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