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