* fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
[external/binutils.git] / gold / ChangeLog
1 2010-03-10  Cary Coutant  <ccoutant@google.com>
2
3         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5         (File_read::open[2]): Add whole_file_view_ to list of views.
6         (File_read::make_view): Remove test of whole_file_view_.
7         (File_read::find_or_make_view): Create whole_file_view_ if
8         necessary.
9         (File_read::clear_views): Replace bool parameter with enum;
10         adjust all callers.  Don't delete views with permanent data;
11         do delete cached views and views from archives if
12         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
13         if clearing the corresponding view.
14         * fileread.h (File_read::Clear_views_mode): New enum.
15         (File_read::View::is_permanent_view): New method.
16         (File_read::clear_views): Replace bool parameter
17         with enum; adjust all callers.
18         * options.h (General_options): Change keep_files_mapped option;
19         add map_whole_files.
20         * readsyms.cc (Add_symbols::run): Delete sd_ object before
21         releasing the file.
22         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
23         the file.
24
25 2010-03-10  David S. Miller  <davem@davemloft.net>
26
27         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
28
29 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
30
31         * icf.cc (get_section_contents): Add '@' marker after processing the
32         merge reloc.
33
34 2010-03-08  Doug Kwan  <dougkwan@google.com>
35
36         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
37         due to a conversion warning.
38         (Arm_relobj::update_output_local_symbol_count): Check for local
39         symbol with unset output index.
40
41 2010-03-05  Ian Lance Taylor  <iant@google.com>
42
43         * options.h (class General_options): Add --spare-dynamic-tags.
44         * output.cc (Output_data_dynamic::set_final_data_size): Implement
45         --spare-dynamic-tags.
46
47 2010-03-05  Ian Lance Taylor  <iant@google.com>
48
49         * incremental.cc: Include "libiberty.h".
50
51 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
52
53         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
54         function, is_info_ member.
55         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
56         (Versions::Versions): Update caller.
57         (Versions::define_base_version): Likewise.
58         (Versions::add_def): Likewise.
59
60 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
61
62         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
63         (Scan::possible_function_pointer_reloc): New function.
64         (Scan::local_reloc_may_be_function_pointer): Change to call
65         possible_function_pointer_reloc.
66         (Scan::global_reloc_may_be_function_pointer): Ditto.
67         * icf.h (Icf::check_section_for_function_pointers): Change to reject
68         relocations in ".data.rel.ro._ZTV" section.
69         * testsuite/icf_safe_so_test.sh: Change to pass i386.
70         * testsuite/icf_safe_so_test.cc: Ditto.
71         * testsuite/icf_safe_test.cc: Ditto.
72         * testsuite/icf_safe_test.sh: Ditto.
73
74 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
75             Ian Lance Taylor  <iant@google.com>
76
77         * target-reloc.h (relocate_section): Check the symbol table index
78         for -1U before setting the local symbol index.
79         (scan_relocatable_relocs): If copying the relocation, record that
80         the local symbol is required.
81         * object.h (Symbol_value::is_output_symtab_index_set): New
82         function.
83         (Symbol_value::may_be_discarded_from_output_symtab): New
84         function.
85         (Symbol_value::has_output_symtab_entry): New function.
86         (Symbol_value::needs_output_symtab_entry): Remove.
87         (Symbol_value::output_symtab_index): Make sure the symbol index is
88         set.
89         (Symbol_value::set_output_symtab_index): Make sure the symbol
90         index is not set.  Make sure the new index is valid.
91         (Symbol_value::set_must_have_output_symtab_entry): New function.
92         (Symbol_value::has_output_dynsym_entry): New function.
93         (Symbol_value::set_output_dynsym_index): Make sure the new index
94         is valid.
95         (Sized_relobj::set_must_have_output_symtab_entry): New function.
96         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
97         local symbol if permitted.
98         (Sized_relobj::do_finalize_local_symbols): Call
99         is_output_symtab_index_set rather than needs_output_symtab_entry.
100         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
101         rather than needs_output_symtab_entry.  Call
102         has_output_dynsym_entry rather than needs_output_dynsym_entry.
103         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
104         is_output_symtab_index_set rather than needs_output_symtab_entry.
105         * testsuite/discard_locals_relocatable_test.c: New file.
106         * testsuite/discard_locals_test.sh: Test -r.
107         * testsuite/Makefile.am (check_DATA): Add
108         discard_locals_relocatable_test1.syms,
109         discard_local_relocatable_test2.syms.
110         (MOSTLYCLEANFILES): Likewise.  Also add
111         discard_locals_relocatable_test1.lout and
112         discard_locals_relocatable_test2.out.
113         (discard_locals_relocatable_test1.syms): New target.
114         (discard_locals_relocatable_test.o): New target.
115         (discard_locals_relocatable_test1.out): New target.
116         (discard_locals_relocatable_test2.syms): New target.
117         (discard_locals_relocatable_test2.out): New target.
118         (various): Add missing ../ld-new dependencies.
119         * testsuite/Makefile.in: Rebuild.
120
121 2010-03-03  Nick Clifton  <nickc@redhat.com>
122
123         * po/fi.po: New Finnish translation.
124
125 2010-03-01  Doug Kwan  <dougkwan@google.com>
126
127         * layout.cc (Layout::Layout): Force section types of .init_array*,
128         .preinit_array* and .fini_array* sections.
129         * output.cc (Output_section::Input_section_sort_entry::has_priority):
130         Fix check of return value of std::string::find.().
131         (Output_section::Input_section_sort_compare::operator()): Remove
132         comment about .init_array.
133         (Output_section::Input_section_sort_init_fini_compare::operator()):
134         New method.
135         (Output_section::sort_attached_input_sections): Handle .init_array
136         and .fini_array specially.
137         * output.h (Output_section::Inut_section_sort_compare): Update
138         comment.
139         (Output_section::Input_section_sort_init_fini_compare): New struct.
140
141 2010-02-26  Doug Kwan  <dougkwan@google.com>
142
143         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
144         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
145         * testsuite/debug_msg.sh: Avoid matching source line number for
146         use of global variable undef_int.
147
148 2010-02-26  Doug Kwan  <dougkwan@google.com>
149
150         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
151         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
152         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
153         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
154         * options.cc (General_options::General_options): Initialize member
155         fix_v4bx_.
156         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
157         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
158         and rm_no_fix_v4bx.stdout
159         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
160         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
161         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
162         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
163         and arm_no_fix_v4bx.
164         * Makefile.in: Regenerate.
165         * testsuite/arm_fix_v4bx.s: New file.
166         * testsuite/arm_fix_v4bx.sh: Ditto.
167
168 2010-02-24  Doug Kwan  <dougkwan@google.com>
169
170         * arm.cc (Target_arm::got_section): Make the .got section the first
171         non RELRO section in the data segment.
172         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
173         suffixes of section names.
174
175 2010-02-24  Doug Kwan  <dougkwan@google.com>
176
177         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
178         flags and attributes merging if an input file is a binary file.
179         * fileread.cc (Input_file::open): Record format of original file.
180         * fileread.h (Input_file::Format): New enum type.
181         (Input_file::Input_file): Initialize data member format_.
182         (Input_file::format): New method definition.
183         (Input_file::format_):: New data member.
184
185 2010-02-24  Doug Kwan  <dougkwan@google.com>
186
187         * arm.cc (Arm_output_data_got): New class.
188         (ARM_TCB_SIZE): New constant
189         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
190         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
191         If user uses a script with a SECTIONS clause, issue only a warning
192         for a misplaced EXIDX input section.  Otherwise, issue an error.
193         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
194         garbage collection.
195         (Target_arm::got_mode_index_entry): Handle static linking.
196         (Target_arm::Scan::local): Ditto.
197         (Target_arm::Scan::global): Ditto.
198         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
199         all incorrectly implemented relocations.
200         (Target_arm::fix_exidx_coverage): Pass layout to 
201         Arm_output_section::fix_exidx_coverage.
202         * layout.cc (Layout::section_name_mapping): Remove trailing dots
203         from ".ARM.exidx." and ".ARM.extab.".
204
205 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
206
207         * arm.cc (Target_arm::do_finalize_sections): Create attribute
208         section if it does not already exist.
209         * attributes.cc (Attributes_section_data::Attributes_section_data):
210         Don't crash if size is zero.
211
212 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
213             Ian Lance Taylor  <iant@google.com>
214
215         * gold.cc (queue_middle_tasks): If no input files were opened,
216         exit.
217         * workqueue.h (Task_function::Task_function): Assert that there is
218         a blocker.
219
220 2010-02-22  Doug Kwan  <dougkwan@google.com>
221
222         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
223         * icf.cc (get_section_contents): Cast snprintf arguments to long long
224         types to avoid warnings due to different uint64_t implementations
225         on different hosts.
226
227 2010-02-21  Doug Kwan  <dougkwan@google.com>
228
229         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
230         handling of the maximum backward branch offset.
231         (Arm_relocate_functions::thumb_branch_common): Ditto.
232         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
233         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
234         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout, 
235         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
236         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
237         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
238         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
239         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
240         thumb_bl_out_of_range thumb_bl_out_of_range.o,
241         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
242         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
243         thumb2_bl_out_of_range.o): New rules.
244         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
245         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
246         thumb2_bl_out_of_range
247         * testsuite/Makefile.in: Regenerate.
248         * testsuite/arm_bl_in_range.s: New file.
249         * testsuite/arm_bl_out_of_range.s: Ditto.
250         * testsuite/arm_branch_in_range.sh: Ditto.
251         * testsuite/arm_branch_range.t: Ditto.
252         * testsuite/thumb2_branch_range.t: Ditto.
253         * testsuite/thumb_bl_in_range.s: Ditto.
254         * testsuite/thumb_bl_out_of_range.s: Ditto.
255         * testsuite/thumb_branch_range.t: Ditto.
256
257 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
258
259         * gc.h (gc_process_relocs): Change vectors to point to the new list.
260         Add reloc offset information.
261         * icf.cc (get_section_contents): Change iterators to point to the new
262         vectors. Add reloc offset information to the contents.
263         * icf.h (Icf::Sections_reachable_info): New typedef.
264         (Icf::Sections_reachable_list): New typedef.
265         (Icf::Offset_info): New typedef.
266         (Icf::Reloc_info): New struct typedef.
267         (Icf::Reloc_info_list): New typedef.
268         (Icf::symbol_reloc_list): Delete method.
269         (Icf::addend_reloc_list): Delete method.
270         (Icf::section_reloc_list): Delete method.
271         (Icf::reloc_info_list): New method.
272         (Icf::reloc_info_list_): New member.
273
274 2010-02-19  Doug Kwan  <dougkwan@google.com>
275
276         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
277         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
278         * arm.cc (Arm_relocation_functions): New forward declaration.
279         (Target_arm::Target_arm): Initialize new data members
280         got_mod_index_offset_ and tls_base_symbol_defined_.
281         (Target_arm::Relocate::relocate_tls): New method.
282         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
283          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
284         New methods.
285         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
286         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
287         (Target_arm::got_mod_index_offset_,
288         Target_arm::tls_base_symbol_defined_): New data members.
289         (Target_arm::Scan::local, Target::Scan::global,
290         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
291         relocations.
292
293 2010-02-18  Doug Kwan  <dougkwan@google.com>
294
295         * arm.cc (Arm_relobj::find_linked_text_section): New method.
296         (Arm_relobj::make_exidx_input_section): Pass section index of linked
297         text section as a parameter becuase some broken tools may not set
298         the link in section header.
299         (Target_arm::has_got_section): New method.
300         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
301         without any mapping symbol as data only.  Remove warning.
302         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
303         link in its section header, try to discover the link by inspecting the
304         REL31 relocation at the beginning of the section.
305         (Target_arm::Scan::check_non_pic): Report name of offending relocation
306         in error message.
307         (Target_arm::Scan::global): Treat any reference to the symbol
308         _GLOBAL_OFFSET_TABLE_ as a GOT access.
309
310 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
311
312         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
313         (Scan::global_reloc_may_be_function_pointer): New function.
314         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
315         (Scan::global_reloc_may_be_function_pointer): New function.
316         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
317         (Scan::global_reloc_may_be_function_pointer): New function.
318         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
319         (Scan::global_reloc_may_be_function_pointer): New function.
320         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
321         (Scan::global_reloc_may_be_function_pointer): New function.
322         (Scan::possible_function_pointer_reloc): New function.
323         (Target_x86_64::can_check_for_function_pointers): New function.
324         * gc.h (gc_process_relocs): Scan relocation types to determine if
325         function pointers were taken for targets that support it.
326         * icf.cc (Icf::find_identical_sections): Include functions for
327         folding in safe ICF whose pointer is not taken.
328         * icf.h (Secn_fptr_taken_set): New typedef.
329         (fptr_section_id_): New member.
330         (section_has_function_pointers): New function.
331         (set_section_has_function_pointers): New function.
332         (check_section_for_function_pointers): New function.
333         * options.h: Fix comment for safe ICF option.
334         * target.h (can_check_for_function_pointers): New function.
335         * testsuite/Makefile.am: Add icf_safe_so_test test case.
336         Modify icf_safe_test for X86-64.
337         * testsuite/Makefile.in: Regenerate.
338         * testsuite/icf_safe_so_test.cc: New file.
339         * testsuite/icf_safe_so_test.sh: New file.
340         * testsuite/icf_safe_test.cc (kept_func_3): New function.
341         (main): Change to take pointer to function kept_func_3.
342         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
343         folding is done correctly for X86-64.
344
345 2010-02-12  David S. Miller  <davem@davemloft.net>
346
347         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
348         is_symbolless parameter.
349         (Output_reloc<SHT_REL>::is_symbolless): New.
350         (Output_reloc<SHT_REL>::is_symbolless_): New.
351         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
352         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
353         (Output_reloc<SHT_RELA>::is_symbolless): New.
354         (Output_data_reloc::add_global): Handle is_symbolless.
355         (Output_data_reloc::add_global_relative): Likewise.
356         (Output_data_reloc::add_local): Likewise.
357         (Output_data_reloc::add_local_relative): Likewise.
358         (Output_data_reloc::add_symbolless_global_addend): New.
359         (Output_data_reloc::add_symbolless_local_addend): New.
360         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
361         is_symbolless.
362         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
363         instead of ->is_relative_
364         (Output_reloc::write): Likewise.
365         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
366         (Output_reloc::write_rel): Simplify.
367
368         * sparc.cc (Target_sparc::Scan::local): Use
369         ->add_symbolless_local_addend as needed.
370         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
371         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
372         based upon relocation offset.
373
374 2010-02-11  Doug Kwan  <dougkwan@google.com>
375
376         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
377         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
378         beginning of function.
379         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
380         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
381         parameter is_32bit in calls to should_apply_static_reloc.
382         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
383         (check_DATA): Add arm_abs_global.stdout.
384         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
385         arm_abs_global.stdout): New rules.
386         (MOSTLLYCLEANFILES): Add arm_abs_global
387         * Makefile.in: Regenerate.
388         * testsuite/arm_abs_global.s: New file.
389         * testsuite/arm_abs_global.sh: Ditto.
390         * testsuite/arm_abs_lib.s: Ditto.
391
392 2010-02-11  Ian Lance Taylor  <iant@google.com>
393
394         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
395         Read_relocs task.
396         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
397         Allocate_commons_task first.
398         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
399         task, rather than symtab_lock_.
400         (Gc_process_relocs::~Gc_process_relocs): New function.
401         (Gc_process_relocs::is_runnable): Check this_blocker_.
402         (Gc_process_relocs::locks): Use next_blocker_ rather than
403         blocker_.
404         (Scan_relocs::~Scan_relocs): New function.
405         (Scan_relocs::is_runnable): Check this_blocker_ rather than
406         symtab_lock_.
407         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
408         next_blocker_.
409         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
410         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
411         constructor accordingly.
412         (class Gc_process_relocs): Likewise.
413         (class Scan_relocs): Likewise.
414         * common.h (class Allocate_commons_task): Remove symtab_lock_
415         field, and corresponding constructor parameter.
416         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
417         symtab_lock_.
418         (Allocate_commons_task::locks): Likewise.
419
420 2010-02-11  Ian Lance Taylor  <iant@google.com>
421
422         * gold-threads.h (class Once): Define.
423         (class Initialize_lock): Rewrite as child of Once.
424         * gold-threads.cc (class Once_initialize): Define.
425         (once_pointer_control): New static variable.
426         (once_pointer, once_arg): New static variables.
427         (c_run_once): New static function.
428         (Once::Once, Once::run_once, Once::internal_run): New functions.
429         (class Initialize_lock_once): Remove.
430         (initialize_lock_control): Remove.
431         (initialize_lock_pointer): Remove.
432         (initialize_lock_once): Remove.
433         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
434         (Initialize_lock::initialize): Rewrite.
435         (Initialize_lock::do_run_once): New function.
436         * archive.cc (Archive::interpret_header): Only clear name if it is
437         not already empty.
438         * fileread.cc: Include "gold-threads.h"
439         (file_counts_lock): New static variable.
440         (file_counts_initialize_lock): Likewise.
441         (File_read::release): Only increment counts when using --stats.
442         Use a lock around the increment.
443         * parameters.cc (class Set_parameters_target_once): Define.
444         (set_parameters_target_once): New static variable.
445         (Parameters::Parameters): Move here from parameters.h.
446         (Parameters::set_target): Rewrite.
447         (Parameters::set_target_once): New function.
448         (Parameters::clear_target): Move here and rewrite.
449         * parameters.h (class Parameters): Update declarations.  Add
450         set_parameters_target_once_ field.
451         (Parameters::Parameters): Move to parameters.cc.
452         (Parameters::clear_target): Likewise.
453         * readsyms.cc (Read_symbols::do_group): Create a Start_group
454         task.
455         (Start_group::~Start_group): New function.
456         (Start_group::is_runnable): New function.
457         (Start_group::locks, Start_group::run): New functions.
458         (Finish_group::run): Change saw_undefined to size_t.
459         * readsyms.h (class Start_group): Define.
460         (class Finish_group): Change saw_undefined_ field to size_t.
461         (Finish_group::Finish_group): Remove saw_undefined and
462         this_blocker parameters.  Change all callers.
463         (Finish_group::set_saw_undefined): New function.
464         (Finish_group::set_blocker): New function.
465         * symtab.h (class Symbol_table): Change saw_undefined to return
466         size_t.  Change saw_undefined_ field to size_t.
467         * target-select.cc (Set_target_once::do_run_once): New function.
468         (Target_selector::Target_selector): Initialize set_target_once_
469         field.  Don't initialize lock_ and initialize_lock_ fields.
470         (Target_selector::instantiate_target): Rewrite.
471         (Target_selector::set_target): New function.
472         * target-select.h (class Set_target_once): Define.
473         (class Target_selector): Update declarations.  Make
474         Set_target_once a friend.  Remove lock_ and initialize_lock_
475         fields.  Add set_target_once_ field.
476
477 2010-02-10  Ian Lance Taylor  <iant@google.com>
478
479         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
480         queueing any tasks.
481         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
482         (queue_middle_tasks): Add all blockers before queueing any tasks.
483         (queue_final_tasks): Likewise.
484         * token.h (Task_token::add_blockers): New function.
485         * object.h (Input_objects::number_of_relobjs): New function.
486
487 2010-02-10  Ian Lance Taylor  <iant@google.com>
488
489         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
490         shared, not if not position independent.
491         * x86_64.cc (Relocate::relocate_tls): Likewise.
492         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
493         (tls_pie_pic_test): New target.
494         * testsuite/Makefile.in: Rebuild.
495
496         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
497         (tls_test_main_pie.o, tls_test_pie.o): New targets.
498         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
499         * testsuite/Makefile.in: Rebuild.
500
501 2010-02-09  David S. Miller  <davem@davemloft.net>
502
503         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
504         R_SPARC_RELATIVE using ->add_local_relative().
505         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
506
507         * output.h (Output_data_dynamic::add_section_size): New method
508         that takes two Output_data objects.
509         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
510         entry param.  Handle it in initializers.
511         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
512         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
513         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
514         arg.
515         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
516         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
517         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
518         for dynrel_includes_plt.
519         * i386.cc (Target_i386::do_finalize_sections): Likewise.
520         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
521         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
522         before .rela.plt
523         (Target_sparc::do_finalize_sections): Update to pass true for
524         dynrel_includes_plt.
525         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
526         output before .rela.plt
527         (Target_powerpc::do_finalize_sections): Update to pass true for
528         dynrel_includes_plt when 32-bit.
529
530 2010-02-08  Doug Kwan  <dougkwan@google.com>
531
532         * arm.cc (Arm_relobj::simple_input_section_output_address): New
533         method.
534         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
535         Arm_relobj::scan_section_for_cortex_a8_stubs,
536         Arm_relobj::do_relocation_section): Instead of calling
537         Output_section::output_address, use faster
538         Arm_relobj::simple_input_section_output_address.
539
540 2010-02-08  David S. Miller  <davem@davemloft.net>
541
542         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
543         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
544         relocation helper function.
545
546         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
547         just like R_SPARC_GOT{10,13,22}.
548         (Target_sparc::Scan::local): Likewise.
549         (Target_sparc::Relocate:relocate): Likewise.
550
551 2010-02-06  Ian Lance Taylor  <iant@google.com>
552
553         * configure.ac: Rewrite targetobjs duplicate removal code to use
554         only shell constructs.
555         * configure: Rebuild.
556
557 2010-02-05  Doug Kwan  <dougkwan@google.com>
558
559         PR 11247
560         * arm.cc (Arm_relobj::section_is_scannable): New method.
561         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
562         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
563
564 2010-02-04  Doug Kwan  <dougkwan@google.com>
565
566         PR 11247
567         * arm-reloc-property.cc (cstdio): Include.
568         * configure.ac (targetobjs): Remove duplicates.
569         * configure: Regenerate.
570         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
571         big and little endian version for a given address size.
572
573 2010-02-03  Doug Kwan  <dougkwan@google.com>
574
575         * arm-reloc-property.cc
576         (Arm_reloc_property_table::reloc_name_in_error_message): New method
577         definition.
578         * arm-reloc-property.h
579         (Arm_reloc_property_table::get_implemented_static_reloc_property):
580         New method definition.
581         (Arm_reloc_property_table::reloc_name_in_error_message): New method
582         declaration.
583         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
584         overflow to N.
585         (GOT_PREL): Change implemented to Y.
586         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
587         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
588         (Arm_relocate_functions::movw_abs_nc): Remove method.
589         (Arm_relocate_functions::movt_abs): Ditto.
590         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
591         (Arm_relocate_functions::thm_movt_abs): Ditto.
592         (Arm_relocate_functions::movw_rel_nc): Ditto.
593         (Arm_relocate_functions::movw_rel): Ditto.
594         (Arm_relocate_functions::movt_rel): Ditto.
595         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
596         (Arm_relocate_functions:thm_movw_rel): Ditto.
597         (Arm_relocate_functions:thm_movt_rel): Ditto.
598         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
599         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
600         New method definitions.
601         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
602         (Arm_relocation_functions::arm_grp_ldr): Ditto.
603         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
604         (Arm_relocation_functions::arm_grp_ldc): Ditto.
605         (Target_arm::Relocate::relocate): Check for non-static or
606         unimplemented relocation code and exit early.  Change calls to
607         Target_arm::reloc_uses_thumb_bit and
608         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
609         instead.  Refactor code to handle similar relocations to increase
610         code sharing.  Remove check for unsupported relocation code in switch
611         statement.
612         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
613         relocation property table to find out size.  Change error message to
614         print out the name of a relocation code instead of the numeric value.
615         (Target_arm::scan_reloc_for_stub): Use relocation property table
616         instead of calling Target_arm::reloc_uses_thumb_bit().
617
618 2010-02-02  Doug Kwan  <dougkwan@google.com>
619
620         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
621         types of relaxed input section.
622
623 2010-02-02  Doug Kwan  <dougkwan@google.com>
624
625         * Makefile.am (HFILES): Add arm-reloc-property.h.
626         (DEFFILES): New.
627         (TARGETSOURCES): Add arm-reloc-property.cc
628         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
629         (libgold_a_SOURCES): $(DEFFILES)
630         * Makefile.in: Regenerate.
631         * arm-reloc-property.cc: New file.
632         * arm-reloc-property.h: New file.
633         * arm-reloc.def: New file.
634         * arm.cc: Update comments.
635         (arm-reloc-property.h): New included header.
636         (arm_reloc_property_table): New global variable.
637         (Target_arm::do_select_as_default_target): New method definition.
638         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
639         arm-reloc-property to targ_extra_obj.
640         * parameters.cc (set_parameters_target): Call
641         Target::select_as_default_target().
642         * target.h (Target::select_as_default_target): New method definition.
643         (Target::do_select_as_default_target): Same.
644
645 2010-02-01  Doug Kwan  <dougkwan@google.com>
646
647         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
648         first_output_text_section_.
649         (Arm_exidx_fixup::first_output_text_section): New method definition.
650         (Arm_exidx_fixup::first_output_text_section_): New data member.
651         (Arm_exidx_fixup::process_exidx_section): Record the first text
652         output section seen.
653         (Arm_output_section::fix_exidx_coverage): Set correct linked section
654         and entsize in output section header.
655
656 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
657
658         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
659         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
660         (Arm_relocate_functions::thm_alu11): New Method.
661         (Arm_relocate_functions::thm_pc8): New Method.
662         (Arm_relocate_functions::thm_pc12): New Method.
663         (Target_arm::Scan::local): Handle the relocations.
664         (Target_arm::Scan::global): Likewise.
665         (Target_arm::Relocate::relocate): Likewise.
666         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
667
668 2010-01-29  Doug Kwan  <dougkwan@google.com>
669
670         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
671         of relocation types as ld.
672
673 2010-01-29  Doug Kwan  <dougkwan@google.com>
674
675         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
676         to public.
677         (Arm_relocate_functions::thumb_branch_common): Ditto.
678         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
679         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
680         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
681         Arm_relocate_functions::jump24): Remove.
682         (Target_arm::Relocate::relocate): Adjust code to call
683         Arm_relocation_functions::arm_branch_common and
684         Arm_relocation_functions::thumb_branch_common instead of their removed
685         wrappers.  Merge switch-cases together to reduce source code size.  
686
687 2010-01-29  Doug Kwan  <dougkwan@google.com>
688
689         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
690         output_local_symbol_count_needs_update_.
691         (Arm_relobj::output_local_symbol_count_needs_update,
692          Arm_relobj::set_output_local_symbol_count_needs_update,
693          Arm_relobj::update_output_local_symbol_count): New methods.
694         (Arm_relobj::output_local_symbol_count_needs_update_): New data
695         member.
696         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
697         of pointed function as in a R_ARM_PREL31 relocation.
698         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
699         for output local symbol count updating.
700         (Target_arm::do_relax): Update output local symbol counts in objects
701         if necessary.
702         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
703
704 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
705
706         * arm.cc: Added support for the ARM relocations:
707         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
708         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
709         (Arm_relocate_functions::movw_rel_nc): Renamed (was
710         movw_prel_nc).
711         (Arm_relocate_functions::movw_rel): New method.
712         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
713         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
714         thm_movw_prel_nc).
715         (Arm_relocate_functions::thm_movw_rel): New method.
716         (Arm_relocate_functions::thm_movt_rel): Renamed (was
717         thm_movt_prel).
718         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
719         relocations.
720         (Target_arm::Scan::global): Likewise.
721         (Target_arm::Relocate::relocate): Likewise.
722         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
723         Likewise.
724
725 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
726
727         * arm.cc: Added support for ARM group relocations.
728         (Target_arm::reloc_needs_sym_origin): New method.
729         (Arm_relocate_functions::calc_grp_kn): New method.
730         (Arm_relocate_functions::calc_grp_residual): New method.
731         (Arm_relocate_functions::calc_grp_gn): New method.
732         (Arm_relocate_functions::arm_grp_alu): New Method.
733         (Arm_relocate_functions::arm_grp_ldr): New Method.
734         (Arm_relocate_functions::arm_grp_ldrs): New Method.
735         (Arm_relocate_functions::arm_grp_ldc): New Method.
736         (Target_arm::Scan::local): Handle the ARM group relocations.
737         (Target_arm::Scan::global): Likewise.
738         (Target_arm::Relocate::relocate): Likewise.
739         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
740         Likewise.
741
742 2010-01-26  Doug Kwan  <dougkwan@google.com>
743
744         * arm.cc (set): Include.
745         (class Arm_exidx_fixup): Change type of last_input_section_ to const
746         pointer type.
747         (Arm_output_section::Text_section_list): New type.
748         (Arm_output_section::append_text_sections_to_list): New method.
749         (Arm_output_section::fix_exidx_coverage): Ditto.
750         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
751         (Arm_relobj::convert_input_section_to_relaxed_section): Use
752         Relobj::set_section_offset() instead of
753         Sized_relobj::invalidate_section_offset().
754         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
755         parameter for section headers. Ignore relocation sections for
756         unallocated sections and EXIDX sections.
757         (Target_arm::fix_exidx_coverage): New method.
758         (Target_arm::output_section_address_less_than): New type.
759         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
760         linked text section instead of the EXIDX section.
761         (Arm_output_section::create_stub_group): Add an assertion to check
762         that this is not an EXIDX output section.
763         (Arm_output_section::append_text_sections_to_list): New method.
764         (Arm_output_section::fix_exidx_coverage): Ditto.
765         (Arm_relobj::scan_sections_for_stubs): Adjust call to
766         Arm_relobj::section_needs_reloc_stub_scanning.
767         (Target_arm::do_relax): Fix EXIDX output section coverage in the
768         first pass.
769         (Target_arm::fix_exidx_coverage): New method.
770         * object.h (Relobj::set_output_section): New method.
771         (Sized_relobj::invalidate_section_offset): Remove method.
772         (Sized_relobj::do_invalidate_section_offset): Remove method.
773         (Sized_relobj::do_set_section_offset): Handle offset value -1.
774
775 2010-01-25  Doug Kwan  <dougkwan@google.com>
776
777         * arm.cc (Arm_exidx_merged_section::do_output_offset):
778         Fix warning due to signed and unsigned comparison on a 32-bit host.
779
780 2010-01-22  Doug Kwan  <dougkwan@google.com>
781
782         * arm.cc (Target_arm::do_relax): Record an output section for section
783         offset adjustment it contains any stub table that has changed.
784         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
785         offsets in an output section if necessary.
786         * output.cc (Output_section::Output_section): Initialize
787         section_offsets_need_adjustments_.
788         (Output_section::add_input_section_for_script): Renamed to
789         Output_section::add_simple_input_section.
790         (Output_section::save_states): Add a comment.
791         (Output_section::discard_states): New method defintion.
792         (Output_section::adjust_section_offsets): Same.
793         * output.h (Output_section::add_input_section_for_script): Renamed to
794         Output_section::add_simple_input_section.
795         (Output_section::discard_states): New method declaration.
796         (Output_section::adjust_section_offsets): Same.
797         (Output_section::section_offsets_need_adjustment,
798         Output_section::set_section_offsets_need_adjustment): New method
799         definitions.
800         (Output_section::section_offsets_need_adjustment_): New data member.
801         * script-sections.cc
802         (Output_section_element_input::set_section_address): Adjust code for
803         renaming of Output_section::add_input_section_for_script.
804         (Orphan_output_section::set_section_address): Same.
805
806 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
807
808         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
809         Fix_v4bx enum values .
810         * gold/options.h (General_options): New option definitions.
811         (General_options::fix_v4bx): New method.
812         (General_options::Fix_v4bx): New enum.
813         * gold/options.cc (General_options::parse_fix_v4bx): New method.
814         (General_options::parse_fix_v4bx_interworking): New method.
815
816 2010-01-22  Doug Kwan  <dougkwan@google.com>
817
818         * arm.cc (Arm_exidx_fixup): New class.
819
820 2010-01-21  Doug Kwan  <dougkwan@google.com>
821
822         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
823         classes.
824         (Arm_exidx_section_offset_map): New type.
825
826 2010-01-21  Doug Kwan  <dougkwan@google.com>
827
828         * arm.cc (Arm_exidx_input_section): New class.
829         (Arm_relobj::exidx_input_section_by_link,
830         Arm_relobj::exidx_input_section_by_shndx,
831         Arm_relobj::make_exidx_input_section): New methods.
832         (read_arm_attributes_section): Remove.
833         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
834         information about them.
835         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
836         to here.
837
838 2010-01-20  Doug Kwan  <dougkwan@google.com>
839
840         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
841         Input_section_specifier to Section_id.
842         (Target_arm::new_arm_input_section: Adjust code for change of key
843         type.
844         (Target_arm::find_arm_input_section): Ditto.
845         * gc.h (object.h): Include for Section_id nand Section_id_hash.
846         (Section_id): Remove.
847         (Garbage_collection::Section_id_hash): Remove.
848         * icf.h (object.h): Include for Section_id nand Section_id_hash.
849         (Section_id): Remove.
850         (Icf::Section_id_hash): Remove.
851         * object.h (Section_id, Const_section_id, Section_id_hash,
852         Const_section_id_hash): New type definitions.
853         * output.cc (Output_section::add_relaxed_input_section): Change to
854         use Const_section_id instead of Input_section_specifier as key type.
855         (Output_section::add_merge_input_section): Ditto.
856         (Output_section::build_relaxation_map): Change to use Section_id
857         instead of Input_section_specifier as key type.
858         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
859         Ditto.
860         (Output_section::convert_input_sections_to_relaxed_sections): Change
861         to use Const_section_id instead of Input_section_specifier as key type.
862         (Output_section::find_merge_section): Ditto.
863         (Output_section::find_relaxed_input_section): Ditto.
864         * output.h (Input_section_specifier): Remove class.
865         (Output_section::Output_section_data_by_input_section_map): Change
866         key type to Const_section_id.
867         (Output_section::Output_relaxed_input_section_by_input_section_map):
868         Ditto.
869         (Output_section::Relaxation_map): Change key type to Section_id.
870
871 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
872
873         * gold/arm.cc: Added support for R_ARM_V4BX relocation
874         (class Arm_v4bx_stub): New class.
875         (DEF_STUBS): Updated definition to support v4_veneer_bx.
876         (Stub_factory::make_arm_v4bx_stub): New method.
877         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
878         (Stub_table::empty): Handle v4bx stubs.
879         (Stub_table::add_arm_v4bx_stub): New method.
880         (Stub_table::find_arm_v4bx_stub): New method.
881         (Arm_relocate_functions::v4bx): New method.
882         (Target_arm::fix_v4bx): New method.
883         (Target_arm::Target_arm): Handle R_ARM_V4BX.
884         (Stub_table::relocate_stubs): Likewise.
885         (Stub_table::do_write): Likewise.
886         (Stub_table::update_data_size_and_addralign): Likewise.
887         (Stub_table::finalize_stubs):  Likewise.
888         (Target_arm::Scan::local): Likewise.
889         (Target_arm::Scan::global): Likewise.
890         (Target_arm::do_finalize_sections): Likewise.
891         (Target_arm::Relocate::relocate): Likewise.
892         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
893         Likewise.
894         (Target_arm::scan_reloc_for_stub): Likewise.
895         (Target_arm::scan_reloc_section_for_stubs): Likewise.
896
897 2010-01-19  Ian Lance Taylor  <iant@google.com>
898
899         * output.cc (Output_section_headers::do_sized_write): Write large
900         segment count to sh_info field.
901         (Output_file_header::do_sized_write): For large segment count,
902         write PN_XNUM to e_phnum field.
903
904 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
905
906         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
907         (Arm_relocate_functions::thm_jump8): New function.
908         (Arm_relocate_functions::thm_jump11): New function.
909         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
910         R_ARM_THM_JUMP11.
911         (Target_arm::Scan::global): Likewise.
912         (Target_arm::Relocate::relocate): Likewise.
913         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
914         Likewise.
915
916 2010-01-14  Doug Kwan  <dougkwan@google.com>
917
918         * arm.cc (map, utility): Include headers.
919         (Target_arm::apply_cortex_a8_workaround): New method.
920         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
921         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
922         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
923         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
924         the --[no-]fix-cortex-a8 command line options.
925         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
926         (Target_arm::relocate_stub): Use addend in instruction template.
927         * options.h (DEFINE_bool): Set the user-set flag.
928         (General_options): Add --[no-]-fix-cortex options.
929         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
930         : Update fast look-up map after conversion. 
931
932 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
933
934         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
935         in the first pass of do_layout.
936
937 2010-01-13  Doug Kwan  <dougkwan@google.com>
938
939         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
940         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
941         apparent compiler problem of not folding static constant integral
942         data members of elfcpp::Elf_sizes<32>.
943
944 2010-01-13  Doug Kwan  <dougkwan@google.com>
945
946         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
947         Arm_relobj::section_needs_cortex_a8_stub_scanning,
948         Arm_relobj::scan_section_for_cortex_a8_erratum,
949         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
950         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
951         sections to scan for relocation stubs into a new method
952         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
953         relocation and Cortex-A8 stub scanning.
954         (Target_arm::do_relax): Force stubs to be after stubbed sections
955         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
956         the beginning of a new relaxation pass.  Update a comment. 
957         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
958
959 2010-01-12  Ian Lance Taylor  <iant@google.com>
960
961         * target-reloc.h (visibility_error): New inline function.
962         (relocate_section): Call visibility_error.
963         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
964         (MOSTLYCLEANFILES): Likewise.
965         (protected_4_pic.o, protected_3.err): New targets.
966         * testsuite/protected_4.cc: New file.
967
968 2010-01-12  Doug Kwan  <dougkwan@google.com>
969
970         * arm.cc (Cortex_a8_reloc): New class.
971         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
972         and cortex_a8_relocs_info_.
973         (Target_arm::fix_cortex_a8): New method definition.
974         (Target_arm::Cortex_a8_relocs_info): New type.
975         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
976         New data member declarations.
977         (Target_arm::scan_reloc_for_stub): Record information about
978         relocations for THUMB branches that might be exempted from the
979         Cortex-A8 workaround.
980         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
981         at the beginning of a relaxation pass.
982
983 2010-01-12  Doug Kwan  <dougkwan@google.com>
984
985         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
986         (Arm_relobj::Mapping_symbol_position,
987          Arm_reloj::Mapping_symbol_position_less,
988          Arm_relobj::Mapping_symbols_info): New types.
989         (Target_arm::is_mapping_symbol_name): New method definition.
990         (Arm_relobj::do_count_local_symbols): Save information about mapping
991         symbols.
992
993 2010-01-11  Doug Kwan  <dougkwan@google.com>
994
995         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
996         Arm_relocate_functions::thumb32_branch_upper,
997         Arm_relocate_functions::thumb32_branch_lower,
998         Arm_relocate_functions::thumb32_cond_branch_offset,
999         Arm_relocate_functions::thumb32_cond_branch_upper,
1000         Arm_relocate_functions::thumb32_cond_branch_lower,
1001         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
1002         branch offset encoding.
1003         (Arm_relocate_functions::thumb_branch_common): Use new branch
1004         offset encoding methods to avoid code duplication.
1005         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
1006         (Stub_addend_reader::operator()): Use new branch encoding method
1007         to avoid code duplication.
1008
1009 2010-01-11  Doug Kwan  <dougkwan@google.com>
1010
1011         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
1012         (Target_arm::do_finalize_sections): Define special EXIDX section
1013         symbols only if referenced.
1014         * gc.h (Garbage_collection::add_reference): New method.
1015         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
1016         code duplication.
1017
1018 2010-01-11  Ian Lance Taylor  <iant@google.com>
1019
1020         * script.cc (Version_script_info::build_expression_list_lookup):
1021         Change complaing about duplicate wildcard match from error to
1022         warning.
1023
1024         * script.cc (class Lazy_demangler): Recreate--revert part of patch
1025         of 2009-12-30.
1026         (Version_script_info::Version_script_info): Initialize globs_,
1027         default_version_, default_is_global_, and exact_.  Don't
1028         initialize globals_ or locals_.
1029         (Version_script_info::build_lookup_tables): Build local symbols
1030         first.
1031         (Version_script_info::unquote): New function.
1032         (Version_script_info::add_exact_match): New function.
1033         (Version_script_info::build_expression_list_lookup): Remove lookup
1034         parameter.  Add is_global parameter.  Change all callers.  Handle
1035         wildcard pattern specially.  Unquote pattern.  Call
1036         add_exact_match.
1037         (Version_script_info::get_name_to_match): New function.
1038         (Version_script_info::get_symbol_version): New function.
1039         (Version_script_info::get_symbol_version_helper): Remove.
1040         (Version_script_info::check_unmatched_names): Call unquote.
1041         * script.h (class Version_script_info): Change get_symbol_version
1042         to be non-inline and add is_global parameter; change all callers.
1043         Rewrite symbol_is_local.  Update declarations.  Define struct
1044         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
1045         Remove globals_ and locals_ members.  Add exact_, globs_,
1046         default_version_, is_global_.
1047         (Version_script_info::Glob): Remove pattern, add expression and
1048         is_global.  Update constructor.  Change all callers.
1049         * dynobj.cc (Versions::finalize): Mark the version symbol as the
1050         default version.
1051         (Versions::symbol_section_contents): If a symbol is undefined, or
1052         defined in a dynamic object, set the version index to
1053         VER_NDX_LOCAL.
1054         * symtab.cc (Symbol_table::add_from_relobj): Don't call
1055         symbol_is_local.
1056         (Symbol_table::add_from_pluginobj): Likewise.
1057         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
1058
1059 2010-01-11  Doug Kwan  <dougkwan@google.com>
1060
1061         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
1062         (incremental_dump_LDADD): Add linking option for libintl.
1063         * Makefile.in: Regenerate.
1064
1065 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1066
1067         PR gold/11144
1068         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
1069         instead of -Ds.
1070         * testsuite/Makefile.in: Regenerated.
1071
1072 2010-01-10  Doug Kwan  <dougkwan@google.com>
1073
1074         * options.h (DEFINE_var): Use parentheses around argument varname__
1075         in macro body to avoid any unintended subsequent substitutions.
1076
1077 2010-01-10  Ian Lance Taylor  <iant@google.com>
1078
1079         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
1080         candidates before doing symbol resolution.
1081
1082         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
1083         ODR candidates if only one is weak.
1084
1085 2010-01-08  Ian Lance Taylor  <iant@google.com>
1086
1087         * script.cc (Version_script_info::build_expression_list_lookup):
1088         Don't warn about ambiguous version, just record the ambiguity.
1089         (Version_script_info::get_symbol_version_helper): Give error if
1090         version is ambiguous.
1091
1092 2010-01-08  Doug Kwan  <dougkwan@google.com>
1093
1094         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
1095           prev_data_size_ and prev_addralign_.  Remove initializer for
1096           deleted data member has_been_changed_.
1097           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
1098           to determine if the table is empty.
1099           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
1100           Remove.
1101           (Stub_table::add_reloc_stub): Define method in class definition
1102           instead of just declaring it there.
1103           (Stub_table::add_cortex_a8_stub): New method definition.
1104           (Stub_table::update_data_size_and_addralign): Ditto.
1105           (Stub_table::finalize_stubs): Ditto.
1106           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
1107           (Stub_table::do_addralign_): Return address alignment in the
1108           (Stub_table::do_reset_address_and_file_offset): Define method in
1109           class definition instead of declaring it there.  Set current data
1110           size to be the data size of the previous pass.
1111           (Stub_table::set_final_data_size): Use current data size as the
1112           final data size.
1113           (Stub_table::relocate_stub): Change parameter type of stub from
1114           Reloc_stub pointer to Stub pointer.
1115           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
1116           (Stub_table::Cortex_a8_stub_list): New typedef.
1117           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
1118            Stub_table::prev_addralign_): New data member.
1119           (Arm_relobj::Arm_relobj): Initialize data member
1120           section_has_cortex_a8_workaround_.
1121           (Arm_relobj::section_has_cortex_a8_workaround,
1122            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
1123            definitions.
1124           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
1125           declarations.
1126           (Target_arm::relocate_stub): Change parameter type of stub from
1127           Reloc_stub pointer to Stub pointer.
1128           (Insn_template::size, Insn_template::alignment): Handle
1129           THUMB16_SPECIAL_TYPE.
1130           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
1131            Stub_table::update_data_size_and_addralign,
1132            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
1133           definitions.
1134           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
1135           (Stub_table::do_write): Ditto.
1136           (Target_arm::do_relax): Adjust code for changes in Stub_table.
1137
1138 2010-01-08  Ian Lance Taylor  <iant@google.com>
1139
1140         PR 11108
1141         * symtab.h (class Symbol): Remove fields is_target_special_ and
1142         has_plt_offset_.  Add field is_defined_in_discarded_section_.
1143         (Symbol::is_defined_in_discarded_section): New function.
1144         (Symbol::set_is_defined_in_discarded_section): New function.
1145         (Symbol::has_plt_offset): Rewrite.
1146         (Symbol::set_plt_offset): Verify that new offset is not -1U.
1147         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
1148         Don't initialize is_target_special_ or has_plt_offset_.
1149         Initialize is_defined_in_discarded_section_.
1150         (Symbol_table::add_from_relobj): If appropriate, set
1151         is_defined_in_discarded_section.
1152         * resolve.cc (Symbol::override_base_with_special): Don't test
1153         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
1154         * target-reloc.h (relocate_section): Do special handling for
1155         symbols defined in discarded sections for global symbols as well
1156         as local symbols.
1157
1158 2010-01-08  Ian Lance Taylor  <iant@google.com>
1159
1160         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
1161         the SHT_SYMTAB case.
1162
1163 2010-01-08  Ian Lance Taylor  <iant@google.com>
1164
1165         * object.cc (Sized_relobj::do_layout): Don't get confused if
1166         layout_eh_frame returns NULL.
1167
1168 2010-01-08  Ian Lance Taylor  <iant@google.com>
1169
1170         PR 11084
1171         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
1172         dynamic symbol table, use the normal symbol table.
1173         (Sized_dynobj::do_read_symbols): Remove assertion about type of
1174         symbol table.
1175
1176 2010-01-08  Ian Lance Taylor  <iant@google.com>
1177
1178         PR 11072
1179         * layout.cc (Layout::include_section): Remove .gnu_debuglink
1180         sections.
1181
1182 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1183
1184         * version.cc (print_version): Change to "Copyright 2010".
1185
1186 2010-01-08  Ian Lance Taylor  <iant@google.com>
1187
1188         PR 10287
1189         PR 11063
1190         * i386.cc (class Target_i386): Change return type of plt_section
1191         to be non-const.
1192         (class Output_data_plt_i386): Add tls_desc_rel_ field.
1193         (Output_data_plt_i386::Output_data_plt_i386): Initialize
1194         tls_desc_rel_ field.
1195         (Output_data_plt_i386::rel_tls_desc): New function.
1196         (Target_i386::rel_tls_desc_section): New function.
1197         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
1198         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
1199         R_386_TLS_DESC reloc in rel_tls_desc_section.
1200         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
1201         Define struct Tlsdesc_info.
1202         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
1203         (Target_x86_64::do_reloc_symbol_index): New function.
1204         (Target_x86_64::add_tlsdesc_info): New function.
1205         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
1206         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
1207         tlsdesc_rel_ field.
1208         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
1209         all callers.
1210         (Output_data_plt_x86_64::rela_tlsdesc): New function.
1211         (Target_x86_64::rela_tlsdesc_section): New function.
1212         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
1213         handling.
1214         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
1215         (Target_x86_64::do_reloc_addend): New function.
1216         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
1217         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
1218         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
1219         (Output_reloc::type): New function.
1220         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
1221         (Output_reloc::is_target_specific): New function.
1222         (Output_reloc::target_arg): New function.
1223         (class Output_reloc) [SHT_RELA]: Add four new constructors for
1224         absolute relocs and target specific relocs.
1225         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
1226         add_target_specific.
1227         (class Output_data_reloc) [SHT_RELA]: Likewise.
1228         * output.cc (Output_reloc::Output_reloc): Add four new versions
1229         for absolute relocs and target specific relocs.
1230         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
1231         (Output_reloc::get_symbol_index): Likewise.
1232         (Output_reloc::local_section_offset): Check that local_sym_index_
1233         is not TARGET_CODE or 0.
1234         (Output_reloc::symbol_value): Likewise.
1235         (Output_reloc::write) [SHT_RELA]: Call target for target specific
1236         reloc.
1237         * target.h (class Target): Add reloc_symbol_index and reloc_addend
1238         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
1239         functions.
1240         * layout.cc (add_target_dynamic_tags): Use output section for
1241         DT_PLTRELSZ and DT_JMPREL.
1242
1243 2010-01-07  Ian Lance Taylor  <iant@google.com>
1244
1245         PR 11061
1246         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
1247         function.
1248         (class Output_data_reloc_generic): Define.
1249         (class Output_data_reloc_base): Change base class to
1250         Output_data_reloc_generic.  Change add() method to call
1251         bump_relative_reloc_count for a relative reloc.  Remove
1252         sort_relocs_ field.
1253         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
1254         to sort_relocs().
1255         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
1256         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
1257         appropriate.
1258         * layout.h (class Layout): Update declaration.
1259
1260 2010-01-07  Ian Lance Taylor  <iant@google.com>
1261
1262         * output.h (class Output_data): Add const version of
1263         output_section and do_output_section.
1264         (class Output_section_data): Add const version of
1265         do_output_section.
1266         (class Output_section): Likewise.
1267         * layout.cc (Layout::add_target_dynamic_tags): New function.
1268         * layout.h (class Layout): Update declarations.
1269         * arm.cc (Target_arm::do_finalize_sections): Use
1270         add_target_dynamic_tags.
1271         * i386.cc (Target_i386::do_finalize_sections): Likewise.
1272         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1273         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1274         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1275
1276 2010-01-07  Ian Lance Taylor  <iant@google.com>
1277
1278         PR 11042
1279         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
1280         object as needed.
1281
1282 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
1283             Ian Lance Taylor  <iant@google.com>
1284
1285         PR 11019
1286         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
1287         Xindex::read_symtab_xindex.
1288
1289 2010-01-07  Doug Kwan  <dougkwan@google.com>
1290
1291         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
1292         (Insn_template::thumb16_bcond_insn): New method declaration.
1293         (Insn_template): Fix spelling.
1294         (Stub::thumb16_special): New method declaration.
1295         (Stub::do_write): Define virtual method which was previously pure
1296         virtual.
1297         (Stub::do_thumb16_special): New method declaration.
1298         (Stub::do_fixed_endian_write): New template member.
1299         (Reloc_stub::do_write): Remove.
1300         (Reloc_stub::do_fixed_endian_write): Remove.
1301         (Cortex_a8_stub): New class definition.
1302         (Stub_factory::make_cortex_a8_stub): New method definition.
1303         (Stub_factory::Stub_factory): Add missing static storage class
1304         qualifier for elf32_arm_stub_a8_veneer_blx.
1305
1306 2010-01-07  Ian Lance Taylor  <iant@google.com>
1307
1308         PR 10980
1309         * options.h (class General_options): Add --warn-unresolved-symbols
1310         and --error-unresolved-symbols.
1311         * errors.cc (Errors::undefined_symbol): Implement
1312         --warn-unresolved-symbols.
1313
1314         * options.h (class General_options): Add -z text and -z textoff.
1315         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
1316
1317 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
1318
1319         * gc.h (Garbage_collection::Cident_section_map): New typedef.
1320         (Garbage_collection::cident_sections): New function.
1321         (Garbage_collection::add_cident_section): New function.
1322         (Garbage_collection::cident_sections_): New member.
1323         (gc_process_relocs): Add references to sections whose names are C
1324         identifiers.
1325         * gold.h (cident_section_start_prefix): New constant.
1326         (cident_section_stop_prefix): New constant.
1327         (is_cident): New function.
1328         * layout.cc (Layout::define_section_symbols): Replace string constants
1329         with the newly defined constants.
1330         * object.cc (Sized_relobj::do_layout): Track sections whose names are
1331         C identifiers.
1332         * testsuite/Makefile.am: Add gc_orphan_section_test.
1333         * testsuite/Makefile.in: Regenerate.
1334         * testsuite/gc_orphan_section_test.cc: New file.
1335         * testsuite/gc_orphan_section_test.sh: New file.
1336
1337 2010-01-06  Ian Lance Taylor  <iant@google.com>
1338
1339         PR 10980
1340         * options.h (class General_options): Add --warn-shared-textrel.
1341         * layout.cc (Layout::finish_dynamic_section): Implement
1342         --warn-shared-textrel.
1343
1344         PR 10980
1345         * options.h (class General_options): Add --warn-multiple-gp.
1346
1347 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1348
1349         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
1350         $(THREADSLIB) and $(LIBDL).
1351         * Makefile.in: Rebuild.
1352
1353 2010-01-06  Ian Lance Taylor  <iant@google.com>
1354
1355         PR 10980
1356         * options.cc (General_options::parse_section_start): New function.
1357         (General_options::section_start): New function.
1358         (General_options::General_options): Initialize all members.
1359         * options.h: Include <map>
1360         (class General_options): Add --section-start.  Add section_starts_
1361         member.
1362         * layout.cc (Layout::attach_allocated_section_to_segment): If
1363         --section-start was used, set the address of the segment.  Remove
1364         local sort_sections.
1365         (Layout::relaxation_loop_body): If the address of the load segment
1366         has been set by --section-start, don't use it.
1367         * output.h (Output_segment::update_flags_for_output_section): New
1368         function.
1369         * output.cc (Output_segment::add_output_section): Call
1370         update_flags_for_output_section.
1371
1372 2010-01-05  Ian Lance Taylor  <iant@google.com>
1373
1374         PR 10980
1375         * options.h (class General_options): Add --undefined-version.
1376         * script.cc (struct Version_expression): Add was_matched_by_symbol
1377         field.
1378         (Version_script_info::matched_symbol): New function.
1379         (Version_script_info::get_symbol_version_helper): Call
1380         matched_symbol.
1381         (Version_script_info::check_unmatched_names): New function.
1382         * script.h (class Version_script_info): Update declarations.
1383         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
1384
1385         * options.h (class General_options): Use DEFINE_bool_alias for
1386         allow_multiple_definition.
1387         * resolve.cc (Symbol_table::should_override): Don't test
1388         allow_multiple_definition.
1389
1390         PR 10980
1391         * options.h (class General_options): Add --cref.
1392         * main.cc (main): Print cref table if --cref.  Don't close mapfile
1393         until after printing cref table.
1394         * cref.cc: Include "symtab.h".
1395         (class Cref_inputs): Define Cref_table_compare and Cref_table.
1396         (Cref_table_compare::operator()): New function.
1397         (Cref_inputs::gather_cref): New function.
1398         (filecol): New static const.
1399         (Cref_inputs::print_cref): New function.
1400         (Cref::print_cref): New function.
1401         * cref.h: Include <cstdio>.
1402         (class Cref): Update declarations.
1403         * mapfile.h (Mapfile::file): New function.
1404         * object.h (class Object): Define Symbols.  Declare virtual
1405         do_get_global_symbols.
1406         (Object::get_global_symbols): New function.
1407         * object.cc (Input_objects::add_object): Pass object to cref_ if
1408         --cref.
1409         (Input_objects::archive_start): Likewise.
1410         (Input_objects::archive_stop): Likewise.
1411         (Input_objects::print_cref): New function.
1412         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
1413         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
1414         --cref.
1415         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
1416         function.
1417         * plugin.h (class Sized_pluginobj): Update declarations.
1418
1419 2010-01-05  Ian Lance Taylor  <iant@google.com>
1420
1421         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
1422         to is_default_version.  Rename insdef to insdefault.
1423         (Symbol_table::add_from_relobj): Rename def to is_default_version
1424         and local to is_forced_local.
1425         (Symbol_table::add_from_pluginobj): Likewise.
1426         (Symbol_table::add_from_dynobj): Likewise.
1427         (Symbol_table::define_special_symbol): Rename insdef to
1428         insdefault.
1429
1430 2010-01-04  Ian Lance Taylor  <iant@google.com>
1431
1432         PR 10980
1433         * options.h (class General_options): Add
1434         --allow-multiple-definition and -z muldefs.
1435         * resolve.cc (Symbol_table::should_override): Don't warn about a
1436         multiple symbol definition if --allow-multiple-definition or -z
1437         muldefs.
1438
1439         PR 10980
1440         * options.h (class General_options): Add --add-needed and
1441         --copy-dt-needed-entries.  Tweak --as-needed help entry.
1442         * object.cc (Input_objects::check_dynamic_dependencies): Give an
1443         error if --copy-dt-needed-entries aka --add-needed is used and
1444         would cause a change in behaviour.
1445
1446         PR 10980
1447         * options.h (class General_options): Add -G as a short version of
1448         --shared.  Add no-op options -assert, -g, and -i.
1449
1450 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
1451
1452         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
1453         check for .text or .gnu.linkonce.t sections.
1454         * icf.cc (Icf::find_identical_sections): Ditto.
1455         Change the detection for mangled function name within the section
1456         name.
1457         * icf.h (is_section_foldable_candidate): New function.
1458
1459 2009-12-30  Ian Lance Taylor  <iant@google.com>
1460
1461         PR 10980
1462         * options.h (class General_options): Permit two dashes with
1463         --retain-symbols-file.
1464
1465 2009-12-30  Ian Lance Taylor  <iant@google.com>
1466
1467         PR 10979
1468         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
1469         don't put the file header and segment headers in the text
1470         segment.
1471
1472         PR 10979
1473         * common.cc (Sort_commons::operator()): Stabilize sort when both
1474         entries are NULL.
1475         (Symbol_table::do_allocate_commons_list): When allocating common
1476         symbols, skip a symbol which is no longer common.
1477         * symtab.h (Symbol::is_common): Test whether the symbol comes from
1478         an object before checking its type.
1479         * testsuite/common_test_2.c: New file.
1480         * testsuite/common_test_3.c: New file.
1481         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
1482         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
1483         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
1484         (common_test_2_pic.o, common_test_2.so): New targets.
1485         (common_test_3_pic.o, common_test_3.so): New targets.
1486         * testsuite/Makefile.in: Rebuild.
1487
1488         PR 10979
1489         * script.cc (read_input_script): If we see a new SECTIONS clause,
1490         and we have added an input section, give an error.
1491         * layout.h (class Layout): Add have_added_input_section function.
1492         Add have_added_input_section_ field.
1493         * layout.cc (Layout::Layout): Initialize
1494         have_added_input_section_.
1495         (Layout::layout): Set have_added_input_section_.
1496         (Layout::layout_eh_frame): Likewise.
1497
1498 2009-12-30  Ian Lance Taylor  <iant@google.com>
1499
1500         PR 10931
1501         * options.h (class General_options): Add --sort-common option.
1502         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
1503         * common.cc (Sort_common): Add sort_order parameter to
1504         constructor.  Add sort_order_ field.
1505         (Sort_commons::operator): Check sort_order_.
1506         (Symbol_table::allocate_commons): Determine the sort order.
1507         (Symbol_table::do_allocate_commons): Add sort_order parameter.
1508         Change all callers.
1509         (Symbol_table::do_allocate_commons_list): Likewise.
1510
1511 2009-12-30  Ian Lance Taylor  <iant@google.com>
1512
1513         PR 10916
1514         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
1515         symbols from this object, don't change the visibility of an
1516         undefined symbol.
1517         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
1518
1519 2009-12-30  Ian Lance Taylor  <iant@google.com>
1520
1521         PR 10861
1522         * script.h (class Version_script_info): Define Language enum.
1523         Update declarations.  Define Glob, Exact, and Lookup types.  Add
1524         new fields globals_, locals_, and is_finalized_.
1525         * script.cc: Various formatting fixes.
1526         (class Parser_closure): Change language_stack_ from a vector of
1527         std::string to one of Version_script_info::Language.  Adjust all
1528         uses accordingly.
1529         (class Lazy_demangler): Remove.
1530         (struct Version_expression): Change language from std::string to
1531         Version_script_info::Language.
1532         (Version_script_info::Version_script_info): New function.
1533         (Version_script_info::~Version_script_info): Don't call clear.
1534         (Version_script_info::finalize): New function.
1535         (Version_script_info::build_lookup_tables): New function.
1536         (Version_script_info::build_expression_list_lookup): New
1537         function.
1538         (Version_script_info::get_symbol_version_helper): Rewrite to use
1539         lookup tables.
1540         (Version_script_info::print_expression_list): Adjust to use
1541         Version_script_info::Language.
1542         (script_push_lex_into_version_mode): Check that the version script
1543         has not been finalized.
1544         (version_script_push_lang): Change language string to
1545         Version_script_info::Language.
1546         * options.cc (Command_line::version_script): New function.
1547         * options.h (class General_options): Add finalize_dynamic_list
1548         function.  Change version_script from declaration to definition.
1549         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
1550         * testsuite/version_script.map: Remove duplicate def of foo.
1551         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
1552         version_script.map.
1553         * testsuite/Makefile.in: Rebuild.
1554
1555 2009-12-30  Ian Lance Taylor  <iant@google.com>
1556
1557         PR 10843
1558         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
1559         if the input symbol index is 0, make the output symbol index 0.
1560
1561 2009-12-30  Ian Lance Taylor  <iant@google.com>
1562
1563         PR 10670
1564         * options.h (class General_options): Add -x/--discard-all.
1565         * object.cc (Sized_relobj::do_count_local_symbols): Handle
1566         --discard-all.  If the local symbol needs a dynamic entry, check
1567         that before handling --discard-locals.
1568
1569 2009-12-30  Ian Lance Taylor  <iant@google.com>
1570
1571         PR 10450
1572         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
1573         flags to PF_R.
1574         (Output_segment::add_output_section): Don't change the flags if
1575         the type is PT_TLS.
1576
1577         PR 10450
1578         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
1579         GNU hash table if they need a dynamic value.  Otherwise, don't add
1580         them if they are defined in a dynamic object or are forced local.
1581
1582 2009-12-29  Ian Lance Taylor  <iant@google.com>
1583
1584         PR 10450
1585         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
1586         .gnu.hash table for a 32-bit target.
1587
1588         PR 10450
1589         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
1590         regular and a dynamic object only needs a dynamic symbol table
1591         entry if it is externally visible.
1592
1593         PR 10450
1594         * i386.cc (class Target_i386): Initialize global_offset_table_ in
1595         constructor.  Add global_offset_table_ field.
1596         (Target_i386::got_section): Set global_offset_table_.
1597         (Target_i386::do_finalize_sections): Set global_offset_table_
1598         size.
1599         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
1600         in constructor.  Add global_offset_table_ field.
1601         (Target_x86_64::got_section): Set global_offset_table_.
1602         (Target_x86_64::do_finalize_sections): Set global_offset_table_
1603         size.
1604
1605         * layout.cc (Layout::Layout): Initialize increase_relro_.
1606         (Layout::get_output_section): Add is_relro, is_last_relro, and
1607         is_first_non_relro parameters.  Change all callers.
1608         (Layout::choose_output_section): Likewise.
1609         (Layout::add_output_section_data): Likewise.
1610         (Layout::make_output_section): Likewise.
1611         (Layout::set_segment_offsets): Clear increase_relro when using a
1612         linker script.
1613         * layout.h (class Layout): Add increase_relro method.  Add
1614         increase_relro_ field.  Update declarations.
1615         * output.cc (Output_section::Output_section): Initialize
1616         is_last_relro_ and is_first_non_relro_.
1617         (Output_segment::add_output_section): Group relro sections is
1618         do_sort is true.  Handle is_last_relro and is_first_non_relro.
1619         (Output_segment::maximum_alignment): Remove relro handling.
1620         (Output_segment::set_section_addresses): Add increase_relro
1621         parameter.  Change all callers.  Add initial alignment to align
1622         relro sections on separate page.  Remove old relro handling.
1623         (Output_segment::set_section_list_addresses): Remove in_relro
1624         parameter.  Change all callers.
1625         (Output_segment::set_offset): Add increase parameter.  Change all
1626         callers.  Remove old relro handling.
1627         * output.h (class Output_section): Add new methods: is_last_relro,
1628         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
1629         Add is_last_relro_ and is_first_non_relro_ fields.
1630         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
1631         Create separate .got.plt section.  Call increase_relro.
1632         * x86_64.cc (Target_x86_64::got_section): Likewise.
1633         * testsuite/relro_script_test.t: Add .got.plt.
1634
1635         PR 10450
1636         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
1637         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
1638         (Layout::finalize): Call set_dynamic_symbol_size.
1639         (Layout::set_dynamic_symbol_size): New function.
1640         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
1641         set_dynamic_symbol_size.
1642
1643         PR 10450
1644         * output.h (class Output_section): Add is_entsize_zero_ field.
1645         * output.cc (Output_section::Output_section): Initialize
1646         is_entsize_zero_.
1647         (Output_section::set_entsize): If two different entsizes are
1648         requested, force it to zero.
1649         (Output_section::add_input_section): Set flags for .debug_str
1650         before updating section flags.  Set entsize.
1651         (Output_section::update_flags_for_input_section): Set SHF_MERGE
1652         and SHF_STRING if all input sections have those flags.
1653
1654 2009-12-29   Rafael Espindola  <espindola@google.com>
1655
1656         * main.cc (main): Fix the sys time reporting.
1657         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
1658         reporting.
1659
1660 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
1661
1662         * options.cc (General_options::parse_version): Allow -v to exit
1663         without an error if there is nothing to link.
1664
1665 2009-12-29  Ian Lance Taylor  <iant@google.com>
1666
1667         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
1668         using a version of gcc before 4.1.
1669         * configure: Rebuild.
1670
1671 2009-12-28  Chris Demetriou  <cgd@google.com>
1672
1673         * attributes.cc (Output_attributes_section_data::do_write): Use
1674         std::vector::front rather than std::vector::data.
1675
1676 2009-12-28  Ian Lance Taylor  <iant@google.com>
1677
1678         * symtab.h (class Symbol_table): Add enum Defined.
1679         * resolve.cc (Symbol_table::should_override): Add defined
1680         parameter.  Change all callers.  Test whether object is NULL
1681         before calling a method on it.
1682         (Symbol_table::report_resolve_problem): Add defined parameter.
1683         Change all callers.
1684         (Symbol_table::should_override_with_special): Likewise.
1685         * symtab.cc (Symbol_table::define_in_output_data): Add defined
1686         parameter.  Change all callers.
1687         (Symbol_table::do_define_in_output_data): Likewise.
1688         (Symbol_table::define_in_output_segment): Likewise.
1689         (Symbol_table::do_define_in_output_segment): Likewise.
1690         (Symbol_table::define_as_constant): Likewise.
1691         (Symbol_table::do_define_as_constant): Likewise.
1692         * script.h (class Symbol_assignment): Add is_defsym parameter to
1693         constructor; change all callers.
1694         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1695         parameter.  Change all callers.  Add is_defsym_ field.
1696         (class Parser_closure): Add parsing_defsym parameter to
1697         constructor; change all callers.  Add parsing_defsym accessor
1698         function.  Add parsing_defsym_ field.
1699
1700 2009-12-28  Ian Lance Taylor  <iant@google.com>
1701
1702         * gold.cc (queue_middle_tasks): Fix formatting.
1703         * object.cc (Relobj::is_section_name_included): Likewise.
1704
1705 2009-12-23  Ian Lance Taylor  <iant@google.com>
1706
1707         * i386.cc (Target_i386::do_calls_non_split): Recognize
1708         -fsplit-stack prologue for a function with a static chain.
1709         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1710         -fsplit-stack prologue when using %r11.
1711
1712 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
1713
1714         * options.cc (General_options::parse_version): Make -v continue and do
1715         the link like GNU ld does.
1716
1717 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
1718
1719         * Makefile.am (CCFILES): Add timer.cc.
1720         (HFILES): Add timer.h.
1721         * configure.ac: Check for sysconf and times.
1722         * main.cc: include timer.h.
1723         (main): Use Timer instead of get_run_time.
1724         * timer.cc: New.
1725         * timer.h: New.
1726         * workqueue.cc: include timer.h.
1727         (Workqueue::find_and_run_task):
1728         Report user, sys and wall time.
1729         * Makefile.in: Regenerate.
1730         * config.in: Regenerate.
1731         * configure: Regenerate.
1732
1733 2009-12-16  Doug Kwan  <dougkwan@google.com>
1734
1735         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1736         sections.
1737         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1738         relaxed input sections.
1739         * output.cc (Output_section::find_relaxed_input_section): Change
1740         return type to Output_relaxed_input_section pointer.  Adjust code
1741         for new type of relaxed_input_section_map_.
1742         * output.h (Output_section::find_relaxed_input_section): Change
1743         return type to Output_relaxed_input_section pointer.
1744         (Output_section::Output_relaxed_input_section_by_input_section_map):
1745         New type.
1746         (Output_section::relaxed_input_section_map_): Change type to
1747         Output_section::Output_relaxed_input_section_by_input_section_map.
1748         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1749         input section.
1750
1751 2009-12-15  Ian Lance Taylor  <iant@google.com>
1752
1753         * layout.cc (Layout::create_shstrtab): Only write out after input
1754         sections if we are compressing debug sections.
1755
1756 2009-12-15  Ian Lance Taylor  <iant@google.com>
1757
1758         * archive.cc (Archive::add_symbols): Only look up a symbol without
1759         a version if there is, in fact, a version.
1760
1761 2009-12-14  Ian Lance Taylor  <iant@google.com>
1762
1763         Revert -Wshadow changes, all changes from:
1764         2009-12-11  Doug Kwan  <dougkwan@google.com>
1765         2009-12-11  Nick Clifton  <nickc@redhat.com>
1766         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1767
1768 2009-12-11  Doug Kwan  <dougkwan@google.com>
1769
1770         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1771         due to -Wshadow.
1772         * attributes.cc (Object_attribute::size): Ditto.
1773         (Attributes_section_data::size): Ditto.
1774         (Attributes_section_data::Attributes_section_data): Ditto.
1775         (Output_attributes_section_data::do_write): Ditto.
1776         * attributes.h (Object_attribute::set_type): Ditto.
1777         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1778
1779 2009-12-11  Nick Clifton  <nickc@redhat.com>
1780
1781         * archive.cc: Fix shadowed variable warnings.
1782         * arm.cc: Likewise.
1783         * compressed_output.cc: Likewise.
1784         * compressed_output.h: Likewise.
1785         * configure: Likewise.
1786         * dwarf_reader.cc: Likewise.
1787         * dynobj.cc: Likewise.
1788         * dynobj.h: Likewise.
1789         * ehframe.cc: Likewise.
1790         * ehframe.h: Likewise.
1791         * errors.cc: Likewise.
1792         * expression.cc: Likewise.
1793         * fileread.cc: Likewise.
1794         * fileread.h: Likewise.
1795         * freebsd.h: Likewise.
1796         * i386.cc: Likewise.
1797         * icf.cc: Likewise.
1798         * incremental.h: Likewise.
1799         * layout.cc: Likewise.
1800         * layout.h: Likewise.
1801         * mapfile.cc: Likewise.
1802         * merge.cc: Likewise.
1803         * merge.h: Likewise.
1804         * object.cc: Likewise.
1805         * object.h: Likewise.
1806         * options.h: Likewise.
1807         * output.cc: Likewise.
1808         * output.h: Likewise.
1809         * parameters.cc: Likewise.
1810         * plugin.cc: Likewise.
1811         * powerpc.cc: Likewise.
1812         * reduced_debug_output.cc: Likewise.
1813         * reduced_debug_output.h: Likewise.
1814         * reloc.cc: Likewise.
1815         * reloc.h: Likewise.
1816         * resolve.cc: Likewise.
1817         * script-sections.cc: Likewise.
1818         * script.cc: Likewise.
1819         * script.h: Likewise.
1820         * sparc.cc: Likewise.
1821         * symtab.cc: Likewise.
1822         * symtab.h: Likewise.
1823         * target-select.cc: Likewise.
1824         * target-select.h: Likewise.
1825         * token.h: Likewise.
1826         * workqueue.cc: Likewise.
1827         * workqueue.h: Likewise.
1828         * x86_64.cc: Likewise.
1829
1830 2009-12-10  Doug Kwan  <dougkwan@google.com>
1831
1832         * arm.cc (attributes.h): New include.
1833         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1834         (Arm_relobj::~Arm_relobj): Delete object pointed by
1835         attributes_section_data_.
1836         (Arm_relobj::attributes_section_data): New method definition.
1837         (Arm_relobj::attributes_section_data_): New data member declaration.
1838         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1839         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1840         attributes_section_data_.
1841         (Arm_dynobj::attributes_section_data): New method definition.
1842         (Arm_dynobj::attributes_section_data_): New data member declaration.
1843         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
1844         initialization value of may_use_blx_ to false.
1845         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1846         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1847         object attributes to compute results instead of hard-coding.
1848         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1849         Target_arm::get_secondary_compatible_arch,
1850         Target_arm::set_secondary_compatible_arch
1851         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1852         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1853         New method declarations.
1854         (Target_arm::get_aeabi_object_attribute): New method definition.
1855         (Target_arm::attributes_section_data_): New data member declaration.
1856         (read_arm_attributes_section): New template definition.
1857         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1858         (Arm_dynobj::do_read_symbols): Ditto.
1859         (Target_arm::do_finalize_sections): Merge attributes sections from
1860         input.  Check for BLX use after attributes section merging.
1861         Fix __exidx_start and __exidx_end visibility.  Create an
1862         .ARM.attributes section if necessary.
1863         (Target_arm::get_secondary_compatible_arch,
1864         Target_arm::set_secondary_compatible_arch,
1865         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1866         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1867         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order): 
1868         New method definitions.
1869
1870 2009-12-09  Ian Lance Taylor  <iant@google.com>
1871
1872         * plugin.cc (Plugin::load): Don't cast from void* to a function
1873         pointer.
1874
1875 2009-12-09  Ian Lance Taylor  <iant@google.com>
1876
1877         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1878         information fields.
1879
1880 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
1881
1882         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1883         Replace two_file_shared_1.so with two_file_shared_2.so.
1884         * testsuite/Makefile.in: Regenerated.
1885
1886 2009-12-08  Doug Kwan  <dougkwan@google.com>
1887
1888         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1889         (HFILES): Add attributes.h and int_encoding.h.
1890         * Makefile.in: Regenerate.
1891         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1892         function definitions to int_encoding.cc
1893         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1894         prototypes to int_encoding.h
1895         * reduced_debug_output.cc (int_encoding.h): New include.
1896         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1897         function definitions to int_encoding.cc
1898         (insert_into_vector, read_from_pointer): Move template definitions to
1899         int_encoding.h
1900         * attributes.cc: New file.
1901         * attributes.h: New file.
1902         * int_encoding.cc: New file.
1903         * int_encoding.h: New file.
1904
1905 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
1906
1907         PR gold/11055
1908         * incremental-dump.cc (dump_incremental_inputs): New.
1909         (main): Use dump_incremental_inputs.
1910
1911 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
1912
1913         PR gold/10893
1914         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1915         checking elfcpp::STT_FUNC.
1916         (Target_i386::Relocate::relocate): Likewise.
1917         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1918
1919         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1920         symbols from shared libraries into normal FUNC symbols.
1921
1922         * symtab.h (Symbol): Add is_func and use it.
1923
1924 2009-12-05  Doug Kwan  <dougkwan@google.com>
1925
1926         * arm.cc (Target_arm::arm_info): Initialize new fields
1927         attributes_section and attributes_vendor.
1928         * i386.cc (Target_i386::i386_info): Same.
1929         * object.cc (Sized_relobj::do_layout): Skip attribute section.
1930         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1931         fields attributes_section and attributes_vendor.
1932         * sparc.cc (Target_sparc::sparc_info): Same.
1933         * target.h (Target::attributes_section, Target::attributes_vendor,
1934         Target::is_attributes_section, Target::attribute_arg_type,
1935         Target::attributes_order): New method definitions.
1936         (Target::Target_info::attributes_section,
1937         Target::Target_info::attributes_vendor): New fields.
1938         (Target::do_attribute_arg_type, Target::do_attributes_order): New
1939         virtual method definitions.
1940         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1941         attributes_section and attributes_vendor.
1942         * testsuite/testfile.cc (Target_test::test_target_info): Same.
1943
1944 2009-12-05  Doug Kwan  <dougkwan@google.com>
1945
1946         * arm.cc: Update comments about interworking and stub generation.
1947         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1948         considered as non-PIC.
1949         (Arm_relocate_functions::base_abs): Fix formatting.
1950         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
1951         of function to use GOT entry address instead of offset.
1952         (Target_arm::Scan::global): Issue an error if a symbol would need a
1953         PLT does not get one because it is untyped.  Remove code to create
1954         dynamic symbols for relative branches.
1955         (Target_arm::Relocate::relocate: Use 0 instead of false since function
1956         takes unsigned integer instead of boolean.
1957
1958 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
1959
1960         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1961         (two_file_test_LDADD): Likewise.
1962         (common_test_1_LDADD): Likewise.
1963         (exception_test_LDADD) Likewise.
1964         (weak_test_LDADD): Likewise.
1965         (many_sections_test_LDADD): Likewise.
1966         (initpri1_LDADD): Likewise.
1967         (script_test_1_LDADD): Likewise.
1968         (script_test_2_LDADD): Likewise.
1969         (justsyms_LDADD): Likewise.
1970         (binary_test_LDADD): Likewise.
1971         (large_LDADD): Likewise.
1972         * testsuite/Makefile.in: Regenerated.
1973
1974 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
1975
1976         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1977         (Symbol_table::override_with_special): Likewise.
1978         (Symbol_table::add_from_object): Likewise.
1979
1980 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
1981
1982         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1983         Don't set the data_offset twice.
1984
1985 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
1986
1987         * testsuite/Makefile.in: Regenerate.
1988
1989 2009-12-03  Doug Kwan  <dougkwan@google.com>
1990
1991         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1992         (Target_arm::do_finalize_sections): Add parameter for symbol table
1993         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
1994         * i386.cc (Target_i386::do_finalize_sections): Add an additional
1995         parameter for symbol table pointer.
1996         * layout.cc (Layout::finalize): Call Target::finalize_sections with
1997         an additional parameter for a pointer to symbol table.
1998         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1999         parameter for a symbol table pointer.
2000         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
2001         * target.h (Target::finalize_sections, Target::do_finalize_sections):
2002         Ditto.
2003         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
2004         parameter for a symbol table pointer.
2005
2006 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
2007
2008         * incremental.cc (Incremental_inputs_header)
2009         (Incremental_inputs_header_write, Incremental_inputs_entry)
2010         (Incremental_inputs_entry_write): Move ...
2011         * incremental.h (Incremental_inputs_header)
2012         (Incremental_inputs_header_write, Incremental_inputs_entry)
2013         (Incremental_inputs_entry_write): here.
2014
2015 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
2016
2017         * incremental.cc (make_sized_incremental_binary): Set the target.
2018         Error if it is incompatible.
2019         * output.h (Output_file): Add filename method.
2020
2021 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
2022
2023         * incremental.cc (Incremental_inputs_entry): Remove unused argument
2024         from the get_* methods.
2025
2026 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
2027
2028         * incremental-dump.cc (main): Check that the offeset of a script is 0.
2029         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
2030         Write 0 for the data_offset of scripts.
2031
2032 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
2033
2034         * testsuite/Makefile.am: Add the incremental_test.sh test.
2035         * testsuite/incremental_test.sh: New.
2036         * testsuite/incremental_test_1.c: New.
2037         * testsuite/incremental_test_2.c: New.
2038
2039 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
2040
2041        * incremental-dump.cc (main): Fix typos.
2042
2043 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
2044
2045         PR gold/11025
2046         * incremental-dump.cc (main): Use llu to print 64 bit values.
2047
2048 2009-11-26  Per Ã˜yvind Karlsen <peroyvind@mandriva.org>
2049             H.J. Lu  <hongjiu.lu@intel.com>
2050
2051         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
2052         $(LIBDL).
2053         (incremental_dump_LDADD): Likewise.
2054         * Makefile.in: Regenerated.
2055
2056 2009-11-25  Doug Kwan  <dougkwan@google.com>
2057         
2058         Revert:
2059
2060         2009-11-25  Doug Kwan  <dougkwan@google.com>
2061
2062                 * arm.cc (Target_arm::Target_arm): Move method definition
2063                 outside of class definition.  Add code to handle
2064                 --target1-rel, --target1-abs and --target2= options.
2065                 (Target_arm::get_reloc_reloc_type): Change method to be
2066                 non-static and const.
2067                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
2068                 New data member declaration.
2069                 (Target_arm::Scan::local, Target_arm::Scan::global,
2070                 Target_arm::Relocate::relocate,
2071                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2072                 Adjust call to Target_arm::get_real_reloc_type.
2073                 (Target_arm::get_real_reloc_type): Use command line options
2074                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
2075                 * options.h (--target1-rel, --target1-abs, --target2): New
2076                 ARM-only options.
2077
2078 2009-11-25  Doug Kwan  <dougkwan@google.com>
2079
2080         * arm.cc (Target_arm::Target_arm): Move method definition outside of
2081         class definition.  Add code to handle --target1-rel, --target1-abs
2082         and --target2= options.
2083         (Target_arm::get_reloc_reloc_type): Change method to be non-static
2084         and const.
2085         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
2086         member declaration.
2087         (Target_arm::Scan::local, Target_arm::Scan::global,
2088         Target_arm::Relocate::relocate,
2089         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
2090         call to Target_arm::get_real_reloc_type.
2091         (Target_arm::get_real_reloc_type): Use command line options to
2092         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
2093         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
2094         options.
2095
2096 2009-11-25  Doug Kwan  <dougkwan@google.com>
2097
2098         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
2099         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
2100         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
2101         formatting.
2102         (Arm_relocate_functions::thm_call): Replace body with a call to
2103         Arm_relocate_functions::thumb_branch_common.
2104         (Arm_relocate_functions::thm_jump24,
2105         Arm_relocate_functions::thm_xpc22): New method definitions.
2106         (Arm_relocate_functions::thumb_branch_common): New method definition.
2107         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
2108         operator.
2109         (Target_arm::Relocate::relocate): Adjust call to thm_call.
2110         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
2111
2112 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
2113
2114         * Makefile.am: Build incremental-dump
2115         * Makefile.in: Regenerate.
2116         * incremental-dump.cc: New.
2117         * incremental.cc (Incremental_inputs_header_data,
2118         Incremental_inputs_entry_data): Move to incremental.h
2119         * incremental.h: (Incremental_inputs_header_data,
2120         Incremental_inputs_entry_data): Move from incremental.cc
2121
2122 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
2123
2124         * incremental.cc (Incremental_inputs_header,
2125         Incremental_inputs_header_write, Incremental_inputs_entry,
2126         Incremental_inputs_entry_write): Add a typedef with the data type.
2127
2128 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
2129
2130         * incremental.cc (Incremental_inputs_header,
2131         Incremental_inputs_header_write, Incremental_inputs_entry,
2132         Incremental_inputs_entry_write): Update comment about which
2133         type has the filed descriptions.
2134
2135 2009-11-15  Doug Kwan  <dougkwan@google.com>
2136
2137         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
2138         (Arm_relocate_functions::arm_branch_common): Change method defintion
2139         in class definition to a method declaration and update list of formal
2140         parameters.
2141         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
2142         Arm_relocation_functions::jump24): Adjust call to
2143         Arm_relocate_functions::arm_branch_common.  Update list of formal
2144         parameters.
2145         (Arm_relocate_functions::xpc25): New method definition.
2146         (Arm_relocate_functions::arm_branch_common): Move method defintion
2147         out from class definition.  Use stubs for mode-switching and extending
2148         branch ranges.
2149         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
2150         specially.  Change code to enable use of stubs in ARM branches.
2151
2152 2009-11-10  Doug Kwan  <dougkwan@google.com>
2153
2154         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
2155         in method declaration.
2156         (Target_arm::relocate_stub): New method declaration.
2157         (Target_arm::default_target): Change to return a pointer instead of
2158         a const reference.
2159         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
2160         Target_arm::default_target.
2161         (Arm_Relobj::do_relocate_sections): Remove options paramater in
2162         method definition.
2163         (Target_arm::relocate_section): Adjust view.
2164         (Target_arm::relocate_stub): New method definition.
2165
2166 2009-11-10  Doug Kwan  <dougkwan@google.com>
2167
2168         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
2169         a format warning.
2170         * incremental.cc (open_incremental_binary): Initialized local
2171         variables to avoid warnings.
2172         * object.cc (make_elf_object): Ditto.
2173         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
2174         a format warning.
2175  
2176 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
2177
2178         PR gold/10930
2179         * testsuite/plugin_test.c: Include "config.h".
2180
2181 2009-11-09  Doug Kwan  <dougkwan@google.com>
2182
2183         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
2184         (arm_symbol_value): Remove.
2185         (Arm_relocate_functions::arm_branch_common,
2186         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
2187         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
2188         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
2189         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
2190         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
2191         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
2192         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
2193         Arm_relocate_functions::thm_mobw_abs_nc,
2194         Arm_relocate_functions::thm_mov_abs,
2195         Arm_relocate_functions::movw_prel_nc,
2196         Arm_relocate_functions::thm_movt_abs,
2197         Arm_relocate_functions::movt_prel,
2198         Arm_relocate_functions::thm_movw_prel_nc,
2199         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
2200         (Target_arm::Relocate::relocate): Only decompose address into two
2201         parts if relocation type uses the thumb-bit and pass the actual
2202         bit instead of a flag indicating that the thumb-bit is used.  Adjust
2203         calls to methods in Arm_relocate_functions for this change.
2204
2205 2009-11-08  Ian Lance Taylor  <iant@google.com>
2206
2207         PR 10925
2208         * reloc.cc: Instantiate
2209         Sized_relobj::initialize_input_to_output_maps and
2210         Sized_relobj:free_input_to_output_maps.
2211
2212 2009-11-06  Ian Lance Taylor  <iant@google.com>
2213
2214         PR 10876
2215         * defstd.cc (in_segment): Set only_if_ref true for "end".
2216
2217 2009-11-06  Doug Kwan  <dougkwan@google.com>
2218
2219         * arm.cc (class Reloc_stub): Correct a comment.
2220         (Target_arm::Target_arm): Initialize arm_input_section_map_.
2221         (Target_arm::scan_section_for_stubs): New method declaration.
2222         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
2223         Change methods from private to protected.
2224         (Target_arm::do_may_relax): New method definition.
2225         (Target_arm::do_relax, Target_arm::group_sections,
2226         Target_arm::scan_reloc_for_stub,
2227         Target_arm::scan_reloc_section_for_stubs): New method declarations.
2228         (Target_arm::arm_input_section_map_): New data member declaration.
2229         (Target_arm::scan_reloc_for_stub,
2230         Target_arm::scan_reloc_section_for_stubs,
2231         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
2232         Target_arm::do_relax): New method definitions.
2233
2234 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
2235
2236         * configure.ac: Check for (struct stat)::st_mtim
2237         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
2238         * config.in: Regenerate.
2239         * configure: Regenerate.
2240
2241 2009-11-05  Ian Lance Taylor  <iant@google.com>
2242
2243         PR 10910
2244         * output.cc (Output_segment::add_output_section): Add missing
2245         return statement.
2246
2247 2009-11-04  Ian Lance Taylor  <iant@google.com>
2248
2249         PR 10880
2250         * object.h (class Object): Add is_needed and set_is_needed
2251         methods.  Add is_needed_ field.  Make bool fields into bitfields.
2252         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
2253         defined in a dynamic object and referenced by a regular object,
2254         set is_needed for the dynamic object.
2255         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
2256         if the file is marked with as_needed and it is not needed.
2257
2258 2009-11-04  Ian Lance Taylor  <iant@google.com>
2259
2260         PR 10887
2261         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
2262         tags if data is discarded by linker script.
2263         * i386.cc (Target_i386::do_finalize_sections): Likewise.
2264         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2265         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2266         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2267
2268 2009-11-04  Ian Lance Taylor  <iant@google.com>
2269
2270         * layout.cc (Layout::get_output_section): Add is_interp and
2271         is_dynamic_linker_section parameters.  Change all callers.
2272         (Layout::choose_output_section): Likewise.
2273         (Layout::make_output_section): Likewise.
2274         (Layout::add_output_section_data): Add is_dynamic_linker_section
2275         parameter.  Change all callers.
2276         * layout.h (class Layout): Update declarations.
2277         * output.h (class Output_section): Add is_interp, set_is_interp,
2278         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
2279         Add is_interp_, is_dynamic_linker_section_ fields.  Change
2280         generate_code_fills_at_write_ to a bitfield.
2281         * output.cc (Output_section::Output_sections): Initialize new
2282         fields.
2283         (Output_segment::add_output_section): Add do_sort parameter.
2284         Change all callers.
2285
2286 2009-11-03  Ian Lance Taylor  <iant@google.com>
2287
2288         PR 10860
2289         * options.h (class General_options): Add --warn-common.
2290         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
2291         merging two common symbols.
2292         (Symbol_table::should_override): Handle --warn-common when merging
2293         a common symbol with a defined symbol.  Use report_resolve_problem
2294         for multiple definitions.
2295         (Symbol_table::report_resolve_problem): New function.
2296         * symtab.h (class Symbol_table): Declare report_resolve_problem.
2297
2298 2009-11-03  Doug Kwan  <dougkwan@google.com>
2299
2300         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
2301         stub_factory_.
2302         (Target_arm::stub_factory): New method definition.
2303         (Target_arm::new_arm_input_section,
2304         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
2305         Target_arm::reloc_uses_thumb_bit): New method declarations.
2306         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map): 
2307         New type definitions.
2308         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
2309         member declarations.
2310         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
2311         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
2312         New method definitions.
2313
2314 2009-11-03  Ian Lance Taylor  <iant@google.com>
2315
2316         * options.h (class General_options): Add --warn_constructors.
2317
2318 2009-11-03  Ian Lance Taylor  <iant@google.com>
2319
2320         PR 10893
2321         * defstd.cc (in_section): Add entries for __rel_iplt_start,
2322         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
2323
2324 2009-11-03  Ian Lance Taylor  <iant@google.com>
2325
2326         PR 10895
2327         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
2328         --msgid-bugs-address.
2329         (install-pdf): New target.
2330         (install-data_yes): Look up one directory to find mkinstalldirs.
2331
2332 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
2333
2334         * po/Make-in (.po.gmo): Don't generate .gmo files in source
2335         tree.
2336
2337 2009-10-30  Doug Kwan  <dougkwan@google.com>
2338
2339         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2340
2341 2009-10-30  Doug Kwan  <dougkwan@google.com>
2342
2343         * arm.cc (Stub_addend_reader): New struct template definition
2344         and partial specializations.
2345         (Stub_addend_reader::operator()): New method definition for a
2346         partially specialized template.
2347
2348 2009-10-30  Doug Kwan  <dougkwan@google.com>
2349
2350         * arm.cc (Arm_relobj::processor_specific_flags): New method
2351         definition.
2352         (Arm_relobj::do_read_symbols): New method declaration.
2353         (Arm_relobj::processor_specific_flags_): New data member declaration.
2354         (Arm_dynobj): New class definition.
2355         (Target_arm::do_finalize_sections): Add input_objects parameter.
2356         (Target_arm::do_adjust_elf_header): New method declaration.
2357         (Target_arm::are_eabi_versions_compatible,
2358         (Target_arm::merge_processor_specific_flags): New method declaration.
2359         (Target_arm::do_make_elf_object): New overloaded method definitions
2360         and declaration.
2361         (Arm_relobj::do_read_symbols): New method definition.
2362         (Arm_dynobj::do_read_symbols): Ditto.
2363         (Target_arm::do_finalize_sections): Add input_objects parameters.
2364         Merge processor-specific flags from all input objects.
2365         (Target_arm::are_eabi_versions_compatible,
2366         Target_arm::merge_processor_specific_flags,
2367         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
2368         New method definitions.
2369         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
2370         Input_objects pointer type parameter.
2371         * layout.cc (Layout::finalize): Pass input objects to target's.
2372         finalize_sections function.
2373         * output.cc (Output_file_header::do_sized_write): Set ELF file
2374         header's processor-specific flags.
2375         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
2376         Input_objects pointer type parameter.
2377         * sparc.cc (Target_sparc::do_finalize_sections): Same.
2378         * target.h (Input_objects): New forward class declaration.
2379         (Target::processor_specific_flags,
2380         Target::are_processor_specific_flags_sect): New method definitions.
2381         (Target::finalize_sections): Add input_objects parameter.
2382         (Target::Target): Initialize processor_specific_flags_ and
2383         are_processor_specific_flags_set_.
2384         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
2385         parameter.
2386         (Target::set_processor_specific_flags): New method definition.
2387         (Target::processor_specific_flags_,
2388         Target::are_processor_specific_flags_set_): New data member
2389         declarations.
2390         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
2391         Input_objects pointer type parameter.
2392
2393 2009-10-30  Doug Kwan  <dougkwan@google.com>
2394
2395         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2396
2397 2009-10-28  Ian Lance Taylor  <iant@google.com>
2398
2399         * object.h (class Relobj): Drop options parameter from
2400         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
2401         do_scan_relocs, do_relocate.  Change all callers.
2402         (class Sized_relobj): Drop options parameters from
2403         do_gc_process_relocs, do_scan_relocs, do_relocate,
2404         do_relocate_sections, relocate_sections, emit_relocs_scan,
2405         emit_relocs_scan_reltype.  Change all callers.
2406         (struct Relocate_info): Remove options field and all references to
2407         it.
2408         * reloc.h (class Read_relocs): Remove options constructor
2409         parameter and options_ field.  Change all callers.
2410         (class Gc_process_relocs, class Scan_relocs): Likewise.
2411         (class Relocate_task): Likewise.
2412         * target-reloc.h (scan_relocs): Remove options parameter.  Change
2413         all callers.
2414         (scan_relocatable_relocs): Likewise.
2415         * target.h (class Sized_target): Remove options parameter from
2416         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
2417         all callers.
2418         * gc.h (gc_process_relocs): Remove options parameter.  Change all
2419         callers.
2420         * arm.cc: Update functions to remove options parameters.
2421         * i386.cc: Likewise.
2422         * powerpc.cc: Likewise.
2423         * sparc.cc: Likewise.
2424         * x86_64.cc: Likewise.
2425         * testsuite/testfile.cc: Likewise.
2426
2427 2009-10-28  Doug Kwan  <dougkwan@google.com>
2428
2429         * arm.cc (Arm_relobj): New class definition.
2430         (Arm_relobj::scan_sections_for_stubs, 
2431         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
2432         New method definitions.
2433
2434 2009-10-28  Cary Coutant  <ccoutant@google.com>
2435
2436         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
2437         (Plugin::cleanup_done_): New member.
2438         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
2439         (Plugin_manager::cleanup_done_): Remove.
2440         (Plugin_manager::add_input_file): Edit error message.
2441         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
2442         (Plugin_manager::cleanup): Remove use of cleanup_done_.
2443
2444 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
2445
2446         * fileread.cc: (File_read::View::~View): Use the new
2447         data_ownership_ filed.
2448         (File_read::~File_read): Dispose the new whole_file_view_.
2449         (File_read::open): Mmap the whole file if needed.
2450         (File_read::open): Use whole_file_view_ instead of contents_.
2451         (File_read::find_view): Use whole_file_view_ if applicable.
2452         (File_read::do_read): Use whole_file_view_ instead of contents_.
2453         (File_read::make_view): Use whole_file_view_ instead of contents_,
2454         update File_read::View::View call.
2455         (File_read::find_or_make_view): Update File_read::View::View
2456         call.
2457         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
2458         remove contents_
2459         (File_read::View::Data_ownership): New enum.
2460         (File_read::View::View): Replace bool mapped_ with Data_ownership
2461         argument.
2462         (File_read::View::mapped_): Remove (replaced by data_ownership_).
2463         (File_read::View::data_ownership_): New field.
2464         (File_read::contents_): Remove (replaced by whole_file_view_).
2465         (File_read::whole_file_view_): New field.
2466         * options.h (class General_options): Add --keep-files-mapped.
2467
2468 2009-10-27  Cary Coutant  <ccoutant@google.com>
2469
2470         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
2471         * testsuite/Makefile.am (plugin_test_5): New test case.
2472         * testsuite/Makefile.in: Regenerate.
2473
2474 2009-10-25  Doug Kwan  <dougkwan@google.com>
2475
2476         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
2477         from private to protected to allow access by child class.
2478         (Sized_relobj::do_relocate_sections): New method declaration.
2479         (Sized_relobj::relocate_sections): Virtualize.
2480         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from 
2481         Sized_relobj::relocate_sections.  Instantiate template explicitly
2482         for different target sizes and endianity.
2483
2484 2009-10-24  Doug Kwan  <dougkwan@google.com>
2485
2486         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
2487         (Arm_input_section::as_arm_input_section): New method.
2488         (Arm_output_section): New class definition.
2489         (Arm_output_section::create_stub_group,
2490         Arm_output_section::group_sections): New method definitions.
2491
2492 2009-10-22  Doug Kwan  <dougkwan@google.com>
2493
2494         * arm.cc (Arm_input_section): New class definition.
2495         (Arm_input_section::init, Arm_input_section:do_write,
2496         Arm_input_section::set_final_data_size,
2497         Arm_input_section::do_reset_address_and_file_offset): New method
2498         definitions.
2499
2500 2009-10-21  Doug Kwan  <dougkwan@google.com>
2501
2502         * arm.cc (Stub_table, Arm_input_section): New forward class
2503         declarations.
2504         (Stub_table): New class defintion.
2505         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
2506         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
2507         New method definition.
2508
2509 2009-10-21  Doug Kwan  <dougkwan@google.com>
2510
2511         * arm.cc: Update copyright comments.
2512         (Target_arm): New forward class template declaration.
2513         (Arm_address): New type.
2514         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
2515         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
2516         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
2517         constants.
2518         (Insn_template): Same.
2519         (DEF_STUBS): New macro.
2520         (Stub_type): New enum type.
2521         (Stub_template): New class definition.
2522         (Stub): Same.
2523         (Reloc_stub): Same.
2524         (Stub_factory): Same.
2525         (Target_arm::Target_arm): Initialize may_use_blx_ and
2526         should_force_pic_veneer_.
2527         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
2528         Target_arm::should_force_pic_veneer,
2529         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
2530         Target_arm::using_thumb_only, Target_arm:;default_target): New
2531         method defintions.
2532         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
2533         New data member declarations.
2534         (Insn_template::size, Insn_template::alignment): New method defintions.
2535         (Stub_template::Stub_template): New method definition.
2536         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
2537         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
2538         (Stub_factory::Stub_factory): New method definition.
2539         * gold.h (string_hash): New template.
2540         * output.h (Input_section_specifier::hash_value): Use
2541         gold::string_hash.
2542         (Input_section_specifier::string_hash): Remove.
2543         * stringpool.cc (Stringpool_template::string_hash): Use
2544         gold::string_hash.
2545
2546 2009-10-20  Doug Kwan  <dougkwan@google.com>
2547
2548         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
2549         symbols of relaxed input sections.
2550         * output.h (Output_section::find_relaxed_input_section): Make
2551         method public.
2552
2553 2009-10-16  Doug Kwan  <dougkwan@google.com>
2554
2555         * dynobj.cc (Versions::Versions): Initialize version_script_.
2556         Only insert base version symbol definition for a shared object
2557         if version script defines any version versions.
2558         (Versions::define_base_version): New method definition.
2559         (Versions::add_def): Check that base version is not needed.
2560         (Versions::add_need): Define base version lazily.
2561         * dynobj.h (Versions::define_base_version): New method declaration.
2562         (Versions::needs_base_version_): New data member declaration.
2563         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
2564         (check_DATA): Add no_version_test.stdout.
2565         (libno_version_test.so, no_version_test.o no_version_test.stdout):
2566         New make rules.
2567         * testsuite/Makefile.in: Regenerate.
2568         * testsuite/no_version_test.c: New file.
2569         * testsuite/no_version_test.sh: Ditto.
2570
2571 2009-10-16  Doug Kwan  <dougkwan@google.com>
2572
2573         * expression.cc (class Segment_start_expression): New class definition.
2574         (Segment_start_expression::value): New method definition.
2575         (script_exp_function_segment_start): Return a new
2576         Segment_start_expression.
2577         * gold/script-c.h (script_saw_segment_start_expression): New function
2578         prototype.
2579         * script-sections.cc (Script_sections::Script_sections): Initialize
2580         SAW_SEGMENT_START_EXPRESSION_ to false.
2581         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
2582         and -Tbbs options to specify section addresses if given in
2583         command line and no SEGMENT_START expression is seen in a script.
2584         * script-sections.h (Script_sections::saw_segment_start_expression,
2585         Script_sections::set_saw_segment_start_expression): New method
2586         definition.
2587         (Script_sections::saw_segment_start_expression_): New data member
2588         declaration.
2589         * script.cc (script_saw_segment_start_expression): New function.
2590         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
2591         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
2592         script_test_7.sh and script_test_8.sh.
2593         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
2594         script_test_8.stdout.
2595         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
2596         (script_test_6, script_test_6.stdout, script_test_7,
2597         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
2598         * Makefile.in: Regenerate.
2599         * testsuite/script_test_6.sh: New file.
2600         * testsuite/script_test_6.t: Same.
2601         * testsuite/script_test_7.sh: Same.
2602         * testsuite/script_test_7.t: Same.
2603         * testsuite/script_test_8.sh: Same.
2604
2605 2009-10-16  Doug Kwan  <dougkwan@google.com>
2606
2607         * output.cc (Output_segment::set_section_list_address): Cast
2608         expressions to unsigned long long type to avoid format warnings.
2609
2610 2009-10-15  Ian Lance Taylor  <iant@google.com>
2611
2612         * script.cc (Script_options::add_symbol_assignment): Always add a
2613         dot assignment to script_sections_.
2614         * script-sections.cc (Script_sections::add_dot_assignment):
2615         Initialize if necessary.
2616
2617         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
2618         program headers with no load segment if there is a linker script.
2619
2620         * layout.cc (Layout::set_segment_offsets): Align the file offset
2621         to the segment aligment for -N or -n with no load segment.
2622         * output.cc (Output_segment::add_output_section): Don't crash if
2623         the first section is a TLS section.
2624         (Output_segment::set_section_list_addresses): Print an error
2625         message if the address moves backward in a linker script.
2626         * script-sections.cc
2627         (Output_section_element_input::set_section_addresses): Don't
2628         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
2629         (Orphan_output_section::set_section_addresses): Likewise.
2630
2631 2009-10-15  Doug Kwan  <dougkwan@google.com>
2632
2633         * layout.cc (Layout::finish_dynamic_section): Generate tags
2634         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
2635         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
2636         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2637
2638 2009-10-14  Ian Lance Taylor  <iant@google.com>
2639
2640         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
2641         fields.
2642         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
2643         data_shdr fields of relinfo.
2644         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
2645         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
2646         R_386_TLS_LDO_32, adjust based on section flags.
2647         (Target_i386::Relocate::fix_up_ldo): Remove.
2648
2649 2009-10-13  Ian Lance Taylor  <iant@google.com>
2650
2651         Add support for -pie.
2652         * options.h (class General_options): Add -pie and
2653         --pic-executable.
2654         (General_options::output_is_position_independent): Test -pie.
2655         (General_options::output_is_executable): Return true if not shared
2656         and not relocatable.
2657         (General_options::output_is_pie): Remove.
2658         * options.cc (General_options::finalize): Reject incompatible uses
2659         of -pie.
2660         * gold.cc (queue_middle_tasks): A -pie link is not static.
2661         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
2662         * symtab.cc (Symbol::final_value_is_known): Return false if
2663         output_is_position_independent.
2664         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
2665         output_is_position_independent.
2666         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
2667         output_is_position_independent.
2668         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
2669         output_is_position_independent.
2670         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
2671         two_file_pie_test.
2672         (basic_pie_test.o, basic_pie_test): New targets.
2673         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
2674         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
2675         (two_file_pie_test): New target.
2676         * testsuite/Makefile.in: Rebuild.
2677         * README: Remove note saying that -pie is not supported.
2678
2679 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
2680
2681         * options.h (class General_options): Add -init and -fini.
2682         * layout.cc (Layout::finish_dynamic_section): Emit
2683         given init and fini functions.
2684
2685 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
2686
2687         * gc.h (gc_process_relocs): Check if icf is enabled using new
2688         function.
2689         * gold.cc (queue_initial_tasks): Likewise.
2690         (queue_middle_tasks): Likewise.
2691         * object.cc (do_layout): Likewise.
2692         * symtab.cc (is_section_folded): Likewise.
2693         * main.cc (main): Likewise.
2694         * reloc.cc (Read_relocs::run): Likewise.
2695         (Sized_relobj::do_scan_relocs): Likewise.
2696         * icf.cc (is_function_ctor_or_dtor): New function.
2697         (Icf::find_identical_sections): Check if function is ctor or dtor when
2698         safe icf is chosen.
2699         * options.h (General_options::icf): Change option to be an enum.
2700         (Icf_status): New enum.
2701         (icf_enabled): New method.
2702         (icf_safe_folding): New method.
2703         (set_icf_status): New method.
2704         (icf_status_): New variable.
2705         * (options.cc) (General_options::finalize): Set icf_status_.
2706         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2707         icf_test and icf_keep_unique_test to use the --icf enum flag.
2708         * testsuite/icf_safe_test.sh: New file.
2709         * testsuite/icf_safe_test.cc: New file. 
2710
2711 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
2712
2713         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2714         includes to gc.h and icf.h.
2715         * arm.cc: Include gc.h.
2716         * gold.cc: Likewise.
2717         * i386.cc: Likewise.
2718         * powerpc.cc: Likewise.
2719         * sparc.cc: Likewise.
2720         * x86_64.cc: Likewise.
2721         * gc.h: Include icf.h.
2722
2723 2009-10-11  Ian Lance Taylor  <iant@google.com>
2724
2725         * plugin.cc: Include "gold.h" before other header files.
2726
2727 2009-10-10  Chris Demetriou  <cgd@google.com>
2728
2729         * options.h (Input_file_argument::Input_file_type): New enum.
2730         (Input_file_argument::is_lib_): Replace with...
2731         (Input_file_argument::type_): New member.
2732         (Input_file_argument::Input_file_argument): Take Input_file_type
2733         'type' rather than boolean 'is_lib' as second argument.
2734         (Input_file_argument::is_lib): Use type_.
2735         (Input_file_argument::is_searched_file): New function.
2736         (Input_file_argument::may_need_search): Handle is_searched_file.
2737         * options.cc (General_options::parse_library): Support -l:filename.
2738         (General_options::parse_just_symbols): Update for Input_file_argument
2739         changes.
2740         (Command_line::process): Likewise.
2741         * archive.cc (Archive::get_file_and_offset): Likewise.
2742         * plugin.cc (Plugin_manager::release_input_file): Likewise.
2743         * script.cc (read_script_file, script_add_file): Likewise.
2744         * fileread.cc (Input_file::Input_file): Likewise.
2745         (Input_file::will_search_for): Handle is_searched_file.
2746         (Input_file::open): Likewise.
2747         * readsyms.cc (Read_symbols::get_name): Likewise.
2748         * testsuite/Makefile.am (searched_file_test): New test.
2749         * testsuite/Makefile.in: Regenerate.
2750         * testsuite/searched_file_test.cc: New file.
2751         * testsuite/searched_file_test_lib.cc: New file.
2752
2753 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
2754             Ian Lance Taylor  <iant@google.com>
2755
2756         * descriptor.cc: Include <cstdio> and "binary-io.h".
2757         (Descriptors::open): Open the files in binary mode always.
2758         * script.cc (Lex::get_token): Treat \r as whitespace.
2759
2760 2009-10-09  Ian Lance Taylor  <iant@google.com>
2761
2762         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2763
2764 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
2765             Ian Lance Taylor  <iant@google.com>
2766
2767         * configure.ac: Check for readv function also.
2768         * fileread.cc (readv): Define if not HAVE_READV.
2769         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2770         does not exist.
2771         * config.in: Regenerate.
2772         * configure: Regenerate.
2773
2774 2009-10-09  Doug Kwan  <dougkwan@google.com>
2775
2776         * layout.cc (Layout::make_output_section): Call target hook to make
2777         ordinary output section.
2778         (Layout::finalize): Adjust parameter list of call the
2779         Target::may_relax().
2780         * layout.h (class Layout::section_list): New method.
2781         * merge.h (Output_merge_base::entsize): Change visibility to public.
2782         (Output_merge_base::is_string, Output_merge_base::do_is_string):
2783         New methods.
2784         (Output_merge_string::do_is_string): New method.
2785         * object.cc (Sized_relobj::do_setup): renamed from
2786         Sized_relobj::set_up.
2787         * object.h (Sized_relobj::adjust_shndx,
2788         Sized_relobj::initializ_input_to_output_maps,
2789         Sized_relobj::free_input_to_output_maps): Change visibilities to
2790         protected.
2791         (Sized_relobj::setup): Virtualize.
2792         (Sized_relobj::do_setup): New method declaration.
2793         (Sized_relobj::invalidate_section_offset,
2794         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2795         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2796         * options.cc (parse_int): New function.
2797         * options.h (parse_int): New declaration.
2798         (DEFINE_int): New macro.
2799         (stub_group_size): New option.
2800         * output.cc (Output_section::Output_section): Initialize memebers
2801         merge_section_map_, merge_section_by_properties_map_,
2802         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2803         (Output_section::add_input_section): Handled deferred code-fill
2804         generation and remove an old comment.
2805         (Output_section::add_relaxed_input_section): New method definition.
2806         (Output_section::add_merge_input_section): Use merge section by
2807         properties map to speed to search.  Update merge section maps
2808         as appropriate.
2809         (Output_section::build_relaxation_map): New method definition.
2810         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2811         Same.
2812         (Output_section::relax_input_section): Renamed to
2813         Output_section::convert_input_sections_to_relaxed_sections and change
2814         interface to take a vector of pointers to relaxed sections.
2815         (Output_section::find_merge_section,
2816         Output_section::find_relaxed_input_section): New method definitions.
2817         (Output_section::is_input_address_mapped,
2818         Output_section::output_offset, Output_section::output_address):
2819         Use output section data maps to speed up searching.
2820         (Output_section::find_starting_output_address): Add comments.
2821         (Output_section::do_write,
2822         Output_section::write_to_postprocessing_buffer): Do code-fill
2823         generation as appropriate.
2824         (Output_section::get_input_sections): Invalidate relaxed input section
2825         map.
2826         (Output_section::restore_states): Adjust type of checkpoint .
2827         Invalidate relaxed input section map.
2828         * output.h (Output_merge_base): New class declaration.
2829         (Input_section_specifier): New class defintion.
2830         (class Output_relaxed_input_section) Change base class to
2831         Output_section_data_build.
2832         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2833         base class initializer.
2834         (Output_section::add_relaxed_input_section): New method declaration.
2835         (Output_section::Input_section): Change visibility to protected.
2836         (Output_section::Input_section::relobj,
2837         Output_section::Input_section::shndx): Handle relaxed input sections.
2838         Output_section::input_sections) Change visibility to protected.  Also
2839         define overload to return a non-const pointer.
2840         (Output_section::Merge_section_properties): New class defintion.
2841         (Output_section::Merge_section_by_properties_map,
2842         Output_section::Output_section_data_by_input_section_map,
2843         Output_section::Relaxation_map): New types.
2844         (Output_section::relax_input_section): Rename method to
2845         Output_section::convert_input_sections_to_relaxed_sections and change
2846         interface to take a vector of relaxed section pointers.
2847         (Output_section::find_merge_section,
2848         Output_section::find_relaxed_input_section,
2849         Output_section::build_relaxation_map,
2850         Output_section::convert_input_sections_in_list_to_relaxed_sections):
2851         New method declarations.
2852         (Output_section::merge_section_map_
2853         Output_section::merge_section_by_properties_map_,
2854         Output_section::relaxed_input_section_map_,
2855         Output_section::is_relaxed_input_section_map_valid_,
2856         Output_section::generate_code_fills_at_write_): New data members.
2857         * script-sections.cc
2858         (Output_section_element_input::set_section_addresses): Call
2859         current_data_size and addralign methods of relaxed input sections.
2860         (Orphan_output_section::set_section_addresses): Call current_data_size
2861         and addralign methods of relaxed input sections.
2862         * symtab.cc (Symbol_table::compute_final_value): Extract template
2863         from the body of Symbol_table::sized_finalize_symbol.
2864         (Symbol_table::sized_finalized_symbol): Call
2865         Symbol_table::compute_final_value.
2866         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2867         (Symbol_table::compute_final_value): New templated method declaration.
2868         * target.cc (Target::do_make_output_section): New method defintion.
2869         * target.h (Target::make_output_section): New method declaration.
2870         (Target::relax): Add more parameters for input objects, symbol table
2871         and layout.  Adjust call to do_relax.
2872         (Target::do_make_output_section): New method declaration.
2873         (Target::do_relax): Add parameters for input objects, symbol table
2874         and layout.
2875
2876 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
2877
2878         * pread.c: Include stdio.h.
2879
2880 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
2881
2882         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2883         defined.
2884
2885 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
2886
2887         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2888         Change read_shndx type to unsigned int.
2889         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2890         int.
2891         (Sized_dwarf_line_info::read_line_mappings): Likewise.
2892         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2893         Change read_shndx type to unsigned int.
2894         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2895         int.
2896         (Sized_dwarf_line_info::read_line_mappings): Likewise.
2897         * layout.cc (Layout::create_symtab_sections): Cast the result of
2898         local_symcount * symsize to off_t in the gold_assert.
2899
2900 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2901
2902         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2903         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2904         R_ARM_BASE_ABS.
2905         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2906         (Arm_relocate_functions::thm_abs5): New function.
2907         (Arm_relocate_functions::abs12): New function.
2908         (Arm_relocate_functions::abs16): New function.
2909         (Arm_relocate_functions::base_abs): New function.
2910         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2911         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
2912         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2913         R_ARM_BASE_ABS.
2914         (Scan::global): Likewise.
2915         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2916         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2917         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2918         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2919         R_ARM_BASE_ABS.
2920
2921 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2922
2923         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2924         (Arm_relocate_functions::movt_prel): New function.
2925         (Arm_relocate_functions::thm_movw_prel_nc): New function.
2926         (Arm_relocate_functions::thm_movt_prel): New function.
2927         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2928         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2929         (Scan::global, Relocate::relocate): Likewise.
2930         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2931
2932 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
2933
2934         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2935         Incremental_checker.
2936         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2937         unsigned int.
2938         (class Incremental_inputs_header): New class.
2939         (Incremental_inputs_header_writer): Edit comment.
2940         (Incremental_inputs_entry): New class.
2941         (Incremental_inputs_entry_writer): Edit comment.
2942         (Sized_incremental_binary::do_find_incremental_inputs_section):
2943         Add *strtab_shndx parameter, fill it.
2944         (Sized_incremental_binary::do_check_inputs): New method.
2945         (Incremental_checker::can_incrementally_link_output_file): Use
2946         Sized_incremental_binary::check_inputs.
2947         (Incremental_inputs::report_command_line): Save command line in
2948         command_line_.
2949         * incremental.h:
2950         (Incremental_binary::find_incremental_inputs_section): New
2951         method.
2952         (Incremental_binary::do_find_incremental_inputs_section): Add
2953         strtab_shndx parameter.
2954         (Incremental_binary::do_check_inputs): New pure virtual method.
2955         (Sized_incremental_binary::do_check_inputs): Declare.
2956         (Incremental_checker::Incremental_checker): Add incremental_inputs
2957         parameter, use it to initialize incremental_inputs_.
2958         (Incremental_checker::incremental_inputs_): New field.
2959         (Incremental_checker::command_line): New method.
2960         (Incremental_checker::inputs): New method.
2961         (Incremental_checker::command_line_): New field.
2962
2963 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
2964
2965         * incremental.cc: Include <cstdarg> and "target-select.h".
2966         (vexplain_no_incremental): New function.
2967         (explain_no_incremental): New function.
2968         (Incremental_binary::error): New method.
2969         (Sized_incremental_binary::do_find_incremental_inputs_section): New
2970         method.
2971         (make_sized_incremental_binary): New function.
2972         (open_incremental_binary): New function.
2973         (can_incrementally_link_file): Add checks if output is ELF and has
2974         inputs section.
2975         * incremental.h: Include "elfcpp_file.h" and "output.h".
2976         (Incremental_binary): New class.
2977         (Sized_incremental_binary): New class.
2978         (open_incremental_binary): Declare.
2979         * object.cc (is_elf_object): Use
2980         elfcpp::Elf_recognizer::is_elf_file.
2981         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2982         * output.h (Output_file::filesize): New method.
2983
2984 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2985
2986         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2987         New function.
2988         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2989         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2990         function.
2991         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2992         function.
2993         (Arm_relocate_functions::movw_abs_nc): New function.
2994         (Arm_relocate_functions::movt_abs): New function.
2995         (Arm_relocate_functions::thm_movw_abs_nc): New function.
2996         (Arm_relocate_functions::thm_movt_abs): New function.
2997         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2998         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2999         (Scan::global): Likewise.
3000         (Relocate::relocate): Likewise.
3001         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3002
3003 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3004
3005         * arm.cc (Arm_relocate_functions::got_prel) New function.
3006         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
3007         (Relocate::relocate): Likewise.
3008         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3009
3010 2009-10-06  Ian Lance Taylor  <iant@google.com>
3011
3012         * options.h (class General_options): Define
3013         split_stack_adjust_size parameter.
3014         * object.h (class Object): Add uses_split_stack_ and
3015         has_no_split_stack_ fields.  Add uses_split_stack and
3016         has_no_split_stack accessor functions.  Declare
3017         handle_split_stack_section.
3018         (class Reloc_symbol_changes): Define.
3019         (class Sized_relobj): Define Function_offsets.  Declare
3020         split_stack_adjust, split_stack_adjust_reltype, and
3021         find_functions.
3022         * object.cc (Object::handle_split_stack_section): New function.
3023         (Sized_relobj::do_layout): Call handle_split_stack_section.
3024         * dynobj.cc (Sized_dynobj::do_layout): Call
3025         handle_split_stack_section.
3026         * reloc.cc (Sized_relobj::relocate_sections): Call
3027         split_stack_adjust for executable sections in split_stack
3028         objects.  Pass reloc_map to relocate_section.
3029         (Sized_relobj::split_stack_adjust): New function.
3030         (Sized_relobj::split_stack_adjust_reltype): New function.
3031         (Sized_relobj::find_functions): New function.
3032         * target-reloc.h: Include "object.h".
3033         (relocate_section): Add reloc_symbol_changes parameter.  Change
3034         all callers.
3035         * target.h (class Target): Add calls_non_split method.  Declare
3036         do_calls_non_split virtual method.  Declare match_view and
3037         set_view_to_nop.
3038         * target.cc: Include "elfcpp.h".
3039         (Target::do_calls_non_split): New function.
3040         (Target::match_view): New function.
3041         (Target::set_view_to_nop): New function.
3042         * gold.cc (queue_middle_tasks): Give an error if mixing
3043         split-stack and non-split-stack objects with -r.
3044         * i386.cc (Target_i386::relocate_section): Add
3045         reloc_symbol_changes parameter.
3046         (Target_i386::do_calls_non_split): New function.
3047         * x86_64.cc (Target_x86_64::relocate_section): Add
3048         reloc_symbol_changes parameter.
3049         (Target_x86_64::do_calls_non_split): New function.
3050         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
3051         parameter.
3052         * powerpc.cc (Target_powerpc::relocate_section): Add
3053         reloc_symbol_changes parameter.
3054         * sparc.cc (Target_sparc::relocate_section): Add
3055         reloc_symbol_changes parameter.
3056         * configure.ac: Call AM_CONDITIONAL for the default target.
3057         * configure: Rebuild.
3058         * testsuite/Makefile.am (TEST_AS): New variable.
3059         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
3060         (check_DATA): Add split_i386 and split_x86_64 files.
3061         (SPLIT_DEFSYMS): Define.
3062         (split_i386_[1234n].o): New targets.
3063         (split_i386_[124]): New targets.
3064         (split_i386_[1234r].stdout): New targets.
3065         (split_x86_64_[1234n].o): New targets.
3066         (split_x86_64_[124]): New targets.
3067         (split_x86_64_[1234r].stdout): New targets.
3068         (MOSTLYCLEANFILES): Add new executables.
3069         * testsuite/split_i386.sh: New file.
3070         * testsuite/split_x86_64.sh: New file.
3071         * testsuite/split_i386_1.s: New file.
3072         * testsuite/split_i386_2.s: New file.
3073         * testsuite/split_i386_3.s: New file.
3074         * testsuite/split_i386_4.s: New file.
3075         * testsuite/split_i386_n.s: New file.
3076         * testsuite/split_x86_64_1.s: New file.
3077         * testsuite/split_x86_64_2.s: New file.
3078         * testsuite/split_x86_64_3.s: New file.
3079         * testsuite/split_x86_64_4.s: New file.
3080         * testsuite/split_x86_64_n.s: New file.
3081         * testsuite/testfile.cc (Target_test): Update relocation_section
3082         function.
3083         * testsuite/Makefile.in: Rebuild.
3084
3085 2009-10-06  Ian Lance Taylor  <iant@google.com>
3086
3087         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
3088         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
3089         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
3090         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
3091         the address on ldo_addrs_.
3092         (Target_i386::Relocate::fix_up_ldo): New function.
3093
3094 2009-10-06   Rafael Espindola  <espindola@google.com>
3095
3096         * plugin.cc (add_input_library): New.
3097         (Plugin::load): Add add_input_library to tv.
3098         (Plugin_manager::add_input_file): Add the is_lib argument.
3099         (add_input_file): Update call to Plugin_manager::add_input_file.
3100         (add_input_library): New.
3101         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
3102
3103 2009-09-30  Doug Kwan  <dougkwan@google.com>
3104
3105         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
3106         symbol and call Symbol::may_need_copy_reloc to determine if
3107         a copy reloc is needed.
3108         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
3109         nocopyreloc is given in command line.
3110         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
3111         given in command line.
3112         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
3113         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
3114         of the removed Target_i386::may_need_copy_reloc.
3115         * options.h (copyreloc): New option with default value false.
3116         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3117         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
3118         instead of the removed Target_powerpc::may_need_copy_reloc.
3119         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3120         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
3121         instead of the removed Target_sparc::may_need_copy_reloc.
3122         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
3123         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
3124         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
3125         instead of the removed Target_x86_64::may_need_copy_reloc.
3126
3127 2009-09-30  Ian Lance Taylor  <iant@google.com>
3128
3129         * object.h (class Object): Remove target_ field, and target,
3130         sized_target, and set_target methods.
3131         (Object::sized_target): Remove.
3132         (class Sized_relobj): Update declarations.  Remove sized_target.
3133         * object.cc (Sized_relobj::setup): Remove target parameter.
3134         Change all callers.
3135         (Input_objects::add_object): Don't do anything with the target.
3136         (make_elf_sized_object): Add punconfigured parameter.  Change all
3137         callers.  Set or test parameter target.
3138         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
3139         Change all callers.
3140         * parameters.cc (Parameters::set_target): Change parameter type to
3141         be non-const.
3142         (Parameters::default_target): Remove.
3143         (set_parameters_target): Change parameter type to be non-const.
3144         (parameters_force_valid_target): New function.
3145         (parameters_clear_target): New function.
3146         * parameters.h (class Parameters): Update declarations.  Remove
3147         default_target method.  Add sized_target and clear_target
3148         methods.  Change target_ to be non-const.
3149         (set_parameters_target): Update declaration.
3150         (parameters_force_valid_target): Declare.
3151         (parameters_clear_target): Declare.
3152         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
3153         as NULL if we aren't searching.
3154         (Add_symbols::run): Don't check for compatible target.
3155         * fileread.cc (Input_file::open_binary): Call
3156         parameters_force_valid_target.
3157         * gold.cc (queue_middle_tasks): Likewise.
3158         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
3159         set_target on object.
3160         * dynobj.h (class Sized_dynobj): Update declarations.
3161         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
3162         make_elf_object returns NULL.
3163         (Archive::include_member): Don't check whether object target is
3164         compatible.
3165         * output.cc (Output_section::add_input_section): Get target from
3166         parameters.
3167         (Output_section::relax_input_section): Likewise.
3168         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
3169         parameters.
3170         (Sized_relobj::do_scan_relocs): Likewise.
3171         (Sized_relobj::relocate_sections): Likewise.
3172         * resolve.cc (Symbol_table::resolve): Likewise.
3173         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
3174         parameter.  Change all callers.
3175         (Symbol_table::add_from_object): Get target from parameters.
3176         (Symbol_table::add_from_relobj): Don't check object target.
3177         (Symbol_table::add_from_dynobj): Likewise.
3178         (Symbol_table::define_special_symbol): Get target from
3179         parameters.
3180         * symtab.h (class Symbol_table): Update declaration.
3181         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
3182         parameter.  Change all callers.  Clear parameter target.
3183         (Binary_test): Test target here.
3184         * testsuite/object_unittest.cc (gold_testsuite): Remove
3185         target_test_pointer parameter.  Change all callers.
3186         (Object_test): Test target here.
3187
3188 2009-09-26  Ian Lance Taylor  <iant@google.com>
3189
3190         * testsuite/initpri1.c: Don't try to use constructor priorities if
3191         compiling with gcc before 4.3.
3192
3193 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
3194
3195         * testsuite/retain_symbols_file_test.sh (check_present): Change
3196         output file name to retain_symbols_file_test.stdout.
3197         (check_absent): Likewise.
3198
3199 2009-09-18  Craig Silverstein  <csilvers@google.com>
3200
3201         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
3202         * options.cc: Include <cerrno> and <fstream>.
3203         (General_options::finalize): Parse -retain-symbols-file tag.
3204         * options.h: New flag.
3205         (General_options): New method should_retain_symbol, new
3206         variable symbols_to_retain.
3207         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
3208         should_retain_symbol map.
3209         * testsuite/Makefile.am (retain_symbols_file_test): New test.
3210         * testsuite/Makefile.in: Regenerate.
3211         * testsuite/retain_symbols_file_test.sh: New file.
3212
3213 2009-09-18  Nick Clifton  <nickc@redhat.com>
3214
3215         * po/es.po: Updated Spanish translation.
3216
3217 2009-09-17  Doug Kwan  <dougkwan@google.com>
3218
3219         * debug.h (DEBUG_RELAXATION): New constant.
3220         (DEBUG_ALL): Add DEBUG_RELAXATION.
3221         (debug_string_to_enum): Add relaxation debug option.
3222         * layout.cc
3223         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
3224         Layout::Relaxation_debug_check::read_sections,
3225         Layout::Relaxation_debug_check::read_sections): New method definitions.
3226         (Layout::Layout): Initialize data members
3227         record_output_section_data_from_scrips_,
3228         script_output_section_data_list_ and relaxation_debug_check_.
3229         (Layout::save_segments, Layout::restore_segments,
3230         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3231         Layout::relaxation_loop_body): New method definitions.
3232         (Layout::finalize): Support relaxation.  Move section layout code to
3233         Layout::relaxation_loop_body.
3234         (Layout::set_asection_address_from_script): Move code for orphan
3235         section placement out.
3236         (Layout::place_orphan_sections_in_script): New method definition.
3237         * layout.h (Output_segment_headers, Output_file_header):
3238         New forward class declarations.
3239         (Layout::~Layout): Define.
3240         (Layout::new_output_section_data_from_script): New method definition.
3241         (Layout::place_orphan_sections_in_script): New method declaration.
3242         (Layout::Segment_states): New type declaration.
3243         (Layout::save_segments, Layout::restore_segments,
3244         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3245         Layout::relaxation_loop_body): New method declarations.
3246         (Layout::Output_section_data_list): New type declaration.
3247         (Layout::Relaxation_debug_check): New class definition.
3248         (Layout::record_output_section_data_from_script_,
3249         Layout::script_output_section_data_list_, Layout::segment_states_,
3250         Layout::relaxation_debug_check_): New data members.
3251         * output.cc: (Output_section_headers::do_size): New method definition.
3252         (Output_section_headers::Output_section_headers): Move size
3253         computation to Output_section_headers::do_size.
3254         (Output_segment_headers::do_size): New method definition.
3255         (Output_file_header::Output_file_header): Move size computation to 
3256         Output_file_header::do_size and call it.
3257         (Output_file_header::do_size): New method definition.
3258         (Output_data_group::Output_data_group): Adjust call to
3259         Output_section_data.
3260         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
3261         (Output_symtab_xindex::do_write): Add array bound check.
3262         (Output_section::Input_section::print_to_mapfile): Handle
3263         RELAXED_INPUT_SECTION_CODE.
3264         (Output_section::Output_section): Initialize data member checkpoint_.
3265         (Output_section::~Output_section): Delete checkpoint object pointed
3266         by checkpoint_.
3267         (Output_section::add_input_section): Always add an Input_section if
3268         relaxing.
3269         (Output_section::add_merge_input_section): Add assert.
3270         (Output_section::relax_input_section): New method definition.
3271         (Output_section::set_final_data_size): Set load address to zero for
3272         an unallocated section.
3273         (Output_section::do_address_and_file_offset_have_reset_values):
3274         New method definition.
3275         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
3276         Handle relaxed input section.
3277         (Output_section::sort_attached_input_sections): Checkpoint input
3278         section list lazily.
3279         (Output_section::get_input_sections): Change type of input_sections to
3280         list of Simple_input_section pointers.  Checkpoint input section list
3281         lazily.  Also handle relaxed input sections.
3282         (Output_section::add_input_section_for_script): Take a reference to
3283         a Simple_input_section object instead of Relobj pointer and section
3284         index as parameter.  Handle relaxed input sections.
3285         (Output_section::save_states, Output_section::restore_states): New
3286         method definitions.
3287         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
3288         (Output_data::is_data_size_fixed): New method definition.
3289         (Output_data::reset_addresss_and_file_offset): Do not reset data size
3290         if it is fixed.
3291         (Output_data::address_and_file_offset_have_reset_values): New method
3292         definition.
3293         (Output_data::do_address_and_file_offset_have_reset_values): New method
3294         definition.
3295         (Output_data::set_data_size): Check that data size is not fixed.
3296         (Output_data::fix_data_size): New method definition.
3297         (Output_data::is_data_size_fixed_): New data member.
3298         (Output_section_headers::set_final_data_size): New method definition.
3299         (Output_section_headers::do_size): New method declaration.
3300         (Output_segment_headers::set_final_data_size): New method definition.
3301         (Output_segment_headers::do_size): New method declaration.
3302         (Output_file_header::set_final_data_size)::New method definition.
3303         (Output_file_header::do_size)::New method declaration.
3304         (Output_section_data::Output_section_data): Add new parameter
3305         is_data_size_fixed and use it to fix data size.
3306         (Output_data_const::Output_data_const): Adjust call to base class
3307         constructor and fix data size.
3308         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
3309         base class constructor and fix data size.
3310         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
3311         base class constructor and fix data size.
3312         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
3313         class constructor and fix data size.
3314         (Output_data_group::set_final_data_size): New method definition.
3315         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
3316         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
3317         class constructor and fix data size.
3318         (Output_relaxed_input_section): New class definition.
3319         (Output_section::Simple_input_section): New class definition.
3320         (Output_section::get_input_sections): Adjust parameter list.
3321         (Output_section::add_input_section_for_script): Same.
3322         (Output_section::save_states, Output_section::restore_states,
3323         Output_section::do_address_and_file_offset_have_reset_values,
3324         (Output_section::Input_section::Input_section): Handle
3325         RELAXED_INPUT_SECTION_CODE.  Add new overload for
3326         Output_relaxed_input_section.
3327         (Output_section::Input_section::is_input_section,
3328         Output_section::Input_section::set_output_section): Handle relaxed
3329         input section.
3330         (Output_section::Input_section::is_relaxed_input_section,
3331         Output_section::Input_section::output_section_data,
3332         Output_section::Input_section::relaxed_input_section): New method
3333         definitions.
3334         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
3335         value.
3336         (Output_section::Input_section::u1_): Update comments.
3337         (Output_section::Input_section::u2_): Add new union member poris.
3338         (Output_section::Checkpoint_output_section): New classs definition.
3339         (Output_section::relax_input_section): New method declaration.
3340         (Output_section::checkpoint_): New data member.
3341         (Output_segment): Update comments.
3342         (Output_segment::Output_segment): Un-privatize copy constructor.
3343         (Output_segment::operator=): Un-privatize.
3344         * script-sections.cc (Output_section_element::Input_section_list):
3345         Change element type to Output_section::Simple_input_section.
3346         (Output_section_element_dot_assignment::set_section_addresses):
3347         Register output section data for relaxation clean up.
3348         (Output_data_exression::Output_data_expression): Adjust call to base
3349         constructor to fix data size.
3350         (Output_section_element_data::set_section_addresses): Register
3351         Output_data_expression object for relaxation clean up.
3352         (struct Input_section_info): Replace Relobj pointer and section index
3353         pair with Output_section::Simple_input_section and Convert struct to a
3354         class.
3355         (Input_section_sorter::operator()): Adjust access to
3356         Input_section_info data member to use accessors. 
3357         (Output_section_element_input::set_section_addresses): Use layout
3358         parameter.  Adjust code to use Output_section::Simple_input_section
3359         and Input_secction_info classes.  Register filler for relaxation
3360         clean up.
3361         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
3362         and section index pair with Output_section::Simple_input_section
3363         class.  Adjust code accordingly.
3364         (Phdrs_element::release_segment): New method definition.
3365         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
3366         segment list.
3367         (Script_sections::release_segments): New method definition.
3368         * gold/script-sections.h (Script_sections::release_segments): New
3369         method declaration.
3370         * gold/target.h (Target::may_relax, Target::relax,
3371         Target::do_may_relax, Target::do_relax): New method definitions.
3372
3373 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3374
3375         * arm.cc (has_signed_unsigned_overflow): New function.
3376         (Arm_relocate_functions::abs8): New function.
3377         (Target_arm::Scan::local): Handle R_ARM_ABS8.
3378         (Target_arm::Scan::global): Likewise.
3379         (Target_arm::relocate::relocate): Likewise.
3380         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3381         Likewise.
3382
3383 2009-09-16  Cary Coutant  <ccoutant@google.com>
3384
3385         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
3386         * testsuite/Makefile.in: Regenerate.
3387
3388 2009-09-11  Nick Clifton  <nickc@redhat.com>
3389
3390         * po/gold.pot: Updated by the Translation project.
3391
3392 2009-09-08  Cary Coutant  <ccoutant@google.com>
3393
3394         * output.cc (Output_file::open): Add execute permission to empty file.
3395         * testsuite/Makefile.am (permission_test): New test.
3396         * testsuite/Makefile.in: Regenerate.
3397
3398 2009-09-02  Ian Lance Taylor  <iant@google.com>
3399
3400         * output.cc (Output_file::resize): Call map_no_anonymous rather
3401         than map.
3402
3403 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
3404
3405         * gold.cc: Include "incremental.h".
3406         (queue_initial_tasks): Call Incremental_checker methods.
3407         * incremental.cc: Include "output.h".
3408         (Incremental_checker::can_incrementally_link_output_file): New
3409         method.
3410         * incremental.h (Incremental_checker): New class.
3411
3412         * output.cc (Output_file::open_for_modification): New method.
3413         (Output_file::map_anonymous): Changed return type to bool.  Record
3414         map in base_ field.
3415         (Output_file::map_no_anonymous): New method, broken out of map.
3416         (Output_file::map): Use map_no_anonymous and map_anonymous.
3417         * output.h (class Output_file): Update declarations.
3418
3419 2009-08-24  Cary Coutant  <ccoutant@google.com>
3420
3421         * options.h (Command_line::Pre_options): New class.
3422         (Command_line::pre_options): New member.
3423         * options.cc (gold::options::ready_to_register): New variable.
3424         (One_option::register_option): Do nothing if not registering options.
3425         Assert if same short option registered twice.
3426         (General_options::General_options): Turn off option registration when
3427         done constructing.
3428         (Command_line::Pre_options::Pre_options): New constructor.
3429
3430 2009-08-24  Cary Coutant  <ccoutant@google.com>
3431
3432         * options.h (General_options::no_keep_memory): Remove incorrect
3433         short option.
3434
3435 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3436
3437         * Makefile.am (am__skiplex, am__skipyacc): New.
3438         * Makefile.in: Regenerate.
3439
3440 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3441
3442         * Makefile.am (AM_CPPFLAGS): Renamed from ...
3443         (INCLUDES): ... this.
3444         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
3445         (AM_CPPFLAGS): Renamed from ...
3446         (INCLUDE): ... this.
3447         * Makefile.in, testsuite/Makefile.in: Regenerate.
3448
3449         * Makefile.in: Regenerate.
3450         * aclocal.m4: Likewise.
3451         * config.in: Likewise.
3452         * configure: Likewise.
3453         * testsuite/Makefile.in: Likewise.
3454
3455         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3456         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3457         * Makefile.in: Regenerate.
3458         * testsuite/Makefile.in: Regenerate.
3459
3460 2009-08-19  Cary Coutant  <ccoutant@google.com>
3461
3462         * resolve.cc (Symbol_table::resolve): Don't complain about defined
3463         symbols in shared libraries overridden by hidden or internal symbols
3464         in the main program.
3465
3466 2009-08-19  Chris Demetriou  <cgd@google.com>
3467
3468         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
3469         checking source file names in error messages.
3470
3471 2009-08-18  Doug Kwan  <dougkwan@google.com>
3472
3473         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
3474         an elcpp::Ehdr as parameter.  Adjust call to set_target.
3475         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
3476         an elfcpp::Ehdr as parameter.
3477         * object.cc (Object::set_target): Remove the version that looks up
3478         a target and sets it.
3479         (Sized_relobj::setup): Take a Target object instead of
3480         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
3481         (make_elf_sized_object): Find target and ask target to
3482         make an ELF object.
3483         * object.h: (Object::set_target): Remove the version that looks up
3484         a target and sets it.
3485         (Sized_relobj::setup): Take a Target object instead of
3486         an elfcpp:Ehdr as parameter.
3487         * target.cc: Include dynobj.h.
3488         (Target::do_make_elf_object_implementation): New.
3489         (Target::do_make_elf_object): New.
3490         * target.h (Target::make_elf_object): New template declaration.
3491         (Target::do_make_elf_object): New method declarations.
3492         (Target::do_make_elf_object_implementation): New template declaration.
3493
3494 2009-08-14  Ian Lance Taylor  <iant@google.com>
3495
3496         * gold.h (FUNCTION_NAME): Define.
3497         (gold_unreachable): Use FUNCTION_NAME.
3498
3499 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
3500
3501         * icf.cc (Icf::find_identical_sections): Issue a warning when a
3502         symbol in the --keep-unique list is not found.
3503
3504 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
3505
3506         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
3507         been maked as --keep-unique.
3508         (Icf::unfold_section): New function.
3509         * icf.h (Icf::unfold_section): New function.
3510         * options.h (General_options::keep_unique): New option.
3511         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
3512         * testsuite/Makefile.in: Regenerate.
3513         * testsuite/icf_keep_unique_test.sh: New file.
3514         * testsuite/icf_keep_unique_test.cc: New file.
3515
3516 2009-08-12  Cary Coutant  <ccoutant@google.com>
3517
3518         PR 10471
3519         * resolve.cc (Symbol_table::resolve): Check for references from
3520         dynamic objects to hidden and internal symbols.
3521         * testsuite/Makefile.am (hidden_test.sh): New test.
3522         * testsuite/Makefile.in: Regenerate.
3523         * testsuite/hidden_test.sh: New script.
3524         * testsuite/hidden_test_1.c: New test source.
3525         * testsuite/hidden_test_main.c: New test source.
3526
3527 2009-08-11  Doug Kwan  <dougkwan@google.com>
3528
3529         * arm.cc: Update comments.
3530         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
3531         segment to locate the .ARM.exidx section if present.
3532
3533 2009-08-09  Doug Kwan  <dougkwan@google.com>
3534
3535         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
3536         patch.
3537
3538 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
3539         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
3540         compiler warnings.
3541
3542 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
3543
3544         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
3545         valid tls_segment only for non-debug-section relocations.
3546         * testsuite/Makefile.am: Add gc_tls_test.
3547         * testsuite/Makefile.in: Regenerate.
3548         * testsuite/gc_tls_test.cc: New file.
3549         * testsuite/gc_tls_test.sh: New file.
3550
3551 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
3552         
3553         * icf.cc: New file.
3554         * icf.h: New file.
3555         * Makefile.am (CCFILES): Add icf.cc.
3556         (HFILES): Add icf.h
3557         * Makefile.in: Regenerate.
3558         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
3559         * gc.h (gc_process_relocs): Populate lists used by icf to contain
3560         section, symbol and addend information for the relocs.
3561         * gold.cc (queue_middle_tasks): Call identical code folding.
3562         * gold.h: Add defines for multimap.
3563         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
3564         to the call of finalize_local_symbols.
3565         * main.cc (main): Create object of class Icf.
3566         * object.cc (Sized_relobj::do_layout): Allow this function to be
3567         called twice during icf.
3568         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
3569         to sections marked as identical by icf.
3570         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
3571         when available.
3572         (Sized_relobj::do_section_entsize): New function.
3573         * object.h (Object::section_entsize): New function.
3574         (Object::do_section_entsize): New pure virtual function.
3575         (Relobj::finalize_local_symbols): Add new parameter.
3576         (Relobj::do_section_entsize): New function.
3577         * options.h (General_options::icf): New option.
3578         (General_options::icf_iterations): New option.
3579         (General_options::print_icf_sections): New option.
3580         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
3581         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
3582         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
3583         icf.
3584         * symtab.cc (Symbol_table::is_section_folded): New function.
3585         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
3586         to sections marked as identical by icf.
3587         * symtab.h (Symbol_table::set_icf): New function.
3588         (Symbol_table::icf): New function.
3589         (Symbol_table::is_section_folded): New function.
3590         (Symbol_table::icf_): New data member.
3591         * target-reloc.h (relocate_section): Ignore sections folded by icf.
3592         * testsuite/Makefile.am: Add commands to build icf_test.
3593         * testsuite/Makefile.in: Regenerate.
3594         * testsuite/icf_test.sh: New file.
3595         * testsuite/icf_test.cc: New file.
3596
3597 2009-07-24  Chris Demetriou  <cgd@google.com>
3598
3599         * layout.cc (is_compressible_debug_section): Fix incorrect
3600         comment about compressed section names.
3601
3602 2009-07-20  Ian Lance Taylor  <ian@airs.com>
3603
3604         PR 10419
3605         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
3606
3607 2009-07-16  Ian Lance Taylor  <iant@google.com>
3608
3609         PR 10400
3610         * layout.h: #include <map>.
3611         (class Kept_section): Change from struct to class.  Add accessors
3612         and setters.  Add section size to Comdat_group mapping.  Change
3613         Comdat_group to std::map.  Add is_comdat_ field.  Add
3614         linkonce_size field in union.
3615         (class Layout): Update declaration of find_or_add_kept_section.
3616         Don't declare find_kept_object.
3617         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
3618         parameter.  Add object, shndx, is_comdat, and is_group_name
3619         parameters.  Change all callers.  Adjust for new Kept_section.
3620         (Layout::find_kept_object): Remove.
3621         * object.cc (Sized_relobj::include_section_group): Update use of
3622         Kept_section.  Rename secnum to shndx.  Only record
3623         Kept_comdat_section if sections are the same size.
3624         (Sized_relobj::include_linkonce_section): Update use of
3625         Kept_section.  Only record Kept_comdat_section if sections are the
3626         same size.  Set size of linkonce section.
3627         (Sized_relobj::map_to_kept_section): Update call to
3628         get_kept_comdat_section.
3629         * object.h (class Sized_relobj): Rename fields in
3630         Kept_comdat_section to drop trailing underscores; change object
3631         field to Relobj*.  Change Kept_comdat_section_table to store
3632         struct rather than pointer.
3633         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
3634         Add kept_object and kept_shndx parameters.  Change all callers.
3635         (Sized_relobj::get_kept_comdat_section): Change return type to
3636         bool.  Add kept_object and kept_shndx parameters.  Change all
3637         callers.
3638         * plugin.cc (Pluginobj::include_comdat_group): Update call to
3639         Layout::find_or_add_kept_section.
3640
3641 2009-07-09  Ian Lance Taylor  <iant@google.com>
3642
3643         * merge.cc (Object_merge_map::initialize_input_to_output_map):
3644         Reserve space in the hash table.
3645
3646 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
3647
3648         * fileread.cc (File_read::get_mtime): New method.
3649         * fileread.h (Timespec): New structure.
3650         (File_read::get_mtime): New method.
3651         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
3652         Renamed from timestamp_nsec.
3653         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
3654         Elf_Xword.
3655         (Incremental_inputs_entry_write::timestamp_usec): Renamed from 
3656         timestamp_nsec.
3657         (Incremental_inputs::report_archive): Save mtime; style fix. 
3658         (Incremental_inputs::report_obejct): Save mtime; style fix.
3659         (Incremental_inputs::report_script): Save mtime; style fix.
3660         (Incremental_inputs::finalize_inputs): Style fix.
3661         (Incremental_inputs::finalize): Style fix.
3662         (Incremental_inputs::create_input_section_data): Store inputs
3663         mtime.
3664         * incremental.h (Incremental_inputs::report_script): Add mtime
3665         argument.
3666         (Incremental_inputs::Input_info::Input_info): Intialize only one
3667         union member.
3668         (Incremental_inputs::Input_info::archive): Move to nameless
3669         union.
3670         (Incremental_inputs::Input_info::obejct): Move to nameless union.
3671         (Incremental_inputs::Input_info::script): Move to nameless union.
3672         (Incremental_inputs::mtime): New field.
3673         * script.cc (read_input_script): Pass file mtime to
3674         Incremental_input.
3675         * script.h (Script_info::inputs): Style fix.
3676
3677 2009-07-01  Ian Lance Taylor  <ian@airs.com>
3678
3679         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
3680         instead of 32.
3681
3682 2009-06-24  Ian Lance Taylor  <iant@google.com>
3683
3684         PR 10156
3685         * layout.cc (Layout::choose_output_section): If we find an
3686         existing section, update the flags.
3687         (Layout::create_notes): New function, broken out of
3688         Layout::finalize.
3689         (Layout::finalize): Don't create note sections.
3690         (Layout::create_note): Don't crash if linker script discards
3691         section.
3692         (Layout::create_gold_note): Likewise.
3693         (Layout::create_build_id): Likewise.  Don't set
3694         after_input_sections on the section.
3695         (Layout::create_executable_stack_info): Remove target parameter.
3696         Change caller.
3697         * layout.h (class Layout): Declare create_notes.  Update
3698         declaration of create_executable_stack_info.
3699         * gold.cc (queue_middle_tasks): Call create_notes.
3700         * output.cc (Output_section::update_flags_for_input_section): Move
3701         here from output.h.  If SHF_ALLOC flag is newly set, mark address
3702         invalid.
3703         * output.h (Output_data::mark_address_invalid): New function.
3704         (class Output_section): Only declare, not define,
3705         update_flags_for_input_section.  Remove set_flags.
3706
3707 2009-06-24  Ian Lance Taylor  <iant@google.com>
3708
3709         * script-sections.cc (Output_section_definition::
3710         set_section_addresses): Rename shadowing local load_address to
3711         laddr.
3712
3713 2009-06-24  Ian Lance Taylor  <iant@google.com>
3714
3715         PR 10244
3716         * reloc.cc (relocate_sections): Skip empty relocation sections.
3717
3718 2009-06-23  Ian Lance Taylor  <iant@google.com>
3719
3720         PR 10156
3721         * layout.cc (Layout::create_note): Use choose_output_section
3722         rather than make_output_section.
3723
3724 2009-06-23  Ian Lance Taylor  <iant@google.com>
3725
3726         PR 10237
3727         * options.cc (General_options::parse_V): Set printed_version_.
3728         (General_options::General_options): Initialize printed_version_.
3729         * options.h (class General_options): Add printed_version_ field.
3730         * gold.cc (queue_initial_tasks): If there are no input files,
3731         don't give a fatal error if we printed the version information.
3732         (queue_middle_tasks): If using -r with a shared object, give a
3733         fatal error rather than an ordinary error.
3734
3735 2009-06-23  Ian Lance Taylor  <iant@google.com>
3736
3737         PR 10219
3738         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3739         (Layout::make_output_section): Set have_stabstr_section_ if we see
3740         a .stab*str section.
3741         (Layout::finalize): Call link_stabs_sections.
3742         (Layout::link_stabs_sections): New file.
3743         * layout.h (class Layout): Add have_stabstr_section_ field.
3744         Declare link_stabs_sections.
3745
3746 2009-06-23  Doug Kwan  <dougkwan@google.com>
3747
3748         * Makefile.am (libgold_a_LIBADD): New.
3749         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3750         * Makefile.in: Regenerate.
3751         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3752         * configure: Regenerate.
3753         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3754         * fileread.cc: Include sys/state.h
3755         * gold.h: Declare memmem and strndup if found missing.
3756         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3757
3758 2009-06-23  Ian Lance Taylor  <iant@google.com>
3759
3760         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3761         * configure: Rebuild.
3762
3763 2009-06-23  Ian Lance Taylor  <iant@google.com>
3764
3765         PR 10147
3766         * object.cc (Object::section_contents): Don't try to get a view if
3767         the section has length zero.
3768         (Object::handle_gnu_warning_section): If the section is empty, use
3769         the name of the section as the warning.
3770
3771 2009-06-23  Ian Lance Taylor  <iant@google.com>
3772
3773         PR 10133
3774         * stringpool.h (class Stringpool_template): Add optimize_ field.
3775         (Stringpool_template::set_optimize): New function.
3776         * stringpool.cc (Stringpool_template::Stringpool_template):
3777         Initialize optimize_ field.
3778         (Stringpool_template::set_string_offsets): Test local optimize
3779         fild rather than parameter.
3780         * layout.cc (Layout::Layout): Call set_optimize on the section
3781         name stringpool.
3782
3783 2009-06-22  Ian Lance Taylor  <iant@google.com>
3784
3785         PR 10030
3786         * yyscript.y: Parse TARGET.
3787         * script.cc (script_set_target): New function.
3788         * script-c.h (script_set_target): Declare.
3789         * options.cc (General_options::string_to_object_format): Rename
3790         from string_to_object_format in anonymous namespace.  Change
3791         callers.
3792         * options.h (class General_options): Declare
3793         string_to_object_format.
3794
3795 2009-06-22  Ian Lance Taylor  <iant@google.com>
3796
3797         * script-sections.cc (Script_sections::create_segments): Don't put
3798         program headers in a PT_LOAD segment if -n or -N.
3799
3800 2009-06-22  Ian Lance Taylor  <iant@google.com>
3801
3802         PR 10141
3803         * options.h (class General_options): Add -z lazy and -z now.  Sort
3804         -z options into alphabetical order.
3805         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3806
3807 2009-06-21  Ian Lance Taylor  <iant@google.com>
3808
3809         * layout.cc (Layout::make_output_section): Call
3810         Target::new_output_section.
3811         (Layout::attach_allocated_section_to_segment): Put large section
3812         sections in a separate load segment with the large segment flag
3813         set.
3814         (Layout::segment_precedes): Sort large data segments after other
3815         load segments.
3816         (align_file_offset): New static function.
3817         (Layout::set_segment_offsets): Use align_file_offset.
3818         * output.h (class Output_section): Add is_small_section_ and
3819         is_large_section_ fields.
3820         (Output_section::is_small_section): New function.
3821         (Output_section::set_is_small_section):  New function.
3822         (Output_section::is_large_section): New function.
3823         (Output_section::set_is_large_section): New function.
3824         (Output_section::is_large_data_section): New function.
3825         (class Output_segment): Add is_large_data_segment_ field.
3826         (Output_segment::is_large_data_segment): New function.
3827         (Output_segment::set_is_large_data_segment): New function.
3828         * output.cc (Output_section::Output_section): Initialize new
3829         fields.
3830         (Output_segment::Output_segment): Likewise.
3831         (Output_segment::add_output_section): Add assertion that large
3832         data sections always go in large data segments.  Force small data
3833         sections to the end of the list of data sections.  Force small BSS
3834         sections to the start of the list of BSS sections.  For large BSS
3835         sections to the end of the list of BSS sections.
3836         * symtab.h (class Symbol): Declare is_common_shndx.
3837         (Symbol::is_defined): Check Symbol::is_common_shndx.
3838         (Symbol::is_common): Likewise.
3839         (class Symbol_table): Define enum Commons_section_type.  Update
3840         declarations.  Add small_commons_ and large_commons_ fields.
3841         * symtab.cc (Symbol::is_common_shndx): New function.
3842         (Symbol_table::Symbol_table): Initialize new fields.
3843         (Symbol_table::add_from_object): Put small and large common
3844         symbols in the right list.
3845         (Symbol_table::sized_finalized_symbol): Check
3846         Symbol::is_common_shndx.
3847         (Symbol_table::sized_write_globals): Likewise.
3848         * common.cc (Symbol_table::do_allocate_commons): Allocate new
3849         common symbol lists.  Don't call do_allocate_commons_list if the
3850         list is empty.
3851         (Symbol_table::do_allocate_commons_list): Remove is_tls
3852         parameter.  Add comons_section_type parameter.  Change all
3853         callers.  Handle small and large common symbols.
3854         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3855         Symbol::is_common_shndx.
3856         * resolve.cc (symbol_to_bits): Likewise.
3857         * target.h (Target::small_common_shndx): New function.
3858         (Target::small_common_section_flags): New function.
3859         (Target::large_common_shndx): New function.
3860         (Target::large_common_section_flags): New function.
3861         (Target::new_output_section): New function.
3862         (Target::Target_info): Add small_common_shndx, large_common_shndx,
3863         small_common_section_flags, and large_common_section_flags
3864         fields.
3865         (Target::do_new_output_section): New virtual function.
3866         * arm.cc (Target_arm::arm_info): Initialize new fields.
3867         * i386.cc (Target_i386::i386_info): Likewise.
3868         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3869         Likewise.
3870         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3871         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3872         (Target_x86_64::do_new_output_section): New function.
3873         * configure.ac: Define conditional MCMODEL_MEDIUM.
3874         * testsuite/Makefile.am (check_PROGRAMS): Add large.
3875         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3876         (large_LDFLAGS): Define.
3877         * testsuite/large.c: New file.
3878         * testsuite/testfile.cc (Target_test::test_target_info):
3879         Initialize new fields.
3880         * configure, testsuite/Makefile.in: Rebuild.
3881
3882 2009-06-05  Doug Kwan  <dougkwan@google.com>
3883
3884         * Makefile.am (CCFILES): Add target.cc.
3885         * Makefile.in: Regenerate. 
3886         * i386.cc (class Target_i386): Define new virtual method to
3887         override do_is_local_label_name in parent.
3888         * object.cc (Sized_relobj::do_count_local_symbols): Discard
3889         local symbols if --discard-locals or -X is given.
3890         * options.h (class General_options): Declare new options
3891         '--discard-locals' and '-X' for discarding locals.
3892         * target.h (class Target): Define new methods is_local_label_name.
3893         Declare new virtual method do_is_local_label_name.
3894         * target.cc: New file.
3895         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3896         (check_SCRIPTS): Add discard_locals_test.sh.
3897         (check_DATA): Add discard_local_tests.syms.
3898         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3899         (discard_local_tests.syms, discard_locals_test.o): New make rules.
3900         * testsuite/Makefile.in: Regenerate.
3901         * testsuite/discard_locals_test.c: New file.
3902         * testsuite/discard_locals_test.sh: Same.
3903
3904 2009-06-05  Doug Kwan  <dougkwan@google.com>
3905
3906         * object.cc (Sized_relobj::Sized_relobj): Initialize
3907         discarded_eh_frame_shndx_ to -1U.
3908         (Sized_relobj::do_layout): Record index of a discard .eh_frame
3909         section.
3910         (Sized_relobj::do_count_local_symbols): Skip local symbols in
3911         a discarded .eh_frame section.
3912         (Sized_relobj::do_finalize_local_symbols): Ditto.
3913         * object.h (class Sized_relobj): Declare new member
3914         discarded_eh_frame_shndx_.
3915         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3916         (local_labels_test.o, local_labels_test): New rules.
3917         * testsuite/Makefile.in: Regenerate.
3918
3919 2009-06-04  Doug Kwan  <dougkwan@google.com>
3920
3921         * layout.cc (Layout::section_name_mapping): Add mapping for
3922         special ARM sections.
3923
3924 2009-06-03  Doug Kwan  <dougkwan@google.com>
3925
3926         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3927         (utils::has_overflow): Same.
3928
3929 2009-06-03  Ian Lance Taylor  <iant@google.com>
3930
3931         * layout.cc (Layout::section_name_mapping): New array, replacing
3932         Layout::linkonce_mapping.
3933         (Layout::section_name_mapping_count): New variable, replacing
3934         Layout::linkonce_mapping_count.
3935         (Layout::linkonce_output_name): Remove.
3936         (Layout::output_section_name): Rewrite.
3937         * layout.h (class Layout): Rename Linkonce_mapping to
3938         Section_name_mapping, linkonce_mapping to section_name_mapping,
3939         linkonce_mapping_count to section_name_mapping_count.  Don't
3940         declare linkonce_output_name.
3941
3942 2009-06-03  Doug Kwan  <dougkwan@google.com>
3943
3944         * gold/arm.cc (namespace utils): New.
3945         (Target_arm::reloc_is_non_pic): Define new method.
3946         (class Arm_relocate_functions): New.
3947         (Target_arm::Relocate::relocate): Handle relocation types used by
3948         Android.
3949
3950 2009-06-03  Ian Lance Taylor  <iant@google.com>
3951
3952         * arm.cc (Target_arm::scan::global): Use || instead of |.
3953
3954 2009-06-02  Doug Kwan  <dougkwan@google.com>
3955
3956         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
3957         issued_non_pic_error_.
3958         (class Target_arm::Scan): Declare new method check_non_pic.
3959         Define new method symbol_needs_plt_entry.
3960         Declare new data member issued_non_pic_error_.
3961         (class Target_arm::Relocate): Declare new method
3962         should_apply_static_reloc.
3963         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3964         (Target_arm::Scan::check_non_pic): Define new method.
3965         (Target_arm::Scan::local): Handle a small subset of reloc types used
3966         by Android.
3967         (Target_arm::Scan::local): Same.
3968         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3969
3970 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
3971
3972         * incremental.cc (Incremental_inputs::report_command_line): Filter
3973         out --incremental-* options.
3974
3975 2009-05-29  Doug Kwan  <dougkwan@google.com>
3976
3977         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3978         template class.
3979         (class Target_arm): Update comment.
3980         (Target_arm::Target_arm): Initialize new data members GOT_,
3981         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3982         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3983         and Target_arm::rel_dyn_section.
3984         Declare new_enum Target_arm::Got_type.
3985         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3986         and DYNBSS_.
3987         Update commments for member do_dynsym_value.
3988         (Target_arm::got_size, Target_arm::plt_section,
3989         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3990         new methods inside class defintion.
3991         (Target_arm::got_section): Define new method.
3992         (Target_arm::rel_dyn_section): Same.
3993         (Output_data_plt_arm): New template class.
3994         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3995         (Output_data_plt_arm:do_adjust_output_section): Define new method.
3996         (Output_data_plt_arm::add_entry): Same.
3997         (Output_data_plt_arm::first_plt_entry): Define new
3998         static data member for PLT instruction template.
3999         (Output_data_plt_arm::plt_entry): Same.
4000         (Output_data_plt_arm::do_write): Define new method.
4001         (Target_arm::make_plt_entry): Same.
4002         (Target_arm::do_finalize_sections): Same.
4003         (Target_arm::do_dynsym_value): Same.
4004
4005 2009-05-28  Doug Kwan  <dougkwan@google.com>
4006
4007         * Makefile.am (TARGETSOURCES): Add arm.cc.
4008         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
4009         * Makefile.in: Regenerate.
4010         * arm.cc: New file.
4011         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
4012
4013 2009-05-26  Doug Kwan  <dougkwan@google.com>
4014
4015         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
4016         (General_options::check_excluded_libs): Strip off directories in
4017         archive name before matching like GNU ld does.
4018         * testsuite/Makefile.am (MOSTLYCLEANFILES,
4019         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
4020         (exclude_libs_test_LDFLAGS): Add linker option
4021         -Wl,--exclude-libs,libexclude_libs_test_3
4022         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
4023         an explicit archive without using -l.
4024         (alt/libexclude_libs_test_3.a): New make rule.
4025         * testsuite/Makefile.in: Regenerate.
4026         * testsuite/exclude_libs_test.c : Declare lib3_default().
4027         (main): Call it.
4028         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
4029         * exclude_libs_test_3.c: New file.
4030
4031 2009-05-26  Nick Clifton  <nickc@redhat.com>
4032
4033         * po/id.po: New Indonesian translation.
4034         * po/gold.pot: Updated template file.
4035
4036 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
4037
4038         * testsuite/Makefile.am: Add -ffunction-sections to compile 
4039         gc_comdat_test files.  Add -Wl,--gc-sections to build
4040         gc_comdat_test.
4041         * testsuite/Makefile.in: Regenerate.
4042         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
4043
4044 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
4045
4046         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
4047         kept comdat section was garbage collected.
4048         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
4049         * testsuite/Makefile.in: Regenerate.
4050         * testsuite/gc_comdat_test.sh: New file.
4051         * testsuite/gc_comdat_test_1.cc: New file.
4052         * testsuite/gc_comdat_test_2.cc: New file.
4053
4054 2009-05-19  Doug Kwan  <dougkwan@google.com>
4055
4056         * archive.cc (Archive::Archive): Move constructor from archive.h
4057         to here.  Initialize no_export_.
4058         (Archive::get_elf_object_for_member): Set no_export flag of object.
4059         * archive.h (Archive::Archive): Move constructor body to
4060         archive.cc.
4061         (Archive::no_export): New method.
4062         (Archive::no_export_): New field.
4063         * object.h (Object::Object): Initialize no_export_ to false.
4064         (Object::no_export, Object::set_no_export): New methods.
4065         (Object::no_export_): New field.
4066         * options.cc (General_options::parse_exclude_libs): New method.
4067         (General_options::check_excluded_libs) Same.
4068         * options.h (exclude_libs): New option.
4069         (General_options::check_excluded_libs): New method declaration.
4070         (General_options::excluded_libs_): New field.
4071         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
4072         default or protected visibility if an object has no-export flag set.
4073         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
4074         (check_SCRIPTS): Add exclude_libs_test.sh.
4075         (check_DATA): Add exclude_libs_test.syms.
4076         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
4077         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
4078         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
4079         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
4080         (exclude_libs_test.syms, libexclude_libs_test_1.a,
4081         libexclude_libs_test_2.a): New rules.
4082         * testsuite/Makefile.in: Regenerate.
4083         * testsuite/exclude_libs_test.c: New file.
4084         * testsuite/exclude_libs_test.sh: Ditto.
4085         * testsuite/exclude_libs_test_1.c: Ditto.
4086         * testsuite/exclude_libs_test_2.c: Ditto.
4087
4088 2009-05-15  Ian Lance Taylor  <iant@google.com>
4089
4090         * configure.ac: Check for declarations for cases where libiberty.h
4091         checks HAVE_DECL_xxx.
4092         * configure, config.in: Rebuild.
4093
4094 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
4095
4096         * gold.h (Incremental_argument_list): Remove (invalid) forward
4097         declaration.
4098         * incremental.cc (Incremental_inputs::report_achive): New method.
4099         (Incremental_inputs::report_object): New method.
4100         (Incremental_inputs::report_script): New method.
4101         (Incremental_inputs::finalize_inputs): New method.
4102         (Incremental_inputs::finalize): Call finalize_inputs().
4103         (Incremental_inputs::sized_create_incremental_inputs_section_data):
4104         Create inputs entries.
4105         * incremental.h (Incremental_input_type): New enum.
4106         (Incremental_inputs::Incremental_input): Initialize new fields.
4107         (Incremental_inputs::report_inputs): New method.
4108         (Incremental_inputs::report_achive): New method.
4109         (Incremental_inputs::report_object): New method.
4110         (Incremental_inputs::report_script): New method.
4111         (Incremental_inputs::finalize_inputs): New method.
4112         (Incremental_inputs::Input_info): New struct.
4113         (Incremental_inputs::Input_info_map): New typedef.
4114         (Incremental_inputs::lock_): New field.
4115         (Incremental_inputs::Inputs_): New field.
4116         (Incremental_inputs::Inputs_map): New field.
4117         * main.cc (main): Call Incremental_input::report_inputs.
4118         * options.h (Input_argument_list): Typedef moved from
4119         Input_arguments.
4120         (Input_file_group::Files): Remove, use ::Input_argument_list.
4121         (Input_file_group::Input_argument_list): Remove, use
4122         ::Input_argument_list.
4123         * plugin.cc (Plugin_manager::add_input_file): Add error in
4124         incremental build.
4125         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
4126         functions.
4127         * script.cc (read_input_script): Call
4128         Incremental_input::report_script.
4129         * script.h (Script_info): New class.
4130
4131 2009-04-27  Ian Lance Taylor  <iant@google.com>
4132
4133         * x86_64.cc (do_adjust_output_section): Set entsize to
4134         plt_entry_size.
4135
4136 2009-04-23  Elliott Hughes  <enh@google.com>
4137
4138         * output.cc (Output_file::close): After short writes, continue
4139         writing from the correct offset in the buffer being written.
4140
4141 2009-04-23  Chris Demetriou  <cgd@google.com>
4142
4143         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
4144         * configure: Regenerate.
4145         * config.in: Regenerate.
4146         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
4147         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
4148
4149 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
4150
4151         * incremental.cc (Incremental_inputs_header_data): Renamed from
4152         Incremental_input_header_data.
4153         (Incremental_inputs_header_data::data_size): New field.
4154         (Incremental_inputs_header_data::put_input_file_count): Renamed
4155         from input_file_count.
4156         (Incremental_inputs_header_data::put_command_line_offset): Renamed
4157         from command_line_offset.
4158         (Incremental_inputs_header_data::put_reserved): Renamed from
4159         put_reserved.
4160         (Incremental_inputs_entry_data): Renamed from
4161         Incremental_input_entry_data.
4162         (Incremental_inputs_entry_data::data_size): New field.
4163         (Incremental_inputs::report_command_line): New method.
4164         (Incremental_inputs::finalize): New method.
4165         (Incremental_inputs::create_incremental_inputs_data): New method.
4166         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
4167         * incremental.h: New file.
4168         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
4169        (Layout::finalize): Create incremental inputs section in
4170         incremental builds.
4171        (Layout::create_incremental_info_sections): New method.
4172         * layout.h (Layout::incremental_inputs): New method.
4173        (Layout::create_incremental_info_sections): New method.
4174        (Layout::incremental_inputs_): New field.
4175         * main.cc (main): Notify Incremental_input of the command line.
4176
4177 2009-04-01  Ian Lance Taylor  <iant@google.com>
4178             Mikolaj Zalewski  <mikolajz@google.com>
4179
4180         * gold.h (reserve_unordered_map): Define, three versions, one for
4181         each version of Unordered_map.
4182         * layout.cc (Layout::Layout): Remove options parameter.  Add
4183         number_of_input_files parameter.  Don't initialize options_.
4184         Initialize number_of_input_files_ and resized_signatures_.  Move
4185         sections_are_attached_.
4186         (Layout::layout_group): Reserve space for group_signatures_.
4187         (Layout::find_or_add_kept_section): Change name parameter to be a
4188         reference.  Resize signatures_ map when it gets large enough.
4189         (Layout::layout_eh_frame): Use parameters->options() instead of
4190         this->options_.
4191         (Layout::make_output_section): Likewise.
4192         (Layout::attach_allocated_section_to_segment): Likewise.
4193         (Layout::finalize, Layout::create_executable_stack): Likewise.
4194         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
4195         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
4196         * layout.h (class Layout): Update declarations.  Remove options_
4197         field.  Add number_of_input_files_ and resized_signatures_
4198         fields.  Move sections_are_attached_ field.
4199         * main.cc (main): Pass number of input files to Layout
4200         constructor.  Don't pass options.
4201
4202 2009-03-30  Ian Lance Taylor  <iant@google.com>
4203
4204         * ffsll.c (ffsll): Correct implementation.
4205
4206 2009-03-27  Ian Lance Taylor  <iant@google.com>
4207
4208         * ffsll.c: New file.
4209         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
4210         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
4211         * ftruncate.c (ftruncate): Declare before definition.
4212         * mremap.c (mremap): Likewise.
4213         * pread.c (pread): Likewise.
4214         * configure, Makefile.in, config.in: Rebuild.
4215
4216         * mremap.c: New file.
4217         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
4218         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
4219         (mremap): Declare if HAVE_MREMAP is not defined.
4220         * configure, Makefile.in, config.in: Rebuild.
4221
4222 2009-03-27  Cary Coutant  <ccoutant@google.com>
4223
4224         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
4225         position independent.
4226         * sparc.cc (Target_sparc::check_non_pic): Likewise.
4227         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
4228
4229 2009-03-24  Cary Coutant  <ccoutant@google.com>
4230
4231         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
4232         an executable.
4233         (needs_dynamic_reloc): Likewise.
4234
4235 2009-03-24  Ian Lance Taylor  <iant@google.com>
4236
4237         * yyscript.y (file_cmd): Recognize EXTERN.
4238         (extern_name_list, extern_name_list_body): New nonterminals.
4239         * script.cc (script_add_extern): Define.
4240         * script-c.h (script_add_extern): Declare.
4241
4242 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
4243
4244         * object.cc (is_elf_object): Define.
4245         * object.h (is_elf_object): Declare.
4246         * archive.cc (Archive::get_elf_object_for_member): Call
4247         is_elf_object.
4248         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
4249
4250 2009-03-24  Elliott Hughes  <enh@google.com>
4251
4252         * output.cc (Output_file::map_anonymous): Define.
4253         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
4254         try an anonymous one.  Report the size if the mmap fails.
4255         * output.h (class Output_file): Declare map_anonymous.
4256
4257 2009-03-24  Ian Lance Taylor  <iant@google.com>
4258
4259         * target-select.cc (instantiate_target): Don't acquire the lock if
4260         the instantiated_target_ field has already been set.
4261
4262 2009-03-23  Ian Lance Taylor  <iant@google.com>
4263
4264         * gold-threads.h (class Initialize_lock): Define.
4265         * gold-threads.cc (class Initialize_lock_once): Define.
4266         (initialize_lock_control): New static variable.
4267         (initialize_lock_pointer): New static variable.
4268         (initialize_lock_once): New static function.
4269         (Initialize_lock::Initialize_lock): Define.
4270         (Initialize_lock::initialize): Define.
4271         * target-select.h: Include "gold-threads.h".
4272         (class Target_selector): Add lock_ and initialize_lock_ fields.
4273         Don't define instantiate_target, just declare it.
4274         * target-select.cc (Target_selector::Target_selector): Initialize
4275         new fields.
4276         (Target_selector::instantiate_target): Define.
4277         * descriptors.h: Include "gold-threads.h".
4278         (class Descriptors): Add initialize_lock_ field.
4279         * descriptors.cc (Descriptors::Descriptors): Initialize new
4280         field.
4281         (Descriptors::open): Use initialize_lock_ field
4282         * errors.h (class Errors): Add initialize_lock_ field.
4283         * errors.cc (Errors::Errors): Initialize new field.
4284         (Errors::initialize_lock): Use initialize_lock_ field.
4285         * powerpc.cc (class Target_selector_powerpc): Remove
4286         instantiated_target_ field.  In do_recognize call
4287         instantiate_target rather than do_instantiate_target.  In
4288         do_instantiate_target just allocate a new target.
4289         * sparc.cc (class Target_selector_sparc): Likewise.
4290
4291         * freebsd.h: New file.
4292         * i386.cc: Include "freebsd.h".
4293         (Target_i386): Derive from Target_freebsd rather than
4294         Sized_target.
4295         (Target_selector_i386): Derive from Target_selector_freebsd rather
4296         than Target_selector.
4297         * x86_64.cc: Include "freebsd.h".
4298         (Target_x86_64): Derive from Target_freebsd rather than
4299         Sized_target.
4300         (Target_selector_x86_64): Derive from Target_selector_freebsd
4301         rather than Target_selector.
4302         * target.h (class Target): Add adjust_elf_header and
4303         do_adjust_elf_header.
4304         * output.cc (Output_file_header:: do_sized_write): Call target
4305         adjust_elf_header routine.
4306         * configure.tgt: Set targ_osabi.
4307         * configure.ac: Define GOLD_DEFAULT_OSABI.
4308         * parameters.cc (Parameters::default_target): Pass
4309         GOLD_DEFAULT_OSABI to select_target.
4310         * target-select.h (class Target_selector): Make instantiate_target
4311         protected rather than private.
4312         * Makefile.am (HFILES): Add freebsd.h.
4313         * configure, Makefile.in, config.in: Rebuild.
4314
4315         * merge.cc (do_add_input_section): Correct pend value.  Change
4316         message about last entry not being null terminated from error to
4317         warning.
4318
4319 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
4320
4321         * incremental.cc: New file.
4322         * Makefile.am (CCFILES): Add incremental.cc.
4323         * Makefile.in: Rebuild.
4324
4325 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
4326
4327         * layout.cc (Layout::output_section_name): Preserve names
4328         of '.note.' sections.
4329         
4330 2009-03-19  Ian Lance Taylor  <iant@google.com>
4331
4332         * descriptors.cc (Descriptors::open): Check that the options are
4333         valid before using them.
4334
4335 2009-03-18  Ian Lance Taylor  <iant@google.com>
4336
4337         * script-sections.h: Include <list>.
4338         (class Script_sections): Change Sections_elements from std::vector
4339         to std::list.  Typedef public Elements_iterator.  Add
4340         orphan_section_placement_, data_segment_align_start_, and
4341         saw_data_segment_align_ fields.  Remove data_segment_align_index_
4342         field.
4343         * script-sections.cc (class Orphan_section_placement): New class.
4344         (class Sections_element): Add virtual functions is_relro and
4345         orphan_section_init.  Remove virtual function place_orphan_here.
4346         (class Output_section_definition): Add is_relro and
4347         orphan_section_init.  Remove place_orphan_here.
4348         (class Orphan_output_section): Likewise.
4349         (Script_sections::Script_sections): Update for field changes.
4350         (Script_sections::data_segment_align): Set saw_data_segment_align_
4351         and data_segment_align_start_, not data_segment_align_index.
4352         (Script_sections::data_segment_relro_end): Check
4353         saw_data_segment_align_.  Use data_segment_align_start_ rather
4354         than data_segment_align_index_.
4355         (Script_sections::place_orphan): Rewrite to use
4356         Orphan_section_placement.
4357
4358 2009-03-17  Ian Lance Taylor  <iant@google.com>
4359
4360         * archive.cc (Archive::add_symbols): Check for a version attached
4361         to the symbol name in the archive map.
4362         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
4363         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
4364         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
4365         (ver_test_11.a): New target.
4366         * testsuite/Makefile.in: Rebuild.
4367
4368         * configure.ac: Check for chsize and posix_fallocate.  Replace
4369         ftruncate.
4370         * ftruncate.c: New file, from gnulib.
4371         * output.cc (posix_fallocate): Define dummy version if not
4372         HAVE_POSIX_FALLOCATE.
4373         (Output_file::map): Call posix_fallocate rather than lseek and
4374         write.
4375         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
4376         * configure, Makefile.in, config.in: Rebuild.
4377
4378 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
4379         
4380         * layout.h (Layout::create_note): Add section_name parameter.
4381         * layout.cc (Layout::create_note): Likewise.
4382         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
4383         
4384 2009-03-17  Ian Lance Taylor  <iant@google.com>
4385
4386         * descriptors.cc: Include "options.h".
4387         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
4388         (Descriptors::open): Always use O_CLOEXEC when opening a new
4389         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
4390         then set FD_CLOEXEC.
4391
4392         * sparc.cc (class Target_sparc): Add has_got_section.
4393         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
4394         make sure we have a GOT section.
4395
4396         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
4397         (Target_sparc::Scan::local): Likewise.
4398         (Target_sparc::Scan::global): Likewise.
4399         (Target_sparc::Relocate::relocate): Likewise.
4400         (Target_sparc::Relocate::relocate_tls): Likewise.
4401
4402         * symtab.cc (Symbol_table::define_default_version): New function,
4403         broken out of add_from_object.
4404         (Symbol_table::add_from_object): Call define_default_version.
4405         (Symbol_table::define_special_symbol): Add resolve_oldsym
4406         parameter.  Change all callers.  If the version for a symbol comes
4407         from a version script, resolve it with the symbol with the same
4408         name with no version.  Also add the symbol without a version if
4409         appropriate.
4410         (do_define_in_output_data): If resolving with oldsym, don't delete
4411         sym.
4412         (do_define_in_output_segment): Likewise.
4413         (do_define_as_constant): Likewise.
4414         * symtab.h (class Symbol_table): Update declarations.
4415
4416 2009-03-13  Ian Lance Taylor  <iant@google.com>
4417
4418         * readsyms.cc (Read_symbols::incompatible_warning): New function.
4419         (Read_symbols::requeue): New function.
4420         (Read_symbols::do_read_symbols): If make_elf_object fails because
4421         the target type is not configured, and the file was searched for,
4422         issue a warning and retry with the next directory.
4423         (Add_symbols::run): If the file has an incompatible format, and
4424         it was searched for, requeue the Read_symbols task.  On error,
4425         release the object.
4426         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
4427         dirindex parameter to constructor.  Change all callers.  Declare
4428         incompatible_warning and requeue.
4429         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
4430         input_argument_ and input_group_ fields.  Add them to
4431         constructor.  Change all callers.
4432         (class Read_script): Add dirindex_ field.  Add it to constructor.
4433         Change all callers.
4434         * archive.cc (Archive::setup): Remove input_objects parameter.
4435         Change all callers.
4436         (Archive::get_file_and_offset): Likewise.
4437         (Archive::read_all_symbols): Likewise.
4438         (Archive::read_symbols): Likewise.
4439         (Archive::get_elf_object_for_member): Remove input_objects
4440         parameter.  Add punconfigured parameter.  Change all callers.
4441         (Archive::add_symbols): Change return type to bool.  Check return
4442         value of include_member.
4443         (Archive::include_all_members): Likewise.
4444         (Archive::include_member): Change return type to bool.  Return
4445         false if first included object has incompatible target.  Set
4446         included_member_ field.
4447         (Add_archive_symbols::run): If add_symbols returns false, requeue
4448         Read_symbols task.
4449         * archive.h (class Archive): Add included_member_ field.
4450         Initialize it in constructor.  Add input_file and searched_for
4451         methods.  Update declarations.
4452         (class Add_archive_symbols): Add dirpath_, dirindex_, and
4453         input_argument_ fields.  Add them to constructor.  Change all
4454         callers.
4455         * script.cc: Include "target-select.h".
4456         (class Parser_closure): Add skip_on_incompatible_target_ and
4457         found_incompatible_target_ fields.  Add
4458         skip_on_incompatible_target parameter to constructor.  Change all
4459         callers.  Add methods skip_on_incompatible_target,
4460         clear_skip_on_incompatible_target, found_incompatible_target, and
4461         set_found_incompatible_target.
4462         (read_input_script): Add dirindex parameter.  Change all callers.
4463         If parser finds an incompatible target, requeue Read_symbols
4464         task.
4465         (script_set_symbol): Clear skip_on_incompatible_target in
4466         closure.
4467         (script_add_assertion, script_parse_option): Likewise.
4468         (script_start_sections, script_add_phdr): Likewise.
4469         (script_check_output_format): New function.
4470         * script.h (read_input_script): Update declaration.
4471         * script-c.h (script_check_output_format): Declare.
4472         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
4473         (ignore_cmd): Remove OUTPUT_FORMAT.
4474         * fileread.cc (Input_file::Input_file): Add explicit this.
4475         (Input_file::will_search_for): New function.
4476         (Input_file::open): Add pindex parameter.  Change all callers.
4477         * fileread.h (class Input_file): Add input_file_argument method.
4478         Declare will_search_for.  Update declarations.
4479         * object.cc (make_elf_object): Add punconfigured parameter.
4480         Change all callers.
4481         * object.h (class Object): Make input_file public.  Add
4482         searched_for method.
4483         (make_elf_object): Update declaration.
4484         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
4485         restart search.
4486         * dirsearch.h (class Dirsearch): Update declaration.
4487         * options.h (class General_options): Add --warn-search-mismatch.
4488         * parameters.cc (Parameters::is_compatible_target): New function.
4489         * parameters.h (class Parameters): Declare is_compatible_target.
4490         * workqueue.cc (Workqueue::add_blocker): New function.
4491         * workqueue.h (class Workqueue): Declare add_blocker.
4492
4493         * fileread.cc (Input_file::open): Remove options parameter.
4494         Change all callers.
4495         (Input_file::open_binary): Likewise.
4496         * script.cc (read_input_script): Likewise.
4497         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
4498         options parameter from constructor.  Change all callers.
4499         (class Read_script): Likewise.
4500         * fileread.h (class Input_file): Update declarations.
4501         * script.h (read_input_script): Update declaration.
4502
4503 2009-03-10  Nick Clifton  <nickc@redhat.com>
4504
4505         * po/es.po: New Spanish translation.
4506
4507 2009-03-06  Cary Coutant  <ccoutant@google.com>
4508
4509         * options.cc (parse_short_option): Keep dash_z from registering itself.
4510
4511 2009-03-03  Ian Lance Taylor  <iant@google.com>
4512
4513         PR 9918
4514         * target-reloc.h (relocate_section): Pass output_section to
4515         relocate.
4516         * i386.cc (Target_i386::should_apply_static_reloc): Add
4517         output_section parameter.  Change all callers.
4518         (Target_i386::Relocate::relocate): Add output_section parameter.
4519         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4520         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
4521         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
4522         * testsuite/two_file_shared.sh: New script.
4523         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
4524         (check_DATA): Add two_file_shared.dbg.
4525         (two_file_shared.dbg): New target.
4526         * testsuite/Makefile.in: Rebuild.
4527
4528 2009-03-01  Ian Lance Taylor  <iant@google.com>
4529
4530         * configure.ac: Check for byteswap.h.
4531         * configure: Rebuild.
4532         * config.in: Rebuild.
4533
4534 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
4535
4536         * layout.cc (Layout::find_or_add_kept_section): New function.
4537         (Layout::add_comdat): Removed.
4538         * layout.h (struct Kept_section): Move out of class Layout.
4539         Remove trailing underscores from field names.  Add group_sections
4540         field.  Rename group_ field to is_group.  Change all uses.
4541         (class Layout): Declare find_or_add_kept_section, not add_comdat.
4542         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
4543         comdat_groups_ field.
4544         (Sized_relobj::include_section_group): Use
4545         find_or_add_kept_section and Kept_section::group_sections.
4546         (Sized_relobj::include_linkonce_section): Likewise.
4547         * object.cc (class Sized_relobj): Don't define Comdat_group or
4548         Comdat_group_table.  Remove find_comdat_group and
4549         add_comdat_group.  Remove comdat_groups_ field.
4550         * plugin.cc (include_comdat_group): Use
4551         Layout::find_or_add_kept_section.
4552
4553 2009-02-28  Ian Lance Taylor  <iant@google.com>
4554
4555         * README: --gc-sections and map files are now supported.  Document
4556         some build requirements.
4557
4558         PR 6992
4559         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
4560         relocatable link set the value of the section symbol to zero.
4561         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
4562         relocatable link don't include the section address in the local
4563         symbol value.
4564
4565 2009-02-27  Ian Lance Taylor  <iant@google.com>
4566
4567         PR 6811
4568         * options.h (class Search_directory): Add is_system_directory.
4569         (class General_options): Declare is_in_system_directory.
4570         * options.cc (get_relative_sysroot): Make static.
4571         (get_default_sysroot): Make static.
4572         (General_optoins::is_in_system_directory): New function.
4573         * fileread.cc (Input_file::is_in_system_directory): New function.
4574         * fileread.h (class Input_file): Declare is_in_system_directory.
4575         * object.h (class Object): Add is_in_system_directory.
4576         (class Input_objects): Remove system_library_directory_ field.
4577         * object.cc (Input_objects::add_object): Don't set
4578         system_library_directory_.
4579         (input_objects::found_in_system_library_directory): Remove.
4580         * symtab.cc (Symbol_table::write_globals): Remove input_objects
4581         parameter.  Change all callers.
4582         (Symbol_table::sized_write_globals): Likewise.
4583         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
4584         Call Object::is_in_system_directory.
4585         * symtab.h (class Symbol_table): Update declarations.
4586
4587         PR 5990
4588         * descriptors.h (Open_descriptor): Add is_on_stack field.
4589         * descriptors.cc (Descriptors::open): If the descriptor is on the
4590         top of the stack, remove it.  Initialize is_on_stack field.
4591         (Descriptors::release): Only add pod to stack if it is not on the
4592         stack already.
4593         (Descriptors::close_some_descriptor): Clear stack_next and
4594         is_on_stack fields.
4595
4596         PR 7091
4597         * output.cc (Output_section::find_starting_output_address): Rename
4598         from starting_output_address; add PADDR parameter; change return
4599         type.
4600         * output.h (class Output_section): Declare
4601         find_starting_output_address instead of starting_output_address.
4602         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
4603         section symbol for which we can't find a merge section.
4604
4605         PR 9836
4606         * symtab.cc (Symbol_table::add_from_object): If the visibility is
4607         hidden or internal, force the symbol to be local.
4608         * resolve.cc (Symbol::override_visibility): Define.
4609         (Symbol::override_base): Use override_visibility.
4610         (Symbol_table::resolve): Likewise.
4611         (Symbol::override_base_with_special): Likewise.
4612         (Symbol_table::override_with_special): If the visibility is hidden
4613         or internal, force the symbol to be local.
4614         * symtab.h (class Symbol): Add set_visibility and
4615         override_visibility.
4616         * testsuite/ver_test_1.sh: New file.
4617         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
4618         (check_DATA): Add ver_test_1.syms.
4619         (ver_test_1.syms): New target.
4620         * testsuite/Makefile.in: Rebuild.
4621
4622 2009-02-25  Cary Coutant  <ccoutant@google.com>
4623
4624         * layout.cc (Layout::choose_output_section): Don't rename sections
4625         when using a linker script that has a SECTIONS clause.
4626         * Makefile.in: Regenerate.
4627
4628         * testsuite/Makefile.am (script_test_5.sh): New test case.
4629         * testsuite/Makefile.in: Regenerate.
4630         * testsuite/script_test_5.cc: New file.
4631         * testsuite/script_test_5.sh: New file.
4632         * testsuite/script_test_5.t: New file.
4633
4634 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
4635
4636         * archive.cc (Archive::include_member): Update calls to add_symbols.
4637         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
4638         the Layout argument.
4639         * dynobj.h (do_add_symbols): Add the Layout argument.
4640         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
4641         Layout argument.
4642         * object.h (Object::add_symbols): Add the Layout argument.
4643         (Object::do_add_symbols): Add the Layout argument.
4644         (Sized_relobj::do_add_symbols): Add the Layout argument.
4645         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
4646         Unify the two versions.
4647         (Add_plugin_symbols): Remove.
4648         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
4649         (Sized_pluginobj::do_add_symbols): Unify the two versions.
4650         (Add_plugin_symbols): Remove.
4651         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
4652         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
4653         (Add_symbols::run): Make it work with Pulginobj.
4654
4655 2009-02-06  Ian Lance Taylor  <iant@google.com>
4656
4657         * object.cc (Sized_relobj::do_layout): Make info message start
4658         with lower case letter.
4659
4660 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
4661
4662         * binary.cc: Fix file comment.
4663
4664         * options.h (enum Incremental_disposition): Define.
4665         (class General_options): Add new options: --incremental,
4666         --incremental_changed, --incremental_unchanged,
4667         --incremental_unknown.  Add incremental_disposition_ and
4668         implicit_incremental_ fields.
4669         (General_options::incremental_disposition): New function.
4670         (class Position_dependent_options): Add incremental_disposition
4671         option.
4672         (Position_dependent_options::copy_from_options): Set incremental
4673         dispositions.
4674         * options.cc (General_options::parse_incremental_changed): New
4675         function.
4676         (General_options::parse_incremental_unchanged): New function.
4677         (General_options::parse_incremental_unknown): New function.
4678         (General_options::General_options): Initialize new fields
4679         incremental_disposition_ and implicit_incremental_.
4680         (General_options::finalize): Check for uasge of --incremental-*
4681         without --incremental.
4682
4683 2009-02-06  Chris Demetriou  <cgd@google.com>
4684
4685         * gold.h (gold_undefined_symbol): Change to take only a Symbol
4686         pointer and to report location as the file name associated with
4687         the symbol.
4688         (gold_undefined_symbol_at_location): New function to replace the
4689         old gold_undefined_symbol functionality.
4690         * target-reloc.h (relocate_section): Update to use
4691         gold_undefined_symbol_at_location.
4692         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4693         Call gold_undefined_symbol function rather than gold_error.
4694         * errors.h (Errors::undefined_symbol): Take location as a
4695         string, rather than calculating it from a relocation.
4696         * errors.cc (Errors::fatal): Print "fatal error:" before the
4697         formatted message.
4698         (Errors::error, Errors::error_at_location): Print "error: "
4699         before the formatted message.
4700         (Errors::undefined_symbol): Take location as a string, rather
4701         than calculating it from a relocation.
4702         (gold_undefined_symbol_at_location): New function akin to
4703         old gold_undefined_symbol, calculates location from relocation.
4704         (gold_undefined_symbol): Change to take only a Symbol pointer
4705         and to report location as the file name associated with the symbol.
4706         * testsuite/debug_msg.sh: Update for changed error messages.
4707         * testsuite/undef_symbol.sh: Likewise.
4708
4709 2009-02-04  Duncan Sands  <baldrick@free.fr>
4710
4711         PR 9812
4712         * reduced_debug_output.h
4713         (Output_reduced_debug_abbrev_section::failed): Use format for
4714         gold_warning.
4715         (Output_reduced_debug_info_section::faild): Likewise.
4716
4717 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
4718
4719         * script.cc (Lazy_demangler): New class.
4720         (Version_script_info::get_symbol_version_helper): Demangle a
4721         symbol only once.
4722
4723 2009-01-29  Cary Coutant  <ccoutant@google.com>
4724
4725         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4726         to __tls_get_addr.
4727         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4728
4729 2009-01-28  Ian Lance Taylor  <iant@google.com>
4730
4731         * version.cc (version_string): Bump to 1.9.
4732
4733         * gold.h: Include <cstring> and <stdint.h>.
4734         * version.cc: Include <cstdio>.
4735         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4736         warning.
4737         * reduced_debug_output.cc (insert_into_vector): Rename from
4738         Insert_into_vector; change all callers.  Use Swap_unaligned to
4739         avoid aliasing issue; remove union since it is unnecessary.
4740
4741 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
4742
4743         * Makefile.am (CCFILES): Add gc.cc.
4744         (HFILES): Add gc.h.
4745         * Makefile.in: Regenerate.
4746         * gold.cc (Gc_runner): New class.
4747         (queue_initial_tasks): Call garbage collection related tasks
4748         when corresponding options are invoked.
4749         (queue_middle_gc_tasks): New function.
4750         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4751         processed early before laying out sections during garbage collection.
4752         * gold.h (queue_middle_gc_tasks): New function.
4753         (is_prefix_of): Move from "layout.cc".
4754         * i386.cc (Target_i386::gc_process_relocs): New function.
4755         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4756         * main.cc (main): Create object of class "Garbage_collection".
4757         * object.cc (Relobj::copy_symbols_data): New function.
4758         (Relobj::is_section_name_included): New function.
4759         (Sized_relobj::do_layout): Allow this function to be called twice 
4760         during garbage collection and defer layout of section during the 
4761         first call.
4762         * object.h (Relobj::get_symbols_data): New function.
4763         (Relobj::is_section_name_included): New function.
4764         (Relobj::copy_symbols_data): New function.
4765         (Relobj::set_symbols_data): New function.
4766         (Relobj::get_relocs_data): New function.
4767         (Relobj::set_relocs_data): New function.
4768         (Relobj::is_output_section_offset_invalid): New pure virtual function.
4769         (Relobj::gc_process_relocs): New function.
4770         (Relobj::do_gc_process_relocs): New pure virtual function.
4771         (Relobj::sd_): New data member.
4772         (Sized_relobj::is_output_section_offset_invalid): New function.
4773         (Sized_relobj::do_gc_process_relocs): New function.
4774         * options.h (General_options::gc_sections): Modify to not be a no-op.
4775         (General_options::print_gc_sections): New option.
4776         * plugin.cc (Plugin_finish::run): Remove function call to
4777         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
4778         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4779         * reloc.cc (Read_relocs::run): Add task to process relocs and
4780         determine unreferenced sections when doing garbage collection.
4781         (Gc_process_relocs): New class.
4782         (Sized_relobj::do_gc_process_relocs): New function.
4783         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4784         sections that are garbage collected.
4785         * reloc.h (Gc_process_relocs): New class.
4786         * sparc.cc (Target_sparc::gc_process_relocs): New function.
4787         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4788         symbols whose corresponding sections are garbage collected.
4789         (Symbol_table::Symbol_table): Add new parameter for the garbage
4790         collection object.
4791         (Symbol_table::gc_mark_undef_symbols): New function.
4792         (Symbol_table::gc_mark_symbol_for_shlib): New function.
4793         (Symbol_table::gc_mark_dyn_syms): New function.
4794         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4795         as garbage.
4796         (Symbol_table::add_from_object): Likewise.
4797         (Symbol_table::add_from_relobj): When building shared objects, do not
4798         treat externally visible symbols as garbage.
4799         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4800         table information for static and relocatable links.
4801         * symtab.h (Symbol_table::set_gc): New function.
4802         (Symbol_table::gc): New function.
4803         (Symbol_table::gc_mark_undef_symbols): New function.
4804         (Symbol_table::gc_mark_symbol_for_shlib): New function.
4805         (Symbol_table::gc_mark_dyn_syms): New function.
4806         (Symbol_table::gc_): New data member.
4807         * target.h (Sized_target::gc_process_relocs): New pure virtual 
4808         function.
4809         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4810         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4811
4812 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
4813
4814         * options.h (General_options::gc_sections): Define as a no-op for now.
4815         (General_options::no_keep_memory): Ditto.
4816         (General_options::Bshareable): Define.
4817         * options.cc (General_options::finalize): Honor -Bshareable.
4818
4819 2009-01-20  Andreas Schwab  <schwab@suse.de>
4820
4821         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4822         read the value in the contents, since we don't use it.  Use the
4823         template endianness when writing.
4824         (Relocate::relocate): Use it for R_PPC_REL16_HA.
4825
4826 2009-01-19  Andreas Schwab  <schwab@suse.de>
4827
4828         * configure.tgt (powerpc64-*): Fix targ_obj.
4829
4830 2009-01-15  Ian Lance Taylor  <iant@google.com>
4831
4832         * object.cc (Sized_relobj::write_local_symbols): Don't write out
4833         local symbols when stripping all symbols.
4834
4835 2009-01-14  Cary Coutant  <ccoutant@google.com>
4836
4837         * output.cc (Output_reloc): Add explicit instantiations.
4838
4839 2009-01-14  Cary Coutant  <ccoutant@google.com>
4840
4841         * archive.cc (Archive::get_elf_object_for_member): Remove call
4842         to File_read::claim_for_plugin.
4843         * descriptors.cc (Descriptors::open): Remove reference to
4844         is_claimed.
4845         (Descriptors::claim_for_plugin): Remove.
4846         * descriptors.h (Descriptors::claim_for_plugin): Remove.
4847         (Descriptors::is_claimed): Remove.
4848         (claim_descriptor_for_plugin): Remove.
4849         * fileread.cc (File_read::claim_for_plugin): Remove.
4850         * fileread.h (File_read::claim_for_plugin): Remove.
4851         (File_read::descriptor): Reopen descriptor if necessary.
4852         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
4853         (Plugin_manager::all_symbols_read): Add task parameter. Change
4854         all callers.
4855         (Plugin_manager::get_input_file): New function.
4856         (Plugin_manager::release_input_file): New function.
4857         (Pluginobj::Pluginobj): Add filesize parameter and initialize
4858         corresponding data member.
4859         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4860         and pass to base constructor. Change all callers.
4861         (get_input_file, release_input_file): New functions.
4862         (make_sized_plugin_object): Add filesize parameter. Change all callers.
4863         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4864         (Plugin_manager::all_symbols_read): Add task parameter.
4865         (Plugin_manager::get_input_file): New function.
4866         (Plugin_manager::release_input_file): New function.
4867         (Plugin_manager::task_): New data member.
4868         (Pluginobj::Pluginobj): Add filesize parameter.
4869         (Pluginobj::filename): New function.
4870         (Pluginobj::descriptor): New function.
4871         (Pluginobj::filesize): New function.
4872         (Pluginobj::filesize_): New data member.
4873         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4874         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4875         File_read::claim_for_plugin; use Object::unlock to unlock the file.
4876
4877         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4878         with archive libraries.
4879         * testsuite/Makefile.in: Regenerate.
4880         * testsuite/plugin_test.c (struct sym_info): New type.
4881         (get_input_file, release_input_file): New static variables.
4882         (onload): Capture new transfer vector entries.
4883         (claim_file_hook): Stop reading at end of file according to filesize.
4884         Factor out parsing of readelf output into separate function.
4885         (all_symbols_read_hook): Exercise get_input_file and release_input_file
4886         APIs and get the source file name from the symbol table.  Convert
4887         source file name to corresponding object file name.  Print info
4888         message when adding new input files.
4889         (parse_readelf_line): New function.
4890         * testsuite/plugin_test_1.sh: Add checks for new info messages.
4891         * testsuite/plugin_test_2.sh: Likewise.
4892         * testsuite/plugin_test_3.sh: Likewise.
4893         * testsuite/plugin_test_4.sh: New test case.
4894
4895 2009-01-07  Ian Lance Taylor  <iant@google.com>
4896
4897         * version.cc (version_string): Bump to 1.8.
4898
4899 2008-12-23  Cary Coutant  <ccoutant@google.com>
4900
4901         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4902         * plugin.cc (Plugin_manager::finish): Rename as
4903         layout_deferred_objects.  Move cleanup to separate function.
4904         (Plugin_manager::cleanup): New function.
4905         (Plugin_finish::run): Call layout_deferred_objects and cleanup
4906         separately.
4907         * plugin.h (Plugin_manager::finish): Rename as
4908         layout_deferred_objects.
4909         (Plugin_manager::cleanup): New function.
4910         (Plugin_manager::cleanup_done): New field.
4911
4912 2008-12-23  Cary Coutant  <ccoutant@google.com>
4913
4914         * plugin.cc (is_visible_from_outside): New function.
4915         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4916         so we don't return "IR only" status for exported symbols or -r links.
4917
4918         * testsuite/Makefile.am (plugin_test_3): New test case.
4919         * testsuite/Makefile.in: Regenerate.
4920         * testsuite/plugin_test_3.sh: New file.
4921
4922 2008-12-22  Cary Coutant  <ccoutant@google.com>
4923
4924         * object.cc (Sized_relobj::layout_section): New function.
4925         (Sized_relobj::do_layout): Defer layout of input sections until after
4926         plugin has provided replacement files.
4927         (Sized_relobj::do_layout_deferred_sections): New function.
4928         * object.h (Relobj::set_section_offset): Remove virtual keyword.
4929         (Relobj::layout_deferred_sections): New function.
4930         (Relobj::do_layout_deferred_sections): New function.
4931         (Sized_relobj::do_layout_deferred_sections): New function.
4932         (Sized_relobj::layout_section): New function.
4933         (Sized_relobj::Deferred_layout): New structure.
4934         (Sized_relobj::deferred_layout_): New field.
4935         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4936         Change all callers.  Layout deferred sections.
4937         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
4938         references.
4939         (Plugin_hook::run): Move code from do_plugin_hook inline.
4940         (Plugin_hook::do_plugin_hook): Remove.
4941         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4942         (Plugin_manager::finish): Renamed, was cleanup.
4943         (Plugin_manager::should_defer_layout): New function.
4944         (Plugin_manager::add_deferred_layout_object): New function.
4945         (Plugin_manager::Deferred_layout_list): New type.
4946         (Plugin_manager::deferred_layout_objects_): New field.
4947         (Plugin_hook::do_plugin_hook): Remove.
4948
4949 2008-12-17  Ian Lance Taylor  <iant@google.com>
4950
4951         * options.h (class General_options): Add --no case for
4952         --export-dynamic.
4953
4954 2008-12-16  Cary Coutant  <ccoutant@google.com>
4955
4956         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4957         vector.
4958         (Plugin_manager::claim_file): Create plugin object even if
4959         plugin did not call the add_symbols callback.
4960         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4961         asking for more symbols than were added.
4962         * testsuite/Makefile.am (plugin_test_1): Add test case with
4963         no global symbols.
4964         (empty.syms): New target.
4965         * testsuite/Makefile.in: Regenerate.
4966         * testsuite/plugin_test.c (claim_file_hook): Add new debug
4967         message. Don't call add_symbols if no globals.
4968         (all_symbols_read_hook): Don't provide replacement for empty
4969         claimed file.
4970
4971 2008-12-12  Ian Lance Taylor  <iant@google.com>
4972
4973         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4974         r_type == 0 for a local symbol with r_sym == 0.
4975         (scan_relocatable_relocs): Pass r_sym to
4976         local_non_section_strategy.
4977         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4978         r_sym parameter.
4979
4980         * configure.ac: Update test for TLS descriptors: they are
4981         supported as of glibc 2.9.
4982         * configure: Rebuild.
4983
4984 2008-12-11  Ian Lance Taylor  <iant@google.com>
4985
4986         PR 7091
4987         * target-reloc.h (Default_scan_relocatable_relocs): For each
4988         function, map r_type == 0 to RELOC_DISCARD.
4989
4990 2008-12-10  Cary Coutant  <ccoutant@google.com>
4991
4992         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4993         object to override a kept COMDAT group from a plugin object.
4994
4995 2008-12-09  Ian Lance Taylor  <iant@google.com>
4996
4997         PR 7088
4998         * yyscript.y (file_cmd): Handle INPUT.
4999
5000         * testsuite/initpri1.c: Change all declarations to be full
5001         prototypes by adding void, to avoid compiler warnings.
5002
5003 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
5004
5005         * options.cc (General_options::parse_plugin_opt): New.
5006         (General_options::add_plugin): The argument now is just the filename.
5007         (General_options::add_plugin_option): New.
5008         * options.h (plugin_opt): New.
5009         (add_plugin): Change argument name.
5010         (add_plugin_option): New.
5011         * plugin.cc (Plugin::load): Don't parse the plugin option.
5012         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
5013         (Plugin::add_option): New.
5014         (Plugin::args_): Change type.
5015         (Plugin::filename_): New.
5016         (Plugin_manager::add_plugin_option): New.
5017         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
5018         * testsuite/Makefile.in: Regenerate.
5019
5020 2008-12-05  Cary Coutant  <ccoutant@google.com>
5021
5022         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
5023         Handle --strip-lto-sections option.
5024         * options.h (strip_lto_sections): New option.
5025
5026 2008-12-01  Cary Coutant  <ccoutant@google.com>
5027
5028         * plugin.cc (ld_plugin_message): Change format parameter to const.
5029         Fix mismatch between new[] and delete.
5030
5031 2008-11-14  Cary Coutant  <ccoutant@google.com>
5032
5033         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
5034         instead of -1U.
5035
5036 2008-11-05  Craig Silverstein  <csilvers@google.com>
5037
5038         * options.cc (General_options::parse_dynamic_list): New function.
5039         * options.h (General_options): New flags dynamic_list,
5040         dynamic_list_data, dynamic_list_cpp_new, and
5041         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
5042         (General_options::in_dynamic_list): New function.
5043         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
5044         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
5045         (Lex::can_continue_name): Likewise.
5046         (yylex): Likewise.
5047         (read_script_file): New parameter script_options.
5048         (read_dynamic_list): New function.
5049         (Script_options::define_dynamic_list): New function.
5050         (dynamic_list_keyword_parsecodes): New variable.
5051         (dynamic_list_keywords): New variable.
5052         * script.h (Script_options::define_dynamic_list): New function
5053         prototype.
5054         (read_dynamic_list): New function prototype.
5055         * symtab.cc (strprefix): New macro.
5056         (Symbol::should_add_dynsym_entry): Support dynamic_list,
5057         dynamic_list_data, dynamic_list_cpp_new, and
5058         dynamic_list_cpp_typeinfo.
5059         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
5060         (dynamic_list_expr): New rule.
5061         (dynamic_list_nodes): Likewise.
5062         (dynamic_list_node): Likewise.
5063         * testsuite/Makefile.am (dynamic_list): New test.
5064         * testsuite/Makefile.in: Regenerated.
5065         * testsuite/dynamic_list.t: New file.
5066         * testsuite/dynamic_list.sh: New file.
5067
5068 2008-11-05  Craig Silverstein  <csilvers@google.com>
5069
5070         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
5071         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
5072         (t11_last): Likewise.
5073         * testsuite/ver_test_6.c (main): Likewise.
5074
5075 2008-10-07  Cary Coutant  <ccoutant@google.com>
5076
5077         * options.c (General_options::finalize): Add check for -static and
5078         -shared.
5079         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
5080         is not empty.
5081
5082 2008-10-02  Cary Coutant  <ccoutant@google.com>
5083
5084         * plugin.cc (make_sized_plugin_object): Fix conditional
5085         compilation to work when not all targets are enabled.
5086
5087 2008-09-29  Cary Coutant  <ccoutant@google.com>
5088
5089         * archive.cc (Archive::get_file_and_offset): Use filename instead
5090         of name to get library path.
5091         (Archive::include_member): Unlock external member of a thin archive.
5092
5093         * testsuite/Makefile.am (TEST_AR): New variable.
5094         (thin_archive_test_1): New test.
5095         (thin_archive_test_2): New test.
5096         * testsuite/Makefile.in: Regenerate.
5097         * testsuite/thin_archive_main.cc: New file.
5098         * testsuite/thin_archive_test_1.cc: New file.
5099         * testsuite/thin_archive_test_2.cc: New file.
5100         * testsuite/thin_archive_test_3.cc: New file.
5101         * testsuite/thin_archive_test_4.cc: New file.
5102
5103 2008-09-29  Cary Coutant  <ccoutant@google.com>
5104
5105         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
5106         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
5107         instead of -1U.
5108         (Sized_relobj::do_finalize_local_symbols): Likewise.
5109         (Sized_relobj::map_to_kept_section): Likewise.
5110         * object.h (Sized_relobj::invalid_address): New constant.
5111         (Sized_relobj::do_output_section_offset): Check for invalid_address
5112         and return -1ULL.
5113         * output.cc (Output_reloc::local_section_offset): Use constant
5114         invalid_address instead of -1U.
5115         (Output_reloc::get_address): Likewise.
5116         (Output_section::output_address): Change -1U to -1ULL.
5117         * output.h (Output_reloc::invalid_address): New constant.
5118         * reloc.cc (Sized_relobj::write_sections): Use constant
5119         invalid_address instead of -1U.
5120         (Sized_relobj::relocate_sections): Likewise.
5121         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
5122         values for merge sections.
5123         * target-reloc.h (relocate_for_relocatable): Use constant
5124         invalid_address instead of -1U.
5125
5126 2008-09-19  Cary Coutant  <ccoutant@google.com>
5127
5128         Add plugin functionality for link-time optimization (LTO).
5129         * configure.ac (plugins): Add --enable-plugins option.
5130         * configure: Regenerate.
5131         * config.in: Regenerate.
5132         * Makefile.am (LIBDL): New variable.
5133         (CCFILES): Add plugin.cc.
5134         (HFILES): Add plugin.h.
5135         (ldadd_var): Add LIBDL.
5136         * Makefile.in: Regenerate.
5137
5138         * archive.cc: Include "plugin.h".
5139         (Archive::setup): Don't preread archive symbols when using a plugin.
5140         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
5141         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
5142         files.
5143         (Archive::include_member): Add symbols from plugin objects.
5144         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
5145         * descriptors.cc (Descriptors::open): Check for file descriptors
5146         abandoned by plugins.
5147         (Descriptors::claim_for_plugin): New function.
5148         * descriptors.h (Descriptors::claim_for_plugin): New function.
5149         (Open_descriptor::is_claimed): New field.
5150         (claim_descriptor_for_plugin): New function.
5151         * fileread.cc (File_read::claim_for_plugin): New function.
5152         * fileread.h (File_read::claim_for_plugin): New function.
5153         (File_read::descriptor): New function.
5154         * gold.cc: Include "plugin.h".
5155         (queue_initial_tasks): Add task to call plugin hooks for generating
5156         new object files.
5157         * main.cc: Include "plugin.h".
5158         (main): Load plugin libraries.
5159         * object.h (Pluginobj): Declare.
5160         (Object::pluginobj): New function.
5161         (Object::do_pluginobj): New function.
5162         (Object::set_target): New function.
5163         * options.cc: Include "plugin.h".
5164         (General_options::parse_plugin): New function.
5165         (General_options::General_options): Initialize plugins_ field.
5166         (General_options::add_plugin): New function.
5167         * options.h (Plugin_manager): Declare.
5168         (General_options): Add --plugin option.
5169         (General_options::has_plugins): New function.
5170         (General_options::plugins): New function.
5171         (General_options::add_plugin): New function.
5172         (General_options::plugins_): New field.
5173         * plugin.cc: New file.
5174         * plugin.h: New file.
5175         * readsyms.cc: Include "plugin.h".
5176         (Read_symbols::do_read_symbols): Check for archive before checking
5177         for ELF file.  Call plugin hooks to claim files.
5178         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
5179         from a real object file; force override when processing replacement
5180         files.
5181         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
5182         (Symbol::init_base_object): Likewise.
5183         (Symbol::init_base_output_data): Likewise.
5184         (Symbol::init_base_output_segment): Likewise.
5185         (Symbol::init_base_constant): Likewise.
5186         (Symbol::init_base_undefined): Likewise.
5187         (Symbol::output_section): Assert that object is not a plugin.
5188         (Symbol_table::add_from_pluginobj): New function.
5189         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
5190         undefined.
5191         (Symbol_table::sized_write_globals): Likewise.
5192         (Symbol_table::add_from_pluginobj): Instantiate template.
5193         * symtab.h (Sized_pluginobj): Declare.
5194         (Symbol::in_real_elf): New function.
5195         (Symbol::set_in_real_elf): New function.
5196         (Symbol::in_real_elf_): New field.
5197         (Symbol_table::add_from_pluginobj): New function.
5198
5199         * testsuite/Makefile.am (AM_CFLAGS): New variable.
5200         (LIBDL): New variable.
5201         (LDADD): Add LIBDL.
5202         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
5203         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
5204         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
5205         (MOSTLYCLEANFILES): Likewise.
5206         * testsuite/Makefile.in: Regenerate.
5207         * testsuite/plugin_test.c: New file.
5208         * testsuite/plugin_test_1.sh: New file.
5209         * testsuite/plugin_test_2.sh: New file.
5210
5211 2008-09-16  Ian Lance Taylor  <iant@google.com>
5212
5213         * target-reloc.h (relocate_section): Check whether a symbol is
5214         defined by the ABI before reporting an undefined symbol error.
5215         * target.h (Target::is_defined_by_abi): Make parameter const.
5216         (Target::do_is_defined_by_abi): Likewise.
5217         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
5218         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
5219         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
5220         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
5221         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
5222         * testsuite/Makefile.in: Rebuild.
5223
5224         * fileread.cc (make_view): Add casts to avoid warning.
5225
5226 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
5227
5228         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
5229         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5230
5231 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
5232
5233         * options.h (General_options::output_is_executable): New.
5234         (General_options::output_is_pie): New.
5235         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
5236         for shared libraries.
5237         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5238
5239 2008-09-11  Chris Demetriou  <cgd@google.com>
5240
5241         * options.h (origin): New -z option.
5242         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
5243         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
5244         in DT_FLAGS_1.
5245
5246 2008-09-05  Cary Coutant  <ccoutant@google.com>
5247
5248         * fileread.cc (File_read::make_view): Add check for attempt to map
5249         beyond end of file.
5250
5251 2008-09-05  Cary Coutant  <ccoutant@google.com>
5252
5253         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
5254         explicit instantiations.
5255
5256 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
5257
5258         PR gold/6858
5259         * options.cc (General_options::finalize): Allow undefined symbols
5260         in shlibs if linking -shared.
5261
5262         PR gold/6859
5263         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
5264         symbols as not needing a dynsym entry.
5265
5266 2008-08-20  Craig Silverstein  <csilvers@google.com>
5267
5268         * fileread.cc (File_read::open): Do not lock the file unless it
5269         was successfully opened.
5270
5271 2008-08-14  Cary Coutant  <ccoutant@google.com>
5272
5273         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
5274         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
5275         * testsuite/tls_test.cc (struct int128): 128-bit struct
5276         for testing TLS relocs with non-zero addend.
5277         (v12): New TLS variable.
5278         (t12): New test.
5279         (t_last): Add check for v12.
5280         * testsuite/tls_test.h (t12): New function.
5281         * testsuite/tls_test_main.cc (thread_routine): Call new test.
5282
5283 2008-08-13  Ian Lance Taylor  <iant@google.com>
5284
5285         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
5286         set tls_segment_ or relro_segment_.
5287         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
5288         when appropriate.
5289         * output.h (Output_section::clear_is_relro): New function.
5290         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
5291         sections specially even when output_data_ is empty.
5292         (Output_segment::maximum_alignment): When first section is relro,
5293         only force alignment for PT_LOAD segments.
5294         * script.cc (script_data_segment_align): New function.
5295         (script_data_segment_relro_end): New function.
5296         * script-c.h (script_data_segment_align): Declare.
5297         (script_data_segment_relro_end): Declare.
5298         * script-sections.h (class Script_sections): Declare
5299         data_segment_align and data_segment_relro_end.  Add fields
5300         segment_align_index_ and saw_relro_end_.
5301         * script-sections.cc (class Sections_element): Add set_is_relro
5302         virtual function.  Add new bool* parameter to place_orphan_here.
5303         Add get_output_section virtual function.
5304         (class Output_section_definition): Add set_is_relro.  Add new
5305         bool* parameter to place_orphan_here.  Add get_output_section.
5306         Add is_relro_ field.
5307         (Output_section_definition::Output_section_definition): Initialize
5308         evaluated_address_, evaluated_load_address, evaluated_addralign_,
5309         and is_relro_ fields.
5310         (Output_section_definition::place_orphan_here): Add is_relro
5311         parameter.
5312         (Output_section_definition::set_section_addresses): Set relro for
5313         output section.
5314         (Output_section_definition::alternate_constraint): Likewise.
5315         (class Orphan_output_section): Add new bool* parameter to
5316         place_orphan_here.  Add get_output_section.
5317         (Orphan_output_section::place_orphan_here): Add is_relro
5318         parameter.
5319         (Script_sections::Script_sections): Initialize
5320         data_segment_align_index_ and saw_relro_end_.
5321         (Script_sections::data_segment_align): New function.
5322         (Script_sections::data_segment_relro_end): New function.
5323         (Script_sections::place_orphan): Set or clear is_relro.
5324         (Script_sections::set_section_addresses): Force alignment of first
5325         TLS section.
5326         * yyscript.y (exp): Call script_data_segment_align and
5327         script_data_segment_relro_end.
5328         * testsuite/relro_script_test.t: New file.
5329         * testsuite/relro_test.cc (using_script): Declare.
5330         (t1, t2): Test using_script.
5331         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
5332         (relro_script_test_SOURCES): Define.
5333         (relro_script_test_DEPENDENCIES): Define.
5334         (relro_script_test_LDFLAGS): Define.
5335         (relro_script_test_LDADD): Define.
5336         (relro_script_test.so): New target.
5337         * testsuite/Makefile.in: Rebuild.
5338
5339 2008-08-06  Cary Coutant <ccoutant@google.com>
5340
5341         * archive.cc (Archive::total_archives, Archive::total_members)
5342         (Archive::total_members_loaded): New variables.
5343         (Archive::setup): Add parameter.  Add option to preread
5344         archive symbols.
5345         (Archive::read_armap): Add counter.
5346         (Archive::get_file_and_offset): New function.
5347         (Archive::get_elf_object_for_member): New function.
5348         (Archive::read_all_symbols): New function.
5349         (Archive::read_symbols): New function.
5350         (Archive::add_symbols): Add counters.
5351         (Archive::include_all_members): Use armap to find members if it's
5352         already built.
5353         (Archive::include_member): Skip reading symbols if already read.
5354         Factored code into Archive::get_file_and_offset and
5355         Archive::get_elf_object_for_member.  Changed call to
5356         Mapfile::report_include_archive_member.
5357         (Archive::print_stats): New function.
5358         * archive.h: Declare Object and Read_symbols_data classes.
5359         (Archive::Archive): Add initializers for new members.
5360         (Archive::setup): Add parameter.
5361         (Archive::print_stats): New function.
5362         (Archive::total_archives, Archive::total_members)
5363         (Archive::total_members_loaded): New variables.
5364         (Archive::get_file_and_offset): New function.
5365         (Archive::get_elf_object_for_member): New function.
5366         (Archive::read_all_symbols): New function.
5367         (Archive::read_symbols): New function.
5368         (Archive::Archive_member): New class.
5369         (Archive::members_): New member.
5370         (Archive::num_members_): New member.
5371         * main.cc: Include archive.h.
5372         (main): Call Archive::print_stats.
5373         * mapfile.cc (Mapfile::report_include_archive_member): Delete
5374         archive parameter; member_name is now the fully-decorated name.
5375         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
5376         * options.h: (General_options): Add --preread-archive-symbols option.
5377         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
5378         Archive::setup.
5379
5380 2008-08-04  Ian Lance Taylor  <iant@google.com>
5381
5382         * symtab.h (Symbol::use_plt_offset): New function.
5383         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
5384         * powerpc.cc (Relocate::relocate): Likewise.
5385         * sparc.cc (Relocate::relocate): Likewise.
5386         * x86_64.cc (Relocate::relocate): Likewise.
5387         * testsuite/weak_plt.sh: New test.
5388         * testsuite/weak_plt_main.cc: New test.
5389         * testsuite/weak_plt_shared.cc: New test.
5390         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
5391         (check_PROGRAMS): Add weak_plt.
5392         (check_DATA): Add weak_plt_shared.so.
5393         (weak_plt_main_pic.o, weak_plt): New targets.
5394         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
5395         * testsuite/Makefile.in: Rebuild.
5396
5397         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
5398         gcctestdir/ld.
5399         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
5400         * testsuite/Makefile.in: Rebuild.
5401
5402 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
5403
5404         * Makefile.am (POTFILES.in): Set LC_ALL=C.
5405         * Makefile.in: Regenerate.
5406         * po/POTFILES.in: Regenerate.
5407
5408 2008-07-29  Ian Lance Taylor  <iant@google.com>
5409
5410         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
5411         symbols before other symbols.
5412         * testsuite/script_test_2.cc (test_addr): Declare.
5413         (test_addr_alias): Declare.
5414         (main): Check that test_addr and test_addr_alias have the right
5415         values.
5416         * testsuite/script_test_2.t: Define test_addr_alias and
5417         test_addr.
5418
5419 2008-07-24  Ian Lance Taylor  <iant@google.com>
5420
5421         PR 5990
5422         * descriptors.cc: New file.
5423         * descriptors.h: New file.
5424         * gold-threads.h (class Hold_optional_lock): New class.
5425         * fileread.cc: Include "descriptors.h".
5426         (File_read::~File_read): Release descriptor rather than closing
5427         it.
5428         (File_read::open) [file]: Call open_descriptor rather than open.
5429         Set is_descriptor_opened_.
5430         (File_read::open) [memory]: Assert that descriptor is not open.
5431         (File_read::reopen_descriptor): New function.
5432         (File_read::release): Release descriptor.
5433         (File_read::do_read): Make non-const.  Reopen descriptor.
5434         (File_read::read): Make non-const.
5435         (File_read::make_view): Reopen descriptor.
5436         (File_read::do_readv): Likewise.
5437         * fileread.h (class File_read): Add is_descriptor_opened_ field.
5438         Update declarations.
5439         * layout.cc: Include "descriptors.h".
5440         (Layout::create_build_id): Use open_descriptor rather than open.
5441         * output.cc: Include "descriptors.h".
5442         (Output_file::open): Use open_descriptor rather than open.
5443         * archive.cc (Archive::const_iterator): Change Archive to be
5444         non-const.
5445         (Archive::begin, Archive::end): Make non-const.
5446         (Archive::count_members): Likewise.
5447         * archive.h (class Archive): Update declarations.
5448         * object.h (Object::read): Make non-const.
5449         * Makefile.am (CCFILES): Add descriptors.cc.
5450         (HFILES): Add descriptors.h.
5451         * Makefile.in: Rebuild.
5452
5453         PR 6716
5454         * gold.h: Always include <clocale>.  Add Solaris workarounds
5455         following code in binutils/sysdep.h.
5456
5457         PR 6048
5458         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
5459         this->eh_frame_hdr_ is NULL before using it.
5460
5461         * dynobj.cc (Versions::Versions): Update comment.
5462
5463         * dynobj.cc (Versions::Versions): If there is an soname, use it as
5464         the base version name.
5465
5466         * stringpool.cc (Stringpool_template::add_with_length): Set key to
5467         array size plus one.
5468         (Stringpool_template::set_string_offsets): Subtract one from key
5469         before using it as an array index.
5470         (Stringpool_template::get_offset_with_length): Likewise.
5471         (Stringpool_template::write_to_buffer): Likewise.
5472         * stringpool.h (Stringpool_template::get_offset_from_key):
5473         Likewise.
5474
5475 2008-07-23  Ian Lance Taylor  <iant@google.com>
5476
5477         PR 6658
5478         * object.h (Merged_symbol_value::value): Do our best to handle a
5479         negative addend.
5480
5481         PR 6647
5482         * script.cc (Version_script_info::get_versions): Don't add empty
5483         version tag to return value.
5484         (Version_script_info::get_symbol_version_helper): Change return
5485         type to bool.  Add pversion parameter.  Change all callers.
5486         (script_register_vers_node): Don't require a non-NULL tag.
5487         * script.h (class Version_script_info): Update declarations.
5488         (Version_script_info::get_symbol_version): Change return type to
5489         bool.  Add version parameter.  Change all callers.
5490         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
5491         handling.  Handle an empty version from a version script.
5492         (Symbol_table::define_special_symbol): Likewise.
5493         * testsuite/ver_test_10.script: New file.
5494         * testsuite/ver_test_10.sh: New file.
5495         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
5496         (check_DATA): Add ver_test_10.syms.
5497         (ver_test_10.syms, ver_test_10.so): New target.
5498         * testsuite/Makefile.in: Rebuild.
5499
5500 2008-07-23  Simon Baldwin  <simonb@google.com>
5501
5502         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
5503         to zero for undefined symbols from dynamic libraries.
5504
5505 2008-07-23  Ian Lance Taylor  <iant@google.com>
5506
5507         * symtab.cc (Symbol_table::resolve): Remove version parameter.
5508         Change all callers.
5509         * symtab.h (class Symbol_table): Update declaration.
5510         * testsuite/ver_test_9.cc: New file.
5511         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
5512         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
5513         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
5514         (ver_test_9.so, ver_test_9.o): New targets.
5515         * testsuite/Makefile.in: Rebuild.
5516
5517 2008-07-22  Ian Lance Taylor  <iant@google.com>
5518
5519         * options.h (class General_options): Define --check-sections.
5520         * layout.cc (Layout::set_segment_offsets): Handle
5521         --check-sections.
5522
5523         * options.h (class General_options): Define -n/--nmagic and
5524         -N/--omagic.
5525         * options.cc (General_options::finalize): For -n/--nmagic or
5526         -N/--omagic, set -static.
5527         * layout.cc (Layout::attach_allocated_section_to_segment): If
5528         -N/--omagic, don't put read-only and read-write sections in
5529         different segments.
5530         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
5531         finding a read-only segment.
5532         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
5533         don't set the minimum segment alignment to the common page size,
5534         and don't set the file offset to the address modulo the page size.
5535         * script-sections.cc (Script_sections::create_segments): If
5536         -n/--omagic, don't put read-only and read-write sections in
5537         different segments.
5538
5539         * cref.cc: New file.
5540         * cref.h: New file.
5541         * options.h (class General_options): Add --print-symbol-counts.
5542         * main.cc (main): Issue defined symbol report if requested.
5543         * archive.cc (Archive::interpret_header): Make into a const member
5544         function.
5545         (Archive::add_symbols): Call Input_objects::archive_start and
5546         archive_stop.
5547         (Archive::const_iterator): Define new class.
5548         (Archive::begin, Archive::end): New functions.
5549         (Archive::include_all_members): Rewrite to use iterator.
5550         (Archive::count_members): New function.
5551         * archive.h (class Archive): Update declarations.
5552         (Archive::filename): New function.
5553         * object.cc: Include "cref.h".
5554         (Sized_relobj::Sized_relobj): Initialize defined_count_.
5555         (Sized_relobj::do_get_global_symbol_counts): New function.
5556         (Input_objects::add_object): Add object to cross-referencer.
5557         (Input_objects::archive_start): New function.
5558         (Input_objects::archive_stop): New function.
5559         (Input_objects::print_symbol_counts): New function.
5560         * object.h: Declare Cref and Archive.
5561         (Object::get_global_symbol_counts): New function.
5562         (Object::do_get_global_symbol_counts): New pure virtual function.
5563         (class Sized_relobj): Add defined_count_ field.  Update
5564         declarations.
5565         (class Input_objects): Add cref_ field.  Update constructor.
5566         Update declarations.
5567         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
5568         defined_count_.
5569         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
5570         symbol counts.
5571         (Sized_dynobj::do_get_global_symbol_counts): New function.
5572         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
5573         defined_count_.  Update declarations.  Define Symbols typedef.
5574         * symtab.cc (Symbol_table::add_from_relobj): Add defined
5575         parameter.  Change all callers.
5576         (Symbol_table::add_from_dynobj): Add sympointers and defined
5577         parameters.  Change all callers.
5578         * symtab.h (class Symbol_table): Update declarations.
5579         * Makefile.am (CCFILES): Add cref.cc.
5580         (HFILES): Add cref.h.
5581         * Makefile.in: Rebuild.
5582
5583 2008-07-22  Simon Baldwin  <simonb@google.com>
5584
5585         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
5586         to zero when writing undefined symbols.
5587
5588 2008-07-22  Ian Lance Taylor  <iant@google.com>
5589
5590         * output.cc (Output_section::add_input_section): Don't try to
5591         merge empty merge sections.
5592
5593 2008-07-21  Craig Silverstein  <csilvers@google.com>
5594
5595         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5596         Include symbol version in error message.
5597
5598 2008-07-20  Chris Demetriou  <cgd@google.com>
5599
5600         * configure.ac (gold_cv_c_random_seed): New configured variable.
5601         (RANDOM_SEED_CFLAGS): New substituted variable.
5602         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
5603         * configure: Rebuild.
5604         * Makefile.in: Likewise.
5605         * testsuite/Makefile.in: Likewise.
5606
5607 2008-07-18  Ian Lance Taylor  <iant@google.com>
5608
5609         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
5610         where we see NAME/NULL and NAME/VERSION  as separate symbols.
5611         * testsuite/ver_test_main.cc (main): Call t4.
5612         (t4, t4_2a): Define.
5613         * testsuite/ver_test_2.cc (t4_2): Define.
5614         * testsuite/ver_test_2.script: Put t4_2a in VER2.
5615         * testsuite/ver_test_4.cc (t4_2a): Define.
5616         * testsuite/ver_test_4.script: Put t4_2a in VER2.
5617         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
5618
5619 2008-07-17  Ian Lance Taylor  <iant@google.com>
5620
5621         * dynobj.cc (Versions::add_def): If we give an error about a
5622         missing version, go ahead and create the version anyhow.
5623
5624 2008-07-10  Ian Lance Taylor  <iant@google.com>
5625
5626         Handle output sections with more than 0x7fffffff bytes.
5627         * object.h (class Relobj): Change map_to_output_ to
5628         output_sections_, and just keep a section pointer.  Change all
5629         uses.  Move comdat group support to Sized_relobj.
5630         (Relobj::is_section_specially_mapped): Remove.
5631         (Relobj::output_section): Remove poff parameter.  Change all
5632         callers.
5633         (Relobj::output_section_offset): New function.
5634         (Relobj::set_section_offset): Rewrite.
5635         (Relobj::map_to_output): Remove.
5636         (Relobj::output_sections): New function.
5637         (Relobj::do_output_section_offset): New pure virtual function.
5638         (Relobj::do_set_section_offset): Likewise.
5639         (class Sized_relobj): Add section_offsets_ field.  Add comdat
5640         group support from Relobj.  Update declarations.
5641         (Sized_relobj::get_output_section_offset): New function.
5642         (Sized_relobj::do_output_section_offset): New function.
5643         (Sized_relobj::do_set_section_offset): New function.
5644         * object.cc (Relobj::output_section_address): Remove.
5645         (Sized_relobj::Sized_relobj): Initialize new fields.
5646         (Sized_relobj::include_section_group): Cast find_kept_object to
5647         Sized_relobj.
5648         (Sized_relobj::include_linkonce_section): Likewise.
5649         (Sized_relobj::do_layout): Use separate arrays for output section
5650         and output offset.
5651         (Sized_relobj::do_count_local_symbols): Change map_to_output to
5652         output_sections.
5653         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
5654         output_sections and section_offsets.
5655         (Sized_relobj::write_local_symbols): Likewise.
5656         (map_to_kept_section): Compute output address directly.
5657         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
5658         output_sections and section_offsets.
5659         (Sized_relobj::write_sections): Likewise.
5660         (Sized_relobj::relocate_sections): Likewise.
5661         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
5662         * output.h (class Output_reloc): Update declarations.  Change
5663         u2_.relobj to Sized_relobj*.
5664         (class Output_data_reloc): Change add functions to use
5665         Sized_relobj*.
5666         * output.cc (Output_reloc::Output_reloc): Change relobj to
5667         Sized_relobj*.
5668         (Output_reloc::local_section_offset): Change return type to
5669         Elf_Addr.  Use get_output_section_offset.
5670         (Output_reloc::get_address): Likewise.
5671         (Output_section::is_input_address_mapped): Don't call
5672         is_section_specially_mapped.
5673         (Output_section::output_offset): Likewise.
5674         (Output_section::output_address): Likewise.
5675         (Output_section::starting_output_address): Likewise.
5676         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
5677         parameter to Sized_relobj*.
5678         (Copy_relocs::need_copy_reloc): Likewise.
5679         (Copy_relocs::save): Likewise.
5680         * copy-relocs.h (class Copy_relocs): Update declarations.
5681         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
5682         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
5683         * target-reloc.h (relocate_for_relocatable): Change
5684         offset_in_output_section type to Elf_Addr.  Change code that uses
5685         it as well.
5686         * layout.cc (Layout::layout): Always set *off.
5687         * mapfile.cc (Mapfile::print_input_section): Use
5688         output_section_offset.
5689         * i386.cc (Target_i386::copy_reloc): Change object parameter to
5690         Sized_relobj*.
5691         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5692         * sparc.cc (Target_sparc::copy_reloc): Likewise.
5693         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5694
5695 2008-07-03  Ian Lance Taylor  <iant@google.com>
5696
5697         * layout.cc (Layout::include_section): Do not discard unrecognized
5698         SHT_STRTAB sections.
5699
5700 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
5701
5702         * script.cc (Lex::can_continue_name): Make '?' allowable in
5703         version-script names.
5704         * testsuite/version_script.map: Change glob pattern to use '?'
5705
5706 2008-06-30  Manish Singh  <yosh@gimp.org>
5707
5708         PR 6585
5709         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5710         Correct typo.
5711
5712 2008-06-30  Ian Lance Taylor  <iant@google.com>
5713
5714         PR 6660
5715         PR 6682
5716         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5717         versions]: Don't try to read the value in the contents, since we
5718         don't use it.  Use the template endianness when writing.
5719
5720 2008-06-25  Cary Coutant  <ccoutant@google.com>
5721
5722         * fileread.cc (File_read::make_view): Assert on zero-length view.
5723         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5724         symbol table when there are no symbols to read.
5725
5726 2008-06-23  Craig Silverstein  <csilvers@google.com>
5727
5728         * version.cc (version_string): Bump to 1.7
5729
5730 2008-06-18  Craig Silverstein  <csilvers@google.com>
5731
5732         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5733         constant 0xFFFF to type Valtype.
5734         (Powerpc_relocate_functions::rel16_ha): Likewise.
5735
5736 2008-06-17  Ian Lance Taylor  <iant@google.com>
5737
5738         * output.h (Output_section::Input_section): Initialize p2align_ to
5739         zero for Output_section_data constructors.
5740         (Output_section::Input_section::addralign): If not an input
5741         section, return the alignment of the Output_section_data.
5742         * testsuite/copy_test.cc: New file.
5743         * testsuite/copy_test_1.cc: New file.
5744         * testsuite/copy_test_2.cc: New file.
5745         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5746         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5747         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5748         (copy_test_1_pic.o, copy_test_1.so): New targets.
5749         (copy_test_2_pic.o, copy_test_2.so): New targets.
5750         * testsuite/Makefile.in: Rebuild.
5751
5752         * script-sections.cc (Script_sections::place_orphan): Initialize
5753         local variable exact.
5754
5755 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
5756
5757         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5758
5759 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
5760             David S. Miller  <davem@davemloft.net>
5761
5762         * powerpc.cc: New file.
5763         * Makefile.am (TARGETSOURCES): Add powerpc.cc
5764         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5765         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5766         * Makefile.in: Rebuild.
5767
5768 2008-06-09  Ian Lance Taylor  <iant@google.com>
5769
5770         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5771         <exception>.
5772         (throwing, orig_terminate): New static variables.
5773         (terminate_handler): New static function.
5774         (t2): Set terminate handler.
5775
5776 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
5777
5778         PR 6584
5779         * binary.cc (Binary_to_elf::sized_convert): Fix .data
5780         alignment.
5781
5782 2008-05-30  Cary Coutant  <ccoutant@google.com>
5783
5784         * archive.cc (Archive::include_all_members) Correct to step
5785         over symbol table and extended name table in thin archives.
5786
5787 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
5788
5789         PR 6407
5790         * target-reloc.h (relocate_for_relocatable): Fix new_offset
5791         calculation.
5792
5793 2008-05-28  Caleb Howe  <cshowe@google.com>
5794
5795         * reduced_debug_output.cc: New file.
5796         * reduced_debug_output.h: New file.
5797         * options.h (class General_options): Add --strip-debug-non-line.
5798         * options.cc (General_options::finalize): Add strip_debug_non_line
5799         to the strip heirarchy.
5800         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5801         fields.
5802         * layout.cc: Include "reduced_debug_output.h".
5803         (Layout::Layout): Initialize new fields.
5804         (line_only_debug_sections): New static array.
5805         (is_lines_only_debug_sections): New static inline function.
5806         (Layout::include_section): Handle --strip-debug-non-line.
5807         (Layout::make_output_section): If --strip-debug-non-line, build
5808         new output sections for .debug_abbrev and .debug_info.
5809         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5810         gold.  Warn about possible overflow.
5811         (read_signed_LEB_128): Likewise.
5812         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5813         (read_signed_LEB_128): Declare.
5814         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5815         (HFILES): Add reduced_debug_output.h.
5816         * Makefile.in: Rebuild.
5817
5818 2008-05-21  Ian Lance Taylor  <iant@google.com>
5819
5820         * mapfile.cc: New file.
5821         * mapfile.h: New file.
5822         * options.h (class General_options): Add -M/--print-map and -Map.
5823         * options.cc (General_options::finalize): Make -M equivalent to
5824         -Map -.
5825         * main.cc: Include <cstdio> and "mapfile.h".
5826         (main): Open mapfile if requested.
5827         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
5828         constructor.  Change caller.
5829         (queue_initial_tasks): Add mapfile parameter.  Change caller.
5830         (queue_middle_tasks): Likewise.
5831         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5832         declarations.
5833         * archive.cc: Include "mapfile.h".
5834         (Archive::add_symbols): Add mapfile parameter.  Change all
5835         callers.  Pass mapfile, symbol, and reason to include_member.
5836         (Archive::include_all_members): Add mapfile parameter.  Change all
5837         callers.
5838         (Archive::include_member): Add mapfile, sym, and why parameters.
5839         Change all callers.  Report inclusion to map file.
5840         * archive.h: Include "fileread.h".
5841         (class Archive): Update declarations.
5842         (Archive::file): New const method.
5843         (class Add_archive_symbols): Add mapfile_ field.  Update
5844         constructor.  Change all callers.
5845         * readsyms.h (class Read_symbols): Likewise.
5846         (class Finish_group): Likewise.
5847         (class Read_script): Likewise.
5848         * common.cc: Include "mapfile.h".
5849         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
5850         all callers.
5851         (Symbol_table::do_allocate_commons): Likewise.
5852         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
5853         symbol allocation to mapfile.
5854         * common.h (class Allocate_commons_task): Add mapfile_ field.
5855         Update constructor.  Change all callers.
5856         * symtab.h (class Symbol_table): Update declarations.
5857         * layout.cc: Include "mapfile.h".
5858         (Layout_task_runner::run): Print information to mapfile.
5859         (Layout::create_gold_note): Change Output_data_fixed_space to
5860         Output_data_zero_fill.
5861         (Layout::create_build_id): Likewise.
5862         (Layout::print_to_mapfile): New function.
5863         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
5864         constructor.  Change caller.
5865         (class Layout): Declare print_to_mapfile.
5866         * output.cc (Output_section::Input_section::print_to_mapfile): New
5867         function.
5868         (Output_section::add_input_section): If producing a map, always
5869         add to input_sections_ list.
5870         (Output_section::do_print_to_mapfile): New function.
5871         (Output_segment::print_sections_to_mapfile): New function.
5872         (Output_segment::print_section_list_to_mapfile): New function.
5873         * output.h: Include "mapfile.h".
5874         (Output_data::print_to_mapfile): New function.
5875         (Output_data::do_print_to_mapfile): New virtual function.
5876         (Output_segment_headers::do_print_to_mapfile): New function.
5877         (Output_file_header::do_print_to_mapfile): New function.
5878         (Output_data_const::do_print_to_mapfile): New function.
5879         (class Output_data_const_buffer): Add map_name_ field.  Update
5880         constructor.  Change all callers.  Add do_print_to_mapfile
5881         function.
5882         (class Output_data_fixed_space): Likewise.
5883         (class Output_data_space): Likewise.
5884         (class Output_data_zero_fill): New class.
5885         (Output_data_strtab::do_print_to_mapfile): New function.
5886         (Output_data_reloc_base::do_print_to_mapfile): New function.
5887         (Output_relocatable_relocs::do_print_to_mapfile): New function.
5888         (Output_data_group::do_print_to_mapfile): New function.
5889         (Output_data_got::do_print_to_mapfile): New function.
5890         (Output_data_dynamic::do_print_to_mapfile): New function.
5891         (Output_symtab_xindex::do_print_to_mapfile): New function.
5892         (class Output_section): Declare do_print_to_mapflie.  Declare
5893         print_to_mapfile in Input_section.
5894         (class Output_segment): Declare new functions.
5895         * object.h (Sized_relobj::symbol_count): New function.
5896         * script-sections.cc
5897         (Output_section_element_dot_assignment::set_section_addresses):
5898         Change Output_data_fixed_space to Output_data_zero_fill.
5899         (Output_data_expression::do_print_to_mapfile): New function.
5900         * script.cc (read_input_script): Add mapfile parameter.  Change
5901         all callers.
5902         * script.h (read_input_script): Update declaration.
5903         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5904         (Eh_frame::do_print_to_mapfile): New function.
5905         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5906         (Output_merge_string::do_print_to_mapfile): New function.
5907         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5908         function.
5909         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5910         function.
5911         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5912         function.
5913         * Makefile.am (CCFILES): Add mapfile.cc.
5914         (HFILES): Add mapfile.h.
5915         * Makefile.in: Rebuild.
5916
5917 2008-05-19  Ian Lance Taylor  <iant@google.com>
5918
5919         * options.h (class General_options): Add -z relro.
5920         * layout.cc (Layout::Layout): Initialize relro_segment_.
5921         (Layout::add_output_section_data): Return the output section.
5922         (Layout::make_output_section): Rcognize relro sections and mark
5923         them appropriately.
5924         (Layout::attach_allocated_section_to_segment): Put relro sections
5925         in a PT_GNU_RELRO segment.
5926         (Layout::create_initial_dynamic_sections): Mark the .dynamic
5927         section as relro.
5928         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5929         PT_TLS segments.
5930         (Layout::linkonce_mapping): Map d.rel.ro.local to
5931         .data.rel.ro.local.
5932         (Layout::output_section_name): Us .data.rel.ro.local for any
5933         section which begins with that.
5934         * layout.h (class Layout): Update add_output_section_data
5935         declaration.  Add relro_segment_ field.
5936         * output.cc (Output_section::Output_section): Initialize is_relro_
5937         and is_relro_local_ fields.
5938         (Output_segment::add_output_section): Group relro sections.
5939         (Output_segment::is_first_section_relro): New function.
5940         (Output_segment::maximum_alignment): If there is a relro section,
5941         align the segment to the common page size.
5942         (Output_segment::set_section_addresses): Track whether we are
5943         looking at relro sections.  If the last section is a relro
5944         section, align to the common page size.
5945         (Output_segment::set_section_list_addresses): Add in_relro
5946         parameter.  Change all callers.  Align to the page size when
5947         moving from relro to non-relro section.
5948         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5949         segment.
5950         * output.h (class Output_section): Add is_relro_ and
5951         is_relro_local_ fields.
5952         (Output_section::is_relro): New function.
5953         (Output_section::set_is_relro): New function.
5954         (Output_section::is_relro_local): New function.
5955         (Output_section::set_is_relro_local): New function.
5956         (class Output_segment): Update declarations.
5957         * i386.cc (Target_i386::got_section): Mark .got section as relro.
5958         * sparc.cc (Target_sparc::got_section): Likewise.
5959         * x86_64.cc (Target_x86_64::got_section): Likewise.
5960         * testsuite/relro_test_main.cc: New file.
5961         * testsuite/relro_test.cc: New file.
5962         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5963         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5964         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5965         (relro_test.so, relro_test_pic.o): New targets.
5966         * testsuite/Makefile.in: Rebuild.
5967
5968 2008-05-16  Ian Lance Taylor  <iant@google.com>
5969
5970         * output.cc (Output_segment::add_output_section): Remove front
5971         parameter.
5972         * output.h (class Output_segment): Remove
5973         add_initial_output_section and overloaded add_output_section.
5974         Update declaration of remaining add_output_section.
5975         * layout.cc (Layout::create_interp): Call add_output_section
5976         rather than add_initial_output_section.
5977         (Layout::finish_dynamic_section): Likewise.
5978
5979         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5980         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
5981         know the dynamic type.
5982         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5983         field.  Initialize it in constructor.
5984         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5985         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5986         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5987         reloc.
5988
5989         * output.cc (Output_reloc::get_address): Change return type to
5990         Elf_Addr.
5991         * output.h (class Output_reloc): Update get_address declaration.
5992         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5993         for section addresses.
5994
5995 2008-05-09  Ian Lance Taylor  <iant@google.com>
5996
5997         PR 6493
5998         * gold.cc (gold_nomem): Use return value of write.
5999
6000 2008-05-08  Ian Lance Taylor  <iant@google.com>
6001
6002         * symtab.c (Symbol::init_base_output_data): Add version
6003         parameter.  Change all callers.
6004         (Symbol::init_base_output_segment): Likewise.
6005         (Symbol::init_base_constant): Likewise.
6006         (Symbol::init_base_undefined): Likewise.
6007         (Sized_symbol::init_output_data): Likewise.
6008         (Sized_symbol::init_output_segment): Likewise.
6009         (Sized_symbol::init_constant): Likewise.
6010         (Sized_symbol::init_undefined): Likewise.
6011         (Symbol_table::do_define_in_output_data): If the new symbol has a
6012         version, mark it as the default.
6013         (Symbol_table::do_define_in_output_segment): Likewise.
6014         (Symbol_table::do_define_as_constant): Likewise.
6015         * symtab.h (class Symbol): Update declarations.
6016         (class Sized_symbol): Likewise.
6017         * resolve.cc (Symbol::override_version): New function.
6018         (Symbol::override_base): Call override_version.
6019         (Symbol::override_base_with_special): Likewise.
6020         * testsuite/ver_script_8.script: New file.
6021         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
6022         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
6023         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
6024         (ver_test_8_1.so, ver_test_8_2.so): New targets.
6025
6026 2008-05-06  Ian Lance Taylor  <iant@google.com>
6027
6028         PR 6049
6029         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
6030         functions.
6031         (class General_options): Remove existing --undefined, and add
6032         --no-undefined instead.  Add new --undefined as synonym for -u.
6033         * archive.cc (Archive::add_symbols): Check whether symbol was
6034         named with -u.
6035         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
6036         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
6037         all uses.  Add IS_UNDEFINED.  Update declarations to split
6038         different versions of init_base.  Declare init_base_undefined.
6039         (Symbol::is_defined): Handle IS_UNDEFINED.
6040         (Symbol::is_undefined): Likewise.
6041         (Symbol::is_weak_undefined): Call is_undefined.
6042         (Symbol::is_absolute): Handle IS_CONSTANT.
6043         (class Sized_symbol): Update declarations to split different
6044         versions of init.  Declare init_undefined.
6045         (class Symbol_table): Declare new functions.
6046         * symtab.cc (Symbol::init_base_object): Rename from init_base.
6047         Change all callers.
6048         (Symbol::init_base_output_data): Likewise.
6049         (Symbol::init_base_output_segment): Likewise.
6050         (Symbol::init_base_constant): Likewise.
6051         (Symbol::init_base_undefined): New function.
6052         (Sized_symbol::init_object): Rename from init.  Change all
6053         callers.
6054         (Sized_symbol::init_output_data): Likewise.
6055         (Sized_symbol::init_output_segment): Likewise.
6056         (Sized_symbol::init_constant): Likewise.
6057         (Sized_symbol::init_undefined): New function.
6058         (Symbol_table::add_undefined_symbols_from_command_line): New
6059         function.
6060         (Symbol_table::do_add_undefined_symbols_from_command_line): New
6061         function.
6062         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
6063         (Symbol::output_section): Likewise.
6064         (Symbol::set_output_section): Likewise.
6065         (Symbol_table::sized_finalize_symbol): Likewise.
6066         (Symbol_table::sized_write_globals): Likewise.
6067         * resolve.cc (Symbol_table::should_override): Likewise.
6068         (Symbol::override_base_with_special): Likewise.
6069
6070         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
6071         symbol, change it to have default visibility.
6072         * testsuite/protected_1.cc: New file.
6073         * testsuite/protected_2.cc: New file.
6074         * testsuite/protected_3.cc: New file.
6075         * testsuite/protected_main_1.cc: New file.
6076         * testsuite/protected_main_2.cc: New file.
6077         * testsuite/protected_main_3.cc: New file.
6078         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
6079         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
6080         (protected_1_LDFLAGS, protected_1_LDADD): Define.
6081         (protected_1.so): New target.
6082         (protected_1_pic.o, protected_2_pic.o): New targets.
6083         (protected_3_pic.o): New target.
6084         (check_PROGRAMS): Add protected_2.
6085         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
6086         (protected_2_LDFLAGS, protected_2_LDADD): Define.
6087         * testsuite/Makefile.in: Rebuild.
6088
6089         * options.h (DEFINE_var): Add set_user_set_##varname__.
6090         (DEFINE_bool_alias): New macro.
6091         (class General_options): Define -Bstatic using DEFINE_bool_alias
6092         rather than DEFINE_special.  Add --undefined as an alias for -z
6093         defs.
6094         * options.cc (General_options::parse_Bstatic): Remove.
6095
6096         * options.h (class General_options): Add --fatal-warnings.
6097         * main.cc (main): Implement --fatal-warnings.
6098         * errors.h (Errors::warning_count): New function.
6099
6100         * options.h (class General_options): Add -Bsymbolic-functions.
6101         * symtab.h (Symbol::is_preemptible): Check for
6102         -Bsymbolic-functions.
6103
6104 2008-05-05  Ian Lance Taylor  <iant@google.com>
6105
6106         * options.h (DEFINE_bool): For DASH_Z, create the negative option
6107         as noVARNAME rather than no-VARNAME.
6108         (class General_options): Add option -z combreloc.
6109         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
6110         get_address.
6111         (Output_reloc::sort_before) [SHT_REL]: New function.
6112         (Output_reloc::sort_before) [SHT_RELA]: New function.
6113         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
6114         Sort_relocs_comparison.
6115         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
6116         parameter.  Change all callers.
6117         (Output_data_reloc::Output_data_reloc) [both versions]: Add
6118         sort_relocs parameter.  Change all callers.
6119         * output.cc (Output_reloc::get_address): New function, broken out
6120         of write_rel.
6121         (Output_reloc::write_rel): Call it.
6122         (Output_reloc::compare): New function.
6123         (Output_data_reloc_base::do_write): Optionally sort relocs.
6124
6125         * configure.ac: If targ_extra_obj is set, link it in.
6126         * configure.tgt: Initialize all variables.
6127         (x86_64*): Set targ_extra_obj and targ_extra_size.
6128         * configure: Rebuild.
6129
6130         * object.cc (Sized_relobj::include_section_group): Adjust section
6131         indexes read from group data.  Build vector to pass to
6132         layout_group.
6133         * layout.cc (Layout::layout_group): Add flags and shndxes
6134         parameters.  Remove contents parameter.  Change caller.  Update
6135         explicit instantiations.
6136         * layout.h (class Layout): Update layout_group declaration.
6137         * output.cc (Output_data_group::Output_data_group): Add flags and
6138         input_shndxes parameters.  Remove contents parameter.  Change
6139         caller.
6140         (Output_data_group::do_write): Change input_sections_ to
6141         input_shndxes_.
6142         * output.h (class Output_data_group): Update constructor
6143         declaration.  Rename input_sections_ to input_shndxes_.
6144         * testsuite/many_sections_test.cc: Add template.
6145
6146 2008-04-30  Cary Coutant  <ccoutant@google.com>
6147
6148         * target-reloc.h (relocate_section): Fix dead-pointer bug.
6149
6150         * layout.cc (Layout::include_section): Refactored check for debug
6151         info section.
6152         (Layout::add_comdat): Add new parameters.  Change type
6153         of signature parameter.  Add object and shndx to signatures table.
6154         (Layout::find_kept_object): New function.
6155         * layout.h: Include <cstring>.
6156         (Layout::is_debug_info_section): New function.
6157         (Layout::add_comdat): Add new parameters.
6158         (Layout::find_kept_object): New function.
6159         (Layout::Kept_section): New struct.
6160         (Layout::Signatures): Change type of map range.
6161         * object.cc (Relobj::output_section_address): New function.
6162         (Sized_relobj::include_section_group): Add new parameters.  Change
6163         calls to Layout::add_comdat.  Change to build table of kept comdat
6164         groups and table mapping discarded sections to kept sections.
6165         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
6166         (Sized_relobj::do_layout): Change calls to include_section_group and
6167         include_linkonce_section.
6168         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
6169         value to zero when section is discarded.
6170         (Sized_relobj::map_to_kept_section): New function.
6171         * object.h (Relobj::output_section_address): New function.
6172         (Relobj::Comdat_group): New type.
6173         (Relobj::find_comdat_group): New function.
6174         (Relobj::Comdat_group_table): New type.
6175         (Relobj::Kept_comdat_section): New type.
6176         (Relobj::Kept_comdat_section_table): New type.
6177         (Relobj::add_comdat_group): New function.
6178         (Relobj::set_kept_comdat_section): New function.
6179         (Relobj::get_kept_comdat_section): New function.
6180         (Relobj::comdat_groups_): New field.
6181         (Relobj::kept_comdat_sections_): New field.
6182         (Symbol_value::input_value): Update comment.
6183         (Sized_relobj::map_to_kept_section) New function.
6184         (Sized_relobj::include_linkonce_section): Add new parameter.
6185         * target-reloc.h (Comdat_behavior): New type.
6186         (get_comdat_behavior): New function.
6187         (relocate_section): Add code to map a discarded section to the
6188         corresponding kept section when applying a relocation.
6189
6190 2008-04-30  Craig Silverstein  <csilvers@google.com>
6191
6192         * dwarf_reader.cc (next_generation_count): New static var.
6193         (Addr2line_cache_entry): New struct.
6194         (addr2line_cache): New static var.
6195         (Dwarf_line_info::one_addr2line): Added caching.
6196         (Dwarf_line_info::clear_addr2line_cache): New function.
6197         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
6198         cache-size parameter.
6199         (Dwarf_line_info::one_addr2line_cache): New function.
6200         * symtab.cc (Symbol_table::detect_odr_violations): Pass
6201         new cache-size argument to one_addr2line(), and clear cache.
6202
6203 2008-04-28  Cary Coutant  <ccoutant@google.com>
6204
6205         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
6206         R_386_PC8 relocations.
6207
6208 2008-04-23  Ian Lance Taylor  <iant@google.com>
6209
6210         * object.cc (Sized_relobj::include_section_group): Check for
6211         invalid section group.
6212
6213         * object.cc (make_elf_object): Correct test for 64-bit ELF file
6214         header size.
6215
6216         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
6217         than read for file header.
6218         * archive.cc (Archive::include_member): Likewise.
6219
6220 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
6221
6222         * aclocal.m4: Regenerate.
6223         * configure: Regenerate.
6224
6225 2008-04-19  Ian Lance Taylor  <iant@google.com>
6226
6227         * version.cc (version_string): Bump to 1.6.
6228
6229         * testsuite/Makefile.am (many_sections_r_test): New target.
6230         (many_sections_r_test_SOURCES): Remove.
6231         (many_sections_r_test_DEPENDENCIES): Remove.
6232         (many_sections_r_test_LDFLAGS): Remove.
6233         (many_sections_r_test_LDADD): Remove.
6234
6235         * object.cc (Sized_relobj::do_add_symbols): Always pass
6236         local_symbol_count_ to add_from_relobj.
6237
6238         * testsuite/Makefile.am (many_sections_check.h): Only check one in
6239         every thousand variables.
6240         * testsuite/Makefile.in: Rebuild.
6241
6242         * object.cc (Xindex::initialize_symtab_xindex): New function.
6243         (Xindex::read_symtab_xindex): New function.
6244         (Xindex::sym_xindex_to_shndx): New function.
6245         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
6246         available.
6247         (Sized_relobj::do_initialize_xindex): New function.
6248         (Sized_relobj::do_read_symbols): Adjust section links.
6249         (Sized_relobj::symbol_section_and_value): Add is_ordinary
6250         parameter.  Change all callers.
6251         (Sized_relobj::include_section_group): Adjust section links and
6252         symbol section indexes.
6253         (Sized_relobj::do_layout): Adjust section links.
6254         (Sized_relobj::do_count_local_symbols): Adjust section links and
6255         symbol section indexes.
6256         (Sized_relobj::do_finalize_local_symbols): Distinguish between
6257         ordinary and special symbols.
6258         (Sized_relobj::write_local_symbols): Add symtab_xindex and
6259         dynsym_xindex parameters.  Change all callers.  Adjust section
6260         links.  Use SHN_XINDEX when needed.
6261         (Sized_relobj::get_symbol_location_info): Adjust section links.
6262         Don't get fooled by special symbols.
6263         * object.h (class Xindex): Define.
6264         (class Object): Add xindex_ parameter.  Declare virtual functoin
6265         do_initialize_xindex.
6266         (Object::adjust_sym_shndx): New function.
6267         (Object::set_xindex): New protected function.
6268         (class Symbol_value): Add is_ordinary_shndx_ field.
6269         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
6270         (Symbol_value::value): Assert ordinary section.
6271         (Symbol_value::initialize_input_to_output_map): Likewise.
6272         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
6273         Change all callers.
6274         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
6275         all callers.
6276         (class Sized_relobj): Update declarations.
6277         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
6278         parameter.  Change all callers.
6279         (Sized_relobj::adjust_shndx): New function.
6280         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
6281         field.
6282         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
6283         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
6284         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
6285         (Sized_dynobj::read_dynsym_section): Adjust section links.
6286         (Sized_dynobj::read_dynamic): Likewise.
6287         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
6288         section links.
6289         (Sized_dynobj::do_initialize_xindex): New function.
6290         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
6291         do_initialize_xindex.
6292         (Sized_dynobj::adjust_shndx): New function.
6293         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
6294         dynsym_xindex_ fields.
6295         (Layout::finalize): Add a call to set_section_indexes before
6296         creating the symtab sections.
6297         (Layout::set_section_indexes): Don't do anything if the section
6298         already has a section index.
6299         (Layout::create_symtab_sections): Add shnum parameter.  Change
6300         caller.  Create .symtab_shndx section if needed.
6301         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
6302         caller.
6303         (Layout::allocated_output_section_count): New function.
6304         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
6305         needed.
6306         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
6307         fields.  Update declarations.
6308         (Layout::symtab_xindex): New function.
6309         (Layout::dynsym_xindex): New function.
6310         (class Write_symbols_task): Add layout_ field.
6311         (Write_symbols_task::Write_symbols_task): Add layout parameter.
6312         Change caller.
6313         * output.cc (Output_section_headers::Output_section_headers): Add
6314         shstrtab_section parameter.  Change all callers.
6315         (Output_section_headers::do_sized_write): Store overflow values
6316         for section count and section string table section index in
6317         section header zero.
6318         (Output_file_header::do_sized_write): Check for overflow of
6319         section count and section string table section index.
6320         (Output_symtab_xindex::do_write): New function.
6321         (Output_symtab_xindex::endian_do_write): New function.
6322         * output.h (class Output_section_headers): Add shstrtab_section_.
6323         Update declarations.
6324         (class Output_symtab_xindex): Define.
6325         (Output_section::has_out_shndx): New function.
6326         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
6327         field.
6328         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
6329         Change all callers.
6330         (Sized_symbol::init): Likewise.
6331         (Symbol::output_section): Check for ordinary symbol.
6332         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
6333         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
6334         callers.
6335         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
6336         Change all callers.  Simplify handling of symbols from sections
6337         not included in the link.
6338         (Symbol_table::add_from_dynobj): Handle ordinary symbol
6339         distinction.
6340         (Weak_alias_sorter::operator()): Assert that symbols are
6341         ordinary.
6342         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
6343         distinction.
6344         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
6345         parameters.  Change all callers.
6346         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
6347         symbol distinction.  Use SHN_XINDEX when needed.
6348         (Symbol_table::write_section_symbol): Add symtab_xindex
6349         parameter.  Change all callers.
6350         (Symbol_table::sized_write_section_symbol): Likewise.  Use
6351         SHN_XINDEX when needed.
6352         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
6353         declarations.
6354         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
6355         (Symbol::is_defined): Check is_ordinary.
6356         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
6357         (Symbol::is_absolute, Symbol::is_common): Likewise.
6358         (class Sized_symbol): Update declarations.
6359         (class Symbol_table): Update declarations.
6360         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
6361         parameters.  Change all callers.
6362         (Sized_symbol::override): Likewise.
6363         (Symbol_table::override): Likewise.
6364         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
6365         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
6366         is_ordinary, and orig_st_shndx parameters.  Change all callers.
6367         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
6368         to be in an ordinary section.
6369         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
6370         object and is_ordinary parameters.  Change all callers.
6371         (Sized_dwarf_line_info::read_relocs): Add object parameter.
6372         Change all callers.  Don't add undefined or non-ordinary symbols
6373         to reloc_map_.
6374         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
6375         Change all callers.
6376         * dwarf_reader.h (class Sized_dwarf_line_info): Update
6377         declarations.
6378         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
6379         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
6380         (Sized_relobj::relocate_sections): Likewise.
6381         * target-reloc.h (scan_relocs): Adjust section symbol index.
6382         (scan_relocatable_relocs): Likewise.
6383         * i386.cc (Scan::local): Check for ordinary symbols.
6384         * sparc.cc (Scan::local): Likewise.
6385         * x86_64.cc (Scan::local): Likewise.
6386         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
6387         to symbol_section_and_value.
6388         * testsuite/many_sections_test.cc: New file.
6389         * testsuite/Makefile.am (BUILT_SOURCES): Define.
6390         (check_PROGRAMS): Add many_sections_test.
6391         (many_sections_test_SOURCES): Define.
6392         (many_sections_test_DEPENDENCIES): Define.
6393         (many_sections_test_LDFLAGS): Define.
6394         (BUILT_SOURCES): Add many_sections_define.h.
6395         (many_sections_define.h): New target.
6396         (BUILT_SOURCES): Add many_sections_check.h.
6397         (many_sections_check.h): New target.
6398         (check_PROGRAMS): Add many_sections_r_test.
6399         (many_sections_r_test_SOURCES): Define.
6400         (many_sections_r_test_DEPENDENCIES): Define.
6401         (many_sections_r_test_LDFLAGS): Define.
6402         (many_sections_r_test_LDADD): Define.
6403         (many_sections_r_test.o): New target.
6404         * testsuite/Makefile.in: Rebuild.
6405
6406 2008-04-17  Cary Coutant  <ccoutant@google.com>
6407
6408         * errors.cc (Errors::info): New function.
6409         (gold_info): New function.
6410         * errors.h (Errors::info): New function.
6411         * gold.h (gold_info): New function.
6412         * object.cc (Input_objects::add_object): Print trace output.
6413         * options.cc (options::parse_set): New function.
6414         (General_options::parse_wrap): Deleted.
6415         (General_options::General_options): Deleted initializer.
6416         * options.h (options::String_set): New typedef.
6417         (options::parse_set): New function.
6418         (DEFINE_set): New macro.
6419         (General_options::wrap): Changed to use DEFINE_set. Changed
6420         callers of any_wrap_symbols and is_wrap_symbol.
6421         (General_options::trace, General_options::trace_symbol):
6422         New options.
6423         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
6424         (General_options::wrap_symbols_): Deleted.
6425         * symtab.cc (Symbol_table::add_from_object): Print trace output.
6426
6427 2008-04-17  David S. Miller  <davem@davemloft.net>
6428
6429         * options.cc (General_options::parse_V): New function.
6430         * options.h: Add entries for -V and -Qy.
6431
6432 2008-04-17  Ian Lance Taylor  <iant@google.com>
6433
6434         * common.cc (Symbol_table::allocate_commons): Remove options
6435         parameter.  Change caller.
6436         (Symbol_table::do_allocate_commons): Remove options parameter.
6437         Change caller.  Just call do_allocate_commons_list twice.
6438         (Symbol_table::do_allocate_commons_list): New function, broken out
6439         of do_allocate_commons.
6440         * common.h (class Allocate_commons_task): Remove options_ field.
6441         Update constructor.
6442         * symtab.cc (Symbol_table::Symbol_table): Initialize
6443         tls_commons_.
6444         (Symbol_table::add_from_object): Put TLS common symbols on
6445         tls_commons_ list.
6446         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
6447         which are IN_OUTPUT_DATA.
6448         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
6449         allocate_commons and do_allocate_commons declarations.  Declare
6450         do_allocate_commons_list.
6451         * gold.cc (queue_middle_tasks): Update creation of
6452         Allocate_commons_task to not pass options.
6453         * testsuite/Makefile.am (INCLUDES): Add -I.. .
6454         (TLS_TEST_C_FLAGS): New variable.
6455         (tls_test_c_pic.o): New target.
6456         (tls_test_shared.so): Link in tls_test_c_pic.o.
6457         (tls_test_c_pic_ie.o): New target.
6458         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
6459         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
6460         (tls_test_c.o): New target.
6461         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
6462         (tls_pic_test_LDADD): Likewise.
6463         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
6464         (tls_shared_gd_to_ie_test_LDADD): Likewise.
6465         (tls_test_c_gnu2.o): New target.
6466         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
6467         tls_test_c_gnu2.o.
6468         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
6469         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
6470         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
6471         * testsuite/tls_test.cc: Include "config.h".
6472         (t_last): Call t11_last.
6473         * testsuite/tls_test.h (t11, t11_last): Declare.
6474         * testsuite/tls_test_c.c: New file.
6475         * testsuite/tls_test_main.cc (thread_routine): Call t11.
6476         * configure.ac: Check for OpenMP support.
6477         * configure, config.in, Makefile.in: Rebuild.
6478         * testsuite/Makefile.in: Rebuild.
6479
6480 2008-04-16  Cary Coutant  <ccoutant@google.com>
6481
6482         * i386.cc (Target_i386::define_tls_base_symbol): New function.
6483         (Target_i386::tls_base_symbol_defined_): New field.
6484         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6485         (Target_i386::Scan::global): Likewise.
6486         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
6487         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
6488         (Target_x86_64::tls_base_symbol_defined_): New field.
6489         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6490         (Target_x86_64::Scan::global): Likewise.
6491
6492 2008-04-16  Cary Coutant  <ccoutant@google.com>
6493
6494         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
6495         (Symbol::needs_plt_entry): Allow weak undefined symbols.
6496         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
6497         building shared libraries.
6498         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
6499         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
6500         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
6501         * testsuite/Makefile.in: Rebuild.
6502         * testsuite/weak_undef.h: New file.
6503         * testsuite/weak_undef_file1.cc: Add extra test cases.
6504         * testsuite/weak_undef_file2.cc: Likewise.
6505         * testsuite/weak_undef_test.cc: Likewise.
6506
6507 2008-04-16  David S. Miller  <davem@davemloft.net>
6508
6509         * sparc.cc (Target_sparc::Scan): Change from struct to class.
6510         Add issued_non_pic_error_ field.  Declare check_non_pic.
6511         (Target_sparc::Scan::check_non_pic): New function.
6512         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
6513         (Target_sparc::Scan::global): Likewise.
6514
6515         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
6516         * configure: Rebuild.
6517
6518         * options.h (DEFINE_enable): New macro.
6519         (new_dtags): New enable option.
6520         (initfirst, interpose, loadfltr, nodefaultlib,
6521         nodelete, nodlopen, nodump): New -z options.
6522         * layout.cc (Layout:finish_dynamic_section): If new
6523         dtags enabled, emit DT_RUNPATH.  Also, emit a
6524         DT_FLAGS_1 containing any specified -z flags.
6525
6526 2008-04-16  Ian Lance Taylor  <iant@google.com>
6527
6528         * copy-relocs.cc: New file.
6529         * copy-relocs.h: New file.
6530         * reloc.cc: Remove Copy_relocs code.
6531         * reloc.h: Likewise.
6532         * reloc-types.h (struct Reloc_types) [both versions]: Add
6533         get_reloc_addend_noerror.
6534         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
6535         variants of add_global which take an addend which must be zero.
6536         * i386.cc: Include "copy-relocs.h".
6537         (class Target_i386): Change type of copy_relocs_ to variable,
6538         update initializer.
6539         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
6540         Change all callers.
6541         (Target_i386::do_finalize_sections): Change handling of
6542         copy_relocs_.
6543         * sparc.cc: Include "copy-relocs.h".
6544         (class Target_sparc): Change type of copy_relocs_ to variable,
6545         update initializer.
6546         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
6547         Change all callers.
6548         (Target_sparc::do_finalize_sections): Change handling of
6549         copy_relocs_.
6550         * x86_64.cc: Include "copy-relocs.h".
6551         (class Target_x86_64): Change type of copy_relocs_ to variable,
6552         update initializer.
6553         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
6554         class.  Change all callers.
6555         (Target_x86_64::do_finalize_sections): Change handling of
6556         copy_relocs_.
6557         * Makefile.am (CCFILES): Add copy-relocs.cc.
6558         (HFILES): Add copy-relocs.h.
6559
6560         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
6561
6562         * testsuite/script_test_4.sh: Permit leading zeroes.
6563
6564 2008-04-15  Ian Lance Taylor  <iant@google.com>
6565
6566         * script-sections.cc (Script_sections::create_segments): Use
6567         header_size_adjustment even when there is enough room for the
6568         headers.
6569         * testsuite/script_test_4.sh: New file.
6570         * testsuite/script_test_4.t: New file.
6571         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
6572         (check_DATA): Add script_test_4.stdout.
6573         (MOSTLYCLEANFILES): Likewise.
6574         (script_test_4): New target.
6575         (script_test_4.stdout): New target.
6576         * testsuite/Makefile.in: Rebuild.
6577
6578         * sparc.cc: Add definitions for Output_data_plt_sparc class
6579         constants.
6580
6581 2008-04-14  David S. Miller  <davem@davemloft.net>
6582
6583         * sparc.cc: New file.
6584         * Makefile.am (TARGETSOURCES): Add sparc.cc
6585         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
6586         * configure.tgt: Document targ_extra_size and
6587         targ_extra_big_endian.  Add entries for sparc-* and
6588         sparc64-*.
6589         * configure.ac: Handle targ_extra_size and
6590         targ_extra_big_endian.
6591         * Makefile.in: Rebuild.
6592         * configure: Likewise.
6593         * po/POTFILES.in: Likewise.
6594         * po/gold.pot: Likewise.
6595
6596 2008-04-14  Ian Lance Taylor  <iant@google.com>
6597
6598         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
6599         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
6600         in the name/type/flags to section mapping.  Don't call
6601         allocate_output_section.
6602         (Layout::choose_output_section): Change parameter from adjust_name
6603         to is_input_section.  Don't permit input sections after sections
6604         are attached to segments.  Don't call allocate_output_section.
6605         (Layout::layout_eh_frame): Call update_flags_for_input_section,
6606         not write_enable_output_section.
6607         (Layout::make_output_section): Don't push to
6608         unattached_section_list_ nor call attach_to_segment.  Call
6609         attach_section_to_segment if sections are attached.
6610         (Layout::attach_sections_to_segments): New function.
6611         (Layout::attach_section_to_segment): New function.
6612         (Layout::attach_allocated_section_to_segment): Rename from
6613         attach_to_segment.  Remove flags parameter.
6614         (Layout::allocate_output_section): Remove function.
6615         (Layout::write_enable_output_section): Remove function.
6616         * layout.h (class Layout): Update for above changes.  Add new
6617         field sections_are_attached_.
6618         * output.h (Output_section::update_flags_for_input_section): New
6619         function.
6620         * output.cc (Output_section::add_input_section): Call
6621         update_flags_for_input_section.
6622         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
6623
6624 2008-04-11  Cary Coutant  <ccoutant@google.com>
6625
6626         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
6627         thought unnecessary.
6628         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
6629
6630 2008-04-11  Ian Lance Taylor  <iant@google.com>
6631
6632         * output.h (class Output_section_data): Remove inline definition
6633         of set_addralign.
6634         * output.cc (Output_section_data::set_addralign): New function.
6635
6636 2008-04-11  Cary Coutant  <ccoutant@google.com>
6637
6638         Add support for TLS descriptors for i386 and x86_64.
6639         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
6640         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
6641         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
6642         GOT_TYPE_TLS_DESC.
6643         (Target_i386::got_mod_index_entry): Remove unnecessary code.
6644         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
6645         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
6646         relocations.
6647         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
6648         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
6649         Fix problem with initial-exec relocations.
6650         (Target_i386::Relocate::relocate_tls): Likewise.
6651         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
6652         relaxation.
6653         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
6654         support for section-plus-offset dynamic table entries.
6655         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
6656         (Output_data_dynamic::Dynamic_entry): Add support for
6657         section-plus-offset dynamic table entries.
6658         (Output_data_dynamic::Classification): Likewise.
6659         (Output_data_dynamic::classification_): Renamed offset_.
6660         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
6661         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
6662         (Target_x86_64::make_plt_section): New function.
6663         (Target_x86_64::reserve_tlsdesc_entries): New function.
6664         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
6665         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
6666         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
6667         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
6668         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
6669         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
6670         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
6671         add extra PLT entry for TLS descriptors.
6672         (Output_data_plt_x86_64::got_): New field.
6673         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
6674         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
6675         fields.
6676         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
6677         descriptors.
6678         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
6679         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
6680         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
6681         R_386_TLS_DESC_CALL relocations.
6682         (Target_x86_64::Scan::global): Likewise.
6683         (Target_x86_64::do_finalize_sections): Add dynamic table entries
6684         for TLS descriptors.
6685         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6686         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6687         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6688         GD-to-IE relaxation.
6689         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6690         and TLS_DESCRIPTORS.
6691         * Makefile.in: Rebuild.
6692         * configure: Rebuild.
6693         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6694         (tls_test_shared2.so): New target.
6695         (tls_shared_gd_to_ie_test_SOURCES): New variable.
6696         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6697         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6698         (tls_shared_gd_to_ie_test_LDADD): New variable.
6699         (tls_shared_gnu2_gd_to_ie_test): New target.
6700         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6701         New targets.
6702         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6703         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6704         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6705         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6706         (tls_shared_gnu2_test): New target.
6707         (tls_test_gnu2_shared.so): New target.
6708         (tls_shared_gnu2_test_SOURCES): New variable.
6709         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6710         (tls_shared_gnu2_test_LDFLAGS): New variable.
6711         (tls_shared_gnu2_test_LDADD): New variable.
6712         * testsuite/Makefile.in: Rebuild.
6713         * testsuite/Makefile.
6714
6715 2008-04-11  Ian Lance Taylor  <iant@google.com>
6716
6717         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6718         justsyms.t.
6719         * testsuite/Makefile.in: Rebuild.
6720
6721         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6722         long.
6723         * testsuite/script_test_2.cc (main): Adjust test.
6724
6725 2008-04-11  David S. Miller  <davem@davemloft.net>
6726             Ian Lance Taylor  <iant@google.com>
6727
6728         * options.h (General_options): Add entries for '-Y' and
6729         '-relax'.
6730         * options.cc (General_options:finalize): If -Y was used, add those
6731         entries to the library path instead of the default "/lib" and
6732         "/usr/lib".
6733
6734 2008-04-11  David S. Miller  <davem@davemloft.net>
6735
6736         * testsuite/justsyms.t: Start at 0x100.
6737         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
6738         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6739         long.
6740         * testsuite/script_test_2.cc: Adjust string and section length
6741         checks.
6742
6743 2008-04-09  Ian Lance Taylor  <iant@google.com>
6744
6745         PR gold/5996
6746         * script-sections.cc (Sections_element::allocate_to_segment): Add
6747         orphan parameter.
6748         (Output_section_definition::allocate_to_segment): Likewise.
6749         (Orphan_output_section::allocate_to_segment): Likewise.
6750         (Script_sections::attach_sections_using_phdrs_clause): Don't
6751         propagate non-PT_LOAD segments to orphan sections.
6752         * testsuite/Makefile.am (script_test_3.stdout): Generate using
6753         readelf rather than objdump.
6754         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
6755         .interp section and PT_INTERP segment are the same size.
6756         * testsuite/Makefile.in: Rebuild.
6757
6758         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6759         aliases for symbols defined in the same object.
6760         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6761         (weak_alias_test_SOURCES): New variable.
6762         (weak_alias_test_DEPENDENCIES): New variable.
6763         (weak_alias_test_LDFLAGS): New variable.
6764         (weak_alias_test_LDADD): New variable.
6765         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6766         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6767         (weak_alias_test_3.o): New target.
6768         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6769         * testsuite/weak_alias_test_main.cc: New file.
6770         * testsuite/weak_alias_test_1.cc: New file.
6771         * testsuite/weak_alias_test_2.cc: New file.
6772         * testsuite/weak_alias_test_3.cc: New file.
6773
6774 2008-04-08  Ian Lance Taylor  <iant@google.com>
6775
6776         * options.h (class General_options): Add --noinhibit-exec option.
6777         * main.cc (main): Check --noinhibit-exec.
6778
6779         * options.h (class General_options): Define --wrap as a special
6780         option.  Add wrap_symbols_ field.
6781         (General_options::any_wrap_symbols): New function.
6782         (General_options::is_wrap_symbol): New function.
6783         * options.cc (General_options::parse_wrap): New function.
6784         (General_options::General_options): Initialize wrap_symbols_.
6785         * symtab.cc (Symbol_table::wrap_symbol): New function.
6786         (Symbol_table::add_from_object): Handle --wrap.
6787         * symtab.h (class Symbol_table): Declare wrap_symbol.
6788         * target.h (Target::wrap_char): New function.
6789         (Target::Target_info): Add wrap_char field.
6790         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6791         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6792         * testsuite/testfile.cc (Target_test::test_target_info):
6793         Likewise.
6794
6795         * errors.cc (Errors::undefined_symbol): Mention symbol version if
6796         there is one.
6797
6798         * layout.h (class Layout): Add added_eh_frame_data_ field.
6799         * layout.cc (Layout::Layout): Initialize new field.
6800         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6801         output section until we find a section we merged successfully.
6802         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6803         that the size be non-zero.
6804
6805         * merge.cc (Object_merge_map::get_output_offset): Remove inline
6806         qualifier.
6807
6808 2008-04-08  Craig Silverstein  <csilvers@google.com>
6809
6810         * configure.ac: Export new conditional variable HAVE_ZLIB.
6811         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6812         on HAVE_ZLIB.
6813         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6814         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6815
6816 2008-04-07  Ian Lance Taylor  <iant@google.com>
6817
6818         * version.cc (version_string): Set to "1.5".
6819
6820         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6821         Add issued_non_pic_error_ field.  Declare check_non_pic.
6822         (Target_x86_64::Scan::check_non_pic): New function.
6823         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6824         (Target_x86_64::Scan::global): Likewise.
6825
6826         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6827         addend parameter.  Change caller.  Handle merge sections.
6828         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6829         Address to Addend.  Don't add in the result of
6830         local_section_offset, pass down the addend and use the returned
6831         value.
6832         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6833         Update declarations of local_section_offset and symbol_value.
6834         * testsuite/two_file_test_1.cc (t18): New function.
6835         * testsuite/two_file_test_2.cc (f18): New function.
6836         * testsuite/two_file_test_main.cc (main): Call t18.
6837         * testsuite/two_file_test.h (t18, f18): Declare.
6838
6839         * configure.ac: Don't test for objdump, c++filt, or readelf.
6840         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6841         conditionals.
6842         (TEST_READELF): New variable.
6843         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6844         (check_PROGRAMS): Add two_file_strip_test.
6845         (two_file_strip_test): New target.
6846         (check_PROGRAMS): Add two_file_same_shared_strip_test.
6847         (two_file_same_shared_strip_test_SOURCES): New variable.
6848         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6849         (two_file_same_shared_strip_test_LDFLAGS): New variable.
6850         (two_file_same_shared_strip_test_LDADD): New variable.
6851         (two_file_shared_strip.so): New target.
6852         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6853         (ver_test_5.syms, ver_test_7.syms): Likewise.
6854         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6855         (strip_test_3.stdout): Use TEST_OBJDUMP.
6856         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6857
6858 2008-04-04  Cary Coutant  <ccoutant@google.com>
6859
6860         * symtab.h (Symbol::is_weak_undefined): New function.
6861         (Symbol::is_strong_undefined): New function.
6862         (Symbol::is_absolute): New function.
6863         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6864         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6865         absolute symbols.
6866         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6867         (weak_undef_test): New target.
6868         * testsuite/Makefile.in: Rebuild.
6869         * testsuite/weak_undef_file1.cc: New file.
6870         * testsuite/weak_undef_file2.cc: New file.
6871         * testsuite/weak_undef_test.cc: New file.
6872
6873 2008-04-03  Craig Silverstein  <csilvers@google.com>
6874
6875         * compressed_output.h (class Output_compressed_section): Use
6876         unsigned buffer.
6877         * compressed_output.cc (zlib_compress): Use unsigned buffers,
6878         add zlib header.
6879         (zlib_compressed_suffix): Removed.
6880         (Output_compressed_section::set_final_data_size): Use unsigned
6881         buffers.
6882         * testsuite/Makefile.am (flagstest_compress_debug_sections):
6883         Fix linker invocation.
6884         (flagstest_o_specialfile_and_compress_debug_sections):
6885         Likewise.
6886         * testsuite/Makefile.in: Regenerated.
6887
6888 2008-04-02  David S. Miller  <davem@davemloft.net>
6889
6890         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6891         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6892
6893 2008-04-02  Craig Silverstein  <csilvers@google.com>
6894
6895         * TODO: New file.
6896
6897 2008-04-02  Ian Lance Taylor  <iant@google.com>
6898
6899         * fileread.cc (File_read::find_view): Add byteshift and vshifted
6900         parameters.  Update for new key type to views_.  Change all
6901         callers.
6902         (File_read::read): Adjust for byteshift in returned view.
6903         (File_read::add_view): New function, broken out of
6904         find_and_make_view.
6905         (File_read::make_view): New function, broken out of
6906         find_and_make_view.
6907         (File_read::find_or_make_view): Add offset and aligned
6908         parameters.  Rewrite accordingly.  Change all callers.
6909         (File_read::get_view): Add offset and aligned parameters.  Adjust
6910         for byteshift in return value.
6911         (File_read::get_lasting_view): Likewise.
6912         * fileread.h (class File_read): Update declarations.
6913         (class File_read::View): Add byteshift_ field.  Add byteshift to
6914         constructor.  Add byteshift method.
6915         * archive.h (Archive::clear_uncached_views): New function.
6916         (Archive::get_view): Add aligned parameter.  Change all callers.
6917         * object.h (Object::get_view): Add aligned parameter.  Change all
6918         callers.
6919         (Object::get_lasting_view): Likewise.
6920
6921         * fileread.cc (File_read::release): Don't call clear_views if
6922         there are multiple objects.
6923         * fileread.h (File_read::clear_uncached_views): New function.
6924         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6925         on the archive.
6926
6927 2008-03-31  Cary Coutant  <ccoutant@google.com>
6928
6929         Add thin archive support.
6930         * archive.cc (Archive::armagt): New const.
6931         (Archive::setup): Remove task parameter and calls to unlock.
6932         (Archive::unlock_nested_archives): New function.
6933         (Archive::read_header): Add nested_off parameter. Change
6934         all callers.
6935         (Archive::interpret_header): Likewise.
6936         (Archive::include_all_members): Change to handle thin
6937         archives.
6938         (Archive::include_member): Likewise.
6939         * archive.h (Archive::Archive): Add new parameters and
6940         initializers.
6941         (Archive::armagt): New const.
6942         (Archive::setup): Remove task parameter.
6943         (Archive::unlock_nested_archives): New function.
6944         (Archive::read_header): Add nested_off parameter.
6945         (Archive::interpret_header): Likewise.
6946         (Archive::Nested_archive_table): New typedef.
6947         (Archive::is_thin_archive_): New field.
6948         (Archive::nested_archives_): New field.
6949         (Archive::options_): New field.
6950         (Archive::dirpath_): New field.
6951         (Archive::task_): New field.
6952         * readsyms.cc (Read_symbols::do_read_symbols): Add check
6953         for thin archives.  Pass additional parameters to
6954         Archive::Archive.  Unlock the archive file after calling
6955         Archive::setup.
6956
6957 2008-03-29  Ian Lance Taylor  <iant@google.com>
6958
6959         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6960         version symbol to be local.
6961         * testsuite/ver_test_4.sh: New file.
6962         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6963         (check_DATA): Add ver_test_4.syms.
6964         (ver_test_4.syms): New target.
6965         * testsuite/Makefile.in: Rebuild.
6966
6967         * output.cc
6968         (Output_section::Input_section_sort_entry::has_priority): New
6969         function.
6970         (Output_section::Input_section_sort_entry::match_file_name): New
6971         function.
6972         (Output_section::Input_section_sort_entry::match_section_name):
6973         Remove.
6974         (Output_section::Input_section_sort_entry::match_section_name_prefix):
6975         Remove.
6976         (Output_section::Input_section_sort_entry::match_section_file):
6977         Remove.
6978         (Output_section::Input_section_sort_compare::operator()): Rewrite
6979         using new Input_section_sort_entry functions.  Sort crtbegin and
6980         crtend first.  Sort sections with no priority before sections with
6981         a priority.
6982         * testsuite/initpri1.c (d3): Check j != 4.
6983         (cd5): New constructor/destructor function.
6984         (main): Check j != 2.
6985
6986         * symtab.cc (Symbol_table::add_from_object): If we don't use the
6987         new symbol when resolving, don't call set_is_default.
6988         * testsuite/ver_test_7.cc: New file.
6989         * testsuite/ver_test_7.sh: New file.
6990         * testsuite/Makefile.am (ver_test_7.so): New target.
6991         (ver_test_7.o): New target.
6992         (check_SCRIPTS): Add ver_test_7.sh.
6993         (check_DATA): Add ver_test_7.syms.
6994         (ver_test_7.syms): New target.
6995
6996 2008-03-28  Ian Lance Taylor  <iant@google.com>
6997
6998         * layout.cc (Layout::layout): If we see an input section with a
6999         name that needs sorting, set the must_sort flag for the output
7000         section.
7001         (Layout::make_output_section): If the name of the output section
7002         indicates that it might require sorting, set the may_sort flag.
7003         * output.h (Output_section::may_sort_attached_input_sections): New
7004         function.
7005         (Output_section::set_may_sort_attached_input_sections): New
7006         function.
7007         (Output_section::must_sort_attached_input_sections): New
7008         function.
7009         (Output_section::set_must_sort_attached_input_sections): New
7010         function.
7011         (class Output_section): Declare Input_section_sort_entry.  Define
7012         Input_section_sort_compare.  Declare
7013         sort_attached_input_sections.  Add new fields:
7014         may_sort_attached_input_sections_,
7015         must_sort_attached_input_sections_,
7016         attached_input_sections_are_sorted_.
7017         * output.cc (Output_section::Output_section): Initialize new
7018         fields.
7019         (Output_section::add_input_section): Add an entry to
7020         input_sections_ if may_sort or must_sort are true.
7021         (Output_section::set_final_data_size): Call
7022         sort_attached_input_sections if necessary.
7023         (Output_section::Input_section_sort_entry): Define new class.
7024         (Output_section::Input_section_sort_compare::operator()): New
7025         function.
7026         (Output_section::sort_attached_input_sections): New function.
7027         * configure.ac: Check whether the compiler supports constructor
7028         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
7029         * testsuite/initpri1.c: New file.
7030         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
7031         CONSTRUCTOR_PRIORITY.
7032         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
7033         (initpri1_LDFLAGS): New variable.
7034         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
7035
7036 2008-03-27  Ian Lance Taylor  <iant@google.com>
7037
7038         * common.cc (Sort_commons::operator): Correct sorting algorithm.
7039         * testsuite/common_test_1.c: New file.
7040         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
7041         (common_test_1_SOURCES): New variable.
7042         (common_test_1_DEPENDENCIES): New variable.
7043         (common_test_1_LDFLAGS): New variable.
7044
7045         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
7046         and commons_ correctly when NAME/VERSION does not override
7047         NAME/NULL.
7048         * testsuite/ver_test_6.c: New file.
7049         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
7050         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
7051         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
7052
7053 2008-03-26  Ian Lance Taylor  <iant@google.com>
7054
7055         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
7056         of an undefined symbol from a version script.
7057         * testsuite/Makefile.am (ver_test_5.so): New target.
7058         (ver_test_5.o): New target.
7059         (check_SCRIPTS): Add ver_test_5.sh.
7060         (check_DATA): Add ver_test_5.syms.
7061         (ver_test_5.syms): New target.
7062         * testsuite/ver_test_5.cc: New file.
7063         * testsuite/ver_test_5.script: New file.
7064         * testsuite/ver_test_5.sh: New file.
7065         * Makefile.in, testsuite/Makefile.in: Rebuild.
7066
7067         PR gold/5986
7068         Fix problems building gold with gcc 4.3.0.
7069         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
7070         (gold_error_at_location, gold_warning_at_location): Use it.
7071         * configure.ac: Check whether we can compile and use a template
7072         function with a printf attribute.
7073         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
7074         when jumping over bytes.
7075         * object.cc: Instantiate Object::read_section_data.
7076         * debug.h: Include <cstring>
7077         * dwarf_reader.cc: Include <algorithm>
7078         * main.cc: Include <cstring>.
7079         * options.cc: Include <cstring>.
7080         * output.cc: Include <cstring>.
7081         * script.cc: Include <cstring>.
7082         * script.h: Include <string>.
7083         * symtab.cc: Include <cstring> and <algorithm>.
7084         * target-select.cc: Include <cstring>.
7085         * version.cc: Include <string>.
7086         * testsuite/testmain.cc: Include <cstdlib>.
7087         * configure, config.in: Rebuild.
7088
7089 2008-03-25  Ian Lance Taylor  <iant@google.com>
7090
7091         * options.cc: Include "../bfd/bfdver.h".
7092         (options::help): Print bug reporting address.
7093
7094         * version.cc (print_version): Adjust output for current value of
7095         BFD_VERSION_STRING.
7096
7097         * NEWS: New file.
7098
7099         * options.cc (options::help): Print list of supported targets.
7100         * target-select.h: Include <vector>.
7101         (class Target_selector): Make machine_, size_, and is_big_endian_
7102         fields const.  Add bfd_name_ and instantiated_target_ fields.
7103         (Target_selector::Target_selector): Add bfd_name parameter.
7104         (Target_selector::recognize): Make non-virtual, call
7105         do_recognize.
7106         (Target_selector::recognize_by_name): Make non-virtual, call
7107         do_recognize_by_name.
7108         (Target_selector::supported_names): New function.
7109         (Target_selector::bfd_name): New function.
7110         (Target_selector::do_instantiate_target): New pure virtual
7111         function.
7112         (Target_selector::do_recognize): New virtual function.
7113         (Target_selector::do_recognize_by_name): New virtual function.
7114         (Target_selector::instantiate_target): New private function.
7115         (supported_target_names): Declare.
7116         * target-select.cc (Target_selector::Target_selector): Update for
7117         new parameter and fields.
7118         (select_target_by_name): Check that the name matches before
7119         calling recognize_by_name.
7120         (supported_target_names): New function.
7121         * i386.cc (class Target_selector_i386): Update Target_selector
7122         constructor call.  Remove recognize and recognize_by_name.  Add
7123         do_instantiate_target.
7124         * x86_64.cc (class Target_selector_x86_64): Likewise.
7125         * testsuite/testfile.cc (class Target_selector_test): Update for
7126         changes to Target_selector.
7127
7128         * README: Rewrite, with some notes on unsupported features.
7129
7130 2008-03-24  Cary Coutant  <ccoutant@google.com>
7131
7132         * i386.cc (Target_i386::Got_type): New enum declaration.
7133         (Target_i386::Scan::local): Updated callers of Output_data_got
7134         member functions.
7135         (Target_i386::Scan::global): Likewise.
7136         (Target_i386::Relocate::relocate): Likewise.
7137         (Target_i386::Relocate::relocate_tls): Likewise.
7138         * object.h (Got_offset_list): New class.
7139         (Sized_relobj::local_has_got_offset): Added got_type parameter.
7140         (Sized_relobj::local_got_offset): Likewise.
7141         (Sized_relobj::set_local_got_offset): Likewise.
7142         (Sized_relobj::local_has_tls_got_offset): Removed.
7143         (Sized_relobj::local_tls_got_offset): Removed.
7144         (Sized_relobj::set_local_tls_got_offset): Removed.
7145         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
7146         * output.cc (Output_data_got::add_global): Added got_type parameter.
7147         (Output_data_got::add_global_with_rel): Likewise.
7148         (Output_data_got::add_global_with_rela): Likewise.
7149         (Output_data_got::add_global_pair_with_rel): New function.
7150         (Output_data_got::add_global_pair_with_rela): New function.
7151         (Output_data_got::add_local): Added got_type parameter.
7152         (Output_data_got::add_local_with_rel): Likewise.
7153         (Output_data_got::add_local_with_rela): Likewise.
7154         (Output_data_got::add_local_pair_with_rel): New function.
7155         (Output_data_got::add_local_pair_with_rela): New function.
7156         (Output_data_got::add_global_tls): Removed.
7157         (Output_data_got::add_global_tls_with_rel): Removed.
7158         (Output_data_got::add_global_tls_with_rela): Removed.
7159         (Output_data_got::add_local_tls): Removed.
7160         (Output_data_got::add_local_tls_with_rel): Removed.
7161         (Output_data_got::add_local_tls_with_rela): Removed.
7162         * output.h (Output_data_got::add_global): Added got_type parameter.
7163         (Output_data_got::add_global_with_rel): Likewise.
7164         (Output_data_got::add_global_with_rela): Likewise.
7165         (Output_data_got::add_global_pair_with_rel): New function.
7166         (Output_data_got::add_global_pair_with_rela): New function.
7167         (Output_data_got::add_local): Added got_type parameter.
7168         (Output_data_got::add_local_with_rel): Likewise.
7169         (Output_data_got::add_local_with_rela): Likewise.
7170         (Output_data_got::add_local_pair_with_rel): New function.
7171         (Output_data_got::add_local_pair_with_rela): New function.
7172         (Output_data_got::add_global_tls): Removed.
7173         (Output_data_got::add_global_tls_with_rel): Removed.
7174         (Output_data_got::add_global_tls_with_rela): Removed.
7175         (Output_data_got::add_local_tls): Removed.
7176         (Output_data_got::add_local_tls_with_rel): Removed.
7177         (Output_data_got::add_local_tls_with_rela): Removed.
7178         * resolve.cc (Symbol::override_base_with_special): Removed
7179         reference to has_got_offset_ field.
7180         * symtab.cc (Symbol::init_fields): Replaced initialization
7181         of got_offset_ with got_offsets_.  Removed initialization
7182         of has_got_offset_
7183         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
7184         (Symbol::got_offset): Likewise.
7185         (Symbol::set_got_offset): Likewise.
7186         (Symbol::has_tls_got_offset): Removed.
7187         (Symbol::tls_got_offset): Removed.
7188         (Symbol::set_tls_got_offset): Removed.
7189         (Symbol::got_offset_): Removed.
7190         (Symbol::tls_mod_got_offset_): Removed.
7191         (Symbol::tls_pair_got_offset_): Removed.
7192         (Symbol::got_offsets_): New field.
7193         (Symbol::has_got_offset): Removed.
7194         (Symbol::has_tls_mod_got_offset): Removed.
7195         (Symbol::has_tls_pair_got_offset): Removed.
7196         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
7197         (Target_x86_64::Scan::local): Updated callers of Output_data_got
7198         member functions.
7199         (Target_x86_64::Scan::global): Likewise.
7200         (Target_x86_64::Relocate::relocate): Likewise.
7201         (Target_x86_64::Relocate::relocate_tls): Likewise.
7202
7203 2008-03-25  Ben Elliston  <bje@au.ibm.com>
7204
7205         * yyscript.y: Fix spelling error in comment.
7206
7207 2008-03-24  Ian Lance Taylor  <iant@google.com>
7208
7209         * options.h (class General_options): Define build_id option.
7210         * layout.h (class Layout): Declare write_build_id, create_note,
7211         create_build_id.  Add build_id_note_ member.
7212         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
7213         "libiberty.h", "md5.h", "sha1.h".
7214         (Layout::Layout): Initialize eh_frame_data_,
7215         eh_frame_hdr_section_, and build_id_note_.
7216         (Layout::finalize): Call create_build_id.
7217         (Layout::create_note): New function, broken out of
7218         Layout::create_gold_note.
7219         (Layout::create_gold_note): Call create_note.
7220         (Layout::create_build_id): New function.
7221         (Layout::write_build_id): New function.
7222         (Close_task_runner::run): Call write_build_id.
7223
7224         * x86_64.cc: Correct license to GPLv3.
7225
7226 2008-03-23  Ian Lance Taylor  <iant@google.com>
7227
7228         * options.cc: Include "demangle.h".
7229         (parse_optional_string): New function.
7230         (parse_long_option): Handle takes_optional_argument.
7231         (parse_short_option): Update dash_z initializer.  Handle
7232         takes_optional_argument.
7233         (General_options::General_options): Initialize do_demangle_.
7234         (General_options::finalize): Set do_demangle_.  Handle demangling
7235         style.
7236         * options.h (parse_optional_string): Declare.
7237         (struct One_option): Add optional_arg field.  Update constructor.
7238         Update call constructor calls.  Add takes_optional_argument
7239         function.
7240         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
7241         (DEFINE_optional_string): Define.
7242         (General_options::demangle): Change from DEFINE_bool to
7243         DEFINE_optional_string.
7244         (General_options::no_demangle): New function.
7245         (General_options::do_demangle): New function.
7246         (General_options::set_do_demangle): New function.
7247         (General_options::execstack_status_): Move definition to end of
7248         class definition.
7249         (General_options::static_): Likewise.
7250         (General_options::do_demangle_): New field.
7251         * object.cc (big_endian>::get_symbol_location_info): Call
7252         Options::do_demangle, not Options::demangle.
7253         * symtab.cc (demangle): Likewise.
7254
7255 2008-03-22  Ian Lance Taylor  <iant@google.com>
7256
7257         * gold.h: Include <cstddef> and <sys/types.h>
7258         * options.h: Include <cstring>.
7259
7260 2008-03-21  Ian Lance Taylor  <iant@google.com>
7261
7262         * Added source code to GNU binutils.