* arm.cc (Target_arm::may_use_v5t_interworking): Check whether
[external/binutils.git] / gold / ChangeLog
1 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2
3         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4         we are working around the ARM1176 Erratum.
5         * options.h (General_options::fix_arm1176): Add option.
6         * testsuite/Makefile.am: Add testcases, and keep current ones
7         working.
8         * testsuite/Makefile.in: Regenerate.
9         * testsuite/arm_fix_1176.s: New file.
10         * testsuite/arm_fix_1176.sh: Likewise.
11
12 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
13
14         * arm.cc (Target_arm::Target_arm): Remove initialisation of
15         may_use_blx_.
16         (Target_arm::may_use_blx): Remove method.
17         (Target_arm::set_may_use_blx): Likewise.
18         (Target_arm::may_use_v4t_interworking): New method.
19         (Target_arm::may_use_v5t_interworking): Likewise.
20         (Target_arm::may_use_blx_): Remove member variable.
21         (Arm_relocate_functions::arm_branch_common): Check for v5T
22         interworking.
23         (Arm_relocate_functions::thumb_branch_common): Likewise.
24         (Reloc_stub::stub_type_for_reloc): Likewise.
25         (Target_arm::do_finalize_sections): Correct interworking checks.
26         * testsuite/Makefile.am: Add new tests.
27         * testsuite/Makefile.in: Regenerate.
28         * testsuite/arm_farcall_arm_arm.s: New test.
29         * testsuite/arm_farcall_arm_arm.sh: Likewise.
30         * testsuite/arm_farcall_arm_thumb.s: Likewise.
31         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
32         * testsuite/arm_farcall_thumb_arm.s: Likewise.
33         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
34         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
35         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
36
37 2011-10-31  Cary Coutant  <ccoutant@google.com>
38
39         PR gold/13023
40         * expression.cc (Expression::eval_with_dot): Add
41         is_section_dot_assignment parameter.
42         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
43         absolute and assigning to dot within a section.
44         * script-sections.cc
45         (Output_section_element_assignment::set_section_addresses): Pass
46         dot_section to set_if_absolute.
47         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
48         as is_section_dot_assignment flag to eval_with_dot.
49         (Output_section_element_dot_assignment::set_section_addresses):
50         Likewise.
51         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
52         parameter.  Also set value if relative to dot_section; set the
53         symbol's output_section.
54         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
55         parameter.  Adjust all callers.
56         (Expression::eval_maybe_dot): Likewise.
57         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
58         Adjust all callers.
59         * testsuite/script_test_2.t: Test assignment of an absolute value
60         to dot within an output section element.
61
62 2011-10-31  Cary Coutant  <ccoutant@google.com>
63
64         * options.h (class General_options): Add --[no-]gnu-unique options.
65         * symtab.cc (Symbol_table::sized_write_globals): Convert
66         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
67
68 2011-10-31  Cary Coutant  <ccoutant@google.com>
69
70         PR gold/13359
71         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
72         unnecessary assertion.
73         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
74
75 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
76
77         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
78         gc_mark_symbol.
79         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
80         gc_mark_symbol.
81         Change to just keep the section associated with symbol.
82         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
83         they are externally visible and --export-dynamic is turned on.
84         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
85
86 2011-10-19  Ian Lance Taylor  <iant@google.com>
87
88         PR gold/13163
89         * script-sections.cc
90         (Output_section_element_dot_assignment::needs_output_section): New
91         function.
92
93 2011-10-19  Ian Lance Taylor  <iant@google.com>
94
95         PR gold/13204
96         * layout.cc (Layout::segment_precedes): Don't assert failure if a
97         --section-start option was seen.
98         * options.h (General_options::any_section_start): New function.
99
100 2011-10-18  David S. Miller  <davem@davemloft.net>
101
102         PR binutils/13301
103         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
104         member to track relocation locations that have moved during TLS
105         reloc optimizations.
106         (Target_sparc::Relocate::Relocate): Initialize to NULL.
107         (Target_sparc::Relocate::relocate): Adjust view down by 4
108         bytes if it matches reloc_adjust_addr_.
109         (Target_sparc::Relocate::relocate_tls): Always move the
110         __tls_get_addr call delay slot instruction forward 4 bytes when
111         performing relaxation.
112
113 2011-10-18  Cary Coutant  <ccoutant@google.com>
114
115         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
116         (Output_file::map_no_anonymous): Check for non-zero
117         return code from posix_fallocate.
118
119 2011-10-17  Cary Coutant  <ccoutant@google.com>
120
121         PR gold/13245
122         * plugin.cc (is_visible_from_outside): Check for symbols
123         referenced from dynamic objects.
124         * resolve.cc (Symbol_table::resolve): Don't count references
125         from dynamic objects as references from real ELF files.
126         * testsuite/plugin_test_2.sh: Adjust expected result.
127
128 2011-10-17  Cary Coutant  <ccoutant@google.com>
129
130         * gold.cc: Include timer.h.
131         (queue_middle_tasks): Stamp time.
132         (queue_final_tasks): Likewise.
133         * main.cc (main): Store timer in parameters.  Print timers
134         for each pass.
135         * parameters.cc (Parameters::Parameters): Initialize timer_.
136         (Parameters::set_timer): New function.
137         (set_parameters_timer): New function.
138         * parameters.h (Parameters::set_timer): New function.
139         (Parameters::timer): New function.
140         (Parameters::timer_): New data member.
141         (set_parameters_timer): New function.
142         * timer.cc (Timer::stamp): New function.
143         (Timer::get_pass_time): New function.
144         * timer.h (Timer::stamp): New function.
145         (Timer::get_pass_time): New function.
146         (Timer::pass_times_): New data member.
147
148 2011-10-17  Cary Coutant  <ccoutant@google.com>
149
150         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
151         task for members of lib groups.
152
153 2011-10-17  Cary Coutant  <ccoutant@google.com>
154
155         PR gold/13288
156         * fileread.cc (File_read::find_view): Add assert.
157         (File_read::make_view): Move bounds check (replace with assert)...
158         (File_read::find_or_make_view): ... to here.
159
160 2011-10-12  Cary Coutant  <ccoutant@google.com>
161
162         * output.cc (Output_file::open_base_file): Handle case where
163         ::read returns less than requested size.
164
165 2011-10-10  Cary Coutant  <ccoutant@google.com>
166
167         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
168         Initialize defined_count_.
169         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
170         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
171         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
172         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
173         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
174         * incremental.h (Sized_relobj_incr::defined_count_): New data
175         member.
176         (Sized_incr_dynobj::defined_count_): New data member.
177         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
178         Return zeroes instead of internal error.
179
180 2011-10-10  Cary Coutant  <ccoutant@google.com>
181
182         PR gold/13249
183         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
184         (Output_reloc::symbol_value): Return PLT offset if flag is set.
185         * output.h (class Output_reloc): Add use_plt_offset flag.
186         (Output_reloc::type_): Adjust size of bit field.
187         (Output_reloc::use_plt_offset_): New bit field.
188         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
189         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
190         flag.  Adjust all callers.
191         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
192         creating RELATIVE relocations.
193
194 2011-10-10  Nick Clifton  <nickc@redhat.com>
195
196         * po/es.po: Updated Spanish translation.
197         * po/fi.po: Updated Finnish translation.
198
199 2011-10-03   Diego Novillo  <dnovillo@google.com>
200
201         * options.cc (parse_uint): Fix dereference of RETVAL.
202
203 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
204
205         * layout.h (section_order_map_): New member.
206         (get_section_order_map): New member function.
207         * output.cc (Output_section::add_input_section): Check for patterns
208         only when --section-ordering-file is specified.
209         * gold.cc (queue_middle_tasks): Delay updating order of sections till
210         output_sections have been formed.
211         * layout.cc (Layout_Layout): Initialize section_order_map_.
212         * plugin.cc (update_section_order): Store order in order_map. Do not
213         update the order.
214         * testsuite/Makefile.am: Add test case for plugin_final_layout.
215         * testsuite/Makefile.in: Regenerate.
216         * testsuite/plugin_section_order.c: New file.
217         * testsuite/plugin_final_layout.cc: New file.
218         * testsuite/plugin_final_layout.sh: New file.
219
220 2011-09-29  Cary Coutant  <ccoutant@google.com>
221
222         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
223         Check for NULL.
224         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
225         symbols during incremental update.
226         (Symbol_table::add_from_dynobj): Likewise.
227
228 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
229             Ian Lance Taylor  <iant@google.com>
230
231         * symtab.cc (Symbol_table::define_special_symbol): Always
232         canonicalize version string.
233
234 2011-09-26  Cary Coutant  <ccoutant@google.com>
235
236         * gold.cc (queue_initial_tasks): Move option checks ...
237         * options.cc (General_options::finalize): ... to here. Disable
238         some options; make others fatal.
239
240 2011-09-26  Cary Coutant  <ccoutant@google.com>
241
242         gcc PR lto/47247
243         * plugin.cc (get_symbols_v2): New function.
244         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
245         (is_referenced_from_outside): New function.
246         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
247         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
248         (get_symbols): Pass version parameter.
249         (get_symbols_v2): New function.
250         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
251         parameter.
252         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
253         (onload): Add LDPT_GET_SYMBOLS_V2.
254         (all_symbols_read_hook): Use get_symbols_v2; check for
255         LDPR_PREVAILING_DEF_IRONLY_EXP.
256         * testsuite/plugin_test_3.sh: Update expected results.
257
258 2011-09-23  Simon Baldwin  <simonb@google.com>
259
260         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
261         configuration options.
262         * configure: Regenerate.
263         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
264         * Makefile.in: Regenerate.
265         * testsuite/Makefile.in: Regenerate.
266
267 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
268
269         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
270
271 2011-09-19  Cary Coutant  <ccoutant@google.com>
272
273         * incremental.cc (can_incremental_update): Fix typo in comment.
274         * incremental.h (can_incremental_update): Likewise.
275
276 2011-09-18  Cary Coutant  <ccoutant@google.com>
277
278         * incremental.cc (can_incremental_update): New function.
279         * incremental.h (can_incremental_update): New function.
280         * layout.cc (Layout::init_fixed_output_section): Call it.
281         (Layout::make_output_section): Don't allow patch space in .eh_frame.
282         * object.cc (Sized_relobj_file::do_layout): Call
283         can_incremental_update.
284
285 2011-09-13  Cary Coutant  <ccoutant@google.com>
286
287         * configure.ac: Check for glibc support for gnu_indirect_function
288         support with static linking, setting automake conditional
289         IFUNC_STATIC.
290         * Makefile.in: Regenerate.
291         * configure: Regenerate.
292
293         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
294         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
295         for IFUNC_STATIC.
296         * testsuite/Makefile.in: Regenerate.
297
298 2011-09-13  Cary Coutant  <ccoutant@google.com>
299
300         * incremental.cc (Sized_relobj_incr::do_layout): Call
301         report_comdat_group for kept comdat sections.
302         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
303         * testsuite/Makefile.in: Regenerate.
304         * testsuite/incr_comdat_test_1.cc: New source file.
305         * testsuite/incr_comdat_test_2_v1.cc: New source file.
306         * testsuite/incr_comdat_test_2_v2.cc: New source file.
307         * testsuite/incr_comdat_test_2_v3.cc: New source file.
308
309 2011-09-13  Ian Lance Taylor  <iant@google.com>
310
311         * object.cc (Sized_relobj_file::do_layout): Remove unused local
312         variable external_symbols_offset.
313
314 2011-09-12  Ian Lance Taylor  <iant@google.com>
315
316         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
317         triggered if object has no symbols.
318
319 2011-09-09  David S. Miller  <davem@davemloft.net>
320
321         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
322         (Output_fill_debug_line::do_write): Likewise.
323
324 2011-08-29  Cary Coutant  <ccoutant@google.com>
325
326         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
327         casts to match formatting specs.
328         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
329
330 2011-08-26  Cary Coutant  <ccoutant@google.com>
331
332         * layout.cc (Free_list::allocate): Provide guarantee of minimum
333         remaining hole size when allocating.
334         (Layout::make_output_section): Set fill methods for debug sections.
335         * layout.h (Free_list::Free_list_node): Move from private to
336         public.
337         (Free_list::set_min_hole_size): New function.
338         (Free_list::begin, Free_list::end): New functions.
339         (Free_list::min_hole_): New data member.
340         * output.cc: Include dwarf.h.
341         (Output_fill_debug_info::do_minimum_hole_size): New function.
342         (Output_fill_debug_info::do_write): New function.
343         (Output_fill_debug_line::do_minimum_hole_size): New function.
344         (Output_fill_debug_line::do_write): New function.
345         (Output_section::Output_section): Initialize new data member.
346         (Output_section::set_final_data_size): Ensure patch space is larger
347         than minimum hole size.
348         (Output_section::do_write): Fill holes in debug sections.
349         * output.h (Output_fill): New class.
350         (Output_fill_debug_info): New class.
351         (Output_fill_debug_line): New class.
352         (Output_section::set_free_space_fill): New function.
353         (Output_section::free_space_fill_): New data member.
354         * testsuite/Makefile.am (incremental_test_3): Add
355         --incremental-patch option.
356         (incremental_test_4): Likewise.
357         (incremental_test_5): Likewise.
358         (incremental_test_6): Likewise.
359         (incremental_copy_test): Likewise.
360         (incremental_common_test_1): Likewise.
361         * testsuite/Makefile.in: Regenerate.
362
363 2011-08-26  Nick Clifton  <nickc@redhat.com>
364
365         * po/es.po: Updated Spanish translation.
366
367 2011-08-01  Cary Coutant  <ccoutant@google.com>
368
369         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
370         * gold/testsuite/Makefile.in: Regenerate.
371         * gold/testsuite/justsyms_exec.c: New source file.
372         * gold/testsuite/justsyms_lib.c: New source file.
373
374 2011-08-01  Cary Coutant  <ccoutant@google.com>
375
376         * layout.cc (Layout::set_segment_offsets): Don't realign text
377         segment if -Ttext was specified.
378         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
379         file type.
380         * object.h (Sized_relobj_file::e_type): New function.
381         (Sized_relobj_file::e_type_): New data member.
382         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
383         base address for ET_EXEC files.
384         * target.cc (Target::do_make_elf_object_implementation): Allow
385         ET_EXEC files with --just-symbols option.
386
387 2011-07-28  Cary Coutant  <ccoutant@google.com>
388
389         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
390         Add thread_number parameter.
391         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
392         * workqueue-threads.cc
393         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
394         current thread if its thread number is greater than desired thread
395         count.
396         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
397         Add thread_number parameter.
398         (Workqueue::should_cancel_thread): Likewise.
399         (Workqueue::find_runnable_or_wait): Pass thread_number to
400         should_cancel_thread.
401         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
402         parameter.
403
404 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
405
406         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
407         only after checking if it cannot be forced local.
408         * symtab.h (is_externally_visible): Check if the symbol is not forced
409         local.
410
411 2011-07-15  Ian Lance Taylor  <iant@google.com>
412
413         * options.h (class General_options): Add --print-output-format.
414         Move -EL next to -EB, for  better --help output.
415         * target-select.cc: Include <cstdio>, "options.h", and
416         "parameters.h".
417         (Target_selector::do_target_bfd_name): New function.
418         (print_output_format): New function.
419         * target-select.h (class Target_selector): Update declarations.
420         (Target_selector::target_bfd_name): New function.
421         (print_output_format): Declare.
422         * main.cc: Include "target-select.h".
423         (main): Handle --print-output-format.
424         * gold.cc: Include "target-select.h".
425         (queue_initial_tasks): Handle --print-output-format when there are
426         no input files.
427         * parameters.cc (parameters_force_valid_target): Give a better
428         error message if -EB/-EL does not match target.
429         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
430         function.
431
432 2011-07-15  Ian Lance Taylor  <iant@google.com>
433
434         * i386.cc (class Output_data_plt_i386): Add layout_ field.
435         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
436         (Output_data_plt_i386::do_write): Write address of .dynamic
437         section to first entry in .got.plt section.
438         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
439         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
440         Initialize layout_.
441         (Output_data_plt_x86_64::do_write): Write address of .dynamic
442         section to first entry in .got.plt section.
443         * layout.h (Layout::dynamic_section): New function.
444
445 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
446
447         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
448         to claim_file call.
449         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
450         input_section_position_, and input_section_glob_.
451         (read_layout_from_file): Call function section_ordering_specified.
452         * layout.h (is_section_ordering_specified): New function.
453         (section_ordering_specified): New function.
454         (section_ordering_specified_): New boolean member.
455         * main.cc(main): Call load_plugins after layout object is defined.
456         * output.cc (Output_section::add_input_section): Use
457         function section_ordering_specified to check if section ordering is
458         needed.
459         * output.cc (Output_section::add_relaxed_input_section): Use
460         function section_ordering_specified to check if section ordering is
461         needed.
462         (Output_section::update_section_layout): New function.
463         (Output_section::sort_attached_input_sections): Check if input section
464         must be reordered.
465         * output.h (Output_section::update_section_layout): New function.
466         * plugin.cc (get_section_count): New function.
467         (get_section_type): New function.
468         (get_section_name): New function.
469         (get_section_contents): New function.
470         (update_section_order): New function.
471         (allow_section_ordering): New function. 
472         (Plugin::load): Add the new interfaces to the transfer vector.
473         (Plugin_manager::load_plugins): New parameter.
474         (Plugin_manager::all_symbols_read): New parameter.
475         (Plugin_manager::claim_file): New parameter. Save the elf object for
476         unclaimed objects.
477         (Plugin_manager::get_elf_object): New function.
478         (Plugin_manager::get_view): Change to directly use the bool to check
479         if get_view is called from claim_file_hook.
480         * plugin.h (input_objects): New function
481         (Plugin__manager::load_plugins): New parameter.
482         (Plugin_manager::claim_file): New parameter.
483         (Plugin_manager::get_elf_object): New function.
484         (Plugin_manager::in_claim_file_handler): New function.
485         (Plugin_manager::in_claim_file_handler_): New member.
486         (layout): New function.
487         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
488         handler with an extra parameter. Make the elf object before calling
489         claim_file handler.
490         * testsuite/plugin_test.c (get_section_count): New function pointer.
491         (get_section_type): New function pointer.
492         (get_section_name): New function pointer.
493         (get_section_contents): New function pointer.
494         (update_section_order): New function pointer.
495         (allow_section_ordering): New function pointer.
496         (onload): Check if the new interfaces exist.
497
498 2011-07-13  Ian Lance Taylor  <iant@google.com>
499
500         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
501         relro section.
502         * x86_64.cc (Target_x86_64::got_section): Likewise.
503         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
504         (relro_now_test_SOURCES): New variable.
505         (relro_now_test_DEPENDENCIES): New variable.
506         (relro_now_test_LDFLAGS): New variable.
507         (relro_now_test_LDADD): New variable.
508         (relro_now_test.so): New target.
509         * testsuite/Makefile.in: Rebuild.
510
511 2011-07-12  Ian Lance Taylor  <iant@google.com>
512
513         PR gold/12980
514         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
515         GLOB_DAT relocation rather than a RELATIVE relocation for a
516         protected symbol when creating a shared library.
517         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
518         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
519         * testsuite/protected_main_1.cc (main): Test that protected
520         function has same address.
521
522 2011-07-11  Ian Lance Taylor  <iant@google.com>
523
524         PR gold/12979
525         * options.h (class General_options): Add -Bgroup.
526         * options.cc (General_options::finalize): If -Bgroup is set,
527         default to --unresolved-symbols=report-all.
528         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
529         * target-reloc.h (issue_undefined_symbol_error): Handle
530         --unresolved-symbols=report-all.
531
532 2011-07-08  Ian Lance Taylor  <iant@google.com>
533
534         PR gold/11985
535         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
536         if linker script discards key sections.
537         (Layout::create_dynamic_symtab): Likewise.
538         (Layout::assign_local_dynsym_offsets): Likewise.
539         (Layout::sized_create_version_sections): Likewise.
540         (Layout::create_interp): Likewise.
541         (Layout::finish_dynamic_section): Likewise.
542         (Layout::set_dynamic_symbol_size): Likewise.
543
544 2011-07-08  Ian Lance Taylor  <iant@google.com>
545
546         PR gold/12386
547         * options.h (class General_options): Add --unresolved-symbols.
548         * target-reloc.h (issue_undefined_symbol_error): Check
549         --unresolved-symbols.  Add comments.
550
551 2011-07-08  Ian Lance Taylor  <iant@google.com>
552
553         * testsuite/odr_violation2.cc (Ordering::operator()): Make
554         expression more complex.
555
556 2011-07-08  Ian Lance Taylor  <iant@google.com>
557
558         PR gold/11317
559         * target-reloc.h (issue_undefined_symbol_error): New inline
560         function, broken out of relocate_section.
561         (relocate_section): Call issue_undefined_symbol_error.
562         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
563         there is no TLS segment if we are about to issue an undefined
564         symbol error.
565         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
566
567 2011-07-08  Ian Lance Taylor  <iant@google.com>
568
569         PR gold/12279
570         * resolve.cc (Symbol_table::should_override): Add fromtype
571         parameter.  Change all callers.  Give error when linking together
572         TLS and non-TLS symbol.
573         (Symbol_table::should_override_with_special): Add fromtype
574         parameter.  Change all callers.
575         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
576         there is no TLS segment if we have reported some errors.
577         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
578
579 2011-07-08  Ian Lance Taylor  <iant@google.com>
580
581         PR gold/12372
582         * target.h (Target::plt_address_for_global): New function.
583         (Target::plt_address_for_local): New function.
584         (Target::plt_section_for_global): Remove.
585         (Target::plt_section_for_local): Remove.
586         (Target::do_plt_address_for_global): New virtual function.
587         (Target::do_plt_address_for_local): New virtual function.
588         (Target::do_plt_section_for_global): Remove.
589         (Target::do_plt_section_for_local): Remove.
590         (Target::register_global_plt_entry): Add Symbol_table and Layout
591         parameters.
592         * output.cc (Output_data_got::Got_entry::write): Use
593         plt_address_for_global and plt_address_for_local.
594         * layout.cc (Layout::add_target_dynamic_tags): Use size and
595         address of output section.
596         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
597         got_irelative_, and irelative_count_ fields.  Update
598         declarations.
599         (Output_data_plt_i386::has_irelative_section): New function.
600         (Output_data_plt_i386::entry_count): Add irelative_count_.
601         (Output_data_plt_i386::set_final_data_size): Likewise.
602         (class Target_i386): Add got_irelative_ and rel_irelative_
603         fields.  Update declarations.
604         (Target_i386::Target_i386): Initialize new fields.
605         (Target_i386::do_plt_address_for_global): New function replacing
606         do_plt_section_for_global.
607         (Target_i386::do_plt_address_for_local): New function replacing
608         do_plt_section_for_local.
609         (Target_i386::got_section): Create got_irelative_.
610         (Target_i386::rel_irelative_section): New function.
611         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
612         fields.  Don't define __rel_iplt_{start,end}.
613         (Output_data_plt_i386::add_entry): Add symtab and layout
614         parameters.  Change all callers.  Use different PLT and GOT for
615         IFUNC symbols.
616         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
617         layout parameters.  Change all callers.  Use different PLT and
618         GOT.
619         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
620         (Output_data_plt_i386::rel_irelative): New function.
621         (Output_data_plt_i386::address_for_global): New function.
622         (Output_data_plt_i386::address_for_local): New function.
623         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
624         IRELATIVE GOT when changing IFUNC GOT entries.
625         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
626         reloc.
627         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
628         if we didn't create an IRELATIVE GOT.
629         (Target_i386::Relocate::relocate): Use plt_address_for_global and
630         plt_address_for_local.
631         (Target_i386::do_dynsym_value): Use plt_address_for_global.
632         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
633         got_irelative_, and irelative_count_ fields.  Update
634         declarations.
635         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
636         Initialize new fields.  Remove symtab parameter.  Change all
637         callers.
638         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
639         irelative_count_.
640         (Output_data_plt_x86_64::has_irelative_section): New function.
641         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
642         (class Target_x86_64): Add got_irelative_ and rel_irelative_
643         fields.  Update declarations.
644         (Target_x86_64::Target_x86_64): Initialize new fields.
645         (Target_x86_64::do_plt_address_for_global): New function replacing
646         do_plt_section_for_global.
647         (Target_x86_64::do_plt_address_for_local): New function replacing
648         do_plt_section_for_local.
649         (Target_x86_64::got_section): Create got_irelative_.
650         (Target_x86_64::rela_irelative_section): New function.
651         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
652         all callers.  Don't create __rel_iplt_{start,end}.
653         (Output_data_plt_x86_64::add_entry): Add symtab and layout
654         parameters.  Change all callers.  Use different PLT and GOT for
655         IFUNC symbols.
656         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
657         layout parameters.  Change all callers.  Use different PLT and
658         GOT.
659         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
660         parameters.  Change all callers.  Use different PLT and GOT for
661         IFUNC symbols.
662         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
663         (Output_data_plt_x86_64::rela_irelative): New function.
664         (Output_data_plt_x86_64::address_for_global): New function.
665         (Output_data_plt_x86_64::address_for_local): New function.
666         (Output_data_plt_x86_64::set_final_data_size): Likewise.
667         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
668         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
669         (Target_x86_64::register_global_plt_entry): Add symtab and layout
670         parameters.
671         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
672         reloc.
673         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
674         symbols if we didn't create an IRELATIVE GOT.
675         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
676         plt_address_for_local.
677         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
678         * testsuite/ifuncvar1.c: New test file.
679         * testsuite/ifuncvar2.c: New test file.
680         * testsuite/ifuncvar3.c: New test file.
681         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
682         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
683         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
684         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
685         * testsuite/Makefile.in: Rebuild.
686
687 2011-07-07  Cary Coutant  <ccoutant@google.com>
688
689         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
690         (two_file_test_1_ndebug.o): Likewise.
691         (two_file_test_1b_ndebug.o): Likewise.
692         (two_file_test_2_ndebug.o): Likewise.
693         (two_file_test_main_ndebug.o): Likewise.
694         (incremental_test_2): Link with no-debug versions.
695
696 2011-07-06  Cary Coutant  <ccoutant@google.com>
697
698         * gold/incremental.cc
699         (Output_section_incremental_inputs::write_info_blocks): Check for
700         hidden and internal symbols.
701
702 2011-07-06  Cary Coutant  <ccoutant@google.com>
703
704         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
705         Check disposition for startup file.
706         (Incremental_inputs::report_command_line): Ignore
707         --incremental-startup-unchanged option.
708         * options.cc (General_options::parse_incremental_startup_unchanged):
709         New function.
710         (General_options::General_options): Initialize new data member.
711         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
712         (General_options): Add --incremental-startup-unchanged option.
713         (General_options::incremental_startup_disposition): New function.
714         (General_options::incremental_startup_disposition_): New data member.
715
716 2011-07-06  Cary Coutant  <ccoutant@google.com>
717
718         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
719         input file index to Script_info ctor.
720         (Sized_incremental_binary::do_file_has_changed): Find the
721         command-line argument for files named in scripts.
722         * incremental.h (Script_info::Script_info): New ctor
723         with input file index.
724         (Script_info::input_file_index): New function.
725         (Script_info::input_file_index_): New data member.
726         (Incremental_binary::get_library): Add const.
727         (Incremental_binary::get_script_info): Add const.
728         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
729         * testsuite/Makefile.am (incremental_test_5): New test case.
730         (incremental_test_6): New test case.
731         * testsuite/Makefile.in: Regenerate.
732
733 2011-07-06  Cary Coutant  <ccoutant@google.com>
734
735         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
736         debug output when command lines differ.
737
738 2011-07-06  Cary Coutant  <ccoutant@google.com>
739
740         * incremental.cc (Incremental_inputs::report_command_line): Ignore
741         --incremental-patch option.
742         * layout.cc (Free_list::allocate): Extend allocation beyond original
743         end if enabled.
744         (Layout::make_output_section): Mark sections that should get
745         patch space.
746         * options.cc (parse_percent): New function.
747         * options.h (parse_percent): New function.
748         (DEFINE_percent): New macro.
749         (General_options): Add --incremental-patch option.
750         * output.cc (Output_section::Output_section): Initialize new data
751         members.
752         (Output_section::add_input_section): Print section name when out
753         of patch space.
754         (Output_section::add_output_section_data): Likewise.
755         (Output_section::set_final_data_size): Add patch space when
756         doing --incremental-full.
757         (Output_section::do_reset_address_and_file_offset): Remove patch
758         space.
759         (Output_segment::set_section_list_addresses): Print debug output
760         only if --incremental-update.
761         * output.h (Output_section::set_is_patch_space_allowed): New function.
762         (Output_section::is_patch_space_allowed_): New data member.
763         (Output_section::patch_space_): New data member.
764         * parameters.cc (Parameters::incremental_full): New function.
765         * parameters.h (Parameters::incremental_full): New function
766         * testsuite/Makefile.am (incremental_test_2): Add test for
767         --incremental-patch option.
768         * testsuite/Makefile.in: Regenerate.
769         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
770         (t18): Remove function body.
771
772 2011-07-05  Doug Kwan  <dougkwan@google.com>
773
774         PR gold/12771
775         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
776         Arm_Address type for relocation result.
777         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
778         overflow check.
779         (Arm_relocate_functions::abs32): Use unaligned access.
780         (Arm_relocate_functions::rel32): Ditto.
781         (Arm_relocate_functions::prel31): Ditto.
782         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
783         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
784         static data relocations.
785         * testsuite/Makefile.in: Regnerate.
786         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
787
788 2011-07-05  Ian Lance Taylor  <iant@google.com>
789
790         PR gold/12392
791         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
792         symbols if necessary.
793         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
794
795 2011-07-05  Ian Lance Taylor  <iant@google.com>
796
797         PR gold/12952
798         * resolve.cc (Symbol::override_base_with_special): Simply override
799         version with special symbol version, ignoring previous version.
800
801 2011-07-05  Ian Lance Taylor  <iant@google.com>
802
803         * object.cc (Sized_relobj_file::include_section_group): Add
804         information to comment about signature location.
805
806 2011-07-02  Ian Lance Taylor  <iant@google.com>
807
808         PR gold/12957
809         * options.h (class General_options): Add -f and -F.
810         * options.cc (General_options::finalize): Fatal error if -f/-F
811         are used without -shared.
812         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
813
814 2011-07-02  Ian Lance Taylor  <iant@google.com>
815
816         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
817
818 2011-07-01  Ian Lance Taylor  <iant@google.com>
819
820         PR gold/12525
821         PR gold/12952
822         * resolve.cc (Symbol::override_base_with_special): Don't override
823         the version if the overriding symbol has a different name.
824         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
825         all callers.  If we give an error about an undefined version,
826         define the base version if necessary.
827         * dynobj.h (class Versions): Update declaration.
828         * testsuite/weak_alias_test_5.cc: New file.
829         * testsuite/weak_alias_test.script: New file.
830         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
831         and versioned_alias have the right value, and call t2.
832         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
833         weak_alias_test_5.so.
834         (weak_alias_test_LDADD): Likewise.
835         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
836         * testsuite/Makefile.in: Rebuild.
837
838 2011-07-01  Ian Lance Taylor  <iant@google.com>
839
840         PR gold/12525
841         * options.h (class General_options): Support -z notext.
842         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
843         -Wl,-z,notext.
844         (two_file_shared_nonpic.so): Likewise.
845         (two_file_shared_mixed.so): Likewise.
846         (two_file_shared_mixed_1.so): Likewise.
847         (weak_undef_lib_nonpic.so): Likewise.
848         (alt/weak_undef_lib_nonpic.so): Likewise.
849         (tls_test_shared_nonpic.so): Likewise.
850         * testsuite/Makefile.in: Rebuild.
851
852 2011-07-01  Ian Lance Taylor  <iant@google.com>
853
854         PR gold/12525
855         * configure.ac: Test whether static linking works, setting
856         the automake conditional HAVE_STATIC.
857         * testsuite/Makefile.am: Disable tests using -static if
858         HAVE_STATIC is not true.
859         * configure, testsuite/Makefile.in: Rebuild.
860
861 2011-07-01  Ian Lance Taylor  <iant@google.com>
862
863         PR gold/12525
864         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
865         Assert if we see DW_EH_PE_indirect.
866         * target.h (Target::ehframe_datarel_base): New function.
867         (Target::do_ehframe_datarel_base): New target function.
868         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
869         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
870         function.
871
872 2011-07-01  Ian Lance Taylor  <iant@google.com>
873
874         PR gold/12571
875         * options.h (class General_options): Add
876         --ld-generated-unwind-info.
877         * ehframe.cc (Fde::write): Add address parameter.  Change all
878         callers.  If associated with PLT, fill in address and size.
879         (Cie::set_output_offset): Only add merge mapping if there is an
880         object.
881         (Cie::write): Add address parameter.  Change all callers.
882         (Eh_frame::add_ehframe_for_plt): New function.
883         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
884         input_offset_ fields into union u_, with new plt field.
885         (Fde::Fde): Adjust for new union field.
886         (Fde::Fde) [Output_data version]: New constructor.
887         (Fde::add_mapping): Only add merge mapping if there is an object.
888         (class Cie): Update declarations.
889         (class Eh_frame): Declare add_ehframe_for_plt.
890         * layout.cc (Layout::layout_eh_frame): Break out code into
891         make_eh_frame_section, and call it.
892         (Layout::make_eh_frame_section): New function.
893         (Layout::add_eh_frame_for_plt): New function.
894         * layout.h (class Layout): Update declarations.
895         * merge.cc (Merge_map::add_mapping): Add assertion.
896         * i386.cc: Include "dwarf.h".
897         (class Output_data_plt_i386): Make first_plt_entry,
898         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
899         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
900         and plt_eh_frame_fde.
901         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
902         boundary.  Call add_eh_frame_for_plt if appropriate.
903         * x86_64.cc: Include "dwarf.h".
904         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
905         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
906         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
907         and plt_eh_frame_fde.
908         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
909         appropriate.
910
911 2011-06-29  Ian Lance Taylor  <iant@google.com>
912
913         PR gold/12629
914         * object.cc (Sized_relobj_file::layout_section): Change shdr
915         parameter to be const.
916         (Sized_relobj_file::layout_eh_frame_section): New function, broken
917         out of do_layout.
918         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
919         appropriate.  Call layout_eh_frame_section.
920         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
921         sections.
922         * object.h (class Sized_relobj_file): Update declarations.
923
924 2011-06-29  Ian Lance Taylor  <iant@google.com>
925
926         PR gold/12652
927         * script.cc (Token::integer_value): Accept trailing M/m/K/k
928         modifier.
929         (Lex::gather_token): Accept trailing M/m/K/k for integers.
930
931 2011-06-29  Ian Lance Taylor  <iant@google.com>
932
933         PR gold/12675
934         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
935         SHT_X86_64_UNWIND.
936         * layout.cc (Layout::layout_eh_frame): Likewise.
937
938 2011-06-29  Ian Lance Taylor  <iant@google.com>
939
940         PR gold/12695
941         * layout.cc (Layout::symtab_section_shndx): New function.
942         * layout.h (class Layout): Declare symtab_section_shndx.
943         * output.cc (Output_section::write_header): Call it.
944
945 2011-06-29  Ian Lance Taylor  <iant@google.com>
946
947         PR gold/12818
948         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
949         symbols which are not used in a relocation.
950
951 2011-06-28  Ian Lance Taylor  <iant@google.com>
952
953         PR gold/12898
954         * layout.cc (Layout::segment_precedes): Don't crash if a linker
955         script create indistinguishable segments.
956         (Layout::set_segment_offsets): Use stable_sort when sorting
957         segments.  Pass this to Compare_segments constructor.
958         * layout.h (class Layout): Make segment_precedes non-static.
959         (class Compare_segments): Change from struct to class.  Add
960         layout_ field.  Add constructor.
961         * script-sections.cc
962         (Script_sections::attach_sections_using_phdrs_clause): Rename
963         local orphan to is_orphan.  Don't report failure to put empty
964         section in segment.  On attachment failure, report name of
965         section, and attach to first PT_LOAD segment.
966
967 2011-06-28  Ian Lance Taylor  <iant@google.com>
968
969         PR gold/12934
970         * target-select.cc (Target_selector::Target_selector): Add
971         emulation parameter.  Change all callers.
972         (select_target_by_bfd_name): Rename from select_target_by_name.
973         Change all callers.
974         (select_target_by_emulation): New function.
975         (supported_emulation_names): New function.
976         * target-select.h (class Target_selector): Add emulation_ field.
977         Update declarations.
978         (Target_selector::recognize_by_bfd_name): Rename from
979         recognize_by_name.  Change all callers.
980         (Target_selector::supported_bfd_names): Rename from
981         supported_names.  Change all callers.
982         (Target_selector::recognize_by_emulation): New function.
983         (Target_selector::supported_emulations): New function.
984         (Target_selector::emulation): New function.
985         (Target_selector::do_recognize_by_bfd_name): Rename from
986         do_recognize_by_name.  Change all callers.
987         (Target_selector::do_supported_bfd_names): Rename from
988         do_supported_names.  Change all callers.
989         (Target_selector::do_recognize_by_emulation): New function.
990         (Target_selector::do_supported_emulations): New function.
991         (select_target_by_bfd_name): Change name in declaration.
992         (select_target_by_emulation): Declare.
993         (supported_emulation_names): Declare.
994         * parameters.cc (parameters_force_valid_target): Try to find
995         target based on emulation from -m option.
996         * options.h (class General_options): Change doc string for -m.
997         * options.cc (help): Print emulations.
998         (General_options::parse_V): Likewise.
999         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1000         Add emulation parameter.  Change all callers.
1001
1002 2011-06-28  Ian Lance Taylor  <iant@google.com>
1003
1004         * target.h (class Target): Add osabi_ field.
1005         (Target::osabi): New function.
1006         (Target::set_osabi): New function.
1007         (Target::Target): Initialize osabi_.
1008         (Target::do_adjust_elf_header): Make pure virtual.
1009         (Sized_target::do_adjust_elf_header): Declare.
1010         * target.cc (Sized_target::do_adjust_elf_header): New function.
1011         (class Sized_target): Instantiate all versions.
1012         * freebsd.h (class Target_freebsd): Remove.
1013         (Target_selector_freebsd::do_recognize): Call set_osabi on
1014         Target.
1015         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1016         (Target_selector_freebsd::set_osabi): Remove.
1017         * i386.cc (class Target_i386): Inherit from Sized_target rather
1018         than Target_freebsd.
1019         * x86_64.cc (class Target_x86_64): Likewise.
1020
1021 2011-06-28  Ian Lance Taylor  <iant@google.com>
1022
1023         * target.h (Target::can_check_for_function_pointers): Rewrite.
1024         Make non-virtual.
1025         (Target::can_icf_inline_merge_sections): Likewise.
1026         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1027         (Target::Target_info): Add can_icf_inline_merge_sections field.
1028         (Target::do_can_check_for_function_pointers): New virtual
1029         function.
1030         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1031         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1032         from can_check_for_function_pointers, move in file.
1033         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1034         section_may_have_icf_unsafe_poineters, move in file.
1035         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1036         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1037         Rename from can_check_for_function_pointers, move in file.
1038         (Target_i386::can_icf_inline_merge_sections): Remove.
1039         (Target_i386::i386_info): Initialize
1040         can_icf_inline_merge_sections.
1041         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1042         Initialize can_icf_inline_merge_sections.
1043         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1044         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1045         Rename from can_check_for_function_pointers, move in file.
1046         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1047         (Target_x86_64::x86_64_info): Initialize
1048         can_icf_inline_merge_sections.
1049         * testsuite/testfile.cc (Target_test::test_target_info):
1050         Likewise.
1051         * icf.cc (get_section_contents): Correct formatting.
1052
1053 2011-06-27  Ian Lance Taylor  <iant@google.com>
1054
1055         * symtab.cc (Symbol::versioned_name): New function.
1056         (Symbol_table::add_to_final_symtab): Use versioned_name when
1057         appropriate.
1058         (Symbol_table::sized_write_symbol): Likewise.
1059         * symtab.h (class Symbol): Declare versioned_name.
1060         * stringpool.h (class Stringpool_template): Add variant of add
1061         which takes a std::basic_string.
1062         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1063         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1064         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1065         (ver_test_12.o): New target.
1066         * testsuite/Makefile.in: Rebuild.
1067
1068 2011-06-27  Doug Kwan  <dougkwan@google.com>
1069
1070         * arm.cc (Arm_relocate_functions::thm_jump8,
1071         Arm_relocate_functions::thm_jump11): Use a wider signed
1072         type to compute offset.
1073         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1074         arm_thm_jump8.
1075         * testsuite/Makefile.in: Regenerate.
1076         * testsuite/arm_branch_in_range.sh: Check test results of
1077         arm_thm_jump11 and arm_thm_jump8.
1078         * testsuite/arm_thm_jump11.s: New test source file.
1079         * testsuite/arm_thm_jump11.t: New linker script.
1080         * testsuite/arm_thm_jump8.s: New test source file.
1081         * testsuite/arm_thm_jump8.t: New linker script.
1082
1083 2011-06-24  Ian Lance Taylor  <iant@google.com>
1084
1085         * layout.cc: Include "object.h".
1086         (ctors_sections_in_init_array): New static variable.
1087         (Layout::is_ctors_in_init_array): New function.
1088         (Layout::layout): Add entry to ctors_sections_in_init_array if
1089         appropriate.
1090         * layout.h (class Layout): Declare is_ctors_in_init_array.
1091         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1092         is_ctors_reverse_view is set.
1093         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1094         all callers.  Set is_ctors_reverse_view field of View_size.
1095         (Sized_relobj_file::reverse_words): New function.
1096         * object.h (Sized_relobj_file::View_size): Add
1097         is_ctors_reverse_view field.
1098         (class Sized_relobj_file): Update declarations.
1099         * testsuite/initpri3.c: New test.
1100         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1101         initpri3b.
1102         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1103         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1104         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1105         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1106         * testsuite/Makefile.in: Rebuild.
1107
1108 2011-06-24  Cary Coutant  <ccoutant@google.com>
1109
1110         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1111         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1112         (debug_msg_cdebug.err): New targets.
1113         * testsuite/Makefile.in: Regenerate.
1114         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1115         Fix checks for link with shared library.
1116
1117 2011-06-24  Doug Kwan  <dougkwan@google.com>
1118
1119         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1120         skip empty text sections.
1121         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1122
1123 2011-06-22  Ian Lance Taylor  <iant@google.com>
1124
1125         PR gold/12910
1126         * options.h (class General_options): Add --ctors-in-init-array.
1127         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1128         friends as SHT_PROGBITS for merging sections.
1129         (Layout::layout): Remove special handling of .init_array and
1130         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1131         and .dtors if ctors_in_init_array.
1132         (Layout::make_output_section): Force correct section types for
1133         .init_array and friends.  Don't sort if doing relocatable link,
1134         Don't sort .ctors and .dtors if ctors_in_init_array.
1135         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1136         (Layout::output_section_name): Add relobj parameter.  Change all
1137         callers.  Handle .ctors. and .dtors. in code rather than table.
1138         Handle .ctors and .dtors if ctors_in_init_array.
1139         (Layout::match_file_name): New function, moved from output.cc.
1140         * layout.h (class Layout): Update declarations.
1141         * output.cc: Include "layout.h".
1142         (Input_section_sort_entry::get_priority): New function.
1143         (Input_section_sort_entry::match_file_name): Just call
1144         Layout::match_file_name.
1145         (Output_section::Input_section_sort_init_fini_compare::operator()):
1146         Handle .ctors and .dtors.  Sort by explicit priority rather than
1147         by name.
1148         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1149         * testsuite/initpri2.c: New test.
1150         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1151         (check_PROGRAMS): Add initpri2.
1152         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1153         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1154         * configure, testsuite/Makefile.in: Rebuild.
1155
1156 2011-06-19  Ian Lance Taylor  <iant@google.com>
1157
1158         PR gold/12880
1159         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1160         .interp section to a PT_INTERP segment even if we have seen a
1161         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1162         clause in a linker script.
1163         (Layout::finalize): Don't create a .interp section if we've
1164         already create a PT_INTERP segment.
1165         (Layout::create_interp): Always call choose_output_section (revert
1166         patch of 2011-06-17).  Don't create PT_INTERP segment.
1167         * script-sections.cc
1168         (Script_sections::create_note_and_tls_segments): Add a .interp
1169         section to a PT_INTERP segment even if we have seen a
1170         --dynamic-linker option.
1171
1172 2011-06-18  Ian Lance Taylor  <iant@google.com>
1173
1174         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1175         merely because a non-PT_LOAD segment has a dynamic reloc.
1176
1177 2011-06-18  Ian Lance Taylor  <iant@google.com>
1178
1179         * layout.cc (Layout::finish_dynamic_section): Don't create
1180         DT_FLAGS entry if not needed.
1181
1182 2011-06-18  Ian Lance Taylor  <iant@google.com>
1183
1184         PR gold/12745
1185         * layout.cc (Layout::layout_eh_frame): Correct handling of
1186         writable .eh_frame section.
1187
1188 2011-06-17  Ian Lance Taylor  <iant@google.com>
1189
1190         PR gold/12893
1191         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1192         symbol is redefined with the exact same object and value.
1193
1194 2011-06-17  Ian Lance Taylor  <iant@google.com>
1195
1196         PR gold/12880
1197         * layout.h (class Layout): Add interp_segment_ field.
1198         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1199         (Layout::attach_allocated_section_to_segment): If making shared
1200         library, put .interp section in PT_INTERP segment.
1201         (Layout::finalize): Also call create_interp if -dynamic-linker
1202         option was used.
1203         (Layout::create_interp): Assert that there is no PT_INTERP
1204         segment.  If not using a SECTIONS clause, use make_output_section.
1205         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1206         * script-sections.cc
1207         (Script_sections::create_note_and_tls_segments): If making shared
1208         library, put .interp section in PT_INTERP segment.
1209
1210 2011-06-17  Ian Lance Taylor  <iant@google.com>
1211
1212         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1213         when making a shared library.
1214
1215 2011-06-17  Ian Lance Taylor  <iant@google.com>
1216
1217         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1218         parameter.  Change all callers.  Don't issue warning about PC32
1219         against locally defined symbol.
1220
1221 2011-06-16  Ian Lance Taylor  <iant@google.com>
1222
1223         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1224         occurs in same object.
1225
1226 2011-06-14  Alan Modra  <amodra@gmail.com>
1227
1228         * po/POTFILES.in: Regenerate.
1229
1230 2011-06-09  Ian Lance Taylor  <iant@google.com>
1231
1232         * script-sections.cc
1233         (Orphan_output_section::set_section_addresses): For a relocatable
1234         link set address to 0.
1235
1236 2011-06-09  Cary Coutant  <ccoutant@google.com>
1237
1238         PR gold/12804
1239         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1240         used with --compress-debug-sections.
1241         * gold/object.cc (Sized_relobj_file::do_layout): Report
1242         uncompressed size of compressed input sections.
1243
1244 2011-06-08  Cary Coutant  <ccoutant@google.com>
1245
1246         PR gold/12804
1247         * testsuite/two_file_test_2_v1.cc: Change initialization of
1248         v2 to keep it in .data.
1249
1250 2011-06-07  Cary Coutant  <ccoutant@google.com>
1251
1252         * common.cc (Symbol_table::do_allocate_commons_list): Call
1253         gold_fallback.
1254         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1255         (Errors::fallback): New function.
1256         (gold_fallback): New function.
1257         * errors.h (Errors::fallback): New function.
1258         * gold.cc (gold_exit): Change status parameter to enum; adjust
1259         all callers.
1260         (queue_initial_tasks): Call gold_fallback.
1261         * gold.h: Include cstdlib.
1262         (Exit_status): New enum type.
1263         (gold_exit): Change status parameter to enum.
1264         (gold_fallback): New function.
1265         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1266         (Layout::create_symtab_sections): Likewise.
1267         (Layout::create_shdrs): Likewise.
1268         * main.cc (main): Adjust call to gold_exit.
1269         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1270         (Output_data_got::add_got_entry_pair): Likewise.
1271         (Output_section::add_input_section): Likewise.
1272         (Output_section::add_output_section_data): Likewise.
1273         (Output_segment::set_section_list_addresses): Likewise.
1274         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1275
1276 2011-06-07  Cary Coutant  <ccoutant@google.com>
1277
1278         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1279         for incremental links.
1280         * output.cc (Output_segment::set_section_list_addresses): Remove
1281         FIXME and test for TLS or BSS.
1282
1283 2011-06-07  Cary Coutant  <ccoutant@google.com>
1284
1285         * testsuite/Makefile.am: Add incremental_copy_test,
1286         incremental_common_test_1.
1287         * testsuite/Makefile.in: Regenerate.
1288         * testsuite/common_test_1_v1.c: New source file.
1289         * testsuite/common_test_1_v2.c: New source file.
1290         * testsuite/copy_test_v1.cc: New source file.
1291
1292 2011-06-07  Cary Coutant  <ccoutant@google.com>
1293
1294         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1295         update, allocate common from bss section's free list.
1296         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1297         linker-defined symbols.
1298         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1299         Skip GOT and PLT entries that are no longer referenced.
1300         (Output_section_incremental_inputs::write_info_blocks): Mark
1301         linker-defined symbols.
1302         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1303         * output.cc (Output_section::allocate): New function.
1304         * output.h (Output_section::allocate): New function.
1305         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1306         linker-defined symbols.
1307         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1308         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1309         (Symbol::init_base_output_data): Likewise.
1310         (Symbol::init_base_output_segment): Likewise.
1311         (Symbol::init_base_constant): Likewise.
1312         (Sized_symbol::init_output_data): Likewise.
1313         (Sized_symbol::init_output_segment): Likewise.
1314         (Sized_symbol::init_constant): Likewise.
1315         (Symbol_table::do_define_in_output_data): Likewise.
1316         (Symbol_table::do_define_in_output_segment): Likewise.
1317         (Symbol_table::do_define_as_constant): Likewise.
1318         * symtab.h (Symbol::is_predefined): New function.
1319         (Symbol::init_base_output_data): Add is_predefined parameter.
1320         (Symbol::init_base_output_segment): Likewise.
1321         (Symbol::init_base_constant): Likewise.
1322         (Symbol::is_predefined_): New data member.
1323         (Sized_symbol::init_output_data): Add is_predefined parameter.
1324         (Sized_symbol::init_output_segment): Likewise.
1325         (Sized_symbol::init_constant): Likewise.
1326         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1327
1328 2011-06-07  Cary Coutant  <ccoutant@google.com>
1329
1330         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1331         instead of emit_copy_reloc.
1332         (Copy_relocs::emit_copy_reloc): Refactor.
1333         (Copy_relocs::make_copy_reloc): New function.
1334         (Copy_relocs::add_copy_reloc): Remove.
1335         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1336         section.
1337         (Copy_relocs::make_copy_reloc): New function.
1338         (Copy_relocs::add_copy_reloc): Remove.
1339         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1340         unchanged input files.
1341         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1342         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1343         Reserve BSS space for COPY relocations.
1344         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1345         (Output_section_incremental_inputs::write_info_blocks): Record
1346         whether a symbol is copied from a shared object.
1347         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1348         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1349         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1350         (Incremental_input_entry_reader::get_output_symbol_index): Add
1351         is_copy parameter.
1352         (Incremental_binary::emit_copy_relocs): New function.
1353         (Incremental_binary::do_emit_copy_relocs): New function.
1354         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1355         new data member.
1356         (Sized_incremental_binary::add_copy_reloc): New function.
1357         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1358         (Sized_incremental_binary::Copy_reloc): New struct.
1359         (Sized_incremental_binary::Copy_relocs): New typedef.
1360         (Sized_incremental_binary::copy_relocs_): New data member.
1361         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1362         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1363         * target.h (Sized_target::emit_copy_reloc): New function.
1364         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1365
1366 2011-06-02  Cary Coutant  <ccoutant@google.com>
1367
1368         PR gold/12163
1369         * gold/archive.cc (Archive::Archive): Initialize new data member.
1370         (Archive::include_all_members): Return if archive has already been
1371         included.
1372         * gold/archive.h (Archive::include_all_members_): New data member.
1373
1374 2011-06-02  Nick Clifton  <nickc@redhat.com>
1375
1376         * dynobj.h: Fix spelling mistake in comment.
1377         * output.cc: Likewise.
1378
1379 2011-05-31  Doug Kwan  <dougkwan@google.com>
1380             Asier Llano
1381
1382         PR gold/12826
1383         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1384         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1385         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1386         redundant arm_exidx_test.so.
1387         * testsuite/Makefile.in: Regenerate.
1388         (check_SCRIPTS): Add pr12826.sh
1389         (check_DATA): Add pr12826.stdout
1390         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1391         * testsuite/pr12826.sh: New file.
1392         * testsuite/pr12826_1.s: Ditto.
1393         * testsuite/pr12826_1.s: Ditto.
1394
1395 2011-05-30  Ian Lance Taylor  <iant@google.com>
1396
1397         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1398         sections.
1399
1400 2011-05-29  Ian Lance Taylor  <iant@google.com>
1401
1402         PR gold/12804
1403         * testsuite/Makefile.am: Use different file name for two_file_test
1404         temporary file for each incremental test.
1405         * testsuite/Makefile.in: Rebuild.
1406
1407 2011-05-29  Ian Lance Taylor  <iant@google.com>
1408
1409         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1410         binary input file is empty.
1411
1412 2011-05-27  Ian Lance Taylor  <iant@google.com>
1413
1414         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1415         (ver_test_9.so): Likewise.
1416         * testsuite/Makefile.in: Rebuild.
1417
1418 2011-05-26 Cary Coutant  <ccoutant@google.com>
1419
1420         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1421         * incremental.cc (Incremental_inputs::report_input_section): Fix
1422         comment, indentation.
1423         (Incremental_inputs::report_comdat_group): New function.
1424         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1425         of data for incremental input file entry.
1426         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1427         group count, COMDAT group signatures.
1428         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1429         an unchanged input file.
1430         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1431         Initialize new data member.
1432         (Incremental_object_entry::add_comdat_group): New function.
1433         (Incremental_object_entry::get_comdat_group_count): New function.
1434         (Incremental_object_entry::get_comdat_signature_key): New function.
1435         (Incremental_object_entry::groups_): New data member.
1436         (Incremental_inputs::report_comdat_group): New function.
1437         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1438         data for incremental input file entry.
1439         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1440         (Incremental_input_entry_reader::get_input_section): Adjust size of
1441         data for incremental input file entry.
1442         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1443         (Incremental_input_entry_reader::get_comdat_group_signature): New
1444         function.
1445         * object.cc (Sized_relobj::include_section_group): Report kept
1446         COMDAT groups for incremental links.
1447
1448 2011-05-24  David Meyer  <pdox@google.com>
1449
1450         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1451         with name parameter.  Add found_name parameter.
1452         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1453         * dirsearch.h (class Dirsearch): Update declaration.
1454
1455 2011-05-24  Ian Lance Taylor  <iant@google.com>
1456
1457         * archive.cc (Library_base::should_include_member): Pull in object
1458         from archive if it defines the entry symbol.
1459         * parameters.cc (Parameters::entry): New function.
1460         * parameters.h (class Parameters): Declare entry.
1461         * output.h (class Output_file_header): Remove entry_ field.
1462         * output.cc (Output_file_header::Output_file_header): Remove entry
1463         parameter.  Change all callers.
1464         (Output_file_header::entry): Use parameters->entry.
1465         * gold.cc (queue_middle_tasks): Likewise.
1466         * plugin.cc (Plugin_hook::run): Likewise.
1467
1468 2011-05-24 Cary Coutant  <ccoutant@google.com>
1469
1470         * gold.cc (queue_initial_tasks): Pass incremental base filename
1471         to Output_file::open_base_file; don't print error message.
1472         * incremental-dump.cc (main): Adjust call to
1473         Output_file::open_for_modification.
1474         * incremental-dump.cc (main): Likewise.
1475         * incremental.cc (Incremental_inputs::report_command_line):
1476         Ignore --incremental-base option when comparing command lines.
1477         Ignore parameter when given as separate argument.
1478         * options.h (class General_options): Add --incremental-base.
1479         * output.cc (Output_file::Output_file):
1480         (Output_file::open_base_file): Add base_name and writable parameters;
1481         read base file into new file; print error message here.
1482         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1483         callers.
1484         * output.h (Output_file::open_for_modification): Rename to...
1485         (Output_file::open_base_file): ...this; add base_name and
1486         writable parameters; adjust all callers.
1487         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1488         callers.
1489         * testsuite/Makefile.am (incremental_test_4): Test
1490         --incremental-base.
1491         * testsuite/Makefile.in: Regenerate.
1492
1493 2011-05-24 Cary Coutant  <ccoutant@google.com>
1494
1495         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1496         incremental_test_4.
1497         * testsuite/Makefile.in: Regenerate.
1498         * testsuite/two_file_test_1_v1.cc: New test source file.
1499         * testsuite/two_file_test_1b_v1.cc: New test source file.
1500         * testsuite/two_file_test_2_v1.cc: New test source file.
1501
1502 2011-05-24 Cary Coutant  <ccoutant@google.com>
1503
1504         * dynobj.h (Dynobj::do_dynobj): New function.
1505         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1506         flag and soname for shared objects.
1507         * incremental.cc (Incremental_inputs::report_object): Make
1508         either Incremental_object_entry or Incremental_dynobj_entry; add
1509         soname to string table.
1510         (Incremental_inputs::report_input_section): Add assertion.
1511         (Output_section_incremental_inputs::set_final_data_size): Adjust
1512         type of input file entry for shared libraries; adjust size of
1513         shared library info entry.
1514         (Output_section_incremental_inputs::write_input_files): Write
1515         as_needed flag for shared libraries.
1516         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1517         of input file entry for shared libraries; write soname.
1518         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1519         soname from incremental info.
1520         * incremental.h (enum Incremental_input_flags): Add
1521         INCREMENTAL_INPUT_AS_NEEDED.
1522         (Incremental_input_entry::Incremental_input_entry): Initialize new
1523         data member.
1524         (Incremental_input_entry::set_as_needed): New function.
1525         (Incremental_input_entry::as_needed): New function.
1526         (Incremental_input_entry::do_dynobj_entry): New function.
1527         (Incremental_input_entry::as_needed_): New data member.
1528         (Incremental_object_entry::Incremental_object_entry): Don't check
1529         for shared library.
1530         (Incremental_object_entry::do_type): Likewise.
1531         (class Incremental_dynobj_entry): New class.
1532         (Incremental_input_entry_reader::as_needed): New function.
1533         (Incremental_input_entry_reader::get_soname): New function.
1534         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1535         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1536         size of shared library info entry.
1537         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1538         incremental link when adding DT_NEEDED entries.
1539         * object.h (Object::Object): Initialize new data member.
1540         (Object::dynobj): New function.
1541         (Object::set_as_needed): New function.
1542         (Object::as_needed): New function.
1543         (Object::do_dynobj): New function.
1544         (Object::as_needed_): New data member.
1545
1546 2011-05-24 Cary Coutant  <ccoutant@google.com>
1547
1548         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1549         info; adjust display of GOT entries.
1550         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1551         vector of input objects; remove file_status_.
1552         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1553         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1554         got_plt reader; call target hooks to reserve GOT entries.
1555         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1556         of input file info header and GOT info entry.
1557         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1558         relocation info.
1559         (Got_plt_view_info::got_descriptor): Remove.
1560         (Got_plt_view_info::sym_index): New data member.
1561         (Got_plt_view_info::input_index): New data member.
1562         (Local_got_offset_visitor::visit): Write input file index.
1563         (Global_got_offset_visitor::visit): Write 0 for input file index.
1564         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1565         with sym_index and input_index.
1566         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1567         incremental info GOT entry; replace got_descriptor with input_index.
1568         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1569         map from input file index to object.
1570         (Sized_relobj_incr::do_layout): Replace direct data member reference
1571         with accessor function.
1572         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1573         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1574         Adjust size of input file info header.
1575         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1576         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1577         (Incremental_input_entry_reader::get_input_section): Adjust size of
1578         input file info header.
1579         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1580         of incremental info GOT entry.
1581         (Incremental_got_plt_reader::get_got_desc): Remove.
1582         (Incremental_got_plt_reader::get_got_symndx): New function.
1583         (Incremental_got_plt_reader::get_got_input_index): New function.
1584         (Sized_incremental_binary::Sized_incremental_binary): Remove
1585         file_status_; add input_objects_.
1586         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1587         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1588         (Sized_incremental_binary::file_is_unchanged): Remove.
1589         (Sized_incremental_binary::set_input_object): New function.
1590         (Sized_incremental_binary::input_object): New function.
1591         (Sized_incremental_binary::file_status_): Remove.
1592         (Sized_incremental_binary::input_objects_): New data member.
1593         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1594         references.
1595         (Sized_relobj_incr::invalid_address): Move to base class.
1596         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1597         class.
1598         (Sized_relobj_incr::do_output_section_offset): Likewise.
1599         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1600         (Sized_relobj_incr::section_offsets_): Likewise.
1601         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1602         function.
1603         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1604         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1605         with accessor function.
1606         (Sized_relobj_file::do_layout): Likewise.
1607         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1608         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1609         (Sized_relobj_file::compute_final_local_value): Replace refs to
1610         section_offsets_ with accessor function.
1611         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1612         * object.h (Relobj::Relobj): Initialize new data members.
1613         (Relobj::add_dyn_reloc): New function.
1614         (Relobj::first_dyn_reloc): New function.
1615         (Relobj::dyn_reloc_count): New function.
1616         (Relobj::first_dyn_reloc_): New data member.
1617         (Relobj::dyn_reloc_count_): New data member.
1618         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1619         references.
1620         (Sized_relobj::Address): New typedef.
1621         (Sized_relobj::invalid_address): Move here from child class.
1622         (Sized_relobj::Sized_relobj): Initialize new data members.
1623         (Sized_relobj::sized_relobj): New function.
1624         (Sized_relobj::is_output_section_offset_invalid): Move here from
1625         child class.
1626         (Sized_relobj::get_output_section_offset): Likewise.
1627         (Sized_relobj::local_has_got_offset): Likewise.
1628         (Sized_relobj::local_got_offset): Likewise.
1629         (Sized_relobj::set_local_got_offset): Likewise.
1630         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1631         (Sized_relobj::clear_got_offsets): New function.
1632         (Sized_relobj::section_offsets): Move here from child class.
1633         (Sized_relobj::do_output_section_offset): Likewise.
1634         (Sized_relobj::do_set_section_offset): Likewise.
1635         (Sized_relobj::Local_got_offsets): Likewise.
1636         (Sized_relobj::local_got_offsets_): Likewise.
1637         (Sized_relobj::section_offsets_): Likewise.
1638         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1639         references.
1640         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1641         class.
1642         (Sized_relobj_file::sized_relobj): New function
1643         (Sized_relobj_file::local_has_got_offset): Move to base class.
1644         (Sized_relobj_file::local_got_offset): Likewise.
1645         (Sized_relobj_file::set_local_got_offset): Likewise.
1646         (Sized_relobj_file::get_output_section_offset): Likewise.
1647         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1648         (Sized_relobj_file::do_output_section_offset): Likewise.
1649         (Sized_relobj_file::do_set_section_offset): Likewise.
1650         (Sized_relobj_file::Local_got_offsets): Likewise.
1651         (Sized_relobj_file::local_got_offsets_): Likewise.
1652         (Sized_relobj_file::section_offsets_): Likewise.
1653         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1654         (all constructors).
1655         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1656         (Output_reloc::get_symbol_index): Likewise.
1657         (Output_reloc::local_section_offset): Likewise.
1658         (Output_reloc::get_address): Likewise.
1659         (Output_reloc::symbol_value): Likewise.
1660         (Output_data_got::reserve_slot): Move to class definition.
1661         (Output_data_got::reserve_local): New function.
1662         (Output_data_got::reserve_slot_for_global): Remove.
1663         (Output_data_got::reserve_global): New function.
1664         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1665         (all constructors, two instantiations).
1666         (Output_reloc::get_relobj): New function (two instantiations).
1667         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1668         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1669         (Output_data_reloc::add_global): Adjust type of relobj.
1670         (Output_data_reloc::add_global_relative): Likewise.
1671         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1672         (Output_data_reloc::add_local): Likewise.
1673         (Output_data_reloc::add_local_relative): Likewise.
1674         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1675         (Output_data_reloc::add_local_section): Likewise.
1676         (Output_data_reloc::add_output_section): Likewise.
1677         (Output_data_reloc::add_absolute): Likewise.
1678         (Output_data_reloc::add_target_specific): Likewise.
1679         (Output_data_got::reserve_slot): Move definition here.
1680         (Output_data_got::reserve_local): New function.
1681         (Output_data_got::reserve_global): New function.
1682         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1683         section_offsets_ with accessor function.
1684         (Sized_relobj_file::write_sections): Likewise.
1685         (Sized_relobj_file::do_relocate_sections): Likewise.
1686         * target.h (Sized_target::reserve_local_got_entry): New function.
1687         (Sized_target::reserve_global_got_entry): New function.
1688         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1689         (Target_x86_64::reserve_global_got_entry): New function.
1690         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1691
1692 2011-05-23 Cary Coutant  <ccoutant@google.com>
1693
1694         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1695         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1696         bit when checking got_type.
1697         * incremental.cc (Sized_incremental_binary::setup_readers):
1698         Store symbol table and string table locations; initialize bit vector
1699         of file status flags.
1700         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1701         unchanged files.
1702         (Sized_incremental_binary::do_process_got_plt): New function.
1703         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1704         (Output_section_incremental_inputs::set_final_data_size): Record
1705         file index for each input file.
1706         (Output_section_incremental_inputs::write_got_plt): Store file index
1707         instead of input entry offset for each GOT entry.
1708         * incremental.h
1709         (Incremental_input_entry::Incremental_input_entry): Initialize new
1710         data member.
1711         (Incremental_input_entry::set_offset): Store file index.
1712         (Incremental_input_entry::get_file_index): New function.
1713         (Incremental_input_entry::file_index_): New data member.
1714         (Incremental_binary::process_got_plt): New function.
1715         (Incremental_binary::do_process_got_plt): New function.
1716         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1717         data members.
1718         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1719         (Sized_incremental_binary::set_file_is_unchanged): New function.
1720         (Sized_incremental_binary::file_is_unchanged): New function.
1721         (Sized_incremental_binary::do_process_got_plt): New function.
1722         (Sized_incremental_binary::file_status_): New data member.
1723         (Sized_incremental_binary::main_symtab_loc_): New data member.
1724         (Sized_incremental_binary::main_strtab_loc_): New data member.
1725         * output.cc (Output_data_got::Got_entry::write): Add case
1726         RESERVED_CODE.
1727         (Output_data_got::add_global): Call add_got_entry.
1728         (Output_data_got::add_global_plt): Likewise.
1729         (Output_data_got::add_global_with_rel): Likewise.
1730         (Output_data_got::add_global_with_rela): Likewise.
1731         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1732         (Output_data_got::add_global_pair_with_rela): Likewise.
1733         (Output_data_got::add_local): Call add_got_entry.
1734         (Output_data_got::add_local_plt): Likewise.
1735         (Output_data_got::add_local_with_rel): Likewise.
1736         (Output_data_got::add_local_with_rela): Likewise.
1737         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1738         (Output_data_got::add_local_pair_with_rela): Likewise.
1739         (Output_data_got::reserve_slot): New function.
1740         (Output_data_got::reserve_slot_for_global): New function.
1741         (Output_data_got::add_got_entry): New function.
1742         (Output_data_got::add_got_entry_pair): New function.
1743         (Output_section::add_output_section_data): Edit FIXME.
1744         * output.h
1745         (Output_section_data_build::Output_section_data_build): New
1746         constructor with size parameter.
1747         (Output_data_space::Output_data_space): Likewise.
1748         (Output_data_got::Output_data_got): Initialize new data member; new
1749         constructor with size parameter.
1750         (Output_data_got::add_constant): Call add_got_entry.
1751         (Output_data_got::reserve_slot): New function.
1752         (Output_data_got::reserve_slot_for_global): New function.
1753         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1754         (Output_data_got::add_got_entry): New function.
1755         (Output_data_got::add_got_entry_pair): New function.
1756         (Output_data_got::free_list_): New data member.
1757         * target.h (Sized_target::init_got_plt_for_update): New function.
1758         (Sized_target::register_global_plt_entry): New function.
1759         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1760         Initialize new data member; call init; add constructor with PLT count.
1761         (Output_data_plt_x86_64::init): New function.
1762         (Output_data_plt_x86_64::add_relocation): New function.
1763         (Output_data_plt_x86_64::reserve_slot): New function.
1764         (Output_data_plt_x86_64::free_list_): New data member.
1765         (Target_x86_64::init_got_plt_for_update): New function.
1766         (Target_x86_64::register_global_plt_entry): New function.
1767         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1768         incremental updates.
1769         (Output_data_plt_x86_64::add_relocation): New function.
1770         * testsuite/object_unittest.cc (Object_test): Set default options.
1771
1772 2011-05-16  Ian Lance Taylor  <iant@google.com>
1773
1774         * options.h (class General_options): Make -i a synonym for -r.
1775
1776 2011-05-16  Ian Lance Taylor  <iant@google.com>
1777
1778         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1779
1780 2011-05-10 Cary Coutant  <ccoutant@google.com>
1781
1782         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1783         strip_all (-s).
1784
1785 2011-05-06  Ian Lance Taylor  <iant@google.com>
1786
1787         * layout.cc (Layout::layout): If the output section flags change,
1788         update the ordering.
1789
1790 2011-04-25 Cary Coutant  <ccoutant@google.com>
1791
1792         * incremental-dump.cc (dump_incremental_inputs): Print local
1793         symbol info for each input file.
1794         * incremental.cc
1795         (Output_section_incremental_inputs::set_final_data_size): Add local
1796         symbol info to input file entries in incremental info.
1797         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1798         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1799         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1800         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1801         implementation.
1802         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1803         (Sized_incr_relobj::do_relocate): Write the local symbols.
1804         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1805         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1806         Adjust size of input file header.
1807         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1808         (Incremental_inputs_reader::get_local_symbol_count): New function.
1809         (Incremental_inputs_reader::get_input_section): Adjust size of input
1810         file header.
1811         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1812         (Sized_incr_relobj::This): New typedef.
1813         (Sized_incr_relobj::sym_size): New const data member.
1814         (Sized_incr_relobj::Local_symbol): New struct.
1815         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1816         (Sized_incr_relobj::do_local_symbol_offset): New function.
1817         (Sized_incr_relobj::local_symbol_count_): New data member.
1818         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1819         (Sized_incr_relobj::local_symbol_index_): New data member.
1820         (Sized_incr_relobj::local_symbol_offset_): New data member.
1821         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1822         (Sized_incr_relobj::local_symbols_): New data member.
1823         * object.h (Relobj::output_local_symbol_count): New function.
1824         (Relobj::local_symbol_offset): New function.
1825         (Relobj::do_output_local_symbol_count): New function.
1826         (Relobj::do_local_symbol_offset): New function.
1827         (Sized_relobj::do_output_local_symbol_count): New function.
1828         (Sized_relobj::do_local_symbol_offset): New function.
1829
1830 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1831
1832         * descriptors.cc (set_close_on_exec): New function.
1833         (Descriptors::open): Use set_close_on_exec.
1834         * output.cc (S_ISLNK): Define if not defined.
1835
1836 2011-04-22 Cary Coutant  <ccoutant@google.com>
1837
1838         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1839         global symbol map.
1840         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1841         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1842         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1843         relocations.
1844         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1845         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1846         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1847         * incremental.h
1848         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1849         function.
1850         (Incremental_binary::apply_incremental_relocs): New function.
1851         (Incremental_binary::do_apply_incremental_relocs): New function.
1852         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1853         data member.
1854         (Sized_incremental_binary::add_global_symbol): New function.
1855         (Sized_incremental_binary::global_symbol): New function.
1856         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1857         (Sized_incremental_binary::symbol_map_): New data member.
1858         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1859         * target.h (Sized_target::apply_relocation): New function.
1860         * target-reloc.h (apply_relocation): New function.
1861         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1862
1863 2011-04-22  Doug Kwan  <dougkwan@google.com>
1864
1865         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1866         flag of a SHT_ARM_EXIDX section.
1867         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1868         * testsuite/Makefile.in: Regenerate.
1869         * testsuite/arm_exidx_test.s: New file.
1870         * testsuite/arm_exidx_test.sh: Same.
1871
1872 2011-04-20 Cary Coutant  <ccoutant@google.com>
1873
1874         PR gold/12689
1875         * archive.h (Incremental_archive_entry::Archive_member):
1876         Initialize arg_serial_ (second constructor).
1877
1878 2011-04-17  Ian Lance Taylor  <iant@google.com>
1879
1880         * object.cc (Relocate_info::location): Simplify location string.
1881         * errors.cc (Errors::error_at_location): Don't print program
1882         name.
1883         (Errors::warning_at_location): Likewise.
1884         (Errors::undefined_symbol): Likewise.
1885         * testsuite/debug_msg.sh: Update accordingly.
1886
1887 2011-04-14 Cary Coutant  <ccoutant@google.com>
1888
1889         * gold/layout.cc (Layout::symtab_section_offset): New function.
1890         * gold/layout.h (Layout::symtab_section_offset): New function.
1891         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1892
1893 2011-04-12  Ian Lance Taylor  <iant@google.com>
1894
1895         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1896         with MREMAP_MAYMOVE.
1897         * output.h (class Output_file): Add map_is_allocated_ field.
1898         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1899         not available, provide stubs.  If mremap is not available, #define
1900         it to gold_mremap.
1901         (MREMAP_MAYMOVE): Define if not defined.
1902         (Output_file::Output_file): Initialize map_is_allocated_.
1903         (Output_file::resize): Check map_is_allocated_.
1904         (Output_file::map_anonymous): If mmap fails, use malloc.
1905         (Output_file::unmap): Don't do anything for an anonymous map.
1906         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1907         is not available, provide stubs.
1908         (File_read::View::~View): Use free rather than delete[].
1909         (File_read::make_view): Use malloc rather than new[].  If mmap
1910         fails, use malloc.
1911         (File_read::find_or_make_view): Use malloc rather than new[].
1912         * gold.h: Remove HAVE_REMAP code.
1913         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1914         exists.  Rename mremap to gold_mremap.  If mmap is not available
1915         don't do anything.
1916         * configure, config.in: Rebuild.
1917
1918 2011-04-11  Ian Lance Taylor  <iant@google.com>
1919
1920         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1921         initialize local variable v.
1922
1923 2011-04-11  Cary Coutant  <ccoutant@google.com>
1924
1925         * archive.cc (Archive::include_member): Adjust call to
1926         report_object.
1927         (Add_archive_symbols::run): Track argument serial numbers.
1928         (Lib_group::include_member): Likewise.
1929         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1930         * archive.h (Incremental_archive_entry::Archive_member):
1931         Initialize arg_serial_.
1932         (Archive_member::arg_serial_): New data member.
1933         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1934         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1935         incremental link.
1936         (Sized_dynobj::do_for_all_local_got_entries): New function.
1937         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1938         function.
1939         * fileread.cc (get_mtime): New function.
1940         * fileread.h (get_mtime): New function.
1941         * gold.cc (queue_initial_tasks): Check for incremental update.
1942         (process_incremental_input): New function.
1943         (queue_middle_tasks): Don't force valid target for incremental
1944         update.
1945         * incremental-dump.cc (find_input_containing_global): Adjust
1946         size of symbol info entry.
1947         (dump_incremental_inputs): Dump argument serial number and
1948         in_system_directory flag; bias shndx by 1; print symbol names
1949         when dumping per-file symbol lists; use new symbol info readers.
1950         * incremental.cc
1951         (Output_section_incremental_inputs:update_data_size): New function.
1952         (Sized_incremental_binary::setup_readers): Setup input readers
1953         for each input file; build maps for files added from libraries
1954         and scripts.
1955         (Sized_incremental_binary::check_input_args): New function.
1956         (Sized_incremental_binary::do_check_inputs): Build map of argument
1957         serial numbers to input arguments.
1958         (Sized_incremental_binary::do_file_has_changed): Rename
1959         do_file_is_unchanged to this; compare file modification times.
1960         (Sized_incremental_binary::do_init_layout): New function.
1961         (Sized_incremental_binary::do_reserve_layout): New function.
1962         (Sized_incremental_binary::do_get_input_reader): Remove.
1963         (Sized_incremental_binary::get_symtab_view): New function.
1964         (Incremental_checker::can_incrementally_link_output_file): Remove.
1965         (Incremental_inputs::report_command_line): Exclude --debug options.
1966         (Incremental_inputs::report_archive_begin): Add parameter; track
1967         argument serial numbers; don't put input file entry for archive
1968         before archive members.
1969         (Incremental_inputs::report_archive_end): Put input file entry
1970         for archive after archive members.
1971         (Incremental_inputs::report_object): Add parameter; track argument
1972         serial numbers and in_system_directory flag.
1973         (Incremental_inputs::report_script): Add parameter; track argument
1974         serial numbers.
1975         (Output_section_incremental_inputs::set_final_data_size): Adjust
1976         size of symbol info entry; check for forwarding symbols.
1977         (Output_section_incremental_inputs::write_input_files): Write
1978         in_system_directory flag and argument serial number.
1979         (Output_section_incremental_inputs::write_info_blocks): Map section
1980         indices between incremental info and original input file; store
1981         input section index for each symbol.
1982         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1983         change operator() to visit().
1984         (class Global_got_offset_visitor): Likewise.
1985         (class Global_symbol_visitor_got_plt):
1986         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1987         classes.
1988         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1989         (Sized_incr_relobj::do_read_symbols): New function.
1990         (Sized_incr_relobj::do_layout): New function.
1991         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1992         (Sized_incr_relobj::do_add_symbols): New function.
1993         (Sized_incr_relobj::do_should_include_member): New function.
1994         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1995         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1996         (Sized_incr_relobj::do_section_size): New function.
1997         (Sized_incr_relobj::do_section_name): New function.
1998         (Sized_incr_relobj::do_section_contents): New function.
1999         (Sized_incr_relobj::do_section_flags): New function.
2000         (Sized_incr_relobj::do_section_entsize): New function.
2001         (Sized_incr_relobj::do_section_address): New function.
2002         (Sized_incr_relobj::do_section_type): New function.
2003         (Sized_incr_relobj::do_section_link): New function.
2004         (Sized_incr_relobj::do_section_info): New function.
2005         (Sized_incr_relobj::do_section_addralign): New function.
2006         (Sized_incr_relobj::do_initialize_xindex): New function.
2007         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2008         (Sized_incr_relobj::do_read_relocs): New function.
2009         (Sized_incr_relobj::do_gc_process_relocs): New function.
2010         (Sized_incr_relobj::do_scan_relocs): New function.
2011         (Sized_incr_relobj::do_count_local_symbols): New function.
2012         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2013         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2014         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2015         (Sized_incr_relobj::do_relocate): New function.
2016         (Sized_incr_relobj::do_set_section_offset): New function.
2017         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2018         (Sized_incr_dynobj::do_read_symbols): New function.
2019         (Sized_incr_dynobj::do_layout): New function.
2020         (Sized_incr_dynobj::do_add_symbols): New function.
2021         (Sized_incr_dynobj::do_should_include_member): New function.
2022         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2023         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2024         (Sized_incr_dynobj::do_section_size): New function.
2025         (Sized_incr_dynobj::do_section_name): New function.
2026         (Sized_incr_dynobj::do_section_contents): New function.
2027         (Sized_incr_dynobj::do_section_flags): New function.
2028         (Sized_incr_dynobj::do_section_entsize): New function.
2029         (Sized_incr_dynobj::do_section_address): New function.
2030         (Sized_incr_dynobj::do_section_type): New function.
2031         (Sized_incr_dynobj::do_section_link): New function.
2032         (Sized_incr_dynobj::do_section_info): New function.
2033         (Sized_incr_dynobj::do_section_addralign): New function.
2034         (Sized_incr_dynobj::do_initialize_xindex): New function.
2035         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2036         (make_sized_incremental_object): New function.
2037         (Incremental_library::copy_unused_symbols): New function.
2038         (Incremental_library::do_for_all_unused_symbols): New function.
2039         * incremental.h (enum Incremental_input_flags): New type.
2040         (class Incremental_checker): Remove.
2041         (Incremental_input_entry::Incremental_input_entry): Add argument
2042         serial number.
2043         (Incremental_input_entry::arg_serial): New function.
2044         (Incremental_input_entry::set_is_in_system_directory): New function.
2045         (Incremental_input_entry::is_in_system_directory): New function.
2046         (Incremental_input_entry::arg_serial_): New data member.
2047         (Incremental_input_entry::is_in_system_directory_): New data member.
2048         (class Script_info): Move here from script.h.
2049         (Script_info::Script_info): Add filename parameter.
2050         (Script_info::filename): New function.
2051         (Script_info::filename_): New data member.
2052         (Incremental_script_entry::Incremental_script_entry): Add argument
2053         serial number.
2054         (Incremental_object_entry::Incremental_object_entry): Likewise.
2055         (Incremental_object_entry::add_input_section): Build list of input
2056         sections with map to original shndx.
2057         (Incremental_object_entry::get_input_section_index): New function.
2058         (Incremental_object_entry::shndx_): New data member.
2059         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2060         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2061         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2062         serial number.
2063         (Incremental_inputs::report_archive_begin): Likewise.
2064         (Incremental_inputs::report_object): Likewise.
2065         (Incremental_inputs::report_script): Likewise.
2066         (class Incremental_global_symbol_reader): New class.
2067         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2068         and store flags and input file type.
2069         (Incremental_input_entry_reader::arg_serial): New function.
2070         (Incremental_input_entry_reader::type): Extract type from flags.
2071         (Incremental_input_entry_reader::is_in_system_directory): New function.
2072         (Incremental_input_entry_reader::get_input_section_count): Call
2073         accessor function for type.
2074         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2075         function for type; adjust size of global symbol entry.
2076         (Incremental_input_entry_reader::get_global_symbol_count): Call
2077         accessor function for type.
2078         (Incremental_input_entry_reader::get_object_count): Likewise.
2079         (Incremental_input_entry_reader::get_object_offset): Likewise.
2080         (Incremental_input_entry_reader::get_member_count): Likewise.
2081         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2082         (Incremental_input_entry_reader::get_member_offset): Likewise.
2083         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2084         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2085         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2086         (Incremental_input_entry_reader::get_global_symbol_reader): New
2087         function.
2088         (Incremental_input_entry_reader::get_output_symbol_index): New
2089         function.
2090         (Incremental_input_entry_reader::type_): Remove.
2091         (Incremental_input_entry_reader::flags_): New data member.
2092         (Incremental_inputs_reader::input_file_offset): New function.
2093         (Incremental_inputs_reader::input_file_index): New function.
2094         (Incremental_inputs_reader::input_file): Call input_file_offset.
2095         (Incremental_inputs_reader::input_file_at_offset): New function.
2096         (Incremental_relocs_reader::get_r_type): Reformat.
2097         (Incremental_relocs_reader::get_r_shndx): Reformat.
2098         (Incremental_relocs_reader::get_r_offset): Reformat.
2099         (Incremental_relocs_reader::data): New function.
2100         (Incremental_binary::Incremental_binary): Initialize new data members.
2101         (Incremental_binary::check_inputs): Add cmdline parameter.
2102         (Incremental_binary::file_is_unchanged): Remove.
2103         (Input_reader::arg_serial): New function.
2104         (Input_reader::get_unused_symbol_count): New function.
2105         (Input_reader::get_unused_symbol): New function.
2106         (Input_reader::do_arg_serial): New function.
2107         (Input_reader::do_get_unused_symbol_count): New function.
2108         (Input_reader::do_get_unused_symbol): New function.
2109         (Incremental_binary::input_file_count): New function.
2110         (Incremental_binary::get_input_reader): Change signature to use
2111         index instead of filename.
2112         (Incremental_binary::file_has_changed): New function.
2113         (Incremental_binary::get_input_argument): New function.
2114         (Incremental_binary::get_library): New function.
2115         (Incremental_binary::get_script_info): New function.
2116         (Incremental_binary::init_layout): New function.
2117         (Incremental_binary::reserve_layout): New function.
2118         (Incremental_binary::output_file): New function.
2119         (Incremental_binary::do_check_inputs): New function.
2120         (Incremental_binary::do_file_is_unchanged): Remove.
2121         (Incremental_binary::do_file_has_changed): New function.
2122         (Incremental_binary::do_init_layout): New function.
2123         (Incremental_binary::do_reserve_layout): New function.
2124         (Incremental_binary::do_input_file_count): New function.
2125         (Incremental_binary::do_get_input_reader): Change signature.
2126         (Incremental_binary::input_args_map_): New data member.
2127         (Incremental_binary::library_map_): New data member.
2128         (Incremental_binary::script_map_): New data member.
2129         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2130         new data members.
2131         (Sized_incremental_binary::output_section): New function.
2132         (Sized_incremental_binary::inputs_reader): Add const.
2133         (Sized_incremental_binary::symtab_reader): Add const.
2134         (Sized_incremental_binary::relocs_reader): Add const.
2135         (Sized_incremental_binary::got_plt_reader): Add const.
2136         (Sized_incremental_binary::get_symtab_view): New function.
2137         (Sized_incremental_binary::Inputs_reader): New typedef.
2138         (Sized_incremental_binary::Input_entry_reader): New typedef.
2139         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2140         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2141         (Sized_incremental_binary::do_file_has_changed): New function.
2142         (Sized_incremental_binary::do_init_layout): New function.
2143         (Sized_incremental_binary::do_reserve_layout): New function.
2144         (Sized_input_reader::Inputs_reader): Remove.
2145         (Sized_input_reader::Input_entry_reader): Remove.
2146         (Sized_input_reader::do_arg_serial): New function.
2147         (Sized_input_reader::do_get_unused_symbol_count): New function.
2148         (Sized_input_reader::do_get_unused_symbol): New function.
2149         (Sized_incremental_binary::do_input_file_count): New function.
2150         (Sized_incremental_binary::do_get_input_reader): Change signature;
2151         use index instead of filename.
2152         (Sized_incremental_binary::section_map_): New data member.
2153         (Sized_incremental_binary::input_entry_readers_): New data member.
2154         (class Sized_incr_relobj): New class.
2155         (class Sized_incr_dynobj): New class.
2156         (make_sized_incremental_object): New function.
2157         (class Incremental_library): New class.
2158         * layout.cc (Free_list::num_lists): New static data member.
2159         (Free_list::num_nodes): New static data member.
2160         (Free_list::num_removes): New static data member.
2161         (Free_list::num_remove_visits): New static data member.
2162         (Free_list::num_allocates): New static data member.
2163         (Free_list::num_allocate_visits): New static data member.
2164         (Free_list::init): New function.
2165         (Free_list::remove): New function.
2166         (Free_list::allocate): New function.
2167         (Free_list::dump): New function.
2168         (Free_list::print_stats): New function.
2169         (Layout_task_runner::run): Resize output file for incremental updates.
2170         (Layout::Layout): Initialize new data members.
2171         (Layout::set_incremental_base): New function.
2172         (Layout::init_fixed_output_section): New function.
2173         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2174         incremental updates.
2175         (Layout::create_gold_note): Do not create gold note section for
2176         incremental updates.
2177         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2178         for incremental updates.
2179         (Layout::set_section_offsets): For incremental updates, allocate space
2180         from free list.
2181         (Layout::create_symtab_sections): Layout with offsets relative to
2182         start of section; for incremental updates, allocate space from free
2183         list.
2184         (Layout::create_shdrs): For incremental updates, allocate space from
2185         free list.
2186         (Layout::finish_dynamic_section): For incremental updates, do not
2187         check --as-needed (fixed in subsequent patch).
2188         * layout.h (class Free_list): New class.
2189         (Layout::set_incremental_base): New function.
2190         (Layout::incremental_base): New function.
2191         (Layout::init_fixed_output_section): New function.
2192         (Layout::allocate): New function.
2193         (Layout::incremental_base_): New data member.
2194         (Layout::free_list_): New data member.
2195         * main.cc (main): Print Free_list statistics.
2196         * object.cc (Relobj::finalize_incremental_relocs): Add
2197         clear_counts parameter; clear counts only when clear_counts is set.
2198         (Sized_relobj::Sized_relobj): Initialize new base class.
2199         (Sized_relobj::do_layout): Don't report special sections.
2200         (Sized_relobj::do_for_all_local_got_entries): New function.
2201         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2202         symtab_off to all symbol table offsets.
2203         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2204         * object.h (class Got_offset_list): Move to top of file.
2205         (Object::Object): Allow case where input_file == NULL.
2206         (Object::~Object): Likewise.
2207         (Object::input_file): Assert that input_file != NULL.
2208         (Object::lock): Allow case where input_file == NULL.
2209         (Object::unlock): Likewise.
2210         (Object::is_locked): Likewise.
2211         (Object::token): Likewise.
2212         (Object::release): Likewise.
2213         (Object::is_incremental): New function.
2214         (Object::get_mtime): New function.
2215         (Object::for_all_local_got_entries): New function.
2216         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2217         (Object::set_is_in_system_directory): New function.
2218         (Object::is_in_system_directory): New function.
2219         (Object::do_is_incremental): New function.
2220         (Object::do_get_mtime): New function.
2221         (Object::do_for_all_local_got_entries): New function.
2222         (Object::is_in_system_directory_): New data member.
2223         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2224         (class Sized_relobj_base): New class.
2225         (class Sized_relobj): Derive from Sized_relobj_base.
2226         (class Sized_relobj::Symbols): Redeclare from base class.
2227         (class Sized_relobj::local_got_offset_list): Remove.
2228         (class Sized_relobj::Output_sections): Redeclare from base class.
2229         (class Sized_relobj::do_for_all_local_got_entries): New function.
2230         (class Sized_relobj::write_local_symbols): Add offset parameter.
2231         (class Sized_relobj::local_symbol_offset_): Update comment.
2232         (class Sized_relobj::local_dynsym_offset_): Update comment.
2233         * options.cc (Input_arguments::add_file): Remove const.
2234         * options.h (Input_file_argument::Input_file_argument):
2235         Initialize arg_serial_ (all constructors).
2236         (Input_file_argument::set_arg_serial): New function.
2237         (Input_file_argument::arg_serial): New function.
2238         (Input_file_argument::arg_serial_): New data member.
2239         (Input_arguments::Input_arguments): Initialize file_count_.
2240         (Input_arguments::add_file): Remove const.
2241         (Input_arguments::number_of_input_files): New function.
2242         (Input_arguments::file_count_): New data member.
2243         (Command_line::number_of_input_files): Call
2244         Input_arguments::number_of_input_files.
2245         * output.cc (Output_segment_headers::Output_segment_headers):
2246         Set current size.
2247         (Output_section::Input_section::current_data_size): New function.
2248         (Output_section::Output_section): Initialize new data members.
2249         (Output_section::add_input_section): Don't do merge sections for
2250         an incremental link; allocate space from free list for an
2251         incremental update.
2252         (Output_section::add_output_section_data): Allocate space from
2253         free list for an incremental update.
2254         (Output_section::update_data_size): New function.
2255         (Output_section::set_fixed_layout): New function.
2256         (Output_section::reserve): New function.
2257         (Output_segment::set_section_addresses): Remove const.
2258         (Output_segment::set_section_list_addresses): Remove const; allocate
2259         space from free list for an incremental update.
2260         (Output_segment::set_offset): Adjust size of RELRO segment for an
2261         incremental update.
2262         * output.h (Output_data::current_data_size): Move here from
2263         child classes.
2264         (Output_data::pre_finalize_data_size): New function.
2265         (Output_data::update_data_size): New function.
2266         (Output_section_headers::update_data_size): new function.
2267         (Output_section_data_build::current_data_size): Move to Output_data.
2268         (Output_data_strtab::update_data_size): New function.
2269         (Output_section::current_data_size): Move to Output_data.
2270         (Output_section::set_fixed_layout): New function.
2271         (Output_section::has_fixed_layout): New function.
2272         (Output_section::reserve): New function.
2273         (Output_section::update_data_size): New function.
2274         (Output_section::has_fixed_layout_): New data member.
2275         (Output_section::free_list_): New data member.
2276         (Output_segment::set_section_addresses): Remove const.
2277         (Output_segment::set_section_list_addresses): Remove const.
2278         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2279         New function.
2280         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2281         New function.
2282         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2283         parameter when calling Add_symbols constructor; store argument
2284         serial number for members of a lib group.
2285         (Add_symbols::locks): Allow case where token == NULL.
2286         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2287         (Read_member::~Read_member): New function.
2288         (Read_member::is_runnable): New function.
2289         (Read_member::locks): New function.
2290         (Read_member::run): New function.
2291         (Check_script::~Check_script): New function.
2292         (Check_script::is_runnable): New function.
2293         (Check_script::locks): New function.
2294         (Check_script::run): New function.
2295         (Check_library::~Check_library): New function.
2296         (Check_library::is_runnable): New function.
2297         (Check_library::locks): New function.
2298         (Check_library::run): New function.
2299         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2300         (Add_symbols::library_): New data member.
2301         (class Read_member): New class.
2302         (class Check_script): New class.
2303         (class Check_library): New class.
2304         * reloc.cc (Read_relocs::is_runnable): Allow case where
2305         token == NULL.
2306         (Read_relocs::locks): Likewise.
2307         (Scan_relocs::locks): Likewise.
2308         (Relocate_task::locks): Likewise.
2309         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2310         to clear counters.
2311         (Sized_relobj::incremental_relocs_scan): Fix comment.
2312         (Sized_relobj::do_relocate): Pass output file offset to
2313         write_local_symbols.
2314         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2315         from class declaration.
2316         * script.cc (read_input_script): Allocate Script_info; pass
2317         argument serial number to report_script.
2318         * script.h (class Script_info): Move to incremental.h.
2319         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2320         * symtab.h (Symbol_table::add_from_incrobj): New function.
2321         (Symbol_table::set_file_offset): New function.
2322
2323 2011-04-05  Cary Coutant  <ccoutant@google.com>
2324
2325         * incremental-dump.cc (dump_incremental_inputs): Change signature
2326         to take a Sized_incremental_binary; change caller.  Use readers
2327         in Sized_incremental_binary.
2328         * incremental.cc
2329         (Sized_incremental_binary::find_incremental_inputs_sections):
2330         Rename do_find_incremental_inputs_sections to this.
2331         (Sized_incremental_binary::setup_readers): New function.
2332         (Sized_incremental_binary::do_check_inputs): Check
2333         has_incremental_info_ flag; move setup code to setup_readers;
2334         use input readers.
2335         (Sized_incremental_binary::do_file_is_unchanged): New function.
2336         (Sized_incremental_binary::do_get_input_reader): New function.
2337         * incremental.h (class Incremental_binary): Move to end of file.
2338         (Incremental_binary::file_is_unchanged): New function.
2339         (Incremental_binary::do_file_is_unchanged): New function.
2340         (Incremental_binary::Input_reader): New class.
2341         (Incremental_binary::get_input_reader): New function.
2342         (class Sized_incremental_binary): Move to end of file.
2343         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2344         input section reader classes.
2345         (Sized_incremental_binary::has_incremental_info): New function.
2346         (Sized_incremental_binary::inputs_reader): New function.
2347         (Sized_incremental_binary::symtab_reader): New function.
2348         (Sized_incremental_binary::relocs_reader): New function.
2349         (Sized_incremental_binary::got_plt_reader): New function.
2350         (Sized_incremental_binary::do_file_is_unchanged): New function.
2351         (Sized_incremental_binary::Sized_input_reader): New class.
2352         (Sized_incremental_binary::get_input_reader): New function.
2353         (Sized_incremental_binary::find_incremental_inputs_sections):
2354         Rename do_find_incremental_inputs_sections to this.
2355         (Sized_incremental_binary::setup_readers): New function.
2356         (Sized_incremental_binary::has_incremental_info_): New data member.
2357         (Sized_incremental_binary::inputs_reader_): New data member.
2358         (Sized_incremental_binary::symtab_reader_): New data member.
2359         (Sized_incremental_binary::relocs_reader_): New data member.
2360         (Sized_incremental_binary::got_plt_reader_): New data member.
2361         (Sized_incremental_binary::current_input_file_): New data member.
2362
2363 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2364
2365         PR gold/12640
2366         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2367         violation.
2368
2369 2011-03-30  Cary Coutant  <ccoutant@google.com>
2370
2371         * archive.cc (Archive::include_member): Adjust call to report_object.
2372         (Add_archive_symbols::run): Add script_info to call to
2373         report_archive_begin.
2374         (Lib_group::include_member): Adjust call to report_object.
2375         (Add_lib_group_symbols::run): Adjust call to report_object.
2376         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2377         blocks.  Add object count for script input files.
2378         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2379         script_info parameter; change all callers.
2380         (Incremental_inputs::report_object): Add script_info parameter;
2381         change all callers.
2382         (Incremental_inputs::report_script): Store backpointer to
2383         incremental info entry.
2384         (Output_section_incremental_inputs::set_final_data_size): Record
2385         additional information for scripts.
2386         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2387         * incremental.h (Incremental_script_entry::add_object): New function.
2388         (Incremental_script_entry::get_object_count): New function.
2389         (Incremental_script_entry::get_object): New function.
2390         (Incremental_script_entry::objects_): New data member; adjust
2391         constructor.
2392         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2393         (Incremental_inputs::report_object): Add script_info parameter.
2394         (Incremental_inputs_reader::get_object_count): New function.
2395         (Incremental_inputs_reader::get_object_offset): New function.
2396         * options.cc (Input_arguments::add_file): Return reference to
2397         new input argument.
2398         * options.h (Input_argument::set_script_info): New function.
2399         (Input_argument::script_info): New function.
2400         (Input_argument::script_info_): New data member; adjust all
2401         constructors.
2402         (Input_file_group::add_file): Return reference to new input argument.
2403         (Input_file_lib::add_file): Likewise.
2404         (Input_arguments::add_file): Likewise.
2405         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2406         * script.cc (Parser_closure::Parser_closure): Add script_info
2407         parameter; adjust all callers.
2408         (Parser_closure::script_info): New function.
2409         (Parser_closure::script_info_): New data member.
2410         (read_input_script): Report scripts earlier to incremental info.
2411         (script_add_file): Set script_info in Input_argument.
2412         (script_add_library): Likewise.
2413         * script.h (Script_options::Script_info): Rewrite class.
2414
2415 2011-03-29  Cary Coutant  <ccoutant@google.com>
2416
2417         * archive.cc (Library_base::should_include_member): Move
2418         method here from class Archive.
2419         (Archive::Archive): Initialize base class.
2420         (Archive::should_include_member): Move to base class.
2421         (Archive::do_for_all_unused_symbols): New function.
2422         (Add_archive_symbols::run): Remove redundant access to
2423         incremental_inputs.
2424         (Lib_group::Lib_group): Initialize base class.
2425         (Lib_group::do_filename): New function.
2426         (Lib_group::include_member): Pass pointer to Lib_group to
2427         report_object.
2428         (Lib_group::do_for_all_unused_symbols): New function.
2429         (Add_lib_group_symbols::run): Report archive information for
2430         incremental links.
2431         * archive.h (class Library_base): New base class.
2432         (class Archive): Derive from Library_base.
2433         (Archive::filename): Move to base class.
2434         (Archive::set_incremental_info): Likewise.
2435         (Archive::incremental_info): Likewise.
2436         (Archive::Should_include): Likewise.
2437         (Archive::should_include_member): Likewise.
2438         (Archive::Armap_entry): Remove.
2439         (Archive::Unused_symbol_iterator): Remove.
2440         (Archive::unused_symbols_begin): Remove.
2441         (Archive::unused_symbols_end): Remove.
2442         (Archive::do_filename): New function.
2443         (Archive::do_get_mtime): New function.
2444         (Archive::do_for_all_unused_symbols): New function.
2445         (Archive::task_): Move to base class.
2446         (Archive::incremental_info_): Likewise.
2447         (class Lib_group): Derive from Library_base.
2448         (Lib_group::do_filename): New function.
2449         (Lib_group::do_get_mtime): New function.
2450         (Lib_group::do_for_all_unused_symbols): New function.
2451         (Lib_group::task_): Move to base class.
2452         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2453         function.
2454         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2455         function.
2456         * incremental.cc (Incremental_inputs::report_archive_begin):
2457         Use Library_base; call library's get_mtime; add incremental inputs
2458         entry before members.
2459         (class Unused_symbol_visitor): New class.
2460         (Incremental_inputs::report_archive_end): Use Library_base; use
2461         visitor class to record unused symbols; don't add incremental inputs
2462         entry after members.
2463         (Incremental_inputs::report_object): Use Library_base.
2464         * incremental.h
2465         (Incremental_archive_entry::Incremental_archive_entry): Remove
2466         unused Archive parameter.
2467         (Incremental_inputs::report_archive_begin): Use Library_base.
2468         (Incremental_inputs::report_archive_end): Likewise.
2469         (Incremental_inputs::report_object): Likewise.
2470         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2471         function.
2472         * object.h (Object::for_all_global_symbols): New function.
2473         (Object::do_for_all_global_symbols): New function.
2474         (Sized_relobj::do_for_all_global_symbols): New function.
2475         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2476         function.
2477         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2478         function.
2479
2480 2011-03-27  Ian Lance Taylor  <iant@google.com>
2481
2482         * archive.cc (Archive::interpret_header): Return -1 if something
2483         goes wrong.  Change callers accordingly.
2484
2485 2011-03-25  Cary Coutant  <ccoutant@google.com>
2486
2487         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2488         * testsuite/Makefile.in: Regenerate.
2489
2490 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2491
2492         * plugin.cc (get_view): New.
2493         (Plugin::load): Pass get_view to the plugin.
2494         (Plugin_manager::get_view): New.
2495
2496 2011-03-21  Ian Lance Taylor  <iant@google.com>
2497
2498         * testsuite/final_layout.sh: Rewrite to not use dc.
2499         * testsuite/relro_test.sh: Fail if dc is not present.
2500
2501 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2502
2503         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2504         Change == to -eq.
2505         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2506         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2507         Change == to -eq.
2508         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2509         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2510
2511 2011-03-14  Ian Lance Taylor  <iant@google.com>
2512
2513         * script-sections.cc (Sort_output_sections::script_compare):
2514         Rename from is_before, change return type.
2515         (Sort_output_sections::operator()): Adjust accordingly.
2516
2517 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2518
2519         PR gold/12572
2520         * testsuite/odr_violation2.cc: Add comment to make all error line
2521         numbers double digits.
2522         * testsuite/debug_msg.sh: Adjust expected errors.
2523
2524 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2525
2526         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2527         but mark earlier ones as non-canonical
2528         (offset_to_iterator): Update search target and example
2529         (do_addr2line): Return extra lines in a vector*
2530         (format_file_lineno): Extract from do_addr2line
2531         (one_addr2line): Add vector* out-param
2532         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2533         when a lineno entry appeared last for its instruction
2534         (Dwarf_line_info): Add vector* out-param
2535         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2536         * symtab.cc (Odr_violation_compare): Include the lineno in the
2537         comparison again.
2538         (linenos_from_loc): New. Combine the canonical line for an
2539         address with its other lines.
2540         (True_if_intersect): New. Helper functor to make
2541         std::set_intersection a query.
2542         (detect_odr_violations): Compare sets of lines instead of just
2543         one line for each function. This became less deterministic, but
2544         has fewer false positives.
2545         * symtab.h: Declarations.
2546         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2547         mix an optimized and non-optimized object in the same binary
2548         (odr_violation2.so): Same.
2549         * testsuite/Makefile.in: Regenerate from Makefile.am.
2550         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2551         * testsuite/debug_msg.sh: Update line numbers and add
2552         assertions.
2553         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2554         non-optimized context.
2555         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2556         isn't inlined, and use OdrDerived in an optimized context.
2557         * testsuite/odr_header1.h: Defines OdrDerived, where
2558         optimization will change the
2559         first-instruction-in-the-destructor's file and line number.
2560         * testsuite/odr_header2.h: Defines OdrBase.
2561
2562 2011-03-09  Ian Lance Taylor  <iant@google.com>
2563
2564         * fileread.cc (File_read::clear_views): Don't delete the whole
2565         file view.
2566
2567 2011-03-08  Ian Lance Taylor  <iant@google.com>
2568
2569         PR gold/12525
2570         * fileread.cc: #include <climits>.
2571         (GOLD_IOV_MAX): Define.
2572         (File_read::read_multiple): Limit number of entries by iov_max.
2573         * fileread.h (class File_read): Always set max_readv_entries to
2574         128.
2575
2576 2011-03-07  Ian Lance Taylor  <iant@google.com>
2577
2578         PR gold/12525
2579         * options.h (class General_options): Add -dy and -dn.
2580
2581 2011-03-02  Cary Coutant  <ccoutant@google.com>
2582
2583         * testsuite/script_test_9.t: Add TLS segment.
2584
2585 2011-03-02  Simon Baldwin  <simonb@google.com>
2586
2587         * configure.ac: Add check for gnu_indirect_function support in
2588         the toolchain building binutils.
2589         * configure: Rebuild.
2590
2591 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2592
2593         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2594         plugin only symbols.
2595         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2596         in plugin files as not needed in the symbol table.
2597
2598 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2599
2600         * output.cc (Output_section::add_input_section): Delay fill
2601         generation for section ordering.
2602
2603 2011-02-09  Ian Lance Taylor  <iant@google.com>
2604
2605         PR gold/12316
2606         * object.h (class Sized_relobj): Remove clear_local_symbols.
2607         * reloc.cc (Sized_relobj::do_relocate): Don't call
2608         clear_local_symbols.
2609
2610 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2611
2612         * plugin.cc (is_visible_from_outside): Return true for symbols
2613         in the -u option.
2614
2615 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2616
2617         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2618         filename.
2619
2620 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2621
2622         * icf.h (is_section_foldable_candidate): Change type of parameter
2623         to std::string.
2624         * icf.cc (Icf::find_identical_sections): Change type of local variable
2625         section_name to be std::string.
2626         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2627
2628 2011-01-25  Ian Lance Taylor  <iant@google.com>
2629
2630         * script.cc (script_add_extern): Rewrite to use
2631         add_symbol_reference.
2632
2633 2011-01-25  Doug Kwan  <dougkwan@google.com>
2634
2635         * icf.cc (get_section_contents): Always lock section's object.
2636
2637 2011-01-24  Ian Lance Taylor  <iant@google.com>
2638
2639         * options.h (class General_options): Accept
2640         --no-detect-odr-violations.
2641
2642 2011-01-24  Ian Lance Taylor  <iant@google.com>
2643
2644         * version.cc (version_string): Bump to 1.11.
2645
2646 2011-01-24  Ian Lance Taylor  <iant@google.com>
2647
2648         * plugin.cc (class Plugin_rescan): Define new class.
2649         (Plugin_manager::claim_file): Set any_claimed_.
2650         (Plugin_manager::save_archive): New function.
2651         (Plugin_manager::save_input_group): New function.
2652         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2653         necessary.
2654         (Plugin_manager::new_undefined_symbol): New function.
2655         (Plugin_manager::rescan): New function.
2656         (Plugin_manager::rescannable_defines): New function.
2657         (Plugin_manager::add_input_file): Set any_added_.
2658         * plugin.h (class Plugin_manager): define new fields rescannable_,
2659         undefined_symbols_, any_claimed_, and any_added_.  Declare
2660         Plugin_rescan as friend.  Declare new functions.
2661         (Plugin_manager::Rescannable): Define type.
2662         (Plugin_manager::Rescannable_list): Define type.
2663         (Plugin_manager::Undefined_symbol_list): Define type.
2664         (Plugin_manager::Plugin_manager): Initialize new fields.
2665         * archive.cc (Archive::defines_symbol): New function.
2666         (Add_archive_symbols::run): Pass archive to plugins if any.
2667         * archive.h (class Archive): Declare defines_symbol.
2668         * readsyms.cc (Input_group::~Input_group): New function.
2669         (Finish_group::run): Pass input_group to plugins if any.
2670         * readsyms.h (class Input_group): Declare destructor.
2671         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2672         any.
2673
2674 2011-01-10  Ian Lance Taylor  <iant@google.com>
2675
2676         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2677         section as relro.
2678         (Layout::set_segment_offsets): Reset increase_relro before calling
2679         set_section_addresses a second time.
2680
2681 2011-01-04  Cary Coutant  <ccoutant@google.com>
2682
2683         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2684         sections before NOBITS sections.
2685
2686 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2687
2688         * version.cc (print_version): Update copyright to 2011.
2689
2690 2010-12-23  Cary Coutant  <ccoutant@google.com>
2691
2692         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2693         of OS to this->add.  Add OD parameter to second form of the function.
2694
2695 2010-12-20  Ian Lance Taylor  <iant@google.com>
2696
2697         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2698         second of two consecutive entries with same offset.
2699
2700 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2701
2702         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2703         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2704         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2705         to avoid unneeded links against $(LDADD).
2706         * testsuite/Makefile.in: Regenerate.
2707
2708 2010-12-15  Ian Lance Taylor  <iant@google.com>
2709
2710         PR gold/12324
2711         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2712         for R_X86_64_32 and R_X86_64_PC32.
2713         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2714         ver_matching_def_pic.o.
2715         (ver_matching_def_pic.o): New target.
2716
2717 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2718
2719         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2720         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2721         Move definition before File_read::View member definitions.
2722         (File_read::View::~View): Initialize and hold lock before
2723         updating current_mapped_bytes.
2724
2725 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2726
2727         * dwarf_reader.cc: Remove outdated comment.
2728         * gold-threads.cc: Fix typo in error message.
2729         * archive.cc: Fix typos in comments.
2730         * archive.h: Likewise.
2731         * arm-reloc-property.cc: Likewise.
2732         * arm-reloc-property.h: Likewise.
2733         * arm-reloc.def: Likewise.
2734         * arm.cc: Likewise.
2735         * attributes.h: Likewise.
2736         * cref.cc: Likewise.
2737         * ehframe.cc: Likewise.
2738         * fileread.h: Likewise.
2739         * gold.h: Likewise.
2740         * i386.cc: Likewise.
2741         * icf.cc: Likewise.
2742         * incremental.h: Likewise.
2743         * int_encoding.cc: Likewise.
2744         * layout.h: Likewise.
2745         * main.cc: Likewise.
2746         * merge.h: Likewise.
2747         * object.cc: Likewise.
2748         * object.h: Likewise.
2749         * options.cc: Likewise.
2750         * readsyms.cc: Likewise.
2751         * reduced_debug_output.cc: Likewise.
2752         * reloc.cc: Likewise.
2753         * script-sections.cc: Likewise.
2754         * sparc.cc: Likewise.
2755         * symtab.h: Likewise.
2756         * target-reloc.h: Likewise.
2757         * target.cc: Likewise.
2758         * target.h: Likewise.
2759         * timer.cc: Likewise.
2760         * timer.h: Likewise.
2761         * x86_64.cc: Likewise.
2762
2763 2010-12-09  Cary Coutant  <ccoutant@google.com>
2764
2765         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2766         stack.
2767         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2768         parameter; change all callers.
2769         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2770         * options.h (warn_execstack): New option.
2771
2772 2010-12-07  Doug Kwan  <dougkwan@google.com>
2773
2774         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2775         like function call relocations.
2776
2777 2010-12-07  Ian Lance Taylor  <iant@google.com>
2778
2779         * archive.cc (Archive::get_elf_object_for_member): Permit
2780         punconfigured to be NULL.
2781         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2782         (Archive::include_member): Pass NULL to get_elf_object_for_member
2783         if we searched for the archive and this is the first included
2784         object.
2785
2786 2010-12-01  Ian Lance Taylor  <iant@google.com>
2787
2788         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2789         track_relocs_type_ field.
2790         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2791         Set track_relocs_type_.
2792         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2793         contents when using RELA relocs.
2794         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2795         reloc_map_.
2796         * reloc.cc (Track_relocs::next_addend): New function.
2797         * reloc.h (class Track_relocs): Declare next_addend.
2798
2799 2010-12-01  Ian Lance Taylor  <iant@google.com>
2800
2801         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2802         virtual destructor.
2803
2804 2010-12-01  Ian Lance Taylor  <iant@google.com>
2805
2806         * README: Update compilers known to work and fail.
2807
2808 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2809
2810         * configure.in: For --enable-gold, handle value `default' instead of
2811         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2812         not the default.
2813         * configure: Regenerate.
2814
2815 2010-11-18  Doug Kwan  <dougkwan@google.com>
2816
2817         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2818         and right_alignment to be zero.  Store result alignment only if it is
2819         greater than existing alignment.
2820
2821 2010-11-16  Cary Coutant  <ccoutant@google.com>
2822
2823         PR gold/12220
2824         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2825         Check for ".zdebug_line".
2826
2827 2010-11-16  Doug Kwan  <dougkwan@google.com>
2828             Cary Coutant  <ccoutant@google.com>
2829
2830         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2831         by reference; adjust all callers.
2832         * output.cc (Output_segment::set_section_addresses): Adjust references
2833         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2834         list is empty.
2835         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2836         end at page boundary.
2837
2838 2010-11-16  Cary Coutant  <ccoutant@google.com>
2839
2840         PR gold/12220
2841         * layout.cc (Layout::choose_output_section): Transform names of
2842         compressed sections even when using a script with a SECTIONS clause.
2843         (Layout::output_section_name): Remove code to transform
2844         compressed debug section names.
2845         * output.cc (Output_section::add_input_section): Use uncompressed
2846         section size when tracking input sections.
2847
2848 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2849
2850         * symtab.h (Symbol::NON_PIC_REF): Remove.
2851         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2852         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2853         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2854         (Symbol::use_plt_offset): Take a flags argument and pass it
2855         directly to needs_dynamic_reloc.  Restrict check for undefined
2856         weak symbols to function calls.
2857         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2858         (Target_arm::Scan::global): Use it.
2859         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2860         (Target_arm::Relocate::relocate): Likewise.
2861         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2862         parameter with an r_type parameter.  Use get_reference_flags
2863         to get the flags.
2864         (Target_arm::Relocate::relocate): Update accordingly.
2865         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2866         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2867         (Target_i386::Scan::global): Likewise.
2868         (Target_i386::Relocate::relocate): Likewise.
2869         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2870         parameter with an r_type parameter.  Use get_reference_flags
2871         to get the flags.
2872         (Target_i386::Relocate::relocate): Update accordingly.
2873         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2874         (Target_powerpc::Scan::global): Use it.
2875         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2876         (Target_powerpc::Relocate::relocate): Likewise.
2877         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2878         (Target_sparc::Scan::global): Use it.
2879         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2880         (Target_sparc::Relocate::relocate): Likewise.
2881         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2882         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2883         (Target_x86_64::Scan::global): Likewise.
2884         (Target_x86_64::Relocate::relocate): Likewise.
2885
2886 2010-11-08  Doug Kwan  <dougkwan@google.com>
2887             Cary Coutant  <ccoutant@google.com>
2888
2889         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2890         (Arm_exidx_merge_section::section_contents_): New data member.
2891         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2892         (Arm_input_section::~Arm_input_section): De-allocate memory.
2893         (Arm_input_section::original_contents_): New data member.       
2894         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2895         in parameters instead of calling Object::section_contents without
2896         locking.
2897         (Arm_output_section::group_section): New parameter TASK.  Pass it
2898         to callees that need locking objects.
2899         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2900         to lock EXIDX input sections.  Fix a formatting issue.  Call
2901         Arm_exidx_merged_section::build_contents to create merged section
2902         contents.
2903         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2904         to lock object of stub table owner.
2905         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2906         TEXT_SIZE to initialize data member TEXT_SIZE_.
2907         (Arm_exidx_input_section::addralign): Fix typo in comment.
2908         (Arm_exidx_input_section::text_size): New method.
2909         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2910         that require locking objects.  Lock objects before scanning for stubs
2911         and updating local symbols.
2912         (Arm_input_section<big_endian>::init): Copy contents of original
2913         input section.
2914         (Arm_input_section<big_endian>::do_write): Use saved contents of
2915         original input section instead of calling Object::section_contents
2916         without locking.
2917         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2918         size without calling Object::section_size().
2919         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2920         for size.  Allocate a buffer for merged EXIDX entries.
2921         (Arm_exidx_merged_section::build_contents): New method.
2922         (Arm_exidx_merged_section::do_write): Move merge section contents
2923         building code to Arm_exidx_merged_section::build_contetns.  Write
2924         out contetns in buffer instead of building it on the fly.
2925         (Arm_relobj::make_exidx_input_section): Also pass text section size
2926         to Arm_exidx_input_section constructor.
2927         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2928         (Arm_dynobj::do_read_symbols): Fix memory leak.
2929         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2930         * target.h: (class Task): Add forward declaration.
2931         (Target::relax): Add new parameter TASK and pass it to
2932         Target::do_relax().
2933         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2934
2935 2010-11-05  Cary Coutant  <ccoutant@google.com>
2936
2937         PR gold/10708
2938         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2939         object when reading from the file.
2940         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2941         second layout pass.
2942         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2943         when reading section contents.
2944         (get_section_contents): Likewise.
2945         (icf::find_identical_sections): Likewise.
2946         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2947         object when reading from the file.
2948         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2949         the object when doing deferred section layout.
2950
2951 2010-11-03  Nick Clifton  <nickc@redhat.com>
2952
2953         PR gold/12001
2954         * script.h (class Symbol_assignment: name): New member.  Returns
2955         the name of the symbol.
2956         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2957         Returns true if the given symbol name is on the list of
2958         assignments wating to be processed.
2959         * archive.cc (should_incldue_member): If the symbol is undefined,
2960         check to see if it is on the list of symbols pending assignment.
2961
2962 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2963
2964         * script-sections.cc (Script_sections::find_memory_region): Check
2965         for a NULL output section pointer.
2966
2967 2010-10-29  Doug Kwan  <dougkwan@google.com>
2968
2969         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2970         Output_section::add_relaxed_input_section.
2971         * output.cc (Output_section::add_relaxed_input_section): Add new
2972         arguments LAYOUT and NAME.  Set section order index.
2973         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2974         Copy section order index.
2975         * output.h (Output_section::add_relaxed_input_section): Add new
2976         arguments LAYOUT and NAME.
2977
2978 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2979
2980         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2981         NATIVE_OR_CROSS_LINKER.
2982         * testsuite/Makefile.in: Regenerate.
2983
2984 2010-10-20  Doug Kwan  <dougkwan@google.com>
2985
2986         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2987         without SHF_LINK_ORDER flags.
2988         * layout.cc (Layout::choose_output_section): Do not filter
2989         SHF_LINK_ORDER flag in a relocatable link.
2990
2991 2010-10-17  Cary Coutant  <ccoutant@google.com>
2992
2993         * output.h (Output_segment::set_section_addresses): Change function
2994         signature.  Update all callers.
2995         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2996         sections.
2997         (Output_segment::set_section_addresses): Align after last TLS
2998         section.  Add padding before last relro section instead of after.
2999
3000 2010-10-17  Doug Kwan  <dougkwan@google.com>
3001
3002         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3003         GOT output section to be writable.
3004
3005 2010-10-14  Cary Coutant  <ccoutant@google.com>
3006
3007         * debug.h (DEBUG_INCREMENTAL): New flag.
3008         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3009         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3010         mode.
3011         * incremental.cc (report_command_line): Ignore all forms of
3012         --incremental.
3013         * layout.cc (Layout::Layout): Check parameters for incremental link
3014         mode.
3015         * options.cc (General_options::parse_incremental): New function.
3016         (General_options::parse_no_incremental): New function.
3017         (General_options::parse_incremental_full): New function.
3018         (General_options::parse_incremental_update): New function.
3019         (General_options::incremental_mode_): New data member.
3020         (General_options::finalize): Check incremental_mode_.
3021         * options.h (General_options): Update help text for --incremental.
3022         Add --no-incremental, --incremental-full, --incremental-update.
3023         (General_options::Incremental_mode): New enum type.
3024         (General_options::incremental_mode): New function.
3025         (General_options::incremental_mode_): New data member.
3026         * parameters.cc (Parameters::incremental_mode_): New data member.
3027         (Parameters::set_options): Set incremental_mode_.
3028         (Parameters::set_incremental_full): New function.
3029         (Parameters::incremental): New function.
3030         (Parameters::incremental_update): New function.
3031         (set_parameters_incremental_full): New function.
3032         * parameters.h (Parameters::set_incremental_full): New function.
3033         (Parameters::incremental): New function.
3034         (Parameters::incremental_update): New function.
3035         (Parameters::incremental_mode_): New data member.
3036         (set_parameters_incremental_full): New function.
3037         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3038         incremental link mode.
3039         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3040         (Sized_relobj::do_relocate_sections): Likewise.
3041         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3042         option.
3043         * testsuite/Makefile.in: Regenerate.
3044         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3045
3046 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3047
3048         * script-sections.h (class Script_sections): Make
3049         Sections_elements typedef public.
3050         * script-sections.cc (class Sort_output_sections): Add elements_
3051         field.  Add constructor which sets it; change all callers.
3052         (Sort_output_sections::is_before): New function.
3053         (Sort_output_sections::operator()): Call is_before.
3054         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3055         conditional.
3056         * testsuite/script_test_10.sh: New test. Test script section
3057         order.
3058         * testsuite/script_test_10.t: Likewise.
3059         * testsuite/script_test_10.s: Likewise.
3060         * testsuite/Makefile.am: Wrap the cross linker tests and the
3061         common tests into NATIVE_OR_CROSS_LINKER.
3062         (check_SCRIPTS): Add script_test_10.sh.
3063         (check_DATA): Add script_test_10.stdout.
3064         (script_test_10.o, script_test_10): New targets.
3065         (script_test_10.stdout): New target.
3066         * configure, testsuite/Makefile.in: Regenerate.
3067
3068 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3069
3070         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3071         error for the deprecated relocations.
3072         (Target_arm::Scan::global): Likewise.
3073         (Target_arm::Relocate::relocate): Likewise.
3074
3075 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3076
3077         * fileread.cc (Input_file::find_file): Initialize *found_name
3078         and *namep when using the fallback search for case 4.
3079
3080 2010-10-11  Cary Coutant  <ccoutant@google.com>
3081
3082         * options.h (class General_options): Redefine -z lazy as an alias for
3083         the negation of -z now.
3084
3085 2010-10-11  Ian Lance Taylor  <iant@google.com>
3086
3087         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3088         binding.
3089
3090 2010-10-06  Nick Clifton  <nickc@redhat.com>
3091
3092         * script-sections.cc(class Memory_region): Remove
3093         current_lma_offset_ field.  Rename current_vma_offset_ to
3094         current_offset_.  Add last_section_ field.
3095         (Memory_region::get_current_vma_address): Rename to
3096         get_current_address.
3097         (Memory_region::get_current_lma_address): Delete.
3098         (Memory_region::increment_vma_offset): Rename to
3099         increment_offset.
3100         (Memory_region::increment_lma_offset): Delete.
3101         (Memory_region::attributes_compatible): New method.  Returns
3102         true if the provided section is compatible with the region.
3103         (Memory_region::get_last_section): New method.  Returns the last
3104         section to use the region.
3105         (Memory_region::set_last_section): New method.  Stores the last
3106         section to use the region.
3107         (Script_sections::block_in_region): New method.  Returns true if
3108         a block of memory is contained within a region.
3109         (Script_sections::find_memory_region): New method.  Locates a
3110         memory region to be used to set a VMA or LMA address.
3111         (Output_section_definition::set_section_addresses): Add code to
3112         check for addresses set by memory regions.
3113         (Output_segment::set_section_addresses): Remove memory region
3114         walking code.
3115         (Script_sections::create_segment): Add a warning if a header
3116         segment is created outside of any region.
3117         * script-sections.h (class Script_sections): Add prototypes for
3118         find_memory_region and block_in_region methods.
3119         * testsuite/memory_test.s: Use .long instead of .word.
3120         * testsuite/memory_test.t: Add some more output sections.
3121         * testsuite/memory_test.sh: Update expected output.
3122
3123 2010-10-02  Doug Kwan  <dougkwan@google.com>
3124
3125         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3126         defintion to symtab.h
3127         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3128         declaration to defintion.
3129
3130 2010-10-01  Nick Clifton  <nickc@redhat.com>
3131
3132         * expression.cc (eval): Replace dummy argument with NULL.
3133         (eval_maybe_dot): Check for a NULL result section pointer.
3134         (Symbol_expression::value): Likewise.
3135         (Dot_expression::value): Likewise.
3136         (BINARY_EXPRESSION): Likewise.
3137         (Max_expression::value): Likewise.
3138         (Min_expression::value): Likewise.
3139         (Absolute_expression::value): Likewise.
3140         (Addr_expression::value_from_output_section): Likewise.
3141         (Loaddddr_expression::value_from_output_section): Likewise.
3142         (Segment_start_expression::value): Likewise.
3143         * script-sections.cc
3144         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3145         argument with NULL.
3146         (Sections_elememt_dot_assignment::set_section_addresses):
3147         Likewise.
3148         (Output_data_expression::do_write_to_buffer): Likewise.
3149         (Output_section_definition::finalize_symbols): Likewise.
3150         (Output_section_definition::set_section_addresses): Likewise.
3151
3152 2010-09-30  Doug Kwan  <dougkwan@google.com>
3153
3154         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3155
3156 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3157
3158         * target.h (Target::can_icf_inline_merge_sections): New virtual
3159         function.
3160         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3161         virtual function.
3162         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3163         virtual function.
3164         * icf.cc (get_section_contents): Inline merge sections only when
3165         target allows it.
3166
3167 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3168
3169         * configure: Regenerate.
3170
3171 2010-09-17  Ian Lance Taylor  <iant@google.com>
3172
3173         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3174         * testsuite/Makefile.am (memory_test.o): New target.
3175         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3176         memory_test.t.
3177         * testsuite/Makefile.in: Rebuild.
3178
3179 2010-09-17  Doug Kwan  <dougkwan@google.com>
3180
3181         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3182         defintion if relocation uses GOT entries of the symbol.
3183         * testsuite/icf_safe_test.sh: Fix test.
3184         * testsuite/icf_safe_so_test.sh: Fix test.
3185
3186 2010-09-16  Cary Coutant  <ccoutant@google.com>
3187
3188         * script_sections.cc (class Memory_region): Remove "NULL" from
3189         vector initializations.
3190
3191 2010-09-15  Cary Coutant  <ccoutant@google.com>
3192
3193         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3194         Resolve forwarding symbols.
3195
3196 2010-09-15  Doug Kwan  <dougkwan@google.com>
3197
3198         * gold/testsuite/script_test_3.t: Add ARM special sections.
3199         * gold/testsuite/script_test_4.t: Same.
3200         * gold/testsuite/script_test_5.t: Same.
3201         * gold/testsuite/script_test_6.t: Same.
3202         * gold/testsuite/script_test_7.t: Same.
3203         * gold/testsuite/script_test_7.t: Same.
3204         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3205
3206 2010-09-14  Cary Coutant  <ccoutant@google.com>
3207
3208         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3209         (Target_x86_64::Relocate::relocate_tls): Replace check for
3210         saw_tls_block_reloc_ with test for executable section.
3211
3212 2010-09-12  Cary Coutant  <ccoutant@google.com>
3213
3214         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3215         position-independent executables to shared libraries need dynamic
3216         relocations.
3217         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3218         position-independent executables.
3219         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3220         * testsuite/Makefile.in: Regenerate.
3221
3222 2010-09-10  Nick Clifton  <nickc@redhat.com>
3223
3224         PR gold/11997
3225         * testsuite/memory_test.t: Discard any sections that are not
3226         needed.
3227
3228 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3229
3230         PR gold/11996
3231         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3232         "This::" to work around a bug in gcc 4.2.
3233
3234         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3235
3236 2010-09-09  Rafael Espindola  <espindola@google.com>
3237
3238         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3239         sections with different PF_X flags in the same segment.
3240         (Layout::find_first_load_seg): Search all segments to find the first
3241         one.
3242         * options.h (rosegment): New.
3243
3244 2010-09-08  Rafael Espindola  <espindola@google.com>
3245
3246         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3247
3248 2010-09-08  Doug Kwan  <dougkwan@google.com>
3249
3250         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3251         (Arm_relobj::do_relocate_sections): Add new parameter for output
3252         file to match the parent.
3253         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3254         of local symbols instead of input values.  Update code to track
3255         changes in gold::relocate_section.
3256         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3257         (Sized_relobj::compute_final_local_value_internal): New methods.
3258         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3259         body into private version of Sized_relobj::compute_final_local_value.
3260         Call the inline method.
3261         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3262         merged symbol value if there is one.
3263         (Symbol_value::has_output_value): New method defintiion.
3264         (Sized_relobj::Compute_final_local_value_status): New enum type.
3265         (Sized_relobj::compute_final_local_value): New methods.
3266         (Sized_relobj::compute_final_local_value_internal): New methods.
3267         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3268         and arm_cortex_a8.sh.
3269         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3270         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3271         New tests.
3272         * Makefile.in: Regenerate.
3273         * testsuite/arm_bl_out_of_range.s: Update test.
3274         * testsuite/thumb_bl_out_of_range.s: Ditto.
3275         * testsuite/thumb_blx_out_of_range.s: Ditto.
3276         * testsuite/arm_branch_out_of_range.sh: New file.
3277         * testsuite/arm_cortex_a8.sh: Ditto.
3278         * testsuite/arm_cortex_a8_b.s: Ditto.
3279         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3280         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3281         * testsuite/arm_cortex_a8_bl.s: Ditto.
3282         * testsuite/arm_cortex_a8_blx.s: Ditto.
3283         * testsuite/arm_cortex_a8_local.s: Ditto.
3284         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3285         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3286
3287 2010-09-08  Rafael Espindola  <espindola@google.com>
3288
3289         * Makefile.am (memory_test.stdout): Run readelf with -W.
3290         * Makefile.in: Regenerate.
3291         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3292         64 bit output.
3293
3294 2010-09-08  Rafael Espindola  <espindola@google.com>
3295
3296         * script-sections.cc (Script_sections::add_memory_region): Convert
3297         field precision to int.
3298         * script.cc (script_set_section_region, script_set_section_region):
3299         Convert field precision to int.
3300
3301 2010-09-08  Rafael Espindola  <espindola@google.com>
3302
3303         * arm.cc (do_finalize_sections): Create the __exidx_start and
3304         __exdix_end symbols even when the section is missing.
3305
3306 2010-09-08  Nick Clifton  <nickc@redhat.com>
3307
3308         * README: Remove claim that MEMORY is not supported.
3309         * expression.cc (script_exp_function_origin)
3310         (script_exp_function_length): Move from here to ...
3311         * script.cc: ... here.
3312         (script_set_section_region, script_add_memory)
3313         (script_parse_memory_attr, script_include_directive): New
3314         functions.
3315         * script-sections.cc
3316         (class Memory_region): New class.
3317         (class Output_section_definition): Add set_memory_region,
3318         set_section_vma, set_section_lma and get_section_name methods.
3319         (class Script_Sections): Add add_memory_region,
3320         find_memory_region, find_memory_region_origin,
3321         find_memory_region_length and set_memory_region methods.
3322         Have set_section_addresses method walk the list of set memory
3323         regions.
3324         Extend the print methos to display memory regions.
3325         * script-sections.h: Add prototypes for new methods.
3326         Add enum for MEMORY region attributes.
3327         * yyscript.y: Add support for parsing MEMORY regions.
3328         * script-c.h: Add prototypes for new functions.
3329         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3330         * testsuite/Makefile.in: Regenerate.
3331         * testsuite/memory_test.sh: New script.
3332         * testsuite/memory_test.s: New assembler source file.
3333         * testsuite/memory_test.t: New linker script.
3334
3335 2010-08-27  Doug Kwan  <dougkwan@google.com>
3336
3337         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3338         reference override an existing dynamic weak reference.
3339         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3340         * testsuite/Makefile.in: Regenerate.
3341         * testsuite/dyn_weak_ref.sh: New file.
3342         * testsuite/dyn_weak_ref_1.c: Ditto.
3343         * testsuite/dyn_weak_ref_2.c: Ditto.
3344
3345 2010-08-27  Ian Lance Taylor  <iant@google.com>
3346
3347         * incremental.h (class Incremental_input_entry): Add virtual
3348         destructor.
3349
3350 2010-08-27  Ian Lance Taylor  <iant@google.com>
3351
3352         * testsuite/start_lib_test_3.c: Mark t3 as used.
3353
3354 2010-08-27  Nick Clifton  <nickc@redhat.com>
3355
3356         * options.cc (version_script): Fix small typo in previous
3357         whitespace tidyup.
3358
3359 2010-08-25  Nick Clifton  <nickc@redhat.com>
3360
3361         * archive.cc: Formatting fixes: Remove whitespace between
3362         typename and following asterisk.  Remove whitespace between
3363         function name and opening parenthesis.
3364         * archive.h: Likewise.
3365         * arm.cc: Likewise.
3366         * attributes.cc: Likewise.
3367         * attributes.h: Likewise.
3368         * common.cc: Likewise.
3369         * copy-relocs.cc: Likewise.
3370         * dirsearch.h: Likewise.
3371         * dynobj.cc: Likewise.
3372         * ehframe.cc: Likewise.
3373         * ehframe.h: Likewise.
3374         * expression.cc: Likewise.
3375         * fileread.cc: Likewise.
3376         * fileread.h: Likewise.
3377         * gc.h: Likewise.
3378         * gold-threads.cc: Likewise.
3379         * gold.cc: Likewise.
3380         * i386.cc: Likewise.
3381         * icf.h: Likewise.
3382         * incremental-dump.cc: Likewise.
3383         * incremental.cc: Likewise.
3384         * layout.cc: Likewise.
3385         * layout.h: Likewise.
3386         * main.cc: Likewise.
3387         * merge.cc: Likewise.
3388         * merge.h: Likewise.
3389         * object.cc: Likewise.
3390         * object.h: Likewise.
3391         * options.cc: Likewise.
3392         * options.h: Likewise.
3393         * output.cc: Likewise.
3394         * output.h: Likewise.
3395         * plugin.cc: Likewise.
3396         * plugin.h: Likewise.
3397         * powerpc.cc: Likewise.
3398         * reloc.cc: Likewise.
3399         * script-c.h: Likewise.
3400         * script-sections.cc: Likewise.
3401         * script.cc: Likewise.
3402         * stringpool.cc: Likewise.
3403         * symtab.cc: Likewise.
3404         * symtab.h: Likewise.
3405         * target.cc: Likewise.
3406         * timer.cc: Likewise.
3407         * timer.h: Likewise.
3408         * version.cc: Likewise.
3409         * x86_64.cc: Likewise.
3410
3411 2010-08-24  Nick Clifton  <nickc@redhat.com>
3412
3413         PR 11899
3414         * layout.cc (segment_precedes): Sort segments by their physical
3415         addresses, if they have been set.
3416
3417 2010-08-23  Cary Coutant  <ccoutant@google.com>
3418
3419         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3420         symbols data.
3421         (Lib_group::include_member): Unlock object after deleting its
3422         symbols data.
3423         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3424         the bug fixed here.
3425
3426 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3427             Cary Coutant  <ccoutant@google.com>
3428
3429         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3430         constructor, and set_blocker.
3431         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3432         readsyms_blocker_.
3433         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3434         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3435         * testsuite/Makefile.am (start_lib_test): New test case.
3436         * testsuite/Makefile.in: Regenerate.
3437         * testsuite/start_lib_test_main.c: New file.
3438         * testsuite/start_lib_test_1.c: New file.
3439         * testsuite/start_lib_test_2.c: New file.
3440         * testsuite/start_lib_test_3.c: New file.
3441
3442 2010-08-19  Ian Lance Taylor  <iant@google.com>
3443
3444         * Makefile.in: Rebuild with automake 1.11.1.
3445         * aclocal.m4: Likewise.
3446         * testsuite/Makefile.in: Likewise.
3447
3448 2010-08-19  Ian Lance Taylor  <iant@google.com>
3449
3450         PR 10893
3451         * i386.cc (class Output_data_plt_i386): Update declarations.
3452         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3453         local_ifuncs_ fields.
3454         (Target_i386::do_plt_section_for_global): New function.
3455         (Target_i386::do_plt_section_for_local): New function.
3456         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3457         parameter; change all callers.  Initialize global_ifuncs_ and
3458         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3459         __rel_iplt_end.
3460         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3461         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3462         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3463         symbols.
3464         (Target_i386::make_plt_section): New function, broken out of
3465         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3466         (Target_i386::make_plt_entry): Call make_plt_section.
3467         (Target_i386::make_local_ifunc_plt_entry): New function.
3468         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3469         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3470         R_386_IRELATIVE to switch.
3471         (Target_i386::Scan::global): Likewise.
3472         (Target_i386::Relocate::relocate): Likewise.
3473         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3474         switch.
3475         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3476         (Target_x86_64::do_plt_section_for_global): New function.
3477         (Target_x86_64::do_plt_section_for_local): New function.
3478         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3479         parameter; change all callers.  If doing a static link define
3480         __rela_iplt_start and __rela_iplt_end.
3481         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3482         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3483         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3484         to point to .plt.
3485         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3486         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3487         switch.
3488         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3489         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3490         R_X86_64_IRELATIVE to switch.
3491         (Target_x86_64::Scan::global): Likewise.
3492         (Target_x86_64::Relocate::relocate): Likewise.
3493         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3494         switch.
3495         * target.h (class Target): Add plt_section_for_global and
3496         plt_section_for_local functions.  Add do_plt_section_for_global
3497         and do_plt_section_for_local virtual functions.
3498         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3499         clarifying comments.
3500         (Symbol::use_plt_offset): Handle IFUNC symbol.
3501         * object.cc (Sized_relobj::Sized_relobj): Initialize
3502         local_plt_offsets_.
3503         (Sized_relobj::local_has_plt_offset): New function.
3504         (Sized_relobj::local_plt_offset): New function.
3505         (Sized_relobj::set_local_plt_offset): New function.
3506         (Sized_relobj::do_count): Handle IFUNC symbol.
3507         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3508         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3509         is_ifunc_symbol functions.
3510         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3511         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3512         local_plt_offsets_ field.
3513         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3514         * output.h (class Output_section_data): Add non-const
3515         output_section function.
3516         (class Output_data_got): Update declarations.
3517         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3518         Add use_plt_offset parameter to global and local constructors.
3519         Change all callers.  Change local_sym_index_ field to 31 bits.
3520         Change GSYM_CODE and CONSTANT_CODE accordingly.
3521         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3522         doing a static link don't set sh_link field.
3523         (Output_data_got::Got_entry::write): Use PLT offset if
3524         appropriate.
3525         (Output_data_got::add_global_plt): New function.
3526         (Output_data_got::add_local_plt): New function.
3527         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3528         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3529         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3530         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3531         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3532         IFUNC conditional.
3533         * testsuite/ifunc-sel.h: New file.
3534         * testsuite/ifuncmain1.c: New file.
3535         * testsuite/ifuncmain1vis.c: New file.
3536         * testsuite/ifuncmod1.c: New file.
3537         * testsuite/ifuncdep2.c: New file.
3538         * testsuite/ifuncmain2.c: New file.
3539         * testsuite/ifuncmain3.c: New file.
3540         * testsuite/ifuncmod3.c: New file.
3541         * testsuite/ifuncmain4.c: New file.
3542         * testsuite/ifuncmain5.c: New file.
3543         * testsuite/ifuncmod5.c: New file.
3544         * testsuite/ifuncmain6pie.c: New file.
3545         * testsuite/ifuncmod6.c: New file.
3546         * testsuite/ifuncmain7.c: New file.
3547         * configure, testsuite/Makefile.in: Rebuild.
3548
3549 2010-08-18  Ian Lance Taylor  <iant@google.com>
3550
3551         * incremental.cc
3552         (Output_section_incremental_inputs::write_input_files): Add cast
3553         to avoid signed/unsigned comparison warning.
3554         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3555
3556 2010-08-12  Cary Coutant  <ccoutant@google.com>
3557
3558         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3559
3560 2010-08-13  Ian Lance Taylor  <iant@google.com>
3561
3562         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3563
3564 2010-08-12  Cary Coutant  <ccoutant@google.com>
3565             Doug Kwan  <dougkwan@google.com>
3566
3567         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3568         defintion overrides non-weak undef, remember that the original undef
3569         is not weak.
3570         * symtab.cc (Symbol_table::sized_write_global): For undef without
3571         an original weak binding, set binding to global in output.
3572         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3573         * testsuite/Makefile.in: Regenerate.
3574         * testsuite/strong_ref_weak_def.sh: New file.
3575         * testsuite/strong_ref_weak_def_1.c: Ditto.
3576         * testsuite/strong_ref_weak_def_2.c: Ditto.
3577
3578 2010-08-12  Cary Coutant  <ccoutant@google.com>
3579
3580         * testsuite/incremental_test.sh: Rewrite.
3581         * testsuite/incremental_test_1.c: Rewrite.
3582         * testsuite/incremental_test_2.c: Rewrite.
3583
3584 2010-08-12  Cary Coutant  <ccoutant@google.com>
3585
3586         * arm.cc (Target_arm::got_size): Add const.
3587         (Target_arm::got_entry_count): New function.
3588         (Target_arm::plt_entry_count): New function.
3589         (Target_arm::first_plt_entry_offset): New function.
3590         (Target_arm::plt_entry_size): New function.
3591         (Output_data_plt_arm::entry_count): New function.
3592         (Output_data_plt_arm::first_plt_entry_offset): New function.
3593         (Output_data_plt_arm::get_plt_entry_size): New function.
3594         * i386.cc (Target_i386::got_size): Add const.
3595         (Target_i386::got_entry_count): New function.
3596         (Target_i386::plt_entry_count): New function.
3597         (Target_i386::first_plt_entry_offset): New function.
3598         (Target_i386::plt_entry_size): New function.
3599         (Output_data_plt_i386::entry_count): New function.
3600         (Output_data_plt_i386::first_plt_entry_offset): New function.
3601         (Output_data_plt_i386::get_plt_entry_size): New function.
3602         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3603         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3604         * incremental.cc: Include target.h.
3605         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3606         parameter.  Adjust all callers.  Find incremental_got_plt section.
3607         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3608         section.
3609         (Output_section_incremental_inputs::set_final_data_size): Calculate
3610         size of incremental_got_plt section.
3611         (Output_section_incremental_inputs::do_write): Write the
3612         incremental_got_plt section.
3613         (Got_plt_view_info): New struct.
3614         (Local_got_offset_visitor): New class.
3615         (Global_got_offset_visitor): New class.
3616         (Global_symbol_visitor_got_plt): New class.
3617         (Output_section_incremental_inputs::write_got_plt): New function.
3618         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3619         Add parameter.  Adjust all callers.
3620         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3621         (Incremental_inputs::got_plt_section): New function.
3622         (Incremental_inputs::got_plt_section_): New data member.
3623         (Incremental_got_plt_reader): New class.
3624         * layout.cc (Layout::create_incremental_info_sections): Add the
3625         incremental_got_plt section.
3626         * object.h (Got_offset_list::get_list): New function.
3627         (Got offset_list::for_all_got_offsets): New function.
3628         (Sized_relobj::local_got_offset_list): New function.
3629         * powerpc.cc (Target_powerpc::got_size): Add const.
3630         (Target_powerpc::got_entry_count): New function.
3631         (Target_powerpc::plt_entry_count): New function.
3632         (Target_powerpc::first_plt_entry_offset): New function.
3633         (Target_powerpc::plt_entry_size): New function.
3634         (Output_data_plt_powerpc::entry_count): New function.
3635         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3636         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3637         * sparc.cc (Target_sparc::got_size): Add const.
3638         (Target_sparc::got_entry_count): New function.
3639         (Target_sparc::plt_entry_count): New function.
3640         (Target_sparc::first_plt_entry_offset): New function.
3641         (Target_sparc::plt_entry_size): New function.
3642         (Output_data_plt_sparc::entry_count): New function.
3643         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3644         (Output_data_plt_sparc::get_plt_entry_size): New function.
3645         * symtab.h (Symbol::got_offset_list): New function.
3646         (Symbol_table::for_all_symbols): New function.
3647         * target.h (Sized_target::got_entry_count): New function.
3648         (Sized_target::plt_entry_count): New function.
3649         (Sized_target::plt_entry_size): New function.
3650         * x86_64.cc (Target_x86_64::got_size): Add const.
3651         (Target_x86_64::got_entry_count): New function.
3652         (Target_x86_64::plt_entry_count): New function.
3653         (Target_x86_64::first_plt_entry_offset): New function.
3654         (Target_x86_64::plt_entry_size): New function.
3655         (Output_data_plt_x86_64::entry_count): New function.
3656         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3657         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3658
3659 2010-08-12  Cary Coutant  <ccoutant@google.com>
3660
3661         * archive.cc: Include incremental.h.
3662         (Archive::Archive): Initialize incremental_info_.
3663         (Archive::include_member): Record archive members in incremental info.
3664         (Add_archive_symbols::run): Record begin and end of an archive in
3665         incremental info.
3666         (Lib_group::include_member): Record objects in incremental info.
3667         * archive.h (Incremental_archive_entry): Forward declaration.
3668         (Archive::set_incremental_info): New member function.
3669         (Archive::incremental_info): New member function.
3670         (Archive::Unused_symbol_iterator): New class.
3671         (Archive::unused_symbols_begin): New member function.
3672         (Archive::unused_symbols_end): New member function.
3673         (Archive::incremental_info_): New data member.
3674         * incremental-dump.cc (find_input_containing_global): New function.
3675         (dump_incremental_inputs): Dump new incremental info sections.
3676         * incremental.cc: Include symtab.h.
3677         (Output_section_incremental_inputs): New class.
3678         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3679         new incremental info sections.
3680         (Sized_incremental_binary::do_check_inputs): Likewise.
3681         (Incremental_inputs::report_archive): Remove.
3682         (Incremental_inputs::report_archive_begin): New function.
3683         (Incremental_inputs::report_archive_end): New function.
3684         (Incremental_inputs::report_object): New function.
3685         (Incremental_inputs::finalize_inputs): Remove.
3686         (Incremental_inputs::report_input_section): New function.
3687         (Incremental_inputs::report_script): Rewrite.
3688         (Incremental_inputs::finalize): Do nothing but finalize string table.
3689         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3690         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3691         (Incremental_inputs::create_data_sections): New function.
3692         (Incremental_inputs::relocs_entsize): New function.
3693         (Output_section_incremental_inputs::set_final_data_size): New function.
3694         (Output_section_incremental_inputs::do_write): New function.
3695         (Output_section_incremental_inputs::write_header): New function.
3696         (Output_section_incremental_inputs::write_input_files): New function.
3697         (Output_section_incremental_inputs::write_info_blocks): New function.
3698         (Output_section_incremental_inputs::write_symtab): New function.
3699         * incremental.h (Incremental_script_entry): Forward declaration.
3700         (Incremental_object_entry): Forward declaration.
3701         (Incremental_archive_entry): Forward declaration.
3702         (Incremental_inputs): Forward declaration.
3703         (Incremental_inputs_header_data): Remove.
3704         (Incremental_inputs_header): Remove.
3705         (Incremental_inputs_header_write): Remove.
3706         (Incremental_inputs_entry_data): Remove.
3707         (Incremental_inputs_entry): Remove.
3708         (Incremental_inputs_entry_write): Remove.
3709         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3710         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3711         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3712         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3713         Likewise.
3714         (Incremental_input_entry): New class.
3715         (Incremental_script_entry): New class.
3716         (Incremental_object_entry): New class.
3717         (Incremental_archive_entry): New class.
3718         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3719         (Incremental_inputs::report_inputs): Remove.
3720         (Incremental_inputs::report_archive): Remove.
3721         (Incremental_inputs::report_archive_begin): New function.
3722         (Incremental_inputs::report_archive_end): New function.
3723         (Incremental_inputs::report_object): Change prototype.
3724         (Incremental_inputs::report_input_section): New function.
3725         (Incremental_inputs::report_script): Change prototype.
3726         (Incremental_inputs::get_reloc_count): New function.
3727         (Incremental_inputs::set_reloc_count): New function.
3728         (Incremental_inputs::create_data_sections): New function.
3729         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3730         (Incremental_inputs::inputs_section): New function.
3731         (Incremental_inputs::symtab_section): New function.
3732         (Incremental_inputs::relocs_section): New function.
3733         (Incremental_inputs::get_stringpool): Add const.
3734         (Incremental_inputs::command_line): Add const.
3735         (Incremental_inputs::inputs): Remove.
3736         (Incremental_inputs::command_line_key): New function.
3737         (Incremental_inputs::input_file_count): New function.
3738         (Incremental_inputs::input_files): New function.
3739         (Incremental_inputs::relocs_entsize): New function.
3740         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3741         (Incremental_inputs::finalize_inputs): Remove.
3742         (Incremental_inputs::Input_info): Remove.
3743         (Incremental_inputs::lock_): Remove.
3744         (Incremental_inputs::inputs_): Change type.
3745         (Incremental_inputs::inputs_map_): Remove.
3746         (Incremental_inputs::current_object_entry_): New data member.
3747         (Incremental_inputs::inputs_section_): New data member.
3748         (Incremental_inputs::symtab_section_): New data member.
3749         (Incremental_inputs::relocs_section_): New data member.
3750         (Incremental_inputs::reloc_count_): New data member.
3751         (Incremental_inputs_reader): New class.
3752         (Incremental_symtab_reader): New class.
3753         (Incremental_relocs_reader): New class.
3754         * layout.cc (Layout::finalize): Move finalization of incremental info
3755         and creation of incremental info sections to follow finalization of
3756         symbol table.  Set offsets for postprocessing sections.
3757         (Layout::create_incremental_info_sections): Call
3758         Incremental_inputs::create_data_sections.  Add incremental symtab
3759         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3760         sections to layout after input sections.
3761         * layout.h (struct Timespec): Forward declaration.
3762         (Layout::incremental_inputs): Add const.
3763         (Layout::create_incremental_info_sections): Add parameter.
3764         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3765         * object.cc: Include incremental.h.
3766         (Relobj::finalize_incremental_relocs): New function.
3767         (Sized_relobj::do_layout): Record input sections in incremental info.
3768         * object.h (Object::output_section): New function.
3769         (Object::output_section_offset): Moved from Relobj.
3770         (Object::get_incremental_reloc_base): New function.
3771         (Object::get_incremental_reloc_count): New function.
3772         (Object::do_output_section): New function.
3773         (Object::do_output_section_offset): Moved from Relobj.
3774         (Object::do_get_incremental_reloc_base): New function.
3775         (Object::do_get_incremental_reloc_count): New function.
3776         (Object::Object): Initialize new data members.
3777         (Relobj::output_section): Renamed do_output_section and moved to
3778         protected.
3779         (Relobj::output_section_offset): Moved to Object.
3780         (Relobj::do_get_incremental_reloc_base): New function.
3781         (Relobj::do_get_incremental_reloc_count): New function.
3782         (Relobj::allocate_incremental_reloc_counts): New function.
3783         (Relobj::count_incremental_reloc): New function.
3784         (Relobj::finalize_incremental_relocs): New function.
3785         (Relobj::next_incremental_reloc_index): New function.
3786         (Relobj::reloc_counts_): New data member.
3787         (Relobj::reloc_bases_): New data member.
3788         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3789         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3790         (Sized_relobj::incremental_relocs_scan): New function.
3791         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3792         (Sized_relobj::incremental_relocs_write): New function.
3793         (Sized_relobj::incremental_relocs_write_reltype): New function.
3794         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3795         incremental link.
3796         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3797         archives and object files elsewhere.
3798         (Add_symbols::run): Report object files here.
3799         (Finish_group::run): Report end of archive at end of group.
3800         * reloc.cc: Include layout.h, incremental.h.
3801         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3802         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3803         (Sized_relobj::incremental_relocs_scan): New function.
3804         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3805         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3806         (Sized_relobj::incremental_relocs_write): New function.
3807         (Sized_relobj::incremental_relocs_write_reltype): New function.
3808         * script.cc (read_input_script): Rewrite test for incremental link.
3809         Change call to Incremental_inputs::report_script.
3810         * symtab.h (Symbol_table::first_global_index): New function.
3811         (Symbol_table::output_count): New function.
3812
3813 2010-08-12  Doug Kwan  <dougkwan@google.com>
3814
3815         * arm.cc (Target_arm::merge_object_attributes): Check command line
3816         options --no-wchar-size-warning and --no-enum-size-warning.
3817         * options.h (General_options): Add ld-compatible options
3818         --no-enum-size-warning and --no-wchar-size-warning.
3819
3820 2010-08-04  Ian Lance Taylor  <iant@google.com>
3821
3822         * x86_64.cc (Target_x86_64::Scan::local): Use
3823         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3824         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3825         (Target_x86_64::Scan::global): Likewise.
3826         (Target_x86_64::Relocate::relocate): Likewise.
3827         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3828         Likewise.
3829
3830 2010-08-03  Cary Coutant  <ccoutant@google.com>
3831
3832         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3833         to reserve space in merged_strings vector. Keep total input size
3834         for stats.
3835         (Output_merge_string::do_print_merge_stats): Print total input size.
3836         * merge.h (Output_merge_string): Add input_size_ field.
3837         * stringpool.cc (Stringpool_template::string_length): Move
3838         implementations out of Stringpool_template class and place in
3839         stringpool.h.
3840         * stringpool.h (string_length): Move out of Stringpool_template.
3841
3842 2010-08-03  Ian Lance Taylor  <iant@google.com>
3843
3844         PR 11712
3845         * layout.cc (relaxation_loop_body): If address of load segment is
3846         set, adjust address to include headers if possible.
3847
3848 2010-08-03  Ian Lance Taylor  <iant@google.com>
3849
3850         * version.cc (version_string): Bump to 1.10.
3851
3852 2010-08-03  Ian Lance Taylor  <iant@google.com>
3853
3854         PR 11805
3855         * layout.h (enum Output_section_order): Define.
3856         (class Layout): Update declarations.
3857         * layout.cc (Layout::get_output_section): Add order parameter.
3858         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3859         is_first_non_relro parameters.  Change all callers.
3860         (Layout::choose_output_section): Likewise.
3861         (Layout::add_output_section_data): Likewise.
3862         (Layout::make_output_section): Likewise.  Set order.
3863         (Layout::default_section_order): New function.
3864         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3865         * output.cc (Output_section::Output_section): Initialize order_.
3866         Don't initialize deleted fields.
3867         (Output_segment::Output_segment): Don't initialize deleted
3868         fields.
3869         (Output_segment::add_output_section_to_load): New function
3870         replacing add_output_section.  Change all callers to call this or
3871         add_output_section_to_nonload.
3872         (Output_segment::add_output_section_to_nonload): New function.
3873         (Output_segment::remove_output_section): Rewrite.
3874         (Output_segment::add_initial_output_data): Likewise.
3875         (Output_segment::has_any_data_sections): Likewise.
3876         (Output_segment::is_first_section_relro): Likewise.
3877         (Output_segment::maximum_alignment): Likewise.
3878         (Output_segment::has_dynamic_reloc): New function replacing
3879         dynamic_reloc_count.  Change all callers.
3880         (Output_segment::has_dynamic_reloc_list): New function replacing
3881         dynamic_reloc_count_list.  Change all callers.
3882         (Output_segment::set_section_addresses): Rewrite.
3883         (Output_segment::set_offset): Rewrite.
3884         (Output_segment::find_first_and_last_list): Remove.
3885         (Output_segment::set_tls_offsets): Rewrite.
3886         (Output_segment::first_section_load_address): Likewise.
3887         (Output_segment::output_section_count): Likewise.
3888         (Output_segment::section_with_lowest_load_address): Likewise.
3889         (Output_segment::write_section_headers): Likewise.
3890         (Output_segment::print_sections_to_map): Likewise.
3891         * output.h (class Output_data): Remove dynamic_reloc_count_
3892         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3893         (Output_data::add_dynamic_reloc): Rewrite.
3894         (Output_data::has_dynamic_reloc): New function.
3895         (Output_data::dynamic_reloc_count): Remove.
3896         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3897         is_last_relro_, is_first_non_relro_, is_interp_,
3898         is_dynamic_linker_section_ fields.  Add order and set_order
3899         functions.  Remove is_relro_local, set_is_relro_local,
3900         is_last_relro, set_is_last_relro, is_first_non_relro,
3901         set_is_first_non_relro functions, is_interp, set_is_interp,
3902         is_dynamic_linker_section, and set_is_dynamic_linker_section
3903         functions.
3904         (class Output_segment): Change Output_data_list from std::list to
3905         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3906         output_bss_ fields.  Update declarations.
3907
3908 2010-08-02  Ian Lance Taylor  <iant@google.com>
3909
3910         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3911         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3912         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3913
3914 2010-08-02  Ian Lance Taylor  <iant@google.com>
3915
3916         PR 11855
3917         * script.cc (Script_options::Script_options): Initialize
3918         symbol_definitions_ and symbol_references_.
3919         (Script_options::add_symbol_assignment): Update
3920         symbol_definitions_ and symbol_references_.
3921         (Script_options::add_symbol_reference): New function.
3922         (script_symbol): New function.
3923         * script.h (class Script_options): Add symbol_definitions_ and
3924         symbol_references_ fields.
3925         (Script_options::referenced_const_iterator): New type.
3926         (Script_options::referenced_begin): New function.
3927         (Script_options::referenced_end): New function.
3928         (Script_options::is_referenced): New function.
3929         (Script_options::any_unreferenced): New function.
3930         * script-c.h (script_symbol): Declare.
3931         * yyscript.y (exp): Call script_symbol.
3932         * symtab.cc: Include "script.h".
3933         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3934         Change all callers.  Check symbols referenced by scripts.
3935         (Symbol_table::add_undefined_symbols_from_command_line): Add
3936         layout parameter.  Change all callers.
3937         (Symbol_table::do_add_undefined_symbols_from_command_line):
3938         Likewise.  Break out loop body.  Check symbols referenced by
3939         scripts.
3940         (Symbol_table::add_undefined_symbol_from_command_line): New
3941         function broken out of
3942         do_add_undefined_symbols_from_command_line.
3943         * symtab.h (class Symbol_table): Update declarations.
3944         * archive.cc: Include "layout.h".
3945         (Archive::should_include_member): Add layout parameter.  Change
3946         all callers.  Check for symbol mentioned in expression.
3947         * archive.h (class Archive): Update declaration.
3948         * object.cc (Sized_relobj::do_should_include_member): Add layout
3949         parameter.
3950         * object.h (Object::should_include_member): Add layout parameter.
3951         Change all callers.
3952         (Object::do_should_include_member): Add layout parameter.
3953         (class Sized_relobj): Update declaration.
3954         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3955         parameter.
3956         * dynobj.h (class Sized_dynobj): Update declaration.
3957         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3958         layout parameter.
3959         * plugin.h (class Sized_pluginobj): Update declaration.
3960
3961 2010-08-02  Ian Lance Taylor  <iant@google.com>
3962
3963         PR 11866
3964         * output.cc (Output_segment::set_offset): Search for the first and
3965         last sections rather than assuming that the list is in order.
3966         (Output_segment::find_first_and_last_list): New function.
3967         * output.h (class Output_segment): Update declarations.
3968         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3969         (relro_strip_test_SOURCES): New variable.
3970         (relro_strip_test_DEPENDENCIES): New variable.
3971         (relro_strip_test_LDFLAGS): New variable.
3972         (relro_strip_test_LDADD): New variable.
3973         (relro_strip_test.so): New target.
3974
3975 2010-08-02  Ian Lance Taylor  <iant@google.com>
3976
3977         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3978         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3979         (Target_i386::got_tlsdesc_section): New function.
3980         (Target_i386::got_section): Create space for GOT entries for
3981         TLSDESC relocations.
3982         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3983         R_386_TLS_GOTDESC.
3984         (Target_i386::Scan::global): Likewise.
3985         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3986         using TLSDESC GOT.
3987         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3988         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3989         (Target_x86_64::got_tlsdesc_section): New function.
3990         (Target_x86_64::got_section): Create space for GOT entries for
3991         TLSDESC relocations.
3992         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3993         R_386_TLS_GOTDESC.
3994         (Target_x86_64::Scan::global): Likewise.
3995         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3996         using TLSDESC GOT.
3997
3998 2010-08-02  Ian Lance Taylor  <iant@google.com>
3999
4000         * testsuite/final_layout.sh: Use dc to convert from hex to
4001         decimal.
4002
4003 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4004
4005         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4006         paramter to the call to gold::gc_process_relocs.
4007         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4008         paramter to the call to gold::gc_process_relocs.
4009         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4010         parameter to the call to gold::gc_process_relocs.
4011         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4012         template parameter to the call to gold::gc_process_relocs.
4013         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4014         paramter to the call to gold::gc_process_relocs.
4015         * gc.h (get_embedded_addend_size): New function.
4016         (gc_process_relocs): Save the size of the reloc for use by ICF.
4017         * icf.cc (get_section_contents): Get the addend from the text section
4018         for SHT_REL relocation sections.
4019         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4020         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4021         * int_encoding.h (read_from_pointer): New overloaded function.
4022         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4023         * testsuite/icf_sht_rel_addend_test.sh: New file.
4024         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4025         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4026
4027 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4028
4029         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4030         * Makefile.in: Regenerate.
4031         * testsuite/Makefile.in: Regenerate.
4032
4033 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4034
4035         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4036         * gold/testsuite/debug_msg.cc: Likewise.
4037         * gold/testsuite/odr_violation1.cc
4038         * gold/testsuite/odr_violation2.cc
4039
4040 2010-07-21  Cary Coutant  <ccoutant@google.com>
4041
4042         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4043         string, and length fields.
4044         (Output_merge_string::Merged_strings_list): New type.
4045         (Output_merge_string::Merged_strings_lists): New typedef.
4046         (Output_merge_string): Replace merged_strings_ with
4047         merged_strings_lists_.
4048         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4049         Merged_strings_list per input object and section.  Don't store pointer
4050         to the string.  Don't store length with each merged string entry.
4051         (Output_merge_string::finalize_merged_data): Loop over list of merged
4052         strings lists.  Recompute length of each merged string.
4053
4054 2010-07-15  Cary Coutant  <ccoutant@google.com>
4055
4056         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4057         here.
4058
4059 2010-07-14  Ian Lance Taylor  <iant@google.com>
4060
4061         * descriptors.cc (Descriptors::open): Report correct name in error
4062         message.
4063
4064 2010-07-13  Doug Kwan  <dougkwan@google.com>
4065
4066         * arm.cc (Arm_input_section::Arm_input_section): For a
4067         SHT_ARM_EXIDX section, always keeps the input sections.
4068         (Arm_input_section::set_exidx_section_link): New method.
4069         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4070         has_errors_ to false.
4071         (Arm_exidx_input_section::has_errors,
4072         Arm_exidx_input_section::set_has_errors): New methods.
4073         (Arm_exidx_input_section::has_errors_): New data member.
4074         (Arm_relobj::get_exidx_shndx_list): New method.
4075         (Arm_output_section::append_text_sections_to_list): Do not skip
4076         section without SHF_EXECINSTR.
4077         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4078         errors.
4079         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4080         section header.  Make error messages more verbose.  Check for
4081         a non-executable section linked to an EXIDX section.
4082         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4083         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4084         check that there is no deferred EXIDX section if we exit early.
4085         Instead of not making an EXIDX section in case of an error, make one
4086         and set the has_errors flag of it.
4087         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4088         in a relocatable link.
4089         (Target_arm::do_relax): Look for the EXIDX output section instead of
4090         assuming that it is called .ARM.exidx.
4091         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4092         section list.  Do not check for SHF_EXECINSTR section flags but
4093         skip any input section with errors.
4094         * output.cc (Output_section::Output_section): Initialize
4095         always_keeps_input_sections_ to false.
4096         (Output_section::add_input_section): Check for
4097         always_keeps_input_sections_.
4098         *  output.h (Output_section::always_keeps_input_sections,
4099         Output_section::set_always_keeps_input_sections): New methods.
4100         (Output_section::always_keeps_input_sections): New data member.
4101
4102 2010-07-13  Rafael Espindola  <espindola@google.com>
4103
4104         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4105         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4106
4107 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4108             Ian Lance Taylor  <iant@google.com>
4109
4110         * output.h (Output_section_lookup_maps::add_merge_section):
4111         Correct check of whether value was inserted.
4112         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4113         (Output_section_lookup_maps::add_relaxed_input_section):
4114         Likewise.
4115         * arm.cc (Target_arm::got_section): Remove used local os.
4116         * i386.cc (Target_i386::got_section): Likewise.
4117         * x86_64.cc (Target_x86_64::got_section): Likewise.
4118         * sparc.cc (Target_sparc::got_section): Likewise.
4119         (Target_sparc::relocate): Remove unused local have_got_offset.
4120         * powerpc.cc (Target_powerpc::relocate): Likewise.
4121
4122 2010-07-13  Ian Lance Taylor  <iant@google.com>
4123
4124         * compressed_output.cc (zlib_decompress): Fix signature in
4125         !HAVE_ZLIB_H case.
4126
4127         * archive.cc (Archive::include_member): Unlock an external member
4128         of a thin archive.  Don't bother to delete an object we know is
4129         NULL.
4130
4131 2010-07-12  Cary Coutant  <ccoutant@google.com>
4132
4133         * compressed_output.cc (zlib_decompress): New function.
4134         (get_uncompressed_size): New function.
4135         (decompress_input_section): New function.
4136         * compressed_output.h (get_uncompressed_size): New function.
4137         (decompress_input_section): New function.
4138         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4139         Handle compressed debug sections.
4140         * layout.cc (is_compressed_debug_section): New function.
4141         (Layout::output_section_name): Map compressed section names to
4142         canonical names.
4143         * layout.h (is_compressed_debug_section): New function.
4144         (is_debug_info_section): Recognize compressed debug sections.
4145         * merge.cc: Include compressed_output.h.
4146         (Output_merge_data::do_add_input_section): Handle compressed
4147         debug sections.
4148         (Output_merge_string::do_add_input_section): Handle compressed
4149         debug sections.
4150         * object.cc: Include compressed_output.h.
4151         (Sized_relobj::Sized_relobj): Initialize new data members.
4152         (build_compressed_section_map): New function.
4153         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4154         * object.h (Object::section_is_compressed): New method.
4155         (Object::do_section_is_compressed): New method.
4156         (Sized_relobj::Compressed_section_map): New type.
4157         (Sized_relobj::do_section_is_compressed): New method.
4158         (Sized_relobj::compressed_sections_): New data member.
4159         * output.cc (Output_section::add_input_section): Handle compressed
4160         debug sections.
4161         * reloc.cc: Include compressed_output.h.
4162         (Sized_relobj::write_sections): Handle compressed debug sections.
4163
4164 2010-07-08  Cary Coutant  <ccoutant@google.com>
4165
4166         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4167         weak when resolving to a dynamic def.
4168         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4169         for weak undef/dynamic def cases. Adjust callers.
4170         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4171         undef_binding_weak_.
4172         (Symbol_table::sized_write_globals): Adjust symbol binding.
4173         (Symbol_table::sized_write_symbol): Add binding parameter.
4174         * symtab.h (Symbol::set_undef_binding): New method.
4175         (Symbol::is_undef_binding_weak): New method.
4176         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4177         (Symbol_table::should_override): Add new parameter.
4178         (Symbol_table::sized_write_symbol): Add new parameter.
4179
4180         * testsuite/weak_undef_file1.cc: Add new test case.
4181         * testsuite/weak_undef_file2.cc: Fix header comment.
4182         * testsuite/weak_undef_test.cc: Add new test case.
4183
4184 2010-06-29  Doug Kwan  <dougkwan@google.com>
4185
4186         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4187         Initialize USE_SYMBOL_.
4188         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4189         definition.
4190         (Arm_reloc_property::uses_symbol_): New data member declaration.
4191         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4192         uses symbol value and symbol is undefined but not weakly undefined.
4193
4194 2010-06-28  Rafael Espindola  <espindola@google.com>
4195
4196         * plugin.cc (Plugin::load): Use dlerror.
4197
4198 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4199
4200         * symtab.cc (detect_odr_violations): When reporting an ODR
4201         violation, report an object where the symbol is defined.
4202
4203 2010-06-25  Doug Kwan  <dougkwan@google.com>
4204
4205         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4206         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4207         definition.
4208         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4209         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4210         target hook to detect function points.
4211         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4212         * icf.h (Icf::check_section_for_function_pointers): Change type of
4213         parameter SECTION_NAME to const reference to std::string.  Use
4214         target hook to determine if section may have unsafe pointers.
4215         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4216         method definition.
4217
4218 2010-06-21  Rafael Espindola  <espindola@google.com>
4219
4220         * fileread.cc (Input_file::find_fie): New
4221         (Input_file::open): Use Input_file::find_fie.
4222         * fileread.h (Input_file::find_fie): New
4223         * plugin.cc (set_extra_library_path): New.
4224         (Plugin::load): Add set_extra_library_path to the transfer vector.
4225         (Plugin_manager::set_extra_library_path): New.
4226         (Plugin_manager::add_input_file): Use the extra search path if set.
4227         (set_extra_library_path(): New.
4228         * plugin.h (Plugin_manager): Add set_extra_library_path and
4229         extra_search_path_.
4230
4231 2010-06-19  Cary Coutant  <ccoutant@google.com>
4232
4233         * layout.cc (gdb_sections): Add .debug_types.
4234         (lines_only_debug_sections): Likewise.
4235
4236 2010-06-18  Rafael Espindola  <espindola@google.com>
4237
4238         * plugin.cc (add_input_file,add_input_library)
4239         (Plugin_manager::add_input_file): Make filename arguments const.
4240         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4241         const.
4242
4243 2010-06-16  Doug Kwan  <dougkwan@google.com>
4244
4245         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4246         .ARM.attributes section if we have not merged any input
4247         attributes sections.
4248
4249 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4250
4251         * arm.cc: Allow combining objects with no EABI version
4252         information.
4253
4254 2010-06-15  Rafael Espindola  <espindola@google.com>
4255
4256         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4257
4258 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4259
4260         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4261         (struct iovec): Correct !HAVE_READV definition.
4262
4263 2010-06-10  Cary Coutant  <ccoutant@google.com>
4264
4265         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4266         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4267         reloc sections.
4268         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4269
4270         PR 11683
4271         * symtab.h (Symbol::is_placeholder): New member function.
4272         * target-reloc.h (relocate_section): Check for placeholder symbols.
4273
4274         * testsuite/Makefile.am (plugin_test_8): New test.
4275         (plugin_test_9): New test.
4276         * testsuite/Makefile.in: Regenerate.
4277
4278 2010-06-09  Nick Clifton  <nickc@redhat.com>
4279
4280         * yyscript.y (input_list_element): Allow strings prefixed with
4281         the '-' character.  Treat these as libraries.
4282         * script.cc (script_add_library): New function.  Adds a library
4283         specified by "-l<name>" found in an input script.
4284         * script-c.h: Add prototype for script_add_library.
4285
4286 2010-06-07  Doug Kwan  <dougkwan@google.com>
4287
4288         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4289         Restrict stub-group size to be within long conditional branch
4290         range when working around cortex-A8 erratum.
4291
4292 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4293
4294         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4295         #ifdef typo.
4296
4297 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4298
4299         PR gold/11658
4300         * output.cc
4301         (Output_section::Input_section_sort_entry::compare_section_ordering):
4302         Change to return non-zero correctly.
4303         (Output_section::Input_section_sort_section_order_index_compare
4304         ::operator()): Change to fix ambiguity in comparisons.
4305
4306 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4307
4308         * gold.h (is_wildcard_string): New function.
4309         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4310         (Layout::layout_eh_frame): Ditto.
4311         (Layout::find_section_order_index): New method.
4312         (Layout::read_layout_from_file): New method.
4313         * layout.h (Layout::find_section_order_index): New method.
4314         (Layout::read_layout_from_file): New method.
4315         (Layout::input_section_position_): New private member.
4316         (Layout::input_section_glob_): New private member.
4317         * main.cc (main): Call read_layout_from_file here.
4318         * options.h (--section-ordering-file): New option.
4319         * output.cc (Output_section::input_section_order_specified_): New
4320         member.
4321         (Output_section::Output_section): Initialize new member.
4322         (Output_section::add_input_section): Add new parameter.
4323         Keep input sections when --section-ordering-file is used.
4324         (Output_section::set_final_data_size): Sort input sections when
4325         section ordering file is specified.
4326         (Output_section::Input_section_sort_entry): Add new parameter.
4327         Check sorting type.
4328         (Output_section::Input_section_sort_entry::compare_section_ordering):
4329         New method.
4330         (Output_section::Input_section_sort_compare::operator()): Change to
4331         consider section_order_index.
4332         (Output_section::Input_section_sort_init_fini_compare::operator()):
4333         Change to consider section_order_index.
4334         (Output_section::Input_section_sort_section_order_index_compare
4335         ::operator()): New method.
4336         (Output_section::sort_attached_input_sections): Change to sort
4337         according to section order when specified.
4338         (Output_section::add_input_section<32, true>): Add new parameter.
4339         (Output_section::add_input_section<64, true>): Add new parameter.
4340         (Output_section::add_input_section<32, false>): Add new parameter.
4341         (Output_section::add_input_section<64, false>): Add new parameter.
4342         * output.h (Output_section::add_input_section): Add new parameter.
4343         (Output_section::input_section_order_specified): New
4344         method.
4345         (Output_section::set_input_section_order_specified): New method.
4346         (Input_section::Input_section): Initialize section_order_index_.
4347         (Input_section::section_order_index): New method.
4348         (Input_section::set_section_order_index): New method.
4349         (Input_section::section_order_index_): New member.
4350         (Input_section::Input_section_sort_section_order_index_compare): New
4351         struct.
4352         (Output_section::input_section_order_specified_): New member.
4353         * script-sections.cc (is_wildcard_string): Delete and move modified
4354         method to gold.h.
4355         (Output_section_element_input::Output_section_element_input): Modify
4356         call to is_wildcard_string.
4357         (Output_section_element_input::Input_section_pattern
4358         ::Input_section_pattern): Ditto.
4359         (Output_section_element_input::Output_section_element_input): Ditto.
4360         * testsuite/Makefile.am (final_layout): New test case.
4361         * testsuite/Makefile.in: Regenerate.
4362         * testsuite/final_layout.cc: New file.
4363         * testsuite/final_layout.sh: New file.
4364
4365 2010-06-01  Rafael Espindola  <espindola@google.com>
4366
4367         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4368
4369 2010-06-01  Rafael Espindola  <espindola@google.com>
4370
4371         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4372         visibility of symbols.
4373
4374 2010-05-27  Doug Kwan  <dougkwan@google.com>
4375
4376         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4377         from start of output section instead of address for a local symbol
4378         in a merged or relaxed section when doing a relocatable link.
4379
4380 2010-05-26  Rafael Espindola  <espindola@google.com>
4381
4382        PR 11604
4383         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4384         adding sections the garbage collector removed.
4385         * gold/testsuite/Makefile.am: Add test.
4386         * gold/testsuite/Makefile.in: Regenerate.
4387         * gold/testsuite/plugin_test_7.sh: New.
4388         * gold/testsuite/plugin_test_7_1.c: New.
4389         * gold/testsuite/plugin_test_7_2.c: New.
4390
4391 2010-05-26  Rafael Espindola  <espindola@google.com>
4392
4393         * script-sections.cc (Output_section_definition::set_section_addresses):
4394         Check for --section-start.
4395
4396 2010-05-26  Doug Kwan  <dougkwan@google.com>
4397
4398         * arm.cc (Arm_scan_relocatable_relocs): New class.
4399         (Target_arm::relocate_special_relocatable): New method.
4400         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4401         (Arm_relocate_functions::thumb_branch_common): Same.
4402         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4403         instead of Default_scan_relocatable_relocs.
4404         * target-reloc.h (relocate_for_relocatable): Let target handle
4405         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4406         * target.h (Sized_target::relocate_special_relocatable): New method.
4407
4408 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4409
4410         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4411
4412 2010-05-23  Doug Kwan  <dougkwan@google.com>
4413
4414         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4415         instead of a cast.
4416         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4417         with a direct branch, not a conditional branch, to a stub.
4418         * merge.cc (Output_merge_base::record_input_section): New method
4419         defintion.
4420         (Output_merge_data::do_add_input_section): Record input section if
4421         keeps-input-sections flag is set.
4422         (Output_merge_string::do_add_input_section): Ditto.
4423         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4424         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4425         INPUT_SECTIONS_.
4426         (Output_merge_base::keeps_input_sections,
4427         Output_merge_base::set_keeps_input_sections,
4428         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4429         method definitions.
4430         (Output_merge_base::Input_sections): New type declaration.
4431         (Output_merge_base::input_sections_begin,
4432         Output_merge_base::input_sections_end,
4433         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4434         (Output_merge_base::bool keeps_input_sections_,
4435         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4436         Output_merge_base::input_sections_): New data members.
4437         (Output_merge_data::do_set_keeps_input_sections): New method
4438         defintion.
4439         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4440         * output.cc (Output_section::Input_section::relobj): Move method
4441         defintion from class declaration to here and handle merge sections.
4442         (Output_section::Input_section::shndx): Ditto.
4443         (Output_section::Output_section): Remove initializations of removed
4444         data members and initialize new data member LOOKUP_MAPS_.
4445         (Output_section::add_input_section): Set keeps-input-sections flag
4446         for a newly created merge output section as appropriate.  Adjust code
4447         to use Output_section_lookup_maps class.
4448         (Output_section::add_relaxed_input_section): Adjst code for lookup
4449         maps code refactoring.
4450         (Output_section::add_merge_input_section): Add a new parameter
4451         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4452         class.  If adding input section to a newly created merge output
4453         section fails, remove the new merge section.
4454         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4455         Adjust code for use of the Output_section_lookup_maps class.
4456         (Output_section::find_merge_section): Ditto.
4457         (Output_section::build_lookup_maps): New method defintion.
4458         (Output_section::find_relaxed_input_section): Adjust code to use
4459         Output_section_lookup_maps class.
4460         (Output_section::get_input_sections): Export merge sections.  Adjust
4461         code to use Output_section_lookup_maps class.
4462         (Output_section:::add_script_input_section): Adjust code to use
4463         Output_section_lookup_maps class.  Update lookup maps for merge
4464         sections also.
4465         (Output_section::discard_states): Use Output_section_lookup_maps.
4466         (Output_section::restore_states): Same.
4467         * output.h (Merge_section_properties): Move class defintion out of
4468         Output_section.
4469         (Output_section_lookup_maps): New class.
4470         (Output_section::Input_section::is_merge_section): New method
4471         defintion.
4472         (Output_section::Input_section::relobj): Move defintion out of class
4473         defintion.  Declare method only.
4474         (Output_section::Input_section::shndx): Ditto.
4475         (Output_section::Input_section::output_merge_base): New method defintion.
4476         (Output_section::Input_section::u2_.pomb): New union field.
4477         (Output_section::Merge_section_by_properties_map,
4478         Output_section::Output_section_data_by_input_section_map,
4479         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4480         Remove types.
4481         (Output_section::add_merge_input_section): Add new parameter
4482         KEEPS_INPUT_SECTIONS.
4483         (Output_section::build_lookup_maps): New method declaration.
4484         (Output_section::merge_section_map_,
4485         Output_section::merge_section_by_properties_map_,
4486         Output_section::relaxed_input_section_map_,
4487         Output_section::is_relaxed_input_section_map_valid_): Remove data
4488         members.
4489         (Output_section::lookup_maps_): New data member.
4490
4491 2010-05-21  Doug Kwan  <dougkwan@google.com>
4492
4493         PR gold/11619
4494         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4495         avoid a compilation error.
4496
4497 2010-05-19  Rafael Espindola  <espindola@google.com>
4498
4499         * script-sections.cc (Output_section_definition::allocate_to_segment):
4500         Update the phdrs_list even when the output section is NULL.
4501         * testsuite/Makefile.am: Add test.
4502         * testsuite/Makefile.in: Regenerate.
4503         * testsuite/script_test_9.cc: New.
4504         * testsuite/script_test_9.sh: New.
4505         * testsuite/script_test_9.t: New.
4506
4507 2010-05-19  Doug Kwan  <dougkwan@google.com>
4508
4509         * arm.cc (Arm_input_section::original_size): New method.
4510         (Arm_input_section::do_addralign): Add a cast.
4511         (Arm_input_section::do_output_offset): Remove static cast.
4512         (Arm_input_section::original_addralign,
4513          Arm_input_section::original_size_): Change type to uint32_t.
4514         (Arm_input_section::init): Add safe casts for section alignment
4515         and size.
4516         (Arm_input_section::set_final_data_size): Do not set address and
4517         offset of stub table.
4518         (Arm_output_section::fix_exidx_coverage): Change use of of
4519         Output_section::Simple_input_section to that of
4520         Output_section::Input_section.
4521         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4522         except for the first pass.
4523         * output.cc (Output_section::get_input_sections): Change type of
4524         input_sections to std::list<Input_section>.
4525         (Output_section::add_script_input_section): Rename from
4526         Output_section::add_simple_input_section.  Change type of SIS
4527         parameter from Simple_input_section to Input_section.
4528         * output.h (Output_section::Simple_input_section): Remove class.
4529         (Output_section::Input_section): Change class visibility to public.
4530         (Output_section::Input_section::addralign): Use stored alignments
4531         for special input sections if set.
4532         (Output_section::Input_section::set_addralign): New method.
4533         (Output_section::get_input_sections): Change parameter type from
4534         list of Simple_input_section to list of Input_section.
4535         (Output_section::add_script_input_section): Rename from
4536         Output_section::add_simple_input_section. Change first parameter's
4537         type from Simple_input_section to Input_section and remove the
4538         second and third parameters.
4539         * script-sections.cc (Input_section::Input_section_list): Change
4540         type to list of Output_section::Input_section/
4541         (Input_section_info::Input_section_info): Change parameter type of
4542         INPUT_SECTION to Output_section::Input_section.
4543         (Input_section_info::input_section): Change return type.
4544         (Input_section_info::input_section_): Change type to
4545         Output_section::Input_section.
4546         (Output_section_element_input::set_section_addresses): Adjust code
4547         to use Output_section::Input_section instead of
4548         Output_section::Simple_input_section.  Adjust code for renaming
4549         of Output_section::add_simple_input_section.
4550         (Orphan_output_section::set_section_addresses): Ditto.
4551
4552 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4553
4554         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4555         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4556
4557 2010-05-18  Rafael Espindola  <espindola@google.com>
4558
4559         * options.cc (General_options::finalize): Handle -nostdlib.
4560         * options.h (nostdlib): New option.
4561         * script.cc (script_add_search_dir): Handle -nostdlib.
4562
4563 2010-05-12  Doug Kwan  <dougkwan@google.com>
4564
4565         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4566         attributes section only if there no attributes section after merging.
4567         (Target_arm::merge_object_attributes): Move value of
4568         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4569         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4570         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4571         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4572         and arm_attr_merge_7.stdout.
4573         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4574         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4575         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4576         arm_attr_merge_7b.o): New rules.
4577         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4578         arm_attr_merge_7
4579         * testsuite/Makefile.in: Regenerate.
4580         * testsuite/arm_attr_merge.sh: New file.
4581         * testsuite/arm_attr_merge_[67][ab].s: Same.
4582
4583 2010-05-05  Nick Clifton  <nickc@redhat.com>
4584
4585         * po/es.po: Updated Spanish translation.
4586
4587 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4588
4589         * Makefile.am (install-exec-local): Properly install gold as
4590         default cross linker.
4591         * Makefile.in: Regenerated.
4592
4593 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4594             Nick Clifton  <nickc@redhat.com>
4595
4596         * configure.ac (install_as_default): Define and set to false
4597         unless --enable-gold or --enable-gold=both/gold has been
4598         specified.
4599         * configure: Regenerate.
4600
4601         * Makefile.am (install-exec-local): Install the executable as
4602         'ld.gold'.  If install_as_default is true then also install it as
4603         'ld'.
4604         * Makefile.in: Regenerated.
4605
4606 2010-04-24  Ian Lance Taylor  <iant@google.com>
4607
4608         * layout.cc (Layout::layout_reloc): In relocatable link don't
4609         combine reloc sections for grouped sections.
4610
4611 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4612
4613         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4614         sections that are not ordinary to icf.
4615         * icf.cc (get_section_contents): Handle relocation pointing to section
4616         with no object or shndx information.
4617         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4618         * testsuite/Makefile.in: Regenerate.
4619         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4620         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4621
4622 2010-04-22  Ian Lance Taylor  <iant@google.com>
4623
4624         * expression.cc (Expression::Expression_eval_info): Add
4625         result_alignment_pointer field.
4626         (Expression::eval_with_dot): Add result_alignment_pointer
4627         parameter.  Change all callers.
4628         (Expression::eval_maybe_dot): Likewise.
4629         (class Binary_expression): Add alignment_pointer parameter to
4630         left_value and right_value.  Change all callers.
4631         (BINARY_EXPRESSION): Set result alignment.
4632         (class Trinary_expression): Add alignment_pointer parameter to
4633         arg2_value and arg3_value.  Change all callers.
4634         (Trinary_cond::value): Set result alignment.
4635         (Max_expression::value, Min_expression::value): Likewise.
4636         (Align_expression::value): Likewise.
4637         * script-sections.cc (class Sections_element): Add dot_alignment
4638         parameter to set_section_addresses virtual function.  Update
4639         instantiations.
4640         (class Output_section_element): Likewise.
4641         (Script_sections::create_segments): Add dot_alignment parameter.
4642         Change all callers.
4643         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4644         (Script_sections::set_phdrs_clause_addresses): Likewise.
4645         * script-sections.h: Update declarations.
4646         * script.h: Update declarations.
4647         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4648         min_p_align.
4649         * testsuite/script_test_3.t: Set large alignment.
4650         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4651         segment has expected alignment.
4652
4653 2010-04-22  Nick Clifton  <nickc@redhat.com>
4654
4655         * po/gold.pot: Updated by the Translation project.
4656         * po/vi.po: Updated Vietnamese translation.
4657
4658 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4659
4660         * testsuite/Makefile.am (check_PROGRAMS): Add
4661         icf_virtual_function_folding_test.
4662         * testsuite/Makefile.in: Regenerated.
4663
4664 2010-04-15  Andrew Haley  <aph@redhat.com>
4665
4666         * options.h (merge_exidx_entries): New option.
4667         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4668         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4669         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4670         (Target_arm::merge_exidx_entries): New function.
4671         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4672         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4673         to Arm_exidx_fixup constructor.
4674         Add new arg, merge_exidx_entries.
4675         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4676         Arm_output_section::fix_exidx_coverage.
4677
4678 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4679
4680         * icf.cc (get_section_contents): Check for preemptible functions.
4681         Ignore addend when appropriate.
4682         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4683         section folded.
4684         (add_from_relobj): Check for section folded.
4685         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4686         * symtab.h (should_add_dynsym_entry): Add new parameter.
4687         * target-reloc.h (scan_relocs): Check for section folded.
4688         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4689         Check reloc types for function pointers in shared objects.
4690         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4691         case.
4692         (icf_preemptible_functions_test): New test case.
4693         (icf_string_merge_test): New test case.
4694         * testsuite.Makefile.in: Regenerate.
4695         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4696         bar_glob.  Refactor code.
4697         * testsuite/icf_preemptible_functions_test.cc: New file.
4698         * testsuite/icf_preemptible_functions_test.sh: New file.
4699         * testsuite/icf_string_merge_test.cc: New file.
4700         * testsuite/icf_string_merge_test.sh: New file.
4701         * testsuite/icf_virtual_function_folding_test.cc: New file.
4702         * testsuite/icf_virtual_function_folding_test.sh: New file.
4703
4704 2010-04-14  Doug Kwan  <dougkwan@google.com>
4705
4706         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4707         for local symbol recounting if we remove a section due to ICF.
4708         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4709         there are no regular objects in input.
4710
4711 2010-04-13  Doug Kwan  <dougkwan@google.com>
4712
4713         * arm.cc (Arm_input_section::set_final_data_size): Compute
4714         accurate final data size instead of using current data size.
4715
4716 2010-04-09  Doug Kwan  <dougkwan@google.com>
4717
4718         * layout.cc (Layout::choose_output_section): Handle script section
4719         types.
4720         (Layout::make_output_section_for_script): Add section type parameter.
4721         Handle script section types.
4722         * layout.h (Layout::make_output_section_for_script): Add section
4723         type parameter.
4724         * output.cc (Output_section::Output_section): Initialize data member
4725         is_noload_.
4726         (Output_section::do_reset_address_and_file_offset): Do not set address
4727         to 0 if section is a NOLOAD section.
4728         * output.h (Output_section::is_noload): New method.
4729         (Output_section::set_is_noload): Ditto.
4730         (Output_section::is_noload_): New data member.
4731         * script-c.h (Script_section_type): New enum type.
4732         (struct Parser_output_section_header): Add new file section_type.
4733         * script-sections.cc (Sections_element::output_section_name): Add
4734         parameter for returning script section type.
4735         (Output_section_definition::output_section_name): Ditto.
4736         (Output_section_definition::section_type)P; New method.
4737         (Output_section_definiton::script_section_type_name): Ditto.
4738         (Output_section_definition::script_section_type_): New data member.
4739         (Output_section_definition::Output_section_definition): Initialize
4740         data member Output_section_definition::script_section_type_.
4741         (Output_section_definition::create_sections): Pass script section type
4742         to Layout::make_output_section_for_script.
4743         (Output_section_definition::output_section_name): Return script
4744         section type to caller.
4745         (Output_section_definition::set_section_address): Do not advance
4746         dot value and load address if section type is NOLOAD.  Set address
4747         of NOLOAD sections regardless of section flags.
4748         (Output_section_definition::print): Print section type if it is
4749         not SCRIPT_SECTION_TYPE_NONE.
4750         (Output_section_definition::section_type): New method.
4751         (Output_section_definition::script_section_type_name): Ditto.
4752         (Script_sections::output_section_name): Add new parameter
4753         PSECTION_TYPE for returning script section type.  Pass it to
4754         section elements.  Handle discard sections.
4755         (Sort_output_sections::operator()): Handle NOLOAD sections.
4756         * script-sections.h (Script_sections::Section_type): New enum type.
4757         (Script_sections::output_section_name): Add a new parameter for
4758         returning script section type.
4759         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4760         INFO and NOLOAD.
4761         * yyscript.y (union): Add new field SECTION_TYPE.
4762         (COPY, DSECT, INFO, NOLOAD): New tokens.
4763         (opt_address_and_section_type): Change type to output_section_header.
4764         (section_type): New non-terminal
4765         (section_header): Handle section type.
4766         (opt_address_and_section_type): Return section type value.
4767
4768 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4769
4770         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4771         * testsuite/plugin_common_test_2.c (foo): Likewise.
4772
4773 2010-04-08  Doug Kwan  <dougkwan@google.com>
4774
4775         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4776         Output_merge_data.
4777         * output.cc (Output_section::add_merge_input_section): Simplify
4778         code and return status of Output_merge_base::add_input_section.
4779         Update merge section map only if Output_merge_base::add_input_section
4780         returns true.
4781
4782 2010-04-07  Doug Kwan  <dougkwan@google.com>
4783
4784         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4785         if section is marked as containing instructions but has no mapping
4786         symbols.
4787         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4788         correct section index.
4789         (Arm_relobj::find_linked_text_section): Ditto.
4790
4791 2010-04-07  Cary Coutant  <ccoutant@google.com>
4792
4793         * archive.cc (include_member): Destroy Read_symbols_data object before
4794         releasing file.
4795         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4796         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4797         (Read_symbols_data::~Read_symbols_data) New destructor.
4798         (Section_relocs::Section_relocs) New constructor.
4799         (Section_relocs::~Section_relocs) New destructor.
4800         (Read_relocs_data::Read_relocs_data) New constructor.
4801         (Read_relocs_data::~Read_relocs_data) New destructor.
4802         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4803         pointers to NULL after deleting.
4804
4805 2010-04-07  Doug Kwan  <dougkwan@google.com>
4806
4807         * arm.cc: Replace "endianity" with "endianness" in comments.
4808         (Arm_exidx_cantunwind): Ditto.
4809         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4810         (Arm_relobj::merge_flags_and_attributes): New method.
4811         (Arm_relobj::merge_flags_and_attributes_): New data member.
4812         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4813         (Arm_relobj::scan_sections_for_stubs): Ditto.
4814         (Arm_relobj::do_read_symbols): Check to see if we really want to
4815         merge processor-specific flags and attributes.  Exit early if
4816         an object is empty except for section names and the undefined symbol.
4817         (Target_arm::do_finalize_sections): Move check for ELF format to
4818         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4819         attributes from a regular object only when we have determined that
4820         it is aapropriate.  Do not create an .ARM.attributes section in
4821         output if there is no regular input object.
4822         (Target_arm::merge_processor_specific_flags): Check
4823         --warn-mismatch before printing any error.
4824         (Target_arm::merge_object_attributes): Ditto.
4825         * gold.cc (queue_middle_tasks): Handle the case in which there is
4826         no regular object in input.
4827         * options.cc (General_options::parse_EB): New method.
4828         (General_options::parse_EL): Same.
4829         (General_options::General_options): Initialize endianness_.
4830         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4831         New options.
4832         (General_options::Endianness): New enum.
4833         (General_options::endianness): New method.
4834         (General_options::endianness_): New data member.
4835         * parameters.cc (Parameters::set_options): Check target endianness.
4836         (Parameters::set_target_once): Ditto.
4837         (Parameters::check_target_endianness): New method.
4838         (parameters_force_valid_target): If either -EL or -EB is specified,
4839         use it to define endianness of default target.
4840         * parameters.h (Parameters::check_target_endianness): New method
4841         declaration.
4842         * target.h (class Target): Change "endianity" to "endianness"
4843         in comments.
4844
4845 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4846
4847         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4848         * configure: Regenerate.
4849         * Makefile.in: Regenerate.
4850         * testsuite/Makefile.in: Regenerate.
4851
4852 2010-04-06  Cary Coutant  <ccoutant@google.com>
4853
4854         gcc PR lto/42757
4855         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4856         prevailing definitions of common symbols.
4857         * testsuite/plugin_test_6.sh: New test case.
4858         * testsuite/plugin_common_test_1.c: New test case.
4859         * testsuite/plugin_common_test_2.c: New test case.
4860         * testsuite/Makefile.am (plugin_test_6): New test case.
4861         * testsuite/Makefile.in: Regenerate.
4862
4863 2010-04-06  Nick Clifton  <nickc@redhat.com>
4864
4865         * po/vi.po: New Vietnamese translation.
4866
4867 2010-03-30  Doug Kwan  <dougkwan@google.com>
4868
4869         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4870
4871 2010-03-25  Doug Kwan  <dougkwan@google.com>
4872
4873         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4874         to avoid a conversion warning on a 32-bit host.
4875
4876 2010-03-24  Ian Lance Taylor  <iant@google.com>
4877
4878         * testsuite/script_test_3.t: Add a TLS segment.
4879         * testsuite/Makefile.am (check_PROGRAMS): Add
4880         tls_phdrs_script_test.
4881         (tls_phdrs_script_test_SOURCES): Define.
4882         (tls_phdrs_script_test_DEPENDENCIES): Define.
4883         (tls_phdrs_script_test_LDFLAGS): Define.
4884         (tls_phdrs_script_test_LDADD): Define.
4885         * testsuite/Makefile.in: Rebuild.
4886
4887 2010-03-23  Cary Coutant  <ccoutant@google.com>
4888
4889         * fileread.cc (find_or_make_view): Fix comment.
4890
4891 2010-03-23  Ian Lance Taylor  <iant@google.com>
4892
4893         * script-sections.cc (class Orphan_section_placement): Define
4894         PLACE_TLS and PLACE_TLS_BSS.
4895         (Orphan_section_placement::Orphan_section_placement): Initialize
4896         new places.
4897         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4898         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4899         (tls_script_test_SOURCES): Define.
4900         (tls_script_test_DEPENDENCIES): Define.
4901         (tls_script_test_LDFLAGS): Define.
4902         (tls_script_test_LDADD): Define.
4903         * testsuite/Makefile.in: Rebuild.
4904
4905 2010-03-22  Doug Kwan  <dougkwan@google.com>
4906
4907         * arm.cc (Arm_relocate_functions::abs8,
4908         Arm_relocate_functions::abs16): Use correct check for overflow
4909         specified in the ARM ELF specs.
4910         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4911         target of a BLX instruction specially.
4912         (Reloc_stub::stub_type_for_reloc): Ditto.
4913         (Relocate::relocate): Use symbolic names instead of numeric relocation
4914         codes to report error.
4915         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4916         workaround.
4917         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4918         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4919         thumb2_blx_out_of_range.stdout
4920         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4921         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4922         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4923         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4924         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4925         thumb2_blx_in_range, thumb2_blx_in_range.o,
4926         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4927         thumb2_blx_out_of_range.o): New rules.
4928         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4929         thumb2_blx_in_range and thumb2_blx_out_of_range.
4930         * testsuite/Makefile.in: Regenerate.
4931         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4932         * testsuite/thumb_blx_in_range.s: New file.
4933         * testsuite/thumb_blx_out_of_range.s: New file.
4934
4935 2010-03-22  Rafael Espindola  <espindola@google.com>
4936
4937         * archive.cc (Should_include): Move to archive.h.
4938         (should_include_member): Make it a member of Archive.
4939         (Lib_group): New.
4940         (Add_lib_group_symbols): New.
4941         * archive.h: Include options.h.
4942         (Archive_member): Moved from Archive.
4943         (Should_include): Moved from archive.cc.
4944         (Lib_group): New.
4945         (Add_lib_group_symbols): New.
4946         * dynobj.cc (do_should_include_member): New.
4947         * dynobj.h (do_should_include_member): New.
4948         * gold.cc (queue_initial_tasks): Update call to queue.
4949         * main.cc (main): Print lib group stats.
4950         * object.cc (do_should_include_member): New.
4951         * object.h: Include archive.h.
4952         (Object::should_include_member): New.
4953         (Object::do_should_include_member): New.
4954         (Sized_relobj::do_should_include_member): New.
4955         * options.cc (General_options::parse_start_lib): New.
4956         (General_options::parse_end_lib): New.
4957         (Input_arguments::add_file): Handle lib groups.
4958         (Input_arguments::start_group): Check we are not in a lib.
4959         (Input_arguments::start_lib): New.
4960         (Input_arguments::end_lib): New.
4961         * options.h (General_options): Add start_lib and end_lib.
4962         (Input_argument::lib_): New.
4963         (Input_argument::lib): New.
4964         (Input_argument::is_lib): New.
4965         (Input_file_lib): New.
4966         (Input_arguments::in_lib_): New.
4967         (Input_arguments::in_lib): New.
4968         (Input_arguments::start_lib): New.
4969         (Input_arguments::end_lib_): New.
4970         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4971         in unused members as preempted.
4972         (Sized_pluginobj::do_should_include_member): New.
4973         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4974         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4975         return the blocker.
4976         (Read_symbols::do_whole_lib_group): New.
4977         (Read_symbols::do_lib_group): New.
4978         (Read_symbols::do_read_symbols): Handle lib groups.
4979         (Read_symbols::get_name): Handle lib groups.
4980         * readsyms.h (Read_symbols): Add an archive member pointer.
4981         (Read_symbols::do_whole_lib_group): New.
4982         (Read_symbols::do_lib_group): New.
4983         (Read_symbols::member_): New.
4984         * script.cc (read_input_script): Update call to queue_soon.
4985
4986 2010-03-19  Doug Kwan  <dougkwan@google.com>
4987
4988         * arm.cc (Stub_table::Stub_table): Initialize new data members
4989         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4990         (Stub_table::add_reloc_stub): Assign stub offset and update
4991         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4992         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4993         New data members.
4994         (Stub_table::update_data_size_and_addralign): Use
4995         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4996         instead of going over all reloc stubs.
4997         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4998         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4999         Stringpool_template::offset_ to size of Stringpool_char.
5000         (Stringpool_template::new_key_offset): Remove code to initialize
5001         Stringpool_template::offset_.
5002         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5003         Stringpool_template::offset_ to zero.
5004
5005 2010-03-15  Doug Kwan  <dougkwan@google.com>
5006
5007         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5008         offset_.
5009         (Stringpool_template::new_key_offset): New method.
5010         (Stringpool_template::add_string): Assign offsets when adding new
5011         strings.
5012         (Stringpool_template::set_string_offsets): Do not set string offsets
5013         when not optimizing.
5014         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5015         member size_.
5016         (Chunked_vector::clear): Clear size_.
5017         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5018         (Chunked_vector::size): Return size_.
5019         (Chunked_vector::push_back): Use size_ to find insert position.
5020         (Chunked_vector::size_): New data member.
5021         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5022         (Stringpool_template::new_key_offset): New method declaration.
5023         (Stringpool_template::offset_): New data member.
5024
5025 2010-03-15   Rafael Espindola  <espindola@google.com>
5026
5027         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5028         Add_symbols' constructor.
5029         * readsyms.h (Add_symbols): Remove the input_group member.
5030
5031 2010-03-10  Ian Lance Taylor  <iant@google.com>
5032
5033         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5034         target to ask whether a reference to a symbol requires a stack
5035         split.
5036         * target.h (Target::is_call_to_non_split): New function.
5037         (Target::do_is_call_to_non_split): Declare virtual function.
5038         * target.cc: Include "symtab.h".
5039         (Target::do_is_call_to_non_split): New function.
5040         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5041
5042 2010-03-10  Cary Coutant  <ccoutant@google.com>
5043
5044         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5045         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5046         (File_read::open[2]): Add whole_file_view_ to list of views.
5047         (File_read::make_view): Remove test of whole_file_view_.
5048         (File_read::find_or_make_view): Create whole_file_view_ if
5049         necessary.
5050         (File_read::clear_views): Replace bool parameter with enum;
5051         adjust all callers.  Don't delete views with permanent data;
5052         do delete cached views and views from archives if
5053         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5054         if clearing the corresponding view.
5055         * fileread.h (File_read::Clear_views_mode): New enum.
5056         (File_read::View::is_permanent_view): New method.
5057         (File_read::clear_views): Replace bool parameter
5058         with enum; adjust all callers.
5059         * options.h (General_options): Change keep_files_mapped option;
5060         add map_whole_files.
5061         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5062         releasing the file.
5063         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5064         the file.
5065
5066 2010-03-10  David S. Miller  <davem@davemloft.net>
5067
5068         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5069
5070 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5071
5072         * icf.cc (get_section_contents): Add '@' marker after processing the
5073         merge reloc.
5074
5075 2010-03-08  Doug Kwan  <dougkwan@google.com>
5076
5077         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5078         due to a conversion warning.
5079         (Arm_relobj::update_output_local_symbol_count): Check for local
5080         symbol with unset output index.
5081
5082 2010-03-05  Ian Lance Taylor  <iant@google.com>
5083
5084         * options.h (class General_options): Add --spare-dynamic-tags.
5085         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5086         --spare-dynamic-tags.
5087
5088 2010-03-05  Ian Lance Taylor  <iant@google.com>
5089
5090         * incremental.cc: Include "libiberty.h".
5091
5092 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5093
5094         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5095         function, is_info_ member.
5096         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5097         (Versions::Versions): Update caller.
5098         (Versions::define_base_version): Likewise.
5099         (Versions::add_def): Likewise.
5100
5101 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5102
5103         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5104         (Scan::possible_function_pointer_reloc): New function.
5105         (Scan::local_reloc_may_be_function_pointer): Change to call
5106         possible_function_pointer_reloc.
5107         (Scan::global_reloc_may_be_function_pointer): Ditto.
5108         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5109         relocations in ".data.rel.ro._ZTV" section.
5110         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5111         * testsuite/icf_safe_so_test.cc: Ditto.
5112         * testsuite/icf_safe_test.cc: Ditto.
5113         * testsuite/icf_safe_test.sh: Ditto.
5114
5115 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5116             Ian Lance Taylor  <iant@google.com>
5117
5118         * target-reloc.h (relocate_section): Check the symbol table index
5119         for -1U before setting the local symbol index.
5120         (scan_relocatable_relocs): If copying the relocation, record that
5121         the local symbol is required.
5122         * object.h (Symbol_value::is_output_symtab_index_set): New
5123         function.
5124         (Symbol_value::may_be_discarded_from_output_symtab): New
5125         function.
5126         (Symbol_value::has_output_symtab_entry): New function.
5127         (Symbol_value::needs_output_symtab_entry): Remove.
5128         (Symbol_value::output_symtab_index): Make sure the symbol index is
5129         set.
5130         (Symbol_value::set_output_symtab_index): Make sure the symbol
5131         index is not set.  Make sure the new index is valid.
5132         (Symbol_value::set_must_have_output_symtab_entry): New function.
5133         (Symbol_value::has_output_dynsym_entry): New function.
5134         (Symbol_value::set_output_dynsym_index): Make sure the new index
5135         is valid.
5136         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5137         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5138         local symbol if permitted.
5139         (Sized_relobj::do_finalize_local_symbols): Call
5140         is_output_symtab_index_set rather than needs_output_symtab_entry.
5141         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5142         rather than needs_output_symtab_entry.  Call
5143         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5144         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5145         is_output_symtab_index_set rather than needs_output_symtab_entry.
5146         * testsuite/discard_locals_relocatable_test.c: New file.
5147         * testsuite/discard_locals_test.sh: Test -r.
5148         * testsuite/Makefile.am (check_DATA): Add
5149         discard_locals_relocatable_test1.syms,
5150         discard_local_relocatable_test2.syms.
5151         (MOSTLYCLEANFILES): Likewise.  Also add
5152         discard_locals_relocatable_test1.lout and
5153         discard_locals_relocatable_test2.out.
5154         (discard_locals_relocatable_test1.syms): New target.
5155         (discard_locals_relocatable_test.o): New target.
5156         (discard_locals_relocatable_test1.out): New target.
5157         (discard_locals_relocatable_test2.syms): New target.
5158         (discard_locals_relocatable_test2.out): New target.
5159         (various): Add missing ../ld-new dependencies.
5160         * testsuite/Makefile.in: Rebuild.
5161
5162 2010-03-03  Nick Clifton  <nickc@redhat.com>
5163
5164         * po/fi.po: New Finnish translation.
5165
5166 2010-03-01  Doug Kwan  <dougkwan@google.com>
5167
5168         * layout.cc (Layout::Layout): Force section types of .init_array*,
5169         .preinit_array* and .fini_array* sections.
5170         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5171         Fix check of return value of std::string::find.().
5172         (Output_section::Input_section_sort_compare::operator()): Remove
5173         comment about .init_array.
5174         (Output_section::Input_section_sort_init_fini_compare::operator()):
5175         New method.
5176         (Output_section::sort_attached_input_sections): Handle .init_array
5177         and .fini_array specially.
5178         * output.h (Output_section::Inut_section_sort_compare): Update
5179         comment.
5180         (Output_section::Input_section_sort_init_fini_compare): New struct.
5181
5182 2010-02-26  Doug Kwan  <dougkwan@google.com>
5183
5184         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5185         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5186         * testsuite/debug_msg.sh: Avoid matching source line number for
5187         use of global variable undef_int.
5188
5189 2010-02-26  Doug Kwan  <dougkwan@google.com>
5190
5191         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5192         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5193         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5194         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5195         * options.cc (General_options::General_options): Initialize member
5196         fix_v4bx_.
5197         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5198         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5199         and rm_no_fix_v4bx.stdout
5200         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5201         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5202         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5203         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5204         and arm_no_fix_v4bx.
5205         * Makefile.in: Regenerate.
5206         * testsuite/arm_fix_v4bx.s: New file.
5207         * testsuite/arm_fix_v4bx.sh: Ditto.
5208
5209 2010-02-24  Doug Kwan  <dougkwan@google.com>
5210
5211         * arm.cc (Target_arm::got_section): Make the .got section the first
5212         non RELRO section in the data segment.
5213         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5214         suffixes of section names.
5215
5216 2010-02-24  Doug Kwan  <dougkwan@google.com>
5217
5218         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5219         flags and attributes merging if an input file is a binary file.
5220         * fileread.cc (Input_file::open): Record format of original file.
5221         * fileread.h (Input_file::Format): New enum type.
5222         (Input_file::Input_file): Initialize data member format_.
5223         (Input_file::format): New method definition.
5224         (Input_file::format_):: New data member.
5225
5226 2010-02-24  Doug Kwan  <dougkwan@google.com>
5227
5228         * arm.cc (Arm_output_data_got): New class.
5229         (ARM_TCB_SIZE): New constant
5230         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5231         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5232         If user uses a script with a SECTIONS clause, issue only a warning
5233         for a misplaced EXIDX input section.  Otherwise, issue an error.
5234         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5235         garbage collection.
5236         (Target_arm::got_mode_index_entry): Handle static linking.
5237         (Target_arm::Scan::local): Ditto.
5238         (Target_arm::Scan::global): Ditto.
5239         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5240         all incorrectly implemented relocations.
5241         (Target_arm::fix_exidx_coverage): Pass layout to
5242         Arm_output_section::fix_exidx_coverage.
5243         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5244         from ".ARM.exidx." and ".ARM.extab.".
5245
5246 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5247
5248         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5249         section if it does not already exist.
5250         * attributes.cc (Attributes_section_data::Attributes_section_data):
5251         Don't crash if size is zero.
5252
5253 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5254             Ian Lance Taylor  <iant@google.com>
5255
5256         * gold.cc (queue_middle_tasks): If no input files were opened,
5257         exit.
5258         * workqueue.h (Task_function::Task_function): Assert that there is
5259         a blocker.
5260
5261 2010-02-22  Doug Kwan  <dougkwan@google.com>
5262
5263         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5264         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5265         types to avoid warnings due to different uint64_t implementations
5266         on different hosts.
5267
5268 2010-02-21  Doug Kwan  <dougkwan@google.com>
5269
5270         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5271         handling of the maximum backward branch offset.
5272         (Arm_relocate_functions::thumb_branch_common): Ditto.
5273         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5274         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5275         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5276         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5277         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5278         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5279         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5280         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5281         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5282         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5283         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5284         thumb2_bl_out_of_range.o): New rules.
5285         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5286         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5287         thumb2_bl_out_of_range
5288         * testsuite/Makefile.in: Regenerate.
5289         * testsuite/arm_bl_in_range.s: New file.
5290         * testsuite/arm_bl_out_of_range.s: Ditto.
5291         * testsuite/arm_branch_in_range.sh: Ditto.
5292         * testsuite/arm_branch_range.t: Ditto.
5293         * testsuite/thumb2_branch_range.t: Ditto.
5294         * testsuite/thumb_bl_in_range.s: Ditto.
5295         * testsuite/thumb_bl_out_of_range.s: Ditto.
5296         * testsuite/thumb_branch_range.t: Ditto.
5297
5298 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5299
5300         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5301         Add reloc offset information.
5302         * icf.cc (get_section_contents): Change iterators to point to the new
5303         vectors. Add reloc offset information to the contents.
5304         * icf.h (Icf::Sections_reachable_info): New typedef.
5305         (Icf::Sections_reachable_list): New typedef.
5306         (Icf::Offset_info): New typedef.
5307         (Icf::Reloc_info): New struct typedef.
5308         (Icf::Reloc_info_list): New typedef.
5309         (Icf::symbol_reloc_list): Delete method.
5310         (Icf::addend_reloc_list): Delete method.
5311         (Icf::section_reloc_list): Delete method.
5312         (Icf::reloc_info_list): New method.
5313         (Icf::reloc_info_list_): New member.
5314
5315 2010-02-19  Doug Kwan  <dougkwan@google.com>
5316
5317         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5318         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5319         * arm.cc (Arm_relocation_functions): New forward declaration.
5320         (Target_arm::Target_arm): Initialize new data members
5321         got_mod_index_offset_ and tls_base_symbol_defined_.
5322         (Target_arm::Relocate::relocate_tls): New method.
5323         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5324          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5325         New methods.
5326         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5327         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5328         (Target_arm::got_mod_index_offset_,
5329         Target_arm::tls_base_symbol_defined_): New data members.
5330         (Target_arm::Scan::local, Target::Scan::global,
5331         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5332         relocations.
5333
5334 2010-02-18  Doug Kwan  <dougkwan@google.com>
5335
5336         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5337         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5338         text section as a parameter becuase some broken tools may not set
5339         the link in section header.
5340         (Target_arm::has_got_section): New method.
5341         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5342         without any mapping symbol as data only.  Remove warning.
5343         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5344         link in its section header, try to discover the link by inspecting the
5345         REL31 relocation at the beginning of the section.
5346         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5347         in error message.
5348         (Target_arm::Scan::global): Treat any reference to the symbol
5349         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5350
5351 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5352
5353         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5354         (Scan::global_reloc_may_be_function_pointer): New function.
5355         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5356         (Scan::global_reloc_may_be_function_pointer): New function.
5357         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5358         (Scan::global_reloc_may_be_function_pointer): New function.
5359         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5360         (Scan::global_reloc_may_be_function_pointer): New function.
5361         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5362         (Scan::global_reloc_may_be_function_pointer): New function.
5363         (Scan::possible_function_pointer_reloc): New function.
5364         (Target_x86_64::can_check_for_function_pointers): New function.
5365         * gc.h (gc_process_relocs): Scan relocation types to determine if
5366         function pointers were taken for targets that support it.
5367         * icf.cc (Icf::find_identical_sections): Include functions for
5368         folding in safe ICF whose pointer is not taken.
5369         * icf.h (Secn_fptr_taken_set): New typedef.
5370         (fptr_section_id_): New member.
5371         (section_has_function_pointers): New function.
5372         (set_section_has_function_pointers): New function.
5373         (check_section_for_function_pointers): New function.
5374         * options.h: Fix comment for safe ICF option.
5375         * target.h (can_check_for_function_pointers): New function.
5376         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5377         Modify icf_safe_test for X86-64.
5378         * testsuite/Makefile.in: Regenerate.
5379         * testsuite/icf_safe_so_test.cc: New file.
5380         * testsuite/icf_safe_so_test.sh: New file.
5381         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5382         (main): Change to take pointer to function kept_func_3.
5383         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5384         folding is done correctly for X86-64.
5385
5386 2010-02-12  David S. Miller  <davem@davemloft.net>
5387
5388         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5389         is_symbolless parameter.
5390         (Output_reloc<SHT_REL>::is_symbolless): New.
5391         (Output_reloc<SHT_REL>::is_symbolless_): New.
5392         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5393         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5394         (Output_reloc<SHT_RELA>::is_symbolless): New.
5395         (Output_data_reloc::add_global): Handle is_symbolless.
5396         (Output_data_reloc::add_global_relative): Likewise.
5397         (Output_data_reloc::add_local): Likewise.
5398         (Output_data_reloc::add_local_relative): Likewise.
5399         (Output_data_reloc::add_symbolless_global_addend): New.
5400         (Output_data_reloc::add_symbolless_local_addend): New.
5401         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5402         is_symbolless.
5403         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5404         instead of ->is_relative_
5405         (Output_reloc::write): Likewise.
5406         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5407         (Output_reloc::write_rel): Simplify.
5408
5409         * sparc.cc (Target_sparc::Scan::local): Use
5410         ->add_symbolless_local_addend as needed.
5411         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5412         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5413         based upon relocation offset.
5414
5415 2010-02-11  Doug Kwan  <dougkwan@google.com>
5416
5417         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5418         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5419         beginning of function.
5420         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5421         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5422         parameter is_32bit in calls to should_apply_static_reloc.
5423         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5424         (check_DATA): Add arm_abs_global.stdout.
5425         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5426         arm_abs_global.stdout): New rules.
5427         (MOSTLLYCLEANFILES): Add arm_abs_global
5428         * Makefile.in: Regenerate.
5429         * testsuite/arm_abs_global.s: New file.
5430         * testsuite/arm_abs_global.sh: Ditto.
5431         * testsuite/arm_abs_lib.s: Ditto.
5432
5433 2010-02-11  Ian Lance Taylor  <iant@google.com>
5434
5435         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5436         Read_relocs task.
5437         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5438         Allocate_commons_task first.
5439         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5440         task, rather than symtab_lock_.
5441         (Gc_process_relocs::~Gc_process_relocs): New function.
5442         (Gc_process_relocs::is_runnable): Check this_blocker_.
5443         (Gc_process_relocs::locks): Use next_blocker_ rather than
5444         blocker_.
5445         (Scan_relocs::~Scan_relocs): New function.
5446         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5447         symtab_lock_.
5448         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5449         next_blocker_.
5450         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5451         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5452         constructor accordingly.
5453         (class Gc_process_relocs): Likewise.
5454         (class Scan_relocs): Likewise.
5455         * common.h (class Allocate_commons_task): Remove symtab_lock_
5456         field, and corresponding constructor parameter.
5457         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5458         symtab_lock_.
5459         (Allocate_commons_task::locks): Likewise.
5460
5461 2010-02-11  Ian Lance Taylor  <iant@google.com>
5462
5463         * gold-threads.h (class Once): Define.
5464         (class Initialize_lock): Rewrite as child of Once.
5465         * gold-threads.cc (class Once_initialize): Define.
5466         (once_pointer_control): New static variable.
5467         (once_pointer, once_arg): New static variables.
5468         (c_run_once): New static function.
5469         (Once::Once, Once::run_once, Once::internal_run): New functions.
5470         (class Initialize_lock_once): Remove.
5471         (initialize_lock_control): Remove.
5472         (initialize_lock_pointer): Remove.
5473         (initialize_lock_once): Remove.
5474         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5475         (Initialize_lock::initialize): Rewrite.
5476         (Initialize_lock::do_run_once): New function.
5477         * archive.cc (Archive::interpret_header): Only clear name if it is
5478         not already empty.
5479         * fileread.cc: Include "gold-threads.h"
5480         (file_counts_lock): New static variable.
5481         (file_counts_initialize_lock): Likewise.
5482         (File_read::release): Only increment counts when using --stats.
5483         Use a lock around the increment.
5484         * parameters.cc (class Set_parameters_target_once): Define.
5485         (set_parameters_target_once): New static variable.
5486         (Parameters::Parameters): Move here from parameters.h.
5487         (Parameters::set_target): Rewrite.
5488         (Parameters::set_target_once): New function.
5489         (Parameters::clear_target): Move here and rewrite.
5490         * parameters.h (class Parameters): Update declarations.  Add
5491         set_parameters_target_once_ field.
5492         (Parameters::Parameters): Move to parameters.cc.
5493         (Parameters::clear_target): Likewise.
5494         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5495         task.
5496         (Start_group::~Start_group): New function.
5497         (Start_group::is_runnable): New function.
5498         (Start_group::locks, Start_group::run): New functions.
5499         (Finish_group::run): Change saw_undefined to size_t.
5500         * readsyms.h (class Start_group): Define.
5501         (class Finish_group): Change saw_undefined_ field to size_t.
5502         (Finish_group::Finish_group): Remove saw_undefined and
5503         this_blocker parameters.  Change all callers.
5504         (Finish_group::set_saw_undefined): New function.
5505         (Finish_group::set_blocker): New function.
5506         * symtab.h (class Symbol_table): Change saw_undefined to return
5507         size_t.  Change saw_undefined_ field to size_t.
5508         * target-select.cc (Set_target_once::do_run_once): New function.
5509         (Target_selector::Target_selector): Initialize set_target_once_
5510         field.  Don't initialize lock_ and initialize_lock_ fields.
5511         (Target_selector::instantiate_target): Rewrite.
5512         (Target_selector::set_target): New function.
5513         * target-select.h (class Set_target_once): Define.
5514         (class Target_selector): Update declarations.  Make
5515         Set_target_once a friend.  Remove lock_ and initialize_lock_
5516         fields.  Add set_target_once_ field.
5517
5518 2010-02-10  Ian Lance Taylor  <iant@google.com>
5519
5520         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5521         queueing any tasks.
5522         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5523         (queue_middle_tasks): Add all blockers before queueing any tasks.
5524         (queue_final_tasks): Likewise.
5525         * token.h (Task_token::add_blockers): New function.
5526         * object.h (Input_objects::number_of_relobjs): New function.
5527
5528 2010-02-10  Ian Lance Taylor  <iant@google.com>
5529
5530         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5531         shared, not if not position independent.
5532         * x86_64.cc (Relocate::relocate_tls): Likewise.
5533         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5534         (tls_pie_pic_test): New target.
5535         * testsuite/Makefile.in: Rebuild.
5536
5537         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5538         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5539         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5540         * testsuite/Makefile.in: Rebuild.
5541
5542 2010-02-09  David S. Miller  <davem@davemloft.net>
5543
5544         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5545         R_SPARC_RELATIVE using ->add_local_relative().
5546         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5547
5548         * output.h (Output_data_dynamic::add_section_size): New method
5549         that takes two Output_data objects.
5550         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5551         entry param.  Handle it in initializers.
5552         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5553         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5554         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5555         arg.
5556         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5557         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5558         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5559         for dynrel_includes_plt.
5560         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5561         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5562         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5563         before .rela.plt
5564         (Target_sparc::do_finalize_sections): Update to pass true for
5565         dynrel_includes_plt.
5566         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5567         output before .rela.plt
5568         (Target_powerpc::do_finalize_sections): Update to pass true for
5569         dynrel_includes_plt when 32-bit.
5570
5571 2010-02-08  Doug Kwan  <dougkwan@google.com>
5572
5573         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5574         method.
5575         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5576         Arm_relobj::scan_section_for_cortex_a8_stubs,
5577         Arm_relobj::do_relocation_section): Instead of calling
5578         Output_section::output_address, use faster
5579         Arm_relobj::simple_input_section_output_address.
5580
5581 2010-02-08  David S. Miller  <davem@davemloft.net>
5582
5583         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5584         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5585         relocation helper function.
5586
5587         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5588         just like R_SPARC_GOT{10,13,22}.
5589         (Target_sparc::Scan::local): Likewise.
5590         (Target_sparc::Relocate:relocate): Likewise.
5591
5592 2010-02-06  Ian Lance Taylor  <iant@google.com>
5593
5594         * configure.ac: Rewrite targetobjs duplicate removal code to use
5595         only shell constructs.
5596         * configure: Rebuild.
5597
5598 2010-02-05  Doug Kwan  <dougkwan@google.com>
5599
5600         PR 11247
5601         * arm.cc (Arm_relobj::section_is_scannable): New method.
5602         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5603         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5604
5605 2010-02-04  Doug Kwan  <dougkwan@google.com>
5606
5607         PR 11247
5608         * arm-reloc-property.cc (cstdio): Include.
5609         * configure.ac (targetobjs): Remove duplicates.
5610         * configure: Regenerate.
5611         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5612         big and little endian version for a given address size.
5613
5614 2010-02-03  Doug Kwan  <dougkwan@google.com>
5615
5616         * arm-reloc-property.cc
5617         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5618         definition.
5619         * arm-reloc-property.h
5620         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5621         New method definition.
5622         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5623         declaration.
5624         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5625         overflow to N.
5626         (GOT_PREL): Change implemented to Y.
5627         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5628         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5629         (Arm_relocate_functions::movw_abs_nc): Remove method.
5630         (Arm_relocate_functions::movt_abs): Ditto.
5631         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5632         (Arm_relocate_functions::thm_movt_abs): Ditto.
5633         (Arm_relocate_functions::movw_rel_nc): Ditto.
5634         (Arm_relocate_functions::movw_rel): Ditto.
5635         (Arm_relocate_functions::movt_rel): Ditto.
5636         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5637         (Arm_relocate_functions:thm_movw_rel): Ditto.
5638         (Arm_relocate_functions:thm_movt_rel): Ditto.
5639         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5640         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5641         New method definitions.
5642         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5643         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5644         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5645         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5646         (Target_arm::Relocate::relocate): Check for non-static or
5647         unimplemented relocation code and exit early.  Change calls to
5648         Target_arm::reloc_uses_thumb_bit and
5649         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5650         instead.  Refactor code to handle similar relocations to increase
5651         code sharing.  Remove check for unsupported relocation code in switch
5652         statement.
5653         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5654         relocation property table to find out size.  Change error message to
5655         print out the name of a relocation code instead of the numeric value.
5656         (Target_arm::scan_reloc_for_stub): Use relocation property table
5657         instead of calling Target_arm::reloc_uses_thumb_bit().
5658
5659 2010-02-02  Doug Kwan  <dougkwan@google.com>
5660
5661         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5662         types of relaxed input section.
5663
5664 2010-02-02  Doug Kwan  <dougkwan@google.com>
5665
5666         * Makefile.am (HFILES): Add arm-reloc-property.h.
5667         (DEFFILES): New.
5668         (TARGETSOURCES): Add arm-reloc-property.cc
5669         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5670         (libgold_a_SOURCES): $(DEFFILES)
5671         * Makefile.in: Regenerate.
5672         * arm-reloc-property.cc: New file.
5673         * arm-reloc-property.h: New file.
5674         * arm-reloc.def: New file.
5675         * arm.cc: Update comments.
5676         (arm-reloc-property.h): New included header.
5677         (arm_reloc_property_table): New global variable.
5678         (Target_arm::do_select_as_default_target): New method definition.
5679         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5680         arm-reloc-property to targ_extra_obj.
5681         * parameters.cc (set_parameters_target): Call
5682         Target::select_as_default_target().
5683         * target.h (Target::select_as_default_target): New method definition.
5684         (Target::do_select_as_default_target): Same.
5685
5686 2010-02-01  Doug Kwan  <dougkwan@google.com>
5687
5688         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5689         first_output_text_section_.
5690         (Arm_exidx_fixup::first_output_text_section): New method definition.
5691         (Arm_exidx_fixup::first_output_text_section_): New data member.
5692         (Arm_exidx_fixup::process_exidx_section): Record the first text
5693         output section seen.
5694         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5695         and entsize in output section header.
5696
5697 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5698
5699         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5700         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5701         (Arm_relocate_functions::thm_alu11): New Method.
5702         (Arm_relocate_functions::thm_pc8): New Method.
5703         (Arm_relocate_functions::thm_pc12): New Method.
5704         (Target_arm::Scan::local): Handle the relocations.
5705         (Target_arm::Scan::global): Likewise.
5706         (Target_arm::Relocate::relocate): Likewise.
5707         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5708
5709 2010-01-29  Doug Kwan  <dougkwan@google.com>
5710
5711         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5712         of relocation types as ld.
5713
5714 2010-01-29  Doug Kwan  <dougkwan@google.com>
5715
5716         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5717         to public.
5718         (Arm_relocate_functions::thumb_branch_common): Ditto.
5719         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5720         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5721         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5722         Arm_relocate_functions::jump24): Remove.
5723         (Target_arm::Relocate::relocate): Adjust code to call
5724         Arm_relocation_functions::arm_branch_common and
5725         Arm_relocation_functions::thumb_branch_common instead of their removed
5726         wrappers.  Merge switch-cases together to reduce source code size.
5727
5728 2010-01-29  Doug Kwan  <dougkwan@google.com>
5729
5730         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5731         output_local_symbol_count_needs_update_.
5732         (Arm_relobj::output_local_symbol_count_needs_update,
5733          Arm_relobj::set_output_local_symbol_count_needs_update,
5734          Arm_relobj::update_output_local_symbol_count): New methods.
5735         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5736         member.
5737         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5738         of pointed function as in a R_ARM_PREL31 relocation.
5739         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5740         for output local symbol count updating.
5741         (Target_arm::do_relax): Update output local symbol counts in objects
5742         if necessary.
5743         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5744
5745 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5746
5747         * arm.cc: Added support for the ARM relocations:
5748         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5749         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5750         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5751         movw_prel_nc).
5752         (Arm_relocate_functions::movw_rel): New method.
5753         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5754         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5755         thm_movw_prel_nc).
5756         (Arm_relocate_functions::thm_movw_rel): New method.
5757         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5758         thm_movt_prel).
5759         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5760         relocations.
5761         (Target_arm::Scan::global): Likewise.
5762         (Target_arm::Relocate::relocate): Likewise.
5763         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5764         Likewise.
5765
5766 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5767
5768         * arm.cc: Added support for ARM group relocations.
5769         (Target_arm::reloc_needs_sym_origin): New method.
5770         (Arm_relocate_functions::calc_grp_kn): New method.
5771         (Arm_relocate_functions::calc_grp_residual): New method.
5772         (Arm_relocate_functions::calc_grp_gn): New method.
5773         (Arm_relocate_functions::arm_grp_alu): New Method.
5774         (Arm_relocate_functions::arm_grp_ldr): New Method.
5775         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5776         (Arm_relocate_functions::arm_grp_ldc): New Method.
5777         (Target_arm::Scan::local): Handle the ARM group relocations.
5778         (Target_arm::Scan::global): Likewise.
5779         (Target_arm::Relocate::relocate): Likewise.
5780         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5781         Likewise.
5782
5783 2010-01-26  Doug Kwan  <dougkwan@google.com>
5784
5785         * arm.cc (set): Include.
5786         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5787         pointer type.
5788         (Arm_output_section::Text_section_list): New type.
5789         (Arm_output_section::append_text_sections_to_list): New method.
5790         (Arm_output_section::fix_exidx_coverage): Ditto.
5791         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5792         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5793         Relobj::set_section_offset() instead of
5794         Sized_relobj::invalidate_section_offset().
5795         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5796         parameter for section headers. Ignore relocation sections for
5797         unallocated sections and EXIDX sections.
5798         (Target_arm::fix_exidx_coverage): New method.
5799         (Target_arm::output_section_address_less_than): New type.
5800         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5801         linked text section instead of the EXIDX section.
5802         (Arm_output_section::create_stub_group): Add an assertion to check
5803         that this is not an EXIDX output section.
5804         (Arm_output_section::append_text_sections_to_list): New method.
5805         (Arm_output_section::fix_exidx_coverage): Ditto.
5806         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5807         Arm_relobj::section_needs_reloc_stub_scanning.
5808         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5809         first pass.
5810         (Target_arm::fix_exidx_coverage): New method.
5811         * object.h (Relobj::set_output_section): New method.
5812         (Sized_relobj::invalidate_section_offset): Remove method.
5813         (Sized_relobj::do_invalidate_section_offset): Remove method.
5814         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5815
5816 2010-01-25  Doug Kwan  <dougkwan@google.com>
5817
5818         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5819         Fix warning due to signed and unsigned comparison on a 32-bit host.
5820
5821 2010-01-22  Doug Kwan  <dougkwan@google.com>
5822
5823         * arm.cc (Target_arm::do_relax): Record an output section for section
5824         offset adjustment it contains any stub table that has changed.
5825         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5826         offsets in an output section if necessary.
5827         * output.cc (Output_section::Output_section): Initialize
5828         section_offsets_need_adjustments_.
5829         (Output_section::add_input_section_for_script): Renamed to
5830         Output_section::add_simple_input_section.
5831         (Output_section::save_states): Add a comment.
5832         (Output_section::discard_states): New method defintion.
5833         (Output_section::adjust_section_offsets): Same.
5834         * output.h (Output_section::add_input_section_for_script): Renamed to
5835         Output_section::add_simple_input_section.
5836         (Output_section::discard_states): New method declaration.
5837         (Output_section::adjust_section_offsets): Same.
5838         (Output_section::section_offsets_need_adjustment,
5839         Output_section::set_section_offsets_need_adjustment): New method
5840         definitions.
5841         (Output_section::section_offsets_need_adjustment_): New data member.
5842         * script-sections.cc
5843         (Output_section_element_input::set_section_address): Adjust code for
5844         renaming of Output_section::add_input_section_for_script.
5845         (Orphan_output_section::set_section_address): Same.
5846
5847 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5848
5849         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5850         Fix_v4bx enum values .
5851         * gold/options.h (General_options): New option definitions.
5852         (General_options::fix_v4bx): New method.
5853         (General_options::Fix_v4bx): New enum.
5854         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5855         (General_options::parse_fix_v4bx_interworking): New method.
5856
5857 2010-01-22  Doug Kwan  <dougkwan@google.com>
5858
5859         * arm.cc (Arm_exidx_fixup): New class.
5860
5861 2010-01-21  Doug Kwan  <dougkwan@google.com>
5862
5863         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5864         classes.
5865         (Arm_exidx_section_offset_map): New type.
5866
5867 2010-01-21  Doug Kwan  <dougkwan@google.com>
5868
5869         * arm.cc (Arm_exidx_input_section): New class.
5870         (Arm_relobj::exidx_input_section_by_link,
5871         Arm_relobj::exidx_input_section_by_shndx,
5872         Arm_relobj::make_exidx_input_section): New methods.
5873         (read_arm_attributes_section): Remove.
5874         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5875         information about them.
5876         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5877         to here.
5878
5879 2010-01-20  Doug Kwan  <dougkwan@google.com>
5880
5881         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5882         Input_section_specifier to Section_id.
5883         (Target_arm::new_arm_input_section: Adjust code for change of key
5884         type.
5885         (Target_arm::find_arm_input_section): Ditto.
5886         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5887         (Section_id): Remove.
5888         (Garbage_collection::Section_id_hash): Remove.
5889         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5890         (Section_id): Remove.
5891         (Icf::Section_id_hash): Remove.
5892         * object.h (Section_id, Const_section_id, Section_id_hash,
5893         Const_section_id_hash): New type definitions.
5894         * output.cc (Output_section::add_relaxed_input_section): Change to
5895         use Const_section_id instead of Input_section_specifier as key type.
5896         (Output_section::add_merge_input_section): Ditto.
5897         (Output_section::build_relaxation_map): Change to use Section_id
5898         instead of Input_section_specifier as key type.
5899         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5900         Ditto.
5901         (Output_section::convert_input_sections_to_relaxed_sections): Change
5902         to use Const_section_id instead of Input_section_specifier as key type.
5903         (Output_section::find_merge_section): Ditto.
5904         (Output_section::find_relaxed_input_section): Ditto.
5905         * output.h (Input_section_specifier): Remove class.
5906         (Output_section::Output_section_data_by_input_section_map): Change
5907         key type to Const_section_id.
5908         (Output_section::Output_relaxed_input_section_by_input_section_map):
5909         Ditto.
5910         (Output_section::Relaxation_map): Change key type to Section_id.
5911
5912 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5913
5914         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5915         (class Arm_v4bx_stub): New class.
5916         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5917         (Stub_factory::make_arm_v4bx_stub): New method.
5918         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5919         (Stub_table::empty): Handle v4bx stubs.
5920         (Stub_table::add_arm_v4bx_stub): New method.
5921         (Stub_table::find_arm_v4bx_stub): New method.
5922         (Arm_relocate_functions::v4bx): New method.
5923         (Target_arm::fix_v4bx): New method.
5924         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5925         (Stub_table::relocate_stubs): Likewise.
5926         (Stub_table::do_write): Likewise.
5927         (Stub_table::update_data_size_and_addralign): Likewise.
5928         (Stub_table::finalize_stubs):  Likewise.
5929         (Target_arm::Scan::local): Likewise.
5930         (Target_arm::Scan::global): Likewise.
5931         (Target_arm::do_finalize_sections): Likewise.
5932         (Target_arm::Relocate::relocate): Likewise.
5933         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5934         Likewise.
5935         (Target_arm::scan_reloc_for_stub): Likewise.
5936         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5937
5938 2010-01-19  Ian Lance Taylor  <iant@google.com>
5939
5940         * output.cc (Output_section_headers::do_sized_write): Write large
5941         segment count to sh_info field.
5942         (Output_file_header::do_sized_write): For large segment count,
5943         write PN_XNUM to e_phnum field.
5944
5945 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5946
5947         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5948         (Arm_relocate_functions::thm_jump8): New function.
5949         (Arm_relocate_functions::thm_jump11): New function.
5950         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5951         R_ARM_THM_JUMP11.
5952         (Target_arm::Scan::global): Likewise.
5953         (Target_arm::Relocate::relocate): Likewise.
5954         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5955         Likewise.
5956
5957 2010-01-14  Doug Kwan  <dougkwan@google.com>
5958
5959         * arm.cc (map, utility): Include headers.
5960         (Target_arm::apply_cortex_a8_workaround): New method.
5961         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5962         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5963         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5964         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5965         the --[no-]fix-cortex-a8 command line options.
5966         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5967         (Target_arm::relocate_stub): Use addend in instruction template.
5968         * options.h (DEFINE_bool): Set the user-set flag.
5969         (General_options): Add --[no-]-fix-cortex options.
5970         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5971         : Update fast look-up map after conversion.
5972
5973 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5974
5975         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5976         in the first pass of do_layout.
5977
5978 2010-01-13  Doug Kwan  <dougkwan@google.com>
5979
5980         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5981         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5982         apparent compiler problem of not folding static constant integral
5983         data members of elfcpp::Elf_sizes<32>.
5984
5985 2010-01-13  Doug Kwan  <dougkwan@google.com>
5986
5987         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5988         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5989         Arm_relobj::scan_section_for_cortex_a8_erratum,
5990         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5991         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5992         sections to scan for relocation stubs into a new method
5993         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5994         relocation and Cortex-A8 stub scanning.
5995         (Target_arm::do_relax): Force stubs to be after stubbed sections
5996         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5997         the beginning of a new relaxation pass.  Update a comment.
5998         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5999
6000 2010-01-12  Ian Lance Taylor  <iant@google.com>
6001
6002         * target-reloc.h (visibility_error): New inline function.
6003         (relocate_section): Call visibility_error.
6004         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6005         (MOSTLYCLEANFILES): Likewise.
6006         (protected_4_pic.o, protected_3.err): New targets.
6007         * testsuite/protected_4.cc: New file.
6008
6009 2010-01-12  Doug Kwan  <dougkwan@google.com>
6010
6011         * arm.cc (Cortex_a8_reloc): New class.
6012         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6013         and cortex_a8_relocs_info_.
6014         (Target_arm::fix_cortex_a8): New method definition.
6015         (Target_arm::Cortex_a8_relocs_info): New type.
6016         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6017         New data member declarations.
6018         (Target_arm::scan_reloc_for_stub): Record information about
6019         relocations for THUMB branches that might be exempted from the
6020         Cortex-A8 workaround.
6021         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6022         at the beginning of a relaxation pass.
6023
6024 2010-01-12  Doug Kwan  <dougkwan@google.com>
6025
6026         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6027         (Arm_relobj::Mapping_symbol_position,
6028          Arm_reloj::Mapping_symbol_position_less,
6029          Arm_relobj::Mapping_symbols_info): New types.
6030         (Target_arm::is_mapping_symbol_name): New method definition.
6031         (Arm_relobj::do_count_local_symbols): Save information about mapping
6032         symbols.
6033
6034 2010-01-11  Doug Kwan  <dougkwan@google.com>
6035
6036         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6037         Arm_relocate_functions::thumb32_branch_upper,
6038         Arm_relocate_functions::thumb32_branch_lower,
6039         Arm_relocate_functions::thumb32_cond_branch_offset,
6040         Arm_relocate_functions::thumb32_cond_branch_upper,
6041         Arm_relocate_functions::thumb32_cond_branch_lower,
6042         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6043         branch offset encoding.
6044         (Arm_relocate_functions::thumb_branch_common): Use new branch
6045         offset encoding methods to avoid code duplication.
6046         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6047         (Stub_addend_reader::operator()): Use new branch encoding method
6048         to avoid code duplication.
6049
6050 2010-01-11  Doug Kwan  <dougkwan@google.com>
6051
6052         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6053         (Target_arm::do_finalize_sections): Define special EXIDX section
6054         symbols only if referenced.
6055         * gc.h (Garbage_collection::add_reference): New method.
6056         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6057         code duplication.
6058
6059 2010-01-11  Ian Lance Taylor  <iant@google.com>
6060
6061         * script.cc (Version_script_info::build_expression_list_lookup):
6062         Change complaing about duplicate wildcard match from error to
6063         warning.
6064
6065         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6066         of 2009-12-30.
6067         (Version_script_info::Version_script_info): Initialize globs_,
6068         default_version_, default_is_global_, and exact_.  Don't
6069         initialize globals_ or locals_.
6070         (Version_script_info::build_lookup_tables): Build local symbols
6071         first.
6072         (Version_script_info::unquote): New function.
6073         (Version_script_info::add_exact_match): New function.
6074         (Version_script_info::build_expression_list_lookup): Remove lookup
6075         parameter.  Add is_global parameter.  Change all callers.  Handle
6076         wildcard pattern specially.  Unquote pattern.  Call
6077         add_exact_match.
6078         (Version_script_info::get_name_to_match): New function.
6079         (Version_script_info::get_symbol_version): New function.
6080         (Version_script_info::get_symbol_version_helper): Remove.
6081         (Version_script_info::check_unmatched_names): Call unquote.
6082         * script.h (class Version_script_info): Change get_symbol_version
6083         to be non-inline and add is_global parameter; change all callers.
6084         Rewrite symbol_is_local.  Update declarations.  Define struct
6085         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6086         Remove globals_ and locals_ members.  Add exact_, globs_,
6087         default_version_, is_global_.
6088         (Version_script_info::Glob): Remove pattern, add expression and
6089         is_global.  Update constructor.  Change all callers.
6090         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6091         default version.
6092         (Versions::symbol_section_contents): If a symbol is undefined, or
6093         defined in a dynamic object, set the version index to
6094         VER_NDX_LOCAL.
6095         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6096         symbol_is_local.
6097         (Symbol_table::add_from_pluginobj): Likewise.
6098         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6099
6100 2010-01-11  Doug Kwan  <dougkwan@google.com>
6101
6102         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6103         (incremental_dump_LDADD): Add linking option for libintl.
6104         * Makefile.in: Regenerate.
6105
6106 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6107
6108         PR gold/11144
6109         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6110         instead of -Ds.
6111         * testsuite/Makefile.in: Regenerated.
6112
6113 2010-01-10  Doug Kwan  <dougkwan@google.com>
6114
6115         * options.h (DEFINE_var): Use parentheses around argument varname__
6116         in macro body to avoid any unintended subsequent substitutions.
6117
6118 2010-01-10  Ian Lance Taylor  <iant@google.com>
6119
6120         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6121         candidates before doing symbol resolution.
6122
6123         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6124         ODR candidates if only one is weak.
6125
6126 2010-01-08  Ian Lance Taylor  <iant@google.com>
6127
6128         * script.cc (Version_script_info::build_expression_list_lookup):
6129         Don't warn about ambiguous version, just record the ambiguity.
6130         (Version_script_info::get_symbol_version_helper): Give error if
6131         version is ambiguous.
6132
6133 2010-01-08  Doug Kwan  <dougkwan@google.com>
6134
6135         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6136           prev_data_size_ and prev_addralign_.  Remove initializer for
6137           deleted data member has_been_changed_.
6138           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6139           to determine if the table is empty.
6140           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6141           Remove.
6142           (Stub_table::add_reloc_stub): Define method in class definition
6143           instead of just declaring it there.
6144           (Stub_table::add_cortex_a8_stub): New method definition.
6145           (Stub_table::update_data_size_and_addralign): Ditto.
6146           (Stub_table::finalize_stubs): Ditto.
6147           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6148           (Stub_table::do_addralign_): Return address alignment in the
6149           (Stub_table::do_reset_address_and_file_offset): Define method in
6150           class definition instead of declaring it there.  Set current data
6151           size to be the data size of the previous pass.
6152           (Stub_table::set_final_data_size): Use current data size as the
6153           final data size.
6154           (Stub_table::relocate_stub): Change parameter type of stub from
6155           Reloc_stub pointer to Stub pointer.
6156           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6157           (Stub_table::Cortex_a8_stub_list): New typedef.
6158           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6159            Stub_table::prev_addralign_): New data member.
6160           (Arm_relobj::Arm_relobj): Initialize data member
6161           section_has_cortex_a8_workaround_.
6162           (Arm_relobj::section_has_cortex_a8_workaround,
6163            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6164            definitions.
6165           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6166           declarations.
6167           (Target_arm::relocate_stub): Change parameter type of stub from
6168           Reloc_stub pointer to Stub pointer.
6169           (Insn_template::size, Insn_template::alignment): Handle
6170           THUMB16_SPECIAL_TYPE.
6171           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6172            Stub_table::update_data_size_and_addralign,
6173            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6174           definitions.
6175           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6176           (Stub_table::do_write): Ditto.
6177           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6178
6179 2010-01-08  Ian Lance Taylor  <iant@google.com>
6180
6181         PR 11108
6182         * symtab.h (class Symbol): Remove fields is_target_special_ and
6183         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6184         (Symbol::is_defined_in_discarded_section): New function.
6185         (Symbol::set_is_defined_in_discarded_section): New function.
6186         (Symbol::has_plt_offset): Rewrite.
6187         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6188         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6189         Don't initialize is_target_special_ or has_plt_offset_.
6190         Initialize is_defined_in_discarded_section_.
6191         (Symbol_table::add_from_relobj): If appropriate, set
6192         is_defined_in_discarded_section.
6193         * resolve.cc (Symbol::override_base_with_special): Don't test
6194         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6195         * target-reloc.h (relocate_section): Do special handling for
6196         symbols defined in discarded sections for global symbols as well
6197         as local symbols.
6198
6199 2010-01-08  Ian Lance Taylor  <iant@google.com>
6200
6201         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6202         the SHT_SYMTAB case.
6203
6204 2010-01-08  Ian Lance Taylor  <iant@google.com>
6205
6206         * object.cc (Sized_relobj::do_layout): Don't get confused if
6207         layout_eh_frame returns NULL.
6208
6209 2010-01-08  Ian Lance Taylor  <iant@google.com>
6210
6211         PR 11084
6212         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6213         dynamic symbol table, use the normal symbol table.
6214         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6215         symbol table.
6216
6217 2010-01-08  Ian Lance Taylor  <iant@google.com>
6218
6219         PR 11072
6220         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6221         sections.
6222
6223 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6224
6225         * version.cc (print_version): Change to "Copyright 2010".
6226
6227 2010-01-08  Ian Lance Taylor  <iant@google.com>
6228
6229         PR 10287
6230         PR 11063
6231         * i386.cc (class Target_i386): Change return type of plt_section
6232         to be non-const.
6233         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6234         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6235         tls_desc_rel_ field.
6236         (Output_data_plt_i386::rel_tls_desc): New function.
6237         (Target_i386::rel_tls_desc_section): New function.
6238         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6239         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6240         R_386_TLS_DESC reloc in rel_tls_desc_section.
6241         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6242         Define struct Tlsdesc_info.
6243         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6244         (Target_x86_64::do_reloc_symbol_index): New function.
6245         (Target_x86_64::add_tlsdesc_info): New function.
6246         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6247         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6248         tlsdesc_rel_ field.
6249         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6250         all callers.
6251         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6252         (Target_x86_64::rela_tlsdesc_section): New function.
6253         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6254         handling.
6255         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6256         (Target_x86_64::do_reloc_addend): New function.
6257         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6258         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6259         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6260         (Output_reloc::type): New function.
6261         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6262         (Output_reloc::is_target_specific): New function.
6263         (Output_reloc::target_arg): New function.
6264         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6265         absolute relocs and target specific relocs.
6266         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6267         add_target_specific.
6268         (class Output_data_reloc) [SHT_RELA]: Likewise.
6269         * output.cc (Output_reloc::Output_reloc): Add four new versions
6270         for absolute relocs and target specific relocs.
6271         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6272         (Output_reloc::get_symbol_index): Likewise.
6273         (Output_reloc::local_section_offset): Check that local_sym_index_
6274         is not TARGET_CODE or 0.
6275         (Output_reloc::symbol_value): Likewise.
6276         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6277         reloc.
6278         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6279         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6280         functions.
6281         * layout.cc (add_target_dynamic_tags): Use output section for
6282         DT_PLTRELSZ and DT_JMPREL.
6283
6284 2010-01-07  Ian Lance Taylor  <iant@google.com>
6285
6286         PR 11061
6287         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6288         function.
6289         (class Output_data_reloc_generic): Define.
6290         (class Output_data_reloc_base): Change base class to
6291         Output_data_reloc_generic.  Change add() method to call
6292         bump_relative_reloc_count for a relative reloc.  Remove
6293         sort_relocs_ field.
6294         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6295         to sort_relocs().
6296         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6297         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6298         appropriate.
6299         * layout.h (class Layout): Update declaration.
6300
6301 2010-01-07  Ian Lance Taylor  <iant@google.com>
6302
6303         * output.h (class Output_data): Add const version of
6304         output_section and do_output_section.
6305         (class Output_section_data): Add const version of
6306         do_output_section.
6307         (class Output_section): Likewise.
6308         * layout.cc (Layout::add_target_dynamic_tags): New function.
6309         * layout.h (class Layout): Update declarations.
6310         * arm.cc (Target_arm::do_finalize_sections): Use
6311         add_target_dynamic_tags.
6312         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6313         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6314         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6315         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6316
6317 2010-01-07  Ian Lance Taylor  <iant@google.com>
6318
6319         PR 11042
6320         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6321         object as needed.
6322
6323 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6324             Ian Lance Taylor  <iant@google.com>
6325
6326         PR 11019
6327         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6328         Xindex::read_symtab_xindex.
6329
6330 2010-01-07  Doug Kwan  <dougkwan@google.com>
6331
6332         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6333         (Insn_template::thumb16_bcond_insn): New method declaration.
6334         (Insn_template): Fix spelling.
6335         (Stub::thumb16_special): New method declaration.
6336         (Stub::do_write): Define virtual method which was previously pure
6337         virtual.
6338         (Stub::do_thumb16_special): New method declaration.
6339         (Stub::do_fixed_endian_write): New template member.
6340         (Reloc_stub::do_write): Remove.
6341         (Reloc_stub::do_fixed_endian_write): Remove.
6342         (Cortex_a8_stub): New class definition.
6343         (Stub_factory::make_cortex_a8_stub): New method definition.
6344         (Stub_factory::Stub_factory): Add missing static storage class
6345         qualifier for elf32_arm_stub_a8_veneer_blx.
6346
6347 2010-01-07  Ian Lance Taylor  <iant@google.com>
6348
6349         PR 10980
6350         * options.h (class General_options): Add --warn-unresolved-symbols
6351         and --error-unresolved-symbols.
6352         * errors.cc (Errors::undefined_symbol): Implement
6353         --warn-unresolved-symbols.
6354
6355         * options.h (class General_options): Add -z text and -z textoff.
6356         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6357
6358 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6359
6360         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6361         (Garbage_collection::cident_sections): New function.
6362         (Garbage_collection::add_cident_section): New function.
6363         (Garbage_collection::cident_sections_): New member.
6364         (gc_process_relocs): Add references to sections whose names are C
6365         identifiers.
6366         * gold.h (cident_section_start_prefix): New constant.
6367         (cident_section_stop_prefix): New constant.
6368         (is_cident): New function.
6369         * layout.cc (Layout::define_section_symbols): Replace string constants
6370         with the newly defined constants.
6371         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6372         C identifiers.
6373         * testsuite/Makefile.am: Add gc_orphan_section_test.
6374         * testsuite/Makefile.in: Regenerate.
6375         * testsuite/gc_orphan_section_test.cc: New file.
6376         * testsuite/gc_orphan_section_test.sh: New file.
6377
6378 2010-01-06  Ian Lance Taylor  <iant@google.com>
6379
6380         PR 10980
6381         * options.h (class General_options): Add --warn-shared-textrel.
6382         * layout.cc (Layout::finish_dynamic_section): Implement
6383         --warn-shared-textrel.
6384
6385         PR 10980
6386         * options.h (class General_options): Add --warn-multiple-gp.
6387
6388 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6389
6390         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6391         $(THREADSLIB) and $(LIBDL).
6392         * Makefile.in: Rebuild.
6393
6394 2010-01-06  Ian Lance Taylor  <iant@google.com>
6395
6396         PR 10980
6397         * options.cc (General_options::parse_section_start): New function.
6398         (General_options::section_start): New function.
6399         (General_options::General_options): Initialize all members.
6400         * options.h: Include <map>
6401         (class General_options): Add --section-start.  Add section_starts_
6402         member.
6403         * layout.cc (Layout::attach_allocated_section_to_segment): If
6404         --section-start was used, set the address of the segment.  Remove
6405         local sort_sections.
6406         (Layout::relaxation_loop_body): If the address of the load segment
6407         has been set by --section-start, don't use it.
6408         * output.h (Output_segment::update_flags_for_output_section): New
6409         function.
6410         * output.cc (Output_segment::add_output_section): Call
6411         update_flags_for_output_section.
6412
6413 2010-01-05  Ian Lance Taylor  <iant@google.com>
6414
6415         PR 10980
6416         * options.h (class General_options): Add --undefined-version.
6417         * script.cc (struct Version_expression): Add was_matched_by_symbol
6418         field.
6419         (Version_script_info::matched_symbol): New function.
6420         (Version_script_info::get_symbol_version_helper): Call
6421         matched_symbol.
6422         (Version_script_info::check_unmatched_names): New function.
6423         * script.h (class Version_script_info): Update declarations.
6424         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6425
6426         * options.h (class General_options): Use DEFINE_bool_alias for
6427         allow_multiple_definition.
6428         * resolve.cc (Symbol_table::should_override): Don't test
6429         allow_multiple_definition.
6430
6431         PR 10980
6432         * options.h (class General_options): Add --cref.
6433         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6434         until after printing cref table.
6435         * cref.cc: Include "symtab.h".
6436         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6437         (Cref_table_compare::operator()): New function.
6438         (Cref_inputs::gather_cref): New function.
6439         (filecol): New static const.
6440         (Cref_inputs::print_cref): New function.
6441         (Cref::print_cref): New function.
6442         * cref.h: Include <cstdio>.
6443         (class Cref): Update declarations.
6444         * mapfile.h (Mapfile::file): New function.
6445         * object.h (class Object): Define Symbols.  Declare virtual
6446         do_get_global_symbols.
6447         (Object::get_global_symbols): New function.
6448         * object.cc (Input_objects::add_object): Pass object to cref_ if
6449         --cref.
6450         (Input_objects::archive_start): Likewise.
6451         (Input_objects::archive_stop): Likewise.
6452         (Input_objects::print_cref): New function.
6453         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6454         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6455         --cref.
6456         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6457         function.
6458         * plugin.h (class Sized_pluginobj): Update declarations.
6459
6460 2010-01-05  Ian Lance Taylor  <iant@google.com>
6461
6462         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6463         to is_default_version.  Rename insdef to insdefault.
6464         (Symbol_table::add_from_relobj): Rename def to is_default_version
6465         and local to is_forced_local.
6466         (Symbol_table::add_from_pluginobj): Likewise.
6467         (Symbol_table::add_from_dynobj): Likewise.
6468         (Symbol_table::define_special_symbol): Rename insdef to
6469         insdefault.
6470
6471 2010-01-04  Ian Lance Taylor  <iant@google.com>
6472
6473         PR 10980
6474         * options.h (class General_options): Add
6475         --allow-multiple-definition and -z muldefs.
6476         * resolve.cc (Symbol_table::should_override): Don't warn about a
6477         multiple symbol definition if --allow-multiple-definition or -z
6478         muldefs.
6479
6480         PR 10980
6481         * options.h (class General_options): Add --add-needed and
6482         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6483         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6484         error if --copy-dt-needed-entries aka --add-needed is used and
6485         would cause a change in behaviour.
6486
6487         PR 10980
6488         * options.h (class General_options): Add -G as a short version of
6489         --shared.  Add no-op options -assert, -g, and -i.
6490
6491 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6492
6493         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6494         check for .text or .gnu.linkonce.t sections.
6495         * icf.cc (Icf::find_identical_sections): Ditto.
6496         Change the detection for mangled function name within the section
6497         name.
6498         * icf.h (is_section_foldable_candidate): New function.
6499
6500 2009-12-30  Ian Lance Taylor  <iant@google.com>
6501
6502         PR 10980
6503         * options.h (class General_options): Permit two dashes with
6504         --retain-symbols-file.
6505
6506 2009-12-30  Ian Lance Taylor  <iant@google.com>
6507
6508         PR 10979
6509         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6510         don't put the file header and segment headers in the text
6511         segment.
6512
6513         PR 10979
6514         * common.cc (Sort_commons::operator()): Stabilize sort when both
6515         entries are NULL.
6516         (Symbol_table::do_allocate_commons_list): When allocating common
6517         symbols, skip a symbol which is no longer common.
6518         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6519         an object before checking its type.
6520         * testsuite/common_test_2.c: New file.
6521         * testsuite/common_test_3.c: New file.
6522         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6523         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6524         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6525         (common_test_2_pic.o, common_test_2.so): New targets.
6526         (common_test_3_pic.o, common_test_3.so): New targets.
6527         * testsuite/Makefile.in: Rebuild.
6528
6529         PR 10979
6530         * script.cc (read_input_script): If we see a new SECTIONS clause,
6531         and we have added an input section, give an error.
6532         * layout.h (class Layout): Add have_added_input_section function.
6533         Add have_added_input_section_ field.
6534         * layout.cc (Layout::Layout): Initialize
6535         have_added_input_section_.
6536         (Layout::layout): Set have_added_input_section_.
6537         (Layout::layout_eh_frame): Likewise.
6538
6539 2009-12-30  Ian Lance Taylor  <iant@google.com>
6540
6541         PR 10931
6542         * options.h (class General_options): Add --sort-common option.
6543         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6544         * common.cc (Sort_common): Add sort_order parameter to
6545         constructor.  Add sort_order_ field.
6546         (Sort_commons::operator): Check sort_order_.
6547         (Symbol_table::allocate_commons): Determine the sort order.
6548         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6549         Change all callers.
6550         (Symbol_table::do_allocate_commons_list): Likewise.
6551
6552 2009-12-30  Ian Lance Taylor  <iant@google.com>
6553
6554         PR 10916
6555         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6556         symbols from this object, don't change the visibility of an
6557         undefined symbol.
6558         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6559
6560 2009-12-30  Ian Lance Taylor  <iant@google.com>
6561
6562         PR 10861
6563         * script.h (class Version_script_info): Define Language enum.
6564         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6565         new fields globals_, locals_, and is_finalized_.
6566         * script.cc: Various formatting fixes.
6567         (class Parser_closure): Change language_stack_ from a vector of
6568         std::string to one of Version_script_info::Language.  Adjust all
6569         uses accordingly.
6570         (class Lazy_demangler): Remove.
6571         (struct Version_expression): Change language from std::string to
6572         Version_script_info::Language.
6573         (Version_script_info::Version_script_info): New function.
6574         (Version_script_info::~Version_script_info): Don't call clear.
6575         (Version_script_info::finalize): New function.
6576         (Version_script_info::build_lookup_tables): New function.
6577         (Version_script_info::build_expression_list_lookup): New
6578         function.
6579         (Version_script_info::get_symbol_version_helper): Rewrite to use
6580         lookup tables.
6581         (Version_script_info::print_expression_list): Adjust to use
6582         Version_script_info::Language.
6583         (script_push_lex_into_version_mode): Check that the version script
6584         has not been finalized.
6585         (version_script_push_lang): Change language string to
6586         Version_script_info::Language.
6587         * options.cc (Command_line::version_script): New function.
6588         * options.h (class General_options): Add finalize_dynamic_list
6589         function.  Change version_script from declaration to definition.
6590         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6591         * testsuite/version_script.map: Remove duplicate def of foo.
6592         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6593         version_script.map.
6594         * testsuite/Makefile.in: Rebuild.
6595
6596 2009-12-30  Ian Lance Taylor  <iant@google.com>
6597
6598         PR 10843
6599         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6600         if the input symbol index is 0, make the output symbol index 0.
6601
6602 2009-12-30  Ian Lance Taylor  <iant@google.com>
6603
6604         PR 10670
6605         * options.h (class General_options): Add -x/--discard-all.
6606         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6607         --discard-all.  If the local symbol needs a dynamic entry, check
6608         that before handling --discard-locals.
6609
6610 2009-12-30  Ian Lance Taylor  <iant@google.com>
6611
6612         PR 10450
6613         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6614         flags to PF_R.
6615         (Output_segment::add_output_section): Don't change the flags if
6616         the type is PT_TLS.
6617
6618         PR 10450
6619         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6620         GNU hash table if they need a dynamic value.  Otherwise, don't add
6621         them if they are defined in a dynamic object or are forced local.
6622
6623 2009-12-29  Ian Lance Taylor  <iant@google.com>
6624
6625         PR 10450
6626         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6627         .gnu.hash table for a 32-bit target.
6628
6629         PR 10450
6630         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6631         regular and a dynamic object only needs a dynamic symbol table
6632         entry if it is externally visible.
6633
6634         PR 10450
6635         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6636         constructor.  Add global_offset_table_ field.
6637         (Target_i386::got_section): Set global_offset_table_.
6638         (Target_i386::do_finalize_sections): Set global_offset_table_
6639         size.
6640         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6641         in constructor.  Add global_offset_table_ field.
6642         (Target_x86_64::got_section): Set global_offset_table_.
6643         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6644         size.
6645
6646         * layout.cc (Layout::Layout): Initialize increase_relro_.
6647         (Layout::get_output_section): Add is_relro, is_last_relro, and
6648         is_first_non_relro parameters.  Change all callers.
6649         (Layout::choose_output_section): Likewise.
6650         (Layout::add_output_section_data): Likewise.
6651         (Layout::make_output_section): Likewise.
6652         (Layout::set_segment_offsets): Clear increase_relro when using a
6653         linker script.
6654         * layout.h (class Layout): Add increase_relro method.  Add
6655         increase_relro_ field.  Update declarations.
6656         * output.cc (Output_section::Output_section): Initialize
6657         is_last_relro_ and is_first_non_relro_.
6658         (Output_segment::add_output_section): Group relro sections is
6659         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6660         (Output_segment::maximum_alignment): Remove relro handling.
6661         (Output_segment::set_section_addresses): Add increase_relro
6662         parameter.  Change all callers.  Add initial alignment to align
6663         relro sections on separate page.  Remove old relro handling.
6664         (Output_segment::set_section_list_addresses): Remove in_relro
6665         parameter.  Change all callers.
6666         (Output_segment::set_offset): Add increase parameter.  Change all
6667         callers.  Remove old relro handling.
6668         * output.h (class Output_section): Add new methods: is_last_relro,
6669         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6670         Add is_last_relro_ and is_first_non_relro_ fields.
6671         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6672         Create separate .got.plt section.  Call increase_relro.
6673         * x86_64.cc (Target_x86_64::got_section): Likewise.
6674         * testsuite/relro_script_test.t: Add .got.plt.
6675
6676         PR 10450
6677         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6678         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6679         (Layout::finalize): Call set_dynamic_symbol_size.
6680         (Layout::set_dynamic_symbol_size): New function.
6681         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6682         set_dynamic_symbol_size.
6683
6684         PR 10450
6685         * output.h (class Output_section): Add is_entsize_zero_ field.
6686         * output.cc (Output_section::Output_section): Initialize
6687         is_entsize_zero_.
6688         (Output_section::set_entsize): If two different entsizes are
6689         requested, force it to zero.
6690         (Output_section::add_input_section): Set flags for .debug_str
6691         before updating section flags.  Set entsize.
6692         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6693         and SHF_STRING if all input sections have those flags.
6694
6695 2009-12-29   Rafael Espindola  <espindola@google.com>
6696
6697         * main.cc (main): Fix the sys time reporting.
6698         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6699         reporting.
6700
6701 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6702
6703         * options.cc (General_options::parse_version): Allow -v to exit
6704         without an error if there is nothing to link.
6705
6706 2009-12-29  Ian Lance Taylor  <iant@google.com>
6707
6708         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6709         using a version of gcc before 4.1.
6710         * configure: Rebuild.
6711
6712 2009-12-28  Chris Demetriou  <cgd@google.com>
6713
6714         * attributes.cc (Output_attributes_section_data::do_write): Use
6715         std::vector::front rather than std::vector::data.
6716
6717 2009-12-28  Ian Lance Taylor  <iant@google.com>
6718
6719         * symtab.h (class Symbol_table): Add enum Defined.
6720         * resolve.cc (Symbol_table::should_override): Add defined
6721         parameter.  Change all callers.  Test whether object is NULL
6722         before calling a method on it.
6723         (Symbol_table::report_resolve_problem): Add defined parameter.
6724         Change all callers.
6725         (Symbol_table::should_override_with_special): Likewise.
6726         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6727         parameter.  Change all callers.
6728         (Symbol_table::do_define_in_output_data): Likewise.
6729         (Symbol_table::define_in_output_segment): Likewise.
6730         (Symbol_table::do_define_in_output_segment): Likewise.
6731         (Symbol_table::define_as_constant): Likewise.
6732         (Symbol_table::do_define_as_constant): Likewise.
6733         * script.h (class Symbol_assignment): Add is_defsym parameter to
6734         constructor; change all callers.
6735         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6736         parameter.  Change all callers.  Add is_defsym_ field.
6737         (class Parser_closure): Add parsing_defsym parameter to
6738         constructor; change all callers.  Add parsing_defsym accessor
6739         function.  Add parsing_defsym_ field.
6740
6741 2009-12-28  Ian Lance Taylor  <iant@google.com>
6742
6743         * gold.cc (queue_middle_tasks): Fix formatting.
6744         * object.cc (Relobj::is_section_name_included): Likewise.
6745
6746 2009-12-23  Ian Lance Taylor  <iant@google.com>
6747
6748         * i386.cc (Target_i386::do_calls_non_split): Recognize
6749         -fsplit-stack prologue for a function with a static chain.
6750         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6751         -fsplit-stack prologue when using %r11.
6752
6753 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6754
6755         * options.cc (General_options::parse_version): Make -v continue and do
6756         the link like GNU ld does.
6757
6758 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6759
6760         * Makefile.am (CCFILES): Add timer.cc.
6761         (HFILES): Add timer.h.
6762         * configure.ac: Check for sysconf and times.
6763         * main.cc: include timer.h.
6764         (main): Use Timer instead of get_run_time.
6765         * timer.cc: New.
6766         * timer.h: New.
6767         * workqueue.cc: include timer.h.
6768         (Workqueue::find_and_run_task):
6769         Report user, sys and wall time.
6770         * Makefile.in: Regenerate.
6771         * config.in: Regenerate.
6772         * configure: Regenerate.
6773
6774 2009-12-16  Doug Kwan  <dougkwan@google.com>
6775
6776         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6777         sections.
6778         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6779         relaxed input sections.
6780         * output.cc (Output_section::find_relaxed_input_section): Change
6781         return type to Output_relaxed_input_section pointer.  Adjust code
6782         for new type of relaxed_input_section_map_.
6783         * output.h (Output_section::find_relaxed_input_section): Change
6784         return type to Output_relaxed_input_section pointer.
6785         (Output_section::Output_relaxed_input_section_by_input_section_map):
6786         New type.
6787         (Output_section::relaxed_input_section_map_): Change type to
6788         Output_section::Output_relaxed_input_section_by_input_section_map.
6789         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6790         input section.
6791
6792 2009-12-15  Ian Lance Taylor  <iant@google.com>
6793
6794         * layout.cc (Layout::create_shstrtab): Only write out after input
6795         sections if we are compressing debug sections.
6796
6797 2009-12-15  Ian Lance Taylor  <iant@google.com>
6798
6799         * archive.cc (Archive::add_symbols): Only look up a symbol without
6800         a version if there is, in fact, a version.
6801
6802 2009-12-14  Ian Lance Taylor  <iant@google.com>
6803
6804         Revert -Wshadow changes, all changes from:
6805         2009-12-11  Doug Kwan  <dougkwan@google.com>
6806         2009-12-11  Nick Clifton  <nickc@redhat.com>
6807         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6808
6809 2009-12-11  Doug Kwan  <dougkwan@google.com>
6810
6811         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6812         due to -Wshadow.
6813         * attributes.cc (Object_attribute::size): Ditto.
6814         (Attributes_section_data::size): Ditto.
6815         (Attributes_section_data::Attributes_section_data): Ditto.
6816         (Output_attributes_section_data::do_write): Ditto.
6817         * attributes.h (Object_attribute::set_type): Ditto.
6818         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6819
6820 2009-12-11  Nick Clifton  <nickc@redhat.com>
6821
6822         * archive.cc: Fix shadowed variable warnings.
6823         * arm.cc: Likewise.
6824         * compressed_output.cc: Likewise.
6825         * compressed_output.h: Likewise.
6826         * configure: Likewise.
6827         * dwarf_reader.cc: Likewise.
6828         * dynobj.cc: Likewise.
6829         * dynobj.h: Likewise.
6830         * ehframe.cc: Likewise.
6831         * ehframe.h: Likewise.
6832         * errors.cc: Likewise.
6833         * expression.cc: Likewise.
6834         * fileread.cc: Likewise.
6835         * fileread.h: Likewise.
6836         * freebsd.h: Likewise.
6837         * i386.cc: Likewise.
6838         * icf.cc: Likewise.
6839         * incremental.h: Likewise.
6840         * layout.cc: Likewise.
6841         * layout.h: Likewise.
6842         * mapfile.cc: Likewise.
6843         * merge.cc: Likewise.
6844         * merge.h: Likewise.
6845         * object.cc: Likewise.
6846         * object.h: Likewise.
6847         * options.h: Likewise.
6848         * output.cc: Likewise.
6849         * output.h: Likewise.
6850         * parameters.cc: Likewise.
6851         * plugin.cc: Likewise.
6852         * powerpc.cc: Likewise.
6853         * reduced_debug_output.cc: Likewise.
6854         * reduced_debug_output.h: Likewise.
6855         * reloc.cc: Likewise.
6856         * reloc.h: Likewise.
6857         * resolve.cc: Likewise.
6858         * script-sections.cc: Likewise.
6859         * script.cc: Likewise.
6860         * script.h: Likewise.
6861         * sparc.cc: Likewise.
6862         * symtab.cc: Likewise.
6863         * symtab.h: Likewise.
6864         * target-select.cc: Likewise.
6865         * target-select.h: Likewise.
6866         * token.h: Likewise.
6867         * workqueue.cc: Likewise.
6868         * workqueue.h: Likewise.
6869         * x86_64.cc: Likewise.
6870
6871 2009-12-10  Doug Kwan  <dougkwan@google.com>
6872
6873         * arm.cc (attributes.h): New include.
6874         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6875         (Arm_relobj::~Arm_relobj): Delete object pointed by
6876         attributes_section_data_.
6877         (Arm_relobj::attributes_section_data): New method definition.
6878         (Arm_relobj::attributes_section_data_): New data member declaration.
6879         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6880         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6881         attributes_section_data_.
6882         (Arm_dynobj::attributes_section_data): New method definition.
6883         (Arm_dynobj::attributes_section_data_): New data member declaration.
6884         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6885         initialization value of may_use_blx_ to false.
6886         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6887         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6888         object attributes to compute results instead of hard-coding.
6889         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6890         Target_arm::get_secondary_compatible_arch,
6891         Target_arm::set_secondary_compatible_arch
6892         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6893         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6894         New method declarations.
6895         (Target_arm::get_aeabi_object_attribute): New method definition.
6896         (Target_arm::attributes_section_data_): New data member declaration.
6897         (read_arm_attributes_section): New template definition.
6898         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6899         (Arm_dynobj::do_read_symbols): Ditto.
6900         (Target_arm::do_finalize_sections): Merge attributes sections from
6901         input.  Check for BLX use after attributes section merging.
6902         Fix __exidx_start and __exidx_end visibility.  Create an
6903         .ARM.attributes section if necessary.
6904         (Target_arm::get_secondary_compatible_arch,
6905         Target_arm::set_secondary_compatible_arch,
6906         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6907         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6908         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6909         New method definitions.
6910
6911 2009-12-09  Ian Lance Taylor  <iant@google.com>
6912
6913         * plugin.cc (Plugin::load): Don't cast from void* to a function
6914         pointer.
6915
6916 2009-12-09  Ian Lance Taylor  <iant@google.com>
6917
6918         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6919         information fields.
6920
6921 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6922
6923         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6924         Replace two_file_shared_1.so with two_file_shared_2.so.
6925         * testsuite/Makefile.in: Regenerated.
6926
6927 2009-12-08  Doug Kwan  <dougkwan@google.com>
6928
6929         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6930         (HFILES): Add attributes.h and int_encoding.h.
6931         * Makefile.in: Regenerate.
6932         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6933         function definitions to int_encoding.cc
6934         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6935         prototypes to int_encoding.h
6936         * reduced_debug_output.cc (int_encoding.h): New include.
6937         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6938         function definitions to int_encoding.cc
6939         (insert_into_vector, read_from_pointer): Move template definitions to
6940         int_encoding.h
6941         * attributes.cc: New file.
6942         * attributes.h: New file.
6943         * int_encoding.cc: New file.
6944         * int_encoding.h: New file.
6945
6946 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6947
6948         PR gold/11055
6949         * incremental-dump.cc (dump_incremental_inputs): New.
6950         (main): Use dump_incremental_inputs.
6951
6952 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6953
6954         PR gold/10893
6955         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6956         checking elfcpp::STT_FUNC.
6957         (Target_i386::Relocate::relocate): Likewise.
6958         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6959
6960         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6961         symbols from shared libraries into normal FUNC symbols.
6962
6963         * symtab.h (Symbol): Add is_func and use it.
6964
6965 2009-12-05  Doug Kwan  <dougkwan@google.com>
6966
6967         * arm.cc (Target_arm::arm_info): Initialize new fields
6968         attributes_section and attributes_vendor.
6969         * i386.cc (Target_i386::i386_info): Same.
6970         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6971         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6972         fields attributes_section and attributes_vendor.
6973         * sparc.cc (Target_sparc::sparc_info): Same.
6974         * target.h (Target::attributes_section, Target::attributes_vendor,
6975         Target::is_attributes_section, Target::attribute_arg_type,
6976         Target::attributes_order): New method definitions.
6977         (Target::Target_info::attributes_section,
6978         Target::Target_info::attributes_vendor): New fields.
6979         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6980         virtual method definitions.
6981         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6982         attributes_section and attributes_vendor.
6983         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6984
6985 2009-12-05  Doug Kwan  <dougkwan@google.com>
6986
6987         * arm.cc: Update comments about interworking and stub generation.
6988         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6989         considered as non-PIC.
6990         (Arm_relocate_functions::base_abs): Fix formatting.
6991         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6992         of function to use GOT entry address instead of offset.
6993         (Target_arm::Scan::global): Issue an error if a symbol would need a
6994         PLT does not get one because it is untyped.  Remove code to create
6995         dynamic symbols for relative branches.
6996         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6997         takes unsigned integer instead of boolean.
6998
6999 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7000
7001         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7002         (two_file_test_LDADD): Likewise.
7003         (common_test_1_LDADD): Likewise.
7004         (exception_test_LDADD) Likewise.
7005         (weak_test_LDADD): Likewise.
7006         (many_sections_test_LDADD): Likewise.
7007         (initpri1_LDADD): Likewise.
7008         (script_test_1_LDADD): Likewise.
7009         (script_test_2_LDADD): Likewise.
7010         (justsyms_LDADD): Likewise.
7011         (binary_test_LDADD): Likewise.
7012         (large_LDADD): Likewise.
7013         * testsuite/Makefile.in: Regenerated.
7014
7015 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7016
7017         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7018         (Symbol_table::override_with_special): Likewise.
7019         (Symbol_table::add_from_object): Likewise.
7020
7021 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7022
7023         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7024         Don't set the data_offset twice.
7025
7026 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7027
7028         * testsuite/Makefile.in: Regenerate.
7029
7030 2009-12-03  Doug Kwan  <dougkwan@google.com>
7031
7032         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7033         (Target_arm::do_finalize_sections): Add parameter for symbol table
7034         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7035         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7036         parameter for symbol table pointer.
7037         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7038         an additional parameter for a pointer to symbol table.
7039         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7040         parameter for a symbol table pointer.
7041         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7042         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7043         Ditto.
7044         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7045         parameter for a symbol table pointer.
7046
7047 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7048
7049         * incremental.cc (Incremental_inputs_header)
7050         (Incremental_inputs_header_write, Incremental_inputs_entry)
7051         (Incremental_inputs_entry_write): Move ...
7052         * incremental.h (Incremental_inputs_header)
7053         (Incremental_inputs_header_write, Incremental_inputs_entry)
7054         (Incremental_inputs_entry_write): here.
7055
7056 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7057
7058         * incremental.cc (make_sized_incremental_binary): Set the target.
7059         Error if it is incompatible.
7060         * output.h (Output_file): Add filename method.
7061
7062 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7063
7064         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7065         from the get_* methods.
7066
7067 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7068
7069         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7070         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7071         Write 0 for the data_offset of scripts.
7072
7073 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7074
7075         * testsuite/Makefile.am: Add the incremental_test.sh test.
7076         * testsuite/incremental_test.sh: New.
7077         * testsuite/incremental_test_1.c: New.
7078         * testsuite/incremental_test_2.c: New.
7079
7080 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7081
7082        * incremental-dump.cc (main): Fix typos.
7083
7084 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7085
7086         PR gold/11025
7087         * incremental-dump.cc (main): Use llu to print 64 bit values.
7088
7089 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7090             H.J. Lu  <hongjiu.lu@intel.com>
7091
7092         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7093         $(LIBDL).
7094         (incremental_dump_LDADD): Likewise.
7095         * Makefile.in: Regenerated.
7096
7097 2009-11-25  Doug Kwan  <dougkwan@google.com>
7098
7099         Revert:
7100
7101         2009-11-25  Doug Kwan  <dougkwan@google.com>
7102
7103                 * arm.cc (Target_arm::Target_arm): Move method definition
7104                 outside of class definition.  Add code to handle
7105                 --target1-rel, --target1-abs and --target2= options.
7106                 (Target_arm::get_reloc_reloc_type): Change method to be
7107                 non-static and const.
7108                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7109                 New data member declaration.
7110                 (Target_arm::Scan::local, Target_arm::Scan::global,
7111                 Target_arm::Relocate::relocate,
7112                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7113                 Adjust call to Target_arm::get_real_reloc_type.
7114                 (Target_arm::get_real_reloc_type): Use command line options
7115                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7116                 * options.h (--target1-rel, --target1-abs, --target2): New
7117                 ARM-only options.
7118
7119 2009-11-25  Doug Kwan  <dougkwan@google.com>
7120
7121         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7122         class definition.  Add code to handle --target1-rel, --target1-abs
7123         and --target2= options.
7124         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7125         and const.
7126         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7127         member declaration.
7128         (Target_arm::Scan::local, Target_arm::Scan::global,
7129         Target_arm::Relocate::relocate,
7130         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7131         call to Target_arm::get_real_reloc_type.
7132         (Target_arm::get_real_reloc_type): Use command line options to
7133         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7134         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7135         options.
7136
7137 2009-11-25  Doug Kwan  <dougkwan@google.com>
7138
7139         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7140         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7141         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7142         formatting.
7143         (Arm_relocate_functions::thm_call): Replace body with a call to
7144         Arm_relocate_functions::thumb_branch_common.
7145         (Arm_relocate_functions::thm_jump24,
7146         Arm_relocate_functions::thm_xpc22): New method definitions.
7147         (Arm_relocate_functions::thumb_branch_common): New method definition.
7148         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7149         operator.
7150         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7151         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7152
7153 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7154
7155         * Makefile.am: Build incremental-dump
7156         * Makefile.in: Regenerate.
7157         * incremental-dump.cc: New.
7158         * incremental.cc (Incremental_inputs_header_data,
7159         Incremental_inputs_entry_data): Move to incremental.h
7160         * incremental.h: (Incremental_inputs_header_data,
7161         Incremental_inputs_entry_data): Move from incremental.cc
7162
7163 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7164
7165         * incremental.cc (Incremental_inputs_header,
7166         Incremental_inputs_header_write, Incremental_inputs_entry,
7167         Incremental_inputs_entry_write): Add a typedef with the data type.
7168
7169 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7170
7171         * incremental.cc (Incremental_inputs_header,
7172         Incremental_inputs_header_write, Incremental_inputs_entry,
7173         Incremental_inputs_entry_write): Update comment about which
7174         type has the filed descriptions.
7175
7176 2009-11-15  Doug Kwan  <dougkwan@google.com>
7177
7178         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7179         (Arm_relocate_functions::arm_branch_common): Change method defintion
7180         in class definition to a method declaration and update list of formal
7181         parameters.
7182         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7183         Arm_relocation_functions::jump24): Adjust call to
7184         Arm_relocate_functions::arm_branch_common.  Update list of formal
7185         parameters.
7186         (Arm_relocate_functions::xpc25): New method definition.
7187         (Arm_relocate_functions::arm_branch_common): Move method defintion
7188         out from class definition.  Use stubs for mode-switching and extending
7189         branch ranges.
7190         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7191         specially.  Change code to enable use of stubs in ARM branches.
7192
7193 2009-11-10  Doug Kwan  <dougkwan@google.com>
7194
7195         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7196         in method declaration.
7197         (Target_arm::relocate_stub): New method declaration.
7198         (Target_arm::default_target): Change to return a pointer instead of
7199         a const reference.
7200         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7201         Target_arm::default_target.
7202         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7203         method definition.
7204         (Target_arm::relocate_section): Adjust view.
7205         (Target_arm::relocate_stub): New method definition.
7206
7207 2009-11-10  Doug Kwan  <dougkwan@google.com>
7208
7209         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7210         a format warning.
7211         * incremental.cc (open_incremental_binary): Initialized local
7212         variables to avoid warnings.
7213         * object.cc (make_elf_object): Ditto.
7214         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7215         a format warning.
7216
7217 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7218
7219         PR gold/10930
7220         * testsuite/plugin_test.c: Include "config.h".
7221
7222 2009-11-09  Doug Kwan  <dougkwan@google.com>
7223
7224         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7225         (arm_symbol_value): Remove.
7226         (Arm_relocate_functions::arm_branch_common,
7227         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7228         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7229         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7230         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7231         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7232         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7233         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7234         Arm_relocate_functions::thm_mobw_abs_nc,
7235         Arm_relocate_functions::thm_mov_abs,
7236         Arm_relocate_functions::movw_prel_nc,
7237         Arm_relocate_functions::thm_movt_abs,
7238         Arm_relocate_functions::movt_prel,
7239         Arm_relocate_functions::thm_movw_prel_nc,
7240         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7241         (Target_arm::Relocate::relocate): Only decompose address into two
7242         parts if relocation type uses the thumb-bit and pass the actual
7243         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7244         calls to methods in Arm_relocate_functions for this change.
7245
7246 2009-11-08  Ian Lance Taylor  <iant@google.com>
7247
7248         PR 10925
7249         * reloc.cc: Instantiate
7250         Sized_relobj::initialize_input_to_output_maps and
7251         Sized_relobj:free_input_to_output_maps.
7252
7253 2009-11-06  Ian Lance Taylor  <iant@google.com>
7254
7255         PR 10876
7256         * defstd.cc (in_segment): Set only_if_ref true for "end".
7257
7258 2009-11-06  Doug Kwan  <dougkwan@google.com>
7259
7260         * arm.cc (class Reloc_stub): Correct a comment.
7261         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7262         (Target_arm::scan_section_for_stubs): New method declaration.
7263         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7264         Change methods from private to protected.
7265         (Target_arm::do_may_relax): New method definition.
7266         (Target_arm::do_relax, Target_arm::group_sections,
7267         Target_arm::scan_reloc_for_stub,
7268         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7269         (Target_arm::arm_input_section_map_): New data member declaration.
7270         (Target_arm::scan_reloc_for_stub,
7271         Target_arm::scan_reloc_section_for_stubs,
7272         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7273         Target_arm::do_relax): New method definitions.
7274
7275 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7276
7277         * configure.ac: Check for (struct stat)::st_mtim
7278         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7279         * config.in: Regenerate.
7280         * configure: Regenerate.
7281
7282 2009-11-05  Ian Lance Taylor  <iant@google.com>
7283
7284         PR 10910
7285         * output.cc (Output_segment::add_output_section): Add missing
7286         return statement.
7287
7288 2009-11-04  Ian Lance Taylor  <iant@google.com>
7289
7290         PR 10880
7291         * object.h (class Object): Add is_needed and set_is_needed
7292         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7293         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7294         defined in a dynamic object and referenced by a regular object,
7295         set is_needed for the dynamic object.
7296         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7297         if the file is marked with as_needed and it is not needed.
7298
7299 2009-11-04  Ian Lance Taylor  <iant@google.com>
7300
7301         PR 10887
7302         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7303         tags if data is discarded by linker script.
7304         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7305         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7306         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7307         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7308
7309 2009-11-04  Ian Lance Taylor  <iant@google.com>
7310
7311         * layout.cc (Layout::get_output_section): Add is_interp and
7312         is_dynamic_linker_section parameters.  Change all callers.
7313         (Layout::choose_output_section): Likewise.
7314         (Layout::make_output_section): Likewise.
7315         (Layout::add_output_section_data): Add is_dynamic_linker_section
7316         parameter.  Change all callers.
7317         * layout.h (class Layout): Update declarations.
7318         * output.h (class Output_section): Add is_interp, set_is_interp,
7319         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7320         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7321         generate_code_fills_at_write_ to a bitfield.
7322         * output.cc (Output_section::Output_sections): Initialize new
7323         fields.
7324         (Output_segment::add_output_section): Add do_sort parameter.
7325         Change all callers.
7326
7327 2009-11-03  Ian Lance Taylor  <iant@google.com>
7328
7329         PR 10860
7330         * options.h (class General_options): Add --warn-common.
7331         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7332         merging two common symbols.
7333         (Symbol_table::should_override): Handle --warn-common when merging
7334         a common symbol with a defined symbol.  Use report_resolve_problem
7335         for multiple definitions.
7336         (Symbol_table::report_resolve_problem): New function.
7337         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7338
7339 2009-11-03  Doug Kwan  <dougkwan@google.com>
7340
7341         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7342         stub_factory_.
7343         (Target_arm::stub_factory): New method definition.
7344         (Target_arm::new_arm_input_section,
7345         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7346         Target_arm::reloc_uses_thumb_bit): New method declarations.
7347         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7348         New type definitions.
7349         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7350         member declarations.
7351         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7352         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7353         New method definitions.
7354
7355 2009-11-03  Ian Lance Taylor  <iant@google.com>
7356
7357         * options.h (class General_options): Add --warn_constructors.
7358
7359 2009-11-03  Ian Lance Taylor  <iant@google.com>
7360
7361         PR 10893
7362         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7363         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7364
7365 2009-11-03  Ian Lance Taylor  <iant@google.com>
7366
7367         PR 10895
7368         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7369         --msgid-bugs-address.
7370         (install-pdf): New target.
7371         (install-data_yes): Look up one directory to find mkinstalldirs.
7372
7373 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7374
7375         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7376         tree.
7377
7378 2009-10-30  Doug Kwan  <dougkwan@google.com>
7379
7380         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7381
7382 2009-10-30  Doug Kwan  <dougkwan@google.com>
7383
7384         * arm.cc (Stub_addend_reader): New struct template definition
7385         and partial specializations.
7386         (Stub_addend_reader::operator()): New method definition for a
7387         partially specialized template.
7388
7389 2009-10-30  Doug Kwan  <dougkwan@google.com>
7390
7391         * arm.cc (Arm_relobj::processor_specific_flags): New method
7392         definition.
7393         (Arm_relobj::do_read_symbols): New method declaration.
7394         (Arm_relobj::processor_specific_flags_): New data member declaration.
7395         (Arm_dynobj): New class definition.
7396         (Target_arm::do_finalize_sections): Add input_objects parameter.
7397         (Target_arm::do_adjust_elf_header): New method declaration.
7398         (Target_arm::are_eabi_versions_compatible,
7399         (Target_arm::merge_processor_specific_flags): New method declaration.
7400         (Target_arm::do_make_elf_object): New overloaded method definitions
7401         and declaration.
7402         (Arm_relobj::do_read_symbols): New method definition.
7403         (Arm_dynobj::do_read_symbols): Ditto.
7404         (Target_arm::do_finalize_sections): Add input_objects parameters.
7405         Merge processor-specific flags from all input objects.
7406         (Target_arm::are_eabi_versions_compatible,
7407         Target_arm::merge_processor_specific_flags,
7408         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7409         New method definitions.
7410         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7411         Input_objects pointer type parameter.
7412         * layout.cc (Layout::finalize): Pass input objects to target's.
7413         finalize_sections function.
7414         * output.cc (Output_file_header::do_sized_write): Set ELF file
7415         header's processor-specific flags.
7416         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7417         Input_objects pointer type parameter.
7418         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7419         * target.h (Input_objects): New forward class declaration.
7420         (Target::processor_specific_flags,
7421         Target::are_processor_specific_flags_sect): New method definitions.
7422         (Target::finalize_sections): Add input_objects parameter.
7423         (Target::Target): Initialize processor_specific_flags_ and
7424         are_processor_specific_flags_set_.
7425         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7426         parameter.
7427         (Target::set_processor_specific_flags): New method definition.
7428         (Target::processor_specific_flags_,
7429         Target::are_processor_specific_flags_set_): New data member
7430         declarations.
7431         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7432         Input_objects pointer type parameter.
7433
7434 2009-10-30  Doug Kwan  <dougkwan@google.com>
7435
7436         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7437
7438 2009-10-28  Ian Lance Taylor  <iant@google.com>
7439
7440         * object.h (class Relobj): Drop options parameter from
7441         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7442         do_scan_relocs, do_relocate.  Change all callers.
7443         (class Sized_relobj): Drop options parameters from
7444         do_gc_process_relocs, do_scan_relocs, do_relocate,
7445         do_relocate_sections, relocate_sections, emit_relocs_scan,
7446         emit_relocs_scan_reltype.  Change all callers.
7447         (struct Relocate_info): Remove options field and all references to
7448         it.
7449         * reloc.h (class Read_relocs): Remove options constructor
7450         parameter and options_ field.  Change all callers.
7451         (class Gc_process_relocs, class Scan_relocs): Likewise.
7452         (class Relocate_task): Likewise.
7453         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7454         all callers.
7455         (scan_relocatable_relocs): Likewise.
7456         * target.h (class Sized_target): Remove options parameter from
7457         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7458         all callers.
7459         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7460         callers.
7461         * arm.cc: Update functions to remove options parameters.
7462         * i386.cc: Likewise.
7463         * powerpc.cc: Likewise.
7464         * sparc.cc: Likewise.
7465         * x86_64.cc: Likewise.
7466         * testsuite/testfile.cc: Likewise.
7467
7468 2009-10-28  Doug Kwan  <dougkwan@google.com>
7469
7470         * arm.cc (Arm_relobj): New class definition.
7471         (Arm_relobj::scan_sections_for_stubs,
7472         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7473         New method definitions.
7474
7475 2009-10-28  Cary Coutant  <ccoutant@google.com>
7476
7477         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7478         (Plugin::cleanup_done_): New member.
7479         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7480         (Plugin_manager::cleanup_done_): Remove.
7481         (Plugin_manager::add_input_file): Edit error message.
7482         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7483         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7484
7485 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7486
7487         * fileread.cc: (File_read::View::~View): Use the new
7488         data_ownership_ filed.
7489         (File_read::~File_read): Dispose the new whole_file_view_.
7490         (File_read::open): Mmap the whole file if needed.
7491         (File_read::open): Use whole_file_view_ instead of contents_.
7492         (File_read::find_view): Use whole_file_view_ if applicable.
7493         (File_read::do_read): Use whole_file_view_ instead of contents_.
7494         (File_read::make_view): Use whole_file_view_ instead of contents_,
7495         update File_read::View::View call.
7496         (File_read::find_or_make_view): Update File_read::View::View
7497         call.
7498         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7499         remove contents_
7500         (File_read::View::Data_ownership): New enum.
7501         (File_read::View::View): Replace bool mapped_ with Data_ownership
7502         argument.
7503         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7504         (File_read::View::data_ownership_): New field.
7505         (File_read::contents_): Remove (replaced by whole_file_view_).
7506         (File_read::whole_file_view_): New field.
7507         * options.h (class General_options): Add --keep-files-mapped.
7508
7509 2009-10-27  Cary Coutant  <ccoutant@google.com>
7510
7511         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7512         * testsuite/Makefile.am (plugin_test_5): New test case.
7513         * testsuite/Makefile.in: Regenerate.
7514
7515 2009-10-25  Doug Kwan  <dougkwan@google.com>
7516
7517         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7518         from private to protected to allow access by child class.
7519         (Sized_relobj::do_relocate_sections): New method declaration.
7520         (Sized_relobj::relocate_sections): Virtualize.
7521         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7522         Sized_relobj::relocate_sections.  Instantiate template explicitly
7523         for different target sizes and endianity.
7524
7525 2009-10-24  Doug Kwan  <dougkwan@google.com>
7526
7527         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7528         (Arm_input_section::as_arm_input_section): New method.
7529         (Arm_output_section): New class definition.
7530         (Arm_output_section::create_stub_group,
7531         Arm_output_section::group_sections): New method definitions.
7532
7533 2009-10-22  Doug Kwan  <dougkwan@google.com>
7534
7535         * arm.cc (Arm_input_section): New class definition.
7536         (Arm_input_section::init, Arm_input_section:do_write,
7537         Arm_input_section::set_final_data_size,
7538         Arm_input_section::do_reset_address_and_file_offset): New method
7539         definitions.
7540
7541 2009-10-21  Doug Kwan  <dougkwan@google.com>
7542
7543         * arm.cc (Stub_table, Arm_input_section): New forward class
7544         declarations.
7545         (Stub_table): New class defintion.
7546         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7547         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7548         New method definition.
7549
7550 2009-10-21  Doug Kwan  <dougkwan@google.com>
7551
7552         * arm.cc: Update copyright comments.
7553         (Target_arm): New forward class template declaration.
7554         (Arm_address): New type.
7555         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7556         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7557         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7558         constants.
7559         (Insn_template): Same.
7560         (DEF_STUBS): New macro.
7561         (Stub_type): New enum type.
7562         (Stub_template): New class definition.
7563         (Stub): Same.
7564         (Reloc_stub): Same.
7565         (Stub_factory): Same.
7566         (Target_arm::Target_arm): Initialize may_use_blx_ and
7567         should_force_pic_veneer_.
7568         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7569         Target_arm::should_force_pic_veneer,
7570         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7571         Target_arm::using_thumb_only, Target_arm:;default_target): New
7572         method defintions.
7573         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7574         New data member declarations.
7575         (Insn_template::size, Insn_template::alignment): New method defintions.
7576         (Stub_template::Stub_template): New method definition.
7577         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7578         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7579         (Stub_factory::Stub_factory): New method definition.
7580         * gold.h (string_hash): New template.
7581         * output.h (Input_section_specifier::hash_value): Use
7582         gold::string_hash.
7583         (Input_section_specifier::string_hash): Remove.
7584         * stringpool.cc (Stringpool_template::string_hash): Use
7585         gold::string_hash.
7586
7587 2009-10-20  Doug Kwan  <dougkwan@google.com>
7588
7589         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7590         symbols of relaxed input sections.
7591         * output.h (Output_section::find_relaxed_input_section): Make
7592         method public.
7593
7594 2009-10-16  Doug Kwan  <dougkwan@google.com>
7595
7596         * dynobj.cc (Versions::Versions): Initialize version_script_.
7597         Only insert base version symbol definition for a shared object
7598         if version script defines any version versions.
7599         (Versions::define_base_version): New method definition.
7600         (Versions::add_def): Check that base version is not needed.
7601         (Versions::add_need): Define base version lazily.
7602         * dynobj.h (Versions::define_base_version): New method declaration.
7603         (Versions::needs_base_version_): New data member declaration.
7604         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7605         (check_DATA): Add no_version_test.stdout.
7606         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7607         New make rules.
7608         * testsuite/Makefile.in: Regenerate.
7609         * testsuite/no_version_test.c: New file.
7610         * testsuite/no_version_test.sh: Ditto.
7611
7612 2009-10-16  Doug Kwan  <dougkwan@google.com>
7613
7614         * expression.cc (class Segment_start_expression): New class definition.
7615         (Segment_start_expression::value): New method definition.
7616         (script_exp_function_segment_start): Return a new
7617         Segment_start_expression.
7618         * gold/script-c.h (script_saw_segment_start_expression): New function
7619         prototype.
7620         * script-sections.cc (Script_sections::Script_sections): Initialize
7621         SAW_SEGMENT_START_EXPRESSION_ to false.
7622         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7623         and -Tbbs options to specify section addresses if given in
7624         command line and no SEGMENT_START expression is seen in a script.
7625         * script-sections.h (Script_sections::saw_segment_start_expression,
7626         Script_sections::set_saw_segment_start_expression): New method
7627         definition.
7628         (Script_sections::saw_segment_start_expression_): New data member
7629         declaration.
7630         * script.cc (script_saw_segment_start_expression): New function.
7631         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7632         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7633         script_test_7.sh and script_test_8.sh.
7634         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7635         script_test_8.stdout.
7636         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7637         (script_test_6, script_test_6.stdout, script_test_7,
7638         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7639         * Makefile.in: Regenerate.
7640         * testsuite/script_test_6.sh: New file.
7641         * testsuite/script_test_6.t: Same.
7642         * testsuite/script_test_7.sh: Same.
7643         * testsuite/script_test_7.t: Same.
7644         * testsuite/script_test_8.sh: Same.
7645
7646 2009-10-16  Doug Kwan  <dougkwan@google.com>
7647
7648         * output.cc (Output_segment::set_section_list_address): Cast
7649         expressions to unsigned long long type to avoid format warnings.
7650
7651 2009-10-15  Ian Lance Taylor  <iant@google.com>
7652
7653         * script.cc (Script_options::add_symbol_assignment): Always add a
7654         dot assignment to script_sections_.
7655         * script-sections.cc (Script_sections::add_dot_assignment):
7656         Initialize if necessary.
7657
7658         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7659         program headers with no load segment if there is a linker script.
7660
7661         * layout.cc (Layout::set_segment_offsets): Align the file offset
7662         to the segment aligment for -N or -n with no load segment.
7663         * output.cc (Output_segment::add_output_section): Don't crash if
7664         the first section is a TLS section.
7665         (Output_segment::set_section_list_addresses): Print an error
7666         message if the address moves backward in a linker script.
7667         * script-sections.cc
7668         (Output_section_element_input::set_section_addresses): Don't
7669         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7670         (Orphan_output_section::set_section_addresses): Likewise.
7671
7672 2009-10-15  Doug Kwan  <dougkwan@google.com>
7673
7674         * layout.cc (Layout::finish_dynamic_section): Generate tags
7675         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7676         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7677         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7678
7679 2009-10-14  Ian Lance Taylor  <iant@google.com>
7680
7681         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7682         fields.
7683         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7684         data_shdr fields of relinfo.
7685         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7686         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7687         R_386_TLS_LDO_32, adjust based on section flags.
7688         (Target_i386::Relocate::fix_up_ldo): Remove.
7689
7690 2009-10-13  Ian Lance Taylor  <iant@google.com>
7691
7692         Add support for -pie.
7693         * options.h (class General_options): Add -pie and
7694         --pic-executable.
7695         (General_options::output_is_position_independent): Test -pie.
7696         (General_options::output_is_executable): Return true if not shared
7697         and not relocatable.
7698         (General_options::output_is_pie): Remove.
7699         * options.cc (General_options::finalize): Reject incompatible uses
7700         of -pie.
7701         * gold.cc (queue_middle_tasks): A -pie link is not static.
7702         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7703         * symtab.cc (Symbol::final_value_is_known): Return false if
7704         output_is_position_independent.
7705         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7706         output_is_position_independent.
7707         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7708         output_is_position_independent.
7709         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7710         output_is_position_independent.
7711         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7712         two_file_pie_test.
7713         (basic_pie_test.o, basic_pie_test): New targets.
7714         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7715         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7716         (two_file_pie_test): New target.
7717         * testsuite/Makefile.in: Rebuild.
7718         * README: Remove note saying that -pie is not supported.
7719
7720 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7721
7722         * options.h (class General_options): Add -init and -fini.
7723         * layout.cc (Layout::finish_dynamic_section): Emit
7724         given init and fini functions.
7725
7726 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7727
7728         * gc.h (gc_process_relocs): Check if icf is enabled using new
7729         function.
7730         * gold.cc (queue_initial_tasks): Likewise.
7731         (queue_middle_tasks): Likewise.
7732         * object.cc (do_layout): Likewise.
7733         * symtab.cc (is_section_folded): Likewise.
7734         * main.cc (main): Likewise.
7735         * reloc.cc (Read_relocs::run): Likewise.
7736         (Sized_relobj::do_scan_relocs): Likewise.
7737         * icf.cc (is_function_ctor_or_dtor): New function.
7738         (Icf::find_identical_sections): Check if function is ctor or dtor when
7739         safe icf is chosen.
7740         * options.h (General_options::icf): Change option to be an enum.
7741         (Icf_status): New enum.
7742         (icf_enabled): New method.
7743         (icf_safe_folding): New method.
7744         (set_icf_status): New method.
7745         (icf_status_): New variable.
7746         * (options.cc) (General_options::finalize): Set icf_status_.
7747         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7748         icf_test and icf_keep_unique_test to use the --icf enum flag.
7749         * testsuite/icf_safe_test.sh: New file.
7750         * testsuite/icf_safe_test.cc: New file.
7751
7752 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7753
7754         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7755         includes to gc.h and icf.h.
7756         * arm.cc: Include gc.h.
7757         * gold.cc: Likewise.
7758         * i386.cc: Likewise.
7759         * powerpc.cc: Likewise.
7760         * sparc.cc: Likewise.
7761         * x86_64.cc: Likewise.
7762         * gc.h: Include icf.h.
7763
7764 2009-10-11  Ian Lance Taylor  <iant@google.com>
7765
7766         * plugin.cc: Include "gold.h" before other header files.
7767
7768 2009-10-10  Chris Demetriou  <cgd@google.com>
7769
7770         * options.h (Input_file_argument::Input_file_type): New enum.
7771         (Input_file_argument::is_lib_): Replace with...
7772         (Input_file_argument::type_): New member.
7773         (Input_file_argument::Input_file_argument): Take Input_file_type
7774         'type' rather than boolean 'is_lib' as second argument.
7775         (Input_file_argument::is_lib): Use type_.
7776         (Input_file_argument::is_searched_file): New function.
7777         (Input_file_argument::may_need_search): Handle is_searched_file.
7778         * options.cc (General_options::parse_library): Support -l:filename.
7779         (General_options::parse_just_symbols): Update for Input_file_argument
7780         changes.
7781         (Command_line::process): Likewise.
7782         * archive.cc (Archive::get_file_and_offset): Likewise.
7783         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7784         * script.cc (read_script_file, script_add_file): Likewise.
7785         * fileread.cc (Input_file::Input_file): Likewise.
7786         (Input_file::will_search_for): Handle is_searched_file.
7787         (Input_file::open): Likewise.
7788         * readsyms.cc (Read_symbols::get_name): Likewise.
7789         * testsuite/Makefile.am (searched_file_test): New test.
7790         * testsuite/Makefile.in: Regenerate.
7791         * testsuite/searched_file_test.cc: New file.
7792         * testsuite/searched_file_test_lib.cc: New file.
7793
7794 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7795             Ian Lance Taylor  <iant@google.com>
7796
7797         * descriptor.cc: Include <cstdio> and "binary-io.h".
7798         (Descriptors::open): Open the files in binary mode always.
7799         * script.cc (Lex::get_token): Treat \r as whitespace.
7800
7801 2009-10-09  Ian Lance Taylor  <iant@google.com>
7802
7803         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7804
7805 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7806             Ian Lance Taylor  <iant@google.com>
7807
7808         * configure.ac: Check for readv function also.
7809         * fileread.cc (readv): Define if not HAVE_READV.
7810         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7811         does not exist.
7812         * config.in: Regenerate.
7813         * configure: Regenerate.
7814
7815 2009-10-09  Doug Kwan  <dougkwan@google.com>
7816
7817         * layout.cc (Layout::make_output_section): Call target hook to make
7818         ordinary output section.
7819         (Layout::finalize): Adjust parameter list of call the
7820         Target::may_relax().
7821         * layout.h (class Layout::section_list): New method.
7822         * merge.h (Output_merge_base::entsize): Change visibility to public.
7823         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7824         New methods.
7825         (Output_merge_string::do_is_string): New method.
7826         * object.cc (Sized_relobj::do_setup): renamed from
7827         Sized_relobj::set_up.
7828         * object.h (Sized_relobj::adjust_shndx,
7829         Sized_relobj::initializ_input_to_output_maps,
7830         Sized_relobj::free_input_to_output_maps): Change visibilities to
7831         protected.
7832         (Sized_relobj::setup): Virtualize.
7833         (Sized_relobj::do_setup): New method declaration.
7834         (Sized_relobj::invalidate_section_offset,
7835         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7836         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7837         * options.cc (parse_int): New function.
7838         * options.h (parse_int): New declaration.
7839         (DEFINE_int): New macro.
7840         (stub_group_size): New option.
7841         * output.cc (Output_section::Output_section): Initialize memebers
7842         merge_section_map_, merge_section_by_properties_map_,
7843         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7844         (Output_section::add_input_section): Handled deferred code-fill
7845         generation and remove an old comment.
7846         (Output_section::add_relaxed_input_section): New method definition.
7847         (Output_section::add_merge_input_section): Use merge section by
7848         properties map to speed to search.  Update merge section maps
7849         as appropriate.
7850         (Output_section::build_relaxation_map): New method definition.
7851         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7852         Same.
7853         (Output_section::relax_input_section): Renamed to
7854         Output_section::convert_input_sections_to_relaxed_sections and change
7855         interface to take a vector of pointers to relaxed sections.
7856         (Output_section::find_merge_section,
7857         Output_section::find_relaxed_input_section): New method definitions.
7858         (Output_section::is_input_address_mapped,
7859         Output_section::output_offset, Output_section::output_address):
7860         Use output section data maps to speed up searching.
7861         (Output_section::find_starting_output_address): Add comments.
7862         (Output_section::do_write,
7863         Output_section::write_to_postprocessing_buffer): Do code-fill
7864         generation as appropriate.
7865         (Output_section::get_input_sections): Invalidate relaxed input section
7866         map.
7867         (Output_section::restore_states): Adjust type of checkpoint .
7868         Invalidate relaxed input section map.
7869         * output.h (Output_merge_base): New class declaration.
7870         (Input_section_specifier): New class defintion.
7871         (class Output_relaxed_input_section) Change base class to
7872         Output_section_data_build.
7873         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7874         base class initializer.
7875         (Output_section::add_relaxed_input_section): New method declaration.
7876         (Output_section::Input_section): Change visibility to protected.
7877         (Output_section::Input_section::relobj,
7878         Output_section::Input_section::shndx): Handle relaxed input sections.
7879         Output_section::input_sections) Change visibility to protected.  Also
7880         define overload to return a non-const pointer.
7881         (Output_section::Merge_section_properties): New class defintion.
7882         (Output_section::Merge_section_by_properties_map,
7883         Output_section::Output_section_data_by_input_section_map,
7884         Output_section::Relaxation_map): New types.
7885         (Output_section::relax_input_section): Rename method to
7886         Output_section::convert_input_sections_to_relaxed_sections and change
7887         interface to take a vector of relaxed section pointers.
7888         (Output_section::find_merge_section,
7889         Output_section::find_relaxed_input_section,
7890         Output_section::build_relaxation_map,
7891         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7892         New method declarations.
7893         (Output_section::merge_section_map_
7894         Output_section::merge_section_by_properties_map_,
7895         Output_section::relaxed_input_section_map_,
7896         Output_section::is_relaxed_input_section_map_valid_,
7897         Output_section::generate_code_fills_at_write_): New data members.
7898         * script-sections.cc
7899         (Output_section_element_input::set_section_addresses): Call
7900         current_data_size and addralign methods of relaxed input sections.
7901         (Orphan_output_section::set_section_addresses): Call current_data_size
7902         and addralign methods of relaxed input sections.
7903         * symtab.cc (Symbol_table::compute_final_value): Extract template
7904         from the body of Symbol_table::sized_finalize_symbol.
7905         (Symbol_table::sized_finalized_symbol): Call
7906         Symbol_table::compute_final_value.
7907         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7908         (Symbol_table::compute_final_value): New templated method declaration.
7909         * target.cc (Target::do_make_output_section): New method defintion.
7910         * target.h (Target::make_output_section): New method declaration.
7911         (Target::relax): Add more parameters for input objects, symbol table
7912         and layout.  Adjust call to do_relax.
7913         (Target::do_make_output_section): New method declaration.
7914         (Target::do_relax): Add parameters for input objects, symbol table
7915         and layout.
7916
7917 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7918
7919         * pread.c: Include stdio.h.
7920
7921 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7922
7923         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7924         defined.
7925
7926 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7927
7928         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7929         Change read_shndx type to unsigned int.
7930         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7931         int.
7932         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7933         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7934         Change read_shndx type to unsigned int.
7935         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7936         int.
7937         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7938         * layout.cc (Layout::create_symtab_sections): Cast the result of
7939         local_symcount * symsize to off_t in the gold_assert.
7940
7941 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7942
7943         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7944         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7945         R_ARM_BASE_ABS.
7946         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7947         (Arm_relocate_functions::thm_abs5): New function.
7948         (Arm_relocate_functions::abs12): New function.
7949         (Arm_relocate_functions::abs16): New function.
7950         (Arm_relocate_functions::base_abs): New function.
7951         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7952         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7953         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7954         R_ARM_BASE_ABS.
7955         (Scan::global): Likewise.
7956         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7957         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7958         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7959         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7960         R_ARM_BASE_ABS.
7961
7962 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7963
7964         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7965         (Arm_relocate_functions::movt_prel): New function.
7966         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7967         (Arm_relocate_functions::thm_movt_prel): New function.
7968         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7969         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7970         (Scan::global, Relocate::relocate): Likewise.
7971         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7972
7973 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7974
7975         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7976         Incremental_checker.
7977         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7978         unsigned int.
7979         (class Incremental_inputs_header): New class.
7980         (Incremental_inputs_header_writer): Edit comment.
7981         (Incremental_inputs_entry): New class.
7982         (Incremental_inputs_entry_writer): Edit comment.
7983         (Sized_incremental_binary::do_find_incremental_inputs_section):
7984         Add *strtab_shndx parameter, fill it.
7985         (Sized_incremental_binary::do_check_inputs): New method.
7986         (Incremental_checker::can_incrementally_link_output_file): Use
7987         Sized_incremental_binary::check_inputs.
7988         (Incremental_inputs::report_command_line): Save command line in
7989         command_line_.
7990         * incremental.h:
7991         (Incremental_binary::find_incremental_inputs_section): New
7992         method.
7993         (Incremental_binary::do_find_incremental_inputs_section): Add
7994         strtab_shndx parameter.
7995         (Incremental_binary::do_check_inputs): New pure virtual method.
7996         (Sized_incremental_binary::do_check_inputs): Declare.
7997         (Incremental_checker::Incremental_checker): Add incremental_inputs
7998         parameter, use it to initialize incremental_inputs_.
7999         (Incremental_checker::incremental_inputs_): New field.
8000         (Incremental_checker::command_line): New method.
8001         (Incremental_checker::inputs): New method.
8002         (Incremental_checker::command_line_): New field.
8003
8004 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8005
8006         * incremental.cc: Include <cstdarg> and "target-select.h".
8007         (vexplain_no_incremental): New function.
8008         (explain_no_incremental): New function.
8009         (Incremental_binary::error): New method.
8010         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8011         method.
8012         (make_sized_incremental_binary): New function.
8013         (open_incremental_binary): New function.
8014         (can_incrementally_link_file): Add checks if output is ELF and has
8015         inputs section.
8016         * incremental.h: Include "elfcpp_file.h" and "output.h".
8017         (Incremental_binary): New class.
8018         (Sized_incremental_binary): New class.
8019         (open_incremental_binary): Declare.
8020         * object.cc (is_elf_object): Use
8021         elfcpp::Elf_recognizer::is_elf_file.
8022         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8023         * output.h (Output_file::filesize): New method.
8024
8025 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8026
8027         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8028         New function.
8029         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8030         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8031         function.
8032         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8033         function.
8034         (Arm_relocate_functions::movw_abs_nc): New function.
8035         (Arm_relocate_functions::movt_abs): New function.
8036         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8037         (Arm_relocate_functions::thm_movt_abs): New function.
8038         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8039         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8040         (Scan::global): Likewise.
8041         (Relocate::relocate): Likewise.
8042         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8043
8044 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8045
8046         * arm.cc (Arm_relocate_functions::got_prel) New function.
8047         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8048         (Relocate::relocate): Likewise.
8049         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8050
8051 2009-10-06  Ian Lance Taylor  <iant@google.com>
8052
8053         * options.h (class General_options): Define
8054         split_stack_adjust_size parameter.
8055         * object.h (class Object): Add uses_split_stack_ and
8056         has_no_split_stack_ fields.  Add uses_split_stack and
8057         has_no_split_stack accessor functions.  Declare
8058         handle_split_stack_section.
8059         (class Reloc_symbol_changes): Define.
8060         (class Sized_relobj): Define Function_offsets.  Declare
8061         split_stack_adjust, split_stack_adjust_reltype, and
8062         find_functions.
8063         * object.cc (Object::handle_split_stack_section): New function.
8064         (Sized_relobj::do_layout): Call handle_split_stack_section.
8065         * dynobj.cc (Sized_dynobj::do_layout): Call
8066         handle_split_stack_section.
8067         * reloc.cc (Sized_relobj::relocate_sections): Call
8068         split_stack_adjust for executable sections in split_stack
8069         objects.  Pass reloc_map to relocate_section.
8070         (Sized_relobj::split_stack_adjust): New function.
8071         (Sized_relobj::split_stack_adjust_reltype): New function.
8072         (Sized_relobj::find_functions): New function.
8073         * target-reloc.h: Include "object.h".
8074         (relocate_section): Add reloc_symbol_changes parameter.  Change
8075         all callers.
8076         * target.h (class Target): Add calls_non_split method.  Declare
8077         do_calls_non_split virtual method.  Declare match_view and
8078         set_view_to_nop.
8079         * target.cc: Include "elfcpp.h".
8080         (Target::do_calls_non_split): New function.
8081         (Target::match_view): New function.
8082         (Target::set_view_to_nop): New function.
8083         * gold.cc (queue_middle_tasks): Give an error if mixing
8084         split-stack and non-split-stack objects with -r.
8085         * i386.cc (Target_i386::relocate_section): Add
8086         reloc_symbol_changes parameter.
8087         (Target_i386::do_calls_non_split): New function.
8088         * x86_64.cc (Target_x86_64::relocate_section): Add
8089         reloc_symbol_changes parameter.
8090         (Target_x86_64::do_calls_non_split): New function.
8091         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8092         parameter.
8093         * powerpc.cc (Target_powerpc::relocate_section): Add
8094         reloc_symbol_changes parameter.
8095         * sparc.cc (Target_sparc::relocate_section): Add
8096         reloc_symbol_changes parameter.
8097         * configure.ac: Call AM_CONDITIONAL for the default target.
8098         * configure: Rebuild.
8099         * testsuite/Makefile.am (TEST_AS): New variable.
8100         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8101         (check_DATA): Add split_i386 and split_x86_64 files.
8102         (SPLIT_DEFSYMS): Define.
8103         (split_i386_[1234n].o): New targets.
8104         (split_i386_[124]): New targets.
8105         (split_i386_[1234r].stdout): New targets.
8106         (split_x86_64_[1234n].o): New targets.
8107         (split_x86_64_[124]): New targets.
8108         (split_x86_64_[1234r].stdout): New targets.
8109         (MOSTLYCLEANFILES): Add new executables.
8110         * testsuite/split_i386.sh: New file.
8111         * testsuite/split_x86_64.sh: New file.
8112         * testsuite/split_i386_1.s: New file.
8113         * testsuite/split_i386_2.s: New file.
8114         * testsuite/split_i386_3.s: New file.
8115         * testsuite/split_i386_4.s: New file.
8116         * testsuite/split_i386_n.s: New file.
8117         * testsuite/split_x86_64_1.s: New file.
8118         * testsuite/split_x86_64_2.s: New file.
8119         * testsuite/split_x86_64_3.s: New file.
8120         * testsuite/split_x86_64_4.s: New file.
8121         * testsuite/split_x86_64_n.s: New file.
8122         * testsuite/testfile.cc (Target_test): Update relocation_section
8123         function.
8124         * testsuite/Makefile.in: Rebuild.
8125
8126 2009-10-06  Ian Lance Taylor  <iant@google.com>
8127
8128         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8129         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8130         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8131         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8132         the address on ldo_addrs_.
8133         (Target_i386::Relocate::fix_up_ldo): New function.
8134
8135 2009-10-06   Rafael Espindola  <espindola@google.com>
8136
8137         * plugin.cc (add_input_library): New.
8138         (Plugin::load): Add add_input_library to tv.
8139         (Plugin_manager::add_input_file): Add the is_lib argument.
8140         (add_input_file): Update call to Plugin_manager::add_input_file.
8141         (add_input_library): New.
8142         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8143
8144 2009-09-30  Doug Kwan  <dougkwan@google.com>
8145
8146         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8147         symbol and call Symbol::may_need_copy_reloc to determine if
8148         a copy reloc is needed.
8149         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8150         nocopyreloc is given in command line.
8151         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8152         given in command line.
8153         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8154         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8155         of the removed Target_i386::may_need_copy_reloc.
8156         * options.h (copyreloc): New option with default value false.
8157         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8158         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8159         instead of the removed Target_powerpc::may_need_copy_reloc.
8160         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8161         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8162         instead of the removed Target_sparc::may_need_copy_reloc.
8163         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8164         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8165         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8166         instead of the removed Target_x86_64::may_need_copy_reloc.
8167
8168 2009-09-30  Ian Lance Taylor  <iant@google.com>
8169
8170         * object.h (class Object): Remove target_ field, and target,
8171         sized_target, and set_target methods.
8172         (Object::sized_target): Remove.
8173         (class Sized_relobj): Update declarations.  Remove sized_target.
8174         * object.cc (Sized_relobj::setup): Remove target parameter.
8175         Change all callers.
8176         (Input_objects::add_object): Don't do anything with the target.
8177         (make_elf_sized_object): Add punconfigured parameter.  Change all
8178         callers.  Set or test parameter target.
8179         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8180         Change all callers.
8181         * parameters.cc (Parameters::set_target): Change parameter type to
8182         be non-const.
8183         (Parameters::default_target): Remove.
8184         (set_parameters_target): Change parameter type to be non-const.
8185         (parameters_force_valid_target): New function.
8186         (parameters_clear_target): New function.
8187         * parameters.h (class Parameters): Update declarations.  Remove
8188         default_target method.  Add sized_target and clear_target
8189         methods.  Change target_ to be non-const.
8190         (set_parameters_target): Update declaration.
8191         (parameters_force_valid_target): Declare.
8192         (parameters_clear_target): Declare.
8193         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8194         as NULL if we aren't searching.
8195         (Add_symbols::run): Don't check for compatible target.
8196         * fileread.cc (Input_file::open_binary): Call
8197         parameters_force_valid_target.
8198         * gold.cc (queue_middle_tasks): Likewise.
8199         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8200         set_target on object.
8201         * dynobj.h (class Sized_dynobj): Update declarations.
8202         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8203         make_elf_object returns NULL.
8204         (Archive::include_member): Don't check whether object target is
8205         compatible.
8206         * output.cc (Output_section::add_input_section): Get target from
8207         parameters.
8208         (Output_section::relax_input_section): Likewise.
8209         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8210         parameters.
8211         (Sized_relobj::do_scan_relocs): Likewise.
8212         (Sized_relobj::relocate_sections): Likewise.
8213         * resolve.cc (Symbol_table::resolve): Likewise.
8214         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8215         parameter.  Change all callers.
8216         (Symbol_table::add_from_object): Get target from parameters.
8217         (Symbol_table::add_from_relobj): Don't check object target.
8218         (Symbol_table::add_from_dynobj): Likewise.
8219         (Symbol_table::define_special_symbol): Get target from
8220         parameters.
8221         * symtab.h (class Symbol_table): Update declaration.
8222         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8223         parameter.  Change all callers.  Clear parameter target.
8224         (Binary_test): Test target here.
8225         * testsuite/object_unittest.cc (gold_testsuite): Remove
8226         target_test_pointer parameter.  Change all callers.
8227         (Object_test): Test target here.
8228
8229 2009-09-26  Ian Lance Taylor  <iant@google.com>
8230
8231         * testsuite/initpri1.c: Don't try to use constructor priorities if
8232         compiling with gcc before 4.3.
8233
8234 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8235
8236         * testsuite/retain_symbols_file_test.sh (check_present): Change
8237         output file name to retain_symbols_file_test.stdout.
8238         (check_absent): Likewise.
8239
8240 2009-09-18  Craig Silverstein  <csilvers@google.com>
8241
8242         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8243         * options.cc: Include <cerrno> and <fstream>.
8244         (General_options::finalize): Parse -retain-symbols-file tag.
8245         * options.h: New flag.
8246         (General_options): New method should_retain_symbol, new
8247         variable symbols_to_retain.
8248         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8249         should_retain_symbol map.
8250         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8251         * testsuite/Makefile.in: Regenerate.
8252         * testsuite/retain_symbols_file_test.sh: New file.
8253
8254 2009-09-18  Nick Clifton  <nickc@redhat.com>
8255
8256         * po/es.po: Updated Spanish translation.
8257
8258 2009-09-17  Doug Kwan  <dougkwan@google.com>
8259
8260         * debug.h (DEBUG_RELAXATION): New constant.
8261         (DEBUG_ALL): Add DEBUG_RELAXATION.
8262         (debug_string_to_enum): Add relaxation debug option.
8263         * layout.cc
8264         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8265         Layout::Relaxation_debug_check::read_sections,
8266         Layout::Relaxation_debug_check::read_sections): New method definitions.
8267         (Layout::Layout): Initialize data members
8268         record_output_section_data_from_scrips_,
8269         script_output_section_data_list_ and relaxation_debug_check_.
8270         (Layout::save_segments, Layout::restore_segments,
8271         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8272         Layout::relaxation_loop_body): New method definitions.
8273         (Layout::finalize): Support relaxation.  Move section layout code to
8274         Layout::relaxation_loop_body.
8275         (Layout::set_asection_address_from_script): Move code for orphan
8276         section placement out.
8277         (Layout::place_orphan_sections_in_script): New method definition.
8278         * layout.h (Output_segment_headers, Output_file_header):
8279         New forward class declarations.
8280         (Layout::~Layout): Define.
8281         (Layout::new_output_section_data_from_script): New method definition.
8282         (Layout::place_orphan_sections_in_script): New method declaration.
8283         (Layout::Segment_states): New type declaration.
8284         (Layout::save_segments, Layout::restore_segments,
8285         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8286         Layout::relaxation_loop_body): New method declarations.
8287         (Layout::Output_section_data_list): New type declaration.
8288         (Layout::Relaxation_debug_check): New class definition.
8289         (Layout::record_output_section_data_from_script_,
8290         Layout::script_output_section_data_list_, Layout::segment_states_,
8291         Layout::relaxation_debug_check_): New data members.
8292         * output.cc: (Output_section_headers::do_size): New method definition.
8293         (Output_section_headers::Output_section_headers): Move size
8294         computation to Output_section_headers::do_size.
8295         (Output_segment_headers::do_size): New method definition.
8296         (Output_file_header::Output_file_header): Move size computation to
8297         Output_file_header::do_size and call it.
8298         (Output_file_header::do_size): New method definition.
8299         (Output_data_group::Output_data_group): Adjust call to
8300         Output_section_data.
8301         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8302         (Output_symtab_xindex::do_write): Add array bound check.
8303         (Output_section::Input_section::print_to_mapfile): Handle
8304         RELAXED_INPUT_SECTION_CODE.
8305         (Output_section::Output_section): Initialize data member checkpoint_.
8306         (Output_section::~Output_section): Delete checkpoint object pointed
8307         by checkpoint_.
8308         (Output_section::add_input_section): Always add an Input_section if
8309         relaxing.
8310         (Output_section::add_merge_input_section): Add assert.
8311         (Output_section::relax_input_section): New method definition.
8312         (Output_section::set_final_data_size): Set load address to zero for
8313         an unallocated section.
8314         (Output_section::do_address_and_file_offset_have_reset_values):
8315         New method definition.
8316         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8317         Handle relaxed input section.
8318         (Output_section::sort_attached_input_sections): Checkpoint input
8319         section list lazily.
8320         (Output_section::get_input_sections): Change type of input_sections to
8321         list of Simple_input_section pointers.  Checkpoint input section list
8322         lazily.  Also handle relaxed input sections.
8323         (Output_section::add_input_section_for_script): Take a reference to
8324         a Simple_input_section object instead of Relobj pointer and section
8325         index as parameter.  Handle relaxed input sections.
8326         (Output_section::save_states, Output_section::restore_states): New
8327         method definitions.
8328         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8329         (Output_data::is_data_size_fixed): New method definition.
8330         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8331         if it is fixed.
8332         (Output_data::address_and_file_offset_have_reset_values): New method
8333         definition.
8334         (Output_data::do_address_and_file_offset_have_reset_values): New method
8335         definition.
8336         (Output_data::set_data_size): Check that data size is not fixed.
8337         (Output_data::fix_data_size): New method definition.
8338         (Output_data::is_data_size_fixed_): New data member.
8339         (Output_section_headers::set_final_data_size): New method definition.
8340         (Output_section_headers::do_size): New method declaration.
8341         (Output_segment_headers::set_final_data_size): New method definition.
8342         (Output_segment_headers::do_size): New method declaration.
8343         (Output_file_header::set_final_data_size)::New method definition.
8344         (Output_file_header::do_size)::New method declaration.
8345         (Output_section_data::Output_section_data): Add new parameter
8346         is_data_size_fixed and use it to fix data size.
8347         (Output_data_const::Output_data_const): Adjust call to base class
8348         constructor and fix data size.
8349         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8350         base class constructor and fix data size.
8351         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8352         base class constructor and fix data size.
8353         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8354         class constructor and fix data size.
8355         (Output_data_group::set_final_data_size): New method definition.
8356         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8357         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8358         class constructor and fix data size.
8359         (Output_relaxed_input_section): New class definition.
8360         (Output_section::Simple_input_section): New class definition.
8361         (Output_section::get_input_sections): Adjust parameter list.
8362         (Output_section::add_input_section_for_script): Same.
8363         (Output_section::save_states, Output_section::restore_states,
8364         Output_section::do_address_and_file_offset_have_reset_values,
8365         (Output_section::Input_section::Input_section): Handle
8366         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8367         Output_relaxed_input_section.
8368         (Output_section::Input_section::is_input_section,
8369         Output_section::Input_section::set_output_section): Handle relaxed
8370         input section.
8371         (Output_section::Input_section::is_relaxed_input_section,
8372         Output_section::Input_section::output_section_data,
8373         Output_section::Input_section::relaxed_input_section): New method
8374         definitions.
8375         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8376         value.
8377         (Output_section::Input_section::u1_): Update comments.
8378         (Output_section::Input_section::u2_): Add new union member poris.
8379         (Output_section::Checkpoint_output_section): New classs definition.
8380         (Output_section::relax_input_section): New method declaration.
8381         (Output_section::checkpoint_): New data member.
8382         (Output_segment): Update comments.
8383         (Output_segment::Output_segment): Un-privatize copy constructor.
8384         (Output_segment::operator=): Un-privatize.
8385         * script-sections.cc (Output_section_element::Input_section_list):
8386         Change element type to Output_section::Simple_input_section.
8387         (Output_section_element_dot_assignment::set_section_addresses):
8388         Register output section data for relaxation clean up.
8389         (Output_data_exression::Output_data_expression): Adjust call to base
8390         constructor to fix data size.
8391         (Output_section_element_data::set_section_addresses): Register
8392         Output_data_expression object for relaxation clean up.
8393         (struct Input_section_info): Replace Relobj pointer and section index
8394         pair with Output_section::Simple_input_section and Convert struct to a
8395         class.
8396         (Input_section_sorter::operator()): Adjust access to
8397         Input_section_info data member to use accessors.
8398         (Output_section_element_input::set_section_addresses): Use layout
8399         parameter.  Adjust code to use Output_section::Simple_input_section
8400         and Input_secction_info classes.  Register filler for relaxation
8401         clean up.
8402         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8403         and section index pair with Output_section::Simple_input_section
8404         class.  Adjust code accordingly.
8405         (Phdrs_element::release_segment): New method definition.
8406         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8407         segment list.
8408         (Script_sections::release_segments): New method definition.
8409         * gold/script-sections.h (Script_sections::release_segments): New
8410         method declaration.
8411         * gold/target.h (Target::may_relax, Target::relax,
8412         Target::do_may_relax, Target::do_relax): New method definitions.
8413
8414 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8415
8416         * arm.cc (has_signed_unsigned_overflow): New function.
8417         (Arm_relocate_functions::abs8): New function.
8418         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8419         (Target_arm::Scan::global): Likewise.
8420         (Target_arm::relocate::relocate): Likewise.
8421         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8422         Likewise.
8423
8424 2009-09-16  Cary Coutant  <ccoutant@google.com>
8425
8426         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8427         * testsuite/Makefile.in: Regenerate.
8428
8429 2009-09-11  Nick Clifton  <nickc@redhat.com>
8430
8431         * po/gold.pot: Updated by the Translation project.
8432
8433 2009-09-08  Cary Coutant  <ccoutant@google.com>
8434
8435         * output.cc (Output_file::open): Add execute permission to empty file.
8436         * testsuite/Makefile.am (permission_test): New test.
8437         * testsuite/Makefile.in: Regenerate.
8438
8439 2009-09-02  Ian Lance Taylor  <iant@google.com>
8440
8441         * output.cc (Output_file::resize): Call map_no_anonymous rather
8442         than map.
8443
8444 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8445
8446         * gold.cc: Include "incremental.h".
8447         (queue_initial_tasks): Call Incremental_checker methods.
8448         * incremental.cc: Include "output.h".
8449         (Incremental_checker::can_incrementally_link_output_file): New
8450         method.
8451         * incremental.h (Incremental_checker): New class.
8452
8453         * output.cc (Output_file::open_for_modification): New method.
8454         (Output_file::map_anonymous): Changed return type to bool.  Record
8455         map in base_ field.
8456         (Output_file::map_no_anonymous): New method, broken out of map.
8457         (Output_file::map): Use map_no_anonymous and map_anonymous.
8458         * output.h (class Output_file): Update declarations.
8459
8460 2009-08-24  Cary Coutant  <ccoutant@google.com>
8461
8462         * options.h (Command_line::Pre_options): New class.
8463         (Command_line::pre_options): New member.
8464         * options.cc (gold::options::ready_to_register): New variable.
8465         (One_option::register_option): Do nothing if not registering options.
8466         Assert if same short option registered twice.
8467         (General_options::General_options): Turn off option registration when
8468         done constructing.
8469         (Command_line::Pre_options::Pre_options): New constructor.
8470
8471 2009-08-24  Cary Coutant  <ccoutant@google.com>
8472
8473         * options.h (General_options::no_keep_memory): Remove incorrect
8474         short option.
8475
8476 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8477
8478         * Makefile.am (am__skiplex, am__skipyacc): New.
8479         * Makefile.in: Regenerate.
8480
8481 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8482
8483         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8484         (INCLUDES): ... this.
8485         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8486         (AM_CPPFLAGS): Renamed from ...
8487         (INCLUDE): ... this.
8488         * Makefile.in, testsuite/Makefile.in: Regenerate.
8489
8490         * Makefile.in: Regenerate.
8491         * aclocal.m4: Likewise.
8492         * config.in: Likewise.
8493         * configure: Likewise.
8494         * testsuite/Makefile.in: Likewise.
8495
8496         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8497         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8498         * Makefile.in: Regenerate.
8499         * testsuite/Makefile.in: Regenerate.
8500
8501 2009-08-19  Cary Coutant  <ccoutant@google.com>
8502
8503         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8504         symbols in shared libraries overridden by hidden or internal symbols
8505         in the main program.
8506
8507 2009-08-19  Chris Demetriou  <cgd@google.com>
8508
8509         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8510         checking source file names in error messages.
8511
8512 2009-08-18  Doug Kwan  <dougkwan@google.com>
8513
8514         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8515         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8516         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8517         an elfcpp::Ehdr as parameter.
8518         * object.cc (Object::set_target): Remove the version that looks up
8519         a target and sets it.
8520         (Sized_relobj::setup): Take a Target object instead of
8521         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8522         (make_elf_sized_object): Find target and ask target to
8523         make an ELF object.
8524         * object.h: (Object::set_target): Remove the version that looks up
8525         a target and sets it.
8526         (Sized_relobj::setup): Take a Target object instead of
8527         an elfcpp:Ehdr as parameter.
8528         * target.cc: Include dynobj.h.
8529         (Target::do_make_elf_object_implementation): New.
8530         (Target::do_make_elf_object): New.
8531         * target.h (Target::make_elf_object): New template declaration.
8532         (Target::do_make_elf_object): New method declarations.
8533         (Target::do_make_elf_object_implementation): New template declaration.
8534
8535 2009-08-14  Ian Lance Taylor  <iant@google.com>
8536
8537         * gold.h (FUNCTION_NAME): Define.
8538         (gold_unreachable): Use FUNCTION_NAME.
8539
8540 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8541
8542         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8543         symbol in the --keep-unique list is not found.
8544
8545 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8546
8547         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8548         been maked as --keep-unique.
8549         (Icf::unfold_section): New function.
8550         * icf.h (Icf::unfold_section): New function.
8551         * options.h (General_options::keep_unique): New option.
8552         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8553         * testsuite/Makefile.in: Regenerate.
8554         * testsuite/icf_keep_unique_test.sh: New file.
8555         * testsuite/icf_keep_unique_test.cc: New file.
8556
8557 2009-08-12  Cary Coutant  <ccoutant@google.com>
8558
8559         PR 10471
8560         * resolve.cc (Symbol_table::resolve): Check for references from
8561         dynamic objects to hidden and internal symbols.
8562         * testsuite/Makefile.am (hidden_test.sh): New test.
8563         * testsuite/Makefile.in: Regenerate.
8564         * testsuite/hidden_test.sh: New script.
8565         * testsuite/hidden_test_1.c: New test source.
8566         * testsuite/hidden_test_main.c: New test source.
8567
8568 2009-08-11  Doug Kwan  <dougkwan@google.com>
8569
8570         * arm.cc: Update comments.
8571         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8572         segment to locate the .ARM.exidx section if present.
8573
8574 2009-08-09  Doug Kwan  <dougkwan@google.com>
8575
8576         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8577         patch.
8578
8579 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8580         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8581         compiler warnings.
8582
8583 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8584
8585         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8586         valid tls_segment only for non-debug-section relocations.
8587         * testsuite/Makefile.am: Add gc_tls_test.
8588         * testsuite/Makefile.in: Regenerate.
8589         * testsuite/gc_tls_test.cc: New file.
8590         * testsuite/gc_tls_test.sh: New file.
8591
8592 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8593
8594         * icf.cc: New file.
8595         * icf.h: New file.
8596         * Makefile.am (CCFILES): Add icf.cc.
8597         (HFILES): Add icf.h
8598         * Makefile.in: Regenerate.
8599         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8600         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8601         section, symbol and addend information for the relocs.
8602         * gold.cc (queue_middle_tasks): Call identical code folding.
8603         * gold.h: Add defines for multimap.
8604         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8605         to the call of finalize_local_symbols.
8606         * main.cc (main): Create object of class Icf.
8607         * object.cc (Sized_relobj::do_layout): Allow this function to be
8608         called twice during icf.
8609         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8610         to sections marked as identical by icf.
8611         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8612         when available.
8613         (Sized_relobj::do_section_entsize): New function.
8614         * object.h (Object::section_entsize): New function.
8615         (Object::do_section_entsize): New pure virtual function.
8616         (Relobj::finalize_local_symbols): Add new parameter.
8617         (Relobj::do_section_entsize): New function.
8618         * options.h (General_options::icf): New option.
8619         (General_options::icf_iterations): New option.
8620         (General_options::print_icf_sections): New option.
8621         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8622         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8623         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8624         icf.
8625         * symtab.cc (Symbol_table::is_section_folded): New function.
8626         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8627         to sections marked as identical by icf.
8628         * symtab.h (Symbol_table::set_icf): New function.
8629         (Symbol_table::icf): New function.
8630         (Symbol_table::is_section_folded): New function.
8631         (Symbol_table::icf_): New data member.
8632         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8633         * testsuite/Makefile.am: Add commands to build icf_test.
8634         * testsuite/Makefile.in: Regenerate.
8635         * testsuite/icf_test.sh: New file.
8636         * testsuite/icf_test.cc: New file.
8637
8638 2009-07-24  Chris Demetriou  <cgd@google.com>
8639
8640         * layout.cc (is_compressible_debug_section): Fix incorrect
8641         comment about compressed section names.
8642
8643 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8644
8645         PR 10419
8646         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8647
8648 2009-07-16  Ian Lance Taylor  <iant@google.com>
8649
8650         PR 10400
8651         * layout.h: #include <map>.
8652         (class Kept_section): Change from struct to class.  Add accessors
8653         and setters.  Add section size to Comdat_group mapping.  Change
8654         Comdat_group to std::map.  Add is_comdat_ field.  Add
8655         linkonce_size field in union.
8656         (class Layout): Update declaration of find_or_add_kept_section.
8657         Don't declare find_kept_object.
8658         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8659         parameter.  Add object, shndx, is_comdat, and is_group_name
8660         parameters.  Change all callers.  Adjust for new Kept_section.
8661         (Layout::find_kept_object): Remove.
8662         * object.cc (Sized_relobj::include_section_group): Update use of
8663         Kept_section.  Rename secnum to shndx.  Only record
8664         Kept_comdat_section if sections are the same size.
8665         (Sized_relobj::include_linkonce_section): Update use of
8666         Kept_section.  Only record Kept_comdat_section if sections are the
8667         same size.  Set size of linkonce section.
8668         (Sized_relobj::map_to_kept_section): Update call to
8669         get_kept_comdat_section.
8670         * object.h (class Sized_relobj): Rename fields in
8671         Kept_comdat_section to drop trailing underscores; change object
8672         field to Relobj*.  Change Kept_comdat_section_table to store
8673         struct rather than pointer.
8674         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8675         Add kept_object and kept_shndx parameters.  Change all callers.
8676         (Sized_relobj::get_kept_comdat_section): Change return type to
8677         bool.  Add kept_object and kept_shndx parameters.  Change all
8678         callers.
8679         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8680         Layout::find_or_add_kept_section.
8681
8682 2009-07-09  Ian Lance Taylor  <iant@google.com>
8683
8684         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8685         Reserve space in the hash table.
8686
8687 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8688
8689         * fileread.cc (File_read::get_mtime): New method.
8690         * fileread.h (Timespec): New structure.
8691         (File_read::get_mtime): New method.
8692         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8693         Renamed from timestamp_nsec.
8694         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8695         Elf_Xword.
8696         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8697         timestamp_nsec.
8698         (Incremental_inputs::report_archive): Save mtime; style fix.
8699         (Incremental_inputs::report_obejct): Save mtime; style fix.
8700         (Incremental_inputs::report_script): Save mtime; style fix.
8701         (Incremental_inputs::finalize_inputs): Style fix.
8702         (Incremental_inputs::finalize): Style fix.
8703         (Incremental_inputs::create_input_section_data): Store inputs
8704         mtime.
8705         * incremental.h (Incremental_inputs::report_script): Add mtime
8706         argument.
8707         (Incremental_inputs::Input_info::Input_info): Intialize only one
8708         union member.
8709         (Incremental_inputs::Input_info::archive): Move to nameless
8710         union.
8711         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8712         (Incremental_inputs::Input_info::script): Move to nameless union.
8713         (Incremental_inputs::mtime): New field.
8714         * script.cc (read_input_script): Pass file mtime to
8715         Incremental_input.
8716         * script.h (Script_info::inputs): Style fix.
8717
8718 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8719
8720         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8721         instead of 32.
8722
8723 2009-06-24  Ian Lance Taylor  <iant@google.com>
8724
8725         PR 10156
8726         * layout.cc (Layout::choose_output_section): If we find an
8727         existing section, update the flags.
8728         (Layout::create_notes): New function, broken out of
8729         Layout::finalize.
8730         (Layout::finalize): Don't create note sections.
8731         (Layout::create_note): Don't crash if linker script discards
8732         section.
8733         (Layout::create_gold_note): Likewise.
8734         (Layout::create_build_id): Likewise.  Don't set
8735         after_input_sections on the section.
8736         (Layout::create_executable_stack_info): Remove target parameter.
8737         Change caller.
8738         * layout.h (class Layout): Declare create_notes.  Update
8739         declaration of create_executable_stack_info.
8740         * gold.cc (queue_middle_tasks): Call create_notes.
8741         * output.cc (Output_section::update_flags_for_input_section): Move
8742         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8743         invalid.
8744         * output.h (Output_data::mark_address_invalid): New function.
8745         (class Output_section): Only declare, not define,
8746         update_flags_for_input_section.  Remove set_flags.
8747
8748 2009-06-24  Ian Lance Taylor  <iant@google.com>
8749
8750         * script-sections.cc (Output_section_definition::
8751         set_section_addresses): Rename shadowing local load_address to
8752         laddr.
8753
8754 2009-06-24  Ian Lance Taylor  <iant@google.com>
8755
8756         PR 10244
8757         * reloc.cc (relocate_sections): Skip empty relocation sections.
8758
8759 2009-06-23  Ian Lance Taylor  <iant@google.com>
8760
8761         PR 10156
8762         * layout.cc (Layout::create_note): Use choose_output_section
8763         rather than make_output_section.
8764
8765 2009-06-23  Ian Lance Taylor  <iant@google.com>
8766
8767         PR 10237
8768         * options.cc (General_options::parse_V): Set printed_version_.
8769         (General_options::General_options): Initialize printed_version_.
8770         * options.h (class General_options): Add printed_version_ field.
8771         * gold.cc (queue_initial_tasks): If there are no input files,
8772         don't give a fatal error if we printed the version information.
8773         (queue_middle_tasks): If using -r with a shared object, give a
8774         fatal error rather than an ordinary error.
8775
8776 2009-06-23  Ian Lance Taylor  <iant@google.com>
8777
8778         PR 10219
8779         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8780         (Layout::make_output_section): Set have_stabstr_section_ if we see
8781         a .stab*str section.
8782         (Layout::finalize): Call link_stabs_sections.
8783         (Layout::link_stabs_sections): New file.
8784         * layout.h (class Layout): Add have_stabstr_section_ field.
8785         Declare link_stabs_sections.
8786
8787 2009-06-23  Doug Kwan  <dougkwan@google.com>
8788
8789         * Makefile.am (libgold_a_LIBADD): New.
8790         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8791         * Makefile.in: Regenerate.
8792         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8793         * configure: Regenerate.
8794         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8795         * fileread.cc: Include sys/state.h
8796         * gold.h: Declare memmem and strndup if found missing.
8797         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8798
8799 2009-06-23  Ian Lance Taylor  <iant@google.com>
8800
8801         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8802         * configure: Rebuild.
8803
8804 2009-06-23  Ian Lance Taylor  <iant@google.com>
8805
8806         PR 10147
8807         * object.cc (Object::section_contents): Don't try to get a view if
8808         the section has length zero.
8809         (Object::handle_gnu_warning_section): If the section is empty, use
8810         the name of the section as the warning.
8811
8812 2009-06-23  Ian Lance Taylor  <iant@google.com>
8813
8814         PR 10133
8815         * stringpool.h (class Stringpool_template): Add optimize_ field.
8816         (Stringpool_template::set_optimize): New function.
8817         * stringpool.cc (Stringpool_template::Stringpool_template):
8818         Initialize optimize_ field.
8819         (Stringpool_template::set_string_offsets): Test local optimize
8820         fild rather than parameter.
8821         * layout.cc (Layout::Layout): Call set_optimize on the section
8822         name stringpool.
8823
8824 2009-06-22  Ian Lance Taylor  <iant@google.com>
8825
8826         PR 10030
8827         * yyscript.y: Parse TARGET.
8828         * script.cc (script_set_target): New function.
8829         * script-c.h (script_set_target): Declare.
8830         * options.cc (General_options::string_to_object_format): Rename
8831         from string_to_object_format in anonymous namespace.  Change
8832         callers.
8833         * options.h (class General_options): Declare
8834         string_to_object_format.
8835
8836 2009-06-22  Ian Lance Taylor  <iant@google.com>
8837
8838         * script-sections.cc (Script_sections::create_segments): Don't put
8839         program headers in a PT_LOAD segment if -n or -N.
8840
8841 2009-06-22  Ian Lance Taylor  <iant@google.com>
8842
8843         PR 10141
8844         * options.h (class General_options): Add -z lazy and -z now.  Sort
8845         -z options into alphabetical order.
8846         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8847
8848 2009-06-21  Ian Lance Taylor  <iant@google.com>
8849
8850         * layout.cc (Layout::make_output_section): Call
8851         Target::new_output_section.
8852         (Layout::attach_allocated_section_to_segment): Put large section
8853         sections in a separate load segment with the large segment flag
8854         set.
8855         (Layout::segment_precedes): Sort large data segments after other
8856         load segments.
8857         (align_file_offset): New static function.
8858         (Layout::set_segment_offsets): Use align_file_offset.
8859         * output.h (class Output_section): Add is_small_section_ and
8860         is_large_section_ fields.
8861         (Output_section::is_small_section): New function.
8862         (Output_section::set_is_small_section):  New function.
8863         (Output_section::is_large_section): New function.
8864         (Output_section::set_is_large_section): New function.
8865         (Output_section::is_large_data_section): New function.
8866         (class Output_segment): Add is_large_data_segment_ field.
8867         (Output_segment::is_large_data_segment): New function.
8868         (Output_segment::set_is_large_data_segment): New function.
8869         * output.cc (Output_section::Output_section): Initialize new
8870         fields.
8871         (Output_segment::Output_segment): Likewise.
8872         (Output_segment::add_output_section): Add assertion that large
8873         data sections always go in large data segments.  Force small data
8874         sections to the end of the list of data sections.  Force small BSS
8875         sections to the start of the list of BSS sections.  For large BSS
8876         sections to the end of the list of BSS sections.
8877         * symtab.h (class Symbol): Declare is_common_shndx.
8878         (Symbol::is_defined): Check Symbol::is_common_shndx.
8879         (Symbol::is_common): Likewise.
8880         (class Symbol_table): Define enum Commons_section_type.  Update
8881         declarations.  Add small_commons_ and large_commons_ fields.
8882         * symtab.cc (Symbol::is_common_shndx): New function.
8883         (Symbol_table::Symbol_table): Initialize new fields.
8884         (Symbol_table::add_from_object): Put small and large common
8885         symbols in the right list.
8886         (Symbol_table::sized_finalized_symbol): Check
8887         Symbol::is_common_shndx.
8888         (Symbol_table::sized_write_globals): Likewise.
8889         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8890         common symbol lists.  Don't call do_allocate_commons_list if the
8891         list is empty.
8892         (Symbol_table::do_allocate_commons_list): Remove is_tls
8893         parameter.  Add comons_section_type parameter.  Change all
8894         callers.  Handle small and large common symbols.
8895         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8896         Symbol::is_common_shndx.
8897         * resolve.cc (symbol_to_bits): Likewise.
8898         * target.h (Target::small_common_shndx): New function.
8899         (Target::small_common_section_flags): New function.
8900         (Target::large_common_shndx): New function.
8901         (Target::large_common_section_flags): New function.
8902         (Target::new_output_section): New function.
8903         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8904         small_common_section_flags, and large_common_section_flags
8905         fields.
8906         (Target::do_new_output_section): New virtual function.
8907         * arm.cc (Target_arm::arm_info): Initialize new fields.
8908         * i386.cc (Target_i386::i386_info): Likewise.
8909         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8910         Likewise.
8911         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8912         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8913         (Target_x86_64::do_new_output_section): New function.
8914         * configure.ac: Define conditional MCMODEL_MEDIUM.
8915         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8916         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8917         (large_LDFLAGS): Define.
8918         * testsuite/large.c: New file.
8919         * testsuite/testfile.cc (Target_test::test_target_info):
8920         Initialize new fields.
8921         * configure, testsuite/Makefile.in: Rebuild.
8922
8923 2009-06-05  Doug Kwan  <dougkwan@google.com>
8924
8925         * Makefile.am (CCFILES): Add target.cc.
8926         * Makefile.in: Regenerate.
8927         * i386.cc (class Target_i386): Define new virtual method to
8928         override do_is_local_label_name in parent.
8929         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8930         local symbols if --discard-locals or -X is given.
8931         * options.h (class General_options): Declare new options
8932         '--discard-locals' and '-X' for discarding locals.
8933         * target.h (class Target): Define new methods is_local_label_name.
8934         Declare new virtual method do_is_local_label_name.
8935         * target.cc: New file.
8936         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8937         (check_SCRIPTS): Add discard_locals_test.sh.
8938         (check_DATA): Add discard_local_tests.syms.
8939         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8940         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8941         * testsuite/Makefile.in: Regenerate.
8942         * testsuite/discard_locals_test.c: New file.
8943         * testsuite/discard_locals_test.sh: Same.
8944
8945 2009-06-05  Doug Kwan  <dougkwan@google.com>
8946
8947         * object.cc (Sized_relobj::Sized_relobj): Initialize
8948         discarded_eh_frame_shndx_ to -1U.
8949         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8950         section.
8951         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8952         a discarded .eh_frame section.
8953         (Sized_relobj::do_finalize_local_symbols): Ditto.
8954         * object.h (class Sized_relobj): Declare new member
8955         discarded_eh_frame_shndx_.
8956         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8957         (local_labels_test.o, local_labels_test): New rules.
8958         * testsuite/Makefile.in: Regenerate.
8959
8960 2009-06-04  Doug Kwan  <dougkwan@google.com>
8961
8962         * layout.cc (Layout::section_name_mapping): Add mapping for
8963         special ARM sections.
8964
8965 2009-06-03  Doug Kwan  <dougkwan@google.com>
8966
8967         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8968         (utils::has_overflow): Same.
8969
8970 2009-06-03  Ian Lance Taylor  <iant@google.com>
8971
8972         * layout.cc (Layout::section_name_mapping): New array, replacing
8973         Layout::linkonce_mapping.
8974         (Layout::section_name_mapping_count): New variable, replacing
8975         Layout::linkonce_mapping_count.
8976         (Layout::linkonce_output_name): Remove.
8977         (Layout::output_section_name): Rewrite.
8978         * layout.h (class Layout): Rename Linkonce_mapping to
8979         Section_name_mapping, linkonce_mapping to section_name_mapping,
8980         linkonce_mapping_count to section_name_mapping_count.  Don't
8981         declare linkonce_output_name.
8982
8983 2009-06-03  Doug Kwan  <dougkwan@google.com>
8984
8985         * gold/arm.cc (namespace utils): New.
8986         (Target_arm::reloc_is_non_pic): Define new method.
8987         (class Arm_relocate_functions): New.
8988         (Target_arm::Relocate::relocate): Handle relocation types used by
8989         Android.
8990
8991 2009-06-03  Ian Lance Taylor  <iant@google.com>
8992
8993         * arm.cc (Target_arm::scan::global): Use || instead of |.
8994
8995 2009-06-02  Doug Kwan  <dougkwan@google.com>
8996
8997         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8998         issued_non_pic_error_.
8999         (class Target_arm::Scan): Declare new method check_non_pic.
9000         Define new method symbol_needs_plt_entry.
9001         Declare new data member issued_non_pic_error_.
9002         (class Target_arm::Relocate): Declare new method
9003         should_apply_static_reloc.
9004         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9005         (Target_arm::Scan::check_non_pic): Define new method.
9006         (Target_arm::Scan::local): Handle a small subset of reloc types used
9007         by Android.
9008         (Target_arm::Scan::local): Same.
9009         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9010
9011 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9012
9013         * incremental.cc (Incremental_inputs::report_command_line): Filter
9014         out --incremental-* options.
9015
9016 2009-05-29  Doug Kwan  <dougkwan@google.com>
9017
9018         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9019         template class.
9020         (class Target_arm): Update comment.
9021         (Target_arm::Target_arm): Initialize new data members GOT_,
9022         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9023         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9024         and Target_arm::rel_dyn_section.
9025         Declare new_enum Target_arm::Got_type.
9026         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9027         and DYNBSS_.
9028         Update commments for member do_dynsym_value.
9029         (Target_arm::got_size, Target_arm::plt_section,
9030         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9031         new methods inside class defintion.
9032         (Target_arm::got_section): Define new method.
9033         (Target_arm::rel_dyn_section): Same.
9034         (Output_data_plt_arm): New template class.
9035         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9036         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9037         (Output_data_plt_arm::add_entry): Same.
9038         (Output_data_plt_arm::first_plt_entry): Define new
9039         static data member for PLT instruction template.
9040         (Output_data_plt_arm::plt_entry): Same.
9041         (Output_data_plt_arm::do_write): Define new method.
9042         (Target_arm::make_plt_entry): Same.
9043         (Target_arm::do_finalize_sections): Same.
9044         (Target_arm::do_dynsym_value): Same.
9045
9046 2009-05-28  Doug Kwan  <dougkwan@google.com>
9047
9048         * Makefile.am (TARGETSOURCES): Add arm.cc.
9049         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9050         * Makefile.in: Regenerate.
9051         * arm.cc: New file.
9052         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9053
9054 2009-05-26  Doug Kwan  <dougkwan@google.com>
9055
9056         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9057         (General_options::check_excluded_libs): Strip off directories in
9058         archive name before matching like GNU ld does.
9059         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9060         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9061         (exclude_libs_test_LDFLAGS): Add linker option
9062         -Wl,--exclude-libs,libexclude_libs_test_3
9063         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9064         an explicit archive without using -l.
9065         (alt/libexclude_libs_test_3.a): New make rule.
9066         * testsuite/Makefile.in: Regenerate.
9067         * testsuite/exclude_libs_test.c : Declare lib3_default().
9068         (main): Call it.
9069         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9070         * exclude_libs_test_3.c: New file.
9071
9072 2009-05-26  Nick Clifton  <nickc@redhat.com>
9073
9074         * po/id.po: New Indonesian translation.
9075         * po/gold.pot: Updated template file.
9076
9077 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9078
9079         * testsuite/Makefile.am: Add -ffunction-sections to compile
9080         gc_comdat_test files.  Add -Wl,--gc-sections to build
9081         gc_comdat_test.
9082         * testsuite/Makefile.in: Regenerate.
9083         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9084
9085 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9086
9087         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9088         kept comdat section was garbage collected.
9089         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9090         * testsuite/Makefile.in: Regenerate.
9091         * testsuite/gc_comdat_test.sh: New file.
9092         * testsuite/gc_comdat_test_1.cc: New file.
9093         * testsuite/gc_comdat_test_2.cc: New file.
9094
9095 2009-05-19  Doug Kwan  <dougkwan@google.com>
9096
9097         * archive.cc (Archive::Archive): Move constructor from archive.h
9098         to here.  Initialize no_export_.
9099         (Archive::get_elf_object_for_member): Set no_export flag of object.
9100         * archive.h (Archive::Archive): Move constructor body to
9101         archive.cc.
9102         (Archive::no_export): New method.
9103         (Archive::no_export_): New field.
9104         * object.h (Object::Object): Initialize no_export_ to false.
9105         (Object::no_export, Object::set_no_export): New methods.
9106         (Object::no_export_): New field.
9107         * options.cc (General_options::parse_exclude_libs): New method.
9108         (General_options::check_excluded_libs) Same.
9109         * options.h (exclude_libs): New option.
9110         (General_options::check_excluded_libs): New method declaration.
9111         (General_options::excluded_libs_): New field.
9112         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9113         default or protected visibility if an object has no-export flag set.
9114         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9115         (check_SCRIPTS): Add exclude_libs_test.sh.
9116         (check_DATA): Add exclude_libs_test.syms.
9117         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9118         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9119         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9120         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9121         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9122         libexclude_libs_test_2.a): New rules.
9123         * testsuite/Makefile.in: Regenerate.
9124         * testsuite/exclude_libs_test.c: New file.
9125         * testsuite/exclude_libs_test.sh: Ditto.
9126         * testsuite/exclude_libs_test_1.c: Ditto.
9127         * testsuite/exclude_libs_test_2.c: Ditto.
9128
9129 2009-05-15  Ian Lance Taylor  <iant@google.com>
9130
9131         * configure.ac: Check for declarations for cases where libiberty.h
9132         checks HAVE_DECL_xxx.
9133         * configure, config.in: Rebuild.
9134
9135 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9136
9137         * gold.h (Incremental_argument_list): Remove (invalid) forward
9138         declaration.
9139         * incremental.cc (Incremental_inputs::report_achive): New method.
9140         (Incremental_inputs::report_object): New method.
9141         (Incremental_inputs::report_script): New method.
9142         (Incremental_inputs::finalize_inputs): New method.
9143         (Incremental_inputs::finalize): Call finalize_inputs().
9144         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9145         Create inputs entries.
9146         * incremental.h (Incremental_input_type): New enum.
9147         (Incremental_inputs::Incremental_input): Initialize new fields.
9148         (Incremental_inputs::report_inputs): New method.
9149         (Incremental_inputs::report_achive): New method.
9150         (Incremental_inputs::report_object): New method.
9151         (Incremental_inputs::report_script): New method.
9152         (Incremental_inputs::finalize_inputs): New method.
9153         (Incremental_inputs::Input_info): New struct.
9154         (Incremental_inputs::Input_info_map): New typedef.
9155         (Incremental_inputs::lock_): New field.
9156         (Incremental_inputs::Inputs_): New field.
9157         (Incremental_inputs::Inputs_map): New field.
9158         * main.cc (main): Call Incremental_input::report_inputs.
9159         * options.h (Input_argument_list): Typedef moved from
9160         Input_arguments.
9161         (Input_file_group::Files): Remove, use ::Input_argument_list.
9162         (Input_file_group::Input_argument_list): Remove, use
9163         ::Input_argument_list.
9164         * plugin.cc (Plugin_manager::add_input_file): Add error in
9165         incremental build.
9166         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9167         functions.
9168         * script.cc (read_input_script): Call
9169         Incremental_input::report_script.
9170         * script.h (Script_info): New class.
9171
9172 2009-04-27  Ian Lance Taylor  <iant@google.com>
9173
9174         * x86_64.cc (do_adjust_output_section): Set entsize to
9175         plt_entry_size.
9176
9177 2009-04-23  Elliott Hughes  <enh@google.com>
9178
9179         * output.cc (Output_file::close): After short writes, continue
9180         writing from the correct offset in the buffer being written.
9181
9182 2009-04-23  Chris Demetriou  <cgd@google.com>
9183
9184         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9185         * configure: Regenerate.
9186         * config.in: Regenerate.
9187         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9188         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9189
9190 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9191
9192         * incremental.cc (Incremental_inputs_header_data): Renamed from
9193         Incremental_input_header_data.
9194         (Incremental_inputs_header_data::data_size): New field.
9195         (Incremental_inputs_header_data::put_input_file_count): Renamed
9196         from input_file_count.
9197         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9198         from command_line_offset.
9199         (Incremental_inputs_header_data::put_reserved): Renamed from
9200         put_reserved.
9201         (Incremental_inputs_entry_data): Renamed from
9202         Incremental_input_entry_data.
9203         (Incremental_inputs_entry_data::data_size): New field.
9204         (Incremental_inputs::report_command_line): New method.
9205         (Incremental_inputs::finalize): New method.
9206         (Incremental_inputs::create_incremental_inputs_data): New method.
9207         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9208         * incremental.h: New file.
9209         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9210        (Layout::finalize): Create incremental inputs section in
9211         incremental builds.
9212        (Layout::create_incremental_info_sections): New method.
9213         * layout.h (Layout::incremental_inputs): New method.
9214        (Layout::create_incremental_info_sections): New method.
9215        (Layout::incremental_inputs_): New field.
9216         * main.cc (main): Notify Incremental_input of the command line.
9217
9218 2009-04-01  Ian Lance Taylor  <iant@google.com>
9219             Mikolaj Zalewski  <mikolajz@google.com>
9220
9221         * gold.h (reserve_unordered_map): Define, three versions, one for
9222         each version of Unordered_map.
9223         * layout.cc (Layout::Layout): Remove options parameter.  Add
9224         number_of_input_files parameter.  Don't initialize options_.
9225         Initialize number_of_input_files_ and resized_signatures_.  Move
9226         sections_are_attached_.
9227         (Layout::layout_group): Reserve space for group_signatures_.
9228         (Layout::find_or_add_kept_section): Change name parameter to be a
9229         reference.  Resize signatures_ map when it gets large enough.
9230         (Layout::layout_eh_frame): Use parameters->options() instead of
9231         this->options_.
9232         (Layout::make_output_section): Likewise.
9233         (Layout::attach_allocated_section_to_segment): Likewise.
9234         (Layout::finalize, Layout::create_executable_stack): Likewise.
9235         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9236         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9237         * layout.h (class Layout): Update declarations.  Remove options_
9238         field.  Add number_of_input_files_ and resized_signatures_
9239         fields.  Move sections_are_attached_ field.
9240         * main.cc (main): Pass number of input files to Layout
9241         constructor.  Don't pass options.
9242
9243 2009-03-30  Ian Lance Taylor  <iant@google.com>
9244
9245         * ffsll.c (ffsll): Correct implementation.
9246
9247 2009-03-27  Ian Lance Taylor  <iant@google.com>
9248
9249         * ffsll.c: New file.
9250         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9251         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9252         * ftruncate.c (ftruncate): Declare before definition.
9253         * mremap.c (mremap): Likewise.
9254         * pread.c (pread): Likewise.
9255         * configure, Makefile.in, config.in: Rebuild.
9256
9257         * mremap.c: New file.
9258         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9259         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9260         (mremap): Declare if HAVE_MREMAP is not defined.
9261         * configure, Makefile.in, config.in: Rebuild.
9262
9263 2009-03-27  Cary Coutant  <ccoutant@google.com>
9264
9265         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9266         position independent.
9267         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9268         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9269
9270 2009-03-24  Cary Coutant  <ccoutant@google.com>
9271
9272         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9273         an executable.
9274         (needs_dynamic_reloc): Likewise.
9275
9276 2009-03-24  Ian Lance Taylor  <iant@google.com>
9277
9278         * yyscript.y (file_cmd): Recognize EXTERN.
9279         (extern_name_list, extern_name_list_body): New nonterminals.
9280         * script.cc (script_add_extern): Define.
9281         * script-c.h (script_add_extern): Declare.
9282
9283 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9284
9285         * object.cc (is_elf_object): Define.
9286         * object.h (is_elf_object): Declare.
9287         * archive.cc (Archive::get_elf_object_for_member): Call
9288         is_elf_object.
9289         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9290
9291 2009-03-24  Elliott Hughes  <enh@google.com>
9292
9293         * output.cc (Output_file::map_anonymous): Define.
9294         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9295         try an anonymous one.  Report the size if the mmap fails.
9296         * output.h (class Output_file): Declare map_anonymous.
9297
9298 2009-03-24  Ian Lance Taylor  <iant@google.com>
9299
9300         * target-select.cc (instantiate_target): Don't acquire the lock if
9301         the instantiated_target_ field has already been set.
9302
9303 2009-03-23  Ian Lance Taylor  <iant@google.com>
9304
9305         * gold-threads.h (class Initialize_lock): Define.
9306         * gold-threads.cc (class Initialize_lock_once): Define.
9307         (initialize_lock_control): New static variable.
9308         (initialize_lock_pointer): New static variable.
9309         (initialize_lock_once): New static function.
9310         (Initialize_lock::Initialize_lock): Define.
9311         (Initialize_lock::initialize): Define.
9312         * target-select.h: Include "gold-threads.h".
9313         (class Target_selector): Add lock_ and initialize_lock_ fields.
9314         Don't define instantiate_target, just declare it.
9315         * target-select.cc (Target_selector::Target_selector): Initialize
9316         new fields.
9317         (Target_selector::instantiate_target): Define.
9318         * descriptors.h: Include "gold-threads.h".
9319         (class Descriptors): Add initialize_lock_ field.
9320         * descriptors.cc (Descriptors::Descriptors): Initialize new
9321         field.
9322         (Descriptors::open): Use initialize_lock_ field
9323         * errors.h (class Errors): Add initialize_lock_ field.
9324         * errors.cc (Errors::Errors): Initialize new field.
9325         (Errors::initialize_lock): Use initialize_lock_ field.
9326         * powerpc.cc (class Target_selector_powerpc): Remove
9327         instantiated_target_ field.  In do_recognize call
9328         instantiate_target rather than do_instantiate_target.  In
9329         do_instantiate_target just allocate a new target.
9330         * sparc.cc (class Target_selector_sparc): Likewise.
9331
9332         * freebsd.h: New file.
9333         * i386.cc: Include "freebsd.h".
9334         (Target_i386): Derive from Target_freebsd rather than
9335         Sized_target.
9336         (Target_selector_i386): Derive from Target_selector_freebsd rather
9337         than Target_selector.
9338         * x86_64.cc: Include "freebsd.h".
9339         (Target_x86_64): Derive from Target_freebsd rather than
9340         Sized_target.
9341         (Target_selector_x86_64): Derive from Target_selector_freebsd
9342         rather than Target_selector.
9343         * target.h (class Target): Add adjust_elf_header and
9344         do_adjust_elf_header.
9345         * output.cc (Output_file_header:: do_sized_write): Call target
9346         adjust_elf_header routine.
9347         * configure.tgt: Set targ_osabi.
9348         * configure.ac: Define GOLD_DEFAULT_OSABI.
9349         * parameters.cc (Parameters::default_target): Pass
9350         GOLD_DEFAULT_OSABI to select_target.
9351         * target-select.h (class Target_selector): Make instantiate_target
9352         protected rather than private.
9353         * Makefile.am (HFILES): Add freebsd.h.
9354         * configure, Makefile.in, config.in: Rebuild.
9355
9356         * merge.cc (do_add_input_section): Correct pend value.  Change
9357         message about last entry not being null terminated from error to
9358         warning.
9359
9360 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9361
9362         * incremental.cc: New file.
9363         * Makefile.am (CCFILES): Add incremental.cc.
9364         * Makefile.in: Rebuild.
9365
9366 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9367
9368         * layout.cc (Layout::output_section_name): Preserve names
9369         of '.note.' sections.
9370
9371 2009-03-19  Ian Lance Taylor  <iant@google.com>
9372
9373         * descriptors.cc (Descriptors::open): Check that the options are
9374         valid before using them.
9375
9376 2009-03-18  Ian Lance Taylor  <iant@google.com>
9377
9378         * script-sections.h: Include <list>.
9379         (class Script_sections): Change Sections_elements from std::vector
9380         to std::list.  Typedef public Elements_iterator.  Add
9381         orphan_section_placement_, data_segment_align_start_, and
9382         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9383         field.
9384         * script-sections.cc (class Orphan_section_placement): New class.
9385         (class Sections_element): Add virtual functions is_relro and
9386         orphan_section_init.  Remove virtual function place_orphan_here.
9387         (class Output_section_definition): Add is_relro and
9388         orphan_section_init.  Remove place_orphan_here.
9389         (class Orphan_output_section): Likewise.
9390         (Script_sections::Script_sections): Update for field changes.
9391         (Script_sections::data_segment_align): Set saw_data_segment_align_
9392         and data_segment_align_start_, not data_segment_align_index.
9393         (Script_sections::data_segment_relro_end): Check
9394         saw_data_segment_align_.  Use data_segment_align_start_ rather
9395         than data_segment_align_index_.
9396         (Script_sections::place_orphan): Rewrite to use
9397         Orphan_section_placement.
9398
9399 2009-03-17  Ian Lance Taylor  <iant@google.com>
9400
9401         * archive.cc (Archive::add_symbols): Check for a version attached
9402         to the symbol name in the archive map.
9403         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9404         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9405         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9406         (ver_test_11.a): New target.
9407         * testsuite/Makefile.in: Rebuild.
9408
9409         * configure.ac: Check for chsize and posix_fallocate.  Replace
9410         ftruncate.
9411         * ftruncate.c: New file, from gnulib.
9412         * output.cc (posix_fallocate): Define dummy version if not
9413         HAVE_POSIX_FALLOCATE.
9414         (Output_file::map): Call posix_fallocate rather than lseek and
9415         write.
9416         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9417         * configure, Makefile.in, config.in: Rebuild.
9418
9419 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9420
9421         * layout.h (Layout::create_note): Add section_name parameter.
9422         * layout.cc (Layout::create_note): Likewise.
9423         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9424
9425 2009-03-17  Ian Lance Taylor  <iant@google.com>
9426
9427         * descriptors.cc: Include "options.h".
9428         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9429         (Descriptors::open): Always use O_CLOEXEC when opening a new
9430         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9431         then set FD_CLOEXEC.
9432
9433         * sparc.cc (class Target_sparc): Add has_got_section.
9434         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9435         make sure we have a GOT section.
9436
9437         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9438         (Target_sparc::Scan::local): Likewise.
9439         (Target_sparc::Scan::global): Likewise.
9440         (Target_sparc::Relocate::relocate): Likewise.
9441         (Target_sparc::Relocate::relocate_tls): Likewise.
9442
9443         * symtab.cc (Symbol_table::define_default_version): New function,
9444         broken out of add_from_object.
9445         (Symbol_table::add_from_object): Call define_default_version.
9446         (Symbol_table::define_special_symbol): Add resolve_oldsym
9447         parameter.  Change all callers.  If the version for a symbol comes
9448         from a version script, resolve it with the symbol with the same
9449         name with no version.  Also add the symbol without a version if
9450         appropriate.
9451         (do_define_in_output_data): If resolving with oldsym, don't delete
9452         sym.
9453         (do_define_in_output_segment): Likewise.
9454         (do_define_as_constant): Likewise.
9455         * symtab.h (class Symbol_table): Update declarations.
9456
9457 2009-03-13  Ian Lance Taylor  <iant@google.com>
9458
9459         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9460         (Read_symbols::requeue): New function.
9461         (Read_symbols::do_read_symbols): If make_elf_object fails because
9462         the target type is not configured, and the file was searched for,
9463         issue a warning and retry with the next directory.
9464         (Add_symbols::run): If the file has an incompatible format, and
9465         it was searched for, requeue the Read_symbols task.  On error,
9466         release the object.
9467         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9468         dirindex parameter to constructor.  Change all callers.  Declare
9469         incompatible_warning and requeue.
9470         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9471         input_argument_ and input_group_ fields.  Add them to
9472         constructor.  Change all callers.
9473         (class Read_script): Add dirindex_ field.  Add it to constructor.
9474         Change all callers.
9475         * archive.cc (Archive::setup): Remove input_objects parameter.
9476         Change all callers.
9477         (Archive::get_file_and_offset): Likewise.
9478         (Archive::read_all_symbols): Likewise.
9479         (Archive::read_symbols): Likewise.
9480         (Archive::get_elf_object_for_member): Remove input_objects
9481         parameter.  Add punconfigured parameter.  Change all callers.
9482         (Archive::add_symbols): Change return type to bool.  Check return
9483         value of include_member.
9484         (Archive::include_all_members): Likewise.
9485         (Archive::include_member): Change return type to bool.  Return
9486         false if first included object has incompatible target.  Set
9487         included_member_ field.
9488         (Add_archive_symbols::run): If add_symbols returns false, requeue
9489         Read_symbols task.
9490         * archive.h (class Archive): Add included_member_ field.
9491         Initialize it in constructor.  Add input_file and searched_for
9492         methods.  Update declarations.
9493         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9494         input_argument_ fields.  Add them to constructor.  Change all
9495         callers.
9496         * script.cc: Include "target-select.h".
9497         (class Parser_closure): Add skip_on_incompatible_target_ and
9498         found_incompatible_target_ fields.  Add
9499         skip_on_incompatible_target parameter to constructor.  Change all
9500         callers.  Add methods skip_on_incompatible_target,
9501         clear_skip_on_incompatible_target, found_incompatible_target, and
9502         set_found_incompatible_target.
9503         (read_input_script): Add dirindex parameter.  Change all callers.
9504         If parser finds an incompatible target, requeue Read_symbols
9505         task.
9506         (script_set_symbol): Clear skip_on_incompatible_target in
9507         closure.
9508         (script_add_assertion, script_parse_option): Likewise.
9509         (script_start_sections, script_add_phdr): Likewise.
9510         (script_check_output_format): New function.
9511         * script.h (read_input_script): Update declaration.
9512         * script-c.h (script_check_output_format): Declare.
9513         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9514         (ignore_cmd): Remove OUTPUT_FORMAT.
9515         * fileread.cc (Input_file::Input_file): Add explicit this.
9516         (Input_file::will_search_for): New function.
9517         (Input_file::open): Add pindex parameter.  Change all callers.
9518         * fileread.h (class Input_file): Add input_file_argument method.
9519         Declare will_search_for.  Update declarations.
9520         * object.cc (make_elf_object): Add punconfigured parameter.
9521         Change all callers.
9522         * object.h (class Object): Make input_file public.  Add
9523         searched_for method.
9524         (make_elf_object): Update declaration.
9525         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9526         restart search.
9527         * dirsearch.h (class Dirsearch): Update declaration.
9528         * options.h (class General_options): Add --warn-search-mismatch.
9529         * parameters.cc (Parameters::is_compatible_target): New function.
9530         * parameters.h (class Parameters): Declare is_compatible_target.
9531         * workqueue.cc (Workqueue::add_blocker): New function.
9532         * workqueue.h (class Workqueue): Declare add_blocker.
9533
9534         * fileread.cc (Input_file::open): Remove options parameter.
9535         Change all callers.
9536         (Input_file::open_binary): Likewise.
9537         * script.cc (read_input_script): Likewise.
9538         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9539         options parameter from constructor.  Change all callers.
9540         (class Read_script): Likewise.
9541         * fileread.h (class Input_file): Update declarations.
9542         * script.h (read_input_script): Update declaration.
9543
9544 2009-03-10  Nick Clifton  <nickc@redhat.com>
9545
9546         * po/es.po: New Spanish translation.
9547
9548 2009-03-06  Cary Coutant  <ccoutant@google.com>
9549
9550         * options.cc (parse_short_option): Keep dash_z from registering itself.
9551
9552 2009-03-03  Ian Lance Taylor  <iant@google.com>
9553
9554         PR 9918
9555         * target-reloc.h (relocate_section): Pass output_section to
9556         relocate.
9557         * i386.cc (Target_i386::should_apply_static_reloc): Add
9558         output_section parameter.  Change all callers.
9559         (Target_i386::Relocate::relocate): Add output_section parameter.
9560         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9561         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9562         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9563         * testsuite/two_file_shared.sh: New script.
9564         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9565         (check_DATA): Add two_file_shared.dbg.
9566         (two_file_shared.dbg): New target.
9567         * testsuite/Makefile.in: Rebuild.
9568
9569 2009-03-01  Ian Lance Taylor  <iant@google.com>
9570
9571         * configure.ac: Check for byteswap.h.
9572         * configure: Rebuild.
9573         * config.in: Rebuild.
9574
9575 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9576
9577         * layout.cc (Layout::find_or_add_kept_section): New function.
9578         (Layout::add_comdat): Removed.
9579         * layout.h (struct Kept_section): Move out of class Layout.
9580         Remove trailing underscores from field names.  Add group_sections
9581         field.  Rename group_ field to is_group.  Change all uses.
9582         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9583         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9584         comdat_groups_ field.
9585         (Sized_relobj::include_section_group): Use
9586         find_or_add_kept_section and Kept_section::group_sections.
9587         (Sized_relobj::include_linkonce_section): Likewise.
9588         * object.cc (class Sized_relobj): Don't define Comdat_group or
9589         Comdat_group_table.  Remove find_comdat_group and
9590         add_comdat_group.  Remove comdat_groups_ field.
9591         * plugin.cc (include_comdat_group): Use
9592         Layout::find_or_add_kept_section.
9593
9594 2009-02-28  Ian Lance Taylor  <iant@google.com>
9595
9596         * README: --gc-sections and map files are now supported.  Document
9597         some build requirements.
9598
9599         PR 6992
9600         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9601         relocatable link set the value of the section symbol to zero.
9602         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9603         relocatable link don't include the section address in the local
9604         symbol value.
9605
9606 2009-02-27  Ian Lance Taylor  <iant@google.com>
9607
9608         PR 6811
9609         * options.h (class Search_directory): Add is_system_directory.
9610         (class General_options): Declare is_in_system_directory.
9611         * options.cc (get_relative_sysroot): Make static.
9612         (get_default_sysroot): Make static.
9613         (General_optoins::is_in_system_directory): New function.
9614         * fileread.cc (Input_file::is_in_system_directory): New function.
9615         * fileread.h (class Input_file): Declare is_in_system_directory.
9616         * object.h (class Object): Add is_in_system_directory.
9617         (class Input_objects): Remove system_library_directory_ field.
9618         * object.cc (Input_objects::add_object): Don't set
9619         system_library_directory_.
9620         (input_objects::found_in_system_library_directory): Remove.
9621         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9622         parameter.  Change all callers.
9623         (Symbol_table::sized_write_globals): Likewise.
9624         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9625         Call Object::is_in_system_directory.
9626         * symtab.h (class Symbol_table): Update declarations.
9627
9628         PR 5990
9629         * descriptors.h (Open_descriptor): Add is_on_stack field.
9630         * descriptors.cc (Descriptors::open): If the descriptor is on the
9631         top of the stack, remove it.  Initialize is_on_stack field.
9632         (Descriptors::release): Only add pod to stack if it is not on the
9633         stack already.
9634         (Descriptors::close_some_descriptor): Clear stack_next and
9635         is_on_stack fields.
9636
9637         PR 7091
9638         * output.cc (Output_section::find_starting_output_address): Rename
9639         from starting_output_address; add PADDR parameter; change return
9640         type.
9641         * output.h (class Output_section): Declare
9642         find_starting_output_address instead of starting_output_address.
9643         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9644         section symbol for which we can't find a merge section.
9645
9646         PR 9836
9647         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9648         hidden or internal, force the symbol to be local.
9649         * resolve.cc (Symbol::override_visibility): Define.
9650         (Symbol::override_base): Use override_visibility.
9651         (Symbol_table::resolve): Likewise.
9652         (Symbol::override_base_with_special): Likewise.
9653         (Symbol_table::override_with_special): If the visibility is hidden
9654         or internal, force the symbol to be local.
9655         * symtab.h (class Symbol): Add set_visibility and
9656         override_visibility.
9657         * testsuite/ver_test_1.sh: New file.
9658         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9659         (check_DATA): Add ver_test_1.syms.
9660         (ver_test_1.syms): New target.
9661         * testsuite/Makefile.in: Rebuild.
9662
9663 2009-02-25  Cary Coutant  <ccoutant@google.com>
9664
9665         * layout.cc (Layout::choose_output_section): Don't rename sections
9666         when using a linker script that has a SECTIONS clause.
9667         * Makefile.in: Regenerate.
9668
9669         * testsuite/Makefile.am (script_test_5.sh): New test case.
9670         * testsuite/Makefile.in: Regenerate.
9671         * testsuite/script_test_5.cc: New file.
9672         * testsuite/script_test_5.sh: New file.
9673         * testsuite/script_test_5.t: New file.
9674
9675 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9676
9677         * archive.cc (Archive::include_member): Update calls to add_symbols.
9678         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9679         the Layout argument.
9680         * dynobj.h (do_add_symbols): Add the Layout argument.
9681         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9682         Layout argument.
9683         * object.h (Object::add_symbols): Add the Layout argument.
9684         (Object::do_add_symbols): Add the Layout argument.
9685         (Sized_relobj::do_add_symbols): Add the Layout argument.
9686         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9687         Unify the two versions.
9688         (Add_plugin_symbols): Remove.
9689         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9690         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9691         (Add_plugin_symbols): Remove.
9692         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9693         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9694         (Add_symbols::run): Make it work with Pulginobj.
9695
9696 2009-02-06  Ian Lance Taylor  <iant@google.com>
9697
9698         * object.cc (Sized_relobj::do_layout): Make info message start
9699         with lower case letter.
9700
9701 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9702
9703         * binary.cc: Fix file comment.
9704
9705         * options.h (enum Incremental_disposition): Define.
9706         (class General_options): Add new options: --incremental,
9707         --incremental_changed, --incremental_unchanged,
9708         --incremental_unknown.  Add incremental_disposition_ and
9709         implicit_incremental_ fields.
9710         (General_options::incremental_disposition): New function.
9711         (class Position_dependent_options): Add incremental_disposition
9712         option.
9713         (Position_dependent_options::copy_from_options): Set incremental
9714         dispositions.
9715         * options.cc (General_options::parse_incremental_changed): New
9716         function.
9717         (General_options::parse_incremental_unchanged): New function.
9718         (General_options::parse_incremental_unknown): New function.
9719         (General_options::General_options): Initialize new fields
9720         incremental_disposition_ and implicit_incremental_.
9721         (General_options::finalize): Check for uasge of --incremental-*
9722         without --incremental.
9723
9724 2009-02-06  Chris Demetriou  <cgd@google.com>
9725
9726         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9727         pointer and to report location as the file name associated with
9728         the symbol.
9729         (gold_undefined_symbol_at_location): New function to replace the
9730         old gold_undefined_symbol functionality.
9731         * target-reloc.h (relocate_section): Update to use
9732         gold_undefined_symbol_at_location.
9733         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9734         Call gold_undefined_symbol function rather than gold_error.
9735         * errors.h (Errors::undefined_symbol): Take location as a
9736         string, rather than calculating it from a relocation.
9737         * errors.cc (Errors::fatal): Print "fatal error:" before the
9738         formatted message.
9739         (Errors::error, Errors::error_at_location): Print "error: "
9740         before the formatted message.
9741         (Errors::undefined_symbol): Take location as a string, rather
9742         than calculating it from a relocation.
9743         (gold_undefined_symbol_at_location): New function akin to
9744         old gold_undefined_symbol, calculates location from relocation.
9745         (gold_undefined_symbol): Change to take only a Symbol pointer
9746         and to report location as the file name associated with the symbol.
9747         * testsuite/debug_msg.sh: Update for changed error messages.
9748         * testsuite/undef_symbol.sh: Likewise.
9749
9750 2009-02-04  Duncan Sands  <baldrick@free.fr>
9751
9752         PR 9812
9753         * reduced_debug_output.h
9754         (Output_reduced_debug_abbrev_section::failed): Use format for
9755         gold_warning.
9756         (Output_reduced_debug_info_section::faild): Likewise.
9757
9758 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9759
9760         * script.cc (Lazy_demangler): New class.
9761         (Version_script_info::get_symbol_version_helper): Demangle a
9762         symbol only once.
9763
9764 2009-01-29  Cary Coutant  <ccoutant@google.com>
9765
9766         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9767         to __tls_get_addr.
9768         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9769
9770 2009-01-28  Ian Lance Taylor  <iant@google.com>
9771
9772         * version.cc (version_string): Bump to 1.9.
9773
9774         * gold.h: Include <cstring> and <stdint.h>.
9775         * version.cc: Include <cstdio>.
9776         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9777         warning.
9778         * reduced_debug_output.cc (insert_into_vector): Rename from
9779         Insert_into_vector; change all callers.  Use Swap_unaligned to
9780         avoid aliasing issue; remove union since it is unnecessary.
9781
9782 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9783
9784         * Makefile.am (CCFILES): Add gc.cc.
9785         (HFILES): Add gc.h.
9786         * Makefile.in: Regenerate.
9787         * gold.cc (Gc_runner): New class.
9788         (queue_initial_tasks): Call garbage collection related tasks
9789         when corresponding options are invoked.
9790         (queue_middle_gc_tasks): New function.
9791         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9792         processed early before laying out sections during garbage collection.
9793         * gold.h (queue_middle_gc_tasks): New function.
9794         (is_prefix_of): Move from "layout.cc".
9795         * i386.cc (Target_i386::gc_process_relocs): New function.
9796         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9797         * main.cc (main): Create object of class "Garbage_collection".
9798         * object.cc (Relobj::copy_symbols_data): New function.
9799         (Relobj::is_section_name_included): New function.
9800         (Sized_relobj::do_layout): Allow this function to be called twice
9801         during garbage collection and defer layout of section during the
9802         first call.
9803         * object.h (Relobj::get_symbols_data): New function.
9804         (Relobj::is_section_name_included): New function.
9805         (Relobj::copy_symbols_data): New function.
9806         (Relobj::set_symbols_data): New function.
9807         (Relobj::get_relocs_data): New function.
9808         (Relobj::set_relocs_data): New function.
9809         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9810         (Relobj::gc_process_relocs): New function.
9811         (Relobj::do_gc_process_relocs): New pure virtual function.
9812         (Relobj::sd_): New data member.
9813         (Sized_relobj::is_output_section_offset_invalid): New function.
9814         (Sized_relobj::do_gc_process_relocs): New function.
9815         * options.h (General_options::gc_sections): Modify to not be a no-op.
9816         (General_options::print_gc_sections): New option.
9817         * plugin.cc (Plugin_finish::run): Remove function call to
9818         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9819         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9820         * reloc.cc (Read_relocs::run): Add task to process relocs and
9821         determine unreferenced sections when doing garbage collection.
9822         (Gc_process_relocs): New class.
9823         (Sized_relobj::do_gc_process_relocs): New function.
9824         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9825         sections that are garbage collected.
9826         * reloc.h (Gc_process_relocs): New class.
9827         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9828         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9829         symbols whose corresponding sections are garbage collected.
9830         (Symbol_table::Symbol_table): Add new parameter for the garbage
9831         collection object.
9832         (Symbol_table::gc_mark_undef_symbols): New function.
9833         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9834         (Symbol_table::gc_mark_dyn_syms): New function.
9835         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9836         as garbage.
9837         (Symbol_table::add_from_object): Likewise.
9838         (Symbol_table::add_from_relobj): When building shared objects, do not
9839         treat externally visible symbols as garbage.
9840         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9841         table information for static and relocatable links.
9842         * symtab.h (Symbol_table::set_gc): New function.
9843         (Symbol_table::gc): New function.
9844         (Symbol_table::gc_mark_undef_symbols): New function.
9845         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9846         (Symbol_table::gc_mark_dyn_syms): New function.
9847         (Symbol_table::gc_): New data member.
9848         * target.h (Sized_target::gc_process_relocs): New pure virtual
9849         function.
9850         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9851         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9852
9853 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9854
9855         * options.h (General_options::gc_sections): Define as a no-op for now.
9856         (General_options::no_keep_memory): Ditto.
9857         (General_options::Bshareable): Define.
9858         * options.cc (General_options::finalize): Honor -Bshareable.
9859
9860 2009-01-20  Andreas Schwab  <schwab@suse.de>
9861
9862         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9863         read the value in the contents, since we don't use it.  Use the
9864         template endianness when writing.
9865         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9866
9867 2009-01-19  Andreas Schwab  <schwab@suse.de>
9868
9869         * configure.tgt (powerpc64-*): Fix targ_obj.
9870
9871 2009-01-15  Ian Lance Taylor  <iant@google.com>
9872
9873         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9874         local symbols when stripping all symbols.
9875
9876 2009-01-14  Cary Coutant  <ccoutant@google.com>
9877
9878         * output.cc (Output_reloc): Add explicit instantiations.
9879
9880 2009-01-14  Cary Coutant  <ccoutant@google.com>
9881
9882         * archive.cc (Archive::get_elf_object_for_member): Remove call
9883         to File_read::claim_for_plugin.
9884         * descriptors.cc (Descriptors::open): Remove reference to
9885         is_claimed.
9886         (Descriptors::claim_for_plugin): Remove.
9887         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9888         (Descriptors::is_claimed): Remove.
9889         (claim_descriptor_for_plugin): Remove.
9890         * fileread.cc (File_read::claim_for_plugin): Remove.
9891         * fileread.h (File_read::claim_for_plugin): Remove.
9892         (File_read::descriptor): Reopen descriptor if necessary.
9893         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9894         (Plugin_manager::all_symbols_read): Add task parameter. Change
9895         all callers.
9896         (Plugin_manager::get_input_file): New function.
9897         (Plugin_manager::release_input_file): New function.
9898         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9899         corresponding data member.
9900         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9901         and pass to base constructor. Change all callers.
9902         (get_input_file, release_input_file): New functions.
9903         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9904         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9905         (Plugin_manager::all_symbols_read): Add task parameter.
9906         (Plugin_manager::get_input_file): New function.
9907         (Plugin_manager::release_input_file): New function.
9908         (Plugin_manager::task_): New data member.
9909         (Pluginobj::Pluginobj): Add filesize parameter.
9910         (Pluginobj::filename): New function.
9911         (Pluginobj::descriptor): New function.
9912         (Pluginobj::filesize): New function.
9913         (Pluginobj::filesize_): New data member.
9914         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9915         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9916         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9917
9918         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9919         with archive libraries.
9920         * testsuite/Makefile.in: Regenerate.
9921         * testsuite/plugin_test.c (struct sym_info): New type.
9922         (get_input_file, release_input_file): New static variables.
9923         (onload): Capture new transfer vector entries.
9924         (claim_file_hook): Stop reading at end of file according to filesize.
9925         Factor out parsing of readelf output into separate function.
9926         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9927         APIs and get the source file name from the symbol table.  Convert
9928         source file name to corresponding object file name.  Print info
9929         message when adding new input files.
9930         (parse_readelf_line): New function.
9931         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9932         * testsuite/plugin_test_2.sh: Likewise.
9933         * testsuite/plugin_test_3.sh: Likewise.
9934         * testsuite/plugin_test_4.sh: New test case.
9935
9936 2009-01-07  Ian Lance Taylor  <iant@google.com>
9937
9938         * version.cc (version_string): Bump to 1.8.
9939
9940 2008-12-23  Cary Coutant  <ccoutant@google.com>
9941
9942         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9943         * plugin.cc (Plugin_manager::finish): Rename as
9944         layout_deferred_objects.  Move cleanup to separate function.
9945         (Plugin_manager::cleanup): New function.
9946         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9947         separately.
9948         * plugin.h (Plugin_manager::finish): Rename as
9949         layout_deferred_objects.
9950         (Plugin_manager::cleanup): New function.
9951         (Plugin_manager::cleanup_done): New field.
9952
9953 2008-12-23  Cary Coutant  <ccoutant@google.com>
9954
9955         * plugin.cc (is_visible_from_outside): New function.
9956         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9957         so we don't return "IR only" status for exported symbols or -r links.
9958
9959         * testsuite/Makefile.am (plugin_test_3): New test case.
9960         * testsuite/Makefile.in: Regenerate.
9961         * testsuite/plugin_test_3.sh: New file.
9962
9963 2008-12-22  Cary Coutant  <ccoutant@google.com>
9964
9965         * object.cc (Sized_relobj::layout_section): New function.
9966         (Sized_relobj::do_layout): Defer layout of input sections until after
9967         plugin has provided replacement files.
9968         (Sized_relobj::do_layout_deferred_sections): New function.
9969         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9970         (Relobj::layout_deferred_sections): New function.
9971         (Relobj::do_layout_deferred_sections): New function.
9972         (Sized_relobj::do_layout_deferred_sections): New function.
9973         (Sized_relobj::layout_section): New function.
9974         (Sized_relobj::Deferred_layout): New structure.
9975         (Sized_relobj::deferred_layout_): New field.
9976         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9977         Change all callers.  Layout deferred sections.
9978         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9979         references.
9980         (Plugin_hook::run): Move code from do_plugin_hook inline.
9981         (Plugin_hook::do_plugin_hook): Remove.
9982         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9983         (Plugin_manager::finish): Renamed, was cleanup.
9984         (Plugin_manager::should_defer_layout): New function.
9985         (Plugin_manager::add_deferred_layout_object): New function.
9986         (Plugin_manager::Deferred_layout_list): New type.
9987         (Plugin_manager::deferred_layout_objects_): New field.
9988         (Plugin_hook::do_plugin_hook): Remove.
9989
9990 2008-12-17  Ian Lance Taylor  <iant@google.com>
9991
9992         * options.h (class General_options): Add --no case for
9993         --export-dynamic.
9994
9995 2008-12-16  Cary Coutant  <ccoutant@google.com>
9996
9997         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9998         vector.
9999         (Plugin_manager::claim_file): Create plugin object even if
10000         plugin did not call the add_symbols callback.
10001         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10002         asking for more symbols than were added.
10003         * testsuite/Makefile.am (plugin_test_1): Add test case with
10004         no global symbols.
10005         (empty.syms): New target.
10006         * testsuite/Makefile.in: Regenerate.
10007         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10008         message. Don't call add_symbols if no globals.
10009         (all_symbols_read_hook): Don't provide replacement for empty
10010         claimed file.
10011
10012 2008-12-12  Ian Lance Taylor  <iant@google.com>
10013
10014         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10015         r_type == 0 for a local symbol with r_sym == 0.
10016         (scan_relocatable_relocs): Pass r_sym to
10017         local_non_section_strategy.
10018         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10019         r_sym parameter.
10020
10021         * configure.ac: Update test for TLS descriptors: they are
10022         supported as of glibc 2.9.
10023         * configure: Rebuild.
10024
10025 2008-12-11  Ian Lance Taylor  <iant@google.com>
10026
10027         PR 7091
10028         * target-reloc.h (Default_scan_relocatable_relocs): For each
10029         function, map r_type == 0 to RELOC_DISCARD.
10030
10031 2008-12-10  Cary Coutant  <ccoutant@google.com>
10032
10033         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10034         object to override a kept COMDAT group from a plugin object.
10035
10036 2008-12-09  Ian Lance Taylor  <iant@google.com>
10037
10038         PR 7088
10039         * yyscript.y (file_cmd): Handle INPUT.
10040
10041         * testsuite/initpri1.c: Change all declarations to be full
10042         prototypes by adding void, to avoid compiler warnings.
10043
10044 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10045
10046         * options.cc (General_options::parse_plugin_opt): New.
10047         (General_options::add_plugin): The argument now is just the filename.
10048         (General_options::add_plugin_option): New.
10049         * options.h (plugin_opt): New.
10050         (add_plugin): Change argument name.
10051         (add_plugin_option): New.
10052         * plugin.cc (Plugin::load): Don't parse the plugin option.
10053         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10054         (Plugin::add_option): New.
10055         (Plugin::args_): Change type.
10056         (Plugin::filename_): New.
10057         (Plugin_manager::add_plugin_option): New.
10058         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10059         * testsuite/Makefile.in: Regenerate.
10060
10061 2008-12-05  Cary Coutant  <ccoutant@google.com>
10062
10063         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10064         Handle --strip-lto-sections option.
10065         * options.h (strip_lto_sections): New option.
10066
10067 2008-12-01  Cary Coutant  <ccoutant@google.com>
10068
10069         * plugin.cc (ld_plugin_message): Change format parameter to const.
10070         Fix mismatch between new[] and delete.
10071
10072 2008-11-14  Cary Coutant  <ccoutant@google.com>
10073
10074         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10075         instead of -1U.
10076
10077 2008-11-05  Craig Silverstein  <csilvers@google.com>
10078
10079         * options.cc (General_options::parse_dynamic_list): New function.
10080         * options.h (General_options): New flags dynamic_list,
10081         dynamic_list_data, dynamic_list_cpp_new, and
10082         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10083         (General_options::in_dynamic_list): New function.
10084         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10085         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10086         (Lex::can_continue_name): Likewise.
10087         (yylex): Likewise.
10088         (read_script_file): New parameter script_options.
10089         (read_dynamic_list): New function.
10090         (Script_options::define_dynamic_list): New function.
10091         (dynamic_list_keyword_parsecodes): New variable.
10092         (dynamic_list_keywords): New variable.
10093         * script.h (Script_options::define_dynamic_list): New function
10094         prototype.
10095         (read_dynamic_list): New function prototype.
10096         * symtab.cc (strprefix): New macro.
10097         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10098         dynamic_list_data, dynamic_list_cpp_new, and
10099         dynamic_list_cpp_typeinfo.
10100         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10101         (dynamic_list_expr): New rule.
10102         (dynamic_list_nodes): Likewise.
10103         (dynamic_list_node): Likewise.
10104         * testsuite/Makefile.am (dynamic_list): New test.
10105         * testsuite/Makefile.in: Regenerated.
10106         * testsuite/dynamic_list.t: New file.
10107         * testsuite/dynamic_list.sh: New file.
10108
10109 2008-11-05  Craig Silverstein  <csilvers@google.com>
10110
10111         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10112         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10113         (t11_last): Likewise.
10114         * testsuite/ver_test_6.c (main): Likewise.
10115
10116 2008-10-07  Cary Coutant  <ccoutant@google.com>
10117
10118         * options.c (General_options::finalize): Add check for -static and
10119         -shared.
10120         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10121         is not empty.
10122
10123 2008-10-02  Cary Coutant  <ccoutant@google.com>
10124
10125         * plugin.cc (make_sized_plugin_object): Fix conditional
10126         compilation to work when not all targets are enabled.
10127
10128 2008-09-29  Cary Coutant  <ccoutant@google.com>
10129
10130         * archive.cc (Archive::get_file_and_offset): Use filename instead
10131         of name to get library path.
10132         (Archive::include_member): Unlock external member of a thin archive.
10133
10134         * testsuite/Makefile.am (TEST_AR): New variable.
10135         (thin_archive_test_1): New test.
10136         (thin_archive_test_2): New test.
10137         * testsuite/Makefile.in: Regenerate.
10138         * testsuite/thin_archive_main.cc: New file.
10139         * testsuite/thin_archive_test_1.cc: New file.
10140         * testsuite/thin_archive_test_2.cc: New file.
10141         * testsuite/thin_archive_test_3.cc: New file.
10142         * testsuite/thin_archive_test_4.cc: New file.
10143
10144 2008-09-29  Cary Coutant  <ccoutant@google.com>
10145
10146         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10147         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10148         instead of -1U.
10149         (Sized_relobj::do_finalize_local_symbols): Likewise.
10150         (Sized_relobj::map_to_kept_section): Likewise.
10151         * object.h (Sized_relobj::invalid_address): New constant.
10152         (Sized_relobj::do_output_section_offset): Check for invalid_address
10153         and return -1ULL.
10154         * output.cc (Output_reloc::local_section_offset): Use constant
10155         invalid_address instead of -1U.
10156         (Output_reloc::get_address): Likewise.
10157         (Output_section::output_address): Change -1U to -1ULL.
10158         * output.h (Output_reloc::invalid_address): New constant.
10159         * reloc.cc (Sized_relobj::write_sections): Use constant
10160         invalid_address instead of -1U.
10161         (Sized_relobj::relocate_sections): Likewise.
10162         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10163         values for merge sections.
10164         * target-reloc.h (relocate_for_relocatable): Use constant
10165         invalid_address instead of -1U.
10166
10167 2008-09-19  Cary Coutant  <ccoutant@google.com>
10168
10169         Add plugin functionality for link-time optimization (LTO).
10170         * configure.ac (plugins): Add --enable-plugins option.
10171         * configure: Regenerate.
10172         * config.in: Regenerate.
10173         * Makefile.am (LIBDL): New variable.
10174         (CCFILES): Add plugin.cc.
10175         (HFILES): Add plugin.h.
10176         (ldadd_var): Add LIBDL.
10177         * Makefile.in: Regenerate.
10178
10179         * archive.cc: Include "plugin.h".
10180         (Archive::setup): Don't preread archive symbols when using a plugin.
10181         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10182         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10183         files.
10184         (Archive::include_member): Add symbols from plugin objects.
10185         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10186         * descriptors.cc (Descriptors::open): Check for file descriptors
10187         abandoned by plugins.
10188         (Descriptors::claim_for_plugin): New function.
10189         * descriptors.h (Descriptors::claim_for_plugin): New function.
10190         (Open_descriptor::is_claimed): New field.
10191         (claim_descriptor_for_plugin): New function.
10192         * fileread.cc (File_read::claim_for_plugin): New function.
10193         * fileread.h (File_read::claim_for_plugin): New function.
10194         (File_read::descriptor): New function.
10195         * gold.cc: Include "plugin.h".
10196         (queue_initial_tasks): Add task to call plugin hooks for generating
10197         new object files.
10198         * main.cc: Include "plugin.h".
10199         (main): Load plugin libraries.
10200         * object.h (Pluginobj): Declare.
10201         (Object::pluginobj): New function.
10202         (Object::do_pluginobj): New function.
10203         (Object::set_target): New function.
10204         * options.cc: Include "plugin.h".
10205         (General_options::parse_plugin): New function.
10206         (General_options::General_options): Initialize plugins_ field.
10207         (General_options::add_plugin): New function.
10208         * options.h (Plugin_manager): Declare.
10209         (General_options): Add --plugin option.
10210         (General_options::has_plugins): New function.
10211         (General_options::plugins): New function.
10212         (General_options::add_plugin): New function.
10213         (General_options::plugins_): New field.
10214         * plugin.cc: New file.
10215         * plugin.h: New file.
10216         * readsyms.cc: Include "plugin.h".
10217         (Read_symbols::do_read_symbols): Check for archive before checking
10218         for ELF file.  Call plugin hooks to claim files.
10219         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10220         from a real object file; force override when processing replacement
10221         files.
10222         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10223         (Symbol::init_base_object): Likewise.
10224         (Symbol::init_base_output_data): Likewise.
10225         (Symbol::init_base_output_segment): Likewise.
10226         (Symbol::init_base_constant): Likewise.
10227         (Symbol::init_base_undefined): Likewise.
10228         (Symbol::output_section): Assert that object is not a plugin.
10229         (Symbol_table::add_from_pluginobj): New function.
10230         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10231         undefined.
10232         (Symbol_table::sized_write_globals): Likewise.
10233         (Symbol_table::add_from_pluginobj): Instantiate template.
10234         * symtab.h (Sized_pluginobj): Declare.
10235         (Symbol::in_real_elf): New function.
10236         (Symbol::set_in_real_elf): New function.
10237         (Symbol::in_real_elf_): New field.
10238         (Symbol_table::add_from_pluginobj): New function.
10239
10240         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10241         (LIBDL): New variable.
10242         (LDADD): Add LIBDL.
10243         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10244         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10245         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10246         (MOSTLYCLEANFILES): Likewise.
10247         * testsuite/Makefile.in: Regenerate.
10248         * testsuite/plugin_test.c: New file.
10249         * testsuite/plugin_test_1.sh: New file.
10250         * testsuite/plugin_test_2.sh: New file.
10251
10252 2008-09-16  Ian Lance Taylor  <iant@google.com>
10253
10254         * target-reloc.h (relocate_section): Check whether a symbol is
10255         defined by the ABI before reporting an undefined symbol error.
10256         * target.h (Target::is_defined_by_abi): Make parameter const.
10257         (Target::do_is_defined_by_abi): Likewise.
10258         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10259         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10260         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10261         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10262         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10263         * testsuite/Makefile.in: Rebuild.
10264
10265         * fileread.cc (make_view): Add casts to avoid warning.
10266
10267 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10268
10269         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10270         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10271
10272 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10273
10274         * options.h (General_options::output_is_executable): New.
10275         (General_options::output_is_pie): New.
10276         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10277         for shared libraries.
10278         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10279
10280 2008-09-11  Chris Demetriou  <cgd@google.com>
10281
10282         * options.h (origin): New -z option.
10283         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10284         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10285         in DT_FLAGS_1.
10286
10287 2008-09-05  Cary Coutant  <ccoutant@google.com>
10288
10289         * fileread.cc (File_read::make_view): Add check for attempt to map
10290         beyond end of file.
10291
10292 2008-09-05  Cary Coutant  <ccoutant@google.com>
10293
10294         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10295         explicit instantiations.
10296
10297 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10298
10299         PR gold/6858
10300         * options.cc (General_options::finalize): Allow undefined symbols
10301         in shlibs if linking -shared.
10302
10303         PR gold/6859
10304         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10305         symbols as not needing a dynsym entry.
10306
10307 2008-08-20  Craig Silverstein  <csilvers@google.com>
10308
10309         * fileread.cc (File_read::open): Do not lock the file unless it
10310         was successfully opened.
10311
10312 2008-08-14  Cary Coutant  <ccoutant@google.com>
10313
10314         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10315         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10316         * testsuite/tls_test.cc (struct int128): 128-bit struct
10317         for testing TLS relocs with non-zero addend.
10318         (v12): New TLS variable.
10319         (t12): New test.
10320         (t_last): Add check for v12.
10321         * testsuite/tls_test.h (t12): New function.
10322         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10323
10324 2008-08-13  Ian Lance Taylor  <iant@google.com>
10325
10326         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10327         set tls_segment_ or relro_segment_.
10328         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10329         when appropriate.
10330         * output.h (Output_section::clear_is_relro): New function.
10331         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10332         sections specially even when output_data_ is empty.
10333         (Output_segment::maximum_alignment): When first section is relro,
10334         only force alignment for PT_LOAD segments.
10335         * script.cc (script_data_segment_align): New function.
10336         (script_data_segment_relro_end): New function.
10337         * script-c.h (script_data_segment_align): Declare.
10338         (script_data_segment_relro_end): Declare.
10339         * script-sections.h (class Script_sections): Declare
10340         data_segment_align and data_segment_relro_end.  Add fields
10341         segment_align_index_ and saw_relro_end_.
10342         * script-sections.cc (class Sections_element): Add set_is_relro
10343         virtual function.  Add new bool* parameter to place_orphan_here.
10344         Add get_output_section virtual function.
10345         (class Output_section_definition): Add set_is_relro.  Add new
10346         bool* parameter to place_orphan_here.  Add get_output_section.
10347         Add is_relro_ field.
10348         (Output_section_definition::Output_section_definition): Initialize
10349         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10350         and is_relro_ fields.
10351         (Output_section_definition::place_orphan_here): Add is_relro
10352         parameter.
10353         (Output_section_definition::set_section_addresses): Set relro for
10354         output section.
10355         (Output_section_definition::alternate_constraint): Likewise.
10356         (class Orphan_output_section): Add new bool* parameter to
10357         place_orphan_here.  Add get_output_section.
10358         (Orphan_output_section::place_orphan_here): Add is_relro
10359         parameter.
10360         (Script_sections::Script_sections): Initialize
10361         data_segment_align_index_ and saw_relro_end_.
10362         (Script_sections::data_segment_align): New function.
10363         (Script_sections::data_segment_relro_end): New function.
10364         (Script_sections::place_orphan): Set or clear is_relro.
10365         (Script_sections::set_section_addresses): Force alignment of first
10366         TLS section.
10367         * yyscript.y (exp): Call script_data_segment_align and
10368         script_data_segment_relro_end.
10369         * testsuite/relro_script_test.t: New file.
10370         * testsuite/relro_test.cc (using_script): Declare.
10371         (t1, t2): Test using_script.
10372         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10373         (relro_script_test_SOURCES): Define.
10374         (relro_script_test_DEPENDENCIES): Define.
10375         (relro_script_test_LDFLAGS): Define.
10376         (relro_script_test_LDADD): Define.
10377         (relro_script_test.so): New target.
10378         * testsuite/Makefile.in: Rebuild.
10379
10380 2008-08-06  Cary Coutant <ccoutant@google.com>
10381
10382         * archive.cc (Archive::total_archives, Archive::total_members)
10383         (Archive::total_members_loaded): New variables.
10384         (Archive::setup): Add parameter.  Add option to preread
10385         archive symbols.
10386         (Archive::read_armap): Add counter.
10387         (Archive::get_file_and_offset): New function.
10388         (Archive::get_elf_object_for_member): New function.
10389         (Archive::read_all_symbols): New function.
10390         (Archive::read_symbols): New function.
10391         (Archive::add_symbols): Add counters.
10392         (Archive::include_all_members): Use armap to find members if it's
10393         already built.
10394         (Archive::include_member): Skip reading symbols if already read.
10395         Factored code into Archive::get_file_and_offset and
10396         Archive::get_elf_object_for_member.  Changed call to
10397         Mapfile::report_include_archive_member.
10398         (Archive::print_stats): New function.
10399         * archive.h: Declare Object and Read_symbols_data classes.
10400         (Archive::Archive): Add initializers for new members.
10401         (Archive::setup): Add parameter.
10402         (Archive::print_stats): New function.
10403         (Archive::total_archives, Archive::total_members)
10404         (Archive::total_members_loaded): New variables.
10405         (Archive::get_file_and_offset): New function.
10406         (Archive::get_elf_object_for_member): New function.
10407         (Archive::read_all_symbols): New function.
10408         (Archive::read_symbols): New function.
10409         (Archive::Archive_member): New class.
10410         (Archive::members_): New member.
10411         (Archive::num_members_): New member.
10412         * main.cc: Include archive.h.
10413         (main): Call Archive::print_stats.
10414         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10415         archive parameter; member_name is now the fully-decorated name.
10416         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10417         * options.h: (General_options): Add --preread-archive-symbols option.
10418         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10419         Archive::setup.
10420
10421 2008-08-04  Ian Lance Taylor  <iant@google.com>
10422
10423         * symtab.h (Symbol::use_plt_offset): New function.
10424         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10425         * powerpc.cc (Relocate::relocate): Likewise.
10426         * sparc.cc (Relocate::relocate): Likewise.
10427         * x86_64.cc (Relocate::relocate): Likewise.
10428         * testsuite/weak_plt.sh: New test.
10429         * testsuite/weak_plt_main.cc: New test.
10430         * testsuite/weak_plt_shared.cc: New test.
10431         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10432         (check_PROGRAMS): Add weak_plt.
10433         (check_DATA): Add weak_plt_shared.so.
10434         (weak_plt_main_pic.o, weak_plt): New targets.
10435         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10436         * testsuite/Makefile.in: Rebuild.
10437
10438         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10439         gcctestdir/ld.
10440         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10441         * testsuite/Makefile.in: Rebuild.
10442
10443 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10444
10445         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10446         * Makefile.in: Regenerate.
10447         * po/POTFILES.in: Regenerate.
10448
10449 2008-07-29  Ian Lance Taylor  <iant@google.com>
10450
10451         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10452         symbols before other symbols.
10453         * testsuite/script_test_2.cc (test_addr): Declare.
10454         (test_addr_alias): Declare.
10455         (main): Check that test_addr and test_addr_alias have the right
10456         values.
10457         * testsuite/script_test_2.t: Define test_addr_alias and
10458         test_addr.
10459
10460 2008-07-24  Ian Lance Taylor  <iant@google.com>
10461
10462         PR 5990
10463         * descriptors.cc: New file.
10464         * descriptors.h: New file.
10465         * gold-threads.h (class Hold_optional_lock): New class.
10466         * fileread.cc: Include "descriptors.h".
10467         (File_read::~File_read): Release descriptor rather than closing
10468         it.
10469         (File_read::open) [file]: Call open_descriptor rather than open.
10470         Set is_descriptor_opened_.
10471         (File_read::open) [memory]: Assert that descriptor is not open.
10472         (File_read::reopen_descriptor): New function.
10473         (File_read::release): Release descriptor.
10474         (File_read::do_read): Make non-const.  Reopen descriptor.
10475         (File_read::read): Make non-const.
10476         (File_read::make_view): Reopen descriptor.
10477         (File_read::do_readv): Likewise.
10478         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10479         Update declarations.
10480         * layout.cc: Include "descriptors.h".
10481         (Layout::create_build_id): Use open_descriptor rather than open.
10482         * output.cc: Include "descriptors.h".
10483         (Output_file::open): Use open_descriptor rather than open.
10484         * archive.cc (Archive::const_iterator): Change Archive to be
10485         non-const.
10486         (Archive::begin, Archive::end): Make non-const.
10487         (Archive::count_members): Likewise.
10488         * archive.h (class Archive): Update declarations.
10489         * object.h (Object::read): Make non-const.
10490         * Makefile.am (CCFILES): Add descriptors.cc.
10491         (HFILES): Add descriptors.h.
10492         * Makefile.in: Rebuild.
10493
10494         PR 6716
10495         * gold.h: Always include <clocale>.  Add Solaris workarounds
10496         following code in binutils/sysdep.h.
10497
10498         PR 6048
10499         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10500         this->eh_frame_hdr_ is NULL before using it.
10501
10502         * dynobj.cc (Versions::Versions): Update comment.
10503
10504         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10505         the base version name.
10506
10507         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10508         array size plus one.
10509         (Stringpool_template::set_string_offsets): Subtract one from key
10510         before using it as an array index.
10511         (Stringpool_template::get_offset_with_length): Likewise.
10512         (Stringpool_template::write_to_buffer): Likewise.
10513         * stringpool.h (Stringpool_template::get_offset_from_key):
10514         Likewise.
10515
10516 2008-07-23  Ian Lance Taylor  <iant@google.com>
10517
10518         PR 6658
10519         * object.h (Merged_symbol_value::value): Do our best to handle a
10520         negative addend.
10521
10522         PR 6647
10523         * script.cc (Version_script_info::get_versions): Don't add empty
10524         version tag to return value.
10525         (Version_script_info::get_symbol_version_helper): Change return
10526         type to bool.  Add pversion parameter.  Change all callers.
10527         (script_register_vers_node): Don't require a non-NULL tag.
10528         * script.h (class Version_script_info): Update declarations.
10529         (Version_script_info::get_symbol_version): Change return type to
10530         bool.  Add version parameter.  Change all callers.
10531         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10532         handling.  Handle an empty version from a version script.
10533         (Symbol_table::define_special_symbol): Likewise.
10534         * testsuite/ver_test_10.script: New file.
10535         * testsuite/ver_test_10.sh: New file.
10536         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10537         (check_DATA): Add ver_test_10.syms.
10538         (ver_test_10.syms, ver_test_10.so): New target.
10539         * testsuite/Makefile.in: Rebuild.
10540
10541 2008-07-23  Simon Baldwin  <simonb@google.com>
10542
10543         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10544         to zero for undefined symbols from dynamic libraries.
10545
10546 2008-07-23  Ian Lance Taylor  <iant@google.com>
10547
10548         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10549         Change all callers.
10550         * symtab.h (class Symbol_table): Update declaration.
10551         * testsuite/ver_test_9.cc: New file.
10552         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10553         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10554         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10555         (ver_test_9.so, ver_test_9.o): New targets.
10556         * testsuite/Makefile.in: Rebuild.
10557
10558 2008-07-22  Ian Lance Taylor  <iant@google.com>
10559
10560         * options.h (class General_options): Define --check-sections.
10561         * layout.cc (Layout::set_segment_offsets): Handle
10562         --check-sections.
10563
10564         * options.h (class General_options): Define -n/--nmagic and
10565         -N/--omagic.
10566         * options.cc (General_options::finalize): For -n/--nmagic or
10567         -N/--omagic, set -static.
10568         * layout.cc (Layout::attach_allocated_section_to_segment): If
10569         -N/--omagic, don't put read-only and read-write sections in
10570         different segments.
10571         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10572         finding a read-only segment.
10573         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10574         don't set the minimum segment alignment to the common page size,
10575         and don't set the file offset to the address modulo the page size.
10576         * script-sections.cc (Script_sections::create_segments): If
10577         -n/--omagic, don't put read-only and read-write sections in
10578         different segments.
10579
10580         * cref.cc: New file.
10581         * cref.h: New file.
10582         * options.h (class General_options): Add --print-symbol-counts.
10583         * main.cc (main): Issue defined symbol report if requested.
10584         * archive.cc (Archive::interpret_header): Make into a const member
10585         function.
10586         (Archive::add_symbols): Call Input_objects::archive_start and
10587         archive_stop.
10588         (Archive::const_iterator): Define new class.
10589         (Archive::begin, Archive::end): New functions.
10590         (Archive::include_all_members): Rewrite to use iterator.
10591         (Archive::count_members): New function.
10592         * archive.h (class Archive): Update declarations.
10593         (Archive::filename): New function.
10594         * object.cc: Include "cref.h".
10595         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10596         (Sized_relobj::do_get_global_symbol_counts): New function.
10597         (Input_objects::add_object): Add object to cross-referencer.
10598         (Input_objects::archive_start): New function.
10599         (Input_objects::archive_stop): New function.
10600         (Input_objects::print_symbol_counts): New function.
10601         * object.h: Declare Cref and Archive.
10602         (Object::get_global_symbol_counts): New function.
10603         (Object::do_get_global_symbol_counts): New pure virtual function.
10604         (class Sized_relobj): Add defined_count_ field.  Update
10605         declarations.
10606         (class Input_objects): Add cref_ field.  Update constructor.
10607         Update declarations.
10608         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10609         defined_count_.
10610         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10611         symbol counts.
10612         (Sized_dynobj::do_get_global_symbol_counts): New function.
10613         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10614         defined_count_.  Update declarations.  Define Symbols typedef.
10615         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10616         parameter.  Change all callers.
10617         (Symbol_table::add_from_dynobj): Add sympointers and defined
10618         parameters.  Change all callers.
10619         * symtab.h (class Symbol_table): Update declarations.
10620         * Makefile.am (CCFILES): Add cref.cc.
10621         (HFILES): Add cref.h.
10622         * Makefile.in: Rebuild.
10623
10624 2008-07-22  Simon Baldwin  <simonb@google.com>
10625
10626         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10627         to zero when writing undefined symbols.
10628
10629 2008-07-22  Ian Lance Taylor  <iant@google.com>
10630
10631         * output.cc (Output_section::add_input_section): Don't try to
10632         merge empty merge sections.
10633
10634 2008-07-21  Craig Silverstein  <csilvers@google.com>
10635
10636         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10637         Include symbol version in error message.
10638
10639 2008-07-20  Chris Demetriou  <cgd@google.com>
10640
10641         * configure.ac (gold_cv_c_random_seed): New configured variable.
10642         (RANDOM_SEED_CFLAGS): New substituted variable.
10643         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10644         * configure: Rebuild.
10645         * Makefile.in: Likewise.
10646         * testsuite/Makefile.in: Likewise.
10647
10648 2008-07-18  Ian Lance Taylor  <iant@google.com>
10649
10650         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10651         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10652         * testsuite/ver_test_main.cc (main): Call t4.
10653         (t4, t4_2a): Define.
10654         * testsuite/ver_test_2.cc (t4_2): Define.
10655         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10656         * testsuite/ver_test_4.cc (t4_2a): Define.
10657         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10658         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10659
10660 2008-07-17  Ian Lance Taylor  <iant@google.com>
10661
10662         * dynobj.cc (Versions::add_def): If we give an error about a
10663         missing version, go ahead and create the version anyhow.
10664
10665 2008-07-10  Ian Lance Taylor  <iant@google.com>
10666
10667         Handle output sections with more than 0x7fffffff bytes.
10668         * object.h (class Relobj): Change map_to_output_ to
10669         output_sections_, and just keep a section pointer.  Change all
10670         uses.  Move comdat group support to Sized_relobj.
10671         (Relobj::is_section_specially_mapped): Remove.
10672         (Relobj::output_section): Remove poff parameter.  Change all
10673         callers.
10674         (Relobj::output_section_offset): New function.
10675         (Relobj::set_section_offset): Rewrite.
10676         (Relobj::map_to_output): Remove.
10677         (Relobj::output_sections): New function.
10678         (Relobj::do_output_section_offset): New pure virtual function.
10679         (Relobj::do_set_section_offset): Likewise.
10680         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10681         group support from Relobj.  Update declarations.
10682         (Sized_relobj::get_output_section_offset): New function.
10683         (Sized_relobj::do_output_section_offset): New function.
10684         (Sized_relobj::do_set_section_offset): New function.
10685         * object.cc (Relobj::output_section_address): Remove.
10686         (Sized_relobj::Sized_relobj): Initialize new fields.
10687         (Sized_relobj::include_section_group): Cast find_kept_object to
10688         Sized_relobj.
10689         (Sized_relobj::include_linkonce_section): Likewise.
10690         (Sized_relobj::do_layout): Use separate arrays for output section
10691         and output offset.
10692         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10693         output_sections.
10694         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10695         output_sections and section_offsets.
10696         (Sized_relobj::write_local_symbols): Likewise.
10697         (map_to_kept_section): Compute output address directly.
10698         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10699         output_sections and section_offsets.
10700         (Sized_relobj::write_sections): Likewise.
10701         (Sized_relobj::relocate_sections): Likewise.
10702         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10703         * output.h (class Output_reloc): Update declarations.  Change
10704         u2_.relobj to Sized_relobj*.
10705         (class Output_data_reloc): Change add functions to use
10706         Sized_relobj*.
10707         * output.cc (Output_reloc::Output_reloc): Change relobj to
10708         Sized_relobj*.
10709         (Output_reloc::local_section_offset): Change return type to
10710         Elf_Addr.  Use get_output_section_offset.
10711         (Output_reloc::get_address): Likewise.
10712         (Output_section::is_input_address_mapped): Don't call
10713         is_section_specially_mapped.
10714         (Output_section::output_offset): Likewise.
10715         (Output_section::output_address): Likewise.
10716         (Output_section::starting_output_address): Likewise.
10717         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10718         parameter to Sized_relobj*.
10719         (Copy_relocs::need_copy_reloc): Likewise.
10720         (Copy_relocs::save): Likewise.
10721         * copy-relocs.h (class Copy_relocs): Update declarations.
10722         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10723         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10724         * target-reloc.h (relocate_for_relocatable): Change
10725         offset_in_output_section type to Elf_Addr.  Change code that uses
10726         it as well.
10727         * layout.cc (Layout::layout): Always set *off.
10728         * mapfile.cc (Mapfile::print_input_section): Use
10729         output_section_offset.
10730         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10731         Sized_relobj*.
10732         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10733         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10734         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10735
10736 2008-07-03  Ian Lance Taylor  <iant@google.com>
10737
10738         * layout.cc (Layout::include_section): Do not discard unrecognized
10739         SHT_STRTAB sections.
10740
10741 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10742
10743         * script.cc (Lex::can_continue_name): Make '?' allowable in
10744         version-script names.
10745         * testsuite/version_script.map: Change glob pattern to use '?'
10746
10747 2008-06-30  Manish Singh  <yosh@gimp.org>
10748
10749         PR 6585
10750         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10751         Correct typo.
10752
10753 2008-06-30  Ian Lance Taylor  <iant@google.com>
10754
10755         PR 6660
10756         PR 6682
10757         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10758         versions]: Don't try to read the value in the contents, since we
10759         don't use it.  Use the template endianness when writing.
10760
10761 2008-06-25  Cary Coutant  <ccoutant@google.com>
10762
10763         * fileread.cc (File_read::make_view): Assert on zero-length view.
10764         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10765         symbol table when there are no symbols to read.
10766
10767 2008-06-23  Craig Silverstein  <csilvers@google.com>
10768
10769         * version.cc (version_string): Bump to 1.7
10770
10771 2008-06-18  Craig Silverstein  <csilvers@google.com>
10772
10773         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10774         constant 0xFFFF to type Valtype.
10775         (Powerpc_relocate_functions::rel16_ha): Likewise.
10776
10777 2008-06-17  Ian Lance Taylor  <iant@google.com>
10778
10779         * output.h (Output_section::Input_section): Initialize p2align_ to
10780         zero for Output_section_data constructors.
10781         (Output_section::Input_section::addralign): If not an input
10782         section, return the alignment of the Output_section_data.
10783         * testsuite/copy_test.cc: New file.
10784         * testsuite/copy_test_1.cc: New file.
10785         * testsuite/copy_test_2.cc: New file.
10786         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10787         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10788         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10789         (copy_test_1_pic.o, copy_test_1.so): New targets.
10790         (copy_test_2_pic.o, copy_test_2.so): New targets.
10791         * testsuite/Makefile.in: Rebuild.
10792
10793         * script-sections.cc (Script_sections::place_orphan): Initialize
10794         local variable exact.
10795
10796 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10797
10798         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10799
10800 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10801             David S. Miller  <davem@davemloft.net>
10802
10803         * powerpc.cc: New file.
10804         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10805         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10806         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10807         * Makefile.in: Rebuild.
10808
10809 2008-06-09  Ian Lance Taylor  <iant@google.com>
10810
10811         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10812         <exception>.
10813         (throwing, orig_terminate): New static variables.
10814         (terminate_handler): New static function.
10815         (t2): Set terminate handler.
10816
10817 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10818
10819         PR 6584
10820         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10821         alignment.
10822
10823 2008-05-30  Cary Coutant  <ccoutant@google.com>
10824
10825         * archive.cc (Archive::include_all_members) Correct to step
10826         over symbol table and extended name table in thin archives.
10827
10828 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10829
10830         PR 6407
10831         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10832         calculation.
10833
10834 2008-05-28  Caleb Howe  <cshowe@google.com>
10835
10836         * reduced_debug_output.cc: New file.
10837         * reduced_debug_output.h: New file.
10838         * options.h (class General_options): Add --strip-debug-non-line.
10839         * options.cc (General_options::finalize): Add strip_debug_non_line
10840         to the strip heirarchy.
10841         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10842         fields.
10843         * layout.cc: Include "reduced_debug_output.h".
10844         (Layout::Layout): Initialize new fields.
10845         (line_only_debug_sections): New static array.
10846         (is_lines_only_debug_sections): New static inline function.
10847         (Layout::include_section): Handle --strip-debug-non-line.
10848         (Layout::make_output_section): If --strip-debug-non-line, build
10849         new output sections for .debug_abbrev and .debug_info.
10850         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10851         gold.  Warn about possible overflow.
10852         (read_signed_LEB_128): Likewise.
10853         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10854         (read_signed_LEB_128): Declare.
10855         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10856         (HFILES): Add reduced_debug_output.h.
10857         * Makefile.in: Rebuild.
10858
10859 2008-05-21  Ian Lance Taylor  <iant@google.com>
10860
10861         * mapfile.cc: New file.
10862         * mapfile.h: New file.
10863         * options.h (class General_options): Add -M/--print-map and -Map.
10864         * options.cc (General_options::finalize): Make -M equivalent to
10865         -Map -.
10866         * main.cc: Include <cstdio> and "mapfile.h".
10867         (main): Open mapfile if requested.
10868         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10869         constructor.  Change caller.
10870         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10871         (queue_middle_tasks): Likewise.
10872         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10873         declarations.
10874         * archive.cc: Include "mapfile.h".
10875         (Archive::add_symbols): Add mapfile parameter.  Change all
10876         callers.  Pass mapfile, symbol, and reason to include_member.
10877         (Archive::include_all_members): Add mapfile parameter.  Change all
10878         callers.
10879         (Archive::include_member): Add mapfile, sym, and why parameters.
10880         Change all callers.  Report inclusion to map file.
10881         * archive.h: Include "fileread.h".
10882         (class Archive): Update declarations.
10883         (Archive::file): New const method.
10884         (class Add_archive_symbols): Add mapfile_ field.  Update
10885         constructor.  Change all callers.
10886         * readsyms.h (class Read_symbols): Likewise.
10887         (class Finish_group): Likewise.
10888         (class Read_script): Likewise.
10889         * common.cc: Include "mapfile.h".
10890         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10891         all callers.
10892         (Symbol_table::do_allocate_commons): Likewise.
10893         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10894         symbol allocation to mapfile.
10895         * common.h (class Allocate_commons_task): Add mapfile_ field.
10896         Update constructor.  Change all callers.
10897         * symtab.h (class Symbol_table): Update declarations.
10898         * layout.cc: Include "mapfile.h".
10899         (Layout_task_runner::run): Print information to mapfile.
10900         (Layout::create_gold_note): Change Output_data_fixed_space to
10901         Output_data_zero_fill.
10902         (Layout::create_build_id): Likewise.
10903         (Layout::print_to_mapfile): New function.
10904         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10905         constructor.  Change caller.
10906         (class Layout): Declare print_to_mapfile.
10907         * output.cc (Output_section::Input_section::print_to_mapfile): New
10908         function.
10909         (Output_section::add_input_section): If producing a map, always
10910         add to input_sections_ list.
10911         (Output_section::do_print_to_mapfile): New function.
10912         (Output_segment::print_sections_to_mapfile): New function.
10913         (Output_segment::print_section_list_to_mapfile): New function.
10914         * output.h: Include "mapfile.h".
10915         (Output_data::print_to_mapfile): New function.
10916         (Output_data::do_print_to_mapfile): New virtual function.
10917         (Output_segment_headers::do_print_to_mapfile): New function.
10918         (Output_file_header::do_print_to_mapfile): New function.
10919         (Output_data_const::do_print_to_mapfile): New function.
10920         (class Output_data_const_buffer): Add map_name_ field.  Update
10921         constructor.  Change all callers.  Add do_print_to_mapfile
10922         function.
10923         (class Output_data_fixed_space): Likewise.
10924         (class Output_data_space): Likewise.
10925         (class Output_data_zero_fill): New class.
10926         (Output_data_strtab::do_print_to_mapfile): New function.
10927         (Output_data_reloc_base::do_print_to_mapfile): New function.
10928         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10929         (Output_data_group::do_print_to_mapfile): New function.
10930         (Output_data_got::do_print_to_mapfile): New function.
10931         (Output_data_dynamic::do_print_to_mapfile): New function.
10932         (Output_symtab_xindex::do_print_to_mapfile): New function.
10933         (class Output_section): Declare do_print_to_mapflie.  Declare
10934         print_to_mapfile in Input_section.
10935         (class Output_segment): Declare new functions.
10936         * object.h (Sized_relobj::symbol_count): New function.
10937         * script-sections.cc
10938         (Output_section_element_dot_assignment::set_section_addresses):
10939         Change Output_data_fixed_space to Output_data_zero_fill.
10940         (Output_data_expression::do_print_to_mapfile): New function.
10941         * script.cc (read_input_script): Add mapfile parameter.  Change
10942         all callers.
10943         * script.h (read_input_script): Update declaration.
10944         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10945         (Eh_frame::do_print_to_mapfile): New function.
10946         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10947         (Output_merge_string::do_print_to_mapfile): New function.
10948         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10949         function.
10950         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10951         function.
10952         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10953         function.
10954         * Makefile.am (CCFILES): Add mapfile.cc.
10955         (HFILES): Add mapfile.h.
10956         * Makefile.in: Rebuild.
10957
10958 2008-05-19  Ian Lance Taylor  <iant@google.com>
10959
10960         * options.h (class General_options): Add -z relro.
10961         * layout.cc (Layout::Layout): Initialize relro_segment_.
10962         (Layout::add_output_section_data): Return the output section.
10963         (Layout::make_output_section): Rcognize relro sections and mark
10964         them appropriately.
10965         (Layout::attach_allocated_section_to_segment): Put relro sections
10966         in a PT_GNU_RELRO segment.
10967         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10968         section as relro.
10969         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10970         PT_TLS segments.
10971         (Layout::linkonce_mapping): Map d.rel.ro.local to
10972         .data.rel.ro.local.
10973         (Layout::output_section_name): Us .data.rel.ro.local for any
10974         section which begins with that.
10975         * layout.h (class Layout): Update add_output_section_data
10976         declaration.  Add relro_segment_ field.
10977         * output.cc (Output_section::Output_section): Initialize is_relro_
10978         and is_relro_local_ fields.
10979         (Output_segment::add_output_section): Group relro sections.
10980         (Output_segment::is_first_section_relro): New function.
10981         (Output_segment::maximum_alignment): If there is a relro section,
10982         align the segment to the common page size.
10983         (Output_segment::set_section_addresses): Track whether we are
10984         looking at relro sections.  If the last section is a relro
10985         section, align to the common page size.
10986         (Output_segment::set_section_list_addresses): Add in_relro
10987         parameter.  Change all callers.  Align to the page size when
10988         moving from relro to non-relro section.
10989         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10990         segment.
10991         * output.h (class Output_section): Add is_relro_ and
10992         is_relro_local_ fields.
10993         (Output_section::is_relro): New function.
10994         (Output_section::set_is_relro): New function.
10995         (Output_section::is_relro_local): New function.
10996         (Output_section::set_is_relro_local): New function.
10997         (class Output_segment): Update declarations.
10998         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10999         * sparc.cc (Target_sparc::got_section): Likewise.
11000         * x86_64.cc (Target_x86_64::got_section): Likewise.
11001         * testsuite/relro_test_main.cc: New file.
11002         * testsuite/relro_test.cc: New file.
11003         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11004         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11005         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11006         (relro_test.so, relro_test_pic.o): New targets.
11007         * testsuite/Makefile.in: Rebuild.
11008
11009 2008-05-16  Ian Lance Taylor  <iant@google.com>
11010
11011         * output.cc (Output_segment::add_output_section): Remove front
11012         parameter.
11013         * output.h (class Output_segment): Remove
11014         add_initial_output_section and overloaded add_output_section.
11015         Update declaration of remaining add_output_section.
11016         * layout.cc (Layout::create_interp): Call add_output_section
11017         rather than add_initial_output_section.
11018         (Layout::finish_dynamic_section): Likewise.
11019
11020         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11021         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11022         know the dynamic type.
11023         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11024         field.  Initialize it in constructor.
11025         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11026         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11027         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11028         reloc.
11029
11030         * output.cc (Output_reloc::get_address): Change return type to
11031         Elf_Addr.
11032         * output.h (class Output_reloc): Update get_address declaration.
11033         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11034         for section addresses.
11035
11036 2008-05-09  Ian Lance Taylor  <iant@google.com>
11037
11038         PR 6493
11039         * gold.cc (gold_nomem): Use return value of write.
11040
11041 2008-05-08  Ian Lance Taylor  <iant@google.com>
11042
11043         * symtab.c (Symbol::init_base_output_data): Add version
11044         parameter.  Change all callers.
11045         (Symbol::init_base_output_segment): Likewise.
11046         (Symbol::init_base_constant): Likewise.
11047         (Symbol::init_base_undefined): Likewise.
11048         (Sized_symbol::init_output_data): Likewise.
11049         (Sized_symbol::init_output_segment): Likewise.
11050         (Sized_symbol::init_constant): Likewise.
11051         (Sized_symbol::init_undefined): Likewise.
11052         (Symbol_table::do_define_in_output_data): If the new symbol has a
11053         version, mark it as the default.
11054         (Symbol_table::do_define_in_output_segment): Likewise.
11055         (Symbol_table::do_define_as_constant): Likewise.
11056         * symtab.h (class Symbol): Update declarations.
11057         (class Sized_symbol): Likewise.
11058         * resolve.cc (Symbol::override_version): New function.
11059         (Symbol::override_base): Call override_version.
11060         (Symbol::override_base_with_special): Likewise.
11061         * testsuite/ver_script_8.script: New file.
11062         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11063         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11064         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11065         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11066
11067 2008-05-06  Ian Lance Taylor  <iant@google.com>
11068
11069         PR 6049
11070         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11071         functions.
11072         (class General_options): Remove existing --undefined, and add
11073         --no-undefined instead.  Add new --undefined as synonym for -u.
11074         * archive.cc (Archive::add_symbols): Check whether symbol was
11075         named with -u.
11076         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11077         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11078         all uses.  Add IS_UNDEFINED.  Update declarations to split
11079         different versions of init_base.  Declare init_base_undefined.
11080         (Symbol::is_defined): Handle IS_UNDEFINED.
11081         (Symbol::is_undefined): Likewise.
11082         (Symbol::is_weak_undefined): Call is_undefined.
11083         (Symbol::is_absolute): Handle IS_CONSTANT.
11084         (class Sized_symbol): Update declarations to split different
11085         versions of init.  Declare init_undefined.
11086         (class Symbol_table): Declare new functions.
11087         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11088         Change all callers.
11089         (Symbol::init_base_output_data): Likewise.
11090         (Symbol::init_base_output_segment): Likewise.
11091         (Symbol::init_base_constant): Likewise.
11092         (Symbol::init_base_undefined): New function.
11093         (Sized_symbol::init_object): Rename from init.  Change all
11094         callers.
11095         (Sized_symbol::init_output_data): Likewise.
11096         (Sized_symbol::init_output_segment): Likewise.
11097         (Sized_symbol::init_constant): Likewise.
11098         (Sized_symbol::init_undefined): New function.
11099         (Symbol_table::add_undefined_symbols_from_command_line): New
11100         function.
11101         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11102         function.
11103         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11104         (Symbol::output_section): Likewise.
11105         (Symbol::set_output_section): Likewise.
11106         (Symbol_table::sized_finalize_symbol): Likewise.
11107         (Symbol_table::sized_write_globals): Likewise.
11108         * resolve.cc (Symbol_table::should_override): Likewise.
11109         (Symbol::override_base_with_special): Likewise.
11110
11111         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11112         symbol, change it to have default visibility.
11113         * testsuite/protected_1.cc: New file.
11114         * testsuite/protected_2.cc: New file.
11115         * testsuite/protected_3.cc: New file.
11116         * testsuite/protected_main_1.cc: New file.
11117         * testsuite/protected_main_2.cc: New file.
11118         * testsuite/protected_main_3.cc: New file.
11119         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11120         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11121         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11122         (protected_1.so): New target.
11123         (protected_1_pic.o, protected_2_pic.o): New targets.
11124         (protected_3_pic.o): New target.
11125         (check_PROGRAMS): Add protected_2.
11126         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11127         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11128         * testsuite/Makefile.in: Rebuild.
11129
11130         * options.h (DEFINE_var): Add set_user_set_##varname__.
11131         (DEFINE_bool_alias): New macro.
11132         (class General_options): Define -Bstatic using DEFINE_bool_alias
11133         rather than DEFINE_special.  Add --undefined as an alias for -z
11134         defs.
11135         * options.cc (General_options::parse_Bstatic): Remove.
11136
11137         * options.h (class General_options): Add --fatal-warnings.
11138         * main.cc (main): Implement --fatal-warnings.
11139         * errors.h (Errors::warning_count): New function.
11140
11141         * options.h (class General_options): Add -Bsymbolic-functions.
11142         * symtab.h (Symbol::is_preemptible): Check for
11143         -Bsymbolic-functions.
11144
11145 2008-05-05  Ian Lance Taylor  <iant@google.com>
11146
11147         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11148         as noVARNAME rather than no-VARNAME.
11149         (class General_options): Add option -z combreloc.
11150         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11151         get_address.
11152         (Output_reloc::sort_before) [SHT_REL]: New function.
11153         (Output_reloc::sort_before) [SHT_RELA]: New function.
11154         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11155         Sort_relocs_comparison.
11156         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11157         parameter.  Change all callers.
11158         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11159         sort_relocs parameter.  Change all callers.
11160         * output.cc (Output_reloc::get_address): New function, broken out
11161         of write_rel.
11162         (Output_reloc::write_rel): Call it.
11163         (Output_reloc::compare): New function.
11164         (Output_data_reloc_base::do_write): Optionally sort relocs.
11165
11166         * configure.ac: If targ_extra_obj is set, link it in.
11167         * configure.tgt: Initialize all variables.
11168         (x86_64*): Set targ_extra_obj and targ_extra_size.
11169         * configure: Rebuild.
11170
11171         * object.cc (Sized_relobj::include_section_group): Adjust section
11172         indexes read from group data.  Build vector to pass to
11173         layout_group.
11174         * layout.cc (Layout::layout_group): Add flags and shndxes
11175         parameters.  Remove contents parameter.  Change caller.  Update
11176         explicit instantiations.
11177         * layout.h (class Layout): Update layout_group declaration.
11178         * output.cc (Output_data_group::Output_data_group): Add flags and
11179         input_shndxes parameters.  Remove contents parameter.  Change
11180         caller.
11181         (Output_data_group::do_write): Change input_sections_ to
11182         input_shndxes_.
11183         * output.h (class Output_data_group): Update constructor
11184         declaration.  Rename input_sections_ to input_shndxes_.
11185         * testsuite/many_sections_test.cc: Add template.
11186
11187 2008-04-30  Cary Coutant  <ccoutant@google.com>
11188
11189         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11190
11191         * layout.cc (Layout::include_section): Refactored check for debug
11192         info section.
11193         (Layout::add_comdat): Add new parameters.  Change type
11194         of signature parameter.  Add object and shndx to signatures table.
11195         (Layout::find_kept_object): New function.
11196         * layout.h: Include <cstring>.
11197         (Layout::is_debug_info_section): New function.
11198         (Layout::add_comdat): Add new parameters.
11199         (Layout::find_kept_object): New function.
11200         (Layout::Kept_section): New struct.
11201         (Layout::Signatures): Change type of map range.
11202         * object.cc (Relobj::output_section_address): New function.
11203         (Sized_relobj::include_section_group): Add new parameters.  Change
11204         calls to Layout::add_comdat.  Change to build table of kept comdat
11205         groups and table mapping discarded sections to kept sections.
11206         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11207         (Sized_relobj::do_layout): Change calls to include_section_group and
11208         include_linkonce_section.
11209         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11210         value to zero when section is discarded.
11211         (Sized_relobj::map_to_kept_section): New function.
11212         * object.h (Relobj::output_section_address): New function.
11213         (Relobj::Comdat_group): New type.
11214         (Relobj::find_comdat_group): New function.
11215         (Relobj::Comdat_group_table): New type.
11216         (Relobj::Kept_comdat_section): New type.
11217         (Relobj::Kept_comdat_section_table): New type.
11218         (Relobj::add_comdat_group): New function.
11219         (Relobj::set_kept_comdat_section): New function.
11220         (Relobj::get_kept_comdat_section): New function.
11221         (Relobj::comdat_groups_): New field.
11222         (Relobj::kept_comdat_sections_): New field.
11223         (Symbol_value::input_value): Update comment.
11224         (Sized_relobj::map_to_kept_section) New function.
11225         (Sized_relobj::include_linkonce_section): Add new parameter.
11226         * target-reloc.h (Comdat_behavior): New type.
11227         (get_comdat_behavior): New function.
11228         (relocate_section): Add code to map a discarded section to the
11229         corresponding kept section when applying a relocation.
11230
11231 2008-04-30  Craig Silverstein  <csilvers@google.com>
11232
11233         * dwarf_reader.cc (next_generation_count): New static var.
11234         (Addr2line_cache_entry): New struct.
11235         (addr2line_cache): New static var.
11236         (Dwarf_line_info::one_addr2line): Added caching.
11237         (Dwarf_line_info::clear_addr2line_cache): New function.
11238         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11239         cache-size parameter.
11240         (Dwarf_line_info::one_addr2line_cache): New function.
11241         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11242         new cache-size argument to one_addr2line(), and clear cache.
11243
11244 2008-04-28  Cary Coutant  <ccoutant@google.com>
11245
11246         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11247         R_386_PC8 relocations.
11248
11249 2008-04-23  Ian Lance Taylor  <iant@google.com>
11250
11251         * object.cc (Sized_relobj::include_section_group): Check for
11252         invalid section group.
11253
11254         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11255         header size.
11256
11257         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11258         than read for file header.
11259         * archive.cc (Archive::include_member): Likewise.
11260
11261 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11262
11263         * aclocal.m4: Regenerate.
11264         * configure: Regenerate.
11265
11266 2008-04-19  Ian Lance Taylor  <iant@google.com>
11267
11268         * version.cc (version_string): Bump to 1.6.
11269
11270         * testsuite/Makefile.am (many_sections_r_test): New target.
11271         (many_sections_r_test_SOURCES): Remove.
11272         (many_sections_r_test_DEPENDENCIES): Remove.
11273         (many_sections_r_test_LDFLAGS): Remove.
11274         (many_sections_r_test_LDADD): Remove.
11275
11276         * object.cc (Sized_relobj::do_add_symbols): Always pass
11277         local_symbol_count_ to add_from_relobj.
11278
11279         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11280         every thousand variables.
11281         * testsuite/Makefile.in: Rebuild.
11282
11283         * object.cc (Xindex::initialize_symtab_xindex): New function.
11284         (Xindex::read_symtab_xindex): New function.
11285         (Xindex::sym_xindex_to_shndx): New function.
11286         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11287         available.
11288         (Sized_relobj::do_initialize_xindex): New function.
11289         (Sized_relobj::do_read_symbols): Adjust section links.
11290         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11291         parameter.  Change all callers.
11292         (Sized_relobj::include_section_group): Adjust section links and
11293         symbol section indexes.
11294         (Sized_relobj::do_layout): Adjust section links.
11295         (Sized_relobj::do_count_local_symbols): Adjust section links and
11296         symbol section indexes.
11297         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11298         ordinary and special symbols.
11299         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11300         dynsym_xindex parameters.  Change all callers.  Adjust section
11301         links.  Use SHN_XINDEX when needed.
11302         (Sized_relobj::get_symbol_location_info): Adjust section links.
11303         Don't get fooled by special symbols.
11304         * object.h (class Xindex): Define.
11305         (class Object): Add xindex_ parameter.  Declare virtual functoin
11306         do_initialize_xindex.
11307         (Object::adjust_sym_shndx): New function.
11308         (Object::set_xindex): New protected function.
11309         (class Symbol_value): Add is_ordinary_shndx_ field.
11310         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11311         (Symbol_value::value): Assert ordinary section.
11312         (Symbol_value::initialize_input_to_output_map): Likewise.
11313         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11314         Change all callers.
11315         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11316         all callers.
11317         (class Sized_relobj): Update declarations.
11318         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11319         parameter.  Change all callers.
11320         (Sized_relobj::adjust_shndx): New function.
11321         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11322         field.
11323         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11324         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11325         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11326         (Sized_dynobj::read_dynsym_section): Adjust section links.
11327         (Sized_dynobj::read_dynamic): Likewise.
11328         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11329         section links.
11330         (Sized_dynobj::do_initialize_xindex): New function.
11331         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11332         do_initialize_xindex.
11333         (Sized_dynobj::adjust_shndx): New function.
11334         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11335         dynsym_xindex_ fields.
11336         (Layout::finalize): Add a call to set_section_indexes before
11337         creating the symtab sections.
11338         (Layout::set_section_indexes): Don't do anything if the section
11339         already has a section index.
11340         (Layout::create_symtab_sections): Add shnum parameter.  Change
11341         caller.  Create .symtab_shndx section if needed.
11342         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11343         caller.
11344         (Layout::allocated_output_section_count): New function.
11345         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11346         needed.
11347         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11348         fields.  Update declarations.
11349         (Layout::symtab_xindex): New function.
11350         (Layout::dynsym_xindex): New function.
11351         (class Write_symbols_task): Add layout_ field.
11352         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11353         Change caller.
11354         * output.cc (Output_section_headers::Output_section_headers): Add
11355         shstrtab_section parameter.  Change all callers.
11356         (Output_section_headers::do_sized_write): Store overflow values
11357         for section count and section string table section index in
11358         section header zero.
11359         (Output_file_header::do_sized_write): Check for overflow of
11360         section count and section string table section index.
11361         (Output_symtab_xindex::do_write): New function.
11362         (Output_symtab_xindex::endian_do_write): New function.
11363         * output.h (class Output_section_headers): Add shstrtab_section_.
11364         Update declarations.
11365         (class Output_symtab_xindex): Define.
11366         (Output_section::has_out_shndx): New function.
11367         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11368         field.
11369         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11370         Change all callers.
11371         (Sized_symbol::init): Likewise.
11372         (Symbol::output_section): Check for ordinary symbol.
11373         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11374         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11375         callers.
11376         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11377         Change all callers.  Simplify handling of symbols from sections
11378         not included in the link.
11379         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11380         distinction.
11381         (Weak_alias_sorter::operator()): Assert that symbols are
11382         ordinary.
11383         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11384         distinction.
11385         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11386         parameters.  Change all callers.
11387         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11388         symbol distinction.  Use SHN_XINDEX when needed.
11389         (Symbol_table::write_section_symbol): Add symtab_xindex
11390         parameter.  Change all callers.
11391         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11392         SHN_XINDEX when needed.
11393         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11394         declarations.
11395         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11396         (Symbol::is_defined): Check is_ordinary.
11397         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11398         (Symbol::is_absolute, Symbol::is_common): Likewise.
11399         (class Sized_symbol): Update declarations.
11400         (class Symbol_table): Update declarations.
11401         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11402         parameters.  Change all callers.
11403         (Sized_symbol::override): Likewise.
11404         (Symbol_table::override): Likewise.
11405         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11406         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11407         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11408         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11409         to be in an ordinary section.
11410         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11411         object and is_ordinary parameters.  Change all callers.
11412         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11413         Change all callers.  Don't add undefined or non-ordinary symbols
11414         to reloc_map_.
11415         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11416         Change all callers.
11417         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11418         declarations.
11419         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11420         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11421         (Sized_relobj::relocate_sections): Likewise.
11422         * target-reloc.h (scan_relocs): Adjust section symbol index.
11423         (scan_relocatable_relocs): Likewise.
11424         * i386.cc (Scan::local): Check for ordinary symbols.
11425         * sparc.cc (Scan::local): Likewise.
11426         * x86_64.cc (Scan::local): Likewise.
11427         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11428         to symbol_section_and_value.
11429         * testsuite/many_sections_test.cc: New file.
11430         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11431         (check_PROGRAMS): Add many_sections_test.
11432         (many_sections_test_SOURCES): Define.
11433         (many_sections_test_DEPENDENCIES): Define.
11434         (many_sections_test_LDFLAGS): Define.
11435         (BUILT_SOURCES): Add many_sections_define.h.
11436         (many_sections_define.h): New target.
11437         (BUILT_SOURCES): Add many_sections_check.h.
11438         (many_sections_check.h): New target.
11439         (check_PROGRAMS): Add many_sections_r_test.
11440         (many_sections_r_test_SOURCES): Define.
11441         (many_sections_r_test_DEPENDENCIES): Define.
11442         (many_sections_r_test_LDFLAGS): Define.
11443         (many_sections_r_test_LDADD): Define.
11444         (many_sections_r_test.o): New target.
11445         * testsuite/Makefile.in: Rebuild.
11446
11447 2008-04-17  Cary Coutant  <ccoutant@google.com>
11448
11449         * errors.cc (Errors::info): New function.
11450         (gold_info): New function.
11451         * errors.h (Errors::info): New function.
11452         * gold.h (gold_info): New function.
11453         * object.cc (Input_objects::add_object): Print trace output.
11454         * options.cc (options::parse_set): New function.
11455         (General_options::parse_wrap): Deleted.
11456         (General_options::General_options): Deleted initializer.
11457         * options.h (options::String_set): New typedef.
11458         (options::parse_set): New function.
11459         (DEFINE_set): New macro.
11460         (General_options::wrap): Changed to use DEFINE_set. Changed
11461         callers of any_wrap_symbols and is_wrap_symbol.
11462         (General_options::trace, General_options::trace_symbol):
11463         New options.
11464         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11465         (General_options::wrap_symbols_): Deleted.
11466         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11467
11468 2008-04-17  David S. Miller  <davem@davemloft.net>
11469
11470         * options.cc (General_options::parse_V): New function.
11471         * options.h: Add entries for -V and -Qy.
11472
11473 2008-04-17  Ian Lance Taylor  <iant@google.com>
11474
11475         * common.cc (Symbol_table::allocate_commons): Remove options
11476         parameter.  Change caller.
11477         (Symbol_table::do_allocate_commons): Remove options parameter.
11478         Change caller.  Just call do_allocate_commons_list twice.
11479         (Symbol_table::do_allocate_commons_list): New function, broken out
11480         of do_allocate_commons.
11481         * common.h (class Allocate_commons_task): Remove options_ field.
11482         Update constructor.
11483         * symtab.cc (Symbol_table::Symbol_table): Initialize
11484         tls_commons_.
11485         (Symbol_table::add_from_object): Put TLS common symbols on
11486         tls_commons_ list.
11487         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11488         which are IN_OUTPUT_DATA.
11489         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11490         allocate_commons and do_allocate_commons declarations.  Declare
11491         do_allocate_commons_list.
11492         * gold.cc (queue_middle_tasks): Update creation of
11493         Allocate_commons_task to not pass options.
11494         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11495         (TLS_TEST_C_FLAGS): New variable.
11496         (tls_test_c_pic.o): New target.
11497         (tls_test_shared.so): Link in tls_test_c_pic.o.
11498         (tls_test_c_pic_ie.o): New target.
11499         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11500         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11501         (tls_test_c.o): New target.
11502         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11503         (tls_pic_test_LDADD): Likewise.
11504         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11505         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11506         (tls_test_c_gnu2.o): New target.
11507         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11508         tls_test_c_gnu2.o.
11509         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11510         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11511         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11512         * testsuite/tls_test.cc: Include "config.h".
11513         (t_last): Call t11_last.
11514         * testsuite/tls_test.h (t11, t11_last): Declare.
11515         * testsuite/tls_test_c.c: New file.
11516         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11517         * configure.ac: Check for OpenMP support.
11518         * configure, config.in, Makefile.in: Rebuild.
11519         * testsuite/Makefile.in: Rebuild.
11520
11521 2008-04-16  Cary Coutant  <ccoutant@google.com>
11522
11523         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11524         (Target_i386::tls_base_symbol_defined_): New field.
11525         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11526         (Target_i386::Scan::global): Likewise.
11527         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11528         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11529         (Target_x86_64::tls_base_symbol_defined_): New field.
11530         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11531         (Target_x86_64::Scan::global): Likewise.
11532
11533 2008-04-16  Cary Coutant  <ccoutant@google.com>
11534
11535         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11536         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11537         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11538         building shared libraries.
11539         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11540         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11541         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11542         * testsuite/Makefile.in: Rebuild.
11543         * testsuite/weak_undef.h: New file.
11544         * testsuite/weak_undef_file1.cc: Add extra test cases.
11545         * testsuite/weak_undef_file2.cc: Likewise.
11546         * testsuite/weak_undef_test.cc: Likewise.
11547
11548 2008-04-16  David S. Miller  <davem@davemloft.net>
11549
11550         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11551         Add issued_non_pic_error_ field.  Declare check_non_pic.
11552         (Target_sparc::Scan::check_non_pic): New function.
11553         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11554         (Target_sparc::Scan::global): Likewise.
11555
11556         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11557         * configure: Rebuild.
11558
11559         * options.h (DEFINE_enable): New macro.
11560         (new_dtags): New enable option.
11561         (initfirst, interpose, loadfltr, nodefaultlib,
11562         nodelete, nodlopen, nodump): New -z options.
11563         * layout.cc (Layout:finish_dynamic_section): If new
11564         dtags enabled, emit DT_RUNPATH.  Also, emit a
11565         DT_FLAGS_1 containing any specified -z flags.
11566
11567 2008-04-16  Ian Lance Taylor  <iant@google.com>
11568
11569         * copy-relocs.cc: New file.
11570         * copy-relocs.h: New file.
11571         * reloc.cc: Remove Copy_relocs code.
11572         * reloc.h: Likewise.
11573         * reloc-types.h (struct Reloc_types) [both versions]: Add
11574         get_reloc_addend_noerror.
11575         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11576         variants of add_global which take an addend which must be zero.
11577         * i386.cc: Include "copy-relocs.h".
11578         (class Target_i386): Change type of copy_relocs_ to variable,
11579         update initializer.
11580         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11581         Change all callers.
11582         (Target_i386::do_finalize_sections): Change handling of
11583         copy_relocs_.
11584         * sparc.cc: Include "copy-relocs.h".
11585         (class Target_sparc): Change type of copy_relocs_ to variable,
11586         update initializer.
11587         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11588         Change all callers.
11589         (Target_sparc::do_finalize_sections): Change handling of
11590         copy_relocs_.
11591         * x86_64.cc: Include "copy-relocs.h".
11592         (class Target_x86_64): Change type of copy_relocs_ to variable,
11593         update initializer.
11594         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11595         class.  Change all callers.
11596         (Target_x86_64::do_finalize_sections): Change handling of
11597         copy_relocs_.
11598         * Makefile.am (CCFILES): Add copy-relocs.cc.
11599         (HFILES): Add copy-relocs.h.
11600
11601         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11602
11603         * testsuite/script_test_4.sh: Permit leading zeroes.
11604
11605 2008-04-15  Ian Lance Taylor  <iant@google.com>
11606
11607         * script-sections.cc (Script_sections::create_segments): Use
11608         header_size_adjustment even when there is enough room for the
11609         headers.
11610         * testsuite/script_test_4.sh: New file.
11611         * testsuite/script_test_4.t: New file.
11612         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11613         (check_DATA): Add script_test_4.stdout.
11614         (MOSTLYCLEANFILES): Likewise.
11615         (script_test_4): New target.
11616         (script_test_4.stdout): New target.
11617         * testsuite/Makefile.in: Rebuild.
11618
11619         * sparc.cc: Add definitions for Output_data_plt_sparc class
11620         constants.
11621
11622 2008-04-14  David S. Miller  <davem@davemloft.net>
11623
11624         * sparc.cc: New file.
11625         * Makefile.am (TARGETSOURCES): Add sparc.cc
11626         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11627         * configure.tgt: Document targ_extra_size and
11628         targ_extra_big_endian.  Add entries for sparc-* and
11629         sparc64-*.
11630         * configure.ac: Handle targ_extra_size and
11631         targ_extra_big_endian.
11632         * Makefile.in: Rebuild.
11633         * configure: Likewise.
11634         * po/POTFILES.in: Likewise.
11635         * po/gold.pot: Likewise.
11636
11637 2008-04-14  Ian Lance Taylor  <iant@google.com>
11638
11639         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11640         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11641         in the name/type/flags to section mapping.  Don't call
11642         allocate_output_section.
11643         (Layout::choose_output_section): Change parameter from adjust_name
11644         to is_input_section.  Don't permit input sections after sections
11645         are attached to segments.  Don't call allocate_output_section.
11646         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11647         not write_enable_output_section.
11648         (Layout::make_output_section): Don't push to
11649         unattached_section_list_ nor call attach_to_segment.  Call
11650         attach_section_to_segment if sections are attached.
11651         (Layout::attach_sections_to_segments): New function.
11652         (Layout::attach_section_to_segment): New function.
11653         (Layout::attach_allocated_section_to_segment): Rename from
11654         attach_to_segment.  Remove flags parameter.
11655         (Layout::allocate_output_section): Remove function.
11656         (Layout::write_enable_output_section): Remove function.
11657         * layout.h (class Layout): Update for above changes.  Add new
11658         field sections_are_attached_.
11659         * output.h (Output_section::update_flags_for_input_section): New
11660         function.
11661         * output.cc (Output_section::add_input_section): Call
11662         update_flags_for_input_section.
11663         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11664
11665 2008-04-11  Cary Coutant  <ccoutant@google.com>
11666
11667         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11668         thought unnecessary.
11669         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11670
11671 2008-04-11  Ian Lance Taylor  <iant@google.com>
11672
11673         * output.h (class Output_section_data): Remove inline definition
11674         of set_addralign.
11675         * output.cc (Output_section_data::set_addralign): New function.
11676
11677 2008-04-11  Cary Coutant  <ccoutant@google.com>
11678
11679         Add support for TLS descriptors for i386 and x86_64.
11680         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11681         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11682         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11683         GOT_TYPE_TLS_DESC.
11684         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11685         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11686         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11687         relocations.
11688         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11689         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11690         Fix problem with initial-exec relocations.
11691         (Target_i386::Relocate::relocate_tls): Likewise.
11692         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11693         relaxation.
11694         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11695         support for section-plus-offset dynamic table entries.
11696         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11697         (Output_data_dynamic::Dynamic_entry): Add support for
11698         section-plus-offset dynamic table entries.
11699         (Output_data_dynamic::Classification): Likewise.
11700         (Output_data_dynamic::classification_): Renamed offset_.
11701         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11702         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11703         (Target_x86_64::make_plt_section): New function.
11704         (Target_x86_64::reserve_tlsdesc_entries): New function.
11705         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11706         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11707         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11708         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11709         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11710         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11711         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11712         add extra PLT entry for TLS descriptors.
11713         (Output_data_plt_x86_64::got_): New field.
11714         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11715         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11716         fields.
11717         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11718         descriptors.
11719         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11720         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11721         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11722         R_386_TLS_DESC_CALL relocations.
11723         (Target_x86_64::Scan::global): Likewise.
11724         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11725         for TLS descriptors.
11726         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11727         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11728         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11729         GD-to-IE relaxation.
11730         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11731         and TLS_DESCRIPTORS.
11732         * Makefile.in: Rebuild.
11733         * configure: Rebuild.
11734         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11735         (tls_test_shared2.so): New target.
11736         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11737         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11738         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11739         (tls_shared_gd_to_ie_test_LDADD): New variable.
11740         (tls_shared_gnu2_gd_to_ie_test): New target.
11741         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11742         New targets.
11743         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11744         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11745         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11746         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11747         (tls_shared_gnu2_test): New target.
11748         (tls_test_gnu2_shared.so): New target.
11749         (tls_shared_gnu2_test_SOURCES): New variable.
11750         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11751         (tls_shared_gnu2_test_LDFLAGS): New variable.
11752         (tls_shared_gnu2_test_LDADD): New variable.
11753         * testsuite/Makefile.in: Rebuild.
11754         * testsuite/Makefile.
11755
11756 2008-04-11  Ian Lance Taylor  <iant@google.com>
11757
11758         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11759         justsyms.t.
11760         * testsuite/Makefile.in: Rebuild.
11761
11762         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11763         long.
11764         * testsuite/script_test_2.cc (main): Adjust test.
11765
11766 2008-04-11  David S. Miller  <davem@davemloft.net>
11767             Ian Lance Taylor  <iant@google.com>
11768
11769         * options.h (General_options): Add entries for '-Y' and
11770         '-relax'.
11771         * options.cc (General_options:finalize): If -Y was used, add those
11772         entries to the library path instead of the default "/lib" and
11773         "/usr/lib".
11774
11775 2008-04-11  David S. Miller  <davem@davemloft.net>
11776
11777         * testsuite/justsyms.t: Start at 0x100.
11778         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11779         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11780         long.
11781         * testsuite/script_test_2.cc: Adjust string and section length
11782         checks.
11783
11784 2008-04-09  Ian Lance Taylor  <iant@google.com>
11785
11786         PR gold/5996
11787         * script-sections.cc (Sections_element::allocate_to_segment): Add
11788         orphan parameter.
11789         (Output_section_definition::allocate_to_segment): Likewise.
11790         (Orphan_output_section::allocate_to_segment): Likewise.
11791         (Script_sections::attach_sections_using_phdrs_clause): Don't
11792         propagate non-PT_LOAD segments to orphan sections.
11793         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11794         readelf rather than objdump.
11795         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11796         .interp section and PT_INTERP segment are the same size.
11797         * testsuite/Makefile.in: Rebuild.
11798
11799         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11800         aliases for symbols defined in the same object.
11801         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11802         (weak_alias_test_SOURCES): New variable.
11803         (weak_alias_test_DEPENDENCIES): New variable.
11804         (weak_alias_test_LDFLAGS): New variable.
11805         (weak_alias_test_LDADD): New variable.
11806         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11807         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11808         (weak_alias_test_3.o): New target.
11809         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11810         * testsuite/weak_alias_test_main.cc: New file.
11811         * testsuite/weak_alias_test_1.cc: New file.
11812         * testsuite/weak_alias_test_2.cc: New file.
11813         * testsuite/weak_alias_test_3.cc: New file.
11814
11815 2008-04-08  Ian Lance Taylor  <iant@google.com>
11816
11817         * options.h (class General_options): Add --noinhibit-exec option.
11818         * main.cc (main): Check --noinhibit-exec.
11819
11820         * options.h (class General_options): Define --wrap as a special
11821         option.  Add wrap_symbols_ field.
11822         (General_options::any_wrap_symbols): New function.
11823         (General_options::is_wrap_symbol): New function.
11824         * options.cc (General_options::parse_wrap): New function.
11825         (General_options::General_options): Initialize wrap_symbols_.
11826         * symtab.cc (Symbol_table::wrap_symbol): New function.
11827         (Symbol_table::add_from_object): Handle --wrap.
11828         * symtab.h (class Symbol_table): Declare wrap_symbol.
11829         * target.h (Target::wrap_char): New function.
11830         (Target::Target_info): Add wrap_char field.
11831         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11832         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11833         * testsuite/testfile.cc (Target_test::test_target_info):
11834         Likewise.
11835
11836         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11837         there is one.
11838
11839         * layout.h (class Layout): Add added_eh_frame_data_ field.
11840         * layout.cc (Layout::Layout): Initialize new field.
11841         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11842         output section until we find a section we merged successfully.
11843         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11844         that the size be non-zero.
11845
11846         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11847         qualifier.
11848
11849 2008-04-08  Craig Silverstein  <csilvers@google.com>
11850
11851         * configure.ac: Export new conditional variable HAVE_ZLIB.
11852         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11853         on HAVE_ZLIB.
11854         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11855         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11856
11857 2008-04-07  Ian Lance Taylor  <iant@google.com>
11858
11859         * version.cc (version_string): Set to "1.5".
11860
11861         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11862         Add issued_non_pic_error_ field.  Declare check_non_pic.
11863         (Target_x86_64::Scan::check_non_pic): New function.
11864         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11865         (Target_x86_64::Scan::global): Likewise.
11866
11867         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11868         addend parameter.  Change caller.  Handle merge sections.
11869         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11870         Address to Addend.  Don't add in the result of
11871         local_section_offset, pass down the addend and use the returned
11872         value.
11873         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11874         Update declarations of local_section_offset and symbol_value.
11875         * testsuite/two_file_test_1.cc (t18): New function.
11876         * testsuite/two_file_test_2.cc (f18): New function.
11877         * testsuite/two_file_test_main.cc (main): Call t18.
11878         * testsuite/two_file_test.h (t18, f18): Declare.
11879
11880         * configure.ac: Don't test for objdump, c++filt, or readelf.
11881         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11882         conditionals.
11883         (TEST_READELF): New variable.
11884         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11885         (check_PROGRAMS): Add two_file_strip_test.
11886         (two_file_strip_test): New target.
11887         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11888         (two_file_same_shared_strip_test_SOURCES): New variable.
11889         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11890         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11891         (two_file_same_shared_strip_test_LDADD): New variable.
11892         (two_file_shared_strip.so): New target.
11893         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11894         (ver_test_5.syms, ver_test_7.syms): Likewise.
11895         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11896         (strip_test_3.stdout): Use TEST_OBJDUMP.
11897         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11898
11899 2008-04-04  Cary Coutant  <ccoutant@google.com>
11900
11901         * symtab.h (Symbol::is_weak_undefined): New function.
11902         (Symbol::is_strong_undefined): New function.
11903         (Symbol::is_absolute): New function.
11904         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11905         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11906         absolute symbols.
11907         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11908         (weak_undef_test): New target.
11909         * testsuite/Makefile.in: Rebuild.
11910         * testsuite/weak_undef_file1.cc: New file.
11911         * testsuite/weak_undef_file2.cc: New file.
11912         * testsuite/weak_undef_test.cc: New file.
11913
11914 2008-04-03  Craig Silverstein  <csilvers@google.com>
11915
11916         * compressed_output.h (class Output_compressed_section): Use
11917         unsigned buffer.
11918         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11919         add zlib header.
11920         (zlib_compressed_suffix): Removed.
11921         (Output_compressed_section::set_final_data_size): Use unsigned
11922         buffers.
11923         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11924         Fix linker invocation.
11925         (flagstest_o_specialfile_and_compress_debug_sections):
11926         Likewise.
11927         * testsuite/Makefile.in: Regenerated.
11928
11929 2008-04-02  David S. Miller  <davem@davemloft.net>
11930
11931         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11932         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11933
11934 2008-04-02  Craig Silverstein  <csilvers@google.com>
11935
11936         * TODO: New file.
11937
11938 2008-04-02  Ian Lance Taylor  <iant@google.com>
11939
11940         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11941         parameters.  Update for new key type to views_.  Change all
11942         callers.
11943         (File_read::read): Adjust for byteshift in returned view.
11944         (File_read::add_view): New function, broken out of
11945         find_and_make_view.
11946         (File_read::make_view): New function, broken out of
11947         find_and_make_view.
11948         (File_read::find_or_make_view): Add offset and aligned
11949         parameters.  Rewrite accordingly.  Change all callers.
11950         (File_read::get_view): Add offset and aligned parameters.  Adjust
11951         for byteshift in return value.
11952         (File_read::get_lasting_view): Likewise.
11953         * fileread.h (class File_read): Update declarations.
11954         (class File_read::View): Add byteshift_ field.  Add byteshift to
11955         constructor.  Add byteshift method.
11956         * archive.h (Archive::clear_uncached_views): New function.
11957         (Archive::get_view): Add aligned parameter.  Change all callers.
11958         * object.h (Object::get_view): Add aligned parameter.  Change all
11959         callers.
11960         (Object::get_lasting_view): Likewise.
11961
11962         * fileread.cc (File_read::release): Don't call clear_views if
11963         there are multiple objects.
11964         * fileread.h (File_read::clear_uncached_views): New function.
11965         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11966         on the archive.
11967
11968 2008-03-31  Cary Coutant  <ccoutant@google.com>
11969
11970         Add thin archive support.
11971         * archive.cc (Archive::armagt): New const.
11972         (Archive::setup): Remove task parameter and calls to unlock.
11973         (Archive::unlock_nested_archives): New function.
11974         (Archive::read_header): Add nested_off parameter. Change
11975         all callers.
11976         (Archive::interpret_header): Likewise.
11977         (Archive::include_all_members): Change to handle thin
11978         archives.
11979         (Archive::include_member): Likewise.
11980         * archive.h (Archive::Archive): Add new parameters and
11981         initializers.
11982         (Archive::armagt): New const.
11983         (Archive::setup): Remove task parameter.
11984         (Archive::unlock_nested_archives): New function.
11985         (Archive::read_header): Add nested_off parameter.
11986         (Archive::interpret_header): Likewise.
11987         (Archive::Nested_archive_table): New typedef.
11988         (Archive::is_thin_archive_): New field.
11989         (Archive::nested_archives_): New field.
11990         (Archive::options_): New field.
11991         (Archive::dirpath_): New field.
11992         (Archive::task_): New field.
11993         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11994         for thin archives.  Pass additional parameters to
11995         Archive::Archive.  Unlock the archive file after calling
11996         Archive::setup.
11997
11998 2008-03-29  Ian Lance Taylor  <iant@google.com>
11999
12000         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12001         version symbol to be local.
12002         * testsuite/ver_test_4.sh: New file.
12003         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12004         (check_DATA): Add ver_test_4.syms.
12005         (ver_test_4.syms): New target.
12006         * testsuite/Makefile.in: Rebuild.
12007
12008         * output.cc
12009         (Output_section::Input_section_sort_entry::has_priority): New
12010         function.
12011         (Output_section::Input_section_sort_entry::match_file_name): New
12012         function.
12013         (Output_section::Input_section_sort_entry::match_section_name):
12014         Remove.
12015         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12016         Remove.
12017         (Output_section::Input_section_sort_entry::match_section_file):
12018         Remove.
12019         (Output_section::Input_section_sort_compare::operator()): Rewrite
12020         using new Input_section_sort_entry functions.  Sort crtbegin and
12021         crtend first.  Sort sections with no priority before sections with
12022         a priority.
12023         * testsuite/initpri1.c (d3): Check j != 4.
12024         (cd5): New constructor/destructor function.
12025         (main): Check j != 2.
12026
12027         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12028         new symbol when resolving, don't call set_is_default.
12029         * testsuite/ver_test_7.cc: New file.
12030         * testsuite/ver_test_7.sh: New file.
12031         * testsuite/Makefile.am (ver_test_7.so): New target.
12032         (ver_test_7.o): New target.
12033         (check_SCRIPTS): Add ver_test_7.sh.
12034         (check_DATA): Add ver_test_7.syms.
12035         (ver_test_7.syms): New target.
12036
12037 2008-03-28  Ian Lance Taylor  <iant@google.com>
12038
12039         * layout.cc (Layout::layout): If we see an input section with a
12040         name that needs sorting, set the must_sort flag for the output
12041         section.
12042         (Layout::make_output_section): If the name of the output section
12043         indicates that it might require sorting, set the may_sort flag.
12044         * output.h (Output_section::may_sort_attached_input_sections): New
12045         function.
12046         (Output_section::set_may_sort_attached_input_sections): New
12047         function.
12048         (Output_section::must_sort_attached_input_sections): New
12049         function.
12050         (Output_section::set_must_sort_attached_input_sections): New
12051         function.
12052         (class Output_section): Declare Input_section_sort_entry.  Define
12053         Input_section_sort_compare.  Declare
12054         sort_attached_input_sections.  Add new fields:
12055         may_sort_attached_input_sections_,
12056         must_sort_attached_input_sections_,
12057         attached_input_sections_are_sorted_.
12058         * output.cc (Output_section::Output_section): Initialize new
12059         fields.
12060         (Output_section::add_input_section): Add an entry to
12061         input_sections_ if may_sort or must_sort are true.
12062         (Output_section::set_final_data_size): Call
12063         sort_attached_input_sections if necessary.
12064         (Output_section::Input_section_sort_entry): Define new class.
12065         (Output_section::Input_section_sort_compare::operator()): New
12066         function.
12067         (Output_section::sort_attached_input_sections): New function.
12068         * configure.ac: Check whether the compiler supports constructor
12069         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12070         * testsuite/initpri1.c: New file.
12071         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12072         CONSTRUCTOR_PRIORITY.
12073         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12074         (initpri1_LDFLAGS): New variable.
12075         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12076
12077 2008-03-27  Ian Lance Taylor  <iant@google.com>
12078
12079         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12080         * testsuite/common_test_1.c: New file.
12081         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12082         (common_test_1_SOURCES): New variable.
12083         (common_test_1_DEPENDENCIES): New variable.
12084         (common_test_1_LDFLAGS): New variable.
12085
12086         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12087         and commons_ correctly when NAME/VERSION does not override
12088         NAME/NULL.
12089         * testsuite/ver_test_6.c: New file.
12090         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12091         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12092         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12093
12094 2008-03-26  Ian Lance Taylor  <iant@google.com>
12095
12096         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12097         of an undefined symbol from a version script.
12098         * testsuite/Makefile.am (ver_test_5.so): New target.
12099         (ver_test_5.o): New target.
12100         (check_SCRIPTS): Add ver_test_5.sh.
12101         (check_DATA): Add ver_test_5.syms.
12102         (ver_test_5.syms): New target.
12103         * testsuite/ver_test_5.cc: New file.
12104         * testsuite/ver_test_5.script: New file.
12105         * testsuite/ver_test_5.sh: New file.
12106         * Makefile.in, testsuite/Makefile.in: Rebuild.
12107
12108         PR gold/5986
12109         Fix problems building gold with gcc 4.3.0.
12110         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12111         (gold_error_at_location, gold_warning_at_location): Use it.
12112         * configure.ac: Check whether we can compile and use a template
12113         function with a printf attribute.
12114         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12115         when jumping over bytes.
12116         * object.cc: Instantiate Object::read_section_data.
12117         * debug.h: Include <cstring>
12118         * dwarf_reader.cc: Include <algorithm>
12119         * main.cc: Include <cstring>.
12120         * options.cc: Include <cstring>.
12121         * output.cc: Include <cstring>.
12122         * script.cc: Include <cstring>.
12123         * script.h: Include <string>.
12124         * symtab.cc: Include <cstring> and <algorithm>.
12125         * target-select.cc: Include <cstring>.
12126         * version.cc: Include <string>.
12127         * testsuite/testmain.cc: Include <cstdlib>.
12128         * configure, config.in: Rebuild.
12129
12130 2008-03-25  Ian Lance Taylor  <iant@google.com>
12131
12132         * options.cc: Include "../bfd/bfdver.h".
12133         (options::help): Print bug reporting address.
12134
12135         * version.cc (print_version): Adjust output for current value of
12136         BFD_VERSION_STRING.
12137
12138         * NEWS: New file.
12139
12140         * options.cc (options::help): Print list of supported targets.
12141         * target-select.h: Include <vector>.
12142         (class Target_selector): Make machine_, size_, and is_big_endian_
12143         fields const.  Add bfd_name_ and instantiated_target_ fields.
12144         (Target_selector::Target_selector): Add bfd_name parameter.
12145         (Target_selector::recognize): Make non-virtual, call
12146         do_recognize.
12147         (Target_selector::recognize_by_name): Make non-virtual, call
12148         do_recognize_by_name.
12149         (Target_selector::supported_names): New function.
12150         (Target_selector::bfd_name): New function.
12151         (Target_selector::do_instantiate_target): New pure virtual
12152         function.
12153         (Target_selector::do_recognize): New virtual function.
12154         (Target_selector::do_recognize_by_name): New virtual function.
12155         (Target_selector::instantiate_target): New private function.
12156         (supported_target_names): Declare.
12157         * target-select.cc (Target_selector::Target_selector): Update for
12158         new parameter and fields.
12159         (select_target_by_name): Check that the name matches before
12160         calling recognize_by_name.
12161         (supported_target_names): New function.
12162         * i386.cc (class Target_selector_i386): Update Target_selector
12163         constructor call.  Remove recognize and recognize_by_name.  Add
12164         do_instantiate_target.
12165         * x86_64.cc (class Target_selector_x86_64): Likewise.
12166         * testsuite/testfile.cc (class Target_selector_test): Update for
12167         changes to Target_selector.
12168
12169         * README: Rewrite, with some notes on unsupported features.
12170
12171 2008-03-24  Cary Coutant  <ccoutant@google.com>
12172
12173         * i386.cc (Target_i386::Got_type): New enum declaration.
12174         (Target_i386::Scan::local): Updated callers of Output_data_got
12175         member functions.
12176         (Target_i386::Scan::global): Likewise.
12177         (Target_i386::Relocate::relocate): Likewise.
12178         (Target_i386::Relocate::relocate_tls): Likewise.
12179         * object.h (Got_offset_list): New class.
12180         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12181         (Sized_relobj::local_got_offset): Likewise.
12182         (Sized_relobj::set_local_got_offset): Likewise.
12183         (Sized_relobj::local_has_tls_got_offset): Removed.
12184         (Sized_relobj::local_tls_got_offset): Removed.
12185         (Sized_relobj::set_local_tls_got_offset): Removed.
12186         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12187         * output.cc (Output_data_got::add_global): Added got_type parameter.
12188         (Output_data_got::add_global_with_rel): Likewise.
12189         (Output_data_got::add_global_with_rela): Likewise.
12190         (Output_data_got::add_global_pair_with_rel): New function.
12191         (Output_data_got::add_global_pair_with_rela): New function.
12192         (Output_data_got::add_local): Added got_type parameter.
12193         (Output_data_got::add_local_with_rel): Likewise.
12194         (Output_data_got::add_local_with_rela): Likewise.
12195         (Output_data_got::add_local_pair_with_rel): New function.
12196         (Output_data_got::add_local_pair_with_rela): New function.
12197         (Output_data_got::add_global_tls): Removed.
12198         (Output_data_got::add_global_tls_with_rel): Removed.
12199         (Output_data_got::add_global_tls_with_rela): Removed.
12200         (Output_data_got::add_local_tls): Removed.
12201         (Output_data_got::add_local_tls_with_rel): Removed.
12202         (Output_data_got::add_local_tls_with_rela): Removed.
12203         * output.h (Output_data_got::add_global): Added got_type parameter.
12204         (Output_data_got::add_global_with_rel): Likewise.
12205         (Output_data_got::add_global_with_rela): Likewise.
12206         (Output_data_got::add_global_pair_with_rel): New function.
12207         (Output_data_got::add_global_pair_with_rela): New function.
12208         (Output_data_got::add_local): Added got_type parameter.
12209         (Output_data_got::add_local_with_rel): Likewise.
12210         (Output_data_got::add_local_with_rela): Likewise.
12211         (Output_data_got::add_local_pair_with_rel): New function.
12212         (Output_data_got::add_local_pair_with_rela): New function.
12213         (Output_data_got::add_global_tls): Removed.
12214         (Output_data_got::add_global_tls_with_rel): Removed.
12215         (Output_data_got::add_global_tls_with_rela): Removed.
12216         (Output_data_got::add_local_tls): Removed.
12217         (Output_data_got::add_local_tls_with_rel): Removed.
12218         (Output_data_got::add_local_tls_with_rela): Removed.
12219         * resolve.cc (Symbol::override_base_with_special): Removed
12220         reference to has_got_offset_ field.
12221         * symtab.cc (Symbol::init_fields): Replaced initialization
12222         of got_offset_ with got_offsets_.  Removed initialization
12223         of has_got_offset_
12224         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12225         (Symbol::got_offset): Likewise.
12226         (Symbol::set_got_offset): Likewise.
12227         (Symbol::has_tls_got_offset): Removed.
12228         (Symbol::tls_got_offset): Removed.
12229         (Symbol::set_tls_got_offset): Removed.
12230         (Symbol::got_offset_): Removed.
12231         (Symbol::tls_mod_got_offset_): Removed.
12232         (Symbol::tls_pair_got_offset_): Removed.
12233         (Symbol::got_offsets_): New field.
12234         (Symbol::has_got_offset): Removed.
12235         (Symbol::has_tls_mod_got_offset): Removed.
12236         (Symbol::has_tls_pair_got_offset): Removed.
12237         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12238         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12239         member functions.
12240         (Target_x86_64::Scan::global): Likewise.
12241         (Target_x86_64::Relocate::relocate): Likewise.
12242         (Target_x86_64::Relocate::relocate_tls): Likewise.
12243
12244 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12245
12246         * yyscript.y: Fix spelling error in comment.
12247
12248 2008-03-24  Ian Lance Taylor  <iant@google.com>
12249
12250         * options.h (class General_options): Define build_id option.
12251         * layout.h (class Layout): Declare write_build_id, create_note,
12252         create_build_id.  Add build_id_note_ member.
12253         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12254         "libiberty.h", "md5.h", "sha1.h".
12255         (Layout::Layout): Initialize eh_frame_data_,
12256         eh_frame_hdr_section_, and build_id_note_.
12257         (Layout::finalize): Call create_build_id.
12258         (Layout::create_note): New function, broken out of
12259         Layout::create_gold_note.
12260         (Layout::create_gold_note): Call create_note.
12261         (Layout::create_build_id): New function.
12262         (Layout::write_build_id): New function.
12263         (Close_task_runner::run): Call write_build_id.
12264
12265         * x86_64.cc: Correct license to GPLv3.
12266
12267 2008-03-23  Ian Lance Taylor  <iant@google.com>
12268
12269         * options.cc: Include "demangle.h".
12270         (parse_optional_string): New function.
12271         (parse_long_option): Handle takes_optional_argument.
12272         (parse_short_option): Update dash_z initializer.  Handle
12273         takes_optional_argument.
12274         (General_options::General_options): Initialize do_demangle_.
12275         (General_options::finalize): Set do_demangle_.  Handle demangling
12276         style.
12277         * options.h (parse_optional_string): Declare.
12278         (struct One_option): Add optional_arg field.  Update constructor.
12279         Update call constructor calls.  Add takes_optional_argument
12280         function.
12281         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12282         (DEFINE_optional_string): Define.
12283         (General_options::demangle): Change from DEFINE_bool to
12284         DEFINE_optional_string.
12285         (General_options::no_demangle): New function.
12286         (General_options::do_demangle): New function.
12287         (General_options::set_do_demangle): New function.
12288         (General_options::execstack_status_): Move definition to end of
12289         class definition.
12290         (General_options::static_): Likewise.
12291         (General_options::do_demangle_): New field.
12292         * object.cc (big_endian>::get_symbol_location_info): Call
12293         Options::do_demangle, not Options::demangle.
12294         * symtab.cc (demangle): Likewise.
12295
12296 2008-03-22  Ian Lance Taylor  <iant@google.com>
12297
12298         * gold.h: Include <cstddef> and <sys/types.h>
12299         * options.h: Include <cstring>.
12300
12301 2008-03-21  Ian Lance Taylor  <iant@google.com>
12302
12303         * Added source code to GNU binutils.