* arm.cc (Target_arm::Target_arm): Remove initialisation of
[external/binutils.git] / gold / ChangeLog
1 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2
3         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4         may_use_blx_.
5         (Target_arm::may_use_blx): Remove method.
6         (Target_arm::set_may_use_blx): Likewise.
7         (Target_arm::may_use_v4t_interworking): New method.
8         (Target_arm::may_use_v5t_interworking): Likewise.
9         (Target_arm::may_use_blx_): Remove member variable.
10         (Arm_relocate_functions::arm_branch_common): Check for v5T
11         interworking.
12         (Arm_relocate_functions::thumb_branch_common): Likewise.
13         (Reloc_stub::stub_type_for_reloc): Likewise.
14         (Target_arm::do_finalize_sections): Correct interworking checks.
15         * testsuite/Makefile.am: Add new tests.
16         * testsuite/Makefile.in: Regenerate.
17         * testsuite/arm_farcall_arm_arm.s: New test.
18         * testsuite/arm_farcall_arm_arm.sh: Likewise.
19         * testsuite/arm_farcall_arm_thumb.s: Likewise.
20         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
21         * testsuite/arm_farcall_thumb_arm.s: Likewise.
22         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
23         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
24         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
25
26 2011-10-31  Cary Coutant  <ccoutant@google.com>
27
28         PR gold/13023
29         * expression.cc (Expression::eval_with_dot): Add
30         is_section_dot_assignment parameter.
31         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
32         absolute and assigning to dot within a section.
33         * script-sections.cc
34         (Output_section_element_assignment::set_section_addresses): Pass
35         dot_section to set_if_absolute.
36         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
37         as is_section_dot_assignment flag to eval_with_dot.
38         (Output_section_element_dot_assignment::set_section_addresses):
39         Likewise.
40         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
41         parameter.  Also set value if relative to dot_section; set the
42         symbol's output_section.
43         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
44         parameter.  Adjust all callers.
45         (Expression::eval_maybe_dot): Likewise.
46         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
47         Adjust all callers.
48         * testsuite/script_test_2.t: Test assignment of an absolute value
49         to dot within an output section element.
50
51 2011-10-31  Cary Coutant  <ccoutant@google.com>
52
53         * options.h (class General_options): Add --[no-]gnu-unique options.
54         * symtab.cc (Symbol_table::sized_write_globals): Convert
55         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
56
57 2011-10-31  Cary Coutant  <ccoutant@google.com>
58
59         PR gold/13359
60         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
61         unnecessary assertion.
62         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
63
64 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
65
66         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
67         gc_mark_symbol.
68         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
69         gc_mark_symbol.
70         Change to just keep the section associated with symbol.
71         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
72         they are externally visible and --export-dynamic is turned on.
73         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
74
75 2011-10-19  Ian Lance Taylor  <iant@google.com>
76
77         PR gold/13163
78         * script-sections.cc
79         (Output_section_element_dot_assignment::needs_output_section): New
80         function.
81
82 2011-10-19  Ian Lance Taylor  <iant@google.com>
83
84         PR gold/13204
85         * layout.cc (Layout::segment_precedes): Don't assert failure if a
86         --section-start option was seen.
87         * options.h (General_options::any_section_start): New function.
88
89 2011-10-18  David S. Miller  <davem@davemloft.net>
90
91         PR binutils/13301
92         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
93         member to track relocation locations that have moved during TLS
94         reloc optimizations.
95         (Target_sparc::Relocate::Relocate): Initialize to NULL.
96         (Target_sparc::Relocate::relocate): Adjust view down by 4
97         bytes if it matches reloc_adjust_addr_.
98         (Target_sparc::Relocate::relocate_tls): Always move the
99         __tls_get_addr call delay slot instruction forward 4 bytes when
100         performing relaxation.
101
102 2011-10-18  Cary Coutant  <ccoutant@google.com>
103
104         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
105         (Output_file::map_no_anonymous): Check for non-zero
106         return code from posix_fallocate.
107
108 2011-10-17  Cary Coutant  <ccoutant@google.com>
109
110         PR gold/13245
111         * plugin.cc (is_visible_from_outside): Check for symbols
112         referenced from dynamic objects.
113         * resolve.cc (Symbol_table::resolve): Don't count references
114         from dynamic objects as references from real ELF files.
115         * testsuite/plugin_test_2.sh: Adjust expected result.
116
117 2011-10-17  Cary Coutant  <ccoutant@google.com>
118
119         * gold.cc: Include timer.h.
120         (queue_middle_tasks): Stamp time.
121         (queue_final_tasks): Likewise.
122         * main.cc (main): Store timer in parameters.  Print timers
123         for each pass.
124         * parameters.cc (Parameters::Parameters): Initialize timer_.
125         (Parameters::set_timer): New function.
126         (set_parameters_timer): New function.
127         * parameters.h (Parameters::set_timer): New function.
128         (Parameters::timer): New function.
129         (Parameters::timer_): New data member.
130         (set_parameters_timer): New function.
131         * timer.cc (Timer::stamp): New function.
132         (Timer::get_pass_time): New function.
133         * timer.h (Timer::stamp): New function.
134         (Timer::get_pass_time): New function.
135         (Timer::pass_times_): New data member.
136
137 2011-10-17  Cary Coutant  <ccoutant@google.com>
138
139         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
140         task for members of lib groups.
141
142 2011-10-17  Cary Coutant  <ccoutant@google.com>
143
144         PR gold/13288
145         * fileread.cc (File_read::find_view): Add assert.
146         (File_read::make_view): Move bounds check (replace with assert)...
147         (File_read::find_or_make_view): ... to here.
148
149 2011-10-12  Cary Coutant  <ccoutant@google.com>
150
151         * output.cc (Output_file::open_base_file): Handle case where
152         ::read returns less than requested size.
153
154 2011-10-10  Cary Coutant  <ccoutant@google.com>
155
156         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
157         Initialize defined_count_.
158         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
159         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
160         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
161         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
162         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
163         * incremental.h (Sized_relobj_incr::defined_count_): New data
164         member.
165         (Sized_incr_dynobj::defined_count_): New data member.
166         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
167         Return zeroes instead of internal error.
168
169 2011-10-10  Cary Coutant  <ccoutant@google.com>
170
171         PR gold/13249
172         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
173         (Output_reloc::symbol_value): Return PLT offset if flag is set.
174         * output.h (class Output_reloc): Add use_plt_offset flag.
175         (Output_reloc::type_): Adjust size of bit field.
176         (Output_reloc::use_plt_offset_): New bit field.
177         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
178         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
179         flag.  Adjust all callers.
180         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
181         creating RELATIVE relocations.
182
183 2011-10-10  Nick Clifton  <nickc@redhat.com>
184
185         * po/es.po: Updated Spanish translation.
186         * po/fi.po: Updated Finnish translation.
187
188 2011-10-03   Diego Novillo  <dnovillo@google.com>
189
190         * options.cc (parse_uint): Fix dereference of RETVAL.
191
192 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
193
194         * layout.h (section_order_map_): New member.
195         (get_section_order_map): New member function.
196         * output.cc (Output_section::add_input_section): Check for patterns
197         only when --section-ordering-file is specified.
198         * gold.cc (queue_middle_tasks): Delay updating order of sections till
199         output_sections have been formed.
200         * layout.cc (Layout_Layout): Initialize section_order_map_.
201         * plugin.cc (update_section_order): Store order in order_map. Do not
202         update the order.
203         * testsuite/Makefile.am: Add test case for plugin_final_layout.
204         * testsuite/Makefile.in: Regenerate.
205         * testsuite/plugin_section_order.c: New file.
206         * testsuite/plugin_final_layout.cc: New file.
207         * testsuite/plugin_final_layout.sh: New file.
208
209 2011-09-29  Cary Coutant  <ccoutant@google.com>
210
211         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
212         Check for NULL.
213         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
214         symbols during incremental update.
215         (Symbol_table::add_from_dynobj): Likewise.
216
217 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
218             Ian Lance Taylor  <iant@google.com>
219
220         * symtab.cc (Symbol_table::define_special_symbol): Always
221         canonicalize version string.
222
223 2011-09-26  Cary Coutant  <ccoutant@google.com>
224
225         * gold.cc (queue_initial_tasks): Move option checks ...
226         * options.cc (General_options::finalize): ... to here. Disable
227         some options; make others fatal.
228
229 2011-09-26  Cary Coutant  <ccoutant@google.com>
230
231         gcc PR lto/47247
232         * plugin.cc (get_symbols_v2): New function.
233         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
234         (is_referenced_from_outside): New function.
235         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
236         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
237         (get_symbols): Pass version parameter.
238         (get_symbols_v2): New function.
239         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
240         parameter.
241         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
242         (onload): Add LDPT_GET_SYMBOLS_V2.
243         (all_symbols_read_hook): Use get_symbols_v2; check for
244         LDPR_PREVAILING_DEF_IRONLY_EXP.
245         * testsuite/plugin_test_3.sh: Update expected results.
246
247 2011-09-23  Simon Baldwin  <simonb@google.com>
248
249         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
250         configuration options.
251         * configure: Regenerate.
252         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
253         * Makefile.in: Regenerate.
254         * testsuite/Makefile.in: Regenerate.
255
256 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
257
258         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
259
260 2011-09-19  Cary Coutant  <ccoutant@google.com>
261
262         * incremental.cc (can_incremental_update): Fix typo in comment.
263         * incremental.h (can_incremental_update): Likewise.
264
265 2011-09-18  Cary Coutant  <ccoutant@google.com>
266
267         * incremental.cc (can_incremental_update): New function.
268         * incremental.h (can_incremental_update): New function.
269         * layout.cc (Layout::init_fixed_output_section): Call it.
270         (Layout::make_output_section): Don't allow patch space in .eh_frame.
271         * object.cc (Sized_relobj_file::do_layout): Call
272         can_incremental_update.
273
274 2011-09-13  Cary Coutant  <ccoutant@google.com>
275
276         * configure.ac: Check for glibc support for gnu_indirect_function
277         support with static linking, setting automake conditional
278         IFUNC_STATIC.
279         * Makefile.in: Regenerate.
280         * configure: Regenerate.
281
282         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
283         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
284         for IFUNC_STATIC.
285         * testsuite/Makefile.in: Regenerate.
286
287 2011-09-13  Cary Coutant  <ccoutant@google.com>
288
289         * incremental.cc (Sized_relobj_incr::do_layout): Call
290         report_comdat_group for kept comdat sections.
291         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
292         * testsuite/Makefile.in: Regenerate.
293         * testsuite/incr_comdat_test_1.cc: New source file.
294         * testsuite/incr_comdat_test_2_v1.cc: New source file.
295         * testsuite/incr_comdat_test_2_v2.cc: New source file.
296         * testsuite/incr_comdat_test_2_v3.cc: New source file.
297
298 2011-09-13  Ian Lance Taylor  <iant@google.com>
299
300         * object.cc (Sized_relobj_file::do_layout): Remove unused local
301         variable external_symbols_offset.
302
303 2011-09-12  Ian Lance Taylor  <iant@google.com>
304
305         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
306         triggered if object has no symbols.
307
308 2011-09-09  David S. Miller  <davem@davemloft.net>
309
310         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
311         (Output_fill_debug_line::do_write): Likewise.
312
313 2011-08-29  Cary Coutant  <ccoutant@google.com>
314
315         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
316         casts to match formatting specs.
317         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
318
319 2011-08-26  Cary Coutant  <ccoutant@google.com>
320
321         * layout.cc (Free_list::allocate): Provide guarantee of minimum
322         remaining hole size when allocating.
323         (Layout::make_output_section): Set fill methods for debug sections.
324         * layout.h (Free_list::Free_list_node): Move from private to
325         public.
326         (Free_list::set_min_hole_size): New function.
327         (Free_list::begin, Free_list::end): New functions.
328         (Free_list::min_hole_): New data member.
329         * output.cc: Include dwarf.h.
330         (Output_fill_debug_info::do_minimum_hole_size): New function.
331         (Output_fill_debug_info::do_write): New function.
332         (Output_fill_debug_line::do_minimum_hole_size): New function.
333         (Output_fill_debug_line::do_write): New function.
334         (Output_section::Output_section): Initialize new data member.
335         (Output_section::set_final_data_size): Ensure patch space is larger
336         than minimum hole size.
337         (Output_section::do_write): Fill holes in debug sections.
338         * output.h (Output_fill): New class.
339         (Output_fill_debug_info): New class.
340         (Output_fill_debug_line): New class.
341         (Output_section::set_free_space_fill): New function.
342         (Output_section::free_space_fill_): New data member.
343         * testsuite/Makefile.am (incremental_test_3): Add
344         --incremental-patch option.
345         (incremental_test_4): Likewise.
346         (incremental_test_5): Likewise.
347         (incremental_test_6): Likewise.
348         (incremental_copy_test): Likewise.
349         (incremental_common_test_1): Likewise.
350         * testsuite/Makefile.in: Regenerate.
351
352 2011-08-26  Nick Clifton  <nickc@redhat.com>
353
354         * po/es.po: Updated Spanish translation.
355
356 2011-08-01  Cary Coutant  <ccoutant@google.com>
357
358         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
359         * gold/testsuite/Makefile.in: Regenerate.
360         * gold/testsuite/justsyms_exec.c: New source file.
361         * gold/testsuite/justsyms_lib.c: New source file.
362
363 2011-08-01  Cary Coutant  <ccoutant@google.com>
364
365         * layout.cc (Layout::set_segment_offsets): Don't realign text
366         segment if -Ttext was specified.
367         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
368         file type.
369         * object.h (Sized_relobj_file::e_type): New function.
370         (Sized_relobj_file::e_type_): New data member.
371         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
372         base address for ET_EXEC files.
373         * target.cc (Target::do_make_elf_object_implementation): Allow
374         ET_EXEC files with --just-symbols option.
375
376 2011-07-28  Cary Coutant  <ccoutant@google.com>
377
378         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
379         Add thread_number parameter.
380         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
381         * workqueue-threads.cc
382         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
383         current thread if its thread number is greater than desired thread
384         count.
385         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
386         Add thread_number parameter.
387         (Workqueue::should_cancel_thread): Likewise.
388         (Workqueue::find_runnable_or_wait): Pass thread_number to
389         should_cancel_thread.
390         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
391         parameter.
392
393 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
394
395         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
396         only after checking if it cannot be forced local.
397         * symtab.h (is_externally_visible): Check if the symbol is not forced
398         local.
399
400 2011-07-15  Ian Lance Taylor  <iant@google.com>
401
402         * options.h (class General_options): Add --print-output-format.
403         Move -EL next to -EB, for  better --help output.
404         * target-select.cc: Include <cstdio>, "options.h", and
405         "parameters.h".
406         (Target_selector::do_target_bfd_name): New function.
407         (print_output_format): New function.
408         * target-select.h (class Target_selector): Update declarations.
409         (Target_selector::target_bfd_name): New function.
410         (print_output_format): Declare.
411         * main.cc: Include "target-select.h".
412         (main): Handle --print-output-format.
413         * gold.cc: Include "target-select.h".
414         (queue_initial_tasks): Handle --print-output-format when there are
415         no input files.
416         * parameters.cc (parameters_force_valid_target): Give a better
417         error message if -EB/-EL does not match target.
418         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
419         function.
420
421 2011-07-15  Ian Lance Taylor  <iant@google.com>
422
423         * i386.cc (class Output_data_plt_i386): Add layout_ field.
424         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
425         (Output_data_plt_i386::do_write): Write address of .dynamic
426         section to first entry in .got.plt section.
427         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
428         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
429         Initialize layout_.
430         (Output_data_plt_x86_64::do_write): Write address of .dynamic
431         section to first entry in .got.plt section.
432         * layout.h (Layout::dynamic_section): New function.
433
434 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
435
436         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
437         to claim_file call.
438         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
439         input_section_position_, and input_section_glob_.
440         (read_layout_from_file): Call function section_ordering_specified.
441         * layout.h (is_section_ordering_specified): New function.
442         (section_ordering_specified): New function.
443         (section_ordering_specified_): New boolean member.
444         * main.cc(main): Call load_plugins after layout object is defined.
445         * output.cc (Output_section::add_input_section): Use
446         function section_ordering_specified to check if section ordering is
447         needed.
448         * output.cc (Output_section::add_relaxed_input_section): Use
449         function section_ordering_specified to check if section ordering is
450         needed.
451         (Output_section::update_section_layout): New function.
452         (Output_section::sort_attached_input_sections): Check if input section
453         must be reordered.
454         * output.h (Output_section::update_section_layout): New function.
455         * plugin.cc (get_section_count): New function.
456         (get_section_type): New function.
457         (get_section_name): New function.
458         (get_section_contents): New function.
459         (update_section_order): New function.
460         (allow_section_ordering): New function. 
461         (Plugin::load): Add the new interfaces to the transfer vector.
462         (Plugin_manager::load_plugins): New parameter.
463         (Plugin_manager::all_symbols_read): New parameter.
464         (Plugin_manager::claim_file): New parameter. Save the elf object for
465         unclaimed objects.
466         (Plugin_manager::get_elf_object): New function.
467         (Plugin_manager::get_view): Change to directly use the bool to check
468         if get_view is called from claim_file_hook.
469         * plugin.h (input_objects): New function
470         (Plugin__manager::load_plugins): New parameter.
471         (Plugin_manager::claim_file): New parameter.
472         (Plugin_manager::get_elf_object): New function.
473         (Plugin_manager::in_claim_file_handler): New function.
474         (Plugin_manager::in_claim_file_handler_): New member.
475         (layout): New function.
476         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
477         handler with an extra parameter. Make the elf object before calling
478         claim_file handler.
479         * testsuite/plugin_test.c (get_section_count): New function pointer.
480         (get_section_type): New function pointer.
481         (get_section_name): New function pointer.
482         (get_section_contents): New function pointer.
483         (update_section_order): New function pointer.
484         (allow_section_ordering): New function pointer.
485         (onload): Check if the new interfaces exist.
486
487 2011-07-13  Ian Lance Taylor  <iant@google.com>
488
489         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
490         relro section.
491         * x86_64.cc (Target_x86_64::got_section): Likewise.
492         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
493         (relro_now_test_SOURCES): New variable.
494         (relro_now_test_DEPENDENCIES): New variable.
495         (relro_now_test_LDFLAGS): New variable.
496         (relro_now_test_LDADD): New variable.
497         (relro_now_test.so): New target.
498         * testsuite/Makefile.in: Rebuild.
499
500 2011-07-12  Ian Lance Taylor  <iant@google.com>
501
502         PR gold/12980
503         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
504         GLOB_DAT relocation rather than a RELATIVE relocation for a
505         protected symbol when creating a shared library.
506         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
507         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
508         * testsuite/protected_main_1.cc (main): Test that protected
509         function has same address.
510
511 2011-07-11  Ian Lance Taylor  <iant@google.com>
512
513         PR gold/12979
514         * options.h (class General_options): Add -Bgroup.
515         * options.cc (General_options::finalize): If -Bgroup is set,
516         default to --unresolved-symbols=report-all.
517         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
518         * target-reloc.h (issue_undefined_symbol_error): Handle
519         --unresolved-symbols=report-all.
520
521 2011-07-08  Ian Lance Taylor  <iant@google.com>
522
523         PR gold/11985
524         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
525         if linker script discards key sections.
526         (Layout::create_dynamic_symtab): Likewise.
527         (Layout::assign_local_dynsym_offsets): Likewise.
528         (Layout::sized_create_version_sections): Likewise.
529         (Layout::create_interp): Likewise.
530         (Layout::finish_dynamic_section): Likewise.
531         (Layout::set_dynamic_symbol_size): Likewise.
532
533 2011-07-08  Ian Lance Taylor  <iant@google.com>
534
535         PR gold/12386
536         * options.h (class General_options): Add --unresolved-symbols.
537         * target-reloc.h (issue_undefined_symbol_error): Check
538         --unresolved-symbols.  Add comments.
539
540 2011-07-08  Ian Lance Taylor  <iant@google.com>
541
542         * testsuite/odr_violation2.cc (Ordering::operator()): Make
543         expression more complex.
544
545 2011-07-08  Ian Lance Taylor  <iant@google.com>
546
547         PR gold/11317
548         * target-reloc.h (issue_undefined_symbol_error): New inline
549         function, broken out of relocate_section.
550         (relocate_section): Call issue_undefined_symbol_error.
551         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
552         there is no TLS segment if we are about to issue an undefined
553         symbol error.
554         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
555
556 2011-07-08  Ian Lance Taylor  <iant@google.com>
557
558         PR gold/12279
559         * resolve.cc (Symbol_table::should_override): Add fromtype
560         parameter.  Change all callers.  Give error when linking together
561         TLS and non-TLS symbol.
562         (Symbol_table::should_override_with_special): Add fromtype
563         parameter.  Change all callers.
564         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
565         there is no TLS segment if we have reported some errors.
566         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
567
568 2011-07-08  Ian Lance Taylor  <iant@google.com>
569
570         PR gold/12372
571         * target.h (Target::plt_address_for_global): New function.
572         (Target::plt_address_for_local): New function.
573         (Target::plt_section_for_global): Remove.
574         (Target::plt_section_for_local): Remove.
575         (Target::do_plt_address_for_global): New virtual function.
576         (Target::do_plt_address_for_local): New virtual function.
577         (Target::do_plt_section_for_global): Remove.
578         (Target::do_plt_section_for_local): Remove.
579         (Target::register_global_plt_entry): Add Symbol_table and Layout
580         parameters.
581         * output.cc (Output_data_got::Got_entry::write): Use
582         plt_address_for_global and plt_address_for_local.
583         * layout.cc (Layout::add_target_dynamic_tags): Use size and
584         address of output section.
585         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
586         got_irelative_, and irelative_count_ fields.  Update
587         declarations.
588         (Output_data_plt_i386::has_irelative_section): New function.
589         (Output_data_plt_i386::entry_count): Add irelative_count_.
590         (Output_data_plt_i386::set_final_data_size): Likewise.
591         (class Target_i386): Add got_irelative_ and rel_irelative_
592         fields.  Update declarations.
593         (Target_i386::Target_i386): Initialize new fields.
594         (Target_i386::do_plt_address_for_global): New function replacing
595         do_plt_section_for_global.
596         (Target_i386::do_plt_address_for_local): New function replacing
597         do_plt_section_for_local.
598         (Target_i386::got_section): Create got_irelative_.
599         (Target_i386::rel_irelative_section): New function.
600         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
601         fields.  Don't define __rel_iplt_{start,end}.
602         (Output_data_plt_i386::add_entry): Add symtab and layout
603         parameters.  Change all callers.  Use different PLT and GOT for
604         IFUNC symbols.
605         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
606         layout parameters.  Change all callers.  Use different PLT and
607         GOT.
608         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
609         (Output_data_plt_i386::rel_irelative): New function.
610         (Output_data_plt_i386::address_for_global): New function.
611         (Output_data_plt_i386::address_for_local): New function.
612         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
613         IRELATIVE GOT when changing IFUNC GOT entries.
614         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
615         reloc.
616         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
617         if we didn't create an IRELATIVE GOT.
618         (Target_i386::Relocate::relocate): Use plt_address_for_global and
619         plt_address_for_local.
620         (Target_i386::do_dynsym_value): Use plt_address_for_global.
621         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
622         got_irelative_, and irelative_count_ fields.  Update
623         declarations.
624         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
625         Initialize new fields.  Remove symtab parameter.  Change all
626         callers.
627         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
628         irelative_count_.
629         (Output_data_plt_x86_64::has_irelative_section): New function.
630         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
631         (class Target_x86_64): Add got_irelative_ and rel_irelative_
632         fields.  Update declarations.
633         (Target_x86_64::Target_x86_64): Initialize new fields.
634         (Target_x86_64::do_plt_address_for_global): New function replacing
635         do_plt_section_for_global.
636         (Target_x86_64::do_plt_address_for_local): New function replacing
637         do_plt_section_for_local.
638         (Target_x86_64::got_section): Create got_irelative_.
639         (Target_x86_64::rela_irelative_section): New function.
640         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
641         all callers.  Don't create __rel_iplt_{start,end}.
642         (Output_data_plt_x86_64::add_entry): Add symtab and layout
643         parameters.  Change all callers.  Use different PLT and GOT for
644         IFUNC symbols.
645         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
646         layout parameters.  Change all callers.  Use different PLT and
647         GOT.
648         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
649         parameters.  Change all callers.  Use different PLT and GOT for
650         IFUNC symbols.
651         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
652         (Output_data_plt_x86_64::rela_irelative): New function.
653         (Output_data_plt_x86_64::address_for_global): New function.
654         (Output_data_plt_x86_64::address_for_local): New function.
655         (Output_data_plt_x86_64::set_final_data_size): Likewise.
656         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
657         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
658         (Target_x86_64::register_global_plt_entry): Add symtab and layout
659         parameters.
660         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
661         reloc.
662         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
663         symbols if we didn't create an IRELATIVE GOT.
664         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
665         plt_address_for_local.
666         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
667         * testsuite/ifuncvar1.c: New test file.
668         * testsuite/ifuncvar2.c: New test file.
669         * testsuite/ifuncvar3.c: New test file.
670         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
671         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
672         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
673         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
674         * testsuite/Makefile.in: Rebuild.
675
676 2011-07-07  Cary Coutant  <ccoutant@google.com>
677
678         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
679         (two_file_test_1_ndebug.o): Likewise.
680         (two_file_test_1b_ndebug.o): Likewise.
681         (two_file_test_2_ndebug.o): Likewise.
682         (two_file_test_main_ndebug.o): Likewise.
683         (incremental_test_2): Link with no-debug versions.
684
685 2011-07-06  Cary Coutant  <ccoutant@google.com>
686
687         * gold/incremental.cc
688         (Output_section_incremental_inputs::write_info_blocks): Check for
689         hidden and internal symbols.
690
691 2011-07-06  Cary Coutant  <ccoutant@google.com>
692
693         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
694         Check disposition for startup file.
695         (Incremental_inputs::report_command_line): Ignore
696         --incremental-startup-unchanged option.
697         * options.cc (General_options::parse_incremental_startup_unchanged):
698         New function.
699         (General_options::General_options): Initialize new data member.
700         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
701         (General_options): Add --incremental-startup-unchanged option.
702         (General_options::incremental_startup_disposition): New function.
703         (General_options::incremental_startup_disposition_): New data member.
704
705 2011-07-06  Cary Coutant  <ccoutant@google.com>
706
707         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
708         input file index to Script_info ctor.
709         (Sized_incremental_binary::do_file_has_changed): Find the
710         command-line argument for files named in scripts.
711         * incremental.h (Script_info::Script_info): New ctor
712         with input file index.
713         (Script_info::input_file_index): New function.
714         (Script_info::input_file_index_): New data member.
715         (Incremental_binary::get_library): Add const.
716         (Incremental_binary::get_script_info): Add const.
717         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
718         * testsuite/Makefile.am (incremental_test_5): New test case.
719         (incremental_test_6): New test case.
720         * testsuite/Makefile.in: Regenerate.
721
722 2011-07-06  Cary Coutant  <ccoutant@google.com>
723
724         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
725         debug output when command lines differ.
726
727 2011-07-06  Cary Coutant  <ccoutant@google.com>
728
729         * incremental.cc (Incremental_inputs::report_command_line): Ignore
730         --incremental-patch option.
731         * layout.cc (Free_list::allocate): Extend allocation beyond original
732         end if enabled.
733         (Layout::make_output_section): Mark sections that should get
734         patch space.
735         * options.cc (parse_percent): New function.
736         * options.h (parse_percent): New function.
737         (DEFINE_percent): New macro.
738         (General_options): Add --incremental-patch option.
739         * output.cc (Output_section::Output_section): Initialize new data
740         members.
741         (Output_section::add_input_section): Print section name when out
742         of patch space.
743         (Output_section::add_output_section_data): Likewise.
744         (Output_section::set_final_data_size): Add patch space when
745         doing --incremental-full.
746         (Output_section::do_reset_address_and_file_offset): Remove patch
747         space.
748         (Output_segment::set_section_list_addresses): Print debug output
749         only if --incremental-update.
750         * output.h (Output_section::set_is_patch_space_allowed): New function.
751         (Output_section::is_patch_space_allowed_): New data member.
752         (Output_section::patch_space_): New data member.
753         * parameters.cc (Parameters::incremental_full): New function.
754         * parameters.h (Parameters::incremental_full): New function
755         * testsuite/Makefile.am (incremental_test_2): Add test for
756         --incremental-patch option.
757         * testsuite/Makefile.in: Regenerate.
758         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
759         (t18): Remove function body.
760
761 2011-07-05  Doug Kwan  <dougkwan@google.com>
762
763         PR gold/12771
764         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
765         Arm_Address type for relocation result.
766         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
767         overflow check.
768         (Arm_relocate_functions::abs32): Use unaligned access.
769         (Arm_relocate_functions::rel32): Ditto.
770         (Arm_relocate_functions::prel31): Ditto.
771         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
772         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
773         static data relocations.
774         * testsuite/Makefile.in: Regnerate.
775         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
776
777 2011-07-05  Ian Lance Taylor  <iant@google.com>
778
779         PR gold/12392
780         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
781         symbols if necessary.
782         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
783
784 2011-07-05  Ian Lance Taylor  <iant@google.com>
785
786         PR gold/12952
787         * resolve.cc (Symbol::override_base_with_special): Simply override
788         version with special symbol version, ignoring previous version.
789
790 2011-07-05  Ian Lance Taylor  <iant@google.com>
791
792         * object.cc (Sized_relobj_file::include_section_group): Add
793         information to comment about signature location.
794
795 2011-07-02  Ian Lance Taylor  <iant@google.com>
796
797         PR gold/12957
798         * options.h (class General_options): Add -f and -F.
799         * options.cc (General_options::finalize): Fatal error if -f/-F
800         are used without -shared.
801         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
802
803 2011-07-02  Ian Lance Taylor  <iant@google.com>
804
805         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
806
807 2011-07-01  Ian Lance Taylor  <iant@google.com>
808
809         PR gold/12525
810         PR gold/12952
811         * resolve.cc (Symbol::override_base_with_special): Don't override
812         the version if the overriding symbol has a different name.
813         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
814         all callers.  If we give an error about an undefined version,
815         define the base version if necessary.
816         * dynobj.h (class Versions): Update declaration.
817         * testsuite/weak_alias_test_5.cc: New file.
818         * testsuite/weak_alias_test.script: New file.
819         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
820         and versioned_alias have the right value, and call t2.
821         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
822         weak_alias_test_5.so.
823         (weak_alias_test_LDADD): Likewise.
824         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
825         * testsuite/Makefile.in: Rebuild.
826
827 2011-07-01  Ian Lance Taylor  <iant@google.com>
828
829         PR gold/12525
830         * options.h (class General_options): Support -z notext.
831         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
832         -Wl,-z,notext.
833         (two_file_shared_nonpic.so): Likewise.
834         (two_file_shared_mixed.so): Likewise.
835         (two_file_shared_mixed_1.so): Likewise.
836         (weak_undef_lib_nonpic.so): Likewise.
837         (alt/weak_undef_lib_nonpic.so): Likewise.
838         (tls_test_shared_nonpic.so): Likewise.
839         * testsuite/Makefile.in: Rebuild.
840
841 2011-07-01  Ian Lance Taylor  <iant@google.com>
842
843         PR gold/12525
844         * configure.ac: Test whether static linking works, setting
845         the automake conditional HAVE_STATIC.
846         * testsuite/Makefile.am: Disable tests using -static if
847         HAVE_STATIC is not true.
848         * configure, testsuite/Makefile.in: Rebuild.
849
850 2011-07-01  Ian Lance Taylor  <iant@google.com>
851
852         PR gold/12525
853         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
854         Assert if we see DW_EH_PE_indirect.
855         * target.h (Target::ehframe_datarel_base): New function.
856         (Target::do_ehframe_datarel_base): New target function.
857         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
858         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
859         function.
860
861 2011-07-01  Ian Lance Taylor  <iant@google.com>
862
863         PR gold/12571
864         * options.h (class General_options): Add
865         --ld-generated-unwind-info.
866         * ehframe.cc (Fde::write): Add address parameter.  Change all
867         callers.  If associated with PLT, fill in address and size.
868         (Cie::set_output_offset): Only add merge mapping if there is an
869         object.
870         (Cie::write): Add address parameter.  Change all callers.
871         (Eh_frame::add_ehframe_for_plt): New function.
872         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
873         input_offset_ fields into union u_, with new plt field.
874         (Fde::Fde): Adjust for new union field.
875         (Fde::Fde) [Output_data version]: New constructor.
876         (Fde::add_mapping): Only add merge mapping if there is an object.
877         (class Cie): Update declarations.
878         (class Eh_frame): Declare add_ehframe_for_plt.
879         * layout.cc (Layout::layout_eh_frame): Break out code into
880         make_eh_frame_section, and call it.
881         (Layout::make_eh_frame_section): New function.
882         (Layout::add_eh_frame_for_plt): New function.
883         * layout.h (class Layout): Update declarations.
884         * merge.cc (Merge_map::add_mapping): Add assertion.
885         * i386.cc: Include "dwarf.h".
886         (class Output_data_plt_i386): Make first_plt_entry,
887         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
888         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
889         and plt_eh_frame_fde.
890         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
891         boundary.  Call add_eh_frame_for_plt if appropriate.
892         * x86_64.cc: Include "dwarf.h".
893         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
894         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
895         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
896         and plt_eh_frame_fde.
897         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
898         appropriate.
899
900 2011-06-29  Ian Lance Taylor  <iant@google.com>
901
902         PR gold/12629
903         * object.cc (Sized_relobj_file::layout_section): Change shdr
904         parameter to be const.
905         (Sized_relobj_file::layout_eh_frame_section): New function, broken
906         out of do_layout.
907         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
908         appropriate.  Call layout_eh_frame_section.
909         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
910         sections.
911         * object.h (class Sized_relobj_file): Update declarations.
912
913 2011-06-29  Ian Lance Taylor  <iant@google.com>
914
915         PR gold/12652
916         * script.cc (Token::integer_value): Accept trailing M/m/K/k
917         modifier.
918         (Lex::gather_token): Accept trailing M/m/K/k for integers.
919
920 2011-06-29  Ian Lance Taylor  <iant@google.com>
921
922         PR gold/12675
923         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
924         SHT_X86_64_UNWIND.
925         * layout.cc (Layout::layout_eh_frame): Likewise.
926
927 2011-06-29  Ian Lance Taylor  <iant@google.com>
928
929         PR gold/12695
930         * layout.cc (Layout::symtab_section_shndx): New function.
931         * layout.h (class Layout): Declare symtab_section_shndx.
932         * output.cc (Output_section::write_header): Call it.
933
934 2011-06-29  Ian Lance Taylor  <iant@google.com>
935
936         PR gold/12818
937         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
938         symbols which are not used in a relocation.
939
940 2011-06-28  Ian Lance Taylor  <iant@google.com>
941
942         PR gold/12898
943         * layout.cc (Layout::segment_precedes): Don't crash if a linker
944         script create indistinguishable segments.
945         (Layout::set_segment_offsets): Use stable_sort when sorting
946         segments.  Pass this to Compare_segments constructor.
947         * layout.h (class Layout): Make segment_precedes non-static.
948         (class Compare_segments): Change from struct to class.  Add
949         layout_ field.  Add constructor.
950         * script-sections.cc
951         (Script_sections::attach_sections_using_phdrs_clause): Rename
952         local orphan to is_orphan.  Don't report failure to put empty
953         section in segment.  On attachment failure, report name of
954         section, and attach to first PT_LOAD segment.
955
956 2011-06-28  Ian Lance Taylor  <iant@google.com>
957
958         PR gold/12934
959         * target-select.cc (Target_selector::Target_selector): Add
960         emulation parameter.  Change all callers.
961         (select_target_by_bfd_name): Rename from select_target_by_name.
962         Change all callers.
963         (select_target_by_emulation): New function.
964         (supported_emulation_names): New function.
965         * target-select.h (class Target_selector): Add emulation_ field.
966         Update declarations.
967         (Target_selector::recognize_by_bfd_name): Rename from
968         recognize_by_name.  Change all callers.
969         (Target_selector::supported_bfd_names): Rename from
970         supported_names.  Change all callers.
971         (Target_selector::recognize_by_emulation): New function.
972         (Target_selector::supported_emulations): New function.
973         (Target_selector::emulation): New function.
974         (Target_selector::do_recognize_by_bfd_name): Rename from
975         do_recognize_by_name.  Change all callers.
976         (Target_selector::do_supported_bfd_names): Rename from
977         do_supported_names.  Change all callers.
978         (Target_selector::do_recognize_by_emulation): New function.
979         (Target_selector::do_supported_emulations): New function.
980         (select_target_by_bfd_name): Change name in declaration.
981         (select_target_by_emulation): Declare.
982         (supported_emulation_names): Declare.
983         * parameters.cc (parameters_force_valid_target): Try to find
984         target based on emulation from -m option.
985         * options.h (class General_options): Change doc string for -m.
986         * options.cc (help): Print emulations.
987         (General_options::parse_V): Likewise.
988         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
989         Add emulation parameter.  Change all callers.
990
991 2011-06-28  Ian Lance Taylor  <iant@google.com>
992
993         * target.h (class Target): Add osabi_ field.
994         (Target::osabi): New function.
995         (Target::set_osabi): New function.
996         (Target::Target): Initialize osabi_.
997         (Target::do_adjust_elf_header): Make pure virtual.
998         (Sized_target::do_adjust_elf_header): Declare.
999         * target.cc (Sized_target::do_adjust_elf_header): New function.
1000         (class Sized_target): Instantiate all versions.
1001         * freebsd.h (class Target_freebsd): Remove.
1002         (Target_selector_freebsd::do_recognize): Call set_osabi on
1003         Target.
1004         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1005         (Target_selector_freebsd::set_osabi): Remove.
1006         * i386.cc (class Target_i386): Inherit from Sized_target rather
1007         than Target_freebsd.
1008         * x86_64.cc (class Target_x86_64): Likewise.
1009
1010 2011-06-28  Ian Lance Taylor  <iant@google.com>
1011
1012         * target.h (Target::can_check_for_function_pointers): Rewrite.
1013         Make non-virtual.
1014         (Target::can_icf_inline_merge_sections): Likewise.
1015         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1016         (Target::Target_info): Add can_icf_inline_merge_sections field.
1017         (Target::do_can_check_for_function_pointers): New virtual
1018         function.
1019         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1020         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1021         from can_check_for_function_pointers, move in file.
1022         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1023         section_may_have_icf_unsafe_poineters, move in file.
1024         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1025         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1026         Rename from can_check_for_function_pointers, move in file.
1027         (Target_i386::can_icf_inline_merge_sections): Remove.
1028         (Target_i386::i386_info): Initialize
1029         can_icf_inline_merge_sections.
1030         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1031         Initialize can_icf_inline_merge_sections.
1032         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1033         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1034         Rename from can_check_for_function_pointers, move in file.
1035         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1036         (Target_x86_64::x86_64_info): Initialize
1037         can_icf_inline_merge_sections.
1038         * testsuite/testfile.cc (Target_test::test_target_info):
1039         Likewise.
1040         * icf.cc (get_section_contents): Correct formatting.
1041
1042 2011-06-27  Ian Lance Taylor  <iant@google.com>
1043
1044         * symtab.cc (Symbol::versioned_name): New function.
1045         (Symbol_table::add_to_final_symtab): Use versioned_name when
1046         appropriate.
1047         (Symbol_table::sized_write_symbol): Likewise.
1048         * symtab.h (class Symbol): Declare versioned_name.
1049         * stringpool.h (class Stringpool_template): Add variant of add
1050         which takes a std::basic_string.
1051         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1052         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1053         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1054         (ver_test_12.o): New target.
1055         * testsuite/Makefile.in: Rebuild.
1056
1057 2011-06-27  Doug Kwan  <dougkwan@google.com>
1058
1059         * arm.cc (Arm_relocate_functions::thm_jump8,
1060         Arm_relocate_functions::thm_jump11): Use a wider signed
1061         type to compute offset.
1062         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1063         arm_thm_jump8.
1064         * testsuite/Makefile.in: Regenerate.
1065         * testsuite/arm_branch_in_range.sh: Check test results of
1066         arm_thm_jump11 and arm_thm_jump8.
1067         * testsuite/arm_thm_jump11.s: New test source file.
1068         * testsuite/arm_thm_jump11.t: New linker script.
1069         * testsuite/arm_thm_jump8.s: New test source file.
1070         * testsuite/arm_thm_jump8.t: New linker script.
1071
1072 2011-06-24  Ian Lance Taylor  <iant@google.com>
1073
1074         * layout.cc: Include "object.h".
1075         (ctors_sections_in_init_array): New static variable.
1076         (Layout::is_ctors_in_init_array): New function.
1077         (Layout::layout): Add entry to ctors_sections_in_init_array if
1078         appropriate.
1079         * layout.h (class Layout): Declare is_ctors_in_init_array.
1080         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1081         is_ctors_reverse_view is set.
1082         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1083         all callers.  Set is_ctors_reverse_view field of View_size.
1084         (Sized_relobj_file::reverse_words): New function.
1085         * object.h (Sized_relobj_file::View_size): Add
1086         is_ctors_reverse_view field.
1087         (class Sized_relobj_file): Update declarations.
1088         * testsuite/initpri3.c: New test.
1089         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1090         initpri3b.
1091         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1092         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1093         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1094         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1095         * testsuite/Makefile.in: Rebuild.
1096
1097 2011-06-24  Cary Coutant  <ccoutant@google.com>
1098
1099         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1100         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1101         (debug_msg_cdebug.err): New targets.
1102         * testsuite/Makefile.in: Regenerate.
1103         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1104         Fix checks for link with shared library.
1105
1106 2011-06-24  Doug Kwan  <dougkwan@google.com>
1107
1108         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1109         skip empty text sections.
1110         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1111
1112 2011-06-22  Ian Lance Taylor  <iant@google.com>
1113
1114         PR gold/12910
1115         * options.h (class General_options): Add --ctors-in-init-array.
1116         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1117         friends as SHT_PROGBITS for merging sections.
1118         (Layout::layout): Remove special handling of .init_array and
1119         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1120         and .dtors if ctors_in_init_array.
1121         (Layout::make_output_section): Force correct section types for
1122         .init_array and friends.  Don't sort if doing relocatable link,
1123         Don't sort .ctors and .dtors if ctors_in_init_array.
1124         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1125         (Layout::output_section_name): Add relobj parameter.  Change all
1126         callers.  Handle .ctors. and .dtors. in code rather than table.
1127         Handle .ctors and .dtors if ctors_in_init_array.
1128         (Layout::match_file_name): New function, moved from output.cc.
1129         * layout.h (class Layout): Update declarations.
1130         * output.cc: Include "layout.h".
1131         (Input_section_sort_entry::get_priority): New function.
1132         (Input_section_sort_entry::match_file_name): Just call
1133         Layout::match_file_name.
1134         (Output_section::Input_section_sort_init_fini_compare::operator()):
1135         Handle .ctors and .dtors.  Sort by explicit priority rather than
1136         by name.
1137         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1138         * testsuite/initpri2.c: New test.
1139         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1140         (check_PROGRAMS): Add initpri2.
1141         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1142         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1143         * configure, testsuite/Makefile.in: Rebuild.
1144
1145 2011-06-19  Ian Lance Taylor  <iant@google.com>
1146
1147         PR gold/12880
1148         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1149         .interp section to a PT_INTERP segment even if we have seen a
1150         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1151         clause in a linker script.
1152         (Layout::finalize): Don't create a .interp section if we've
1153         already create a PT_INTERP segment.
1154         (Layout::create_interp): Always call choose_output_section (revert
1155         patch of 2011-06-17).  Don't create PT_INTERP segment.
1156         * script-sections.cc
1157         (Script_sections::create_note_and_tls_segments): Add a .interp
1158         section to a PT_INTERP segment even if we have seen a
1159         --dynamic-linker option.
1160
1161 2011-06-18  Ian Lance Taylor  <iant@google.com>
1162
1163         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1164         merely because a non-PT_LOAD segment has a dynamic reloc.
1165
1166 2011-06-18  Ian Lance Taylor  <iant@google.com>
1167
1168         * layout.cc (Layout::finish_dynamic_section): Don't create
1169         DT_FLAGS entry if not needed.
1170
1171 2011-06-18  Ian Lance Taylor  <iant@google.com>
1172
1173         PR gold/12745
1174         * layout.cc (Layout::layout_eh_frame): Correct handling of
1175         writable .eh_frame section.
1176
1177 2011-06-17  Ian Lance Taylor  <iant@google.com>
1178
1179         PR gold/12893
1180         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1181         symbol is redefined with the exact same object and value.
1182
1183 2011-06-17  Ian Lance Taylor  <iant@google.com>
1184
1185         PR gold/12880
1186         * layout.h (class Layout): Add interp_segment_ field.
1187         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1188         (Layout::attach_allocated_section_to_segment): If making shared
1189         library, put .interp section in PT_INTERP segment.
1190         (Layout::finalize): Also call create_interp if -dynamic-linker
1191         option was used.
1192         (Layout::create_interp): Assert that there is no PT_INTERP
1193         segment.  If not using a SECTIONS clause, use make_output_section.
1194         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1195         * script-sections.cc
1196         (Script_sections::create_note_and_tls_segments): If making shared
1197         library, put .interp section in PT_INTERP segment.
1198
1199 2011-06-17  Ian Lance Taylor  <iant@google.com>
1200
1201         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1202         when making a shared library.
1203
1204 2011-06-17  Ian Lance Taylor  <iant@google.com>
1205
1206         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1207         parameter.  Change all callers.  Don't issue warning about PC32
1208         against locally defined symbol.
1209
1210 2011-06-16  Ian Lance Taylor  <iant@google.com>
1211
1212         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1213         occurs in same object.
1214
1215 2011-06-14  Alan Modra  <amodra@gmail.com>
1216
1217         * po/POTFILES.in: Regenerate.
1218
1219 2011-06-09  Ian Lance Taylor  <iant@google.com>
1220
1221         * script-sections.cc
1222         (Orphan_output_section::set_section_addresses): For a relocatable
1223         link set address to 0.
1224
1225 2011-06-09  Cary Coutant  <ccoutant@google.com>
1226
1227         PR gold/12804
1228         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1229         used with --compress-debug-sections.
1230         * gold/object.cc (Sized_relobj_file::do_layout): Report
1231         uncompressed size of compressed input sections.
1232
1233 2011-06-08  Cary Coutant  <ccoutant@google.com>
1234
1235         PR gold/12804
1236         * testsuite/two_file_test_2_v1.cc: Change initialization of
1237         v2 to keep it in .data.
1238
1239 2011-06-07  Cary Coutant  <ccoutant@google.com>
1240
1241         * common.cc (Symbol_table::do_allocate_commons_list): Call
1242         gold_fallback.
1243         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1244         (Errors::fallback): New function.
1245         (gold_fallback): New function.
1246         * errors.h (Errors::fallback): New function.
1247         * gold.cc (gold_exit): Change status parameter to enum; adjust
1248         all callers.
1249         (queue_initial_tasks): Call gold_fallback.
1250         * gold.h: Include cstdlib.
1251         (Exit_status): New enum type.
1252         (gold_exit): Change status parameter to enum.
1253         (gold_fallback): New function.
1254         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1255         (Layout::create_symtab_sections): Likewise.
1256         (Layout::create_shdrs): Likewise.
1257         * main.cc (main): Adjust call to gold_exit.
1258         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1259         (Output_data_got::add_got_entry_pair): Likewise.
1260         (Output_section::add_input_section): Likewise.
1261         (Output_section::add_output_section_data): Likewise.
1262         (Output_segment::set_section_list_addresses): Likewise.
1263         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1264
1265 2011-06-07  Cary Coutant  <ccoutant@google.com>
1266
1267         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1268         for incremental links.
1269         * output.cc (Output_segment::set_section_list_addresses): Remove
1270         FIXME and test for TLS or BSS.
1271
1272 2011-06-07  Cary Coutant  <ccoutant@google.com>
1273
1274         * testsuite/Makefile.am: Add incremental_copy_test,
1275         incremental_common_test_1.
1276         * testsuite/Makefile.in: Regenerate.
1277         * testsuite/common_test_1_v1.c: New source file.
1278         * testsuite/common_test_1_v2.c: New source file.
1279         * testsuite/copy_test_v1.cc: New source file.
1280
1281 2011-06-07  Cary Coutant  <ccoutant@google.com>
1282
1283         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1284         update, allocate common from bss section's free list.
1285         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1286         linker-defined symbols.
1287         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1288         Skip GOT and PLT entries that are no longer referenced.
1289         (Output_section_incremental_inputs::write_info_blocks): Mark
1290         linker-defined symbols.
1291         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1292         * output.cc (Output_section::allocate): New function.
1293         * output.h (Output_section::allocate): New function.
1294         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1295         linker-defined symbols.
1296         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1297         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1298         (Symbol::init_base_output_data): Likewise.
1299         (Symbol::init_base_output_segment): Likewise.
1300         (Symbol::init_base_constant): Likewise.
1301         (Sized_symbol::init_output_data): Likewise.
1302         (Sized_symbol::init_output_segment): Likewise.
1303         (Sized_symbol::init_constant): Likewise.
1304         (Symbol_table::do_define_in_output_data): Likewise.
1305         (Symbol_table::do_define_in_output_segment): Likewise.
1306         (Symbol_table::do_define_as_constant): Likewise.
1307         * symtab.h (Symbol::is_predefined): New function.
1308         (Symbol::init_base_output_data): Add is_predefined parameter.
1309         (Symbol::init_base_output_segment): Likewise.
1310         (Symbol::init_base_constant): Likewise.
1311         (Symbol::is_predefined_): New data member.
1312         (Sized_symbol::init_output_data): Add is_predefined parameter.
1313         (Sized_symbol::init_output_segment): Likewise.
1314         (Sized_symbol::init_constant): Likewise.
1315         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1316
1317 2011-06-07  Cary Coutant  <ccoutant@google.com>
1318
1319         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1320         instead of emit_copy_reloc.
1321         (Copy_relocs::emit_copy_reloc): Refactor.
1322         (Copy_relocs::make_copy_reloc): New function.
1323         (Copy_relocs::add_copy_reloc): Remove.
1324         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1325         section.
1326         (Copy_relocs::make_copy_reloc): New function.
1327         (Copy_relocs::add_copy_reloc): Remove.
1328         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1329         unchanged input files.
1330         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1331         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1332         Reserve BSS space for COPY relocations.
1333         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1334         (Output_section_incremental_inputs::write_info_blocks): Record
1335         whether a symbol is copied from a shared object.
1336         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1337         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1338         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1339         (Incremental_input_entry_reader::get_output_symbol_index): Add
1340         is_copy parameter.
1341         (Incremental_binary::emit_copy_relocs): New function.
1342         (Incremental_binary::do_emit_copy_relocs): New function.
1343         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1344         new data member.
1345         (Sized_incremental_binary::add_copy_reloc): New function.
1346         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1347         (Sized_incremental_binary::Copy_reloc): New struct.
1348         (Sized_incremental_binary::Copy_relocs): New typedef.
1349         (Sized_incremental_binary::copy_relocs_): New data member.
1350         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1351         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1352         * target.h (Sized_target::emit_copy_reloc): New function.
1353         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1354
1355 2011-06-02  Cary Coutant  <ccoutant@google.com>
1356
1357         PR gold/12163
1358         * gold/archive.cc (Archive::Archive): Initialize new data member.
1359         (Archive::include_all_members): Return if archive has already been
1360         included.
1361         * gold/archive.h (Archive::include_all_members_): New data member.
1362
1363 2011-06-02  Nick Clifton  <nickc@redhat.com>
1364
1365         * dynobj.h: Fix spelling mistake in comment.
1366         * output.cc: Likewise.
1367
1368 2011-05-31  Doug Kwan  <dougkwan@google.com>
1369             Asier Llano
1370
1371         PR gold/12826
1372         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1373         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1374         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1375         redundant arm_exidx_test.so.
1376         * testsuite/Makefile.in: Regenerate.
1377         (check_SCRIPTS): Add pr12826.sh
1378         (check_DATA): Add pr12826.stdout
1379         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1380         * testsuite/pr12826.sh: New file.
1381         * testsuite/pr12826_1.s: Ditto.
1382         * testsuite/pr12826_1.s: Ditto.
1383
1384 2011-05-30  Ian Lance Taylor  <iant@google.com>
1385
1386         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1387         sections.
1388
1389 2011-05-29  Ian Lance Taylor  <iant@google.com>
1390
1391         PR gold/12804
1392         * testsuite/Makefile.am: Use different file name for two_file_test
1393         temporary file for each incremental test.
1394         * testsuite/Makefile.in: Rebuild.
1395
1396 2011-05-29  Ian Lance Taylor  <iant@google.com>
1397
1398         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1399         binary input file is empty.
1400
1401 2011-05-27  Ian Lance Taylor  <iant@google.com>
1402
1403         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1404         (ver_test_9.so): Likewise.
1405         * testsuite/Makefile.in: Rebuild.
1406
1407 2011-05-26 Cary Coutant  <ccoutant@google.com>
1408
1409         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1410         * incremental.cc (Incremental_inputs::report_input_section): Fix
1411         comment, indentation.
1412         (Incremental_inputs::report_comdat_group): New function.
1413         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1414         of data for incremental input file entry.
1415         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1416         group count, COMDAT group signatures.
1417         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1418         an unchanged input file.
1419         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1420         Initialize new data member.
1421         (Incremental_object_entry::add_comdat_group): New function.
1422         (Incremental_object_entry::get_comdat_group_count): New function.
1423         (Incremental_object_entry::get_comdat_signature_key): New function.
1424         (Incremental_object_entry::groups_): New data member.
1425         (Incremental_inputs::report_comdat_group): New function.
1426         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1427         data for incremental input file entry.
1428         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1429         (Incremental_input_entry_reader::get_input_section): Adjust size of
1430         data for incremental input file entry.
1431         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1432         (Incremental_input_entry_reader::get_comdat_group_signature): New
1433         function.
1434         * object.cc (Sized_relobj::include_section_group): Report kept
1435         COMDAT groups for incremental links.
1436
1437 2011-05-24  David Meyer  <pdox@google.com>
1438
1439         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1440         with name parameter.  Add found_name parameter.
1441         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1442         * dirsearch.h (class Dirsearch): Update declaration.
1443
1444 2011-05-24  Ian Lance Taylor  <iant@google.com>
1445
1446         * archive.cc (Library_base::should_include_member): Pull in object
1447         from archive if it defines the entry symbol.
1448         * parameters.cc (Parameters::entry): New function.
1449         * parameters.h (class Parameters): Declare entry.
1450         * output.h (class Output_file_header): Remove entry_ field.
1451         * output.cc (Output_file_header::Output_file_header): Remove entry
1452         parameter.  Change all callers.
1453         (Output_file_header::entry): Use parameters->entry.
1454         * gold.cc (queue_middle_tasks): Likewise.
1455         * plugin.cc (Plugin_hook::run): Likewise.
1456
1457 2011-05-24 Cary Coutant  <ccoutant@google.com>
1458
1459         * gold.cc (queue_initial_tasks): Pass incremental base filename
1460         to Output_file::open_base_file; don't print error message.
1461         * incremental-dump.cc (main): Adjust call to
1462         Output_file::open_for_modification.
1463         * incremental-dump.cc (main): Likewise.
1464         * incremental.cc (Incremental_inputs::report_command_line):
1465         Ignore --incremental-base option when comparing command lines.
1466         Ignore parameter when given as separate argument.
1467         * options.h (class General_options): Add --incremental-base.
1468         * output.cc (Output_file::Output_file):
1469         (Output_file::open_base_file): Add base_name and writable parameters;
1470         read base file into new file; print error message here.
1471         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1472         callers.
1473         * output.h (Output_file::open_for_modification): Rename to...
1474         (Output_file::open_base_file): ...this; add base_name and
1475         writable parameters; adjust all callers.
1476         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1477         callers.
1478         * testsuite/Makefile.am (incremental_test_4): Test
1479         --incremental-base.
1480         * testsuite/Makefile.in: Regenerate.
1481
1482 2011-05-24 Cary Coutant  <ccoutant@google.com>
1483
1484         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1485         incremental_test_4.
1486         * testsuite/Makefile.in: Regenerate.
1487         * testsuite/two_file_test_1_v1.cc: New test source file.
1488         * testsuite/two_file_test_1b_v1.cc: New test source file.
1489         * testsuite/two_file_test_2_v1.cc: New test source file.
1490
1491 2011-05-24 Cary Coutant  <ccoutant@google.com>
1492
1493         * dynobj.h (Dynobj::do_dynobj): New function.
1494         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1495         flag and soname for shared objects.
1496         * incremental.cc (Incremental_inputs::report_object): Make
1497         either Incremental_object_entry or Incremental_dynobj_entry; add
1498         soname to string table.
1499         (Incremental_inputs::report_input_section): Add assertion.
1500         (Output_section_incremental_inputs::set_final_data_size): Adjust
1501         type of input file entry for shared libraries; adjust size of
1502         shared library info entry.
1503         (Output_section_incremental_inputs::write_input_files): Write
1504         as_needed flag for shared libraries.
1505         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1506         of input file entry for shared libraries; write soname.
1507         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1508         soname from incremental info.
1509         * incremental.h (enum Incremental_input_flags): Add
1510         INCREMENTAL_INPUT_AS_NEEDED.
1511         (Incremental_input_entry::Incremental_input_entry): Initialize new
1512         data member.
1513         (Incremental_input_entry::set_as_needed): New function.
1514         (Incremental_input_entry::as_needed): New function.
1515         (Incremental_input_entry::do_dynobj_entry): New function.
1516         (Incremental_input_entry::as_needed_): New data member.
1517         (Incremental_object_entry::Incremental_object_entry): Don't check
1518         for shared library.
1519         (Incremental_object_entry::do_type): Likewise.
1520         (class Incremental_dynobj_entry): New class.
1521         (Incremental_input_entry_reader::as_needed): New function.
1522         (Incremental_input_entry_reader::get_soname): New function.
1523         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1524         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1525         size of shared library info entry.
1526         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1527         incremental link when adding DT_NEEDED entries.
1528         * object.h (Object::Object): Initialize new data member.
1529         (Object::dynobj): New function.
1530         (Object::set_as_needed): New function.
1531         (Object::as_needed): New function.
1532         (Object::do_dynobj): New function.
1533         (Object::as_needed_): New data member.
1534
1535 2011-05-24 Cary Coutant  <ccoutant@google.com>
1536
1537         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1538         info; adjust display of GOT entries.
1539         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1540         vector of input objects; remove file_status_.
1541         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1542         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1543         got_plt reader; call target hooks to reserve GOT entries.
1544         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1545         of input file info header and GOT info entry.
1546         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1547         relocation info.
1548         (Got_plt_view_info::got_descriptor): Remove.
1549         (Got_plt_view_info::sym_index): New data member.
1550         (Got_plt_view_info::input_index): New data member.
1551         (Local_got_offset_visitor::visit): Write input file index.
1552         (Global_got_offset_visitor::visit): Write 0 for input file index.
1553         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1554         with sym_index and input_index.
1555         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1556         incremental info GOT entry; replace got_descriptor with input_index.
1557         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1558         map from input file index to object.
1559         (Sized_relobj_incr::do_layout): Replace direct data member reference
1560         with accessor function.
1561         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1562         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1563         Adjust size of input file info header.
1564         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1565         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1566         (Incremental_input_entry_reader::get_input_section): Adjust size of
1567         input file info header.
1568         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1569         of incremental info GOT entry.
1570         (Incremental_got_plt_reader::get_got_desc): Remove.
1571         (Incremental_got_plt_reader::get_got_symndx): New function.
1572         (Incremental_got_plt_reader::get_got_input_index): New function.
1573         (Sized_incremental_binary::Sized_incremental_binary): Remove
1574         file_status_; add input_objects_.
1575         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1576         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1577         (Sized_incremental_binary::file_is_unchanged): Remove.
1578         (Sized_incremental_binary::set_input_object): New function.
1579         (Sized_incremental_binary::input_object): New function.
1580         (Sized_incremental_binary::file_status_): Remove.
1581         (Sized_incremental_binary::input_objects_): New data member.
1582         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1583         references.
1584         (Sized_relobj_incr::invalid_address): Move to base class.
1585         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1586         class.
1587         (Sized_relobj_incr::do_output_section_offset): Likewise.
1588         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1589         (Sized_relobj_incr::section_offsets_): Likewise.
1590         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1591         function.
1592         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1593         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1594         with accessor function.
1595         (Sized_relobj_file::do_layout): Likewise.
1596         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1597         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1598         (Sized_relobj_file::compute_final_local_value): Replace refs to
1599         section_offsets_ with accessor function.
1600         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1601         * object.h (Relobj::Relobj): Initialize new data members.
1602         (Relobj::add_dyn_reloc): New function.
1603         (Relobj::first_dyn_reloc): New function.
1604         (Relobj::dyn_reloc_count): New function.
1605         (Relobj::first_dyn_reloc_): New data member.
1606         (Relobj::dyn_reloc_count_): New data member.
1607         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1608         references.
1609         (Sized_relobj::Address): New typedef.
1610         (Sized_relobj::invalid_address): Move here from child class.
1611         (Sized_relobj::Sized_relobj): Initialize new data members.
1612         (Sized_relobj::sized_relobj): New function.
1613         (Sized_relobj::is_output_section_offset_invalid): Move here from
1614         child class.
1615         (Sized_relobj::get_output_section_offset): Likewise.
1616         (Sized_relobj::local_has_got_offset): Likewise.
1617         (Sized_relobj::local_got_offset): Likewise.
1618         (Sized_relobj::set_local_got_offset): Likewise.
1619         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1620         (Sized_relobj::clear_got_offsets): New function.
1621         (Sized_relobj::section_offsets): Move here from child class.
1622         (Sized_relobj::do_output_section_offset): Likewise.
1623         (Sized_relobj::do_set_section_offset): Likewise.
1624         (Sized_relobj::Local_got_offsets): Likewise.
1625         (Sized_relobj::local_got_offsets_): Likewise.
1626         (Sized_relobj::section_offsets_): Likewise.
1627         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1628         references.
1629         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1630         class.
1631         (Sized_relobj_file::sized_relobj): New function
1632         (Sized_relobj_file::local_has_got_offset): Move to base class.
1633         (Sized_relobj_file::local_got_offset): Likewise.
1634         (Sized_relobj_file::set_local_got_offset): Likewise.
1635         (Sized_relobj_file::get_output_section_offset): Likewise.
1636         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1637         (Sized_relobj_file::do_output_section_offset): Likewise.
1638         (Sized_relobj_file::do_set_section_offset): Likewise.
1639         (Sized_relobj_file::Local_got_offsets): Likewise.
1640         (Sized_relobj_file::local_got_offsets_): Likewise.
1641         (Sized_relobj_file::section_offsets_): Likewise.
1642         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1643         (all constructors).
1644         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1645         (Output_reloc::get_symbol_index): Likewise.
1646         (Output_reloc::local_section_offset): Likewise.
1647         (Output_reloc::get_address): Likewise.
1648         (Output_reloc::symbol_value): Likewise.
1649         (Output_data_got::reserve_slot): Move to class definition.
1650         (Output_data_got::reserve_local): New function.
1651         (Output_data_got::reserve_slot_for_global): Remove.
1652         (Output_data_got::reserve_global): New function.
1653         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1654         (all constructors, two instantiations).
1655         (Output_reloc::get_relobj): New function (two instantiations).
1656         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1657         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1658         (Output_data_reloc::add_global): Adjust type of relobj.
1659         (Output_data_reloc::add_global_relative): Likewise.
1660         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1661         (Output_data_reloc::add_local): Likewise.
1662         (Output_data_reloc::add_local_relative): Likewise.
1663         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1664         (Output_data_reloc::add_local_section): Likewise.
1665         (Output_data_reloc::add_output_section): Likewise.
1666         (Output_data_reloc::add_absolute): Likewise.
1667         (Output_data_reloc::add_target_specific): Likewise.
1668         (Output_data_got::reserve_slot): Move definition here.
1669         (Output_data_got::reserve_local): New function.
1670         (Output_data_got::reserve_global): New function.
1671         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1672         section_offsets_ with accessor function.
1673         (Sized_relobj_file::write_sections): Likewise.
1674         (Sized_relobj_file::do_relocate_sections): Likewise.
1675         * target.h (Sized_target::reserve_local_got_entry): New function.
1676         (Sized_target::reserve_global_got_entry): New function.
1677         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1678         (Target_x86_64::reserve_global_got_entry): New function.
1679         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1680
1681 2011-05-23 Cary Coutant  <ccoutant@google.com>
1682
1683         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1684         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1685         bit when checking got_type.
1686         * incremental.cc (Sized_incremental_binary::setup_readers):
1687         Store symbol table and string table locations; initialize bit vector
1688         of file status flags.
1689         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1690         unchanged files.
1691         (Sized_incremental_binary::do_process_got_plt): New function.
1692         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1693         (Output_section_incremental_inputs::set_final_data_size): Record
1694         file index for each input file.
1695         (Output_section_incremental_inputs::write_got_plt): Store file index
1696         instead of input entry offset for each GOT entry.
1697         * incremental.h
1698         (Incremental_input_entry::Incremental_input_entry): Initialize new
1699         data member.
1700         (Incremental_input_entry::set_offset): Store file index.
1701         (Incremental_input_entry::get_file_index): New function.
1702         (Incremental_input_entry::file_index_): New data member.
1703         (Incremental_binary::process_got_plt): New function.
1704         (Incremental_binary::do_process_got_plt): New function.
1705         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1706         data members.
1707         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1708         (Sized_incremental_binary::set_file_is_unchanged): New function.
1709         (Sized_incremental_binary::file_is_unchanged): New function.
1710         (Sized_incremental_binary::do_process_got_plt): New function.
1711         (Sized_incremental_binary::file_status_): New data member.
1712         (Sized_incremental_binary::main_symtab_loc_): New data member.
1713         (Sized_incremental_binary::main_strtab_loc_): New data member.
1714         * output.cc (Output_data_got::Got_entry::write): Add case
1715         RESERVED_CODE.
1716         (Output_data_got::add_global): Call add_got_entry.
1717         (Output_data_got::add_global_plt): Likewise.
1718         (Output_data_got::add_global_with_rel): Likewise.
1719         (Output_data_got::add_global_with_rela): Likewise.
1720         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1721         (Output_data_got::add_global_pair_with_rela): Likewise.
1722         (Output_data_got::add_local): Call add_got_entry.
1723         (Output_data_got::add_local_plt): Likewise.
1724         (Output_data_got::add_local_with_rel): Likewise.
1725         (Output_data_got::add_local_with_rela): Likewise.
1726         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1727         (Output_data_got::add_local_pair_with_rela): Likewise.
1728         (Output_data_got::reserve_slot): New function.
1729         (Output_data_got::reserve_slot_for_global): New function.
1730         (Output_data_got::add_got_entry): New function.
1731         (Output_data_got::add_got_entry_pair): New function.
1732         (Output_section::add_output_section_data): Edit FIXME.
1733         * output.h
1734         (Output_section_data_build::Output_section_data_build): New
1735         constructor with size parameter.
1736         (Output_data_space::Output_data_space): Likewise.
1737         (Output_data_got::Output_data_got): Initialize new data member; new
1738         constructor with size parameter.
1739         (Output_data_got::add_constant): Call add_got_entry.
1740         (Output_data_got::reserve_slot): New function.
1741         (Output_data_got::reserve_slot_for_global): New function.
1742         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1743         (Output_data_got::add_got_entry): New function.
1744         (Output_data_got::add_got_entry_pair): New function.
1745         (Output_data_got::free_list_): New data member.
1746         * target.h (Sized_target::init_got_plt_for_update): New function.
1747         (Sized_target::register_global_plt_entry): New function.
1748         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1749         Initialize new data member; call init; add constructor with PLT count.
1750         (Output_data_plt_x86_64::init): New function.
1751         (Output_data_plt_x86_64::add_relocation): New function.
1752         (Output_data_plt_x86_64::reserve_slot): New function.
1753         (Output_data_plt_x86_64::free_list_): New data member.
1754         (Target_x86_64::init_got_plt_for_update): New function.
1755         (Target_x86_64::register_global_plt_entry): New function.
1756         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1757         incremental updates.
1758         (Output_data_plt_x86_64::add_relocation): New function.
1759         * testsuite/object_unittest.cc (Object_test): Set default options.
1760
1761 2011-05-16  Ian Lance Taylor  <iant@google.com>
1762
1763         * options.h (class General_options): Make -i a synonym for -r.
1764
1765 2011-05-16  Ian Lance Taylor  <iant@google.com>
1766
1767         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1768
1769 2011-05-10 Cary Coutant  <ccoutant@google.com>
1770
1771         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1772         strip_all (-s).
1773
1774 2011-05-06  Ian Lance Taylor  <iant@google.com>
1775
1776         * layout.cc (Layout::layout): If the output section flags change,
1777         update the ordering.
1778
1779 2011-04-25 Cary Coutant  <ccoutant@google.com>
1780
1781         * incremental-dump.cc (dump_incremental_inputs): Print local
1782         symbol info for each input file.
1783         * incremental.cc
1784         (Output_section_incremental_inputs::set_final_data_size): Add local
1785         symbol info to input file entries in incremental info.
1786         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1787         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1788         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1789         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1790         implementation.
1791         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1792         (Sized_incr_relobj::do_relocate): Write the local symbols.
1793         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1794         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1795         Adjust size of input file header.
1796         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1797         (Incremental_inputs_reader::get_local_symbol_count): New function.
1798         (Incremental_inputs_reader::get_input_section): Adjust size of input
1799         file header.
1800         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1801         (Sized_incr_relobj::This): New typedef.
1802         (Sized_incr_relobj::sym_size): New const data member.
1803         (Sized_incr_relobj::Local_symbol): New struct.
1804         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1805         (Sized_incr_relobj::do_local_symbol_offset): New function.
1806         (Sized_incr_relobj::local_symbol_count_): New data member.
1807         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1808         (Sized_incr_relobj::local_symbol_index_): New data member.
1809         (Sized_incr_relobj::local_symbol_offset_): New data member.
1810         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1811         (Sized_incr_relobj::local_symbols_): New data member.
1812         * object.h (Relobj::output_local_symbol_count): New function.
1813         (Relobj::local_symbol_offset): New function.
1814         (Relobj::do_output_local_symbol_count): New function.
1815         (Relobj::do_local_symbol_offset): New function.
1816         (Sized_relobj::do_output_local_symbol_count): New function.
1817         (Sized_relobj::do_local_symbol_offset): New function.
1818
1819 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1820
1821         * descriptors.cc (set_close_on_exec): New function.
1822         (Descriptors::open): Use set_close_on_exec.
1823         * output.cc (S_ISLNK): Define if not defined.
1824
1825 2011-04-22 Cary Coutant  <ccoutant@google.com>
1826
1827         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1828         global symbol map.
1829         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1830         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1831         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1832         relocations.
1833         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1834         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1835         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1836         * incremental.h
1837         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1838         function.
1839         (Incremental_binary::apply_incremental_relocs): New function.
1840         (Incremental_binary::do_apply_incremental_relocs): New function.
1841         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1842         data member.
1843         (Sized_incremental_binary::add_global_symbol): New function.
1844         (Sized_incremental_binary::global_symbol): New function.
1845         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1846         (Sized_incremental_binary::symbol_map_): New data member.
1847         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1848         * target.h (Sized_target::apply_relocation): New function.
1849         * target-reloc.h (apply_relocation): New function.
1850         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1851
1852 2011-04-22  Doug Kwan  <dougkwan@google.com>
1853
1854         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1855         flag of a SHT_ARM_EXIDX section.
1856         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1857         * testsuite/Makefile.in: Regenerate.
1858         * testsuite/arm_exidx_test.s: New file.
1859         * testsuite/arm_exidx_test.sh: Same.
1860
1861 2011-04-20 Cary Coutant  <ccoutant@google.com>
1862
1863         PR gold/12689
1864         * archive.h (Incremental_archive_entry::Archive_member):
1865         Initialize arg_serial_ (second constructor).
1866
1867 2011-04-17  Ian Lance Taylor  <iant@google.com>
1868
1869         * object.cc (Relocate_info::location): Simplify location string.
1870         * errors.cc (Errors::error_at_location): Don't print program
1871         name.
1872         (Errors::warning_at_location): Likewise.
1873         (Errors::undefined_symbol): Likewise.
1874         * testsuite/debug_msg.sh: Update accordingly.
1875
1876 2011-04-14 Cary Coutant  <ccoutant@google.com>
1877
1878         * gold/layout.cc (Layout::symtab_section_offset): New function.
1879         * gold/layout.h (Layout::symtab_section_offset): New function.
1880         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1881
1882 2011-04-12  Ian Lance Taylor  <iant@google.com>
1883
1884         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1885         with MREMAP_MAYMOVE.
1886         * output.h (class Output_file): Add map_is_allocated_ field.
1887         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1888         not available, provide stubs.  If mremap is not available, #define
1889         it to gold_mremap.
1890         (MREMAP_MAYMOVE): Define if not defined.
1891         (Output_file::Output_file): Initialize map_is_allocated_.
1892         (Output_file::resize): Check map_is_allocated_.
1893         (Output_file::map_anonymous): If mmap fails, use malloc.
1894         (Output_file::unmap): Don't do anything for an anonymous map.
1895         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1896         is not available, provide stubs.
1897         (File_read::View::~View): Use free rather than delete[].
1898         (File_read::make_view): Use malloc rather than new[].  If mmap
1899         fails, use malloc.
1900         (File_read::find_or_make_view): Use malloc rather than new[].
1901         * gold.h: Remove HAVE_REMAP code.
1902         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1903         exists.  Rename mremap to gold_mremap.  If mmap is not available
1904         don't do anything.
1905         * configure, config.in: Rebuild.
1906
1907 2011-04-11  Ian Lance Taylor  <iant@google.com>
1908
1909         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1910         initialize local variable v.
1911
1912 2011-04-11  Cary Coutant  <ccoutant@google.com>
1913
1914         * archive.cc (Archive::include_member): Adjust call to
1915         report_object.
1916         (Add_archive_symbols::run): Track argument serial numbers.
1917         (Lib_group::include_member): Likewise.
1918         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1919         * archive.h (Incremental_archive_entry::Archive_member):
1920         Initialize arg_serial_.
1921         (Archive_member::arg_serial_): New data member.
1922         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1923         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1924         incremental link.
1925         (Sized_dynobj::do_for_all_local_got_entries): New function.
1926         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1927         function.
1928         * fileread.cc (get_mtime): New function.
1929         * fileread.h (get_mtime): New function.
1930         * gold.cc (queue_initial_tasks): Check for incremental update.
1931         (process_incremental_input): New function.
1932         (queue_middle_tasks): Don't force valid target for incremental
1933         update.
1934         * incremental-dump.cc (find_input_containing_global): Adjust
1935         size of symbol info entry.
1936         (dump_incremental_inputs): Dump argument serial number and
1937         in_system_directory flag; bias shndx by 1; print symbol names
1938         when dumping per-file symbol lists; use new symbol info readers.
1939         * incremental.cc
1940         (Output_section_incremental_inputs:update_data_size): New function.
1941         (Sized_incremental_binary::setup_readers): Setup input readers
1942         for each input file; build maps for files added from libraries
1943         and scripts.
1944         (Sized_incremental_binary::check_input_args): New function.
1945         (Sized_incremental_binary::do_check_inputs): Build map of argument
1946         serial numbers to input arguments.
1947         (Sized_incremental_binary::do_file_has_changed): Rename
1948         do_file_is_unchanged to this; compare file modification times.
1949         (Sized_incremental_binary::do_init_layout): New function.
1950         (Sized_incremental_binary::do_reserve_layout): New function.
1951         (Sized_incremental_binary::do_get_input_reader): Remove.
1952         (Sized_incremental_binary::get_symtab_view): New function.
1953         (Incremental_checker::can_incrementally_link_output_file): Remove.
1954         (Incremental_inputs::report_command_line): Exclude --debug options.
1955         (Incremental_inputs::report_archive_begin): Add parameter; track
1956         argument serial numbers; don't put input file entry for archive
1957         before archive members.
1958         (Incremental_inputs::report_archive_end): Put input file entry
1959         for archive after archive members.
1960         (Incremental_inputs::report_object): Add parameter; track argument
1961         serial numbers and in_system_directory flag.
1962         (Incremental_inputs::report_script): Add parameter; track argument
1963         serial numbers.
1964         (Output_section_incremental_inputs::set_final_data_size): Adjust
1965         size of symbol info entry; check for forwarding symbols.
1966         (Output_section_incremental_inputs::write_input_files): Write
1967         in_system_directory flag and argument serial number.
1968         (Output_section_incremental_inputs::write_info_blocks): Map section
1969         indices between incremental info and original input file; store
1970         input section index for each symbol.
1971         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1972         change operator() to visit().
1973         (class Global_got_offset_visitor): Likewise.
1974         (class Global_symbol_visitor_got_plt):
1975         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1976         classes.
1977         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1978         (Sized_incr_relobj::do_read_symbols): New function.
1979         (Sized_incr_relobj::do_layout): New function.
1980         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1981         (Sized_incr_relobj::do_add_symbols): New function.
1982         (Sized_incr_relobj::do_should_include_member): New function.
1983         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1984         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1985         (Sized_incr_relobj::do_section_size): New function.
1986         (Sized_incr_relobj::do_section_name): New function.
1987         (Sized_incr_relobj::do_section_contents): New function.
1988         (Sized_incr_relobj::do_section_flags): New function.
1989         (Sized_incr_relobj::do_section_entsize): New function.
1990         (Sized_incr_relobj::do_section_address): New function.
1991         (Sized_incr_relobj::do_section_type): New function.
1992         (Sized_incr_relobj::do_section_link): New function.
1993         (Sized_incr_relobj::do_section_info): New function.
1994         (Sized_incr_relobj::do_section_addralign): New function.
1995         (Sized_incr_relobj::do_initialize_xindex): New function.
1996         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1997         (Sized_incr_relobj::do_read_relocs): New function.
1998         (Sized_incr_relobj::do_gc_process_relocs): New function.
1999         (Sized_incr_relobj::do_scan_relocs): New function.
2000         (Sized_incr_relobj::do_count_local_symbols): New function.
2001         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2002         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2003         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2004         (Sized_incr_relobj::do_relocate): New function.
2005         (Sized_incr_relobj::do_set_section_offset): New function.
2006         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2007         (Sized_incr_dynobj::do_read_symbols): New function.
2008         (Sized_incr_dynobj::do_layout): New function.
2009         (Sized_incr_dynobj::do_add_symbols): New function.
2010         (Sized_incr_dynobj::do_should_include_member): New function.
2011         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2012         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2013         (Sized_incr_dynobj::do_section_size): New function.
2014         (Sized_incr_dynobj::do_section_name): New function.
2015         (Sized_incr_dynobj::do_section_contents): New function.
2016         (Sized_incr_dynobj::do_section_flags): New function.
2017         (Sized_incr_dynobj::do_section_entsize): New function.
2018         (Sized_incr_dynobj::do_section_address): New function.
2019         (Sized_incr_dynobj::do_section_type): New function.
2020         (Sized_incr_dynobj::do_section_link): New function.
2021         (Sized_incr_dynobj::do_section_info): New function.
2022         (Sized_incr_dynobj::do_section_addralign): New function.
2023         (Sized_incr_dynobj::do_initialize_xindex): New function.
2024         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2025         (make_sized_incremental_object): New function.
2026         (Incremental_library::copy_unused_symbols): New function.
2027         (Incremental_library::do_for_all_unused_symbols): New function.
2028         * incremental.h (enum Incremental_input_flags): New type.
2029         (class Incremental_checker): Remove.
2030         (Incremental_input_entry::Incremental_input_entry): Add argument
2031         serial number.
2032         (Incremental_input_entry::arg_serial): New function.
2033         (Incremental_input_entry::set_is_in_system_directory): New function.
2034         (Incremental_input_entry::is_in_system_directory): New function.
2035         (Incremental_input_entry::arg_serial_): New data member.
2036         (Incremental_input_entry::is_in_system_directory_): New data member.
2037         (class Script_info): Move here from script.h.
2038         (Script_info::Script_info): Add filename parameter.
2039         (Script_info::filename): New function.
2040         (Script_info::filename_): New data member.
2041         (Incremental_script_entry::Incremental_script_entry): Add argument
2042         serial number.
2043         (Incremental_object_entry::Incremental_object_entry): Likewise.
2044         (Incremental_object_entry::add_input_section): Build list of input
2045         sections with map to original shndx.
2046         (Incremental_object_entry::get_input_section_index): New function.
2047         (Incremental_object_entry::shndx_): New data member.
2048         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2049         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2050         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2051         serial number.
2052         (Incremental_inputs::report_archive_begin): Likewise.
2053         (Incremental_inputs::report_object): Likewise.
2054         (Incremental_inputs::report_script): Likewise.
2055         (class Incremental_global_symbol_reader): New class.
2056         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2057         and store flags and input file type.
2058         (Incremental_input_entry_reader::arg_serial): New function.
2059         (Incremental_input_entry_reader::type): Extract type from flags.
2060         (Incremental_input_entry_reader::is_in_system_directory): New function.
2061         (Incremental_input_entry_reader::get_input_section_count): Call
2062         accessor function for type.
2063         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2064         function for type; adjust size of global symbol entry.
2065         (Incremental_input_entry_reader::get_global_symbol_count): Call
2066         accessor function for type.
2067         (Incremental_input_entry_reader::get_object_count): Likewise.
2068         (Incremental_input_entry_reader::get_object_offset): Likewise.
2069         (Incremental_input_entry_reader::get_member_count): Likewise.
2070         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2071         (Incremental_input_entry_reader::get_member_offset): Likewise.
2072         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2073         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2074         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2075         (Incremental_input_entry_reader::get_global_symbol_reader): New
2076         function.
2077         (Incremental_input_entry_reader::get_output_symbol_index): New
2078         function.
2079         (Incremental_input_entry_reader::type_): Remove.
2080         (Incremental_input_entry_reader::flags_): New data member.
2081         (Incremental_inputs_reader::input_file_offset): New function.
2082         (Incremental_inputs_reader::input_file_index): New function.
2083         (Incremental_inputs_reader::input_file): Call input_file_offset.
2084         (Incremental_inputs_reader::input_file_at_offset): New function.
2085         (Incremental_relocs_reader::get_r_type): Reformat.
2086         (Incremental_relocs_reader::get_r_shndx): Reformat.
2087         (Incremental_relocs_reader::get_r_offset): Reformat.
2088         (Incremental_relocs_reader::data): New function.
2089         (Incremental_binary::Incremental_binary): Initialize new data members.
2090         (Incremental_binary::check_inputs): Add cmdline parameter.
2091         (Incremental_binary::file_is_unchanged): Remove.
2092         (Input_reader::arg_serial): New function.
2093         (Input_reader::get_unused_symbol_count): New function.
2094         (Input_reader::get_unused_symbol): New function.
2095         (Input_reader::do_arg_serial): New function.
2096         (Input_reader::do_get_unused_symbol_count): New function.
2097         (Input_reader::do_get_unused_symbol): New function.
2098         (Incremental_binary::input_file_count): New function.
2099         (Incremental_binary::get_input_reader): Change signature to use
2100         index instead of filename.
2101         (Incremental_binary::file_has_changed): New function.
2102         (Incremental_binary::get_input_argument): New function.
2103         (Incremental_binary::get_library): New function.
2104         (Incremental_binary::get_script_info): New function.
2105         (Incremental_binary::init_layout): New function.
2106         (Incremental_binary::reserve_layout): New function.
2107         (Incremental_binary::output_file): New function.
2108         (Incremental_binary::do_check_inputs): New function.
2109         (Incremental_binary::do_file_is_unchanged): Remove.
2110         (Incremental_binary::do_file_has_changed): New function.
2111         (Incremental_binary::do_init_layout): New function.
2112         (Incremental_binary::do_reserve_layout): New function.
2113         (Incremental_binary::do_input_file_count): New function.
2114         (Incremental_binary::do_get_input_reader): Change signature.
2115         (Incremental_binary::input_args_map_): New data member.
2116         (Incremental_binary::library_map_): New data member.
2117         (Incremental_binary::script_map_): New data member.
2118         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2119         new data members.
2120         (Sized_incremental_binary::output_section): New function.
2121         (Sized_incremental_binary::inputs_reader): Add const.
2122         (Sized_incremental_binary::symtab_reader): Add const.
2123         (Sized_incremental_binary::relocs_reader): Add const.
2124         (Sized_incremental_binary::got_plt_reader): Add const.
2125         (Sized_incremental_binary::get_symtab_view): New function.
2126         (Sized_incremental_binary::Inputs_reader): New typedef.
2127         (Sized_incremental_binary::Input_entry_reader): New typedef.
2128         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2129         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2130         (Sized_incremental_binary::do_file_has_changed): New function.
2131         (Sized_incremental_binary::do_init_layout): New function.
2132         (Sized_incremental_binary::do_reserve_layout): New function.
2133         (Sized_input_reader::Inputs_reader): Remove.
2134         (Sized_input_reader::Input_entry_reader): Remove.
2135         (Sized_input_reader::do_arg_serial): New function.
2136         (Sized_input_reader::do_get_unused_symbol_count): New function.
2137         (Sized_input_reader::do_get_unused_symbol): New function.
2138         (Sized_incremental_binary::do_input_file_count): New function.
2139         (Sized_incremental_binary::do_get_input_reader): Change signature;
2140         use index instead of filename.
2141         (Sized_incremental_binary::section_map_): New data member.
2142         (Sized_incremental_binary::input_entry_readers_): New data member.
2143         (class Sized_incr_relobj): New class.
2144         (class Sized_incr_dynobj): New class.
2145         (make_sized_incremental_object): New function.
2146         (class Incremental_library): New class.
2147         * layout.cc (Free_list::num_lists): New static data member.
2148         (Free_list::num_nodes): New static data member.
2149         (Free_list::num_removes): New static data member.
2150         (Free_list::num_remove_visits): New static data member.
2151         (Free_list::num_allocates): New static data member.
2152         (Free_list::num_allocate_visits): New static data member.
2153         (Free_list::init): New function.
2154         (Free_list::remove): New function.
2155         (Free_list::allocate): New function.
2156         (Free_list::dump): New function.
2157         (Free_list::print_stats): New function.
2158         (Layout_task_runner::run): Resize output file for incremental updates.
2159         (Layout::Layout): Initialize new data members.
2160         (Layout::set_incremental_base): New function.
2161         (Layout::init_fixed_output_section): New function.
2162         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2163         incremental updates.
2164         (Layout::create_gold_note): Do not create gold note section for
2165         incremental updates.
2166         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2167         for incremental updates.
2168         (Layout::set_section_offsets): For incremental updates, allocate space
2169         from free list.
2170         (Layout::create_symtab_sections): Layout with offsets relative to
2171         start of section; for incremental updates, allocate space from free
2172         list.
2173         (Layout::create_shdrs): For incremental updates, allocate space from
2174         free list.
2175         (Layout::finish_dynamic_section): For incremental updates, do not
2176         check --as-needed (fixed in subsequent patch).
2177         * layout.h (class Free_list): New class.
2178         (Layout::set_incremental_base): New function.
2179         (Layout::incremental_base): New function.
2180         (Layout::init_fixed_output_section): New function.
2181         (Layout::allocate): New function.
2182         (Layout::incremental_base_): New data member.
2183         (Layout::free_list_): New data member.
2184         * main.cc (main): Print Free_list statistics.
2185         * object.cc (Relobj::finalize_incremental_relocs): Add
2186         clear_counts parameter; clear counts only when clear_counts is set.
2187         (Sized_relobj::Sized_relobj): Initialize new base class.
2188         (Sized_relobj::do_layout): Don't report special sections.
2189         (Sized_relobj::do_for_all_local_got_entries): New function.
2190         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2191         symtab_off to all symbol table offsets.
2192         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2193         * object.h (class Got_offset_list): Move to top of file.
2194         (Object::Object): Allow case where input_file == NULL.
2195         (Object::~Object): Likewise.
2196         (Object::input_file): Assert that input_file != NULL.
2197         (Object::lock): Allow case where input_file == NULL.
2198         (Object::unlock): Likewise.
2199         (Object::is_locked): Likewise.
2200         (Object::token): Likewise.
2201         (Object::release): Likewise.
2202         (Object::is_incremental): New function.
2203         (Object::get_mtime): New function.
2204         (Object::for_all_local_got_entries): New function.
2205         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2206         (Object::set_is_in_system_directory): New function.
2207         (Object::is_in_system_directory): New function.
2208         (Object::do_is_incremental): New function.
2209         (Object::do_get_mtime): New function.
2210         (Object::do_for_all_local_got_entries): New function.
2211         (Object::is_in_system_directory_): New data member.
2212         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2213         (class Sized_relobj_base): New class.
2214         (class Sized_relobj): Derive from Sized_relobj_base.
2215         (class Sized_relobj::Symbols): Redeclare from base class.
2216         (class Sized_relobj::local_got_offset_list): Remove.
2217         (class Sized_relobj::Output_sections): Redeclare from base class.
2218         (class Sized_relobj::do_for_all_local_got_entries): New function.
2219         (class Sized_relobj::write_local_symbols): Add offset parameter.
2220         (class Sized_relobj::local_symbol_offset_): Update comment.
2221         (class Sized_relobj::local_dynsym_offset_): Update comment.
2222         * options.cc (Input_arguments::add_file): Remove const.
2223         * options.h (Input_file_argument::Input_file_argument):
2224         Initialize arg_serial_ (all constructors).
2225         (Input_file_argument::set_arg_serial): New function.
2226         (Input_file_argument::arg_serial): New function.
2227         (Input_file_argument::arg_serial_): New data member.
2228         (Input_arguments::Input_arguments): Initialize file_count_.
2229         (Input_arguments::add_file): Remove const.
2230         (Input_arguments::number_of_input_files): New function.
2231         (Input_arguments::file_count_): New data member.
2232         (Command_line::number_of_input_files): Call
2233         Input_arguments::number_of_input_files.
2234         * output.cc (Output_segment_headers::Output_segment_headers):
2235         Set current size.
2236         (Output_section::Input_section::current_data_size): New function.
2237         (Output_section::Output_section): Initialize new data members.
2238         (Output_section::add_input_section): Don't do merge sections for
2239         an incremental link; allocate space from free list for an
2240         incremental update.
2241         (Output_section::add_output_section_data): Allocate space from
2242         free list for an incremental update.
2243         (Output_section::update_data_size): New function.
2244         (Output_section::set_fixed_layout): New function.
2245         (Output_section::reserve): New function.
2246         (Output_segment::set_section_addresses): Remove const.
2247         (Output_segment::set_section_list_addresses): Remove const; allocate
2248         space from free list for an incremental update.
2249         (Output_segment::set_offset): Adjust size of RELRO segment for an
2250         incremental update.
2251         * output.h (Output_data::current_data_size): Move here from
2252         child classes.
2253         (Output_data::pre_finalize_data_size): New function.
2254         (Output_data::update_data_size): New function.
2255         (Output_section_headers::update_data_size): new function.
2256         (Output_section_data_build::current_data_size): Move to Output_data.
2257         (Output_data_strtab::update_data_size): New function.
2258         (Output_section::current_data_size): Move to Output_data.
2259         (Output_section::set_fixed_layout): New function.
2260         (Output_section::has_fixed_layout): New function.
2261         (Output_section::reserve): New function.
2262         (Output_section::update_data_size): New function.
2263         (Output_section::has_fixed_layout_): New data member.
2264         (Output_section::free_list_): New data member.
2265         (Output_segment::set_section_addresses): Remove const.
2266         (Output_segment::set_section_list_addresses): Remove const.
2267         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2268         New function.
2269         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2270         New function.
2271         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2272         parameter when calling Add_symbols constructor; store argument
2273         serial number for members of a lib group.
2274         (Add_symbols::locks): Allow case where token == NULL.
2275         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2276         (Read_member::~Read_member): New function.
2277         (Read_member::is_runnable): New function.
2278         (Read_member::locks): New function.
2279         (Read_member::run): New function.
2280         (Check_script::~Check_script): New function.
2281         (Check_script::is_runnable): New function.
2282         (Check_script::locks): New function.
2283         (Check_script::run): New function.
2284         (Check_library::~Check_library): New function.
2285         (Check_library::is_runnable): New function.
2286         (Check_library::locks): New function.
2287         (Check_library::run): New function.
2288         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2289         (Add_symbols::library_): New data member.
2290         (class Read_member): New class.
2291         (class Check_script): New class.
2292         (class Check_library): New class.
2293         * reloc.cc (Read_relocs::is_runnable): Allow case where
2294         token == NULL.
2295         (Read_relocs::locks): Likewise.
2296         (Scan_relocs::locks): Likewise.
2297         (Relocate_task::locks): Likewise.
2298         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2299         to clear counters.
2300         (Sized_relobj::incremental_relocs_scan): Fix comment.
2301         (Sized_relobj::do_relocate): Pass output file offset to
2302         write_local_symbols.
2303         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2304         from class declaration.
2305         * script.cc (read_input_script): Allocate Script_info; pass
2306         argument serial number to report_script.
2307         * script.h (class Script_info): Move to incremental.h.
2308         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2309         * symtab.h (Symbol_table::add_from_incrobj): New function.
2310         (Symbol_table::set_file_offset): New function.
2311
2312 2011-04-05  Cary Coutant  <ccoutant@google.com>
2313
2314         * incremental-dump.cc (dump_incremental_inputs): Change signature
2315         to take a Sized_incremental_binary; change caller.  Use readers
2316         in Sized_incremental_binary.
2317         * incremental.cc
2318         (Sized_incremental_binary::find_incremental_inputs_sections):
2319         Rename do_find_incremental_inputs_sections to this.
2320         (Sized_incremental_binary::setup_readers): New function.
2321         (Sized_incremental_binary::do_check_inputs): Check
2322         has_incremental_info_ flag; move setup code to setup_readers;
2323         use input readers.
2324         (Sized_incremental_binary::do_file_is_unchanged): New function.
2325         (Sized_incremental_binary::do_get_input_reader): New function.
2326         * incremental.h (class Incremental_binary): Move to end of file.
2327         (Incremental_binary::file_is_unchanged): New function.
2328         (Incremental_binary::do_file_is_unchanged): New function.
2329         (Incremental_binary::Input_reader): New class.
2330         (Incremental_binary::get_input_reader): New function.
2331         (class Sized_incremental_binary): Move to end of file.
2332         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2333         input section reader classes.
2334         (Sized_incremental_binary::has_incremental_info): New function.
2335         (Sized_incremental_binary::inputs_reader): New function.
2336         (Sized_incremental_binary::symtab_reader): New function.
2337         (Sized_incremental_binary::relocs_reader): New function.
2338         (Sized_incremental_binary::got_plt_reader): New function.
2339         (Sized_incremental_binary::do_file_is_unchanged): New function.
2340         (Sized_incremental_binary::Sized_input_reader): New class.
2341         (Sized_incremental_binary::get_input_reader): New function.
2342         (Sized_incremental_binary::find_incremental_inputs_sections):
2343         Rename do_find_incremental_inputs_sections to this.
2344         (Sized_incremental_binary::setup_readers): New function.
2345         (Sized_incremental_binary::has_incremental_info_): New data member.
2346         (Sized_incremental_binary::inputs_reader_): New data member.
2347         (Sized_incremental_binary::symtab_reader_): New data member.
2348         (Sized_incremental_binary::relocs_reader_): New data member.
2349         (Sized_incremental_binary::got_plt_reader_): New data member.
2350         (Sized_incremental_binary::current_input_file_): New data member.
2351
2352 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2353
2354         PR gold/12640
2355         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2356         violation.
2357
2358 2011-03-30  Cary Coutant  <ccoutant@google.com>
2359
2360         * archive.cc (Archive::include_member): Adjust call to report_object.
2361         (Add_archive_symbols::run): Add script_info to call to
2362         report_archive_begin.
2363         (Lib_group::include_member): Adjust call to report_object.
2364         (Add_lib_group_symbols::run): Adjust call to report_object.
2365         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2366         blocks.  Add object count for script input files.
2367         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2368         script_info parameter; change all callers.
2369         (Incremental_inputs::report_object): Add script_info parameter;
2370         change all callers.
2371         (Incremental_inputs::report_script): Store backpointer to
2372         incremental info entry.
2373         (Output_section_incremental_inputs::set_final_data_size): Record
2374         additional information for scripts.
2375         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2376         * incremental.h (Incremental_script_entry::add_object): New function.
2377         (Incremental_script_entry::get_object_count): New function.
2378         (Incremental_script_entry::get_object): New function.
2379         (Incremental_script_entry::objects_): New data member; adjust
2380         constructor.
2381         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2382         (Incremental_inputs::report_object): Add script_info parameter.
2383         (Incremental_inputs_reader::get_object_count): New function.
2384         (Incremental_inputs_reader::get_object_offset): New function.
2385         * options.cc (Input_arguments::add_file): Return reference to
2386         new input argument.
2387         * options.h (Input_argument::set_script_info): New function.
2388         (Input_argument::script_info): New function.
2389         (Input_argument::script_info_): New data member; adjust all
2390         constructors.
2391         (Input_file_group::add_file): Return reference to new input argument.
2392         (Input_file_lib::add_file): Likewise.
2393         (Input_arguments::add_file): Likewise.
2394         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2395         * script.cc (Parser_closure::Parser_closure): Add script_info
2396         parameter; adjust all callers.
2397         (Parser_closure::script_info): New function.
2398         (Parser_closure::script_info_): New data member.
2399         (read_input_script): Report scripts earlier to incremental info.
2400         (script_add_file): Set script_info in Input_argument.
2401         (script_add_library): Likewise.
2402         * script.h (Script_options::Script_info): Rewrite class.
2403
2404 2011-03-29  Cary Coutant  <ccoutant@google.com>
2405
2406         * archive.cc (Library_base::should_include_member): Move
2407         method here from class Archive.
2408         (Archive::Archive): Initialize base class.
2409         (Archive::should_include_member): Move to base class.
2410         (Archive::do_for_all_unused_symbols): New function.
2411         (Add_archive_symbols::run): Remove redundant access to
2412         incremental_inputs.
2413         (Lib_group::Lib_group): Initialize base class.
2414         (Lib_group::do_filename): New function.
2415         (Lib_group::include_member): Pass pointer to Lib_group to
2416         report_object.
2417         (Lib_group::do_for_all_unused_symbols): New function.
2418         (Add_lib_group_symbols::run): Report archive information for
2419         incremental links.
2420         * archive.h (class Library_base): New base class.
2421         (class Archive): Derive from Library_base.
2422         (Archive::filename): Move to base class.
2423         (Archive::set_incremental_info): Likewise.
2424         (Archive::incremental_info): Likewise.
2425         (Archive::Should_include): Likewise.
2426         (Archive::should_include_member): Likewise.
2427         (Archive::Armap_entry): Remove.
2428         (Archive::Unused_symbol_iterator): Remove.
2429         (Archive::unused_symbols_begin): Remove.
2430         (Archive::unused_symbols_end): Remove.
2431         (Archive::do_filename): New function.
2432         (Archive::do_get_mtime): New function.
2433         (Archive::do_for_all_unused_symbols): New function.
2434         (Archive::task_): Move to base class.
2435         (Archive::incremental_info_): Likewise.
2436         (class Lib_group): Derive from Library_base.
2437         (Lib_group::do_filename): New function.
2438         (Lib_group::do_get_mtime): New function.
2439         (Lib_group::do_for_all_unused_symbols): New function.
2440         (Lib_group::task_): Move to base class.
2441         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2442         function.
2443         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2444         function.
2445         * incremental.cc (Incremental_inputs::report_archive_begin):
2446         Use Library_base; call library's get_mtime; add incremental inputs
2447         entry before members.
2448         (class Unused_symbol_visitor): New class.
2449         (Incremental_inputs::report_archive_end): Use Library_base; use
2450         visitor class to record unused symbols; don't add incremental inputs
2451         entry after members.
2452         (Incremental_inputs::report_object): Use Library_base.
2453         * incremental.h
2454         (Incremental_archive_entry::Incremental_archive_entry): Remove
2455         unused Archive parameter.
2456         (Incremental_inputs::report_archive_begin): Use Library_base.
2457         (Incremental_inputs::report_archive_end): Likewise.
2458         (Incremental_inputs::report_object): Likewise.
2459         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2460         function.
2461         * object.h (Object::for_all_global_symbols): New function.
2462         (Object::do_for_all_global_symbols): New function.
2463         (Sized_relobj::do_for_all_global_symbols): New function.
2464         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2465         function.
2466         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2467         function.
2468
2469 2011-03-27  Ian Lance Taylor  <iant@google.com>
2470
2471         * archive.cc (Archive::interpret_header): Return -1 if something
2472         goes wrong.  Change callers accordingly.
2473
2474 2011-03-25  Cary Coutant  <ccoutant@google.com>
2475
2476         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2477         * testsuite/Makefile.in: Regenerate.
2478
2479 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2480
2481         * plugin.cc (get_view): New.
2482         (Plugin::load): Pass get_view to the plugin.
2483         (Plugin_manager::get_view): New.
2484
2485 2011-03-21  Ian Lance Taylor  <iant@google.com>
2486
2487         * testsuite/final_layout.sh: Rewrite to not use dc.
2488         * testsuite/relro_test.sh: Fail if dc is not present.
2489
2490 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2491
2492         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2493         Change == to -eq.
2494         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2495         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2496         Change == to -eq.
2497         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2498         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2499
2500 2011-03-14  Ian Lance Taylor  <iant@google.com>
2501
2502         * script-sections.cc (Sort_output_sections::script_compare):
2503         Rename from is_before, change return type.
2504         (Sort_output_sections::operator()): Adjust accordingly.
2505
2506 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2507
2508         PR gold/12572
2509         * testsuite/odr_violation2.cc: Add comment to make all error line
2510         numbers double digits.
2511         * testsuite/debug_msg.sh: Adjust expected errors.
2512
2513 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2514
2515         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2516         but mark earlier ones as non-canonical
2517         (offset_to_iterator): Update search target and example
2518         (do_addr2line): Return extra lines in a vector*
2519         (format_file_lineno): Extract from do_addr2line
2520         (one_addr2line): Add vector* out-param
2521         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2522         when a lineno entry appeared last for its instruction
2523         (Dwarf_line_info): Add vector* out-param
2524         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2525         * symtab.cc (Odr_violation_compare): Include the lineno in the
2526         comparison again.
2527         (linenos_from_loc): New. Combine the canonical line for an
2528         address with its other lines.
2529         (True_if_intersect): New. Helper functor to make
2530         std::set_intersection a query.
2531         (detect_odr_violations): Compare sets of lines instead of just
2532         one line for each function. This became less deterministic, but
2533         has fewer false positives.
2534         * symtab.h: Declarations.
2535         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2536         mix an optimized and non-optimized object in the same binary
2537         (odr_violation2.so): Same.
2538         * testsuite/Makefile.in: Regenerate from Makefile.am.
2539         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2540         * testsuite/debug_msg.sh: Update line numbers and add
2541         assertions.
2542         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2543         non-optimized context.
2544         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2545         isn't inlined, and use OdrDerived in an optimized context.
2546         * testsuite/odr_header1.h: Defines OdrDerived, where
2547         optimization will change the
2548         first-instruction-in-the-destructor's file and line number.
2549         * testsuite/odr_header2.h: Defines OdrBase.
2550
2551 2011-03-09  Ian Lance Taylor  <iant@google.com>
2552
2553         * fileread.cc (File_read::clear_views): Don't delete the whole
2554         file view.
2555
2556 2011-03-08  Ian Lance Taylor  <iant@google.com>
2557
2558         PR gold/12525
2559         * fileread.cc: #include <climits>.
2560         (GOLD_IOV_MAX): Define.
2561         (File_read::read_multiple): Limit number of entries by iov_max.
2562         * fileread.h (class File_read): Always set max_readv_entries to
2563         128.
2564
2565 2011-03-07  Ian Lance Taylor  <iant@google.com>
2566
2567         PR gold/12525
2568         * options.h (class General_options): Add -dy and -dn.
2569
2570 2011-03-02  Cary Coutant  <ccoutant@google.com>
2571
2572         * testsuite/script_test_9.t: Add TLS segment.
2573
2574 2011-03-02  Simon Baldwin  <simonb@google.com>
2575
2576         * configure.ac: Add check for gnu_indirect_function support in
2577         the toolchain building binutils.
2578         * configure: Rebuild.
2579
2580 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2581
2582         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2583         plugin only symbols.
2584         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2585         in plugin files as not needed in the symbol table.
2586
2587 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2588
2589         * output.cc (Output_section::add_input_section): Delay fill
2590         generation for section ordering.
2591
2592 2011-02-09  Ian Lance Taylor  <iant@google.com>
2593
2594         PR gold/12316
2595         * object.h (class Sized_relobj): Remove clear_local_symbols.
2596         * reloc.cc (Sized_relobj::do_relocate): Don't call
2597         clear_local_symbols.
2598
2599 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2600
2601         * plugin.cc (is_visible_from_outside): Return true for symbols
2602         in the -u option.
2603
2604 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2605
2606         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2607         filename.
2608
2609 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2610
2611         * icf.h (is_section_foldable_candidate): Change type of parameter
2612         to std::string.
2613         * icf.cc (Icf::find_identical_sections): Change type of local variable
2614         section_name to be std::string.
2615         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2616
2617 2011-01-25  Ian Lance Taylor  <iant@google.com>
2618
2619         * script.cc (script_add_extern): Rewrite to use
2620         add_symbol_reference.
2621
2622 2011-01-25  Doug Kwan  <dougkwan@google.com>
2623
2624         * icf.cc (get_section_contents): Always lock section's object.
2625
2626 2011-01-24  Ian Lance Taylor  <iant@google.com>
2627
2628         * options.h (class General_options): Accept
2629         --no-detect-odr-violations.
2630
2631 2011-01-24  Ian Lance Taylor  <iant@google.com>
2632
2633         * version.cc (version_string): Bump to 1.11.
2634
2635 2011-01-24  Ian Lance Taylor  <iant@google.com>
2636
2637         * plugin.cc (class Plugin_rescan): Define new class.
2638         (Plugin_manager::claim_file): Set any_claimed_.
2639         (Plugin_manager::save_archive): New function.
2640         (Plugin_manager::save_input_group): New function.
2641         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2642         necessary.
2643         (Plugin_manager::new_undefined_symbol): New function.
2644         (Plugin_manager::rescan): New function.
2645         (Plugin_manager::rescannable_defines): New function.
2646         (Plugin_manager::add_input_file): Set any_added_.
2647         * plugin.h (class Plugin_manager): define new fields rescannable_,
2648         undefined_symbols_, any_claimed_, and any_added_.  Declare
2649         Plugin_rescan as friend.  Declare new functions.
2650         (Plugin_manager::Rescannable): Define type.
2651         (Plugin_manager::Rescannable_list): Define type.
2652         (Plugin_manager::Undefined_symbol_list): Define type.
2653         (Plugin_manager::Plugin_manager): Initialize new fields.
2654         * archive.cc (Archive::defines_symbol): New function.
2655         (Add_archive_symbols::run): Pass archive to plugins if any.
2656         * archive.h (class Archive): Declare defines_symbol.
2657         * readsyms.cc (Input_group::~Input_group): New function.
2658         (Finish_group::run): Pass input_group to plugins if any.
2659         * readsyms.h (class Input_group): Declare destructor.
2660         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2661         any.
2662
2663 2011-01-10  Ian Lance Taylor  <iant@google.com>
2664
2665         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2666         section as relro.
2667         (Layout::set_segment_offsets): Reset increase_relro before calling
2668         set_section_addresses a second time.
2669
2670 2011-01-04  Cary Coutant  <ccoutant@google.com>
2671
2672         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2673         sections before NOBITS sections.
2674
2675 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2676
2677         * version.cc (print_version): Update copyright to 2011.
2678
2679 2010-12-23  Cary Coutant  <ccoutant@google.com>
2680
2681         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2682         of OS to this->add.  Add OD parameter to second form of the function.
2683
2684 2010-12-20  Ian Lance Taylor  <iant@google.com>
2685
2686         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2687         second of two consecutive entries with same offset.
2688
2689 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2690
2691         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2692         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2693         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2694         to avoid unneeded links against $(LDADD).
2695         * testsuite/Makefile.in: Regenerate.
2696
2697 2010-12-15  Ian Lance Taylor  <iant@google.com>
2698
2699         PR gold/12324
2700         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2701         for R_X86_64_32 and R_X86_64_PC32.
2702         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2703         ver_matching_def_pic.o.
2704         (ver_matching_def_pic.o): New target.
2705
2706 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2707
2708         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2709         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2710         Move definition before File_read::View member definitions.
2711         (File_read::View::~View): Initialize and hold lock before
2712         updating current_mapped_bytes.
2713
2714 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2715
2716         * dwarf_reader.cc: Remove outdated comment.
2717         * gold-threads.cc: Fix typo in error message.
2718         * archive.cc: Fix typos in comments.
2719         * archive.h: Likewise.
2720         * arm-reloc-property.cc: Likewise.
2721         * arm-reloc-property.h: Likewise.
2722         * arm-reloc.def: Likewise.
2723         * arm.cc: Likewise.
2724         * attributes.h: Likewise.
2725         * cref.cc: Likewise.
2726         * ehframe.cc: Likewise.
2727         * fileread.h: Likewise.
2728         * gold.h: Likewise.
2729         * i386.cc: Likewise.
2730         * icf.cc: Likewise.
2731         * incremental.h: Likewise.
2732         * int_encoding.cc: Likewise.
2733         * layout.h: Likewise.
2734         * main.cc: Likewise.
2735         * merge.h: Likewise.
2736         * object.cc: Likewise.
2737         * object.h: Likewise.
2738         * options.cc: Likewise.
2739         * readsyms.cc: Likewise.
2740         * reduced_debug_output.cc: Likewise.
2741         * reloc.cc: Likewise.
2742         * script-sections.cc: Likewise.
2743         * sparc.cc: Likewise.
2744         * symtab.h: Likewise.
2745         * target-reloc.h: Likewise.
2746         * target.cc: Likewise.
2747         * target.h: Likewise.
2748         * timer.cc: Likewise.
2749         * timer.h: Likewise.
2750         * x86_64.cc: Likewise.
2751
2752 2010-12-09  Cary Coutant  <ccoutant@google.com>
2753
2754         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2755         stack.
2756         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2757         parameter; change all callers.
2758         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2759         * options.h (warn_execstack): New option.
2760
2761 2010-12-07  Doug Kwan  <dougkwan@google.com>
2762
2763         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2764         like function call relocations.
2765
2766 2010-12-07  Ian Lance Taylor  <iant@google.com>
2767
2768         * archive.cc (Archive::get_elf_object_for_member): Permit
2769         punconfigured to be NULL.
2770         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2771         (Archive::include_member): Pass NULL to get_elf_object_for_member
2772         if we searched for the archive and this is the first included
2773         object.
2774
2775 2010-12-01  Ian Lance Taylor  <iant@google.com>
2776
2777         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2778         track_relocs_type_ field.
2779         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2780         Set track_relocs_type_.
2781         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2782         contents when using RELA relocs.
2783         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2784         reloc_map_.
2785         * reloc.cc (Track_relocs::next_addend): New function.
2786         * reloc.h (class Track_relocs): Declare next_addend.
2787
2788 2010-12-01  Ian Lance Taylor  <iant@google.com>
2789
2790         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2791         virtual destructor.
2792
2793 2010-12-01  Ian Lance Taylor  <iant@google.com>
2794
2795         * README: Update compilers known to work and fail.
2796
2797 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2798
2799         * configure.in: For --enable-gold, handle value `default' instead of
2800         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2801         not the default.
2802         * configure: Regenerate.
2803
2804 2010-11-18  Doug Kwan  <dougkwan@google.com>
2805
2806         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2807         and right_alignment to be zero.  Store result alignment only if it is
2808         greater than existing alignment.
2809
2810 2010-11-16  Cary Coutant  <ccoutant@google.com>
2811
2812         PR gold/12220
2813         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2814         Check for ".zdebug_line".
2815
2816 2010-11-16  Doug Kwan  <dougkwan@google.com>
2817             Cary Coutant  <ccoutant@google.com>
2818
2819         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2820         by reference; adjust all callers.
2821         * output.cc (Output_segment::set_section_addresses): Adjust references
2822         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2823         list is empty.
2824         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2825         end at page boundary.
2826
2827 2010-11-16  Cary Coutant  <ccoutant@google.com>
2828
2829         PR gold/12220
2830         * layout.cc (Layout::choose_output_section): Transform names of
2831         compressed sections even when using a script with a SECTIONS clause.
2832         (Layout::output_section_name): Remove code to transform
2833         compressed debug section names.
2834         * output.cc (Output_section::add_input_section): Use uncompressed
2835         section size when tracking input sections.
2836
2837 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2838
2839         * symtab.h (Symbol::NON_PIC_REF): Remove.
2840         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2841         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2842         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2843         (Symbol::use_plt_offset): Take a flags argument and pass it
2844         directly to needs_dynamic_reloc.  Restrict check for undefined
2845         weak symbols to function calls.
2846         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2847         (Target_arm::Scan::global): Use it.
2848         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2849         (Target_arm::Relocate::relocate): Likewise.
2850         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2851         parameter with an r_type parameter.  Use get_reference_flags
2852         to get the flags.
2853         (Target_arm::Relocate::relocate): Update accordingly.
2854         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2855         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2856         (Target_i386::Scan::global): Likewise.
2857         (Target_i386::Relocate::relocate): Likewise.
2858         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2859         parameter with an r_type parameter.  Use get_reference_flags
2860         to get the flags.
2861         (Target_i386::Relocate::relocate): Update accordingly.
2862         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2863         (Target_powerpc::Scan::global): Use it.
2864         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2865         (Target_powerpc::Relocate::relocate): Likewise.
2866         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2867         (Target_sparc::Scan::global): Use it.
2868         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2869         (Target_sparc::Relocate::relocate): Likewise.
2870         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2871         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2872         (Target_x86_64::Scan::global): Likewise.
2873         (Target_x86_64::Relocate::relocate): Likewise.
2874
2875 2010-11-08  Doug Kwan  <dougkwan@google.com>
2876             Cary Coutant  <ccoutant@google.com>
2877
2878         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2879         (Arm_exidx_merge_section::section_contents_): New data member.
2880         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2881         (Arm_input_section::~Arm_input_section): De-allocate memory.
2882         (Arm_input_section::original_contents_): New data member.       
2883         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2884         in parameters instead of calling Object::section_contents without
2885         locking.
2886         (Arm_output_section::group_section): New parameter TASK.  Pass it
2887         to callees that need locking objects.
2888         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2889         to lock EXIDX input sections.  Fix a formatting issue.  Call
2890         Arm_exidx_merged_section::build_contents to create merged section
2891         contents.
2892         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2893         to lock object of stub table owner.
2894         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2895         TEXT_SIZE to initialize data member TEXT_SIZE_.
2896         (Arm_exidx_input_section::addralign): Fix typo in comment.
2897         (Arm_exidx_input_section::text_size): New method.
2898         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2899         that require locking objects.  Lock objects before scanning for stubs
2900         and updating local symbols.
2901         (Arm_input_section<big_endian>::init): Copy contents of original
2902         input section.
2903         (Arm_input_section<big_endian>::do_write): Use saved contents of
2904         original input section instead of calling Object::section_contents
2905         without locking.
2906         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2907         size without calling Object::section_size().
2908         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2909         for size.  Allocate a buffer for merged EXIDX entries.
2910         (Arm_exidx_merged_section::build_contents): New method.
2911         (Arm_exidx_merged_section::do_write): Move merge section contents
2912         building code to Arm_exidx_merged_section::build_contetns.  Write
2913         out contetns in buffer instead of building it on the fly.
2914         (Arm_relobj::make_exidx_input_section): Also pass text section size
2915         to Arm_exidx_input_section constructor.
2916         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2917         (Arm_dynobj::do_read_symbols): Fix memory leak.
2918         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2919         * target.h: (class Task): Add forward declaration.
2920         (Target::relax): Add new parameter TASK and pass it to
2921         Target::do_relax().
2922         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2923
2924 2010-11-05  Cary Coutant  <ccoutant@google.com>
2925
2926         PR gold/10708
2927         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2928         object when reading from the file.
2929         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2930         second layout pass.
2931         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2932         when reading section contents.
2933         (get_section_contents): Likewise.
2934         (icf::find_identical_sections): Likewise.
2935         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2936         object when reading from the file.
2937         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2938         the object when doing deferred section layout.
2939
2940 2010-11-03  Nick Clifton  <nickc@redhat.com>
2941
2942         PR gold/12001
2943         * script.h (class Symbol_assignment: name): New member.  Returns
2944         the name of the symbol.
2945         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2946         Returns true if the given symbol name is on the list of
2947         assignments wating to be processed.
2948         * archive.cc (should_incldue_member): If the symbol is undefined,
2949         check to see if it is on the list of symbols pending assignment.
2950
2951 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2952
2953         * script-sections.cc (Script_sections::find_memory_region): Check
2954         for a NULL output section pointer.
2955
2956 2010-10-29  Doug Kwan  <dougkwan@google.com>
2957
2958         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2959         Output_section::add_relaxed_input_section.
2960         * output.cc (Output_section::add_relaxed_input_section): Add new
2961         arguments LAYOUT and NAME.  Set section order index.
2962         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2963         Copy section order index.
2964         * output.h (Output_section::add_relaxed_input_section): Add new
2965         arguments LAYOUT and NAME.
2966
2967 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2968
2969         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2970         NATIVE_OR_CROSS_LINKER.
2971         * testsuite/Makefile.in: Regenerate.
2972
2973 2010-10-20  Doug Kwan  <dougkwan@google.com>
2974
2975         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2976         without SHF_LINK_ORDER flags.
2977         * layout.cc (Layout::choose_output_section): Do not filter
2978         SHF_LINK_ORDER flag in a relocatable link.
2979
2980 2010-10-17  Cary Coutant  <ccoutant@google.com>
2981
2982         * output.h (Output_segment::set_section_addresses): Change function
2983         signature.  Update all callers.
2984         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2985         sections.
2986         (Output_segment::set_section_addresses): Align after last TLS
2987         section.  Add padding before last relro section instead of after.
2988
2989 2010-10-17  Doug Kwan  <dougkwan@google.com>
2990
2991         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2992         GOT output section to be writable.
2993
2994 2010-10-14  Cary Coutant  <ccoutant@google.com>
2995
2996         * debug.h (DEBUG_INCREMENTAL): New flag.
2997         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2998         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2999         mode.
3000         * incremental.cc (report_command_line): Ignore all forms of
3001         --incremental.
3002         * layout.cc (Layout::Layout): Check parameters for incremental link
3003         mode.
3004         * options.cc (General_options::parse_incremental): New function.
3005         (General_options::parse_no_incremental): New function.
3006         (General_options::parse_incremental_full): New function.
3007         (General_options::parse_incremental_update): New function.
3008         (General_options::incremental_mode_): New data member.
3009         (General_options::finalize): Check incremental_mode_.
3010         * options.h (General_options): Update help text for --incremental.
3011         Add --no-incremental, --incremental-full, --incremental-update.
3012         (General_options::Incremental_mode): New enum type.
3013         (General_options::incremental_mode): New function.
3014         (General_options::incremental_mode_): New data member.
3015         * parameters.cc (Parameters::incremental_mode_): New data member.
3016         (Parameters::set_options): Set incremental_mode_.
3017         (Parameters::set_incremental_full): New function.
3018         (Parameters::incremental): New function.
3019         (Parameters::incremental_update): New function.
3020         (set_parameters_incremental_full): New function.
3021         * parameters.h (Parameters::set_incremental_full): New function.
3022         (Parameters::incremental): New function.
3023         (Parameters::incremental_update): New function.
3024         (Parameters::incremental_mode_): New data member.
3025         (set_parameters_incremental_full): New function.
3026         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3027         incremental link mode.
3028         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3029         (Sized_relobj::do_relocate_sections): Likewise.
3030         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3031         option.
3032         * testsuite/Makefile.in: Regenerate.
3033         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3034
3035 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3036
3037         * script-sections.h (class Script_sections): Make
3038         Sections_elements typedef public.
3039         * script-sections.cc (class Sort_output_sections): Add elements_
3040         field.  Add constructor which sets it; change all callers.
3041         (Sort_output_sections::is_before): New function.
3042         (Sort_output_sections::operator()): Call is_before.
3043         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3044         conditional.
3045         * testsuite/script_test_10.sh: New test. Test script section
3046         order.
3047         * testsuite/script_test_10.t: Likewise.
3048         * testsuite/script_test_10.s: Likewise.
3049         * testsuite/Makefile.am: Wrap the cross linker tests and the
3050         common tests into NATIVE_OR_CROSS_LINKER.
3051         (check_SCRIPTS): Add script_test_10.sh.
3052         (check_DATA): Add script_test_10.stdout.
3053         (script_test_10.o, script_test_10): New targets.
3054         (script_test_10.stdout): New target.
3055         * configure, testsuite/Makefile.in: Regenerate.
3056
3057 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3058
3059         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3060         error for the deprecated relocations.
3061         (Target_arm::Scan::global): Likewise.
3062         (Target_arm::Relocate::relocate): Likewise.
3063
3064 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3065
3066         * fileread.cc (Input_file::find_file): Initialize *found_name
3067         and *namep when using the fallback search for case 4.
3068
3069 2010-10-11  Cary Coutant  <ccoutant@google.com>
3070
3071         * options.h (class General_options): Redefine -z lazy as an alias for
3072         the negation of -z now.
3073
3074 2010-10-11  Ian Lance Taylor  <iant@google.com>
3075
3076         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3077         binding.
3078
3079 2010-10-06  Nick Clifton  <nickc@redhat.com>
3080
3081         * script-sections.cc(class Memory_region): Remove
3082         current_lma_offset_ field.  Rename current_vma_offset_ to
3083         current_offset_.  Add last_section_ field.
3084         (Memory_region::get_current_vma_address): Rename to
3085         get_current_address.
3086         (Memory_region::get_current_lma_address): Delete.
3087         (Memory_region::increment_vma_offset): Rename to
3088         increment_offset.
3089         (Memory_region::increment_lma_offset): Delete.
3090         (Memory_region::attributes_compatible): New method.  Returns
3091         true if the provided section is compatible with the region.
3092         (Memory_region::get_last_section): New method.  Returns the last
3093         section to use the region.
3094         (Memory_region::set_last_section): New method.  Stores the last
3095         section to use the region.
3096         (Script_sections::block_in_region): New method.  Returns true if
3097         a block of memory is contained within a region.
3098         (Script_sections::find_memory_region): New method.  Locates a
3099         memory region to be used to set a VMA or LMA address.
3100         (Output_section_definition::set_section_addresses): Add code to
3101         check for addresses set by memory regions.
3102         (Output_segment::set_section_addresses): Remove memory region
3103         walking code.
3104         (Script_sections::create_segment): Add a warning if a header
3105         segment is created outside of any region.
3106         * script-sections.h (class Script_sections): Add prototypes for
3107         find_memory_region and block_in_region methods.
3108         * testsuite/memory_test.s: Use .long instead of .word.
3109         * testsuite/memory_test.t: Add some more output sections.
3110         * testsuite/memory_test.sh: Update expected output.
3111
3112 2010-10-02  Doug Kwan  <dougkwan@google.com>
3113
3114         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3115         defintion to symtab.h
3116         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3117         declaration to defintion.
3118
3119 2010-10-01  Nick Clifton  <nickc@redhat.com>
3120
3121         * expression.cc (eval): Replace dummy argument with NULL.
3122         (eval_maybe_dot): Check for a NULL result section pointer.
3123         (Symbol_expression::value): Likewise.
3124         (Dot_expression::value): Likewise.
3125         (BINARY_EXPRESSION): Likewise.
3126         (Max_expression::value): Likewise.
3127         (Min_expression::value): Likewise.
3128         (Absolute_expression::value): Likewise.
3129         (Addr_expression::value_from_output_section): Likewise.
3130         (Loaddddr_expression::value_from_output_section): Likewise.
3131         (Segment_start_expression::value): Likewise.
3132         * script-sections.cc
3133         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3134         argument with NULL.
3135         (Sections_elememt_dot_assignment::set_section_addresses):
3136         Likewise.
3137         (Output_data_expression::do_write_to_buffer): Likewise.
3138         (Output_section_definition::finalize_symbols): Likewise.
3139         (Output_section_definition::set_section_addresses): Likewise.
3140
3141 2010-09-30  Doug Kwan  <dougkwan@google.com>
3142
3143         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3144
3145 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3146
3147         * target.h (Target::can_icf_inline_merge_sections): New virtual
3148         function.
3149         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3150         virtual function.
3151         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3152         virtual function.
3153         * icf.cc (get_section_contents): Inline merge sections only when
3154         target allows it.
3155
3156 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3157
3158         * configure: Regenerate.
3159
3160 2010-09-17  Ian Lance Taylor  <iant@google.com>
3161
3162         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3163         * testsuite/Makefile.am (memory_test.o): New target.
3164         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3165         memory_test.t.
3166         * testsuite/Makefile.in: Rebuild.
3167
3168 2010-09-17  Doug Kwan  <dougkwan@google.com>
3169
3170         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3171         defintion if relocation uses GOT entries of the symbol.
3172         * testsuite/icf_safe_test.sh: Fix test.
3173         * testsuite/icf_safe_so_test.sh: Fix test.
3174
3175 2010-09-16  Cary Coutant  <ccoutant@google.com>
3176
3177         * script_sections.cc (class Memory_region): Remove "NULL" from
3178         vector initializations.
3179
3180 2010-09-15  Cary Coutant  <ccoutant@google.com>
3181
3182         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3183         Resolve forwarding symbols.
3184
3185 2010-09-15  Doug Kwan  <dougkwan@google.com>
3186
3187         * gold/testsuite/script_test_3.t: Add ARM special sections.
3188         * gold/testsuite/script_test_4.t: Same.
3189         * gold/testsuite/script_test_5.t: Same.
3190         * gold/testsuite/script_test_6.t: Same.
3191         * gold/testsuite/script_test_7.t: Same.
3192         * gold/testsuite/script_test_7.t: Same.
3193         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3194
3195 2010-09-14  Cary Coutant  <ccoutant@google.com>
3196
3197         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3198         (Target_x86_64::Relocate::relocate_tls): Replace check for
3199         saw_tls_block_reloc_ with test for executable section.
3200
3201 2010-09-12  Cary Coutant  <ccoutant@google.com>
3202
3203         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3204         position-independent executables to shared libraries need dynamic
3205         relocations.
3206         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3207         position-independent executables.
3208         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3209         * testsuite/Makefile.in: Regenerate.
3210
3211 2010-09-10  Nick Clifton  <nickc@redhat.com>
3212
3213         PR gold/11997
3214         * testsuite/memory_test.t: Discard any sections that are not
3215         needed.
3216
3217 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3218
3219         PR gold/11996
3220         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3221         "This::" to work around a bug in gcc 4.2.
3222
3223         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3224
3225 2010-09-09  Rafael Espindola  <espindola@google.com>
3226
3227         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3228         sections with different PF_X flags in the same segment.
3229         (Layout::find_first_load_seg): Search all segments to find the first
3230         one.
3231         * options.h (rosegment): New.
3232
3233 2010-09-08  Rafael Espindola  <espindola@google.com>
3234
3235         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3236
3237 2010-09-08  Doug Kwan  <dougkwan@google.com>
3238
3239         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3240         (Arm_relobj::do_relocate_sections): Add new parameter for output
3241         file to match the parent.
3242         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3243         of local symbols instead of input values.  Update code to track
3244         changes in gold::relocate_section.
3245         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3246         (Sized_relobj::compute_final_local_value_internal): New methods.
3247         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3248         body into private version of Sized_relobj::compute_final_local_value.
3249         Call the inline method.
3250         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3251         merged symbol value if there is one.
3252         (Symbol_value::has_output_value): New method defintiion.
3253         (Sized_relobj::Compute_final_local_value_status): New enum type.
3254         (Sized_relobj::compute_final_local_value): New methods.
3255         (Sized_relobj::compute_final_local_value_internal): New methods.
3256         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3257         and arm_cortex_a8.sh.
3258         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3259         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3260         New tests.
3261         * Makefile.in: Regenerate.
3262         * testsuite/arm_bl_out_of_range.s: Update test.
3263         * testsuite/thumb_bl_out_of_range.s: Ditto.
3264         * testsuite/thumb_blx_out_of_range.s: Ditto.
3265         * testsuite/arm_branch_out_of_range.sh: New file.
3266         * testsuite/arm_cortex_a8.sh: Ditto.
3267         * testsuite/arm_cortex_a8_b.s: Ditto.
3268         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3269         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3270         * testsuite/arm_cortex_a8_bl.s: Ditto.
3271         * testsuite/arm_cortex_a8_blx.s: Ditto.
3272         * testsuite/arm_cortex_a8_local.s: Ditto.
3273         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3274         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3275
3276 2010-09-08  Rafael Espindola  <espindola@google.com>
3277
3278         * Makefile.am (memory_test.stdout): Run readelf with -W.
3279         * Makefile.in: Regenerate.
3280         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3281         64 bit output.
3282
3283 2010-09-08  Rafael Espindola  <espindola@google.com>
3284
3285         * script-sections.cc (Script_sections::add_memory_region): Convert
3286         field precision to int.
3287         * script.cc (script_set_section_region, script_set_section_region):
3288         Convert field precision to int.
3289
3290 2010-09-08  Rafael Espindola  <espindola@google.com>
3291
3292         * arm.cc (do_finalize_sections): Create the __exidx_start and
3293         __exdix_end symbols even when the section is missing.
3294
3295 2010-09-08  Nick Clifton  <nickc@redhat.com>
3296
3297         * README: Remove claim that MEMORY is not supported.
3298         * expression.cc (script_exp_function_origin)
3299         (script_exp_function_length): Move from here to ...
3300         * script.cc: ... here.
3301         (script_set_section_region, script_add_memory)
3302         (script_parse_memory_attr, script_include_directive): New
3303         functions.
3304         * script-sections.cc
3305         (class Memory_region): New class.
3306         (class Output_section_definition): Add set_memory_region,
3307         set_section_vma, set_section_lma and get_section_name methods.
3308         (class Script_Sections): Add add_memory_region,
3309         find_memory_region, find_memory_region_origin,
3310         find_memory_region_length and set_memory_region methods.
3311         Have set_section_addresses method walk the list of set memory
3312         regions.
3313         Extend the print methos to display memory regions.
3314         * script-sections.h: Add prototypes for new methods.
3315         Add enum for MEMORY region attributes.
3316         * yyscript.y: Add support for parsing MEMORY regions.
3317         * script-c.h: Add prototypes for new functions.
3318         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3319         * testsuite/Makefile.in: Regenerate.
3320         * testsuite/memory_test.sh: New script.
3321         * testsuite/memory_test.s: New assembler source file.
3322         * testsuite/memory_test.t: New linker script.
3323
3324 2010-08-27  Doug Kwan  <dougkwan@google.com>
3325
3326         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3327         reference override an existing dynamic weak reference.
3328         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3329         * testsuite/Makefile.in: Regenerate.
3330         * testsuite/dyn_weak_ref.sh: New file.
3331         * testsuite/dyn_weak_ref_1.c: Ditto.
3332         * testsuite/dyn_weak_ref_2.c: Ditto.
3333
3334 2010-08-27  Ian Lance Taylor  <iant@google.com>
3335
3336         * incremental.h (class Incremental_input_entry): Add virtual
3337         destructor.
3338
3339 2010-08-27  Ian Lance Taylor  <iant@google.com>
3340
3341         * testsuite/start_lib_test_3.c: Mark t3 as used.
3342
3343 2010-08-27  Nick Clifton  <nickc@redhat.com>
3344
3345         * options.cc (version_script): Fix small typo in previous
3346         whitespace tidyup.
3347
3348 2010-08-25  Nick Clifton  <nickc@redhat.com>
3349
3350         * archive.cc: Formatting fixes: Remove whitespace between
3351         typename and following asterisk.  Remove whitespace between
3352         function name and opening parenthesis.
3353         * archive.h: Likewise.
3354         * arm.cc: Likewise.
3355         * attributes.cc: Likewise.
3356         * attributes.h: Likewise.
3357         * common.cc: Likewise.
3358         * copy-relocs.cc: Likewise.
3359         * dirsearch.h: Likewise.
3360         * dynobj.cc: Likewise.
3361         * ehframe.cc: Likewise.
3362         * ehframe.h: Likewise.
3363         * expression.cc: Likewise.
3364         * fileread.cc: Likewise.
3365         * fileread.h: Likewise.
3366         * gc.h: Likewise.
3367         * gold-threads.cc: Likewise.
3368         * gold.cc: Likewise.
3369         * i386.cc: Likewise.
3370         * icf.h: Likewise.
3371         * incremental-dump.cc: Likewise.
3372         * incremental.cc: Likewise.
3373         * layout.cc: Likewise.
3374         * layout.h: Likewise.
3375         * main.cc: Likewise.
3376         * merge.cc: Likewise.
3377         * merge.h: Likewise.
3378         * object.cc: Likewise.
3379         * object.h: Likewise.
3380         * options.cc: Likewise.
3381         * options.h: Likewise.
3382         * output.cc: Likewise.
3383         * output.h: Likewise.
3384         * plugin.cc: Likewise.
3385         * plugin.h: Likewise.
3386         * powerpc.cc: Likewise.
3387         * reloc.cc: Likewise.
3388         * script-c.h: Likewise.
3389         * script-sections.cc: Likewise.
3390         * script.cc: Likewise.
3391         * stringpool.cc: Likewise.
3392         * symtab.cc: Likewise.
3393         * symtab.h: Likewise.
3394         * target.cc: Likewise.
3395         * timer.cc: Likewise.
3396         * timer.h: Likewise.
3397         * version.cc: Likewise.
3398         * x86_64.cc: Likewise.
3399
3400 2010-08-24  Nick Clifton  <nickc@redhat.com>
3401
3402         PR 11899
3403         * layout.cc (segment_precedes): Sort segments by their physical
3404         addresses, if they have been set.
3405
3406 2010-08-23  Cary Coutant  <ccoutant@google.com>
3407
3408         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3409         symbols data.
3410         (Lib_group::include_member): Unlock object after deleting its
3411         symbols data.
3412         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3413         the bug fixed here.
3414
3415 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3416             Cary Coutant  <ccoutant@google.com>
3417
3418         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3419         constructor, and set_blocker.
3420         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3421         readsyms_blocker_.
3422         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3423         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3424         * testsuite/Makefile.am (start_lib_test): New test case.
3425         * testsuite/Makefile.in: Regenerate.
3426         * testsuite/start_lib_test_main.c: New file.
3427         * testsuite/start_lib_test_1.c: New file.
3428         * testsuite/start_lib_test_2.c: New file.
3429         * testsuite/start_lib_test_3.c: New file.
3430
3431 2010-08-19  Ian Lance Taylor  <iant@google.com>
3432
3433         * Makefile.in: Rebuild with automake 1.11.1.
3434         * aclocal.m4: Likewise.
3435         * testsuite/Makefile.in: Likewise.
3436
3437 2010-08-19  Ian Lance Taylor  <iant@google.com>
3438
3439         PR 10893
3440         * i386.cc (class Output_data_plt_i386): Update declarations.
3441         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3442         local_ifuncs_ fields.
3443         (Target_i386::do_plt_section_for_global): New function.
3444         (Target_i386::do_plt_section_for_local): New function.
3445         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3446         parameter; change all callers.  Initialize global_ifuncs_ and
3447         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3448         __rel_iplt_end.
3449         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3450         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3451         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3452         symbols.
3453         (Target_i386::make_plt_section): New function, broken out of
3454         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3455         (Target_i386::make_plt_entry): Call make_plt_section.
3456         (Target_i386::make_local_ifunc_plt_entry): New function.
3457         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3458         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3459         R_386_IRELATIVE to switch.
3460         (Target_i386::Scan::global): Likewise.
3461         (Target_i386::Relocate::relocate): Likewise.
3462         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3463         switch.
3464         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3465         (Target_x86_64::do_plt_section_for_global): New function.
3466         (Target_x86_64::do_plt_section_for_local): New function.
3467         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3468         parameter; change all callers.  If doing a static link define
3469         __rela_iplt_start and __rela_iplt_end.
3470         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3471         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3472         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3473         to point to .plt.
3474         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3475         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3476         switch.
3477         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3478         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3479         R_X86_64_IRELATIVE to switch.
3480         (Target_x86_64::Scan::global): Likewise.
3481         (Target_x86_64::Relocate::relocate): Likewise.
3482         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3483         switch.
3484         * target.h (class Target): Add plt_section_for_global and
3485         plt_section_for_local functions.  Add do_plt_section_for_global
3486         and do_plt_section_for_local virtual functions.
3487         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3488         clarifying comments.
3489         (Symbol::use_plt_offset): Handle IFUNC symbol.
3490         * object.cc (Sized_relobj::Sized_relobj): Initialize
3491         local_plt_offsets_.
3492         (Sized_relobj::local_has_plt_offset): New function.
3493         (Sized_relobj::local_plt_offset): New function.
3494         (Sized_relobj::set_local_plt_offset): New function.
3495         (Sized_relobj::do_count): Handle IFUNC symbol.
3496         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3497         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3498         is_ifunc_symbol functions.
3499         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3500         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3501         local_plt_offsets_ field.
3502         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3503         * output.h (class Output_section_data): Add non-const
3504         output_section function.
3505         (class Output_data_got): Update declarations.
3506         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3507         Add use_plt_offset parameter to global and local constructors.
3508         Change all callers.  Change local_sym_index_ field to 31 bits.
3509         Change GSYM_CODE and CONSTANT_CODE accordingly.
3510         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3511         doing a static link don't set sh_link field.
3512         (Output_data_got::Got_entry::write): Use PLT offset if
3513         appropriate.
3514         (Output_data_got::add_global_plt): New function.
3515         (Output_data_got::add_local_plt): New function.
3516         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3517         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3518         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3519         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3520         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3521         IFUNC conditional.
3522         * testsuite/ifunc-sel.h: New file.
3523         * testsuite/ifuncmain1.c: New file.
3524         * testsuite/ifuncmain1vis.c: New file.
3525         * testsuite/ifuncmod1.c: New file.
3526         * testsuite/ifuncdep2.c: New file.
3527         * testsuite/ifuncmain2.c: New file.
3528         * testsuite/ifuncmain3.c: New file.
3529         * testsuite/ifuncmod3.c: New file.
3530         * testsuite/ifuncmain4.c: New file.
3531         * testsuite/ifuncmain5.c: New file.
3532         * testsuite/ifuncmod5.c: New file.
3533         * testsuite/ifuncmain6pie.c: New file.
3534         * testsuite/ifuncmod6.c: New file.
3535         * testsuite/ifuncmain7.c: New file.
3536         * configure, testsuite/Makefile.in: Rebuild.
3537
3538 2010-08-18  Ian Lance Taylor  <iant@google.com>
3539
3540         * incremental.cc
3541         (Output_section_incremental_inputs::write_input_files): Add cast
3542         to avoid signed/unsigned comparison warning.
3543         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3544
3545 2010-08-12  Cary Coutant  <ccoutant@google.com>
3546
3547         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3548
3549 2010-08-13  Ian Lance Taylor  <iant@google.com>
3550
3551         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3552
3553 2010-08-12  Cary Coutant  <ccoutant@google.com>
3554             Doug Kwan  <dougkwan@google.com>
3555
3556         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3557         defintion overrides non-weak undef, remember that the original undef
3558         is not weak.
3559         * symtab.cc (Symbol_table::sized_write_global): For undef without
3560         an original weak binding, set binding to global in output.
3561         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3562         * testsuite/Makefile.in: Regenerate.
3563         * testsuite/strong_ref_weak_def.sh: New file.
3564         * testsuite/strong_ref_weak_def_1.c: Ditto.
3565         * testsuite/strong_ref_weak_def_2.c: Ditto.
3566
3567 2010-08-12  Cary Coutant  <ccoutant@google.com>
3568
3569         * testsuite/incremental_test.sh: Rewrite.
3570         * testsuite/incremental_test_1.c: Rewrite.
3571         * testsuite/incremental_test_2.c: Rewrite.
3572
3573 2010-08-12  Cary Coutant  <ccoutant@google.com>
3574
3575         * arm.cc (Target_arm::got_size): Add const.
3576         (Target_arm::got_entry_count): New function.
3577         (Target_arm::plt_entry_count): New function.
3578         (Target_arm::first_plt_entry_offset): New function.
3579         (Target_arm::plt_entry_size): New function.
3580         (Output_data_plt_arm::entry_count): New function.
3581         (Output_data_plt_arm::first_plt_entry_offset): New function.
3582         (Output_data_plt_arm::get_plt_entry_size): New function.
3583         * i386.cc (Target_i386::got_size): Add const.
3584         (Target_i386::got_entry_count): New function.
3585         (Target_i386::plt_entry_count): New function.
3586         (Target_i386::first_plt_entry_offset): New function.
3587         (Target_i386::plt_entry_size): New function.
3588         (Output_data_plt_i386::entry_count): New function.
3589         (Output_data_plt_i386::first_plt_entry_offset): New function.
3590         (Output_data_plt_i386::get_plt_entry_size): New function.
3591         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3592         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3593         * incremental.cc: Include target.h.
3594         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3595         parameter.  Adjust all callers.  Find incremental_got_plt section.
3596         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3597         section.
3598         (Output_section_incremental_inputs::set_final_data_size): Calculate
3599         size of incremental_got_plt section.
3600         (Output_section_incremental_inputs::do_write): Write the
3601         incremental_got_plt section.
3602         (Got_plt_view_info): New struct.
3603         (Local_got_offset_visitor): New class.
3604         (Global_got_offset_visitor): New class.
3605         (Global_symbol_visitor_got_plt): New class.
3606         (Output_section_incremental_inputs::write_got_plt): New function.
3607         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3608         Add parameter.  Adjust all callers.
3609         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3610         (Incremental_inputs::got_plt_section): New function.
3611         (Incremental_inputs::got_plt_section_): New data member.
3612         (Incremental_got_plt_reader): New class.
3613         * layout.cc (Layout::create_incremental_info_sections): Add the
3614         incremental_got_plt section.
3615         * object.h (Got_offset_list::get_list): New function.
3616         (Got offset_list::for_all_got_offsets): New function.
3617         (Sized_relobj::local_got_offset_list): New function.
3618         * powerpc.cc (Target_powerpc::got_size): Add const.
3619         (Target_powerpc::got_entry_count): New function.
3620         (Target_powerpc::plt_entry_count): New function.
3621         (Target_powerpc::first_plt_entry_offset): New function.
3622         (Target_powerpc::plt_entry_size): New function.
3623         (Output_data_plt_powerpc::entry_count): New function.
3624         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3625         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3626         * sparc.cc (Target_sparc::got_size): Add const.
3627         (Target_sparc::got_entry_count): New function.
3628         (Target_sparc::plt_entry_count): New function.
3629         (Target_sparc::first_plt_entry_offset): New function.
3630         (Target_sparc::plt_entry_size): New function.
3631         (Output_data_plt_sparc::entry_count): New function.
3632         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3633         (Output_data_plt_sparc::get_plt_entry_size): New function.
3634         * symtab.h (Symbol::got_offset_list): New function.
3635         (Symbol_table::for_all_symbols): New function.
3636         * target.h (Sized_target::got_entry_count): New function.
3637         (Sized_target::plt_entry_count): New function.
3638         (Sized_target::plt_entry_size): New function.
3639         * x86_64.cc (Target_x86_64::got_size): Add const.
3640         (Target_x86_64::got_entry_count): New function.
3641         (Target_x86_64::plt_entry_count): New function.
3642         (Target_x86_64::first_plt_entry_offset): New function.
3643         (Target_x86_64::plt_entry_size): New function.
3644         (Output_data_plt_x86_64::entry_count): New function.
3645         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3646         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3647
3648 2010-08-12  Cary Coutant  <ccoutant@google.com>
3649
3650         * archive.cc: Include incremental.h.
3651         (Archive::Archive): Initialize incremental_info_.
3652         (Archive::include_member): Record archive members in incremental info.
3653         (Add_archive_symbols::run): Record begin and end of an archive in
3654         incremental info.
3655         (Lib_group::include_member): Record objects in incremental info.
3656         * archive.h (Incremental_archive_entry): Forward declaration.
3657         (Archive::set_incremental_info): New member function.
3658         (Archive::incremental_info): New member function.
3659         (Archive::Unused_symbol_iterator): New class.
3660         (Archive::unused_symbols_begin): New member function.
3661         (Archive::unused_symbols_end): New member function.
3662         (Archive::incremental_info_): New data member.
3663         * incremental-dump.cc (find_input_containing_global): New function.
3664         (dump_incremental_inputs): Dump new incremental info sections.
3665         * incremental.cc: Include symtab.h.
3666         (Output_section_incremental_inputs): New class.
3667         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3668         new incremental info sections.
3669         (Sized_incremental_binary::do_check_inputs): Likewise.
3670         (Incremental_inputs::report_archive): Remove.
3671         (Incremental_inputs::report_archive_begin): New function.
3672         (Incremental_inputs::report_archive_end): New function.
3673         (Incremental_inputs::report_object): New function.
3674         (Incremental_inputs::finalize_inputs): Remove.
3675         (Incremental_inputs::report_input_section): New function.
3676         (Incremental_inputs::report_script): Rewrite.
3677         (Incremental_inputs::finalize): Do nothing but finalize string table.
3678         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3679         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3680         (Incremental_inputs::create_data_sections): New function.
3681         (Incremental_inputs::relocs_entsize): New function.
3682         (Output_section_incremental_inputs::set_final_data_size): New function.
3683         (Output_section_incremental_inputs::do_write): New function.
3684         (Output_section_incremental_inputs::write_header): New function.
3685         (Output_section_incremental_inputs::write_input_files): New function.
3686         (Output_section_incremental_inputs::write_info_blocks): New function.
3687         (Output_section_incremental_inputs::write_symtab): New function.
3688         * incremental.h (Incremental_script_entry): Forward declaration.
3689         (Incremental_object_entry): Forward declaration.
3690         (Incremental_archive_entry): Forward declaration.
3691         (Incremental_inputs): Forward declaration.
3692         (Incremental_inputs_header_data): Remove.
3693         (Incremental_inputs_header): Remove.
3694         (Incremental_inputs_header_write): Remove.
3695         (Incremental_inputs_entry_data): Remove.
3696         (Incremental_inputs_entry): Remove.
3697         (Incremental_inputs_entry_write): Remove.
3698         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3699         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3700         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3701         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3702         Likewise.
3703         (Incremental_input_entry): New class.
3704         (Incremental_script_entry): New class.
3705         (Incremental_object_entry): New class.
3706         (Incremental_archive_entry): New class.
3707         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3708         (Incremental_inputs::report_inputs): Remove.
3709         (Incremental_inputs::report_archive): Remove.
3710         (Incremental_inputs::report_archive_begin): New function.
3711         (Incremental_inputs::report_archive_end): New function.
3712         (Incremental_inputs::report_object): Change prototype.
3713         (Incremental_inputs::report_input_section): New function.
3714         (Incremental_inputs::report_script): Change prototype.
3715         (Incremental_inputs::get_reloc_count): New function.
3716         (Incremental_inputs::set_reloc_count): New function.
3717         (Incremental_inputs::create_data_sections): New function.
3718         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3719         (Incremental_inputs::inputs_section): New function.
3720         (Incremental_inputs::symtab_section): New function.
3721         (Incremental_inputs::relocs_section): New function.
3722         (Incremental_inputs::get_stringpool): Add const.
3723         (Incremental_inputs::command_line): Add const.
3724         (Incremental_inputs::inputs): Remove.
3725         (Incremental_inputs::command_line_key): New function.
3726         (Incremental_inputs::input_file_count): New function.
3727         (Incremental_inputs::input_files): New function.
3728         (Incremental_inputs::relocs_entsize): New function.
3729         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3730         (Incremental_inputs::finalize_inputs): Remove.
3731         (Incremental_inputs::Input_info): Remove.
3732         (Incremental_inputs::lock_): Remove.
3733         (Incremental_inputs::inputs_): Change type.
3734         (Incremental_inputs::inputs_map_): Remove.
3735         (Incremental_inputs::current_object_entry_): New data member.
3736         (Incremental_inputs::inputs_section_): New data member.
3737         (Incremental_inputs::symtab_section_): New data member.
3738         (Incremental_inputs::relocs_section_): New data member.
3739         (Incremental_inputs::reloc_count_): New data member.
3740         (Incremental_inputs_reader): New class.
3741         (Incremental_symtab_reader): New class.
3742         (Incremental_relocs_reader): New class.
3743         * layout.cc (Layout::finalize): Move finalization of incremental info
3744         and creation of incremental info sections to follow finalization of
3745         symbol table.  Set offsets for postprocessing sections.
3746         (Layout::create_incremental_info_sections): Call
3747         Incremental_inputs::create_data_sections.  Add incremental symtab
3748         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3749         sections to layout after input sections.
3750         * layout.h (struct Timespec): Forward declaration.
3751         (Layout::incremental_inputs): Add const.
3752         (Layout::create_incremental_info_sections): Add parameter.
3753         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3754         * object.cc: Include incremental.h.
3755         (Relobj::finalize_incremental_relocs): New function.
3756         (Sized_relobj::do_layout): Record input sections in incremental info.
3757         * object.h (Object::output_section): New function.
3758         (Object::output_section_offset): Moved from Relobj.
3759         (Object::get_incremental_reloc_base): New function.
3760         (Object::get_incremental_reloc_count): New function.
3761         (Object::do_output_section): New function.
3762         (Object::do_output_section_offset): Moved from Relobj.
3763         (Object::do_get_incremental_reloc_base): New function.
3764         (Object::do_get_incremental_reloc_count): New function.
3765         (Object::Object): Initialize new data members.
3766         (Relobj::output_section): Renamed do_output_section and moved to
3767         protected.
3768         (Relobj::output_section_offset): Moved to Object.
3769         (Relobj::do_get_incremental_reloc_base): New function.
3770         (Relobj::do_get_incremental_reloc_count): New function.
3771         (Relobj::allocate_incremental_reloc_counts): New function.
3772         (Relobj::count_incremental_reloc): New function.
3773         (Relobj::finalize_incremental_relocs): New function.
3774         (Relobj::next_incremental_reloc_index): New function.
3775         (Relobj::reloc_counts_): New data member.
3776         (Relobj::reloc_bases_): New data member.
3777         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3778         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3779         (Sized_relobj::incremental_relocs_scan): New function.
3780         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3781         (Sized_relobj::incremental_relocs_write): New function.
3782         (Sized_relobj::incremental_relocs_write_reltype): New function.
3783         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3784         incremental link.
3785         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3786         archives and object files elsewhere.
3787         (Add_symbols::run): Report object files here.
3788         (Finish_group::run): Report end of archive at end of group.
3789         * reloc.cc: Include layout.h, incremental.h.
3790         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3791         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3792         (Sized_relobj::incremental_relocs_scan): New function.
3793         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3794         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3795         (Sized_relobj::incremental_relocs_write): New function.
3796         (Sized_relobj::incremental_relocs_write_reltype): New function.
3797         * script.cc (read_input_script): Rewrite test for incremental link.
3798         Change call to Incremental_inputs::report_script.
3799         * symtab.h (Symbol_table::first_global_index): New function.
3800         (Symbol_table::output_count): New function.
3801
3802 2010-08-12  Doug Kwan  <dougkwan@google.com>
3803
3804         * arm.cc (Target_arm::merge_object_attributes): Check command line
3805         options --no-wchar-size-warning and --no-enum-size-warning.
3806         * options.h (General_options): Add ld-compatible options
3807         --no-enum-size-warning and --no-wchar-size-warning.
3808
3809 2010-08-04  Ian Lance Taylor  <iant@google.com>
3810
3811         * x86_64.cc (Target_x86_64::Scan::local): Use
3812         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3813         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3814         (Target_x86_64::Scan::global): Likewise.
3815         (Target_x86_64::Relocate::relocate): Likewise.
3816         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3817         Likewise.
3818
3819 2010-08-03  Cary Coutant  <ccoutant@google.com>
3820
3821         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3822         to reserve space in merged_strings vector. Keep total input size
3823         for stats.
3824         (Output_merge_string::do_print_merge_stats): Print total input size.
3825         * merge.h (Output_merge_string): Add input_size_ field.
3826         * stringpool.cc (Stringpool_template::string_length): Move
3827         implementations out of Stringpool_template class and place in
3828         stringpool.h.
3829         * stringpool.h (string_length): Move out of Stringpool_template.
3830
3831 2010-08-03  Ian Lance Taylor  <iant@google.com>
3832
3833         PR 11712
3834         * layout.cc (relaxation_loop_body): If address of load segment is
3835         set, adjust address to include headers if possible.
3836
3837 2010-08-03  Ian Lance Taylor  <iant@google.com>
3838
3839         * version.cc (version_string): Bump to 1.10.
3840
3841 2010-08-03  Ian Lance Taylor  <iant@google.com>
3842
3843         PR 11805
3844         * layout.h (enum Output_section_order): Define.
3845         (class Layout): Update declarations.
3846         * layout.cc (Layout::get_output_section): Add order parameter.
3847         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3848         is_first_non_relro parameters.  Change all callers.
3849         (Layout::choose_output_section): Likewise.
3850         (Layout::add_output_section_data): Likewise.
3851         (Layout::make_output_section): Likewise.  Set order.
3852         (Layout::default_section_order): New function.
3853         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3854         * output.cc (Output_section::Output_section): Initialize order_.
3855         Don't initialize deleted fields.
3856         (Output_segment::Output_segment): Don't initialize deleted
3857         fields.
3858         (Output_segment::add_output_section_to_load): New function
3859         replacing add_output_section.  Change all callers to call this or
3860         add_output_section_to_nonload.
3861         (Output_segment::add_output_section_to_nonload): New function.
3862         (Output_segment::remove_output_section): Rewrite.
3863         (Output_segment::add_initial_output_data): Likewise.
3864         (Output_segment::has_any_data_sections): Likewise.
3865         (Output_segment::is_first_section_relro): Likewise.
3866         (Output_segment::maximum_alignment): Likewise.
3867         (Output_segment::has_dynamic_reloc): New function replacing
3868         dynamic_reloc_count.  Change all callers.
3869         (Output_segment::has_dynamic_reloc_list): New function replacing
3870         dynamic_reloc_count_list.  Change all callers.
3871         (Output_segment::set_section_addresses): Rewrite.
3872         (Output_segment::set_offset): Rewrite.
3873         (Output_segment::find_first_and_last_list): Remove.
3874         (Output_segment::set_tls_offsets): Rewrite.
3875         (Output_segment::first_section_load_address): Likewise.
3876         (Output_segment::output_section_count): Likewise.
3877         (Output_segment::section_with_lowest_load_address): Likewise.
3878         (Output_segment::write_section_headers): Likewise.
3879         (Output_segment::print_sections_to_map): Likewise.
3880         * output.h (class Output_data): Remove dynamic_reloc_count_
3881         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3882         (Output_data::add_dynamic_reloc): Rewrite.
3883         (Output_data::has_dynamic_reloc): New function.
3884         (Output_data::dynamic_reloc_count): Remove.
3885         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3886         is_last_relro_, is_first_non_relro_, is_interp_,
3887         is_dynamic_linker_section_ fields.  Add order and set_order
3888         functions.  Remove is_relro_local, set_is_relro_local,
3889         is_last_relro, set_is_last_relro, is_first_non_relro,
3890         set_is_first_non_relro functions, is_interp, set_is_interp,
3891         is_dynamic_linker_section, and set_is_dynamic_linker_section
3892         functions.
3893         (class Output_segment): Change Output_data_list from std::list to
3894         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3895         output_bss_ fields.  Update declarations.
3896
3897 2010-08-02  Ian Lance Taylor  <iant@google.com>
3898
3899         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3900         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3901         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3902
3903 2010-08-02  Ian Lance Taylor  <iant@google.com>
3904
3905         PR 11855
3906         * script.cc (Script_options::Script_options): Initialize
3907         symbol_definitions_ and symbol_references_.
3908         (Script_options::add_symbol_assignment): Update
3909         symbol_definitions_ and symbol_references_.
3910         (Script_options::add_symbol_reference): New function.
3911         (script_symbol): New function.
3912         * script.h (class Script_options): Add symbol_definitions_ and
3913         symbol_references_ fields.
3914         (Script_options::referenced_const_iterator): New type.
3915         (Script_options::referenced_begin): New function.
3916         (Script_options::referenced_end): New function.
3917         (Script_options::is_referenced): New function.
3918         (Script_options::any_unreferenced): New function.
3919         * script-c.h (script_symbol): Declare.
3920         * yyscript.y (exp): Call script_symbol.
3921         * symtab.cc: Include "script.h".
3922         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3923         Change all callers.  Check symbols referenced by scripts.
3924         (Symbol_table::add_undefined_symbols_from_command_line): Add
3925         layout parameter.  Change all callers.
3926         (Symbol_table::do_add_undefined_symbols_from_command_line):
3927         Likewise.  Break out loop body.  Check symbols referenced by
3928         scripts.
3929         (Symbol_table::add_undefined_symbol_from_command_line): New
3930         function broken out of
3931         do_add_undefined_symbols_from_command_line.
3932         * symtab.h (class Symbol_table): Update declarations.
3933         * archive.cc: Include "layout.h".
3934         (Archive::should_include_member): Add layout parameter.  Change
3935         all callers.  Check for symbol mentioned in expression.
3936         * archive.h (class Archive): Update declaration.
3937         * object.cc (Sized_relobj::do_should_include_member): Add layout
3938         parameter.
3939         * object.h (Object::should_include_member): Add layout parameter.
3940         Change all callers.
3941         (Object::do_should_include_member): Add layout parameter.
3942         (class Sized_relobj): Update declaration.
3943         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3944         parameter.
3945         * dynobj.h (class Sized_dynobj): Update declaration.
3946         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3947         layout parameter.
3948         * plugin.h (class Sized_pluginobj): Update declaration.
3949
3950 2010-08-02  Ian Lance Taylor  <iant@google.com>
3951
3952         PR 11866
3953         * output.cc (Output_segment::set_offset): Search for the first and
3954         last sections rather than assuming that the list is in order.
3955         (Output_segment::find_first_and_last_list): New function.
3956         * output.h (class Output_segment): Update declarations.
3957         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3958         (relro_strip_test_SOURCES): New variable.
3959         (relro_strip_test_DEPENDENCIES): New variable.
3960         (relro_strip_test_LDFLAGS): New variable.
3961         (relro_strip_test_LDADD): New variable.
3962         (relro_strip_test.so): New target.
3963
3964 2010-08-02  Ian Lance Taylor  <iant@google.com>
3965
3966         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3967         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3968         (Target_i386::got_tlsdesc_section): New function.
3969         (Target_i386::got_section): Create space for GOT entries for
3970         TLSDESC relocations.
3971         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3972         R_386_TLS_GOTDESC.
3973         (Target_i386::Scan::global): Likewise.
3974         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3975         using TLSDESC GOT.
3976         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3977         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3978         (Target_x86_64::got_tlsdesc_section): New function.
3979         (Target_x86_64::got_section): Create space for GOT entries for
3980         TLSDESC relocations.
3981         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3982         R_386_TLS_GOTDESC.
3983         (Target_x86_64::Scan::global): Likewise.
3984         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3985         using TLSDESC GOT.
3986
3987 2010-08-02  Ian Lance Taylor  <iant@google.com>
3988
3989         * testsuite/final_layout.sh: Use dc to convert from hex to
3990         decimal.
3991
3992 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3993
3994         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3995         paramter to the call to gold::gc_process_relocs.
3996         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3997         paramter to the call to gold::gc_process_relocs.
3998         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3999         parameter to the call to gold::gc_process_relocs.
4000         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4001         template parameter to the call to gold::gc_process_relocs.
4002         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4003         paramter to the call to gold::gc_process_relocs.
4004         * gc.h (get_embedded_addend_size): New function.
4005         (gc_process_relocs): Save the size of the reloc for use by ICF.
4006         * icf.cc (get_section_contents): Get the addend from the text section
4007         for SHT_REL relocation sections.
4008         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4009         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4010         * int_encoding.h (read_from_pointer): New overloaded function.
4011         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4012         * testsuite/icf_sht_rel_addend_test.sh: New file.
4013         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4014         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4015
4016 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4017
4018         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4019         * Makefile.in: Regenerate.
4020         * testsuite/Makefile.in: Regenerate.
4021
4022 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4023
4024         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4025         * gold/testsuite/debug_msg.cc: Likewise.
4026         * gold/testsuite/odr_violation1.cc
4027         * gold/testsuite/odr_violation2.cc
4028
4029 2010-07-21  Cary Coutant  <ccoutant@google.com>
4030
4031         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4032         string, and length fields.
4033         (Output_merge_string::Merged_strings_list): New type.
4034         (Output_merge_string::Merged_strings_lists): New typedef.
4035         (Output_merge_string): Replace merged_strings_ with
4036         merged_strings_lists_.
4037         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4038         Merged_strings_list per input object and section.  Don't store pointer
4039         to the string.  Don't store length with each merged string entry.
4040         (Output_merge_string::finalize_merged_data): Loop over list of merged
4041         strings lists.  Recompute length of each merged string.
4042
4043 2010-07-15  Cary Coutant  <ccoutant@google.com>
4044
4045         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4046         here.
4047
4048 2010-07-14  Ian Lance Taylor  <iant@google.com>
4049
4050         * descriptors.cc (Descriptors::open): Report correct name in error
4051         message.
4052
4053 2010-07-13  Doug Kwan  <dougkwan@google.com>
4054
4055         * arm.cc (Arm_input_section::Arm_input_section): For a
4056         SHT_ARM_EXIDX section, always keeps the input sections.
4057         (Arm_input_section::set_exidx_section_link): New method.
4058         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4059         has_errors_ to false.
4060         (Arm_exidx_input_section::has_errors,
4061         Arm_exidx_input_section::set_has_errors): New methods.
4062         (Arm_exidx_input_section::has_errors_): New data member.
4063         (Arm_relobj::get_exidx_shndx_list): New method.
4064         (Arm_output_section::append_text_sections_to_list): Do not skip
4065         section without SHF_EXECINSTR.
4066         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4067         errors.
4068         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4069         section header.  Make error messages more verbose.  Check for
4070         a non-executable section linked to an EXIDX section.
4071         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4072         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4073         check that there is no deferred EXIDX section if we exit early.
4074         Instead of not making an EXIDX section in case of an error, make one
4075         and set the has_errors flag of it.
4076         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4077         in a relocatable link.
4078         (Target_arm::do_relax): Look for the EXIDX output section instead of
4079         assuming that it is called .ARM.exidx.
4080         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4081         section list.  Do not check for SHF_EXECINSTR section flags but
4082         skip any input section with errors.
4083         * output.cc (Output_section::Output_section): Initialize
4084         always_keeps_input_sections_ to false.
4085         (Output_section::add_input_section): Check for
4086         always_keeps_input_sections_.
4087         *  output.h (Output_section::always_keeps_input_sections,
4088         Output_section::set_always_keeps_input_sections): New methods.
4089         (Output_section::always_keeps_input_sections): New data member.
4090
4091 2010-07-13  Rafael Espindola  <espindola@google.com>
4092
4093         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4094         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4095
4096 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4097             Ian Lance Taylor  <iant@google.com>
4098
4099         * output.h (Output_section_lookup_maps::add_merge_section):
4100         Correct check of whether value was inserted.
4101         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4102         (Output_section_lookup_maps::add_relaxed_input_section):
4103         Likewise.
4104         * arm.cc (Target_arm::got_section): Remove used local os.
4105         * i386.cc (Target_i386::got_section): Likewise.
4106         * x86_64.cc (Target_x86_64::got_section): Likewise.
4107         * sparc.cc (Target_sparc::got_section): Likewise.
4108         (Target_sparc::relocate): Remove unused local have_got_offset.
4109         * powerpc.cc (Target_powerpc::relocate): Likewise.
4110
4111 2010-07-13  Ian Lance Taylor  <iant@google.com>
4112
4113         * compressed_output.cc (zlib_decompress): Fix signature in
4114         !HAVE_ZLIB_H case.
4115
4116         * archive.cc (Archive::include_member): Unlock an external member
4117         of a thin archive.  Don't bother to delete an object we know is
4118         NULL.
4119
4120 2010-07-12  Cary Coutant  <ccoutant@google.com>
4121
4122         * compressed_output.cc (zlib_decompress): New function.
4123         (get_uncompressed_size): New function.
4124         (decompress_input_section): New function.
4125         * compressed_output.h (get_uncompressed_size): New function.
4126         (decompress_input_section): New function.
4127         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4128         Handle compressed debug sections.
4129         * layout.cc (is_compressed_debug_section): New function.
4130         (Layout::output_section_name): Map compressed section names to
4131         canonical names.
4132         * layout.h (is_compressed_debug_section): New function.
4133         (is_debug_info_section): Recognize compressed debug sections.
4134         * merge.cc: Include compressed_output.h.
4135         (Output_merge_data::do_add_input_section): Handle compressed
4136         debug sections.
4137         (Output_merge_string::do_add_input_section): Handle compressed
4138         debug sections.
4139         * object.cc: Include compressed_output.h.
4140         (Sized_relobj::Sized_relobj): Initialize new data members.
4141         (build_compressed_section_map): New function.
4142         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4143         * object.h (Object::section_is_compressed): New method.
4144         (Object::do_section_is_compressed): New method.
4145         (Sized_relobj::Compressed_section_map): New type.
4146         (Sized_relobj::do_section_is_compressed): New method.
4147         (Sized_relobj::compressed_sections_): New data member.
4148         * output.cc (Output_section::add_input_section): Handle compressed
4149         debug sections.
4150         * reloc.cc: Include compressed_output.h.
4151         (Sized_relobj::write_sections): Handle compressed debug sections.
4152
4153 2010-07-08  Cary Coutant  <ccoutant@google.com>
4154
4155         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4156         weak when resolving to a dynamic def.
4157         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4158         for weak undef/dynamic def cases. Adjust callers.
4159         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4160         undef_binding_weak_.
4161         (Symbol_table::sized_write_globals): Adjust symbol binding.
4162         (Symbol_table::sized_write_symbol): Add binding parameter.
4163         * symtab.h (Symbol::set_undef_binding): New method.
4164         (Symbol::is_undef_binding_weak): New method.
4165         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4166         (Symbol_table::should_override): Add new parameter.
4167         (Symbol_table::sized_write_symbol): Add new parameter.
4168
4169         * testsuite/weak_undef_file1.cc: Add new test case.
4170         * testsuite/weak_undef_file2.cc: Fix header comment.
4171         * testsuite/weak_undef_test.cc: Add new test case.
4172
4173 2010-06-29  Doug Kwan  <dougkwan@google.com>
4174
4175         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4176         Initialize USE_SYMBOL_.
4177         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4178         definition.
4179         (Arm_reloc_property::uses_symbol_): New data member declaration.
4180         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4181         uses symbol value and symbol is undefined but not weakly undefined.
4182
4183 2010-06-28  Rafael Espindola  <espindola@google.com>
4184
4185         * plugin.cc (Plugin::load): Use dlerror.
4186
4187 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4188
4189         * symtab.cc (detect_odr_violations): When reporting an ODR
4190         violation, report an object where the symbol is defined.
4191
4192 2010-06-25  Doug Kwan  <dougkwan@google.com>
4193
4194         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4195         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4196         definition.
4197         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4198         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4199         target hook to detect function points.
4200         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4201         * icf.h (Icf::check_section_for_function_pointers): Change type of
4202         parameter SECTION_NAME to const reference to std::string.  Use
4203         target hook to determine if section may have unsafe pointers.
4204         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4205         method definition.
4206
4207 2010-06-21  Rafael Espindola  <espindola@google.com>
4208
4209         * fileread.cc (Input_file::find_fie): New
4210         (Input_file::open): Use Input_file::find_fie.
4211         * fileread.h (Input_file::find_fie): New
4212         * plugin.cc (set_extra_library_path): New.
4213         (Plugin::load): Add set_extra_library_path to the transfer vector.
4214         (Plugin_manager::set_extra_library_path): New.
4215         (Plugin_manager::add_input_file): Use the extra search path if set.
4216         (set_extra_library_path(): New.
4217         * plugin.h (Plugin_manager): Add set_extra_library_path and
4218         extra_search_path_.
4219
4220 2010-06-19  Cary Coutant  <ccoutant@google.com>
4221
4222         * layout.cc (gdb_sections): Add .debug_types.
4223         (lines_only_debug_sections): Likewise.
4224
4225 2010-06-18  Rafael Espindola  <espindola@google.com>
4226
4227         * plugin.cc (add_input_file,add_input_library)
4228         (Plugin_manager::add_input_file): Make filename arguments const.
4229         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4230         const.
4231
4232 2010-06-16  Doug Kwan  <dougkwan@google.com>
4233
4234         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4235         .ARM.attributes section if we have not merged any input
4236         attributes sections.
4237
4238 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4239
4240         * arm.cc: Allow combining objects with no EABI version
4241         information.
4242
4243 2010-06-15  Rafael Espindola  <espindola@google.com>
4244
4245         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4246
4247 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4248
4249         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4250         (struct iovec): Correct !HAVE_READV definition.
4251
4252 2010-06-10  Cary Coutant  <ccoutant@google.com>
4253
4254         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4255         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4256         reloc sections.
4257         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4258
4259         PR 11683
4260         * symtab.h (Symbol::is_placeholder): New member function.
4261         * target-reloc.h (relocate_section): Check for placeholder symbols.
4262
4263         * testsuite/Makefile.am (plugin_test_8): New test.
4264         (plugin_test_9): New test.
4265         * testsuite/Makefile.in: Regenerate.
4266
4267 2010-06-09  Nick Clifton  <nickc@redhat.com>
4268
4269         * yyscript.y (input_list_element): Allow strings prefixed with
4270         the '-' character.  Treat these as libraries.
4271         * script.cc (script_add_library): New function.  Adds a library
4272         specified by "-l<name>" found in an input script.
4273         * script-c.h: Add prototype for script_add_library.
4274
4275 2010-06-07  Doug Kwan  <dougkwan@google.com>
4276
4277         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4278         Restrict stub-group size to be within long conditional branch
4279         range when working around cortex-A8 erratum.
4280
4281 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4282
4283         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4284         #ifdef typo.
4285
4286 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4287
4288         PR gold/11658
4289         * output.cc
4290         (Output_section::Input_section_sort_entry::compare_section_ordering):
4291         Change to return non-zero correctly.
4292         (Output_section::Input_section_sort_section_order_index_compare
4293         ::operator()): Change to fix ambiguity in comparisons.
4294
4295 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4296
4297         * gold.h (is_wildcard_string): New function.
4298         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4299         (Layout::layout_eh_frame): Ditto.
4300         (Layout::find_section_order_index): New method.
4301         (Layout::read_layout_from_file): New method.
4302         * layout.h (Layout::find_section_order_index): New method.
4303         (Layout::read_layout_from_file): New method.
4304         (Layout::input_section_position_): New private member.
4305         (Layout::input_section_glob_): New private member.
4306         * main.cc (main): Call read_layout_from_file here.
4307         * options.h (--section-ordering-file): New option.
4308         * output.cc (Output_section::input_section_order_specified_): New
4309         member.
4310         (Output_section::Output_section): Initialize new member.
4311         (Output_section::add_input_section): Add new parameter.
4312         Keep input sections when --section-ordering-file is used.
4313         (Output_section::set_final_data_size): Sort input sections when
4314         section ordering file is specified.
4315         (Output_section::Input_section_sort_entry): Add new parameter.
4316         Check sorting type.
4317         (Output_section::Input_section_sort_entry::compare_section_ordering):
4318         New method.
4319         (Output_section::Input_section_sort_compare::operator()): Change to
4320         consider section_order_index.
4321         (Output_section::Input_section_sort_init_fini_compare::operator()):
4322         Change to consider section_order_index.
4323         (Output_section::Input_section_sort_section_order_index_compare
4324         ::operator()): New method.
4325         (Output_section::sort_attached_input_sections): Change to sort
4326         according to section order when specified.
4327         (Output_section::add_input_section<32, true>): Add new parameter.
4328         (Output_section::add_input_section<64, true>): Add new parameter.
4329         (Output_section::add_input_section<32, false>): Add new parameter.
4330         (Output_section::add_input_section<64, false>): Add new parameter.
4331         * output.h (Output_section::add_input_section): Add new parameter.
4332         (Output_section::input_section_order_specified): New
4333         method.
4334         (Output_section::set_input_section_order_specified): New method.
4335         (Input_section::Input_section): Initialize section_order_index_.
4336         (Input_section::section_order_index): New method.
4337         (Input_section::set_section_order_index): New method.
4338         (Input_section::section_order_index_): New member.
4339         (Input_section::Input_section_sort_section_order_index_compare): New
4340         struct.
4341         (Output_section::input_section_order_specified_): New member.
4342         * script-sections.cc (is_wildcard_string): Delete and move modified
4343         method to gold.h.
4344         (Output_section_element_input::Output_section_element_input): Modify
4345         call to is_wildcard_string.
4346         (Output_section_element_input::Input_section_pattern
4347         ::Input_section_pattern): Ditto.
4348         (Output_section_element_input::Output_section_element_input): Ditto.
4349         * testsuite/Makefile.am (final_layout): New test case.
4350         * testsuite/Makefile.in: Regenerate.
4351         * testsuite/final_layout.cc: New file.
4352         * testsuite/final_layout.sh: New file.
4353
4354 2010-06-01  Rafael Espindola  <espindola@google.com>
4355
4356         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4357
4358 2010-06-01  Rafael Espindola  <espindola@google.com>
4359
4360         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4361         visibility of symbols.
4362
4363 2010-05-27  Doug Kwan  <dougkwan@google.com>
4364
4365         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4366         from start of output section instead of address for a local symbol
4367         in a merged or relaxed section when doing a relocatable link.
4368
4369 2010-05-26  Rafael Espindola  <espindola@google.com>
4370
4371        PR 11604
4372         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4373         adding sections the garbage collector removed.
4374         * gold/testsuite/Makefile.am: Add test.
4375         * gold/testsuite/Makefile.in: Regenerate.
4376         * gold/testsuite/plugin_test_7.sh: New.
4377         * gold/testsuite/plugin_test_7_1.c: New.
4378         * gold/testsuite/plugin_test_7_2.c: New.
4379
4380 2010-05-26  Rafael Espindola  <espindola@google.com>
4381
4382         * script-sections.cc (Output_section_definition::set_section_addresses):
4383         Check for --section-start.
4384
4385 2010-05-26  Doug Kwan  <dougkwan@google.com>
4386
4387         * arm.cc (Arm_scan_relocatable_relocs): New class.
4388         (Target_arm::relocate_special_relocatable): New method.
4389         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4390         (Arm_relocate_functions::thumb_branch_common): Same.
4391         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4392         instead of Default_scan_relocatable_relocs.
4393         * target-reloc.h (relocate_for_relocatable): Let target handle
4394         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4395         * target.h (Sized_target::relocate_special_relocatable): New method.
4396
4397 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4398
4399         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4400
4401 2010-05-23  Doug Kwan  <dougkwan@google.com>
4402
4403         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4404         instead of a cast.
4405         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4406         with a direct branch, not a conditional branch, to a stub.
4407         * merge.cc (Output_merge_base::record_input_section): New method
4408         defintion.
4409         (Output_merge_data::do_add_input_section): Record input section if
4410         keeps-input-sections flag is set.
4411         (Output_merge_string::do_add_input_section): Ditto.
4412         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4413         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4414         INPUT_SECTIONS_.
4415         (Output_merge_base::keeps_input_sections,
4416         Output_merge_base::set_keeps_input_sections,
4417         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4418         method definitions.
4419         (Output_merge_base::Input_sections): New type declaration.
4420         (Output_merge_base::input_sections_begin,
4421         Output_merge_base::input_sections_end,
4422         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4423         (Output_merge_base::bool keeps_input_sections_,
4424         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4425         Output_merge_base::input_sections_): New data members.
4426         (Output_merge_data::do_set_keeps_input_sections): New method
4427         defintion.
4428         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4429         * output.cc (Output_section::Input_section::relobj): Move method
4430         defintion from class declaration to here and handle merge sections.
4431         (Output_section::Input_section::shndx): Ditto.
4432         (Output_section::Output_section): Remove initializations of removed
4433         data members and initialize new data member LOOKUP_MAPS_.
4434         (Output_section::add_input_section): Set keeps-input-sections flag
4435         for a newly created merge output section as appropriate.  Adjust code
4436         to use Output_section_lookup_maps class.
4437         (Output_section::add_relaxed_input_section): Adjst code for lookup
4438         maps code refactoring.
4439         (Output_section::add_merge_input_section): Add a new parameter
4440         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4441         class.  If adding input section to a newly created merge output
4442         section fails, remove the new merge section.
4443         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4444         Adjust code for use of the Output_section_lookup_maps class.
4445         (Output_section::find_merge_section): Ditto.
4446         (Output_section::build_lookup_maps): New method defintion.
4447         (Output_section::find_relaxed_input_section): Adjust code to use
4448         Output_section_lookup_maps class.
4449         (Output_section::get_input_sections): Export merge sections.  Adjust
4450         code to use Output_section_lookup_maps class.
4451         (Output_section:::add_script_input_section): Adjust code to use
4452         Output_section_lookup_maps class.  Update lookup maps for merge
4453         sections also.
4454         (Output_section::discard_states): Use Output_section_lookup_maps.
4455         (Output_section::restore_states): Same.
4456         * output.h (Merge_section_properties): Move class defintion out of
4457         Output_section.
4458         (Output_section_lookup_maps): New class.
4459         (Output_section::Input_section::is_merge_section): New method
4460         defintion.
4461         (Output_section::Input_section::relobj): Move defintion out of class
4462         defintion.  Declare method only.
4463         (Output_section::Input_section::shndx): Ditto.
4464         (Output_section::Input_section::output_merge_base): New method defintion.
4465         (Output_section::Input_section::u2_.pomb): New union field.
4466         (Output_section::Merge_section_by_properties_map,
4467         Output_section::Output_section_data_by_input_section_map,
4468         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4469         Remove types.
4470         (Output_section::add_merge_input_section): Add new parameter
4471         KEEPS_INPUT_SECTIONS.
4472         (Output_section::build_lookup_maps): New method declaration.
4473         (Output_section::merge_section_map_,
4474         Output_section::merge_section_by_properties_map_,
4475         Output_section::relaxed_input_section_map_,
4476         Output_section::is_relaxed_input_section_map_valid_): Remove data
4477         members.
4478         (Output_section::lookup_maps_): New data member.
4479
4480 2010-05-21  Doug Kwan  <dougkwan@google.com>
4481
4482         PR gold/11619
4483         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4484         avoid a compilation error.
4485
4486 2010-05-19  Rafael Espindola  <espindola@google.com>
4487
4488         * script-sections.cc (Output_section_definition::allocate_to_segment):
4489         Update the phdrs_list even when the output section is NULL.
4490         * testsuite/Makefile.am: Add test.
4491         * testsuite/Makefile.in: Regenerate.
4492         * testsuite/script_test_9.cc: New.
4493         * testsuite/script_test_9.sh: New.
4494         * testsuite/script_test_9.t: New.
4495
4496 2010-05-19  Doug Kwan  <dougkwan@google.com>
4497
4498         * arm.cc (Arm_input_section::original_size): New method.
4499         (Arm_input_section::do_addralign): Add a cast.
4500         (Arm_input_section::do_output_offset): Remove static cast.
4501         (Arm_input_section::original_addralign,
4502          Arm_input_section::original_size_): Change type to uint32_t.
4503         (Arm_input_section::init): Add safe casts for section alignment
4504         and size.
4505         (Arm_input_section::set_final_data_size): Do not set address and
4506         offset of stub table.
4507         (Arm_output_section::fix_exidx_coverage): Change use of of
4508         Output_section::Simple_input_section to that of
4509         Output_section::Input_section.
4510         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4511         except for the first pass.
4512         * output.cc (Output_section::get_input_sections): Change type of
4513         input_sections to std::list<Input_section>.
4514         (Output_section::add_script_input_section): Rename from
4515         Output_section::add_simple_input_section.  Change type of SIS
4516         parameter from Simple_input_section to Input_section.
4517         * output.h (Output_section::Simple_input_section): Remove class.
4518         (Output_section::Input_section): Change class visibility to public.
4519         (Output_section::Input_section::addralign): Use stored alignments
4520         for special input sections if set.
4521         (Output_section::Input_section::set_addralign): New method.
4522         (Output_section::get_input_sections): Change parameter type from
4523         list of Simple_input_section to list of Input_section.
4524         (Output_section::add_script_input_section): Rename from
4525         Output_section::add_simple_input_section. Change first parameter's
4526         type from Simple_input_section to Input_section and remove the
4527         second and third parameters.
4528         * script-sections.cc (Input_section::Input_section_list): Change
4529         type to list of Output_section::Input_section/
4530         (Input_section_info::Input_section_info): Change parameter type of
4531         INPUT_SECTION to Output_section::Input_section.
4532         (Input_section_info::input_section): Change return type.
4533         (Input_section_info::input_section_): Change type to
4534         Output_section::Input_section.
4535         (Output_section_element_input::set_section_addresses): Adjust code
4536         to use Output_section::Input_section instead of
4537         Output_section::Simple_input_section.  Adjust code for renaming
4538         of Output_section::add_simple_input_section.
4539         (Orphan_output_section::set_section_addresses): Ditto.
4540
4541 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4542
4543         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4544         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4545
4546 2010-05-18  Rafael Espindola  <espindola@google.com>
4547
4548         * options.cc (General_options::finalize): Handle -nostdlib.
4549         * options.h (nostdlib): New option.
4550         * script.cc (script_add_search_dir): Handle -nostdlib.
4551
4552 2010-05-12  Doug Kwan  <dougkwan@google.com>
4553
4554         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4555         attributes section only if there no attributes section after merging.
4556         (Target_arm::merge_object_attributes): Move value of
4557         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4558         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4559         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4560         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4561         and arm_attr_merge_7.stdout.
4562         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4563         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4564         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4565         arm_attr_merge_7b.o): New rules.
4566         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4567         arm_attr_merge_7
4568         * testsuite/Makefile.in: Regenerate.
4569         * testsuite/arm_attr_merge.sh: New file.
4570         * testsuite/arm_attr_merge_[67][ab].s: Same.
4571
4572 2010-05-05  Nick Clifton  <nickc@redhat.com>
4573
4574         * po/es.po: Updated Spanish translation.
4575
4576 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4577
4578         * Makefile.am (install-exec-local): Properly install gold as
4579         default cross linker.
4580         * Makefile.in: Regenerated.
4581
4582 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4583             Nick Clifton  <nickc@redhat.com>
4584
4585         * configure.ac (install_as_default): Define and set to false
4586         unless --enable-gold or --enable-gold=both/gold has been
4587         specified.
4588         * configure: Regenerate.
4589
4590         * Makefile.am (install-exec-local): Install the executable as
4591         'ld.gold'.  If install_as_default is true then also install it as
4592         'ld'.
4593         * Makefile.in: Regenerated.
4594
4595 2010-04-24  Ian Lance Taylor  <iant@google.com>
4596
4597         * layout.cc (Layout::layout_reloc): In relocatable link don't
4598         combine reloc sections for grouped sections.
4599
4600 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4601
4602         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4603         sections that are not ordinary to icf.
4604         * icf.cc (get_section_contents): Handle relocation pointing to section
4605         with no object or shndx information.
4606         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4607         * testsuite/Makefile.in: Regenerate.
4608         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4609         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4610
4611 2010-04-22  Ian Lance Taylor  <iant@google.com>
4612
4613         * expression.cc (Expression::Expression_eval_info): Add
4614         result_alignment_pointer field.
4615         (Expression::eval_with_dot): Add result_alignment_pointer
4616         parameter.  Change all callers.
4617         (Expression::eval_maybe_dot): Likewise.
4618         (class Binary_expression): Add alignment_pointer parameter to
4619         left_value and right_value.  Change all callers.
4620         (BINARY_EXPRESSION): Set result alignment.
4621         (class Trinary_expression): Add alignment_pointer parameter to
4622         arg2_value and arg3_value.  Change all callers.
4623         (Trinary_cond::value): Set result alignment.
4624         (Max_expression::value, Min_expression::value): Likewise.
4625         (Align_expression::value): Likewise.
4626         * script-sections.cc (class Sections_element): Add dot_alignment
4627         parameter to set_section_addresses virtual function.  Update
4628         instantiations.
4629         (class Output_section_element): Likewise.
4630         (Script_sections::create_segments): Add dot_alignment parameter.
4631         Change all callers.
4632         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4633         (Script_sections::set_phdrs_clause_addresses): Likewise.
4634         * script-sections.h: Update declarations.
4635         * script.h: Update declarations.
4636         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4637         min_p_align.
4638         * testsuite/script_test_3.t: Set large alignment.
4639         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4640         segment has expected alignment.
4641
4642 2010-04-22  Nick Clifton  <nickc@redhat.com>
4643
4644         * po/gold.pot: Updated by the Translation project.
4645         * po/vi.po: Updated Vietnamese translation.
4646
4647 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4648
4649         * testsuite/Makefile.am (check_PROGRAMS): Add
4650         icf_virtual_function_folding_test.
4651         * testsuite/Makefile.in: Regenerated.
4652
4653 2010-04-15  Andrew Haley  <aph@redhat.com>
4654
4655         * options.h (merge_exidx_entries): New option.
4656         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4657         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4658         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4659         (Target_arm::merge_exidx_entries): New function.
4660         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4661         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4662         to Arm_exidx_fixup constructor.
4663         Add new arg, merge_exidx_entries.
4664         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4665         Arm_output_section::fix_exidx_coverage.
4666
4667 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4668
4669         * icf.cc (get_section_contents): Check for preemptible functions.
4670         Ignore addend when appropriate.
4671         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4672         section folded.
4673         (add_from_relobj): Check for section folded.
4674         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4675         * symtab.h (should_add_dynsym_entry): Add new parameter.
4676         * target-reloc.h (scan_relocs): Check for section folded.
4677         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4678         Check reloc types for function pointers in shared objects.
4679         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4680         case.
4681         (icf_preemptible_functions_test): New test case.
4682         (icf_string_merge_test): New test case.
4683         * testsuite.Makefile.in: Regenerate.
4684         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4685         bar_glob.  Refactor code.
4686         * testsuite/icf_preemptible_functions_test.cc: New file.
4687         * testsuite/icf_preemptible_functions_test.sh: New file.
4688         * testsuite/icf_string_merge_test.cc: New file.
4689         * testsuite/icf_string_merge_test.sh: New file.
4690         * testsuite/icf_virtual_function_folding_test.cc: New file.
4691         * testsuite/icf_virtual_function_folding_test.sh: New file.
4692
4693 2010-04-14  Doug Kwan  <dougkwan@google.com>
4694
4695         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4696         for local symbol recounting if we remove a section due to ICF.
4697         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4698         there are no regular objects in input.
4699
4700 2010-04-13  Doug Kwan  <dougkwan@google.com>
4701
4702         * arm.cc (Arm_input_section::set_final_data_size): Compute
4703         accurate final data size instead of using current data size.
4704
4705 2010-04-09  Doug Kwan  <dougkwan@google.com>
4706
4707         * layout.cc (Layout::choose_output_section): Handle script section
4708         types.
4709         (Layout::make_output_section_for_script): Add section type parameter.
4710         Handle script section types.
4711         * layout.h (Layout::make_output_section_for_script): Add section
4712         type parameter.
4713         * output.cc (Output_section::Output_section): Initialize data member
4714         is_noload_.
4715         (Output_section::do_reset_address_and_file_offset): Do not set address
4716         to 0 if section is a NOLOAD section.
4717         * output.h (Output_section::is_noload): New method.
4718         (Output_section::set_is_noload): Ditto.
4719         (Output_section::is_noload_): New data member.
4720         * script-c.h (Script_section_type): New enum type.
4721         (struct Parser_output_section_header): Add new file section_type.
4722         * script-sections.cc (Sections_element::output_section_name): Add
4723         parameter for returning script section type.
4724         (Output_section_definition::output_section_name): Ditto.
4725         (Output_section_definition::section_type)P; New method.
4726         (Output_section_definiton::script_section_type_name): Ditto.
4727         (Output_section_definition::script_section_type_): New data member.
4728         (Output_section_definition::Output_section_definition): Initialize
4729         data member Output_section_definition::script_section_type_.
4730         (Output_section_definition::create_sections): Pass script section type
4731         to Layout::make_output_section_for_script.
4732         (Output_section_definition::output_section_name): Return script
4733         section type to caller.
4734         (Output_section_definition::set_section_address): Do not advance
4735         dot value and load address if section type is NOLOAD.  Set address
4736         of NOLOAD sections regardless of section flags.
4737         (Output_section_definition::print): Print section type if it is
4738         not SCRIPT_SECTION_TYPE_NONE.
4739         (Output_section_definition::section_type): New method.
4740         (Output_section_definition::script_section_type_name): Ditto.
4741         (Script_sections::output_section_name): Add new parameter
4742         PSECTION_TYPE for returning script section type.  Pass it to
4743         section elements.  Handle discard sections.
4744         (Sort_output_sections::operator()): Handle NOLOAD sections.
4745         * script-sections.h (Script_sections::Section_type): New enum type.
4746         (Script_sections::output_section_name): Add a new parameter for
4747         returning script section type.
4748         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4749         INFO and NOLOAD.
4750         * yyscript.y (union): Add new field SECTION_TYPE.
4751         (COPY, DSECT, INFO, NOLOAD): New tokens.
4752         (opt_address_and_section_type): Change type to output_section_header.
4753         (section_type): New non-terminal
4754         (section_header): Handle section type.
4755         (opt_address_and_section_type): Return section type value.
4756
4757 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4758
4759         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4760         * testsuite/plugin_common_test_2.c (foo): Likewise.
4761
4762 2010-04-08  Doug Kwan  <dougkwan@google.com>
4763
4764         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4765         Output_merge_data.
4766         * output.cc (Output_section::add_merge_input_section): Simplify
4767         code and return status of Output_merge_base::add_input_section.
4768         Update merge section map only if Output_merge_base::add_input_section
4769         returns true.
4770
4771 2010-04-07  Doug Kwan  <dougkwan@google.com>
4772
4773         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4774         if section is marked as containing instructions but has no mapping
4775         symbols.
4776         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4777         correct section index.
4778         (Arm_relobj::find_linked_text_section): Ditto.
4779
4780 2010-04-07  Cary Coutant  <ccoutant@google.com>
4781
4782         * archive.cc (include_member): Destroy Read_symbols_data object before
4783         releasing file.
4784         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4785         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4786         (Read_symbols_data::~Read_symbols_data) New destructor.
4787         (Section_relocs::Section_relocs) New constructor.
4788         (Section_relocs::~Section_relocs) New destructor.
4789         (Read_relocs_data::Read_relocs_data) New constructor.
4790         (Read_relocs_data::~Read_relocs_data) New destructor.
4791         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4792         pointers to NULL after deleting.
4793
4794 2010-04-07  Doug Kwan  <dougkwan@google.com>
4795
4796         * arm.cc: Replace "endianity" with "endianness" in comments.
4797         (Arm_exidx_cantunwind): Ditto.
4798         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4799         (Arm_relobj::merge_flags_and_attributes): New method.
4800         (Arm_relobj::merge_flags_and_attributes_): New data member.
4801         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4802         (Arm_relobj::scan_sections_for_stubs): Ditto.
4803         (Arm_relobj::do_read_symbols): Check to see if we really want to
4804         merge processor-specific flags and attributes.  Exit early if
4805         an object is empty except for section names and the undefined symbol.
4806         (Target_arm::do_finalize_sections): Move check for ELF format to
4807         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4808         attributes from a regular object only when we have determined that
4809         it is aapropriate.  Do not create an .ARM.attributes section in
4810         output if there is no regular input object.
4811         (Target_arm::merge_processor_specific_flags): Check
4812         --warn-mismatch before printing any error.
4813         (Target_arm::merge_object_attributes): Ditto.
4814         * gold.cc (queue_middle_tasks): Handle the case in which there is
4815         no regular object in input.
4816         * options.cc (General_options::parse_EB): New method.
4817         (General_options::parse_EL): Same.
4818         (General_options::General_options): Initialize endianness_.
4819         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4820         New options.
4821         (General_options::Endianness): New enum.
4822         (General_options::endianness): New method.
4823         (General_options::endianness_): New data member.
4824         * parameters.cc (Parameters::set_options): Check target endianness.
4825         (Parameters::set_target_once): Ditto.
4826         (Parameters::check_target_endianness): New method.
4827         (parameters_force_valid_target): If either -EL or -EB is specified,
4828         use it to define endianness of default target.
4829         * parameters.h (Parameters::check_target_endianness): New method
4830         declaration.
4831         * target.h (class Target): Change "endianity" to "endianness"
4832         in comments.
4833
4834 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4835
4836         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4837         * configure: Regenerate.
4838         * Makefile.in: Regenerate.
4839         * testsuite/Makefile.in: Regenerate.
4840
4841 2010-04-06  Cary Coutant  <ccoutant@google.com>
4842
4843         gcc PR lto/42757
4844         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4845         prevailing definitions of common symbols.
4846         * testsuite/plugin_test_6.sh: New test case.
4847         * testsuite/plugin_common_test_1.c: New test case.
4848         * testsuite/plugin_common_test_2.c: New test case.
4849         * testsuite/Makefile.am (plugin_test_6): New test case.
4850         * testsuite/Makefile.in: Regenerate.
4851
4852 2010-04-06  Nick Clifton  <nickc@redhat.com>
4853
4854         * po/vi.po: New Vietnamese translation.
4855
4856 2010-03-30  Doug Kwan  <dougkwan@google.com>
4857
4858         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4859
4860 2010-03-25  Doug Kwan  <dougkwan@google.com>
4861
4862         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4863         to avoid a conversion warning on a 32-bit host.
4864
4865 2010-03-24  Ian Lance Taylor  <iant@google.com>
4866
4867         * testsuite/script_test_3.t: Add a TLS segment.
4868         * testsuite/Makefile.am (check_PROGRAMS): Add
4869         tls_phdrs_script_test.
4870         (tls_phdrs_script_test_SOURCES): Define.
4871         (tls_phdrs_script_test_DEPENDENCIES): Define.
4872         (tls_phdrs_script_test_LDFLAGS): Define.
4873         (tls_phdrs_script_test_LDADD): Define.
4874         * testsuite/Makefile.in: Rebuild.
4875
4876 2010-03-23  Cary Coutant  <ccoutant@google.com>
4877
4878         * fileread.cc (find_or_make_view): Fix comment.
4879
4880 2010-03-23  Ian Lance Taylor  <iant@google.com>
4881
4882         * script-sections.cc (class Orphan_section_placement): Define
4883         PLACE_TLS and PLACE_TLS_BSS.
4884         (Orphan_section_placement::Orphan_section_placement): Initialize
4885         new places.
4886         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4887         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4888         (tls_script_test_SOURCES): Define.
4889         (tls_script_test_DEPENDENCIES): Define.
4890         (tls_script_test_LDFLAGS): Define.
4891         (tls_script_test_LDADD): Define.
4892         * testsuite/Makefile.in: Rebuild.
4893
4894 2010-03-22  Doug Kwan  <dougkwan@google.com>
4895
4896         * arm.cc (Arm_relocate_functions::abs8,
4897         Arm_relocate_functions::abs16): Use correct check for overflow
4898         specified in the ARM ELF specs.
4899         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4900         target of a BLX instruction specially.
4901         (Reloc_stub::stub_type_for_reloc): Ditto.
4902         (Relocate::relocate): Use symbolic names instead of numeric relocation
4903         codes to report error.
4904         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4905         workaround.
4906         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4907         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4908         thumb2_blx_out_of_range.stdout
4909         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4910         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4911         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4912         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4913         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4914         thumb2_blx_in_range, thumb2_blx_in_range.o,
4915         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4916         thumb2_blx_out_of_range.o): New rules.
4917         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4918         thumb2_blx_in_range and thumb2_blx_out_of_range.
4919         * testsuite/Makefile.in: Regenerate.
4920         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4921         * testsuite/thumb_blx_in_range.s: New file.
4922         * testsuite/thumb_blx_out_of_range.s: New file.
4923
4924 2010-03-22  Rafael Espindola  <espindola@google.com>
4925
4926         * archive.cc (Should_include): Move to archive.h.
4927         (should_include_member): Make it a member of Archive.
4928         (Lib_group): New.
4929         (Add_lib_group_symbols): New.
4930         * archive.h: Include options.h.
4931         (Archive_member): Moved from Archive.
4932         (Should_include): Moved from archive.cc.
4933         (Lib_group): New.
4934         (Add_lib_group_symbols): New.
4935         * dynobj.cc (do_should_include_member): New.
4936         * dynobj.h (do_should_include_member): New.
4937         * gold.cc (queue_initial_tasks): Update call to queue.
4938         * main.cc (main): Print lib group stats.
4939         * object.cc (do_should_include_member): New.
4940         * object.h: Include archive.h.
4941         (Object::should_include_member): New.
4942         (Object::do_should_include_member): New.
4943         (Sized_relobj::do_should_include_member): New.
4944         * options.cc (General_options::parse_start_lib): New.
4945         (General_options::parse_end_lib): New.
4946         (Input_arguments::add_file): Handle lib groups.
4947         (Input_arguments::start_group): Check we are not in a lib.
4948         (Input_arguments::start_lib): New.
4949         (Input_arguments::end_lib): New.
4950         * options.h (General_options): Add start_lib and end_lib.
4951         (Input_argument::lib_): New.
4952         (Input_argument::lib): New.
4953         (Input_argument::is_lib): New.
4954         (Input_file_lib): New.
4955         (Input_arguments::in_lib_): New.
4956         (Input_arguments::in_lib): New.
4957         (Input_arguments::start_lib): New.
4958         (Input_arguments::end_lib_): New.
4959         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4960         in unused members as preempted.
4961         (Sized_pluginobj::do_should_include_member): New.
4962         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4963         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4964         return the blocker.
4965         (Read_symbols::do_whole_lib_group): New.
4966         (Read_symbols::do_lib_group): New.
4967         (Read_symbols::do_read_symbols): Handle lib groups.
4968         (Read_symbols::get_name): Handle lib groups.
4969         * readsyms.h (Read_symbols): Add an archive member pointer.
4970         (Read_symbols::do_whole_lib_group): New.
4971         (Read_symbols::do_lib_group): New.
4972         (Read_symbols::member_): New.
4973         * script.cc (read_input_script): Update call to queue_soon.
4974
4975 2010-03-19  Doug Kwan  <dougkwan@google.com>
4976
4977         * arm.cc (Stub_table::Stub_table): Initialize new data members
4978         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4979         (Stub_table::add_reloc_stub): Assign stub offset and update
4980         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4981         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4982         New data members.
4983         (Stub_table::update_data_size_and_addralign): Use
4984         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4985         instead of going over all reloc stubs.
4986         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4987         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4988         Stringpool_template::offset_ to size of Stringpool_char.
4989         (Stringpool_template::new_key_offset): Remove code to initialize
4990         Stringpool_template::offset_.
4991         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4992         Stringpool_template::offset_ to zero.
4993
4994 2010-03-15  Doug Kwan  <dougkwan@google.com>
4995
4996         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4997         offset_.
4998         (Stringpool_template::new_key_offset): New method.
4999         (Stringpool_template::add_string): Assign offsets when adding new
5000         strings.
5001         (Stringpool_template::set_string_offsets): Do not set string offsets
5002         when not optimizing.
5003         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5004         member size_.
5005         (Chunked_vector::clear): Clear size_.
5006         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5007         (Chunked_vector::size): Return size_.
5008         (Chunked_vector::push_back): Use size_ to find insert position.
5009         (Chunked_vector::size_): New data member.
5010         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5011         (Stringpool_template::new_key_offset): New method declaration.
5012         (Stringpool_template::offset_): New data member.
5013
5014 2010-03-15   Rafael Espindola  <espindola@google.com>
5015
5016         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5017         Add_symbols' constructor.
5018         * readsyms.h (Add_symbols): Remove the input_group member.
5019
5020 2010-03-10  Ian Lance Taylor  <iant@google.com>
5021
5022         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5023         target to ask whether a reference to a symbol requires a stack
5024         split.
5025         * target.h (Target::is_call_to_non_split): New function.
5026         (Target::do_is_call_to_non_split): Declare virtual function.
5027         * target.cc: Include "symtab.h".
5028         (Target::do_is_call_to_non_split): New function.
5029         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5030
5031 2010-03-10  Cary Coutant  <ccoutant@google.com>
5032
5033         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5034         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5035         (File_read::open[2]): Add whole_file_view_ to list of views.
5036         (File_read::make_view): Remove test of whole_file_view_.
5037         (File_read::find_or_make_view): Create whole_file_view_ if
5038         necessary.
5039         (File_read::clear_views): Replace bool parameter with enum;
5040         adjust all callers.  Don't delete views with permanent data;
5041         do delete cached views and views from archives if
5042         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5043         if clearing the corresponding view.
5044         * fileread.h (File_read::Clear_views_mode): New enum.
5045         (File_read::View::is_permanent_view): New method.
5046         (File_read::clear_views): Replace bool parameter
5047         with enum; adjust all callers.
5048         * options.h (General_options): Change keep_files_mapped option;
5049         add map_whole_files.
5050         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5051         releasing the file.
5052         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5053         the file.
5054
5055 2010-03-10  David S. Miller  <davem@davemloft.net>
5056
5057         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5058
5059 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5060
5061         * icf.cc (get_section_contents): Add '@' marker after processing the
5062         merge reloc.
5063
5064 2010-03-08  Doug Kwan  <dougkwan@google.com>
5065
5066         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5067         due to a conversion warning.
5068         (Arm_relobj::update_output_local_symbol_count): Check for local
5069         symbol with unset output index.
5070
5071 2010-03-05  Ian Lance Taylor  <iant@google.com>
5072
5073         * options.h (class General_options): Add --spare-dynamic-tags.
5074         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5075         --spare-dynamic-tags.
5076
5077 2010-03-05  Ian Lance Taylor  <iant@google.com>
5078
5079         * incremental.cc: Include "libiberty.h".
5080
5081 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5082
5083         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5084         function, is_info_ member.
5085         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5086         (Versions::Versions): Update caller.
5087         (Versions::define_base_version): Likewise.
5088         (Versions::add_def): Likewise.
5089
5090 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5091
5092         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5093         (Scan::possible_function_pointer_reloc): New function.
5094         (Scan::local_reloc_may_be_function_pointer): Change to call
5095         possible_function_pointer_reloc.
5096         (Scan::global_reloc_may_be_function_pointer): Ditto.
5097         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5098         relocations in ".data.rel.ro._ZTV" section.
5099         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5100         * testsuite/icf_safe_so_test.cc: Ditto.
5101         * testsuite/icf_safe_test.cc: Ditto.
5102         * testsuite/icf_safe_test.sh: Ditto.
5103
5104 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5105             Ian Lance Taylor  <iant@google.com>
5106
5107         * target-reloc.h (relocate_section): Check the symbol table index
5108         for -1U before setting the local symbol index.
5109         (scan_relocatable_relocs): If copying the relocation, record that
5110         the local symbol is required.
5111         * object.h (Symbol_value::is_output_symtab_index_set): New
5112         function.
5113         (Symbol_value::may_be_discarded_from_output_symtab): New
5114         function.
5115         (Symbol_value::has_output_symtab_entry): New function.
5116         (Symbol_value::needs_output_symtab_entry): Remove.
5117         (Symbol_value::output_symtab_index): Make sure the symbol index is
5118         set.
5119         (Symbol_value::set_output_symtab_index): Make sure the symbol
5120         index is not set.  Make sure the new index is valid.
5121         (Symbol_value::set_must_have_output_symtab_entry): New function.
5122         (Symbol_value::has_output_dynsym_entry): New function.
5123         (Symbol_value::set_output_dynsym_index): Make sure the new index
5124         is valid.
5125         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5126         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5127         local symbol if permitted.
5128         (Sized_relobj::do_finalize_local_symbols): Call
5129         is_output_symtab_index_set rather than needs_output_symtab_entry.
5130         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5131         rather than needs_output_symtab_entry.  Call
5132         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5133         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5134         is_output_symtab_index_set rather than needs_output_symtab_entry.
5135         * testsuite/discard_locals_relocatable_test.c: New file.
5136         * testsuite/discard_locals_test.sh: Test -r.
5137         * testsuite/Makefile.am (check_DATA): Add
5138         discard_locals_relocatable_test1.syms,
5139         discard_local_relocatable_test2.syms.
5140         (MOSTLYCLEANFILES): Likewise.  Also add
5141         discard_locals_relocatable_test1.lout and
5142         discard_locals_relocatable_test2.out.
5143         (discard_locals_relocatable_test1.syms): New target.
5144         (discard_locals_relocatable_test.o): New target.
5145         (discard_locals_relocatable_test1.out): New target.
5146         (discard_locals_relocatable_test2.syms): New target.
5147         (discard_locals_relocatable_test2.out): New target.
5148         (various): Add missing ../ld-new dependencies.
5149         * testsuite/Makefile.in: Rebuild.
5150
5151 2010-03-03  Nick Clifton  <nickc@redhat.com>
5152
5153         * po/fi.po: New Finnish translation.
5154
5155 2010-03-01  Doug Kwan  <dougkwan@google.com>
5156
5157         * layout.cc (Layout::Layout): Force section types of .init_array*,
5158         .preinit_array* and .fini_array* sections.
5159         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5160         Fix check of return value of std::string::find.().
5161         (Output_section::Input_section_sort_compare::operator()): Remove
5162         comment about .init_array.
5163         (Output_section::Input_section_sort_init_fini_compare::operator()):
5164         New method.
5165         (Output_section::sort_attached_input_sections): Handle .init_array
5166         and .fini_array specially.
5167         * output.h (Output_section::Inut_section_sort_compare): Update
5168         comment.
5169         (Output_section::Input_section_sort_init_fini_compare): New struct.
5170
5171 2010-02-26  Doug Kwan  <dougkwan@google.com>
5172
5173         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5174         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5175         * testsuite/debug_msg.sh: Avoid matching source line number for
5176         use of global variable undef_int.
5177
5178 2010-02-26  Doug Kwan  <dougkwan@google.com>
5179
5180         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5181         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5182         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5183         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5184         * options.cc (General_options::General_options): Initialize member
5185         fix_v4bx_.
5186         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5187         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5188         and rm_no_fix_v4bx.stdout
5189         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5190         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5191         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5192         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5193         and arm_no_fix_v4bx.
5194         * Makefile.in: Regenerate.
5195         * testsuite/arm_fix_v4bx.s: New file.
5196         * testsuite/arm_fix_v4bx.sh: Ditto.
5197
5198 2010-02-24  Doug Kwan  <dougkwan@google.com>
5199
5200         * arm.cc (Target_arm::got_section): Make the .got section the first
5201         non RELRO section in the data segment.
5202         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5203         suffixes of section names.
5204
5205 2010-02-24  Doug Kwan  <dougkwan@google.com>
5206
5207         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5208         flags and attributes merging if an input file is a binary file.
5209         * fileread.cc (Input_file::open): Record format of original file.
5210         * fileread.h (Input_file::Format): New enum type.
5211         (Input_file::Input_file): Initialize data member format_.
5212         (Input_file::format): New method definition.
5213         (Input_file::format_):: New data member.
5214
5215 2010-02-24  Doug Kwan  <dougkwan@google.com>
5216
5217         * arm.cc (Arm_output_data_got): New class.
5218         (ARM_TCB_SIZE): New constant
5219         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5220         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5221         If user uses a script with a SECTIONS clause, issue only a warning
5222         for a misplaced EXIDX input section.  Otherwise, issue an error.
5223         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5224         garbage collection.
5225         (Target_arm::got_mode_index_entry): Handle static linking.
5226         (Target_arm::Scan::local): Ditto.
5227         (Target_arm::Scan::global): Ditto.
5228         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5229         all incorrectly implemented relocations.
5230         (Target_arm::fix_exidx_coverage): Pass layout to
5231         Arm_output_section::fix_exidx_coverage.
5232         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5233         from ".ARM.exidx." and ".ARM.extab.".
5234
5235 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5236
5237         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5238         section if it does not already exist.
5239         * attributes.cc (Attributes_section_data::Attributes_section_data):
5240         Don't crash if size is zero.
5241
5242 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5243             Ian Lance Taylor  <iant@google.com>
5244
5245         * gold.cc (queue_middle_tasks): If no input files were opened,
5246         exit.
5247         * workqueue.h (Task_function::Task_function): Assert that there is
5248         a blocker.
5249
5250 2010-02-22  Doug Kwan  <dougkwan@google.com>
5251
5252         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5253         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5254         types to avoid warnings due to different uint64_t implementations
5255         on different hosts.
5256
5257 2010-02-21  Doug Kwan  <dougkwan@google.com>
5258
5259         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5260         handling of the maximum backward branch offset.
5261         (Arm_relocate_functions::thumb_branch_common): Ditto.
5262         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5263         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5264         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5265         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5266         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5267         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5268         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5269         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5270         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5271         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5272         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5273         thumb2_bl_out_of_range.o): New rules.
5274         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5275         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5276         thumb2_bl_out_of_range
5277         * testsuite/Makefile.in: Regenerate.
5278         * testsuite/arm_bl_in_range.s: New file.
5279         * testsuite/arm_bl_out_of_range.s: Ditto.
5280         * testsuite/arm_branch_in_range.sh: Ditto.
5281         * testsuite/arm_branch_range.t: Ditto.
5282         * testsuite/thumb2_branch_range.t: Ditto.
5283         * testsuite/thumb_bl_in_range.s: Ditto.
5284         * testsuite/thumb_bl_out_of_range.s: Ditto.
5285         * testsuite/thumb_branch_range.t: Ditto.
5286
5287 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5288
5289         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5290         Add reloc offset information.
5291         * icf.cc (get_section_contents): Change iterators to point to the new
5292         vectors. Add reloc offset information to the contents.
5293         * icf.h (Icf::Sections_reachable_info): New typedef.
5294         (Icf::Sections_reachable_list): New typedef.
5295         (Icf::Offset_info): New typedef.
5296         (Icf::Reloc_info): New struct typedef.
5297         (Icf::Reloc_info_list): New typedef.
5298         (Icf::symbol_reloc_list): Delete method.
5299         (Icf::addend_reloc_list): Delete method.
5300         (Icf::section_reloc_list): Delete method.
5301         (Icf::reloc_info_list): New method.
5302         (Icf::reloc_info_list_): New member.
5303
5304 2010-02-19  Doug Kwan  <dougkwan@google.com>
5305
5306         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5307         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5308         * arm.cc (Arm_relocation_functions): New forward declaration.
5309         (Target_arm::Target_arm): Initialize new data members
5310         got_mod_index_offset_ and tls_base_symbol_defined_.
5311         (Target_arm::Relocate::relocate_tls): New method.
5312         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5313          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5314         New methods.
5315         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5316         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5317         (Target_arm::got_mod_index_offset_,
5318         Target_arm::tls_base_symbol_defined_): New data members.
5319         (Target_arm::Scan::local, Target::Scan::global,
5320         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5321         relocations.
5322
5323 2010-02-18  Doug Kwan  <dougkwan@google.com>
5324
5325         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5326         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5327         text section as a parameter becuase some broken tools may not set
5328         the link in section header.
5329         (Target_arm::has_got_section): New method.
5330         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5331         without any mapping symbol as data only.  Remove warning.
5332         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5333         link in its section header, try to discover the link by inspecting the
5334         REL31 relocation at the beginning of the section.
5335         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5336         in error message.
5337         (Target_arm::Scan::global): Treat any reference to the symbol
5338         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5339
5340 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5341
5342         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5343         (Scan::global_reloc_may_be_function_pointer): New function.
5344         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5345         (Scan::global_reloc_may_be_function_pointer): New function.
5346         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5347         (Scan::global_reloc_may_be_function_pointer): New function.
5348         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5349         (Scan::global_reloc_may_be_function_pointer): New function.
5350         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5351         (Scan::global_reloc_may_be_function_pointer): New function.
5352         (Scan::possible_function_pointer_reloc): New function.
5353         (Target_x86_64::can_check_for_function_pointers): New function.
5354         * gc.h (gc_process_relocs): Scan relocation types to determine if
5355         function pointers were taken for targets that support it.
5356         * icf.cc (Icf::find_identical_sections): Include functions for
5357         folding in safe ICF whose pointer is not taken.
5358         * icf.h (Secn_fptr_taken_set): New typedef.
5359         (fptr_section_id_): New member.
5360         (section_has_function_pointers): New function.
5361         (set_section_has_function_pointers): New function.
5362         (check_section_for_function_pointers): New function.
5363         * options.h: Fix comment for safe ICF option.
5364         * target.h (can_check_for_function_pointers): New function.
5365         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5366         Modify icf_safe_test for X86-64.
5367         * testsuite/Makefile.in: Regenerate.
5368         * testsuite/icf_safe_so_test.cc: New file.
5369         * testsuite/icf_safe_so_test.sh: New file.
5370         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5371         (main): Change to take pointer to function kept_func_3.
5372         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5373         folding is done correctly for X86-64.
5374
5375 2010-02-12  David S. Miller  <davem@davemloft.net>
5376
5377         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5378         is_symbolless parameter.
5379         (Output_reloc<SHT_REL>::is_symbolless): New.
5380         (Output_reloc<SHT_REL>::is_symbolless_): New.
5381         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5382         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5383         (Output_reloc<SHT_RELA>::is_symbolless): New.
5384         (Output_data_reloc::add_global): Handle is_symbolless.
5385         (Output_data_reloc::add_global_relative): Likewise.
5386         (Output_data_reloc::add_local): Likewise.
5387         (Output_data_reloc::add_local_relative): Likewise.
5388         (Output_data_reloc::add_symbolless_global_addend): New.
5389         (Output_data_reloc::add_symbolless_local_addend): New.
5390         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5391         is_symbolless.
5392         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5393         instead of ->is_relative_
5394         (Output_reloc::write): Likewise.
5395         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5396         (Output_reloc::write_rel): Simplify.
5397
5398         * sparc.cc (Target_sparc::Scan::local): Use
5399         ->add_symbolless_local_addend as needed.
5400         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5401         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5402         based upon relocation offset.
5403
5404 2010-02-11  Doug Kwan  <dougkwan@google.com>
5405
5406         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5407         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5408         beginning of function.
5409         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5410         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5411         parameter is_32bit in calls to should_apply_static_reloc.
5412         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5413         (check_DATA): Add arm_abs_global.stdout.
5414         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5415         arm_abs_global.stdout): New rules.
5416         (MOSTLLYCLEANFILES): Add arm_abs_global
5417         * Makefile.in: Regenerate.
5418         * testsuite/arm_abs_global.s: New file.
5419         * testsuite/arm_abs_global.sh: Ditto.
5420         * testsuite/arm_abs_lib.s: Ditto.
5421
5422 2010-02-11  Ian Lance Taylor  <iant@google.com>
5423
5424         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5425         Read_relocs task.
5426         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5427         Allocate_commons_task first.
5428         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5429         task, rather than symtab_lock_.
5430         (Gc_process_relocs::~Gc_process_relocs): New function.
5431         (Gc_process_relocs::is_runnable): Check this_blocker_.
5432         (Gc_process_relocs::locks): Use next_blocker_ rather than
5433         blocker_.
5434         (Scan_relocs::~Scan_relocs): New function.
5435         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5436         symtab_lock_.
5437         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5438         next_blocker_.
5439         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5440         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5441         constructor accordingly.
5442         (class Gc_process_relocs): Likewise.
5443         (class Scan_relocs): Likewise.
5444         * common.h (class Allocate_commons_task): Remove symtab_lock_
5445         field, and corresponding constructor parameter.
5446         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5447         symtab_lock_.
5448         (Allocate_commons_task::locks): Likewise.
5449
5450 2010-02-11  Ian Lance Taylor  <iant@google.com>
5451
5452         * gold-threads.h (class Once): Define.
5453         (class Initialize_lock): Rewrite as child of Once.
5454         * gold-threads.cc (class Once_initialize): Define.
5455         (once_pointer_control): New static variable.
5456         (once_pointer, once_arg): New static variables.
5457         (c_run_once): New static function.
5458         (Once::Once, Once::run_once, Once::internal_run): New functions.
5459         (class Initialize_lock_once): Remove.
5460         (initialize_lock_control): Remove.
5461         (initialize_lock_pointer): Remove.
5462         (initialize_lock_once): Remove.
5463         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5464         (Initialize_lock::initialize): Rewrite.
5465         (Initialize_lock::do_run_once): New function.
5466         * archive.cc (Archive::interpret_header): Only clear name if it is
5467         not already empty.
5468         * fileread.cc: Include "gold-threads.h"
5469         (file_counts_lock): New static variable.
5470         (file_counts_initialize_lock): Likewise.
5471         (File_read::release): Only increment counts when using --stats.
5472         Use a lock around the increment.
5473         * parameters.cc (class Set_parameters_target_once): Define.
5474         (set_parameters_target_once): New static variable.
5475         (Parameters::Parameters): Move here from parameters.h.
5476         (Parameters::set_target): Rewrite.
5477         (Parameters::set_target_once): New function.
5478         (Parameters::clear_target): Move here and rewrite.
5479         * parameters.h (class Parameters): Update declarations.  Add
5480         set_parameters_target_once_ field.
5481         (Parameters::Parameters): Move to parameters.cc.
5482         (Parameters::clear_target): Likewise.
5483         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5484         task.
5485         (Start_group::~Start_group): New function.
5486         (Start_group::is_runnable): New function.
5487         (Start_group::locks, Start_group::run): New functions.
5488         (Finish_group::run): Change saw_undefined to size_t.
5489         * readsyms.h (class Start_group): Define.
5490         (class Finish_group): Change saw_undefined_ field to size_t.
5491         (Finish_group::Finish_group): Remove saw_undefined and
5492         this_blocker parameters.  Change all callers.
5493         (Finish_group::set_saw_undefined): New function.
5494         (Finish_group::set_blocker): New function.
5495         * symtab.h (class Symbol_table): Change saw_undefined to return
5496         size_t.  Change saw_undefined_ field to size_t.
5497         * target-select.cc (Set_target_once::do_run_once): New function.
5498         (Target_selector::Target_selector): Initialize set_target_once_
5499         field.  Don't initialize lock_ and initialize_lock_ fields.
5500         (Target_selector::instantiate_target): Rewrite.
5501         (Target_selector::set_target): New function.
5502         * target-select.h (class Set_target_once): Define.
5503         (class Target_selector): Update declarations.  Make
5504         Set_target_once a friend.  Remove lock_ and initialize_lock_
5505         fields.  Add set_target_once_ field.
5506
5507 2010-02-10  Ian Lance Taylor  <iant@google.com>
5508
5509         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5510         queueing any tasks.
5511         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5512         (queue_middle_tasks): Add all blockers before queueing any tasks.
5513         (queue_final_tasks): Likewise.
5514         * token.h (Task_token::add_blockers): New function.
5515         * object.h (Input_objects::number_of_relobjs): New function.
5516
5517 2010-02-10  Ian Lance Taylor  <iant@google.com>
5518
5519         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5520         shared, not if not position independent.
5521         * x86_64.cc (Relocate::relocate_tls): Likewise.
5522         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5523         (tls_pie_pic_test): New target.
5524         * testsuite/Makefile.in: Rebuild.
5525
5526         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5527         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5528         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5529         * testsuite/Makefile.in: Rebuild.
5530
5531 2010-02-09  David S. Miller  <davem@davemloft.net>
5532
5533         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5534         R_SPARC_RELATIVE using ->add_local_relative().
5535         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5536
5537         * output.h (Output_data_dynamic::add_section_size): New method
5538         that takes two Output_data objects.
5539         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5540         entry param.  Handle it in initializers.
5541         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5542         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5543         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5544         arg.
5545         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5546         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5547         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5548         for dynrel_includes_plt.
5549         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5550         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5551         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5552         before .rela.plt
5553         (Target_sparc::do_finalize_sections): Update to pass true for
5554         dynrel_includes_plt.
5555         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5556         output before .rela.plt
5557         (Target_powerpc::do_finalize_sections): Update to pass true for
5558         dynrel_includes_plt when 32-bit.
5559
5560 2010-02-08  Doug Kwan  <dougkwan@google.com>
5561
5562         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5563         method.
5564         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5565         Arm_relobj::scan_section_for_cortex_a8_stubs,
5566         Arm_relobj::do_relocation_section): Instead of calling
5567         Output_section::output_address, use faster
5568         Arm_relobj::simple_input_section_output_address.
5569
5570 2010-02-08  David S. Miller  <davem@davemloft.net>
5571
5572         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5573         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5574         relocation helper function.
5575
5576         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5577         just like R_SPARC_GOT{10,13,22}.
5578         (Target_sparc::Scan::local): Likewise.
5579         (Target_sparc::Relocate:relocate): Likewise.
5580
5581 2010-02-06  Ian Lance Taylor  <iant@google.com>
5582
5583         * configure.ac: Rewrite targetobjs duplicate removal code to use
5584         only shell constructs.
5585         * configure: Rebuild.
5586
5587 2010-02-05  Doug Kwan  <dougkwan@google.com>
5588
5589         PR 11247
5590         * arm.cc (Arm_relobj::section_is_scannable): New method.
5591         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5592         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5593
5594 2010-02-04  Doug Kwan  <dougkwan@google.com>
5595
5596         PR 11247
5597         * arm-reloc-property.cc (cstdio): Include.
5598         * configure.ac (targetobjs): Remove duplicates.
5599         * configure: Regenerate.
5600         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5601         big and little endian version for a given address size.
5602
5603 2010-02-03  Doug Kwan  <dougkwan@google.com>
5604
5605         * arm-reloc-property.cc
5606         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5607         definition.
5608         * arm-reloc-property.h
5609         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5610         New method definition.
5611         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5612         declaration.
5613         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5614         overflow to N.
5615         (GOT_PREL): Change implemented to Y.
5616         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5617         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5618         (Arm_relocate_functions::movw_abs_nc): Remove method.
5619         (Arm_relocate_functions::movt_abs): Ditto.
5620         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5621         (Arm_relocate_functions::thm_movt_abs): Ditto.
5622         (Arm_relocate_functions::movw_rel_nc): Ditto.
5623         (Arm_relocate_functions::movw_rel): Ditto.
5624         (Arm_relocate_functions::movt_rel): Ditto.
5625         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5626         (Arm_relocate_functions:thm_movw_rel): Ditto.
5627         (Arm_relocate_functions:thm_movt_rel): Ditto.
5628         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5629         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5630         New method definitions.
5631         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5632         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5633         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5634         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5635         (Target_arm::Relocate::relocate): Check for non-static or
5636         unimplemented relocation code and exit early.  Change calls to
5637         Target_arm::reloc_uses_thumb_bit and
5638         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5639         instead.  Refactor code to handle similar relocations to increase
5640         code sharing.  Remove check for unsupported relocation code in switch
5641         statement.
5642         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5643         relocation property table to find out size.  Change error message to
5644         print out the name of a relocation code instead of the numeric value.
5645         (Target_arm::scan_reloc_for_stub): Use relocation property table
5646         instead of calling Target_arm::reloc_uses_thumb_bit().
5647
5648 2010-02-02  Doug Kwan  <dougkwan@google.com>
5649
5650         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5651         types of relaxed input section.
5652
5653 2010-02-02  Doug Kwan  <dougkwan@google.com>
5654
5655         * Makefile.am (HFILES): Add arm-reloc-property.h.
5656         (DEFFILES): New.
5657         (TARGETSOURCES): Add arm-reloc-property.cc
5658         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5659         (libgold_a_SOURCES): $(DEFFILES)
5660         * Makefile.in: Regenerate.
5661         * arm-reloc-property.cc: New file.
5662         * arm-reloc-property.h: New file.
5663         * arm-reloc.def: New file.
5664         * arm.cc: Update comments.
5665         (arm-reloc-property.h): New included header.
5666         (arm_reloc_property_table): New global variable.
5667         (Target_arm::do_select_as_default_target): New method definition.
5668         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5669         arm-reloc-property to targ_extra_obj.
5670         * parameters.cc (set_parameters_target): Call
5671         Target::select_as_default_target().
5672         * target.h (Target::select_as_default_target): New method definition.
5673         (Target::do_select_as_default_target): Same.
5674
5675 2010-02-01  Doug Kwan  <dougkwan@google.com>
5676
5677         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5678         first_output_text_section_.
5679         (Arm_exidx_fixup::first_output_text_section): New method definition.
5680         (Arm_exidx_fixup::first_output_text_section_): New data member.
5681         (Arm_exidx_fixup::process_exidx_section): Record the first text
5682         output section seen.
5683         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5684         and entsize in output section header.
5685
5686 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5687
5688         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5689         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5690         (Arm_relocate_functions::thm_alu11): New Method.
5691         (Arm_relocate_functions::thm_pc8): New Method.
5692         (Arm_relocate_functions::thm_pc12): New Method.
5693         (Target_arm::Scan::local): Handle the relocations.
5694         (Target_arm::Scan::global): Likewise.
5695         (Target_arm::Relocate::relocate): Likewise.
5696         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5697
5698 2010-01-29  Doug Kwan  <dougkwan@google.com>
5699
5700         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5701         of relocation types as ld.
5702
5703 2010-01-29  Doug Kwan  <dougkwan@google.com>
5704
5705         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5706         to public.
5707         (Arm_relocate_functions::thumb_branch_common): Ditto.
5708         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5709         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5710         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5711         Arm_relocate_functions::jump24): Remove.
5712         (Target_arm::Relocate::relocate): Adjust code to call
5713         Arm_relocation_functions::arm_branch_common and
5714         Arm_relocation_functions::thumb_branch_common instead of their removed
5715         wrappers.  Merge switch-cases together to reduce source code size.
5716
5717 2010-01-29  Doug Kwan  <dougkwan@google.com>
5718
5719         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5720         output_local_symbol_count_needs_update_.
5721         (Arm_relobj::output_local_symbol_count_needs_update,
5722          Arm_relobj::set_output_local_symbol_count_needs_update,
5723          Arm_relobj::update_output_local_symbol_count): New methods.
5724         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5725         member.
5726         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5727         of pointed function as in a R_ARM_PREL31 relocation.
5728         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5729         for output local symbol count updating.
5730         (Target_arm::do_relax): Update output local symbol counts in objects
5731         if necessary.
5732         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5733
5734 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5735
5736         * arm.cc: Added support for the ARM relocations:
5737         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5738         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5739         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5740         movw_prel_nc).
5741         (Arm_relocate_functions::movw_rel): New method.
5742         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5743         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5744         thm_movw_prel_nc).
5745         (Arm_relocate_functions::thm_movw_rel): New method.
5746         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5747         thm_movt_prel).
5748         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5749         relocations.
5750         (Target_arm::Scan::global): Likewise.
5751         (Target_arm::Relocate::relocate): Likewise.
5752         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5753         Likewise.
5754
5755 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5756
5757         * arm.cc: Added support for ARM group relocations.
5758         (Target_arm::reloc_needs_sym_origin): New method.
5759         (Arm_relocate_functions::calc_grp_kn): New method.
5760         (Arm_relocate_functions::calc_grp_residual): New method.
5761         (Arm_relocate_functions::calc_grp_gn): New method.
5762         (Arm_relocate_functions::arm_grp_alu): New Method.
5763         (Arm_relocate_functions::arm_grp_ldr): New Method.
5764         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5765         (Arm_relocate_functions::arm_grp_ldc): New Method.
5766         (Target_arm::Scan::local): Handle the ARM group relocations.
5767         (Target_arm::Scan::global): Likewise.
5768         (Target_arm::Relocate::relocate): Likewise.
5769         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5770         Likewise.
5771
5772 2010-01-26  Doug Kwan  <dougkwan@google.com>
5773
5774         * arm.cc (set): Include.
5775         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5776         pointer type.
5777         (Arm_output_section::Text_section_list): New type.
5778         (Arm_output_section::append_text_sections_to_list): New method.
5779         (Arm_output_section::fix_exidx_coverage): Ditto.
5780         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5781         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5782         Relobj::set_section_offset() instead of
5783         Sized_relobj::invalidate_section_offset().
5784         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5785         parameter for section headers. Ignore relocation sections for
5786         unallocated sections and EXIDX sections.
5787         (Target_arm::fix_exidx_coverage): New method.
5788         (Target_arm::output_section_address_less_than): New type.
5789         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5790         linked text section instead of the EXIDX section.
5791         (Arm_output_section::create_stub_group): Add an assertion to check
5792         that this is not an EXIDX output section.
5793         (Arm_output_section::append_text_sections_to_list): New method.
5794         (Arm_output_section::fix_exidx_coverage): Ditto.
5795         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5796         Arm_relobj::section_needs_reloc_stub_scanning.
5797         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5798         first pass.
5799         (Target_arm::fix_exidx_coverage): New method.
5800         * object.h (Relobj::set_output_section): New method.
5801         (Sized_relobj::invalidate_section_offset): Remove method.
5802         (Sized_relobj::do_invalidate_section_offset): Remove method.
5803         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5804
5805 2010-01-25  Doug Kwan  <dougkwan@google.com>
5806
5807         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5808         Fix warning due to signed and unsigned comparison on a 32-bit host.
5809
5810 2010-01-22  Doug Kwan  <dougkwan@google.com>
5811
5812         * arm.cc (Target_arm::do_relax): Record an output section for section
5813         offset adjustment it contains any stub table that has changed.
5814         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5815         offsets in an output section if necessary.
5816         * output.cc (Output_section::Output_section): Initialize
5817         section_offsets_need_adjustments_.
5818         (Output_section::add_input_section_for_script): Renamed to
5819         Output_section::add_simple_input_section.
5820         (Output_section::save_states): Add a comment.
5821         (Output_section::discard_states): New method defintion.
5822         (Output_section::adjust_section_offsets): Same.
5823         * output.h (Output_section::add_input_section_for_script): Renamed to
5824         Output_section::add_simple_input_section.
5825         (Output_section::discard_states): New method declaration.
5826         (Output_section::adjust_section_offsets): Same.
5827         (Output_section::section_offsets_need_adjustment,
5828         Output_section::set_section_offsets_need_adjustment): New method
5829         definitions.
5830         (Output_section::section_offsets_need_adjustment_): New data member.
5831         * script-sections.cc
5832         (Output_section_element_input::set_section_address): Adjust code for
5833         renaming of Output_section::add_input_section_for_script.
5834         (Orphan_output_section::set_section_address): Same.
5835
5836 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5837
5838         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5839         Fix_v4bx enum values .
5840         * gold/options.h (General_options): New option definitions.
5841         (General_options::fix_v4bx): New method.
5842         (General_options::Fix_v4bx): New enum.
5843         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5844         (General_options::parse_fix_v4bx_interworking): New method.
5845
5846 2010-01-22  Doug Kwan  <dougkwan@google.com>
5847
5848         * arm.cc (Arm_exidx_fixup): New class.
5849
5850 2010-01-21  Doug Kwan  <dougkwan@google.com>
5851
5852         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5853         classes.
5854         (Arm_exidx_section_offset_map): New type.
5855
5856 2010-01-21  Doug Kwan  <dougkwan@google.com>
5857
5858         * arm.cc (Arm_exidx_input_section): New class.
5859         (Arm_relobj::exidx_input_section_by_link,
5860         Arm_relobj::exidx_input_section_by_shndx,
5861         Arm_relobj::make_exidx_input_section): New methods.
5862         (read_arm_attributes_section): Remove.
5863         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5864         information about them.
5865         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5866         to here.
5867
5868 2010-01-20  Doug Kwan  <dougkwan@google.com>
5869
5870         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5871         Input_section_specifier to Section_id.
5872         (Target_arm::new_arm_input_section: Adjust code for change of key
5873         type.
5874         (Target_arm::find_arm_input_section): Ditto.
5875         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5876         (Section_id): Remove.
5877         (Garbage_collection::Section_id_hash): Remove.
5878         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5879         (Section_id): Remove.
5880         (Icf::Section_id_hash): Remove.
5881         * object.h (Section_id, Const_section_id, Section_id_hash,
5882         Const_section_id_hash): New type definitions.
5883         * output.cc (Output_section::add_relaxed_input_section): Change to
5884         use Const_section_id instead of Input_section_specifier as key type.
5885         (Output_section::add_merge_input_section): Ditto.
5886         (Output_section::build_relaxation_map): Change to use Section_id
5887         instead of Input_section_specifier as key type.
5888         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5889         Ditto.
5890         (Output_section::convert_input_sections_to_relaxed_sections): Change
5891         to use Const_section_id instead of Input_section_specifier as key type.
5892         (Output_section::find_merge_section): Ditto.
5893         (Output_section::find_relaxed_input_section): Ditto.
5894         * output.h (Input_section_specifier): Remove class.
5895         (Output_section::Output_section_data_by_input_section_map): Change
5896         key type to Const_section_id.
5897         (Output_section::Output_relaxed_input_section_by_input_section_map):
5898         Ditto.
5899         (Output_section::Relaxation_map): Change key type to Section_id.
5900
5901 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5902
5903         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5904         (class Arm_v4bx_stub): New class.
5905         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5906         (Stub_factory::make_arm_v4bx_stub): New method.
5907         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5908         (Stub_table::empty): Handle v4bx stubs.
5909         (Stub_table::add_arm_v4bx_stub): New method.
5910         (Stub_table::find_arm_v4bx_stub): New method.
5911         (Arm_relocate_functions::v4bx): New method.
5912         (Target_arm::fix_v4bx): New method.
5913         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5914         (Stub_table::relocate_stubs): Likewise.
5915         (Stub_table::do_write): Likewise.
5916         (Stub_table::update_data_size_and_addralign): Likewise.
5917         (Stub_table::finalize_stubs):  Likewise.
5918         (Target_arm::Scan::local): Likewise.
5919         (Target_arm::Scan::global): Likewise.
5920         (Target_arm::do_finalize_sections): Likewise.
5921         (Target_arm::Relocate::relocate): Likewise.
5922         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5923         Likewise.
5924         (Target_arm::scan_reloc_for_stub): Likewise.
5925         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5926
5927 2010-01-19  Ian Lance Taylor  <iant@google.com>
5928
5929         * output.cc (Output_section_headers::do_sized_write): Write large
5930         segment count to sh_info field.
5931         (Output_file_header::do_sized_write): For large segment count,
5932         write PN_XNUM to e_phnum field.
5933
5934 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5935
5936         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5937         (Arm_relocate_functions::thm_jump8): New function.
5938         (Arm_relocate_functions::thm_jump11): New function.
5939         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5940         R_ARM_THM_JUMP11.
5941         (Target_arm::Scan::global): Likewise.
5942         (Target_arm::Relocate::relocate): Likewise.
5943         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5944         Likewise.
5945
5946 2010-01-14  Doug Kwan  <dougkwan@google.com>
5947
5948         * arm.cc (map, utility): Include headers.
5949         (Target_arm::apply_cortex_a8_workaround): New method.
5950         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5951         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5952         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5953         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5954         the --[no-]fix-cortex-a8 command line options.
5955         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5956         (Target_arm::relocate_stub): Use addend in instruction template.
5957         * options.h (DEFINE_bool): Set the user-set flag.
5958         (General_options): Add --[no-]-fix-cortex options.
5959         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5960         : Update fast look-up map after conversion.
5961
5962 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5963
5964         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5965         in the first pass of do_layout.
5966
5967 2010-01-13  Doug Kwan  <dougkwan@google.com>
5968
5969         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5970         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5971         apparent compiler problem of not folding static constant integral
5972         data members of elfcpp::Elf_sizes<32>.
5973
5974 2010-01-13  Doug Kwan  <dougkwan@google.com>
5975
5976         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5977         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5978         Arm_relobj::scan_section_for_cortex_a8_erratum,
5979         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5980         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5981         sections to scan for relocation stubs into a new method
5982         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5983         relocation and Cortex-A8 stub scanning.
5984         (Target_arm::do_relax): Force stubs to be after stubbed sections
5985         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5986         the beginning of a new relaxation pass.  Update a comment.
5987         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5988
5989 2010-01-12  Ian Lance Taylor  <iant@google.com>
5990
5991         * target-reloc.h (visibility_error): New inline function.
5992         (relocate_section): Call visibility_error.
5993         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5994         (MOSTLYCLEANFILES): Likewise.
5995         (protected_4_pic.o, protected_3.err): New targets.
5996         * testsuite/protected_4.cc: New file.
5997
5998 2010-01-12  Doug Kwan  <dougkwan@google.com>
5999
6000         * arm.cc (Cortex_a8_reloc): New class.
6001         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6002         and cortex_a8_relocs_info_.
6003         (Target_arm::fix_cortex_a8): New method definition.
6004         (Target_arm::Cortex_a8_relocs_info): New type.
6005         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6006         New data member declarations.
6007         (Target_arm::scan_reloc_for_stub): Record information about
6008         relocations for THUMB branches that might be exempted from the
6009         Cortex-A8 workaround.
6010         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6011         at the beginning of a relaxation pass.
6012
6013 2010-01-12  Doug Kwan  <dougkwan@google.com>
6014
6015         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6016         (Arm_relobj::Mapping_symbol_position,
6017          Arm_reloj::Mapping_symbol_position_less,
6018          Arm_relobj::Mapping_symbols_info): New types.
6019         (Target_arm::is_mapping_symbol_name): New method definition.
6020         (Arm_relobj::do_count_local_symbols): Save information about mapping
6021         symbols.
6022
6023 2010-01-11  Doug Kwan  <dougkwan@google.com>
6024
6025         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6026         Arm_relocate_functions::thumb32_branch_upper,
6027         Arm_relocate_functions::thumb32_branch_lower,
6028         Arm_relocate_functions::thumb32_cond_branch_offset,
6029         Arm_relocate_functions::thumb32_cond_branch_upper,
6030         Arm_relocate_functions::thumb32_cond_branch_lower,
6031         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6032         branch offset encoding.
6033         (Arm_relocate_functions::thumb_branch_common): Use new branch
6034         offset encoding methods to avoid code duplication.
6035         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6036         (Stub_addend_reader::operator()): Use new branch encoding method
6037         to avoid code duplication.
6038
6039 2010-01-11  Doug Kwan  <dougkwan@google.com>
6040
6041         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6042         (Target_arm::do_finalize_sections): Define special EXIDX section
6043         symbols only if referenced.
6044         * gc.h (Garbage_collection::add_reference): New method.
6045         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6046         code duplication.
6047
6048 2010-01-11  Ian Lance Taylor  <iant@google.com>
6049
6050         * script.cc (Version_script_info::build_expression_list_lookup):
6051         Change complaing about duplicate wildcard match from error to
6052         warning.
6053
6054         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6055         of 2009-12-30.
6056         (Version_script_info::Version_script_info): Initialize globs_,
6057         default_version_, default_is_global_, and exact_.  Don't
6058         initialize globals_ or locals_.
6059         (Version_script_info::build_lookup_tables): Build local symbols
6060         first.
6061         (Version_script_info::unquote): New function.
6062         (Version_script_info::add_exact_match): New function.
6063         (Version_script_info::build_expression_list_lookup): Remove lookup
6064         parameter.  Add is_global parameter.  Change all callers.  Handle
6065         wildcard pattern specially.  Unquote pattern.  Call
6066         add_exact_match.
6067         (Version_script_info::get_name_to_match): New function.
6068         (Version_script_info::get_symbol_version): New function.
6069         (Version_script_info::get_symbol_version_helper): Remove.
6070         (Version_script_info::check_unmatched_names): Call unquote.
6071         * script.h (class Version_script_info): Change get_symbol_version
6072         to be non-inline and add is_global parameter; change all callers.
6073         Rewrite symbol_is_local.  Update declarations.  Define struct
6074         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6075         Remove globals_ and locals_ members.  Add exact_, globs_,
6076         default_version_, is_global_.
6077         (Version_script_info::Glob): Remove pattern, add expression and
6078         is_global.  Update constructor.  Change all callers.
6079         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6080         default version.
6081         (Versions::symbol_section_contents): If a symbol is undefined, or
6082         defined in a dynamic object, set the version index to
6083         VER_NDX_LOCAL.
6084         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6085         symbol_is_local.
6086         (Symbol_table::add_from_pluginobj): Likewise.
6087         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6088
6089 2010-01-11  Doug Kwan  <dougkwan@google.com>
6090
6091         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6092         (incremental_dump_LDADD): Add linking option for libintl.
6093         * Makefile.in: Regenerate.
6094
6095 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6096
6097         PR gold/11144
6098         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6099         instead of -Ds.
6100         * testsuite/Makefile.in: Regenerated.
6101
6102 2010-01-10  Doug Kwan  <dougkwan@google.com>
6103
6104         * options.h (DEFINE_var): Use parentheses around argument varname__
6105         in macro body to avoid any unintended subsequent substitutions.
6106
6107 2010-01-10  Ian Lance Taylor  <iant@google.com>
6108
6109         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6110         candidates before doing symbol resolution.
6111
6112         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6113         ODR candidates if only one is weak.
6114
6115 2010-01-08  Ian Lance Taylor  <iant@google.com>
6116
6117         * script.cc (Version_script_info::build_expression_list_lookup):
6118         Don't warn about ambiguous version, just record the ambiguity.
6119         (Version_script_info::get_symbol_version_helper): Give error if
6120         version is ambiguous.
6121
6122 2010-01-08  Doug Kwan  <dougkwan@google.com>
6123
6124         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6125           prev_data_size_ and prev_addralign_.  Remove initializer for
6126           deleted data member has_been_changed_.
6127           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6128           to determine if the table is empty.
6129           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6130           Remove.
6131           (Stub_table::add_reloc_stub): Define method in class definition
6132           instead of just declaring it there.
6133           (Stub_table::add_cortex_a8_stub): New method definition.
6134           (Stub_table::update_data_size_and_addralign): Ditto.
6135           (Stub_table::finalize_stubs): Ditto.
6136           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6137           (Stub_table::do_addralign_): Return address alignment in the
6138           (Stub_table::do_reset_address_and_file_offset): Define method in
6139           class definition instead of declaring it there.  Set current data
6140           size to be the data size of the previous pass.
6141           (Stub_table::set_final_data_size): Use current data size as the
6142           final data size.
6143           (Stub_table::relocate_stub): Change parameter type of stub from
6144           Reloc_stub pointer to Stub pointer.
6145           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6146           (Stub_table::Cortex_a8_stub_list): New typedef.
6147           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6148            Stub_table::prev_addralign_): New data member.
6149           (Arm_relobj::Arm_relobj): Initialize data member
6150           section_has_cortex_a8_workaround_.
6151           (Arm_relobj::section_has_cortex_a8_workaround,
6152            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6153            definitions.
6154           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6155           declarations.
6156           (Target_arm::relocate_stub): Change parameter type of stub from
6157           Reloc_stub pointer to Stub pointer.
6158           (Insn_template::size, Insn_template::alignment): Handle
6159           THUMB16_SPECIAL_TYPE.
6160           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6161            Stub_table::update_data_size_and_addralign,
6162            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6163           definitions.
6164           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6165           (Stub_table::do_write): Ditto.
6166           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6167
6168 2010-01-08  Ian Lance Taylor  <iant@google.com>
6169
6170         PR 11108
6171         * symtab.h (class Symbol): Remove fields is_target_special_ and
6172         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6173         (Symbol::is_defined_in_discarded_section): New function.
6174         (Symbol::set_is_defined_in_discarded_section): New function.
6175         (Symbol::has_plt_offset): Rewrite.
6176         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6177         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6178         Don't initialize is_target_special_ or has_plt_offset_.
6179         Initialize is_defined_in_discarded_section_.
6180         (Symbol_table::add_from_relobj): If appropriate, set
6181         is_defined_in_discarded_section.
6182         * resolve.cc (Symbol::override_base_with_special): Don't test
6183         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6184         * target-reloc.h (relocate_section): Do special handling for
6185         symbols defined in discarded sections for global symbols as well
6186         as local symbols.
6187
6188 2010-01-08  Ian Lance Taylor  <iant@google.com>
6189
6190         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6191         the SHT_SYMTAB case.
6192
6193 2010-01-08  Ian Lance Taylor  <iant@google.com>
6194
6195         * object.cc (Sized_relobj::do_layout): Don't get confused if
6196         layout_eh_frame returns NULL.
6197
6198 2010-01-08  Ian Lance Taylor  <iant@google.com>
6199
6200         PR 11084
6201         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6202         dynamic symbol table, use the normal symbol table.
6203         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6204         symbol table.
6205
6206 2010-01-08  Ian Lance Taylor  <iant@google.com>
6207
6208         PR 11072
6209         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6210         sections.
6211
6212 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6213
6214         * version.cc (print_version): Change to "Copyright 2010".
6215
6216 2010-01-08  Ian Lance Taylor  <iant@google.com>
6217
6218         PR 10287
6219         PR 11063
6220         * i386.cc (class Target_i386): Change return type of plt_section
6221         to be non-const.
6222         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6223         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6224         tls_desc_rel_ field.
6225         (Output_data_plt_i386::rel_tls_desc): New function.
6226         (Target_i386::rel_tls_desc_section): New function.
6227         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6228         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6229         R_386_TLS_DESC reloc in rel_tls_desc_section.
6230         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6231         Define struct Tlsdesc_info.
6232         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6233         (Target_x86_64::do_reloc_symbol_index): New function.
6234         (Target_x86_64::add_tlsdesc_info): New function.
6235         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6236         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6237         tlsdesc_rel_ field.
6238         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6239         all callers.
6240         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6241         (Target_x86_64::rela_tlsdesc_section): New function.
6242         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6243         handling.
6244         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6245         (Target_x86_64::do_reloc_addend): New function.
6246         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6247         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6248         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6249         (Output_reloc::type): New function.
6250         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6251         (Output_reloc::is_target_specific): New function.
6252         (Output_reloc::target_arg): New function.
6253         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6254         absolute relocs and target specific relocs.
6255         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6256         add_target_specific.
6257         (class Output_data_reloc) [SHT_RELA]: Likewise.
6258         * output.cc (Output_reloc::Output_reloc): Add four new versions
6259         for absolute relocs and target specific relocs.
6260         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6261         (Output_reloc::get_symbol_index): Likewise.
6262         (Output_reloc::local_section_offset): Check that local_sym_index_
6263         is not TARGET_CODE or 0.
6264         (Output_reloc::symbol_value): Likewise.
6265         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6266         reloc.
6267         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6268         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6269         functions.
6270         * layout.cc (add_target_dynamic_tags): Use output section for
6271         DT_PLTRELSZ and DT_JMPREL.
6272
6273 2010-01-07  Ian Lance Taylor  <iant@google.com>
6274
6275         PR 11061
6276         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6277         function.
6278         (class Output_data_reloc_generic): Define.
6279         (class Output_data_reloc_base): Change base class to
6280         Output_data_reloc_generic.  Change add() method to call
6281         bump_relative_reloc_count for a relative reloc.  Remove
6282         sort_relocs_ field.
6283         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6284         to sort_relocs().
6285         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6286         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6287         appropriate.
6288         * layout.h (class Layout): Update declaration.
6289
6290 2010-01-07  Ian Lance Taylor  <iant@google.com>
6291
6292         * output.h (class Output_data): Add const version of
6293         output_section and do_output_section.
6294         (class Output_section_data): Add const version of
6295         do_output_section.
6296         (class Output_section): Likewise.
6297         * layout.cc (Layout::add_target_dynamic_tags): New function.
6298         * layout.h (class Layout): Update declarations.
6299         * arm.cc (Target_arm::do_finalize_sections): Use
6300         add_target_dynamic_tags.
6301         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6302         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6303         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6304         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6305
6306 2010-01-07  Ian Lance Taylor  <iant@google.com>
6307
6308         PR 11042
6309         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6310         object as needed.
6311
6312 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6313             Ian Lance Taylor  <iant@google.com>
6314
6315         PR 11019
6316         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6317         Xindex::read_symtab_xindex.
6318
6319 2010-01-07  Doug Kwan  <dougkwan@google.com>
6320
6321         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6322         (Insn_template::thumb16_bcond_insn): New method declaration.
6323         (Insn_template): Fix spelling.
6324         (Stub::thumb16_special): New method declaration.
6325         (Stub::do_write): Define virtual method which was previously pure
6326         virtual.
6327         (Stub::do_thumb16_special): New method declaration.
6328         (Stub::do_fixed_endian_write): New template member.
6329         (Reloc_stub::do_write): Remove.
6330         (Reloc_stub::do_fixed_endian_write): Remove.
6331         (Cortex_a8_stub): New class definition.
6332         (Stub_factory::make_cortex_a8_stub): New method definition.
6333         (Stub_factory::Stub_factory): Add missing static storage class
6334         qualifier for elf32_arm_stub_a8_veneer_blx.
6335
6336 2010-01-07  Ian Lance Taylor  <iant@google.com>
6337
6338         PR 10980
6339         * options.h (class General_options): Add --warn-unresolved-symbols
6340         and --error-unresolved-symbols.
6341         * errors.cc (Errors::undefined_symbol): Implement
6342         --warn-unresolved-symbols.
6343
6344         * options.h (class General_options): Add -z text and -z textoff.
6345         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6346
6347 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6348
6349         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6350         (Garbage_collection::cident_sections): New function.
6351         (Garbage_collection::add_cident_section): New function.
6352         (Garbage_collection::cident_sections_): New member.
6353         (gc_process_relocs): Add references to sections whose names are C
6354         identifiers.
6355         * gold.h (cident_section_start_prefix): New constant.
6356         (cident_section_stop_prefix): New constant.
6357         (is_cident): New function.
6358         * layout.cc (Layout::define_section_symbols): Replace string constants
6359         with the newly defined constants.
6360         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6361         C identifiers.
6362         * testsuite/Makefile.am: Add gc_orphan_section_test.
6363         * testsuite/Makefile.in: Regenerate.
6364         * testsuite/gc_orphan_section_test.cc: New file.
6365         * testsuite/gc_orphan_section_test.sh: New file.
6366
6367 2010-01-06  Ian Lance Taylor  <iant@google.com>
6368
6369         PR 10980
6370         * options.h (class General_options): Add --warn-shared-textrel.
6371         * layout.cc (Layout::finish_dynamic_section): Implement
6372         --warn-shared-textrel.
6373
6374         PR 10980
6375         * options.h (class General_options): Add --warn-multiple-gp.
6376
6377 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6378
6379         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6380         $(THREADSLIB) and $(LIBDL).
6381         * Makefile.in: Rebuild.
6382
6383 2010-01-06  Ian Lance Taylor  <iant@google.com>
6384
6385         PR 10980
6386         * options.cc (General_options::parse_section_start): New function.
6387         (General_options::section_start): New function.
6388         (General_options::General_options): Initialize all members.
6389         * options.h: Include <map>
6390         (class General_options): Add --section-start.  Add section_starts_
6391         member.
6392         * layout.cc (Layout::attach_allocated_section_to_segment): If
6393         --section-start was used, set the address of the segment.  Remove
6394         local sort_sections.
6395         (Layout::relaxation_loop_body): If the address of the load segment
6396         has been set by --section-start, don't use it.
6397         * output.h (Output_segment::update_flags_for_output_section): New
6398         function.
6399         * output.cc (Output_segment::add_output_section): Call
6400         update_flags_for_output_section.
6401
6402 2010-01-05  Ian Lance Taylor  <iant@google.com>
6403
6404         PR 10980
6405         * options.h (class General_options): Add --undefined-version.
6406         * script.cc (struct Version_expression): Add was_matched_by_symbol
6407         field.
6408         (Version_script_info::matched_symbol): New function.
6409         (Version_script_info::get_symbol_version_helper): Call
6410         matched_symbol.
6411         (Version_script_info::check_unmatched_names): New function.
6412         * script.h (class Version_script_info): Update declarations.
6413         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6414
6415         * options.h (class General_options): Use DEFINE_bool_alias for
6416         allow_multiple_definition.
6417         * resolve.cc (Symbol_table::should_override): Don't test
6418         allow_multiple_definition.
6419
6420         PR 10980
6421         * options.h (class General_options): Add --cref.
6422         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6423         until after printing cref table.
6424         * cref.cc: Include "symtab.h".
6425         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6426         (Cref_table_compare::operator()): New function.
6427         (Cref_inputs::gather_cref): New function.
6428         (filecol): New static const.
6429         (Cref_inputs::print_cref): New function.
6430         (Cref::print_cref): New function.
6431         * cref.h: Include <cstdio>.
6432         (class Cref): Update declarations.
6433         * mapfile.h (Mapfile::file): New function.
6434         * object.h (class Object): Define Symbols.  Declare virtual
6435         do_get_global_symbols.
6436         (Object::get_global_symbols): New function.
6437         * object.cc (Input_objects::add_object): Pass object to cref_ if
6438         --cref.
6439         (Input_objects::archive_start): Likewise.
6440         (Input_objects::archive_stop): Likewise.
6441         (Input_objects::print_cref): New function.
6442         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6443         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6444         --cref.
6445         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6446         function.
6447         * plugin.h (class Sized_pluginobj): Update declarations.
6448
6449 2010-01-05  Ian Lance Taylor  <iant@google.com>
6450
6451         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6452         to is_default_version.  Rename insdef to insdefault.
6453         (Symbol_table::add_from_relobj): Rename def to is_default_version
6454         and local to is_forced_local.
6455         (Symbol_table::add_from_pluginobj): Likewise.
6456         (Symbol_table::add_from_dynobj): Likewise.
6457         (Symbol_table::define_special_symbol): Rename insdef to
6458         insdefault.
6459
6460 2010-01-04  Ian Lance Taylor  <iant@google.com>
6461
6462         PR 10980
6463         * options.h (class General_options): Add
6464         --allow-multiple-definition and -z muldefs.
6465         * resolve.cc (Symbol_table::should_override): Don't warn about a
6466         multiple symbol definition if --allow-multiple-definition or -z
6467         muldefs.
6468
6469         PR 10980
6470         * options.h (class General_options): Add --add-needed and
6471         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6472         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6473         error if --copy-dt-needed-entries aka --add-needed is used and
6474         would cause a change in behaviour.
6475
6476         PR 10980
6477         * options.h (class General_options): Add -G as a short version of
6478         --shared.  Add no-op options -assert, -g, and -i.
6479
6480 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6481
6482         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6483         check for .text or .gnu.linkonce.t sections.
6484         * icf.cc (Icf::find_identical_sections): Ditto.
6485         Change the detection for mangled function name within the section
6486         name.
6487         * icf.h (is_section_foldable_candidate): New function.
6488
6489 2009-12-30  Ian Lance Taylor  <iant@google.com>
6490
6491         PR 10980
6492         * options.h (class General_options): Permit two dashes with
6493         --retain-symbols-file.
6494
6495 2009-12-30  Ian Lance Taylor  <iant@google.com>
6496
6497         PR 10979
6498         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6499         don't put the file header and segment headers in the text
6500         segment.
6501
6502         PR 10979
6503         * common.cc (Sort_commons::operator()): Stabilize sort when both
6504         entries are NULL.
6505         (Symbol_table::do_allocate_commons_list): When allocating common
6506         symbols, skip a symbol which is no longer common.
6507         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6508         an object before checking its type.
6509         * testsuite/common_test_2.c: New file.
6510         * testsuite/common_test_3.c: New file.
6511         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6512         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6513         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6514         (common_test_2_pic.o, common_test_2.so): New targets.
6515         (common_test_3_pic.o, common_test_3.so): New targets.
6516         * testsuite/Makefile.in: Rebuild.
6517
6518         PR 10979
6519         * script.cc (read_input_script): If we see a new SECTIONS clause,
6520         and we have added an input section, give an error.
6521         * layout.h (class Layout): Add have_added_input_section function.
6522         Add have_added_input_section_ field.
6523         * layout.cc (Layout::Layout): Initialize
6524         have_added_input_section_.
6525         (Layout::layout): Set have_added_input_section_.
6526         (Layout::layout_eh_frame): Likewise.
6527
6528 2009-12-30  Ian Lance Taylor  <iant@google.com>
6529
6530         PR 10931
6531         * options.h (class General_options): Add --sort-common option.
6532         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6533         * common.cc (Sort_common): Add sort_order parameter to
6534         constructor.  Add sort_order_ field.
6535         (Sort_commons::operator): Check sort_order_.
6536         (Symbol_table::allocate_commons): Determine the sort order.
6537         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6538         Change all callers.
6539         (Symbol_table::do_allocate_commons_list): Likewise.
6540
6541 2009-12-30  Ian Lance Taylor  <iant@google.com>
6542
6543         PR 10916
6544         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6545         symbols from this object, don't change the visibility of an
6546         undefined symbol.
6547         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6548
6549 2009-12-30  Ian Lance Taylor  <iant@google.com>
6550
6551         PR 10861
6552         * script.h (class Version_script_info): Define Language enum.
6553         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6554         new fields globals_, locals_, and is_finalized_.
6555         * script.cc: Various formatting fixes.
6556         (class Parser_closure): Change language_stack_ from a vector of
6557         std::string to one of Version_script_info::Language.  Adjust all
6558         uses accordingly.
6559         (class Lazy_demangler): Remove.
6560         (struct Version_expression): Change language from std::string to
6561         Version_script_info::Language.
6562         (Version_script_info::Version_script_info): New function.
6563         (Version_script_info::~Version_script_info): Don't call clear.
6564         (Version_script_info::finalize): New function.
6565         (Version_script_info::build_lookup_tables): New function.
6566         (Version_script_info::build_expression_list_lookup): New
6567         function.
6568         (Version_script_info::get_symbol_version_helper): Rewrite to use
6569         lookup tables.
6570         (Version_script_info::print_expression_list): Adjust to use
6571         Version_script_info::Language.
6572         (script_push_lex_into_version_mode): Check that the version script
6573         has not been finalized.
6574         (version_script_push_lang): Change language string to
6575         Version_script_info::Language.
6576         * options.cc (Command_line::version_script): New function.
6577         * options.h (class General_options): Add finalize_dynamic_list
6578         function.  Change version_script from declaration to definition.
6579         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6580         * testsuite/version_script.map: Remove duplicate def of foo.
6581         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6582         version_script.map.
6583         * testsuite/Makefile.in: Rebuild.
6584
6585 2009-12-30  Ian Lance Taylor  <iant@google.com>
6586
6587         PR 10843
6588         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6589         if the input symbol index is 0, make the output symbol index 0.
6590
6591 2009-12-30  Ian Lance Taylor  <iant@google.com>
6592
6593         PR 10670
6594         * options.h (class General_options): Add -x/--discard-all.
6595         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6596         --discard-all.  If the local symbol needs a dynamic entry, check
6597         that before handling --discard-locals.
6598
6599 2009-12-30  Ian Lance Taylor  <iant@google.com>
6600
6601         PR 10450
6602         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6603         flags to PF_R.
6604         (Output_segment::add_output_section): Don't change the flags if
6605         the type is PT_TLS.
6606
6607         PR 10450
6608         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6609         GNU hash table if they need a dynamic value.  Otherwise, don't add
6610         them if they are defined in a dynamic object or are forced local.
6611
6612 2009-12-29  Ian Lance Taylor  <iant@google.com>
6613
6614         PR 10450
6615         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6616         .gnu.hash table for a 32-bit target.
6617
6618         PR 10450
6619         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6620         regular and a dynamic object only needs a dynamic symbol table
6621         entry if it is externally visible.
6622
6623         PR 10450
6624         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6625         constructor.  Add global_offset_table_ field.
6626         (Target_i386::got_section): Set global_offset_table_.
6627         (Target_i386::do_finalize_sections): Set global_offset_table_
6628         size.
6629         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6630         in constructor.  Add global_offset_table_ field.
6631         (Target_x86_64::got_section): Set global_offset_table_.
6632         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6633         size.
6634
6635         * layout.cc (Layout::Layout): Initialize increase_relro_.
6636         (Layout::get_output_section): Add is_relro, is_last_relro, and
6637         is_first_non_relro parameters.  Change all callers.
6638         (Layout::choose_output_section): Likewise.
6639         (Layout::add_output_section_data): Likewise.
6640         (Layout::make_output_section): Likewise.
6641         (Layout::set_segment_offsets): Clear increase_relro when using a
6642         linker script.
6643         * layout.h (class Layout): Add increase_relro method.  Add
6644         increase_relro_ field.  Update declarations.
6645         * output.cc (Output_section::Output_section): Initialize
6646         is_last_relro_ and is_first_non_relro_.
6647         (Output_segment::add_output_section): Group relro sections is
6648         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6649         (Output_segment::maximum_alignment): Remove relro handling.
6650         (Output_segment::set_section_addresses): Add increase_relro
6651         parameter.  Change all callers.  Add initial alignment to align
6652         relro sections on separate page.  Remove old relro handling.
6653         (Output_segment::set_section_list_addresses): Remove in_relro
6654         parameter.  Change all callers.
6655         (Output_segment::set_offset): Add increase parameter.  Change all
6656         callers.  Remove old relro handling.
6657         * output.h (class Output_section): Add new methods: is_last_relro,
6658         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6659         Add is_last_relro_ and is_first_non_relro_ fields.
6660         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6661         Create separate .got.plt section.  Call increase_relro.
6662         * x86_64.cc (Target_x86_64::got_section): Likewise.
6663         * testsuite/relro_script_test.t: Add .got.plt.
6664
6665         PR 10450
6666         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6667         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6668         (Layout::finalize): Call set_dynamic_symbol_size.
6669         (Layout::set_dynamic_symbol_size): New function.
6670         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6671         set_dynamic_symbol_size.
6672
6673         PR 10450
6674         * output.h (class Output_section): Add is_entsize_zero_ field.
6675         * output.cc (Output_section::Output_section): Initialize
6676         is_entsize_zero_.
6677         (Output_section::set_entsize): If two different entsizes are
6678         requested, force it to zero.
6679         (Output_section::add_input_section): Set flags for .debug_str
6680         before updating section flags.  Set entsize.
6681         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6682         and SHF_STRING if all input sections have those flags.
6683
6684 2009-12-29   Rafael Espindola  <espindola@google.com>
6685
6686         * main.cc (main): Fix the sys time reporting.
6687         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6688         reporting.
6689
6690 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6691
6692         * options.cc (General_options::parse_version): Allow -v to exit
6693         without an error if there is nothing to link.
6694
6695 2009-12-29  Ian Lance Taylor  <iant@google.com>
6696
6697         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6698         using a version of gcc before 4.1.
6699         * configure: Rebuild.
6700
6701 2009-12-28  Chris Demetriou  <cgd@google.com>
6702
6703         * attributes.cc (Output_attributes_section_data::do_write): Use
6704         std::vector::front rather than std::vector::data.
6705
6706 2009-12-28  Ian Lance Taylor  <iant@google.com>
6707
6708         * symtab.h (class Symbol_table): Add enum Defined.
6709         * resolve.cc (Symbol_table::should_override): Add defined
6710         parameter.  Change all callers.  Test whether object is NULL
6711         before calling a method on it.
6712         (Symbol_table::report_resolve_problem): Add defined parameter.
6713         Change all callers.
6714         (Symbol_table::should_override_with_special): Likewise.
6715         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6716         parameter.  Change all callers.
6717         (Symbol_table::do_define_in_output_data): Likewise.
6718         (Symbol_table::define_in_output_segment): Likewise.
6719         (Symbol_table::do_define_in_output_segment): Likewise.
6720         (Symbol_table::define_as_constant): Likewise.
6721         (Symbol_table::do_define_as_constant): Likewise.
6722         * script.h (class Symbol_assignment): Add is_defsym parameter to
6723         constructor; change all callers.
6724         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6725         parameter.  Change all callers.  Add is_defsym_ field.
6726         (class Parser_closure): Add parsing_defsym parameter to
6727         constructor; change all callers.  Add parsing_defsym accessor
6728         function.  Add parsing_defsym_ field.
6729
6730 2009-12-28  Ian Lance Taylor  <iant@google.com>
6731
6732         * gold.cc (queue_middle_tasks): Fix formatting.
6733         * object.cc (Relobj::is_section_name_included): Likewise.
6734
6735 2009-12-23  Ian Lance Taylor  <iant@google.com>
6736
6737         * i386.cc (Target_i386::do_calls_non_split): Recognize
6738         -fsplit-stack prologue for a function with a static chain.
6739         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6740         -fsplit-stack prologue when using %r11.
6741
6742 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6743
6744         * options.cc (General_options::parse_version): Make -v continue and do
6745         the link like GNU ld does.
6746
6747 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6748
6749         * Makefile.am (CCFILES): Add timer.cc.
6750         (HFILES): Add timer.h.
6751         * configure.ac: Check for sysconf and times.
6752         * main.cc: include timer.h.
6753         (main): Use Timer instead of get_run_time.
6754         * timer.cc: New.
6755         * timer.h: New.
6756         * workqueue.cc: include timer.h.
6757         (Workqueue::find_and_run_task):
6758         Report user, sys and wall time.
6759         * Makefile.in: Regenerate.
6760         * config.in: Regenerate.
6761         * configure: Regenerate.
6762
6763 2009-12-16  Doug Kwan  <dougkwan@google.com>
6764
6765         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6766         sections.
6767         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6768         relaxed input sections.
6769         * output.cc (Output_section::find_relaxed_input_section): Change
6770         return type to Output_relaxed_input_section pointer.  Adjust code
6771         for new type of relaxed_input_section_map_.
6772         * output.h (Output_section::find_relaxed_input_section): Change
6773         return type to Output_relaxed_input_section pointer.
6774         (Output_section::Output_relaxed_input_section_by_input_section_map):
6775         New type.
6776         (Output_section::relaxed_input_section_map_): Change type to
6777         Output_section::Output_relaxed_input_section_by_input_section_map.
6778         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6779         input section.
6780
6781 2009-12-15  Ian Lance Taylor  <iant@google.com>
6782
6783         * layout.cc (Layout::create_shstrtab): Only write out after input
6784         sections if we are compressing debug sections.
6785
6786 2009-12-15  Ian Lance Taylor  <iant@google.com>
6787
6788         * archive.cc (Archive::add_symbols): Only look up a symbol without
6789         a version if there is, in fact, a version.
6790
6791 2009-12-14  Ian Lance Taylor  <iant@google.com>
6792
6793         Revert -Wshadow changes, all changes from:
6794         2009-12-11  Doug Kwan  <dougkwan@google.com>
6795         2009-12-11  Nick Clifton  <nickc@redhat.com>
6796         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6797
6798 2009-12-11  Doug Kwan  <dougkwan@google.com>
6799
6800         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6801         due to -Wshadow.
6802         * attributes.cc (Object_attribute::size): Ditto.
6803         (Attributes_section_data::size): Ditto.
6804         (Attributes_section_data::Attributes_section_data): Ditto.
6805         (Output_attributes_section_data::do_write): Ditto.
6806         * attributes.h (Object_attribute::set_type): Ditto.
6807         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6808
6809 2009-12-11  Nick Clifton  <nickc@redhat.com>
6810
6811         * archive.cc: Fix shadowed variable warnings.
6812         * arm.cc: Likewise.
6813         * compressed_output.cc: Likewise.
6814         * compressed_output.h: Likewise.
6815         * configure: Likewise.
6816         * dwarf_reader.cc: Likewise.
6817         * dynobj.cc: Likewise.
6818         * dynobj.h: Likewise.
6819         * ehframe.cc: Likewise.
6820         * ehframe.h: Likewise.
6821         * errors.cc: Likewise.
6822         * expression.cc: Likewise.
6823         * fileread.cc: Likewise.
6824         * fileread.h: Likewise.
6825         * freebsd.h: Likewise.
6826         * i386.cc: Likewise.
6827         * icf.cc: Likewise.
6828         * incremental.h: Likewise.
6829         * layout.cc: Likewise.
6830         * layout.h: Likewise.
6831         * mapfile.cc: Likewise.
6832         * merge.cc: Likewise.
6833         * merge.h: Likewise.
6834         * object.cc: Likewise.
6835         * object.h: Likewise.
6836         * options.h: Likewise.
6837         * output.cc: Likewise.
6838         * output.h: Likewise.
6839         * parameters.cc: Likewise.
6840         * plugin.cc: Likewise.
6841         * powerpc.cc: Likewise.
6842         * reduced_debug_output.cc: Likewise.
6843         * reduced_debug_output.h: Likewise.
6844         * reloc.cc: Likewise.
6845         * reloc.h: Likewise.
6846         * resolve.cc: Likewise.
6847         * script-sections.cc: Likewise.
6848         * script.cc: Likewise.
6849         * script.h: Likewise.
6850         * sparc.cc: Likewise.
6851         * symtab.cc: Likewise.
6852         * symtab.h: Likewise.
6853         * target-select.cc: Likewise.
6854         * target-select.h: Likewise.
6855         * token.h: Likewise.
6856         * workqueue.cc: Likewise.
6857         * workqueue.h: Likewise.
6858         * x86_64.cc: Likewise.
6859
6860 2009-12-10  Doug Kwan  <dougkwan@google.com>
6861
6862         * arm.cc (attributes.h): New include.
6863         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6864         (Arm_relobj::~Arm_relobj): Delete object pointed by
6865         attributes_section_data_.
6866         (Arm_relobj::attributes_section_data): New method definition.
6867         (Arm_relobj::attributes_section_data_): New data member declaration.
6868         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6869         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6870         attributes_section_data_.
6871         (Arm_dynobj::attributes_section_data): New method definition.
6872         (Arm_dynobj::attributes_section_data_): New data member declaration.
6873         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6874         initialization value of may_use_blx_ to false.
6875         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6876         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6877         object attributes to compute results instead of hard-coding.
6878         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6879         Target_arm::get_secondary_compatible_arch,
6880         Target_arm::set_secondary_compatible_arch
6881         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6882         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6883         New method declarations.
6884         (Target_arm::get_aeabi_object_attribute): New method definition.
6885         (Target_arm::attributes_section_data_): New data member declaration.
6886         (read_arm_attributes_section): New template definition.
6887         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6888         (Arm_dynobj::do_read_symbols): Ditto.
6889         (Target_arm::do_finalize_sections): Merge attributes sections from
6890         input.  Check for BLX use after attributes section merging.
6891         Fix __exidx_start and __exidx_end visibility.  Create an
6892         .ARM.attributes section if necessary.
6893         (Target_arm::get_secondary_compatible_arch,
6894         Target_arm::set_secondary_compatible_arch,
6895         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6896         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6897         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6898         New method definitions.
6899
6900 2009-12-09  Ian Lance Taylor  <iant@google.com>
6901
6902         * plugin.cc (Plugin::load): Don't cast from void* to a function
6903         pointer.
6904
6905 2009-12-09  Ian Lance Taylor  <iant@google.com>
6906
6907         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6908         information fields.
6909
6910 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6911
6912         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6913         Replace two_file_shared_1.so with two_file_shared_2.so.
6914         * testsuite/Makefile.in: Regenerated.
6915
6916 2009-12-08  Doug Kwan  <dougkwan@google.com>
6917
6918         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6919         (HFILES): Add attributes.h and int_encoding.h.
6920         * Makefile.in: Regenerate.
6921         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6922         function definitions to int_encoding.cc
6923         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6924         prototypes to int_encoding.h
6925         * reduced_debug_output.cc (int_encoding.h): New include.
6926         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6927         function definitions to int_encoding.cc
6928         (insert_into_vector, read_from_pointer): Move template definitions to
6929         int_encoding.h
6930         * attributes.cc: New file.
6931         * attributes.h: New file.
6932         * int_encoding.cc: New file.
6933         * int_encoding.h: New file.
6934
6935 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6936
6937         PR gold/11055
6938         * incremental-dump.cc (dump_incremental_inputs): New.
6939         (main): Use dump_incremental_inputs.
6940
6941 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6942
6943         PR gold/10893
6944         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6945         checking elfcpp::STT_FUNC.
6946         (Target_i386::Relocate::relocate): Likewise.
6947         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6948
6949         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6950         symbols from shared libraries into normal FUNC symbols.
6951
6952         * symtab.h (Symbol): Add is_func and use it.
6953
6954 2009-12-05  Doug Kwan  <dougkwan@google.com>
6955
6956         * arm.cc (Target_arm::arm_info): Initialize new fields
6957         attributes_section and attributes_vendor.
6958         * i386.cc (Target_i386::i386_info): Same.
6959         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6960         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6961         fields attributes_section and attributes_vendor.
6962         * sparc.cc (Target_sparc::sparc_info): Same.
6963         * target.h (Target::attributes_section, Target::attributes_vendor,
6964         Target::is_attributes_section, Target::attribute_arg_type,
6965         Target::attributes_order): New method definitions.
6966         (Target::Target_info::attributes_section,
6967         Target::Target_info::attributes_vendor): New fields.
6968         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6969         virtual method definitions.
6970         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6971         attributes_section and attributes_vendor.
6972         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6973
6974 2009-12-05  Doug Kwan  <dougkwan@google.com>
6975
6976         * arm.cc: Update comments about interworking and stub generation.
6977         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6978         considered as non-PIC.
6979         (Arm_relocate_functions::base_abs): Fix formatting.
6980         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6981         of function to use GOT entry address instead of offset.
6982         (Target_arm::Scan::global): Issue an error if a symbol would need a
6983         PLT does not get one because it is untyped.  Remove code to create
6984         dynamic symbols for relative branches.
6985         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6986         takes unsigned integer instead of boolean.
6987
6988 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6989
6990         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6991         (two_file_test_LDADD): Likewise.
6992         (common_test_1_LDADD): Likewise.
6993         (exception_test_LDADD) Likewise.
6994         (weak_test_LDADD): Likewise.
6995         (many_sections_test_LDADD): Likewise.
6996         (initpri1_LDADD): Likewise.
6997         (script_test_1_LDADD): Likewise.
6998         (script_test_2_LDADD): Likewise.
6999         (justsyms_LDADD): Likewise.
7000         (binary_test_LDADD): Likewise.
7001         (large_LDADD): Likewise.
7002         * testsuite/Makefile.in: Regenerated.
7003
7004 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7005
7006         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7007         (Symbol_table::override_with_special): Likewise.
7008         (Symbol_table::add_from_object): Likewise.
7009
7010 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7011
7012         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7013         Don't set the data_offset twice.
7014
7015 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7016
7017         * testsuite/Makefile.in: Regenerate.
7018
7019 2009-12-03  Doug Kwan  <dougkwan@google.com>
7020
7021         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7022         (Target_arm::do_finalize_sections): Add parameter for symbol table
7023         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7024         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7025         parameter for symbol table pointer.
7026         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7027         an additional parameter for a pointer to symbol table.
7028         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7029         parameter for a symbol table pointer.
7030         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7031         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7032         Ditto.
7033         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7034         parameter for a symbol table pointer.
7035
7036 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7037
7038         * incremental.cc (Incremental_inputs_header)
7039         (Incremental_inputs_header_write, Incremental_inputs_entry)
7040         (Incremental_inputs_entry_write): Move ...
7041         * incremental.h (Incremental_inputs_header)
7042         (Incremental_inputs_header_write, Incremental_inputs_entry)
7043         (Incremental_inputs_entry_write): here.
7044
7045 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7046
7047         * incremental.cc (make_sized_incremental_binary): Set the target.
7048         Error if it is incompatible.
7049         * output.h (Output_file): Add filename method.
7050
7051 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7052
7053         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7054         from the get_* methods.
7055
7056 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7057
7058         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7059         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7060         Write 0 for the data_offset of scripts.
7061
7062 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7063
7064         * testsuite/Makefile.am: Add the incremental_test.sh test.
7065         * testsuite/incremental_test.sh: New.
7066         * testsuite/incremental_test_1.c: New.
7067         * testsuite/incremental_test_2.c: New.
7068
7069 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7070
7071        * incremental-dump.cc (main): Fix typos.
7072
7073 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7074
7075         PR gold/11025
7076         * incremental-dump.cc (main): Use llu to print 64 bit values.
7077
7078 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7079             H.J. Lu  <hongjiu.lu@intel.com>
7080
7081         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7082         $(LIBDL).
7083         (incremental_dump_LDADD): Likewise.
7084         * Makefile.in: Regenerated.
7085
7086 2009-11-25  Doug Kwan  <dougkwan@google.com>
7087
7088         Revert:
7089
7090         2009-11-25  Doug Kwan  <dougkwan@google.com>
7091
7092                 * arm.cc (Target_arm::Target_arm): Move method definition
7093                 outside of class definition.  Add code to handle
7094                 --target1-rel, --target1-abs and --target2= options.
7095                 (Target_arm::get_reloc_reloc_type): Change method to be
7096                 non-static and const.
7097                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7098                 New data member declaration.
7099                 (Target_arm::Scan::local, Target_arm::Scan::global,
7100                 Target_arm::Relocate::relocate,
7101                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7102                 Adjust call to Target_arm::get_real_reloc_type.
7103                 (Target_arm::get_real_reloc_type): Use command line options
7104                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7105                 * options.h (--target1-rel, --target1-abs, --target2): New
7106                 ARM-only options.
7107
7108 2009-11-25  Doug Kwan  <dougkwan@google.com>
7109
7110         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7111         class definition.  Add code to handle --target1-rel, --target1-abs
7112         and --target2= options.
7113         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7114         and const.
7115         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7116         member declaration.
7117         (Target_arm::Scan::local, Target_arm::Scan::global,
7118         Target_arm::Relocate::relocate,
7119         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7120         call to Target_arm::get_real_reloc_type.
7121         (Target_arm::get_real_reloc_type): Use command line options to
7122         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7123         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7124         options.
7125
7126 2009-11-25  Doug Kwan  <dougkwan@google.com>
7127
7128         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7129         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7130         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7131         formatting.
7132         (Arm_relocate_functions::thm_call): Replace body with a call to
7133         Arm_relocate_functions::thumb_branch_common.
7134         (Arm_relocate_functions::thm_jump24,
7135         Arm_relocate_functions::thm_xpc22): New method definitions.
7136         (Arm_relocate_functions::thumb_branch_common): New method definition.
7137         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7138         operator.
7139         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7140         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7141
7142 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7143
7144         * Makefile.am: Build incremental-dump
7145         * Makefile.in: Regenerate.
7146         * incremental-dump.cc: New.
7147         * incremental.cc (Incremental_inputs_header_data,
7148         Incremental_inputs_entry_data): Move to incremental.h
7149         * incremental.h: (Incremental_inputs_header_data,
7150         Incremental_inputs_entry_data): Move from incremental.cc
7151
7152 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7153
7154         * incremental.cc (Incremental_inputs_header,
7155         Incremental_inputs_header_write, Incremental_inputs_entry,
7156         Incremental_inputs_entry_write): Add a typedef with the data type.
7157
7158 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7159
7160         * incremental.cc (Incremental_inputs_header,
7161         Incremental_inputs_header_write, Incremental_inputs_entry,
7162         Incremental_inputs_entry_write): Update comment about which
7163         type has the filed descriptions.
7164
7165 2009-11-15  Doug Kwan  <dougkwan@google.com>
7166
7167         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7168         (Arm_relocate_functions::arm_branch_common): Change method defintion
7169         in class definition to a method declaration and update list of formal
7170         parameters.
7171         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7172         Arm_relocation_functions::jump24): Adjust call to
7173         Arm_relocate_functions::arm_branch_common.  Update list of formal
7174         parameters.
7175         (Arm_relocate_functions::xpc25): New method definition.
7176         (Arm_relocate_functions::arm_branch_common): Move method defintion
7177         out from class definition.  Use stubs for mode-switching and extending
7178         branch ranges.
7179         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7180         specially.  Change code to enable use of stubs in ARM branches.
7181
7182 2009-11-10  Doug Kwan  <dougkwan@google.com>
7183
7184         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7185         in method declaration.
7186         (Target_arm::relocate_stub): New method declaration.
7187         (Target_arm::default_target): Change to return a pointer instead of
7188         a const reference.
7189         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7190         Target_arm::default_target.
7191         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7192         method definition.
7193         (Target_arm::relocate_section): Adjust view.
7194         (Target_arm::relocate_stub): New method definition.
7195
7196 2009-11-10  Doug Kwan  <dougkwan@google.com>
7197
7198         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7199         a format warning.
7200         * incremental.cc (open_incremental_binary): Initialized local
7201         variables to avoid warnings.
7202         * object.cc (make_elf_object): Ditto.
7203         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7204         a format warning.
7205
7206 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7207
7208         PR gold/10930
7209         * testsuite/plugin_test.c: Include "config.h".
7210
7211 2009-11-09  Doug Kwan  <dougkwan@google.com>
7212
7213         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7214         (arm_symbol_value): Remove.
7215         (Arm_relocate_functions::arm_branch_common,
7216         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7217         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7218         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7219         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7220         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7221         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7222         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7223         Arm_relocate_functions::thm_mobw_abs_nc,
7224         Arm_relocate_functions::thm_mov_abs,
7225         Arm_relocate_functions::movw_prel_nc,
7226         Arm_relocate_functions::thm_movt_abs,
7227         Arm_relocate_functions::movt_prel,
7228         Arm_relocate_functions::thm_movw_prel_nc,
7229         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7230         (Target_arm::Relocate::relocate): Only decompose address into two
7231         parts if relocation type uses the thumb-bit and pass the actual
7232         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7233         calls to methods in Arm_relocate_functions for this change.
7234
7235 2009-11-08  Ian Lance Taylor  <iant@google.com>
7236
7237         PR 10925
7238         * reloc.cc: Instantiate
7239         Sized_relobj::initialize_input_to_output_maps and
7240         Sized_relobj:free_input_to_output_maps.
7241
7242 2009-11-06  Ian Lance Taylor  <iant@google.com>
7243
7244         PR 10876
7245         * defstd.cc (in_segment): Set only_if_ref true for "end".
7246
7247 2009-11-06  Doug Kwan  <dougkwan@google.com>
7248
7249         * arm.cc (class Reloc_stub): Correct a comment.
7250         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7251         (Target_arm::scan_section_for_stubs): New method declaration.
7252         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7253         Change methods from private to protected.
7254         (Target_arm::do_may_relax): New method definition.
7255         (Target_arm::do_relax, Target_arm::group_sections,
7256         Target_arm::scan_reloc_for_stub,
7257         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7258         (Target_arm::arm_input_section_map_): New data member declaration.
7259         (Target_arm::scan_reloc_for_stub,
7260         Target_arm::scan_reloc_section_for_stubs,
7261         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7262         Target_arm::do_relax): New method definitions.
7263
7264 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7265
7266         * configure.ac: Check for (struct stat)::st_mtim
7267         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7268         * config.in: Regenerate.
7269         * configure: Regenerate.
7270
7271 2009-11-05  Ian Lance Taylor  <iant@google.com>
7272
7273         PR 10910
7274         * output.cc (Output_segment::add_output_section): Add missing
7275         return statement.
7276
7277 2009-11-04  Ian Lance Taylor  <iant@google.com>
7278
7279         PR 10880
7280         * object.h (class Object): Add is_needed and set_is_needed
7281         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7282         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7283         defined in a dynamic object and referenced by a regular object,
7284         set is_needed for the dynamic object.
7285         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7286         if the file is marked with as_needed and it is not needed.
7287
7288 2009-11-04  Ian Lance Taylor  <iant@google.com>
7289
7290         PR 10887
7291         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7292         tags if data is discarded by linker script.
7293         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7294         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7295         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7296         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7297
7298 2009-11-04  Ian Lance Taylor  <iant@google.com>
7299
7300         * layout.cc (Layout::get_output_section): Add is_interp and
7301         is_dynamic_linker_section parameters.  Change all callers.
7302         (Layout::choose_output_section): Likewise.
7303         (Layout::make_output_section): Likewise.
7304         (Layout::add_output_section_data): Add is_dynamic_linker_section
7305         parameter.  Change all callers.
7306         * layout.h (class Layout): Update declarations.
7307         * output.h (class Output_section): Add is_interp, set_is_interp,
7308         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7309         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7310         generate_code_fills_at_write_ to a bitfield.
7311         * output.cc (Output_section::Output_sections): Initialize new
7312         fields.
7313         (Output_segment::add_output_section): Add do_sort parameter.
7314         Change all callers.
7315
7316 2009-11-03  Ian Lance Taylor  <iant@google.com>
7317
7318         PR 10860
7319         * options.h (class General_options): Add --warn-common.
7320         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7321         merging two common symbols.
7322         (Symbol_table::should_override): Handle --warn-common when merging
7323         a common symbol with a defined symbol.  Use report_resolve_problem
7324         for multiple definitions.
7325         (Symbol_table::report_resolve_problem): New function.
7326         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7327
7328 2009-11-03  Doug Kwan  <dougkwan@google.com>
7329
7330         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7331         stub_factory_.
7332         (Target_arm::stub_factory): New method definition.
7333         (Target_arm::new_arm_input_section,
7334         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7335         Target_arm::reloc_uses_thumb_bit): New method declarations.
7336         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7337         New type definitions.
7338         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7339         member declarations.
7340         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7341         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7342         New method definitions.
7343
7344 2009-11-03  Ian Lance Taylor  <iant@google.com>
7345
7346         * options.h (class General_options): Add --warn_constructors.
7347
7348 2009-11-03  Ian Lance Taylor  <iant@google.com>
7349
7350         PR 10893
7351         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7352         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7353
7354 2009-11-03  Ian Lance Taylor  <iant@google.com>
7355
7356         PR 10895
7357         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7358         --msgid-bugs-address.
7359         (install-pdf): New target.
7360         (install-data_yes): Look up one directory to find mkinstalldirs.
7361
7362 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7363
7364         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7365         tree.
7366
7367 2009-10-30  Doug Kwan  <dougkwan@google.com>
7368
7369         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7370
7371 2009-10-30  Doug Kwan  <dougkwan@google.com>
7372
7373         * arm.cc (Stub_addend_reader): New struct template definition
7374         and partial specializations.
7375         (Stub_addend_reader::operator()): New method definition for a
7376         partially specialized template.
7377
7378 2009-10-30  Doug Kwan  <dougkwan@google.com>
7379
7380         * arm.cc (Arm_relobj::processor_specific_flags): New method
7381         definition.
7382         (Arm_relobj::do_read_symbols): New method declaration.
7383         (Arm_relobj::processor_specific_flags_): New data member declaration.
7384         (Arm_dynobj): New class definition.
7385         (Target_arm::do_finalize_sections): Add input_objects parameter.
7386         (Target_arm::do_adjust_elf_header): New method declaration.
7387         (Target_arm::are_eabi_versions_compatible,
7388         (Target_arm::merge_processor_specific_flags): New method declaration.
7389         (Target_arm::do_make_elf_object): New overloaded method definitions
7390         and declaration.
7391         (Arm_relobj::do_read_symbols): New method definition.
7392         (Arm_dynobj::do_read_symbols): Ditto.
7393         (Target_arm::do_finalize_sections): Add input_objects parameters.
7394         Merge processor-specific flags from all input objects.
7395         (Target_arm::are_eabi_versions_compatible,
7396         Target_arm::merge_processor_specific_flags,
7397         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7398         New method definitions.
7399         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7400         Input_objects pointer type parameter.
7401         * layout.cc (Layout::finalize): Pass input objects to target's.
7402         finalize_sections function.
7403         * output.cc (Output_file_header::do_sized_write): Set ELF file
7404         header's processor-specific flags.
7405         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7406         Input_objects pointer type parameter.
7407         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7408         * target.h (Input_objects): New forward class declaration.
7409         (Target::processor_specific_flags,
7410         Target::are_processor_specific_flags_sect): New method definitions.
7411         (Target::finalize_sections): Add input_objects parameter.
7412         (Target::Target): Initialize processor_specific_flags_ and
7413         are_processor_specific_flags_set_.
7414         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7415         parameter.
7416         (Target::set_processor_specific_flags): New method definition.
7417         (Target::processor_specific_flags_,
7418         Target::are_processor_specific_flags_set_): New data member
7419         declarations.
7420         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7421         Input_objects pointer type parameter.
7422
7423 2009-10-30  Doug Kwan  <dougkwan@google.com>
7424
7425         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7426
7427 2009-10-28  Ian Lance Taylor  <iant@google.com>
7428
7429         * object.h (class Relobj): Drop options parameter from
7430         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7431         do_scan_relocs, do_relocate.  Change all callers.
7432         (class Sized_relobj): Drop options parameters from
7433         do_gc_process_relocs, do_scan_relocs, do_relocate,
7434         do_relocate_sections, relocate_sections, emit_relocs_scan,
7435         emit_relocs_scan_reltype.  Change all callers.
7436         (struct Relocate_info): Remove options field and all references to
7437         it.
7438         * reloc.h (class Read_relocs): Remove options constructor
7439         parameter and options_ field.  Change all callers.
7440         (class Gc_process_relocs, class Scan_relocs): Likewise.
7441         (class Relocate_task): Likewise.
7442         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7443         all callers.
7444         (scan_relocatable_relocs): Likewise.
7445         * target.h (class Sized_target): Remove options parameter from
7446         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7447         all callers.
7448         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7449         callers.
7450         * arm.cc: Update functions to remove options parameters.
7451         * i386.cc: Likewise.
7452         * powerpc.cc: Likewise.
7453         * sparc.cc: Likewise.
7454         * x86_64.cc: Likewise.
7455         * testsuite/testfile.cc: Likewise.
7456
7457 2009-10-28  Doug Kwan  <dougkwan@google.com>
7458
7459         * arm.cc (Arm_relobj): New class definition.
7460         (Arm_relobj::scan_sections_for_stubs,
7461         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7462         New method definitions.
7463
7464 2009-10-28  Cary Coutant  <ccoutant@google.com>
7465
7466         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7467         (Plugin::cleanup_done_): New member.
7468         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7469         (Plugin_manager::cleanup_done_): Remove.
7470         (Plugin_manager::add_input_file): Edit error message.
7471         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7472         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7473
7474 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7475
7476         * fileread.cc: (File_read::View::~View): Use the new
7477         data_ownership_ filed.
7478         (File_read::~File_read): Dispose the new whole_file_view_.
7479         (File_read::open): Mmap the whole file if needed.
7480         (File_read::open): Use whole_file_view_ instead of contents_.
7481         (File_read::find_view): Use whole_file_view_ if applicable.
7482         (File_read::do_read): Use whole_file_view_ instead of contents_.
7483         (File_read::make_view): Use whole_file_view_ instead of contents_,
7484         update File_read::View::View call.
7485         (File_read::find_or_make_view): Update File_read::View::View
7486         call.
7487         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7488         remove contents_
7489         (File_read::View::Data_ownership): New enum.
7490         (File_read::View::View): Replace bool mapped_ with Data_ownership
7491         argument.
7492         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7493         (File_read::View::data_ownership_): New field.
7494         (File_read::contents_): Remove (replaced by whole_file_view_).
7495         (File_read::whole_file_view_): New field.
7496         * options.h (class General_options): Add --keep-files-mapped.
7497
7498 2009-10-27  Cary Coutant  <ccoutant@google.com>
7499
7500         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7501         * testsuite/Makefile.am (plugin_test_5): New test case.
7502         * testsuite/Makefile.in: Regenerate.
7503
7504 2009-10-25  Doug Kwan  <dougkwan@google.com>
7505
7506         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7507         from private to protected to allow access by child class.
7508         (Sized_relobj::do_relocate_sections): New method declaration.
7509         (Sized_relobj::relocate_sections): Virtualize.
7510         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7511         Sized_relobj::relocate_sections.  Instantiate template explicitly
7512         for different target sizes and endianity.
7513
7514 2009-10-24  Doug Kwan  <dougkwan@google.com>
7515
7516         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7517         (Arm_input_section::as_arm_input_section): New method.
7518         (Arm_output_section): New class definition.
7519         (Arm_output_section::create_stub_group,
7520         Arm_output_section::group_sections): New method definitions.
7521
7522 2009-10-22  Doug Kwan  <dougkwan@google.com>
7523
7524         * arm.cc (Arm_input_section): New class definition.
7525         (Arm_input_section::init, Arm_input_section:do_write,
7526         Arm_input_section::set_final_data_size,
7527         Arm_input_section::do_reset_address_and_file_offset): New method
7528         definitions.
7529
7530 2009-10-21  Doug Kwan  <dougkwan@google.com>
7531
7532         * arm.cc (Stub_table, Arm_input_section): New forward class
7533         declarations.
7534         (Stub_table): New class defintion.
7535         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7536         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7537         New method definition.
7538
7539 2009-10-21  Doug Kwan  <dougkwan@google.com>
7540
7541         * arm.cc: Update copyright comments.
7542         (Target_arm): New forward class template declaration.
7543         (Arm_address): New type.
7544         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7545         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7546         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7547         constants.
7548         (Insn_template): Same.
7549         (DEF_STUBS): New macro.
7550         (Stub_type): New enum type.
7551         (Stub_template): New class definition.
7552         (Stub): Same.
7553         (Reloc_stub): Same.
7554         (Stub_factory): Same.
7555         (Target_arm::Target_arm): Initialize may_use_blx_ and
7556         should_force_pic_veneer_.
7557         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7558         Target_arm::should_force_pic_veneer,
7559         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7560         Target_arm::using_thumb_only, Target_arm:;default_target): New
7561         method defintions.
7562         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7563         New data member declarations.
7564         (Insn_template::size, Insn_template::alignment): New method defintions.
7565         (Stub_template::Stub_template): New method definition.
7566         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7567         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7568         (Stub_factory::Stub_factory): New method definition.
7569         * gold.h (string_hash): New template.
7570         * output.h (Input_section_specifier::hash_value): Use
7571         gold::string_hash.
7572         (Input_section_specifier::string_hash): Remove.
7573         * stringpool.cc (Stringpool_template::string_hash): Use
7574         gold::string_hash.
7575
7576 2009-10-20  Doug Kwan  <dougkwan@google.com>
7577
7578         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7579         symbols of relaxed input sections.
7580         * output.h (Output_section::find_relaxed_input_section): Make
7581         method public.
7582
7583 2009-10-16  Doug Kwan  <dougkwan@google.com>
7584
7585         * dynobj.cc (Versions::Versions): Initialize version_script_.
7586         Only insert base version symbol definition for a shared object
7587         if version script defines any version versions.
7588         (Versions::define_base_version): New method definition.
7589         (Versions::add_def): Check that base version is not needed.
7590         (Versions::add_need): Define base version lazily.
7591         * dynobj.h (Versions::define_base_version): New method declaration.
7592         (Versions::needs_base_version_): New data member declaration.
7593         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7594         (check_DATA): Add no_version_test.stdout.
7595         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7596         New make rules.
7597         * testsuite/Makefile.in: Regenerate.
7598         * testsuite/no_version_test.c: New file.
7599         * testsuite/no_version_test.sh: Ditto.
7600
7601 2009-10-16  Doug Kwan  <dougkwan@google.com>
7602
7603         * expression.cc (class Segment_start_expression): New class definition.
7604         (Segment_start_expression::value): New method definition.
7605         (script_exp_function_segment_start): Return a new
7606         Segment_start_expression.
7607         * gold/script-c.h (script_saw_segment_start_expression): New function
7608         prototype.
7609         * script-sections.cc (Script_sections::Script_sections): Initialize
7610         SAW_SEGMENT_START_EXPRESSION_ to false.
7611         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7612         and -Tbbs options to specify section addresses if given in
7613         command line and no SEGMENT_START expression is seen in a script.
7614         * script-sections.h (Script_sections::saw_segment_start_expression,
7615         Script_sections::set_saw_segment_start_expression): New method
7616         definition.
7617         (Script_sections::saw_segment_start_expression_): New data member
7618         declaration.
7619         * script.cc (script_saw_segment_start_expression): New function.
7620         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7621         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7622         script_test_7.sh and script_test_8.sh.
7623         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7624         script_test_8.stdout.
7625         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7626         (script_test_6, script_test_6.stdout, script_test_7,
7627         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7628         * Makefile.in: Regenerate.
7629         * testsuite/script_test_6.sh: New file.
7630         * testsuite/script_test_6.t: Same.
7631         * testsuite/script_test_7.sh: Same.
7632         * testsuite/script_test_7.t: Same.
7633         * testsuite/script_test_8.sh: Same.
7634
7635 2009-10-16  Doug Kwan  <dougkwan@google.com>
7636
7637         * output.cc (Output_segment::set_section_list_address): Cast
7638         expressions to unsigned long long type to avoid format warnings.
7639
7640 2009-10-15  Ian Lance Taylor  <iant@google.com>
7641
7642         * script.cc (Script_options::add_symbol_assignment): Always add a
7643         dot assignment to script_sections_.
7644         * script-sections.cc (Script_sections::add_dot_assignment):
7645         Initialize if necessary.
7646
7647         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7648         program headers with no load segment if there is a linker script.
7649
7650         * layout.cc (Layout::set_segment_offsets): Align the file offset
7651         to the segment aligment for -N or -n with no load segment.
7652         * output.cc (Output_segment::add_output_section): Don't crash if
7653         the first section is a TLS section.
7654         (Output_segment::set_section_list_addresses): Print an error
7655         message if the address moves backward in a linker script.
7656         * script-sections.cc
7657         (Output_section_element_input::set_section_addresses): Don't
7658         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7659         (Orphan_output_section::set_section_addresses): Likewise.
7660
7661 2009-10-15  Doug Kwan  <dougkwan@google.com>
7662
7663         * layout.cc (Layout::finish_dynamic_section): Generate tags
7664         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7665         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7666         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7667
7668 2009-10-14  Ian Lance Taylor  <iant@google.com>
7669
7670         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7671         fields.
7672         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7673         data_shdr fields of relinfo.
7674         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7675         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7676         R_386_TLS_LDO_32, adjust based on section flags.
7677         (Target_i386::Relocate::fix_up_ldo): Remove.
7678
7679 2009-10-13  Ian Lance Taylor  <iant@google.com>
7680
7681         Add support for -pie.
7682         * options.h (class General_options): Add -pie and
7683         --pic-executable.
7684         (General_options::output_is_position_independent): Test -pie.
7685         (General_options::output_is_executable): Return true if not shared
7686         and not relocatable.
7687         (General_options::output_is_pie): Remove.
7688         * options.cc (General_options::finalize): Reject incompatible uses
7689         of -pie.
7690         * gold.cc (queue_middle_tasks): A -pie link is not static.
7691         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7692         * symtab.cc (Symbol::final_value_is_known): Return false if
7693         output_is_position_independent.
7694         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7695         output_is_position_independent.
7696         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7697         output_is_position_independent.
7698         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7699         output_is_position_independent.
7700         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7701         two_file_pie_test.
7702         (basic_pie_test.o, basic_pie_test): New targets.
7703         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7704         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7705         (two_file_pie_test): New target.
7706         * testsuite/Makefile.in: Rebuild.
7707         * README: Remove note saying that -pie is not supported.
7708
7709 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7710
7711         * options.h (class General_options): Add -init and -fini.
7712         * layout.cc (Layout::finish_dynamic_section): Emit
7713         given init and fini functions.
7714
7715 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7716
7717         * gc.h (gc_process_relocs): Check if icf is enabled using new
7718         function.
7719         * gold.cc (queue_initial_tasks): Likewise.
7720         (queue_middle_tasks): Likewise.
7721         * object.cc (do_layout): Likewise.
7722         * symtab.cc (is_section_folded): Likewise.
7723         * main.cc (main): Likewise.
7724         * reloc.cc (Read_relocs::run): Likewise.
7725         (Sized_relobj::do_scan_relocs): Likewise.
7726         * icf.cc (is_function_ctor_or_dtor): New function.
7727         (Icf::find_identical_sections): Check if function is ctor or dtor when
7728         safe icf is chosen.
7729         * options.h (General_options::icf): Change option to be an enum.
7730         (Icf_status): New enum.
7731         (icf_enabled): New method.
7732         (icf_safe_folding): New method.
7733         (set_icf_status): New method.
7734         (icf_status_): New variable.
7735         * (options.cc) (General_options::finalize): Set icf_status_.
7736         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7737         icf_test and icf_keep_unique_test to use the --icf enum flag.
7738         * testsuite/icf_safe_test.sh: New file.
7739         * testsuite/icf_safe_test.cc: New file.
7740
7741 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7742
7743         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7744         includes to gc.h and icf.h.
7745         * arm.cc: Include gc.h.
7746         * gold.cc: Likewise.
7747         * i386.cc: Likewise.
7748         * powerpc.cc: Likewise.
7749         * sparc.cc: Likewise.
7750         * x86_64.cc: Likewise.
7751         * gc.h: Include icf.h.
7752
7753 2009-10-11  Ian Lance Taylor  <iant@google.com>
7754
7755         * plugin.cc: Include "gold.h" before other header files.
7756
7757 2009-10-10  Chris Demetriou  <cgd@google.com>
7758
7759         * options.h (Input_file_argument::Input_file_type): New enum.
7760         (Input_file_argument::is_lib_): Replace with...
7761         (Input_file_argument::type_): New member.
7762         (Input_file_argument::Input_file_argument): Take Input_file_type
7763         'type' rather than boolean 'is_lib' as second argument.
7764         (Input_file_argument::is_lib): Use type_.
7765         (Input_file_argument::is_searched_file): New function.
7766         (Input_file_argument::may_need_search): Handle is_searched_file.
7767         * options.cc (General_options::parse_library): Support -l:filename.
7768         (General_options::parse_just_symbols): Update for Input_file_argument
7769         changes.
7770         (Command_line::process): Likewise.
7771         * archive.cc (Archive::get_file_and_offset): Likewise.
7772         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7773         * script.cc (read_script_file, script_add_file): Likewise.
7774         * fileread.cc (Input_file::Input_file): Likewise.
7775         (Input_file::will_search_for): Handle is_searched_file.
7776         (Input_file::open): Likewise.
7777         * readsyms.cc (Read_symbols::get_name): Likewise.
7778         * testsuite/Makefile.am (searched_file_test): New test.
7779         * testsuite/Makefile.in: Regenerate.
7780         * testsuite/searched_file_test.cc: New file.
7781         * testsuite/searched_file_test_lib.cc: New file.
7782
7783 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7784             Ian Lance Taylor  <iant@google.com>
7785
7786         * descriptor.cc: Include <cstdio> and "binary-io.h".
7787         (Descriptors::open): Open the files in binary mode always.
7788         * script.cc (Lex::get_token): Treat \r as whitespace.
7789
7790 2009-10-09  Ian Lance Taylor  <iant@google.com>
7791
7792         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7793
7794 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7795             Ian Lance Taylor  <iant@google.com>
7796
7797         * configure.ac: Check for readv function also.
7798         * fileread.cc (readv): Define if not HAVE_READV.
7799         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7800         does not exist.
7801         * config.in: Regenerate.
7802         * configure: Regenerate.
7803
7804 2009-10-09  Doug Kwan  <dougkwan@google.com>
7805
7806         * layout.cc (Layout::make_output_section): Call target hook to make
7807         ordinary output section.
7808         (Layout::finalize): Adjust parameter list of call the
7809         Target::may_relax().
7810         * layout.h (class Layout::section_list): New method.
7811         * merge.h (Output_merge_base::entsize): Change visibility to public.
7812         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7813         New methods.
7814         (Output_merge_string::do_is_string): New method.
7815         * object.cc (Sized_relobj::do_setup): renamed from
7816         Sized_relobj::set_up.
7817         * object.h (Sized_relobj::adjust_shndx,
7818         Sized_relobj::initializ_input_to_output_maps,
7819         Sized_relobj::free_input_to_output_maps): Change visibilities to
7820         protected.
7821         (Sized_relobj::setup): Virtualize.
7822         (Sized_relobj::do_setup): New method declaration.
7823         (Sized_relobj::invalidate_section_offset,
7824         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7825         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7826         * options.cc (parse_int): New function.
7827         * options.h (parse_int): New declaration.
7828         (DEFINE_int): New macro.
7829         (stub_group_size): New option.
7830         * output.cc (Output_section::Output_section): Initialize memebers
7831         merge_section_map_, merge_section_by_properties_map_,
7832         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7833         (Output_section::add_input_section): Handled deferred code-fill
7834         generation and remove an old comment.
7835         (Output_section::add_relaxed_input_section): New method definition.
7836         (Output_section::add_merge_input_section): Use merge section by
7837         properties map to speed to search.  Update merge section maps
7838         as appropriate.
7839         (Output_section::build_relaxation_map): New method definition.
7840         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7841         Same.
7842         (Output_section::relax_input_section): Renamed to
7843         Output_section::convert_input_sections_to_relaxed_sections and change
7844         interface to take a vector of pointers to relaxed sections.
7845         (Output_section::find_merge_section,
7846         Output_section::find_relaxed_input_section): New method definitions.
7847         (Output_section::is_input_address_mapped,
7848         Output_section::output_offset, Output_section::output_address):
7849         Use output section data maps to speed up searching.
7850         (Output_section::find_starting_output_address): Add comments.
7851         (Output_section::do_write,
7852         Output_section::write_to_postprocessing_buffer): Do code-fill
7853         generation as appropriate.
7854         (Output_section::get_input_sections): Invalidate relaxed input section
7855         map.
7856         (Output_section::restore_states): Adjust type of checkpoint .
7857         Invalidate relaxed input section map.
7858         * output.h (Output_merge_base): New class declaration.
7859         (Input_section_specifier): New class defintion.
7860         (class Output_relaxed_input_section) Change base class to
7861         Output_section_data_build.
7862         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7863         base class initializer.
7864         (Output_section::add_relaxed_input_section): New method declaration.
7865         (Output_section::Input_section): Change visibility to protected.
7866         (Output_section::Input_section::relobj,
7867         Output_section::Input_section::shndx): Handle relaxed input sections.
7868         Output_section::input_sections) Change visibility to protected.  Also
7869         define overload to return a non-const pointer.
7870         (Output_section::Merge_section_properties): New class defintion.
7871         (Output_section::Merge_section_by_properties_map,
7872         Output_section::Output_section_data_by_input_section_map,
7873         Output_section::Relaxation_map): New types.
7874         (Output_section::relax_input_section): Rename method to
7875         Output_section::convert_input_sections_to_relaxed_sections and change
7876         interface to take a vector of relaxed section pointers.
7877         (Output_section::find_merge_section,
7878         Output_section::find_relaxed_input_section,
7879         Output_section::build_relaxation_map,
7880         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7881         New method declarations.
7882         (Output_section::merge_section_map_
7883         Output_section::merge_section_by_properties_map_,
7884         Output_section::relaxed_input_section_map_,
7885         Output_section::is_relaxed_input_section_map_valid_,
7886         Output_section::generate_code_fills_at_write_): New data members.
7887         * script-sections.cc
7888         (Output_section_element_input::set_section_addresses): Call
7889         current_data_size and addralign methods of relaxed input sections.
7890         (Orphan_output_section::set_section_addresses): Call current_data_size
7891         and addralign methods of relaxed input sections.
7892         * symtab.cc (Symbol_table::compute_final_value): Extract template
7893         from the body of Symbol_table::sized_finalize_symbol.
7894         (Symbol_table::sized_finalized_symbol): Call
7895         Symbol_table::compute_final_value.
7896         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7897         (Symbol_table::compute_final_value): New templated method declaration.
7898         * target.cc (Target::do_make_output_section): New method defintion.
7899         * target.h (Target::make_output_section): New method declaration.
7900         (Target::relax): Add more parameters for input objects, symbol table
7901         and layout.  Adjust call to do_relax.
7902         (Target::do_make_output_section): New method declaration.
7903         (Target::do_relax): Add parameters for input objects, symbol table
7904         and layout.
7905
7906 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7907
7908         * pread.c: Include stdio.h.
7909
7910 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7911
7912         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7913         defined.
7914
7915 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7916
7917         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7918         Change read_shndx type to unsigned int.
7919         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7920         int.
7921         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7922         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7923         Change read_shndx type to unsigned int.
7924         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7925         int.
7926         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7927         * layout.cc (Layout::create_symtab_sections): Cast the result of
7928         local_symcount * symsize to off_t in the gold_assert.
7929
7930 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7931
7932         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7933         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7934         R_ARM_BASE_ABS.
7935         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7936         (Arm_relocate_functions::thm_abs5): New function.
7937         (Arm_relocate_functions::abs12): New function.
7938         (Arm_relocate_functions::abs16): New function.
7939         (Arm_relocate_functions::base_abs): New function.
7940         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7941         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7942         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7943         R_ARM_BASE_ABS.
7944         (Scan::global): Likewise.
7945         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7946         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7947         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7948         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7949         R_ARM_BASE_ABS.
7950
7951 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7952
7953         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7954         (Arm_relocate_functions::movt_prel): New function.
7955         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7956         (Arm_relocate_functions::thm_movt_prel): New function.
7957         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7958         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7959         (Scan::global, Relocate::relocate): Likewise.
7960         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7961
7962 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7963
7964         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7965         Incremental_checker.
7966         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7967         unsigned int.
7968         (class Incremental_inputs_header): New class.
7969         (Incremental_inputs_header_writer): Edit comment.
7970         (Incremental_inputs_entry): New class.
7971         (Incremental_inputs_entry_writer): Edit comment.
7972         (Sized_incremental_binary::do_find_incremental_inputs_section):
7973         Add *strtab_shndx parameter, fill it.
7974         (Sized_incremental_binary::do_check_inputs): New method.
7975         (Incremental_checker::can_incrementally_link_output_file): Use
7976         Sized_incremental_binary::check_inputs.
7977         (Incremental_inputs::report_command_line): Save command line in
7978         command_line_.
7979         * incremental.h:
7980         (Incremental_binary::find_incremental_inputs_section): New
7981         method.
7982         (Incremental_binary::do_find_incremental_inputs_section): Add
7983         strtab_shndx parameter.
7984         (Incremental_binary::do_check_inputs): New pure virtual method.
7985         (Sized_incremental_binary::do_check_inputs): Declare.
7986         (Incremental_checker::Incremental_checker): Add incremental_inputs
7987         parameter, use it to initialize incremental_inputs_.
7988         (Incremental_checker::incremental_inputs_): New field.
7989         (Incremental_checker::command_line): New method.
7990         (Incremental_checker::inputs): New method.
7991         (Incremental_checker::command_line_): New field.
7992
7993 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7994
7995         * incremental.cc: Include <cstdarg> and "target-select.h".
7996         (vexplain_no_incremental): New function.
7997         (explain_no_incremental): New function.
7998         (Incremental_binary::error): New method.
7999         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8000         method.
8001         (make_sized_incremental_binary): New function.
8002         (open_incremental_binary): New function.
8003         (can_incrementally_link_file): Add checks if output is ELF and has
8004         inputs section.
8005         * incremental.h: Include "elfcpp_file.h" and "output.h".
8006         (Incremental_binary): New class.
8007         (Sized_incremental_binary): New class.
8008         (open_incremental_binary): Declare.
8009         * object.cc (is_elf_object): Use
8010         elfcpp::Elf_recognizer::is_elf_file.
8011         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8012         * output.h (Output_file::filesize): New method.
8013
8014 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8015
8016         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8017         New function.
8018         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8019         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8020         function.
8021         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8022         function.
8023         (Arm_relocate_functions::movw_abs_nc): New function.
8024         (Arm_relocate_functions::movt_abs): New function.
8025         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8026         (Arm_relocate_functions::thm_movt_abs): New function.
8027         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8028         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8029         (Scan::global): Likewise.
8030         (Relocate::relocate): Likewise.
8031         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8032
8033 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8034
8035         * arm.cc (Arm_relocate_functions::got_prel) New function.
8036         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8037         (Relocate::relocate): Likewise.
8038         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8039
8040 2009-10-06  Ian Lance Taylor  <iant@google.com>
8041
8042         * options.h (class General_options): Define
8043         split_stack_adjust_size parameter.
8044         * object.h (class Object): Add uses_split_stack_ and
8045         has_no_split_stack_ fields.  Add uses_split_stack and
8046         has_no_split_stack accessor functions.  Declare
8047         handle_split_stack_section.
8048         (class Reloc_symbol_changes): Define.
8049         (class Sized_relobj): Define Function_offsets.  Declare
8050         split_stack_adjust, split_stack_adjust_reltype, and
8051         find_functions.
8052         * object.cc (Object::handle_split_stack_section): New function.
8053         (Sized_relobj::do_layout): Call handle_split_stack_section.
8054         * dynobj.cc (Sized_dynobj::do_layout): Call
8055         handle_split_stack_section.
8056         * reloc.cc (Sized_relobj::relocate_sections): Call
8057         split_stack_adjust for executable sections in split_stack
8058         objects.  Pass reloc_map to relocate_section.
8059         (Sized_relobj::split_stack_adjust): New function.
8060         (Sized_relobj::split_stack_adjust_reltype): New function.
8061         (Sized_relobj::find_functions): New function.
8062         * target-reloc.h: Include "object.h".
8063         (relocate_section): Add reloc_symbol_changes parameter.  Change
8064         all callers.
8065         * target.h (class Target): Add calls_non_split method.  Declare
8066         do_calls_non_split virtual method.  Declare match_view and
8067         set_view_to_nop.
8068         * target.cc: Include "elfcpp.h".
8069         (Target::do_calls_non_split): New function.
8070         (Target::match_view): New function.
8071         (Target::set_view_to_nop): New function.
8072         * gold.cc (queue_middle_tasks): Give an error if mixing
8073         split-stack and non-split-stack objects with -r.
8074         * i386.cc (Target_i386::relocate_section): Add
8075         reloc_symbol_changes parameter.
8076         (Target_i386::do_calls_non_split): New function.
8077         * x86_64.cc (Target_x86_64::relocate_section): Add
8078         reloc_symbol_changes parameter.
8079         (Target_x86_64::do_calls_non_split): New function.
8080         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8081         parameter.
8082         * powerpc.cc (Target_powerpc::relocate_section): Add
8083         reloc_symbol_changes parameter.
8084         * sparc.cc (Target_sparc::relocate_section): Add
8085         reloc_symbol_changes parameter.
8086         * configure.ac: Call AM_CONDITIONAL for the default target.
8087         * configure: Rebuild.
8088         * testsuite/Makefile.am (TEST_AS): New variable.
8089         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8090         (check_DATA): Add split_i386 and split_x86_64 files.
8091         (SPLIT_DEFSYMS): Define.
8092         (split_i386_[1234n].o): New targets.
8093         (split_i386_[124]): New targets.
8094         (split_i386_[1234r].stdout): New targets.
8095         (split_x86_64_[1234n].o): New targets.
8096         (split_x86_64_[124]): New targets.
8097         (split_x86_64_[1234r].stdout): New targets.
8098         (MOSTLYCLEANFILES): Add new executables.
8099         * testsuite/split_i386.sh: New file.
8100         * testsuite/split_x86_64.sh: New file.
8101         * testsuite/split_i386_1.s: New file.
8102         * testsuite/split_i386_2.s: New file.
8103         * testsuite/split_i386_3.s: New file.
8104         * testsuite/split_i386_4.s: New file.
8105         * testsuite/split_i386_n.s: New file.
8106         * testsuite/split_x86_64_1.s: New file.
8107         * testsuite/split_x86_64_2.s: New file.
8108         * testsuite/split_x86_64_3.s: New file.
8109         * testsuite/split_x86_64_4.s: New file.
8110         * testsuite/split_x86_64_n.s: New file.
8111         * testsuite/testfile.cc (Target_test): Update relocation_section
8112         function.
8113         * testsuite/Makefile.in: Rebuild.
8114
8115 2009-10-06  Ian Lance Taylor  <iant@google.com>
8116
8117         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8118         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8119         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8120         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8121         the address on ldo_addrs_.
8122         (Target_i386::Relocate::fix_up_ldo): New function.
8123
8124 2009-10-06   Rafael Espindola  <espindola@google.com>
8125
8126         * plugin.cc (add_input_library): New.
8127         (Plugin::load): Add add_input_library to tv.
8128         (Plugin_manager::add_input_file): Add the is_lib argument.
8129         (add_input_file): Update call to Plugin_manager::add_input_file.
8130         (add_input_library): New.
8131         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8132
8133 2009-09-30  Doug Kwan  <dougkwan@google.com>
8134
8135         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8136         symbol and call Symbol::may_need_copy_reloc to determine if
8137         a copy reloc is needed.
8138         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8139         nocopyreloc is given in command line.
8140         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8141         given in command line.
8142         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8143         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8144         of the removed Target_i386::may_need_copy_reloc.
8145         * options.h (copyreloc): New option with default value false.
8146         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8147         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8148         instead of the removed Target_powerpc::may_need_copy_reloc.
8149         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8150         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8151         instead of the removed Target_sparc::may_need_copy_reloc.
8152         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8153         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8154         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8155         instead of the removed Target_x86_64::may_need_copy_reloc.
8156
8157 2009-09-30  Ian Lance Taylor  <iant@google.com>
8158
8159         * object.h (class Object): Remove target_ field, and target,
8160         sized_target, and set_target methods.
8161         (Object::sized_target): Remove.
8162         (class Sized_relobj): Update declarations.  Remove sized_target.
8163         * object.cc (Sized_relobj::setup): Remove target parameter.
8164         Change all callers.
8165         (Input_objects::add_object): Don't do anything with the target.
8166         (make_elf_sized_object): Add punconfigured parameter.  Change all
8167         callers.  Set or test parameter target.
8168         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8169         Change all callers.
8170         * parameters.cc (Parameters::set_target): Change parameter type to
8171         be non-const.
8172         (Parameters::default_target): Remove.
8173         (set_parameters_target): Change parameter type to be non-const.
8174         (parameters_force_valid_target): New function.
8175         (parameters_clear_target): New function.
8176         * parameters.h (class Parameters): Update declarations.  Remove
8177         default_target method.  Add sized_target and clear_target
8178         methods.  Change target_ to be non-const.
8179         (set_parameters_target): Update declaration.
8180         (parameters_force_valid_target): Declare.
8181         (parameters_clear_target): Declare.
8182         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8183         as NULL if we aren't searching.
8184         (Add_symbols::run): Don't check for compatible target.
8185         * fileread.cc (Input_file::open_binary): Call
8186         parameters_force_valid_target.
8187         * gold.cc (queue_middle_tasks): Likewise.
8188         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8189         set_target on object.
8190         * dynobj.h (class Sized_dynobj): Update declarations.
8191         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8192         make_elf_object returns NULL.
8193         (Archive::include_member): Don't check whether object target is
8194         compatible.
8195         * output.cc (Output_section::add_input_section): Get target from
8196         parameters.
8197         (Output_section::relax_input_section): Likewise.
8198         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8199         parameters.
8200         (Sized_relobj::do_scan_relocs): Likewise.
8201         (Sized_relobj::relocate_sections): Likewise.
8202         * resolve.cc (Symbol_table::resolve): Likewise.
8203         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8204         parameter.  Change all callers.
8205         (Symbol_table::add_from_object): Get target from parameters.
8206         (Symbol_table::add_from_relobj): Don't check object target.
8207         (Symbol_table::add_from_dynobj): Likewise.
8208         (Symbol_table::define_special_symbol): Get target from
8209         parameters.
8210         * symtab.h (class Symbol_table): Update declaration.
8211         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8212         parameter.  Change all callers.  Clear parameter target.
8213         (Binary_test): Test target here.
8214         * testsuite/object_unittest.cc (gold_testsuite): Remove
8215         target_test_pointer parameter.  Change all callers.
8216         (Object_test): Test target here.
8217
8218 2009-09-26  Ian Lance Taylor  <iant@google.com>
8219
8220         * testsuite/initpri1.c: Don't try to use constructor priorities if
8221         compiling with gcc before 4.3.
8222
8223 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8224
8225         * testsuite/retain_symbols_file_test.sh (check_present): Change
8226         output file name to retain_symbols_file_test.stdout.
8227         (check_absent): Likewise.
8228
8229 2009-09-18  Craig Silverstein  <csilvers@google.com>
8230
8231         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8232         * options.cc: Include <cerrno> and <fstream>.
8233         (General_options::finalize): Parse -retain-symbols-file tag.
8234         * options.h: New flag.
8235         (General_options): New method should_retain_symbol, new
8236         variable symbols_to_retain.
8237         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8238         should_retain_symbol map.
8239         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8240         * testsuite/Makefile.in: Regenerate.
8241         * testsuite/retain_symbols_file_test.sh: New file.
8242
8243 2009-09-18  Nick Clifton  <nickc@redhat.com>
8244
8245         * po/es.po: Updated Spanish translation.
8246
8247 2009-09-17  Doug Kwan  <dougkwan@google.com>
8248
8249         * debug.h (DEBUG_RELAXATION): New constant.
8250         (DEBUG_ALL): Add DEBUG_RELAXATION.
8251         (debug_string_to_enum): Add relaxation debug option.
8252         * layout.cc
8253         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8254         Layout::Relaxation_debug_check::read_sections,
8255         Layout::Relaxation_debug_check::read_sections): New method definitions.
8256         (Layout::Layout): Initialize data members
8257         record_output_section_data_from_scrips_,
8258         script_output_section_data_list_ and relaxation_debug_check_.
8259         (Layout::save_segments, Layout::restore_segments,
8260         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8261         Layout::relaxation_loop_body): New method definitions.
8262         (Layout::finalize): Support relaxation.  Move section layout code to
8263         Layout::relaxation_loop_body.
8264         (Layout::set_asection_address_from_script): Move code for orphan
8265         section placement out.
8266         (Layout::place_orphan_sections_in_script): New method definition.
8267         * layout.h (Output_segment_headers, Output_file_header):
8268         New forward class declarations.
8269         (Layout::~Layout): Define.
8270         (Layout::new_output_section_data_from_script): New method definition.
8271         (Layout::place_orphan_sections_in_script): New method declaration.
8272         (Layout::Segment_states): New type declaration.
8273         (Layout::save_segments, Layout::restore_segments,
8274         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8275         Layout::relaxation_loop_body): New method declarations.
8276         (Layout::Output_section_data_list): New type declaration.
8277         (Layout::Relaxation_debug_check): New class definition.
8278         (Layout::record_output_section_data_from_script_,
8279         Layout::script_output_section_data_list_, Layout::segment_states_,
8280         Layout::relaxation_debug_check_): New data members.
8281         * output.cc: (Output_section_headers::do_size): New method definition.
8282         (Output_section_headers::Output_section_headers): Move size
8283         computation to Output_section_headers::do_size.
8284         (Output_segment_headers::do_size): New method definition.
8285         (Output_file_header::Output_file_header): Move size computation to
8286         Output_file_header::do_size and call it.
8287         (Output_file_header::do_size): New method definition.
8288         (Output_data_group::Output_data_group): Adjust call to
8289         Output_section_data.
8290         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8291         (Output_symtab_xindex::do_write): Add array bound check.
8292         (Output_section::Input_section::print_to_mapfile): Handle
8293         RELAXED_INPUT_SECTION_CODE.
8294         (Output_section::Output_section): Initialize data member checkpoint_.
8295         (Output_section::~Output_section): Delete checkpoint object pointed
8296         by checkpoint_.
8297         (Output_section::add_input_section): Always add an Input_section if
8298         relaxing.
8299         (Output_section::add_merge_input_section): Add assert.
8300         (Output_section::relax_input_section): New method definition.
8301         (Output_section::set_final_data_size): Set load address to zero for
8302         an unallocated section.
8303         (Output_section::do_address_and_file_offset_have_reset_values):
8304         New method definition.
8305         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8306         Handle relaxed input section.
8307         (Output_section::sort_attached_input_sections): Checkpoint input
8308         section list lazily.
8309         (Output_section::get_input_sections): Change type of input_sections to
8310         list of Simple_input_section pointers.  Checkpoint input section list
8311         lazily.  Also handle relaxed input sections.
8312         (Output_section::add_input_section_for_script): Take a reference to
8313         a Simple_input_section object instead of Relobj pointer and section
8314         index as parameter.  Handle relaxed input sections.
8315         (Output_section::save_states, Output_section::restore_states): New
8316         method definitions.
8317         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8318         (Output_data::is_data_size_fixed): New method definition.
8319         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8320         if it is fixed.
8321         (Output_data::address_and_file_offset_have_reset_values): New method
8322         definition.
8323         (Output_data::do_address_and_file_offset_have_reset_values): New method
8324         definition.
8325         (Output_data::set_data_size): Check that data size is not fixed.
8326         (Output_data::fix_data_size): New method definition.
8327         (Output_data::is_data_size_fixed_): New data member.
8328         (Output_section_headers::set_final_data_size): New method definition.
8329         (Output_section_headers::do_size): New method declaration.
8330         (Output_segment_headers::set_final_data_size): New method definition.
8331         (Output_segment_headers::do_size): New method declaration.
8332         (Output_file_header::set_final_data_size)::New method definition.
8333         (Output_file_header::do_size)::New method declaration.
8334         (Output_section_data::Output_section_data): Add new parameter
8335         is_data_size_fixed and use it to fix data size.
8336         (Output_data_const::Output_data_const): Adjust call to base class
8337         constructor and fix data size.
8338         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8339         base class constructor and fix data size.
8340         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8341         base class constructor and fix data size.
8342         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8343         class constructor and fix data size.
8344         (Output_data_group::set_final_data_size): New method definition.
8345         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8346         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8347         class constructor and fix data size.
8348         (Output_relaxed_input_section): New class definition.
8349         (Output_section::Simple_input_section): New class definition.
8350         (Output_section::get_input_sections): Adjust parameter list.
8351         (Output_section::add_input_section_for_script): Same.
8352         (Output_section::save_states, Output_section::restore_states,
8353         Output_section::do_address_and_file_offset_have_reset_values,
8354         (Output_section::Input_section::Input_section): Handle
8355         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8356         Output_relaxed_input_section.
8357         (Output_section::Input_section::is_input_section,
8358         Output_section::Input_section::set_output_section): Handle relaxed
8359         input section.
8360         (Output_section::Input_section::is_relaxed_input_section,
8361         Output_section::Input_section::output_section_data,
8362         Output_section::Input_section::relaxed_input_section): New method
8363         definitions.
8364         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8365         value.
8366         (Output_section::Input_section::u1_): Update comments.
8367         (Output_section::Input_section::u2_): Add new union member poris.
8368         (Output_section::Checkpoint_output_section): New classs definition.
8369         (Output_section::relax_input_section): New method declaration.
8370         (Output_section::checkpoint_): New data member.
8371         (Output_segment): Update comments.
8372         (Output_segment::Output_segment): Un-privatize copy constructor.
8373         (Output_segment::operator=): Un-privatize.
8374         * script-sections.cc (Output_section_element::Input_section_list):
8375         Change element type to Output_section::Simple_input_section.
8376         (Output_section_element_dot_assignment::set_section_addresses):
8377         Register output section data for relaxation clean up.
8378         (Output_data_exression::Output_data_expression): Adjust call to base
8379         constructor to fix data size.
8380         (Output_section_element_data::set_section_addresses): Register
8381         Output_data_expression object for relaxation clean up.
8382         (struct Input_section_info): Replace Relobj pointer and section index
8383         pair with Output_section::Simple_input_section and Convert struct to a
8384         class.
8385         (Input_section_sorter::operator()): Adjust access to
8386         Input_section_info data member to use accessors.
8387         (Output_section_element_input::set_section_addresses): Use layout
8388         parameter.  Adjust code to use Output_section::Simple_input_section
8389         and Input_secction_info classes.  Register filler for relaxation
8390         clean up.
8391         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8392         and section index pair with Output_section::Simple_input_section
8393         class.  Adjust code accordingly.
8394         (Phdrs_element::release_segment): New method definition.
8395         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8396         segment list.
8397         (Script_sections::release_segments): New method definition.
8398         * gold/script-sections.h (Script_sections::release_segments): New
8399         method declaration.
8400         * gold/target.h (Target::may_relax, Target::relax,
8401         Target::do_may_relax, Target::do_relax): New method definitions.
8402
8403 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8404
8405         * arm.cc (has_signed_unsigned_overflow): New function.
8406         (Arm_relocate_functions::abs8): New function.
8407         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8408         (Target_arm::Scan::global): Likewise.
8409         (Target_arm::relocate::relocate): Likewise.
8410         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8411         Likewise.
8412
8413 2009-09-16  Cary Coutant  <ccoutant@google.com>
8414
8415         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8416         * testsuite/Makefile.in: Regenerate.
8417
8418 2009-09-11  Nick Clifton  <nickc@redhat.com>
8419
8420         * po/gold.pot: Updated by the Translation project.
8421
8422 2009-09-08  Cary Coutant  <ccoutant@google.com>
8423
8424         * output.cc (Output_file::open): Add execute permission to empty file.
8425         * testsuite/Makefile.am (permission_test): New test.
8426         * testsuite/Makefile.in: Regenerate.
8427
8428 2009-09-02  Ian Lance Taylor  <iant@google.com>
8429
8430         * output.cc (Output_file::resize): Call map_no_anonymous rather
8431         than map.
8432
8433 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8434
8435         * gold.cc: Include "incremental.h".
8436         (queue_initial_tasks): Call Incremental_checker methods.
8437         * incremental.cc: Include "output.h".
8438         (Incremental_checker::can_incrementally_link_output_file): New
8439         method.
8440         * incremental.h (Incremental_checker): New class.
8441
8442         * output.cc (Output_file::open_for_modification): New method.
8443         (Output_file::map_anonymous): Changed return type to bool.  Record
8444         map in base_ field.
8445         (Output_file::map_no_anonymous): New method, broken out of map.
8446         (Output_file::map): Use map_no_anonymous and map_anonymous.
8447         * output.h (class Output_file): Update declarations.
8448
8449 2009-08-24  Cary Coutant  <ccoutant@google.com>
8450
8451         * options.h (Command_line::Pre_options): New class.
8452         (Command_line::pre_options): New member.
8453         * options.cc (gold::options::ready_to_register): New variable.
8454         (One_option::register_option): Do nothing if not registering options.
8455         Assert if same short option registered twice.
8456         (General_options::General_options): Turn off option registration when
8457         done constructing.
8458         (Command_line::Pre_options::Pre_options): New constructor.
8459
8460 2009-08-24  Cary Coutant  <ccoutant@google.com>
8461
8462         * options.h (General_options::no_keep_memory): Remove incorrect
8463         short option.
8464
8465 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8466
8467         * Makefile.am (am__skiplex, am__skipyacc): New.
8468         * Makefile.in: Regenerate.
8469
8470 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8471
8472         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8473         (INCLUDES): ... this.
8474         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8475         (AM_CPPFLAGS): Renamed from ...
8476         (INCLUDE): ... this.
8477         * Makefile.in, testsuite/Makefile.in: Regenerate.
8478
8479         * Makefile.in: Regenerate.
8480         * aclocal.m4: Likewise.
8481         * config.in: Likewise.
8482         * configure: Likewise.
8483         * testsuite/Makefile.in: Likewise.
8484
8485         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8486         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8487         * Makefile.in: Regenerate.
8488         * testsuite/Makefile.in: Regenerate.
8489
8490 2009-08-19  Cary Coutant  <ccoutant@google.com>
8491
8492         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8493         symbols in shared libraries overridden by hidden or internal symbols
8494         in the main program.
8495
8496 2009-08-19  Chris Demetriou  <cgd@google.com>
8497
8498         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8499         checking source file names in error messages.
8500
8501 2009-08-18  Doug Kwan  <dougkwan@google.com>
8502
8503         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8504         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8505         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8506         an elfcpp::Ehdr as parameter.
8507         * object.cc (Object::set_target): Remove the version that looks up
8508         a target and sets it.
8509         (Sized_relobj::setup): Take a Target object instead of
8510         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8511         (make_elf_sized_object): Find target and ask target to
8512         make an ELF object.
8513         * object.h: (Object::set_target): Remove the version that looks up
8514         a target and sets it.
8515         (Sized_relobj::setup): Take a Target object instead of
8516         an elfcpp:Ehdr as parameter.
8517         * target.cc: Include dynobj.h.
8518         (Target::do_make_elf_object_implementation): New.
8519         (Target::do_make_elf_object): New.
8520         * target.h (Target::make_elf_object): New template declaration.
8521         (Target::do_make_elf_object): New method declarations.
8522         (Target::do_make_elf_object_implementation): New template declaration.
8523
8524 2009-08-14  Ian Lance Taylor  <iant@google.com>
8525
8526         * gold.h (FUNCTION_NAME): Define.
8527         (gold_unreachable): Use FUNCTION_NAME.
8528
8529 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8530
8531         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8532         symbol in the --keep-unique list is not found.
8533
8534 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8535
8536         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8537         been maked as --keep-unique.
8538         (Icf::unfold_section): New function.
8539         * icf.h (Icf::unfold_section): New function.
8540         * options.h (General_options::keep_unique): New option.
8541         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8542         * testsuite/Makefile.in: Regenerate.
8543         * testsuite/icf_keep_unique_test.sh: New file.
8544         * testsuite/icf_keep_unique_test.cc: New file.
8545
8546 2009-08-12  Cary Coutant  <ccoutant@google.com>
8547
8548         PR 10471
8549         * resolve.cc (Symbol_table::resolve): Check for references from
8550         dynamic objects to hidden and internal symbols.
8551         * testsuite/Makefile.am (hidden_test.sh): New test.
8552         * testsuite/Makefile.in: Regenerate.
8553         * testsuite/hidden_test.sh: New script.
8554         * testsuite/hidden_test_1.c: New test source.
8555         * testsuite/hidden_test_main.c: New test source.
8556
8557 2009-08-11  Doug Kwan  <dougkwan@google.com>
8558
8559         * arm.cc: Update comments.
8560         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8561         segment to locate the .ARM.exidx section if present.
8562
8563 2009-08-09  Doug Kwan  <dougkwan@google.com>
8564
8565         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8566         patch.
8567
8568 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8569         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8570         compiler warnings.
8571
8572 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8573
8574         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8575         valid tls_segment only for non-debug-section relocations.
8576         * testsuite/Makefile.am: Add gc_tls_test.
8577         * testsuite/Makefile.in: Regenerate.
8578         * testsuite/gc_tls_test.cc: New file.
8579         * testsuite/gc_tls_test.sh: New file.
8580
8581 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8582
8583         * icf.cc: New file.
8584         * icf.h: New file.
8585         * Makefile.am (CCFILES): Add icf.cc.
8586         (HFILES): Add icf.h
8587         * Makefile.in: Regenerate.
8588         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8589         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8590         section, symbol and addend information for the relocs.
8591         * gold.cc (queue_middle_tasks): Call identical code folding.
8592         * gold.h: Add defines for multimap.
8593         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8594         to the call of finalize_local_symbols.
8595         * main.cc (main): Create object of class Icf.
8596         * object.cc (Sized_relobj::do_layout): Allow this function to be
8597         called twice during icf.
8598         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8599         to sections marked as identical by icf.
8600         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8601         when available.
8602         (Sized_relobj::do_section_entsize): New function.
8603         * object.h (Object::section_entsize): New function.
8604         (Object::do_section_entsize): New pure virtual function.
8605         (Relobj::finalize_local_symbols): Add new parameter.
8606         (Relobj::do_section_entsize): New function.
8607         * options.h (General_options::icf): New option.
8608         (General_options::icf_iterations): New option.
8609         (General_options::print_icf_sections): New option.
8610         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8611         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8612         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8613         icf.
8614         * symtab.cc (Symbol_table::is_section_folded): New function.
8615         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8616         to sections marked as identical by icf.
8617         * symtab.h (Symbol_table::set_icf): New function.
8618         (Symbol_table::icf): New function.
8619         (Symbol_table::is_section_folded): New function.
8620         (Symbol_table::icf_): New data member.
8621         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8622         * testsuite/Makefile.am: Add commands to build icf_test.
8623         * testsuite/Makefile.in: Regenerate.
8624         * testsuite/icf_test.sh: New file.
8625         * testsuite/icf_test.cc: New file.
8626
8627 2009-07-24  Chris Demetriou  <cgd@google.com>
8628
8629         * layout.cc (is_compressible_debug_section): Fix incorrect
8630         comment about compressed section names.
8631
8632 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8633
8634         PR 10419
8635         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8636
8637 2009-07-16  Ian Lance Taylor  <iant@google.com>
8638
8639         PR 10400
8640         * layout.h: #include <map>.
8641         (class Kept_section): Change from struct to class.  Add accessors
8642         and setters.  Add section size to Comdat_group mapping.  Change
8643         Comdat_group to std::map.  Add is_comdat_ field.  Add
8644         linkonce_size field in union.
8645         (class Layout): Update declaration of find_or_add_kept_section.
8646         Don't declare find_kept_object.
8647         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8648         parameter.  Add object, shndx, is_comdat, and is_group_name
8649         parameters.  Change all callers.  Adjust for new Kept_section.
8650         (Layout::find_kept_object): Remove.
8651         * object.cc (Sized_relobj::include_section_group): Update use of
8652         Kept_section.  Rename secnum to shndx.  Only record
8653         Kept_comdat_section if sections are the same size.
8654         (Sized_relobj::include_linkonce_section): Update use of
8655         Kept_section.  Only record Kept_comdat_section if sections are the
8656         same size.  Set size of linkonce section.
8657         (Sized_relobj::map_to_kept_section): Update call to
8658         get_kept_comdat_section.
8659         * object.h (class Sized_relobj): Rename fields in
8660         Kept_comdat_section to drop trailing underscores; change object
8661         field to Relobj*.  Change Kept_comdat_section_table to store
8662         struct rather than pointer.
8663         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8664         Add kept_object and kept_shndx parameters.  Change all callers.
8665         (Sized_relobj::get_kept_comdat_section): Change return type to
8666         bool.  Add kept_object and kept_shndx parameters.  Change all
8667         callers.
8668         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8669         Layout::find_or_add_kept_section.
8670
8671 2009-07-09  Ian Lance Taylor  <iant@google.com>
8672
8673         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8674         Reserve space in the hash table.
8675
8676 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8677
8678         * fileread.cc (File_read::get_mtime): New method.
8679         * fileread.h (Timespec): New structure.
8680         (File_read::get_mtime): New method.
8681         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8682         Renamed from timestamp_nsec.
8683         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8684         Elf_Xword.
8685         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8686         timestamp_nsec.
8687         (Incremental_inputs::report_archive): Save mtime; style fix.
8688         (Incremental_inputs::report_obejct): Save mtime; style fix.
8689         (Incremental_inputs::report_script): Save mtime; style fix.
8690         (Incremental_inputs::finalize_inputs): Style fix.
8691         (Incremental_inputs::finalize): Style fix.
8692         (Incremental_inputs::create_input_section_data): Store inputs
8693         mtime.
8694         * incremental.h (Incremental_inputs::report_script): Add mtime
8695         argument.
8696         (Incremental_inputs::Input_info::Input_info): Intialize only one
8697         union member.
8698         (Incremental_inputs::Input_info::archive): Move to nameless
8699         union.
8700         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8701         (Incremental_inputs::Input_info::script): Move to nameless union.
8702         (Incremental_inputs::mtime): New field.
8703         * script.cc (read_input_script): Pass file mtime to
8704         Incremental_input.
8705         * script.h (Script_info::inputs): Style fix.
8706
8707 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8708
8709         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8710         instead of 32.
8711
8712 2009-06-24  Ian Lance Taylor  <iant@google.com>
8713
8714         PR 10156
8715         * layout.cc (Layout::choose_output_section): If we find an
8716         existing section, update the flags.
8717         (Layout::create_notes): New function, broken out of
8718         Layout::finalize.
8719         (Layout::finalize): Don't create note sections.
8720         (Layout::create_note): Don't crash if linker script discards
8721         section.
8722         (Layout::create_gold_note): Likewise.
8723         (Layout::create_build_id): Likewise.  Don't set
8724         after_input_sections on the section.
8725         (Layout::create_executable_stack_info): Remove target parameter.
8726         Change caller.
8727         * layout.h (class Layout): Declare create_notes.  Update
8728         declaration of create_executable_stack_info.
8729         * gold.cc (queue_middle_tasks): Call create_notes.
8730         * output.cc (Output_section::update_flags_for_input_section): Move
8731         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8732         invalid.
8733         * output.h (Output_data::mark_address_invalid): New function.
8734         (class Output_section): Only declare, not define,
8735         update_flags_for_input_section.  Remove set_flags.
8736
8737 2009-06-24  Ian Lance Taylor  <iant@google.com>
8738
8739         * script-sections.cc (Output_section_definition::
8740         set_section_addresses): Rename shadowing local load_address to
8741         laddr.
8742
8743 2009-06-24  Ian Lance Taylor  <iant@google.com>
8744
8745         PR 10244
8746         * reloc.cc (relocate_sections): Skip empty relocation sections.
8747
8748 2009-06-23  Ian Lance Taylor  <iant@google.com>
8749
8750         PR 10156
8751         * layout.cc (Layout::create_note): Use choose_output_section
8752         rather than make_output_section.
8753
8754 2009-06-23  Ian Lance Taylor  <iant@google.com>
8755
8756         PR 10237
8757         * options.cc (General_options::parse_V): Set printed_version_.
8758         (General_options::General_options): Initialize printed_version_.
8759         * options.h (class General_options): Add printed_version_ field.
8760         * gold.cc (queue_initial_tasks): If there are no input files,
8761         don't give a fatal error if we printed the version information.
8762         (queue_middle_tasks): If using -r with a shared object, give a
8763         fatal error rather than an ordinary error.
8764
8765 2009-06-23  Ian Lance Taylor  <iant@google.com>
8766
8767         PR 10219
8768         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8769         (Layout::make_output_section): Set have_stabstr_section_ if we see
8770         a .stab*str section.
8771         (Layout::finalize): Call link_stabs_sections.
8772         (Layout::link_stabs_sections): New file.
8773         * layout.h (class Layout): Add have_stabstr_section_ field.
8774         Declare link_stabs_sections.
8775
8776 2009-06-23  Doug Kwan  <dougkwan@google.com>
8777
8778         * Makefile.am (libgold_a_LIBADD): New.
8779         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8780         * Makefile.in: Regenerate.
8781         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8782         * configure: Regenerate.
8783         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8784         * fileread.cc: Include sys/state.h
8785         * gold.h: Declare memmem and strndup if found missing.
8786         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8787
8788 2009-06-23  Ian Lance Taylor  <iant@google.com>
8789
8790         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8791         * configure: Rebuild.
8792
8793 2009-06-23  Ian Lance Taylor  <iant@google.com>
8794
8795         PR 10147
8796         * object.cc (Object::section_contents): Don't try to get a view if
8797         the section has length zero.
8798         (Object::handle_gnu_warning_section): If the section is empty, use
8799         the name of the section as the warning.
8800
8801 2009-06-23  Ian Lance Taylor  <iant@google.com>
8802
8803         PR 10133
8804         * stringpool.h (class Stringpool_template): Add optimize_ field.
8805         (Stringpool_template::set_optimize): New function.
8806         * stringpool.cc (Stringpool_template::Stringpool_template):
8807         Initialize optimize_ field.
8808         (Stringpool_template::set_string_offsets): Test local optimize
8809         fild rather than parameter.
8810         * layout.cc (Layout::Layout): Call set_optimize on the section
8811         name stringpool.
8812
8813 2009-06-22  Ian Lance Taylor  <iant@google.com>
8814
8815         PR 10030
8816         * yyscript.y: Parse TARGET.
8817         * script.cc (script_set_target): New function.
8818         * script-c.h (script_set_target): Declare.
8819         * options.cc (General_options::string_to_object_format): Rename
8820         from string_to_object_format in anonymous namespace.  Change
8821         callers.
8822         * options.h (class General_options): Declare
8823         string_to_object_format.
8824
8825 2009-06-22  Ian Lance Taylor  <iant@google.com>
8826
8827         * script-sections.cc (Script_sections::create_segments): Don't put
8828         program headers in a PT_LOAD segment if -n or -N.
8829
8830 2009-06-22  Ian Lance Taylor  <iant@google.com>
8831
8832         PR 10141
8833         * options.h (class General_options): Add -z lazy and -z now.  Sort
8834         -z options into alphabetical order.
8835         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8836
8837 2009-06-21  Ian Lance Taylor  <iant@google.com>
8838
8839         * layout.cc (Layout::make_output_section): Call
8840         Target::new_output_section.
8841         (Layout::attach_allocated_section_to_segment): Put large section
8842         sections in a separate load segment with the large segment flag
8843         set.
8844         (Layout::segment_precedes): Sort large data segments after other
8845         load segments.
8846         (align_file_offset): New static function.
8847         (Layout::set_segment_offsets): Use align_file_offset.
8848         * output.h (class Output_section): Add is_small_section_ and
8849         is_large_section_ fields.
8850         (Output_section::is_small_section): New function.
8851         (Output_section::set_is_small_section):  New function.
8852         (Output_section::is_large_section): New function.
8853         (Output_section::set_is_large_section): New function.
8854         (Output_section::is_large_data_section): New function.
8855         (class Output_segment): Add is_large_data_segment_ field.
8856         (Output_segment::is_large_data_segment): New function.
8857         (Output_segment::set_is_large_data_segment): New function.
8858         * output.cc (Output_section::Output_section): Initialize new
8859         fields.
8860         (Output_segment::Output_segment): Likewise.
8861         (Output_segment::add_output_section): Add assertion that large
8862         data sections always go in large data segments.  Force small data
8863         sections to the end of the list of data sections.  Force small BSS
8864         sections to the start of the list of BSS sections.  For large BSS
8865         sections to the end of the list of BSS sections.
8866         * symtab.h (class Symbol): Declare is_common_shndx.
8867         (Symbol::is_defined): Check Symbol::is_common_shndx.
8868         (Symbol::is_common): Likewise.
8869         (class Symbol_table): Define enum Commons_section_type.  Update
8870         declarations.  Add small_commons_ and large_commons_ fields.
8871         * symtab.cc (Symbol::is_common_shndx): New function.
8872         (Symbol_table::Symbol_table): Initialize new fields.
8873         (Symbol_table::add_from_object): Put small and large common
8874         symbols in the right list.
8875         (Symbol_table::sized_finalized_symbol): Check
8876         Symbol::is_common_shndx.
8877         (Symbol_table::sized_write_globals): Likewise.
8878         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8879         common symbol lists.  Don't call do_allocate_commons_list if the
8880         list is empty.
8881         (Symbol_table::do_allocate_commons_list): Remove is_tls
8882         parameter.  Add comons_section_type parameter.  Change all
8883         callers.  Handle small and large common symbols.
8884         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8885         Symbol::is_common_shndx.
8886         * resolve.cc (symbol_to_bits): Likewise.
8887         * target.h (Target::small_common_shndx): New function.
8888         (Target::small_common_section_flags): New function.
8889         (Target::large_common_shndx): New function.
8890         (Target::large_common_section_flags): New function.
8891         (Target::new_output_section): New function.
8892         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8893         small_common_section_flags, and large_common_section_flags
8894         fields.
8895         (Target::do_new_output_section): New virtual function.
8896         * arm.cc (Target_arm::arm_info): Initialize new fields.
8897         * i386.cc (Target_i386::i386_info): Likewise.
8898         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8899         Likewise.
8900         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8901         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8902         (Target_x86_64::do_new_output_section): New function.
8903         * configure.ac: Define conditional MCMODEL_MEDIUM.
8904         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8905         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8906         (large_LDFLAGS): Define.
8907         * testsuite/large.c: New file.
8908         * testsuite/testfile.cc (Target_test::test_target_info):
8909         Initialize new fields.
8910         * configure, testsuite/Makefile.in: Rebuild.
8911
8912 2009-06-05  Doug Kwan  <dougkwan@google.com>
8913
8914         * Makefile.am (CCFILES): Add target.cc.
8915         * Makefile.in: Regenerate.
8916         * i386.cc (class Target_i386): Define new virtual method to
8917         override do_is_local_label_name in parent.
8918         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8919         local symbols if --discard-locals or -X is given.
8920         * options.h (class General_options): Declare new options
8921         '--discard-locals' and '-X' for discarding locals.
8922         * target.h (class Target): Define new methods is_local_label_name.
8923         Declare new virtual method do_is_local_label_name.
8924         * target.cc: New file.
8925         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8926         (check_SCRIPTS): Add discard_locals_test.sh.
8927         (check_DATA): Add discard_local_tests.syms.
8928         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8929         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8930         * testsuite/Makefile.in: Regenerate.
8931         * testsuite/discard_locals_test.c: New file.
8932         * testsuite/discard_locals_test.sh: Same.
8933
8934 2009-06-05  Doug Kwan  <dougkwan@google.com>
8935
8936         * object.cc (Sized_relobj::Sized_relobj): Initialize
8937         discarded_eh_frame_shndx_ to -1U.
8938         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8939         section.
8940         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8941         a discarded .eh_frame section.
8942         (Sized_relobj::do_finalize_local_symbols): Ditto.
8943         * object.h (class Sized_relobj): Declare new member
8944         discarded_eh_frame_shndx_.
8945         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8946         (local_labels_test.o, local_labels_test): New rules.
8947         * testsuite/Makefile.in: Regenerate.
8948
8949 2009-06-04  Doug Kwan  <dougkwan@google.com>
8950
8951         * layout.cc (Layout::section_name_mapping): Add mapping for
8952         special ARM sections.
8953
8954 2009-06-03  Doug Kwan  <dougkwan@google.com>
8955
8956         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8957         (utils::has_overflow): Same.
8958
8959 2009-06-03  Ian Lance Taylor  <iant@google.com>
8960
8961         * layout.cc (Layout::section_name_mapping): New array, replacing
8962         Layout::linkonce_mapping.
8963         (Layout::section_name_mapping_count): New variable, replacing
8964         Layout::linkonce_mapping_count.
8965         (Layout::linkonce_output_name): Remove.
8966         (Layout::output_section_name): Rewrite.
8967         * layout.h (class Layout): Rename Linkonce_mapping to
8968         Section_name_mapping, linkonce_mapping to section_name_mapping,
8969         linkonce_mapping_count to section_name_mapping_count.  Don't
8970         declare linkonce_output_name.
8971
8972 2009-06-03  Doug Kwan  <dougkwan@google.com>
8973
8974         * gold/arm.cc (namespace utils): New.
8975         (Target_arm::reloc_is_non_pic): Define new method.
8976         (class Arm_relocate_functions): New.
8977         (Target_arm::Relocate::relocate): Handle relocation types used by
8978         Android.
8979
8980 2009-06-03  Ian Lance Taylor  <iant@google.com>
8981
8982         * arm.cc (Target_arm::scan::global): Use || instead of |.
8983
8984 2009-06-02  Doug Kwan  <dougkwan@google.com>
8985
8986         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8987         issued_non_pic_error_.
8988         (class Target_arm::Scan): Declare new method check_non_pic.
8989         Define new method symbol_needs_plt_entry.
8990         Declare new data member issued_non_pic_error_.
8991         (class Target_arm::Relocate): Declare new method
8992         should_apply_static_reloc.
8993         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8994         (Target_arm::Scan::check_non_pic): Define new method.
8995         (Target_arm::Scan::local): Handle a small subset of reloc types used
8996         by Android.
8997         (Target_arm::Scan::local): Same.
8998         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8999
9000 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9001
9002         * incremental.cc (Incremental_inputs::report_command_line): Filter
9003         out --incremental-* options.
9004
9005 2009-05-29  Doug Kwan  <dougkwan@google.com>
9006
9007         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9008         template class.
9009         (class Target_arm): Update comment.
9010         (Target_arm::Target_arm): Initialize new data members GOT_,
9011         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9012         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9013         and Target_arm::rel_dyn_section.
9014         Declare new_enum Target_arm::Got_type.
9015         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9016         and DYNBSS_.
9017         Update commments for member do_dynsym_value.
9018         (Target_arm::got_size, Target_arm::plt_section,
9019         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9020         new methods inside class defintion.
9021         (Target_arm::got_section): Define new method.
9022         (Target_arm::rel_dyn_section): Same.
9023         (Output_data_plt_arm): New template class.
9024         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9025         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9026         (Output_data_plt_arm::add_entry): Same.
9027         (Output_data_plt_arm::first_plt_entry): Define new
9028         static data member for PLT instruction template.
9029         (Output_data_plt_arm::plt_entry): Same.
9030         (Output_data_plt_arm::do_write): Define new method.
9031         (Target_arm::make_plt_entry): Same.
9032         (Target_arm::do_finalize_sections): Same.
9033         (Target_arm::do_dynsym_value): Same.
9034
9035 2009-05-28  Doug Kwan  <dougkwan@google.com>
9036
9037         * Makefile.am (TARGETSOURCES): Add arm.cc.
9038         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9039         * Makefile.in: Regenerate.
9040         * arm.cc: New file.
9041         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9042
9043 2009-05-26  Doug Kwan  <dougkwan@google.com>
9044
9045         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9046         (General_options::check_excluded_libs): Strip off directories in
9047         archive name before matching like GNU ld does.
9048         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9049         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9050         (exclude_libs_test_LDFLAGS): Add linker option
9051         -Wl,--exclude-libs,libexclude_libs_test_3
9052         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9053         an explicit archive without using -l.
9054         (alt/libexclude_libs_test_3.a): New make rule.
9055         * testsuite/Makefile.in: Regenerate.
9056         * testsuite/exclude_libs_test.c : Declare lib3_default().
9057         (main): Call it.
9058         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9059         * exclude_libs_test_3.c: New file.
9060
9061 2009-05-26  Nick Clifton  <nickc@redhat.com>
9062
9063         * po/id.po: New Indonesian translation.
9064         * po/gold.pot: Updated template file.
9065
9066 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9067
9068         * testsuite/Makefile.am: Add -ffunction-sections to compile
9069         gc_comdat_test files.  Add -Wl,--gc-sections to build
9070         gc_comdat_test.
9071         * testsuite/Makefile.in: Regenerate.
9072         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9073
9074 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9075
9076         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9077         kept comdat section was garbage collected.
9078         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9079         * testsuite/Makefile.in: Regenerate.
9080         * testsuite/gc_comdat_test.sh: New file.
9081         * testsuite/gc_comdat_test_1.cc: New file.
9082         * testsuite/gc_comdat_test_2.cc: New file.
9083
9084 2009-05-19  Doug Kwan  <dougkwan@google.com>
9085
9086         * archive.cc (Archive::Archive): Move constructor from archive.h
9087         to here.  Initialize no_export_.
9088         (Archive::get_elf_object_for_member): Set no_export flag of object.
9089         * archive.h (Archive::Archive): Move constructor body to
9090         archive.cc.
9091         (Archive::no_export): New method.
9092         (Archive::no_export_): New field.
9093         * object.h (Object::Object): Initialize no_export_ to false.
9094         (Object::no_export, Object::set_no_export): New methods.
9095         (Object::no_export_): New field.
9096         * options.cc (General_options::parse_exclude_libs): New method.
9097         (General_options::check_excluded_libs) Same.
9098         * options.h (exclude_libs): New option.
9099         (General_options::check_excluded_libs): New method declaration.
9100         (General_options::excluded_libs_): New field.
9101         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9102         default or protected visibility if an object has no-export flag set.
9103         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9104         (check_SCRIPTS): Add exclude_libs_test.sh.
9105         (check_DATA): Add exclude_libs_test.syms.
9106         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9107         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9108         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9109         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9110         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9111         libexclude_libs_test_2.a): New rules.
9112         * testsuite/Makefile.in: Regenerate.
9113         * testsuite/exclude_libs_test.c: New file.
9114         * testsuite/exclude_libs_test.sh: Ditto.
9115         * testsuite/exclude_libs_test_1.c: Ditto.
9116         * testsuite/exclude_libs_test_2.c: Ditto.
9117
9118 2009-05-15  Ian Lance Taylor  <iant@google.com>
9119
9120         * configure.ac: Check for declarations for cases where libiberty.h
9121         checks HAVE_DECL_xxx.
9122         * configure, config.in: Rebuild.
9123
9124 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9125
9126         * gold.h (Incremental_argument_list): Remove (invalid) forward
9127         declaration.
9128         * incremental.cc (Incremental_inputs::report_achive): New method.
9129         (Incremental_inputs::report_object): New method.
9130         (Incremental_inputs::report_script): New method.
9131         (Incremental_inputs::finalize_inputs): New method.
9132         (Incremental_inputs::finalize): Call finalize_inputs().
9133         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9134         Create inputs entries.
9135         * incremental.h (Incremental_input_type): New enum.
9136         (Incremental_inputs::Incremental_input): Initialize new fields.
9137         (Incremental_inputs::report_inputs): New method.
9138         (Incremental_inputs::report_achive): New method.
9139         (Incremental_inputs::report_object): New method.
9140         (Incremental_inputs::report_script): New method.
9141         (Incremental_inputs::finalize_inputs): New method.
9142         (Incremental_inputs::Input_info): New struct.
9143         (Incremental_inputs::Input_info_map): New typedef.
9144         (Incremental_inputs::lock_): New field.
9145         (Incremental_inputs::Inputs_): New field.
9146         (Incremental_inputs::Inputs_map): New field.
9147         * main.cc (main): Call Incremental_input::report_inputs.
9148         * options.h (Input_argument_list): Typedef moved from
9149         Input_arguments.
9150         (Input_file_group::Files): Remove, use ::Input_argument_list.
9151         (Input_file_group::Input_argument_list): Remove, use
9152         ::Input_argument_list.
9153         * plugin.cc (Plugin_manager::add_input_file): Add error in
9154         incremental build.
9155         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9156         functions.
9157         * script.cc (read_input_script): Call
9158         Incremental_input::report_script.
9159         * script.h (Script_info): New class.
9160
9161 2009-04-27  Ian Lance Taylor  <iant@google.com>
9162
9163         * x86_64.cc (do_adjust_output_section): Set entsize to
9164         plt_entry_size.
9165
9166 2009-04-23  Elliott Hughes  <enh@google.com>
9167
9168         * output.cc (Output_file::close): After short writes, continue
9169         writing from the correct offset in the buffer being written.
9170
9171 2009-04-23  Chris Demetriou  <cgd@google.com>
9172
9173         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9174         * configure: Regenerate.
9175         * config.in: Regenerate.
9176         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9177         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9178
9179 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9180
9181         * incremental.cc (Incremental_inputs_header_data): Renamed from
9182         Incremental_input_header_data.
9183         (Incremental_inputs_header_data::data_size): New field.
9184         (Incremental_inputs_header_data::put_input_file_count): Renamed
9185         from input_file_count.
9186         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9187         from command_line_offset.
9188         (Incremental_inputs_header_data::put_reserved): Renamed from
9189         put_reserved.
9190         (Incremental_inputs_entry_data): Renamed from
9191         Incremental_input_entry_data.
9192         (Incremental_inputs_entry_data::data_size): New field.
9193         (Incremental_inputs::report_command_line): New method.
9194         (Incremental_inputs::finalize): New method.
9195         (Incremental_inputs::create_incremental_inputs_data): New method.
9196         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9197         * incremental.h: New file.
9198         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9199        (Layout::finalize): Create incremental inputs section in
9200         incremental builds.
9201        (Layout::create_incremental_info_sections): New method.
9202         * layout.h (Layout::incremental_inputs): New method.
9203        (Layout::create_incremental_info_sections): New method.
9204        (Layout::incremental_inputs_): New field.
9205         * main.cc (main): Notify Incremental_input of the command line.
9206
9207 2009-04-01  Ian Lance Taylor  <iant@google.com>
9208             Mikolaj Zalewski  <mikolajz@google.com>
9209
9210         * gold.h (reserve_unordered_map): Define, three versions, one for
9211         each version of Unordered_map.
9212         * layout.cc (Layout::Layout): Remove options parameter.  Add
9213         number_of_input_files parameter.  Don't initialize options_.
9214         Initialize number_of_input_files_ and resized_signatures_.  Move
9215         sections_are_attached_.
9216         (Layout::layout_group): Reserve space for group_signatures_.
9217         (Layout::find_or_add_kept_section): Change name parameter to be a
9218         reference.  Resize signatures_ map when it gets large enough.
9219         (Layout::layout_eh_frame): Use parameters->options() instead of
9220         this->options_.
9221         (Layout::make_output_section): Likewise.
9222         (Layout::attach_allocated_section_to_segment): Likewise.
9223         (Layout::finalize, Layout::create_executable_stack): Likewise.
9224         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9225         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9226         * layout.h (class Layout): Update declarations.  Remove options_
9227         field.  Add number_of_input_files_ and resized_signatures_
9228         fields.  Move sections_are_attached_ field.
9229         * main.cc (main): Pass number of input files to Layout
9230         constructor.  Don't pass options.
9231
9232 2009-03-30  Ian Lance Taylor  <iant@google.com>
9233
9234         * ffsll.c (ffsll): Correct implementation.
9235
9236 2009-03-27  Ian Lance Taylor  <iant@google.com>
9237
9238         * ffsll.c: New file.
9239         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9240         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9241         * ftruncate.c (ftruncate): Declare before definition.
9242         * mremap.c (mremap): Likewise.
9243         * pread.c (pread): Likewise.
9244         * configure, Makefile.in, config.in: Rebuild.
9245
9246         * mremap.c: New file.
9247         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9248         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9249         (mremap): Declare if HAVE_MREMAP is not defined.
9250         * configure, Makefile.in, config.in: Rebuild.
9251
9252 2009-03-27  Cary Coutant  <ccoutant@google.com>
9253
9254         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9255         position independent.
9256         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9257         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9258
9259 2009-03-24  Cary Coutant  <ccoutant@google.com>
9260
9261         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9262         an executable.
9263         (needs_dynamic_reloc): Likewise.
9264
9265 2009-03-24  Ian Lance Taylor  <iant@google.com>
9266
9267         * yyscript.y (file_cmd): Recognize EXTERN.
9268         (extern_name_list, extern_name_list_body): New nonterminals.
9269         * script.cc (script_add_extern): Define.
9270         * script-c.h (script_add_extern): Declare.
9271
9272 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9273
9274         * object.cc (is_elf_object): Define.
9275         * object.h (is_elf_object): Declare.
9276         * archive.cc (Archive::get_elf_object_for_member): Call
9277         is_elf_object.
9278         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9279
9280 2009-03-24  Elliott Hughes  <enh@google.com>
9281
9282         * output.cc (Output_file::map_anonymous): Define.
9283         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9284         try an anonymous one.  Report the size if the mmap fails.
9285         * output.h (class Output_file): Declare map_anonymous.
9286
9287 2009-03-24  Ian Lance Taylor  <iant@google.com>
9288
9289         * target-select.cc (instantiate_target): Don't acquire the lock if
9290         the instantiated_target_ field has already been set.
9291
9292 2009-03-23  Ian Lance Taylor  <iant@google.com>
9293
9294         * gold-threads.h (class Initialize_lock): Define.
9295         * gold-threads.cc (class Initialize_lock_once): Define.
9296         (initialize_lock_control): New static variable.
9297         (initialize_lock_pointer): New static variable.
9298         (initialize_lock_once): New static function.
9299         (Initialize_lock::Initialize_lock): Define.
9300         (Initialize_lock::initialize): Define.
9301         * target-select.h: Include "gold-threads.h".
9302         (class Target_selector): Add lock_ and initialize_lock_ fields.
9303         Don't define instantiate_target, just declare it.
9304         * target-select.cc (Target_selector::Target_selector): Initialize
9305         new fields.
9306         (Target_selector::instantiate_target): Define.
9307         * descriptors.h: Include "gold-threads.h".
9308         (class Descriptors): Add initialize_lock_ field.
9309         * descriptors.cc (Descriptors::Descriptors): Initialize new
9310         field.
9311         (Descriptors::open): Use initialize_lock_ field
9312         * errors.h (class Errors): Add initialize_lock_ field.
9313         * errors.cc (Errors::Errors): Initialize new field.
9314         (Errors::initialize_lock): Use initialize_lock_ field.
9315         * powerpc.cc (class Target_selector_powerpc): Remove
9316         instantiated_target_ field.  In do_recognize call
9317         instantiate_target rather than do_instantiate_target.  In
9318         do_instantiate_target just allocate a new target.
9319         * sparc.cc (class Target_selector_sparc): Likewise.
9320
9321         * freebsd.h: New file.
9322         * i386.cc: Include "freebsd.h".
9323         (Target_i386): Derive from Target_freebsd rather than
9324         Sized_target.
9325         (Target_selector_i386): Derive from Target_selector_freebsd rather
9326         than Target_selector.
9327         * x86_64.cc: Include "freebsd.h".
9328         (Target_x86_64): Derive from Target_freebsd rather than
9329         Sized_target.
9330         (Target_selector_x86_64): Derive from Target_selector_freebsd
9331         rather than Target_selector.
9332         * target.h (class Target): Add adjust_elf_header and
9333         do_adjust_elf_header.
9334         * output.cc (Output_file_header:: do_sized_write): Call target
9335         adjust_elf_header routine.
9336         * configure.tgt: Set targ_osabi.
9337         * configure.ac: Define GOLD_DEFAULT_OSABI.
9338         * parameters.cc (Parameters::default_target): Pass
9339         GOLD_DEFAULT_OSABI to select_target.
9340         * target-select.h (class Target_selector): Make instantiate_target
9341         protected rather than private.
9342         * Makefile.am (HFILES): Add freebsd.h.
9343         * configure, Makefile.in, config.in: Rebuild.
9344
9345         * merge.cc (do_add_input_section): Correct pend value.  Change
9346         message about last entry not being null terminated from error to
9347         warning.
9348
9349 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9350
9351         * incremental.cc: New file.
9352         * Makefile.am (CCFILES): Add incremental.cc.
9353         * Makefile.in: Rebuild.
9354
9355 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9356
9357         * layout.cc (Layout::output_section_name): Preserve names
9358         of '.note.' sections.
9359
9360 2009-03-19  Ian Lance Taylor  <iant@google.com>
9361
9362         * descriptors.cc (Descriptors::open): Check that the options are
9363         valid before using them.
9364
9365 2009-03-18  Ian Lance Taylor  <iant@google.com>
9366
9367         * script-sections.h: Include <list>.
9368         (class Script_sections): Change Sections_elements from std::vector
9369         to std::list.  Typedef public Elements_iterator.  Add
9370         orphan_section_placement_, data_segment_align_start_, and
9371         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9372         field.
9373         * script-sections.cc (class Orphan_section_placement): New class.
9374         (class Sections_element): Add virtual functions is_relro and
9375         orphan_section_init.  Remove virtual function place_orphan_here.
9376         (class Output_section_definition): Add is_relro and
9377         orphan_section_init.  Remove place_orphan_here.
9378         (class Orphan_output_section): Likewise.
9379         (Script_sections::Script_sections): Update for field changes.
9380         (Script_sections::data_segment_align): Set saw_data_segment_align_
9381         and data_segment_align_start_, not data_segment_align_index.
9382         (Script_sections::data_segment_relro_end): Check
9383         saw_data_segment_align_.  Use data_segment_align_start_ rather
9384         than data_segment_align_index_.
9385         (Script_sections::place_orphan): Rewrite to use
9386         Orphan_section_placement.
9387
9388 2009-03-17  Ian Lance Taylor  <iant@google.com>
9389
9390         * archive.cc (Archive::add_symbols): Check for a version attached
9391         to the symbol name in the archive map.
9392         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9393         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9394         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9395         (ver_test_11.a): New target.
9396         * testsuite/Makefile.in: Rebuild.
9397
9398         * configure.ac: Check for chsize and posix_fallocate.  Replace
9399         ftruncate.
9400         * ftruncate.c: New file, from gnulib.
9401         * output.cc (posix_fallocate): Define dummy version if not
9402         HAVE_POSIX_FALLOCATE.
9403         (Output_file::map): Call posix_fallocate rather than lseek and
9404         write.
9405         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9406         * configure, Makefile.in, config.in: Rebuild.
9407
9408 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9409
9410         * layout.h (Layout::create_note): Add section_name parameter.
9411         * layout.cc (Layout::create_note): Likewise.
9412         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9413
9414 2009-03-17  Ian Lance Taylor  <iant@google.com>
9415
9416         * descriptors.cc: Include "options.h".
9417         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9418         (Descriptors::open): Always use O_CLOEXEC when opening a new
9419         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9420         then set FD_CLOEXEC.
9421
9422         * sparc.cc (class Target_sparc): Add has_got_section.
9423         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9424         make sure we have a GOT section.
9425
9426         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9427         (Target_sparc::Scan::local): Likewise.
9428         (Target_sparc::Scan::global): Likewise.
9429         (Target_sparc::Relocate::relocate): Likewise.
9430         (Target_sparc::Relocate::relocate_tls): Likewise.
9431
9432         * symtab.cc (Symbol_table::define_default_version): New function,
9433         broken out of add_from_object.
9434         (Symbol_table::add_from_object): Call define_default_version.
9435         (Symbol_table::define_special_symbol): Add resolve_oldsym
9436         parameter.  Change all callers.  If the version for a symbol comes
9437         from a version script, resolve it with the symbol with the same
9438         name with no version.  Also add the symbol without a version if
9439         appropriate.
9440         (do_define_in_output_data): If resolving with oldsym, don't delete
9441         sym.
9442         (do_define_in_output_segment): Likewise.
9443         (do_define_as_constant): Likewise.
9444         * symtab.h (class Symbol_table): Update declarations.
9445
9446 2009-03-13  Ian Lance Taylor  <iant@google.com>
9447
9448         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9449         (Read_symbols::requeue): New function.
9450         (Read_symbols::do_read_symbols): If make_elf_object fails because
9451         the target type is not configured, and the file was searched for,
9452         issue a warning and retry with the next directory.
9453         (Add_symbols::run): If the file has an incompatible format, and
9454         it was searched for, requeue the Read_symbols task.  On error,
9455         release the object.
9456         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9457         dirindex parameter to constructor.  Change all callers.  Declare
9458         incompatible_warning and requeue.
9459         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9460         input_argument_ and input_group_ fields.  Add them to
9461         constructor.  Change all callers.
9462         (class Read_script): Add dirindex_ field.  Add it to constructor.
9463         Change all callers.
9464         * archive.cc (Archive::setup): Remove input_objects parameter.
9465         Change all callers.
9466         (Archive::get_file_and_offset): Likewise.
9467         (Archive::read_all_symbols): Likewise.
9468         (Archive::read_symbols): Likewise.
9469         (Archive::get_elf_object_for_member): Remove input_objects
9470         parameter.  Add punconfigured parameter.  Change all callers.
9471         (Archive::add_symbols): Change return type to bool.  Check return
9472         value of include_member.
9473         (Archive::include_all_members): Likewise.
9474         (Archive::include_member): Change return type to bool.  Return
9475         false if first included object has incompatible target.  Set
9476         included_member_ field.
9477         (Add_archive_symbols::run): If add_symbols returns false, requeue
9478         Read_symbols task.
9479         * archive.h (class Archive): Add included_member_ field.
9480         Initialize it in constructor.  Add input_file and searched_for
9481         methods.  Update declarations.
9482         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9483         input_argument_ fields.  Add them to constructor.  Change all
9484         callers.
9485         * script.cc: Include "target-select.h".
9486         (class Parser_closure): Add skip_on_incompatible_target_ and
9487         found_incompatible_target_ fields.  Add
9488         skip_on_incompatible_target parameter to constructor.  Change all
9489         callers.  Add methods skip_on_incompatible_target,
9490         clear_skip_on_incompatible_target, found_incompatible_target, and
9491         set_found_incompatible_target.
9492         (read_input_script): Add dirindex parameter.  Change all callers.
9493         If parser finds an incompatible target, requeue Read_symbols
9494         task.
9495         (script_set_symbol): Clear skip_on_incompatible_target in
9496         closure.
9497         (script_add_assertion, script_parse_option): Likewise.
9498         (script_start_sections, script_add_phdr): Likewise.
9499         (script_check_output_format): New function.
9500         * script.h (read_input_script): Update declaration.
9501         * script-c.h (script_check_output_format): Declare.
9502         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9503         (ignore_cmd): Remove OUTPUT_FORMAT.
9504         * fileread.cc (Input_file::Input_file): Add explicit this.
9505         (Input_file::will_search_for): New function.
9506         (Input_file::open): Add pindex parameter.  Change all callers.
9507         * fileread.h (class Input_file): Add input_file_argument method.
9508         Declare will_search_for.  Update declarations.
9509         * object.cc (make_elf_object): Add punconfigured parameter.
9510         Change all callers.
9511         * object.h (class Object): Make input_file public.  Add
9512         searched_for method.
9513         (make_elf_object): Update declaration.
9514         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9515         restart search.
9516         * dirsearch.h (class Dirsearch): Update declaration.
9517         * options.h (class General_options): Add --warn-search-mismatch.
9518         * parameters.cc (Parameters::is_compatible_target): New function.
9519         * parameters.h (class Parameters): Declare is_compatible_target.
9520         * workqueue.cc (Workqueue::add_blocker): New function.
9521         * workqueue.h (class Workqueue): Declare add_blocker.
9522
9523         * fileread.cc (Input_file::open): Remove options parameter.
9524         Change all callers.
9525         (Input_file::open_binary): Likewise.
9526         * script.cc (read_input_script): Likewise.
9527         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9528         options parameter from constructor.  Change all callers.
9529         (class Read_script): Likewise.
9530         * fileread.h (class Input_file): Update declarations.
9531         * script.h (read_input_script): Update declaration.
9532
9533 2009-03-10  Nick Clifton  <nickc@redhat.com>
9534
9535         * po/es.po: New Spanish translation.
9536
9537 2009-03-06  Cary Coutant  <ccoutant@google.com>
9538
9539         * options.cc (parse_short_option): Keep dash_z from registering itself.
9540
9541 2009-03-03  Ian Lance Taylor  <iant@google.com>
9542
9543         PR 9918
9544         * target-reloc.h (relocate_section): Pass output_section to
9545         relocate.
9546         * i386.cc (Target_i386::should_apply_static_reloc): Add
9547         output_section parameter.  Change all callers.
9548         (Target_i386::Relocate::relocate): Add output_section parameter.
9549         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9550         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9551         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9552         * testsuite/two_file_shared.sh: New script.
9553         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9554         (check_DATA): Add two_file_shared.dbg.
9555         (two_file_shared.dbg): New target.
9556         * testsuite/Makefile.in: Rebuild.
9557
9558 2009-03-01  Ian Lance Taylor  <iant@google.com>
9559
9560         * configure.ac: Check for byteswap.h.
9561         * configure: Rebuild.
9562         * config.in: Rebuild.
9563
9564 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9565
9566         * layout.cc (Layout::find_or_add_kept_section): New function.
9567         (Layout::add_comdat): Removed.
9568         * layout.h (struct Kept_section): Move out of class Layout.
9569         Remove trailing underscores from field names.  Add group_sections
9570         field.  Rename group_ field to is_group.  Change all uses.
9571         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9572         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9573         comdat_groups_ field.
9574         (Sized_relobj::include_section_group): Use
9575         find_or_add_kept_section and Kept_section::group_sections.
9576         (Sized_relobj::include_linkonce_section): Likewise.
9577         * object.cc (class Sized_relobj): Don't define Comdat_group or
9578         Comdat_group_table.  Remove find_comdat_group and
9579         add_comdat_group.  Remove comdat_groups_ field.
9580         * plugin.cc (include_comdat_group): Use
9581         Layout::find_or_add_kept_section.
9582
9583 2009-02-28  Ian Lance Taylor  <iant@google.com>
9584
9585         * README: --gc-sections and map files are now supported.  Document
9586         some build requirements.
9587
9588         PR 6992
9589         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9590         relocatable link set the value of the section symbol to zero.
9591         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9592         relocatable link don't include the section address in the local
9593         symbol value.
9594
9595 2009-02-27  Ian Lance Taylor  <iant@google.com>
9596
9597         PR 6811
9598         * options.h (class Search_directory): Add is_system_directory.
9599         (class General_options): Declare is_in_system_directory.
9600         * options.cc (get_relative_sysroot): Make static.
9601         (get_default_sysroot): Make static.
9602         (General_optoins::is_in_system_directory): New function.
9603         * fileread.cc (Input_file::is_in_system_directory): New function.
9604         * fileread.h (class Input_file): Declare is_in_system_directory.
9605         * object.h (class Object): Add is_in_system_directory.
9606         (class Input_objects): Remove system_library_directory_ field.
9607         * object.cc (Input_objects::add_object): Don't set
9608         system_library_directory_.
9609         (input_objects::found_in_system_library_directory): Remove.
9610         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9611         parameter.  Change all callers.
9612         (Symbol_table::sized_write_globals): Likewise.
9613         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9614         Call Object::is_in_system_directory.
9615         * symtab.h (class Symbol_table): Update declarations.
9616
9617         PR 5990
9618         * descriptors.h (Open_descriptor): Add is_on_stack field.
9619         * descriptors.cc (Descriptors::open): If the descriptor is on the
9620         top of the stack, remove it.  Initialize is_on_stack field.
9621         (Descriptors::release): Only add pod to stack if it is not on the
9622         stack already.
9623         (Descriptors::close_some_descriptor): Clear stack_next and
9624         is_on_stack fields.
9625
9626         PR 7091
9627         * output.cc (Output_section::find_starting_output_address): Rename
9628         from starting_output_address; add PADDR parameter; change return
9629         type.
9630         * output.h (class Output_section): Declare
9631         find_starting_output_address instead of starting_output_address.
9632         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9633         section symbol for which we can't find a merge section.
9634
9635         PR 9836
9636         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9637         hidden or internal, force the symbol to be local.
9638         * resolve.cc (Symbol::override_visibility): Define.
9639         (Symbol::override_base): Use override_visibility.
9640         (Symbol_table::resolve): Likewise.
9641         (Symbol::override_base_with_special): Likewise.
9642         (Symbol_table::override_with_special): If the visibility is hidden
9643         or internal, force the symbol to be local.
9644         * symtab.h (class Symbol): Add set_visibility and
9645         override_visibility.
9646         * testsuite/ver_test_1.sh: New file.
9647         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9648         (check_DATA): Add ver_test_1.syms.
9649         (ver_test_1.syms): New target.
9650         * testsuite/Makefile.in: Rebuild.
9651
9652 2009-02-25  Cary Coutant  <ccoutant@google.com>
9653
9654         * layout.cc (Layout::choose_output_section): Don't rename sections
9655         when using a linker script that has a SECTIONS clause.
9656         * Makefile.in: Regenerate.
9657
9658         * testsuite/Makefile.am (script_test_5.sh): New test case.
9659         * testsuite/Makefile.in: Regenerate.
9660         * testsuite/script_test_5.cc: New file.
9661         * testsuite/script_test_5.sh: New file.
9662         * testsuite/script_test_5.t: New file.
9663
9664 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9665
9666         * archive.cc (Archive::include_member): Update calls to add_symbols.
9667         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9668         the Layout argument.
9669         * dynobj.h (do_add_symbols): Add the Layout argument.
9670         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9671         Layout argument.
9672         * object.h (Object::add_symbols): Add the Layout argument.
9673         (Object::do_add_symbols): Add the Layout argument.
9674         (Sized_relobj::do_add_symbols): Add the Layout argument.
9675         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9676         Unify the two versions.
9677         (Add_plugin_symbols): Remove.
9678         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9679         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9680         (Add_plugin_symbols): Remove.
9681         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9682         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9683         (Add_symbols::run): Make it work with Pulginobj.
9684
9685 2009-02-06  Ian Lance Taylor  <iant@google.com>
9686
9687         * object.cc (Sized_relobj::do_layout): Make info message start
9688         with lower case letter.
9689
9690 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9691
9692         * binary.cc: Fix file comment.
9693
9694         * options.h (enum Incremental_disposition): Define.
9695         (class General_options): Add new options: --incremental,
9696         --incremental_changed, --incremental_unchanged,
9697         --incremental_unknown.  Add incremental_disposition_ and
9698         implicit_incremental_ fields.
9699         (General_options::incremental_disposition): New function.
9700         (class Position_dependent_options): Add incremental_disposition
9701         option.
9702         (Position_dependent_options::copy_from_options): Set incremental
9703         dispositions.
9704         * options.cc (General_options::parse_incremental_changed): New
9705         function.
9706         (General_options::parse_incremental_unchanged): New function.
9707         (General_options::parse_incremental_unknown): New function.
9708         (General_options::General_options): Initialize new fields
9709         incremental_disposition_ and implicit_incremental_.
9710         (General_options::finalize): Check for uasge of --incremental-*
9711         without --incremental.
9712
9713 2009-02-06  Chris Demetriou  <cgd@google.com>
9714
9715         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9716         pointer and to report location as the file name associated with
9717         the symbol.
9718         (gold_undefined_symbol_at_location): New function to replace the
9719         old gold_undefined_symbol functionality.
9720         * target-reloc.h (relocate_section): Update to use
9721         gold_undefined_symbol_at_location.
9722         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9723         Call gold_undefined_symbol function rather than gold_error.
9724         * errors.h (Errors::undefined_symbol): Take location as a
9725         string, rather than calculating it from a relocation.
9726         * errors.cc (Errors::fatal): Print "fatal error:" before the
9727         formatted message.
9728         (Errors::error, Errors::error_at_location): Print "error: "
9729         before the formatted message.
9730         (Errors::undefined_symbol): Take location as a string, rather
9731         than calculating it from a relocation.
9732         (gold_undefined_symbol_at_location): New function akin to
9733         old gold_undefined_symbol, calculates location from relocation.
9734         (gold_undefined_symbol): Change to take only a Symbol pointer
9735         and to report location as the file name associated with the symbol.
9736         * testsuite/debug_msg.sh: Update for changed error messages.
9737         * testsuite/undef_symbol.sh: Likewise.
9738
9739 2009-02-04  Duncan Sands  <baldrick@free.fr>
9740
9741         PR 9812
9742         * reduced_debug_output.h
9743         (Output_reduced_debug_abbrev_section::failed): Use format for
9744         gold_warning.
9745         (Output_reduced_debug_info_section::faild): Likewise.
9746
9747 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9748
9749         * script.cc (Lazy_demangler): New class.
9750         (Version_script_info::get_symbol_version_helper): Demangle a
9751         symbol only once.
9752
9753 2009-01-29  Cary Coutant  <ccoutant@google.com>
9754
9755         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9756         to __tls_get_addr.
9757         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9758
9759 2009-01-28  Ian Lance Taylor  <iant@google.com>
9760
9761         * version.cc (version_string): Bump to 1.9.
9762
9763         * gold.h: Include <cstring> and <stdint.h>.
9764         * version.cc: Include <cstdio>.
9765         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9766         warning.
9767         * reduced_debug_output.cc (insert_into_vector): Rename from
9768         Insert_into_vector; change all callers.  Use Swap_unaligned to
9769         avoid aliasing issue; remove union since it is unnecessary.
9770
9771 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9772
9773         * Makefile.am (CCFILES): Add gc.cc.
9774         (HFILES): Add gc.h.
9775         * Makefile.in: Regenerate.
9776         * gold.cc (Gc_runner): New class.
9777         (queue_initial_tasks): Call garbage collection related tasks
9778         when corresponding options are invoked.
9779         (queue_middle_gc_tasks): New function.
9780         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9781         processed early before laying out sections during garbage collection.
9782         * gold.h (queue_middle_gc_tasks): New function.
9783         (is_prefix_of): Move from "layout.cc".
9784         * i386.cc (Target_i386::gc_process_relocs): New function.
9785         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9786         * main.cc (main): Create object of class "Garbage_collection".
9787         * object.cc (Relobj::copy_symbols_data): New function.
9788         (Relobj::is_section_name_included): New function.
9789         (Sized_relobj::do_layout): Allow this function to be called twice
9790         during garbage collection and defer layout of section during the
9791         first call.
9792         * object.h (Relobj::get_symbols_data): New function.
9793         (Relobj::is_section_name_included): New function.
9794         (Relobj::copy_symbols_data): New function.
9795         (Relobj::set_symbols_data): New function.
9796         (Relobj::get_relocs_data): New function.
9797         (Relobj::set_relocs_data): New function.
9798         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9799         (Relobj::gc_process_relocs): New function.
9800         (Relobj::do_gc_process_relocs): New pure virtual function.
9801         (Relobj::sd_): New data member.
9802         (Sized_relobj::is_output_section_offset_invalid): New function.
9803         (Sized_relobj::do_gc_process_relocs): New function.
9804         * options.h (General_options::gc_sections): Modify to not be a no-op.
9805         (General_options::print_gc_sections): New option.
9806         * plugin.cc (Plugin_finish::run): Remove function call to
9807         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9808         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9809         * reloc.cc (Read_relocs::run): Add task to process relocs and
9810         determine unreferenced sections when doing garbage collection.
9811         (Gc_process_relocs): New class.
9812         (Sized_relobj::do_gc_process_relocs): New function.
9813         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9814         sections that are garbage collected.
9815         * reloc.h (Gc_process_relocs): New class.
9816         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9817         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9818         symbols whose corresponding sections are garbage collected.
9819         (Symbol_table::Symbol_table): Add new parameter for the garbage
9820         collection object.
9821         (Symbol_table::gc_mark_undef_symbols): New function.
9822         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9823         (Symbol_table::gc_mark_dyn_syms): New function.
9824         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9825         as garbage.
9826         (Symbol_table::add_from_object): Likewise.
9827         (Symbol_table::add_from_relobj): When building shared objects, do not
9828         treat externally visible symbols as garbage.
9829         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9830         table information for static and relocatable links.
9831         * symtab.h (Symbol_table::set_gc): New function.
9832         (Symbol_table::gc): New function.
9833         (Symbol_table::gc_mark_undef_symbols): New function.
9834         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9835         (Symbol_table::gc_mark_dyn_syms): New function.
9836         (Symbol_table::gc_): New data member.
9837         * target.h (Sized_target::gc_process_relocs): New pure virtual
9838         function.
9839         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9840         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9841
9842 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9843
9844         * options.h (General_options::gc_sections): Define as a no-op for now.
9845         (General_options::no_keep_memory): Ditto.
9846         (General_options::Bshareable): Define.
9847         * options.cc (General_options::finalize): Honor -Bshareable.
9848
9849 2009-01-20  Andreas Schwab  <schwab@suse.de>
9850
9851         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9852         read the value in the contents, since we don't use it.  Use the
9853         template endianness when writing.
9854         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9855
9856 2009-01-19  Andreas Schwab  <schwab@suse.de>
9857
9858         * configure.tgt (powerpc64-*): Fix targ_obj.
9859
9860 2009-01-15  Ian Lance Taylor  <iant@google.com>
9861
9862         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9863         local symbols when stripping all symbols.
9864
9865 2009-01-14  Cary Coutant  <ccoutant@google.com>
9866
9867         * output.cc (Output_reloc): Add explicit instantiations.
9868
9869 2009-01-14  Cary Coutant  <ccoutant@google.com>
9870
9871         * archive.cc (Archive::get_elf_object_for_member): Remove call
9872         to File_read::claim_for_plugin.
9873         * descriptors.cc (Descriptors::open): Remove reference to
9874         is_claimed.
9875         (Descriptors::claim_for_plugin): Remove.
9876         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9877         (Descriptors::is_claimed): Remove.
9878         (claim_descriptor_for_plugin): Remove.
9879         * fileread.cc (File_read::claim_for_plugin): Remove.
9880         * fileread.h (File_read::claim_for_plugin): Remove.
9881         (File_read::descriptor): Reopen descriptor if necessary.
9882         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9883         (Plugin_manager::all_symbols_read): Add task parameter. Change
9884         all callers.
9885         (Plugin_manager::get_input_file): New function.
9886         (Plugin_manager::release_input_file): New function.
9887         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9888         corresponding data member.
9889         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9890         and pass to base constructor. Change all callers.
9891         (get_input_file, release_input_file): New functions.
9892         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9893         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9894         (Plugin_manager::all_symbols_read): Add task parameter.
9895         (Plugin_manager::get_input_file): New function.
9896         (Plugin_manager::release_input_file): New function.
9897         (Plugin_manager::task_): New data member.
9898         (Pluginobj::Pluginobj): Add filesize parameter.
9899         (Pluginobj::filename): New function.
9900         (Pluginobj::descriptor): New function.
9901         (Pluginobj::filesize): New function.
9902         (Pluginobj::filesize_): New data member.
9903         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9904         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9905         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9906
9907         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9908         with archive libraries.
9909         * testsuite/Makefile.in: Regenerate.
9910         * testsuite/plugin_test.c (struct sym_info): New type.
9911         (get_input_file, release_input_file): New static variables.
9912         (onload): Capture new transfer vector entries.
9913         (claim_file_hook): Stop reading at end of file according to filesize.
9914         Factor out parsing of readelf output into separate function.
9915         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9916         APIs and get the source file name from the symbol table.  Convert
9917         source file name to corresponding object file name.  Print info
9918         message when adding new input files.
9919         (parse_readelf_line): New function.
9920         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9921         * testsuite/plugin_test_2.sh: Likewise.
9922         * testsuite/plugin_test_3.sh: Likewise.
9923         * testsuite/plugin_test_4.sh: New test case.
9924
9925 2009-01-07  Ian Lance Taylor  <iant@google.com>
9926
9927         * version.cc (version_string): Bump to 1.8.
9928
9929 2008-12-23  Cary Coutant  <ccoutant@google.com>
9930
9931         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9932         * plugin.cc (Plugin_manager::finish): Rename as
9933         layout_deferred_objects.  Move cleanup to separate function.
9934         (Plugin_manager::cleanup): New function.
9935         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9936         separately.
9937         * plugin.h (Plugin_manager::finish): Rename as
9938         layout_deferred_objects.
9939         (Plugin_manager::cleanup): New function.
9940         (Plugin_manager::cleanup_done): New field.
9941
9942 2008-12-23  Cary Coutant  <ccoutant@google.com>
9943
9944         * plugin.cc (is_visible_from_outside): New function.
9945         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9946         so we don't return "IR only" status for exported symbols or -r links.
9947
9948         * testsuite/Makefile.am (plugin_test_3): New test case.
9949         * testsuite/Makefile.in: Regenerate.
9950         * testsuite/plugin_test_3.sh: New file.
9951
9952 2008-12-22  Cary Coutant  <ccoutant@google.com>
9953
9954         * object.cc (Sized_relobj::layout_section): New function.
9955         (Sized_relobj::do_layout): Defer layout of input sections until after
9956         plugin has provided replacement files.
9957         (Sized_relobj::do_layout_deferred_sections): New function.
9958         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9959         (Relobj::layout_deferred_sections): New function.
9960         (Relobj::do_layout_deferred_sections): New function.
9961         (Sized_relobj::do_layout_deferred_sections): New function.
9962         (Sized_relobj::layout_section): New function.
9963         (Sized_relobj::Deferred_layout): New structure.
9964         (Sized_relobj::deferred_layout_): New field.
9965         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9966         Change all callers.  Layout deferred sections.
9967         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9968         references.
9969         (Plugin_hook::run): Move code from do_plugin_hook inline.
9970         (Plugin_hook::do_plugin_hook): Remove.
9971         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9972         (Plugin_manager::finish): Renamed, was cleanup.
9973         (Plugin_manager::should_defer_layout): New function.
9974         (Plugin_manager::add_deferred_layout_object): New function.
9975         (Plugin_manager::Deferred_layout_list): New type.
9976         (Plugin_manager::deferred_layout_objects_): New field.
9977         (Plugin_hook::do_plugin_hook): Remove.
9978
9979 2008-12-17  Ian Lance Taylor  <iant@google.com>
9980
9981         * options.h (class General_options): Add --no case for
9982         --export-dynamic.
9983
9984 2008-12-16  Cary Coutant  <ccoutant@google.com>
9985
9986         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9987         vector.
9988         (Plugin_manager::claim_file): Create plugin object even if
9989         plugin did not call the add_symbols callback.
9990         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9991         asking for more symbols than were added.
9992         * testsuite/Makefile.am (plugin_test_1): Add test case with
9993         no global symbols.
9994         (empty.syms): New target.
9995         * testsuite/Makefile.in: Regenerate.
9996         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9997         message. Don't call add_symbols if no globals.
9998         (all_symbols_read_hook): Don't provide replacement for empty
9999         claimed file.
10000
10001 2008-12-12  Ian Lance Taylor  <iant@google.com>
10002
10003         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10004         r_type == 0 for a local symbol with r_sym == 0.
10005         (scan_relocatable_relocs): Pass r_sym to
10006         local_non_section_strategy.
10007         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10008         r_sym parameter.
10009
10010         * configure.ac: Update test for TLS descriptors: they are
10011         supported as of glibc 2.9.
10012         * configure: Rebuild.
10013
10014 2008-12-11  Ian Lance Taylor  <iant@google.com>
10015
10016         PR 7091
10017         * target-reloc.h (Default_scan_relocatable_relocs): For each
10018         function, map r_type == 0 to RELOC_DISCARD.
10019
10020 2008-12-10  Cary Coutant  <ccoutant@google.com>
10021
10022         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10023         object to override a kept COMDAT group from a plugin object.
10024
10025 2008-12-09  Ian Lance Taylor  <iant@google.com>
10026
10027         PR 7088
10028         * yyscript.y (file_cmd): Handle INPUT.
10029
10030         * testsuite/initpri1.c: Change all declarations to be full
10031         prototypes by adding void, to avoid compiler warnings.
10032
10033 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10034
10035         * options.cc (General_options::parse_plugin_opt): New.
10036         (General_options::add_plugin): The argument now is just the filename.
10037         (General_options::add_plugin_option): New.
10038         * options.h (plugin_opt): New.
10039         (add_plugin): Change argument name.
10040         (add_plugin_option): New.
10041         * plugin.cc (Plugin::load): Don't parse the plugin option.
10042         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10043         (Plugin::add_option): New.
10044         (Plugin::args_): Change type.
10045         (Plugin::filename_): New.
10046         (Plugin_manager::add_plugin_option): New.
10047         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10048         * testsuite/Makefile.in: Regenerate.
10049
10050 2008-12-05  Cary Coutant  <ccoutant@google.com>
10051
10052         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10053         Handle --strip-lto-sections option.
10054         * options.h (strip_lto_sections): New option.
10055
10056 2008-12-01  Cary Coutant  <ccoutant@google.com>
10057
10058         * plugin.cc (ld_plugin_message): Change format parameter to const.
10059         Fix mismatch between new[] and delete.
10060
10061 2008-11-14  Cary Coutant  <ccoutant@google.com>
10062
10063         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10064         instead of -1U.
10065
10066 2008-11-05  Craig Silverstein  <csilvers@google.com>
10067
10068         * options.cc (General_options::parse_dynamic_list): New function.
10069         * options.h (General_options): New flags dynamic_list,
10070         dynamic_list_data, dynamic_list_cpp_new, and
10071         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10072         (General_options::in_dynamic_list): New function.
10073         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10074         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10075         (Lex::can_continue_name): Likewise.
10076         (yylex): Likewise.
10077         (read_script_file): New parameter script_options.
10078         (read_dynamic_list): New function.
10079         (Script_options::define_dynamic_list): New function.
10080         (dynamic_list_keyword_parsecodes): New variable.
10081         (dynamic_list_keywords): New variable.
10082         * script.h (Script_options::define_dynamic_list): New function
10083         prototype.
10084         (read_dynamic_list): New function prototype.
10085         * symtab.cc (strprefix): New macro.
10086         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10087         dynamic_list_data, dynamic_list_cpp_new, and
10088         dynamic_list_cpp_typeinfo.
10089         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10090         (dynamic_list_expr): New rule.
10091         (dynamic_list_nodes): Likewise.
10092         (dynamic_list_node): Likewise.
10093         * testsuite/Makefile.am (dynamic_list): New test.
10094         * testsuite/Makefile.in: Regenerated.
10095         * testsuite/dynamic_list.t: New file.
10096         * testsuite/dynamic_list.sh: New file.
10097
10098 2008-11-05  Craig Silverstein  <csilvers@google.com>
10099
10100         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10101         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10102         (t11_last): Likewise.
10103         * testsuite/ver_test_6.c (main): Likewise.
10104
10105 2008-10-07  Cary Coutant  <ccoutant@google.com>
10106
10107         * options.c (General_options::finalize): Add check for -static and
10108         -shared.
10109         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10110         is not empty.
10111
10112 2008-10-02  Cary Coutant  <ccoutant@google.com>
10113
10114         * plugin.cc (make_sized_plugin_object): Fix conditional
10115         compilation to work when not all targets are enabled.
10116
10117 2008-09-29  Cary Coutant  <ccoutant@google.com>
10118
10119         * archive.cc (Archive::get_file_and_offset): Use filename instead
10120         of name to get library path.
10121         (Archive::include_member): Unlock external member of a thin archive.
10122
10123         * testsuite/Makefile.am (TEST_AR): New variable.
10124         (thin_archive_test_1): New test.
10125         (thin_archive_test_2): New test.
10126         * testsuite/Makefile.in: Regenerate.
10127         * testsuite/thin_archive_main.cc: New file.
10128         * testsuite/thin_archive_test_1.cc: New file.
10129         * testsuite/thin_archive_test_2.cc: New file.
10130         * testsuite/thin_archive_test_3.cc: New file.
10131         * testsuite/thin_archive_test_4.cc: New file.
10132
10133 2008-09-29  Cary Coutant  <ccoutant@google.com>
10134
10135         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10136         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10137         instead of -1U.
10138         (Sized_relobj::do_finalize_local_symbols): Likewise.
10139         (Sized_relobj::map_to_kept_section): Likewise.
10140         * object.h (Sized_relobj::invalid_address): New constant.
10141         (Sized_relobj::do_output_section_offset): Check for invalid_address
10142         and return -1ULL.
10143         * output.cc (Output_reloc::local_section_offset): Use constant
10144         invalid_address instead of -1U.
10145         (Output_reloc::get_address): Likewise.
10146         (Output_section::output_address): Change -1U to -1ULL.
10147         * output.h (Output_reloc::invalid_address): New constant.
10148         * reloc.cc (Sized_relobj::write_sections): Use constant
10149         invalid_address instead of -1U.
10150         (Sized_relobj::relocate_sections): Likewise.
10151         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10152         values for merge sections.
10153         * target-reloc.h (relocate_for_relocatable): Use constant
10154         invalid_address instead of -1U.
10155
10156 2008-09-19  Cary Coutant  <ccoutant@google.com>
10157
10158         Add plugin functionality for link-time optimization (LTO).
10159         * configure.ac (plugins): Add --enable-plugins option.
10160         * configure: Regenerate.
10161         * config.in: Regenerate.
10162         * Makefile.am (LIBDL): New variable.
10163         (CCFILES): Add plugin.cc.
10164         (HFILES): Add plugin.h.
10165         (ldadd_var): Add LIBDL.
10166         * Makefile.in: Regenerate.
10167
10168         * archive.cc: Include "plugin.h".
10169         (Archive::setup): Don't preread archive symbols when using a plugin.
10170         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10171         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10172         files.
10173         (Archive::include_member): Add symbols from plugin objects.
10174         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10175         * descriptors.cc (Descriptors::open): Check for file descriptors
10176         abandoned by plugins.
10177         (Descriptors::claim_for_plugin): New function.
10178         * descriptors.h (Descriptors::claim_for_plugin): New function.
10179         (Open_descriptor::is_claimed): New field.
10180         (claim_descriptor_for_plugin): New function.
10181         * fileread.cc (File_read::claim_for_plugin): New function.
10182         * fileread.h (File_read::claim_for_plugin): New function.
10183         (File_read::descriptor): New function.
10184         * gold.cc: Include "plugin.h".
10185         (queue_initial_tasks): Add task to call plugin hooks for generating
10186         new object files.
10187         * main.cc: Include "plugin.h".
10188         (main): Load plugin libraries.
10189         * object.h (Pluginobj): Declare.
10190         (Object::pluginobj): New function.
10191         (Object::do_pluginobj): New function.
10192         (Object::set_target): New function.
10193         * options.cc: Include "plugin.h".
10194         (General_options::parse_plugin): New function.
10195         (General_options::General_options): Initialize plugins_ field.
10196         (General_options::add_plugin): New function.
10197         * options.h (Plugin_manager): Declare.
10198         (General_options): Add --plugin option.
10199         (General_options::has_plugins): New function.
10200         (General_options::plugins): New function.
10201         (General_options::add_plugin): New function.
10202         (General_options::plugins_): New field.
10203         * plugin.cc: New file.
10204         * plugin.h: New file.
10205         * readsyms.cc: Include "plugin.h".
10206         (Read_symbols::do_read_symbols): Check for archive before checking
10207         for ELF file.  Call plugin hooks to claim files.
10208         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10209         from a real object file; force override when processing replacement
10210         files.
10211         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10212         (Symbol::init_base_object): Likewise.
10213         (Symbol::init_base_output_data): Likewise.
10214         (Symbol::init_base_output_segment): Likewise.
10215         (Symbol::init_base_constant): Likewise.
10216         (Symbol::init_base_undefined): Likewise.
10217         (Symbol::output_section): Assert that object is not a plugin.
10218         (Symbol_table::add_from_pluginobj): New function.
10219         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10220         undefined.
10221         (Symbol_table::sized_write_globals): Likewise.
10222         (Symbol_table::add_from_pluginobj): Instantiate template.
10223         * symtab.h (Sized_pluginobj): Declare.
10224         (Symbol::in_real_elf): New function.
10225         (Symbol::set_in_real_elf): New function.
10226         (Symbol::in_real_elf_): New field.
10227         (Symbol_table::add_from_pluginobj): New function.
10228
10229         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10230         (LIBDL): New variable.
10231         (LDADD): Add LIBDL.
10232         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10233         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10234         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10235         (MOSTLYCLEANFILES): Likewise.
10236         * testsuite/Makefile.in: Regenerate.
10237         * testsuite/plugin_test.c: New file.
10238         * testsuite/plugin_test_1.sh: New file.
10239         * testsuite/plugin_test_2.sh: New file.
10240
10241 2008-09-16  Ian Lance Taylor  <iant@google.com>
10242
10243         * target-reloc.h (relocate_section): Check whether a symbol is
10244         defined by the ABI before reporting an undefined symbol error.
10245         * target.h (Target::is_defined_by_abi): Make parameter const.
10246         (Target::do_is_defined_by_abi): Likewise.
10247         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10248         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10249         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10250         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10251         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10252         * testsuite/Makefile.in: Rebuild.
10253
10254         * fileread.cc (make_view): Add casts to avoid warning.
10255
10256 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10257
10258         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10259         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10260
10261 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10262
10263         * options.h (General_options::output_is_executable): New.
10264         (General_options::output_is_pie): New.
10265         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10266         for shared libraries.
10267         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10268
10269 2008-09-11  Chris Demetriou  <cgd@google.com>
10270
10271         * options.h (origin): New -z option.
10272         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10273         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10274         in DT_FLAGS_1.
10275
10276 2008-09-05  Cary Coutant  <ccoutant@google.com>
10277
10278         * fileread.cc (File_read::make_view): Add check for attempt to map
10279         beyond end of file.
10280
10281 2008-09-05  Cary Coutant  <ccoutant@google.com>
10282
10283         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10284         explicit instantiations.
10285
10286 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10287
10288         PR gold/6858
10289         * options.cc (General_options::finalize): Allow undefined symbols
10290         in shlibs if linking -shared.
10291
10292         PR gold/6859
10293         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10294         symbols as not needing a dynsym entry.
10295
10296 2008-08-20  Craig Silverstein  <csilvers@google.com>
10297
10298         * fileread.cc (File_read::open): Do not lock the file unless it
10299         was successfully opened.
10300
10301 2008-08-14  Cary Coutant  <ccoutant@google.com>
10302
10303         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10304         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10305         * testsuite/tls_test.cc (struct int128): 128-bit struct
10306         for testing TLS relocs with non-zero addend.
10307         (v12): New TLS variable.
10308         (t12): New test.
10309         (t_last): Add check for v12.
10310         * testsuite/tls_test.h (t12): New function.
10311         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10312
10313 2008-08-13  Ian Lance Taylor  <iant@google.com>
10314
10315         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10316         set tls_segment_ or relro_segment_.
10317         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10318         when appropriate.
10319         * output.h (Output_section::clear_is_relro): New function.
10320         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10321         sections specially even when output_data_ is empty.
10322         (Output_segment::maximum_alignment): When first section is relro,
10323         only force alignment for PT_LOAD segments.
10324         * script.cc (script_data_segment_align): New function.
10325         (script_data_segment_relro_end): New function.
10326         * script-c.h (script_data_segment_align): Declare.
10327         (script_data_segment_relro_end): Declare.
10328         * script-sections.h (class Script_sections): Declare
10329         data_segment_align and data_segment_relro_end.  Add fields
10330         segment_align_index_ and saw_relro_end_.
10331         * script-sections.cc (class Sections_element): Add set_is_relro
10332         virtual function.  Add new bool* parameter to place_orphan_here.
10333         Add get_output_section virtual function.
10334         (class Output_section_definition): Add set_is_relro.  Add new
10335         bool* parameter to place_orphan_here.  Add get_output_section.
10336         Add is_relro_ field.
10337         (Output_section_definition::Output_section_definition): Initialize
10338         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10339         and is_relro_ fields.
10340         (Output_section_definition::place_orphan_here): Add is_relro
10341         parameter.
10342         (Output_section_definition::set_section_addresses): Set relro for
10343         output section.
10344         (Output_section_definition::alternate_constraint): Likewise.
10345         (class Orphan_output_section): Add new bool* parameter to
10346         place_orphan_here.  Add get_output_section.
10347         (Orphan_output_section::place_orphan_here): Add is_relro
10348         parameter.
10349         (Script_sections::Script_sections): Initialize
10350         data_segment_align_index_ and saw_relro_end_.
10351         (Script_sections::data_segment_align): New function.
10352         (Script_sections::data_segment_relro_end): New function.
10353         (Script_sections::place_orphan): Set or clear is_relro.
10354         (Script_sections::set_section_addresses): Force alignment of first
10355         TLS section.
10356         * yyscript.y (exp): Call script_data_segment_align and
10357         script_data_segment_relro_end.
10358         * testsuite/relro_script_test.t: New file.
10359         * testsuite/relro_test.cc (using_script): Declare.
10360         (t1, t2): Test using_script.
10361         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10362         (relro_script_test_SOURCES): Define.
10363         (relro_script_test_DEPENDENCIES): Define.
10364         (relro_script_test_LDFLAGS): Define.
10365         (relro_script_test_LDADD): Define.
10366         (relro_script_test.so): New target.
10367         * testsuite/Makefile.in: Rebuild.
10368
10369 2008-08-06  Cary Coutant <ccoutant@google.com>
10370
10371         * archive.cc (Archive::total_archives, Archive::total_members)
10372         (Archive::total_members_loaded): New variables.
10373         (Archive::setup): Add parameter.  Add option to preread
10374         archive symbols.
10375         (Archive::read_armap): Add counter.
10376         (Archive::get_file_and_offset): New function.
10377         (Archive::get_elf_object_for_member): New function.
10378         (Archive::read_all_symbols): New function.
10379         (Archive::read_symbols): New function.
10380         (Archive::add_symbols): Add counters.
10381         (Archive::include_all_members): Use armap to find members if it's
10382         already built.
10383         (Archive::include_member): Skip reading symbols if already read.
10384         Factored code into Archive::get_file_and_offset and
10385         Archive::get_elf_object_for_member.  Changed call to
10386         Mapfile::report_include_archive_member.
10387         (Archive::print_stats): New function.
10388         * archive.h: Declare Object and Read_symbols_data classes.
10389         (Archive::Archive): Add initializers for new members.
10390         (Archive::setup): Add parameter.
10391         (Archive::print_stats): New function.
10392         (Archive::total_archives, Archive::total_members)
10393         (Archive::total_members_loaded): New variables.
10394         (Archive::get_file_and_offset): New function.
10395         (Archive::get_elf_object_for_member): New function.
10396         (Archive::read_all_symbols): New function.
10397         (Archive::read_symbols): New function.
10398         (Archive::Archive_member): New class.
10399         (Archive::members_): New member.
10400         (Archive::num_members_): New member.
10401         * main.cc: Include archive.h.
10402         (main): Call Archive::print_stats.
10403         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10404         archive parameter; member_name is now the fully-decorated name.
10405         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10406         * options.h: (General_options): Add --preread-archive-symbols option.
10407         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10408         Archive::setup.
10409
10410 2008-08-04  Ian Lance Taylor  <iant@google.com>
10411
10412         * symtab.h (Symbol::use_plt_offset): New function.
10413         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10414         * powerpc.cc (Relocate::relocate): Likewise.
10415         * sparc.cc (Relocate::relocate): Likewise.
10416         * x86_64.cc (Relocate::relocate): Likewise.
10417         * testsuite/weak_plt.sh: New test.
10418         * testsuite/weak_plt_main.cc: New test.
10419         * testsuite/weak_plt_shared.cc: New test.
10420         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10421         (check_PROGRAMS): Add weak_plt.
10422         (check_DATA): Add weak_plt_shared.so.
10423         (weak_plt_main_pic.o, weak_plt): New targets.
10424         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10425         * testsuite/Makefile.in: Rebuild.
10426
10427         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10428         gcctestdir/ld.
10429         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10430         * testsuite/Makefile.in: Rebuild.
10431
10432 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10433
10434         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10435         * Makefile.in: Regenerate.
10436         * po/POTFILES.in: Regenerate.
10437
10438 2008-07-29  Ian Lance Taylor  <iant@google.com>
10439
10440         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10441         symbols before other symbols.
10442         * testsuite/script_test_2.cc (test_addr): Declare.
10443         (test_addr_alias): Declare.
10444         (main): Check that test_addr and test_addr_alias have the right
10445         values.
10446         * testsuite/script_test_2.t: Define test_addr_alias and
10447         test_addr.
10448
10449 2008-07-24  Ian Lance Taylor  <iant@google.com>
10450
10451         PR 5990
10452         * descriptors.cc: New file.
10453         * descriptors.h: New file.
10454         * gold-threads.h (class Hold_optional_lock): New class.
10455         * fileread.cc: Include "descriptors.h".
10456         (File_read::~File_read): Release descriptor rather than closing
10457         it.
10458         (File_read::open) [file]: Call open_descriptor rather than open.
10459         Set is_descriptor_opened_.
10460         (File_read::open) [memory]: Assert that descriptor is not open.
10461         (File_read::reopen_descriptor): New function.
10462         (File_read::release): Release descriptor.
10463         (File_read::do_read): Make non-const.  Reopen descriptor.
10464         (File_read::read): Make non-const.
10465         (File_read::make_view): Reopen descriptor.
10466         (File_read::do_readv): Likewise.
10467         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10468         Update declarations.
10469         * layout.cc: Include "descriptors.h".
10470         (Layout::create_build_id): Use open_descriptor rather than open.
10471         * output.cc: Include "descriptors.h".
10472         (Output_file::open): Use open_descriptor rather than open.
10473         * archive.cc (Archive::const_iterator): Change Archive to be
10474         non-const.
10475         (Archive::begin, Archive::end): Make non-const.
10476         (Archive::count_members): Likewise.
10477         * archive.h (class Archive): Update declarations.
10478         * object.h (Object::read): Make non-const.
10479         * Makefile.am (CCFILES): Add descriptors.cc.
10480         (HFILES): Add descriptors.h.
10481         * Makefile.in: Rebuild.
10482
10483         PR 6716
10484         * gold.h: Always include <clocale>.  Add Solaris workarounds
10485         following code in binutils/sysdep.h.
10486
10487         PR 6048
10488         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10489         this->eh_frame_hdr_ is NULL before using it.
10490
10491         * dynobj.cc (Versions::Versions): Update comment.
10492
10493         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10494         the base version name.
10495
10496         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10497         array size plus one.
10498         (Stringpool_template::set_string_offsets): Subtract one from key
10499         before using it as an array index.
10500         (Stringpool_template::get_offset_with_length): Likewise.
10501         (Stringpool_template::write_to_buffer): Likewise.
10502         * stringpool.h (Stringpool_template::get_offset_from_key):
10503         Likewise.
10504
10505 2008-07-23  Ian Lance Taylor  <iant@google.com>
10506
10507         PR 6658
10508         * object.h (Merged_symbol_value::value): Do our best to handle a
10509         negative addend.
10510
10511         PR 6647
10512         * script.cc (Version_script_info::get_versions): Don't add empty
10513         version tag to return value.
10514         (Version_script_info::get_symbol_version_helper): Change return
10515         type to bool.  Add pversion parameter.  Change all callers.
10516         (script_register_vers_node): Don't require a non-NULL tag.
10517         * script.h (class Version_script_info): Update declarations.
10518         (Version_script_info::get_symbol_version): Change return type to
10519         bool.  Add version parameter.  Change all callers.
10520         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10521         handling.  Handle an empty version from a version script.
10522         (Symbol_table::define_special_symbol): Likewise.
10523         * testsuite/ver_test_10.script: New file.
10524         * testsuite/ver_test_10.sh: New file.
10525         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10526         (check_DATA): Add ver_test_10.syms.
10527         (ver_test_10.syms, ver_test_10.so): New target.
10528         * testsuite/Makefile.in: Rebuild.
10529
10530 2008-07-23  Simon Baldwin  <simonb@google.com>
10531
10532         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10533         to zero for undefined symbols from dynamic libraries.
10534
10535 2008-07-23  Ian Lance Taylor  <iant@google.com>
10536
10537         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10538         Change all callers.
10539         * symtab.h (class Symbol_table): Update declaration.
10540         * testsuite/ver_test_9.cc: New file.
10541         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10542         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10543         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10544         (ver_test_9.so, ver_test_9.o): New targets.
10545         * testsuite/Makefile.in: Rebuild.
10546
10547 2008-07-22  Ian Lance Taylor  <iant@google.com>
10548
10549         * options.h (class General_options): Define --check-sections.
10550         * layout.cc (Layout::set_segment_offsets): Handle
10551         --check-sections.
10552
10553         * options.h (class General_options): Define -n/--nmagic and
10554         -N/--omagic.
10555         * options.cc (General_options::finalize): For -n/--nmagic or
10556         -N/--omagic, set -static.
10557         * layout.cc (Layout::attach_allocated_section_to_segment): If
10558         -N/--omagic, don't put read-only and read-write sections in
10559         different segments.
10560         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10561         finding a read-only segment.
10562         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10563         don't set the minimum segment alignment to the common page size,
10564         and don't set the file offset to the address modulo the page size.
10565         * script-sections.cc (Script_sections::create_segments): If
10566         -n/--omagic, don't put read-only and read-write sections in
10567         different segments.
10568
10569         * cref.cc: New file.
10570         * cref.h: New file.
10571         * options.h (class General_options): Add --print-symbol-counts.
10572         * main.cc (main): Issue defined symbol report if requested.
10573         * archive.cc (Archive::interpret_header): Make into a const member
10574         function.
10575         (Archive::add_symbols): Call Input_objects::archive_start and
10576         archive_stop.
10577         (Archive::const_iterator): Define new class.
10578         (Archive::begin, Archive::end): New functions.
10579         (Archive::include_all_members): Rewrite to use iterator.
10580         (Archive::count_members): New function.
10581         * archive.h (class Archive): Update declarations.
10582         (Archive::filename): New function.
10583         * object.cc: Include "cref.h".
10584         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10585         (Sized_relobj::do_get_global_symbol_counts): New function.
10586         (Input_objects::add_object): Add object to cross-referencer.
10587         (Input_objects::archive_start): New function.
10588         (Input_objects::archive_stop): New function.
10589         (Input_objects::print_symbol_counts): New function.
10590         * object.h: Declare Cref and Archive.
10591         (Object::get_global_symbol_counts): New function.
10592         (Object::do_get_global_symbol_counts): New pure virtual function.
10593         (class Sized_relobj): Add defined_count_ field.  Update
10594         declarations.
10595         (class Input_objects): Add cref_ field.  Update constructor.
10596         Update declarations.
10597         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10598         defined_count_.
10599         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10600         symbol counts.
10601         (Sized_dynobj::do_get_global_symbol_counts): New function.
10602         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10603         defined_count_.  Update declarations.  Define Symbols typedef.
10604         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10605         parameter.  Change all callers.
10606         (Symbol_table::add_from_dynobj): Add sympointers and defined
10607         parameters.  Change all callers.
10608         * symtab.h (class Symbol_table): Update declarations.
10609         * Makefile.am (CCFILES): Add cref.cc.
10610         (HFILES): Add cref.h.
10611         * Makefile.in: Rebuild.
10612
10613 2008-07-22  Simon Baldwin  <simonb@google.com>
10614
10615         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10616         to zero when writing undefined symbols.
10617
10618 2008-07-22  Ian Lance Taylor  <iant@google.com>
10619
10620         * output.cc (Output_section::add_input_section): Don't try to
10621         merge empty merge sections.
10622
10623 2008-07-21  Craig Silverstein  <csilvers@google.com>
10624
10625         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10626         Include symbol version in error message.
10627
10628 2008-07-20  Chris Demetriou  <cgd@google.com>
10629
10630         * configure.ac (gold_cv_c_random_seed): New configured variable.
10631         (RANDOM_SEED_CFLAGS): New substituted variable.
10632         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10633         * configure: Rebuild.
10634         * Makefile.in: Likewise.
10635         * testsuite/Makefile.in: Likewise.
10636
10637 2008-07-18  Ian Lance Taylor  <iant@google.com>
10638
10639         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10640         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10641         * testsuite/ver_test_main.cc (main): Call t4.
10642         (t4, t4_2a): Define.
10643         * testsuite/ver_test_2.cc (t4_2): Define.
10644         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10645         * testsuite/ver_test_4.cc (t4_2a): Define.
10646         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10647         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10648
10649 2008-07-17  Ian Lance Taylor  <iant@google.com>
10650
10651         * dynobj.cc (Versions::add_def): If we give an error about a
10652         missing version, go ahead and create the version anyhow.
10653
10654 2008-07-10  Ian Lance Taylor  <iant@google.com>
10655
10656         Handle output sections with more than 0x7fffffff bytes.
10657         * object.h (class Relobj): Change map_to_output_ to
10658         output_sections_, and just keep a section pointer.  Change all
10659         uses.  Move comdat group support to Sized_relobj.
10660         (Relobj::is_section_specially_mapped): Remove.
10661         (Relobj::output_section): Remove poff parameter.  Change all
10662         callers.
10663         (Relobj::output_section_offset): New function.
10664         (Relobj::set_section_offset): Rewrite.
10665         (Relobj::map_to_output): Remove.
10666         (Relobj::output_sections): New function.
10667         (Relobj::do_output_section_offset): New pure virtual function.
10668         (Relobj::do_set_section_offset): Likewise.
10669         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10670         group support from Relobj.  Update declarations.
10671         (Sized_relobj::get_output_section_offset): New function.
10672         (Sized_relobj::do_output_section_offset): New function.
10673         (Sized_relobj::do_set_section_offset): New function.
10674         * object.cc (Relobj::output_section_address): Remove.
10675         (Sized_relobj::Sized_relobj): Initialize new fields.
10676         (Sized_relobj::include_section_group): Cast find_kept_object to
10677         Sized_relobj.
10678         (Sized_relobj::include_linkonce_section): Likewise.
10679         (Sized_relobj::do_layout): Use separate arrays for output section
10680         and output offset.
10681         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10682         output_sections.
10683         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10684         output_sections and section_offsets.
10685         (Sized_relobj::write_local_symbols): Likewise.
10686         (map_to_kept_section): Compute output address directly.
10687         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10688         output_sections and section_offsets.
10689         (Sized_relobj::write_sections): Likewise.
10690         (Sized_relobj::relocate_sections): Likewise.
10691         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10692         * output.h (class Output_reloc): Update declarations.  Change
10693         u2_.relobj to Sized_relobj*.
10694         (class Output_data_reloc): Change add functions to use
10695         Sized_relobj*.
10696         * output.cc (Output_reloc::Output_reloc): Change relobj to
10697         Sized_relobj*.
10698         (Output_reloc::local_section_offset): Change return type to
10699         Elf_Addr.  Use get_output_section_offset.
10700         (Output_reloc::get_address): Likewise.
10701         (Output_section::is_input_address_mapped): Don't call
10702         is_section_specially_mapped.
10703         (Output_section::output_offset): Likewise.
10704         (Output_section::output_address): Likewise.
10705         (Output_section::starting_output_address): Likewise.
10706         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10707         parameter to Sized_relobj*.
10708         (Copy_relocs::need_copy_reloc): Likewise.
10709         (Copy_relocs::save): Likewise.
10710         * copy-relocs.h (class Copy_relocs): Update declarations.
10711         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10712         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10713         * target-reloc.h (relocate_for_relocatable): Change
10714         offset_in_output_section type to Elf_Addr.  Change code that uses
10715         it as well.
10716         * layout.cc (Layout::layout): Always set *off.
10717         * mapfile.cc (Mapfile::print_input_section): Use
10718         output_section_offset.
10719         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10720         Sized_relobj*.
10721         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10722         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10723         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10724
10725 2008-07-03  Ian Lance Taylor  <iant@google.com>
10726
10727         * layout.cc (Layout::include_section): Do not discard unrecognized
10728         SHT_STRTAB sections.
10729
10730 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10731
10732         * script.cc (Lex::can_continue_name): Make '?' allowable in
10733         version-script names.
10734         * testsuite/version_script.map: Change glob pattern to use '?'
10735
10736 2008-06-30  Manish Singh  <yosh@gimp.org>
10737
10738         PR 6585
10739         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10740         Correct typo.
10741
10742 2008-06-30  Ian Lance Taylor  <iant@google.com>
10743
10744         PR 6660
10745         PR 6682
10746         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10747         versions]: Don't try to read the value in the contents, since we
10748         don't use it.  Use the template endianness when writing.
10749
10750 2008-06-25  Cary Coutant  <ccoutant@google.com>
10751
10752         * fileread.cc (File_read::make_view): Assert on zero-length view.
10753         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10754         symbol table when there are no symbols to read.
10755
10756 2008-06-23  Craig Silverstein  <csilvers@google.com>
10757
10758         * version.cc (version_string): Bump to 1.7
10759
10760 2008-06-18  Craig Silverstein  <csilvers@google.com>
10761
10762         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10763         constant 0xFFFF to type Valtype.
10764         (Powerpc_relocate_functions::rel16_ha): Likewise.
10765
10766 2008-06-17  Ian Lance Taylor  <iant@google.com>
10767
10768         * output.h (Output_section::Input_section): Initialize p2align_ to
10769         zero for Output_section_data constructors.
10770         (Output_section::Input_section::addralign): If not an input
10771         section, return the alignment of the Output_section_data.
10772         * testsuite/copy_test.cc: New file.
10773         * testsuite/copy_test_1.cc: New file.
10774         * testsuite/copy_test_2.cc: New file.
10775         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10776         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10777         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10778         (copy_test_1_pic.o, copy_test_1.so): New targets.
10779         (copy_test_2_pic.o, copy_test_2.so): New targets.
10780         * testsuite/Makefile.in: Rebuild.
10781
10782         * script-sections.cc (Script_sections::place_orphan): Initialize
10783         local variable exact.
10784
10785 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10786
10787         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10788
10789 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10790             David S. Miller  <davem@davemloft.net>
10791
10792         * powerpc.cc: New file.
10793         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10794         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10795         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10796         * Makefile.in: Rebuild.
10797
10798 2008-06-09  Ian Lance Taylor  <iant@google.com>
10799
10800         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10801         <exception>.
10802         (throwing, orig_terminate): New static variables.
10803         (terminate_handler): New static function.
10804         (t2): Set terminate handler.
10805
10806 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10807
10808         PR 6584
10809         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10810         alignment.
10811
10812 2008-05-30  Cary Coutant  <ccoutant@google.com>
10813
10814         * archive.cc (Archive::include_all_members) Correct to step
10815         over symbol table and extended name table in thin archives.
10816
10817 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10818
10819         PR 6407
10820         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10821         calculation.
10822
10823 2008-05-28  Caleb Howe  <cshowe@google.com>
10824
10825         * reduced_debug_output.cc: New file.
10826         * reduced_debug_output.h: New file.
10827         * options.h (class General_options): Add --strip-debug-non-line.
10828         * options.cc (General_options::finalize): Add strip_debug_non_line
10829         to the strip heirarchy.
10830         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10831         fields.
10832         * layout.cc: Include "reduced_debug_output.h".
10833         (Layout::Layout): Initialize new fields.
10834         (line_only_debug_sections): New static array.
10835         (is_lines_only_debug_sections): New static inline function.
10836         (Layout::include_section): Handle --strip-debug-non-line.
10837         (Layout::make_output_section): If --strip-debug-non-line, build
10838         new output sections for .debug_abbrev and .debug_info.
10839         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10840         gold.  Warn about possible overflow.
10841         (read_signed_LEB_128): Likewise.
10842         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10843         (read_signed_LEB_128): Declare.
10844         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10845         (HFILES): Add reduced_debug_output.h.
10846         * Makefile.in: Rebuild.
10847
10848 2008-05-21  Ian Lance Taylor  <iant@google.com>
10849
10850         * mapfile.cc: New file.
10851         * mapfile.h: New file.
10852         * options.h (class General_options): Add -M/--print-map and -Map.
10853         * options.cc (General_options::finalize): Make -M equivalent to
10854         -Map -.
10855         * main.cc: Include <cstdio> and "mapfile.h".
10856         (main): Open mapfile if requested.
10857         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10858         constructor.  Change caller.
10859         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10860         (queue_middle_tasks): Likewise.
10861         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10862         declarations.
10863         * archive.cc: Include "mapfile.h".
10864         (Archive::add_symbols): Add mapfile parameter.  Change all
10865         callers.  Pass mapfile, symbol, and reason to include_member.
10866         (Archive::include_all_members): Add mapfile parameter.  Change all
10867         callers.
10868         (Archive::include_member): Add mapfile, sym, and why parameters.
10869         Change all callers.  Report inclusion to map file.
10870         * archive.h: Include "fileread.h".
10871         (class Archive): Update declarations.
10872         (Archive::file): New const method.
10873         (class Add_archive_symbols): Add mapfile_ field.  Update
10874         constructor.  Change all callers.
10875         * readsyms.h (class Read_symbols): Likewise.
10876         (class Finish_group): Likewise.
10877         (class Read_script): Likewise.
10878         * common.cc: Include "mapfile.h".
10879         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10880         all callers.
10881         (Symbol_table::do_allocate_commons): Likewise.
10882         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10883         symbol allocation to mapfile.
10884         * common.h (class Allocate_commons_task): Add mapfile_ field.
10885         Update constructor.  Change all callers.
10886         * symtab.h (class Symbol_table): Update declarations.
10887         * layout.cc: Include "mapfile.h".
10888         (Layout_task_runner::run): Print information to mapfile.
10889         (Layout::create_gold_note): Change Output_data_fixed_space to
10890         Output_data_zero_fill.
10891         (Layout::create_build_id): Likewise.
10892         (Layout::print_to_mapfile): New function.
10893         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10894         constructor.  Change caller.
10895         (class Layout): Declare print_to_mapfile.
10896         * output.cc (Output_section::Input_section::print_to_mapfile): New
10897         function.
10898         (Output_section::add_input_section): If producing a map, always
10899         add to input_sections_ list.
10900         (Output_section::do_print_to_mapfile): New function.
10901         (Output_segment::print_sections_to_mapfile): New function.
10902         (Output_segment::print_section_list_to_mapfile): New function.
10903         * output.h: Include "mapfile.h".
10904         (Output_data::print_to_mapfile): New function.
10905         (Output_data::do_print_to_mapfile): New virtual function.
10906         (Output_segment_headers::do_print_to_mapfile): New function.
10907         (Output_file_header::do_print_to_mapfile): New function.
10908         (Output_data_const::do_print_to_mapfile): New function.
10909         (class Output_data_const_buffer): Add map_name_ field.  Update
10910         constructor.  Change all callers.  Add do_print_to_mapfile
10911         function.
10912         (class Output_data_fixed_space): Likewise.
10913         (class Output_data_space): Likewise.
10914         (class Output_data_zero_fill): New class.
10915         (Output_data_strtab::do_print_to_mapfile): New function.
10916         (Output_data_reloc_base::do_print_to_mapfile): New function.
10917         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10918         (Output_data_group::do_print_to_mapfile): New function.
10919         (Output_data_got::do_print_to_mapfile): New function.
10920         (Output_data_dynamic::do_print_to_mapfile): New function.
10921         (Output_symtab_xindex::do_print_to_mapfile): New function.
10922         (class Output_section): Declare do_print_to_mapflie.  Declare
10923         print_to_mapfile in Input_section.
10924         (class Output_segment): Declare new functions.
10925         * object.h (Sized_relobj::symbol_count): New function.
10926         * script-sections.cc
10927         (Output_section_element_dot_assignment::set_section_addresses):
10928         Change Output_data_fixed_space to Output_data_zero_fill.
10929         (Output_data_expression::do_print_to_mapfile): New function.
10930         * script.cc (read_input_script): Add mapfile parameter.  Change
10931         all callers.
10932         * script.h (read_input_script): Update declaration.
10933         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10934         (Eh_frame::do_print_to_mapfile): New function.
10935         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10936         (Output_merge_string::do_print_to_mapfile): New function.
10937         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10938         function.
10939         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10940         function.
10941         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10942         function.
10943         * Makefile.am (CCFILES): Add mapfile.cc.
10944         (HFILES): Add mapfile.h.
10945         * Makefile.in: Rebuild.
10946
10947 2008-05-19  Ian Lance Taylor  <iant@google.com>
10948
10949         * options.h (class General_options): Add -z relro.
10950         * layout.cc (Layout::Layout): Initialize relro_segment_.
10951         (Layout::add_output_section_data): Return the output section.
10952         (Layout::make_output_section): Rcognize relro sections and mark
10953         them appropriately.
10954         (Layout::attach_allocated_section_to_segment): Put relro sections
10955         in a PT_GNU_RELRO segment.
10956         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10957         section as relro.
10958         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10959         PT_TLS segments.
10960         (Layout::linkonce_mapping): Map d.rel.ro.local to
10961         .data.rel.ro.local.
10962         (Layout::output_section_name): Us .data.rel.ro.local for any
10963         section which begins with that.
10964         * layout.h (class Layout): Update add_output_section_data
10965         declaration.  Add relro_segment_ field.
10966         * output.cc (Output_section::Output_section): Initialize is_relro_
10967         and is_relro_local_ fields.
10968         (Output_segment::add_output_section): Group relro sections.
10969         (Output_segment::is_first_section_relro): New function.
10970         (Output_segment::maximum_alignment): If there is a relro section,
10971         align the segment to the common page size.
10972         (Output_segment::set_section_addresses): Track whether we are
10973         looking at relro sections.  If the last section is a relro
10974         section, align to the common page size.
10975         (Output_segment::set_section_list_addresses): Add in_relro
10976         parameter.  Change all callers.  Align to the page size when
10977         moving from relro to non-relro section.
10978         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10979         segment.
10980         * output.h (class Output_section): Add is_relro_ and
10981         is_relro_local_ fields.
10982         (Output_section::is_relro): New function.
10983         (Output_section::set_is_relro): New function.
10984         (Output_section::is_relro_local): New function.
10985         (Output_section::set_is_relro_local): New function.
10986         (class Output_segment): Update declarations.
10987         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10988         * sparc.cc (Target_sparc::got_section): Likewise.
10989         * x86_64.cc (Target_x86_64::got_section): Likewise.
10990         * testsuite/relro_test_main.cc: New file.
10991         * testsuite/relro_test.cc: New file.
10992         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10993         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10994         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10995         (relro_test.so, relro_test_pic.o): New targets.
10996         * testsuite/Makefile.in: Rebuild.
10997
10998 2008-05-16  Ian Lance Taylor  <iant@google.com>
10999
11000         * output.cc (Output_segment::add_output_section): Remove front
11001         parameter.
11002         * output.h (class Output_segment): Remove
11003         add_initial_output_section and overloaded add_output_section.
11004         Update declaration of remaining add_output_section.
11005         * layout.cc (Layout::create_interp): Call add_output_section
11006         rather than add_initial_output_section.
11007         (Layout::finish_dynamic_section): Likewise.
11008
11009         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11010         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11011         know the dynamic type.
11012         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11013         field.  Initialize it in constructor.
11014         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11015         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11016         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11017         reloc.
11018
11019         * output.cc (Output_reloc::get_address): Change return type to
11020         Elf_Addr.
11021         * output.h (class Output_reloc): Update get_address declaration.
11022         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11023         for section addresses.
11024
11025 2008-05-09  Ian Lance Taylor  <iant@google.com>
11026
11027         PR 6493
11028         * gold.cc (gold_nomem): Use return value of write.
11029
11030 2008-05-08  Ian Lance Taylor  <iant@google.com>
11031
11032         * symtab.c (Symbol::init_base_output_data): Add version
11033         parameter.  Change all callers.
11034         (Symbol::init_base_output_segment): Likewise.
11035         (Symbol::init_base_constant): Likewise.
11036         (Symbol::init_base_undefined): Likewise.
11037         (Sized_symbol::init_output_data): Likewise.
11038         (Sized_symbol::init_output_segment): Likewise.
11039         (Sized_symbol::init_constant): Likewise.
11040         (Sized_symbol::init_undefined): Likewise.
11041         (Symbol_table::do_define_in_output_data): If the new symbol has a
11042         version, mark it as the default.
11043         (Symbol_table::do_define_in_output_segment): Likewise.
11044         (Symbol_table::do_define_as_constant): Likewise.
11045         * symtab.h (class Symbol): Update declarations.
11046         (class Sized_symbol): Likewise.
11047         * resolve.cc (Symbol::override_version): New function.
11048         (Symbol::override_base): Call override_version.
11049         (Symbol::override_base_with_special): Likewise.
11050         * testsuite/ver_script_8.script: New file.
11051         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11052         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11053         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11054         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11055
11056 2008-05-06  Ian Lance Taylor  <iant@google.com>
11057
11058         PR 6049
11059         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11060         functions.
11061         (class General_options): Remove existing --undefined, and add
11062         --no-undefined instead.  Add new --undefined as synonym for -u.
11063         * archive.cc (Archive::add_symbols): Check whether symbol was
11064         named with -u.
11065         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11066         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11067         all uses.  Add IS_UNDEFINED.  Update declarations to split
11068         different versions of init_base.  Declare init_base_undefined.
11069         (Symbol::is_defined): Handle IS_UNDEFINED.
11070         (Symbol::is_undefined): Likewise.
11071         (Symbol::is_weak_undefined): Call is_undefined.
11072         (Symbol::is_absolute): Handle IS_CONSTANT.
11073         (class Sized_symbol): Update declarations to split different
11074         versions of init.  Declare init_undefined.
11075         (class Symbol_table): Declare new functions.
11076         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11077         Change all callers.
11078         (Symbol::init_base_output_data): Likewise.
11079         (Symbol::init_base_output_segment): Likewise.
11080         (Symbol::init_base_constant): Likewise.
11081         (Symbol::init_base_undefined): New function.
11082         (Sized_symbol::init_object): Rename from init.  Change all
11083         callers.
11084         (Sized_symbol::init_output_data): Likewise.
11085         (Sized_symbol::init_output_segment): Likewise.
11086         (Sized_symbol::init_constant): Likewise.
11087         (Sized_symbol::init_undefined): New function.
11088         (Symbol_table::add_undefined_symbols_from_command_line): New
11089         function.
11090         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11091         function.
11092         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11093         (Symbol::output_section): Likewise.
11094         (Symbol::set_output_section): Likewise.
11095         (Symbol_table::sized_finalize_symbol): Likewise.
11096         (Symbol_table::sized_write_globals): Likewise.
11097         * resolve.cc (Symbol_table::should_override): Likewise.
11098         (Symbol::override_base_with_special): Likewise.
11099
11100         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11101         symbol, change it to have default visibility.
11102         * testsuite/protected_1.cc: New file.
11103         * testsuite/protected_2.cc: New file.
11104         * testsuite/protected_3.cc: New file.
11105         * testsuite/protected_main_1.cc: New file.
11106         * testsuite/protected_main_2.cc: New file.
11107         * testsuite/protected_main_3.cc: New file.
11108         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11109         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11110         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11111         (protected_1.so): New target.
11112         (protected_1_pic.o, protected_2_pic.o): New targets.
11113         (protected_3_pic.o): New target.
11114         (check_PROGRAMS): Add protected_2.
11115         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11116         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11117         * testsuite/Makefile.in: Rebuild.
11118
11119         * options.h (DEFINE_var): Add set_user_set_##varname__.
11120         (DEFINE_bool_alias): New macro.
11121         (class General_options): Define -Bstatic using DEFINE_bool_alias
11122         rather than DEFINE_special.  Add --undefined as an alias for -z
11123         defs.
11124         * options.cc (General_options::parse_Bstatic): Remove.
11125
11126         * options.h (class General_options): Add --fatal-warnings.
11127         * main.cc (main): Implement --fatal-warnings.
11128         * errors.h (Errors::warning_count): New function.
11129
11130         * options.h (class General_options): Add -Bsymbolic-functions.
11131         * symtab.h (Symbol::is_preemptible): Check for
11132         -Bsymbolic-functions.
11133
11134 2008-05-05  Ian Lance Taylor  <iant@google.com>
11135
11136         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11137         as noVARNAME rather than no-VARNAME.
11138         (class General_options): Add option -z combreloc.
11139         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11140         get_address.
11141         (Output_reloc::sort_before) [SHT_REL]: New function.
11142         (Output_reloc::sort_before) [SHT_RELA]: New function.
11143         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11144         Sort_relocs_comparison.
11145         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11146         parameter.  Change all callers.
11147         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11148         sort_relocs parameter.  Change all callers.
11149         * output.cc (Output_reloc::get_address): New function, broken out
11150         of write_rel.
11151         (Output_reloc::write_rel): Call it.
11152         (Output_reloc::compare): New function.
11153         (Output_data_reloc_base::do_write): Optionally sort relocs.
11154
11155         * configure.ac: If targ_extra_obj is set, link it in.
11156         * configure.tgt: Initialize all variables.
11157         (x86_64*): Set targ_extra_obj and targ_extra_size.
11158         * configure: Rebuild.
11159
11160         * object.cc (Sized_relobj::include_section_group): Adjust section
11161         indexes read from group data.  Build vector to pass to
11162         layout_group.
11163         * layout.cc (Layout::layout_group): Add flags and shndxes
11164         parameters.  Remove contents parameter.  Change caller.  Update
11165         explicit instantiations.
11166         * layout.h (class Layout): Update layout_group declaration.
11167         * output.cc (Output_data_group::Output_data_group): Add flags and
11168         input_shndxes parameters.  Remove contents parameter.  Change
11169         caller.
11170         (Output_data_group::do_write): Change input_sections_ to
11171         input_shndxes_.
11172         * output.h (class Output_data_group): Update constructor
11173         declaration.  Rename input_sections_ to input_shndxes_.
11174         * testsuite/many_sections_test.cc: Add template.
11175
11176 2008-04-30  Cary Coutant  <ccoutant@google.com>
11177
11178         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11179
11180         * layout.cc (Layout::include_section): Refactored check for debug
11181         info section.
11182         (Layout::add_comdat): Add new parameters.  Change type
11183         of signature parameter.  Add object and shndx to signatures table.
11184         (Layout::find_kept_object): New function.
11185         * layout.h: Include <cstring>.
11186         (Layout::is_debug_info_section): New function.
11187         (Layout::add_comdat): Add new parameters.
11188         (Layout::find_kept_object): New function.
11189         (Layout::Kept_section): New struct.
11190         (Layout::Signatures): Change type of map range.
11191         * object.cc (Relobj::output_section_address): New function.
11192         (Sized_relobj::include_section_group): Add new parameters.  Change
11193         calls to Layout::add_comdat.  Change to build table of kept comdat
11194         groups and table mapping discarded sections to kept sections.
11195         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11196         (Sized_relobj::do_layout): Change calls to include_section_group and
11197         include_linkonce_section.
11198         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11199         value to zero when section is discarded.
11200         (Sized_relobj::map_to_kept_section): New function.
11201         * object.h (Relobj::output_section_address): New function.
11202         (Relobj::Comdat_group): New type.
11203         (Relobj::find_comdat_group): New function.
11204         (Relobj::Comdat_group_table): New type.
11205         (Relobj::Kept_comdat_section): New type.
11206         (Relobj::Kept_comdat_section_table): New type.
11207         (Relobj::add_comdat_group): New function.
11208         (Relobj::set_kept_comdat_section): New function.
11209         (Relobj::get_kept_comdat_section): New function.
11210         (Relobj::comdat_groups_): New field.
11211         (Relobj::kept_comdat_sections_): New field.
11212         (Symbol_value::input_value): Update comment.
11213         (Sized_relobj::map_to_kept_section) New function.
11214         (Sized_relobj::include_linkonce_section): Add new parameter.
11215         * target-reloc.h (Comdat_behavior): New type.
11216         (get_comdat_behavior): New function.
11217         (relocate_section): Add code to map a discarded section to the
11218         corresponding kept section when applying a relocation.
11219
11220 2008-04-30  Craig Silverstein  <csilvers@google.com>
11221
11222         * dwarf_reader.cc (next_generation_count): New static var.
11223         (Addr2line_cache_entry): New struct.
11224         (addr2line_cache): New static var.
11225         (Dwarf_line_info::one_addr2line): Added caching.
11226         (Dwarf_line_info::clear_addr2line_cache): New function.
11227         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11228         cache-size parameter.
11229         (Dwarf_line_info::one_addr2line_cache): New function.
11230         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11231         new cache-size argument to one_addr2line(), and clear cache.
11232
11233 2008-04-28  Cary Coutant  <ccoutant@google.com>
11234
11235         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11236         R_386_PC8 relocations.
11237
11238 2008-04-23  Ian Lance Taylor  <iant@google.com>
11239
11240         * object.cc (Sized_relobj::include_section_group): Check for
11241         invalid section group.
11242
11243         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11244         header size.
11245
11246         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11247         than read for file header.
11248         * archive.cc (Archive::include_member): Likewise.
11249
11250 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11251
11252         * aclocal.m4: Regenerate.
11253         * configure: Regenerate.
11254
11255 2008-04-19  Ian Lance Taylor  <iant@google.com>
11256
11257         * version.cc (version_string): Bump to 1.6.
11258
11259         * testsuite/Makefile.am (many_sections_r_test): New target.
11260         (many_sections_r_test_SOURCES): Remove.
11261         (many_sections_r_test_DEPENDENCIES): Remove.
11262         (many_sections_r_test_LDFLAGS): Remove.
11263         (many_sections_r_test_LDADD): Remove.
11264
11265         * object.cc (Sized_relobj::do_add_symbols): Always pass
11266         local_symbol_count_ to add_from_relobj.
11267
11268         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11269         every thousand variables.
11270         * testsuite/Makefile.in: Rebuild.
11271
11272         * object.cc (Xindex::initialize_symtab_xindex): New function.
11273         (Xindex::read_symtab_xindex): New function.
11274         (Xindex::sym_xindex_to_shndx): New function.
11275         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11276         available.
11277         (Sized_relobj::do_initialize_xindex): New function.
11278         (Sized_relobj::do_read_symbols): Adjust section links.
11279         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11280         parameter.  Change all callers.
11281         (Sized_relobj::include_section_group): Adjust section links and
11282         symbol section indexes.
11283         (Sized_relobj::do_layout): Adjust section links.
11284         (Sized_relobj::do_count_local_symbols): Adjust section links and
11285         symbol section indexes.
11286         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11287         ordinary and special symbols.
11288         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11289         dynsym_xindex parameters.  Change all callers.  Adjust section
11290         links.  Use SHN_XINDEX when needed.
11291         (Sized_relobj::get_symbol_location_info): Adjust section links.
11292         Don't get fooled by special symbols.
11293         * object.h (class Xindex): Define.
11294         (class Object): Add xindex_ parameter.  Declare virtual functoin
11295         do_initialize_xindex.
11296         (Object::adjust_sym_shndx): New function.
11297         (Object::set_xindex): New protected function.
11298         (class Symbol_value): Add is_ordinary_shndx_ field.
11299         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11300         (Symbol_value::value): Assert ordinary section.
11301         (Symbol_value::initialize_input_to_output_map): Likewise.
11302         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11303         Change all callers.
11304         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11305         all callers.
11306         (class Sized_relobj): Update declarations.
11307         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11308         parameter.  Change all callers.
11309         (Sized_relobj::adjust_shndx): New function.
11310         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11311         field.
11312         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11313         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11314         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11315         (Sized_dynobj::read_dynsym_section): Adjust section links.
11316         (Sized_dynobj::read_dynamic): Likewise.
11317         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11318         section links.
11319         (Sized_dynobj::do_initialize_xindex): New function.
11320         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11321         do_initialize_xindex.
11322         (Sized_dynobj::adjust_shndx): New function.
11323         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11324         dynsym_xindex_ fields.
11325         (Layout::finalize): Add a call to set_section_indexes before
11326         creating the symtab sections.
11327         (Layout::set_section_indexes): Don't do anything if the section
11328         already has a section index.
11329         (Layout::create_symtab_sections): Add shnum parameter.  Change
11330         caller.  Create .symtab_shndx section if needed.
11331         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11332         caller.
11333         (Layout::allocated_output_section_count): New function.
11334         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11335         needed.
11336         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11337         fields.  Update declarations.
11338         (Layout::symtab_xindex): New function.
11339         (Layout::dynsym_xindex): New function.
11340         (class Write_symbols_task): Add layout_ field.
11341         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11342         Change caller.
11343         * output.cc (Output_section_headers::Output_section_headers): Add
11344         shstrtab_section parameter.  Change all callers.
11345         (Output_section_headers::do_sized_write): Store overflow values
11346         for section count and section string table section index in
11347         section header zero.
11348         (Output_file_header::do_sized_write): Check for overflow of
11349         section count and section string table section index.
11350         (Output_symtab_xindex::do_write): New function.
11351         (Output_symtab_xindex::endian_do_write): New function.
11352         * output.h (class Output_section_headers): Add shstrtab_section_.
11353         Update declarations.
11354         (class Output_symtab_xindex): Define.
11355         (Output_section::has_out_shndx): New function.
11356         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11357         field.
11358         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11359         Change all callers.
11360         (Sized_symbol::init): Likewise.
11361         (Symbol::output_section): Check for ordinary symbol.
11362         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11363         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11364         callers.
11365         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11366         Change all callers.  Simplify handling of symbols from sections
11367         not included in the link.
11368         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11369         distinction.
11370         (Weak_alias_sorter::operator()): Assert that symbols are
11371         ordinary.
11372         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11373         distinction.
11374         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11375         parameters.  Change all callers.
11376         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11377         symbol distinction.  Use SHN_XINDEX when needed.
11378         (Symbol_table::write_section_symbol): Add symtab_xindex
11379         parameter.  Change all callers.
11380         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11381         SHN_XINDEX when needed.
11382         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11383         declarations.
11384         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11385         (Symbol::is_defined): Check is_ordinary.
11386         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11387         (Symbol::is_absolute, Symbol::is_common): Likewise.
11388         (class Sized_symbol): Update declarations.
11389         (class Symbol_table): Update declarations.
11390         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11391         parameters.  Change all callers.
11392         (Sized_symbol::override): Likewise.
11393         (Symbol_table::override): Likewise.
11394         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11395         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11396         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11397         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11398         to be in an ordinary section.
11399         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11400         object and is_ordinary parameters.  Change all callers.
11401         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11402         Change all callers.  Don't add undefined or non-ordinary symbols
11403         to reloc_map_.
11404         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11405         Change all callers.
11406         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11407         declarations.
11408         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11409         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11410         (Sized_relobj::relocate_sections): Likewise.
11411         * target-reloc.h (scan_relocs): Adjust section symbol index.
11412         (scan_relocatable_relocs): Likewise.
11413         * i386.cc (Scan::local): Check for ordinary symbols.
11414         * sparc.cc (Scan::local): Likewise.
11415         * x86_64.cc (Scan::local): Likewise.
11416         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11417         to symbol_section_and_value.
11418         * testsuite/many_sections_test.cc: New file.
11419         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11420         (check_PROGRAMS): Add many_sections_test.
11421         (many_sections_test_SOURCES): Define.
11422         (many_sections_test_DEPENDENCIES): Define.
11423         (many_sections_test_LDFLAGS): Define.
11424         (BUILT_SOURCES): Add many_sections_define.h.
11425         (many_sections_define.h): New target.
11426         (BUILT_SOURCES): Add many_sections_check.h.
11427         (many_sections_check.h): New target.
11428         (check_PROGRAMS): Add many_sections_r_test.
11429         (many_sections_r_test_SOURCES): Define.
11430         (many_sections_r_test_DEPENDENCIES): Define.
11431         (many_sections_r_test_LDFLAGS): Define.
11432         (many_sections_r_test_LDADD): Define.
11433         (many_sections_r_test.o): New target.
11434         * testsuite/Makefile.in: Rebuild.
11435
11436 2008-04-17  Cary Coutant  <ccoutant@google.com>
11437
11438         * errors.cc (Errors::info): New function.
11439         (gold_info): New function.
11440         * errors.h (Errors::info): New function.
11441         * gold.h (gold_info): New function.
11442         * object.cc (Input_objects::add_object): Print trace output.
11443         * options.cc (options::parse_set): New function.
11444         (General_options::parse_wrap): Deleted.
11445         (General_options::General_options): Deleted initializer.
11446         * options.h (options::String_set): New typedef.
11447         (options::parse_set): New function.
11448         (DEFINE_set): New macro.
11449         (General_options::wrap): Changed to use DEFINE_set. Changed
11450         callers of any_wrap_symbols and is_wrap_symbol.
11451         (General_options::trace, General_options::trace_symbol):
11452         New options.
11453         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11454         (General_options::wrap_symbols_): Deleted.
11455         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11456
11457 2008-04-17  David S. Miller  <davem@davemloft.net>
11458
11459         * options.cc (General_options::parse_V): New function.
11460         * options.h: Add entries for -V and -Qy.
11461
11462 2008-04-17  Ian Lance Taylor  <iant@google.com>
11463
11464         * common.cc (Symbol_table::allocate_commons): Remove options
11465         parameter.  Change caller.
11466         (Symbol_table::do_allocate_commons): Remove options parameter.
11467         Change caller.  Just call do_allocate_commons_list twice.
11468         (Symbol_table::do_allocate_commons_list): New function, broken out
11469         of do_allocate_commons.
11470         * common.h (class Allocate_commons_task): Remove options_ field.
11471         Update constructor.
11472         * symtab.cc (Symbol_table::Symbol_table): Initialize
11473         tls_commons_.
11474         (Symbol_table::add_from_object): Put TLS common symbols on
11475         tls_commons_ list.
11476         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11477         which are IN_OUTPUT_DATA.
11478         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11479         allocate_commons and do_allocate_commons declarations.  Declare
11480         do_allocate_commons_list.
11481         * gold.cc (queue_middle_tasks): Update creation of
11482         Allocate_commons_task to not pass options.
11483         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11484         (TLS_TEST_C_FLAGS): New variable.
11485         (tls_test_c_pic.o): New target.
11486         (tls_test_shared.so): Link in tls_test_c_pic.o.
11487         (tls_test_c_pic_ie.o): New target.
11488         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11489         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11490         (tls_test_c.o): New target.
11491         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11492         (tls_pic_test_LDADD): Likewise.
11493         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11494         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11495         (tls_test_c_gnu2.o): New target.
11496         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11497         tls_test_c_gnu2.o.
11498         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11499         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11500         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11501         * testsuite/tls_test.cc: Include "config.h".
11502         (t_last): Call t11_last.
11503         * testsuite/tls_test.h (t11, t11_last): Declare.
11504         * testsuite/tls_test_c.c: New file.
11505         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11506         * configure.ac: Check for OpenMP support.
11507         * configure, config.in, Makefile.in: Rebuild.
11508         * testsuite/Makefile.in: Rebuild.
11509
11510 2008-04-16  Cary Coutant  <ccoutant@google.com>
11511
11512         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11513         (Target_i386::tls_base_symbol_defined_): New field.
11514         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11515         (Target_i386::Scan::global): Likewise.
11516         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11517         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11518         (Target_x86_64::tls_base_symbol_defined_): New field.
11519         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11520         (Target_x86_64::Scan::global): Likewise.
11521
11522 2008-04-16  Cary Coutant  <ccoutant@google.com>
11523
11524         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11525         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11526         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11527         building shared libraries.
11528         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11529         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11530         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11531         * testsuite/Makefile.in: Rebuild.
11532         * testsuite/weak_undef.h: New file.
11533         * testsuite/weak_undef_file1.cc: Add extra test cases.
11534         * testsuite/weak_undef_file2.cc: Likewise.
11535         * testsuite/weak_undef_test.cc: Likewise.
11536
11537 2008-04-16  David S. Miller  <davem@davemloft.net>
11538
11539         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11540         Add issued_non_pic_error_ field.  Declare check_non_pic.
11541         (Target_sparc::Scan::check_non_pic): New function.
11542         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11543         (Target_sparc::Scan::global): Likewise.
11544
11545         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11546         * configure: Rebuild.
11547
11548         * options.h (DEFINE_enable): New macro.
11549         (new_dtags): New enable option.
11550         (initfirst, interpose, loadfltr, nodefaultlib,
11551         nodelete, nodlopen, nodump): New -z options.
11552         * layout.cc (Layout:finish_dynamic_section): If new
11553         dtags enabled, emit DT_RUNPATH.  Also, emit a
11554         DT_FLAGS_1 containing any specified -z flags.
11555
11556 2008-04-16  Ian Lance Taylor  <iant@google.com>
11557
11558         * copy-relocs.cc: New file.
11559         * copy-relocs.h: New file.
11560         * reloc.cc: Remove Copy_relocs code.
11561         * reloc.h: Likewise.
11562         * reloc-types.h (struct Reloc_types) [both versions]: Add
11563         get_reloc_addend_noerror.
11564         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11565         variants of add_global which take an addend which must be zero.
11566         * i386.cc: Include "copy-relocs.h".
11567         (class Target_i386): Change type of copy_relocs_ to variable,
11568         update initializer.
11569         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11570         Change all callers.
11571         (Target_i386::do_finalize_sections): Change handling of
11572         copy_relocs_.
11573         * sparc.cc: Include "copy-relocs.h".
11574         (class Target_sparc): Change type of copy_relocs_ to variable,
11575         update initializer.
11576         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11577         Change all callers.
11578         (Target_sparc::do_finalize_sections): Change handling of
11579         copy_relocs_.
11580         * x86_64.cc: Include "copy-relocs.h".
11581         (class Target_x86_64): Change type of copy_relocs_ to variable,
11582         update initializer.
11583         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11584         class.  Change all callers.
11585         (Target_x86_64::do_finalize_sections): Change handling of
11586         copy_relocs_.
11587         * Makefile.am (CCFILES): Add copy-relocs.cc.
11588         (HFILES): Add copy-relocs.h.
11589
11590         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11591
11592         * testsuite/script_test_4.sh: Permit leading zeroes.
11593
11594 2008-04-15  Ian Lance Taylor  <iant@google.com>
11595
11596         * script-sections.cc (Script_sections::create_segments): Use
11597         header_size_adjustment even when there is enough room for the
11598         headers.
11599         * testsuite/script_test_4.sh: New file.
11600         * testsuite/script_test_4.t: New file.
11601         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11602         (check_DATA): Add script_test_4.stdout.
11603         (MOSTLYCLEANFILES): Likewise.
11604         (script_test_4): New target.
11605         (script_test_4.stdout): New target.
11606         * testsuite/Makefile.in: Rebuild.
11607
11608         * sparc.cc: Add definitions for Output_data_plt_sparc class
11609         constants.
11610
11611 2008-04-14  David S. Miller  <davem@davemloft.net>
11612
11613         * sparc.cc: New file.
11614         * Makefile.am (TARGETSOURCES): Add sparc.cc
11615         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11616         * configure.tgt: Document targ_extra_size and
11617         targ_extra_big_endian.  Add entries for sparc-* and
11618         sparc64-*.
11619         * configure.ac: Handle targ_extra_size and
11620         targ_extra_big_endian.
11621         * Makefile.in: Rebuild.
11622         * configure: Likewise.
11623         * po/POTFILES.in: Likewise.
11624         * po/gold.pot: Likewise.
11625
11626 2008-04-14  Ian Lance Taylor  <iant@google.com>
11627
11628         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11629         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11630         in the name/type/flags to section mapping.  Don't call
11631         allocate_output_section.
11632         (Layout::choose_output_section): Change parameter from adjust_name
11633         to is_input_section.  Don't permit input sections after sections
11634         are attached to segments.  Don't call allocate_output_section.
11635         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11636         not write_enable_output_section.
11637         (Layout::make_output_section): Don't push to
11638         unattached_section_list_ nor call attach_to_segment.  Call
11639         attach_section_to_segment if sections are attached.
11640         (Layout::attach_sections_to_segments): New function.
11641         (Layout::attach_section_to_segment): New function.
11642         (Layout::attach_allocated_section_to_segment): Rename from
11643         attach_to_segment.  Remove flags parameter.
11644         (Layout::allocate_output_section): Remove function.
11645         (Layout::write_enable_output_section): Remove function.
11646         * layout.h (class Layout): Update for above changes.  Add new
11647         field sections_are_attached_.
11648         * output.h (Output_section::update_flags_for_input_section): New
11649         function.
11650         * output.cc (Output_section::add_input_section): Call
11651         update_flags_for_input_section.
11652         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11653
11654 2008-04-11  Cary Coutant  <ccoutant@google.com>
11655
11656         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11657         thought unnecessary.
11658         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11659
11660 2008-04-11  Ian Lance Taylor  <iant@google.com>
11661
11662         * output.h (class Output_section_data): Remove inline definition
11663         of set_addralign.
11664         * output.cc (Output_section_data::set_addralign): New function.
11665
11666 2008-04-11  Cary Coutant  <ccoutant@google.com>
11667
11668         Add support for TLS descriptors for i386 and x86_64.
11669         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11670         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11671         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11672         GOT_TYPE_TLS_DESC.
11673         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11674         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11675         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11676         relocations.
11677         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11678         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11679         Fix problem with initial-exec relocations.
11680         (Target_i386::Relocate::relocate_tls): Likewise.
11681         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11682         relaxation.
11683         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11684         support for section-plus-offset dynamic table entries.
11685         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11686         (Output_data_dynamic::Dynamic_entry): Add support for
11687         section-plus-offset dynamic table entries.
11688         (Output_data_dynamic::Classification): Likewise.
11689         (Output_data_dynamic::classification_): Renamed offset_.
11690         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11691         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11692         (Target_x86_64::make_plt_section): New function.
11693         (Target_x86_64::reserve_tlsdesc_entries): New function.
11694         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11695         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11696         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11697         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11698         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11699         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11700         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11701         add extra PLT entry for TLS descriptors.
11702         (Output_data_plt_x86_64::got_): New field.
11703         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11704         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11705         fields.
11706         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11707         descriptors.
11708         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11709         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11710         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11711         R_386_TLS_DESC_CALL relocations.
11712         (Target_x86_64::Scan::global): Likewise.
11713         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11714         for TLS descriptors.
11715         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11716         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11717         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11718         GD-to-IE relaxation.
11719         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11720         and TLS_DESCRIPTORS.
11721         * Makefile.in: Rebuild.
11722         * configure: Rebuild.
11723         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11724         (tls_test_shared2.so): New target.
11725         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11726         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11727         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11728         (tls_shared_gd_to_ie_test_LDADD): New variable.
11729         (tls_shared_gnu2_gd_to_ie_test): New target.
11730         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11731         New targets.
11732         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11733         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11734         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11735         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11736         (tls_shared_gnu2_test): New target.
11737         (tls_test_gnu2_shared.so): New target.
11738         (tls_shared_gnu2_test_SOURCES): New variable.
11739         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11740         (tls_shared_gnu2_test_LDFLAGS): New variable.
11741         (tls_shared_gnu2_test_LDADD): New variable.
11742         * testsuite/Makefile.in: Rebuild.
11743         * testsuite/Makefile.
11744
11745 2008-04-11  Ian Lance Taylor  <iant@google.com>
11746
11747         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11748         justsyms.t.
11749         * testsuite/Makefile.in: Rebuild.
11750
11751         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11752         long.
11753         * testsuite/script_test_2.cc (main): Adjust test.
11754
11755 2008-04-11  David S. Miller  <davem@davemloft.net>
11756             Ian Lance Taylor  <iant@google.com>
11757
11758         * options.h (General_options): Add entries for '-Y' and
11759         '-relax'.
11760         * options.cc (General_options:finalize): If -Y was used, add those
11761         entries to the library path instead of the default "/lib" and
11762         "/usr/lib".
11763
11764 2008-04-11  David S. Miller  <davem@davemloft.net>
11765
11766         * testsuite/justsyms.t: Start at 0x100.
11767         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11768         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11769         long.
11770         * testsuite/script_test_2.cc: Adjust string and section length
11771         checks.
11772
11773 2008-04-09  Ian Lance Taylor  <iant@google.com>
11774
11775         PR gold/5996
11776         * script-sections.cc (Sections_element::allocate_to_segment): Add
11777         orphan parameter.
11778         (Output_section_definition::allocate_to_segment): Likewise.
11779         (Orphan_output_section::allocate_to_segment): Likewise.
11780         (Script_sections::attach_sections_using_phdrs_clause): Don't
11781         propagate non-PT_LOAD segments to orphan sections.
11782         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11783         readelf rather than objdump.
11784         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11785         .interp section and PT_INTERP segment are the same size.
11786         * testsuite/Makefile.in: Rebuild.
11787
11788         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11789         aliases for symbols defined in the same object.
11790         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11791         (weak_alias_test_SOURCES): New variable.
11792         (weak_alias_test_DEPENDENCIES): New variable.
11793         (weak_alias_test_LDFLAGS): New variable.
11794         (weak_alias_test_LDADD): New variable.
11795         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11796         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11797         (weak_alias_test_3.o): New target.
11798         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11799         * testsuite/weak_alias_test_main.cc: New file.
11800         * testsuite/weak_alias_test_1.cc: New file.
11801         * testsuite/weak_alias_test_2.cc: New file.
11802         * testsuite/weak_alias_test_3.cc: New file.
11803
11804 2008-04-08  Ian Lance Taylor  <iant@google.com>
11805
11806         * options.h (class General_options): Add --noinhibit-exec option.
11807         * main.cc (main): Check --noinhibit-exec.
11808
11809         * options.h (class General_options): Define --wrap as a special
11810         option.  Add wrap_symbols_ field.
11811         (General_options::any_wrap_symbols): New function.
11812         (General_options::is_wrap_symbol): New function.
11813         * options.cc (General_options::parse_wrap): New function.
11814         (General_options::General_options): Initialize wrap_symbols_.
11815         * symtab.cc (Symbol_table::wrap_symbol): New function.
11816         (Symbol_table::add_from_object): Handle --wrap.
11817         * symtab.h (class Symbol_table): Declare wrap_symbol.
11818         * target.h (Target::wrap_char): New function.
11819         (Target::Target_info): Add wrap_char field.
11820         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11821         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11822         * testsuite/testfile.cc (Target_test::test_target_info):
11823         Likewise.
11824
11825         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11826         there is one.
11827
11828         * layout.h (class Layout): Add added_eh_frame_data_ field.
11829         * layout.cc (Layout::Layout): Initialize new field.
11830         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11831         output section until we find a section we merged successfully.
11832         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11833         that the size be non-zero.
11834
11835         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11836         qualifier.
11837
11838 2008-04-08  Craig Silverstein  <csilvers@google.com>
11839
11840         * configure.ac: Export new conditional variable HAVE_ZLIB.
11841         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11842         on HAVE_ZLIB.
11843         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11844         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11845
11846 2008-04-07  Ian Lance Taylor  <iant@google.com>
11847
11848         * version.cc (version_string): Set to "1.5".
11849
11850         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11851         Add issued_non_pic_error_ field.  Declare check_non_pic.
11852         (Target_x86_64::Scan::check_non_pic): New function.
11853         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11854         (Target_x86_64::Scan::global): Likewise.
11855
11856         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11857         addend parameter.  Change caller.  Handle merge sections.
11858         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11859         Address to Addend.  Don't add in the result of
11860         local_section_offset, pass down the addend and use the returned
11861         value.
11862         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11863         Update declarations of local_section_offset and symbol_value.
11864         * testsuite/two_file_test_1.cc (t18): New function.
11865         * testsuite/two_file_test_2.cc (f18): New function.
11866         * testsuite/two_file_test_main.cc (main): Call t18.
11867         * testsuite/two_file_test.h (t18, f18): Declare.
11868
11869         * configure.ac: Don't test for objdump, c++filt, or readelf.
11870         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11871         conditionals.
11872         (TEST_READELF): New variable.
11873         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11874         (check_PROGRAMS): Add two_file_strip_test.
11875         (two_file_strip_test): New target.
11876         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11877         (two_file_same_shared_strip_test_SOURCES): New variable.
11878         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11879         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11880         (two_file_same_shared_strip_test_LDADD): New variable.
11881         (two_file_shared_strip.so): New target.
11882         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11883         (ver_test_5.syms, ver_test_7.syms): Likewise.
11884         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11885         (strip_test_3.stdout): Use TEST_OBJDUMP.
11886         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11887
11888 2008-04-04  Cary Coutant  <ccoutant@google.com>
11889
11890         * symtab.h (Symbol::is_weak_undefined): New function.
11891         (Symbol::is_strong_undefined): New function.
11892         (Symbol::is_absolute): New function.
11893         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11894         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11895         absolute symbols.
11896         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11897         (weak_undef_test): New target.
11898         * testsuite/Makefile.in: Rebuild.
11899         * testsuite/weak_undef_file1.cc: New file.
11900         * testsuite/weak_undef_file2.cc: New file.
11901         * testsuite/weak_undef_test.cc: New file.
11902
11903 2008-04-03  Craig Silverstein  <csilvers@google.com>
11904
11905         * compressed_output.h (class Output_compressed_section): Use
11906         unsigned buffer.
11907         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11908         add zlib header.
11909         (zlib_compressed_suffix): Removed.
11910         (Output_compressed_section::set_final_data_size): Use unsigned
11911         buffers.
11912         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11913         Fix linker invocation.
11914         (flagstest_o_specialfile_and_compress_debug_sections):
11915         Likewise.
11916         * testsuite/Makefile.in: Regenerated.
11917
11918 2008-04-02  David S. Miller  <davem@davemloft.net>
11919
11920         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11921         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11922
11923 2008-04-02  Craig Silverstein  <csilvers@google.com>
11924
11925         * TODO: New file.
11926
11927 2008-04-02  Ian Lance Taylor  <iant@google.com>
11928
11929         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11930         parameters.  Update for new key type to views_.  Change all
11931         callers.
11932         (File_read::read): Adjust for byteshift in returned view.
11933         (File_read::add_view): New function, broken out of
11934         find_and_make_view.
11935         (File_read::make_view): New function, broken out of
11936         find_and_make_view.
11937         (File_read::find_or_make_view): Add offset and aligned
11938         parameters.  Rewrite accordingly.  Change all callers.
11939         (File_read::get_view): Add offset and aligned parameters.  Adjust
11940         for byteshift in return value.
11941         (File_read::get_lasting_view): Likewise.
11942         * fileread.h (class File_read): Update declarations.
11943         (class File_read::View): Add byteshift_ field.  Add byteshift to
11944         constructor.  Add byteshift method.
11945         * archive.h (Archive::clear_uncached_views): New function.
11946         (Archive::get_view): Add aligned parameter.  Change all callers.
11947         * object.h (Object::get_view): Add aligned parameter.  Change all
11948         callers.
11949         (Object::get_lasting_view): Likewise.
11950
11951         * fileread.cc (File_read::release): Don't call clear_views if
11952         there are multiple objects.
11953         * fileread.h (File_read::clear_uncached_views): New function.
11954         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11955         on the archive.
11956
11957 2008-03-31  Cary Coutant  <ccoutant@google.com>
11958
11959         Add thin archive support.
11960         * archive.cc (Archive::armagt): New const.
11961         (Archive::setup): Remove task parameter and calls to unlock.
11962         (Archive::unlock_nested_archives): New function.
11963         (Archive::read_header): Add nested_off parameter. Change
11964         all callers.
11965         (Archive::interpret_header): Likewise.
11966         (Archive::include_all_members): Change to handle thin
11967         archives.
11968         (Archive::include_member): Likewise.
11969         * archive.h (Archive::Archive): Add new parameters and
11970         initializers.
11971         (Archive::armagt): New const.
11972         (Archive::setup): Remove task parameter.
11973         (Archive::unlock_nested_archives): New function.
11974         (Archive::read_header): Add nested_off parameter.
11975         (Archive::interpret_header): Likewise.
11976         (Archive::Nested_archive_table): New typedef.
11977         (Archive::is_thin_archive_): New field.
11978         (Archive::nested_archives_): New field.
11979         (Archive::options_): New field.
11980         (Archive::dirpath_): New field.
11981         (Archive::task_): New field.
11982         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11983         for thin archives.  Pass additional parameters to
11984         Archive::Archive.  Unlock the archive file after calling
11985         Archive::setup.
11986
11987 2008-03-29  Ian Lance Taylor  <iant@google.com>
11988
11989         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11990         version symbol to be local.
11991         * testsuite/ver_test_4.sh: New file.
11992         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11993         (check_DATA): Add ver_test_4.syms.
11994         (ver_test_4.syms): New target.
11995         * testsuite/Makefile.in: Rebuild.
11996
11997         * output.cc
11998         (Output_section::Input_section_sort_entry::has_priority): New
11999         function.
12000         (Output_section::Input_section_sort_entry::match_file_name): New
12001         function.
12002         (Output_section::Input_section_sort_entry::match_section_name):
12003         Remove.
12004         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12005         Remove.
12006         (Output_section::Input_section_sort_entry::match_section_file):
12007         Remove.
12008         (Output_section::Input_section_sort_compare::operator()): Rewrite
12009         using new Input_section_sort_entry functions.  Sort crtbegin and
12010         crtend first.  Sort sections with no priority before sections with
12011         a priority.
12012         * testsuite/initpri1.c (d3): Check j != 4.
12013         (cd5): New constructor/destructor function.
12014         (main): Check j != 2.
12015
12016         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12017         new symbol when resolving, don't call set_is_default.
12018         * testsuite/ver_test_7.cc: New file.
12019         * testsuite/ver_test_7.sh: New file.
12020         * testsuite/Makefile.am (ver_test_7.so): New target.
12021         (ver_test_7.o): New target.
12022         (check_SCRIPTS): Add ver_test_7.sh.
12023         (check_DATA): Add ver_test_7.syms.
12024         (ver_test_7.syms): New target.
12025
12026 2008-03-28  Ian Lance Taylor  <iant@google.com>
12027
12028         * layout.cc (Layout::layout): If we see an input section with a
12029         name that needs sorting, set the must_sort flag for the output
12030         section.
12031         (Layout::make_output_section): If the name of the output section
12032         indicates that it might require sorting, set the may_sort flag.
12033         * output.h (Output_section::may_sort_attached_input_sections): New
12034         function.
12035         (Output_section::set_may_sort_attached_input_sections): New
12036         function.
12037         (Output_section::must_sort_attached_input_sections): New
12038         function.
12039         (Output_section::set_must_sort_attached_input_sections): New
12040         function.
12041         (class Output_section): Declare Input_section_sort_entry.  Define
12042         Input_section_sort_compare.  Declare
12043         sort_attached_input_sections.  Add new fields:
12044         may_sort_attached_input_sections_,
12045         must_sort_attached_input_sections_,
12046         attached_input_sections_are_sorted_.
12047         * output.cc (Output_section::Output_section): Initialize new
12048         fields.
12049         (Output_section::add_input_section): Add an entry to
12050         input_sections_ if may_sort or must_sort are true.
12051         (Output_section::set_final_data_size): Call
12052         sort_attached_input_sections if necessary.
12053         (Output_section::Input_section_sort_entry): Define new class.
12054         (Output_section::Input_section_sort_compare::operator()): New
12055         function.
12056         (Output_section::sort_attached_input_sections): New function.
12057         * configure.ac: Check whether the compiler supports constructor
12058         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12059         * testsuite/initpri1.c: New file.
12060         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12061         CONSTRUCTOR_PRIORITY.
12062         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12063         (initpri1_LDFLAGS): New variable.
12064         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12065
12066 2008-03-27  Ian Lance Taylor  <iant@google.com>
12067
12068         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12069         * testsuite/common_test_1.c: New file.
12070         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12071         (common_test_1_SOURCES): New variable.
12072         (common_test_1_DEPENDENCIES): New variable.
12073         (common_test_1_LDFLAGS): New variable.
12074
12075         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12076         and commons_ correctly when NAME/VERSION does not override
12077         NAME/NULL.
12078         * testsuite/ver_test_6.c: New file.
12079         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12080         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12081         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12082
12083 2008-03-26  Ian Lance Taylor  <iant@google.com>
12084
12085         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12086         of an undefined symbol from a version script.
12087         * testsuite/Makefile.am (ver_test_5.so): New target.
12088         (ver_test_5.o): New target.
12089         (check_SCRIPTS): Add ver_test_5.sh.
12090         (check_DATA): Add ver_test_5.syms.
12091         (ver_test_5.syms): New target.
12092         * testsuite/ver_test_5.cc: New file.
12093         * testsuite/ver_test_5.script: New file.
12094         * testsuite/ver_test_5.sh: New file.
12095         * Makefile.in, testsuite/Makefile.in: Rebuild.
12096
12097         PR gold/5986
12098         Fix problems building gold with gcc 4.3.0.
12099         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12100         (gold_error_at_location, gold_warning_at_location): Use it.
12101         * configure.ac: Check whether we can compile and use a template
12102         function with a printf attribute.
12103         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12104         when jumping over bytes.
12105         * object.cc: Instantiate Object::read_section_data.
12106         * debug.h: Include <cstring>
12107         * dwarf_reader.cc: Include <algorithm>
12108         * main.cc: Include <cstring>.
12109         * options.cc: Include <cstring>.
12110         * output.cc: Include <cstring>.
12111         * script.cc: Include <cstring>.
12112         * script.h: Include <string>.
12113         * symtab.cc: Include <cstring> and <algorithm>.
12114         * target-select.cc: Include <cstring>.
12115         * version.cc: Include <string>.
12116         * testsuite/testmain.cc: Include <cstdlib>.
12117         * configure, config.in: Rebuild.
12118
12119 2008-03-25  Ian Lance Taylor  <iant@google.com>
12120
12121         * options.cc: Include "../bfd/bfdver.h".
12122         (options::help): Print bug reporting address.
12123
12124         * version.cc (print_version): Adjust output for current value of
12125         BFD_VERSION_STRING.
12126
12127         * NEWS: New file.
12128
12129         * options.cc (options::help): Print list of supported targets.
12130         * target-select.h: Include <vector>.
12131         (class Target_selector): Make machine_, size_, and is_big_endian_
12132         fields const.  Add bfd_name_ and instantiated_target_ fields.
12133         (Target_selector::Target_selector): Add bfd_name parameter.
12134         (Target_selector::recognize): Make non-virtual, call
12135         do_recognize.
12136         (Target_selector::recognize_by_name): Make non-virtual, call
12137         do_recognize_by_name.
12138         (Target_selector::supported_names): New function.
12139         (Target_selector::bfd_name): New function.
12140         (Target_selector::do_instantiate_target): New pure virtual
12141         function.
12142         (Target_selector::do_recognize): New virtual function.
12143         (Target_selector::do_recognize_by_name): New virtual function.
12144         (Target_selector::instantiate_target): New private function.
12145         (supported_target_names): Declare.
12146         * target-select.cc (Target_selector::Target_selector): Update for
12147         new parameter and fields.
12148         (select_target_by_name): Check that the name matches before
12149         calling recognize_by_name.
12150         (supported_target_names): New function.
12151         * i386.cc (class Target_selector_i386): Update Target_selector
12152         constructor call.  Remove recognize and recognize_by_name.  Add
12153         do_instantiate_target.
12154         * x86_64.cc (class Target_selector_x86_64): Likewise.
12155         * testsuite/testfile.cc (class Target_selector_test): Update for
12156         changes to Target_selector.
12157
12158         * README: Rewrite, with some notes on unsupported features.
12159
12160 2008-03-24  Cary Coutant  <ccoutant@google.com>
12161
12162         * i386.cc (Target_i386::Got_type): New enum declaration.
12163         (Target_i386::Scan::local): Updated callers of Output_data_got
12164         member functions.
12165         (Target_i386::Scan::global): Likewise.
12166         (Target_i386::Relocate::relocate): Likewise.
12167         (Target_i386::Relocate::relocate_tls): Likewise.
12168         * object.h (Got_offset_list): New class.
12169         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12170         (Sized_relobj::local_got_offset): Likewise.
12171         (Sized_relobj::set_local_got_offset): Likewise.
12172         (Sized_relobj::local_has_tls_got_offset): Removed.
12173         (Sized_relobj::local_tls_got_offset): Removed.
12174         (Sized_relobj::set_local_tls_got_offset): Removed.
12175         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12176         * output.cc (Output_data_got::add_global): Added got_type parameter.
12177         (Output_data_got::add_global_with_rel): Likewise.
12178         (Output_data_got::add_global_with_rela): Likewise.
12179         (Output_data_got::add_global_pair_with_rel): New function.
12180         (Output_data_got::add_global_pair_with_rela): New function.
12181         (Output_data_got::add_local): Added got_type parameter.
12182         (Output_data_got::add_local_with_rel): Likewise.
12183         (Output_data_got::add_local_with_rela): Likewise.
12184         (Output_data_got::add_local_pair_with_rel): New function.
12185         (Output_data_got::add_local_pair_with_rela): New function.
12186         (Output_data_got::add_global_tls): Removed.
12187         (Output_data_got::add_global_tls_with_rel): Removed.
12188         (Output_data_got::add_global_tls_with_rela): Removed.
12189         (Output_data_got::add_local_tls): Removed.
12190         (Output_data_got::add_local_tls_with_rel): Removed.
12191         (Output_data_got::add_local_tls_with_rela): Removed.
12192         * output.h (Output_data_got::add_global): Added got_type parameter.
12193         (Output_data_got::add_global_with_rel): Likewise.
12194         (Output_data_got::add_global_with_rela): Likewise.
12195         (Output_data_got::add_global_pair_with_rel): New function.
12196         (Output_data_got::add_global_pair_with_rela): New function.
12197         (Output_data_got::add_local): Added got_type parameter.
12198         (Output_data_got::add_local_with_rel): Likewise.
12199         (Output_data_got::add_local_with_rela): Likewise.
12200         (Output_data_got::add_local_pair_with_rel): New function.
12201         (Output_data_got::add_local_pair_with_rela): New function.
12202         (Output_data_got::add_global_tls): Removed.
12203         (Output_data_got::add_global_tls_with_rel): Removed.
12204         (Output_data_got::add_global_tls_with_rela): Removed.
12205         (Output_data_got::add_local_tls): Removed.
12206         (Output_data_got::add_local_tls_with_rel): Removed.
12207         (Output_data_got::add_local_tls_with_rela): Removed.
12208         * resolve.cc (Symbol::override_base_with_special): Removed
12209         reference to has_got_offset_ field.
12210         * symtab.cc (Symbol::init_fields): Replaced initialization
12211         of got_offset_ with got_offsets_.  Removed initialization
12212         of has_got_offset_
12213         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12214         (Symbol::got_offset): Likewise.
12215         (Symbol::set_got_offset): Likewise.
12216         (Symbol::has_tls_got_offset): Removed.
12217         (Symbol::tls_got_offset): Removed.
12218         (Symbol::set_tls_got_offset): Removed.
12219         (Symbol::got_offset_): Removed.
12220         (Symbol::tls_mod_got_offset_): Removed.
12221         (Symbol::tls_pair_got_offset_): Removed.
12222         (Symbol::got_offsets_): New field.
12223         (Symbol::has_got_offset): Removed.
12224         (Symbol::has_tls_mod_got_offset): Removed.
12225         (Symbol::has_tls_pair_got_offset): Removed.
12226         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12227         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12228         member functions.
12229         (Target_x86_64::Scan::global): Likewise.
12230         (Target_x86_64::Relocate::relocate): Likewise.
12231         (Target_x86_64::Relocate::relocate_tls): Likewise.
12232
12233 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12234
12235         * yyscript.y: Fix spelling error in comment.
12236
12237 2008-03-24  Ian Lance Taylor  <iant@google.com>
12238
12239         * options.h (class General_options): Define build_id option.
12240         * layout.h (class Layout): Declare write_build_id, create_note,
12241         create_build_id.  Add build_id_note_ member.
12242         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12243         "libiberty.h", "md5.h", "sha1.h".
12244         (Layout::Layout): Initialize eh_frame_data_,
12245         eh_frame_hdr_section_, and build_id_note_.
12246         (Layout::finalize): Call create_build_id.
12247         (Layout::create_note): New function, broken out of
12248         Layout::create_gold_note.
12249         (Layout::create_gold_note): Call create_note.
12250         (Layout::create_build_id): New function.
12251         (Layout::write_build_id): New function.
12252         (Close_task_runner::run): Call write_build_id.
12253
12254         * x86_64.cc: Correct license to GPLv3.
12255
12256 2008-03-23  Ian Lance Taylor  <iant@google.com>
12257
12258         * options.cc: Include "demangle.h".
12259         (parse_optional_string): New function.
12260         (parse_long_option): Handle takes_optional_argument.
12261         (parse_short_option): Update dash_z initializer.  Handle
12262         takes_optional_argument.
12263         (General_options::General_options): Initialize do_demangle_.
12264         (General_options::finalize): Set do_demangle_.  Handle demangling
12265         style.
12266         * options.h (parse_optional_string): Declare.
12267         (struct One_option): Add optional_arg field.  Update constructor.
12268         Update call constructor calls.  Add takes_optional_argument
12269         function.
12270         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12271         (DEFINE_optional_string): Define.
12272         (General_options::demangle): Change from DEFINE_bool to
12273         DEFINE_optional_string.
12274         (General_options::no_demangle): New function.
12275         (General_options::do_demangle): New function.
12276         (General_options::set_do_demangle): New function.
12277         (General_options::execstack_status_): Move definition to end of
12278         class definition.
12279         (General_options::static_): Likewise.
12280         (General_options::do_demangle_): New field.
12281         * object.cc (big_endian>::get_symbol_location_info): Call
12282         Options::do_demangle, not Options::demangle.
12283         * symtab.cc (demangle): Likewise.
12284
12285 2008-03-22  Ian Lance Taylor  <iant@google.com>
12286
12287         * gold.h: Include <cstddef> and <sys/types.h>
12288         * options.h: Include <cstring>.
12289
12290 2008-03-21  Ian Lance Taylor  <iant@google.com>
12291
12292         * Added source code to GNU binutils.