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