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