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