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