Replace <64, false> with <size, big_endian>
[external/binutils.git] / gold / ChangeLog
1 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2
3         PR gold/13505
4         * target-reloc.h (apply_relocation): Replace <64, false> with
5         <size, big_endian>.
6
7 2011-11-25  Nick Clifton  <nickc@redhat.com>
8
9         * po/it.po: New Italian translation.
10
11 2011-11-17  Sterling Augustine  <saugustine@google.com>
12
13         * script.cc (script_include_directive): Implement.
14         (read_script_file): New local variables name and search_path. Update
15         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
16         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
17         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
18
19 2011-11-11  Sterling Augustine  <saugustine@google.com>
20
21         * yyscript.y (section_cmd): Add support for INCLUDE directive.
22         (file_or_sections_cmd): Likewise.
23
24 2011-11-11  Doug Kwan  <dougkwan@google.com>
25
26         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
27         if --just-symbols is given.
28
29 2011-11-10  Doug Kwan  <dougkwan@google.com>
30
31         PR gold/13362
32         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
33         when processing data relocs.
34         * reloc.h (Relocate_functions::rel_unaligned): New method.
35         (Relocate_functions::pcrel_unaligned): Ditto.
36         (Relocate_functions::rel32_unaligned): Ditto.
37         (Relocate_functions::pcrel32_unaligned): Ditto.
38
39 2011-11-09  Doug Kwan  <dougkwan@google.com>
40
41         PR gold/13362
42         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
43         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
44         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
45         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
46         (Relocate_functions::rel_unaligned): New.
47         (Relocate_functions::rel32_unaligned): New.
48         * target-reloc.h (relocate_for_relocatable): Add code to handle
49         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
50         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
51         arm_unaligned_reloc_r): New targets.
52         * testsuite/Makefile.in: Regenerate.
53         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
54         linking.
55
56 2011-11-02  Ian Lance Taylor  <iant@google.com>
57
58         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
59         NATIVE_LINKER.
60         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
61         * options.cc (General_options::finalize): Use library search path
62         from configure script if specified.  If not native and no sysroot,
63         only search TOOLLIBDIR.
64         * options.h (Search_directory::Search_directory): Change name to
65         const std::string&.
66         (General_options::add_to_library_path_with_sysroot): Change arg to
67         const std::string&.
68         * configure, Makefile.in, config.in: Rebuild.
69
70 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
71
72         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
73         we are working around the ARM1176 Erratum.
74         * options.h (General_options::fix_arm1176): Add option.
75         * testsuite/Makefile.am: Add testcases, and keep current ones
76         working.
77         * testsuite/Makefile.in: Regenerate.
78         * testsuite/arm_fix_1176.s: New file.
79         * testsuite/arm_fix_1176.sh: Likewise.
80
81 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
82
83         * arm.cc (Target_arm::Target_arm): Remove initialisation of
84         may_use_blx_.
85         (Target_arm::may_use_blx): Remove method.
86         (Target_arm::set_may_use_blx): Likewise.
87         (Target_arm::may_use_v4t_interworking): New method.
88         (Target_arm::may_use_v5t_interworking): Likewise.
89         (Target_arm::may_use_blx_): Remove member variable.
90         (Arm_relocate_functions::arm_branch_common): Check for v5T
91         interworking.
92         (Arm_relocate_functions::thumb_branch_common): Likewise.
93         (Reloc_stub::stub_type_for_reloc): Likewise.
94         (Target_arm::do_finalize_sections): Correct interworking checks.
95         * testsuite/Makefile.am: Add new tests.
96         * testsuite/Makefile.in: Regenerate.
97         * testsuite/arm_farcall_arm_arm.s: New test.
98         * testsuite/arm_farcall_arm_arm.sh: Likewise.
99         * testsuite/arm_farcall_arm_thumb.s: Likewise.
100         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
101         * testsuite/arm_farcall_thumb_arm.s: Likewise.
102         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
103         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
104         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
105
106 2011-10-31  Cary Coutant  <ccoutant@google.com>
107
108         PR gold/13023
109         * expression.cc (Expression::eval_with_dot): Add
110         is_section_dot_assignment parameter.
111         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
112         absolute and assigning to dot within a section.
113         * script-sections.cc
114         (Output_section_element_assignment::set_section_addresses): Pass
115         dot_section to set_if_absolute.
116         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
117         as is_section_dot_assignment flag to eval_with_dot.
118         (Output_section_element_dot_assignment::set_section_addresses):
119         Likewise.
120         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
121         parameter.  Also set value if relative to dot_section; set the
122         symbol's output_section.
123         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
124         parameter.  Adjust all callers.
125         (Expression::eval_maybe_dot): Likewise.
126         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
127         Adjust all callers.
128         * testsuite/script_test_2.t: Test assignment of an absolute value
129         to dot within an output section element.
130
131 2011-10-31  Cary Coutant  <ccoutant@google.com>
132
133         * options.h (class General_options): Add --[no-]gnu-unique options.
134         * symtab.cc (Symbol_table::sized_write_globals): Convert
135         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
136
137 2011-10-31  Cary Coutant  <ccoutant@google.com>
138
139         PR gold/13359
140         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
141         unnecessary assertion.
142         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
143
144 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
145
146         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
147         gc_mark_symbol.
148         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
149         gc_mark_symbol.
150         Change to just keep the section associated with symbol.
151         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
152         they are externally visible and --export-dynamic is turned on.
153         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
154
155 2011-10-19  Ian Lance Taylor  <iant@google.com>
156
157         PR gold/13163
158         * script-sections.cc
159         (Output_section_element_dot_assignment::needs_output_section): New
160         function.
161
162 2011-10-19  Ian Lance Taylor  <iant@google.com>
163
164         PR gold/13204
165         * layout.cc (Layout::segment_precedes): Don't assert failure if a
166         --section-start option was seen.
167         * options.h (General_options::any_section_start): New function.
168
169 2011-10-18  David S. Miller  <davem@davemloft.net>
170
171         PR binutils/13301
172         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
173         member to track relocation locations that have moved during TLS
174         reloc optimizations.
175         (Target_sparc::Relocate::Relocate): Initialize to NULL.
176         (Target_sparc::Relocate::relocate): Adjust view down by 4
177         bytes if it matches reloc_adjust_addr_.
178         (Target_sparc::Relocate::relocate_tls): Always move the
179         __tls_get_addr call delay slot instruction forward 4 bytes when
180         performing relaxation.
181
182 2011-10-18  Cary Coutant  <ccoutant@google.com>
183
184         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
185         (Output_file::map_no_anonymous): Check for non-zero
186         return code from posix_fallocate.
187
188 2011-10-17  Cary Coutant  <ccoutant@google.com>
189
190         PR gold/13245
191         * plugin.cc (is_visible_from_outside): Check for symbols
192         referenced from dynamic objects.
193         * resolve.cc (Symbol_table::resolve): Don't count references
194         from dynamic objects as references from real ELF files.
195         * testsuite/plugin_test_2.sh: Adjust expected result.
196
197 2011-10-17  Cary Coutant  <ccoutant@google.com>
198
199         * gold.cc: Include timer.h.
200         (queue_middle_tasks): Stamp time.
201         (queue_final_tasks): Likewise.
202         * main.cc (main): Store timer in parameters.  Print timers
203         for each pass.
204         * parameters.cc (Parameters::Parameters): Initialize timer_.
205         (Parameters::set_timer): New function.
206         (set_parameters_timer): New function.
207         * parameters.h (Parameters::set_timer): New function.
208         (Parameters::timer): New function.
209         (Parameters::timer_): New data member.
210         (set_parameters_timer): New function.
211         * timer.cc (Timer::stamp): New function.
212         (Timer::get_pass_time): New function.
213         * timer.h (Timer::stamp): New function.
214         (Timer::get_pass_time): New function.
215         (Timer::pass_times_): New data member.
216
217 2011-10-17  Cary Coutant  <ccoutant@google.com>
218
219         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
220         task for members of lib groups.
221
222 2011-10-17  Cary Coutant  <ccoutant@google.com>
223
224         PR gold/13288
225         * fileread.cc (File_read::find_view): Add assert.
226         (File_read::make_view): Move bounds check (replace with assert)...
227         (File_read::find_or_make_view): ... to here.
228
229 2011-10-12  Cary Coutant  <ccoutant@google.com>
230
231         * output.cc (Output_file::open_base_file): Handle case where
232         ::read returns less than requested size.
233
234 2011-10-10  Cary Coutant  <ccoutant@google.com>
235
236         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
237         Initialize defined_count_.
238         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
239         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
240         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
241         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
242         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
243         * incremental.h (Sized_relobj_incr::defined_count_): New data
244         member.
245         (Sized_incr_dynobj::defined_count_): New data member.
246         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
247         Return zeroes instead of internal error.
248
249 2011-10-10  Cary Coutant  <ccoutant@google.com>
250
251         PR gold/13249
252         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
253         (Output_reloc::symbol_value): Return PLT offset if flag is set.
254         * output.h (class Output_reloc): Add use_plt_offset flag.
255         (Output_reloc::type_): Adjust size of bit field.
256         (Output_reloc::use_plt_offset_): New bit field.
257         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
258         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
259         flag.  Adjust all callers.
260         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
261         creating RELATIVE relocations.
262
263 2011-10-10  Nick Clifton  <nickc@redhat.com>
264
265         * po/es.po: Updated Spanish translation.
266         * po/fi.po: Updated Finnish translation.
267
268 2011-10-03   Diego Novillo  <dnovillo@google.com>
269
270         * options.cc (parse_uint): Fix dereference of RETVAL.
271
272 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
273
274         * layout.h (section_order_map_): New member.
275         (get_section_order_map): New member function.
276         * output.cc (Output_section::add_input_section): Check for patterns
277         only when --section-ordering-file is specified.
278         * gold.cc (queue_middle_tasks): Delay updating order of sections till
279         output_sections have been formed.
280         * layout.cc (Layout_Layout): Initialize section_order_map_.
281         * plugin.cc (update_section_order): Store order in order_map. Do not
282         update the order.
283         * testsuite/Makefile.am: Add test case for plugin_final_layout.
284         * testsuite/Makefile.in: Regenerate.
285         * testsuite/plugin_section_order.c: New file.
286         * testsuite/plugin_final_layout.cc: New file.
287         * testsuite/plugin_final_layout.sh: New file.
288
289 2011-09-29  Cary Coutant  <ccoutant@google.com>
290
291         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
292         Check for NULL.
293         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
294         symbols during incremental update.
295         (Symbol_table::add_from_dynobj): Likewise.
296
297 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
298             Ian Lance Taylor  <iant@google.com>
299
300         * symtab.cc (Symbol_table::define_special_symbol): Always
301         canonicalize version string.
302
303 2011-09-26  Cary Coutant  <ccoutant@google.com>
304
305         * gold.cc (queue_initial_tasks): Move option checks ...
306         * options.cc (General_options::finalize): ... to here. Disable
307         some options; make others fatal.
308
309 2011-09-26  Cary Coutant  <ccoutant@google.com>
310
311         gcc PR lto/47247
312         * plugin.cc (get_symbols_v2): New function.
313         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
314         (is_referenced_from_outside): New function.
315         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
316         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
317         (get_symbols): Pass version parameter.
318         (get_symbols_v2): New function.
319         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
320         parameter.
321         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
322         (onload): Add LDPT_GET_SYMBOLS_V2.
323         (all_symbols_read_hook): Use get_symbols_v2; check for
324         LDPR_PREVAILING_DEF_IRONLY_EXP.
325         * testsuite/plugin_test_3.sh: Update expected results.
326
327 2011-09-23  Simon Baldwin  <simonb@google.com>
328
329         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
330         configuration options.
331         * configure: Regenerate.
332         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
333         * Makefile.in: Regenerate.
334         * testsuite/Makefile.in: Regenerate.
335
336 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
337
338         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
339
340 2011-09-19  Cary Coutant  <ccoutant@google.com>
341
342         * incremental.cc (can_incremental_update): Fix typo in comment.
343         * incremental.h (can_incremental_update): Likewise.
344
345 2011-09-18  Cary Coutant  <ccoutant@google.com>
346
347         * incremental.cc (can_incremental_update): New function.
348         * incremental.h (can_incremental_update): New function.
349         * layout.cc (Layout::init_fixed_output_section): Call it.
350         (Layout::make_output_section): Don't allow patch space in .eh_frame.
351         * object.cc (Sized_relobj_file::do_layout): Call
352         can_incremental_update.
353
354 2011-09-13  Cary Coutant  <ccoutant@google.com>
355
356         * configure.ac: Check for glibc support for gnu_indirect_function
357         support with static linking, setting automake conditional
358         IFUNC_STATIC.
359         * Makefile.in: Regenerate.
360         * configure: Regenerate.
361
362         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
363         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
364         for IFUNC_STATIC.
365         * testsuite/Makefile.in: Regenerate.
366
367 2011-09-13  Cary Coutant  <ccoutant@google.com>
368
369         * incremental.cc (Sized_relobj_incr::do_layout): Call
370         report_comdat_group for kept comdat sections.
371         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
372         * testsuite/Makefile.in: Regenerate.
373         * testsuite/incr_comdat_test_1.cc: New source file.
374         * testsuite/incr_comdat_test_2_v1.cc: New source file.
375         * testsuite/incr_comdat_test_2_v2.cc: New source file.
376         * testsuite/incr_comdat_test_2_v3.cc: New source file.
377
378 2011-09-13  Ian Lance Taylor  <iant@google.com>
379
380         * object.cc (Sized_relobj_file::do_layout): Remove unused local
381         variable external_symbols_offset.
382
383 2011-09-12  Ian Lance Taylor  <iant@google.com>
384
385         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
386         triggered if object has no symbols.
387
388 2011-09-09  David S. Miller  <davem@davemloft.net>
389
390         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
391         (Output_fill_debug_line::do_write): Likewise.
392
393 2011-08-29  Cary Coutant  <ccoutant@google.com>
394
395         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
396         casts to match formatting specs.
397         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
398
399 2011-08-26  Cary Coutant  <ccoutant@google.com>
400
401         * layout.cc (Free_list::allocate): Provide guarantee of minimum
402         remaining hole size when allocating.
403         (Layout::make_output_section): Set fill methods for debug sections.
404         * layout.h (Free_list::Free_list_node): Move from private to
405         public.
406         (Free_list::set_min_hole_size): New function.
407         (Free_list::begin, Free_list::end): New functions.
408         (Free_list::min_hole_): New data member.
409         * output.cc: Include dwarf.h.
410         (Output_fill_debug_info::do_minimum_hole_size): New function.
411         (Output_fill_debug_info::do_write): New function.
412         (Output_fill_debug_line::do_minimum_hole_size): New function.
413         (Output_fill_debug_line::do_write): New function.
414         (Output_section::Output_section): Initialize new data member.
415         (Output_section::set_final_data_size): Ensure patch space is larger
416         than minimum hole size.
417         (Output_section::do_write): Fill holes in debug sections.
418         * output.h (Output_fill): New class.
419         (Output_fill_debug_info): New class.
420         (Output_fill_debug_line): New class.
421         (Output_section::set_free_space_fill): New function.
422         (Output_section::free_space_fill_): New data member.
423         * testsuite/Makefile.am (incremental_test_3): Add
424         --incremental-patch option.
425         (incremental_test_4): Likewise.
426         (incremental_test_5): Likewise.
427         (incremental_test_6): Likewise.
428         (incremental_copy_test): Likewise.
429         (incremental_common_test_1): Likewise.
430         * testsuite/Makefile.in: Regenerate.
431
432 2011-08-26  Nick Clifton  <nickc@redhat.com>
433
434         * po/es.po: Updated Spanish translation.
435
436 2011-08-01  Cary Coutant  <ccoutant@google.com>
437
438         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
439         * gold/testsuite/Makefile.in: Regenerate.
440         * gold/testsuite/justsyms_exec.c: New source file.
441         * gold/testsuite/justsyms_lib.c: New source file.
442
443 2011-08-01  Cary Coutant  <ccoutant@google.com>
444
445         * layout.cc (Layout::set_segment_offsets): Don't realign text
446         segment if -Ttext was specified.
447         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
448         file type.
449         * object.h (Sized_relobj_file::e_type): New function.
450         (Sized_relobj_file::e_type_): New data member.
451         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
452         base address for ET_EXEC files.
453         * target.cc (Target::do_make_elf_object_implementation): Allow
454         ET_EXEC files with --just-symbols option.
455
456 2011-07-28  Cary Coutant  <ccoutant@google.com>
457
458         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
459         Add thread_number parameter.
460         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
461         * workqueue-threads.cc
462         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
463         current thread if its thread number is greater than desired thread
464         count.
465         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
466         Add thread_number parameter.
467         (Workqueue::should_cancel_thread): Likewise.
468         (Workqueue::find_runnable_or_wait): Pass thread_number to
469         should_cancel_thread.
470         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
471         parameter.
472
473 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
474
475         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
476         only after checking if it cannot be forced local.
477         * symtab.h (is_externally_visible): Check if the symbol is not forced
478         local.
479
480 2011-07-15  Ian Lance Taylor  <iant@google.com>
481
482         * options.h (class General_options): Add --print-output-format.
483         Move -EL next to -EB, for  better --help output.
484         * target-select.cc: Include <cstdio>, "options.h", and
485         "parameters.h".
486         (Target_selector::do_target_bfd_name): New function.
487         (print_output_format): New function.
488         * target-select.h (class Target_selector): Update declarations.
489         (Target_selector::target_bfd_name): New function.
490         (print_output_format): Declare.
491         * main.cc: Include "target-select.h".
492         (main): Handle --print-output-format.
493         * gold.cc: Include "target-select.h".
494         (queue_initial_tasks): Handle --print-output-format when there are
495         no input files.
496         * parameters.cc (parameters_force_valid_target): Give a better
497         error message if -EB/-EL does not match target.
498         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
499         function.
500
501 2011-07-15  Ian Lance Taylor  <iant@google.com>
502
503         * i386.cc (class Output_data_plt_i386): Add layout_ field.
504         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
505         (Output_data_plt_i386::do_write): Write address of .dynamic
506         section to first entry in .got.plt section.
507         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
508         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
509         Initialize layout_.
510         (Output_data_plt_x86_64::do_write): Write address of .dynamic
511         section to first entry in .got.plt section.
512         * layout.h (Layout::dynamic_section): New function.
513
514 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
515
516         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
517         to claim_file call.
518         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
519         input_section_position_, and input_section_glob_.
520         (read_layout_from_file): Call function section_ordering_specified.
521         * layout.h (is_section_ordering_specified): New function.
522         (section_ordering_specified): New function.
523         (section_ordering_specified_): New boolean member.
524         * main.cc(main): Call load_plugins after layout object is defined.
525         * output.cc (Output_section::add_input_section): Use
526         function section_ordering_specified to check if section ordering is
527         needed.
528         * output.cc (Output_section::add_relaxed_input_section): Use
529         function section_ordering_specified to check if section ordering is
530         needed.
531         (Output_section::update_section_layout): New function.
532         (Output_section::sort_attached_input_sections): Check if input section
533         must be reordered.
534         * output.h (Output_section::update_section_layout): New function.
535         * plugin.cc (get_section_count): New function.
536         (get_section_type): New function.
537         (get_section_name): New function.
538         (get_section_contents): New function.
539         (update_section_order): New function.
540         (allow_section_ordering): New function. 
541         (Plugin::load): Add the new interfaces to the transfer vector.
542         (Plugin_manager::load_plugins): New parameter.
543         (Plugin_manager::all_symbols_read): New parameter.
544         (Plugin_manager::claim_file): New parameter. Save the elf object for
545         unclaimed objects.
546         (Plugin_manager::get_elf_object): New function.
547         (Plugin_manager::get_view): Change to directly use the bool to check
548         if get_view is called from claim_file_hook.
549         * plugin.h (input_objects): New function
550         (Plugin__manager::load_plugins): New parameter.
551         (Plugin_manager::claim_file): New parameter.
552         (Plugin_manager::get_elf_object): New function.
553         (Plugin_manager::in_claim_file_handler): New function.
554         (Plugin_manager::in_claim_file_handler_): New member.
555         (layout): New function.
556         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
557         handler with an extra parameter. Make the elf object before calling
558         claim_file handler.
559         * testsuite/plugin_test.c (get_section_count): New function pointer.
560         (get_section_type): New function pointer.
561         (get_section_name): New function pointer.
562         (get_section_contents): New function pointer.
563         (update_section_order): New function pointer.
564         (allow_section_ordering): New function pointer.
565         (onload): Check if the new interfaces exist.
566
567 2011-07-13  Ian Lance Taylor  <iant@google.com>
568
569         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
570         relro section.
571         * x86_64.cc (Target_x86_64::got_section): Likewise.
572         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
573         (relro_now_test_SOURCES): New variable.
574         (relro_now_test_DEPENDENCIES): New variable.
575         (relro_now_test_LDFLAGS): New variable.
576         (relro_now_test_LDADD): New variable.
577         (relro_now_test.so): New target.
578         * testsuite/Makefile.in: Rebuild.
579
580 2011-07-12  Ian Lance Taylor  <iant@google.com>
581
582         PR gold/12980
583         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
584         GLOB_DAT relocation rather than a RELATIVE relocation for a
585         protected symbol when creating a shared library.
586         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
587         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
588         * testsuite/protected_main_1.cc (main): Test that protected
589         function has same address.
590
591 2011-07-11  Ian Lance Taylor  <iant@google.com>
592
593         PR gold/12979
594         * options.h (class General_options): Add -Bgroup.
595         * options.cc (General_options::finalize): If -Bgroup is set,
596         default to --unresolved-symbols=report-all.
597         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
598         * target-reloc.h (issue_undefined_symbol_error): Handle
599         --unresolved-symbols=report-all.
600
601 2011-07-08  Ian Lance Taylor  <iant@google.com>
602
603         PR gold/11985
604         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
605         if linker script discards key sections.
606         (Layout::create_dynamic_symtab): Likewise.
607         (Layout::assign_local_dynsym_offsets): Likewise.
608         (Layout::sized_create_version_sections): Likewise.
609         (Layout::create_interp): Likewise.
610         (Layout::finish_dynamic_section): Likewise.
611         (Layout::set_dynamic_symbol_size): Likewise.
612
613 2011-07-08  Ian Lance Taylor  <iant@google.com>
614
615         PR gold/12386
616         * options.h (class General_options): Add --unresolved-symbols.
617         * target-reloc.h (issue_undefined_symbol_error): Check
618         --unresolved-symbols.  Add comments.
619
620 2011-07-08  Ian Lance Taylor  <iant@google.com>
621
622         * testsuite/odr_violation2.cc (Ordering::operator()): Make
623         expression more complex.
624
625 2011-07-08  Ian Lance Taylor  <iant@google.com>
626
627         PR gold/11317
628         * target-reloc.h (issue_undefined_symbol_error): New inline
629         function, broken out of relocate_section.
630         (relocate_section): Call issue_undefined_symbol_error.
631         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
632         there is no TLS segment if we are about to issue an undefined
633         symbol error.
634         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
635
636 2011-07-08  Ian Lance Taylor  <iant@google.com>
637
638         PR gold/12279
639         * resolve.cc (Symbol_table::should_override): Add fromtype
640         parameter.  Change all callers.  Give error when linking together
641         TLS and non-TLS symbol.
642         (Symbol_table::should_override_with_special): Add fromtype
643         parameter.  Change all callers.
644         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
645         there is no TLS segment if we have reported some errors.
646         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
647
648 2011-07-08  Ian Lance Taylor  <iant@google.com>
649
650         PR gold/12372
651         * target.h (Target::plt_address_for_global): New function.
652         (Target::plt_address_for_local): New function.
653         (Target::plt_section_for_global): Remove.
654         (Target::plt_section_for_local): Remove.
655         (Target::do_plt_address_for_global): New virtual function.
656         (Target::do_plt_address_for_local): New virtual function.
657         (Target::do_plt_section_for_global): Remove.
658         (Target::do_plt_section_for_local): Remove.
659         (Target::register_global_plt_entry): Add Symbol_table and Layout
660         parameters.
661         * output.cc (Output_data_got::Got_entry::write): Use
662         plt_address_for_global and plt_address_for_local.
663         * layout.cc (Layout::add_target_dynamic_tags): Use size and
664         address of output section.
665         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
666         got_irelative_, and irelative_count_ fields.  Update
667         declarations.
668         (Output_data_plt_i386::has_irelative_section): New function.
669         (Output_data_plt_i386::entry_count): Add irelative_count_.
670         (Output_data_plt_i386::set_final_data_size): Likewise.
671         (class Target_i386): Add got_irelative_ and rel_irelative_
672         fields.  Update declarations.
673         (Target_i386::Target_i386): Initialize new fields.
674         (Target_i386::do_plt_address_for_global): New function replacing
675         do_plt_section_for_global.
676         (Target_i386::do_plt_address_for_local): New function replacing
677         do_plt_section_for_local.
678         (Target_i386::got_section): Create got_irelative_.
679         (Target_i386::rel_irelative_section): New function.
680         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
681         fields.  Don't define __rel_iplt_{start,end}.
682         (Output_data_plt_i386::add_entry): Add symtab and layout
683         parameters.  Change all callers.  Use different PLT and GOT for
684         IFUNC symbols.
685         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
686         layout parameters.  Change all callers.  Use different PLT and
687         GOT.
688         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
689         (Output_data_plt_i386::rel_irelative): New function.
690         (Output_data_plt_i386::address_for_global): New function.
691         (Output_data_plt_i386::address_for_local): New function.
692         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
693         IRELATIVE GOT when changing IFUNC GOT entries.
694         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
695         reloc.
696         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
697         if we didn't create an IRELATIVE GOT.
698         (Target_i386::Relocate::relocate): Use plt_address_for_global and
699         plt_address_for_local.
700         (Target_i386::do_dynsym_value): Use plt_address_for_global.
701         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
702         got_irelative_, and irelative_count_ fields.  Update
703         declarations.
704         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
705         Initialize new fields.  Remove symtab parameter.  Change all
706         callers.
707         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
708         irelative_count_.
709         (Output_data_plt_x86_64::has_irelative_section): New function.
710         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
711         (class Target_x86_64): Add got_irelative_ and rel_irelative_
712         fields.  Update declarations.
713         (Target_x86_64::Target_x86_64): Initialize new fields.
714         (Target_x86_64::do_plt_address_for_global): New function replacing
715         do_plt_section_for_global.
716         (Target_x86_64::do_plt_address_for_local): New function replacing
717         do_plt_section_for_local.
718         (Target_x86_64::got_section): Create got_irelative_.
719         (Target_x86_64::rela_irelative_section): New function.
720         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
721         all callers.  Don't create __rel_iplt_{start,end}.
722         (Output_data_plt_x86_64::add_entry): Add symtab and layout
723         parameters.  Change all callers.  Use different PLT and GOT for
724         IFUNC symbols.
725         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
726         layout parameters.  Change all callers.  Use different PLT and
727         GOT.
728         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
729         parameters.  Change all callers.  Use different PLT and GOT for
730         IFUNC symbols.
731         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
732         (Output_data_plt_x86_64::rela_irelative): New function.
733         (Output_data_plt_x86_64::address_for_global): New function.
734         (Output_data_plt_x86_64::address_for_local): New function.
735         (Output_data_plt_x86_64::set_final_data_size): Likewise.
736         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
737         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
738         (Target_x86_64::register_global_plt_entry): Add symtab and layout
739         parameters.
740         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
741         reloc.
742         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
743         symbols if we didn't create an IRELATIVE GOT.
744         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
745         plt_address_for_local.
746         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
747         * testsuite/ifuncvar1.c: New test file.
748         * testsuite/ifuncvar2.c: New test file.
749         * testsuite/ifuncvar3.c: New test file.
750         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
751         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
752         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
753         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
754         * testsuite/Makefile.in: Rebuild.
755
756 2011-07-07  Cary Coutant  <ccoutant@google.com>
757
758         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
759         (two_file_test_1_ndebug.o): Likewise.
760         (two_file_test_1b_ndebug.o): Likewise.
761         (two_file_test_2_ndebug.o): Likewise.
762         (two_file_test_main_ndebug.o): Likewise.
763         (incremental_test_2): Link with no-debug versions.
764
765 2011-07-06  Cary Coutant  <ccoutant@google.com>
766
767         * gold/incremental.cc
768         (Output_section_incremental_inputs::write_info_blocks): Check for
769         hidden and internal symbols.
770
771 2011-07-06  Cary Coutant  <ccoutant@google.com>
772
773         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
774         Check disposition for startup file.
775         (Incremental_inputs::report_command_line): Ignore
776         --incremental-startup-unchanged option.
777         * options.cc (General_options::parse_incremental_startup_unchanged):
778         New function.
779         (General_options::General_options): Initialize new data member.
780         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
781         (General_options): Add --incremental-startup-unchanged option.
782         (General_options::incremental_startup_disposition): New function.
783         (General_options::incremental_startup_disposition_): New data member.
784
785 2011-07-06  Cary Coutant  <ccoutant@google.com>
786
787         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
788         input file index to Script_info ctor.
789         (Sized_incremental_binary::do_file_has_changed): Find the
790         command-line argument for files named in scripts.
791         * incremental.h (Script_info::Script_info): New ctor
792         with input file index.
793         (Script_info::input_file_index): New function.
794         (Script_info::input_file_index_): New data member.
795         (Incremental_binary::get_library): Add const.
796         (Incremental_binary::get_script_info): Add const.
797         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
798         * testsuite/Makefile.am (incremental_test_5): New test case.
799         (incremental_test_6): New test case.
800         * testsuite/Makefile.in: Regenerate.
801
802 2011-07-06  Cary Coutant  <ccoutant@google.com>
803
804         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
805         debug output when command lines differ.
806
807 2011-07-06  Cary Coutant  <ccoutant@google.com>
808
809         * incremental.cc (Incremental_inputs::report_command_line): Ignore
810         --incremental-patch option.
811         * layout.cc (Free_list::allocate): Extend allocation beyond original
812         end if enabled.
813         (Layout::make_output_section): Mark sections that should get
814         patch space.
815         * options.cc (parse_percent): New function.
816         * options.h (parse_percent): New function.
817         (DEFINE_percent): New macro.
818         (General_options): Add --incremental-patch option.
819         * output.cc (Output_section::Output_section): Initialize new data
820         members.
821         (Output_section::add_input_section): Print section name when out
822         of patch space.
823         (Output_section::add_output_section_data): Likewise.
824         (Output_section::set_final_data_size): Add patch space when
825         doing --incremental-full.
826         (Output_section::do_reset_address_and_file_offset): Remove patch
827         space.
828         (Output_segment::set_section_list_addresses): Print debug output
829         only if --incremental-update.
830         * output.h (Output_section::set_is_patch_space_allowed): New function.
831         (Output_section::is_patch_space_allowed_): New data member.
832         (Output_section::patch_space_): New data member.
833         * parameters.cc (Parameters::incremental_full): New function.
834         * parameters.h (Parameters::incremental_full): New function
835         * testsuite/Makefile.am (incremental_test_2): Add test for
836         --incremental-patch option.
837         * testsuite/Makefile.in: Regenerate.
838         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
839         (t18): Remove function body.
840
841 2011-07-05  Doug Kwan  <dougkwan@google.com>
842
843         PR gold/12771
844         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
845         Arm_Address type for relocation result.
846         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
847         overflow check.
848         (Arm_relocate_functions::abs32): Use unaligned access.
849         (Arm_relocate_functions::rel32): Ditto.
850         (Arm_relocate_functions::prel31): Ditto.
851         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
852         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
853         static data relocations.
854         * testsuite/Makefile.in: Regnerate.
855         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
856
857 2011-07-05  Ian Lance Taylor  <iant@google.com>
858
859         PR gold/12392
860         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
861         symbols if necessary.
862         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
863
864 2011-07-05  Ian Lance Taylor  <iant@google.com>
865
866         PR gold/12952
867         * resolve.cc (Symbol::override_base_with_special): Simply override
868         version with special symbol version, ignoring previous version.
869
870 2011-07-05  Ian Lance Taylor  <iant@google.com>
871
872         * object.cc (Sized_relobj_file::include_section_group): Add
873         information to comment about signature location.
874
875 2011-07-02  Ian Lance Taylor  <iant@google.com>
876
877         PR gold/12957
878         * options.h (class General_options): Add -f and -F.
879         * options.cc (General_options::finalize): Fatal error if -f/-F
880         are used without -shared.
881         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
882
883 2011-07-02  Ian Lance Taylor  <iant@google.com>
884
885         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
886
887 2011-07-01  Ian Lance Taylor  <iant@google.com>
888
889         PR gold/12525
890         PR gold/12952
891         * resolve.cc (Symbol::override_base_with_special): Don't override
892         the version if the overriding symbol has a different name.
893         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
894         all callers.  If we give an error about an undefined version,
895         define the base version if necessary.
896         * dynobj.h (class Versions): Update declaration.
897         * testsuite/weak_alias_test_5.cc: New file.
898         * testsuite/weak_alias_test.script: New file.
899         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
900         and versioned_alias have the right value, and call t2.
901         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
902         weak_alias_test_5.so.
903         (weak_alias_test_LDADD): Likewise.
904         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
905         * testsuite/Makefile.in: Rebuild.
906
907 2011-07-01  Ian Lance Taylor  <iant@google.com>
908
909         PR gold/12525
910         * options.h (class General_options): Support -z notext.
911         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
912         -Wl,-z,notext.
913         (two_file_shared_nonpic.so): Likewise.
914         (two_file_shared_mixed.so): Likewise.
915         (two_file_shared_mixed_1.so): Likewise.
916         (weak_undef_lib_nonpic.so): Likewise.
917         (alt/weak_undef_lib_nonpic.so): Likewise.
918         (tls_test_shared_nonpic.so): Likewise.
919         * testsuite/Makefile.in: Rebuild.
920
921 2011-07-01  Ian Lance Taylor  <iant@google.com>
922
923         PR gold/12525
924         * configure.ac: Test whether static linking works, setting
925         the automake conditional HAVE_STATIC.
926         * testsuite/Makefile.am: Disable tests using -static if
927         HAVE_STATIC is not true.
928         * configure, testsuite/Makefile.in: Rebuild.
929
930 2011-07-01  Ian Lance Taylor  <iant@google.com>
931
932         PR gold/12525
933         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
934         Assert if we see DW_EH_PE_indirect.
935         * target.h (Target::ehframe_datarel_base): New function.
936         (Target::do_ehframe_datarel_base): New target function.
937         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
938         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
939         function.
940
941 2011-07-01  Ian Lance Taylor  <iant@google.com>
942
943         PR gold/12571
944         * options.h (class General_options): Add
945         --ld-generated-unwind-info.
946         * ehframe.cc (Fde::write): Add address parameter.  Change all
947         callers.  If associated with PLT, fill in address and size.
948         (Cie::set_output_offset): Only add merge mapping if there is an
949         object.
950         (Cie::write): Add address parameter.  Change all callers.
951         (Eh_frame::add_ehframe_for_plt): New function.
952         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
953         input_offset_ fields into union u_, with new plt field.
954         (Fde::Fde): Adjust for new union field.
955         (Fde::Fde) [Output_data version]: New constructor.
956         (Fde::add_mapping): Only add merge mapping if there is an object.
957         (class Cie): Update declarations.
958         (class Eh_frame): Declare add_ehframe_for_plt.
959         * layout.cc (Layout::layout_eh_frame): Break out code into
960         make_eh_frame_section, and call it.
961         (Layout::make_eh_frame_section): New function.
962         (Layout::add_eh_frame_for_plt): New function.
963         * layout.h (class Layout): Update declarations.
964         * merge.cc (Merge_map::add_mapping): Add assertion.
965         * i386.cc: Include "dwarf.h".
966         (class Output_data_plt_i386): Make first_plt_entry,
967         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
968         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
969         and plt_eh_frame_fde.
970         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
971         boundary.  Call add_eh_frame_for_plt if appropriate.
972         * x86_64.cc: Include "dwarf.h".
973         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
974         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
975         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
976         and plt_eh_frame_fde.
977         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
978         appropriate.
979
980 2011-06-29  Ian Lance Taylor  <iant@google.com>
981
982         PR gold/12629
983         * object.cc (Sized_relobj_file::layout_section): Change shdr
984         parameter to be const.
985         (Sized_relobj_file::layout_eh_frame_section): New function, broken
986         out of do_layout.
987         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
988         appropriate.  Call layout_eh_frame_section.
989         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
990         sections.
991         * object.h (class Sized_relobj_file): Update declarations.
992
993 2011-06-29  Ian Lance Taylor  <iant@google.com>
994
995         PR gold/12652
996         * script.cc (Token::integer_value): Accept trailing M/m/K/k
997         modifier.
998         (Lex::gather_token): Accept trailing M/m/K/k for integers.
999
1000 2011-06-29  Ian Lance Taylor  <iant@google.com>
1001
1002         PR gold/12675
1003         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1004         SHT_X86_64_UNWIND.
1005         * layout.cc (Layout::layout_eh_frame): Likewise.
1006
1007 2011-06-29  Ian Lance Taylor  <iant@google.com>
1008
1009         PR gold/12695
1010         * layout.cc (Layout::symtab_section_shndx): New function.
1011         * layout.h (class Layout): Declare symtab_section_shndx.
1012         * output.cc (Output_section::write_header): Call it.
1013
1014 2011-06-29  Ian Lance Taylor  <iant@google.com>
1015
1016         PR gold/12818
1017         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1018         symbols which are not used in a relocation.
1019
1020 2011-06-28  Ian Lance Taylor  <iant@google.com>
1021
1022         PR gold/12898
1023         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1024         script create indistinguishable segments.
1025         (Layout::set_segment_offsets): Use stable_sort when sorting
1026         segments.  Pass this to Compare_segments constructor.
1027         * layout.h (class Layout): Make segment_precedes non-static.
1028         (class Compare_segments): Change from struct to class.  Add
1029         layout_ field.  Add constructor.
1030         * script-sections.cc
1031         (Script_sections::attach_sections_using_phdrs_clause): Rename
1032         local orphan to is_orphan.  Don't report failure to put empty
1033         section in segment.  On attachment failure, report name of
1034         section, and attach to first PT_LOAD segment.
1035
1036 2011-06-28  Ian Lance Taylor  <iant@google.com>
1037
1038         PR gold/12934
1039         * target-select.cc (Target_selector::Target_selector): Add
1040         emulation parameter.  Change all callers.
1041         (select_target_by_bfd_name): Rename from select_target_by_name.
1042         Change all callers.
1043         (select_target_by_emulation): New function.
1044         (supported_emulation_names): New function.
1045         * target-select.h (class Target_selector): Add emulation_ field.
1046         Update declarations.
1047         (Target_selector::recognize_by_bfd_name): Rename from
1048         recognize_by_name.  Change all callers.
1049         (Target_selector::supported_bfd_names): Rename from
1050         supported_names.  Change all callers.
1051         (Target_selector::recognize_by_emulation): New function.
1052         (Target_selector::supported_emulations): New function.
1053         (Target_selector::emulation): New function.
1054         (Target_selector::do_recognize_by_bfd_name): Rename from
1055         do_recognize_by_name.  Change all callers.
1056         (Target_selector::do_supported_bfd_names): Rename from
1057         do_supported_names.  Change all callers.
1058         (Target_selector::do_recognize_by_emulation): New function.
1059         (Target_selector::do_supported_emulations): New function.
1060         (select_target_by_bfd_name): Change name in declaration.
1061         (select_target_by_emulation): Declare.
1062         (supported_emulation_names): Declare.
1063         * parameters.cc (parameters_force_valid_target): Try to find
1064         target based on emulation from -m option.
1065         * options.h (class General_options): Change doc string for -m.
1066         * options.cc (help): Print emulations.
1067         (General_options::parse_V): Likewise.
1068         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1069         Add emulation parameter.  Change all callers.
1070
1071 2011-06-28  Ian Lance Taylor  <iant@google.com>
1072
1073         * target.h (class Target): Add osabi_ field.
1074         (Target::osabi): New function.
1075         (Target::set_osabi): New function.
1076         (Target::Target): Initialize osabi_.
1077         (Target::do_adjust_elf_header): Make pure virtual.
1078         (Sized_target::do_adjust_elf_header): Declare.
1079         * target.cc (Sized_target::do_adjust_elf_header): New function.
1080         (class Sized_target): Instantiate all versions.
1081         * freebsd.h (class Target_freebsd): Remove.
1082         (Target_selector_freebsd::do_recognize): Call set_osabi on
1083         Target.
1084         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1085         (Target_selector_freebsd::set_osabi): Remove.
1086         * i386.cc (class Target_i386): Inherit from Sized_target rather
1087         than Target_freebsd.
1088         * x86_64.cc (class Target_x86_64): Likewise.
1089
1090 2011-06-28  Ian Lance Taylor  <iant@google.com>
1091
1092         * target.h (Target::can_check_for_function_pointers): Rewrite.
1093         Make non-virtual.
1094         (Target::can_icf_inline_merge_sections): Likewise.
1095         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1096         (Target::Target_info): Add can_icf_inline_merge_sections field.
1097         (Target::do_can_check_for_function_pointers): New virtual
1098         function.
1099         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1100         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1101         from can_check_for_function_pointers, move in file.
1102         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1103         section_may_have_icf_unsafe_poineters, move in file.
1104         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1105         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1106         Rename from can_check_for_function_pointers, move in file.
1107         (Target_i386::can_icf_inline_merge_sections): Remove.
1108         (Target_i386::i386_info): Initialize
1109         can_icf_inline_merge_sections.
1110         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1111         Initialize can_icf_inline_merge_sections.
1112         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1113         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1114         Rename from can_check_for_function_pointers, move in file.
1115         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1116         (Target_x86_64::x86_64_info): Initialize
1117         can_icf_inline_merge_sections.
1118         * testsuite/testfile.cc (Target_test::test_target_info):
1119         Likewise.
1120         * icf.cc (get_section_contents): Correct formatting.
1121
1122 2011-06-27  Ian Lance Taylor  <iant@google.com>
1123
1124         * symtab.cc (Symbol::versioned_name): New function.
1125         (Symbol_table::add_to_final_symtab): Use versioned_name when
1126         appropriate.
1127         (Symbol_table::sized_write_symbol): Likewise.
1128         * symtab.h (class Symbol): Declare versioned_name.
1129         * stringpool.h (class Stringpool_template): Add variant of add
1130         which takes a std::basic_string.
1131         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1132         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1133         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1134         (ver_test_12.o): New target.
1135         * testsuite/Makefile.in: Rebuild.
1136
1137 2011-06-27  Doug Kwan  <dougkwan@google.com>
1138
1139         * arm.cc (Arm_relocate_functions::thm_jump8,
1140         Arm_relocate_functions::thm_jump11): Use a wider signed
1141         type to compute offset.
1142         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1143         arm_thm_jump8.
1144         * testsuite/Makefile.in: Regenerate.
1145         * testsuite/arm_branch_in_range.sh: Check test results of
1146         arm_thm_jump11 and arm_thm_jump8.
1147         * testsuite/arm_thm_jump11.s: New test source file.
1148         * testsuite/arm_thm_jump11.t: New linker script.
1149         * testsuite/arm_thm_jump8.s: New test source file.
1150         * testsuite/arm_thm_jump8.t: New linker script.
1151
1152 2011-06-24  Ian Lance Taylor  <iant@google.com>
1153
1154         * layout.cc: Include "object.h".
1155         (ctors_sections_in_init_array): New static variable.
1156         (Layout::is_ctors_in_init_array): New function.
1157         (Layout::layout): Add entry to ctors_sections_in_init_array if
1158         appropriate.
1159         * layout.h (class Layout): Declare is_ctors_in_init_array.
1160         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1161         is_ctors_reverse_view is set.
1162         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1163         all callers.  Set is_ctors_reverse_view field of View_size.
1164         (Sized_relobj_file::reverse_words): New function.
1165         * object.h (Sized_relobj_file::View_size): Add
1166         is_ctors_reverse_view field.
1167         (class Sized_relobj_file): Update declarations.
1168         * testsuite/initpri3.c: New test.
1169         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1170         initpri3b.
1171         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1172         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1173         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1174         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1175         * testsuite/Makefile.in: Rebuild.
1176
1177 2011-06-24  Cary Coutant  <ccoutant@google.com>
1178
1179         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1180         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1181         (debug_msg_cdebug.err): New targets.
1182         * testsuite/Makefile.in: Regenerate.
1183         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1184         Fix checks for link with shared library.
1185
1186 2011-06-24  Doug Kwan  <dougkwan@google.com>
1187
1188         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1189         skip empty text sections.
1190         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1191
1192 2011-06-22  Ian Lance Taylor  <iant@google.com>
1193
1194         PR gold/12910
1195         * options.h (class General_options): Add --ctors-in-init-array.
1196         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1197         friends as SHT_PROGBITS for merging sections.
1198         (Layout::layout): Remove special handling of .init_array and
1199         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1200         and .dtors if ctors_in_init_array.
1201         (Layout::make_output_section): Force correct section types for
1202         .init_array and friends.  Don't sort if doing relocatable link,
1203         Don't sort .ctors and .dtors if ctors_in_init_array.
1204         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1205         (Layout::output_section_name): Add relobj parameter.  Change all
1206         callers.  Handle .ctors. and .dtors. in code rather than table.
1207         Handle .ctors and .dtors if ctors_in_init_array.
1208         (Layout::match_file_name): New function, moved from output.cc.
1209         * layout.h (class Layout): Update declarations.
1210         * output.cc: Include "layout.h".
1211         (Input_section_sort_entry::get_priority): New function.
1212         (Input_section_sort_entry::match_file_name): Just call
1213         Layout::match_file_name.
1214         (Output_section::Input_section_sort_init_fini_compare::operator()):
1215         Handle .ctors and .dtors.  Sort by explicit priority rather than
1216         by name.
1217         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1218         * testsuite/initpri2.c: New test.
1219         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1220         (check_PROGRAMS): Add initpri2.
1221         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1222         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1223         * configure, testsuite/Makefile.in: Rebuild.
1224
1225 2011-06-19  Ian Lance Taylor  <iant@google.com>
1226
1227         PR gold/12880
1228         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1229         .interp section to a PT_INTERP segment even if we have seen a
1230         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1231         clause in a linker script.
1232         (Layout::finalize): Don't create a .interp section if we've
1233         already create a PT_INTERP segment.
1234         (Layout::create_interp): Always call choose_output_section (revert
1235         patch of 2011-06-17).  Don't create PT_INTERP segment.
1236         * script-sections.cc
1237         (Script_sections::create_note_and_tls_segments): Add a .interp
1238         section to a PT_INTERP segment even if we have seen a
1239         --dynamic-linker option.
1240
1241 2011-06-18  Ian Lance Taylor  <iant@google.com>
1242
1243         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1244         merely because a non-PT_LOAD segment has a dynamic reloc.
1245
1246 2011-06-18  Ian Lance Taylor  <iant@google.com>
1247
1248         * layout.cc (Layout::finish_dynamic_section): Don't create
1249         DT_FLAGS entry if not needed.
1250
1251 2011-06-18  Ian Lance Taylor  <iant@google.com>
1252
1253         PR gold/12745
1254         * layout.cc (Layout::layout_eh_frame): Correct handling of
1255         writable .eh_frame section.
1256
1257 2011-06-17  Ian Lance Taylor  <iant@google.com>
1258
1259         PR gold/12893
1260         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1261         symbol is redefined with the exact same object and value.
1262
1263 2011-06-17  Ian Lance Taylor  <iant@google.com>
1264
1265         PR gold/12880
1266         * layout.h (class Layout): Add interp_segment_ field.
1267         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1268         (Layout::attach_allocated_section_to_segment): If making shared
1269         library, put .interp section in PT_INTERP segment.
1270         (Layout::finalize): Also call create_interp if -dynamic-linker
1271         option was used.
1272         (Layout::create_interp): Assert that there is no PT_INTERP
1273         segment.  If not using a SECTIONS clause, use make_output_section.
1274         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1275         * script-sections.cc
1276         (Script_sections::create_note_and_tls_segments): If making shared
1277         library, put .interp section in PT_INTERP segment.
1278
1279 2011-06-17  Ian Lance Taylor  <iant@google.com>
1280
1281         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1282         when making a shared library.
1283
1284 2011-06-17  Ian Lance Taylor  <iant@google.com>
1285
1286         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1287         parameter.  Change all callers.  Don't issue warning about PC32
1288         against locally defined symbol.
1289
1290 2011-06-16  Ian Lance Taylor  <iant@google.com>
1291
1292         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1293         occurs in same object.
1294
1295 2011-06-14  Alan Modra  <amodra@gmail.com>
1296
1297         * po/POTFILES.in: Regenerate.
1298
1299 2011-06-09  Ian Lance Taylor  <iant@google.com>
1300
1301         * script-sections.cc
1302         (Orphan_output_section::set_section_addresses): For a relocatable
1303         link set address to 0.
1304
1305 2011-06-09  Cary Coutant  <ccoutant@google.com>
1306
1307         PR gold/12804
1308         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1309         used with --compress-debug-sections.
1310         * gold/object.cc (Sized_relobj_file::do_layout): Report
1311         uncompressed size of compressed input sections.
1312
1313 2011-06-08  Cary Coutant  <ccoutant@google.com>
1314
1315         PR gold/12804
1316         * testsuite/two_file_test_2_v1.cc: Change initialization of
1317         v2 to keep it in .data.
1318
1319 2011-06-07  Cary Coutant  <ccoutant@google.com>
1320
1321         * common.cc (Symbol_table::do_allocate_commons_list): Call
1322         gold_fallback.
1323         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1324         (Errors::fallback): New function.
1325         (gold_fallback): New function.
1326         * errors.h (Errors::fallback): New function.
1327         * gold.cc (gold_exit): Change status parameter to enum; adjust
1328         all callers.
1329         (queue_initial_tasks): Call gold_fallback.
1330         * gold.h: Include cstdlib.
1331         (Exit_status): New enum type.
1332         (gold_exit): Change status parameter to enum.
1333         (gold_fallback): New function.
1334         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1335         (Layout::create_symtab_sections): Likewise.
1336         (Layout::create_shdrs): Likewise.
1337         * main.cc (main): Adjust call to gold_exit.
1338         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1339         (Output_data_got::add_got_entry_pair): Likewise.
1340         (Output_section::add_input_section): Likewise.
1341         (Output_section::add_output_section_data): Likewise.
1342         (Output_segment::set_section_list_addresses): Likewise.
1343         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1344
1345 2011-06-07  Cary Coutant  <ccoutant@google.com>
1346
1347         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1348         for incremental links.
1349         * output.cc (Output_segment::set_section_list_addresses): Remove
1350         FIXME and test for TLS or BSS.
1351
1352 2011-06-07  Cary Coutant  <ccoutant@google.com>
1353
1354         * testsuite/Makefile.am: Add incremental_copy_test,
1355         incremental_common_test_1.
1356         * testsuite/Makefile.in: Regenerate.
1357         * testsuite/common_test_1_v1.c: New source file.
1358         * testsuite/common_test_1_v2.c: New source file.
1359         * testsuite/copy_test_v1.cc: New source file.
1360
1361 2011-06-07  Cary Coutant  <ccoutant@google.com>
1362
1363         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1364         update, allocate common from bss section's free list.
1365         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1366         linker-defined symbols.
1367         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1368         Skip GOT and PLT entries that are no longer referenced.
1369         (Output_section_incremental_inputs::write_info_blocks): Mark
1370         linker-defined symbols.
1371         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1372         * output.cc (Output_section::allocate): New function.
1373         * output.h (Output_section::allocate): New function.
1374         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1375         linker-defined symbols.
1376         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1377         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1378         (Symbol::init_base_output_data): Likewise.
1379         (Symbol::init_base_output_segment): Likewise.
1380         (Symbol::init_base_constant): Likewise.
1381         (Sized_symbol::init_output_data): Likewise.
1382         (Sized_symbol::init_output_segment): Likewise.
1383         (Sized_symbol::init_constant): Likewise.
1384         (Symbol_table::do_define_in_output_data): Likewise.
1385         (Symbol_table::do_define_in_output_segment): Likewise.
1386         (Symbol_table::do_define_as_constant): Likewise.
1387         * symtab.h (Symbol::is_predefined): New function.
1388         (Symbol::init_base_output_data): Add is_predefined parameter.
1389         (Symbol::init_base_output_segment): Likewise.
1390         (Symbol::init_base_constant): Likewise.
1391         (Symbol::is_predefined_): New data member.
1392         (Sized_symbol::init_output_data): Add is_predefined parameter.
1393         (Sized_symbol::init_output_segment): Likewise.
1394         (Sized_symbol::init_constant): Likewise.
1395         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1396
1397 2011-06-07  Cary Coutant  <ccoutant@google.com>
1398
1399         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1400         instead of emit_copy_reloc.
1401         (Copy_relocs::emit_copy_reloc): Refactor.
1402         (Copy_relocs::make_copy_reloc): New function.
1403         (Copy_relocs::add_copy_reloc): Remove.
1404         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1405         section.
1406         (Copy_relocs::make_copy_reloc): New function.
1407         (Copy_relocs::add_copy_reloc): Remove.
1408         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1409         unchanged input files.
1410         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1411         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1412         Reserve BSS space for COPY relocations.
1413         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1414         (Output_section_incremental_inputs::write_info_blocks): Record
1415         whether a symbol is copied from a shared object.
1416         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1417         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1418         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1419         (Incremental_input_entry_reader::get_output_symbol_index): Add
1420         is_copy parameter.
1421         (Incremental_binary::emit_copy_relocs): New function.
1422         (Incremental_binary::do_emit_copy_relocs): New function.
1423         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1424         new data member.
1425         (Sized_incremental_binary::add_copy_reloc): New function.
1426         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1427         (Sized_incremental_binary::Copy_reloc): New struct.
1428         (Sized_incremental_binary::Copy_relocs): New typedef.
1429         (Sized_incremental_binary::copy_relocs_): New data member.
1430         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1431         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1432         * target.h (Sized_target::emit_copy_reloc): New function.
1433         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1434
1435 2011-06-02  Cary Coutant  <ccoutant@google.com>
1436
1437         PR gold/12163
1438         * gold/archive.cc (Archive::Archive): Initialize new data member.
1439         (Archive::include_all_members): Return if archive has already been
1440         included.
1441         * gold/archive.h (Archive::include_all_members_): New data member.
1442
1443 2011-06-02  Nick Clifton  <nickc@redhat.com>
1444
1445         * dynobj.h: Fix spelling mistake in comment.
1446         * output.cc: Likewise.
1447
1448 2011-05-31  Doug Kwan  <dougkwan@google.com>
1449             Asier Llano
1450
1451         PR gold/12826
1452         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1453         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1454         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1455         redundant arm_exidx_test.so.
1456         * testsuite/Makefile.in: Regenerate.
1457         (check_SCRIPTS): Add pr12826.sh
1458         (check_DATA): Add pr12826.stdout
1459         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1460         * testsuite/pr12826.sh: New file.
1461         * testsuite/pr12826_1.s: Ditto.
1462         * testsuite/pr12826_1.s: Ditto.
1463
1464 2011-05-30  Ian Lance Taylor  <iant@google.com>
1465
1466         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1467         sections.
1468
1469 2011-05-29  Ian Lance Taylor  <iant@google.com>
1470
1471         PR gold/12804
1472         * testsuite/Makefile.am: Use different file name for two_file_test
1473         temporary file for each incremental test.
1474         * testsuite/Makefile.in: Rebuild.
1475
1476 2011-05-29  Ian Lance Taylor  <iant@google.com>
1477
1478         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1479         binary input file is empty.
1480
1481 2011-05-27  Ian Lance Taylor  <iant@google.com>
1482
1483         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1484         (ver_test_9.so): Likewise.
1485         * testsuite/Makefile.in: Rebuild.
1486
1487 2011-05-26 Cary Coutant  <ccoutant@google.com>
1488
1489         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1490         * incremental.cc (Incremental_inputs::report_input_section): Fix
1491         comment, indentation.
1492         (Incremental_inputs::report_comdat_group): New function.
1493         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1494         of data for incremental input file entry.
1495         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1496         group count, COMDAT group signatures.
1497         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1498         an unchanged input file.
1499         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1500         Initialize new data member.
1501         (Incremental_object_entry::add_comdat_group): New function.
1502         (Incremental_object_entry::get_comdat_group_count): New function.
1503         (Incremental_object_entry::get_comdat_signature_key): New function.
1504         (Incremental_object_entry::groups_): New data member.
1505         (Incremental_inputs::report_comdat_group): New function.
1506         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1507         data for incremental input file entry.
1508         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1509         (Incremental_input_entry_reader::get_input_section): Adjust size of
1510         data for incremental input file entry.
1511         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1512         (Incremental_input_entry_reader::get_comdat_group_signature): New
1513         function.
1514         * object.cc (Sized_relobj::include_section_group): Report kept
1515         COMDAT groups for incremental links.
1516
1517 2011-05-24  David Meyer  <pdox@google.com>
1518
1519         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1520         with name parameter.  Add found_name parameter.
1521         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1522         * dirsearch.h (class Dirsearch): Update declaration.
1523
1524 2011-05-24  Ian Lance Taylor  <iant@google.com>
1525
1526         * archive.cc (Library_base::should_include_member): Pull in object
1527         from archive if it defines the entry symbol.
1528         * parameters.cc (Parameters::entry): New function.
1529         * parameters.h (class Parameters): Declare entry.
1530         * output.h (class Output_file_header): Remove entry_ field.
1531         * output.cc (Output_file_header::Output_file_header): Remove entry
1532         parameter.  Change all callers.
1533         (Output_file_header::entry): Use parameters->entry.
1534         * gold.cc (queue_middle_tasks): Likewise.
1535         * plugin.cc (Plugin_hook::run): Likewise.
1536
1537 2011-05-24 Cary Coutant  <ccoutant@google.com>
1538
1539         * gold.cc (queue_initial_tasks): Pass incremental base filename
1540         to Output_file::open_base_file; don't print error message.
1541         * incremental-dump.cc (main): Adjust call to
1542         Output_file::open_for_modification.
1543         * incremental-dump.cc (main): Likewise.
1544         * incremental.cc (Incremental_inputs::report_command_line):
1545         Ignore --incremental-base option when comparing command lines.
1546         Ignore parameter when given as separate argument.
1547         * options.h (class General_options): Add --incremental-base.
1548         * output.cc (Output_file::Output_file):
1549         (Output_file::open_base_file): Add base_name and writable parameters;
1550         read base file into new file; print error message here.
1551         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1552         callers.
1553         * output.h (Output_file::open_for_modification): Rename to...
1554         (Output_file::open_base_file): ...this; add base_name and
1555         writable parameters; adjust all callers.
1556         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1557         callers.
1558         * testsuite/Makefile.am (incremental_test_4): Test
1559         --incremental-base.
1560         * testsuite/Makefile.in: Regenerate.
1561
1562 2011-05-24 Cary Coutant  <ccoutant@google.com>
1563
1564         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1565         incremental_test_4.
1566         * testsuite/Makefile.in: Regenerate.
1567         * testsuite/two_file_test_1_v1.cc: New test source file.
1568         * testsuite/two_file_test_1b_v1.cc: New test source file.
1569         * testsuite/two_file_test_2_v1.cc: New test source file.
1570
1571 2011-05-24 Cary Coutant  <ccoutant@google.com>
1572
1573         * dynobj.h (Dynobj::do_dynobj): New function.
1574         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1575         flag and soname for shared objects.
1576         * incremental.cc (Incremental_inputs::report_object): Make
1577         either Incremental_object_entry or Incremental_dynobj_entry; add
1578         soname to string table.
1579         (Incremental_inputs::report_input_section): Add assertion.
1580         (Output_section_incremental_inputs::set_final_data_size): Adjust
1581         type of input file entry for shared libraries; adjust size of
1582         shared library info entry.
1583         (Output_section_incremental_inputs::write_input_files): Write
1584         as_needed flag for shared libraries.
1585         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1586         of input file entry for shared libraries; write soname.
1587         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1588         soname from incremental info.
1589         * incremental.h (enum Incremental_input_flags): Add
1590         INCREMENTAL_INPUT_AS_NEEDED.
1591         (Incremental_input_entry::Incremental_input_entry): Initialize new
1592         data member.
1593         (Incremental_input_entry::set_as_needed): New function.
1594         (Incremental_input_entry::as_needed): New function.
1595         (Incremental_input_entry::do_dynobj_entry): New function.
1596         (Incremental_input_entry::as_needed_): New data member.
1597         (Incremental_object_entry::Incremental_object_entry): Don't check
1598         for shared library.
1599         (Incremental_object_entry::do_type): Likewise.
1600         (class Incremental_dynobj_entry): New class.
1601         (Incremental_input_entry_reader::as_needed): New function.
1602         (Incremental_input_entry_reader::get_soname): New function.
1603         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1604         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1605         size of shared library info entry.
1606         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1607         incremental link when adding DT_NEEDED entries.
1608         * object.h (Object::Object): Initialize new data member.
1609         (Object::dynobj): New function.
1610         (Object::set_as_needed): New function.
1611         (Object::as_needed): New function.
1612         (Object::do_dynobj): New function.
1613         (Object::as_needed_): New data member.
1614
1615 2011-05-24 Cary Coutant  <ccoutant@google.com>
1616
1617         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1618         info; adjust display of GOT entries.
1619         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1620         vector of input objects; remove file_status_.
1621         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1622         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1623         got_plt reader; call target hooks to reserve GOT entries.
1624         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1625         of input file info header and GOT info entry.
1626         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1627         relocation info.
1628         (Got_plt_view_info::got_descriptor): Remove.
1629         (Got_plt_view_info::sym_index): New data member.
1630         (Got_plt_view_info::input_index): New data member.
1631         (Local_got_offset_visitor::visit): Write input file index.
1632         (Global_got_offset_visitor::visit): Write 0 for input file index.
1633         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1634         with sym_index and input_index.
1635         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1636         incremental info GOT entry; replace got_descriptor with input_index.
1637         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1638         map from input file index to object.
1639         (Sized_relobj_incr::do_layout): Replace direct data member reference
1640         with accessor function.
1641         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1642         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1643         Adjust size of input file info header.
1644         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1645         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1646         (Incremental_input_entry_reader::get_input_section): Adjust size of
1647         input file info header.
1648         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1649         of incremental info GOT entry.
1650         (Incremental_got_plt_reader::get_got_desc): Remove.
1651         (Incremental_got_plt_reader::get_got_symndx): New function.
1652         (Incremental_got_plt_reader::get_got_input_index): New function.
1653         (Sized_incremental_binary::Sized_incremental_binary): Remove
1654         file_status_; add input_objects_.
1655         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1656         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1657         (Sized_incremental_binary::file_is_unchanged): Remove.
1658         (Sized_incremental_binary::set_input_object): New function.
1659         (Sized_incremental_binary::input_object): New function.
1660         (Sized_incremental_binary::file_status_): Remove.
1661         (Sized_incremental_binary::input_objects_): New data member.
1662         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1663         references.
1664         (Sized_relobj_incr::invalid_address): Move to base class.
1665         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1666         class.
1667         (Sized_relobj_incr::do_output_section_offset): Likewise.
1668         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1669         (Sized_relobj_incr::section_offsets_): Likewise.
1670         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1671         function.
1672         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1673         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1674         with accessor function.
1675         (Sized_relobj_file::do_layout): Likewise.
1676         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1677         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1678         (Sized_relobj_file::compute_final_local_value): Replace refs to
1679         section_offsets_ with accessor function.
1680         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1681         * object.h (Relobj::Relobj): Initialize new data members.
1682         (Relobj::add_dyn_reloc): New function.
1683         (Relobj::first_dyn_reloc): New function.
1684         (Relobj::dyn_reloc_count): New function.
1685         (Relobj::first_dyn_reloc_): New data member.
1686         (Relobj::dyn_reloc_count_): New data member.
1687         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1688         references.
1689         (Sized_relobj::Address): New typedef.
1690         (Sized_relobj::invalid_address): Move here from child class.
1691         (Sized_relobj::Sized_relobj): Initialize new data members.
1692         (Sized_relobj::sized_relobj): New function.
1693         (Sized_relobj::is_output_section_offset_invalid): Move here from
1694         child class.
1695         (Sized_relobj::get_output_section_offset): Likewise.
1696         (Sized_relobj::local_has_got_offset): Likewise.
1697         (Sized_relobj::local_got_offset): Likewise.
1698         (Sized_relobj::set_local_got_offset): Likewise.
1699         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1700         (Sized_relobj::clear_got_offsets): New function.
1701         (Sized_relobj::section_offsets): Move here from child class.
1702         (Sized_relobj::do_output_section_offset): Likewise.
1703         (Sized_relobj::do_set_section_offset): Likewise.
1704         (Sized_relobj::Local_got_offsets): Likewise.
1705         (Sized_relobj::local_got_offsets_): Likewise.
1706         (Sized_relobj::section_offsets_): Likewise.
1707         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1708         references.
1709         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1710         class.
1711         (Sized_relobj_file::sized_relobj): New function
1712         (Sized_relobj_file::local_has_got_offset): Move to base class.
1713         (Sized_relobj_file::local_got_offset): Likewise.
1714         (Sized_relobj_file::set_local_got_offset): Likewise.
1715         (Sized_relobj_file::get_output_section_offset): Likewise.
1716         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1717         (Sized_relobj_file::do_output_section_offset): Likewise.
1718         (Sized_relobj_file::do_set_section_offset): Likewise.
1719         (Sized_relobj_file::Local_got_offsets): Likewise.
1720         (Sized_relobj_file::local_got_offsets_): Likewise.
1721         (Sized_relobj_file::section_offsets_): Likewise.
1722         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1723         (all constructors).
1724         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1725         (Output_reloc::get_symbol_index): Likewise.
1726         (Output_reloc::local_section_offset): Likewise.
1727         (Output_reloc::get_address): Likewise.
1728         (Output_reloc::symbol_value): Likewise.
1729         (Output_data_got::reserve_slot): Move to class definition.
1730         (Output_data_got::reserve_local): New function.
1731         (Output_data_got::reserve_slot_for_global): Remove.
1732         (Output_data_got::reserve_global): New function.
1733         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1734         (all constructors, two instantiations).
1735         (Output_reloc::get_relobj): New function (two instantiations).
1736         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1737         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1738         (Output_data_reloc::add_global): Adjust type of relobj.
1739         (Output_data_reloc::add_global_relative): Likewise.
1740         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1741         (Output_data_reloc::add_local): Likewise.
1742         (Output_data_reloc::add_local_relative): Likewise.
1743         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1744         (Output_data_reloc::add_local_section): Likewise.
1745         (Output_data_reloc::add_output_section): Likewise.
1746         (Output_data_reloc::add_absolute): Likewise.
1747         (Output_data_reloc::add_target_specific): Likewise.
1748         (Output_data_got::reserve_slot): Move definition here.
1749         (Output_data_got::reserve_local): New function.
1750         (Output_data_got::reserve_global): New function.
1751         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1752         section_offsets_ with accessor function.
1753         (Sized_relobj_file::write_sections): Likewise.
1754         (Sized_relobj_file::do_relocate_sections): Likewise.
1755         * target.h (Sized_target::reserve_local_got_entry): New function.
1756         (Sized_target::reserve_global_got_entry): New function.
1757         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1758         (Target_x86_64::reserve_global_got_entry): New function.
1759         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1760
1761 2011-05-23 Cary Coutant  <ccoutant@google.com>
1762
1763         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1764         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1765         bit when checking got_type.
1766         * incremental.cc (Sized_incremental_binary::setup_readers):
1767         Store symbol table and string table locations; initialize bit vector
1768         of file status flags.
1769         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1770         unchanged files.
1771         (Sized_incremental_binary::do_process_got_plt): New function.
1772         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1773         (Output_section_incremental_inputs::set_final_data_size): Record
1774         file index for each input file.
1775         (Output_section_incremental_inputs::write_got_plt): Store file index
1776         instead of input entry offset for each GOT entry.
1777         * incremental.h
1778         (Incremental_input_entry::Incremental_input_entry): Initialize new
1779         data member.
1780         (Incremental_input_entry::set_offset): Store file index.
1781         (Incremental_input_entry::get_file_index): New function.
1782         (Incremental_input_entry::file_index_): New data member.
1783         (Incremental_binary::process_got_plt): New function.
1784         (Incremental_binary::do_process_got_plt): New function.
1785         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1786         data members.
1787         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1788         (Sized_incremental_binary::set_file_is_unchanged): New function.
1789         (Sized_incremental_binary::file_is_unchanged): New function.
1790         (Sized_incremental_binary::do_process_got_plt): New function.
1791         (Sized_incremental_binary::file_status_): New data member.
1792         (Sized_incremental_binary::main_symtab_loc_): New data member.
1793         (Sized_incremental_binary::main_strtab_loc_): New data member.
1794         * output.cc (Output_data_got::Got_entry::write): Add case
1795         RESERVED_CODE.
1796         (Output_data_got::add_global): Call add_got_entry.
1797         (Output_data_got::add_global_plt): Likewise.
1798         (Output_data_got::add_global_with_rel): Likewise.
1799         (Output_data_got::add_global_with_rela): Likewise.
1800         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1801         (Output_data_got::add_global_pair_with_rela): Likewise.
1802         (Output_data_got::add_local): Call add_got_entry.
1803         (Output_data_got::add_local_plt): Likewise.
1804         (Output_data_got::add_local_with_rel): Likewise.
1805         (Output_data_got::add_local_with_rela): Likewise.
1806         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1807         (Output_data_got::add_local_pair_with_rela): Likewise.
1808         (Output_data_got::reserve_slot): New function.
1809         (Output_data_got::reserve_slot_for_global): New function.
1810         (Output_data_got::add_got_entry): New function.
1811         (Output_data_got::add_got_entry_pair): New function.
1812         (Output_section::add_output_section_data): Edit FIXME.
1813         * output.h
1814         (Output_section_data_build::Output_section_data_build): New
1815         constructor with size parameter.
1816         (Output_data_space::Output_data_space): Likewise.
1817         (Output_data_got::Output_data_got): Initialize new data member; new
1818         constructor with size parameter.
1819         (Output_data_got::add_constant): Call add_got_entry.
1820         (Output_data_got::reserve_slot): New function.
1821         (Output_data_got::reserve_slot_for_global): New function.
1822         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1823         (Output_data_got::add_got_entry): New function.
1824         (Output_data_got::add_got_entry_pair): New function.
1825         (Output_data_got::free_list_): New data member.
1826         * target.h (Sized_target::init_got_plt_for_update): New function.
1827         (Sized_target::register_global_plt_entry): New function.
1828         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1829         Initialize new data member; call init; add constructor with PLT count.
1830         (Output_data_plt_x86_64::init): New function.
1831         (Output_data_plt_x86_64::add_relocation): New function.
1832         (Output_data_plt_x86_64::reserve_slot): New function.
1833         (Output_data_plt_x86_64::free_list_): New data member.
1834         (Target_x86_64::init_got_plt_for_update): New function.
1835         (Target_x86_64::register_global_plt_entry): New function.
1836         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1837         incremental updates.
1838         (Output_data_plt_x86_64::add_relocation): New function.
1839         * testsuite/object_unittest.cc (Object_test): Set default options.
1840
1841 2011-05-16  Ian Lance Taylor  <iant@google.com>
1842
1843         * options.h (class General_options): Make -i a synonym for -r.
1844
1845 2011-05-16  Ian Lance Taylor  <iant@google.com>
1846
1847         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1848
1849 2011-05-10 Cary Coutant  <ccoutant@google.com>
1850
1851         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1852         strip_all (-s).
1853
1854 2011-05-06  Ian Lance Taylor  <iant@google.com>
1855
1856         * layout.cc (Layout::layout): If the output section flags change,
1857         update the ordering.
1858
1859 2011-04-25 Cary Coutant  <ccoutant@google.com>
1860
1861         * incremental-dump.cc (dump_incremental_inputs): Print local
1862         symbol info for each input file.
1863         * incremental.cc
1864         (Output_section_incremental_inputs::set_final_data_size): Add local
1865         symbol info to input file entries in incremental info.
1866         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1867         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1868         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1869         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1870         implementation.
1871         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1872         (Sized_incr_relobj::do_relocate): Write the local symbols.
1873         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1874         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1875         Adjust size of input file header.
1876         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1877         (Incremental_inputs_reader::get_local_symbol_count): New function.
1878         (Incremental_inputs_reader::get_input_section): Adjust size of input
1879         file header.
1880         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1881         (Sized_incr_relobj::This): New typedef.
1882         (Sized_incr_relobj::sym_size): New const data member.
1883         (Sized_incr_relobj::Local_symbol): New struct.
1884         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1885         (Sized_incr_relobj::do_local_symbol_offset): New function.
1886         (Sized_incr_relobj::local_symbol_count_): New data member.
1887         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1888         (Sized_incr_relobj::local_symbol_index_): New data member.
1889         (Sized_incr_relobj::local_symbol_offset_): New data member.
1890         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1891         (Sized_incr_relobj::local_symbols_): New data member.
1892         * object.h (Relobj::output_local_symbol_count): New function.
1893         (Relobj::local_symbol_offset): New function.
1894         (Relobj::do_output_local_symbol_count): New function.
1895         (Relobj::do_local_symbol_offset): New function.
1896         (Sized_relobj::do_output_local_symbol_count): New function.
1897         (Sized_relobj::do_local_symbol_offset): New function.
1898
1899 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1900
1901         * descriptors.cc (set_close_on_exec): New function.
1902         (Descriptors::open): Use set_close_on_exec.
1903         * output.cc (S_ISLNK): Define if not defined.
1904
1905 2011-04-22 Cary Coutant  <ccoutant@google.com>
1906
1907         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1908         global symbol map.
1909         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1910         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1911         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1912         relocations.
1913         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1914         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1915         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1916         * incremental.h
1917         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1918         function.
1919         (Incremental_binary::apply_incremental_relocs): New function.
1920         (Incremental_binary::do_apply_incremental_relocs): New function.
1921         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1922         data member.
1923         (Sized_incremental_binary::add_global_symbol): New function.
1924         (Sized_incremental_binary::global_symbol): New function.
1925         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1926         (Sized_incremental_binary::symbol_map_): New data member.
1927         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1928         * target.h (Sized_target::apply_relocation): New function.
1929         * target-reloc.h (apply_relocation): New function.
1930         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1931
1932 2011-04-22  Doug Kwan  <dougkwan@google.com>
1933
1934         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1935         flag of a SHT_ARM_EXIDX section.
1936         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1937         * testsuite/Makefile.in: Regenerate.
1938         * testsuite/arm_exidx_test.s: New file.
1939         * testsuite/arm_exidx_test.sh: Same.
1940
1941 2011-04-20 Cary Coutant  <ccoutant@google.com>
1942
1943         PR gold/12689
1944         * archive.h (Incremental_archive_entry::Archive_member):
1945         Initialize arg_serial_ (second constructor).
1946
1947 2011-04-17  Ian Lance Taylor  <iant@google.com>
1948
1949         * object.cc (Relocate_info::location): Simplify location string.
1950         * errors.cc (Errors::error_at_location): Don't print program
1951         name.
1952         (Errors::warning_at_location): Likewise.
1953         (Errors::undefined_symbol): Likewise.
1954         * testsuite/debug_msg.sh: Update accordingly.
1955
1956 2011-04-14 Cary Coutant  <ccoutant@google.com>
1957
1958         * gold/layout.cc (Layout::symtab_section_offset): New function.
1959         * gold/layout.h (Layout::symtab_section_offset): New function.
1960         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1961
1962 2011-04-12  Ian Lance Taylor  <iant@google.com>
1963
1964         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1965         with MREMAP_MAYMOVE.
1966         * output.h (class Output_file): Add map_is_allocated_ field.
1967         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1968         not available, provide stubs.  If mremap is not available, #define
1969         it to gold_mremap.
1970         (MREMAP_MAYMOVE): Define if not defined.
1971         (Output_file::Output_file): Initialize map_is_allocated_.
1972         (Output_file::resize): Check map_is_allocated_.
1973         (Output_file::map_anonymous): If mmap fails, use malloc.
1974         (Output_file::unmap): Don't do anything for an anonymous map.
1975         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1976         is not available, provide stubs.
1977         (File_read::View::~View): Use free rather than delete[].
1978         (File_read::make_view): Use malloc rather than new[].  If mmap
1979         fails, use malloc.
1980         (File_read::find_or_make_view): Use malloc rather than new[].
1981         * gold.h: Remove HAVE_REMAP code.
1982         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1983         exists.  Rename mremap to gold_mremap.  If mmap is not available
1984         don't do anything.
1985         * configure, config.in: Rebuild.
1986
1987 2011-04-11  Ian Lance Taylor  <iant@google.com>
1988
1989         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1990         initialize local variable v.
1991
1992 2011-04-11  Cary Coutant  <ccoutant@google.com>
1993
1994         * archive.cc (Archive::include_member): Adjust call to
1995         report_object.
1996         (Add_archive_symbols::run): Track argument serial numbers.
1997         (Lib_group::include_member): Likewise.
1998         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1999         * archive.h (Incremental_archive_entry::Archive_member):
2000         Initialize arg_serial_.
2001         (Archive_member::arg_serial_): New data member.
2002         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2003         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2004         incremental link.
2005         (Sized_dynobj::do_for_all_local_got_entries): New function.
2006         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2007         function.
2008         * fileread.cc (get_mtime): New function.
2009         * fileread.h (get_mtime): New function.
2010         * gold.cc (queue_initial_tasks): Check for incremental update.
2011         (process_incremental_input): New function.
2012         (queue_middle_tasks): Don't force valid target for incremental
2013         update.
2014         * incremental-dump.cc (find_input_containing_global): Adjust
2015         size of symbol info entry.
2016         (dump_incremental_inputs): Dump argument serial number and
2017         in_system_directory flag; bias shndx by 1; print symbol names
2018         when dumping per-file symbol lists; use new symbol info readers.
2019         * incremental.cc
2020         (Output_section_incremental_inputs:update_data_size): New function.
2021         (Sized_incremental_binary::setup_readers): Setup input readers
2022         for each input file; build maps for files added from libraries
2023         and scripts.
2024         (Sized_incremental_binary::check_input_args): New function.
2025         (Sized_incremental_binary::do_check_inputs): Build map of argument
2026         serial numbers to input arguments.
2027         (Sized_incremental_binary::do_file_has_changed): Rename
2028         do_file_is_unchanged to this; compare file modification times.
2029         (Sized_incremental_binary::do_init_layout): New function.
2030         (Sized_incremental_binary::do_reserve_layout): New function.
2031         (Sized_incremental_binary::do_get_input_reader): Remove.
2032         (Sized_incremental_binary::get_symtab_view): New function.
2033         (Incremental_checker::can_incrementally_link_output_file): Remove.
2034         (Incremental_inputs::report_command_line): Exclude --debug options.
2035         (Incremental_inputs::report_archive_begin): Add parameter; track
2036         argument serial numbers; don't put input file entry for archive
2037         before archive members.
2038         (Incremental_inputs::report_archive_end): Put input file entry
2039         for archive after archive members.
2040         (Incremental_inputs::report_object): Add parameter; track argument
2041         serial numbers and in_system_directory flag.
2042         (Incremental_inputs::report_script): Add parameter; track argument
2043         serial numbers.
2044         (Output_section_incremental_inputs::set_final_data_size): Adjust
2045         size of symbol info entry; check for forwarding symbols.
2046         (Output_section_incremental_inputs::write_input_files): Write
2047         in_system_directory flag and argument serial number.
2048         (Output_section_incremental_inputs::write_info_blocks): Map section
2049         indices between incremental info and original input file; store
2050         input section index for each symbol.
2051         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2052         change operator() to visit().
2053         (class Global_got_offset_visitor): Likewise.
2054         (class Global_symbol_visitor_got_plt):
2055         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2056         classes.
2057         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2058         (Sized_incr_relobj::do_read_symbols): New function.
2059         (Sized_incr_relobj::do_layout): New function.
2060         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2061         (Sized_incr_relobj::do_add_symbols): New function.
2062         (Sized_incr_relobj::do_should_include_member): New function.
2063         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2064         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2065         (Sized_incr_relobj::do_section_size): New function.
2066         (Sized_incr_relobj::do_section_name): New function.
2067         (Sized_incr_relobj::do_section_contents): New function.
2068         (Sized_incr_relobj::do_section_flags): New function.
2069         (Sized_incr_relobj::do_section_entsize): New function.
2070         (Sized_incr_relobj::do_section_address): New function.
2071         (Sized_incr_relobj::do_section_type): New function.
2072         (Sized_incr_relobj::do_section_link): New function.
2073         (Sized_incr_relobj::do_section_info): New function.
2074         (Sized_incr_relobj::do_section_addralign): New function.
2075         (Sized_incr_relobj::do_initialize_xindex): New function.
2076         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2077         (Sized_incr_relobj::do_read_relocs): New function.
2078         (Sized_incr_relobj::do_gc_process_relocs): New function.
2079         (Sized_incr_relobj::do_scan_relocs): New function.
2080         (Sized_incr_relobj::do_count_local_symbols): New function.
2081         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2082         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2083         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2084         (Sized_incr_relobj::do_relocate): New function.
2085         (Sized_incr_relobj::do_set_section_offset): New function.
2086         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2087         (Sized_incr_dynobj::do_read_symbols): New function.
2088         (Sized_incr_dynobj::do_layout): New function.
2089         (Sized_incr_dynobj::do_add_symbols): New function.
2090         (Sized_incr_dynobj::do_should_include_member): New function.
2091         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2092         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2093         (Sized_incr_dynobj::do_section_size): New function.
2094         (Sized_incr_dynobj::do_section_name): New function.
2095         (Sized_incr_dynobj::do_section_contents): New function.
2096         (Sized_incr_dynobj::do_section_flags): New function.
2097         (Sized_incr_dynobj::do_section_entsize): New function.
2098         (Sized_incr_dynobj::do_section_address): New function.
2099         (Sized_incr_dynobj::do_section_type): New function.
2100         (Sized_incr_dynobj::do_section_link): New function.
2101         (Sized_incr_dynobj::do_section_info): New function.
2102         (Sized_incr_dynobj::do_section_addralign): New function.
2103         (Sized_incr_dynobj::do_initialize_xindex): New function.
2104         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2105         (make_sized_incremental_object): New function.
2106         (Incremental_library::copy_unused_symbols): New function.
2107         (Incremental_library::do_for_all_unused_symbols): New function.
2108         * incremental.h (enum Incremental_input_flags): New type.
2109         (class Incremental_checker): Remove.
2110         (Incremental_input_entry::Incremental_input_entry): Add argument
2111         serial number.
2112         (Incremental_input_entry::arg_serial): New function.
2113         (Incremental_input_entry::set_is_in_system_directory): New function.
2114         (Incremental_input_entry::is_in_system_directory): New function.
2115         (Incremental_input_entry::arg_serial_): New data member.
2116         (Incremental_input_entry::is_in_system_directory_): New data member.
2117         (class Script_info): Move here from script.h.
2118         (Script_info::Script_info): Add filename parameter.
2119         (Script_info::filename): New function.
2120         (Script_info::filename_): New data member.
2121         (Incremental_script_entry::Incremental_script_entry): Add argument
2122         serial number.
2123         (Incremental_object_entry::Incremental_object_entry): Likewise.
2124         (Incremental_object_entry::add_input_section): Build list of input
2125         sections with map to original shndx.
2126         (Incremental_object_entry::get_input_section_index): New function.
2127         (Incremental_object_entry::shndx_): New data member.
2128         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2129         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2130         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2131         serial number.
2132         (Incremental_inputs::report_archive_begin): Likewise.
2133         (Incremental_inputs::report_object): Likewise.
2134         (Incremental_inputs::report_script): Likewise.
2135         (class Incremental_global_symbol_reader): New class.
2136         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2137         and store flags and input file type.
2138         (Incremental_input_entry_reader::arg_serial): New function.
2139         (Incremental_input_entry_reader::type): Extract type from flags.
2140         (Incremental_input_entry_reader::is_in_system_directory): New function.
2141         (Incremental_input_entry_reader::get_input_section_count): Call
2142         accessor function for type.
2143         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2144         function for type; adjust size of global symbol entry.
2145         (Incremental_input_entry_reader::get_global_symbol_count): Call
2146         accessor function for type.
2147         (Incremental_input_entry_reader::get_object_count): Likewise.
2148         (Incremental_input_entry_reader::get_object_offset): Likewise.
2149         (Incremental_input_entry_reader::get_member_count): Likewise.
2150         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2151         (Incremental_input_entry_reader::get_member_offset): Likewise.
2152         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2153         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2154         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2155         (Incremental_input_entry_reader::get_global_symbol_reader): New
2156         function.
2157         (Incremental_input_entry_reader::get_output_symbol_index): New
2158         function.
2159         (Incremental_input_entry_reader::type_): Remove.
2160         (Incremental_input_entry_reader::flags_): New data member.
2161         (Incremental_inputs_reader::input_file_offset): New function.
2162         (Incremental_inputs_reader::input_file_index): New function.
2163         (Incremental_inputs_reader::input_file): Call input_file_offset.
2164         (Incremental_inputs_reader::input_file_at_offset): New function.
2165         (Incremental_relocs_reader::get_r_type): Reformat.
2166         (Incremental_relocs_reader::get_r_shndx): Reformat.
2167         (Incremental_relocs_reader::get_r_offset): Reformat.
2168         (Incremental_relocs_reader::data): New function.
2169         (Incremental_binary::Incremental_binary): Initialize new data members.
2170         (Incremental_binary::check_inputs): Add cmdline parameter.
2171         (Incremental_binary::file_is_unchanged): Remove.
2172         (Input_reader::arg_serial): New function.
2173         (Input_reader::get_unused_symbol_count): New function.
2174         (Input_reader::get_unused_symbol): New function.
2175         (Input_reader::do_arg_serial): New function.
2176         (Input_reader::do_get_unused_symbol_count): New function.
2177         (Input_reader::do_get_unused_symbol): New function.
2178         (Incremental_binary::input_file_count): New function.
2179         (Incremental_binary::get_input_reader): Change signature to use
2180         index instead of filename.
2181         (Incremental_binary::file_has_changed): New function.
2182         (Incremental_binary::get_input_argument): New function.
2183         (Incremental_binary::get_library): New function.
2184         (Incremental_binary::get_script_info): New function.
2185         (Incremental_binary::init_layout): New function.
2186         (Incremental_binary::reserve_layout): New function.
2187         (Incremental_binary::output_file): New function.
2188         (Incremental_binary::do_check_inputs): New function.
2189         (Incremental_binary::do_file_is_unchanged): Remove.
2190         (Incremental_binary::do_file_has_changed): New function.
2191         (Incremental_binary::do_init_layout): New function.
2192         (Incremental_binary::do_reserve_layout): New function.
2193         (Incremental_binary::do_input_file_count): New function.
2194         (Incremental_binary::do_get_input_reader): Change signature.
2195         (Incremental_binary::input_args_map_): New data member.
2196         (Incremental_binary::library_map_): New data member.
2197         (Incremental_binary::script_map_): New data member.
2198         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2199         new data members.
2200         (Sized_incremental_binary::output_section): New function.
2201         (Sized_incremental_binary::inputs_reader): Add const.
2202         (Sized_incremental_binary::symtab_reader): Add const.
2203         (Sized_incremental_binary::relocs_reader): Add const.
2204         (Sized_incremental_binary::got_plt_reader): Add const.
2205         (Sized_incremental_binary::get_symtab_view): New function.
2206         (Sized_incremental_binary::Inputs_reader): New typedef.
2207         (Sized_incremental_binary::Input_entry_reader): New typedef.
2208         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2209         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2210         (Sized_incremental_binary::do_file_has_changed): New function.
2211         (Sized_incremental_binary::do_init_layout): New function.
2212         (Sized_incremental_binary::do_reserve_layout): New function.
2213         (Sized_input_reader::Inputs_reader): Remove.
2214         (Sized_input_reader::Input_entry_reader): Remove.
2215         (Sized_input_reader::do_arg_serial): New function.
2216         (Sized_input_reader::do_get_unused_symbol_count): New function.
2217         (Sized_input_reader::do_get_unused_symbol): New function.
2218         (Sized_incremental_binary::do_input_file_count): New function.
2219         (Sized_incremental_binary::do_get_input_reader): Change signature;
2220         use index instead of filename.
2221         (Sized_incremental_binary::section_map_): New data member.
2222         (Sized_incremental_binary::input_entry_readers_): New data member.
2223         (class Sized_incr_relobj): New class.
2224         (class Sized_incr_dynobj): New class.
2225         (make_sized_incremental_object): New function.
2226         (class Incremental_library): New class.
2227         * layout.cc (Free_list::num_lists): New static data member.
2228         (Free_list::num_nodes): New static data member.
2229         (Free_list::num_removes): New static data member.
2230         (Free_list::num_remove_visits): New static data member.
2231         (Free_list::num_allocates): New static data member.
2232         (Free_list::num_allocate_visits): New static data member.
2233         (Free_list::init): New function.
2234         (Free_list::remove): New function.
2235         (Free_list::allocate): New function.
2236         (Free_list::dump): New function.
2237         (Free_list::print_stats): New function.
2238         (Layout_task_runner::run): Resize output file for incremental updates.
2239         (Layout::Layout): Initialize new data members.
2240         (Layout::set_incremental_base): New function.
2241         (Layout::init_fixed_output_section): New function.
2242         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2243         incremental updates.
2244         (Layout::create_gold_note): Do not create gold note section for
2245         incremental updates.
2246         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2247         for incremental updates.
2248         (Layout::set_section_offsets): For incremental updates, allocate space
2249         from free list.
2250         (Layout::create_symtab_sections): Layout with offsets relative to
2251         start of section; for incremental updates, allocate space from free
2252         list.
2253         (Layout::create_shdrs): For incremental updates, allocate space from
2254         free list.
2255         (Layout::finish_dynamic_section): For incremental updates, do not
2256         check --as-needed (fixed in subsequent patch).
2257         * layout.h (class Free_list): New class.
2258         (Layout::set_incremental_base): New function.
2259         (Layout::incremental_base): New function.
2260         (Layout::init_fixed_output_section): New function.
2261         (Layout::allocate): New function.
2262         (Layout::incremental_base_): New data member.
2263         (Layout::free_list_): New data member.
2264         * main.cc (main): Print Free_list statistics.
2265         * object.cc (Relobj::finalize_incremental_relocs): Add
2266         clear_counts parameter; clear counts only when clear_counts is set.
2267         (Sized_relobj::Sized_relobj): Initialize new base class.
2268         (Sized_relobj::do_layout): Don't report special sections.
2269         (Sized_relobj::do_for_all_local_got_entries): New function.
2270         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2271         symtab_off to all symbol table offsets.
2272         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2273         * object.h (class Got_offset_list): Move to top of file.
2274         (Object::Object): Allow case where input_file == NULL.
2275         (Object::~Object): Likewise.
2276         (Object::input_file): Assert that input_file != NULL.
2277         (Object::lock): Allow case where input_file == NULL.
2278         (Object::unlock): Likewise.
2279         (Object::is_locked): Likewise.
2280         (Object::token): Likewise.
2281         (Object::release): Likewise.
2282         (Object::is_incremental): New function.
2283         (Object::get_mtime): New function.
2284         (Object::for_all_local_got_entries): New function.
2285         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2286         (Object::set_is_in_system_directory): New function.
2287         (Object::is_in_system_directory): New function.
2288         (Object::do_is_incremental): New function.
2289         (Object::do_get_mtime): New function.
2290         (Object::do_for_all_local_got_entries): New function.
2291         (Object::is_in_system_directory_): New data member.
2292         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2293         (class Sized_relobj_base): New class.
2294         (class Sized_relobj): Derive from Sized_relobj_base.
2295         (class Sized_relobj::Symbols): Redeclare from base class.
2296         (class Sized_relobj::local_got_offset_list): Remove.
2297         (class Sized_relobj::Output_sections): Redeclare from base class.
2298         (class Sized_relobj::do_for_all_local_got_entries): New function.
2299         (class Sized_relobj::write_local_symbols): Add offset parameter.
2300         (class Sized_relobj::local_symbol_offset_): Update comment.
2301         (class Sized_relobj::local_dynsym_offset_): Update comment.
2302         * options.cc (Input_arguments::add_file): Remove const.
2303         * options.h (Input_file_argument::Input_file_argument):
2304         Initialize arg_serial_ (all constructors).
2305         (Input_file_argument::set_arg_serial): New function.
2306         (Input_file_argument::arg_serial): New function.
2307         (Input_file_argument::arg_serial_): New data member.
2308         (Input_arguments::Input_arguments): Initialize file_count_.
2309         (Input_arguments::add_file): Remove const.
2310         (Input_arguments::number_of_input_files): New function.
2311         (Input_arguments::file_count_): New data member.
2312         (Command_line::number_of_input_files): Call
2313         Input_arguments::number_of_input_files.
2314         * output.cc (Output_segment_headers::Output_segment_headers):
2315         Set current size.
2316         (Output_section::Input_section::current_data_size): New function.
2317         (Output_section::Output_section): Initialize new data members.
2318         (Output_section::add_input_section): Don't do merge sections for
2319         an incremental link; allocate space from free list for an
2320         incremental update.
2321         (Output_section::add_output_section_data): Allocate space from
2322         free list for an incremental update.
2323         (Output_section::update_data_size): New function.
2324         (Output_section::set_fixed_layout): New function.
2325         (Output_section::reserve): New function.
2326         (Output_segment::set_section_addresses): Remove const.
2327         (Output_segment::set_section_list_addresses): Remove const; allocate
2328         space from free list for an incremental update.
2329         (Output_segment::set_offset): Adjust size of RELRO segment for an
2330         incremental update.
2331         * output.h (Output_data::current_data_size): Move here from
2332         child classes.
2333         (Output_data::pre_finalize_data_size): New function.
2334         (Output_data::update_data_size): New function.
2335         (Output_section_headers::update_data_size): new function.
2336         (Output_section_data_build::current_data_size): Move to Output_data.
2337         (Output_data_strtab::update_data_size): New function.
2338         (Output_section::current_data_size): Move to Output_data.
2339         (Output_section::set_fixed_layout): New function.
2340         (Output_section::has_fixed_layout): New function.
2341         (Output_section::reserve): New function.
2342         (Output_section::update_data_size): New function.
2343         (Output_section::has_fixed_layout_): New data member.
2344         (Output_section::free_list_): New data member.
2345         (Output_segment::set_section_addresses): Remove const.
2346         (Output_segment::set_section_list_addresses): Remove const.
2347         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2348         New function.
2349         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2350         New function.
2351         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2352         parameter when calling Add_symbols constructor; store argument
2353         serial number for members of a lib group.
2354         (Add_symbols::locks): Allow case where token == NULL.
2355         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2356         (Read_member::~Read_member): New function.
2357         (Read_member::is_runnable): New function.
2358         (Read_member::locks): New function.
2359         (Read_member::run): New function.
2360         (Check_script::~Check_script): New function.
2361         (Check_script::is_runnable): New function.
2362         (Check_script::locks): New function.
2363         (Check_script::run): New function.
2364         (Check_library::~Check_library): New function.
2365         (Check_library::is_runnable): New function.
2366         (Check_library::locks): New function.
2367         (Check_library::run): New function.
2368         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2369         (Add_symbols::library_): New data member.
2370         (class Read_member): New class.
2371         (class Check_script): New class.
2372         (class Check_library): New class.
2373         * reloc.cc (Read_relocs::is_runnable): Allow case where
2374         token == NULL.
2375         (Read_relocs::locks): Likewise.
2376         (Scan_relocs::locks): Likewise.
2377         (Relocate_task::locks): Likewise.
2378         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2379         to clear counters.
2380         (Sized_relobj::incremental_relocs_scan): Fix comment.
2381         (Sized_relobj::do_relocate): Pass output file offset to
2382         write_local_symbols.
2383         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2384         from class declaration.
2385         * script.cc (read_input_script): Allocate Script_info; pass
2386         argument serial number to report_script.
2387         * script.h (class Script_info): Move to incremental.h.
2388         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2389         * symtab.h (Symbol_table::add_from_incrobj): New function.
2390         (Symbol_table::set_file_offset): New function.
2391
2392 2011-04-05  Cary Coutant  <ccoutant@google.com>
2393
2394         * incremental-dump.cc (dump_incremental_inputs): Change signature
2395         to take a Sized_incremental_binary; change caller.  Use readers
2396         in Sized_incremental_binary.
2397         * incremental.cc
2398         (Sized_incremental_binary::find_incremental_inputs_sections):
2399         Rename do_find_incremental_inputs_sections to this.
2400         (Sized_incremental_binary::setup_readers): New function.
2401         (Sized_incremental_binary::do_check_inputs): Check
2402         has_incremental_info_ flag; move setup code to setup_readers;
2403         use input readers.
2404         (Sized_incremental_binary::do_file_is_unchanged): New function.
2405         (Sized_incremental_binary::do_get_input_reader): New function.
2406         * incremental.h (class Incremental_binary): Move to end of file.
2407         (Incremental_binary::file_is_unchanged): New function.
2408         (Incremental_binary::do_file_is_unchanged): New function.
2409         (Incremental_binary::Input_reader): New class.
2410         (Incremental_binary::get_input_reader): New function.
2411         (class Sized_incremental_binary): Move to end of file.
2412         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2413         input section reader classes.
2414         (Sized_incremental_binary::has_incremental_info): New function.
2415         (Sized_incremental_binary::inputs_reader): New function.
2416         (Sized_incremental_binary::symtab_reader): New function.
2417         (Sized_incremental_binary::relocs_reader): New function.
2418         (Sized_incremental_binary::got_plt_reader): New function.
2419         (Sized_incremental_binary::do_file_is_unchanged): New function.
2420         (Sized_incremental_binary::Sized_input_reader): New class.
2421         (Sized_incremental_binary::get_input_reader): New function.
2422         (Sized_incremental_binary::find_incremental_inputs_sections):
2423         Rename do_find_incremental_inputs_sections to this.
2424         (Sized_incremental_binary::setup_readers): New function.
2425         (Sized_incremental_binary::has_incremental_info_): New data member.
2426         (Sized_incremental_binary::inputs_reader_): New data member.
2427         (Sized_incremental_binary::symtab_reader_): New data member.
2428         (Sized_incremental_binary::relocs_reader_): New data member.
2429         (Sized_incremental_binary::got_plt_reader_): New data member.
2430         (Sized_incremental_binary::current_input_file_): New data member.
2431
2432 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2433
2434         PR gold/12640
2435         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2436         violation.
2437
2438 2011-03-30  Cary Coutant  <ccoutant@google.com>
2439
2440         * archive.cc (Archive::include_member): Adjust call to report_object.
2441         (Add_archive_symbols::run): Add script_info to call to
2442         report_archive_begin.
2443         (Lib_group::include_member): Adjust call to report_object.
2444         (Add_lib_group_symbols::run): Adjust call to report_object.
2445         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2446         blocks.  Add object count for script input files.
2447         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2448         script_info parameter; change all callers.
2449         (Incremental_inputs::report_object): Add script_info parameter;
2450         change all callers.
2451         (Incremental_inputs::report_script): Store backpointer to
2452         incremental info entry.
2453         (Output_section_incremental_inputs::set_final_data_size): Record
2454         additional information for scripts.
2455         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2456         * incremental.h (Incremental_script_entry::add_object): New function.
2457         (Incremental_script_entry::get_object_count): New function.
2458         (Incremental_script_entry::get_object): New function.
2459         (Incremental_script_entry::objects_): New data member; adjust
2460         constructor.
2461         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2462         (Incremental_inputs::report_object): Add script_info parameter.
2463         (Incremental_inputs_reader::get_object_count): New function.
2464         (Incremental_inputs_reader::get_object_offset): New function.
2465         * options.cc (Input_arguments::add_file): Return reference to
2466         new input argument.
2467         * options.h (Input_argument::set_script_info): New function.
2468         (Input_argument::script_info): New function.
2469         (Input_argument::script_info_): New data member; adjust all
2470         constructors.
2471         (Input_file_group::add_file): Return reference to new input argument.
2472         (Input_file_lib::add_file): Likewise.
2473         (Input_arguments::add_file): Likewise.
2474         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2475         * script.cc (Parser_closure::Parser_closure): Add script_info
2476         parameter; adjust all callers.
2477         (Parser_closure::script_info): New function.
2478         (Parser_closure::script_info_): New data member.
2479         (read_input_script): Report scripts earlier to incremental info.
2480         (script_add_file): Set script_info in Input_argument.
2481         (script_add_library): Likewise.
2482         * script.h (Script_options::Script_info): Rewrite class.
2483
2484 2011-03-29  Cary Coutant  <ccoutant@google.com>
2485
2486         * archive.cc (Library_base::should_include_member): Move
2487         method here from class Archive.
2488         (Archive::Archive): Initialize base class.
2489         (Archive::should_include_member): Move to base class.
2490         (Archive::do_for_all_unused_symbols): New function.
2491         (Add_archive_symbols::run): Remove redundant access to
2492         incremental_inputs.
2493         (Lib_group::Lib_group): Initialize base class.
2494         (Lib_group::do_filename): New function.
2495         (Lib_group::include_member): Pass pointer to Lib_group to
2496         report_object.
2497         (Lib_group::do_for_all_unused_symbols): New function.
2498         (Add_lib_group_symbols::run): Report archive information for
2499         incremental links.
2500         * archive.h (class Library_base): New base class.
2501         (class Archive): Derive from Library_base.
2502         (Archive::filename): Move to base class.
2503         (Archive::set_incremental_info): Likewise.
2504         (Archive::incremental_info): Likewise.
2505         (Archive::Should_include): Likewise.
2506         (Archive::should_include_member): Likewise.
2507         (Archive::Armap_entry): Remove.
2508         (Archive::Unused_symbol_iterator): Remove.
2509         (Archive::unused_symbols_begin): Remove.
2510         (Archive::unused_symbols_end): Remove.
2511         (Archive::do_filename): New function.
2512         (Archive::do_get_mtime): New function.
2513         (Archive::do_for_all_unused_symbols): New function.
2514         (Archive::task_): Move to base class.
2515         (Archive::incremental_info_): Likewise.
2516         (class Lib_group): Derive from Library_base.
2517         (Lib_group::do_filename): New function.
2518         (Lib_group::do_get_mtime): New function.
2519         (Lib_group::do_for_all_unused_symbols): New function.
2520         (Lib_group::task_): Move to base class.
2521         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2522         function.
2523         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2524         function.
2525         * incremental.cc (Incremental_inputs::report_archive_begin):
2526         Use Library_base; call library's get_mtime; add incremental inputs
2527         entry before members.
2528         (class Unused_symbol_visitor): New class.
2529         (Incremental_inputs::report_archive_end): Use Library_base; use
2530         visitor class to record unused symbols; don't add incremental inputs
2531         entry after members.
2532         (Incremental_inputs::report_object): Use Library_base.
2533         * incremental.h
2534         (Incremental_archive_entry::Incremental_archive_entry): Remove
2535         unused Archive parameter.
2536         (Incremental_inputs::report_archive_begin): Use Library_base.
2537         (Incremental_inputs::report_archive_end): Likewise.
2538         (Incremental_inputs::report_object): Likewise.
2539         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2540         function.
2541         * object.h (Object::for_all_global_symbols): New function.
2542         (Object::do_for_all_global_symbols): New function.
2543         (Sized_relobj::do_for_all_global_symbols): New function.
2544         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2545         function.
2546         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2547         function.
2548
2549 2011-03-27  Ian Lance Taylor  <iant@google.com>
2550
2551         * archive.cc (Archive::interpret_header): Return -1 if something
2552         goes wrong.  Change callers accordingly.
2553
2554 2011-03-25  Cary Coutant  <ccoutant@google.com>
2555
2556         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2557         * testsuite/Makefile.in: Regenerate.
2558
2559 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2560
2561         * plugin.cc (get_view): New.
2562         (Plugin::load): Pass get_view to the plugin.
2563         (Plugin_manager::get_view): New.
2564
2565 2011-03-21  Ian Lance Taylor  <iant@google.com>
2566
2567         * testsuite/final_layout.sh: Rewrite to not use dc.
2568         * testsuite/relro_test.sh: Fail if dc is not present.
2569
2570 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2571
2572         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2573         Change == to -eq.
2574         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2575         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2576         Change == to -eq.
2577         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2578         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2579
2580 2011-03-14  Ian Lance Taylor  <iant@google.com>
2581
2582         * script-sections.cc (Sort_output_sections::script_compare):
2583         Rename from is_before, change return type.
2584         (Sort_output_sections::operator()): Adjust accordingly.
2585
2586 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2587
2588         PR gold/12572
2589         * testsuite/odr_violation2.cc: Add comment to make all error line
2590         numbers double digits.
2591         * testsuite/debug_msg.sh: Adjust expected errors.
2592
2593 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2594
2595         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2596         but mark earlier ones as non-canonical
2597         (offset_to_iterator): Update search target and example
2598         (do_addr2line): Return extra lines in a vector*
2599         (format_file_lineno): Extract from do_addr2line
2600         (one_addr2line): Add vector* out-param
2601         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2602         when a lineno entry appeared last for its instruction
2603         (Dwarf_line_info): Add vector* out-param
2604         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2605         * symtab.cc (Odr_violation_compare): Include the lineno in the
2606         comparison again.
2607         (linenos_from_loc): New. Combine the canonical line for an
2608         address with its other lines.
2609         (True_if_intersect): New. Helper functor to make
2610         std::set_intersection a query.
2611         (detect_odr_violations): Compare sets of lines instead of just
2612         one line for each function. This became less deterministic, but
2613         has fewer false positives.
2614         * symtab.h: Declarations.
2615         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2616         mix an optimized and non-optimized object in the same binary
2617         (odr_violation2.so): Same.
2618         * testsuite/Makefile.in: Regenerate from Makefile.am.
2619         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2620         * testsuite/debug_msg.sh: Update line numbers and add
2621         assertions.
2622         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2623         non-optimized context.
2624         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2625         isn't inlined, and use OdrDerived in an optimized context.
2626         * testsuite/odr_header1.h: Defines OdrDerived, where
2627         optimization will change the
2628         first-instruction-in-the-destructor's file and line number.
2629         * testsuite/odr_header2.h: Defines OdrBase.
2630
2631 2011-03-09  Ian Lance Taylor  <iant@google.com>
2632
2633         * fileread.cc (File_read::clear_views): Don't delete the whole
2634         file view.
2635
2636 2011-03-08  Ian Lance Taylor  <iant@google.com>
2637
2638         PR gold/12525
2639         * fileread.cc: #include <climits>.
2640         (GOLD_IOV_MAX): Define.
2641         (File_read::read_multiple): Limit number of entries by iov_max.
2642         * fileread.h (class File_read): Always set max_readv_entries to
2643         128.
2644
2645 2011-03-07  Ian Lance Taylor  <iant@google.com>
2646
2647         PR gold/12525
2648         * options.h (class General_options): Add -dy and -dn.
2649
2650 2011-03-02  Cary Coutant  <ccoutant@google.com>
2651
2652         * testsuite/script_test_9.t: Add TLS segment.
2653
2654 2011-03-02  Simon Baldwin  <simonb@google.com>
2655
2656         * configure.ac: Add check for gnu_indirect_function support in
2657         the toolchain building binutils.
2658         * configure: Rebuild.
2659
2660 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2661
2662         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2663         plugin only symbols.
2664         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2665         in plugin files as not needed in the symbol table.
2666
2667 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2668
2669         * output.cc (Output_section::add_input_section): Delay fill
2670         generation for section ordering.
2671
2672 2011-02-09  Ian Lance Taylor  <iant@google.com>
2673
2674         PR gold/12316
2675         * object.h (class Sized_relobj): Remove clear_local_symbols.
2676         * reloc.cc (Sized_relobj::do_relocate): Don't call
2677         clear_local_symbols.
2678
2679 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2680
2681         * plugin.cc (is_visible_from_outside): Return true for symbols
2682         in the -u option.
2683
2684 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2685
2686         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2687         filename.
2688
2689 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2690
2691         * icf.h (is_section_foldable_candidate): Change type of parameter
2692         to std::string.
2693         * icf.cc (Icf::find_identical_sections): Change type of local variable
2694         section_name to be std::string.
2695         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2696
2697 2011-01-25  Ian Lance Taylor  <iant@google.com>
2698
2699         * script.cc (script_add_extern): Rewrite to use
2700         add_symbol_reference.
2701
2702 2011-01-25  Doug Kwan  <dougkwan@google.com>
2703
2704         * icf.cc (get_section_contents): Always lock section's object.
2705
2706 2011-01-24  Ian Lance Taylor  <iant@google.com>
2707
2708         * options.h (class General_options): Accept
2709         --no-detect-odr-violations.
2710
2711 2011-01-24  Ian Lance Taylor  <iant@google.com>
2712
2713         * version.cc (version_string): Bump to 1.11.
2714
2715 2011-01-24  Ian Lance Taylor  <iant@google.com>
2716
2717         * plugin.cc (class Plugin_rescan): Define new class.
2718         (Plugin_manager::claim_file): Set any_claimed_.
2719         (Plugin_manager::save_archive): New function.
2720         (Plugin_manager::save_input_group): New function.
2721         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2722         necessary.
2723         (Plugin_manager::new_undefined_symbol): New function.
2724         (Plugin_manager::rescan): New function.
2725         (Plugin_manager::rescannable_defines): New function.
2726         (Plugin_manager::add_input_file): Set any_added_.
2727         * plugin.h (class Plugin_manager): define new fields rescannable_,
2728         undefined_symbols_, any_claimed_, and any_added_.  Declare
2729         Plugin_rescan as friend.  Declare new functions.
2730         (Plugin_manager::Rescannable): Define type.
2731         (Plugin_manager::Rescannable_list): Define type.
2732         (Plugin_manager::Undefined_symbol_list): Define type.
2733         (Plugin_manager::Plugin_manager): Initialize new fields.
2734         * archive.cc (Archive::defines_symbol): New function.
2735         (Add_archive_symbols::run): Pass archive to plugins if any.
2736         * archive.h (class Archive): Declare defines_symbol.
2737         * readsyms.cc (Input_group::~Input_group): New function.
2738         (Finish_group::run): Pass input_group to plugins if any.
2739         * readsyms.h (class Input_group): Declare destructor.
2740         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2741         any.
2742
2743 2011-01-10  Ian Lance Taylor  <iant@google.com>
2744
2745         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2746         section as relro.
2747         (Layout::set_segment_offsets): Reset increase_relro before calling
2748         set_section_addresses a second time.
2749
2750 2011-01-04  Cary Coutant  <ccoutant@google.com>
2751
2752         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2753         sections before NOBITS sections.
2754
2755 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2756
2757         * version.cc (print_version): Update copyright to 2011.
2758
2759 2010-12-23  Cary Coutant  <ccoutant@google.com>
2760
2761         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2762         of OS to this->add.  Add OD parameter to second form of the function.
2763
2764 2010-12-20  Ian Lance Taylor  <iant@google.com>
2765
2766         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2767         second of two consecutive entries with same offset.
2768
2769 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2770
2771         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2772         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2773         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2774         to avoid unneeded links against $(LDADD).
2775         * testsuite/Makefile.in: Regenerate.
2776
2777 2010-12-15  Ian Lance Taylor  <iant@google.com>
2778
2779         PR gold/12324
2780         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2781         for R_X86_64_32 and R_X86_64_PC32.
2782         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2783         ver_matching_def_pic.o.
2784         (ver_matching_def_pic.o): New target.
2785
2786 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2787
2788         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2789         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2790         Move definition before File_read::View member definitions.
2791         (File_read::View::~View): Initialize and hold lock before
2792         updating current_mapped_bytes.
2793
2794 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2795
2796         * dwarf_reader.cc: Remove outdated comment.
2797         * gold-threads.cc: Fix typo in error message.
2798         * archive.cc: Fix typos in comments.
2799         * archive.h: Likewise.
2800         * arm-reloc-property.cc: Likewise.
2801         * arm-reloc-property.h: Likewise.
2802         * arm-reloc.def: Likewise.
2803         * arm.cc: Likewise.
2804         * attributes.h: Likewise.
2805         * cref.cc: Likewise.
2806         * ehframe.cc: Likewise.
2807         * fileread.h: Likewise.
2808         * gold.h: Likewise.
2809         * i386.cc: Likewise.
2810         * icf.cc: Likewise.
2811         * incremental.h: Likewise.
2812         * int_encoding.cc: Likewise.
2813         * layout.h: Likewise.
2814         * main.cc: Likewise.
2815         * merge.h: Likewise.
2816         * object.cc: Likewise.
2817         * object.h: Likewise.
2818         * options.cc: Likewise.
2819         * readsyms.cc: Likewise.
2820         * reduced_debug_output.cc: Likewise.
2821         * reloc.cc: Likewise.
2822         * script-sections.cc: Likewise.
2823         * sparc.cc: Likewise.
2824         * symtab.h: Likewise.
2825         * target-reloc.h: Likewise.
2826         * target.cc: Likewise.
2827         * target.h: Likewise.
2828         * timer.cc: Likewise.
2829         * timer.h: Likewise.
2830         * x86_64.cc: Likewise.
2831
2832 2010-12-09  Cary Coutant  <ccoutant@google.com>
2833
2834         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2835         stack.
2836         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2837         parameter; change all callers.
2838         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2839         * options.h (warn_execstack): New option.
2840
2841 2010-12-07  Doug Kwan  <dougkwan@google.com>
2842
2843         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2844         like function call relocations.
2845
2846 2010-12-07  Ian Lance Taylor  <iant@google.com>
2847
2848         * archive.cc (Archive::get_elf_object_for_member): Permit
2849         punconfigured to be NULL.
2850         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2851         (Archive::include_member): Pass NULL to get_elf_object_for_member
2852         if we searched for the archive and this is the first included
2853         object.
2854
2855 2010-12-01  Ian Lance Taylor  <iant@google.com>
2856
2857         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2858         track_relocs_type_ field.
2859         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2860         Set track_relocs_type_.
2861         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2862         contents when using RELA relocs.
2863         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2864         reloc_map_.
2865         * reloc.cc (Track_relocs::next_addend): New function.
2866         * reloc.h (class Track_relocs): Declare next_addend.
2867
2868 2010-12-01  Ian Lance Taylor  <iant@google.com>
2869
2870         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2871         virtual destructor.
2872
2873 2010-12-01  Ian Lance Taylor  <iant@google.com>
2874
2875         * README: Update compilers known to work and fail.
2876
2877 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2878
2879         * configure.in: For --enable-gold, handle value `default' instead of
2880         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2881         not the default.
2882         * configure: Regenerate.
2883
2884 2010-11-18  Doug Kwan  <dougkwan@google.com>
2885
2886         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2887         and right_alignment to be zero.  Store result alignment only if it is
2888         greater than existing alignment.
2889
2890 2010-11-16  Cary Coutant  <ccoutant@google.com>
2891
2892         PR gold/12220
2893         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2894         Check for ".zdebug_line".
2895
2896 2010-11-16  Doug Kwan  <dougkwan@google.com>
2897             Cary Coutant  <ccoutant@google.com>
2898
2899         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2900         by reference; adjust all callers.
2901         * output.cc (Output_segment::set_section_addresses): Adjust references
2902         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2903         list is empty.
2904         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2905         end at page boundary.
2906
2907 2010-11-16  Cary Coutant  <ccoutant@google.com>
2908
2909         PR gold/12220
2910         * layout.cc (Layout::choose_output_section): Transform names of
2911         compressed sections even when using a script with a SECTIONS clause.
2912         (Layout::output_section_name): Remove code to transform
2913         compressed debug section names.
2914         * output.cc (Output_section::add_input_section): Use uncompressed
2915         section size when tracking input sections.
2916
2917 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2918
2919         * symtab.h (Symbol::NON_PIC_REF): Remove.
2920         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2921         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2922         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2923         (Symbol::use_plt_offset): Take a flags argument and pass it
2924         directly to needs_dynamic_reloc.  Restrict check for undefined
2925         weak symbols to function calls.
2926         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2927         (Target_arm::Scan::global): Use it.
2928         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2929         (Target_arm::Relocate::relocate): Likewise.
2930         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2931         parameter with an r_type parameter.  Use get_reference_flags
2932         to get the flags.
2933         (Target_arm::Relocate::relocate): Update accordingly.
2934         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2935         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2936         (Target_i386::Scan::global): Likewise.
2937         (Target_i386::Relocate::relocate): Likewise.
2938         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2939         parameter with an r_type parameter.  Use get_reference_flags
2940         to get the flags.
2941         (Target_i386::Relocate::relocate): Update accordingly.
2942         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2943         (Target_powerpc::Scan::global): Use it.
2944         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2945         (Target_powerpc::Relocate::relocate): Likewise.
2946         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2947         (Target_sparc::Scan::global): Use it.
2948         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2949         (Target_sparc::Relocate::relocate): Likewise.
2950         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2951         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2952         (Target_x86_64::Scan::global): Likewise.
2953         (Target_x86_64::Relocate::relocate): Likewise.
2954
2955 2010-11-08  Doug Kwan  <dougkwan@google.com>
2956             Cary Coutant  <ccoutant@google.com>
2957
2958         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2959         (Arm_exidx_merge_section::section_contents_): New data member.
2960         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2961         (Arm_input_section::~Arm_input_section): De-allocate memory.
2962         (Arm_input_section::original_contents_): New data member.       
2963         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2964         in parameters instead of calling Object::section_contents without
2965         locking.
2966         (Arm_output_section::group_section): New parameter TASK.  Pass it
2967         to callees that need locking objects.
2968         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2969         to lock EXIDX input sections.  Fix a formatting issue.  Call
2970         Arm_exidx_merged_section::build_contents to create merged section
2971         contents.
2972         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2973         to lock object of stub table owner.
2974         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2975         TEXT_SIZE to initialize data member TEXT_SIZE_.
2976         (Arm_exidx_input_section::addralign): Fix typo in comment.
2977         (Arm_exidx_input_section::text_size): New method.
2978         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2979         that require locking objects.  Lock objects before scanning for stubs
2980         and updating local symbols.
2981         (Arm_input_section<big_endian>::init): Copy contents of original
2982         input section.
2983         (Arm_input_section<big_endian>::do_write): Use saved contents of
2984         original input section instead of calling Object::section_contents
2985         without locking.
2986         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2987         size without calling Object::section_size().
2988         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2989         for size.  Allocate a buffer for merged EXIDX entries.
2990         (Arm_exidx_merged_section::build_contents): New method.
2991         (Arm_exidx_merged_section::do_write): Move merge section contents
2992         building code to Arm_exidx_merged_section::build_contetns.  Write
2993         out contetns in buffer instead of building it on the fly.
2994         (Arm_relobj::make_exidx_input_section): Also pass text section size
2995         to Arm_exidx_input_section constructor.
2996         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2997         (Arm_dynobj::do_read_symbols): Fix memory leak.
2998         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2999         * target.h: (class Task): Add forward declaration.
3000         (Target::relax): Add new parameter TASK and pass it to
3001         Target::do_relax().
3002         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3003
3004 2010-11-05  Cary Coutant  <ccoutant@google.com>
3005
3006         PR gold/10708
3007         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3008         object when reading from the file.
3009         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3010         second layout pass.
3011         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3012         when reading section contents.
3013         (get_section_contents): Likewise.
3014         (icf::find_identical_sections): Likewise.
3015         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3016         object when reading from the file.
3017         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3018         the object when doing deferred section layout.
3019
3020 2010-11-03  Nick Clifton  <nickc@redhat.com>
3021
3022         PR gold/12001
3023         * script.h (class Symbol_assignment: name): New member.  Returns
3024         the name of the symbol.
3025         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3026         Returns true if the given symbol name is on the list of
3027         assignments wating to be processed.
3028         * archive.cc (should_incldue_member): If the symbol is undefined,
3029         check to see if it is on the list of symbols pending assignment.
3030
3031 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3032
3033         * script-sections.cc (Script_sections::find_memory_region): Check
3034         for a NULL output section pointer.
3035
3036 2010-10-29  Doug Kwan  <dougkwan@google.com>
3037
3038         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3039         Output_section::add_relaxed_input_section.
3040         * output.cc (Output_section::add_relaxed_input_section): Add new
3041         arguments LAYOUT and NAME.  Set section order index.
3042         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3043         Copy section order index.
3044         * output.h (Output_section::add_relaxed_input_section): Add new
3045         arguments LAYOUT and NAME.
3046
3047 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3048
3049         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3050         NATIVE_OR_CROSS_LINKER.
3051         * testsuite/Makefile.in: Regenerate.
3052
3053 2010-10-20  Doug Kwan  <dougkwan@google.com>
3054
3055         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3056         without SHF_LINK_ORDER flags.
3057         * layout.cc (Layout::choose_output_section): Do not filter
3058         SHF_LINK_ORDER flag in a relocatable link.
3059
3060 2010-10-17  Cary Coutant  <ccoutant@google.com>
3061
3062         * output.h (Output_segment::set_section_addresses): Change function
3063         signature.  Update all callers.
3064         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3065         sections.
3066         (Output_segment::set_section_addresses): Align after last TLS
3067         section.  Add padding before last relro section instead of after.
3068
3069 2010-10-17  Doug Kwan  <dougkwan@google.com>
3070
3071         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3072         GOT output section to be writable.
3073
3074 2010-10-14  Cary Coutant  <ccoutant@google.com>
3075
3076         * debug.h (DEBUG_INCREMENTAL): New flag.
3077         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3078         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3079         mode.
3080         * incremental.cc (report_command_line): Ignore all forms of
3081         --incremental.
3082         * layout.cc (Layout::Layout): Check parameters for incremental link
3083         mode.
3084         * options.cc (General_options::parse_incremental): New function.
3085         (General_options::parse_no_incremental): New function.
3086         (General_options::parse_incremental_full): New function.
3087         (General_options::parse_incremental_update): New function.
3088         (General_options::incremental_mode_): New data member.
3089         (General_options::finalize): Check incremental_mode_.
3090         * options.h (General_options): Update help text for --incremental.
3091         Add --no-incremental, --incremental-full, --incremental-update.
3092         (General_options::Incremental_mode): New enum type.
3093         (General_options::incremental_mode): New function.
3094         (General_options::incremental_mode_): New data member.
3095         * parameters.cc (Parameters::incremental_mode_): New data member.
3096         (Parameters::set_options): Set incremental_mode_.
3097         (Parameters::set_incremental_full): New function.
3098         (Parameters::incremental): New function.
3099         (Parameters::incremental_update): New function.
3100         (set_parameters_incremental_full): New function.
3101         * parameters.h (Parameters::set_incremental_full): New function.
3102         (Parameters::incremental): New function.
3103         (Parameters::incremental_update): New function.
3104         (Parameters::incremental_mode_): New data member.
3105         (set_parameters_incremental_full): New function.
3106         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3107         incremental link mode.
3108         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3109         (Sized_relobj::do_relocate_sections): Likewise.
3110         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3111         option.
3112         * testsuite/Makefile.in: Regenerate.
3113         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3114
3115 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3116
3117         * script-sections.h (class Script_sections): Make
3118         Sections_elements typedef public.
3119         * script-sections.cc (class Sort_output_sections): Add elements_
3120         field.  Add constructor which sets it; change all callers.
3121         (Sort_output_sections::is_before): New function.
3122         (Sort_output_sections::operator()): Call is_before.
3123         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3124         conditional.
3125         * testsuite/script_test_10.sh: New test. Test script section
3126         order.
3127         * testsuite/script_test_10.t: Likewise.
3128         * testsuite/script_test_10.s: Likewise.
3129         * testsuite/Makefile.am: Wrap the cross linker tests and the
3130         common tests into NATIVE_OR_CROSS_LINKER.
3131         (check_SCRIPTS): Add script_test_10.sh.
3132         (check_DATA): Add script_test_10.stdout.
3133         (script_test_10.o, script_test_10): New targets.
3134         (script_test_10.stdout): New target.
3135         * configure, testsuite/Makefile.in: Regenerate.
3136
3137 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3138
3139         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3140         error for the deprecated relocations.
3141         (Target_arm::Scan::global): Likewise.
3142         (Target_arm::Relocate::relocate): Likewise.
3143
3144 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3145
3146         * fileread.cc (Input_file::find_file): Initialize *found_name
3147         and *namep when using the fallback search for case 4.
3148
3149 2010-10-11  Cary Coutant  <ccoutant@google.com>
3150
3151         * options.h (class General_options): Redefine -z lazy as an alias for
3152         the negation of -z now.
3153
3154 2010-10-11  Ian Lance Taylor  <iant@google.com>
3155
3156         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3157         binding.
3158
3159 2010-10-06  Nick Clifton  <nickc@redhat.com>
3160
3161         * script-sections.cc(class Memory_region): Remove
3162         current_lma_offset_ field.  Rename current_vma_offset_ to
3163         current_offset_.  Add last_section_ field.
3164         (Memory_region::get_current_vma_address): Rename to
3165         get_current_address.
3166         (Memory_region::get_current_lma_address): Delete.
3167         (Memory_region::increment_vma_offset): Rename to
3168         increment_offset.
3169         (Memory_region::increment_lma_offset): Delete.
3170         (Memory_region::attributes_compatible): New method.  Returns
3171         true if the provided section is compatible with the region.
3172         (Memory_region::get_last_section): New method.  Returns the last
3173         section to use the region.
3174         (Memory_region::set_last_section): New method.  Stores the last
3175         section to use the region.
3176         (Script_sections::block_in_region): New method.  Returns true if
3177         a block of memory is contained within a region.
3178         (Script_sections::find_memory_region): New method.  Locates a
3179         memory region to be used to set a VMA or LMA address.
3180         (Output_section_definition::set_section_addresses): Add code to
3181         check for addresses set by memory regions.
3182         (Output_segment::set_section_addresses): Remove memory region
3183         walking code.
3184         (Script_sections::create_segment): Add a warning if a header
3185         segment is created outside of any region.
3186         * script-sections.h (class Script_sections): Add prototypes for
3187         find_memory_region and block_in_region methods.
3188         * testsuite/memory_test.s: Use .long instead of .word.
3189         * testsuite/memory_test.t: Add some more output sections.
3190         * testsuite/memory_test.sh: Update expected output.
3191
3192 2010-10-02  Doug Kwan  <dougkwan@google.com>
3193
3194         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3195         defintion to symtab.h
3196         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3197         declaration to defintion.
3198
3199 2010-10-01  Nick Clifton  <nickc@redhat.com>
3200
3201         * expression.cc (eval): Replace dummy argument with NULL.
3202         (eval_maybe_dot): Check for a NULL result section pointer.
3203         (Symbol_expression::value): Likewise.
3204         (Dot_expression::value): Likewise.
3205         (BINARY_EXPRESSION): Likewise.
3206         (Max_expression::value): Likewise.
3207         (Min_expression::value): Likewise.
3208         (Absolute_expression::value): Likewise.
3209         (Addr_expression::value_from_output_section): Likewise.
3210         (Loaddddr_expression::value_from_output_section): Likewise.
3211         (Segment_start_expression::value): Likewise.
3212         * script-sections.cc
3213         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3214         argument with NULL.
3215         (Sections_elememt_dot_assignment::set_section_addresses):
3216         Likewise.
3217         (Output_data_expression::do_write_to_buffer): Likewise.
3218         (Output_section_definition::finalize_symbols): Likewise.
3219         (Output_section_definition::set_section_addresses): Likewise.
3220
3221 2010-09-30  Doug Kwan  <dougkwan@google.com>
3222
3223         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3224
3225 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3226
3227         * target.h (Target::can_icf_inline_merge_sections): New virtual
3228         function.
3229         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3230         virtual function.
3231         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3232         virtual function.
3233         * icf.cc (get_section_contents): Inline merge sections only when
3234         target allows it.
3235
3236 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3237
3238         * configure: Regenerate.
3239
3240 2010-09-17  Ian Lance Taylor  <iant@google.com>
3241
3242         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3243         * testsuite/Makefile.am (memory_test.o): New target.
3244         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3245         memory_test.t.
3246         * testsuite/Makefile.in: Rebuild.
3247
3248 2010-09-17  Doug Kwan  <dougkwan@google.com>
3249
3250         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3251         defintion if relocation uses GOT entries of the symbol.
3252         * testsuite/icf_safe_test.sh: Fix test.
3253         * testsuite/icf_safe_so_test.sh: Fix test.
3254
3255 2010-09-16  Cary Coutant  <ccoutant@google.com>
3256
3257         * script_sections.cc (class Memory_region): Remove "NULL" from
3258         vector initializations.
3259
3260 2010-09-15  Cary Coutant  <ccoutant@google.com>
3261
3262         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3263         Resolve forwarding symbols.
3264
3265 2010-09-15  Doug Kwan  <dougkwan@google.com>
3266
3267         * gold/testsuite/script_test_3.t: Add ARM special sections.
3268         * gold/testsuite/script_test_4.t: Same.
3269         * gold/testsuite/script_test_5.t: Same.
3270         * gold/testsuite/script_test_6.t: Same.
3271         * gold/testsuite/script_test_7.t: Same.
3272         * gold/testsuite/script_test_7.t: Same.
3273         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3274
3275 2010-09-14  Cary Coutant  <ccoutant@google.com>
3276
3277         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3278         (Target_x86_64::Relocate::relocate_tls): Replace check for
3279         saw_tls_block_reloc_ with test for executable section.
3280
3281 2010-09-12  Cary Coutant  <ccoutant@google.com>
3282
3283         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3284         position-independent executables to shared libraries need dynamic
3285         relocations.
3286         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3287         position-independent executables.
3288         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3289         * testsuite/Makefile.in: Regenerate.
3290
3291 2010-09-10  Nick Clifton  <nickc@redhat.com>
3292
3293         PR gold/11997
3294         * testsuite/memory_test.t: Discard any sections that are not
3295         needed.
3296
3297 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3298
3299         PR gold/11996
3300         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3301         "This::" to work around a bug in gcc 4.2.
3302
3303         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3304
3305 2010-09-09  Rafael Espindola  <espindola@google.com>
3306
3307         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3308         sections with different PF_X flags in the same segment.
3309         (Layout::find_first_load_seg): Search all segments to find the first
3310         one.
3311         * options.h (rosegment): New.
3312
3313 2010-09-08  Rafael Espindola  <espindola@google.com>
3314
3315         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3316
3317 2010-09-08  Doug Kwan  <dougkwan@google.com>
3318
3319         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3320         (Arm_relobj::do_relocate_sections): Add new parameter for output
3321         file to match the parent.
3322         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3323         of local symbols instead of input values.  Update code to track
3324         changes in gold::relocate_section.
3325         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3326         (Sized_relobj::compute_final_local_value_internal): New methods.
3327         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3328         body into private version of Sized_relobj::compute_final_local_value.
3329         Call the inline method.
3330         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3331         merged symbol value if there is one.
3332         (Symbol_value::has_output_value): New method defintiion.
3333         (Sized_relobj::Compute_final_local_value_status): New enum type.
3334         (Sized_relobj::compute_final_local_value): New methods.
3335         (Sized_relobj::compute_final_local_value_internal): New methods.
3336         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3337         and arm_cortex_a8.sh.
3338         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3339         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3340         New tests.
3341         * Makefile.in: Regenerate.
3342         * testsuite/arm_bl_out_of_range.s: Update test.
3343         * testsuite/thumb_bl_out_of_range.s: Ditto.
3344         * testsuite/thumb_blx_out_of_range.s: Ditto.
3345         * testsuite/arm_branch_out_of_range.sh: New file.
3346         * testsuite/arm_cortex_a8.sh: Ditto.
3347         * testsuite/arm_cortex_a8_b.s: Ditto.
3348         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3349         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3350         * testsuite/arm_cortex_a8_bl.s: Ditto.
3351         * testsuite/arm_cortex_a8_blx.s: Ditto.
3352         * testsuite/arm_cortex_a8_local.s: Ditto.
3353         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3354         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3355
3356 2010-09-08  Rafael Espindola  <espindola@google.com>
3357
3358         * Makefile.am (memory_test.stdout): Run readelf with -W.
3359         * Makefile.in: Regenerate.
3360         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3361         64 bit output.
3362
3363 2010-09-08  Rafael Espindola  <espindola@google.com>
3364
3365         * script-sections.cc (Script_sections::add_memory_region): Convert
3366         field precision to int.
3367         * script.cc (script_set_section_region, script_set_section_region):
3368         Convert field precision to int.
3369
3370 2010-09-08  Rafael Espindola  <espindola@google.com>
3371
3372         * arm.cc (do_finalize_sections): Create the __exidx_start and
3373         __exdix_end symbols even when the section is missing.
3374
3375 2010-09-08  Nick Clifton  <nickc@redhat.com>
3376
3377         * README: Remove claim that MEMORY is not supported.
3378         * expression.cc (script_exp_function_origin)
3379         (script_exp_function_length): Move from here to ...
3380         * script.cc: ... here.
3381         (script_set_section_region, script_add_memory)
3382         (script_parse_memory_attr, script_include_directive): New
3383         functions.
3384         * script-sections.cc
3385         (class Memory_region): New class.
3386         (class Output_section_definition): Add set_memory_region,
3387         set_section_vma, set_section_lma and get_section_name methods.
3388         (class Script_Sections): Add add_memory_region,
3389         find_memory_region, find_memory_region_origin,
3390         find_memory_region_length and set_memory_region methods.
3391         Have set_section_addresses method walk the list of set memory
3392         regions.
3393         Extend the print methos to display memory regions.
3394         * script-sections.h: Add prototypes for new methods.
3395         Add enum for MEMORY region attributes.
3396         * yyscript.y: Add support for parsing MEMORY regions.
3397         * script-c.h: Add prototypes for new functions.
3398         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3399         * testsuite/Makefile.in: Regenerate.
3400         * testsuite/memory_test.sh: New script.
3401         * testsuite/memory_test.s: New assembler source file.
3402         * testsuite/memory_test.t: New linker script.
3403
3404 2010-08-27  Doug Kwan  <dougkwan@google.com>
3405
3406         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3407         reference override an existing dynamic weak reference.
3408         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3409         * testsuite/Makefile.in: Regenerate.
3410         * testsuite/dyn_weak_ref.sh: New file.
3411         * testsuite/dyn_weak_ref_1.c: Ditto.
3412         * testsuite/dyn_weak_ref_2.c: Ditto.
3413
3414 2010-08-27  Ian Lance Taylor  <iant@google.com>
3415
3416         * incremental.h (class Incremental_input_entry): Add virtual
3417         destructor.
3418
3419 2010-08-27  Ian Lance Taylor  <iant@google.com>
3420
3421         * testsuite/start_lib_test_3.c: Mark t3 as used.
3422
3423 2010-08-27  Nick Clifton  <nickc@redhat.com>
3424
3425         * options.cc (version_script): Fix small typo in previous
3426         whitespace tidyup.
3427
3428 2010-08-25  Nick Clifton  <nickc@redhat.com>
3429
3430         * archive.cc: Formatting fixes: Remove whitespace between
3431         typename and following asterisk.  Remove whitespace between
3432         function name and opening parenthesis.
3433         * archive.h: Likewise.
3434         * arm.cc: Likewise.
3435         * attributes.cc: Likewise.
3436         * attributes.h: Likewise.
3437         * common.cc: Likewise.
3438         * copy-relocs.cc: Likewise.
3439         * dirsearch.h: Likewise.
3440         * dynobj.cc: Likewise.
3441         * ehframe.cc: Likewise.
3442         * ehframe.h: Likewise.
3443         * expression.cc: Likewise.
3444         * fileread.cc: Likewise.
3445         * fileread.h: Likewise.
3446         * gc.h: Likewise.
3447         * gold-threads.cc: Likewise.
3448         * gold.cc: Likewise.
3449         * i386.cc: Likewise.
3450         * icf.h: Likewise.
3451         * incremental-dump.cc: Likewise.
3452         * incremental.cc: Likewise.
3453         * layout.cc: Likewise.
3454         * layout.h: Likewise.
3455         * main.cc: Likewise.
3456         * merge.cc: Likewise.
3457         * merge.h: Likewise.
3458         * object.cc: Likewise.
3459         * object.h: Likewise.
3460         * options.cc: Likewise.
3461         * options.h: Likewise.
3462         * output.cc: Likewise.
3463         * output.h: Likewise.
3464         * plugin.cc: Likewise.
3465         * plugin.h: Likewise.
3466         * powerpc.cc: Likewise.
3467         * reloc.cc: Likewise.
3468         * script-c.h: Likewise.
3469         * script-sections.cc: Likewise.
3470         * script.cc: Likewise.
3471         * stringpool.cc: Likewise.
3472         * symtab.cc: Likewise.
3473         * symtab.h: Likewise.
3474         * target.cc: Likewise.
3475         * timer.cc: Likewise.
3476         * timer.h: Likewise.
3477         * version.cc: Likewise.
3478         * x86_64.cc: Likewise.
3479
3480 2010-08-24  Nick Clifton  <nickc@redhat.com>
3481
3482         PR 11899
3483         * layout.cc (segment_precedes): Sort segments by their physical
3484         addresses, if they have been set.
3485
3486 2010-08-23  Cary Coutant  <ccoutant@google.com>
3487
3488         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3489         symbols data.
3490         (Lib_group::include_member): Unlock object after deleting its
3491         symbols data.
3492         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3493         the bug fixed here.
3494
3495 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3496             Cary Coutant  <ccoutant@google.com>
3497
3498         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3499         constructor, and set_blocker.
3500         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3501         readsyms_blocker_.
3502         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3503         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3504         * testsuite/Makefile.am (start_lib_test): New test case.
3505         * testsuite/Makefile.in: Regenerate.
3506         * testsuite/start_lib_test_main.c: New file.
3507         * testsuite/start_lib_test_1.c: New file.
3508         * testsuite/start_lib_test_2.c: New file.
3509         * testsuite/start_lib_test_3.c: New file.
3510
3511 2010-08-19  Ian Lance Taylor  <iant@google.com>
3512
3513         * Makefile.in: Rebuild with automake 1.11.1.
3514         * aclocal.m4: Likewise.
3515         * testsuite/Makefile.in: Likewise.
3516
3517 2010-08-19  Ian Lance Taylor  <iant@google.com>
3518
3519         PR 10893
3520         * i386.cc (class Output_data_plt_i386): Update declarations.
3521         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3522         local_ifuncs_ fields.
3523         (Target_i386::do_plt_section_for_global): New function.
3524         (Target_i386::do_plt_section_for_local): New function.
3525         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3526         parameter; change all callers.  Initialize global_ifuncs_ and
3527         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3528         __rel_iplt_end.
3529         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3530         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3531         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3532         symbols.
3533         (Target_i386::make_plt_section): New function, broken out of
3534         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3535         (Target_i386::make_plt_entry): Call make_plt_section.
3536         (Target_i386::make_local_ifunc_plt_entry): New function.
3537         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3538         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3539         R_386_IRELATIVE to switch.
3540         (Target_i386::Scan::global): Likewise.
3541         (Target_i386::Relocate::relocate): Likewise.
3542         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3543         switch.
3544         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3545         (Target_x86_64::do_plt_section_for_global): New function.
3546         (Target_x86_64::do_plt_section_for_local): New function.
3547         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3548         parameter; change all callers.  If doing a static link define
3549         __rela_iplt_start and __rela_iplt_end.
3550         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3551         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3552         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3553         to point to .plt.
3554         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3555         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3556         switch.
3557         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3558         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3559         R_X86_64_IRELATIVE to switch.
3560         (Target_x86_64::Scan::global): Likewise.
3561         (Target_x86_64::Relocate::relocate): Likewise.
3562         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3563         switch.
3564         * target.h (class Target): Add plt_section_for_global and
3565         plt_section_for_local functions.  Add do_plt_section_for_global
3566         and do_plt_section_for_local virtual functions.
3567         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3568         clarifying comments.
3569         (Symbol::use_plt_offset): Handle IFUNC symbol.
3570         * object.cc (Sized_relobj::Sized_relobj): Initialize
3571         local_plt_offsets_.
3572         (Sized_relobj::local_has_plt_offset): New function.
3573         (Sized_relobj::local_plt_offset): New function.
3574         (Sized_relobj::set_local_plt_offset): New function.
3575         (Sized_relobj::do_count): Handle IFUNC symbol.
3576         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3577         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3578         is_ifunc_symbol functions.
3579         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3580         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3581         local_plt_offsets_ field.
3582         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3583         * output.h (class Output_section_data): Add non-const
3584         output_section function.
3585         (class Output_data_got): Update declarations.
3586         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3587         Add use_plt_offset parameter to global and local constructors.
3588         Change all callers.  Change local_sym_index_ field to 31 bits.
3589         Change GSYM_CODE and CONSTANT_CODE accordingly.
3590         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3591         doing a static link don't set sh_link field.
3592         (Output_data_got::Got_entry::write): Use PLT offset if
3593         appropriate.
3594         (Output_data_got::add_global_plt): New function.
3595         (Output_data_got::add_local_plt): New function.
3596         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3597         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3598         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3599         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3600         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3601         IFUNC conditional.
3602         * testsuite/ifunc-sel.h: New file.
3603         * testsuite/ifuncmain1.c: New file.
3604         * testsuite/ifuncmain1vis.c: New file.
3605         * testsuite/ifuncmod1.c: New file.
3606         * testsuite/ifuncdep2.c: New file.
3607         * testsuite/ifuncmain2.c: New file.
3608         * testsuite/ifuncmain3.c: New file.
3609         * testsuite/ifuncmod3.c: New file.
3610         * testsuite/ifuncmain4.c: New file.
3611         * testsuite/ifuncmain5.c: New file.
3612         * testsuite/ifuncmod5.c: New file.
3613         * testsuite/ifuncmain6pie.c: New file.
3614         * testsuite/ifuncmod6.c: New file.
3615         * testsuite/ifuncmain7.c: New file.
3616         * configure, testsuite/Makefile.in: Rebuild.
3617
3618 2010-08-18  Ian Lance Taylor  <iant@google.com>
3619
3620         * incremental.cc
3621         (Output_section_incremental_inputs::write_input_files): Add cast
3622         to avoid signed/unsigned comparison warning.
3623         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3624
3625 2010-08-12  Cary Coutant  <ccoutant@google.com>
3626
3627         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3628
3629 2010-08-13  Ian Lance Taylor  <iant@google.com>
3630
3631         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3632
3633 2010-08-12  Cary Coutant  <ccoutant@google.com>
3634             Doug Kwan  <dougkwan@google.com>
3635
3636         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3637         defintion overrides non-weak undef, remember that the original undef
3638         is not weak.
3639         * symtab.cc (Symbol_table::sized_write_global): For undef without
3640         an original weak binding, set binding to global in output.
3641         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3642         * testsuite/Makefile.in: Regenerate.
3643         * testsuite/strong_ref_weak_def.sh: New file.
3644         * testsuite/strong_ref_weak_def_1.c: Ditto.
3645         * testsuite/strong_ref_weak_def_2.c: Ditto.
3646
3647 2010-08-12  Cary Coutant  <ccoutant@google.com>
3648
3649         * testsuite/incremental_test.sh: Rewrite.
3650         * testsuite/incremental_test_1.c: Rewrite.
3651         * testsuite/incremental_test_2.c: Rewrite.
3652
3653 2010-08-12  Cary Coutant  <ccoutant@google.com>
3654
3655         * arm.cc (Target_arm::got_size): Add const.
3656         (Target_arm::got_entry_count): New function.
3657         (Target_arm::plt_entry_count): New function.
3658         (Target_arm::first_plt_entry_offset): New function.
3659         (Target_arm::plt_entry_size): New function.
3660         (Output_data_plt_arm::entry_count): New function.
3661         (Output_data_plt_arm::first_plt_entry_offset): New function.
3662         (Output_data_plt_arm::get_plt_entry_size): New function.
3663         * i386.cc (Target_i386::got_size): Add const.
3664         (Target_i386::got_entry_count): New function.
3665         (Target_i386::plt_entry_count): New function.
3666         (Target_i386::first_plt_entry_offset): New function.
3667         (Target_i386::plt_entry_size): New function.
3668         (Output_data_plt_i386::entry_count): New function.
3669         (Output_data_plt_i386::first_plt_entry_offset): New function.
3670         (Output_data_plt_i386::get_plt_entry_size): New function.
3671         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3672         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3673         * incremental.cc: Include target.h.
3674         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3675         parameter.  Adjust all callers.  Find incremental_got_plt section.
3676         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3677         section.
3678         (Output_section_incremental_inputs::set_final_data_size): Calculate
3679         size of incremental_got_plt section.
3680         (Output_section_incremental_inputs::do_write): Write the
3681         incremental_got_plt section.
3682         (Got_plt_view_info): New struct.
3683         (Local_got_offset_visitor): New class.
3684         (Global_got_offset_visitor): New class.
3685         (Global_symbol_visitor_got_plt): New class.
3686         (Output_section_incremental_inputs::write_got_plt): New function.
3687         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3688         Add parameter.  Adjust all callers.
3689         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3690         (Incremental_inputs::got_plt_section): New function.
3691         (Incremental_inputs::got_plt_section_): New data member.
3692         (Incremental_got_plt_reader): New class.
3693         * layout.cc (Layout::create_incremental_info_sections): Add the
3694         incremental_got_plt section.
3695         * object.h (Got_offset_list::get_list): New function.
3696         (Got offset_list::for_all_got_offsets): New function.
3697         (Sized_relobj::local_got_offset_list): New function.
3698         * powerpc.cc (Target_powerpc::got_size): Add const.
3699         (Target_powerpc::got_entry_count): New function.
3700         (Target_powerpc::plt_entry_count): New function.
3701         (Target_powerpc::first_plt_entry_offset): New function.
3702         (Target_powerpc::plt_entry_size): New function.
3703         (Output_data_plt_powerpc::entry_count): New function.
3704         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3705         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3706         * sparc.cc (Target_sparc::got_size): Add const.
3707         (Target_sparc::got_entry_count): New function.
3708         (Target_sparc::plt_entry_count): New function.
3709         (Target_sparc::first_plt_entry_offset): New function.
3710         (Target_sparc::plt_entry_size): New function.
3711         (Output_data_plt_sparc::entry_count): New function.
3712         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3713         (Output_data_plt_sparc::get_plt_entry_size): New function.
3714         * symtab.h (Symbol::got_offset_list): New function.
3715         (Symbol_table::for_all_symbols): New function.
3716         * target.h (Sized_target::got_entry_count): New function.
3717         (Sized_target::plt_entry_count): New function.
3718         (Sized_target::plt_entry_size): New function.
3719         * x86_64.cc (Target_x86_64::got_size): Add const.
3720         (Target_x86_64::got_entry_count): New function.
3721         (Target_x86_64::plt_entry_count): New function.
3722         (Target_x86_64::first_plt_entry_offset): New function.
3723         (Target_x86_64::plt_entry_size): New function.
3724         (Output_data_plt_x86_64::entry_count): New function.
3725         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3726         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3727
3728 2010-08-12  Cary Coutant  <ccoutant@google.com>
3729
3730         * archive.cc: Include incremental.h.
3731         (Archive::Archive): Initialize incremental_info_.
3732         (Archive::include_member): Record archive members in incremental info.
3733         (Add_archive_symbols::run): Record begin and end of an archive in
3734         incremental info.
3735         (Lib_group::include_member): Record objects in incremental info.
3736         * archive.h (Incremental_archive_entry): Forward declaration.
3737         (Archive::set_incremental_info): New member function.
3738         (Archive::incremental_info): New member function.
3739         (Archive::Unused_symbol_iterator): New class.
3740         (Archive::unused_symbols_begin): New member function.
3741         (Archive::unused_symbols_end): New member function.
3742         (Archive::incremental_info_): New data member.
3743         * incremental-dump.cc (find_input_containing_global): New function.
3744         (dump_incremental_inputs): Dump new incremental info sections.
3745         * incremental.cc: Include symtab.h.
3746         (Output_section_incremental_inputs): New class.
3747         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3748         new incremental info sections.
3749         (Sized_incremental_binary::do_check_inputs): Likewise.
3750         (Incremental_inputs::report_archive): Remove.
3751         (Incremental_inputs::report_archive_begin): New function.
3752         (Incremental_inputs::report_archive_end): New function.
3753         (Incremental_inputs::report_object): New function.
3754         (Incremental_inputs::finalize_inputs): Remove.
3755         (Incremental_inputs::report_input_section): New function.
3756         (Incremental_inputs::report_script): Rewrite.
3757         (Incremental_inputs::finalize): Do nothing but finalize string table.
3758         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3759         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3760         (Incremental_inputs::create_data_sections): New function.
3761         (Incremental_inputs::relocs_entsize): New function.
3762         (Output_section_incremental_inputs::set_final_data_size): New function.
3763         (Output_section_incremental_inputs::do_write): New function.
3764         (Output_section_incremental_inputs::write_header): New function.
3765         (Output_section_incremental_inputs::write_input_files): New function.
3766         (Output_section_incremental_inputs::write_info_blocks): New function.
3767         (Output_section_incremental_inputs::write_symtab): New function.
3768         * incremental.h (Incremental_script_entry): Forward declaration.
3769         (Incremental_object_entry): Forward declaration.
3770         (Incremental_archive_entry): Forward declaration.
3771         (Incremental_inputs): Forward declaration.
3772         (Incremental_inputs_header_data): Remove.
3773         (Incremental_inputs_header): Remove.
3774         (Incremental_inputs_header_write): Remove.
3775         (Incremental_inputs_entry_data): Remove.
3776         (Incremental_inputs_entry): Remove.
3777         (Incremental_inputs_entry_write): Remove.
3778         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3779         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3780         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3781         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3782         Likewise.
3783         (Incremental_input_entry): New class.
3784         (Incremental_script_entry): New class.
3785         (Incremental_object_entry): New class.
3786         (Incremental_archive_entry): New class.
3787         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3788         (Incremental_inputs::report_inputs): Remove.
3789         (Incremental_inputs::report_archive): Remove.
3790         (Incremental_inputs::report_archive_begin): New function.
3791         (Incremental_inputs::report_archive_end): New function.
3792         (Incremental_inputs::report_object): Change prototype.
3793         (Incremental_inputs::report_input_section): New function.
3794         (Incremental_inputs::report_script): Change prototype.
3795         (Incremental_inputs::get_reloc_count): New function.
3796         (Incremental_inputs::set_reloc_count): New function.
3797         (Incremental_inputs::create_data_sections): New function.
3798         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3799         (Incremental_inputs::inputs_section): New function.
3800         (Incremental_inputs::symtab_section): New function.
3801         (Incremental_inputs::relocs_section): New function.
3802         (Incremental_inputs::get_stringpool): Add const.
3803         (Incremental_inputs::command_line): Add const.
3804         (Incremental_inputs::inputs): Remove.
3805         (Incremental_inputs::command_line_key): New function.
3806         (Incremental_inputs::input_file_count): New function.
3807         (Incremental_inputs::input_files): New function.
3808         (Incremental_inputs::relocs_entsize): New function.
3809         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3810         (Incremental_inputs::finalize_inputs): Remove.
3811         (Incremental_inputs::Input_info): Remove.
3812         (Incremental_inputs::lock_): Remove.
3813         (Incremental_inputs::inputs_): Change type.
3814         (Incremental_inputs::inputs_map_): Remove.
3815         (Incremental_inputs::current_object_entry_): New data member.
3816         (Incremental_inputs::inputs_section_): New data member.
3817         (Incremental_inputs::symtab_section_): New data member.
3818         (Incremental_inputs::relocs_section_): New data member.
3819         (Incremental_inputs::reloc_count_): New data member.
3820         (Incremental_inputs_reader): New class.
3821         (Incremental_symtab_reader): New class.
3822         (Incremental_relocs_reader): New class.
3823         * layout.cc (Layout::finalize): Move finalization of incremental info
3824         and creation of incremental info sections to follow finalization of
3825         symbol table.  Set offsets for postprocessing sections.
3826         (Layout::create_incremental_info_sections): Call
3827         Incremental_inputs::create_data_sections.  Add incremental symtab
3828         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3829         sections to layout after input sections.
3830         * layout.h (struct Timespec): Forward declaration.
3831         (Layout::incremental_inputs): Add const.
3832         (Layout::create_incremental_info_sections): Add parameter.
3833         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3834         * object.cc: Include incremental.h.
3835         (Relobj::finalize_incremental_relocs): New function.
3836         (Sized_relobj::do_layout): Record input sections in incremental info.
3837         * object.h (Object::output_section): New function.
3838         (Object::output_section_offset): Moved from Relobj.
3839         (Object::get_incremental_reloc_base): New function.
3840         (Object::get_incremental_reloc_count): New function.
3841         (Object::do_output_section): New function.
3842         (Object::do_output_section_offset): Moved from Relobj.
3843         (Object::do_get_incremental_reloc_base): New function.
3844         (Object::do_get_incremental_reloc_count): New function.
3845         (Object::Object): Initialize new data members.
3846         (Relobj::output_section): Renamed do_output_section and moved to
3847         protected.
3848         (Relobj::output_section_offset): Moved to Object.
3849         (Relobj::do_get_incremental_reloc_base): New function.
3850         (Relobj::do_get_incremental_reloc_count): New function.
3851         (Relobj::allocate_incremental_reloc_counts): New function.
3852         (Relobj::count_incremental_reloc): New function.
3853         (Relobj::finalize_incremental_relocs): New function.
3854         (Relobj::next_incremental_reloc_index): New function.
3855         (Relobj::reloc_counts_): New data member.
3856         (Relobj::reloc_bases_): New data member.
3857         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3858         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3859         (Sized_relobj::incremental_relocs_scan): New function.
3860         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3861         (Sized_relobj::incremental_relocs_write): New function.
3862         (Sized_relobj::incremental_relocs_write_reltype): New function.
3863         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3864         incremental link.
3865         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3866         archives and object files elsewhere.
3867         (Add_symbols::run): Report object files here.
3868         (Finish_group::run): Report end of archive at end of group.
3869         * reloc.cc: Include layout.h, incremental.h.
3870         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3871         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3872         (Sized_relobj::incremental_relocs_scan): New function.
3873         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3874         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3875         (Sized_relobj::incremental_relocs_write): New function.
3876         (Sized_relobj::incremental_relocs_write_reltype): New function.
3877         * script.cc (read_input_script): Rewrite test for incremental link.
3878         Change call to Incremental_inputs::report_script.
3879         * symtab.h (Symbol_table::first_global_index): New function.
3880         (Symbol_table::output_count): New function.
3881
3882 2010-08-12  Doug Kwan  <dougkwan@google.com>
3883
3884         * arm.cc (Target_arm::merge_object_attributes): Check command line
3885         options --no-wchar-size-warning and --no-enum-size-warning.
3886         * options.h (General_options): Add ld-compatible options
3887         --no-enum-size-warning and --no-wchar-size-warning.
3888
3889 2010-08-04  Ian Lance Taylor  <iant@google.com>
3890
3891         * x86_64.cc (Target_x86_64::Scan::local): Use
3892         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3893         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3894         (Target_x86_64::Scan::global): Likewise.
3895         (Target_x86_64::Relocate::relocate): Likewise.
3896         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3897         Likewise.
3898
3899 2010-08-03  Cary Coutant  <ccoutant@google.com>
3900
3901         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3902         to reserve space in merged_strings vector. Keep total input size
3903         for stats.
3904         (Output_merge_string::do_print_merge_stats): Print total input size.
3905         * merge.h (Output_merge_string): Add input_size_ field.
3906         * stringpool.cc (Stringpool_template::string_length): Move
3907         implementations out of Stringpool_template class and place in
3908         stringpool.h.
3909         * stringpool.h (string_length): Move out of Stringpool_template.
3910
3911 2010-08-03  Ian Lance Taylor  <iant@google.com>
3912
3913         PR 11712
3914         * layout.cc (relaxation_loop_body): If address of load segment is
3915         set, adjust address to include headers if possible.
3916
3917 2010-08-03  Ian Lance Taylor  <iant@google.com>
3918
3919         * version.cc (version_string): Bump to 1.10.
3920
3921 2010-08-03  Ian Lance Taylor  <iant@google.com>
3922
3923         PR 11805
3924         * layout.h (enum Output_section_order): Define.
3925         (class Layout): Update declarations.
3926         * layout.cc (Layout::get_output_section): Add order parameter.
3927         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3928         is_first_non_relro parameters.  Change all callers.
3929         (Layout::choose_output_section): Likewise.
3930         (Layout::add_output_section_data): Likewise.
3931         (Layout::make_output_section): Likewise.  Set order.
3932         (Layout::default_section_order): New function.
3933         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3934         * output.cc (Output_section::Output_section): Initialize order_.
3935         Don't initialize deleted fields.
3936         (Output_segment::Output_segment): Don't initialize deleted
3937         fields.
3938         (Output_segment::add_output_section_to_load): New function
3939         replacing add_output_section.  Change all callers to call this or
3940         add_output_section_to_nonload.
3941         (Output_segment::add_output_section_to_nonload): New function.
3942         (Output_segment::remove_output_section): Rewrite.
3943         (Output_segment::add_initial_output_data): Likewise.
3944         (Output_segment::has_any_data_sections): Likewise.
3945         (Output_segment::is_first_section_relro): Likewise.
3946         (Output_segment::maximum_alignment): Likewise.
3947         (Output_segment::has_dynamic_reloc): New function replacing
3948         dynamic_reloc_count.  Change all callers.
3949         (Output_segment::has_dynamic_reloc_list): New function replacing
3950         dynamic_reloc_count_list.  Change all callers.
3951         (Output_segment::set_section_addresses): Rewrite.
3952         (Output_segment::set_offset): Rewrite.
3953         (Output_segment::find_first_and_last_list): Remove.
3954         (Output_segment::set_tls_offsets): Rewrite.
3955         (Output_segment::first_section_load_address): Likewise.
3956         (Output_segment::output_section_count): Likewise.
3957         (Output_segment::section_with_lowest_load_address): Likewise.
3958         (Output_segment::write_section_headers): Likewise.
3959         (Output_segment::print_sections_to_map): Likewise.
3960         * output.h (class Output_data): Remove dynamic_reloc_count_
3961         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3962         (Output_data::add_dynamic_reloc): Rewrite.
3963         (Output_data::has_dynamic_reloc): New function.
3964         (Output_data::dynamic_reloc_count): Remove.
3965         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3966         is_last_relro_, is_first_non_relro_, is_interp_,
3967         is_dynamic_linker_section_ fields.  Add order and set_order
3968         functions.  Remove is_relro_local, set_is_relro_local,
3969         is_last_relro, set_is_last_relro, is_first_non_relro,
3970         set_is_first_non_relro functions, is_interp, set_is_interp,
3971         is_dynamic_linker_section, and set_is_dynamic_linker_section
3972         functions.
3973         (class Output_segment): Change Output_data_list from std::list to
3974         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3975         output_bss_ fields.  Update declarations.
3976
3977 2010-08-02  Ian Lance Taylor  <iant@google.com>
3978
3979         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3980         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3981         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3982
3983 2010-08-02  Ian Lance Taylor  <iant@google.com>
3984
3985         PR 11855
3986         * script.cc (Script_options::Script_options): Initialize
3987         symbol_definitions_ and symbol_references_.
3988         (Script_options::add_symbol_assignment): Update
3989         symbol_definitions_ and symbol_references_.
3990         (Script_options::add_symbol_reference): New function.
3991         (script_symbol): New function.
3992         * script.h (class Script_options): Add symbol_definitions_ and
3993         symbol_references_ fields.
3994         (Script_options::referenced_const_iterator): New type.
3995         (Script_options::referenced_begin): New function.
3996         (Script_options::referenced_end): New function.
3997         (Script_options::is_referenced): New function.
3998         (Script_options::any_unreferenced): New function.
3999         * script-c.h (script_symbol): Declare.
4000         * yyscript.y (exp): Call script_symbol.
4001         * symtab.cc: Include "script.h".
4002         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4003         Change all callers.  Check symbols referenced by scripts.
4004         (Symbol_table::add_undefined_symbols_from_command_line): Add
4005         layout parameter.  Change all callers.
4006         (Symbol_table::do_add_undefined_symbols_from_command_line):
4007         Likewise.  Break out loop body.  Check symbols referenced by
4008         scripts.
4009         (Symbol_table::add_undefined_symbol_from_command_line): New
4010         function broken out of
4011         do_add_undefined_symbols_from_command_line.
4012         * symtab.h (class Symbol_table): Update declarations.
4013         * archive.cc: Include "layout.h".
4014         (Archive::should_include_member): Add layout parameter.  Change
4015         all callers.  Check for symbol mentioned in expression.
4016         * archive.h (class Archive): Update declaration.
4017         * object.cc (Sized_relobj::do_should_include_member): Add layout
4018         parameter.
4019         * object.h (Object::should_include_member): Add layout parameter.
4020         Change all callers.
4021         (Object::do_should_include_member): Add layout parameter.
4022         (class Sized_relobj): Update declaration.
4023         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4024         parameter.
4025         * dynobj.h (class Sized_dynobj): Update declaration.
4026         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4027         layout parameter.
4028         * plugin.h (class Sized_pluginobj): Update declaration.
4029
4030 2010-08-02  Ian Lance Taylor  <iant@google.com>
4031
4032         PR 11866
4033         * output.cc (Output_segment::set_offset): Search for the first and
4034         last sections rather than assuming that the list is in order.
4035         (Output_segment::find_first_and_last_list): New function.
4036         * output.h (class Output_segment): Update declarations.
4037         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4038         (relro_strip_test_SOURCES): New variable.
4039         (relro_strip_test_DEPENDENCIES): New variable.
4040         (relro_strip_test_LDFLAGS): New variable.
4041         (relro_strip_test_LDADD): New variable.
4042         (relro_strip_test.so): New target.
4043
4044 2010-08-02  Ian Lance Taylor  <iant@google.com>
4045
4046         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4047         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4048         (Target_i386::got_tlsdesc_section): New function.
4049         (Target_i386::got_section): Create space for GOT entries for
4050         TLSDESC relocations.
4051         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4052         R_386_TLS_GOTDESC.
4053         (Target_i386::Scan::global): Likewise.
4054         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4055         using TLSDESC GOT.
4056         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4057         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4058         (Target_x86_64::got_tlsdesc_section): New function.
4059         (Target_x86_64::got_section): Create space for GOT entries for
4060         TLSDESC relocations.
4061         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4062         R_386_TLS_GOTDESC.
4063         (Target_x86_64::Scan::global): Likewise.
4064         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4065         using TLSDESC GOT.
4066
4067 2010-08-02  Ian Lance Taylor  <iant@google.com>
4068
4069         * testsuite/final_layout.sh: Use dc to convert from hex to
4070         decimal.
4071
4072 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4073
4074         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4075         paramter to the call to gold::gc_process_relocs.
4076         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4077         paramter to the call to gold::gc_process_relocs.
4078         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4079         parameter to the call to gold::gc_process_relocs.
4080         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4081         template parameter to the call to gold::gc_process_relocs.
4082         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4083         paramter to the call to gold::gc_process_relocs.
4084         * gc.h (get_embedded_addend_size): New function.
4085         (gc_process_relocs): Save the size of the reloc for use by ICF.
4086         * icf.cc (get_section_contents): Get the addend from the text section
4087         for SHT_REL relocation sections.
4088         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4089         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4090         * int_encoding.h (read_from_pointer): New overloaded function.
4091         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4092         * testsuite/icf_sht_rel_addend_test.sh: New file.
4093         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4094         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4095
4096 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4097
4098         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4099         * Makefile.in: Regenerate.
4100         * testsuite/Makefile.in: Regenerate.
4101
4102 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4103
4104         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4105         * gold/testsuite/debug_msg.cc: Likewise.
4106         * gold/testsuite/odr_violation1.cc
4107         * gold/testsuite/odr_violation2.cc
4108
4109 2010-07-21  Cary Coutant  <ccoutant@google.com>
4110
4111         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4112         string, and length fields.
4113         (Output_merge_string::Merged_strings_list): New type.
4114         (Output_merge_string::Merged_strings_lists): New typedef.
4115         (Output_merge_string): Replace merged_strings_ with
4116         merged_strings_lists_.
4117         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4118         Merged_strings_list per input object and section.  Don't store pointer
4119         to the string.  Don't store length with each merged string entry.
4120         (Output_merge_string::finalize_merged_data): Loop over list of merged
4121         strings lists.  Recompute length of each merged string.
4122
4123 2010-07-15  Cary Coutant  <ccoutant@google.com>
4124
4125         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4126         here.
4127
4128 2010-07-14  Ian Lance Taylor  <iant@google.com>
4129
4130         * descriptors.cc (Descriptors::open): Report correct name in error
4131         message.
4132
4133 2010-07-13  Doug Kwan  <dougkwan@google.com>
4134
4135         * arm.cc (Arm_input_section::Arm_input_section): For a
4136         SHT_ARM_EXIDX section, always keeps the input sections.
4137         (Arm_input_section::set_exidx_section_link): New method.
4138         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4139         has_errors_ to false.
4140         (Arm_exidx_input_section::has_errors,
4141         Arm_exidx_input_section::set_has_errors): New methods.
4142         (Arm_exidx_input_section::has_errors_): New data member.
4143         (Arm_relobj::get_exidx_shndx_list): New method.
4144         (Arm_output_section::append_text_sections_to_list): Do not skip
4145         section without SHF_EXECINSTR.
4146         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4147         errors.
4148         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4149         section header.  Make error messages more verbose.  Check for
4150         a non-executable section linked to an EXIDX section.
4151         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4152         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4153         check that there is no deferred EXIDX section if we exit early.
4154         Instead of not making an EXIDX section in case of an error, make one
4155         and set the has_errors flag of it.
4156         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4157         in a relocatable link.
4158         (Target_arm::do_relax): Look for the EXIDX output section instead of
4159         assuming that it is called .ARM.exidx.
4160         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4161         section list.  Do not check for SHF_EXECINSTR section flags but
4162         skip any input section with errors.
4163         * output.cc (Output_section::Output_section): Initialize
4164         always_keeps_input_sections_ to false.
4165         (Output_section::add_input_section): Check for
4166         always_keeps_input_sections_.
4167         *  output.h (Output_section::always_keeps_input_sections,
4168         Output_section::set_always_keeps_input_sections): New methods.
4169         (Output_section::always_keeps_input_sections): New data member.
4170
4171 2010-07-13  Rafael Espindola  <espindola@google.com>
4172
4173         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4174         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4175
4176 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4177             Ian Lance Taylor  <iant@google.com>
4178
4179         * output.h (Output_section_lookup_maps::add_merge_section):
4180         Correct check of whether value was inserted.
4181         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4182         (Output_section_lookup_maps::add_relaxed_input_section):
4183         Likewise.
4184         * arm.cc (Target_arm::got_section): Remove used local os.
4185         * i386.cc (Target_i386::got_section): Likewise.
4186         * x86_64.cc (Target_x86_64::got_section): Likewise.
4187         * sparc.cc (Target_sparc::got_section): Likewise.
4188         (Target_sparc::relocate): Remove unused local have_got_offset.
4189         * powerpc.cc (Target_powerpc::relocate): Likewise.
4190
4191 2010-07-13  Ian Lance Taylor  <iant@google.com>
4192
4193         * compressed_output.cc (zlib_decompress): Fix signature in
4194         !HAVE_ZLIB_H case.
4195
4196         * archive.cc (Archive::include_member): Unlock an external member
4197         of a thin archive.  Don't bother to delete an object we know is
4198         NULL.
4199
4200 2010-07-12  Cary Coutant  <ccoutant@google.com>
4201
4202         * compressed_output.cc (zlib_decompress): New function.
4203         (get_uncompressed_size): New function.
4204         (decompress_input_section): New function.
4205         * compressed_output.h (get_uncompressed_size): New function.
4206         (decompress_input_section): New function.
4207         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4208         Handle compressed debug sections.
4209         * layout.cc (is_compressed_debug_section): New function.
4210         (Layout::output_section_name): Map compressed section names to
4211         canonical names.
4212         * layout.h (is_compressed_debug_section): New function.
4213         (is_debug_info_section): Recognize compressed debug sections.
4214         * merge.cc: Include compressed_output.h.
4215         (Output_merge_data::do_add_input_section): Handle compressed
4216         debug sections.
4217         (Output_merge_string::do_add_input_section): Handle compressed
4218         debug sections.
4219         * object.cc: Include compressed_output.h.
4220         (Sized_relobj::Sized_relobj): Initialize new data members.
4221         (build_compressed_section_map): New function.
4222         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4223         * object.h (Object::section_is_compressed): New method.
4224         (Object::do_section_is_compressed): New method.
4225         (Sized_relobj::Compressed_section_map): New type.
4226         (Sized_relobj::do_section_is_compressed): New method.
4227         (Sized_relobj::compressed_sections_): New data member.
4228         * output.cc (Output_section::add_input_section): Handle compressed
4229         debug sections.
4230         * reloc.cc: Include compressed_output.h.
4231         (Sized_relobj::write_sections): Handle compressed debug sections.
4232
4233 2010-07-08  Cary Coutant  <ccoutant@google.com>
4234
4235         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4236         weak when resolving to a dynamic def.
4237         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4238         for weak undef/dynamic def cases. Adjust callers.
4239         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4240         undef_binding_weak_.
4241         (Symbol_table::sized_write_globals): Adjust symbol binding.
4242         (Symbol_table::sized_write_symbol): Add binding parameter.
4243         * symtab.h (Symbol::set_undef_binding): New method.
4244         (Symbol::is_undef_binding_weak): New method.
4245         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4246         (Symbol_table::should_override): Add new parameter.
4247         (Symbol_table::sized_write_symbol): Add new parameter.
4248
4249         * testsuite/weak_undef_file1.cc: Add new test case.
4250         * testsuite/weak_undef_file2.cc: Fix header comment.
4251         * testsuite/weak_undef_test.cc: Add new test case.
4252
4253 2010-06-29  Doug Kwan  <dougkwan@google.com>
4254
4255         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4256         Initialize USE_SYMBOL_.
4257         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4258         definition.
4259         (Arm_reloc_property::uses_symbol_): New data member declaration.
4260         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4261         uses symbol value and symbol is undefined but not weakly undefined.
4262
4263 2010-06-28  Rafael Espindola  <espindola@google.com>
4264
4265         * plugin.cc (Plugin::load): Use dlerror.
4266
4267 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4268
4269         * symtab.cc (detect_odr_violations): When reporting an ODR
4270         violation, report an object where the symbol is defined.
4271
4272 2010-06-25  Doug Kwan  <dougkwan@google.com>
4273
4274         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4275         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4276         definition.
4277         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4278         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4279         target hook to detect function points.
4280         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4281         * icf.h (Icf::check_section_for_function_pointers): Change type of
4282         parameter SECTION_NAME to const reference to std::string.  Use
4283         target hook to determine if section may have unsafe pointers.
4284         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4285         method definition.
4286
4287 2010-06-21  Rafael Espindola  <espindola@google.com>
4288
4289         * fileread.cc (Input_file::find_fie): New
4290         (Input_file::open): Use Input_file::find_fie.
4291         * fileread.h (Input_file::find_fie): New
4292         * plugin.cc (set_extra_library_path): New.
4293         (Plugin::load): Add set_extra_library_path to the transfer vector.
4294         (Plugin_manager::set_extra_library_path): New.
4295         (Plugin_manager::add_input_file): Use the extra search path if set.
4296         (set_extra_library_path(): New.
4297         * plugin.h (Plugin_manager): Add set_extra_library_path and
4298         extra_search_path_.
4299
4300 2010-06-19  Cary Coutant  <ccoutant@google.com>
4301
4302         * layout.cc (gdb_sections): Add .debug_types.
4303         (lines_only_debug_sections): Likewise.
4304
4305 2010-06-18  Rafael Espindola  <espindola@google.com>
4306
4307         * plugin.cc (add_input_file,add_input_library)
4308         (Plugin_manager::add_input_file): Make filename arguments const.
4309         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4310         const.
4311
4312 2010-06-16  Doug Kwan  <dougkwan@google.com>
4313
4314         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4315         .ARM.attributes section if we have not merged any input
4316         attributes sections.
4317
4318 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4319
4320         * arm.cc: Allow combining objects with no EABI version
4321         information.
4322
4323 2010-06-15  Rafael Espindola  <espindola@google.com>
4324
4325         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4326
4327 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4328
4329         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4330         (struct iovec): Correct !HAVE_READV definition.
4331
4332 2010-06-10  Cary Coutant  <ccoutant@google.com>
4333
4334         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4335         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4336         reloc sections.
4337         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4338
4339         PR 11683
4340         * symtab.h (Symbol::is_placeholder): New member function.
4341         * target-reloc.h (relocate_section): Check for placeholder symbols.
4342
4343         * testsuite/Makefile.am (plugin_test_8): New test.
4344         (plugin_test_9): New test.
4345         * testsuite/Makefile.in: Regenerate.
4346
4347 2010-06-09  Nick Clifton  <nickc@redhat.com>
4348
4349         * yyscript.y (input_list_element): Allow strings prefixed with
4350         the '-' character.  Treat these as libraries.
4351         * script.cc (script_add_library): New function.  Adds a library
4352         specified by "-l<name>" found in an input script.
4353         * script-c.h: Add prototype for script_add_library.
4354
4355 2010-06-07  Doug Kwan  <dougkwan@google.com>
4356
4357         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4358         Restrict stub-group size to be within long conditional branch
4359         range when working around cortex-A8 erratum.
4360
4361 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4362
4363         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4364         #ifdef typo.
4365
4366 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4367
4368         PR gold/11658
4369         * output.cc
4370         (Output_section::Input_section_sort_entry::compare_section_ordering):
4371         Change to return non-zero correctly.
4372         (Output_section::Input_section_sort_section_order_index_compare
4373         ::operator()): Change to fix ambiguity in comparisons.
4374
4375 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4376
4377         * gold.h (is_wildcard_string): New function.
4378         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4379         (Layout::layout_eh_frame): Ditto.
4380         (Layout::find_section_order_index): New method.
4381         (Layout::read_layout_from_file): New method.
4382         * layout.h (Layout::find_section_order_index): New method.
4383         (Layout::read_layout_from_file): New method.
4384         (Layout::input_section_position_): New private member.
4385         (Layout::input_section_glob_): New private member.
4386         * main.cc (main): Call read_layout_from_file here.
4387         * options.h (--section-ordering-file): New option.
4388         * output.cc (Output_section::input_section_order_specified_): New
4389         member.
4390         (Output_section::Output_section): Initialize new member.
4391         (Output_section::add_input_section): Add new parameter.
4392         Keep input sections when --section-ordering-file is used.
4393         (Output_section::set_final_data_size): Sort input sections when
4394         section ordering file is specified.
4395         (Output_section::Input_section_sort_entry): Add new parameter.
4396         Check sorting type.
4397         (Output_section::Input_section_sort_entry::compare_section_ordering):
4398         New method.
4399         (Output_section::Input_section_sort_compare::operator()): Change to
4400         consider section_order_index.
4401         (Output_section::Input_section_sort_init_fini_compare::operator()):
4402         Change to consider section_order_index.
4403         (Output_section::Input_section_sort_section_order_index_compare
4404         ::operator()): New method.
4405         (Output_section::sort_attached_input_sections): Change to sort
4406         according to section order when specified.
4407         (Output_section::add_input_section<32, true>): Add new parameter.
4408         (Output_section::add_input_section<64, true>): Add new parameter.
4409         (Output_section::add_input_section<32, false>): Add new parameter.
4410         (Output_section::add_input_section<64, false>): Add new parameter.
4411         * output.h (Output_section::add_input_section): Add new parameter.
4412         (Output_section::input_section_order_specified): New
4413         method.
4414         (Output_section::set_input_section_order_specified): New method.
4415         (Input_section::Input_section): Initialize section_order_index_.
4416         (Input_section::section_order_index): New method.
4417         (Input_section::set_section_order_index): New method.
4418         (Input_section::section_order_index_): New member.
4419         (Input_section::Input_section_sort_section_order_index_compare): New
4420         struct.
4421         (Output_section::input_section_order_specified_): New member.
4422         * script-sections.cc (is_wildcard_string): Delete and move modified
4423         method to gold.h.
4424         (Output_section_element_input::Output_section_element_input): Modify
4425         call to is_wildcard_string.
4426         (Output_section_element_input::Input_section_pattern
4427         ::Input_section_pattern): Ditto.
4428         (Output_section_element_input::Output_section_element_input): Ditto.
4429         * testsuite/Makefile.am (final_layout): New test case.
4430         * testsuite/Makefile.in: Regenerate.
4431         * testsuite/final_layout.cc: New file.
4432         * testsuite/final_layout.sh: New file.
4433
4434 2010-06-01  Rafael Espindola  <espindola@google.com>
4435
4436         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4437
4438 2010-06-01  Rafael Espindola  <espindola@google.com>
4439
4440         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4441         visibility of symbols.
4442
4443 2010-05-27  Doug Kwan  <dougkwan@google.com>
4444
4445         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4446         from start of output section instead of address for a local symbol
4447         in a merged or relaxed section when doing a relocatable link.
4448
4449 2010-05-26  Rafael Espindola  <espindola@google.com>
4450
4451        PR 11604
4452         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4453         adding sections the garbage collector removed.
4454         * gold/testsuite/Makefile.am: Add test.
4455         * gold/testsuite/Makefile.in: Regenerate.
4456         * gold/testsuite/plugin_test_7.sh: New.
4457         * gold/testsuite/plugin_test_7_1.c: New.
4458         * gold/testsuite/plugin_test_7_2.c: New.
4459
4460 2010-05-26  Rafael Espindola  <espindola@google.com>
4461
4462         * script-sections.cc (Output_section_definition::set_section_addresses):
4463         Check for --section-start.
4464
4465 2010-05-26  Doug Kwan  <dougkwan@google.com>
4466
4467         * arm.cc (Arm_scan_relocatable_relocs): New class.
4468         (Target_arm::relocate_special_relocatable): New method.
4469         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4470         (Arm_relocate_functions::thumb_branch_common): Same.
4471         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4472         instead of Default_scan_relocatable_relocs.
4473         * target-reloc.h (relocate_for_relocatable): Let target handle
4474         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4475         * target.h (Sized_target::relocate_special_relocatable): New method.
4476
4477 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4478
4479         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4480
4481 2010-05-23  Doug Kwan  <dougkwan@google.com>
4482
4483         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4484         instead of a cast.
4485         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4486         with a direct branch, not a conditional branch, to a stub.
4487         * merge.cc (Output_merge_base::record_input_section): New method
4488         defintion.
4489         (Output_merge_data::do_add_input_section): Record input section if
4490         keeps-input-sections flag is set.
4491         (Output_merge_string::do_add_input_section): Ditto.
4492         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4493         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4494         INPUT_SECTIONS_.
4495         (Output_merge_base::keeps_input_sections,
4496         Output_merge_base::set_keeps_input_sections,
4497         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4498         method definitions.
4499         (Output_merge_base::Input_sections): New type declaration.
4500         (Output_merge_base::input_sections_begin,
4501         Output_merge_base::input_sections_end,
4502         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4503         (Output_merge_base::bool keeps_input_sections_,
4504         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4505         Output_merge_base::input_sections_): New data members.
4506         (Output_merge_data::do_set_keeps_input_sections): New method
4507         defintion.
4508         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4509         * output.cc (Output_section::Input_section::relobj): Move method
4510         defintion from class declaration to here and handle merge sections.
4511         (Output_section::Input_section::shndx): Ditto.
4512         (Output_section::Output_section): Remove initializations of removed
4513         data members and initialize new data member LOOKUP_MAPS_.
4514         (Output_section::add_input_section): Set keeps-input-sections flag
4515         for a newly created merge output section as appropriate.  Adjust code
4516         to use Output_section_lookup_maps class.
4517         (Output_section::add_relaxed_input_section): Adjst code for lookup
4518         maps code refactoring.
4519         (Output_section::add_merge_input_section): Add a new parameter
4520         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4521         class.  If adding input section to a newly created merge output
4522         section fails, remove the new merge section.
4523         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4524         Adjust code for use of the Output_section_lookup_maps class.
4525         (Output_section::find_merge_section): Ditto.
4526         (Output_section::build_lookup_maps): New method defintion.
4527         (Output_section::find_relaxed_input_section): Adjust code to use
4528         Output_section_lookup_maps class.
4529         (Output_section::get_input_sections): Export merge sections.  Adjust
4530         code to use Output_section_lookup_maps class.
4531         (Output_section:::add_script_input_section): Adjust code to use
4532         Output_section_lookup_maps class.  Update lookup maps for merge
4533         sections also.
4534         (Output_section::discard_states): Use Output_section_lookup_maps.
4535         (Output_section::restore_states): Same.
4536         * output.h (Merge_section_properties): Move class defintion out of
4537         Output_section.
4538         (Output_section_lookup_maps): New class.
4539         (Output_section::Input_section::is_merge_section): New method
4540         defintion.
4541         (Output_section::Input_section::relobj): Move defintion out of class
4542         defintion.  Declare method only.
4543         (Output_section::Input_section::shndx): Ditto.
4544         (Output_section::Input_section::output_merge_base): New method defintion.
4545         (Output_section::Input_section::u2_.pomb): New union field.
4546         (Output_section::Merge_section_by_properties_map,
4547         Output_section::Output_section_data_by_input_section_map,
4548         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4549         Remove types.
4550         (Output_section::add_merge_input_section): Add new parameter
4551         KEEPS_INPUT_SECTIONS.
4552         (Output_section::build_lookup_maps): New method declaration.
4553         (Output_section::merge_section_map_,
4554         Output_section::merge_section_by_properties_map_,
4555         Output_section::relaxed_input_section_map_,
4556         Output_section::is_relaxed_input_section_map_valid_): Remove data
4557         members.
4558         (Output_section::lookup_maps_): New data member.
4559
4560 2010-05-21  Doug Kwan  <dougkwan@google.com>
4561
4562         PR gold/11619
4563         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4564         avoid a compilation error.
4565
4566 2010-05-19  Rafael Espindola  <espindola@google.com>
4567
4568         * script-sections.cc (Output_section_definition::allocate_to_segment):
4569         Update the phdrs_list even when the output section is NULL.
4570         * testsuite/Makefile.am: Add test.
4571         * testsuite/Makefile.in: Regenerate.
4572         * testsuite/script_test_9.cc: New.
4573         * testsuite/script_test_9.sh: New.
4574         * testsuite/script_test_9.t: New.
4575
4576 2010-05-19  Doug Kwan  <dougkwan@google.com>
4577
4578         * arm.cc (Arm_input_section::original_size): New method.
4579         (Arm_input_section::do_addralign): Add a cast.
4580         (Arm_input_section::do_output_offset): Remove static cast.
4581         (Arm_input_section::original_addralign,
4582          Arm_input_section::original_size_): Change type to uint32_t.
4583         (Arm_input_section::init): Add safe casts for section alignment
4584         and size.
4585         (Arm_input_section::set_final_data_size): Do not set address and
4586         offset of stub table.
4587         (Arm_output_section::fix_exidx_coverage): Change use of of
4588         Output_section::Simple_input_section to that of
4589         Output_section::Input_section.
4590         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4591         except for the first pass.
4592         * output.cc (Output_section::get_input_sections): Change type of
4593         input_sections to std::list<Input_section>.
4594         (Output_section::add_script_input_section): Rename from
4595         Output_section::add_simple_input_section.  Change type of SIS
4596         parameter from Simple_input_section to Input_section.
4597         * output.h (Output_section::Simple_input_section): Remove class.
4598         (Output_section::Input_section): Change class visibility to public.
4599         (Output_section::Input_section::addralign): Use stored alignments
4600         for special input sections if set.
4601         (Output_section::Input_section::set_addralign): New method.
4602         (Output_section::get_input_sections): Change parameter type from
4603         list of Simple_input_section to list of Input_section.
4604         (Output_section::add_script_input_section): Rename from
4605         Output_section::add_simple_input_section. Change first parameter's
4606         type from Simple_input_section to Input_section and remove the
4607         second and third parameters.
4608         * script-sections.cc (Input_section::Input_section_list): Change
4609         type to list of Output_section::Input_section/
4610         (Input_section_info::Input_section_info): Change parameter type of
4611         INPUT_SECTION to Output_section::Input_section.
4612         (Input_section_info::input_section): Change return type.
4613         (Input_section_info::input_section_): Change type to
4614         Output_section::Input_section.
4615         (Output_section_element_input::set_section_addresses): Adjust code
4616         to use Output_section::Input_section instead of
4617         Output_section::Simple_input_section.  Adjust code for renaming
4618         of Output_section::add_simple_input_section.
4619         (Orphan_output_section::set_section_addresses): Ditto.
4620
4621 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4622
4623         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4624         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4625
4626 2010-05-18  Rafael Espindola  <espindola@google.com>
4627
4628         * options.cc (General_options::finalize): Handle -nostdlib.
4629         * options.h (nostdlib): New option.
4630         * script.cc (script_add_search_dir): Handle -nostdlib.
4631
4632 2010-05-12  Doug Kwan  <dougkwan@google.com>
4633
4634         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4635         attributes section only if there no attributes section after merging.
4636         (Target_arm::merge_object_attributes): Move value of
4637         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4638         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4639         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4640         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4641         and arm_attr_merge_7.stdout.
4642         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4643         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4644         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4645         arm_attr_merge_7b.o): New rules.
4646         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4647         arm_attr_merge_7
4648         * testsuite/Makefile.in: Regenerate.
4649         * testsuite/arm_attr_merge.sh: New file.
4650         * testsuite/arm_attr_merge_[67][ab].s: Same.
4651
4652 2010-05-05  Nick Clifton  <nickc@redhat.com>
4653
4654         * po/es.po: Updated Spanish translation.
4655
4656 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4657
4658         * Makefile.am (install-exec-local): Properly install gold as
4659         default cross linker.
4660         * Makefile.in: Regenerated.
4661
4662 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4663             Nick Clifton  <nickc@redhat.com>
4664
4665         * configure.ac (install_as_default): Define and set to false
4666         unless --enable-gold or --enable-gold=both/gold has been
4667         specified.
4668         * configure: Regenerate.
4669
4670         * Makefile.am (install-exec-local): Install the executable as
4671         'ld.gold'.  If install_as_default is true then also install it as
4672         'ld'.
4673         * Makefile.in: Regenerated.
4674
4675 2010-04-24  Ian Lance Taylor  <iant@google.com>
4676
4677         * layout.cc (Layout::layout_reloc): In relocatable link don't
4678         combine reloc sections for grouped sections.
4679
4680 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4681
4682         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4683         sections that are not ordinary to icf.
4684         * icf.cc (get_section_contents): Handle relocation pointing to section
4685         with no object or shndx information.
4686         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4687         * testsuite/Makefile.in: Regenerate.
4688         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4689         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4690
4691 2010-04-22  Ian Lance Taylor  <iant@google.com>
4692
4693         * expression.cc (Expression::Expression_eval_info): Add
4694         result_alignment_pointer field.
4695         (Expression::eval_with_dot): Add result_alignment_pointer
4696         parameter.  Change all callers.
4697         (Expression::eval_maybe_dot): Likewise.
4698         (class Binary_expression): Add alignment_pointer parameter to
4699         left_value and right_value.  Change all callers.
4700         (BINARY_EXPRESSION): Set result alignment.
4701         (class Trinary_expression): Add alignment_pointer parameter to
4702         arg2_value and arg3_value.  Change all callers.
4703         (Trinary_cond::value): Set result alignment.
4704         (Max_expression::value, Min_expression::value): Likewise.
4705         (Align_expression::value): Likewise.
4706         * script-sections.cc (class Sections_element): Add dot_alignment
4707         parameter to set_section_addresses virtual function.  Update
4708         instantiations.
4709         (class Output_section_element): Likewise.
4710         (Script_sections::create_segments): Add dot_alignment parameter.
4711         Change all callers.
4712         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4713         (Script_sections::set_phdrs_clause_addresses): Likewise.
4714         * script-sections.h: Update declarations.
4715         * script.h: Update declarations.
4716         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4717         min_p_align.
4718         * testsuite/script_test_3.t: Set large alignment.
4719         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4720         segment has expected alignment.
4721
4722 2010-04-22  Nick Clifton  <nickc@redhat.com>
4723
4724         * po/gold.pot: Updated by the Translation project.
4725         * po/vi.po: Updated Vietnamese translation.
4726
4727 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4728
4729         * testsuite/Makefile.am (check_PROGRAMS): Add
4730         icf_virtual_function_folding_test.
4731         * testsuite/Makefile.in: Regenerated.
4732
4733 2010-04-15  Andrew Haley  <aph@redhat.com>
4734
4735         * options.h (merge_exidx_entries): New option.
4736         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4737         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4738         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4739         (Target_arm::merge_exidx_entries): New function.
4740         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4741         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4742         to Arm_exidx_fixup constructor.
4743         Add new arg, merge_exidx_entries.
4744         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4745         Arm_output_section::fix_exidx_coverage.
4746
4747 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4748
4749         * icf.cc (get_section_contents): Check for preemptible functions.
4750         Ignore addend when appropriate.
4751         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4752         section folded.
4753         (add_from_relobj): Check for section folded.
4754         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4755         * symtab.h (should_add_dynsym_entry): Add new parameter.
4756         * target-reloc.h (scan_relocs): Check for section folded.
4757         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4758         Check reloc types for function pointers in shared objects.
4759         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4760         case.
4761         (icf_preemptible_functions_test): New test case.
4762         (icf_string_merge_test): New test case.
4763         * testsuite.Makefile.in: Regenerate.
4764         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4765         bar_glob.  Refactor code.
4766         * testsuite/icf_preemptible_functions_test.cc: New file.
4767         * testsuite/icf_preemptible_functions_test.sh: New file.
4768         * testsuite/icf_string_merge_test.cc: New file.
4769         * testsuite/icf_string_merge_test.sh: New file.
4770         * testsuite/icf_virtual_function_folding_test.cc: New file.
4771         * testsuite/icf_virtual_function_folding_test.sh: New file.
4772
4773 2010-04-14  Doug Kwan  <dougkwan@google.com>
4774
4775         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4776         for local symbol recounting if we remove a section due to ICF.
4777         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4778         there are no regular objects in input.
4779
4780 2010-04-13  Doug Kwan  <dougkwan@google.com>
4781
4782         * arm.cc (Arm_input_section::set_final_data_size): Compute
4783         accurate final data size instead of using current data size.
4784
4785 2010-04-09  Doug Kwan  <dougkwan@google.com>
4786
4787         * layout.cc (Layout::choose_output_section): Handle script section
4788         types.
4789         (Layout::make_output_section_for_script): Add section type parameter.
4790         Handle script section types.
4791         * layout.h (Layout::make_output_section_for_script): Add section
4792         type parameter.
4793         * output.cc (Output_section::Output_section): Initialize data member
4794         is_noload_.
4795         (Output_section::do_reset_address_and_file_offset): Do not set address
4796         to 0 if section is a NOLOAD section.
4797         * output.h (Output_section::is_noload): New method.
4798         (Output_section::set_is_noload): Ditto.
4799         (Output_section::is_noload_): New data member.
4800         * script-c.h (Script_section_type): New enum type.
4801         (struct Parser_output_section_header): Add new file section_type.
4802         * script-sections.cc (Sections_element::output_section_name): Add
4803         parameter for returning script section type.
4804         (Output_section_definition::output_section_name): Ditto.
4805         (Output_section_definition::section_type)P; New method.
4806         (Output_section_definiton::script_section_type_name): Ditto.
4807         (Output_section_definition::script_section_type_): New data member.
4808         (Output_section_definition::Output_section_definition): Initialize
4809         data member Output_section_definition::script_section_type_.
4810         (Output_section_definition::create_sections): Pass script section type
4811         to Layout::make_output_section_for_script.
4812         (Output_section_definition::output_section_name): Return script
4813         section type to caller.
4814         (Output_section_definition::set_section_address): Do not advance
4815         dot value and load address if section type is NOLOAD.  Set address
4816         of NOLOAD sections regardless of section flags.
4817         (Output_section_definition::print): Print section type if it is
4818         not SCRIPT_SECTION_TYPE_NONE.
4819         (Output_section_definition::section_type): New method.
4820         (Output_section_definition::script_section_type_name): Ditto.
4821         (Script_sections::output_section_name): Add new parameter
4822         PSECTION_TYPE for returning script section type.  Pass it to
4823         section elements.  Handle discard sections.
4824         (Sort_output_sections::operator()): Handle NOLOAD sections.
4825         * script-sections.h (Script_sections::Section_type): New enum type.
4826         (Script_sections::output_section_name): Add a new parameter for
4827         returning script section type.
4828         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4829         INFO and NOLOAD.
4830         * yyscript.y (union): Add new field SECTION_TYPE.
4831         (COPY, DSECT, INFO, NOLOAD): New tokens.
4832         (opt_address_and_section_type): Change type to output_section_header.
4833         (section_type): New non-terminal
4834         (section_header): Handle section type.
4835         (opt_address_and_section_type): Return section type value.
4836
4837 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4838
4839         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4840         * testsuite/plugin_common_test_2.c (foo): Likewise.
4841
4842 2010-04-08  Doug Kwan  <dougkwan@google.com>
4843
4844         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4845         Output_merge_data.
4846         * output.cc (Output_section::add_merge_input_section): Simplify
4847         code and return status of Output_merge_base::add_input_section.
4848         Update merge section map only if Output_merge_base::add_input_section
4849         returns true.
4850
4851 2010-04-07  Doug Kwan  <dougkwan@google.com>
4852
4853         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4854         if section is marked as containing instructions but has no mapping
4855         symbols.
4856         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4857         correct section index.
4858         (Arm_relobj::find_linked_text_section): Ditto.
4859
4860 2010-04-07  Cary Coutant  <ccoutant@google.com>
4861
4862         * archive.cc (include_member): Destroy Read_symbols_data object before
4863         releasing file.
4864         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4865         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4866         (Read_symbols_data::~Read_symbols_data) New destructor.
4867         (Section_relocs::Section_relocs) New constructor.
4868         (Section_relocs::~Section_relocs) New destructor.
4869         (Read_relocs_data::Read_relocs_data) New constructor.
4870         (Read_relocs_data::~Read_relocs_data) New destructor.
4871         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4872         pointers to NULL after deleting.
4873
4874 2010-04-07  Doug Kwan  <dougkwan@google.com>
4875
4876         * arm.cc: Replace "endianity" with "endianness" in comments.
4877         (Arm_exidx_cantunwind): Ditto.
4878         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4879         (Arm_relobj::merge_flags_and_attributes): New method.
4880         (Arm_relobj::merge_flags_and_attributes_): New data member.
4881         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4882         (Arm_relobj::scan_sections_for_stubs): Ditto.
4883         (Arm_relobj::do_read_symbols): Check to see if we really want to
4884         merge processor-specific flags and attributes.  Exit early if
4885         an object is empty except for section names and the undefined symbol.
4886         (Target_arm::do_finalize_sections): Move check for ELF format to
4887         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4888         attributes from a regular object only when we have determined that
4889         it is aapropriate.  Do not create an .ARM.attributes section in
4890         output if there is no regular input object.
4891         (Target_arm::merge_processor_specific_flags): Check
4892         --warn-mismatch before printing any error.
4893         (Target_arm::merge_object_attributes): Ditto.
4894         * gold.cc (queue_middle_tasks): Handle the case in which there is
4895         no regular object in input.
4896         * options.cc (General_options::parse_EB): New method.
4897         (General_options::parse_EL): Same.
4898         (General_options::General_options): Initialize endianness_.
4899         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4900         New options.
4901         (General_options::Endianness): New enum.
4902         (General_options::endianness): New method.
4903         (General_options::endianness_): New data member.
4904         * parameters.cc (Parameters::set_options): Check target endianness.
4905         (Parameters::set_target_once): Ditto.
4906         (Parameters::check_target_endianness): New method.
4907         (parameters_force_valid_target): If either -EL or -EB is specified,
4908         use it to define endianness of default target.
4909         * parameters.h (Parameters::check_target_endianness): New method
4910         declaration.
4911         * target.h (class Target): Change "endianity" to "endianness"
4912         in comments.
4913
4914 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4915
4916         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4917         * configure: Regenerate.
4918         * Makefile.in: Regenerate.
4919         * testsuite/Makefile.in: Regenerate.
4920
4921 2010-04-06  Cary Coutant  <ccoutant@google.com>
4922
4923         gcc PR lto/42757
4924         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4925         prevailing definitions of common symbols.
4926         * testsuite/plugin_test_6.sh: New test case.
4927         * testsuite/plugin_common_test_1.c: New test case.
4928         * testsuite/plugin_common_test_2.c: New test case.
4929         * testsuite/Makefile.am (plugin_test_6): New test case.
4930         * testsuite/Makefile.in: Regenerate.
4931
4932 2010-04-06  Nick Clifton  <nickc@redhat.com>
4933
4934         * po/vi.po: New Vietnamese translation.
4935
4936 2010-03-30  Doug Kwan  <dougkwan@google.com>
4937
4938         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4939
4940 2010-03-25  Doug Kwan  <dougkwan@google.com>
4941
4942         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4943         to avoid a conversion warning on a 32-bit host.
4944
4945 2010-03-24  Ian Lance Taylor  <iant@google.com>
4946
4947         * testsuite/script_test_3.t: Add a TLS segment.
4948         * testsuite/Makefile.am (check_PROGRAMS): Add
4949         tls_phdrs_script_test.
4950         (tls_phdrs_script_test_SOURCES): Define.
4951         (tls_phdrs_script_test_DEPENDENCIES): Define.
4952         (tls_phdrs_script_test_LDFLAGS): Define.
4953         (tls_phdrs_script_test_LDADD): Define.
4954         * testsuite/Makefile.in: Rebuild.
4955
4956 2010-03-23  Cary Coutant  <ccoutant@google.com>
4957
4958         * fileread.cc (find_or_make_view): Fix comment.
4959
4960 2010-03-23  Ian Lance Taylor  <iant@google.com>
4961
4962         * script-sections.cc (class Orphan_section_placement): Define
4963         PLACE_TLS and PLACE_TLS_BSS.
4964         (Orphan_section_placement::Orphan_section_placement): Initialize
4965         new places.
4966         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4967         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4968         (tls_script_test_SOURCES): Define.
4969         (tls_script_test_DEPENDENCIES): Define.
4970         (tls_script_test_LDFLAGS): Define.
4971         (tls_script_test_LDADD): Define.
4972         * testsuite/Makefile.in: Rebuild.
4973
4974 2010-03-22  Doug Kwan  <dougkwan@google.com>
4975
4976         * arm.cc (Arm_relocate_functions::abs8,
4977         Arm_relocate_functions::abs16): Use correct check for overflow
4978         specified in the ARM ELF specs.
4979         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4980         target of a BLX instruction specially.
4981         (Reloc_stub::stub_type_for_reloc): Ditto.
4982         (Relocate::relocate): Use symbolic names instead of numeric relocation
4983         codes to report error.
4984         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4985         workaround.
4986         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4987         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4988         thumb2_blx_out_of_range.stdout
4989         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4990         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4991         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4992         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4993         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4994         thumb2_blx_in_range, thumb2_blx_in_range.o,
4995         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4996         thumb2_blx_out_of_range.o): New rules.
4997         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4998         thumb2_blx_in_range and thumb2_blx_out_of_range.
4999         * testsuite/Makefile.in: Regenerate.
5000         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5001         * testsuite/thumb_blx_in_range.s: New file.
5002         * testsuite/thumb_blx_out_of_range.s: New file.
5003
5004 2010-03-22  Rafael Espindola  <espindola@google.com>
5005
5006         * archive.cc (Should_include): Move to archive.h.
5007         (should_include_member): Make it a member of Archive.
5008         (Lib_group): New.
5009         (Add_lib_group_symbols): New.
5010         * archive.h: Include options.h.
5011         (Archive_member): Moved from Archive.
5012         (Should_include): Moved from archive.cc.
5013         (Lib_group): New.
5014         (Add_lib_group_symbols): New.
5015         * dynobj.cc (do_should_include_member): New.
5016         * dynobj.h (do_should_include_member): New.
5017         * gold.cc (queue_initial_tasks): Update call to queue.
5018         * main.cc (main): Print lib group stats.
5019         * object.cc (do_should_include_member): New.
5020         * object.h: Include archive.h.
5021         (Object::should_include_member): New.
5022         (Object::do_should_include_member): New.
5023         (Sized_relobj::do_should_include_member): New.
5024         * options.cc (General_options::parse_start_lib): New.
5025         (General_options::parse_end_lib): New.
5026         (Input_arguments::add_file): Handle lib groups.
5027         (Input_arguments::start_group): Check we are not in a lib.
5028         (Input_arguments::start_lib): New.
5029         (Input_arguments::end_lib): New.
5030         * options.h (General_options): Add start_lib and end_lib.
5031         (Input_argument::lib_): New.
5032         (Input_argument::lib): New.
5033         (Input_argument::is_lib): New.
5034         (Input_file_lib): New.
5035         (Input_arguments::in_lib_): New.
5036         (Input_arguments::in_lib): New.
5037         (Input_arguments::start_lib): New.
5038         (Input_arguments::end_lib_): New.
5039         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5040         in unused members as preempted.
5041         (Sized_pluginobj::do_should_include_member): New.
5042         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5043         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5044         return the blocker.
5045         (Read_symbols::do_whole_lib_group): New.
5046         (Read_symbols::do_lib_group): New.
5047         (Read_symbols::do_read_symbols): Handle lib groups.
5048         (Read_symbols::get_name): Handle lib groups.
5049         * readsyms.h (Read_symbols): Add an archive member pointer.
5050         (Read_symbols::do_whole_lib_group): New.
5051         (Read_symbols::do_lib_group): New.
5052         (Read_symbols::member_): New.
5053         * script.cc (read_input_script): Update call to queue_soon.
5054
5055 2010-03-19  Doug Kwan  <dougkwan@google.com>
5056
5057         * arm.cc (Stub_table::Stub_table): Initialize new data members
5058         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5059         (Stub_table::add_reloc_stub): Assign stub offset and update
5060         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5061         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5062         New data members.
5063         (Stub_table::update_data_size_and_addralign): Use
5064         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5065         instead of going over all reloc stubs.
5066         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5067         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5068         Stringpool_template::offset_ to size of Stringpool_char.
5069         (Stringpool_template::new_key_offset): Remove code to initialize
5070         Stringpool_template::offset_.
5071         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5072         Stringpool_template::offset_ to zero.
5073
5074 2010-03-15  Doug Kwan  <dougkwan@google.com>
5075
5076         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5077         offset_.
5078         (Stringpool_template::new_key_offset): New method.
5079         (Stringpool_template::add_string): Assign offsets when adding new
5080         strings.
5081         (Stringpool_template::set_string_offsets): Do not set string offsets
5082         when not optimizing.
5083         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5084         member size_.
5085         (Chunked_vector::clear): Clear size_.
5086         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5087         (Chunked_vector::size): Return size_.
5088         (Chunked_vector::push_back): Use size_ to find insert position.
5089         (Chunked_vector::size_): New data member.
5090         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5091         (Stringpool_template::new_key_offset): New method declaration.
5092         (Stringpool_template::offset_): New data member.
5093
5094 2010-03-15   Rafael Espindola  <espindola@google.com>
5095
5096         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5097         Add_symbols' constructor.
5098         * readsyms.h (Add_symbols): Remove the input_group member.
5099
5100 2010-03-10  Ian Lance Taylor  <iant@google.com>
5101
5102         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5103         target to ask whether a reference to a symbol requires a stack
5104         split.
5105         * target.h (Target::is_call_to_non_split): New function.
5106         (Target::do_is_call_to_non_split): Declare virtual function.
5107         * target.cc: Include "symtab.h".
5108         (Target::do_is_call_to_non_split): New function.
5109         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5110
5111 2010-03-10  Cary Coutant  <ccoutant@google.com>
5112
5113         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5114         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5115         (File_read::open[2]): Add whole_file_view_ to list of views.
5116         (File_read::make_view): Remove test of whole_file_view_.
5117         (File_read::find_or_make_view): Create whole_file_view_ if
5118         necessary.
5119         (File_read::clear_views): Replace bool parameter with enum;
5120         adjust all callers.  Don't delete views with permanent data;
5121         do delete cached views and views from archives if
5122         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5123         if clearing the corresponding view.
5124         * fileread.h (File_read::Clear_views_mode): New enum.
5125         (File_read::View::is_permanent_view): New method.
5126         (File_read::clear_views): Replace bool parameter
5127         with enum; adjust all callers.
5128         * options.h (General_options): Change keep_files_mapped option;
5129         add map_whole_files.
5130         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5131         releasing the file.
5132         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5133         the file.
5134
5135 2010-03-10  David S. Miller  <davem@davemloft.net>
5136
5137         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5138
5139 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5140
5141         * icf.cc (get_section_contents): Add '@' marker after processing the
5142         merge reloc.
5143
5144 2010-03-08  Doug Kwan  <dougkwan@google.com>
5145
5146         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5147         due to a conversion warning.
5148         (Arm_relobj::update_output_local_symbol_count): Check for local
5149         symbol with unset output index.
5150
5151 2010-03-05  Ian Lance Taylor  <iant@google.com>
5152
5153         * options.h (class General_options): Add --spare-dynamic-tags.
5154         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5155         --spare-dynamic-tags.
5156
5157 2010-03-05  Ian Lance Taylor  <iant@google.com>
5158
5159         * incremental.cc: Include "libiberty.h".
5160
5161 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5162
5163         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5164         function, is_info_ member.
5165         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5166         (Versions::Versions): Update caller.
5167         (Versions::define_base_version): Likewise.
5168         (Versions::add_def): Likewise.
5169
5170 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5171
5172         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5173         (Scan::possible_function_pointer_reloc): New function.
5174         (Scan::local_reloc_may_be_function_pointer): Change to call
5175         possible_function_pointer_reloc.
5176         (Scan::global_reloc_may_be_function_pointer): Ditto.
5177         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5178         relocations in ".data.rel.ro._ZTV" section.
5179         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5180         * testsuite/icf_safe_so_test.cc: Ditto.
5181         * testsuite/icf_safe_test.cc: Ditto.
5182         * testsuite/icf_safe_test.sh: Ditto.
5183
5184 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5185             Ian Lance Taylor  <iant@google.com>
5186
5187         * target-reloc.h (relocate_section): Check the symbol table index
5188         for -1U before setting the local symbol index.
5189         (scan_relocatable_relocs): If copying the relocation, record that
5190         the local symbol is required.
5191         * object.h (Symbol_value::is_output_symtab_index_set): New
5192         function.
5193         (Symbol_value::may_be_discarded_from_output_symtab): New
5194         function.
5195         (Symbol_value::has_output_symtab_entry): New function.
5196         (Symbol_value::needs_output_symtab_entry): Remove.
5197         (Symbol_value::output_symtab_index): Make sure the symbol index is
5198         set.
5199         (Symbol_value::set_output_symtab_index): Make sure the symbol
5200         index is not set.  Make sure the new index is valid.
5201         (Symbol_value::set_must_have_output_symtab_entry): New function.
5202         (Symbol_value::has_output_dynsym_entry): New function.
5203         (Symbol_value::set_output_dynsym_index): Make sure the new index
5204         is valid.
5205         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5206         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5207         local symbol if permitted.
5208         (Sized_relobj::do_finalize_local_symbols): Call
5209         is_output_symtab_index_set rather than needs_output_symtab_entry.
5210         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5211         rather than needs_output_symtab_entry.  Call
5212         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5213         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5214         is_output_symtab_index_set rather than needs_output_symtab_entry.
5215         * testsuite/discard_locals_relocatable_test.c: New file.
5216         * testsuite/discard_locals_test.sh: Test -r.
5217         * testsuite/Makefile.am (check_DATA): Add
5218         discard_locals_relocatable_test1.syms,
5219         discard_local_relocatable_test2.syms.
5220         (MOSTLYCLEANFILES): Likewise.  Also add
5221         discard_locals_relocatable_test1.lout and
5222         discard_locals_relocatable_test2.out.
5223         (discard_locals_relocatable_test1.syms): New target.
5224         (discard_locals_relocatable_test.o): New target.
5225         (discard_locals_relocatable_test1.out): New target.
5226         (discard_locals_relocatable_test2.syms): New target.
5227         (discard_locals_relocatable_test2.out): New target.
5228         (various): Add missing ../ld-new dependencies.
5229         * testsuite/Makefile.in: Rebuild.
5230
5231 2010-03-03  Nick Clifton  <nickc@redhat.com>
5232
5233         * po/fi.po: New Finnish translation.
5234
5235 2010-03-01  Doug Kwan  <dougkwan@google.com>
5236
5237         * layout.cc (Layout::Layout): Force section types of .init_array*,
5238         .preinit_array* and .fini_array* sections.
5239         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5240         Fix check of return value of std::string::find.().
5241         (Output_section::Input_section_sort_compare::operator()): Remove
5242         comment about .init_array.
5243         (Output_section::Input_section_sort_init_fini_compare::operator()):
5244         New method.
5245         (Output_section::sort_attached_input_sections): Handle .init_array
5246         and .fini_array specially.
5247         * output.h (Output_section::Inut_section_sort_compare): Update
5248         comment.
5249         (Output_section::Input_section_sort_init_fini_compare): New struct.
5250
5251 2010-02-26  Doug Kwan  <dougkwan@google.com>
5252
5253         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5254         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5255         * testsuite/debug_msg.sh: Avoid matching source line number for
5256         use of global variable undef_int.
5257
5258 2010-02-26  Doug Kwan  <dougkwan@google.com>
5259
5260         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5261         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5262         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5263         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5264         * options.cc (General_options::General_options): Initialize member
5265         fix_v4bx_.
5266         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5267         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5268         and rm_no_fix_v4bx.stdout
5269         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5270         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5271         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5272         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5273         and arm_no_fix_v4bx.
5274         * Makefile.in: Regenerate.
5275         * testsuite/arm_fix_v4bx.s: New file.
5276         * testsuite/arm_fix_v4bx.sh: Ditto.
5277
5278 2010-02-24  Doug Kwan  <dougkwan@google.com>
5279
5280         * arm.cc (Target_arm::got_section): Make the .got section the first
5281         non RELRO section in the data segment.
5282         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5283         suffixes of section names.
5284
5285 2010-02-24  Doug Kwan  <dougkwan@google.com>
5286
5287         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5288         flags and attributes merging if an input file is a binary file.
5289         * fileread.cc (Input_file::open): Record format of original file.
5290         * fileread.h (Input_file::Format): New enum type.
5291         (Input_file::Input_file): Initialize data member format_.
5292         (Input_file::format): New method definition.
5293         (Input_file::format_):: New data member.
5294
5295 2010-02-24  Doug Kwan  <dougkwan@google.com>
5296
5297         * arm.cc (Arm_output_data_got): New class.
5298         (ARM_TCB_SIZE): New constant
5299         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5300         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5301         If user uses a script with a SECTIONS clause, issue only a warning
5302         for a misplaced EXIDX input section.  Otherwise, issue an error.
5303         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5304         garbage collection.
5305         (Target_arm::got_mode_index_entry): Handle static linking.
5306         (Target_arm::Scan::local): Ditto.
5307         (Target_arm::Scan::global): Ditto.
5308         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5309         all incorrectly implemented relocations.
5310         (Target_arm::fix_exidx_coverage): Pass layout to
5311         Arm_output_section::fix_exidx_coverage.
5312         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5313         from ".ARM.exidx." and ".ARM.extab.".
5314
5315 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5316
5317         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5318         section if it does not already exist.
5319         * attributes.cc (Attributes_section_data::Attributes_section_data):
5320         Don't crash if size is zero.
5321
5322 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5323             Ian Lance Taylor  <iant@google.com>
5324
5325         * gold.cc (queue_middle_tasks): If no input files were opened,
5326         exit.
5327         * workqueue.h (Task_function::Task_function): Assert that there is
5328         a blocker.
5329
5330 2010-02-22  Doug Kwan  <dougkwan@google.com>
5331
5332         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5333         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5334         types to avoid warnings due to different uint64_t implementations
5335         on different hosts.
5336
5337 2010-02-21  Doug Kwan  <dougkwan@google.com>
5338
5339         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5340         handling of the maximum backward branch offset.
5341         (Arm_relocate_functions::thumb_branch_common): Ditto.
5342         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5343         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5344         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5345         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5346         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5347         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5348         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5349         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5350         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5351         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5352         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5353         thumb2_bl_out_of_range.o): New rules.
5354         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5355         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5356         thumb2_bl_out_of_range
5357         * testsuite/Makefile.in: Regenerate.
5358         * testsuite/arm_bl_in_range.s: New file.
5359         * testsuite/arm_bl_out_of_range.s: Ditto.
5360         * testsuite/arm_branch_in_range.sh: Ditto.
5361         * testsuite/arm_branch_range.t: Ditto.
5362         * testsuite/thumb2_branch_range.t: Ditto.
5363         * testsuite/thumb_bl_in_range.s: Ditto.
5364         * testsuite/thumb_bl_out_of_range.s: Ditto.
5365         * testsuite/thumb_branch_range.t: Ditto.
5366
5367 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5368
5369         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5370         Add reloc offset information.
5371         * icf.cc (get_section_contents): Change iterators to point to the new
5372         vectors. Add reloc offset information to the contents.
5373         * icf.h (Icf::Sections_reachable_info): New typedef.
5374         (Icf::Sections_reachable_list): New typedef.
5375         (Icf::Offset_info): New typedef.
5376         (Icf::Reloc_info): New struct typedef.
5377         (Icf::Reloc_info_list): New typedef.
5378         (Icf::symbol_reloc_list): Delete method.
5379         (Icf::addend_reloc_list): Delete method.
5380         (Icf::section_reloc_list): Delete method.
5381         (Icf::reloc_info_list): New method.
5382         (Icf::reloc_info_list_): New member.
5383
5384 2010-02-19  Doug Kwan  <dougkwan@google.com>
5385
5386         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5387         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5388         * arm.cc (Arm_relocation_functions): New forward declaration.
5389         (Target_arm::Target_arm): Initialize new data members
5390         got_mod_index_offset_ and tls_base_symbol_defined_.
5391         (Target_arm::Relocate::relocate_tls): New method.
5392         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5393          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5394         New methods.
5395         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5396         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5397         (Target_arm::got_mod_index_offset_,
5398         Target_arm::tls_base_symbol_defined_): New data members.
5399         (Target_arm::Scan::local, Target::Scan::global,
5400         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5401         relocations.
5402
5403 2010-02-18  Doug Kwan  <dougkwan@google.com>
5404
5405         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5406         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5407         text section as a parameter becuase some broken tools may not set
5408         the link in section header.
5409         (Target_arm::has_got_section): New method.
5410         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5411         without any mapping symbol as data only.  Remove warning.
5412         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5413         link in its section header, try to discover the link by inspecting the
5414         REL31 relocation at the beginning of the section.
5415         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5416         in error message.
5417         (Target_arm::Scan::global): Treat any reference to the symbol
5418         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5419
5420 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5421
5422         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5423         (Scan::global_reloc_may_be_function_pointer): New function.
5424         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5425         (Scan::global_reloc_may_be_function_pointer): New function.
5426         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5427         (Scan::global_reloc_may_be_function_pointer): New function.
5428         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5429         (Scan::global_reloc_may_be_function_pointer): New function.
5430         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5431         (Scan::global_reloc_may_be_function_pointer): New function.
5432         (Scan::possible_function_pointer_reloc): New function.
5433         (Target_x86_64::can_check_for_function_pointers): New function.
5434         * gc.h (gc_process_relocs): Scan relocation types to determine if
5435         function pointers were taken for targets that support it.
5436         * icf.cc (Icf::find_identical_sections): Include functions for
5437         folding in safe ICF whose pointer is not taken.
5438         * icf.h (Secn_fptr_taken_set): New typedef.
5439         (fptr_section_id_): New member.
5440         (section_has_function_pointers): New function.
5441         (set_section_has_function_pointers): New function.
5442         (check_section_for_function_pointers): New function.
5443         * options.h: Fix comment for safe ICF option.
5444         * target.h (can_check_for_function_pointers): New function.
5445         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5446         Modify icf_safe_test for X86-64.
5447         * testsuite/Makefile.in: Regenerate.
5448         * testsuite/icf_safe_so_test.cc: New file.
5449         * testsuite/icf_safe_so_test.sh: New file.
5450         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5451         (main): Change to take pointer to function kept_func_3.
5452         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5453         folding is done correctly for X86-64.
5454
5455 2010-02-12  David S. Miller  <davem@davemloft.net>
5456
5457         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5458         is_symbolless parameter.
5459         (Output_reloc<SHT_REL>::is_symbolless): New.
5460         (Output_reloc<SHT_REL>::is_symbolless_): New.
5461         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5462         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5463         (Output_reloc<SHT_RELA>::is_symbolless): New.
5464         (Output_data_reloc::add_global): Handle is_symbolless.
5465         (Output_data_reloc::add_global_relative): Likewise.
5466         (Output_data_reloc::add_local): Likewise.
5467         (Output_data_reloc::add_local_relative): Likewise.
5468         (Output_data_reloc::add_symbolless_global_addend): New.
5469         (Output_data_reloc::add_symbolless_local_addend): New.
5470         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5471         is_symbolless.
5472         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5473         instead of ->is_relative_
5474         (Output_reloc::write): Likewise.
5475         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5476         (Output_reloc::write_rel): Simplify.
5477
5478         * sparc.cc (Target_sparc::Scan::local): Use
5479         ->add_symbolless_local_addend as needed.
5480         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5481         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5482         based upon relocation offset.
5483
5484 2010-02-11  Doug Kwan  <dougkwan@google.com>
5485
5486         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5487         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5488         beginning of function.
5489         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5490         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5491         parameter is_32bit in calls to should_apply_static_reloc.
5492         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5493         (check_DATA): Add arm_abs_global.stdout.
5494         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5495         arm_abs_global.stdout): New rules.
5496         (MOSTLLYCLEANFILES): Add arm_abs_global
5497         * Makefile.in: Regenerate.
5498         * testsuite/arm_abs_global.s: New file.
5499         * testsuite/arm_abs_global.sh: Ditto.
5500         * testsuite/arm_abs_lib.s: Ditto.
5501
5502 2010-02-11  Ian Lance Taylor  <iant@google.com>
5503
5504         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5505         Read_relocs task.
5506         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5507         Allocate_commons_task first.
5508         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5509         task, rather than symtab_lock_.
5510         (Gc_process_relocs::~Gc_process_relocs): New function.
5511         (Gc_process_relocs::is_runnable): Check this_blocker_.
5512         (Gc_process_relocs::locks): Use next_blocker_ rather than
5513         blocker_.
5514         (Scan_relocs::~Scan_relocs): New function.
5515         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5516         symtab_lock_.
5517         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5518         next_blocker_.
5519         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5520         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5521         constructor accordingly.
5522         (class Gc_process_relocs): Likewise.
5523         (class Scan_relocs): Likewise.
5524         * common.h (class Allocate_commons_task): Remove symtab_lock_
5525         field, and corresponding constructor parameter.
5526         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5527         symtab_lock_.
5528         (Allocate_commons_task::locks): Likewise.
5529
5530 2010-02-11  Ian Lance Taylor  <iant@google.com>
5531
5532         * gold-threads.h (class Once): Define.
5533         (class Initialize_lock): Rewrite as child of Once.
5534         * gold-threads.cc (class Once_initialize): Define.
5535         (once_pointer_control): New static variable.
5536         (once_pointer, once_arg): New static variables.
5537         (c_run_once): New static function.
5538         (Once::Once, Once::run_once, Once::internal_run): New functions.
5539         (class Initialize_lock_once): Remove.
5540         (initialize_lock_control): Remove.
5541         (initialize_lock_pointer): Remove.
5542         (initialize_lock_once): Remove.
5543         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5544         (Initialize_lock::initialize): Rewrite.
5545         (Initialize_lock::do_run_once): New function.
5546         * archive.cc (Archive::interpret_header): Only clear name if it is
5547         not already empty.
5548         * fileread.cc: Include "gold-threads.h"
5549         (file_counts_lock): New static variable.
5550         (file_counts_initialize_lock): Likewise.
5551         (File_read::release): Only increment counts when using --stats.
5552         Use a lock around the increment.
5553         * parameters.cc (class Set_parameters_target_once): Define.
5554         (set_parameters_target_once): New static variable.
5555         (Parameters::Parameters): Move here from parameters.h.
5556         (Parameters::set_target): Rewrite.
5557         (Parameters::set_target_once): New function.
5558         (Parameters::clear_target): Move here and rewrite.
5559         * parameters.h (class Parameters): Update declarations.  Add
5560         set_parameters_target_once_ field.
5561         (Parameters::Parameters): Move to parameters.cc.
5562         (Parameters::clear_target): Likewise.
5563         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5564         task.
5565         (Start_group::~Start_group): New function.
5566         (Start_group::is_runnable): New function.
5567         (Start_group::locks, Start_group::run): New functions.
5568         (Finish_group::run): Change saw_undefined to size_t.
5569         * readsyms.h (class Start_group): Define.
5570         (class Finish_group): Change saw_undefined_ field to size_t.
5571         (Finish_group::Finish_group): Remove saw_undefined and
5572         this_blocker parameters.  Change all callers.
5573         (Finish_group::set_saw_undefined): New function.
5574         (Finish_group::set_blocker): New function.
5575         * symtab.h (class Symbol_table): Change saw_undefined to return
5576         size_t.  Change saw_undefined_ field to size_t.
5577         * target-select.cc (Set_target_once::do_run_once): New function.
5578         (Target_selector::Target_selector): Initialize set_target_once_
5579         field.  Don't initialize lock_ and initialize_lock_ fields.
5580         (Target_selector::instantiate_target): Rewrite.
5581         (Target_selector::set_target): New function.
5582         * target-select.h (class Set_target_once): Define.
5583         (class Target_selector): Update declarations.  Make
5584         Set_target_once a friend.  Remove lock_ and initialize_lock_
5585         fields.  Add set_target_once_ field.
5586
5587 2010-02-10  Ian Lance Taylor  <iant@google.com>
5588
5589         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5590         queueing any tasks.
5591         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5592         (queue_middle_tasks): Add all blockers before queueing any tasks.
5593         (queue_final_tasks): Likewise.
5594         * token.h (Task_token::add_blockers): New function.
5595         * object.h (Input_objects::number_of_relobjs): New function.
5596
5597 2010-02-10  Ian Lance Taylor  <iant@google.com>
5598
5599         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5600         shared, not if not position independent.
5601         * x86_64.cc (Relocate::relocate_tls): Likewise.
5602         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5603         (tls_pie_pic_test): New target.
5604         * testsuite/Makefile.in: Rebuild.
5605
5606         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5607         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5608         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5609         * testsuite/Makefile.in: Rebuild.
5610
5611 2010-02-09  David S. Miller  <davem@davemloft.net>
5612
5613         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5614         R_SPARC_RELATIVE using ->add_local_relative().
5615         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5616
5617         * output.h (Output_data_dynamic::add_section_size): New method
5618         that takes two Output_data objects.
5619         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5620         entry param.  Handle it in initializers.
5621         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5622         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5623         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5624         arg.
5625         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5626         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5627         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5628         for dynrel_includes_plt.
5629         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5630         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5631         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5632         before .rela.plt
5633         (Target_sparc::do_finalize_sections): Update to pass true for
5634         dynrel_includes_plt.
5635         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5636         output before .rela.plt
5637         (Target_powerpc::do_finalize_sections): Update to pass true for
5638         dynrel_includes_plt when 32-bit.
5639
5640 2010-02-08  Doug Kwan  <dougkwan@google.com>
5641
5642         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5643         method.
5644         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5645         Arm_relobj::scan_section_for_cortex_a8_stubs,
5646         Arm_relobj::do_relocation_section): Instead of calling
5647         Output_section::output_address, use faster
5648         Arm_relobj::simple_input_section_output_address.
5649
5650 2010-02-08  David S. Miller  <davem@davemloft.net>
5651
5652         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5653         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5654         relocation helper function.
5655
5656         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5657         just like R_SPARC_GOT{10,13,22}.
5658         (Target_sparc::Scan::local): Likewise.
5659         (Target_sparc::Relocate:relocate): Likewise.
5660
5661 2010-02-06  Ian Lance Taylor  <iant@google.com>
5662
5663         * configure.ac: Rewrite targetobjs duplicate removal code to use
5664         only shell constructs.
5665         * configure: Rebuild.
5666
5667 2010-02-05  Doug Kwan  <dougkwan@google.com>
5668
5669         PR 11247
5670         * arm.cc (Arm_relobj::section_is_scannable): New method.
5671         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5672         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5673
5674 2010-02-04  Doug Kwan  <dougkwan@google.com>
5675
5676         PR 11247
5677         * arm-reloc-property.cc (cstdio): Include.
5678         * configure.ac (targetobjs): Remove duplicates.
5679         * configure: Regenerate.
5680         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5681         big and little endian version for a given address size.
5682
5683 2010-02-03  Doug Kwan  <dougkwan@google.com>
5684
5685         * arm-reloc-property.cc
5686         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5687         definition.
5688         * arm-reloc-property.h
5689         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5690         New method definition.
5691         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5692         declaration.
5693         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5694         overflow to N.
5695         (GOT_PREL): Change implemented to Y.
5696         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5697         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5698         (Arm_relocate_functions::movw_abs_nc): Remove method.
5699         (Arm_relocate_functions::movt_abs): Ditto.
5700         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5701         (Arm_relocate_functions::thm_movt_abs): Ditto.
5702         (Arm_relocate_functions::movw_rel_nc): Ditto.
5703         (Arm_relocate_functions::movw_rel): Ditto.
5704         (Arm_relocate_functions::movt_rel): Ditto.
5705         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5706         (Arm_relocate_functions:thm_movw_rel): Ditto.
5707         (Arm_relocate_functions:thm_movt_rel): Ditto.
5708         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5709         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5710         New method definitions.
5711         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5712         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5713         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5714         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5715         (Target_arm::Relocate::relocate): Check for non-static or
5716         unimplemented relocation code and exit early.  Change calls to
5717         Target_arm::reloc_uses_thumb_bit and
5718         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5719         instead.  Refactor code to handle similar relocations to increase
5720         code sharing.  Remove check for unsupported relocation code in switch
5721         statement.
5722         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5723         relocation property table to find out size.  Change error message to
5724         print out the name of a relocation code instead of the numeric value.
5725         (Target_arm::scan_reloc_for_stub): Use relocation property table
5726         instead of calling Target_arm::reloc_uses_thumb_bit().
5727
5728 2010-02-02  Doug Kwan  <dougkwan@google.com>
5729
5730         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5731         types of relaxed input section.
5732
5733 2010-02-02  Doug Kwan  <dougkwan@google.com>
5734
5735         * Makefile.am (HFILES): Add arm-reloc-property.h.
5736         (DEFFILES): New.
5737         (TARGETSOURCES): Add arm-reloc-property.cc
5738         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5739         (libgold_a_SOURCES): $(DEFFILES)
5740         * Makefile.in: Regenerate.
5741         * arm-reloc-property.cc: New file.
5742         * arm-reloc-property.h: New file.
5743         * arm-reloc.def: New file.
5744         * arm.cc: Update comments.
5745         (arm-reloc-property.h): New included header.
5746         (arm_reloc_property_table): New global variable.
5747         (Target_arm::do_select_as_default_target): New method definition.
5748         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5749         arm-reloc-property to targ_extra_obj.
5750         * parameters.cc (set_parameters_target): Call
5751         Target::select_as_default_target().
5752         * target.h (Target::select_as_default_target): New method definition.
5753         (Target::do_select_as_default_target): Same.
5754
5755 2010-02-01  Doug Kwan  <dougkwan@google.com>
5756
5757         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5758         first_output_text_section_.
5759         (Arm_exidx_fixup::first_output_text_section): New method definition.
5760         (Arm_exidx_fixup::first_output_text_section_): New data member.
5761         (Arm_exidx_fixup::process_exidx_section): Record the first text
5762         output section seen.
5763         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5764         and entsize in output section header.
5765
5766 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5767
5768         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5769         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5770         (Arm_relocate_functions::thm_alu11): New Method.
5771         (Arm_relocate_functions::thm_pc8): New Method.
5772         (Arm_relocate_functions::thm_pc12): New Method.
5773         (Target_arm::Scan::local): Handle the relocations.
5774         (Target_arm::Scan::global): Likewise.
5775         (Target_arm::Relocate::relocate): Likewise.
5776         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5777
5778 2010-01-29  Doug Kwan  <dougkwan@google.com>
5779
5780         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5781         of relocation types as ld.
5782
5783 2010-01-29  Doug Kwan  <dougkwan@google.com>
5784
5785         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5786         to public.
5787         (Arm_relocate_functions::thumb_branch_common): Ditto.
5788         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5789         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5790         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5791         Arm_relocate_functions::jump24): Remove.
5792         (Target_arm::Relocate::relocate): Adjust code to call
5793         Arm_relocation_functions::arm_branch_common and
5794         Arm_relocation_functions::thumb_branch_common instead of their removed
5795         wrappers.  Merge switch-cases together to reduce source code size.
5796
5797 2010-01-29  Doug Kwan  <dougkwan@google.com>
5798
5799         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5800         output_local_symbol_count_needs_update_.
5801         (Arm_relobj::output_local_symbol_count_needs_update,
5802          Arm_relobj::set_output_local_symbol_count_needs_update,
5803          Arm_relobj::update_output_local_symbol_count): New methods.
5804         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5805         member.
5806         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5807         of pointed function as in a R_ARM_PREL31 relocation.
5808         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5809         for output local symbol count updating.
5810         (Target_arm::do_relax): Update output local symbol counts in objects
5811         if necessary.
5812         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5813
5814 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5815
5816         * arm.cc: Added support for the ARM relocations:
5817         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5818         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5819         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5820         movw_prel_nc).
5821         (Arm_relocate_functions::movw_rel): New method.
5822         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5823         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5824         thm_movw_prel_nc).
5825         (Arm_relocate_functions::thm_movw_rel): New method.
5826         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5827         thm_movt_prel).
5828         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5829         relocations.
5830         (Target_arm::Scan::global): Likewise.
5831         (Target_arm::Relocate::relocate): Likewise.
5832         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5833         Likewise.
5834
5835 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5836
5837         * arm.cc: Added support for ARM group relocations.
5838         (Target_arm::reloc_needs_sym_origin): New method.
5839         (Arm_relocate_functions::calc_grp_kn): New method.
5840         (Arm_relocate_functions::calc_grp_residual): New method.
5841         (Arm_relocate_functions::calc_grp_gn): New method.
5842         (Arm_relocate_functions::arm_grp_alu): New Method.
5843         (Arm_relocate_functions::arm_grp_ldr): New Method.
5844         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5845         (Arm_relocate_functions::arm_grp_ldc): New Method.
5846         (Target_arm::Scan::local): Handle the ARM group relocations.
5847         (Target_arm::Scan::global): Likewise.
5848         (Target_arm::Relocate::relocate): Likewise.
5849         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5850         Likewise.
5851
5852 2010-01-26  Doug Kwan  <dougkwan@google.com>
5853
5854         * arm.cc (set): Include.
5855         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5856         pointer type.
5857         (Arm_output_section::Text_section_list): New type.
5858         (Arm_output_section::append_text_sections_to_list): New method.
5859         (Arm_output_section::fix_exidx_coverage): Ditto.
5860         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5861         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5862         Relobj::set_section_offset() instead of
5863         Sized_relobj::invalidate_section_offset().
5864         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5865         parameter for section headers. Ignore relocation sections for
5866         unallocated sections and EXIDX sections.
5867         (Target_arm::fix_exidx_coverage): New method.
5868         (Target_arm::output_section_address_less_than): New type.
5869         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5870         linked text section instead of the EXIDX section.
5871         (Arm_output_section::create_stub_group): Add an assertion to check
5872         that this is not an EXIDX output section.
5873         (Arm_output_section::append_text_sections_to_list): New method.
5874         (Arm_output_section::fix_exidx_coverage): Ditto.
5875         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5876         Arm_relobj::section_needs_reloc_stub_scanning.
5877         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5878         first pass.
5879         (Target_arm::fix_exidx_coverage): New method.
5880         * object.h (Relobj::set_output_section): New method.
5881         (Sized_relobj::invalidate_section_offset): Remove method.
5882         (Sized_relobj::do_invalidate_section_offset): Remove method.
5883         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5884
5885 2010-01-25  Doug Kwan  <dougkwan@google.com>
5886
5887         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5888         Fix warning due to signed and unsigned comparison on a 32-bit host.
5889
5890 2010-01-22  Doug Kwan  <dougkwan@google.com>
5891
5892         * arm.cc (Target_arm::do_relax): Record an output section for section
5893         offset adjustment it contains any stub table that has changed.
5894         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5895         offsets in an output section if necessary.
5896         * output.cc (Output_section::Output_section): Initialize
5897         section_offsets_need_adjustments_.
5898         (Output_section::add_input_section_for_script): Renamed to
5899         Output_section::add_simple_input_section.
5900         (Output_section::save_states): Add a comment.
5901         (Output_section::discard_states): New method defintion.
5902         (Output_section::adjust_section_offsets): Same.
5903         * output.h (Output_section::add_input_section_for_script): Renamed to
5904         Output_section::add_simple_input_section.
5905         (Output_section::discard_states): New method declaration.
5906         (Output_section::adjust_section_offsets): Same.
5907         (Output_section::section_offsets_need_adjustment,
5908         Output_section::set_section_offsets_need_adjustment): New method
5909         definitions.
5910         (Output_section::section_offsets_need_adjustment_): New data member.
5911         * script-sections.cc
5912         (Output_section_element_input::set_section_address): Adjust code for
5913         renaming of Output_section::add_input_section_for_script.
5914         (Orphan_output_section::set_section_address): Same.
5915
5916 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5917
5918         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5919         Fix_v4bx enum values .
5920         * gold/options.h (General_options): New option definitions.
5921         (General_options::fix_v4bx): New method.
5922         (General_options::Fix_v4bx): New enum.
5923         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5924         (General_options::parse_fix_v4bx_interworking): New method.
5925
5926 2010-01-22  Doug Kwan  <dougkwan@google.com>
5927
5928         * arm.cc (Arm_exidx_fixup): New class.
5929
5930 2010-01-21  Doug Kwan  <dougkwan@google.com>
5931
5932         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5933         classes.
5934         (Arm_exidx_section_offset_map): New type.
5935
5936 2010-01-21  Doug Kwan  <dougkwan@google.com>
5937
5938         * arm.cc (Arm_exidx_input_section): New class.
5939         (Arm_relobj::exidx_input_section_by_link,
5940         Arm_relobj::exidx_input_section_by_shndx,
5941         Arm_relobj::make_exidx_input_section): New methods.
5942         (read_arm_attributes_section): Remove.
5943         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5944         information about them.
5945         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5946         to here.
5947
5948 2010-01-20  Doug Kwan  <dougkwan@google.com>
5949
5950         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5951         Input_section_specifier to Section_id.
5952         (Target_arm::new_arm_input_section: Adjust code for change of key
5953         type.
5954         (Target_arm::find_arm_input_section): Ditto.
5955         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5956         (Section_id): Remove.
5957         (Garbage_collection::Section_id_hash): Remove.
5958         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5959         (Section_id): Remove.
5960         (Icf::Section_id_hash): Remove.
5961         * object.h (Section_id, Const_section_id, Section_id_hash,
5962         Const_section_id_hash): New type definitions.
5963         * output.cc (Output_section::add_relaxed_input_section): Change to
5964         use Const_section_id instead of Input_section_specifier as key type.
5965         (Output_section::add_merge_input_section): Ditto.
5966         (Output_section::build_relaxation_map): Change to use Section_id
5967         instead of Input_section_specifier as key type.
5968         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5969         Ditto.
5970         (Output_section::convert_input_sections_to_relaxed_sections): Change
5971         to use Const_section_id instead of Input_section_specifier as key type.
5972         (Output_section::find_merge_section): Ditto.
5973         (Output_section::find_relaxed_input_section): Ditto.
5974         * output.h (Input_section_specifier): Remove class.
5975         (Output_section::Output_section_data_by_input_section_map): Change
5976         key type to Const_section_id.
5977         (Output_section::Output_relaxed_input_section_by_input_section_map):
5978         Ditto.
5979         (Output_section::Relaxation_map): Change key type to Section_id.
5980
5981 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5982
5983         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5984         (class Arm_v4bx_stub): New class.
5985         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5986         (Stub_factory::make_arm_v4bx_stub): New method.
5987         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5988         (Stub_table::empty): Handle v4bx stubs.
5989         (Stub_table::add_arm_v4bx_stub): New method.
5990         (Stub_table::find_arm_v4bx_stub): New method.
5991         (Arm_relocate_functions::v4bx): New method.
5992         (Target_arm::fix_v4bx): New method.
5993         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5994         (Stub_table::relocate_stubs): Likewise.
5995         (Stub_table::do_write): Likewise.
5996         (Stub_table::update_data_size_and_addralign): Likewise.
5997         (Stub_table::finalize_stubs):  Likewise.
5998         (Target_arm::Scan::local): Likewise.
5999         (Target_arm::Scan::global): Likewise.
6000         (Target_arm::do_finalize_sections): Likewise.
6001         (Target_arm::Relocate::relocate): Likewise.
6002         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6003         Likewise.
6004         (Target_arm::scan_reloc_for_stub): Likewise.
6005         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6006
6007 2010-01-19  Ian Lance Taylor  <iant@google.com>
6008
6009         * output.cc (Output_section_headers::do_sized_write): Write large
6010         segment count to sh_info field.
6011         (Output_file_header::do_sized_write): For large segment count,
6012         write PN_XNUM to e_phnum field.
6013
6014 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6015
6016         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6017         (Arm_relocate_functions::thm_jump8): New function.
6018         (Arm_relocate_functions::thm_jump11): New function.
6019         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6020         R_ARM_THM_JUMP11.
6021         (Target_arm::Scan::global): Likewise.
6022         (Target_arm::Relocate::relocate): Likewise.
6023         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6024         Likewise.
6025
6026 2010-01-14  Doug Kwan  <dougkwan@google.com>
6027
6028         * arm.cc (map, utility): Include headers.
6029         (Target_arm::apply_cortex_a8_workaround): New method.
6030         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6031         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6032         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6033         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6034         the --[no-]fix-cortex-a8 command line options.
6035         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6036         (Target_arm::relocate_stub): Use addend in instruction template.
6037         * options.h (DEFINE_bool): Set the user-set flag.
6038         (General_options): Add --[no-]-fix-cortex options.
6039         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6040         : Update fast look-up map after conversion.
6041
6042 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6043
6044         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6045         in the first pass of do_layout.
6046
6047 2010-01-13  Doug Kwan  <dougkwan@google.com>
6048
6049         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6050         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6051         apparent compiler problem of not folding static constant integral
6052         data members of elfcpp::Elf_sizes<32>.
6053
6054 2010-01-13  Doug Kwan  <dougkwan@google.com>
6055
6056         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6057         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6058         Arm_relobj::scan_section_for_cortex_a8_erratum,
6059         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6060         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6061         sections to scan for relocation stubs into a new method
6062         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6063         relocation and Cortex-A8 stub scanning.
6064         (Target_arm::do_relax): Force stubs to be after stubbed sections
6065         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6066         the beginning of a new relaxation pass.  Update a comment.
6067         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6068
6069 2010-01-12  Ian Lance Taylor  <iant@google.com>
6070
6071         * target-reloc.h (visibility_error): New inline function.
6072         (relocate_section): Call visibility_error.
6073         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6074         (MOSTLYCLEANFILES): Likewise.
6075         (protected_4_pic.o, protected_3.err): New targets.
6076         * testsuite/protected_4.cc: New file.
6077
6078 2010-01-12  Doug Kwan  <dougkwan@google.com>
6079
6080         * arm.cc (Cortex_a8_reloc): New class.
6081         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6082         and cortex_a8_relocs_info_.
6083         (Target_arm::fix_cortex_a8): New method definition.
6084         (Target_arm::Cortex_a8_relocs_info): New type.
6085         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6086         New data member declarations.
6087         (Target_arm::scan_reloc_for_stub): Record information about
6088         relocations for THUMB branches that might be exempted from the
6089         Cortex-A8 workaround.
6090         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6091         at the beginning of a relaxation pass.
6092
6093 2010-01-12  Doug Kwan  <dougkwan@google.com>
6094
6095         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6096         (Arm_relobj::Mapping_symbol_position,
6097          Arm_reloj::Mapping_symbol_position_less,
6098          Arm_relobj::Mapping_symbols_info): New types.
6099         (Target_arm::is_mapping_symbol_name): New method definition.
6100         (Arm_relobj::do_count_local_symbols): Save information about mapping
6101         symbols.
6102
6103 2010-01-11  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6106         Arm_relocate_functions::thumb32_branch_upper,
6107         Arm_relocate_functions::thumb32_branch_lower,
6108         Arm_relocate_functions::thumb32_cond_branch_offset,
6109         Arm_relocate_functions::thumb32_cond_branch_upper,
6110         Arm_relocate_functions::thumb32_cond_branch_lower,
6111         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6112         branch offset encoding.
6113         (Arm_relocate_functions::thumb_branch_common): Use new branch
6114         offset encoding methods to avoid code duplication.
6115         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6116         (Stub_addend_reader::operator()): Use new branch encoding method
6117         to avoid code duplication.
6118
6119 2010-01-11  Doug Kwan  <dougkwan@google.com>
6120
6121         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6122         (Target_arm::do_finalize_sections): Define special EXIDX section
6123         symbols only if referenced.
6124         * gc.h (Garbage_collection::add_reference): New method.
6125         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6126         code duplication.
6127
6128 2010-01-11  Ian Lance Taylor  <iant@google.com>
6129
6130         * script.cc (Version_script_info::build_expression_list_lookup):
6131         Change complaing about duplicate wildcard match from error to
6132         warning.
6133
6134         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6135         of 2009-12-30.
6136         (Version_script_info::Version_script_info): Initialize globs_,
6137         default_version_, default_is_global_, and exact_.  Don't
6138         initialize globals_ or locals_.
6139         (Version_script_info::build_lookup_tables): Build local symbols
6140         first.
6141         (Version_script_info::unquote): New function.
6142         (Version_script_info::add_exact_match): New function.
6143         (Version_script_info::build_expression_list_lookup): Remove lookup
6144         parameter.  Add is_global parameter.  Change all callers.  Handle
6145         wildcard pattern specially.  Unquote pattern.  Call
6146         add_exact_match.
6147         (Version_script_info::get_name_to_match): New function.
6148         (Version_script_info::get_symbol_version): New function.
6149         (Version_script_info::get_symbol_version_helper): Remove.
6150         (Version_script_info::check_unmatched_names): Call unquote.
6151         * script.h (class Version_script_info): Change get_symbol_version
6152         to be non-inline and add is_global parameter; change all callers.
6153         Rewrite symbol_is_local.  Update declarations.  Define struct
6154         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6155         Remove globals_ and locals_ members.  Add exact_, globs_,
6156         default_version_, is_global_.
6157         (Version_script_info::Glob): Remove pattern, add expression and
6158         is_global.  Update constructor.  Change all callers.
6159         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6160         default version.
6161         (Versions::symbol_section_contents): If a symbol is undefined, or
6162         defined in a dynamic object, set the version index to
6163         VER_NDX_LOCAL.
6164         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6165         symbol_is_local.
6166         (Symbol_table::add_from_pluginobj): Likewise.
6167         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6168
6169 2010-01-11  Doug Kwan  <dougkwan@google.com>
6170
6171         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6172         (incremental_dump_LDADD): Add linking option for libintl.
6173         * Makefile.in: Regenerate.
6174
6175 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6176
6177         PR gold/11144
6178         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6179         instead of -Ds.
6180         * testsuite/Makefile.in: Regenerated.
6181
6182 2010-01-10  Doug Kwan  <dougkwan@google.com>
6183
6184         * options.h (DEFINE_var): Use parentheses around argument varname__
6185         in macro body to avoid any unintended subsequent substitutions.
6186
6187 2010-01-10  Ian Lance Taylor  <iant@google.com>
6188
6189         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6190         candidates before doing symbol resolution.
6191
6192         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6193         ODR candidates if only one is weak.
6194
6195 2010-01-08  Ian Lance Taylor  <iant@google.com>
6196
6197         * script.cc (Version_script_info::build_expression_list_lookup):
6198         Don't warn about ambiguous version, just record the ambiguity.
6199         (Version_script_info::get_symbol_version_helper): Give error if
6200         version is ambiguous.
6201
6202 2010-01-08  Doug Kwan  <dougkwan@google.com>
6203
6204         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6205           prev_data_size_ and prev_addralign_.  Remove initializer for
6206           deleted data member has_been_changed_.
6207           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6208           to determine if the table is empty.
6209           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6210           Remove.
6211           (Stub_table::add_reloc_stub): Define method in class definition
6212           instead of just declaring it there.
6213           (Stub_table::add_cortex_a8_stub): New method definition.
6214           (Stub_table::update_data_size_and_addralign): Ditto.
6215           (Stub_table::finalize_stubs): Ditto.
6216           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6217           (Stub_table::do_addralign_): Return address alignment in the
6218           (Stub_table::do_reset_address_and_file_offset): Define method in
6219           class definition instead of declaring it there.  Set current data
6220           size to be the data size of the previous pass.
6221           (Stub_table::set_final_data_size): Use current data size as the
6222           final data size.
6223           (Stub_table::relocate_stub): Change parameter type of stub from
6224           Reloc_stub pointer to Stub pointer.
6225           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6226           (Stub_table::Cortex_a8_stub_list): New typedef.
6227           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6228            Stub_table::prev_addralign_): New data member.
6229           (Arm_relobj::Arm_relobj): Initialize data member
6230           section_has_cortex_a8_workaround_.
6231           (Arm_relobj::section_has_cortex_a8_workaround,
6232            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6233            definitions.
6234           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6235           declarations.
6236           (Target_arm::relocate_stub): Change parameter type of stub from
6237           Reloc_stub pointer to Stub pointer.
6238           (Insn_template::size, Insn_template::alignment): Handle
6239           THUMB16_SPECIAL_TYPE.
6240           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6241            Stub_table::update_data_size_and_addralign,
6242            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6243           definitions.
6244           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6245           (Stub_table::do_write): Ditto.
6246           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6247
6248 2010-01-08  Ian Lance Taylor  <iant@google.com>
6249
6250         PR 11108
6251         * symtab.h (class Symbol): Remove fields is_target_special_ and
6252         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6253         (Symbol::is_defined_in_discarded_section): New function.
6254         (Symbol::set_is_defined_in_discarded_section): New function.
6255         (Symbol::has_plt_offset): Rewrite.
6256         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6257         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6258         Don't initialize is_target_special_ or has_plt_offset_.
6259         Initialize is_defined_in_discarded_section_.
6260         (Symbol_table::add_from_relobj): If appropriate, set
6261         is_defined_in_discarded_section.
6262         * resolve.cc (Symbol::override_base_with_special): Don't test
6263         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6264         * target-reloc.h (relocate_section): Do special handling for
6265         symbols defined in discarded sections for global symbols as well
6266         as local symbols.
6267
6268 2010-01-08  Ian Lance Taylor  <iant@google.com>
6269
6270         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6271         the SHT_SYMTAB case.
6272
6273 2010-01-08  Ian Lance Taylor  <iant@google.com>
6274
6275         * object.cc (Sized_relobj::do_layout): Don't get confused if
6276         layout_eh_frame returns NULL.
6277
6278 2010-01-08  Ian Lance Taylor  <iant@google.com>
6279
6280         PR 11084
6281         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6282         dynamic symbol table, use the normal symbol table.
6283         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6284         symbol table.
6285
6286 2010-01-08  Ian Lance Taylor  <iant@google.com>
6287
6288         PR 11072
6289         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6290         sections.
6291
6292 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6293
6294         * version.cc (print_version): Change to "Copyright 2010".
6295
6296 2010-01-08  Ian Lance Taylor  <iant@google.com>
6297
6298         PR 10287
6299         PR 11063
6300         * i386.cc (class Target_i386): Change return type of plt_section
6301         to be non-const.
6302         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6303         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6304         tls_desc_rel_ field.
6305         (Output_data_plt_i386::rel_tls_desc): New function.
6306         (Target_i386::rel_tls_desc_section): New function.
6307         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6308         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6309         R_386_TLS_DESC reloc in rel_tls_desc_section.
6310         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6311         Define struct Tlsdesc_info.
6312         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6313         (Target_x86_64::do_reloc_symbol_index): New function.
6314         (Target_x86_64::add_tlsdesc_info): New function.
6315         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6316         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6317         tlsdesc_rel_ field.
6318         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6319         all callers.
6320         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6321         (Target_x86_64::rela_tlsdesc_section): New function.
6322         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6323         handling.
6324         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6325         (Target_x86_64::do_reloc_addend): New function.
6326         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6327         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6328         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6329         (Output_reloc::type): New function.
6330         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6331         (Output_reloc::is_target_specific): New function.
6332         (Output_reloc::target_arg): New function.
6333         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6334         absolute relocs and target specific relocs.
6335         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6336         add_target_specific.
6337         (class Output_data_reloc) [SHT_RELA]: Likewise.
6338         * output.cc (Output_reloc::Output_reloc): Add four new versions
6339         for absolute relocs and target specific relocs.
6340         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6341         (Output_reloc::get_symbol_index): Likewise.
6342         (Output_reloc::local_section_offset): Check that local_sym_index_
6343         is not TARGET_CODE or 0.
6344         (Output_reloc::symbol_value): Likewise.
6345         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6346         reloc.
6347         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6348         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6349         functions.
6350         * layout.cc (add_target_dynamic_tags): Use output section for
6351         DT_PLTRELSZ and DT_JMPREL.
6352
6353 2010-01-07  Ian Lance Taylor  <iant@google.com>
6354
6355         PR 11061
6356         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6357         function.
6358         (class Output_data_reloc_generic): Define.
6359         (class Output_data_reloc_base): Change base class to
6360         Output_data_reloc_generic.  Change add() method to call
6361         bump_relative_reloc_count for a relative reloc.  Remove
6362         sort_relocs_ field.
6363         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6364         to sort_relocs().
6365         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6366         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6367         appropriate.
6368         * layout.h (class Layout): Update declaration.
6369
6370 2010-01-07  Ian Lance Taylor  <iant@google.com>
6371
6372         * output.h (class Output_data): Add const version of
6373         output_section and do_output_section.
6374         (class Output_section_data): Add const version of
6375         do_output_section.
6376         (class Output_section): Likewise.
6377         * layout.cc (Layout::add_target_dynamic_tags): New function.
6378         * layout.h (class Layout): Update declarations.
6379         * arm.cc (Target_arm::do_finalize_sections): Use
6380         add_target_dynamic_tags.
6381         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6382         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6383         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6384         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6385
6386 2010-01-07  Ian Lance Taylor  <iant@google.com>
6387
6388         PR 11042
6389         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6390         object as needed.
6391
6392 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6393             Ian Lance Taylor  <iant@google.com>
6394
6395         PR 11019
6396         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6397         Xindex::read_symtab_xindex.
6398
6399 2010-01-07  Doug Kwan  <dougkwan@google.com>
6400
6401         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6402         (Insn_template::thumb16_bcond_insn): New method declaration.
6403         (Insn_template): Fix spelling.
6404         (Stub::thumb16_special): New method declaration.
6405         (Stub::do_write): Define virtual method which was previously pure
6406         virtual.
6407         (Stub::do_thumb16_special): New method declaration.
6408         (Stub::do_fixed_endian_write): New template member.
6409         (Reloc_stub::do_write): Remove.
6410         (Reloc_stub::do_fixed_endian_write): Remove.
6411         (Cortex_a8_stub): New class definition.
6412         (Stub_factory::make_cortex_a8_stub): New method definition.
6413         (Stub_factory::Stub_factory): Add missing static storage class
6414         qualifier for elf32_arm_stub_a8_veneer_blx.
6415
6416 2010-01-07  Ian Lance Taylor  <iant@google.com>
6417
6418         PR 10980
6419         * options.h (class General_options): Add --warn-unresolved-symbols
6420         and --error-unresolved-symbols.
6421         * errors.cc (Errors::undefined_symbol): Implement
6422         --warn-unresolved-symbols.
6423
6424         * options.h (class General_options): Add -z text and -z textoff.
6425         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6426
6427 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6428
6429         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6430         (Garbage_collection::cident_sections): New function.
6431         (Garbage_collection::add_cident_section): New function.
6432         (Garbage_collection::cident_sections_): New member.
6433         (gc_process_relocs): Add references to sections whose names are C
6434         identifiers.
6435         * gold.h (cident_section_start_prefix): New constant.
6436         (cident_section_stop_prefix): New constant.
6437         (is_cident): New function.
6438         * layout.cc (Layout::define_section_symbols): Replace string constants
6439         with the newly defined constants.
6440         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6441         C identifiers.
6442         * testsuite/Makefile.am: Add gc_orphan_section_test.
6443         * testsuite/Makefile.in: Regenerate.
6444         * testsuite/gc_orphan_section_test.cc: New file.
6445         * testsuite/gc_orphan_section_test.sh: New file.
6446
6447 2010-01-06  Ian Lance Taylor  <iant@google.com>
6448
6449         PR 10980
6450         * options.h (class General_options): Add --warn-shared-textrel.
6451         * layout.cc (Layout::finish_dynamic_section): Implement
6452         --warn-shared-textrel.
6453
6454         PR 10980
6455         * options.h (class General_options): Add --warn-multiple-gp.
6456
6457 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6458
6459         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6460         $(THREADSLIB) and $(LIBDL).
6461         * Makefile.in: Rebuild.
6462
6463 2010-01-06  Ian Lance Taylor  <iant@google.com>
6464
6465         PR 10980
6466         * options.cc (General_options::parse_section_start): New function.
6467         (General_options::section_start): New function.
6468         (General_options::General_options): Initialize all members.
6469         * options.h: Include <map>
6470         (class General_options): Add --section-start.  Add section_starts_
6471         member.
6472         * layout.cc (Layout::attach_allocated_section_to_segment): If
6473         --section-start was used, set the address of the segment.  Remove
6474         local sort_sections.
6475         (Layout::relaxation_loop_body): If the address of the load segment
6476         has been set by --section-start, don't use it.
6477         * output.h (Output_segment::update_flags_for_output_section): New
6478         function.
6479         * output.cc (Output_segment::add_output_section): Call
6480         update_flags_for_output_section.
6481
6482 2010-01-05  Ian Lance Taylor  <iant@google.com>
6483
6484         PR 10980
6485         * options.h (class General_options): Add --undefined-version.
6486         * script.cc (struct Version_expression): Add was_matched_by_symbol
6487         field.
6488         (Version_script_info::matched_symbol): New function.
6489         (Version_script_info::get_symbol_version_helper): Call
6490         matched_symbol.
6491         (Version_script_info::check_unmatched_names): New function.
6492         * script.h (class Version_script_info): Update declarations.
6493         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6494
6495         * options.h (class General_options): Use DEFINE_bool_alias for
6496         allow_multiple_definition.
6497         * resolve.cc (Symbol_table::should_override): Don't test
6498         allow_multiple_definition.
6499
6500         PR 10980
6501         * options.h (class General_options): Add --cref.
6502         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6503         until after printing cref table.
6504         * cref.cc: Include "symtab.h".
6505         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6506         (Cref_table_compare::operator()): New function.
6507         (Cref_inputs::gather_cref): New function.
6508         (filecol): New static const.
6509         (Cref_inputs::print_cref): New function.
6510         (Cref::print_cref): New function.
6511         * cref.h: Include <cstdio>.
6512         (class Cref): Update declarations.
6513         * mapfile.h (Mapfile::file): New function.
6514         * object.h (class Object): Define Symbols.  Declare virtual
6515         do_get_global_symbols.
6516         (Object::get_global_symbols): New function.
6517         * object.cc (Input_objects::add_object): Pass object to cref_ if
6518         --cref.
6519         (Input_objects::archive_start): Likewise.
6520         (Input_objects::archive_stop): Likewise.
6521         (Input_objects::print_cref): New function.
6522         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6523         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6524         --cref.
6525         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6526         function.
6527         * plugin.h (class Sized_pluginobj): Update declarations.
6528
6529 2010-01-05  Ian Lance Taylor  <iant@google.com>
6530
6531         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6532         to is_default_version.  Rename insdef to insdefault.
6533         (Symbol_table::add_from_relobj): Rename def to is_default_version
6534         and local to is_forced_local.
6535         (Symbol_table::add_from_pluginobj): Likewise.
6536         (Symbol_table::add_from_dynobj): Likewise.
6537         (Symbol_table::define_special_symbol): Rename insdef to
6538         insdefault.
6539
6540 2010-01-04  Ian Lance Taylor  <iant@google.com>
6541
6542         PR 10980
6543         * options.h (class General_options): Add
6544         --allow-multiple-definition and -z muldefs.
6545         * resolve.cc (Symbol_table::should_override): Don't warn about a
6546         multiple symbol definition if --allow-multiple-definition or -z
6547         muldefs.
6548
6549         PR 10980
6550         * options.h (class General_options): Add --add-needed and
6551         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6552         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6553         error if --copy-dt-needed-entries aka --add-needed is used and
6554         would cause a change in behaviour.
6555
6556         PR 10980
6557         * options.h (class General_options): Add -G as a short version of
6558         --shared.  Add no-op options -assert, -g, and -i.
6559
6560 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6561
6562         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6563         check for .text or .gnu.linkonce.t sections.
6564         * icf.cc (Icf::find_identical_sections): Ditto.
6565         Change the detection for mangled function name within the section
6566         name.
6567         * icf.h (is_section_foldable_candidate): New function.
6568
6569 2009-12-30  Ian Lance Taylor  <iant@google.com>
6570
6571         PR 10980
6572         * options.h (class General_options): Permit two dashes with
6573         --retain-symbols-file.
6574
6575 2009-12-30  Ian Lance Taylor  <iant@google.com>
6576
6577         PR 10979
6578         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6579         don't put the file header and segment headers in the text
6580         segment.
6581
6582         PR 10979
6583         * common.cc (Sort_commons::operator()): Stabilize sort when both
6584         entries are NULL.
6585         (Symbol_table::do_allocate_commons_list): When allocating common
6586         symbols, skip a symbol which is no longer common.
6587         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6588         an object before checking its type.
6589         * testsuite/common_test_2.c: New file.
6590         * testsuite/common_test_3.c: New file.
6591         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6592         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6593         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6594         (common_test_2_pic.o, common_test_2.so): New targets.
6595         (common_test_3_pic.o, common_test_3.so): New targets.
6596         * testsuite/Makefile.in: Rebuild.
6597
6598         PR 10979
6599         * script.cc (read_input_script): If we see a new SECTIONS clause,
6600         and we have added an input section, give an error.
6601         * layout.h (class Layout): Add have_added_input_section function.
6602         Add have_added_input_section_ field.
6603         * layout.cc (Layout::Layout): Initialize
6604         have_added_input_section_.
6605         (Layout::layout): Set have_added_input_section_.
6606         (Layout::layout_eh_frame): Likewise.
6607
6608 2009-12-30  Ian Lance Taylor  <iant@google.com>
6609
6610         PR 10931
6611         * options.h (class General_options): Add --sort-common option.
6612         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6613         * common.cc (Sort_common): Add sort_order parameter to
6614         constructor.  Add sort_order_ field.
6615         (Sort_commons::operator): Check sort_order_.
6616         (Symbol_table::allocate_commons): Determine the sort order.
6617         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6618         Change all callers.
6619         (Symbol_table::do_allocate_commons_list): Likewise.
6620
6621 2009-12-30  Ian Lance Taylor  <iant@google.com>
6622
6623         PR 10916
6624         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6625         symbols from this object, don't change the visibility of an
6626         undefined symbol.
6627         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6628
6629 2009-12-30  Ian Lance Taylor  <iant@google.com>
6630
6631         PR 10861
6632         * script.h (class Version_script_info): Define Language enum.
6633         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6634         new fields globals_, locals_, and is_finalized_.
6635         * script.cc: Various formatting fixes.
6636         (class Parser_closure): Change language_stack_ from a vector of
6637         std::string to one of Version_script_info::Language.  Adjust all
6638         uses accordingly.
6639         (class Lazy_demangler): Remove.
6640         (struct Version_expression): Change language from std::string to
6641         Version_script_info::Language.
6642         (Version_script_info::Version_script_info): New function.
6643         (Version_script_info::~Version_script_info): Don't call clear.
6644         (Version_script_info::finalize): New function.
6645         (Version_script_info::build_lookup_tables): New function.
6646         (Version_script_info::build_expression_list_lookup): New
6647         function.
6648         (Version_script_info::get_symbol_version_helper): Rewrite to use
6649         lookup tables.
6650         (Version_script_info::print_expression_list): Adjust to use
6651         Version_script_info::Language.
6652         (script_push_lex_into_version_mode): Check that the version script
6653         has not been finalized.
6654         (version_script_push_lang): Change language string to
6655         Version_script_info::Language.
6656         * options.cc (Command_line::version_script): New function.
6657         * options.h (class General_options): Add finalize_dynamic_list
6658         function.  Change version_script from declaration to definition.
6659         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6660         * testsuite/version_script.map: Remove duplicate def of foo.
6661         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6662         version_script.map.
6663         * testsuite/Makefile.in: Rebuild.
6664
6665 2009-12-30  Ian Lance Taylor  <iant@google.com>
6666
6667         PR 10843
6668         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6669         if the input symbol index is 0, make the output symbol index 0.
6670
6671 2009-12-30  Ian Lance Taylor  <iant@google.com>
6672
6673         PR 10670
6674         * options.h (class General_options): Add -x/--discard-all.
6675         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6676         --discard-all.  If the local symbol needs a dynamic entry, check
6677         that before handling --discard-locals.
6678
6679 2009-12-30  Ian Lance Taylor  <iant@google.com>
6680
6681         PR 10450
6682         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6683         flags to PF_R.
6684         (Output_segment::add_output_section): Don't change the flags if
6685         the type is PT_TLS.
6686
6687         PR 10450
6688         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6689         GNU hash table if they need a dynamic value.  Otherwise, don't add
6690         them if they are defined in a dynamic object or are forced local.
6691
6692 2009-12-29  Ian Lance Taylor  <iant@google.com>
6693
6694         PR 10450
6695         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6696         .gnu.hash table for a 32-bit target.
6697
6698         PR 10450
6699         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6700         regular and a dynamic object only needs a dynamic symbol table
6701         entry if it is externally visible.
6702
6703         PR 10450
6704         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6705         constructor.  Add global_offset_table_ field.
6706         (Target_i386::got_section): Set global_offset_table_.
6707         (Target_i386::do_finalize_sections): Set global_offset_table_
6708         size.
6709         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6710         in constructor.  Add global_offset_table_ field.
6711         (Target_x86_64::got_section): Set global_offset_table_.
6712         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6713         size.
6714
6715         * layout.cc (Layout::Layout): Initialize increase_relro_.
6716         (Layout::get_output_section): Add is_relro, is_last_relro, and
6717         is_first_non_relro parameters.  Change all callers.
6718         (Layout::choose_output_section): Likewise.
6719         (Layout::add_output_section_data): Likewise.
6720         (Layout::make_output_section): Likewise.
6721         (Layout::set_segment_offsets): Clear increase_relro when using a
6722         linker script.
6723         * layout.h (class Layout): Add increase_relro method.  Add
6724         increase_relro_ field.  Update declarations.
6725         * output.cc (Output_section::Output_section): Initialize
6726         is_last_relro_ and is_first_non_relro_.
6727         (Output_segment::add_output_section): Group relro sections is
6728         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6729         (Output_segment::maximum_alignment): Remove relro handling.
6730         (Output_segment::set_section_addresses): Add increase_relro
6731         parameter.  Change all callers.  Add initial alignment to align
6732         relro sections on separate page.  Remove old relro handling.
6733         (Output_segment::set_section_list_addresses): Remove in_relro
6734         parameter.  Change all callers.
6735         (Output_segment::set_offset): Add increase parameter.  Change all
6736         callers.  Remove old relro handling.
6737         * output.h (class Output_section): Add new methods: is_last_relro,
6738         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6739         Add is_last_relro_ and is_first_non_relro_ fields.
6740         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6741         Create separate .got.plt section.  Call increase_relro.
6742         * x86_64.cc (Target_x86_64::got_section): Likewise.
6743         * testsuite/relro_script_test.t: Add .got.plt.
6744
6745         PR 10450
6746         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6747         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6748         (Layout::finalize): Call set_dynamic_symbol_size.
6749         (Layout::set_dynamic_symbol_size): New function.
6750         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6751         set_dynamic_symbol_size.
6752
6753         PR 10450
6754         * output.h (class Output_section): Add is_entsize_zero_ field.
6755         * output.cc (Output_section::Output_section): Initialize
6756         is_entsize_zero_.
6757         (Output_section::set_entsize): If two different entsizes are
6758         requested, force it to zero.
6759         (Output_section::add_input_section): Set flags for .debug_str
6760         before updating section flags.  Set entsize.
6761         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6762         and SHF_STRING if all input sections have those flags.
6763
6764 2009-12-29   Rafael Espindola  <espindola@google.com>
6765
6766         * main.cc (main): Fix the sys time reporting.
6767         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6768         reporting.
6769
6770 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6771
6772         * options.cc (General_options::parse_version): Allow -v to exit
6773         without an error if there is nothing to link.
6774
6775 2009-12-29  Ian Lance Taylor  <iant@google.com>
6776
6777         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6778         using a version of gcc before 4.1.
6779         * configure: Rebuild.
6780
6781 2009-12-28  Chris Demetriou  <cgd@google.com>
6782
6783         * attributes.cc (Output_attributes_section_data::do_write): Use
6784         std::vector::front rather than std::vector::data.
6785
6786 2009-12-28  Ian Lance Taylor  <iant@google.com>
6787
6788         * symtab.h (class Symbol_table): Add enum Defined.
6789         * resolve.cc (Symbol_table::should_override): Add defined
6790         parameter.  Change all callers.  Test whether object is NULL
6791         before calling a method on it.
6792         (Symbol_table::report_resolve_problem): Add defined parameter.
6793         Change all callers.
6794         (Symbol_table::should_override_with_special): Likewise.
6795         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6796         parameter.  Change all callers.
6797         (Symbol_table::do_define_in_output_data): Likewise.
6798         (Symbol_table::define_in_output_segment): Likewise.
6799         (Symbol_table::do_define_in_output_segment): Likewise.
6800         (Symbol_table::define_as_constant): Likewise.
6801         (Symbol_table::do_define_as_constant): Likewise.
6802         * script.h (class Symbol_assignment): Add is_defsym parameter to
6803         constructor; change all callers.
6804         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6805         parameter.  Change all callers.  Add is_defsym_ field.
6806         (class Parser_closure): Add parsing_defsym parameter to
6807         constructor; change all callers.  Add parsing_defsym accessor
6808         function.  Add parsing_defsym_ field.
6809
6810 2009-12-28  Ian Lance Taylor  <iant@google.com>
6811
6812         * gold.cc (queue_middle_tasks): Fix formatting.
6813         * object.cc (Relobj::is_section_name_included): Likewise.
6814
6815 2009-12-23  Ian Lance Taylor  <iant@google.com>
6816
6817         * i386.cc (Target_i386::do_calls_non_split): Recognize
6818         -fsplit-stack prologue for a function with a static chain.
6819         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6820         -fsplit-stack prologue when using %r11.
6821
6822 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6823
6824         * options.cc (General_options::parse_version): Make -v continue and do
6825         the link like GNU ld does.
6826
6827 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6828
6829         * Makefile.am (CCFILES): Add timer.cc.
6830         (HFILES): Add timer.h.
6831         * configure.ac: Check for sysconf and times.
6832         * main.cc: include timer.h.
6833         (main): Use Timer instead of get_run_time.
6834         * timer.cc: New.
6835         * timer.h: New.
6836         * workqueue.cc: include timer.h.
6837         (Workqueue::find_and_run_task):
6838         Report user, sys and wall time.
6839         * Makefile.in: Regenerate.
6840         * config.in: Regenerate.
6841         * configure: Regenerate.
6842
6843 2009-12-16  Doug Kwan  <dougkwan@google.com>
6844
6845         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6846         sections.
6847         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6848         relaxed input sections.
6849         * output.cc (Output_section::find_relaxed_input_section): Change
6850         return type to Output_relaxed_input_section pointer.  Adjust code
6851         for new type of relaxed_input_section_map_.
6852         * output.h (Output_section::find_relaxed_input_section): Change
6853         return type to Output_relaxed_input_section pointer.
6854         (Output_section::Output_relaxed_input_section_by_input_section_map):
6855         New type.
6856         (Output_section::relaxed_input_section_map_): Change type to
6857         Output_section::Output_relaxed_input_section_by_input_section_map.
6858         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6859         input section.
6860
6861 2009-12-15  Ian Lance Taylor  <iant@google.com>
6862
6863         * layout.cc (Layout::create_shstrtab): Only write out after input
6864         sections if we are compressing debug sections.
6865
6866 2009-12-15  Ian Lance Taylor  <iant@google.com>
6867
6868         * archive.cc (Archive::add_symbols): Only look up a symbol without
6869         a version if there is, in fact, a version.
6870
6871 2009-12-14  Ian Lance Taylor  <iant@google.com>
6872
6873         Revert -Wshadow changes, all changes from:
6874         2009-12-11  Doug Kwan  <dougkwan@google.com>
6875         2009-12-11  Nick Clifton  <nickc@redhat.com>
6876         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6877
6878 2009-12-11  Doug Kwan  <dougkwan@google.com>
6879
6880         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6881         due to -Wshadow.
6882         * attributes.cc (Object_attribute::size): Ditto.
6883         (Attributes_section_data::size): Ditto.
6884         (Attributes_section_data::Attributes_section_data): Ditto.
6885         (Output_attributes_section_data::do_write): Ditto.
6886         * attributes.h (Object_attribute::set_type): Ditto.
6887         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6888
6889 2009-12-11  Nick Clifton  <nickc@redhat.com>
6890
6891         * archive.cc: Fix shadowed variable warnings.
6892         * arm.cc: Likewise.
6893         * compressed_output.cc: Likewise.
6894         * compressed_output.h: Likewise.
6895         * configure: Likewise.
6896         * dwarf_reader.cc: Likewise.
6897         * dynobj.cc: Likewise.
6898         * dynobj.h: Likewise.
6899         * ehframe.cc: Likewise.
6900         * ehframe.h: Likewise.
6901         * errors.cc: Likewise.
6902         * expression.cc: Likewise.
6903         * fileread.cc: Likewise.
6904         * fileread.h: Likewise.
6905         * freebsd.h: Likewise.
6906         * i386.cc: Likewise.
6907         * icf.cc: Likewise.
6908         * incremental.h: Likewise.
6909         * layout.cc: Likewise.
6910         * layout.h: Likewise.
6911         * mapfile.cc: Likewise.
6912         * merge.cc: Likewise.
6913         * merge.h: Likewise.
6914         * object.cc: Likewise.
6915         * object.h: Likewise.
6916         * options.h: Likewise.
6917         * output.cc: Likewise.
6918         * output.h: Likewise.
6919         * parameters.cc: Likewise.
6920         * plugin.cc: Likewise.
6921         * powerpc.cc: Likewise.
6922         * reduced_debug_output.cc: Likewise.
6923         * reduced_debug_output.h: Likewise.
6924         * reloc.cc: Likewise.
6925         * reloc.h: Likewise.
6926         * resolve.cc: Likewise.
6927         * script-sections.cc: Likewise.
6928         * script.cc: Likewise.
6929         * script.h: Likewise.
6930         * sparc.cc: Likewise.
6931         * symtab.cc: Likewise.
6932         * symtab.h: Likewise.
6933         * target-select.cc: Likewise.
6934         * target-select.h: Likewise.
6935         * token.h: Likewise.
6936         * workqueue.cc: Likewise.
6937         * workqueue.h: Likewise.
6938         * x86_64.cc: Likewise.
6939
6940 2009-12-10  Doug Kwan  <dougkwan@google.com>
6941
6942         * arm.cc (attributes.h): New include.
6943         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6944         (Arm_relobj::~Arm_relobj): Delete object pointed by
6945         attributes_section_data_.
6946         (Arm_relobj::attributes_section_data): New method definition.
6947         (Arm_relobj::attributes_section_data_): New data member declaration.
6948         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6949         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6950         attributes_section_data_.
6951         (Arm_dynobj::attributes_section_data): New method definition.
6952         (Arm_dynobj::attributes_section_data_): New data member declaration.
6953         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6954         initialization value of may_use_blx_ to false.
6955         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6956         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6957         object attributes to compute results instead of hard-coding.
6958         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6959         Target_arm::get_secondary_compatible_arch,
6960         Target_arm::set_secondary_compatible_arch
6961         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6962         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6963         New method declarations.
6964         (Target_arm::get_aeabi_object_attribute): New method definition.
6965         (Target_arm::attributes_section_data_): New data member declaration.
6966         (read_arm_attributes_section): New template definition.
6967         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6968         (Arm_dynobj::do_read_symbols): Ditto.
6969         (Target_arm::do_finalize_sections): Merge attributes sections from
6970         input.  Check for BLX use after attributes section merging.
6971         Fix __exidx_start and __exidx_end visibility.  Create an
6972         .ARM.attributes section if necessary.
6973         (Target_arm::get_secondary_compatible_arch,
6974         Target_arm::set_secondary_compatible_arch,
6975         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6976         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6977         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6978         New method definitions.
6979
6980 2009-12-09  Ian Lance Taylor  <iant@google.com>
6981
6982         * plugin.cc (Plugin::load): Don't cast from void* to a function
6983         pointer.
6984
6985 2009-12-09  Ian Lance Taylor  <iant@google.com>
6986
6987         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6988         information fields.
6989
6990 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6991
6992         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6993         Replace two_file_shared_1.so with two_file_shared_2.so.
6994         * testsuite/Makefile.in: Regenerated.
6995
6996 2009-12-08  Doug Kwan  <dougkwan@google.com>
6997
6998         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6999         (HFILES): Add attributes.h and int_encoding.h.
7000         * Makefile.in: Regenerate.
7001         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7002         function definitions to int_encoding.cc
7003         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7004         prototypes to int_encoding.h
7005         * reduced_debug_output.cc (int_encoding.h): New include.
7006         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7007         function definitions to int_encoding.cc
7008         (insert_into_vector, read_from_pointer): Move template definitions to
7009         int_encoding.h
7010         * attributes.cc: New file.
7011         * attributes.h: New file.
7012         * int_encoding.cc: New file.
7013         * int_encoding.h: New file.
7014
7015 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7016
7017         PR gold/11055
7018         * incremental-dump.cc (dump_incremental_inputs): New.
7019         (main): Use dump_incremental_inputs.
7020
7021 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7022
7023         PR gold/10893
7024         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7025         checking elfcpp::STT_FUNC.
7026         (Target_i386::Relocate::relocate): Likewise.
7027         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7028
7029         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7030         symbols from shared libraries into normal FUNC symbols.
7031
7032         * symtab.h (Symbol): Add is_func and use it.
7033
7034 2009-12-05  Doug Kwan  <dougkwan@google.com>
7035
7036         * arm.cc (Target_arm::arm_info): Initialize new fields
7037         attributes_section and attributes_vendor.
7038         * i386.cc (Target_i386::i386_info): Same.
7039         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7040         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7041         fields attributes_section and attributes_vendor.
7042         * sparc.cc (Target_sparc::sparc_info): Same.
7043         * target.h (Target::attributes_section, Target::attributes_vendor,
7044         Target::is_attributes_section, Target::attribute_arg_type,
7045         Target::attributes_order): New method definitions.
7046         (Target::Target_info::attributes_section,
7047         Target::Target_info::attributes_vendor): New fields.
7048         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7049         virtual method definitions.
7050         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7051         attributes_section and attributes_vendor.
7052         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7053
7054 2009-12-05  Doug Kwan  <dougkwan@google.com>
7055
7056         * arm.cc: Update comments about interworking and stub generation.
7057         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7058         considered as non-PIC.
7059         (Arm_relocate_functions::base_abs): Fix formatting.
7060         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7061         of function to use GOT entry address instead of offset.
7062         (Target_arm::Scan::global): Issue an error if a symbol would need a
7063         PLT does not get one because it is untyped.  Remove code to create
7064         dynamic symbols for relative branches.
7065         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7066         takes unsigned integer instead of boolean.
7067
7068 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7069
7070         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7071         (two_file_test_LDADD): Likewise.
7072         (common_test_1_LDADD): Likewise.
7073         (exception_test_LDADD) Likewise.
7074         (weak_test_LDADD): Likewise.
7075         (many_sections_test_LDADD): Likewise.
7076         (initpri1_LDADD): Likewise.
7077         (script_test_1_LDADD): Likewise.
7078         (script_test_2_LDADD): Likewise.
7079         (justsyms_LDADD): Likewise.
7080         (binary_test_LDADD): Likewise.
7081         (large_LDADD): Likewise.
7082         * testsuite/Makefile.in: Regenerated.
7083
7084 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7085
7086         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7087         (Symbol_table::override_with_special): Likewise.
7088         (Symbol_table::add_from_object): Likewise.
7089
7090 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7091
7092         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7093         Don't set the data_offset twice.
7094
7095 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7096
7097         * testsuite/Makefile.in: Regenerate.
7098
7099 2009-12-03  Doug Kwan  <dougkwan@google.com>
7100
7101         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7102         (Target_arm::do_finalize_sections): Add parameter for symbol table
7103         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7104         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7105         parameter for symbol table pointer.
7106         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7107         an additional parameter for a pointer to symbol table.
7108         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7109         parameter for a symbol table pointer.
7110         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7111         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7112         Ditto.
7113         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7114         parameter for a symbol table pointer.
7115
7116 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7117
7118         * incremental.cc (Incremental_inputs_header)
7119         (Incremental_inputs_header_write, Incremental_inputs_entry)
7120         (Incremental_inputs_entry_write): Move ...
7121         * incremental.h (Incremental_inputs_header)
7122         (Incremental_inputs_header_write, Incremental_inputs_entry)
7123         (Incremental_inputs_entry_write): here.
7124
7125 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7126
7127         * incremental.cc (make_sized_incremental_binary): Set the target.
7128         Error if it is incompatible.
7129         * output.h (Output_file): Add filename method.
7130
7131 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7132
7133         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7134         from the get_* methods.
7135
7136 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7137
7138         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7139         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7140         Write 0 for the data_offset of scripts.
7141
7142 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7143
7144         * testsuite/Makefile.am: Add the incremental_test.sh test.
7145         * testsuite/incremental_test.sh: New.
7146         * testsuite/incremental_test_1.c: New.
7147         * testsuite/incremental_test_2.c: New.
7148
7149 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7150
7151        * incremental-dump.cc (main): Fix typos.
7152
7153 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7154
7155         PR gold/11025
7156         * incremental-dump.cc (main): Use llu to print 64 bit values.
7157
7158 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7159             H.J. Lu  <hongjiu.lu@intel.com>
7160
7161         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7162         $(LIBDL).
7163         (incremental_dump_LDADD): Likewise.
7164         * Makefile.in: Regenerated.
7165
7166 2009-11-25  Doug Kwan  <dougkwan@google.com>
7167
7168         Revert:
7169
7170         2009-11-25  Doug Kwan  <dougkwan@google.com>
7171
7172                 * arm.cc (Target_arm::Target_arm): Move method definition
7173                 outside of class definition.  Add code to handle
7174                 --target1-rel, --target1-abs and --target2= options.
7175                 (Target_arm::get_reloc_reloc_type): Change method to be
7176                 non-static and const.
7177                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7178                 New data member declaration.
7179                 (Target_arm::Scan::local, Target_arm::Scan::global,
7180                 Target_arm::Relocate::relocate,
7181                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7182                 Adjust call to Target_arm::get_real_reloc_type.
7183                 (Target_arm::get_real_reloc_type): Use command line options
7184                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7185                 * options.h (--target1-rel, --target1-abs, --target2): New
7186                 ARM-only options.
7187
7188 2009-11-25  Doug Kwan  <dougkwan@google.com>
7189
7190         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7191         class definition.  Add code to handle --target1-rel, --target1-abs
7192         and --target2= options.
7193         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7194         and const.
7195         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7196         member declaration.
7197         (Target_arm::Scan::local, Target_arm::Scan::global,
7198         Target_arm::Relocate::relocate,
7199         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7200         call to Target_arm::get_real_reloc_type.
7201         (Target_arm::get_real_reloc_type): Use command line options to
7202         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7203         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7204         options.
7205
7206 2009-11-25  Doug Kwan  <dougkwan@google.com>
7207
7208         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7209         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7210         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7211         formatting.
7212         (Arm_relocate_functions::thm_call): Replace body with a call to
7213         Arm_relocate_functions::thumb_branch_common.
7214         (Arm_relocate_functions::thm_jump24,
7215         Arm_relocate_functions::thm_xpc22): New method definitions.
7216         (Arm_relocate_functions::thumb_branch_common): New method definition.
7217         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7218         operator.
7219         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7220         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7221
7222 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7223
7224         * Makefile.am: Build incremental-dump
7225         * Makefile.in: Regenerate.
7226         * incremental-dump.cc: New.
7227         * incremental.cc (Incremental_inputs_header_data,
7228         Incremental_inputs_entry_data): Move to incremental.h
7229         * incremental.h: (Incremental_inputs_header_data,
7230         Incremental_inputs_entry_data): Move from incremental.cc
7231
7232 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7233
7234         * incremental.cc (Incremental_inputs_header,
7235         Incremental_inputs_header_write, Incremental_inputs_entry,
7236         Incremental_inputs_entry_write): Add a typedef with the data type.
7237
7238 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7239
7240         * incremental.cc (Incremental_inputs_header,
7241         Incremental_inputs_header_write, Incremental_inputs_entry,
7242         Incremental_inputs_entry_write): Update comment about which
7243         type has the filed descriptions.
7244
7245 2009-11-15  Doug Kwan  <dougkwan@google.com>
7246
7247         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7248         (Arm_relocate_functions::arm_branch_common): Change method defintion
7249         in class definition to a method declaration and update list of formal
7250         parameters.
7251         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7252         Arm_relocation_functions::jump24): Adjust call to
7253         Arm_relocate_functions::arm_branch_common.  Update list of formal
7254         parameters.
7255         (Arm_relocate_functions::xpc25): New method definition.
7256         (Arm_relocate_functions::arm_branch_common): Move method defintion
7257         out from class definition.  Use stubs for mode-switching and extending
7258         branch ranges.
7259         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7260         specially.  Change code to enable use of stubs in ARM branches.
7261
7262 2009-11-10  Doug Kwan  <dougkwan@google.com>
7263
7264         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7265         in method declaration.
7266         (Target_arm::relocate_stub): New method declaration.
7267         (Target_arm::default_target): Change to return a pointer instead of
7268         a const reference.
7269         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7270         Target_arm::default_target.
7271         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7272         method definition.
7273         (Target_arm::relocate_section): Adjust view.
7274         (Target_arm::relocate_stub): New method definition.
7275
7276 2009-11-10  Doug Kwan  <dougkwan@google.com>
7277
7278         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7279         a format warning.
7280         * incremental.cc (open_incremental_binary): Initialized local
7281         variables to avoid warnings.
7282         * object.cc (make_elf_object): Ditto.
7283         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7284         a format warning.
7285
7286 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7287
7288         PR gold/10930
7289         * testsuite/plugin_test.c: Include "config.h".
7290
7291 2009-11-09  Doug Kwan  <dougkwan@google.com>
7292
7293         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7294         (arm_symbol_value): Remove.
7295         (Arm_relocate_functions::arm_branch_common,
7296         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7297         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7298         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7299         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7300         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7301         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7302         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7303         Arm_relocate_functions::thm_mobw_abs_nc,
7304         Arm_relocate_functions::thm_mov_abs,
7305         Arm_relocate_functions::movw_prel_nc,
7306         Arm_relocate_functions::thm_movt_abs,
7307         Arm_relocate_functions::movt_prel,
7308         Arm_relocate_functions::thm_movw_prel_nc,
7309         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7310         (Target_arm::Relocate::relocate): Only decompose address into two
7311         parts if relocation type uses the thumb-bit and pass the actual
7312         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7313         calls to methods in Arm_relocate_functions for this change.
7314
7315 2009-11-08  Ian Lance Taylor  <iant@google.com>
7316
7317         PR 10925
7318         * reloc.cc: Instantiate
7319         Sized_relobj::initialize_input_to_output_maps and
7320         Sized_relobj:free_input_to_output_maps.
7321
7322 2009-11-06  Ian Lance Taylor  <iant@google.com>
7323
7324         PR 10876
7325         * defstd.cc (in_segment): Set only_if_ref true for "end".
7326
7327 2009-11-06  Doug Kwan  <dougkwan@google.com>
7328
7329         * arm.cc (class Reloc_stub): Correct a comment.
7330         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7331         (Target_arm::scan_section_for_stubs): New method declaration.
7332         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7333         Change methods from private to protected.
7334         (Target_arm::do_may_relax): New method definition.
7335         (Target_arm::do_relax, Target_arm::group_sections,
7336         Target_arm::scan_reloc_for_stub,
7337         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7338         (Target_arm::arm_input_section_map_): New data member declaration.
7339         (Target_arm::scan_reloc_for_stub,
7340         Target_arm::scan_reloc_section_for_stubs,
7341         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7342         Target_arm::do_relax): New method definitions.
7343
7344 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7345
7346         * configure.ac: Check for (struct stat)::st_mtim
7347         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7348         * config.in: Regenerate.
7349         * configure: Regenerate.
7350
7351 2009-11-05  Ian Lance Taylor  <iant@google.com>
7352
7353         PR 10910
7354         * output.cc (Output_segment::add_output_section): Add missing
7355         return statement.
7356
7357 2009-11-04  Ian Lance Taylor  <iant@google.com>
7358
7359         PR 10880
7360         * object.h (class Object): Add is_needed and set_is_needed
7361         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7362         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7363         defined in a dynamic object and referenced by a regular object,
7364         set is_needed for the dynamic object.
7365         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7366         if the file is marked with as_needed and it is not needed.
7367
7368 2009-11-04  Ian Lance Taylor  <iant@google.com>
7369
7370         PR 10887
7371         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7372         tags if data is discarded by linker script.
7373         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7374         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7375         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7376         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7377
7378 2009-11-04  Ian Lance Taylor  <iant@google.com>
7379
7380         * layout.cc (Layout::get_output_section): Add is_interp and
7381         is_dynamic_linker_section parameters.  Change all callers.
7382         (Layout::choose_output_section): Likewise.
7383         (Layout::make_output_section): Likewise.
7384         (Layout::add_output_section_data): Add is_dynamic_linker_section
7385         parameter.  Change all callers.
7386         * layout.h (class Layout): Update declarations.
7387         * output.h (class Output_section): Add is_interp, set_is_interp,
7388         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7389         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7390         generate_code_fills_at_write_ to a bitfield.
7391         * output.cc (Output_section::Output_sections): Initialize new
7392         fields.
7393         (Output_segment::add_output_section): Add do_sort parameter.
7394         Change all callers.
7395
7396 2009-11-03  Ian Lance Taylor  <iant@google.com>
7397
7398         PR 10860
7399         * options.h (class General_options): Add --warn-common.
7400         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7401         merging two common symbols.
7402         (Symbol_table::should_override): Handle --warn-common when merging
7403         a common symbol with a defined symbol.  Use report_resolve_problem
7404         for multiple definitions.
7405         (Symbol_table::report_resolve_problem): New function.
7406         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7407
7408 2009-11-03  Doug Kwan  <dougkwan@google.com>
7409
7410         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7411         stub_factory_.
7412         (Target_arm::stub_factory): New method definition.
7413         (Target_arm::new_arm_input_section,
7414         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7415         Target_arm::reloc_uses_thumb_bit): New method declarations.
7416         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7417         New type definitions.
7418         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7419         member declarations.
7420         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7421         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7422         New method definitions.
7423
7424 2009-11-03  Ian Lance Taylor  <iant@google.com>
7425
7426         * options.h (class General_options): Add --warn_constructors.
7427
7428 2009-11-03  Ian Lance Taylor  <iant@google.com>
7429
7430         PR 10893
7431         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7432         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7433
7434 2009-11-03  Ian Lance Taylor  <iant@google.com>
7435
7436         PR 10895
7437         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7438         --msgid-bugs-address.
7439         (install-pdf): New target.
7440         (install-data_yes): Look up one directory to find mkinstalldirs.
7441
7442 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7443
7444         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7445         tree.
7446
7447 2009-10-30  Doug Kwan  <dougkwan@google.com>
7448
7449         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7450
7451 2009-10-30  Doug Kwan  <dougkwan@google.com>
7452
7453         * arm.cc (Stub_addend_reader): New struct template definition
7454         and partial specializations.
7455         (Stub_addend_reader::operator()): New method definition for a
7456         partially specialized template.
7457
7458 2009-10-30  Doug Kwan  <dougkwan@google.com>
7459
7460         * arm.cc (Arm_relobj::processor_specific_flags): New method
7461         definition.
7462         (Arm_relobj::do_read_symbols): New method declaration.
7463         (Arm_relobj::processor_specific_flags_): New data member declaration.
7464         (Arm_dynobj): New class definition.
7465         (Target_arm::do_finalize_sections): Add input_objects parameter.
7466         (Target_arm::do_adjust_elf_header): New method declaration.
7467         (Target_arm::are_eabi_versions_compatible,
7468         (Target_arm::merge_processor_specific_flags): New method declaration.
7469         (Target_arm::do_make_elf_object): New overloaded method definitions
7470         and declaration.
7471         (Arm_relobj::do_read_symbols): New method definition.
7472         (Arm_dynobj::do_read_symbols): Ditto.
7473         (Target_arm::do_finalize_sections): Add input_objects parameters.
7474         Merge processor-specific flags from all input objects.
7475         (Target_arm::are_eabi_versions_compatible,
7476         Target_arm::merge_processor_specific_flags,
7477         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7478         New method definitions.
7479         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7480         Input_objects pointer type parameter.
7481         * layout.cc (Layout::finalize): Pass input objects to target's.
7482         finalize_sections function.
7483         * output.cc (Output_file_header::do_sized_write): Set ELF file
7484         header's processor-specific flags.
7485         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7486         Input_objects pointer type parameter.
7487         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7488         * target.h (Input_objects): New forward class declaration.
7489         (Target::processor_specific_flags,
7490         Target::are_processor_specific_flags_sect): New method definitions.
7491         (Target::finalize_sections): Add input_objects parameter.
7492         (Target::Target): Initialize processor_specific_flags_ and
7493         are_processor_specific_flags_set_.
7494         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7495         parameter.
7496         (Target::set_processor_specific_flags): New method definition.
7497         (Target::processor_specific_flags_,
7498         Target::are_processor_specific_flags_set_): New data member
7499         declarations.
7500         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7501         Input_objects pointer type parameter.
7502
7503 2009-10-30  Doug Kwan  <dougkwan@google.com>
7504
7505         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7506
7507 2009-10-28  Ian Lance Taylor  <iant@google.com>
7508
7509         * object.h (class Relobj): Drop options parameter from
7510         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7511         do_scan_relocs, do_relocate.  Change all callers.
7512         (class Sized_relobj): Drop options parameters from
7513         do_gc_process_relocs, do_scan_relocs, do_relocate,
7514         do_relocate_sections, relocate_sections, emit_relocs_scan,
7515         emit_relocs_scan_reltype.  Change all callers.
7516         (struct Relocate_info): Remove options field and all references to
7517         it.
7518         * reloc.h (class Read_relocs): Remove options constructor
7519         parameter and options_ field.  Change all callers.
7520         (class Gc_process_relocs, class Scan_relocs): Likewise.
7521         (class Relocate_task): Likewise.
7522         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7523         all callers.
7524         (scan_relocatable_relocs): Likewise.
7525         * target.h (class Sized_target): Remove options parameter from
7526         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7527         all callers.
7528         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7529         callers.
7530         * arm.cc: Update functions to remove options parameters.
7531         * i386.cc: Likewise.
7532         * powerpc.cc: Likewise.
7533         * sparc.cc: Likewise.
7534         * x86_64.cc: Likewise.
7535         * testsuite/testfile.cc: Likewise.
7536
7537 2009-10-28  Doug Kwan  <dougkwan@google.com>
7538
7539         * arm.cc (Arm_relobj): New class definition.
7540         (Arm_relobj::scan_sections_for_stubs,
7541         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7542         New method definitions.
7543
7544 2009-10-28  Cary Coutant  <ccoutant@google.com>
7545
7546         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7547         (Plugin::cleanup_done_): New member.
7548         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7549         (Plugin_manager::cleanup_done_): Remove.
7550         (Plugin_manager::add_input_file): Edit error message.
7551         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7552         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7553
7554 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7555
7556         * fileread.cc: (File_read::View::~View): Use the new
7557         data_ownership_ filed.
7558         (File_read::~File_read): Dispose the new whole_file_view_.
7559         (File_read::open): Mmap the whole file if needed.
7560         (File_read::open): Use whole_file_view_ instead of contents_.
7561         (File_read::find_view): Use whole_file_view_ if applicable.
7562         (File_read::do_read): Use whole_file_view_ instead of contents_.
7563         (File_read::make_view): Use whole_file_view_ instead of contents_,
7564         update File_read::View::View call.
7565         (File_read::find_or_make_view): Update File_read::View::View
7566         call.
7567         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7568         remove contents_
7569         (File_read::View::Data_ownership): New enum.
7570         (File_read::View::View): Replace bool mapped_ with Data_ownership
7571         argument.
7572         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7573         (File_read::View::data_ownership_): New field.
7574         (File_read::contents_): Remove (replaced by whole_file_view_).
7575         (File_read::whole_file_view_): New field.
7576         * options.h (class General_options): Add --keep-files-mapped.
7577
7578 2009-10-27  Cary Coutant  <ccoutant@google.com>
7579
7580         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7581         * testsuite/Makefile.am (plugin_test_5): New test case.
7582         * testsuite/Makefile.in: Regenerate.
7583
7584 2009-10-25  Doug Kwan  <dougkwan@google.com>
7585
7586         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7587         from private to protected to allow access by child class.
7588         (Sized_relobj::do_relocate_sections): New method declaration.
7589         (Sized_relobj::relocate_sections): Virtualize.
7590         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7591         Sized_relobj::relocate_sections.  Instantiate template explicitly
7592         for different target sizes and endianity.
7593
7594 2009-10-24  Doug Kwan  <dougkwan@google.com>
7595
7596         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7597         (Arm_input_section::as_arm_input_section): New method.
7598         (Arm_output_section): New class definition.
7599         (Arm_output_section::create_stub_group,
7600         Arm_output_section::group_sections): New method definitions.
7601
7602 2009-10-22  Doug Kwan  <dougkwan@google.com>
7603
7604         * arm.cc (Arm_input_section): New class definition.
7605         (Arm_input_section::init, Arm_input_section:do_write,
7606         Arm_input_section::set_final_data_size,
7607         Arm_input_section::do_reset_address_and_file_offset): New method
7608         definitions.
7609
7610 2009-10-21  Doug Kwan  <dougkwan@google.com>
7611
7612         * arm.cc (Stub_table, Arm_input_section): New forward class
7613         declarations.
7614         (Stub_table): New class defintion.
7615         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7616         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7617         New method definition.
7618
7619 2009-10-21  Doug Kwan  <dougkwan@google.com>
7620
7621         * arm.cc: Update copyright comments.
7622         (Target_arm): New forward class template declaration.
7623         (Arm_address): New type.
7624         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7625         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7626         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7627         constants.
7628         (Insn_template): Same.
7629         (DEF_STUBS): New macro.
7630         (Stub_type): New enum type.
7631         (Stub_template): New class definition.
7632         (Stub): Same.
7633         (Reloc_stub): Same.
7634         (Stub_factory): Same.
7635         (Target_arm::Target_arm): Initialize may_use_blx_ and
7636         should_force_pic_veneer_.
7637         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7638         Target_arm::should_force_pic_veneer,
7639         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7640         Target_arm::using_thumb_only, Target_arm:;default_target): New
7641         method defintions.
7642         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7643         New data member declarations.
7644         (Insn_template::size, Insn_template::alignment): New method defintions.
7645         (Stub_template::Stub_template): New method definition.
7646         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7647         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7648         (Stub_factory::Stub_factory): New method definition.
7649         * gold.h (string_hash): New template.
7650         * output.h (Input_section_specifier::hash_value): Use
7651         gold::string_hash.
7652         (Input_section_specifier::string_hash): Remove.
7653         * stringpool.cc (Stringpool_template::string_hash): Use
7654         gold::string_hash.
7655
7656 2009-10-20  Doug Kwan  <dougkwan@google.com>
7657
7658         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7659         symbols of relaxed input sections.
7660         * output.h (Output_section::find_relaxed_input_section): Make
7661         method public.
7662
7663 2009-10-16  Doug Kwan  <dougkwan@google.com>
7664
7665         * dynobj.cc (Versions::Versions): Initialize version_script_.
7666         Only insert base version symbol definition for a shared object
7667         if version script defines any version versions.
7668         (Versions::define_base_version): New method definition.
7669         (Versions::add_def): Check that base version is not needed.
7670         (Versions::add_need): Define base version lazily.
7671         * dynobj.h (Versions::define_base_version): New method declaration.
7672         (Versions::needs_base_version_): New data member declaration.
7673         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7674         (check_DATA): Add no_version_test.stdout.
7675         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7676         New make rules.
7677         * testsuite/Makefile.in: Regenerate.
7678         * testsuite/no_version_test.c: New file.
7679         * testsuite/no_version_test.sh: Ditto.
7680
7681 2009-10-16  Doug Kwan  <dougkwan@google.com>
7682
7683         * expression.cc (class Segment_start_expression): New class definition.
7684         (Segment_start_expression::value): New method definition.
7685         (script_exp_function_segment_start): Return a new
7686         Segment_start_expression.
7687         * gold/script-c.h (script_saw_segment_start_expression): New function
7688         prototype.
7689         * script-sections.cc (Script_sections::Script_sections): Initialize
7690         SAW_SEGMENT_START_EXPRESSION_ to false.
7691         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7692         and -Tbbs options to specify section addresses if given in
7693         command line and no SEGMENT_START expression is seen in a script.
7694         * script-sections.h (Script_sections::saw_segment_start_expression,
7695         Script_sections::set_saw_segment_start_expression): New method
7696         definition.
7697         (Script_sections::saw_segment_start_expression_): New data member
7698         declaration.
7699         * script.cc (script_saw_segment_start_expression): New function.
7700         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7701         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7702         script_test_7.sh and script_test_8.sh.
7703         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7704         script_test_8.stdout.
7705         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7706         (script_test_6, script_test_6.stdout, script_test_7,
7707         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7708         * Makefile.in: Regenerate.
7709         * testsuite/script_test_6.sh: New file.
7710         * testsuite/script_test_6.t: Same.
7711         * testsuite/script_test_7.sh: Same.
7712         * testsuite/script_test_7.t: Same.
7713         * testsuite/script_test_8.sh: Same.
7714
7715 2009-10-16  Doug Kwan  <dougkwan@google.com>
7716
7717         * output.cc (Output_segment::set_section_list_address): Cast
7718         expressions to unsigned long long type to avoid format warnings.
7719
7720 2009-10-15  Ian Lance Taylor  <iant@google.com>
7721
7722         * script.cc (Script_options::add_symbol_assignment): Always add a
7723         dot assignment to script_sections_.
7724         * script-sections.cc (Script_sections::add_dot_assignment):
7725         Initialize if necessary.
7726
7727         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7728         program headers with no load segment if there is a linker script.
7729
7730         * layout.cc (Layout::set_segment_offsets): Align the file offset
7731         to the segment aligment for -N or -n with no load segment.
7732         * output.cc (Output_segment::add_output_section): Don't crash if
7733         the first section is a TLS section.
7734         (Output_segment::set_section_list_addresses): Print an error
7735         message if the address moves backward in a linker script.
7736         * script-sections.cc
7737         (Output_section_element_input::set_section_addresses): Don't
7738         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7739         (Orphan_output_section::set_section_addresses): Likewise.
7740
7741 2009-10-15  Doug Kwan  <dougkwan@google.com>
7742
7743         * layout.cc (Layout::finish_dynamic_section): Generate tags
7744         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7745         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7746         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7747
7748 2009-10-14  Ian Lance Taylor  <iant@google.com>
7749
7750         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7751         fields.
7752         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7753         data_shdr fields of relinfo.
7754         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7755         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7756         R_386_TLS_LDO_32, adjust based on section flags.
7757         (Target_i386::Relocate::fix_up_ldo): Remove.
7758
7759 2009-10-13  Ian Lance Taylor  <iant@google.com>
7760
7761         Add support for -pie.
7762         * options.h (class General_options): Add -pie and
7763         --pic-executable.
7764         (General_options::output_is_position_independent): Test -pie.
7765         (General_options::output_is_executable): Return true if not shared
7766         and not relocatable.
7767         (General_options::output_is_pie): Remove.
7768         * options.cc (General_options::finalize): Reject incompatible uses
7769         of -pie.
7770         * gold.cc (queue_middle_tasks): A -pie link is not static.
7771         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7772         * symtab.cc (Symbol::final_value_is_known): Return false if
7773         output_is_position_independent.
7774         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7775         output_is_position_independent.
7776         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7777         output_is_position_independent.
7778         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7779         output_is_position_independent.
7780         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7781         two_file_pie_test.
7782         (basic_pie_test.o, basic_pie_test): New targets.
7783         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7784         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7785         (two_file_pie_test): New target.
7786         * testsuite/Makefile.in: Rebuild.
7787         * README: Remove note saying that -pie is not supported.
7788
7789 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7790
7791         * options.h (class General_options): Add -init and -fini.
7792         * layout.cc (Layout::finish_dynamic_section): Emit
7793         given init and fini functions.
7794
7795 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7796
7797         * gc.h (gc_process_relocs): Check if icf is enabled using new
7798         function.
7799         * gold.cc (queue_initial_tasks): Likewise.
7800         (queue_middle_tasks): Likewise.
7801         * object.cc (do_layout): Likewise.
7802         * symtab.cc (is_section_folded): Likewise.
7803         * main.cc (main): Likewise.
7804         * reloc.cc (Read_relocs::run): Likewise.
7805         (Sized_relobj::do_scan_relocs): Likewise.
7806         * icf.cc (is_function_ctor_or_dtor): New function.
7807         (Icf::find_identical_sections): Check if function is ctor or dtor when
7808         safe icf is chosen.
7809         * options.h (General_options::icf): Change option to be an enum.
7810         (Icf_status): New enum.
7811         (icf_enabled): New method.
7812         (icf_safe_folding): New method.
7813         (set_icf_status): New method.
7814         (icf_status_): New variable.
7815         * (options.cc) (General_options::finalize): Set icf_status_.
7816         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7817         icf_test and icf_keep_unique_test to use the --icf enum flag.
7818         * testsuite/icf_safe_test.sh: New file.
7819         * testsuite/icf_safe_test.cc: New file.
7820
7821 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7822
7823         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7824         includes to gc.h and icf.h.
7825         * arm.cc: Include gc.h.
7826         * gold.cc: Likewise.
7827         * i386.cc: Likewise.
7828         * powerpc.cc: Likewise.
7829         * sparc.cc: Likewise.
7830         * x86_64.cc: Likewise.
7831         * gc.h: Include icf.h.
7832
7833 2009-10-11  Ian Lance Taylor  <iant@google.com>
7834
7835         * plugin.cc: Include "gold.h" before other header files.
7836
7837 2009-10-10  Chris Demetriou  <cgd@google.com>
7838
7839         * options.h (Input_file_argument::Input_file_type): New enum.
7840         (Input_file_argument::is_lib_): Replace with...
7841         (Input_file_argument::type_): New member.
7842         (Input_file_argument::Input_file_argument): Take Input_file_type
7843         'type' rather than boolean 'is_lib' as second argument.
7844         (Input_file_argument::is_lib): Use type_.
7845         (Input_file_argument::is_searched_file): New function.
7846         (Input_file_argument::may_need_search): Handle is_searched_file.
7847         * options.cc (General_options::parse_library): Support -l:filename.
7848         (General_options::parse_just_symbols): Update for Input_file_argument
7849         changes.
7850         (Command_line::process): Likewise.
7851         * archive.cc (Archive::get_file_and_offset): Likewise.
7852         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7853         * script.cc (read_script_file, script_add_file): Likewise.
7854         * fileread.cc (Input_file::Input_file): Likewise.
7855         (Input_file::will_search_for): Handle is_searched_file.
7856         (Input_file::open): Likewise.
7857         * readsyms.cc (Read_symbols::get_name): Likewise.
7858         * testsuite/Makefile.am (searched_file_test): New test.
7859         * testsuite/Makefile.in: Regenerate.
7860         * testsuite/searched_file_test.cc: New file.
7861         * testsuite/searched_file_test_lib.cc: New file.
7862
7863 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7864             Ian Lance Taylor  <iant@google.com>
7865
7866         * descriptor.cc: Include <cstdio> and "binary-io.h".
7867         (Descriptors::open): Open the files in binary mode always.
7868         * script.cc (Lex::get_token): Treat \r as whitespace.
7869
7870 2009-10-09  Ian Lance Taylor  <iant@google.com>
7871
7872         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7873
7874 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7875             Ian Lance Taylor  <iant@google.com>
7876
7877         * configure.ac: Check for readv function also.
7878         * fileread.cc (readv): Define if not HAVE_READV.
7879         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7880         does not exist.
7881         * config.in: Regenerate.
7882         * configure: Regenerate.
7883
7884 2009-10-09  Doug Kwan  <dougkwan@google.com>
7885
7886         * layout.cc (Layout::make_output_section): Call target hook to make
7887         ordinary output section.
7888         (Layout::finalize): Adjust parameter list of call the
7889         Target::may_relax().
7890         * layout.h (class Layout::section_list): New method.
7891         * merge.h (Output_merge_base::entsize): Change visibility to public.
7892         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7893         New methods.
7894         (Output_merge_string::do_is_string): New method.
7895         * object.cc (Sized_relobj::do_setup): renamed from
7896         Sized_relobj::set_up.
7897         * object.h (Sized_relobj::adjust_shndx,
7898         Sized_relobj::initializ_input_to_output_maps,
7899         Sized_relobj::free_input_to_output_maps): Change visibilities to
7900         protected.
7901         (Sized_relobj::setup): Virtualize.
7902         (Sized_relobj::do_setup): New method declaration.
7903         (Sized_relobj::invalidate_section_offset,
7904         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7905         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7906         * options.cc (parse_int): New function.
7907         * options.h (parse_int): New declaration.
7908         (DEFINE_int): New macro.
7909         (stub_group_size): New option.
7910         * output.cc (Output_section::Output_section): Initialize memebers
7911         merge_section_map_, merge_section_by_properties_map_,
7912         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7913         (Output_section::add_input_section): Handled deferred code-fill
7914         generation and remove an old comment.
7915         (Output_section::add_relaxed_input_section): New method definition.
7916         (Output_section::add_merge_input_section): Use merge section by
7917         properties map to speed to search.  Update merge section maps
7918         as appropriate.
7919         (Output_section::build_relaxation_map): New method definition.
7920         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7921         Same.
7922         (Output_section::relax_input_section): Renamed to
7923         Output_section::convert_input_sections_to_relaxed_sections and change
7924         interface to take a vector of pointers to relaxed sections.
7925         (Output_section::find_merge_section,
7926         Output_section::find_relaxed_input_section): New method definitions.
7927         (Output_section::is_input_address_mapped,
7928         Output_section::output_offset, Output_section::output_address):
7929         Use output section data maps to speed up searching.
7930         (Output_section::find_starting_output_address): Add comments.
7931         (Output_section::do_write,
7932         Output_section::write_to_postprocessing_buffer): Do code-fill
7933         generation as appropriate.
7934         (Output_section::get_input_sections): Invalidate relaxed input section
7935         map.
7936         (Output_section::restore_states): Adjust type of checkpoint .
7937         Invalidate relaxed input section map.
7938         * output.h (Output_merge_base): New class declaration.
7939         (Input_section_specifier): New class defintion.
7940         (class Output_relaxed_input_section) Change base class to
7941         Output_section_data_build.
7942         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7943         base class initializer.
7944         (Output_section::add_relaxed_input_section): New method declaration.
7945         (Output_section::Input_section): Change visibility to protected.
7946         (Output_section::Input_section::relobj,
7947         Output_section::Input_section::shndx): Handle relaxed input sections.
7948         Output_section::input_sections) Change visibility to protected.  Also
7949         define overload to return a non-const pointer.
7950         (Output_section::Merge_section_properties): New class defintion.
7951         (Output_section::Merge_section_by_properties_map,
7952         Output_section::Output_section_data_by_input_section_map,
7953         Output_section::Relaxation_map): New types.
7954         (Output_section::relax_input_section): Rename method to
7955         Output_section::convert_input_sections_to_relaxed_sections and change
7956         interface to take a vector of relaxed section pointers.
7957         (Output_section::find_merge_section,
7958         Output_section::find_relaxed_input_section,
7959         Output_section::build_relaxation_map,
7960         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7961         New method declarations.
7962         (Output_section::merge_section_map_
7963         Output_section::merge_section_by_properties_map_,
7964         Output_section::relaxed_input_section_map_,
7965         Output_section::is_relaxed_input_section_map_valid_,
7966         Output_section::generate_code_fills_at_write_): New data members.
7967         * script-sections.cc
7968         (Output_section_element_input::set_section_addresses): Call
7969         current_data_size and addralign methods of relaxed input sections.
7970         (Orphan_output_section::set_section_addresses): Call current_data_size
7971         and addralign methods of relaxed input sections.
7972         * symtab.cc (Symbol_table::compute_final_value): Extract template
7973         from the body of Symbol_table::sized_finalize_symbol.
7974         (Symbol_table::sized_finalized_symbol): Call
7975         Symbol_table::compute_final_value.
7976         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7977         (Symbol_table::compute_final_value): New templated method declaration.
7978         * target.cc (Target::do_make_output_section): New method defintion.
7979         * target.h (Target::make_output_section): New method declaration.
7980         (Target::relax): Add more parameters for input objects, symbol table
7981         and layout.  Adjust call to do_relax.
7982         (Target::do_make_output_section): New method declaration.
7983         (Target::do_relax): Add parameters for input objects, symbol table
7984         and layout.
7985
7986 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7987
7988         * pread.c: Include stdio.h.
7989
7990 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7991
7992         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7993         defined.
7994
7995 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7996
7997         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7998         Change read_shndx type to unsigned int.
7999         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8000         int.
8001         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8002         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8003         Change read_shndx type to unsigned int.
8004         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8005         int.
8006         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8007         * layout.cc (Layout::create_symtab_sections): Cast the result of
8008         local_symcount * symsize to off_t in the gold_assert.
8009
8010 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8011
8012         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8013         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8014         R_ARM_BASE_ABS.
8015         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8016         (Arm_relocate_functions::thm_abs5): New function.
8017         (Arm_relocate_functions::abs12): New function.
8018         (Arm_relocate_functions::abs16): New function.
8019         (Arm_relocate_functions::base_abs): New function.
8020         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8021         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8022         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8023         R_ARM_BASE_ABS.
8024         (Scan::global): Likewise.
8025         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8026         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8027         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8028         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8029         R_ARM_BASE_ABS.
8030
8031 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8032
8033         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8034         (Arm_relocate_functions::movt_prel): New function.
8035         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8036         (Arm_relocate_functions::thm_movt_prel): New function.
8037         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8038         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8039         (Scan::global, Relocate::relocate): Likewise.
8040         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8041
8042 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8043
8044         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8045         Incremental_checker.
8046         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8047         unsigned int.
8048         (class Incremental_inputs_header): New class.
8049         (Incremental_inputs_header_writer): Edit comment.
8050         (Incremental_inputs_entry): New class.
8051         (Incremental_inputs_entry_writer): Edit comment.
8052         (Sized_incremental_binary::do_find_incremental_inputs_section):
8053         Add *strtab_shndx parameter, fill it.
8054         (Sized_incremental_binary::do_check_inputs): New method.
8055         (Incremental_checker::can_incrementally_link_output_file): Use
8056         Sized_incremental_binary::check_inputs.
8057         (Incremental_inputs::report_command_line): Save command line in
8058         command_line_.
8059         * incremental.h:
8060         (Incremental_binary::find_incremental_inputs_section): New
8061         method.
8062         (Incremental_binary::do_find_incremental_inputs_section): Add
8063         strtab_shndx parameter.
8064         (Incremental_binary::do_check_inputs): New pure virtual method.
8065         (Sized_incremental_binary::do_check_inputs): Declare.
8066         (Incremental_checker::Incremental_checker): Add incremental_inputs
8067         parameter, use it to initialize incremental_inputs_.
8068         (Incremental_checker::incremental_inputs_): New field.
8069         (Incremental_checker::command_line): New method.
8070         (Incremental_checker::inputs): New method.
8071         (Incremental_checker::command_line_): New field.
8072
8073 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8074
8075         * incremental.cc: Include <cstdarg> and "target-select.h".
8076         (vexplain_no_incremental): New function.
8077         (explain_no_incremental): New function.
8078         (Incremental_binary::error): New method.
8079         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8080         method.
8081         (make_sized_incremental_binary): New function.
8082         (open_incremental_binary): New function.
8083         (can_incrementally_link_file): Add checks if output is ELF and has
8084         inputs section.
8085         * incremental.h: Include "elfcpp_file.h" and "output.h".
8086         (Incremental_binary): New class.
8087         (Sized_incremental_binary): New class.
8088         (open_incremental_binary): Declare.
8089         * object.cc (is_elf_object): Use
8090         elfcpp::Elf_recognizer::is_elf_file.
8091         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8092         * output.h (Output_file::filesize): New method.
8093
8094 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8095
8096         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8097         New function.
8098         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8099         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8100         function.
8101         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8102         function.
8103         (Arm_relocate_functions::movw_abs_nc): New function.
8104         (Arm_relocate_functions::movt_abs): New function.
8105         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8106         (Arm_relocate_functions::thm_movt_abs): New function.
8107         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8108         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8109         (Scan::global): Likewise.
8110         (Relocate::relocate): Likewise.
8111         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8112
8113 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8114
8115         * arm.cc (Arm_relocate_functions::got_prel) New function.
8116         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8117         (Relocate::relocate): Likewise.
8118         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8119
8120 2009-10-06  Ian Lance Taylor  <iant@google.com>
8121
8122         * options.h (class General_options): Define
8123         split_stack_adjust_size parameter.
8124         * object.h (class Object): Add uses_split_stack_ and
8125         has_no_split_stack_ fields.  Add uses_split_stack and
8126         has_no_split_stack accessor functions.  Declare
8127         handle_split_stack_section.
8128         (class Reloc_symbol_changes): Define.
8129         (class Sized_relobj): Define Function_offsets.  Declare
8130         split_stack_adjust, split_stack_adjust_reltype, and
8131         find_functions.
8132         * object.cc (Object::handle_split_stack_section): New function.
8133         (Sized_relobj::do_layout): Call handle_split_stack_section.
8134         * dynobj.cc (Sized_dynobj::do_layout): Call
8135         handle_split_stack_section.
8136         * reloc.cc (Sized_relobj::relocate_sections): Call
8137         split_stack_adjust for executable sections in split_stack
8138         objects.  Pass reloc_map to relocate_section.
8139         (Sized_relobj::split_stack_adjust): New function.
8140         (Sized_relobj::split_stack_adjust_reltype): New function.
8141         (Sized_relobj::find_functions): New function.
8142         * target-reloc.h: Include "object.h".
8143         (relocate_section): Add reloc_symbol_changes parameter.  Change
8144         all callers.
8145         * target.h (class Target): Add calls_non_split method.  Declare
8146         do_calls_non_split virtual method.  Declare match_view and
8147         set_view_to_nop.
8148         * target.cc: Include "elfcpp.h".
8149         (Target::do_calls_non_split): New function.
8150         (Target::match_view): New function.
8151         (Target::set_view_to_nop): New function.
8152         * gold.cc (queue_middle_tasks): Give an error if mixing
8153         split-stack and non-split-stack objects with -r.
8154         * i386.cc (Target_i386::relocate_section): Add
8155         reloc_symbol_changes parameter.
8156         (Target_i386::do_calls_non_split): New function.
8157         * x86_64.cc (Target_x86_64::relocate_section): Add
8158         reloc_symbol_changes parameter.
8159         (Target_x86_64::do_calls_non_split): New function.
8160         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8161         parameter.
8162         * powerpc.cc (Target_powerpc::relocate_section): Add
8163         reloc_symbol_changes parameter.
8164         * sparc.cc (Target_sparc::relocate_section): Add
8165         reloc_symbol_changes parameter.
8166         * configure.ac: Call AM_CONDITIONAL for the default target.
8167         * configure: Rebuild.
8168         * testsuite/Makefile.am (TEST_AS): New variable.
8169         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8170         (check_DATA): Add split_i386 and split_x86_64 files.
8171         (SPLIT_DEFSYMS): Define.
8172         (split_i386_[1234n].o): New targets.
8173         (split_i386_[124]): New targets.
8174         (split_i386_[1234r].stdout): New targets.
8175         (split_x86_64_[1234n].o): New targets.
8176         (split_x86_64_[124]): New targets.
8177         (split_x86_64_[1234r].stdout): New targets.
8178         (MOSTLYCLEANFILES): Add new executables.
8179         * testsuite/split_i386.sh: New file.
8180         * testsuite/split_x86_64.sh: New file.
8181         * testsuite/split_i386_1.s: New file.
8182         * testsuite/split_i386_2.s: New file.
8183         * testsuite/split_i386_3.s: New file.
8184         * testsuite/split_i386_4.s: New file.
8185         * testsuite/split_i386_n.s: New file.
8186         * testsuite/split_x86_64_1.s: New file.
8187         * testsuite/split_x86_64_2.s: New file.
8188         * testsuite/split_x86_64_3.s: New file.
8189         * testsuite/split_x86_64_4.s: New file.
8190         * testsuite/split_x86_64_n.s: New file.
8191         * testsuite/testfile.cc (Target_test): Update relocation_section
8192         function.
8193         * testsuite/Makefile.in: Rebuild.
8194
8195 2009-10-06  Ian Lance Taylor  <iant@google.com>
8196
8197         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8198         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8199         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8200         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8201         the address on ldo_addrs_.
8202         (Target_i386::Relocate::fix_up_ldo): New function.
8203
8204 2009-10-06   Rafael Espindola  <espindola@google.com>
8205
8206         * plugin.cc (add_input_library): New.
8207         (Plugin::load): Add add_input_library to tv.
8208         (Plugin_manager::add_input_file): Add the is_lib argument.
8209         (add_input_file): Update call to Plugin_manager::add_input_file.
8210         (add_input_library): New.
8211         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8212
8213 2009-09-30  Doug Kwan  <dougkwan@google.com>
8214
8215         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8216         symbol and call Symbol::may_need_copy_reloc to determine if
8217         a copy reloc is needed.
8218         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8219         nocopyreloc is given in command line.
8220         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8221         given in command line.
8222         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8223         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8224         of the removed Target_i386::may_need_copy_reloc.
8225         * options.h (copyreloc): New option with default value false.
8226         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8227         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8228         instead of the removed Target_powerpc::may_need_copy_reloc.
8229         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8230         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8231         instead of the removed Target_sparc::may_need_copy_reloc.
8232         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8233         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8234         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8235         instead of the removed Target_x86_64::may_need_copy_reloc.
8236
8237 2009-09-30  Ian Lance Taylor  <iant@google.com>
8238
8239         * object.h (class Object): Remove target_ field, and target,
8240         sized_target, and set_target methods.
8241         (Object::sized_target): Remove.
8242         (class Sized_relobj): Update declarations.  Remove sized_target.
8243         * object.cc (Sized_relobj::setup): Remove target parameter.
8244         Change all callers.
8245         (Input_objects::add_object): Don't do anything with the target.
8246         (make_elf_sized_object): Add punconfigured parameter.  Change all
8247         callers.  Set or test parameter target.
8248         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8249         Change all callers.
8250         * parameters.cc (Parameters::set_target): Change parameter type to
8251         be non-const.
8252         (Parameters::default_target): Remove.
8253         (set_parameters_target): Change parameter type to be non-const.
8254         (parameters_force_valid_target): New function.
8255         (parameters_clear_target): New function.
8256         * parameters.h (class Parameters): Update declarations.  Remove
8257         default_target method.  Add sized_target and clear_target
8258         methods.  Change target_ to be non-const.
8259         (set_parameters_target): Update declaration.
8260         (parameters_force_valid_target): Declare.
8261         (parameters_clear_target): Declare.
8262         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8263         as NULL if we aren't searching.
8264         (Add_symbols::run): Don't check for compatible target.
8265         * fileread.cc (Input_file::open_binary): Call
8266         parameters_force_valid_target.
8267         * gold.cc (queue_middle_tasks): Likewise.
8268         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8269         set_target on object.
8270         * dynobj.h (class Sized_dynobj): Update declarations.
8271         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8272         make_elf_object returns NULL.
8273         (Archive::include_member): Don't check whether object target is
8274         compatible.
8275         * output.cc (Output_section::add_input_section): Get target from
8276         parameters.
8277         (Output_section::relax_input_section): Likewise.
8278         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8279         parameters.
8280         (Sized_relobj::do_scan_relocs): Likewise.
8281         (Sized_relobj::relocate_sections): Likewise.
8282         * resolve.cc (Symbol_table::resolve): Likewise.
8283         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8284         parameter.  Change all callers.
8285         (Symbol_table::add_from_object): Get target from parameters.
8286         (Symbol_table::add_from_relobj): Don't check object target.
8287         (Symbol_table::add_from_dynobj): Likewise.
8288         (Symbol_table::define_special_symbol): Get target from
8289         parameters.
8290         * symtab.h (class Symbol_table): Update declaration.
8291         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8292         parameter.  Change all callers.  Clear parameter target.
8293         (Binary_test): Test target here.
8294         * testsuite/object_unittest.cc (gold_testsuite): Remove
8295         target_test_pointer parameter.  Change all callers.
8296         (Object_test): Test target here.
8297
8298 2009-09-26  Ian Lance Taylor  <iant@google.com>
8299
8300         * testsuite/initpri1.c: Don't try to use constructor priorities if
8301         compiling with gcc before 4.3.
8302
8303 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8304
8305         * testsuite/retain_symbols_file_test.sh (check_present): Change
8306         output file name to retain_symbols_file_test.stdout.
8307         (check_absent): Likewise.
8308
8309 2009-09-18  Craig Silverstein  <csilvers@google.com>
8310
8311         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8312         * options.cc: Include <cerrno> and <fstream>.
8313         (General_options::finalize): Parse -retain-symbols-file tag.
8314         * options.h: New flag.
8315         (General_options): New method should_retain_symbol, new
8316         variable symbols_to_retain.
8317         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8318         should_retain_symbol map.
8319         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8320         * testsuite/Makefile.in: Regenerate.
8321         * testsuite/retain_symbols_file_test.sh: New file.
8322
8323 2009-09-18  Nick Clifton  <nickc@redhat.com>
8324
8325         * po/es.po: Updated Spanish translation.
8326
8327 2009-09-17  Doug Kwan  <dougkwan@google.com>
8328
8329         * debug.h (DEBUG_RELAXATION): New constant.
8330         (DEBUG_ALL): Add DEBUG_RELAXATION.
8331         (debug_string_to_enum): Add relaxation debug option.
8332         * layout.cc
8333         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8334         Layout::Relaxation_debug_check::read_sections,
8335         Layout::Relaxation_debug_check::read_sections): New method definitions.
8336         (Layout::Layout): Initialize data members
8337         record_output_section_data_from_scrips_,
8338         script_output_section_data_list_ and relaxation_debug_check_.
8339         (Layout::save_segments, Layout::restore_segments,
8340         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8341         Layout::relaxation_loop_body): New method definitions.
8342         (Layout::finalize): Support relaxation.  Move section layout code to
8343         Layout::relaxation_loop_body.
8344         (Layout::set_asection_address_from_script): Move code for orphan
8345         section placement out.
8346         (Layout::place_orphan_sections_in_script): New method definition.
8347         * layout.h (Output_segment_headers, Output_file_header):
8348         New forward class declarations.
8349         (Layout::~Layout): Define.
8350         (Layout::new_output_section_data_from_script): New method definition.
8351         (Layout::place_orphan_sections_in_script): New method declaration.
8352         (Layout::Segment_states): New type declaration.
8353         (Layout::save_segments, Layout::restore_segments,
8354         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8355         Layout::relaxation_loop_body): New method declarations.
8356         (Layout::Output_section_data_list): New type declaration.
8357         (Layout::Relaxation_debug_check): New class definition.
8358         (Layout::record_output_section_data_from_script_,
8359         Layout::script_output_section_data_list_, Layout::segment_states_,
8360         Layout::relaxation_debug_check_): New data members.
8361         * output.cc: (Output_section_headers::do_size): New method definition.
8362         (Output_section_headers::Output_section_headers): Move size
8363         computation to Output_section_headers::do_size.
8364         (Output_segment_headers::do_size): New method definition.
8365         (Output_file_header::Output_file_header): Move size computation to
8366         Output_file_header::do_size and call it.
8367         (Output_file_header::do_size): New method definition.
8368         (Output_data_group::Output_data_group): Adjust call to
8369         Output_section_data.
8370         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8371         (Output_symtab_xindex::do_write): Add array bound check.
8372         (Output_section::Input_section::print_to_mapfile): Handle
8373         RELAXED_INPUT_SECTION_CODE.
8374         (Output_section::Output_section): Initialize data member checkpoint_.
8375         (Output_section::~Output_section): Delete checkpoint object pointed
8376         by checkpoint_.
8377         (Output_section::add_input_section): Always add an Input_section if
8378         relaxing.
8379         (Output_section::add_merge_input_section): Add assert.
8380         (Output_section::relax_input_section): New method definition.
8381         (Output_section::set_final_data_size): Set load address to zero for
8382         an unallocated section.
8383         (Output_section::do_address_and_file_offset_have_reset_values):
8384         New method definition.
8385         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8386         Handle relaxed input section.
8387         (Output_section::sort_attached_input_sections): Checkpoint input
8388         section list lazily.
8389         (Output_section::get_input_sections): Change type of input_sections to
8390         list of Simple_input_section pointers.  Checkpoint input section list
8391         lazily.  Also handle relaxed input sections.
8392         (Output_section::add_input_section_for_script): Take a reference to
8393         a Simple_input_section object instead of Relobj pointer and section
8394         index as parameter.  Handle relaxed input sections.
8395         (Output_section::save_states, Output_section::restore_states): New
8396         method definitions.
8397         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8398         (Output_data::is_data_size_fixed): New method definition.
8399         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8400         if it is fixed.
8401         (Output_data::address_and_file_offset_have_reset_values): New method
8402         definition.
8403         (Output_data::do_address_and_file_offset_have_reset_values): New method
8404         definition.
8405         (Output_data::set_data_size): Check that data size is not fixed.
8406         (Output_data::fix_data_size): New method definition.
8407         (Output_data::is_data_size_fixed_): New data member.
8408         (Output_section_headers::set_final_data_size): New method definition.
8409         (Output_section_headers::do_size): New method declaration.
8410         (Output_segment_headers::set_final_data_size): New method definition.
8411         (Output_segment_headers::do_size): New method declaration.
8412         (Output_file_header::set_final_data_size)::New method definition.
8413         (Output_file_header::do_size)::New method declaration.
8414         (Output_section_data::Output_section_data): Add new parameter
8415         is_data_size_fixed and use it to fix data size.
8416         (Output_data_const::Output_data_const): Adjust call to base class
8417         constructor and fix data size.
8418         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8419         base class constructor and fix data size.
8420         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8421         base class constructor and fix data size.
8422         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8423         class constructor and fix data size.
8424         (Output_data_group::set_final_data_size): New method definition.
8425         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8426         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8427         class constructor and fix data size.
8428         (Output_relaxed_input_section): New class definition.
8429         (Output_section::Simple_input_section): New class definition.
8430         (Output_section::get_input_sections): Adjust parameter list.
8431         (Output_section::add_input_section_for_script): Same.
8432         (Output_section::save_states, Output_section::restore_states,
8433         Output_section::do_address_and_file_offset_have_reset_values,
8434         (Output_section::Input_section::Input_section): Handle
8435         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8436         Output_relaxed_input_section.
8437         (Output_section::Input_section::is_input_section,
8438         Output_section::Input_section::set_output_section): Handle relaxed
8439         input section.
8440         (Output_section::Input_section::is_relaxed_input_section,
8441         Output_section::Input_section::output_section_data,
8442         Output_section::Input_section::relaxed_input_section): New method
8443         definitions.
8444         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8445         value.
8446         (Output_section::Input_section::u1_): Update comments.
8447         (Output_section::Input_section::u2_): Add new union member poris.
8448         (Output_section::Checkpoint_output_section): New classs definition.
8449         (Output_section::relax_input_section): New method declaration.
8450         (Output_section::checkpoint_): New data member.
8451         (Output_segment): Update comments.
8452         (Output_segment::Output_segment): Un-privatize copy constructor.
8453         (Output_segment::operator=): Un-privatize.
8454         * script-sections.cc (Output_section_element::Input_section_list):
8455         Change element type to Output_section::Simple_input_section.
8456         (Output_section_element_dot_assignment::set_section_addresses):
8457         Register output section data for relaxation clean up.
8458         (Output_data_exression::Output_data_expression): Adjust call to base
8459         constructor to fix data size.
8460         (Output_section_element_data::set_section_addresses): Register
8461         Output_data_expression object for relaxation clean up.
8462         (struct Input_section_info): Replace Relobj pointer and section index
8463         pair with Output_section::Simple_input_section and Convert struct to a
8464         class.
8465         (Input_section_sorter::operator()): Adjust access to
8466         Input_section_info data member to use accessors.
8467         (Output_section_element_input::set_section_addresses): Use layout
8468         parameter.  Adjust code to use Output_section::Simple_input_section
8469         and Input_secction_info classes.  Register filler for relaxation
8470         clean up.
8471         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8472         and section index pair with Output_section::Simple_input_section
8473         class.  Adjust code accordingly.
8474         (Phdrs_element::release_segment): New method definition.
8475         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8476         segment list.
8477         (Script_sections::release_segments): New method definition.
8478         * gold/script-sections.h (Script_sections::release_segments): New
8479         method declaration.
8480         * gold/target.h (Target::may_relax, Target::relax,
8481         Target::do_may_relax, Target::do_relax): New method definitions.
8482
8483 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8484
8485         * arm.cc (has_signed_unsigned_overflow): New function.
8486         (Arm_relocate_functions::abs8): New function.
8487         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8488         (Target_arm::Scan::global): Likewise.
8489         (Target_arm::relocate::relocate): Likewise.
8490         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8491         Likewise.
8492
8493 2009-09-16  Cary Coutant  <ccoutant@google.com>
8494
8495         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8496         * testsuite/Makefile.in: Regenerate.
8497
8498 2009-09-11  Nick Clifton  <nickc@redhat.com>
8499
8500         * po/gold.pot: Updated by the Translation project.
8501
8502 2009-09-08  Cary Coutant  <ccoutant@google.com>
8503
8504         * output.cc (Output_file::open): Add execute permission to empty file.
8505         * testsuite/Makefile.am (permission_test): New test.
8506         * testsuite/Makefile.in: Regenerate.
8507
8508 2009-09-02  Ian Lance Taylor  <iant@google.com>
8509
8510         * output.cc (Output_file::resize): Call map_no_anonymous rather
8511         than map.
8512
8513 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8514
8515         * gold.cc: Include "incremental.h".
8516         (queue_initial_tasks): Call Incremental_checker methods.
8517         * incremental.cc: Include "output.h".
8518         (Incremental_checker::can_incrementally_link_output_file): New
8519         method.
8520         * incremental.h (Incremental_checker): New class.
8521
8522         * output.cc (Output_file::open_for_modification): New method.
8523         (Output_file::map_anonymous): Changed return type to bool.  Record
8524         map in base_ field.
8525         (Output_file::map_no_anonymous): New method, broken out of map.
8526         (Output_file::map): Use map_no_anonymous and map_anonymous.
8527         * output.h (class Output_file): Update declarations.
8528
8529 2009-08-24  Cary Coutant  <ccoutant@google.com>
8530
8531         * options.h (Command_line::Pre_options): New class.
8532         (Command_line::pre_options): New member.
8533         * options.cc (gold::options::ready_to_register): New variable.
8534         (One_option::register_option): Do nothing if not registering options.
8535         Assert if same short option registered twice.
8536         (General_options::General_options): Turn off option registration when
8537         done constructing.
8538         (Command_line::Pre_options::Pre_options): New constructor.
8539
8540 2009-08-24  Cary Coutant  <ccoutant@google.com>
8541
8542         * options.h (General_options::no_keep_memory): Remove incorrect
8543         short option.
8544
8545 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8546
8547         * Makefile.am (am__skiplex, am__skipyacc): New.
8548         * Makefile.in: Regenerate.
8549
8550 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8551
8552         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8553         (INCLUDES): ... this.
8554         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8555         (AM_CPPFLAGS): Renamed from ...
8556         (INCLUDE): ... this.
8557         * Makefile.in, testsuite/Makefile.in: Regenerate.
8558
8559         * Makefile.in: Regenerate.
8560         * aclocal.m4: Likewise.
8561         * config.in: Likewise.
8562         * configure: Likewise.
8563         * testsuite/Makefile.in: Likewise.
8564
8565         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8566         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8567         * Makefile.in: Regenerate.
8568         * testsuite/Makefile.in: Regenerate.
8569
8570 2009-08-19  Cary Coutant  <ccoutant@google.com>
8571
8572         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8573         symbols in shared libraries overridden by hidden or internal symbols
8574         in the main program.
8575
8576 2009-08-19  Chris Demetriou  <cgd@google.com>
8577
8578         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8579         checking source file names in error messages.
8580
8581 2009-08-18  Doug Kwan  <dougkwan@google.com>
8582
8583         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8584         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8585         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8586         an elfcpp::Ehdr as parameter.
8587         * object.cc (Object::set_target): Remove the version that looks up
8588         a target and sets it.
8589         (Sized_relobj::setup): Take a Target object instead of
8590         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8591         (make_elf_sized_object): Find target and ask target to
8592         make an ELF object.
8593         * object.h: (Object::set_target): Remove the version that looks up
8594         a target and sets it.
8595         (Sized_relobj::setup): Take a Target object instead of
8596         an elfcpp:Ehdr as parameter.
8597         * target.cc: Include dynobj.h.
8598         (Target::do_make_elf_object_implementation): New.
8599         (Target::do_make_elf_object): New.
8600         * target.h (Target::make_elf_object): New template declaration.
8601         (Target::do_make_elf_object): New method declarations.
8602         (Target::do_make_elf_object_implementation): New template declaration.
8603
8604 2009-08-14  Ian Lance Taylor  <iant@google.com>
8605
8606         * gold.h (FUNCTION_NAME): Define.
8607         (gold_unreachable): Use FUNCTION_NAME.
8608
8609 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8610
8611         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8612         symbol in the --keep-unique list is not found.
8613
8614 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8615
8616         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8617         been maked as --keep-unique.
8618         (Icf::unfold_section): New function.
8619         * icf.h (Icf::unfold_section): New function.
8620         * options.h (General_options::keep_unique): New option.
8621         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8622         * testsuite/Makefile.in: Regenerate.
8623         * testsuite/icf_keep_unique_test.sh: New file.
8624         * testsuite/icf_keep_unique_test.cc: New file.
8625
8626 2009-08-12  Cary Coutant  <ccoutant@google.com>
8627
8628         PR 10471
8629         * resolve.cc (Symbol_table::resolve): Check for references from
8630         dynamic objects to hidden and internal symbols.
8631         * testsuite/Makefile.am (hidden_test.sh): New test.
8632         * testsuite/Makefile.in: Regenerate.
8633         * testsuite/hidden_test.sh: New script.
8634         * testsuite/hidden_test_1.c: New test source.
8635         * testsuite/hidden_test_main.c: New test source.
8636
8637 2009-08-11  Doug Kwan  <dougkwan@google.com>
8638
8639         * arm.cc: Update comments.
8640         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8641         segment to locate the .ARM.exidx section if present.
8642
8643 2009-08-09  Doug Kwan  <dougkwan@google.com>
8644
8645         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8646         patch.
8647
8648 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8649         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8650         compiler warnings.
8651
8652 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8653
8654         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8655         valid tls_segment only for non-debug-section relocations.
8656         * testsuite/Makefile.am: Add gc_tls_test.
8657         * testsuite/Makefile.in: Regenerate.
8658         * testsuite/gc_tls_test.cc: New file.
8659         * testsuite/gc_tls_test.sh: New file.
8660
8661 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8662
8663         * icf.cc: New file.
8664         * icf.h: New file.
8665         * Makefile.am (CCFILES): Add icf.cc.
8666         (HFILES): Add icf.h
8667         * Makefile.in: Regenerate.
8668         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8669         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8670         section, symbol and addend information for the relocs.
8671         * gold.cc (queue_middle_tasks): Call identical code folding.
8672         * gold.h: Add defines for multimap.
8673         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8674         to the call of finalize_local_symbols.
8675         * main.cc (main): Create object of class Icf.
8676         * object.cc (Sized_relobj::do_layout): Allow this function to be
8677         called twice during icf.
8678         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8679         to sections marked as identical by icf.
8680         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8681         when available.
8682         (Sized_relobj::do_section_entsize): New function.
8683         * object.h (Object::section_entsize): New function.
8684         (Object::do_section_entsize): New pure virtual function.
8685         (Relobj::finalize_local_symbols): Add new parameter.
8686         (Relobj::do_section_entsize): New function.
8687         * options.h (General_options::icf): New option.
8688         (General_options::icf_iterations): New option.
8689         (General_options::print_icf_sections): New option.
8690         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8691         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8692         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8693         icf.
8694         * symtab.cc (Symbol_table::is_section_folded): New function.
8695         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8696         to sections marked as identical by icf.
8697         * symtab.h (Symbol_table::set_icf): New function.
8698         (Symbol_table::icf): New function.
8699         (Symbol_table::is_section_folded): New function.
8700         (Symbol_table::icf_): New data member.
8701         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8702         * testsuite/Makefile.am: Add commands to build icf_test.
8703         * testsuite/Makefile.in: Regenerate.
8704         * testsuite/icf_test.sh: New file.
8705         * testsuite/icf_test.cc: New file.
8706
8707 2009-07-24  Chris Demetriou  <cgd@google.com>
8708
8709         * layout.cc (is_compressible_debug_section): Fix incorrect
8710         comment about compressed section names.
8711
8712 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8713
8714         PR 10419
8715         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8716
8717 2009-07-16  Ian Lance Taylor  <iant@google.com>
8718
8719         PR 10400
8720         * layout.h: #include <map>.
8721         (class Kept_section): Change from struct to class.  Add accessors
8722         and setters.  Add section size to Comdat_group mapping.  Change
8723         Comdat_group to std::map.  Add is_comdat_ field.  Add
8724         linkonce_size field in union.
8725         (class Layout): Update declaration of find_or_add_kept_section.
8726         Don't declare find_kept_object.
8727         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8728         parameter.  Add object, shndx, is_comdat, and is_group_name
8729         parameters.  Change all callers.  Adjust for new Kept_section.
8730         (Layout::find_kept_object): Remove.
8731         * object.cc (Sized_relobj::include_section_group): Update use of
8732         Kept_section.  Rename secnum to shndx.  Only record
8733         Kept_comdat_section if sections are the same size.
8734         (Sized_relobj::include_linkonce_section): Update use of
8735         Kept_section.  Only record Kept_comdat_section if sections are the
8736         same size.  Set size of linkonce section.
8737         (Sized_relobj::map_to_kept_section): Update call to
8738         get_kept_comdat_section.
8739         * object.h (class Sized_relobj): Rename fields in
8740         Kept_comdat_section to drop trailing underscores; change object
8741         field to Relobj*.  Change Kept_comdat_section_table to store
8742         struct rather than pointer.
8743         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8744         Add kept_object and kept_shndx parameters.  Change all callers.
8745         (Sized_relobj::get_kept_comdat_section): Change return type to
8746         bool.  Add kept_object and kept_shndx parameters.  Change all
8747         callers.
8748         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8749         Layout::find_or_add_kept_section.
8750
8751 2009-07-09  Ian Lance Taylor  <iant@google.com>
8752
8753         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8754         Reserve space in the hash table.
8755
8756 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8757
8758         * fileread.cc (File_read::get_mtime): New method.
8759         * fileread.h (Timespec): New structure.
8760         (File_read::get_mtime): New method.
8761         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8762         Renamed from timestamp_nsec.
8763         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8764         Elf_Xword.
8765         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8766         timestamp_nsec.
8767         (Incremental_inputs::report_archive): Save mtime; style fix.
8768         (Incremental_inputs::report_obejct): Save mtime; style fix.
8769         (Incremental_inputs::report_script): Save mtime; style fix.
8770         (Incremental_inputs::finalize_inputs): Style fix.
8771         (Incremental_inputs::finalize): Style fix.
8772         (Incremental_inputs::create_input_section_data): Store inputs
8773         mtime.
8774         * incremental.h (Incremental_inputs::report_script): Add mtime
8775         argument.
8776         (Incremental_inputs::Input_info::Input_info): Intialize only one
8777         union member.
8778         (Incremental_inputs::Input_info::archive): Move to nameless
8779         union.
8780         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8781         (Incremental_inputs::Input_info::script): Move to nameless union.
8782         (Incremental_inputs::mtime): New field.
8783         * script.cc (read_input_script): Pass file mtime to
8784         Incremental_input.
8785         * script.h (Script_info::inputs): Style fix.
8786
8787 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8788
8789         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8790         instead of 32.
8791
8792 2009-06-24  Ian Lance Taylor  <iant@google.com>
8793
8794         PR 10156
8795         * layout.cc (Layout::choose_output_section): If we find an
8796         existing section, update the flags.
8797         (Layout::create_notes): New function, broken out of
8798         Layout::finalize.
8799         (Layout::finalize): Don't create note sections.
8800         (Layout::create_note): Don't crash if linker script discards
8801         section.
8802         (Layout::create_gold_note): Likewise.
8803         (Layout::create_build_id): Likewise.  Don't set
8804         after_input_sections on the section.
8805         (Layout::create_executable_stack_info): Remove target parameter.
8806         Change caller.
8807         * layout.h (class Layout): Declare create_notes.  Update
8808         declaration of create_executable_stack_info.
8809         * gold.cc (queue_middle_tasks): Call create_notes.
8810         * output.cc (Output_section::update_flags_for_input_section): Move
8811         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8812         invalid.
8813         * output.h (Output_data::mark_address_invalid): New function.
8814         (class Output_section): Only declare, not define,
8815         update_flags_for_input_section.  Remove set_flags.
8816
8817 2009-06-24  Ian Lance Taylor  <iant@google.com>
8818
8819         * script-sections.cc (Output_section_definition::
8820         set_section_addresses): Rename shadowing local load_address to
8821         laddr.
8822
8823 2009-06-24  Ian Lance Taylor  <iant@google.com>
8824
8825         PR 10244
8826         * reloc.cc (relocate_sections): Skip empty relocation sections.
8827
8828 2009-06-23  Ian Lance Taylor  <iant@google.com>
8829
8830         PR 10156
8831         * layout.cc (Layout::create_note): Use choose_output_section
8832         rather than make_output_section.
8833
8834 2009-06-23  Ian Lance Taylor  <iant@google.com>
8835
8836         PR 10237
8837         * options.cc (General_options::parse_V): Set printed_version_.
8838         (General_options::General_options): Initialize printed_version_.
8839         * options.h (class General_options): Add printed_version_ field.
8840         * gold.cc (queue_initial_tasks): If there are no input files,
8841         don't give a fatal error if we printed the version information.
8842         (queue_middle_tasks): If using -r with a shared object, give a
8843         fatal error rather than an ordinary error.
8844
8845 2009-06-23  Ian Lance Taylor  <iant@google.com>
8846
8847         PR 10219
8848         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8849         (Layout::make_output_section): Set have_stabstr_section_ if we see
8850         a .stab*str section.
8851         (Layout::finalize): Call link_stabs_sections.
8852         (Layout::link_stabs_sections): New file.
8853         * layout.h (class Layout): Add have_stabstr_section_ field.
8854         Declare link_stabs_sections.
8855
8856 2009-06-23  Doug Kwan  <dougkwan@google.com>
8857
8858         * Makefile.am (libgold_a_LIBADD): New.
8859         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8860         * Makefile.in: Regenerate.
8861         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8862         * configure: Regenerate.
8863         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8864         * fileread.cc: Include sys/state.h
8865         * gold.h: Declare memmem and strndup if found missing.
8866         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8867
8868 2009-06-23  Ian Lance Taylor  <iant@google.com>
8869
8870         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8871         * configure: Rebuild.
8872
8873 2009-06-23  Ian Lance Taylor  <iant@google.com>
8874
8875         PR 10147
8876         * object.cc (Object::section_contents): Don't try to get a view if
8877         the section has length zero.
8878         (Object::handle_gnu_warning_section): If the section is empty, use
8879         the name of the section as the warning.
8880
8881 2009-06-23  Ian Lance Taylor  <iant@google.com>
8882
8883         PR 10133
8884         * stringpool.h (class Stringpool_template): Add optimize_ field.
8885         (Stringpool_template::set_optimize): New function.
8886         * stringpool.cc (Stringpool_template::Stringpool_template):
8887         Initialize optimize_ field.
8888         (Stringpool_template::set_string_offsets): Test local optimize
8889         fild rather than parameter.
8890         * layout.cc (Layout::Layout): Call set_optimize on the section
8891         name stringpool.
8892
8893 2009-06-22  Ian Lance Taylor  <iant@google.com>
8894
8895         PR 10030
8896         * yyscript.y: Parse TARGET.
8897         * script.cc (script_set_target): New function.
8898         * script-c.h (script_set_target): Declare.
8899         * options.cc (General_options::string_to_object_format): Rename
8900         from string_to_object_format in anonymous namespace.  Change
8901         callers.
8902         * options.h (class General_options): Declare
8903         string_to_object_format.
8904
8905 2009-06-22  Ian Lance Taylor  <iant@google.com>
8906
8907         * script-sections.cc (Script_sections::create_segments): Don't put
8908         program headers in a PT_LOAD segment if -n or -N.
8909
8910 2009-06-22  Ian Lance Taylor  <iant@google.com>
8911
8912         PR 10141
8913         * options.h (class General_options): Add -z lazy and -z now.  Sort
8914         -z options into alphabetical order.
8915         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8916
8917 2009-06-21  Ian Lance Taylor  <iant@google.com>
8918
8919         * layout.cc (Layout::make_output_section): Call
8920         Target::new_output_section.
8921         (Layout::attach_allocated_section_to_segment): Put large section
8922         sections in a separate load segment with the large segment flag
8923         set.
8924         (Layout::segment_precedes): Sort large data segments after other
8925         load segments.
8926         (align_file_offset): New static function.
8927         (Layout::set_segment_offsets): Use align_file_offset.
8928         * output.h (class Output_section): Add is_small_section_ and
8929         is_large_section_ fields.
8930         (Output_section::is_small_section): New function.
8931         (Output_section::set_is_small_section):  New function.
8932         (Output_section::is_large_section): New function.
8933         (Output_section::set_is_large_section): New function.
8934         (Output_section::is_large_data_section): New function.
8935         (class Output_segment): Add is_large_data_segment_ field.
8936         (Output_segment::is_large_data_segment): New function.
8937         (Output_segment::set_is_large_data_segment): New function.
8938         * output.cc (Output_section::Output_section): Initialize new
8939         fields.
8940         (Output_segment::Output_segment): Likewise.
8941         (Output_segment::add_output_section): Add assertion that large
8942         data sections always go in large data segments.  Force small data
8943         sections to the end of the list of data sections.  Force small BSS
8944         sections to the start of the list of BSS sections.  For large BSS
8945         sections to the end of the list of BSS sections.
8946         * symtab.h (class Symbol): Declare is_common_shndx.
8947         (Symbol::is_defined): Check Symbol::is_common_shndx.
8948         (Symbol::is_common): Likewise.
8949         (class Symbol_table): Define enum Commons_section_type.  Update
8950         declarations.  Add small_commons_ and large_commons_ fields.
8951         * symtab.cc (Symbol::is_common_shndx): New function.
8952         (Symbol_table::Symbol_table): Initialize new fields.
8953         (Symbol_table::add_from_object): Put small and large common
8954         symbols in the right list.
8955         (Symbol_table::sized_finalized_symbol): Check
8956         Symbol::is_common_shndx.
8957         (Symbol_table::sized_write_globals): Likewise.
8958         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8959         common symbol lists.  Don't call do_allocate_commons_list if the
8960         list is empty.
8961         (Symbol_table::do_allocate_commons_list): Remove is_tls
8962         parameter.  Add comons_section_type parameter.  Change all
8963         callers.  Handle small and large common symbols.
8964         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8965         Symbol::is_common_shndx.
8966         * resolve.cc (symbol_to_bits): Likewise.
8967         * target.h (Target::small_common_shndx): New function.
8968         (Target::small_common_section_flags): New function.
8969         (Target::large_common_shndx): New function.
8970         (Target::large_common_section_flags): New function.
8971         (Target::new_output_section): New function.
8972         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8973         small_common_section_flags, and large_common_section_flags
8974         fields.
8975         (Target::do_new_output_section): New virtual function.
8976         * arm.cc (Target_arm::arm_info): Initialize new fields.
8977         * i386.cc (Target_i386::i386_info): Likewise.
8978         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8979         Likewise.
8980         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8981         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8982         (Target_x86_64::do_new_output_section): New function.
8983         * configure.ac: Define conditional MCMODEL_MEDIUM.
8984         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8985         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8986         (large_LDFLAGS): Define.
8987         * testsuite/large.c: New file.
8988         * testsuite/testfile.cc (Target_test::test_target_info):
8989         Initialize new fields.
8990         * configure, testsuite/Makefile.in: Rebuild.
8991
8992 2009-06-05  Doug Kwan  <dougkwan@google.com>
8993
8994         * Makefile.am (CCFILES): Add target.cc.
8995         * Makefile.in: Regenerate.
8996         * i386.cc (class Target_i386): Define new virtual method to
8997         override do_is_local_label_name in parent.
8998         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8999         local symbols if --discard-locals or -X is given.
9000         * options.h (class General_options): Declare new options
9001         '--discard-locals' and '-X' for discarding locals.
9002         * target.h (class Target): Define new methods is_local_label_name.
9003         Declare new virtual method do_is_local_label_name.
9004         * target.cc: New file.
9005         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9006         (check_SCRIPTS): Add discard_locals_test.sh.
9007         (check_DATA): Add discard_local_tests.syms.
9008         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9009         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9010         * testsuite/Makefile.in: Regenerate.
9011         * testsuite/discard_locals_test.c: New file.
9012         * testsuite/discard_locals_test.sh: Same.
9013
9014 2009-06-05  Doug Kwan  <dougkwan@google.com>
9015
9016         * object.cc (Sized_relobj::Sized_relobj): Initialize
9017         discarded_eh_frame_shndx_ to -1U.
9018         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9019         section.
9020         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9021         a discarded .eh_frame section.
9022         (Sized_relobj::do_finalize_local_symbols): Ditto.
9023         * object.h (class Sized_relobj): Declare new member
9024         discarded_eh_frame_shndx_.
9025         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9026         (local_labels_test.o, local_labels_test): New rules.
9027         * testsuite/Makefile.in: Regenerate.
9028
9029 2009-06-04  Doug Kwan  <dougkwan@google.com>
9030
9031         * layout.cc (Layout::section_name_mapping): Add mapping for
9032         special ARM sections.
9033
9034 2009-06-03  Doug Kwan  <dougkwan@google.com>
9035
9036         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9037         (utils::has_overflow): Same.
9038
9039 2009-06-03  Ian Lance Taylor  <iant@google.com>
9040
9041         * layout.cc (Layout::section_name_mapping): New array, replacing
9042         Layout::linkonce_mapping.
9043         (Layout::section_name_mapping_count): New variable, replacing
9044         Layout::linkonce_mapping_count.
9045         (Layout::linkonce_output_name): Remove.
9046         (Layout::output_section_name): Rewrite.
9047         * layout.h (class Layout): Rename Linkonce_mapping to
9048         Section_name_mapping, linkonce_mapping to section_name_mapping,
9049         linkonce_mapping_count to section_name_mapping_count.  Don't
9050         declare linkonce_output_name.
9051
9052 2009-06-03  Doug Kwan  <dougkwan@google.com>
9053
9054         * gold/arm.cc (namespace utils): New.
9055         (Target_arm::reloc_is_non_pic): Define new method.
9056         (class Arm_relocate_functions): New.
9057         (Target_arm::Relocate::relocate): Handle relocation types used by
9058         Android.
9059
9060 2009-06-03  Ian Lance Taylor  <iant@google.com>
9061
9062         * arm.cc (Target_arm::scan::global): Use || instead of |.
9063
9064 2009-06-02  Doug Kwan  <dougkwan@google.com>
9065
9066         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9067         issued_non_pic_error_.
9068         (class Target_arm::Scan): Declare new method check_non_pic.
9069         Define new method symbol_needs_plt_entry.
9070         Declare new data member issued_non_pic_error_.
9071         (class Target_arm::Relocate): Declare new method
9072         should_apply_static_reloc.
9073         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9074         (Target_arm::Scan::check_non_pic): Define new method.
9075         (Target_arm::Scan::local): Handle a small subset of reloc types used
9076         by Android.
9077         (Target_arm::Scan::local): Same.
9078         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9079
9080 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9081
9082         * incremental.cc (Incremental_inputs::report_command_line): Filter
9083         out --incremental-* options.
9084
9085 2009-05-29  Doug Kwan  <dougkwan@google.com>
9086
9087         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9088         template class.
9089         (class Target_arm): Update comment.
9090         (Target_arm::Target_arm): Initialize new data members GOT_,
9091         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9092         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9093         and Target_arm::rel_dyn_section.
9094         Declare new_enum Target_arm::Got_type.
9095         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9096         and DYNBSS_.
9097         Update commments for member do_dynsym_value.
9098         (Target_arm::got_size, Target_arm::plt_section,
9099         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9100         new methods inside class defintion.
9101         (Target_arm::got_section): Define new method.
9102         (Target_arm::rel_dyn_section): Same.
9103         (Output_data_plt_arm): New template class.
9104         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9105         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9106         (Output_data_plt_arm::add_entry): Same.
9107         (Output_data_plt_arm::first_plt_entry): Define new
9108         static data member for PLT instruction template.
9109         (Output_data_plt_arm::plt_entry): Same.
9110         (Output_data_plt_arm::do_write): Define new method.
9111         (Target_arm::make_plt_entry): Same.
9112         (Target_arm::do_finalize_sections): Same.
9113         (Target_arm::do_dynsym_value): Same.
9114
9115 2009-05-28  Doug Kwan  <dougkwan@google.com>
9116
9117         * Makefile.am (TARGETSOURCES): Add arm.cc.
9118         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9119         * Makefile.in: Regenerate.
9120         * arm.cc: New file.
9121         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9122
9123 2009-05-26  Doug Kwan  <dougkwan@google.com>
9124
9125         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9126         (General_options::check_excluded_libs): Strip off directories in
9127         archive name before matching like GNU ld does.
9128         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9129         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9130         (exclude_libs_test_LDFLAGS): Add linker option
9131         -Wl,--exclude-libs,libexclude_libs_test_3
9132         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9133         an explicit archive without using -l.
9134         (alt/libexclude_libs_test_3.a): New make rule.
9135         * testsuite/Makefile.in: Regenerate.
9136         * testsuite/exclude_libs_test.c : Declare lib3_default().
9137         (main): Call it.
9138         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9139         * exclude_libs_test_3.c: New file.
9140
9141 2009-05-26  Nick Clifton  <nickc@redhat.com>
9142
9143         * po/id.po: New Indonesian translation.
9144         * po/gold.pot: Updated template file.
9145
9146 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9147
9148         * testsuite/Makefile.am: Add -ffunction-sections to compile
9149         gc_comdat_test files.  Add -Wl,--gc-sections to build
9150         gc_comdat_test.
9151         * testsuite/Makefile.in: Regenerate.
9152         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9153
9154 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9155
9156         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9157         kept comdat section was garbage collected.
9158         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9159         * testsuite/Makefile.in: Regenerate.
9160         * testsuite/gc_comdat_test.sh: New file.
9161         * testsuite/gc_comdat_test_1.cc: New file.
9162         * testsuite/gc_comdat_test_2.cc: New file.
9163
9164 2009-05-19  Doug Kwan  <dougkwan@google.com>
9165
9166         * archive.cc (Archive::Archive): Move constructor from archive.h
9167         to here.  Initialize no_export_.
9168         (Archive::get_elf_object_for_member): Set no_export flag of object.
9169         * archive.h (Archive::Archive): Move constructor body to
9170         archive.cc.
9171         (Archive::no_export): New method.
9172         (Archive::no_export_): New field.
9173         * object.h (Object::Object): Initialize no_export_ to false.
9174         (Object::no_export, Object::set_no_export): New methods.
9175         (Object::no_export_): New field.
9176         * options.cc (General_options::parse_exclude_libs): New method.
9177         (General_options::check_excluded_libs) Same.
9178         * options.h (exclude_libs): New option.
9179         (General_options::check_excluded_libs): New method declaration.
9180         (General_options::excluded_libs_): New field.
9181         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9182         default or protected visibility if an object has no-export flag set.
9183         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9184         (check_SCRIPTS): Add exclude_libs_test.sh.
9185         (check_DATA): Add exclude_libs_test.syms.
9186         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9187         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9188         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9189         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9190         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9191         libexclude_libs_test_2.a): New rules.
9192         * testsuite/Makefile.in: Regenerate.
9193         * testsuite/exclude_libs_test.c: New file.
9194         * testsuite/exclude_libs_test.sh: Ditto.
9195         * testsuite/exclude_libs_test_1.c: Ditto.
9196         * testsuite/exclude_libs_test_2.c: Ditto.
9197
9198 2009-05-15  Ian Lance Taylor  <iant@google.com>
9199
9200         * configure.ac: Check for declarations for cases where libiberty.h
9201         checks HAVE_DECL_xxx.
9202         * configure, config.in: Rebuild.
9203
9204 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9205
9206         * gold.h (Incremental_argument_list): Remove (invalid) forward
9207         declaration.
9208         * incremental.cc (Incremental_inputs::report_achive): New method.
9209         (Incremental_inputs::report_object): New method.
9210         (Incremental_inputs::report_script): New method.
9211         (Incremental_inputs::finalize_inputs): New method.
9212         (Incremental_inputs::finalize): Call finalize_inputs().
9213         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9214         Create inputs entries.
9215         * incremental.h (Incremental_input_type): New enum.
9216         (Incremental_inputs::Incremental_input): Initialize new fields.
9217         (Incremental_inputs::report_inputs): New method.
9218         (Incremental_inputs::report_achive): New method.
9219         (Incremental_inputs::report_object): New method.
9220         (Incremental_inputs::report_script): New method.
9221         (Incremental_inputs::finalize_inputs): New method.
9222         (Incremental_inputs::Input_info): New struct.
9223         (Incremental_inputs::Input_info_map): New typedef.
9224         (Incremental_inputs::lock_): New field.
9225         (Incremental_inputs::Inputs_): New field.
9226         (Incremental_inputs::Inputs_map): New field.
9227         * main.cc (main): Call Incremental_input::report_inputs.
9228         * options.h (Input_argument_list): Typedef moved from
9229         Input_arguments.
9230         (Input_file_group::Files): Remove, use ::Input_argument_list.
9231         (Input_file_group::Input_argument_list): Remove, use
9232         ::Input_argument_list.
9233         * plugin.cc (Plugin_manager::add_input_file): Add error in
9234         incremental build.
9235         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9236         functions.
9237         * script.cc (read_input_script): Call
9238         Incremental_input::report_script.
9239         * script.h (Script_info): New class.
9240
9241 2009-04-27  Ian Lance Taylor  <iant@google.com>
9242
9243         * x86_64.cc (do_adjust_output_section): Set entsize to
9244         plt_entry_size.
9245
9246 2009-04-23  Elliott Hughes  <enh@google.com>
9247
9248         * output.cc (Output_file::close): After short writes, continue
9249         writing from the correct offset in the buffer being written.
9250
9251 2009-04-23  Chris Demetriou  <cgd@google.com>
9252
9253         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9254         * configure: Regenerate.
9255         * config.in: Regenerate.
9256         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9257         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9258
9259 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9260
9261         * incremental.cc (Incremental_inputs_header_data): Renamed from
9262         Incremental_input_header_data.
9263         (Incremental_inputs_header_data::data_size): New field.
9264         (Incremental_inputs_header_data::put_input_file_count): Renamed
9265         from input_file_count.
9266         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9267         from command_line_offset.
9268         (Incremental_inputs_header_data::put_reserved): Renamed from
9269         put_reserved.
9270         (Incremental_inputs_entry_data): Renamed from
9271         Incremental_input_entry_data.
9272         (Incremental_inputs_entry_data::data_size): New field.
9273         (Incremental_inputs::report_command_line): New method.
9274         (Incremental_inputs::finalize): New method.
9275         (Incremental_inputs::create_incremental_inputs_data): New method.
9276         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9277         * incremental.h: New file.
9278         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9279        (Layout::finalize): Create incremental inputs section in
9280         incremental builds.
9281        (Layout::create_incremental_info_sections): New method.
9282         * layout.h (Layout::incremental_inputs): New method.
9283        (Layout::create_incremental_info_sections): New method.
9284        (Layout::incremental_inputs_): New field.
9285         * main.cc (main): Notify Incremental_input of the command line.
9286
9287 2009-04-01  Ian Lance Taylor  <iant@google.com>
9288             Mikolaj Zalewski  <mikolajz@google.com>
9289
9290         * gold.h (reserve_unordered_map): Define, three versions, one for
9291         each version of Unordered_map.
9292         * layout.cc (Layout::Layout): Remove options parameter.  Add
9293         number_of_input_files parameter.  Don't initialize options_.
9294         Initialize number_of_input_files_ and resized_signatures_.  Move
9295         sections_are_attached_.
9296         (Layout::layout_group): Reserve space for group_signatures_.
9297         (Layout::find_or_add_kept_section): Change name parameter to be a
9298         reference.  Resize signatures_ map when it gets large enough.
9299         (Layout::layout_eh_frame): Use parameters->options() instead of
9300         this->options_.
9301         (Layout::make_output_section): Likewise.
9302         (Layout::attach_allocated_section_to_segment): Likewise.
9303         (Layout::finalize, Layout::create_executable_stack): Likewise.
9304         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9305         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9306         * layout.h (class Layout): Update declarations.  Remove options_
9307         field.  Add number_of_input_files_ and resized_signatures_
9308         fields.  Move sections_are_attached_ field.
9309         * main.cc (main): Pass number of input files to Layout
9310         constructor.  Don't pass options.
9311
9312 2009-03-30  Ian Lance Taylor  <iant@google.com>
9313
9314         * ffsll.c (ffsll): Correct implementation.
9315
9316 2009-03-27  Ian Lance Taylor  <iant@google.com>
9317
9318         * ffsll.c: New file.
9319         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9320         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9321         * ftruncate.c (ftruncate): Declare before definition.
9322         * mremap.c (mremap): Likewise.
9323         * pread.c (pread): Likewise.
9324         * configure, Makefile.in, config.in: Rebuild.
9325
9326         * mremap.c: New file.
9327         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9328         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9329         (mremap): Declare if HAVE_MREMAP is not defined.
9330         * configure, Makefile.in, config.in: Rebuild.
9331
9332 2009-03-27  Cary Coutant  <ccoutant@google.com>
9333
9334         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9335         position independent.
9336         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9337         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9338
9339 2009-03-24  Cary Coutant  <ccoutant@google.com>
9340
9341         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9342         an executable.
9343         (needs_dynamic_reloc): Likewise.
9344
9345 2009-03-24  Ian Lance Taylor  <iant@google.com>
9346
9347         * yyscript.y (file_cmd): Recognize EXTERN.
9348         (extern_name_list, extern_name_list_body): New nonterminals.
9349         * script.cc (script_add_extern): Define.
9350         * script-c.h (script_add_extern): Declare.
9351
9352 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9353
9354         * object.cc (is_elf_object): Define.
9355         * object.h (is_elf_object): Declare.
9356         * archive.cc (Archive::get_elf_object_for_member): Call
9357         is_elf_object.
9358         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9359
9360 2009-03-24  Elliott Hughes  <enh@google.com>
9361
9362         * output.cc (Output_file::map_anonymous): Define.
9363         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9364         try an anonymous one.  Report the size if the mmap fails.
9365         * output.h (class Output_file): Declare map_anonymous.
9366
9367 2009-03-24  Ian Lance Taylor  <iant@google.com>
9368
9369         * target-select.cc (instantiate_target): Don't acquire the lock if
9370         the instantiated_target_ field has already been set.
9371
9372 2009-03-23  Ian Lance Taylor  <iant@google.com>
9373
9374         * gold-threads.h (class Initialize_lock): Define.
9375         * gold-threads.cc (class Initialize_lock_once): Define.
9376         (initialize_lock_control): New static variable.
9377         (initialize_lock_pointer): New static variable.
9378         (initialize_lock_once): New static function.
9379         (Initialize_lock::Initialize_lock): Define.
9380         (Initialize_lock::initialize): Define.
9381         * target-select.h: Include "gold-threads.h".
9382         (class Target_selector): Add lock_ and initialize_lock_ fields.
9383         Don't define instantiate_target, just declare it.
9384         * target-select.cc (Target_selector::Target_selector): Initialize
9385         new fields.
9386         (Target_selector::instantiate_target): Define.
9387         * descriptors.h: Include "gold-threads.h".
9388         (class Descriptors): Add initialize_lock_ field.
9389         * descriptors.cc (Descriptors::Descriptors): Initialize new
9390         field.
9391         (Descriptors::open): Use initialize_lock_ field
9392         * errors.h (class Errors): Add initialize_lock_ field.
9393         * errors.cc (Errors::Errors): Initialize new field.
9394         (Errors::initialize_lock): Use initialize_lock_ field.
9395         * powerpc.cc (class Target_selector_powerpc): Remove
9396         instantiated_target_ field.  In do_recognize call
9397         instantiate_target rather than do_instantiate_target.  In
9398         do_instantiate_target just allocate a new target.
9399         * sparc.cc (class Target_selector_sparc): Likewise.
9400
9401         * freebsd.h: New file.
9402         * i386.cc: Include "freebsd.h".
9403         (Target_i386): Derive from Target_freebsd rather than
9404         Sized_target.
9405         (Target_selector_i386): Derive from Target_selector_freebsd rather
9406         than Target_selector.
9407         * x86_64.cc: Include "freebsd.h".
9408         (Target_x86_64): Derive from Target_freebsd rather than
9409         Sized_target.
9410         (Target_selector_x86_64): Derive from Target_selector_freebsd
9411         rather than Target_selector.
9412         * target.h (class Target): Add adjust_elf_header and
9413         do_adjust_elf_header.
9414         * output.cc (Output_file_header:: do_sized_write): Call target
9415         adjust_elf_header routine.
9416         * configure.tgt: Set targ_osabi.
9417         * configure.ac: Define GOLD_DEFAULT_OSABI.
9418         * parameters.cc (Parameters::default_target): Pass
9419         GOLD_DEFAULT_OSABI to select_target.
9420         * target-select.h (class Target_selector): Make instantiate_target
9421         protected rather than private.
9422         * Makefile.am (HFILES): Add freebsd.h.
9423         * configure, Makefile.in, config.in: Rebuild.
9424
9425         * merge.cc (do_add_input_section): Correct pend value.  Change
9426         message about last entry not being null terminated from error to
9427         warning.
9428
9429 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9430
9431         * incremental.cc: New file.
9432         * Makefile.am (CCFILES): Add incremental.cc.
9433         * Makefile.in: Rebuild.
9434
9435 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9436
9437         * layout.cc (Layout::output_section_name): Preserve names
9438         of '.note.' sections.
9439
9440 2009-03-19  Ian Lance Taylor  <iant@google.com>
9441
9442         * descriptors.cc (Descriptors::open): Check that the options are
9443         valid before using them.
9444
9445 2009-03-18  Ian Lance Taylor  <iant@google.com>
9446
9447         * script-sections.h: Include <list>.
9448         (class Script_sections): Change Sections_elements from std::vector
9449         to std::list.  Typedef public Elements_iterator.  Add
9450         orphan_section_placement_, data_segment_align_start_, and
9451         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9452         field.
9453         * script-sections.cc (class Orphan_section_placement): New class.
9454         (class Sections_element): Add virtual functions is_relro and
9455         orphan_section_init.  Remove virtual function place_orphan_here.
9456         (class Output_section_definition): Add is_relro and
9457         orphan_section_init.  Remove place_orphan_here.
9458         (class Orphan_output_section): Likewise.
9459         (Script_sections::Script_sections): Update for field changes.
9460         (Script_sections::data_segment_align): Set saw_data_segment_align_
9461         and data_segment_align_start_, not data_segment_align_index.
9462         (Script_sections::data_segment_relro_end): Check
9463         saw_data_segment_align_.  Use data_segment_align_start_ rather
9464         than data_segment_align_index_.
9465         (Script_sections::place_orphan): Rewrite to use
9466         Orphan_section_placement.
9467
9468 2009-03-17  Ian Lance Taylor  <iant@google.com>
9469
9470         * archive.cc (Archive::add_symbols): Check for a version attached
9471         to the symbol name in the archive map.
9472         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9473         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9474         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9475         (ver_test_11.a): New target.
9476         * testsuite/Makefile.in: Rebuild.
9477
9478         * configure.ac: Check for chsize and posix_fallocate.  Replace
9479         ftruncate.
9480         * ftruncate.c: New file, from gnulib.
9481         * output.cc (posix_fallocate): Define dummy version if not
9482         HAVE_POSIX_FALLOCATE.
9483         (Output_file::map): Call posix_fallocate rather than lseek and
9484         write.
9485         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9486         * configure, Makefile.in, config.in: Rebuild.
9487
9488 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9489
9490         * layout.h (Layout::create_note): Add section_name parameter.
9491         * layout.cc (Layout::create_note): Likewise.
9492         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9493
9494 2009-03-17  Ian Lance Taylor  <iant@google.com>
9495
9496         * descriptors.cc: Include "options.h".
9497         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9498         (Descriptors::open): Always use O_CLOEXEC when opening a new
9499         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9500         then set FD_CLOEXEC.
9501
9502         * sparc.cc (class Target_sparc): Add has_got_section.
9503         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9504         make sure we have a GOT section.
9505
9506         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9507         (Target_sparc::Scan::local): Likewise.
9508         (Target_sparc::Scan::global): Likewise.
9509         (Target_sparc::Relocate::relocate): Likewise.
9510         (Target_sparc::Relocate::relocate_tls): Likewise.
9511
9512         * symtab.cc (Symbol_table::define_default_version): New function,
9513         broken out of add_from_object.
9514         (Symbol_table::add_from_object): Call define_default_version.
9515         (Symbol_table::define_special_symbol): Add resolve_oldsym
9516         parameter.  Change all callers.  If the version for a symbol comes
9517         from a version script, resolve it with the symbol with the same
9518         name with no version.  Also add the symbol without a version if
9519         appropriate.
9520         (do_define_in_output_data): If resolving with oldsym, don't delete
9521         sym.
9522         (do_define_in_output_segment): Likewise.
9523         (do_define_as_constant): Likewise.
9524         * symtab.h (class Symbol_table): Update declarations.
9525
9526 2009-03-13  Ian Lance Taylor  <iant@google.com>
9527
9528         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9529         (Read_symbols::requeue): New function.
9530         (Read_symbols::do_read_symbols): If make_elf_object fails because
9531         the target type is not configured, and the file was searched for,
9532         issue a warning and retry with the next directory.
9533         (Add_symbols::run): If the file has an incompatible format, and
9534         it was searched for, requeue the Read_symbols task.  On error,
9535         release the object.
9536         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9537         dirindex parameter to constructor.  Change all callers.  Declare
9538         incompatible_warning and requeue.
9539         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9540         input_argument_ and input_group_ fields.  Add them to
9541         constructor.  Change all callers.
9542         (class Read_script): Add dirindex_ field.  Add it to constructor.
9543         Change all callers.
9544         * archive.cc (Archive::setup): Remove input_objects parameter.
9545         Change all callers.
9546         (Archive::get_file_and_offset): Likewise.
9547         (Archive::read_all_symbols): Likewise.
9548         (Archive::read_symbols): Likewise.
9549         (Archive::get_elf_object_for_member): Remove input_objects
9550         parameter.  Add punconfigured parameter.  Change all callers.
9551         (Archive::add_symbols): Change return type to bool.  Check return
9552         value of include_member.
9553         (Archive::include_all_members): Likewise.
9554         (Archive::include_member): Change return type to bool.  Return
9555         false if first included object has incompatible target.  Set
9556         included_member_ field.
9557         (Add_archive_symbols::run): If add_symbols returns false, requeue
9558         Read_symbols task.
9559         * archive.h (class Archive): Add included_member_ field.
9560         Initialize it in constructor.  Add input_file and searched_for
9561         methods.  Update declarations.
9562         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9563         input_argument_ fields.  Add them to constructor.  Change all
9564         callers.
9565         * script.cc: Include "target-select.h".
9566         (class Parser_closure): Add skip_on_incompatible_target_ and
9567         found_incompatible_target_ fields.  Add
9568         skip_on_incompatible_target parameter to constructor.  Change all
9569         callers.  Add methods skip_on_incompatible_target,
9570         clear_skip_on_incompatible_target, found_incompatible_target, and
9571         set_found_incompatible_target.
9572         (read_input_script): Add dirindex parameter.  Change all callers.
9573         If parser finds an incompatible target, requeue Read_symbols
9574         task.
9575         (script_set_symbol): Clear skip_on_incompatible_target in
9576         closure.
9577         (script_add_assertion, script_parse_option): Likewise.
9578         (script_start_sections, script_add_phdr): Likewise.
9579         (script_check_output_format): New function.
9580         * script.h (read_input_script): Update declaration.
9581         * script-c.h (script_check_output_format): Declare.
9582         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9583         (ignore_cmd): Remove OUTPUT_FORMAT.
9584         * fileread.cc (Input_file::Input_file): Add explicit this.
9585         (Input_file::will_search_for): New function.
9586         (Input_file::open): Add pindex parameter.  Change all callers.
9587         * fileread.h (class Input_file): Add input_file_argument method.
9588         Declare will_search_for.  Update declarations.
9589         * object.cc (make_elf_object): Add punconfigured parameter.
9590         Change all callers.
9591         * object.h (class Object): Make input_file public.  Add
9592         searched_for method.
9593         (make_elf_object): Update declaration.
9594         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9595         restart search.
9596         * dirsearch.h (class Dirsearch): Update declaration.
9597         * options.h (class General_options): Add --warn-search-mismatch.
9598         * parameters.cc (Parameters::is_compatible_target): New function.
9599         * parameters.h (class Parameters): Declare is_compatible_target.
9600         * workqueue.cc (Workqueue::add_blocker): New function.
9601         * workqueue.h (class Workqueue): Declare add_blocker.
9602
9603         * fileread.cc (Input_file::open): Remove options parameter.
9604         Change all callers.
9605         (Input_file::open_binary): Likewise.
9606         * script.cc (read_input_script): Likewise.
9607         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9608         options parameter from constructor.  Change all callers.
9609         (class Read_script): Likewise.
9610         * fileread.h (class Input_file): Update declarations.
9611         * script.h (read_input_script): Update declaration.
9612
9613 2009-03-10  Nick Clifton  <nickc@redhat.com>
9614
9615         * po/es.po: New Spanish translation.
9616
9617 2009-03-06  Cary Coutant  <ccoutant@google.com>
9618
9619         * options.cc (parse_short_option): Keep dash_z from registering itself.
9620
9621 2009-03-03  Ian Lance Taylor  <iant@google.com>
9622
9623         PR 9918
9624         * target-reloc.h (relocate_section): Pass output_section to
9625         relocate.
9626         * i386.cc (Target_i386::should_apply_static_reloc): Add
9627         output_section parameter.  Change all callers.
9628         (Target_i386::Relocate::relocate): Add output_section parameter.
9629         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9630         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9631         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9632         * testsuite/two_file_shared.sh: New script.
9633         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9634         (check_DATA): Add two_file_shared.dbg.
9635         (two_file_shared.dbg): New target.
9636         * testsuite/Makefile.in: Rebuild.
9637
9638 2009-03-01  Ian Lance Taylor  <iant@google.com>
9639
9640         * configure.ac: Check for byteswap.h.
9641         * configure: Rebuild.
9642         * config.in: Rebuild.
9643
9644 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9645
9646         * layout.cc (Layout::find_or_add_kept_section): New function.
9647         (Layout::add_comdat): Removed.
9648         * layout.h (struct Kept_section): Move out of class Layout.
9649         Remove trailing underscores from field names.  Add group_sections
9650         field.  Rename group_ field to is_group.  Change all uses.
9651         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9652         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9653         comdat_groups_ field.
9654         (Sized_relobj::include_section_group): Use
9655         find_or_add_kept_section and Kept_section::group_sections.
9656         (Sized_relobj::include_linkonce_section): Likewise.
9657         * object.cc (class Sized_relobj): Don't define Comdat_group or
9658         Comdat_group_table.  Remove find_comdat_group and
9659         add_comdat_group.  Remove comdat_groups_ field.
9660         * plugin.cc (include_comdat_group): Use
9661         Layout::find_or_add_kept_section.
9662
9663 2009-02-28  Ian Lance Taylor  <iant@google.com>
9664
9665         * README: --gc-sections and map files are now supported.  Document
9666         some build requirements.
9667
9668         PR 6992
9669         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9670         relocatable link set the value of the section symbol to zero.
9671         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9672         relocatable link don't include the section address in the local
9673         symbol value.
9674
9675 2009-02-27  Ian Lance Taylor  <iant@google.com>
9676
9677         PR 6811
9678         * options.h (class Search_directory): Add is_system_directory.
9679         (class General_options): Declare is_in_system_directory.
9680         * options.cc (get_relative_sysroot): Make static.
9681         (get_default_sysroot): Make static.
9682         (General_optoins::is_in_system_directory): New function.
9683         * fileread.cc (Input_file::is_in_system_directory): New function.
9684         * fileread.h (class Input_file): Declare is_in_system_directory.
9685         * object.h (class Object): Add is_in_system_directory.
9686         (class Input_objects): Remove system_library_directory_ field.
9687         * object.cc (Input_objects::add_object): Don't set
9688         system_library_directory_.
9689         (input_objects::found_in_system_library_directory): Remove.
9690         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9691         parameter.  Change all callers.
9692         (Symbol_table::sized_write_globals): Likewise.
9693         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9694         Call Object::is_in_system_directory.
9695         * symtab.h (class Symbol_table): Update declarations.
9696
9697         PR 5990
9698         * descriptors.h (Open_descriptor): Add is_on_stack field.
9699         * descriptors.cc (Descriptors::open): If the descriptor is on the
9700         top of the stack, remove it.  Initialize is_on_stack field.
9701         (Descriptors::release): Only add pod to stack if it is not on the
9702         stack already.
9703         (Descriptors::close_some_descriptor): Clear stack_next and
9704         is_on_stack fields.
9705
9706         PR 7091
9707         * output.cc (Output_section::find_starting_output_address): Rename
9708         from starting_output_address; add PADDR parameter; change return
9709         type.
9710         * output.h (class Output_section): Declare
9711         find_starting_output_address instead of starting_output_address.
9712         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9713         section symbol for which we can't find a merge section.
9714
9715         PR 9836
9716         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9717         hidden or internal, force the symbol to be local.
9718         * resolve.cc (Symbol::override_visibility): Define.
9719         (Symbol::override_base): Use override_visibility.
9720         (Symbol_table::resolve): Likewise.
9721         (Symbol::override_base_with_special): Likewise.
9722         (Symbol_table::override_with_special): If the visibility is hidden
9723         or internal, force the symbol to be local.
9724         * symtab.h (class Symbol): Add set_visibility and
9725         override_visibility.
9726         * testsuite/ver_test_1.sh: New file.
9727         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9728         (check_DATA): Add ver_test_1.syms.
9729         (ver_test_1.syms): New target.
9730         * testsuite/Makefile.in: Rebuild.
9731
9732 2009-02-25  Cary Coutant  <ccoutant@google.com>
9733
9734         * layout.cc (Layout::choose_output_section): Don't rename sections
9735         when using a linker script that has a SECTIONS clause.
9736         * Makefile.in: Regenerate.
9737
9738         * testsuite/Makefile.am (script_test_5.sh): New test case.
9739         * testsuite/Makefile.in: Regenerate.
9740         * testsuite/script_test_5.cc: New file.
9741         * testsuite/script_test_5.sh: New file.
9742         * testsuite/script_test_5.t: New file.
9743
9744 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9745
9746         * archive.cc (Archive::include_member): Update calls to add_symbols.
9747         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9748         the Layout argument.
9749         * dynobj.h (do_add_symbols): Add the Layout argument.
9750         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9751         Layout argument.
9752         * object.h (Object::add_symbols): Add the Layout argument.
9753         (Object::do_add_symbols): Add the Layout argument.
9754         (Sized_relobj::do_add_symbols): Add the Layout argument.
9755         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9756         Unify the two versions.
9757         (Add_plugin_symbols): Remove.
9758         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9759         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9760         (Add_plugin_symbols): Remove.
9761         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9762         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9763         (Add_symbols::run): Make it work with Pulginobj.
9764
9765 2009-02-06  Ian Lance Taylor  <iant@google.com>
9766
9767         * object.cc (Sized_relobj::do_layout): Make info message start
9768         with lower case letter.
9769
9770 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9771
9772         * binary.cc: Fix file comment.
9773
9774         * options.h (enum Incremental_disposition): Define.
9775         (class General_options): Add new options: --incremental,
9776         --incremental_changed, --incremental_unchanged,
9777         --incremental_unknown.  Add incremental_disposition_ and
9778         implicit_incremental_ fields.
9779         (General_options::incremental_disposition): New function.
9780         (class Position_dependent_options): Add incremental_disposition
9781         option.
9782         (Position_dependent_options::copy_from_options): Set incremental
9783         dispositions.
9784         * options.cc (General_options::parse_incremental_changed): New
9785         function.
9786         (General_options::parse_incremental_unchanged): New function.
9787         (General_options::parse_incremental_unknown): New function.
9788         (General_options::General_options): Initialize new fields
9789         incremental_disposition_ and implicit_incremental_.
9790         (General_options::finalize): Check for uasge of --incremental-*
9791         without --incremental.
9792
9793 2009-02-06  Chris Demetriou  <cgd@google.com>
9794
9795         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9796         pointer and to report location as the file name associated with
9797         the symbol.
9798         (gold_undefined_symbol_at_location): New function to replace the
9799         old gold_undefined_symbol functionality.
9800         * target-reloc.h (relocate_section): Update to use
9801         gold_undefined_symbol_at_location.
9802         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9803         Call gold_undefined_symbol function rather than gold_error.
9804         * errors.h (Errors::undefined_symbol): Take location as a
9805         string, rather than calculating it from a relocation.
9806         * errors.cc (Errors::fatal): Print "fatal error:" before the
9807         formatted message.
9808         (Errors::error, Errors::error_at_location): Print "error: "
9809         before the formatted message.
9810         (Errors::undefined_symbol): Take location as a string, rather
9811         than calculating it from a relocation.
9812         (gold_undefined_symbol_at_location): New function akin to
9813         old gold_undefined_symbol, calculates location from relocation.
9814         (gold_undefined_symbol): Change to take only a Symbol pointer
9815         and to report location as the file name associated with the symbol.
9816         * testsuite/debug_msg.sh: Update for changed error messages.
9817         * testsuite/undef_symbol.sh: Likewise.
9818
9819 2009-02-04  Duncan Sands  <baldrick@free.fr>
9820
9821         PR 9812
9822         * reduced_debug_output.h
9823         (Output_reduced_debug_abbrev_section::failed): Use format for
9824         gold_warning.
9825         (Output_reduced_debug_info_section::faild): Likewise.
9826
9827 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9828
9829         * script.cc (Lazy_demangler): New class.
9830         (Version_script_info::get_symbol_version_helper): Demangle a
9831         symbol only once.
9832
9833 2009-01-29  Cary Coutant  <ccoutant@google.com>
9834
9835         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9836         to __tls_get_addr.
9837         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9838
9839 2009-01-28  Ian Lance Taylor  <iant@google.com>
9840
9841         * version.cc (version_string): Bump to 1.9.
9842
9843         * gold.h: Include <cstring> and <stdint.h>.
9844         * version.cc: Include <cstdio>.
9845         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9846         warning.
9847         * reduced_debug_output.cc (insert_into_vector): Rename from
9848         Insert_into_vector; change all callers.  Use Swap_unaligned to
9849         avoid aliasing issue; remove union since it is unnecessary.
9850
9851 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9852
9853         * Makefile.am (CCFILES): Add gc.cc.
9854         (HFILES): Add gc.h.
9855         * Makefile.in: Regenerate.
9856         * gold.cc (Gc_runner): New class.
9857         (queue_initial_tasks): Call garbage collection related tasks
9858         when corresponding options are invoked.
9859         (queue_middle_gc_tasks): New function.
9860         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9861         processed early before laying out sections during garbage collection.
9862         * gold.h (queue_middle_gc_tasks): New function.
9863         (is_prefix_of): Move from "layout.cc".
9864         * i386.cc (Target_i386::gc_process_relocs): New function.
9865         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9866         * main.cc (main): Create object of class "Garbage_collection".
9867         * object.cc (Relobj::copy_symbols_data): New function.
9868         (Relobj::is_section_name_included): New function.
9869         (Sized_relobj::do_layout): Allow this function to be called twice
9870         during garbage collection and defer layout of section during the
9871         first call.
9872         * object.h (Relobj::get_symbols_data): New function.
9873         (Relobj::is_section_name_included): New function.
9874         (Relobj::copy_symbols_data): New function.
9875         (Relobj::set_symbols_data): New function.
9876         (Relobj::get_relocs_data): New function.
9877         (Relobj::set_relocs_data): New function.
9878         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9879         (Relobj::gc_process_relocs): New function.
9880         (Relobj::do_gc_process_relocs): New pure virtual function.
9881         (Relobj::sd_): New data member.
9882         (Sized_relobj::is_output_section_offset_invalid): New function.
9883         (Sized_relobj::do_gc_process_relocs): New function.
9884         * options.h (General_options::gc_sections): Modify to not be a no-op.
9885         (General_options::print_gc_sections): New option.
9886         * plugin.cc (Plugin_finish::run): Remove function call to
9887         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9888         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9889         * reloc.cc (Read_relocs::run): Add task to process relocs and
9890         determine unreferenced sections when doing garbage collection.
9891         (Gc_process_relocs): New class.
9892         (Sized_relobj::do_gc_process_relocs): New function.
9893         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9894         sections that are garbage collected.
9895         * reloc.h (Gc_process_relocs): New class.
9896         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9897         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9898         symbols whose corresponding sections are garbage collected.
9899         (Symbol_table::Symbol_table): Add new parameter for the garbage
9900         collection object.
9901         (Symbol_table::gc_mark_undef_symbols): New function.
9902         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9903         (Symbol_table::gc_mark_dyn_syms): New function.
9904         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9905         as garbage.
9906         (Symbol_table::add_from_object): Likewise.
9907         (Symbol_table::add_from_relobj): When building shared objects, do not
9908         treat externally visible symbols as garbage.
9909         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9910         table information for static and relocatable links.
9911         * symtab.h (Symbol_table::set_gc): New function.
9912         (Symbol_table::gc): New function.
9913         (Symbol_table::gc_mark_undef_symbols): New function.
9914         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9915         (Symbol_table::gc_mark_dyn_syms): New function.
9916         (Symbol_table::gc_): New data member.
9917         * target.h (Sized_target::gc_process_relocs): New pure virtual
9918         function.
9919         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9920         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9921
9922 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9923
9924         * options.h (General_options::gc_sections): Define as a no-op for now.
9925         (General_options::no_keep_memory): Ditto.
9926         (General_options::Bshareable): Define.
9927         * options.cc (General_options::finalize): Honor -Bshareable.
9928
9929 2009-01-20  Andreas Schwab  <schwab@suse.de>
9930
9931         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9932         read the value in the contents, since we don't use it.  Use the
9933         template endianness when writing.
9934         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9935
9936 2009-01-19  Andreas Schwab  <schwab@suse.de>
9937
9938         * configure.tgt (powerpc64-*): Fix targ_obj.
9939
9940 2009-01-15  Ian Lance Taylor  <iant@google.com>
9941
9942         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9943         local symbols when stripping all symbols.
9944
9945 2009-01-14  Cary Coutant  <ccoutant@google.com>
9946
9947         * output.cc (Output_reloc): Add explicit instantiations.
9948
9949 2009-01-14  Cary Coutant  <ccoutant@google.com>
9950
9951         * archive.cc (Archive::get_elf_object_for_member): Remove call
9952         to File_read::claim_for_plugin.
9953         * descriptors.cc (Descriptors::open): Remove reference to
9954         is_claimed.
9955         (Descriptors::claim_for_plugin): Remove.
9956         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9957         (Descriptors::is_claimed): Remove.
9958         (claim_descriptor_for_plugin): Remove.
9959         * fileread.cc (File_read::claim_for_plugin): Remove.
9960         * fileread.h (File_read::claim_for_plugin): Remove.
9961         (File_read::descriptor): Reopen descriptor if necessary.
9962         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9963         (Plugin_manager::all_symbols_read): Add task parameter. Change
9964         all callers.
9965         (Plugin_manager::get_input_file): New function.
9966         (Plugin_manager::release_input_file): New function.
9967         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9968         corresponding data member.
9969         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9970         and pass to base constructor. Change all callers.
9971         (get_input_file, release_input_file): New functions.
9972         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9973         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9974         (Plugin_manager::all_symbols_read): Add task parameter.
9975         (Plugin_manager::get_input_file): New function.
9976         (Plugin_manager::release_input_file): New function.
9977         (Plugin_manager::task_): New data member.
9978         (Pluginobj::Pluginobj): Add filesize parameter.
9979         (Pluginobj::filename): New function.
9980         (Pluginobj::descriptor): New function.
9981         (Pluginobj::filesize): New function.
9982         (Pluginobj::filesize_): New data member.
9983         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9984         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9985         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9986
9987         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9988         with archive libraries.
9989         * testsuite/Makefile.in: Regenerate.
9990         * testsuite/plugin_test.c (struct sym_info): New type.
9991         (get_input_file, release_input_file): New static variables.
9992         (onload): Capture new transfer vector entries.
9993         (claim_file_hook): Stop reading at end of file according to filesize.
9994         Factor out parsing of readelf output into separate function.
9995         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9996         APIs and get the source file name from the symbol table.  Convert
9997         source file name to corresponding object file name.  Print info
9998         message when adding new input files.
9999         (parse_readelf_line): New function.
10000         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10001         * testsuite/plugin_test_2.sh: Likewise.
10002         * testsuite/plugin_test_3.sh: Likewise.
10003         * testsuite/plugin_test_4.sh: New test case.
10004
10005 2009-01-07  Ian Lance Taylor  <iant@google.com>
10006
10007         * version.cc (version_string): Bump to 1.8.
10008
10009 2008-12-23  Cary Coutant  <ccoutant@google.com>
10010
10011         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10012         * plugin.cc (Plugin_manager::finish): Rename as
10013         layout_deferred_objects.  Move cleanup to separate function.
10014         (Plugin_manager::cleanup): New function.
10015         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10016         separately.
10017         * plugin.h (Plugin_manager::finish): Rename as
10018         layout_deferred_objects.
10019         (Plugin_manager::cleanup): New function.
10020         (Plugin_manager::cleanup_done): New field.
10021
10022 2008-12-23  Cary Coutant  <ccoutant@google.com>
10023
10024         * plugin.cc (is_visible_from_outside): New function.
10025         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10026         so we don't return "IR only" status for exported symbols or -r links.
10027
10028         * testsuite/Makefile.am (plugin_test_3): New test case.
10029         * testsuite/Makefile.in: Regenerate.
10030         * testsuite/plugin_test_3.sh: New file.
10031
10032 2008-12-22  Cary Coutant  <ccoutant@google.com>
10033
10034         * object.cc (Sized_relobj::layout_section): New function.
10035         (Sized_relobj::do_layout): Defer layout of input sections until after
10036         plugin has provided replacement files.
10037         (Sized_relobj::do_layout_deferred_sections): New function.
10038         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10039         (Relobj::layout_deferred_sections): New function.
10040         (Relobj::do_layout_deferred_sections): New function.
10041         (Sized_relobj::do_layout_deferred_sections): New function.
10042         (Sized_relobj::layout_section): New function.
10043         (Sized_relobj::Deferred_layout): New structure.
10044         (Sized_relobj::deferred_layout_): New field.
10045         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10046         Change all callers.  Layout deferred sections.
10047         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10048         references.
10049         (Plugin_hook::run): Move code from do_plugin_hook inline.
10050         (Plugin_hook::do_plugin_hook): Remove.
10051         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10052         (Plugin_manager::finish): Renamed, was cleanup.
10053         (Plugin_manager::should_defer_layout): New function.
10054         (Plugin_manager::add_deferred_layout_object): New function.
10055         (Plugin_manager::Deferred_layout_list): New type.
10056         (Plugin_manager::deferred_layout_objects_): New field.
10057         (Plugin_hook::do_plugin_hook): Remove.
10058
10059 2008-12-17  Ian Lance Taylor  <iant@google.com>
10060
10061         * options.h (class General_options): Add --no case for
10062         --export-dynamic.
10063
10064 2008-12-16  Cary Coutant  <ccoutant@google.com>
10065
10066         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10067         vector.
10068         (Plugin_manager::claim_file): Create plugin object even if
10069         plugin did not call the add_symbols callback.
10070         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10071         asking for more symbols than were added.
10072         * testsuite/Makefile.am (plugin_test_1): Add test case with
10073         no global symbols.
10074         (empty.syms): New target.
10075         * testsuite/Makefile.in: Regenerate.
10076         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10077         message. Don't call add_symbols if no globals.
10078         (all_symbols_read_hook): Don't provide replacement for empty
10079         claimed file.
10080
10081 2008-12-12  Ian Lance Taylor  <iant@google.com>
10082
10083         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10084         r_type == 0 for a local symbol with r_sym == 0.
10085         (scan_relocatable_relocs): Pass r_sym to
10086         local_non_section_strategy.
10087         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10088         r_sym parameter.
10089
10090         * configure.ac: Update test for TLS descriptors: they are
10091         supported as of glibc 2.9.
10092         * configure: Rebuild.
10093
10094 2008-12-11  Ian Lance Taylor  <iant@google.com>
10095
10096         PR 7091
10097         * target-reloc.h (Default_scan_relocatable_relocs): For each
10098         function, map r_type == 0 to RELOC_DISCARD.
10099
10100 2008-12-10  Cary Coutant  <ccoutant@google.com>
10101
10102         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10103         object to override a kept COMDAT group from a plugin object.
10104
10105 2008-12-09  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 7088
10108         * yyscript.y (file_cmd): Handle INPUT.
10109
10110         * testsuite/initpri1.c: Change all declarations to be full
10111         prototypes by adding void, to avoid compiler warnings.
10112
10113 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10114
10115         * options.cc (General_options::parse_plugin_opt): New.
10116         (General_options::add_plugin): The argument now is just the filename.
10117         (General_options::add_plugin_option): New.
10118         * options.h (plugin_opt): New.
10119         (add_plugin): Change argument name.
10120         (add_plugin_option): New.
10121         * plugin.cc (Plugin::load): Don't parse the plugin option.
10122         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10123         (Plugin::add_option): New.
10124         (Plugin::args_): Change type.
10125         (Plugin::filename_): New.
10126         (Plugin_manager::add_plugin_option): New.
10127         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10128         * testsuite/Makefile.in: Regenerate.
10129
10130 2008-12-05  Cary Coutant  <ccoutant@google.com>
10131
10132         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10133         Handle --strip-lto-sections option.
10134         * options.h (strip_lto_sections): New option.
10135
10136 2008-12-01  Cary Coutant  <ccoutant@google.com>
10137
10138         * plugin.cc (ld_plugin_message): Change format parameter to const.
10139         Fix mismatch between new[] and delete.
10140
10141 2008-11-14  Cary Coutant  <ccoutant@google.com>
10142
10143         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10144         instead of -1U.
10145
10146 2008-11-05  Craig Silverstein  <csilvers@google.com>
10147
10148         * options.cc (General_options::parse_dynamic_list): New function.
10149         * options.h (General_options): New flags dynamic_list,
10150         dynamic_list_data, dynamic_list_cpp_new, and
10151         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10152         (General_options::in_dynamic_list): New function.
10153         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10154         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10155         (Lex::can_continue_name): Likewise.
10156         (yylex): Likewise.
10157         (read_script_file): New parameter script_options.
10158         (read_dynamic_list): New function.
10159         (Script_options::define_dynamic_list): New function.
10160         (dynamic_list_keyword_parsecodes): New variable.
10161         (dynamic_list_keywords): New variable.
10162         * script.h (Script_options::define_dynamic_list): New function
10163         prototype.
10164         (read_dynamic_list): New function prototype.
10165         * symtab.cc (strprefix): New macro.
10166         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10167         dynamic_list_data, dynamic_list_cpp_new, and
10168         dynamic_list_cpp_typeinfo.
10169         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10170         (dynamic_list_expr): New rule.
10171         (dynamic_list_nodes): Likewise.
10172         (dynamic_list_node): Likewise.
10173         * testsuite/Makefile.am (dynamic_list): New test.
10174         * testsuite/Makefile.in: Regenerated.
10175         * testsuite/dynamic_list.t: New file.
10176         * testsuite/dynamic_list.sh: New file.
10177
10178 2008-11-05  Craig Silverstein  <csilvers@google.com>
10179
10180         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10181         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10182         (t11_last): Likewise.
10183         * testsuite/ver_test_6.c (main): Likewise.
10184
10185 2008-10-07  Cary Coutant  <ccoutant@google.com>
10186
10187         * options.c (General_options::finalize): Add check for -static and
10188         -shared.
10189         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10190         is not empty.
10191
10192 2008-10-02  Cary Coutant  <ccoutant@google.com>
10193
10194         * plugin.cc (make_sized_plugin_object): Fix conditional
10195         compilation to work when not all targets are enabled.
10196
10197 2008-09-29  Cary Coutant  <ccoutant@google.com>
10198
10199         * archive.cc (Archive::get_file_and_offset): Use filename instead
10200         of name to get library path.
10201         (Archive::include_member): Unlock external member of a thin archive.
10202
10203         * testsuite/Makefile.am (TEST_AR): New variable.
10204         (thin_archive_test_1): New test.
10205         (thin_archive_test_2): New test.
10206         * testsuite/Makefile.in: Regenerate.
10207         * testsuite/thin_archive_main.cc: New file.
10208         * testsuite/thin_archive_test_1.cc: New file.
10209         * testsuite/thin_archive_test_2.cc: New file.
10210         * testsuite/thin_archive_test_3.cc: New file.
10211         * testsuite/thin_archive_test_4.cc: New file.
10212
10213 2008-09-29  Cary Coutant  <ccoutant@google.com>
10214
10215         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10216         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10217         instead of -1U.
10218         (Sized_relobj::do_finalize_local_symbols): Likewise.
10219         (Sized_relobj::map_to_kept_section): Likewise.
10220         * object.h (Sized_relobj::invalid_address): New constant.
10221         (Sized_relobj::do_output_section_offset): Check for invalid_address
10222         and return -1ULL.
10223         * output.cc (Output_reloc::local_section_offset): Use constant
10224         invalid_address instead of -1U.
10225         (Output_reloc::get_address): Likewise.
10226         (Output_section::output_address): Change -1U to -1ULL.
10227         * output.h (Output_reloc::invalid_address): New constant.
10228         * reloc.cc (Sized_relobj::write_sections): Use constant
10229         invalid_address instead of -1U.
10230         (Sized_relobj::relocate_sections): Likewise.
10231         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10232         values for merge sections.
10233         * target-reloc.h (relocate_for_relocatable): Use constant
10234         invalid_address instead of -1U.
10235
10236 2008-09-19  Cary Coutant  <ccoutant@google.com>
10237
10238         Add plugin functionality for link-time optimization (LTO).
10239         * configure.ac (plugins): Add --enable-plugins option.
10240         * configure: Regenerate.
10241         * config.in: Regenerate.
10242         * Makefile.am (LIBDL): New variable.
10243         (CCFILES): Add plugin.cc.
10244         (HFILES): Add plugin.h.
10245         (ldadd_var): Add LIBDL.
10246         * Makefile.in: Regenerate.
10247
10248         * archive.cc: Include "plugin.h".
10249         (Archive::setup): Don't preread archive symbols when using a plugin.
10250         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10251         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10252         files.
10253         (Archive::include_member): Add symbols from plugin objects.
10254         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10255         * descriptors.cc (Descriptors::open): Check for file descriptors
10256         abandoned by plugins.
10257         (Descriptors::claim_for_plugin): New function.
10258         * descriptors.h (Descriptors::claim_for_plugin): New function.
10259         (Open_descriptor::is_claimed): New field.
10260         (claim_descriptor_for_plugin): New function.
10261         * fileread.cc (File_read::claim_for_plugin): New function.
10262         * fileread.h (File_read::claim_for_plugin): New function.
10263         (File_read::descriptor): New function.
10264         * gold.cc: Include "plugin.h".
10265         (queue_initial_tasks): Add task to call plugin hooks for generating
10266         new object files.
10267         * main.cc: Include "plugin.h".
10268         (main): Load plugin libraries.
10269         * object.h (Pluginobj): Declare.
10270         (Object::pluginobj): New function.
10271         (Object::do_pluginobj): New function.
10272         (Object::set_target): New function.
10273         * options.cc: Include "plugin.h".
10274         (General_options::parse_plugin): New function.
10275         (General_options::General_options): Initialize plugins_ field.
10276         (General_options::add_plugin): New function.
10277         * options.h (Plugin_manager): Declare.
10278         (General_options): Add --plugin option.
10279         (General_options::has_plugins): New function.
10280         (General_options::plugins): New function.
10281         (General_options::add_plugin): New function.
10282         (General_options::plugins_): New field.
10283         * plugin.cc: New file.
10284         * plugin.h: New file.
10285         * readsyms.cc: Include "plugin.h".
10286         (Read_symbols::do_read_symbols): Check for archive before checking
10287         for ELF file.  Call plugin hooks to claim files.
10288         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10289         from a real object file; force override when processing replacement
10290         files.
10291         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10292         (Symbol::init_base_object): Likewise.
10293         (Symbol::init_base_output_data): Likewise.
10294         (Symbol::init_base_output_segment): Likewise.
10295         (Symbol::init_base_constant): Likewise.
10296         (Symbol::init_base_undefined): Likewise.
10297         (Symbol::output_section): Assert that object is not a plugin.
10298         (Symbol_table::add_from_pluginobj): New function.
10299         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10300         undefined.
10301         (Symbol_table::sized_write_globals): Likewise.
10302         (Symbol_table::add_from_pluginobj): Instantiate template.
10303         * symtab.h (Sized_pluginobj): Declare.
10304         (Symbol::in_real_elf): New function.
10305         (Symbol::set_in_real_elf): New function.
10306         (Symbol::in_real_elf_): New field.
10307         (Symbol_table::add_from_pluginobj): New function.
10308
10309         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10310         (LIBDL): New variable.
10311         (LDADD): Add LIBDL.
10312         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10313         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10314         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10315         (MOSTLYCLEANFILES): Likewise.
10316         * testsuite/Makefile.in: Regenerate.
10317         * testsuite/plugin_test.c: New file.
10318         * testsuite/plugin_test_1.sh: New file.
10319         * testsuite/plugin_test_2.sh: New file.
10320
10321 2008-09-16  Ian Lance Taylor  <iant@google.com>
10322
10323         * target-reloc.h (relocate_section): Check whether a symbol is
10324         defined by the ABI before reporting an undefined symbol error.
10325         * target.h (Target::is_defined_by_abi): Make parameter const.
10326         (Target::do_is_defined_by_abi): Likewise.
10327         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10328         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10329         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10330         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10331         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10332         * testsuite/Makefile.in: Rebuild.
10333
10334         * fileread.cc (make_view): Add casts to avoid warning.
10335
10336 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10337
10338         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10339         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10340
10341 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10342
10343         * options.h (General_options::output_is_executable): New.
10344         (General_options::output_is_pie): New.
10345         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10346         for shared libraries.
10347         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10348
10349 2008-09-11  Chris Demetriou  <cgd@google.com>
10350
10351         * options.h (origin): New -z option.
10352         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10353         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10354         in DT_FLAGS_1.
10355
10356 2008-09-05  Cary Coutant  <ccoutant@google.com>
10357
10358         * fileread.cc (File_read::make_view): Add check for attempt to map
10359         beyond end of file.
10360
10361 2008-09-05  Cary Coutant  <ccoutant@google.com>
10362
10363         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10364         explicit instantiations.
10365
10366 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10367
10368         PR gold/6858
10369         * options.cc (General_options::finalize): Allow undefined symbols
10370         in shlibs if linking -shared.
10371
10372         PR gold/6859
10373         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10374         symbols as not needing a dynsym entry.
10375
10376 2008-08-20  Craig Silverstein  <csilvers@google.com>
10377
10378         * fileread.cc (File_read::open): Do not lock the file unless it
10379         was successfully opened.
10380
10381 2008-08-14  Cary Coutant  <ccoutant@google.com>
10382
10383         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10384         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10385         * testsuite/tls_test.cc (struct int128): 128-bit struct
10386         for testing TLS relocs with non-zero addend.
10387         (v12): New TLS variable.
10388         (t12): New test.
10389         (t_last): Add check for v12.
10390         * testsuite/tls_test.h (t12): New function.
10391         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10392
10393 2008-08-13  Ian Lance Taylor  <iant@google.com>
10394
10395         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10396         set tls_segment_ or relro_segment_.
10397         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10398         when appropriate.
10399         * output.h (Output_section::clear_is_relro): New function.
10400         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10401         sections specially even when output_data_ is empty.
10402         (Output_segment::maximum_alignment): When first section is relro,
10403         only force alignment for PT_LOAD segments.
10404         * script.cc (script_data_segment_align): New function.
10405         (script_data_segment_relro_end): New function.
10406         * script-c.h (script_data_segment_align): Declare.
10407         (script_data_segment_relro_end): Declare.
10408         * script-sections.h (class Script_sections): Declare
10409         data_segment_align and data_segment_relro_end.  Add fields
10410         segment_align_index_ and saw_relro_end_.
10411         * script-sections.cc (class Sections_element): Add set_is_relro
10412         virtual function.  Add new bool* parameter to place_orphan_here.
10413         Add get_output_section virtual function.
10414         (class Output_section_definition): Add set_is_relro.  Add new
10415         bool* parameter to place_orphan_here.  Add get_output_section.
10416         Add is_relro_ field.
10417         (Output_section_definition::Output_section_definition): Initialize
10418         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10419         and is_relro_ fields.
10420         (Output_section_definition::place_orphan_here): Add is_relro
10421         parameter.
10422         (Output_section_definition::set_section_addresses): Set relro for
10423         output section.
10424         (Output_section_definition::alternate_constraint): Likewise.
10425         (class Orphan_output_section): Add new bool* parameter to
10426         place_orphan_here.  Add get_output_section.
10427         (Orphan_output_section::place_orphan_here): Add is_relro
10428         parameter.
10429         (Script_sections::Script_sections): Initialize
10430         data_segment_align_index_ and saw_relro_end_.
10431         (Script_sections::data_segment_align): New function.
10432         (Script_sections::data_segment_relro_end): New function.
10433         (Script_sections::place_orphan): Set or clear is_relro.
10434         (Script_sections::set_section_addresses): Force alignment of first
10435         TLS section.
10436         * yyscript.y (exp): Call script_data_segment_align and
10437         script_data_segment_relro_end.
10438         * testsuite/relro_script_test.t: New file.
10439         * testsuite/relro_test.cc (using_script): Declare.
10440         (t1, t2): Test using_script.
10441         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10442         (relro_script_test_SOURCES): Define.
10443         (relro_script_test_DEPENDENCIES): Define.
10444         (relro_script_test_LDFLAGS): Define.
10445         (relro_script_test_LDADD): Define.
10446         (relro_script_test.so): New target.
10447         * testsuite/Makefile.in: Rebuild.
10448
10449 2008-08-06  Cary Coutant <ccoutant@google.com>
10450
10451         * archive.cc (Archive::total_archives, Archive::total_members)
10452         (Archive::total_members_loaded): New variables.
10453         (Archive::setup): Add parameter.  Add option to preread
10454         archive symbols.
10455         (Archive::read_armap): Add counter.
10456         (Archive::get_file_and_offset): New function.
10457         (Archive::get_elf_object_for_member): New function.
10458         (Archive::read_all_symbols): New function.
10459         (Archive::read_symbols): New function.
10460         (Archive::add_symbols): Add counters.
10461         (Archive::include_all_members): Use armap to find members if it's
10462         already built.
10463         (Archive::include_member): Skip reading symbols if already read.
10464         Factored code into Archive::get_file_and_offset and
10465         Archive::get_elf_object_for_member.  Changed call to
10466         Mapfile::report_include_archive_member.
10467         (Archive::print_stats): New function.
10468         * archive.h: Declare Object and Read_symbols_data classes.
10469         (Archive::Archive): Add initializers for new members.
10470         (Archive::setup): Add parameter.
10471         (Archive::print_stats): New function.
10472         (Archive::total_archives, Archive::total_members)
10473         (Archive::total_members_loaded): New variables.
10474         (Archive::get_file_and_offset): New function.
10475         (Archive::get_elf_object_for_member): New function.
10476         (Archive::read_all_symbols): New function.
10477         (Archive::read_symbols): New function.
10478         (Archive::Archive_member): New class.
10479         (Archive::members_): New member.
10480         (Archive::num_members_): New member.
10481         * main.cc: Include archive.h.
10482         (main): Call Archive::print_stats.
10483         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10484         archive parameter; member_name is now the fully-decorated name.
10485         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10486         * options.h: (General_options): Add --preread-archive-symbols option.
10487         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10488         Archive::setup.
10489
10490 2008-08-04  Ian Lance Taylor  <iant@google.com>
10491
10492         * symtab.h (Symbol::use_plt_offset): New function.
10493         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10494         * powerpc.cc (Relocate::relocate): Likewise.
10495         * sparc.cc (Relocate::relocate): Likewise.
10496         * x86_64.cc (Relocate::relocate): Likewise.
10497         * testsuite/weak_plt.sh: New test.
10498         * testsuite/weak_plt_main.cc: New test.
10499         * testsuite/weak_plt_shared.cc: New test.
10500         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10501         (check_PROGRAMS): Add weak_plt.
10502         (check_DATA): Add weak_plt_shared.so.
10503         (weak_plt_main_pic.o, weak_plt): New targets.
10504         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10505         * testsuite/Makefile.in: Rebuild.
10506
10507         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10508         gcctestdir/ld.
10509         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10510         * testsuite/Makefile.in: Rebuild.
10511
10512 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10513
10514         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10515         * Makefile.in: Regenerate.
10516         * po/POTFILES.in: Regenerate.
10517
10518 2008-07-29  Ian Lance Taylor  <iant@google.com>
10519
10520         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10521         symbols before other symbols.
10522         * testsuite/script_test_2.cc (test_addr): Declare.
10523         (test_addr_alias): Declare.
10524         (main): Check that test_addr and test_addr_alias have the right
10525         values.
10526         * testsuite/script_test_2.t: Define test_addr_alias and
10527         test_addr.
10528
10529 2008-07-24  Ian Lance Taylor  <iant@google.com>
10530
10531         PR 5990
10532         * descriptors.cc: New file.
10533         * descriptors.h: New file.
10534         * gold-threads.h (class Hold_optional_lock): New class.
10535         * fileread.cc: Include "descriptors.h".
10536         (File_read::~File_read): Release descriptor rather than closing
10537         it.
10538         (File_read::open) [file]: Call open_descriptor rather than open.
10539         Set is_descriptor_opened_.
10540         (File_read::open) [memory]: Assert that descriptor is not open.
10541         (File_read::reopen_descriptor): New function.
10542         (File_read::release): Release descriptor.
10543         (File_read::do_read): Make non-const.  Reopen descriptor.
10544         (File_read::read): Make non-const.
10545         (File_read::make_view): Reopen descriptor.
10546         (File_read::do_readv): Likewise.
10547         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10548         Update declarations.
10549         * layout.cc: Include "descriptors.h".
10550         (Layout::create_build_id): Use open_descriptor rather than open.
10551         * output.cc: Include "descriptors.h".
10552         (Output_file::open): Use open_descriptor rather than open.
10553         * archive.cc (Archive::const_iterator): Change Archive to be
10554         non-const.
10555         (Archive::begin, Archive::end): Make non-const.
10556         (Archive::count_members): Likewise.
10557         * archive.h (class Archive): Update declarations.
10558         * object.h (Object::read): Make non-const.
10559         * Makefile.am (CCFILES): Add descriptors.cc.
10560         (HFILES): Add descriptors.h.
10561         * Makefile.in: Rebuild.
10562
10563         PR 6716
10564         * gold.h: Always include <clocale>.  Add Solaris workarounds
10565         following code in binutils/sysdep.h.
10566
10567         PR 6048
10568         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10569         this->eh_frame_hdr_ is NULL before using it.
10570
10571         * dynobj.cc (Versions::Versions): Update comment.
10572
10573         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10574         the base version name.
10575
10576         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10577         array size plus one.
10578         (Stringpool_template::set_string_offsets): Subtract one from key
10579         before using it as an array index.
10580         (Stringpool_template::get_offset_with_length): Likewise.
10581         (Stringpool_template::write_to_buffer): Likewise.
10582         * stringpool.h (Stringpool_template::get_offset_from_key):
10583         Likewise.
10584
10585 2008-07-23  Ian Lance Taylor  <iant@google.com>
10586
10587         PR 6658
10588         * object.h (Merged_symbol_value::value): Do our best to handle a
10589         negative addend.
10590
10591         PR 6647
10592         * script.cc (Version_script_info::get_versions): Don't add empty
10593         version tag to return value.
10594         (Version_script_info::get_symbol_version_helper): Change return
10595         type to bool.  Add pversion parameter.  Change all callers.
10596         (script_register_vers_node): Don't require a non-NULL tag.
10597         * script.h (class Version_script_info): Update declarations.
10598         (Version_script_info::get_symbol_version): Change return type to
10599         bool.  Add version parameter.  Change all callers.
10600         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10601         handling.  Handle an empty version from a version script.
10602         (Symbol_table::define_special_symbol): Likewise.
10603         * testsuite/ver_test_10.script: New file.
10604         * testsuite/ver_test_10.sh: New file.
10605         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10606         (check_DATA): Add ver_test_10.syms.
10607         (ver_test_10.syms, ver_test_10.so): New target.
10608         * testsuite/Makefile.in: Rebuild.
10609
10610 2008-07-23  Simon Baldwin  <simonb@google.com>
10611
10612         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10613         to zero for undefined symbols from dynamic libraries.
10614
10615 2008-07-23  Ian Lance Taylor  <iant@google.com>
10616
10617         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10618         Change all callers.
10619         * symtab.h (class Symbol_table): Update declaration.
10620         * testsuite/ver_test_9.cc: New file.
10621         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10622         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10623         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10624         (ver_test_9.so, ver_test_9.o): New targets.
10625         * testsuite/Makefile.in: Rebuild.
10626
10627 2008-07-22  Ian Lance Taylor  <iant@google.com>
10628
10629         * options.h (class General_options): Define --check-sections.
10630         * layout.cc (Layout::set_segment_offsets): Handle
10631         --check-sections.
10632
10633         * options.h (class General_options): Define -n/--nmagic and
10634         -N/--omagic.
10635         * options.cc (General_options::finalize): For -n/--nmagic or
10636         -N/--omagic, set -static.
10637         * layout.cc (Layout::attach_allocated_section_to_segment): If
10638         -N/--omagic, don't put read-only and read-write sections in
10639         different segments.
10640         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10641         finding a read-only segment.
10642         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10643         don't set the minimum segment alignment to the common page size,
10644         and don't set the file offset to the address modulo the page size.
10645         * script-sections.cc (Script_sections::create_segments): If
10646         -n/--omagic, don't put read-only and read-write sections in
10647         different segments.
10648
10649         * cref.cc: New file.
10650         * cref.h: New file.
10651         * options.h (class General_options): Add --print-symbol-counts.
10652         * main.cc (main): Issue defined symbol report if requested.
10653         * archive.cc (Archive::interpret_header): Make into a const member
10654         function.
10655         (Archive::add_symbols): Call Input_objects::archive_start and
10656         archive_stop.
10657         (Archive::const_iterator): Define new class.
10658         (Archive::begin, Archive::end): New functions.
10659         (Archive::include_all_members): Rewrite to use iterator.
10660         (Archive::count_members): New function.
10661         * archive.h (class Archive): Update declarations.
10662         (Archive::filename): New function.
10663         * object.cc: Include "cref.h".
10664         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10665         (Sized_relobj::do_get_global_symbol_counts): New function.
10666         (Input_objects::add_object): Add object to cross-referencer.
10667         (Input_objects::archive_start): New function.
10668         (Input_objects::archive_stop): New function.
10669         (Input_objects::print_symbol_counts): New function.
10670         * object.h: Declare Cref and Archive.
10671         (Object::get_global_symbol_counts): New function.
10672         (Object::do_get_global_symbol_counts): New pure virtual function.
10673         (class Sized_relobj): Add defined_count_ field.  Update
10674         declarations.
10675         (class Input_objects): Add cref_ field.  Update constructor.
10676         Update declarations.
10677         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10678         defined_count_.
10679         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10680         symbol counts.
10681         (Sized_dynobj::do_get_global_symbol_counts): New function.
10682         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10683         defined_count_.  Update declarations.  Define Symbols typedef.
10684         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10685         parameter.  Change all callers.
10686         (Symbol_table::add_from_dynobj): Add sympointers and defined
10687         parameters.  Change all callers.
10688         * symtab.h (class Symbol_table): Update declarations.
10689         * Makefile.am (CCFILES): Add cref.cc.
10690         (HFILES): Add cref.h.
10691         * Makefile.in: Rebuild.
10692
10693 2008-07-22  Simon Baldwin  <simonb@google.com>
10694
10695         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10696         to zero when writing undefined symbols.
10697
10698 2008-07-22  Ian Lance Taylor  <iant@google.com>
10699
10700         * output.cc (Output_section::add_input_section): Don't try to
10701         merge empty merge sections.
10702
10703 2008-07-21  Craig Silverstein  <csilvers@google.com>
10704
10705         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10706         Include symbol version in error message.
10707
10708 2008-07-20  Chris Demetriou  <cgd@google.com>
10709
10710         * configure.ac (gold_cv_c_random_seed): New configured variable.
10711         (RANDOM_SEED_CFLAGS): New substituted variable.
10712         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10713         * configure: Rebuild.
10714         * Makefile.in: Likewise.
10715         * testsuite/Makefile.in: Likewise.
10716
10717 2008-07-18  Ian Lance Taylor  <iant@google.com>
10718
10719         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10720         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10721         * testsuite/ver_test_main.cc (main): Call t4.
10722         (t4, t4_2a): Define.
10723         * testsuite/ver_test_2.cc (t4_2): Define.
10724         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10725         * testsuite/ver_test_4.cc (t4_2a): Define.
10726         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10727         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10728
10729 2008-07-17  Ian Lance Taylor  <iant@google.com>
10730
10731         * dynobj.cc (Versions::add_def): If we give an error about a
10732         missing version, go ahead and create the version anyhow.
10733
10734 2008-07-10  Ian Lance Taylor  <iant@google.com>
10735
10736         Handle output sections with more than 0x7fffffff bytes.
10737         * object.h (class Relobj): Change map_to_output_ to
10738         output_sections_, and just keep a section pointer.  Change all
10739         uses.  Move comdat group support to Sized_relobj.
10740         (Relobj::is_section_specially_mapped): Remove.
10741         (Relobj::output_section): Remove poff parameter.  Change all
10742         callers.
10743         (Relobj::output_section_offset): New function.
10744         (Relobj::set_section_offset): Rewrite.
10745         (Relobj::map_to_output): Remove.
10746         (Relobj::output_sections): New function.
10747         (Relobj::do_output_section_offset): New pure virtual function.
10748         (Relobj::do_set_section_offset): Likewise.
10749         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10750         group support from Relobj.  Update declarations.
10751         (Sized_relobj::get_output_section_offset): New function.
10752         (Sized_relobj::do_output_section_offset): New function.
10753         (Sized_relobj::do_set_section_offset): New function.
10754         * object.cc (Relobj::output_section_address): Remove.
10755         (Sized_relobj::Sized_relobj): Initialize new fields.
10756         (Sized_relobj::include_section_group): Cast find_kept_object to
10757         Sized_relobj.
10758         (Sized_relobj::include_linkonce_section): Likewise.
10759         (Sized_relobj::do_layout): Use separate arrays for output section
10760         and output offset.
10761         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10762         output_sections.
10763         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10764         output_sections and section_offsets.
10765         (Sized_relobj::write_local_symbols): Likewise.
10766         (map_to_kept_section): Compute output address directly.
10767         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10768         output_sections and section_offsets.
10769         (Sized_relobj::write_sections): Likewise.
10770         (Sized_relobj::relocate_sections): Likewise.
10771         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10772         * output.h (class Output_reloc): Update declarations.  Change
10773         u2_.relobj to Sized_relobj*.
10774         (class Output_data_reloc): Change add functions to use
10775         Sized_relobj*.
10776         * output.cc (Output_reloc::Output_reloc): Change relobj to
10777         Sized_relobj*.
10778         (Output_reloc::local_section_offset): Change return type to
10779         Elf_Addr.  Use get_output_section_offset.
10780         (Output_reloc::get_address): Likewise.
10781         (Output_section::is_input_address_mapped): Don't call
10782         is_section_specially_mapped.
10783         (Output_section::output_offset): Likewise.
10784         (Output_section::output_address): Likewise.
10785         (Output_section::starting_output_address): Likewise.
10786         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10787         parameter to Sized_relobj*.
10788         (Copy_relocs::need_copy_reloc): Likewise.
10789         (Copy_relocs::save): Likewise.
10790         * copy-relocs.h (class Copy_relocs): Update declarations.
10791         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10792         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10793         * target-reloc.h (relocate_for_relocatable): Change
10794         offset_in_output_section type to Elf_Addr.  Change code that uses
10795         it as well.
10796         * layout.cc (Layout::layout): Always set *off.
10797         * mapfile.cc (Mapfile::print_input_section): Use
10798         output_section_offset.
10799         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10800         Sized_relobj*.
10801         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10802         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10803         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10804
10805 2008-07-03  Ian Lance Taylor  <iant@google.com>
10806
10807         * layout.cc (Layout::include_section): Do not discard unrecognized
10808         SHT_STRTAB sections.
10809
10810 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10811
10812         * script.cc (Lex::can_continue_name): Make '?' allowable in
10813         version-script names.
10814         * testsuite/version_script.map: Change glob pattern to use '?'
10815
10816 2008-06-30  Manish Singh  <yosh@gimp.org>
10817
10818         PR 6585
10819         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10820         Correct typo.
10821
10822 2008-06-30  Ian Lance Taylor  <iant@google.com>
10823
10824         PR 6660
10825         PR 6682
10826         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10827         versions]: Don't try to read the value in the contents, since we
10828         don't use it.  Use the template endianness when writing.
10829
10830 2008-06-25  Cary Coutant  <ccoutant@google.com>
10831
10832         * fileread.cc (File_read::make_view): Assert on zero-length view.
10833         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10834         symbol table when there are no symbols to read.
10835
10836 2008-06-23  Craig Silverstein  <csilvers@google.com>
10837
10838         * version.cc (version_string): Bump to 1.7
10839
10840 2008-06-18  Craig Silverstein  <csilvers@google.com>
10841
10842         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10843         constant 0xFFFF to type Valtype.
10844         (Powerpc_relocate_functions::rel16_ha): Likewise.
10845
10846 2008-06-17  Ian Lance Taylor  <iant@google.com>
10847
10848         * output.h (Output_section::Input_section): Initialize p2align_ to
10849         zero for Output_section_data constructors.
10850         (Output_section::Input_section::addralign): If not an input
10851         section, return the alignment of the Output_section_data.
10852         * testsuite/copy_test.cc: New file.
10853         * testsuite/copy_test_1.cc: New file.
10854         * testsuite/copy_test_2.cc: New file.
10855         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10856         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10857         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10858         (copy_test_1_pic.o, copy_test_1.so): New targets.
10859         (copy_test_2_pic.o, copy_test_2.so): New targets.
10860         * testsuite/Makefile.in: Rebuild.
10861
10862         * script-sections.cc (Script_sections::place_orphan): Initialize
10863         local variable exact.
10864
10865 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10866
10867         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10868
10869 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10870             David S. Miller  <davem@davemloft.net>
10871
10872         * powerpc.cc: New file.
10873         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10874         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10875         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10876         * Makefile.in: Rebuild.
10877
10878 2008-06-09  Ian Lance Taylor  <iant@google.com>
10879
10880         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10881         <exception>.
10882         (throwing, orig_terminate): New static variables.
10883         (terminate_handler): New static function.
10884         (t2): Set terminate handler.
10885
10886 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10887
10888         PR 6584
10889         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10890         alignment.
10891
10892 2008-05-30  Cary Coutant  <ccoutant@google.com>
10893
10894         * archive.cc (Archive::include_all_members) Correct to step
10895         over symbol table and extended name table in thin archives.
10896
10897 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10898
10899         PR 6407
10900         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10901         calculation.
10902
10903 2008-05-28  Caleb Howe  <cshowe@google.com>
10904
10905         * reduced_debug_output.cc: New file.
10906         * reduced_debug_output.h: New file.
10907         * options.h (class General_options): Add --strip-debug-non-line.
10908         * options.cc (General_options::finalize): Add strip_debug_non_line
10909         to the strip heirarchy.
10910         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10911         fields.
10912         * layout.cc: Include "reduced_debug_output.h".
10913         (Layout::Layout): Initialize new fields.
10914         (line_only_debug_sections): New static array.
10915         (is_lines_only_debug_sections): New static inline function.
10916         (Layout::include_section): Handle --strip-debug-non-line.
10917         (Layout::make_output_section): If --strip-debug-non-line, build
10918         new output sections for .debug_abbrev and .debug_info.
10919         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10920         gold.  Warn about possible overflow.
10921         (read_signed_LEB_128): Likewise.
10922         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10923         (read_signed_LEB_128): Declare.
10924         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10925         (HFILES): Add reduced_debug_output.h.
10926         * Makefile.in: Rebuild.
10927
10928 2008-05-21  Ian Lance Taylor  <iant@google.com>
10929
10930         * mapfile.cc: New file.
10931         * mapfile.h: New file.
10932         * options.h (class General_options): Add -M/--print-map and -Map.
10933         * options.cc (General_options::finalize): Make -M equivalent to
10934         -Map -.
10935         * main.cc: Include <cstdio> and "mapfile.h".
10936         (main): Open mapfile if requested.
10937         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10938         constructor.  Change caller.
10939         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10940         (queue_middle_tasks): Likewise.
10941         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10942         declarations.
10943         * archive.cc: Include "mapfile.h".
10944         (Archive::add_symbols): Add mapfile parameter.  Change all
10945         callers.  Pass mapfile, symbol, and reason to include_member.
10946         (Archive::include_all_members): Add mapfile parameter.  Change all
10947         callers.
10948         (Archive::include_member): Add mapfile, sym, and why parameters.
10949         Change all callers.  Report inclusion to map file.
10950         * archive.h: Include "fileread.h".
10951         (class Archive): Update declarations.
10952         (Archive::file): New const method.
10953         (class Add_archive_symbols): Add mapfile_ field.  Update
10954         constructor.  Change all callers.
10955         * readsyms.h (class Read_symbols): Likewise.
10956         (class Finish_group): Likewise.
10957         (class Read_script): Likewise.
10958         * common.cc: Include "mapfile.h".
10959         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10960         all callers.
10961         (Symbol_table::do_allocate_commons): Likewise.
10962         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10963         symbol allocation to mapfile.
10964         * common.h (class Allocate_commons_task): Add mapfile_ field.
10965         Update constructor.  Change all callers.
10966         * symtab.h (class Symbol_table): Update declarations.
10967         * layout.cc: Include "mapfile.h".
10968         (Layout_task_runner::run): Print information to mapfile.
10969         (Layout::create_gold_note): Change Output_data_fixed_space to
10970         Output_data_zero_fill.
10971         (Layout::create_build_id): Likewise.
10972         (Layout::print_to_mapfile): New function.
10973         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10974         constructor.  Change caller.
10975         (class Layout): Declare print_to_mapfile.
10976         * output.cc (Output_section::Input_section::print_to_mapfile): New
10977         function.
10978         (Output_section::add_input_section): If producing a map, always
10979         add to input_sections_ list.
10980         (Output_section::do_print_to_mapfile): New function.
10981         (Output_segment::print_sections_to_mapfile): New function.
10982         (Output_segment::print_section_list_to_mapfile): New function.
10983         * output.h: Include "mapfile.h".
10984         (Output_data::print_to_mapfile): New function.
10985         (Output_data::do_print_to_mapfile): New virtual function.
10986         (Output_segment_headers::do_print_to_mapfile): New function.
10987         (Output_file_header::do_print_to_mapfile): New function.
10988         (Output_data_const::do_print_to_mapfile): New function.
10989         (class Output_data_const_buffer): Add map_name_ field.  Update
10990         constructor.  Change all callers.  Add do_print_to_mapfile
10991         function.
10992         (class Output_data_fixed_space): Likewise.
10993         (class Output_data_space): Likewise.
10994         (class Output_data_zero_fill): New class.
10995         (Output_data_strtab::do_print_to_mapfile): New function.
10996         (Output_data_reloc_base::do_print_to_mapfile): New function.
10997         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10998         (Output_data_group::do_print_to_mapfile): New function.
10999         (Output_data_got::do_print_to_mapfile): New function.
11000         (Output_data_dynamic::do_print_to_mapfile): New function.
11001         (Output_symtab_xindex::do_print_to_mapfile): New function.
11002         (class Output_section): Declare do_print_to_mapflie.  Declare
11003         print_to_mapfile in Input_section.
11004         (class Output_segment): Declare new functions.
11005         * object.h (Sized_relobj::symbol_count): New function.
11006         * script-sections.cc
11007         (Output_section_element_dot_assignment::set_section_addresses):
11008         Change Output_data_fixed_space to Output_data_zero_fill.
11009         (Output_data_expression::do_print_to_mapfile): New function.
11010         * script.cc (read_input_script): Add mapfile parameter.  Change
11011         all callers.
11012         * script.h (read_input_script): Update declaration.
11013         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11014         (Eh_frame::do_print_to_mapfile): New function.
11015         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11016         (Output_merge_string::do_print_to_mapfile): New function.
11017         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11018         function.
11019         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11020         function.
11021         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11022         function.
11023         * Makefile.am (CCFILES): Add mapfile.cc.
11024         (HFILES): Add mapfile.h.
11025         * Makefile.in: Rebuild.
11026
11027 2008-05-19  Ian Lance Taylor  <iant@google.com>
11028
11029         * options.h (class General_options): Add -z relro.
11030         * layout.cc (Layout::Layout): Initialize relro_segment_.
11031         (Layout::add_output_section_data): Return the output section.
11032         (Layout::make_output_section): Rcognize relro sections and mark
11033         them appropriately.
11034         (Layout::attach_allocated_section_to_segment): Put relro sections
11035         in a PT_GNU_RELRO segment.
11036         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11037         section as relro.
11038         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11039         PT_TLS segments.
11040         (Layout::linkonce_mapping): Map d.rel.ro.local to
11041         .data.rel.ro.local.
11042         (Layout::output_section_name): Us .data.rel.ro.local for any
11043         section which begins with that.
11044         * layout.h (class Layout): Update add_output_section_data
11045         declaration.  Add relro_segment_ field.
11046         * output.cc (Output_section::Output_section): Initialize is_relro_
11047         and is_relro_local_ fields.
11048         (Output_segment::add_output_section): Group relro sections.
11049         (Output_segment::is_first_section_relro): New function.
11050         (Output_segment::maximum_alignment): If there is a relro section,
11051         align the segment to the common page size.
11052         (Output_segment::set_section_addresses): Track whether we are
11053         looking at relro sections.  If the last section is a relro
11054         section, align to the common page size.
11055         (Output_segment::set_section_list_addresses): Add in_relro
11056         parameter.  Change all callers.  Align to the page size when
11057         moving from relro to non-relro section.
11058         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11059         segment.
11060         * output.h (class Output_section): Add is_relro_ and
11061         is_relro_local_ fields.
11062         (Output_section::is_relro): New function.
11063         (Output_section::set_is_relro): New function.
11064         (Output_section::is_relro_local): New function.
11065         (Output_section::set_is_relro_local): New function.
11066         (class Output_segment): Update declarations.
11067         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11068         * sparc.cc (Target_sparc::got_section): Likewise.
11069         * x86_64.cc (Target_x86_64::got_section): Likewise.
11070         * testsuite/relro_test_main.cc: New file.
11071         * testsuite/relro_test.cc: New file.
11072         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11073         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11074         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11075         (relro_test.so, relro_test_pic.o): New targets.
11076         * testsuite/Makefile.in: Rebuild.
11077
11078 2008-05-16  Ian Lance Taylor  <iant@google.com>
11079
11080         * output.cc (Output_segment::add_output_section): Remove front
11081         parameter.
11082         * output.h (class Output_segment): Remove
11083         add_initial_output_section and overloaded add_output_section.
11084         Update declaration of remaining add_output_section.
11085         * layout.cc (Layout::create_interp): Call add_output_section
11086         rather than add_initial_output_section.
11087         (Layout::finish_dynamic_section): Likewise.
11088
11089         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11090         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11091         know the dynamic type.
11092         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11093         field.  Initialize it in constructor.
11094         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11095         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11096         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11097         reloc.
11098
11099         * output.cc (Output_reloc::get_address): Change return type to
11100         Elf_Addr.
11101         * output.h (class Output_reloc): Update get_address declaration.
11102         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11103         for section addresses.
11104
11105 2008-05-09  Ian Lance Taylor  <iant@google.com>
11106
11107         PR 6493
11108         * gold.cc (gold_nomem): Use return value of write.
11109
11110 2008-05-08  Ian Lance Taylor  <iant@google.com>
11111
11112         * symtab.c (Symbol::init_base_output_data): Add version
11113         parameter.  Change all callers.
11114         (Symbol::init_base_output_segment): Likewise.
11115         (Symbol::init_base_constant): Likewise.
11116         (Symbol::init_base_undefined): Likewise.
11117         (Sized_symbol::init_output_data): Likewise.
11118         (Sized_symbol::init_output_segment): Likewise.
11119         (Sized_symbol::init_constant): Likewise.
11120         (Sized_symbol::init_undefined): Likewise.
11121         (Symbol_table::do_define_in_output_data): If the new symbol has a
11122         version, mark it as the default.
11123         (Symbol_table::do_define_in_output_segment): Likewise.
11124         (Symbol_table::do_define_as_constant): Likewise.
11125         * symtab.h (class Symbol): Update declarations.
11126         (class Sized_symbol): Likewise.
11127         * resolve.cc (Symbol::override_version): New function.
11128         (Symbol::override_base): Call override_version.
11129         (Symbol::override_base_with_special): Likewise.
11130         * testsuite/ver_script_8.script: New file.
11131         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11132         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11133         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11134         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11135
11136 2008-05-06  Ian Lance Taylor  <iant@google.com>
11137
11138         PR 6049
11139         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11140         functions.
11141         (class General_options): Remove existing --undefined, and add
11142         --no-undefined instead.  Add new --undefined as synonym for -u.
11143         * archive.cc (Archive::add_symbols): Check whether symbol was
11144         named with -u.
11145         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11146         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11147         all uses.  Add IS_UNDEFINED.  Update declarations to split
11148         different versions of init_base.  Declare init_base_undefined.
11149         (Symbol::is_defined): Handle IS_UNDEFINED.
11150         (Symbol::is_undefined): Likewise.
11151         (Symbol::is_weak_undefined): Call is_undefined.
11152         (Symbol::is_absolute): Handle IS_CONSTANT.
11153         (class Sized_symbol): Update declarations to split different
11154         versions of init.  Declare init_undefined.
11155         (class Symbol_table): Declare new functions.
11156         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11157         Change all callers.
11158         (Symbol::init_base_output_data): Likewise.
11159         (Symbol::init_base_output_segment): Likewise.
11160         (Symbol::init_base_constant): Likewise.
11161         (Symbol::init_base_undefined): New function.
11162         (Sized_symbol::init_object): Rename from init.  Change all
11163         callers.
11164         (Sized_symbol::init_output_data): Likewise.
11165         (Sized_symbol::init_output_segment): Likewise.
11166         (Sized_symbol::init_constant): Likewise.
11167         (Sized_symbol::init_undefined): New function.
11168         (Symbol_table::add_undefined_symbols_from_command_line): New
11169         function.
11170         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11171         function.
11172         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11173         (Symbol::output_section): Likewise.
11174         (Symbol::set_output_section): Likewise.
11175         (Symbol_table::sized_finalize_symbol): Likewise.
11176         (Symbol_table::sized_write_globals): Likewise.
11177         * resolve.cc (Symbol_table::should_override): Likewise.
11178         (Symbol::override_base_with_special): Likewise.
11179
11180         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11181         symbol, change it to have default visibility.
11182         * testsuite/protected_1.cc: New file.
11183         * testsuite/protected_2.cc: New file.
11184         * testsuite/protected_3.cc: New file.
11185         * testsuite/protected_main_1.cc: New file.
11186         * testsuite/protected_main_2.cc: New file.
11187         * testsuite/protected_main_3.cc: New file.
11188         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11189         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11190         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11191         (protected_1.so): New target.
11192         (protected_1_pic.o, protected_2_pic.o): New targets.
11193         (protected_3_pic.o): New target.
11194         (check_PROGRAMS): Add protected_2.
11195         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11196         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11197         * testsuite/Makefile.in: Rebuild.
11198
11199         * options.h (DEFINE_var): Add set_user_set_##varname__.
11200         (DEFINE_bool_alias): New macro.
11201         (class General_options): Define -Bstatic using DEFINE_bool_alias
11202         rather than DEFINE_special.  Add --undefined as an alias for -z
11203         defs.
11204         * options.cc (General_options::parse_Bstatic): Remove.
11205
11206         * options.h (class General_options): Add --fatal-warnings.
11207         * main.cc (main): Implement --fatal-warnings.
11208         * errors.h (Errors::warning_count): New function.
11209
11210         * options.h (class General_options): Add -Bsymbolic-functions.
11211         * symtab.h (Symbol::is_preemptible): Check for
11212         -Bsymbolic-functions.
11213
11214 2008-05-05  Ian Lance Taylor  <iant@google.com>
11215
11216         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11217         as noVARNAME rather than no-VARNAME.
11218         (class General_options): Add option -z combreloc.
11219         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11220         get_address.
11221         (Output_reloc::sort_before) [SHT_REL]: New function.
11222         (Output_reloc::sort_before) [SHT_RELA]: New function.
11223         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11224         Sort_relocs_comparison.
11225         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11226         parameter.  Change all callers.
11227         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11228         sort_relocs parameter.  Change all callers.
11229         * output.cc (Output_reloc::get_address): New function, broken out
11230         of write_rel.
11231         (Output_reloc::write_rel): Call it.
11232         (Output_reloc::compare): New function.
11233         (Output_data_reloc_base::do_write): Optionally sort relocs.
11234
11235         * configure.ac: If targ_extra_obj is set, link it in.
11236         * configure.tgt: Initialize all variables.
11237         (x86_64*): Set targ_extra_obj and targ_extra_size.
11238         * configure: Rebuild.
11239
11240         * object.cc (Sized_relobj::include_section_group): Adjust section
11241         indexes read from group data.  Build vector to pass to
11242         layout_group.
11243         * layout.cc (Layout::layout_group): Add flags and shndxes
11244         parameters.  Remove contents parameter.  Change caller.  Update
11245         explicit instantiations.
11246         * layout.h (class Layout): Update layout_group declaration.
11247         * output.cc (Output_data_group::Output_data_group): Add flags and
11248         input_shndxes parameters.  Remove contents parameter.  Change
11249         caller.
11250         (Output_data_group::do_write): Change input_sections_ to
11251         input_shndxes_.
11252         * output.h (class Output_data_group): Update constructor
11253         declaration.  Rename input_sections_ to input_shndxes_.
11254         * testsuite/many_sections_test.cc: Add template.
11255
11256 2008-04-30  Cary Coutant  <ccoutant@google.com>
11257
11258         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11259
11260         * layout.cc (Layout::include_section): Refactored check for debug
11261         info section.
11262         (Layout::add_comdat): Add new parameters.  Change type
11263         of signature parameter.  Add object and shndx to signatures table.
11264         (Layout::find_kept_object): New function.
11265         * layout.h: Include <cstring>.
11266         (Layout::is_debug_info_section): New function.
11267         (Layout::add_comdat): Add new parameters.
11268         (Layout::find_kept_object): New function.
11269         (Layout::Kept_section): New struct.
11270         (Layout::Signatures): Change type of map range.
11271         * object.cc (Relobj::output_section_address): New function.
11272         (Sized_relobj::include_section_group): Add new parameters.  Change
11273         calls to Layout::add_comdat.  Change to build table of kept comdat
11274         groups and table mapping discarded sections to kept sections.
11275         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11276         (Sized_relobj::do_layout): Change calls to include_section_group and
11277         include_linkonce_section.
11278         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11279         value to zero when section is discarded.
11280         (Sized_relobj::map_to_kept_section): New function.
11281         * object.h (Relobj::output_section_address): New function.
11282         (Relobj::Comdat_group): New type.
11283         (Relobj::find_comdat_group): New function.
11284         (Relobj::Comdat_group_table): New type.
11285         (Relobj::Kept_comdat_section): New type.
11286         (Relobj::Kept_comdat_section_table): New type.
11287         (Relobj::add_comdat_group): New function.
11288         (Relobj::set_kept_comdat_section): New function.
11289         (Relobj::get_kept_comdat_section): New function.
11290         (Relobj::comdat_groups_): New field.
11291         (Relobj::kept_comdat_sections_): New field.
11292         (Symbol_value::input_value): Update comment.
11293         (Sized_relobj::map_to_kept_section) New function.
11294         (Sized_relobj::include_linkonce_section): Add new parameter.
11295         * target-reloc.h (Comdat_behavior): New type.
11296         (get_comdat_behavior): New function.
11297         (relocate_section): Add code to map a discarded section to the
11298         corresponding kept section when applying a relocation.
11299
11300 2008-04-30  Craig Silverstein  <csilvers@google.com>
11301
11302         * dwarf_reader.cc (next_generation_count): New static var.
11303         (Addr2line_cache_entry): New struct.
11304         (addr2line_cache): New static var.
11305         (Dwarf_line_info::one_addr2line): Added caching.
11306         (Dwarf_line_info::clear_addr2line_cache): New function.
11307         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11308         cache-size parameter.
11309         (Dwarf_line_info::one_addr2line_cache): New function.
11310         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11311         new cache-size argument to one_addr2line(), and clear cache.
11312
11313 2008-04-28  Cary Coutant  <ccoutant@google.com>
11314
11315         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11316         R_386_PC8 relocations.
11317
11318 2008-04-23  Ian Lance Taylor  <iant@google.com>
11319
11320         * object.cc (Sized_relobj::include_section_group): Check for
11321         invalid section group.
11322
11323         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11324         header size.
11325
11326         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11327         than read for file header.
11328         * archive.cc (Archive::include_member): Likewise.
11329
11330 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11331
11332         * aclocal.m4: Regenerate.
11333         * configure: Regenerate.
11334
11335 2008-04-19  Ian Lance Taylor  <iant@google.com>
11336
11337         * version.cc (version_string): Bump to 1.6.
11338
11339         * testsuite/Makefile.am (many_sections_r_test): New target.
11340         (many_sections_r_test_SOURCES): Remove.
11341         (many_sections_r_test_DEPENDENCIES): Remove.
11342         (many_sections_r_test_LDFLAGS): Remove.
11343         (many_sections_r_test_LDADD): Remove.
11344
11345         * object.cc (Sized_relobj::do_add_symbols): Always pass
11346         local_symbol_count_ to add_from_relobj.
11347
11348         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11349         every thousand variables.
11350         * testsuite/Makefile.in: Rebuild.
11351
11352         * object.cc (Xindex::initialize_symtab_xindex): New function.
11353         (Xindex::read_symtab_xindex): New function.
11354         (Xindex::sym_xindex_to_shndx): New function.
11355         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11356         available.
11357         (Sized_relobj::do_initialize_xindex): New function.
11358         (Sized_relobj::do_read_symbols): Adjust section links.
11359         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11360         parameter.  Change all callers.
11361         (Sized_relobj::include_section_group): Adjust section links and
11362         symbol section indexes.
11363         (Sized_relobj::do_layout): Adjust section links.
11364         (Sized_relobj::do_count_local_symbols): Adjust section links and
11365         symbol section indexes.
11366         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11367         ordinary and special symbols.
11368         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11369         dynsym_xindex parameters.  Change all callers.  Adjust section
11370         links.  Use SHN_XINDEX when needed.
11371         (Sized_relobj::get_symbol_location_info): Adjust section links.
11372         Don't get fooled by special symbols.
11373         * object.h (class Xindex): Define.
11374         (class Object): Add xindex_ parameter.  Declare virtual functoin
11375         do_initialize_xindex.
11376         (Object::adjust_sym_shndx): New function.
11377         (Object::set_xindex): New protected function.
11378         (class Symbol_value): Add is_ordinary_shndx_ field.
11379         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11380         (Symbol_value::value): Assert ordinary section.
11381         (Symbol_value::initialize_input_to_output_map): Likewise.
11382         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11383         Change all callers.
11384         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11385         all callers.
11386         (class Sized_relobj): Update declarations.
11387         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11388         parameter.  Change all callers.
11389         (Sized_relobj::adjust_shndx): New function.
11390         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11391         field.
11392         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11393         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11394         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11395         (Sized_dynobj::read_dynsym_section): Adjust section links.
11396         (Sized_dynobj::read_dynamic): Likewise.
11397         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11398         section links.
11399         (Sized_dynobj::do_initialize_xindex): New function.
11400         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11401         do_initialize_xindex.
11402         (Sized_dynobj::adjust_shndx): New function.
11403         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11404         dynsym_xindex_ fields.
11405         (Layout::finalize): Add a call to set_section_indexes before
11406         creating the symtab sections.
11407         (Layout::set_section_indexes): Don't do anything if the section
11408         already has a section index.
11409         (Layout::create_symtab_sections): Add shnum parameter.  Change
11410         caller.  Create .symtab_shndx section if needed.
11411         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11412         caller.
11413         (Layout::allocated_output_section_count): New function.
11414         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11415         needed.
11416         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11417         fields.  Update declarations.
11418         (Layout::symtab_xindex): New function.
11419         (Layout::dynsym_xindex): New function.
11420         (class Write_symbols_task): Add layout_ field.
11421         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11422         Change caller.
11423         * output.cc (Output_section_headers::Output_section_headers): Add
11424         shstrtab_section parameter.  Change all callers.
11425         (Output_section_headers::do_sized_write): Store overflow values
11426         for section count and section string table section index in
11427         section header zero.
11428         (Output_file_header::do_sized_write): Check for overflow of
11429         section count and section string table section index.
11430         (Output_symtab_xindex::do_write): New function.
11431         (Output_symtab_xindex::endian_do_write): New function.
11432         * output.h (class Output_section_headers): Add shstrtab_section_.
11433         Update declarations.
11434         (class Output_symtab_xindex): Define.
11435         (Output_section::has_out_shndx): New function.
11436         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11437         field.
11438         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11439         Change all callers.
11440         (Sized_symbol::init): Likewise.
11441         (Symbol::output_section): Check for ordinary symbol.
11442         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11443         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11444         callers.
11445         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11446         Change all callers.  Simplify handling of symbols from sections
11447         not included in the link.
11448         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11449         distinction.
11450         (Weak_alias_sorter::operator()): Assert that symbols are
11451         ordinary.
11452         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11453         distinction.
11454         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11455         parameters.  Change all callers.
11456         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11457         symbol distinction.  Use SHN_XINDEX when needed.
11458         (Symbol_table::write_section_symbol): Add symtab_xindex
11459         parameter.  Change all callers.
11460         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11461         SHN_XINDEX when needed.
11462         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11463         declarations.
11464         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11465         (Symbol::is_defined): Check is_ordinary.
11466         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11467         (Symbol::is_absolute, Symbol::is_common): Likewise.
11468         (class Sized_symbol): Update declarations.
11469         (class Symbol_table): Update declarations.
11470         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11471         parameters.  Change all callers.
11472         (Sized_symbol::override): Likewise.
11473         (Symbol_table::override): Likewise.
11474         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11475         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11476         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11477         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11478         to be in an ordinary section.
11479         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11480         object and is_ordinary parameters.  Change all callers.
11481         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11482         Change all callers.  Don't add undefined or non-ordinary symbols
11483         to reloc_map_.
11484         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11485         Change all callers.
11486         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11487         declarations.
11488         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11489         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11490         (Sized_relobj::relocate_sections): Likewise.
11491         * target-reloc.h (scan_relocs): Adjust section symbol index.
11492         (scan_relocatable_relocs): Likewise.
11493         * i386.cc (Scan::local): Check for ordinary symbols.
11494         * sparc.cc (Scan::local): Likewise.
11495         * x86_64.cc (Scan::local): Likewise.
11496         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11497         to symbol_section_and_value.
11498         * testsuite/many_sections_test.cc: New file.
11499         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11500         (check_PROGRAMS): Add many_sections_test.
11501         (many_sections_test_SOURCES): Define.
11502         (many_sections_test_DEPENDENCIES): Define.
11503         (many_sections_test_LDFLAGS): Define.
11504         (BUILT_SOURCES): Add many_sections_define.h.
11505         (many_sections_define.h): New target.
11506         (BUILT_SOURCES): Add many_sections_check.h.
11507         (many_sections_check.h): New target.
11508         (check_PROGRAMS): Add many_sections_r_test.
11509         (many_sections_r_test_SOURCES): Define.
11510         (many_sections_r_test_DEPENDENCIES): Define.
11511         (many_sections_r_test_LDFLAGS): Define.
11512         (many_sections_r_test_LDADD): Define.
11513         (many_sections_r_test.o): New target.
11514         * testsuite/Makefile.in: Rebuild.
11515
11516 2008-04-17  Cary Coutant  <ccoutant@google.com>
11517
11518         * errors.cc (Errors::info): New function.
11519         (gold_info): New function.
11520         * errors.h (Errors::info): New function.
11521         * gold.h (gold_info): New function.
11522         * object.cc (Input_objects::add_object): Print trace output.
11523         * options.cc (options::parse_set): New function.
11524         (General_options::parse_wrap): Deleted.
11525         (General_options::General_options): Deleted initializer.
11526         * options.h (options::String_set): New typedef.
11527         (options::parse_set): New function.
11528         (DEFINE_set): New macro.
11529         (General_options::wrap): Changed to use DEFINE_set. Changed
11530         callers of any_wrap_symbols and is_wrap_symbol.
11531         (General_options::trace, General_options::trace_symbol):
11532         New options.
11533         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11534         (General_options::wrap_symbols_): Deleted.
11535         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11536
11537 2008-04-17  David S. Miller  <davem@davemloft.net>
11538
11539         * options.cc (General_options::parse_V): New function.
11540         * options.h: Add entries for -V and -Qy.
11541
11542 2008-04-17  Ian Lance Taylor  <iant@google.com>
11543
11544         * common.cc (Symbol_table::allocate_commons): Remove options
11545         parameter.  Change caller.
11546         (Symbol_table::do_allocate_commons): Remove options parameter.
11547         Change caller.  Just call do_allocate_commons_list twice.
11548         (Symbol_table::do_allocate_commons_list): New function, broken out
11549         of do_allocate_commons.
11550         * common.h (class Allocate_commons_task): Remove options_ field.
11551         Update constructor.
11552         * symtab.cc (Symbol_table::Symbol_table): Initialize
11553         tls_commons_.
11554         (Symbol_table::add_from_object): Put TLS common symbols on
11555         tls_commons_ list.
11556         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11557         which are IN_OUTPUT_DATA.
11558         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11559         allocate_commons and do_allocate_commons declarations.  Declare
11560         do_allocate_commons_list.
11561         * gold.cc (queue_middle_tasks): Update creation of
11562         Allocate_commons_task to not pass options.
11563         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11564         (TLS_TEST_C_FLAGS): New variable.
11565         (tls_test_c_pic.o): New target.
11566         (tls_test_shared.so): Link in tls_test_c_pic.o.
11567         (tls_test_c_pic_ie.o): New target.
11568         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11569         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11570         (tls_test_c.o): New target.
11571         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11572         (tls_pic_test_LDADD): Likewise.
11573         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11574         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11575         (tls_test_c_gnu2.o): New target.
11576         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11577         tls_test_c_gnu2.o.
11578         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11579         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11580         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11581         * testsuite/tls_test.cc: Include "config.h".
11582         (t_last): Call t11_last.
11583         * testsuite/tls_test.h (t11, t11_last): Declare.
11584         * testsuite/tls_test_c.c: New file.
11585         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11586         * configure.ac: Check for OpenMP support.
11587         * configure, config.in, Makefile.in: Rebuild.
11588         * testsuite/Makefile.in: Rebuild.
11589
11590 2008-04-16  Cary Coutant  <ccoutant@google.com>
11591
11592         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11593         (Target_i386::tls_base_symbol_defined_): New field.
11594         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11595         (Target_i386::Scan::global): Likewise.
11596         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11597         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11598         (Target_x86_64::tls_base_symbol_defined_): New field.
11599         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11600         (Target_x86_64::Scan::global): Likewise.
11601
11602 2008-04-16  Cary Coutant  <ccoutant@google.com>
11603
11604         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11605         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11606         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11607         building shared libraries.
11608         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11609         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11610         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11611         * testsuite/Makefile.in: Rebuild.
11612         * testsuite/weak_undef.h: New file.
11613         * testsuite/weak_undef_file1.cc: Add extra test cases.
11614         * testsuite/weak_undef_file2.cc: Likewise.
11615         * testsuite/weak_undef_test.cc: Likewise.
11616
11617 2008-04-16  David S. Miller  <davem@davemloft.net>
11618
11619         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11620         Add issued_non_pic_error_ field.  Declare check_non_pic.
11621         (Target_sparc::Scan::check_non_pic): New function.
11622         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11623         (Target_sparc::Scan::global): Likewise.
11624
11625         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11626         * configure: Rebuild.
11627
11628         * options.h (DEFINE_enable): New macro.
11629         (new_dtags): New enable option.
11630         (initfirst, interpose, loadfltr, nodefaultlib,
11631         nodelete, nodlopen, nodump): New -z options.
11632         * layout.cc (Layout:finish_dynamic_section): If new
11633         dtags enabled, emit DT_RUNPATH.  Also, emit a
11634         DT_FLAGS_1 containing any specified -z flags.
11635
11636 2008-04-16  Ian Lance Taylor  <iant@google.com>
11637
11638         * copy-relocs.cc: New file.
11639         * copy-relocs.h: New file.
11640         * reloc.cc: Remove Copy_relocs code.
11641         * reloc.h: Likewise.
11642         * reloc-types.h (struct Reloc_types) [both versions]: Add
11643         get_reloc_addend_noerror.
11644         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11645         variants of add_global which take an addend which must be zero.
11646         * i386.cc: Include "copy-relocs.h".
11647         (class Target_i386): Change type of copy_relocs_ to variable,
11648         update initializer.
11649         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11650         Change all callers.
11651         (Target_i386::do_finalize_sections): Change handling of
11652         copy_relocs_.
11653         * sparc.cc: Include "copy-relocs.h".
11654         (class Target_sparc): Change type of copy_relocs_ to variable,
11655         update initializer.
11656         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11657         Change all callers.
11658         (Target_sparc::do_finalize_sections): Change handling of
11659         copy_relocs_.
11660         * x86_64.cc: Include "copy-relocs.h".
11661         (class Target_x86_64): Change type of copy_relocs_ to variable,
11662         update initializer.
11663         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11664         class.  Change all callers.
11665         (Target_x86_64::do_finalize_sections): Change handling of
11666         copy_relocs_.
11667         * Makefile.am (CCFILES): Add copy-relocs.cc.
11668         (HFILES): Add copy-relocs.h.
11669
11670         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11671
11672         * testsuite/script_test_4.sh: Permit leading zeroes.
11673
11674 2008-04-15  Ian Lance Taylor  <iant@google.com>
11675
11676         * script-sections.cc (Script_sections::create_segments): Use
11677         header_size_adjustment even when there is enough room for the
11678         headers.
11679         * testsuite/script_test_4.sh: New file.
11680         * testsuite/script_test_4.t: New file.
11681         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11682         (check_DATA): Add script_test_4.stdout.
11683         (MOSTLYCLEANFILES): Likewise.
11684         (script_test_4): New target.
11685         (script_test_4.stdout): New target.
11686         * testsuite/Makefile.in: Rebuild.
11687
11688         * sparc.cc: Add definitions for Output_data_plt_sparc class
11689         constants.
11690
11691 2008-04-14  David S. Miller  <davem@davemloft.net>
11692
11693         * sparc.cc: New file.
11694         * Makefile.am (TARGETSOURCES): Add sparc.cc
11695         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11696         * configure.tgt: Document targ_extra_size and
11697         targ_extra_big_endian.  Add entries for sparc-* and
11698         sparc64-*.
11699         * configure.ac: Handle targ_extra_size and
11700         targ_extra_big_endian.
11701         * Makefile.in: Rebuild.
11702         * configure: Likewise.
11703         * po/POTFILES.in: Likewise.
11704         * po/gold.pot: Likewise.
11705
11706 2008-04-14  Ian Lance Taylor  <iant@google.com>
11707
11708         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11709         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11710         in the name/type/flags to section mapping.  Don't call
11711         allocate_output_section.
11712         (Layout::choose_output_section): Change parameter from adjust_name
11713         to is_input_section.  Don't permit input sections after sections
11714         are attached to segments.  Don't call allocate_output_section.
11715         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11716         not write_enable_output_section.
11717         (Layout::make_output_section): Don't push to
11718         unattached_section_list_ nor call attach_to_segment.  Call
11719         attach_section_to_segment if sections are attached.
11720         (Layout::attach_sections_to_segments): New function.
11721         (Layout::attach_section_to_segment): New function.
11722         (Layout::attach_allocated_section_to_segment): Rename from
11723         attach_to_segment.  Remove flags parameter.
11724         (Layout::allocate_output_section): Remove function.
11725         (Layout::write_enable_output_section): Remove function.
11726         * layout.h (class Layout): Update for above changes.  Add new
11727         field sections_are_attached_.
11728         * output.h (Output_section::update_flags_for_input_section): New
11729         function.
11730         * output.cc (Output_section::add_input_section): Call
11731         update_flags_for_input_section.
11732         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11733
11734 2008-04-11  Cary Coutant  <ccoutant@google.com>
11735
11736         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11737         thought unnecessary.
11738         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11739
11740 2008-04-11  Ian Lance Taylor  <iant@google.com>
11741
11742         * output.h (class Output_section_data): Remove inline definition
11743         of set_addralign.
11744         * output.cc (Output_section_data::set_addralign): New function.
11745
11746 2008-04-11  Cary Coutant  <ccoutant@google.com>
11747
11748         Add support for TLS descriptors for i386 and x86_64.
11749         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11750         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11751         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11752         GOT_TYPE_TLS_DESC.
11753         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11754         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11755         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11756         relocations.
11757         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11758         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11759         Fix problem with initial-exec relocations.
11760         (Target_i386::Relocate::relocate_tls): Likewise.
11761         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11762         relaxation.
11763         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11764         support for section-plus-offset dynamic table entries.
11765         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11766         (Output_data_dynamic::Dynamic_entry): Add support for
11767         section-plus-offset dynamic table entries.
11768         (Output_data_dynamic::Classification): Likewise.
11769         (Output_data_dynamic::classification_): Renamed offset_.
11770         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11771         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11772         (Target_x86_64::make_plt_section): New function.
11773         (Target_x86_64::reserve_tlsdesc_entries): New function.
11774         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11775         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11776         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11777         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11778         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11779         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11780         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11781         add extra PLT entry for TLS descriptors.
11782         (Output_data_plt_x86_64::got_): New field.
11783         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11784         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11785         fields.
11786         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11787         descriptors.
11788         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11789         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11790         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11791         R_386_TLS_DESC_CALL relocations.
11792         (Target_x86_64::Scan::global): Likewise.
11793         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11794         for TLS descriptors.
11795         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11796         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11797         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11798         GD-to-IE relaxation.
11799         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11800         and TLS_DESCRIPTORS.
11801         * Makefile.in: Rebuild.
11802         * configure: Rebuild.
11803         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11804         (tls_test_shared2.so): New target.
11805         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11806         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11807         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11808         (tls_shared_gd_to_ie_test_LDADD): New variable.
11809         (tls_shared_gnu2_gd_to_ie_test): New target.
11810         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11811         New targets.
11812         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11813         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11814         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11815         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11816         (tls_shared_gnu2_test): New target.
11817         (tls_test_gnu2_shared.so): New target.
11818         (tls_shared_gnu2_test_SOURCES): New variable.
11819         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11820         (tls_shared_gnu2_test_LDFLAGS): New variable.
11821         (tls_shared_gnu2_test_LDADD): New variable.
11822         * testsuite/Makefile.in: Rebuild.
11823         * testsuite/Makefile.
11824
11825 2008-04-11  Ian Lance Taylor  <iant@google.com>
11826
11827         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11828         justsyms.t.
11829         * testsuite/Makefile.in: Rebuild.
11830
11831         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11832         long.
11833         * testsuite/script_test_2.cc (main): Adjust test.
11834
11835 2008-04-11  David S. Miller  <davem@davemloft.net>
11836             Ian Lance Taylor  <iant@google.com>
11837
11838         * options.h (General_options): Add entries for '-Y' and
11839         '-relax'.
11840         * options.cc (General_options:finalize): If -Y was used, add those
11841         entries to the library path instead of the default "/lib" and
11842         "/usr/lib".
11843
11844 2008-04-11  David S. Miller  <davem@davemloft.net>
11845
11846         * testsuite/justsyms.t: Start at 0x100.
11847         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11848         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11849         long.
11850         * testsuite/script_test_2.cc: Adjust string and section length
11851         checks.
11852
11853 2008-04-09  Ian Lance Taylor  <iant@google.com>
11854
11855         PR gold/5996
11856         * script-sections.cc (Sections_element::allocate_to_segment): Add
11857         orphan parameter.
11858         (Output_section_definition::allocate_to_segment): Likewise.
11859         (Orphan_output_section::allocate_to_segment): Likewise.
11860         (Script_sections::attach_sections_using_phdrs_clause): Don't
11861         propagate non-PT_LOAD segments to orphan sections.
11862         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11863         readelf rather than objdump.
11864         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11865         .interp section and PT_INTERP segment are the same size.
11866         * testsuite/Makefile.in: Rebuild.
11867
11868         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11869         aliases for symbols defined in the same object.
11870         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11871         (weak_alias_test_SOURCES): New variable.
11872         (weak_alias_test_DEPENDENCIES): New variable.
11873         (weak_alias_test_LDFLAGS): New variable.
11874         (weak_alias_test_LDADD): New variable.
11875         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11876         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11877         (weak_alias_test_3.o): New target.
11878         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11879         * testsuite/weak_alias_test_main.cc: New file.
11880         * testsuite/weak_alias_test_1.cc: New file.
11881         * testsuite/weak_alias_test_2.cc: New file.
11882         * testsuite/weak_alias_test_3.cc: New file.
11883
11884 2008-04-08  Ian Lance Taylor  <iant@google.com>
11885
11886         * options.h (class General_options): Add --noinhibit-exec option.
11887         * main.cc (main): Check --noinhibit-exec.
11888
11889         * options.h (class General_options): Define --wrap as a special
11890         option.  Add wrap_symbols_ field.
11891         (General_options::any_wrap_symbols): New function.
11892         (General_options::is_wrap_symbol): New function.
11893         * options.cc (General_options::parse_wrap): New function.
11894         (General_options::General_options): Initialize wrap_symbols_.
11895         * symtab.cc (Symbol_table::wrap_symbol): New function.
11896         (Symbol_table::add_from_object): Handle --wrap.
11897         * symtab.h (class Symbol_table): Declare wrap_symbol.
11898         * target.h (Target::wrap_char): New function.
11899         (Target::Target_info): Add wrap_char field.
11900         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11901         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11902         * testsuite/testfile.cc (Target_test::test_target_info):
11903         Likewise.
11904
11905         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11906         there is one.
11907
11908         * layout.h (class Layout): Add added_eh_frame_data_ field.
11909         * layout.cc (Layout::Layout): Initialize new field.
11910         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11911         output section until we find a section we merged successfully.
11912         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11913         that the size be non-zero.
11914
11915         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11916         qualifier.
11917
11918 2008-04-08  Craig Silverstein  <csilvers@google.com>
11919
11920         * configure.ac: Export new conditional variable HAVE_ZLIB.
11921         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11922         on HAVE_ZLIB.
11923         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11924         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11925
11926 2008-04-07  Ian Lance Taylor  <iant@google.com>
11927
11928         * version.cc (version_string): Set to "1.5".
11929
11930         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11931         Add issued_non_pic_error_ field.  Declare check_non_pic.
11932         (Target_x86_64::Scan::check_non_pic): New function.
11933         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11934         (Target_x86_64::Scan::global): Likewise.
11935
11936         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11937         addend parameter.  Change caller.  Handle merge sections.
11938         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11939         Address to Addend.  Don't add in the result of
11940         local_section_offset, pass down the addend and use the returned
11941         value.
11942         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11943         Update declarations of local_section_offset and symbol_value.
11944         * testsuite/two_file_test_1.cc (t18): New function.
11945         * testsuite/two_file_test_2.cc (f18): New function.
11946         * testsuite/two_file_test_main.cc (main): Call t18.
11947         * testsuite/two_file_test.h (t18, f18): Declare.
11948
11949         * configure.ac: Don't test for objdump, c++filt, or readelf.
11950         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11951         conditionals.
11952         (TEST_READELF): New variable.
11953         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11954         (check_PROGRAMS): Add two_file_strip_test.
11955         (two_file_strip_test): New target.
11956         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11957         (two_file_same_shared_strip_test_SOURCES): New variable.
11958         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11959         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11960         (two_file_same_shared_strip_test_LDADD): New variable.
11961         (two_file_shared_strip.so): New target.
11962         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11963         (ver_test_5.syms, ver_test_7.syms): Likewise.
11964         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11965         (strip_test_3.stdout): Use TEST_OBJDUMP.
11966         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11967
11968 2008-04-04  Cary Coutant  <ccoutant@google.com>
11969
11970         * symtab.h (Symbol::is_weak_undefined): New function.
11971         (Symbol::is_strong_undefined): New function.
11972         (Symbol::is_absolute): New function.
11973         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11974         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11975         absolute symbols.
11976         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11977         (weak_undef_test): New target.
11978         * testsuite/Makefile.in: Rebuild.
11979         * testsuite/weak_undef_file1.cc: New file.
11980         * testsuite/weak_undef_file2.cc: New file.
11981         * testsuite/weak_undef_test.cc: New file.
11982
11983 2008-04-03  Craig Silverstein  <csilvers@google.com>
11984
11985         * compressed_output.h (class Output_compressed_section): Use
11986         unsigned buffer.
11987         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11988         add zlib header.
11989         (zlib_compressed_suffix): Removed.
11990         (Output_compressed_section::set_final_data_size): Use unsigned
11991         buffers.
11992         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11993         Fix linker invocation.
11994         (flagstest_o_specialfile_and_compress_debug_sections):
11995         Likewise.
11996         * testsuite/Makefile.in: Regenerated.
11997
11998 2008-04-02  David S. Miller  <davem@davemloft.net>
11999
12000         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12001         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12002
12003 2008-04-02  Craig Silverstein  <csilvers@google.com>
12004
12005         * TODO: New file.
12006
12007 2008-04-02  Ian Lance Taylor  <iant@google.com>
12008
12009         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12010         parameters.  Update for new key type to views_.  Change all
12011         callers.
12012         (File_read::read): Adjust for byteshift in returned view.
12013         (File_read::add_view): New function, broken out of
12014         find_and_make_view.
12015         (File_read::make_view): New function, broken out of
12016         find_and_make_view.
12017         (File_read::find_or_make_view): Add offset and aligned
12018         parameters.  Rewrite accordingly.  Change all callers.
12019         (File_read::get_view): Add offset and aligned parameters.  Adjust
12020         for byteshift in return value.
12021         (File_read::get_lasting_view): Likewise.
12022         * fileread.h (class File_read): Update declarations.
12023         (class File_read::View): Add byteshift_ field.  Add byteshift to
12024         constructor.  Add byteshift method.
12025         * archive.h (Archive::clear_uncached_views): New function.
12026         (Archive::get_view): Add aligned parameter.  Change all callers.
12027         * object.h (Object::get_view): Add aligned parameter.  Change all
12028         callers.
12029         (Object::get_lasting_view): Likewise.
12030
12031         * fileread.cc (File_read::release): Don't call clear_views if
12032         there are multiple objects.
12033         * fileread.h (File_read::clear_uncached_views): New function.
12034         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12035         on the archive.
12036
12037 2008-03-31  Cary Coutant  <ccoutant@google.com>
12038
12039         Add thin archive support.
12040         * archive.cc (Archive::armagt): New const.
12041         (Archive::setup): Remove task parameter and calls to unlock.
12042         (Archive::unlock_nested_archives): New function.
12043         (Archive::read_header): Add nested_off parameter. Change
12044         all callers.
12045         (Archive::interpret_header): Likewise.
12046         (Archive::include_all_members): Change to handle thin
12047         archives.
12048         (Archive::include_member): Likewise.
12049         * archive.h (Archive::Archive): Add new parameters and
12050         initializers.
12051         (Archive::armagt): New const.
12052         (Archive::setup): Remove task parameter.
12053         (Archive::unlock_nested_archives): New function.
12054         (Archive::read_header): Add nested_off parameter.
12055         (Archive::interpret_header): Likewise.
12056         (Archive::Nested_archive_table): New typedef.
12057         (Archive::is_thin_archive_): New field.
12058         (Archive::nested_archives_): New field.
12059         (Archive::options_): New field.
12060         (Archive::dirpath_): New field.
12061         (Archive::task_): New field.
12062         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12063         for thin archives.  Pass additional parameters to
12064         Archive::Archive.  Unlock the archive file after calling
12065         Archive::setup.
12066
12067 2008-03-29  Ian Lance Taylor  <iant@google.com>
12068
12069         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12070         version symbol to be local.
12071         * testsuite/ver_test_4.sh: New file.
12072         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12073         (check_DATA): Add ver_test_4.syms.
12074         (ver_test_4.syms): New target.
12075         * testsuite/Makefile.in: Rebuild.
12076
12077         * output.cc
12078         (Output_section::Input_section_sort_entry::has_priority): New
12079         function.
12080         (Output_section::Input_section_sort_entry::match_file_name): New
12081         function.
12082         (Output_section::Input_section_sort_entry::match_section_name):
12083         Remove.
12084         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12085         Remove.
12086         (Output_section::Input_section_sort_entry::match_section_file):
12087         Remove.
12088         (Output_section::Input_section_sort_compare::operator()): Rewrite
12089         using new Input_section_sort_entry functions.  Sort crtbegin and
12090         crtend first.  Sort sections with no priority before sections with
12091         a priority.
12092         * testsuite/initpri1.c (d3): Check j != 4.
12093         (cd5): New constructor/destructor function.
12094         (main): Check j != 2.
12095
12096         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12097         new symbol when resolving, don't call set_is_default.
12098         * testsuite/ver_test_7.cc: New file.
12099         * testsuite/ver_test_7.sh: New file.
12100         * testsuite/Makefile.am (ver_test_7.so): New target.
12101         (ver_test_7.o): New target.
12102         (check_SCRIPTS): Add ver_test_7.sh.
12103         (check_DATA): Add ver_test_7.syms.
12104         (ver_test_7.syms): New target.
12105
12106 2008-03-28  Ian Lance Taylor  <iant@google.com>
12107
12108         * layout.cc (Layout::layout): If we see an input section with a
12109         name that needs sorting, set the must_sort flag for the output
12110         section.
12111         (Layout::make_output_section): If the name of the output section
12112         indicates that it might require sorting, set the may_sort flag.
12113         * output.h (Output_section::may_sort_attached_input_sections): New
12114         function.
12115         (Output_section::set_may_sort_attached_input_sections): New
12116         function.
12117         (Output_section::must_sort_attached_input_sections): New
12118         function.
12119         (Output_section::set_must_sort_attached_input_sections): New
12120         function.
12121         (class Output_section): Declare Input_section_sort_entry.  Define
12122         Input_section_sort_compare.  Declare
12123         sort_attached_input_sections.  Add new fields:
12124         may_sort_attached_input_sections_,
12125         must_sort_attached_input_sections_,
12126         attached_input_sections_are_sorted_.
12127         * output.cc (Output_section::Output_section): Initialize new
12128         fields.
12129         (Output_section::add_input_section): Add an entry to
12130         input_sections_ if may_sort or must_sort are true.
12131         (Output_section::set_final_data_size): Call
12132         sort_attached_input_sections if necessary.
12133         (Output_section::Input_section_sort_entry): Define new class.
12134         (Output_section::Input_section_sort_compare::operator()): New
12135         function.
12136         (Output_section::sort_attached_input_sections): New function.
12137         * configure.ac: Check whether the compiler supports constructor
12138         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12139         * testsuite/initpri1.c: New file.
12140         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12141         CONSTRUCTOR_PRIORITY.
12142         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12143         (initpri1_LDFLAGS): New variable.
12144         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12145
12146 2008-03-27  Ian Lance Taylor  <iant@google.com>
12147
12148         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12149         * testsuite/common_test_1.c: New file.
12150         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12151         (common_test_1_SOURCES): New variable.
12152         (common_test_1_DEPENDENCIES): New variable.
12153         (common_test_1_LDFLAGS): New variable.
12154
12155         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12156         and commons_ correctly when NAME/VERSION does not override
12157         NAME/NULL.
12158         * testsuite/ver_test_6.c: New file.
12159         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12160         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12161         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12162
12163 2008-03-26  Ian Lance Taylor  <iant@google.com>
12164
12165         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12166         of an undefined symbol from a version script.
12167         * testsuite/Makefile.am (ver_test_5.so): New target.
12168         (ver_test_5.o): New target.
12169         (check_SCRIPTS): Add ver_test_5.sh.
12170         (check_DATA): Add ver_test_5.syms.
12171         (ver_test_5.syms): New target.
12172         * testsuite/ver_test_5.cc: New file.
12173         * testsuite/ver_test_5.script: New file.
12174         * testsuite/ver_test_5.sh: New file.
12175         * Makefile.in, testsuite/Makefile.in: Rebuild.
12176
12177         PR gold/5986
12178         Fix problems building gold with gcc 4.3.0.
12179         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12180         (gold_error_at_location, gold_warning_at_location): Use it.
12181         * configure.ac: Check whether we can compile and use a template
12182         function with a printf attribute.
12183         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12184         when jumping over bytes.
12185         * object.cc: Instantiate Object::read_section_data.
12186         * debug.h: Include <cstring>
12187         * dwarf_reader.cc: Include <algorithm>
12188         * main.cc: Include <cstring>.
12189         * options.cc: Include <cstring>.
12190         * output.cc: Include <cstring>.
12191         * script.cc: Include <cstring>.
12192         * script.h: Include <string>.
12193         * symtab.cc: Include <cstring> and <algorithm>.
12194         * target-select.cc: Include <cstring>.
12195         * version.cc: Include <string>.
12196         * testsuite/testmain.cc: Include <cstdlib>.
12197         * configure, config.in: Rebuild.
12198
12199 2008-03-25  Ian Lance Taylor  <iant@google.com>
12200
12201         * options.cc: Include "../bfd/bfdver.h".
12202         (options::help): Print bug reporting address.
12203
12204         * version.cc (print_version): Adjust output for current value of
12205         BFD_VERSION_STRING.
12206
12207         * NEWS: New file.
12208
12209         * options.cc (options::help): Print list of supported targets.
12210         * target-select.h: Include <vector>.
12211         (class Target_selector): Make machine_, size_, and is_big_endian_
12212         fields const.  Add bfd_name_ and instantiated_target_ fields.
12213         (Target_selector::Target_selector): Add bfd_name parameter.
12214         (Target_selector::recognize): Make non-virtual, call
12215         do_recognize.
12216         (Target_selector::recognize_by_name): Make non-virtual, call
12217         do_recognize_by_name.
12218         (Target_selector::supported_names): New function.
12219         (Target_selector::bfd_name): New function.
12220         (Target_selector::do_instantiate_target): New pure virtual
12221         function.
12222         (Target_selector::do_recognize): New virtual function.
12223         (Target_selector::do_recognize_by_name): New virtual function.
12224         (Target_selector::instantiate_target): New private function.
12225         (supported_target_names): Declare.
12226         * target-select.cc (Target_selector::Target_selector): Update for
12227         new parameter and fields.
12228         (select_target_by_name): Check that the name matches before
12229         calling recognize_by_name.
12230         (supported_target_names): New function.
12231         * i386.cc (class Target_selector_i386): Update Target_selector
12232         constructor call.  Remove recognize and recognize_by_name.  Add
12233         do_instantiate_target.
12234         * x86_64.cc (class Target_selector_x86_64): Likewise.
12235         * testsuite/testfile.cc (class Target_selector_test): Update for
12236         changes to Target_selector.
12237
12238         * README: Rewrite, with some notes on unsupported features.
12239
12240 2008-03-24  Cary Coutant  <ccoutant@google.com>
12241
12242         * i386.cc (Target_i386::Got_type): New enum declaration.
12243         (Target_i386::Scan::local): Updated callers of Output_data_got
12244         member functions.
12245         (Target_i386::Scan::global): Likewise.
12246         (Target_i386::Relocate::relocate): Likewise.
12247         (Target_i386::Relocate::relocate_tls): Likewise.
12248         * object.h (Got_offset_list): New class.
12249         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12250         (Sized_relobj::local_got_offset): Likewise.
12251         (Sized_relobj::set_local_got_offset): Likewise.
12252         (Sized_relobj::local_has_tls_got_offset): Removed.
12253         (Sized_relobj::local_tls_got_offset): Removed.
12254         (Sized_relobj::set_local_tls_got_offset): Removed.
12255         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12256         * output.cc (Output_data_got::add_global): Added got_type parameter.
12257         (Output_data_got::add_global_with_rel): Likewise.
12258         (Output_data_got::add_global_with_rela): Likewise.
12259         (Output_data_got::add_global_pair_with_rel): New function.
12260         (Output_data_got::add_global_pair_with_rela): New function.
12261         (Output_data_got::add_local): Added got_type parameter.
12262         (Output_data_got::add_local_with_rel): Likewise.
12263         (Output_data_got::add_local_with_rela): Likewise.
12264         (Output_data_got::add_local_pair_with_rel): New function.
12265         (Output_data_got::add_local_pair_with_rela): New function.
12266         (Output_data_got::add_global_tls): Removed.
12267         (Output_data_got::add_global_tls_with_rel): Removed.
12268         (Output_data_got::add_global_tls_with_rela): Removed.
12269         (Output_data_got::add_local_tls): Removed.
12270         (Output_data_got::add_local_tls_with_rel): Removed.
12271         (Output_data_got::add_local_tls_with_rela): Removed.
12272         * output.h (Output_data_got::add_global): Added got_type parameter.
12273         (Output_data_got::add_global_with_rel): Likewise.
12274         (Output_data_got::add_global_with_rela): Likewise.
12275         (Output_data_got::add_global_pair_with_rel): New function.
12276         (Output_data_got::add_global_pair_with_rela): New function.
12277         (Output_data_got::add_local): Added got_type parameter.
12278         (Output_data_got::add_local_with_rel): Likewise.
12279         (Output_data_got::add_local_with_rela): Likewise.
12280         (Output_data_got::add_local_pair_with_rel): New function.
12281         (Output_data_got::add_local_pair_with_rela): New function.
12282         (Output_data_got::add_global_tls): Removed.
12283         (Output_data_got::add_global_tls_with_rel): Removed.
12284         (Output_data_got::add_global_tls_with_rela): Removed.
12285         (Output_data_got::add_local_tls): Removed.
12286         (Output_data_got::add_local_tls_with_rel): Removed.
12287         (Output_data_got::add_local_tls_with_rela): Removed.
12288         * resolve.cc (Symbol::override_base_with_special): Removed
12289         reference to has_got_offset_ field.
12290         * symtab.cc (Symbol::init_fields): Replaced initialization
12291         of got_offset_ with got_offsets_.  Removed initialization
12292         of has_got_offset_
12293         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12294         (Symbol::got_offset): Likewise.
12295         (Symbol::set_got_offset): Likewise.
12296         (Symbol::has_tls_got_offset): Removed.
12297         (Symbol::tls_got_offset): Removed.
12298         (Symbol::set_tls_got_offset): Removed.
12299         (Symbol::got_offset_): Removed.
12300         (Symbol::tls_mod_got_offset_): Removed.
12301         (Symbol::tls_pair_got_offset_): Removed.
12302         (Symbol::got_offsets_): New field.
12303         (Symbol::has_got_offset): Removed.
12304         (Symbol::has_tls_mod_got_offset): Removed.
12305         (Symbol::has_tls_pair_got_offset): Removed.
12306         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12307         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12308         member functions.
12309         (Target_x86_64::Scan::global): Likewise.
12310         (Target_x86_64::Relocate::relocate): Likewise.
12311         (Target_x86_64::Relocate::relocate_tls): Likewise.
12312
12313 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12314
12315         * yyscript.y: Fix spelling error in comment.
12316
12317 2008-03-24  Ian Lance Taylor  <iant@google.com>
12318
12319         * options.h (class General_options): Define build_id option.
12320         * layout.h (class Layout): Declare write_build_id, create_note,
12321         create_build_id.  Add build_id_note_ member.
12322         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12323         "libiberty.h", "md5.h", "sha1.h".
12324         (Layout::Layout): Initialize eh_frame_data_,
12325         eh_frame_hdr_section_, and build_id_note_.
12326         (Layout::finalize): Call create_build_id.
12327         (Layout::create_note): New function, broken out of
12328         Layout::create_gold_note.
12329         (Layout::create_gold_note): Call create_note.
12330         (Layout::create_build_id): New function.
12331         (Layout::write_build_id): New function.
12332         (Close_task_runner::run): Call write_build_id.
12333
12334         * x86_64.cc: Correct license to GPLv3.
12335
12336 2008-03-23  Ian Lance Taylor  <iant@google.com>
12337
12338         * options.cc: Include "demangle.h".
12339         (parse_optional_string): New function.
12340         (parse_long_option): Handle takes_optional_argument.
12341         (parse_short_option): Update dash_z initializer.  Handle
12342         takes_optional_argument.
12343         (General_options::General_options): Initialize do_demangle_.
12344         (General_options::finalize): Set do_demangle_.  Handle demangling
12345         style.
12346         * options.h (parse_optional_string): Declare.
12347         (struct One_option): Add optional_arg field.  Update constructor.
12348         Update call constructor calls.  Add takes_optional_argument
12349         function.
12350         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12351         (DEFINE_optional_string): Define.
12352         (General_options::demangle): Change from DEFINE_bool to
12353         DEFINE_optional_string.
12354         (General_options::no_demangle): New function.
12355         (General_options::do_demangle): New function.
12356         (General_options::set_do_demangle): New function.
12357         (General_options::execstack_status_): Move definition to end of
12358         class definition.
12359         (General_options::static_): Likewise.
12360         (General_options::do_demangle_): New field.
12361         * object.cc (big_endian>::get_symbol_location_info): Call
12362         Options::do_demangle, not Options::demangle.
12363         * symtab.cc (demangle): Likewise.
12364
12365 2008-03-22  Ian Lance Taylor  <iant@google.com>
12366
12367         * gold.h: Include <cstddef> and <sys/types.h>
12368         * options.h: Include <cstring>.
12369
12370 2008-03-21  Ian Lance Taylor  <iant@google.com>
12371
12372         * Added source code to GNU binutils.