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