2011-11-09 Doug Kwan <dougkwan@google.com>
[external/binutils.git] / gold / ChangeLog
1 2011-11-09  Doug Kwan  <dougkwan@google.com>
2
3         PR gold/13362
4         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
6         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
7         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
8         (Relocate_functions::rel_unaligned): New.
9         (Relocate_functions::rel32_unaligned): New.
10         * target-reloc.h (relocate_for_relocatable): Add code to handle
11         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
12         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
13         arm_unaligned_reloc_r): New targets.
14         * testsuite/Makefile.in: Regenerate.
15         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
16         linking.
17
18 2011-11-02  Ian Lance Taylor  <iant@google.com>
19
20         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
21         NATIVE_LINKER.
22         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
23         * options.cc (General_options::finalize): Use library search path
24         from configure script if specified.  If not native and no sysroot,
25         only search TOOLLIBDIR.
26         * options.h (Search_directory::Search_directory): Change name to
27         const std::string&.
28         (General_options::add_to_library_path_with_sysroot): Change arg to
29         const std::string&.
30         * configure, Makefile.in, config.in: Rebuild.
31
32 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
33
34         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
35         we are working around the ARM1176 Erratum.
36         * options.h (General_options::fix_arm1176): Add option.
37         * testsuite/Makefile.am: Add testcases, and keep current ones
38         working.
39         * testsuite/Makefile.in: Regenerate.
40         * testsuite/arm_fix_1176.s: New file.
41         * testsuite/arm_fix_1176.sh: Likewise.
42
43 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
44
45         * arm.cc (Target_arm::Target_arm): Remove initialisation of
46         may_use_blx_.
47         (Target_arm::may_use_blx): Remove method.
48         (Target_arm::set_may_use_blx): Likewise.
49         (Target_arm::may_use_v4t_interworking): New method.
50         (Target_arm::may_use_v5t_interworking): Likewise.
51         (Target_arm::may_use_blx_): Remove member variable.
52         (Arm_relocate_functions::arm_branch_common): Check for v5T
53         interworking.
54         (Arm_relocate_functions::thumb_branch_common): Likewise.
55         (Reloc_stub::stub_type_for_reloc): Likewise.
56         (Target_arm::do_finalize_sections): Correct interworking checks.
57         * testsuite/Makefile.am: Add new tests.
58         * testsuite/Makefile.in: Regenerate.
59         * testsuite/arm_farcall_arm_arm.s: New test.
60         * testsuite/arm_farcall_arm_arm.sh: Likewise.
61         * testsuite/arm_farcall_arm_thumb.s: Likewise.
62         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
63         * testsuite/arm_farcall_thumb_arm.s: Likewise.
64         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
65         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
66         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
67
68 2011-10-31  Cary Coutant  <ccoutant@google.com>
69
70         PR gold/13023
71         * expression.cc (Expression::eval_with_dot): Add
72         is_section_dot_assignment parameter.
73         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
74         absolute and assigning to dot within a section.
75         * script-sections.cc
76         (Output_section_element_assignment::set_section_addresses): Pass
77         dot_section to set_if_absolute.
78         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
79         as is_section_dot_assignment flag to eval_with_dot.
80         (Output_section_element_dot_assignment::set_section_addresses):
81         Likewise.
82         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
83         parameter.  Also set value if relative to dot_section; set the
84         symbol's output_section.
85         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
86         parameter.  Adjust all callers.
87         (Expression::eval_maybe_dot): Likewise.
88         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
89         Adjust all callers.
90         * testsuite/script_test_2.t: Test assignment of an absolute value
91         to dot within an output section element.
92
93 2011-10-31  Cary Coutant  <ccoutant@google.com>
94
95         * options.h (class General_options): Add --[no-]gnu-unique options.
96         * symtab.cc (Symbol_table::sized_write_globals): Convert
97         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
98
99 2011-10-31  Cary Coutant  <ccoutant@google.com>
100
101         PR gold/13359
102         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
103         unnecessary assertion.
104         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
105
106 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
107
108         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
109         gc_mark_symbol.
110         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
111         gc_mark_symbol.
112         Change to just keep the section associated with symbol.
113         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
114         they are externally visible and --export-dynamic is turned on.
115         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
116
117 2011-10-19  Ian Lance Taylor  <iant@google.com>
118
119         PR gold/13163
120         * script-sections.cc
121         (Output_section_element_dot_assignment::needs_output_section): New
122         function.
123
124 2011-10-19  Ian Lance Taylor  <iant@google.com>
125
126         PR gold/13204
127         * layout.cc (Layout::segment_precedes): Don't assert failure if a
128         --section-start option was seen.
129         * options.h (General_options::any_section_start): New function.
130
131 2011-10-18  David S. Miller  <davem@davemloft.net>
132
133         PR binutils/13301
134         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
135         member to track relocation locations that have moved during TLS
136         reloc optimizations.
137         (Target_sparc::Relocate::Relocate): Initialize to NULL.
138         (Target_sparc::Relocate::relocate): Adjust view down by 4
139         bytes if it matches reloc_adjust_addr_.
140         (Target_sparc::Relocate::relocate_tls): Always move the
141         __tls_get_addr call delay slot instruction forward 4 bytes when
142         performing relaxation.
143
144 2011-10-18  Cary Coutant  <ccoutant@google.com>
145
146         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
147         (Output_file::map_no_anonymous): Check for non-zero
148         return code from posix_fallocate.
149
150 2011-10-17  Cary Coutant  <ccoutant@google.com>
151
152         PR gold/13245
153         * plugin.cc (is_visible_from_outside): Check for symbols
154         referenced from dynamic objects.
155         * resolve.cc (Symbol_table::resolve): Don't count references
156         from dynamic objects as references from real ELF files.
157         * testsuite/plugin_test_2.sh: Adjust expected result.
158
159 2011-10-17  Cary Coutant  <ccoutant@google.com>
160
161         * gold.cc: Include timer.h.
162         (queue_middle_tasks): Stamp time.
163         (queue_final_tasks): Likewise.
164         * main.cc (main): Store timer in parameters.  Print timers
165         for each pass.
166         * parameters.cc (Parameters::Parameters): Initialize timer_.
167         (Parameters::set_timer): New function.
168         (set_parameters_timer): New function.
169         * parameters.h (Parameters::set_timer): New function.
170         (Parameters::timer): New function.
171         (Parameters::timer_): New data member.
172         (set_parameters_timer): New function.
173         * timer.cc (Timer::stamp): New function.
174         (Timer::get_pass_time): New function.
175         * timer.h (Timer::stamp): New function.
176         (Timer::get_pass_time): New function.
177         (Timer::pass_times_): New data member.
178
179 2011-10-17  Cary Coutant  <ccoutant@google.com>
180
181         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
182         task for members of lib groups.
183
184 2011-10-17  Cary Coutant  <ccoutant@google.com>
185
186         PR gold/13288
187         * fileread.cc (File_read::find_view): Add assert.
188         (File_read::make_view): Move bounds check (replace with assert)...
189         (File_read::find_or_make_view): ... to here.
190
191 2011-10-12  Cary Coutant  <ccoutant@google.com>
192
193         * output.cc (Output_file::open_base_file): Handle case where
194         ::read returns less than requested size.
195
196 2011-10-10  Cary Coutant  <ccoutant@google.com>
197
198         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
199         Initialize defined_count_.
200         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
201         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
202         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
203         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
204         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
205         * incremental.h (Sized_relobj_incr::defined_count_): New data
206         member.
207         (Sized_incr_dynobj::defined_count_): New data member.
208         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
209         Return zeroes instead of internal error.
210
211 2011-10-10  Cary Coutant  <ccoutant@google.com>
212
213         PR gold/13249
214         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
215         (Output_reloc::symbol_value): Return PLT offset if flag is set.
216         * output.h (class Output_reloc): Add use_plt_offset flag.
217         (Output_reloc::type_): Adjust size of bit field.
218         (Output_reloc::use_plt_offset_): New bit field.
219         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
220         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
221         flag.  Adjust all callers.
222         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
223         creating RELATIVE relocations.
224
225 2011-10-10  Nick Clifton  <nickc@redhat.com>
226
227         * po/es.po: Updated Spanish translation.
228         * po/fi.po: Updated Finnish translation.
229
230 2011-10-03   Diego Novillo  <dnovillo@google.com>
231
232         * options.cc (parse_uint): Fix dereference of RETVAL.
233
234 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
235
236         * layout.h (section_order_map_): New member.
237         (get_section_order_map): New member function.
238         * output.cc (Output_section::add_input_section): Check for patterns
239         only when --section-ordering-file is specified.
240         * gold.cc (queue_middle_tasks): Delay updating order of sections till
241         output_sections have been formed.
242         * layout.cc (Layout_Layout): Initialize section_order_map_.
243         * plugin.cc (update_section_order): Store order in order_map. Do not
244         update the order.
245         * testsuite/Makefile.am: Add test case for plugin_final_layout.
246         * testsuite/Makefile.in: Regenerate.
247         * testsuite/plugin_section_order.c: New file.
248         * testsuite/plugin_final_layout.cc: New file.
249         * testsuite/plugin_final_layout.sh: New file.
250
251 2011-09-29  Cary Coutant  <ccoutant@google.com>
252
253         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
254         Check for NULL.
255         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
256         symbols during incremental update.
257         (Symbol_table::add_from_dynobj): Likewise.
258
259 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
260             Ian Lance Taylor  <iant@google.com>
261
262         * symtab.cc (Symbol_table::define_special_symbol): Always
263         canonicalize version string.
264
265 2011-09-26  Cary Coutant  <ccoutant@google.com>
266
267         * gold.cc (queue_initial_tasks): Move option checks ...
268         * options.cc (General_options::finalize): ... to here. Disable
269         some options; make others fatal.
270
271 2011-09-26  Cary Coutant  <ccoutant@google.com>
272
273         gcc PR lto/47247
274         * plugin.cc (get_symbols_v2): New function.
275         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
276         (is_referenced_from_outside): New function.
277         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
278         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
279         (get_symbols): Pass version parameter.
280         (get_symbols_v2): New function.
281         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
282         parameter.
283         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
284         (onload): Add LDPT_GET_SYMBOLS_V2.
285         (all_symbols_read_hook): Use get_symbols_v2; check for
286         LDPR_PREVAILING_DEF_IRONLY_EXP.
287         * testsuite/plugin_test_3.sh: Update expected results.
288
289 2011-09-23  Simon Baldwin  <simonb@google.com>
290
291         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
292         configuration options.
293         * configure: Regenerate.
294         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
295         * Makefile.in: Regenerate.
296         * testsuite/Makefile.in: Regenerate.
297
298 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
299
300         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
301
302 2011-09-19  Cary Coutant  <ccoutant@google.com>
303
304         * incremental.cc (can_incremental_update): Fix typo in comment.
305         * incremental.h (can_incremental_update): Likewise.
306
307 2011-09-18  Cary Coutant  <ccoutant@google.com>
308
309         * incremental.cc (can_incremental_update): New function.
310         * incremental.h (can_incremental_update): New function.
311         * layout.cc (Layout::init_fixed_output_section): Call it.
312         (Layout::make_output_section): Don't allow patch space in .eh_frame.
313         * object.cc (Sized_relobj_file::do_layout): Call
314         can_incremental_update.
315
316 2011-09-13  Cary Coutant  <ccoutant@google.com>
317
318         * configure.ac: Check for glibc support for gnu_indirect_function
319         support with static linking, setting automake conditional
320         IFUNC_STATIC.
321         * Makefile.in: Regenerate.
322         * configure: Regenerate.
323
324         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
325         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
326         for IFUNC_STATIC.
327         * testsuite/Makefile.in: Regenerate.
328
329 2011-09-13  Cary Coutant  <ccoutant@google.com>
330
331         * incremental.cc (Sized_relobj_incr::do_layout): Call
332         report_comdat_group for kept comdat sections.
333         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
334         * testsuite/Makefile.in: Regenerate.
335         * testsuite/incr_comdat_test_1.cc: New source file.
336         * testsuite/incr_comdat_test_2_v1.cc: New source file.
337         * testsuite/incr_comdat_test_2_v2.cc: New source file.
338         * testsuite/incr_comdat_test_2_v3.cc: New source file.
339
340 2011-09-13  Ian Lance Taylor  <iant@google.com>
341
342         * object.cc (Sized_relobj_file::do_layout): Remove unused local
343         variable external_symbols_offset.
344
345 2011-09-12  Ian Lance Taylor  <iant@google.com>
346
347         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
348         triggered if object has no symbols.
349
350 2011-09-09  David S. Miller  <davem@davemloft.net>
351
352         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
353         (Output_fill_debug_line::do_write): Likewise.
354
355 2011-08-29  Cary Coutant  <ccoutant@google.com>
356
357         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
358         casts to match formatting specs.
359         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
360
361 2011-08-26  Cary Coutant  <ccoutant@google.com>
362
363         * layout.cc (Free_list::allocate): Provide guarantee of minimum
364         remaining hole size when allocating.
365         (Layout::make_output_section): Set fill methods for debug sections.
366         * layout.h (Free_list::Free_list_node): Move from private to
367         public.
368         (Free_list::set_min_hole_size): New function.
369         (Free_list::begin, Free_list::end): New functions.
370         (Free_list::min_hole_): New data member.
371         * output.cc: Include dwarf.h.
372         (Output_fill_debug_info::do_minimum_hole_size): New function.
373         (Output_fill_debug_info::do_write): New function.
374         (Output_fill_debug_line::do_minimum_hole_size): New function.
375         (Output_fill_debug_line::do_write): New function.
376         (Output_section::Output_section): Initialize new data member.
377         (Output_section::set_final_data_size): Ensure patch space is larger
378         than minimum hole size.
379         (Output_section::do_write): Fill holes in debug sections.
380         * output.h (Output_fill): New class.
381         (Output_fill_debug_info): New class.
382         (Output_fill_debug_line): New class.
383         (Output_section::set_free_space_fill): New function.
384         (Output_section::free_space_fill_): New data member.
385         * testsuite/Makefile.am (incremental_test_3): Add
386         --incremental-patch option.
387         (incremental_test_4): Likewise.
388         (incremental_test_5): Likewise.
389         (incremental_test_6): Likewise.
390         (incremental_copy_test): Likewise.
391         (incremental_common_test_1): Likewise.
392         * testsuite/Makefile.in: Regenerate.
393
394 2011-08-26  Nick Clifton  <nickc@redhat.com>
395
396         * po/es.po: Updated Spanish translation.
397
398 2011-08-01  Cary Coutant  <ccoutant@google.com>
399
400         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
401         * gold/testsuite/Makefile.in: Regenerate.
402         * gold/testsuite/justsyms_exec.c: New source file.
403         * gold/testsuite/justsyms_lib.c: New source file.
404
405 2011-08-01  Cary Coutant  <ccoutant@google.com>
406
407         * layout.cc (Layout::set_segment_offsets): Don't realign text
408         segment if -Ttext was specified.
409         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
410         file type.
411         * object.h (Sized_relobj_file::e_type): New function.
412         (Sized_relobj_file::e_type_): New data member.
413         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
414         base address for ET_EXEC files.
415         * target.cc (Target::do_make_elf_object_implementation): Allow
416         ET_EXEC files with --just-symbols option.
417
418 2011-07-28  Cary Coutant  <ccoutant@google.com>
419
420         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
421         Add thread_number parameter.
422         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
423         * workqueue-threads.cc
424         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
425         current thread if its thread number is greater than desired thread
426         count.
427         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
428         Add thread_number parameter.
429         (Workqueue::should_cancel_thread): Likewise.
430         (Workqueue::find_runnable_or_wait): Pass thread_number to
431         should_cancel_thread.
432         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
433         parameter.
434
435 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
436
437         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
438         only after checking if it cannot be forced local.
439         * symtab.h (is_externally_visible): Check if the symbol is not forced
440         local.
441
442 2011-07-15  Ian Lance Taylor  <iant@google.com>
443
444         * options.h (class General_options): Add --print-output-format.
445         Move -EL next to -EB, for  better --help output.
446         * target-select.cc: Include <cstdio>, "options.h", and
447         "parameters.h".
448         (Target_selector::do_target_bfd_name): New function.
449         (print_output_format): New function.
450         * target-select.h (class Target_selector): Update declarations.
451         (Target_selector::target_bfd_name): New function.
452         (print_output_format): Declare.
453         * main.cc: Include "target-select.h".
454         (main): Handle --print-output-format.
455         * gold.cc: Include "target-select.h".
456         (queue_initial_tasks): Handle --print-output-format when there are
457         no input files.
458         * parameters.cc (parameters_force_valid_target): Give a better
459         error message if -EB/-EL does not match target.
460         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
461         function.
462
463 2011-07-15  Ian Lance Taylor  <iant@google.com>
464
465         * i386.cc (class Output_data_plt_i386): Add layout_ field.
466         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
467         (Output_data_plt_i386::do_write): Write address of .dynamic
468         section to first entry in .got.plt section.
469         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
470         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
471         Initialize layout_.
472         (Output_data_plt_x86_64::do_write): Write address of .dynamic
473         section to first entry in .got.plt section.
474         * layout.h (Layout::dynamic_section): New function.
475
476 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
477
478         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
479         to claim_file call.
480         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
481         input_section_position_, and input_section_glob_.
482         (read_layout_from_file): Call function section_ordering_specified.
483         * layout.h (is_section_ordering_specified): New function.
484         (section_ordering_specified): New function.
485         (section_ordering_specified_): New boolean member.
486         * main.cc(main): Call load_plugins after layout object is defined.
487         * output.cc (Output_section::add_input_section): Use
488         function section_ordering_specified to check if section ordering is
489         needed.
490         * output.cc (Output_section::add_relaxed_input_section): Use
491         function section_ordering_specified to check if section ordering is
492         needed.
493         (Output_section::update_section_layout): New function.
494         (Output_section::sort_attached_input_sections): Check if input section
495         must be reordered.
496         * output.h (Output_section::update_section_layout): New function.
497         * plugin.cc (get_section_count): New function.
498         (get_section_type): New function.
499         (get_section_name): New function.
500         (get_section_contents): New function.
501         (update_section_order): New function.
502         (allow_section_ordering): New function. 
503         (Plugin::load): Add the new interfaces to the transfer vector.
504         (Plugin_manager::load_plugins): New parameter.
505         (Plugin_manager::all_symbols_read): New parameter.
506         (Plugin_manager::claim_file): New parameter. Save the elf object for
507         unclaimed objects.
508         (Plugin_manager::get_elf_object): New function.
509         (Plugin_manager::get_view): Change to directly use the bool to check
510         if get_view is called from claim_file_hook.
511         * plugin.h (input_objects): New function
512         (Plugin__manager::load_plugins): New parameter.
513         (Plugin_manager::claim_file): New parameter.
514         (Plugin_manager::get_elf_object): New function.
515         (Plugin_manager::in_claim_file_handler): New function.
516         (Plugin_manager::in_claim_file_handler_): New member.
517         (layout): New function.
518         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
519         handler with an extra parameter. Make the elf object before calling
520         claim_file handler.
521         * testsuite/plugin_test.c (get_section_count): New function pointer.
522         (get_section_type): New function pointer.
523         (get_section_name): New function pointer.
524         (get_section_contents): New function pointer.
525         (update_section_order): New function pointer.
526         (allow_section_ordering): New function pointer.
527         (onload): Check if the new interfaces exist.
528
529 2011-07-13  Ian Lance Taylor  <iant@google.com>
530
531         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
532         relro section.
533         * x86_64.cc (Target_x86_64::got_section): Likewise.
534         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
535         (relro_now_test_SOURCES): New variable.
536         (relro_now_test_DEPENDENCIES): New variable.
537         (relro_now_test_LDFLAGS): New variable.
538         (relro_now_test_LDADD): New variable.
539         (relro_now_test.so): New target.
540         * testsuite/Makefile.in: Rebuild.
541
542 2011-07-12  Ian Lance Taylor  <iant@google.com>
543
544         PR gold/12980
545         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
546         GLOB_DAT relocation rather than a RELATIVE relocation for a
547         protected symbol when creating a shared library.
548         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
549         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
550         * testsuite/protected_main_1.cc (main): Test that protected
551         function has same address.
552
553 2011-07-11  Ian Lance Taylor  <iant@google.com>
554
555         PR gold/12979
556         * options.h (class General_options): Add -Bgroup.
557         * options.cc (General_options::finalize): If -Bgroup is set,
558         default to --unresolved-symbols=report-all.
559         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
560         * target-reloc.h (issue_undefined_symbol_error): Handle
561         --unresolved-symbols=report-all.
562
563 2011-07-08  Ian Lance Taylor  <iant@google.com>
564
565         PR gold/11985
566         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
567         if linker script discards key sections.
568         (Layout::create_dynamic_symtab): Likewise.
569         (Layout::assign_local_dynsym_offsets): Likewise.
570         (Layout::sized_create_version_sections): Likewise.
571         (Layout::create_interp): Likewise.
572         (Layout::finish_dynamic_section): Likewise.
573         (Layout::set_dynamic_symbol_size): Likewise.
574
575 2011-07-08  Ian Lance Taylor  <iant@google.com>
576
577         PR gold/12386
578         * options.h (class General_options): Add --unresolved-symbols.
579         * target-reloc.h (issue_undefined_symbol_error): Check
580         --unresolved-symbols.  Add comments.
581
582 2011-07-08  Ian Lance Taylor  <iant@google.com>
583
584         * testsuite/odr_violation2.cc (Ordering::operator()): Make
585         expression more complex.
586
587 2011-07-08  Ian Lance Taylor  <iant@google.com>
588
589         PR gold/11317
590         * target-reloc.h (issue_undefined_symbol_error): New inline
591         function, broken out of relocate_section.
592         (relocate_section): Call issue_undefined_symbol_error.
593         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
594         there is no TLS segment if we are about to issue an undefined
595         symbol error.
596         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
597
598 2011-07-08  Ian Lance Taylor  <iant@google.com>
599
600         PR gold/12279
601         * resolve.cc (Symbol_table::should_override): Add fromtype
602         parameter.  Change all callers.  Give error when linking together
603         TLS and non-TLS symbol.
604         (Symbol_table::should_override_with_special): Add fromtype
605         parameter.  Change all callers.
606         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
607         there is no TLS segment if we have reported some errors.
608         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
609
610 2011-07-08  Ian Lance Taylor  <iant@google.com>
611
612         PR gold/12372
613         * target.h (Target::plt_address_for_global): New function.
614         (Target::plt_address_for_local): New function.
615         (Target::plt_section_for_global): Remove.
616         (Target::plt_section_for_local): Remove.
617         (Target::do_plt_address_for_global): New virtual function.
618         (Target::do_plt_address_for_local): New virtual function.
619         (Target::do_plt_section_for_global): Remove.
620         (Target::do_plt_section_for_local): Remove.
621         (Target::register_global_plt_entry): Add Symbol_table and Layout
622         parameters.
623         * output.cc (Output_data_got::Got_entry::write): Use
624         plt_address_for_global and plt_address_for_local.
625         * layout.cc (Layout::add_target_dynamic_tags): Use size and
626         address of output section.
627         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
628         got_irelative_, and irelative_count_ fields.  Update
629         declarations.
630         (Output_data_plt_i386::has_irelative_section): New function.
631         (Output_data_plt_i386::entry_count): Add irelative_count_.
632         (Output_data_plt_i386::set_final_data_size): Likewise.
633         (class Target_i386): Add got_irelative_ and rel_irelative_
634         fields.  Update declarations.
635         (Target_i386::Target_i386): Initialize new fields.
636         (Target_i386::do_plt_address_for_global): New function replacing
637         do_plt_section_for_global.
638         (Target_i386::do_plt_address_for_local): New function replacing
639         do_plt_section_for_local.
640         (Target_i386::got_section): Create got_irelative_.
641         (Target_i386::rel_irelative_section): New function.
642         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
643         fields.  Don't define __rel_iplt_{start,end}.
644         (Output_data_plt_i386::add_entry): Add symtab and layout
645         parameters.  Change all callers.  Use different PLT and GOT for
646         IFUNC symbols.
647         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
648         layout parameters.  Change all callers.  Use different PLT and
649         GOT.
650         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
651         (Output_data_plt_i386::rel_irelative): New function.
652         (Output_data_plt_i386::address_for_global): New function.
653         (Output_data_plt_i386::address_for_local): New function.
654         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
655         IRELATIVE GOT when changing IFUNC GOT entries.
656         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
657         reloc.
658         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
659         if we didn't create an IRELATIVE GOT.
660         (Target_i386::Relocate::relocate): Use plt_address_for_global and
661         plt_address_for_local.
662         (Target_i386::do_dynsym_value): Use plt_address_for_global.
663         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
664         got_irelative_, and irelative_count_ fields.  Update
665         declarations.
666         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
667         Initialize new fields.  Remove symtab parameter.  Change all
668         callers.
669         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
670         irelative_count_.
671         (Output_data_plt_x86_64::has_irelative_section): New function.
672         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
673         (class Target_x86_64): Add got_irelative_ and rel_irelative_
674         fields.  Update declarations.
675         (Target_x86_64::Target_x86_64): Initialize new fields.
676         (Target_x86_64::do_plt_address_for_global): New function replacing
677         do_plt_section_for_global.
678         (Target_x86_64::do_plt_address_for_local): New function replacing
679         do_plt_section_for_local.
680         (Target_x86_64::got_section): Create got_irelative_.
681         (Target_x86_64::rela_irelative_section): New function.
682         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
683         all callers.  Don't create __rel_iplt_{start,end}.
684         (Output_data_plt_x86_64::add_entry): Add symtab and layout
685         parameters.  Change all callers.  Use different PLT and GOT for
686         IFUNC symbols.
687         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
688         layout parameters.  Change all callers.  Use different PLT and
689         GOT.
690         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
691         parameters.  Change all callers.  Use different PLT and GOT for
692         IFUNC symbols.
693         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
694         (Output_data_plt_x86_64::rela_irelative): New function.
695         (Output_data_plt_x86_64::address_for_global): New function.
696         (Output_data_plt_x86_64::address_for_local): New function.
697         (Output_data_plt_x86_64::set_final_data_size): Likewise.
698         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
699         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
700         (Target_x86_64::register_global_plt_entry): Add symtab and layout
701         parameters.
702         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
703         reloc.
704         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
705         symbols if we didn't create an IRELATIVE GOT.
706         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
707         plt_address_for_local.
708         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
709         * testsuite/ifuncvar1.c: New test file.
710         * testsuite/ifuncvar2.c: New test file.
711         * testsuite/ifuncvar3.c: New test file.
712         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
713         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
714         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
715         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
716         * testsuite/Makefile.in: Rebuild.
717
718 2011-07-07  Cary Coutant  <ccoutant@google.com>
719
720         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
721         (two_file_test_1_ndebug.o): Likewise.
722         (two_file_test_1b_ndebug.o): Likewise.
723         (two_file_test_2_ndebug.o): Likewise.
724         (two_file_test_main_ndebug.o): Likewise.
725         (incremental_test_2): Link with no-debug versions.
726
727 2011-07-06  Cary Coutant  <ccoutant@google.com>
728
729         * gold/incremental.cc
730         (Output_section_incremental_inputs::write_info_blocks): Check for
731         hidden and internal symbols.
732
733 2011-07-06  Cary Coutant  <ccoutant@google.com>
734
735         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
736         Check disposition for startup file.
737         (Incremental_inputs::report_command_line): Ignore
738         --incremental-startup-unchanged option.
739         * options.cc (General_options::parse_incremental_startup_unchanged):
740         New function.
741         (General_options::General_options): Initialize new data member.
742         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
743         (General_options): Add --incremental-startup-unchanged option.
744         (General_options::incremental_startup_disposition): New function.
745         (General_options::incremental_startup_disposition_): New data member.
746
747 2011-07-06  Cary Coutant  <ccoutant@google.com>
748
749         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
750         input file index to Script_info ctor.
751         (Sized_incremental_binary::do_file_has_changed): Find the
752         command-line argument for files named in scripts.
753         * incremental.h (Script_info::Script_info): New ctor
754         with input file index.
755         (Script_info::input_file_index): New function.
756         (Script_info::input_file_index_): New data member.
757         (Incremental_binary::get_library): Add const.
758         (Incremental_binary::get_script_info): Add const.
759         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
760         * testsuite/Makefile.am (incremental_test_5): New test case.
761         (incremental_test_6): New test case.
762         * testsuite/Makefile.in: Regenerate.
763
764 2011-07-06  Cary Coutant  <ccoutant@google.com>
765
766         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
767         debug output when command lines differ.
768
769 2011-07-06  Cary Coutant  <ccoutant@google.com>
770
771         * incremental.cc (Incremental_inputs::report_command_line): Ignore
772         --incremental-patch option.
773         * layout.cc (Free_list::allocate): Extend allocation beyond original
774         end if enabled.
775         (Layout::make_output_section): Mark sections that should get
776         patch space.
777         * options.cc (parse_percent): New function.
778         * options.h (parse_percent): New function.
779         (DEFINE_percent): New macro.
780         (General_options): Add --incremental-patch option.
781         * output.cc (Output_section::Output_section): Initialize new data
782         members.
783         (Output_section::add_input_section): Print section name when out
784         of patch space.
785         (Output_section::add_output_section_data): Likewise.
786         (Output_section::set_final_data_size): Add patch space when
787         doing --incremental-full.
788         (Output_section::do_reset_address_and_file_offset): Remove patch
789         space.
790         (Output_segment::set_section_list_addresses): Print debug output
791         only if --incremental-update.
792         * output.h (Output_section::set_is_patch_space_allowed): New function.
793         (Output_section::is_patch_space_allowed_): New data member.
794         (Output_section::patch_space_): New data member.
795         * parameters.cc (Parameters::incremental_full): New function.
796         * parameters.h (Parameters::incremental_full): New function
797         * testsuite/Makefile.am (incremental_test_2): Add test for
798         --incremental-patch option.
799         * testsuite/Makefile.in: Regenerate.
800         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
801         (t18): Remove function body.
802
803 2011-07-05  Doug Kwan  <dougkwan@google.com>
804
805         PR gold/12771
806         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
807         Arm_Address type for relocation result.
808         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
809         overflow check.
810         (Arm_relocate_functions::abs32): Use unaligned access.
811         (Arm_relocate_functions::rel32): Ditto.
812         (Arm_relocate_functions::prel31): Ditto.
813         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
814         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
815         static data relocations.
816         * testsuite/Makefile.in: Regnerate.
817         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
818
819 2011-07-05  Ian Lance Taylor  <iant@google.com>
820
821         PR gold/12392
822         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
823         symbols if necessary.
824         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
825
826 2011-07-05  Ian Lance Taylor  <iant@google.com>
827
828         PR gold/12952
829         * resolve.cc (Symbol::override_base_with_special): Simply override
830         version with special symbol version, ignoring previous version.
831
832 2011-07-05  Ian Lance Taylor  <iant@google.com>
833
834         * object.cc (Sized_relobj_file::include_section_group): Add
835         information to comment about signature location.
836
837 2011-07-02  Ian Lance Taylor  <iant@google.com>
838
839         PR gold/12957
840         * options.h (class General_options): Add -f and -F.
841         * options.cc (General_options::finalize): Fatal error if -f/-F
842         are used without -shared.
843         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
844
845 2011-07-02  Ian Lance Taylor  <iant@google.com>
846
847         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
848
849 2011-07-01  Ian Lance Taylor  <iant@google.com>
850
851         PR gold/12525
852         PR gold/12952
853         * resolve.cc (Symbol::override_base_with_special): Don't override
854         the version if the overriding symbol has a different name.
855         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
856         all callers.  If we give an error about an undefined version,
857         define the base version if necessary.
858         * dynobj.h (class Versions): Update declaration.
859         * testsuite/weak_alias_test_5.cc: New file.
860         * testsuite/weak_alias_test.script: New file.
861         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
862         and versioned_alias have the right value, and call t2.
863         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
864         weak_alias_test_5.so.
865         (weak_alias_test_LDADD): Likewise.
866         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
867         * testsuite/Makefile.in: Rebuild.
868
869 2011-07-01  Ian Lance Taylor  <iant@google.com>
870
871         PR gold/12525
872         * options.h (class General_options): Support -z notext.
873         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
874         -Wl,-z,notext.
875         (two_file_shared_nonpic.so): Likewise.
876         (two_file_shared_mixed.so): Likewise.
877         (two_file_shared_mixed_1.so): Likewise.
878         (weak_undef_lib_nonpic.so): Likewise.
879         (alt/weak_undef_lib_nonpic.so): Likewise.
880         (tls_test_shared_nonpic.so): Likewise.
881         * testsuite/Makefile.in: Rebuild.
882
883 2011-07-01  Ian Lance Taylor  <iant@google.com>
884
885         PR gold/12525
886         * configure.ac: Test whether static linking works, setting
887         the automake conditional HAVE_STATIC.
888         * testsuite/Makefile.am: Disable tests using -static if
889         HAVE_STATIC is not true.
890         * configure, testsuite/Makefile.in: Rebuild.
891
892 2011-07-01  Ian Lance Taylor  <iant@google.com>
893
894         PR gold/12525
895         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
896         Assert if we see DW_EH_PE_indirect.
897         * target.h (Target::ehframe_datarel_base): New function.
898         (Target::do_ehframe_datarel_base): New target function.
899         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
900         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
901         function.
902
903 2011-07-01  Ian Lance Taylor  <iant@google.com>
904
905         PR gold/12571
906         * options.h (class General_options): Add
907         --ld-generated-unwind-info.
908         * ehframe.cc (Fde::write): Add address parameter.  Change all
909         callers.  If associated with PLT, fill in address and size.
910         (Cie::set_output_offset): Only add merge mapping if there is an
911         object.
912         (Cie::write): Add address parameter.  Change all callers.
913         (Eh_frame::add_ehframe_for_plt): New function.
914         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
915         input_offset_ fields into union u_, with new plt field.
916         (Fde::Fde): Adjust for new union field.
917         (Fde::Fde) [Output_data version]: New constructor.
918         (Fde::add_mapping): Only add merge mapping if there is an object.
919         (class Cie): Update declarations.
920         (class Eh_frame): Declare add_ehframe_for_plt.
921         * layout.cc (Layout::layout_eh_frame): Break out code into
922         make_eh_frame_section, and call it.
923         (Layout::make_eh_frame_section): New function.
924         (Layout::add_eh_frame_for_plt): New function.
925         * layout.h (class Layout): Update declarations.
926         * merge.cc (Merge_map::add_mapping): Add assertion.
927         * i386.cc: Include "dwarf.h".
928         (class Output_data_plt_i386): Make first_plt_entry,
929         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
930         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
931         and plt_eh_frame_fde.
932         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
933         boundary.  Call add_eh_frame_for_plt if appropriate.
934         * x86_64.cc: Include "dwarf.h".
935         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
936         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
937         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
938         and plt_eh_frame_fde.
939         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
940         appropriate.
941
942 2011-06-29  Ian Lance Taylor  <iant@google.com>
943
944         PR gold/12629
945         * object.cc (Sized_relobj_file::layout_section): Change shdr
946         parameter to be const.
947         (Sized_relobj_file::layout_eh_frame_section): New function, broken
948         out of do_layout.
949         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
950         appropriate.  Call layout_eh_frame_section.
951         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
952         sections.
953         * object.h (class Sized_relobj_file): Update declarations.
954
955 2011-06-29  Ian Lance Taylor  <iant@google.com>
956
957         PR gold/12652
958         * script.cc (Token::integer_value): Accept trailing M/m/K/k
959         modifier.
960         (Lex::gather_token): Accept trailing M/m/K/k for integers.
961
962 2011-06-29  Ian Lance Taylor  <iant@google.com>
963
964         PR gold/12675
965         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
966         SHT_X86_64_UNWIND.
967         * layout.cc (Layout::layout_eh_frame): Likewise.
968
969 2011-06-29  Ian Lance Taylor  <iant@google.com>
970
971         PR gold/12695
972         * layout.cc (Layout::symtab_section_shndx): New function.
973         * layout.h (class Layout): Declare symtab_section_shndx.
974         * output.cc (Output_section::write_header): Call it.
975
976 2011-06-29  Ian Lance Taylor  <iant@google.com>
977
978         PR gold/12818
979         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
980         symbols which are not used in a relocation.
981
982 2011-06-28  Ian Lance Taylor  <iant@google.com>
983
984         PR gold/12898
985         * layout.cc (Layout::segment_precedes): Don't crash if a linker
986         script create indistinguishable segments.
987         (Layout::set_segment_offsets): Use stable_sort when sorting
988         segments.  Pass this to Compare_segments constructor.
989         * layout.h (class Layout): Make segment_precedes non-static.
990         (class Compare_segments): Change from struct to class.  Add
991         layout_ field.  Add constructor.
992         * script-sections.cc
993         (Script_sections::attach_sections_using_phdrs_clause): Rename
994         local orphan to is_orphan.  Don't report failure to put empty
995         section in segment.  On attachment failure, report name of
996         section, and attach to first PT_LOAD segment.
997
998 2011-06-28  Ian Lance Taylor  <iant@google.com>
999
1000         PR gold/12934
1001         * target-select.cc (Target_selector::Target_selector): Add
1002         emulation parameter.  Change all callers.
1003         (select_target_by_bfd_name): Rename from select_target_by_name.
1004         Change all callers.
1005         (select_target_by_emulation): New function.
1006         (supported_emulation_names): New function.
1007         * target-select.h (class Target_selector): Add emulation_ field.
1008         Update declarations.
1009         (Target_selector::recognize_by_bfd_name): Rename from
1010         recognize_by_name.  Change all callers.
1011         (Target_selector::supported_bfd_names): Rename from
1012         supported_names.  Change all callers.
1013         (Target_selector::recognize_by_emulation): New function.
1014         (Target_selector::supported_emulations): New function.
1015         (Target_selector::emulation): New function.
1016         (Target_selector::do_recognize_by_bfd_name): Rename from
1017         do_recognize_by_name.  Change all callers.
1018         (Target_selector::do_supported_bfd_names): Rename from
1019         do_supported_names.  Change all callers.
1020         (Target_selector::do_recognize_by_emulation): New function.
1021         (Target_selector::do_supported_emulations): New function.
1022         (select_target_by_bfd_name): Change name in declaration.
1023         (select_target_by_emulation): Declare.
1024         (supported_emulation_names): Declare.
1025         * parameters.cc (parameters_force_valid_target): Try to find
1026         target based on emulation from -m option.
1027         * options.h (class General_options): Change doc string for -m.
1028         * options.cc (help): Print emulations.
1029         (General_options::parse_V): Likewise.
1030         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1031         Add emulation parameter.  Change all callers.
1032
1033 2011-06-28  Ian Lance Taylor  <iant@google.com>
1034
1035         * target.h (class Target): Add osabi_ field.
1036         (Target::osabi): New function.
1037         (Target::set_osabi): New function.
1038         (Target::Target): Initialize osabi_.
1039         (Target::do_adjust_elf_header): Make pure virtual.
1040         (Sized_target::do_adjust_elf_header): Declare.
1041         * target.cc (Sized_target::do_adjust_elf_header): New function.
1042         (class Sized_target): Instantiate all versions.
1043         * freebsd.h (class Target_freebsd): Remove.
1044         (Target_selector_freebsd::do_recognize): Call set_osabi on
1045         Target.
1046         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1047         (Target_selector_freebsd::set_osabi): Remove.
1048         * i386.cc (class Target_i386): Inherit from Sized_target rather
1049         than Target_freebsd.
1050         * x86_64.cc (class Target_x86_64): Likewise.
1051
1052 2011-06-28  Ian Lance Taylor  <iant@google.com>
1053
1054         * target.h (Target::can_check_for_function_pointers): Rewrite.
1055         Make non-virtual.
1056         (Target::can_icf_inline_merge_sections): Likewise.
1057         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1058         (Target::Target_info): Add can_icf_inline_merge_sections field.
1059         (Target::do_can_check_for_function_pointers): New virtual
1060         function.
1061         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1062         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1063         from can_check_for_function_pointers, move in file.
1064         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1065         section_may_have_icf_unsafe_poineters, move in file.
1066         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1067         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1068         Rename from can_check_for_function_pointers, move in file.
1069         (Target_i386::can_icf_inline_merge_sections): Remove.
1070         (Target_i386::i386_info): Initialize
1071         can_icf_inline_merge_sections.
1072         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1073         Initialize can_icf_inline_merge_sections.
1074         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1075         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1076         Rename from can_check_for_function_pointers, move in file.
1077         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1078         (Target_x86_64::x86_64_info): Initialize
1079         can_icf_inline_merge_sections.
1080         * testsuite/testfile.cc (Target_test::test_target_info):
1081         Likewise.
1082         * icf.cc (get_section_contents): Correct formatting.
1083
1084 2011-06-27  Ian Lance Taylor  <iant@google.com>
1085
1086         * symtab.cc (Symbol::versioned_name): New function.
1087         (Symbol_table::add_to_final_symtab): Use versioned_name when
1088         appropriate.
1089         (Symbol_table::sized_write_symbol): Likewise.
1090         * symtab.h (class Symbol): Declare versioned_name.
1091         * stringpool.h (class Stringpool_template): Add variant of add
1092         which takes a std::basic_string.
1093         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1094         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1095         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1096         (ver_test_12.o): New target.
1097         * testsuite/Makefile.in: Rebuild.
1098
1099 2011-06-27  Doug Kwan  <dougkwan@google.com>
1100
1101         * arm.cc (Arm_relocate_functions::thm_jump8,
1102         Arm_relocate_functions::thm_jump11): Use a wider signed
1103         type to compute offset.
1104         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1105         arm_thm_jump8.
1106         * testsuite/Makefile.in: Regenerate.
1107         * testsuite/arm_branch_in_range.sh: Check test results of
1108         arm_thm_jump11 and arm_thm_jump8.
1109         * testsuite/arm_thm_jump11.s: New test source file.
1110         * testsuite/arm_thm_jump11.t: New linker script.
1111         * testsuite/arm_thm_jump8.s: New test source file.
1112         * testsuite/arm_thm_jump8.t: New linker script.
1113
1114 2011-06-24  Ian Lance Taylor  <iant@google.com>
1115
1116         * layout.cc: Include "object.h".
1117         (ctors_sections_in_init_array): New static variable.
1118         (Layout::is_ctors_in_init_array): New function.
1119         (Layout::layout): Add entry to ctors_sections_in_init_array if
1120         appropriate.
1121         * layout.h (class Layout): Declare is_ctors_in_init_array.
1122         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1123         is_ctors_reverse_view is set.
1124         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1125         all callers.  Set is_ctors_reverse_view field of View_size.
1126         (Sized_relobj_file::reverse_words): New function.
1127         * object.h (Sized_relobj_file::View_size): Add
1128         is_ctors_reverse_view field.
1129         (class Sized_relobj_file): Update declarations.
1130         * testsuite/initpri3.c: New test.
1131         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1132         initpri3b.
1133         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1134         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1135         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1136         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1137         * testsuite/Makefile.in: Rebuild.
1138
1139 2011-06-24  Cary Coutant  <ccoutant@google.com>
1140
1141         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1142         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1143         (debug_msg_cdebug.err): New targets.
1144         * testsuite/Makefile.in: Regenerate.
1145         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1146         Fix checks for link with shared library.
1147
1148 2011-06-24  Doug Kwan  <dougkwan@google.com>
1149
1150         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1151         skip empty text sections.
1152         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1153
1154 2011-06-22  Ian Lance Taylor  <iant@google.com>
1155
1156         PR gold/12910
1157         * options.h (class General_options): Add --ctors-in-init-array.
1158         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1159         friends as SHT_PROGBITS for merging sections.
1160         (Layout::layout): Remove special handling of .init_array and
1161         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1162         and .dtors if ctors_in_init_array.
1163         (Layout::make_output_section): Force correct section types for
1164         .init_array and friends.  Don't sort if doing relocatable link,
1165         Don't sort .ctors and .dtors if ctors_in_init_array.
1166         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1167         (Layout::output_section_name): Add relobj parameter.  Change all
1168         callers.  Handle .ctors. and .dtors. in code rather than table.
1169         Handle .ctors and .dtors if ctors_in_init_array.
1170         (Layout::match_file_name): New function, moved from output.cc.
1171         * layout.h (class Layout): Update declarations.
1172         * output.cc: Include "layout.h".
1173         (Input_section_sort_entry::get_priority): New function.
1174         (Input_section_sort_entry::match_file_name): Just call
1175         Layout::match_file_name.
1176         (Output_section::Input_section_sort_init_fini_compare::operator()):
1177         Handle .ctors and .dtors.  Sort by explicit priority rather than
1178         by name.
1179         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1180         * testsuite/initpri2.c: New test.
1181         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1182         (check_PROGRAMS): Add initpri2.
1183         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1184         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1185         * configure, testsuite/Makefile.in: Rebuild.
1186
1187 2011-06-19  Ian Lance Taylor  <iant@google.com>
1188
1189         PR gold/12880
1190         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1191         .interp section to a PT_INTERP segment even if we have seen a
1192         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1193         clause in a linker script.
1194         (Layout::finalize): Don't create a .interp section if we've
1195         already create a PT_INTERP segment.
1196         (Layout::create_interp): Always call choose_output_section (revert
1197         patch of 2011-06-17).  Don't create PT_INTERP segment.
1198         * script-sections.cc
1199         (Script_sections::create_note_and_tls_segments): Add a .interp
1200         section to a PT_INTERP segment even if we have seen a
1201         --dynamic-linker option.
1202
1203 2011-06-18  Ian Lance Taylor  <iant@google.com>
1204
1205         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1206         merely because a non-PT_LOAD segment has a dynamic reloc.
1207
1208 2011-06-18  Ian Lance Taylor  <iant@google.com>
1209
1210         * layout.cc (Layout::finish_dynamic_section): Don't create
1211         DT_FLAGS entry if not needed.
1212
1213 2011-06-18  Ian Lance Taylor  <iant@google.com>
1214
1215         PR gold/12745
1216         * layout.cc (Layout::layout_eh_frame): Correct handling of
1217         writable .eh_frame section.
1218
1219 2011-06-17  Ian Lance Taylor  <iant@google.com>
1220
1221         PR gold/12893
1222         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1223         symbol is redefined with the exact same object and value.
1224
1225 2011-06-17  Ian Lance Taylor  <iant@google.com>
1226
1227         PR gold/12880
1228         * layout.h (class Layout): Add interp_segment_ field.
1229         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1230         (Layout::attach_allocated_section_to_segment): If making shared
1231         library, put .interp section in PT_INTERP segment.
1232         (Layout::finalize): Also call create_interp if -dynamic-linker
1233         option was used.
1234         (Layout::create_interp): Assert that there is no PT_INTERP
1235         segment.  If not using a SECTIONS clause, use make_output_section.
1236         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1237         * script-sections.cc
1238         (Script_sections::create_note_and_tls_segments): If making shared
1239         library, put .interp section in PT_INTERP segment.
1240
1241 2011-06-17  Ian Lance Taylor  <iant@google.com>
1242
1243         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1244         when making a shared library.
1245
1246 2011-06-17  Ian Lance Taylor  <iant@google.com>
1247
1248         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1249         parameter.  Change all callers.  Don't issue warning about PC32
1250         against locally defined symbol.
1251
1252 2011-06-16  Ian Lance Taylor  <iant@google.com>
1253
1254         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1255         occurs in same object.
1256
1257 2011-06-14  Alan Modra  <amodra@gmail.com>
1258
1259         * po/POTFILES.in: Regenerate.
1260
1261 2011-06-09  Ian Lance Taylor  <iant@google.com>
1262
1263         * script-sections.cc
1264         (Orphan_output_section::set_section_addresses): For a relocatable
1265         link set address to 0.
1266
1267 2011-06-09  Cary Coutant  <ccoutant@google.com>
1268
1269         PR gold/12804
1270         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1271         used with --compress-debug-sections.
1272         * gold/object.cc (Sized_relobj_file::do_layout): Report
1273         uncompressed size of compressed input sections.
1274
1275 2011-06-08  Cary Coutant  <ccoutant@google.com>
1276
1277         PR gold/12804
1278         * testsuite/two_file_test_2_v1.cc: Change initialization of
1279         v2 to keep it in .data.
1280
1281 2011-06-07  Cary Coutant  <ccoutant@google.com>
1282
1283         * common.cc (Symbol_table::do_allocate_commons_list): Call
1284         gold_fallback.
1285         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1286         (Errors::fallback): New function.
1287         (gold_fallback): New function.
1288         * errors.h (Errors::fallback): New function.
1289         * gold.cc (gold_exit): Change status parameter to enum; adjust
1290         all callers.
1291         (queue_initial_tasks): Call gold_fallback.
1292         * gold.h: Include cstdlib.
1293         (Exit_status): New enum type.
1294         (gold_exit): Change status parameter to enum.
1295         (gold_fallback): New function.
1296         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1297         (Layout::create_symtab_sections): Likewise.
1298         (Layout::create_shdrs): Likewise.
1299         * main.cc (main): Adjust call to gold_exit.
1300         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1301         (Output_data_got::add_got_entry_pair): Likewise.
1302         (Output_section::add_input_section): Likewise.
1303         (Output_section::add_output_section_data): Likewise.
1304         (Output_segment::set_section_list_addresses): Likewise.
1305         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1306
1307 2011-06-07  Cary Coutant  <ccoutant@google.com>
1308
1309         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1310         for incremental links.
1311         * output.cc (Output_segment::set_section_list_addresses): Remove
1312         FIXME and test for TLS or BSS.
1313
1314 2011-06-07  Cary Coutant  <ccoutant@google.com>
1315
1316         * testsuite/Makefile.am: Add incremental_copy_test,
1317         incremental_common_test_1.
1318         * testsuite/Makefile.in: Regenerate.
1319         * testsuite/common_test_1_v1.c: New source file.
1320         * testsuite/common_test_1_v2.c: New source file.
1321         * testsuite/copy_test_v1.cc: New source file.
1322
1323 2011-06-07  Cary Coutant  <ccoutant@google.com>
1324
1325         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1326         update, allocate common from bss section's free list.
1327         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1328         linker-defined symbols.
1329         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1330         Skip GOT and PLT entries that are no longer referenced.
1331         (Output_section_incremental_inputs::write_info_blocks): Mark
1332         linker-defined symbols.
1333         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1334         * output.cc (Output_section::allocate): New function.
1335         * output.h (Output_section::allocate): New function.
1336         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1337         linker-defined symbols.
1338         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1339         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1340         (Symbol::init_base_output_data): Likewise.
1341         (Symbol::init_base_output_segment): Likewise.
1342         (Symbol::init_base_constant): Likewise.
1343         (Sized_symbol::init_output_data): Likewise.
1344         (Sized_symbol::init_output_segment): Likewise.
1345         (Sized_symbol::init_constant): Likewise.
1346         (Symbol_table::do_define_in_output_data): Likewise.
1347         (Symbol_table::do_define_in_output_segment): Likewise.
1348         (Symbol_table::do_define_as_constant): Likewise.
1349         * symtab.h (Symbol::is_predefined): New function.
1350         (Symbol::init_base_output_data): Add is_predefined parameter.
1351         (Symbol::init_base_output_segment): Likewise.
1352         (Symbol::init_base_constant): Likewise.
1353         (Symbol::is_predefined_): New data member.
1354         (Sized_symbol::init_output_data): Add is_predefined parameter.
1355         (Sized_symbol::init_output_segment): Likewise.
1356         (Sized_symbol::init_constant): Likewise.
1357         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1358
1359 2011-06-07  Cary Coutant  <ccoutant@google.com>
1360
1361         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1362         instead of emit_copy_reloc.
1363         (Copy_relocs::emit_copy_reloc): Refactor.
1364         (Copy_relocs::make_copy_reloc): New function.
1365         (Copy_relocs::add_copy_reloc): Remove.
1366         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1367         section.
1368         (Copy_relocs::make_copy_reloc): New function.
1369         (Copy_relocs::add_copy_reloc): Remove.
1370         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1371         unchanged input files.
1372         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1373         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1374         Reserve BSS space for COPY relocations.
1375         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1376         (Output_section_incremental_inputs::write_info_blocks): Record
1377         whether a symbol is copied from a shared object.
1378         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1379         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1380         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1381         (Incremental_input_entry_reader::get_output_symbol_index): Add
1382         is_copy parameter.
1383         (Incremental_binary::emit_copy_relocs): New function.
1384         (Incremental_binary::do_emit_copy_relocs): New function.
1385         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1386         new data member.
1387         (Sized_incremental_binary::add_copy_reloc): New function.
1388         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1389         (Sized_incremental_binary::Copy_reloc): New struct.
1390         (Sized_incremental_binary::Copy_relocs): New typedef.
1391         (Sized_incremental_binary::copy_relocs_): New data member.
1392         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1393         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1394         * target.h (Sized_target::emit_copy_reloc): New function.
1395         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1396
1397 2011-06-02  Cary Coutant  <ccoutant@google.com>
1398
1399         PR gold/12163
1400         * gold/archive.cc (Archive::Archive): Initialize new data member.
1401         (Archive::include_all_members): Return if archive has already been
1402         included.
1403         * gold/archive.h (Archive::include_all_members_): New data member.
1404
1405 2011-06-02  Nick Clifton  <nickc@redhat.com>
1406
1407         * dynobj.h: Fix spelling mistake in comment.
1408         * output.cc: Likewise.
1409
1410 2011-05-31  Doug Kwan  <dougkwan@google.com>
1411             Asier Llano
1412
1413         PR gold/12826
1414         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1415         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1416         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1417         redundant arm_exidx_test.so.
1418         * testsuite/Makefile.in: Regenerate.
1419         (check_SCRIPTS): Add pr12826.sh
1420         (check_DATA): Add pr12826.stdout
1421         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1422         * testsuite/pr12826.sh: New file.
1423         * testsuite/pr12826_1.s: Ditto.
1424         * testsuite/pr12826_1.s: Ditto.
1425
1426 2011-05-30  Ian Lance Taylor  <iant@google.com>
1427
1428         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1429         sections.
1430
1431 2011-05-29  Ian Lance Taylor  <iant@google.com>
1432
1433         PR gold/12804
1434         * testsuite/Makefile.am: Use different file name for two_file_test
1435         temporary file for each incremental test.
1436         * testsuite/Makefile.in: Rebuild.
1437
1438 2011-05-29  Ian Lance Taylor  <iant@google.com>
1439
1440         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1441         binary input file is empty.
1442
1443 2011-05-27  Ian Lance Taylor  <iant@google.com>
1444
1445         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1446         (ver_test_9.so): Likewise.
1447         * testsuite/Makefile.in: Rebuild.
1448
1449 2011-05-26 Cary Coutant  <ccoutant@google.com>
1450
1451         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1452         * incremental.cc (Incremental_inputs::report_input_section): Fix
1453         comment, indentation.
1454         (Incremental_inputs::report_comdat_group): New function.
1455         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1456         of data for incremental input file entry.
1457         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1458         group count, COMDAT group signatures.
1459         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1460         an unchanged input file.
1461         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1462         Initialize new data member.
1463         (Incremental_object_entry::add_comdat_group): New function.
1464         (Incremental_object_entry::get_comdat_group_count): New function.
1465         (Incremental_object_entry::get_comdat_signature_key): New function.
1466         (Incremental_object_entry::groups_): New data member.
1467         (Incremental_inputs::report_comdat_group): New function.
1468         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1469         data for incremental input file entry.
1470         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1471         (Incremental_input_entry_reader::get_input_section): Adjust size of
1472         data for incremental input file entry.
1473         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1474         (Incremental_input_entry_reader::get_comdat_group_signature): New
1475         function.
1476         * object.cc (Sized_relobj::include_section_group): Report kept
1477         COMDAT groups for incremental links.
1478
1479 2011-05-24  David Meyer  <pdox@google.com>
1480
1481         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1482         with name parameter.  Add found_name parameter.
1483         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1484         * dirsearch.h (class Dirsearch): Update declaration.
1485
1486 2011-05-24  Ian Lance Taylor  <iant@google.com>
1487
1488         * archive.cc (Library_base::should_include_member): Pull in object
1489         from archive if it defines the entry symbol.
1490         * parameters.cc (Parameters::entry): New function.
1491         * parameters.h (class Parameters): Declare entry.
1492         * output.h (class Output_file_header): Remove entry_ field.
1493         * output.cc (Output_file_header::Output_file_header): Remove entry
1494         parameter.  Change all callers.
1495         (Output_file_header::entry): Use parameters->entry.
1496         * gold.cc (queue_middle_tasks): Likewise.
1497         * plugin.cc (Plugin_hook::run): Likewise.
1498
1499 2011-05-24 Cary Coutant  <ccoutant@google.com>
1500
1501         * gold.cc (queue_initial_tasks): Pass incremental base filename
1502         to Output_file::open_base_file; don't print error message.
1503         * incremental-dump.cc (main): Adjust call to
1504         Output_file::open_for_modification.
1505         * incremental-dump.cc (main): Likewise.
1506         * incremental.cc (Incremental_inputs::report_command_line):
1507         Ignore --incremental-base option when comparing command lines.
1508         Ignore parameter when given as separate argument.
1509         * options.h (class General_options): Add --incremental-base.
1510         * output.cc (Output_file::Output_file):
1511         (Output_file::open_base_file): Add base_name and writable parameters;
1512         read base file into new file; print error message here.
1513         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1514         callers.
1515         * output.h (Output_file::open_for_modification): Rename to...
1516         (Output_file::open_base_file): ...this; add base_name and
1517         writable parameters; adjust all callers.
1518         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1519         callers.
1520         * testsuite/Makefile.am (incremental_test_4): Test
1521         --incremental-base.
1522         * testsuite/Makefile.in: Regenerate.
1523
1524 2011-05-24 Cary Coutant  <ccoutant@google.com>
1525
1526         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1527         incremental_test_4.
1528         * testsuite/Makefile.in: Regenerate.
1529         * testsuite/two_file_test_1_v1.cc: New test source file.
1530         * testsuite/two_file_test_1b_v1.cc: New test source file.
1531         * testsuite/two_file_test_2_v1.cc: New test source file.
1532
1533 2011-05-24 Cary Coutant  <ccoutant@google.com>
1534
1535         * dynobj.h (Dynobj::do_dynobj): New function.
1536         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1537         flag and soname for shared objects.
1538         * incremental.cc (Incremental_inputs::report_object): Make
1539         either Incremental_object_entry or Incremental_dynobj_entry; add
1540         soname to string table.
1541         (Incremental_inputs::report_input_section): Add assertion.
1542         (Output_section_incremental_inputs::set_final_data_size): Adjust
1543         type of input file entry for shared libraries; adjust size of
1544         shared library info entry.
1545         (Output_section_incremental_inputs::write_input_files): Write
1546         as_needed flag for shared libraries.
1547         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1548         of input file entry for shared libraries; write soname.
1549         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1550         soname from incremental info.
1551         * incremental.h (enum Incremental_input_flags): Add
1552         INCREMENTAL_INPUT_AS_NEEDED.
1553         (Incremental_input_entry::Incremental_input_entry): Initialize new
1554         data member.
1555         (Incremental_input_entry::set_as_needed): New function.
1556         (Incremental_input_entry::as_needed): New function.
1557         (Incremental_input_entry::do_dynobj_entry): New function.
1558         (Incremental_input_entry::as_needed_): New data member.
1559         (Incremental_object_entry::Incremental_object_entry): Don't check
1560         for shared library.
1561         (Incremental_object_entry::do_type): Likewise.
1562         (class Incremental_dynobj_entry): New class.
1563         (Incremental_input_entry_reader::as_needed): New function.
1564         (Incremental_input_entry_reader::get_soname): New function.
1565         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1566         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1567         size of shared library info entry.
1568         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1569         incremental link when adding DT_NEEDED entries.
1570         * object.h (Object::Object): Initialize new data member.
1571         (Object::dynobj): New function.
1572         (Object::set_as_needed): New function.
1573         (Object::as_needed): New function.
1574         (Object::do_dynobj): New function.
1575         (Object::as_needed_): New data member.
1576
1577 2011-05-24 Cary Coutant  <ccoutant@google.com>
1578
1579         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1580         info; adjust display of GOT entries.
1581         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1582         vector of input objects; remove file_status_.
1583         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1584         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1585         got_plt reader; call target hooks to reserve GOT entries.
1586         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1587         of input file info header and GOT info entry.
1588         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1589         relocation info.
1590         (Got_plt_view_info::got_descriptor): Remove.
1591         (Got_plt_view_info::sym_index): New data member.
1592         (Got_plt_view_info::input_index): New data member.
1593         (Local_got_offset_visitor::visit): Write input file index.
1594         (Global_got_offset_visitor::visit): Write 0 for input file index.
1595         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1596         with sym_index and input_index.
1597         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1598         incremental info GOT entry; replace got_descriptor with input_index.
1599         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1600         map from input file index to object.
1601         (Sized_relobj_incr::do_layout): Replace direct data member reference
1602         with accessor function.
1603         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1604         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1605         Adjust size of input file info header.
1606         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1607         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1608         (Incremental_input_entry_reader::get_input_section): Adjust size of
1609         input file info header.
1610         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1611         of incremental info GOT entry.
1612         (Incremental_got_plt_reader::get_got_desc): Remove.
1613         (Incremental_got_plt_reader::get_got_symndx): New function.
1614         (Incremental_got_plt_reader::get_got_input_index): New function.
1615         (Sized_incremental_binary::Sized_incremental_binary): Remove
1616         file_status_; add input_objects_.
1617         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1618         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1619         (Sized_incremental_binary::file_is_unchanged): Remove.
1620         (Sized_incremental_binary::set_input_object): New function.
1621         (Sized_incremental_binary::input_object): New function.
1622         (Sized_incremental_binary::file_status_): Remove.
1623         (Sized_incremental_binary::input_objects_): New data member.
1624         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1625         references.
1626         (Sized_relobj_incr::invalid_address): Move to base class.
1627         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1628         class.
1629         (Sized_relobj_incr::do_output_section_offset): Likewise.
1630         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1631         (Sized_relobj_incr::section_offsets_): Likewise.
1632         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1633         function.
1634         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1635         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1636         with accessor function.
1637         (Sized_relobj_file::do_layout): Likewise.
1638         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1639         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1640         (Sized_relobj_file::compute_final_local_value): Replace refs to
1641         section_offsets_ with accessor function.
1642         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1643         * object.h (Relobj::Relobj): Initialize new data members.
1644         (Relobj::add_dyn_reloc): New function.
1645         (Relobj::first_dyn_reloc): New function.
1646         (Relobj::dyn_reloc_count): New function.
1647         (Relobj::first_dyn_reloc_): New data member.
1648         (Relobj::dyn_reloc_count_): New data member.
1649         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1650         references.
1651         (Sized_relobj::Address): New typedef.
1652         (Sized_relobj::invalid_address): Move here from child class.
1653         (Sized_relobj::Sized_relobj): Initialize new data members.
1654         (Sized_relobj::sized_relobj): New function.
1655         (Sized_relobj::is_output_section_offset_invalid): Move here from
1656         child class.
1657         (Sized_relobj::get_output_section_offset): Likewise.
1658         (Sized_relobj::local_has_got_offset): Likewise.
1659         (Sized_relobj::local_got_offset): Likewise.
1660         (Sized_relobj::set_local_got_offset): Likewise.
1661         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1662         (Sized_relobj::clear_got_offsets): New function.
1663         (Sized_relobj::section_offsets): Move here from child class.
1664         (Sized_relobj::do_output_section_offset): Likewise.
1665         (Sized_relobj::do_set_section_offset): Likewise.
1666         (Sized_relobj::Local_got_offsets): Likewise.
1667         (Sized_relobj::local_got_offsets_): Likewise.
1668         (Sized_relobj::section_offsets_): Likewise.
1669         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1670         references.
1671         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1672         class.
1673         (Sized_relobj_file::sized_relobj): New function
1674         (Sized_relobj_file::local_has_got_offset): Move to base class.
1675         (Sized_relobj_file::local_got_offset): Likewise.
1676         (Sized_relobj_file::set_local_got_offset): Likewise.
1677         (Sized_relobj_file::get_output_section_offset): Likewise.
1678         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1679         (Sized_relobj_file::do_output_section_offset): Likewise.
1680         (Sized_relobj_file::do_set_section_offset): Likewise.
1681         (Sized_relobj_file::Local_got_offsets): Likewise.
1682         (Sized_relobj_file::local_got_offsets_): Likewise.
1683         (Sized_relobj_file::section_offsets_): Likewise.
1684         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1685         (all constructors).
1686         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1687         (Output_reloc::get_symbol_index): Likewise.
1688         (Output_reloc::local_section_offset): Likewise.
1689         (Output_reloc::get_address): Likewise.
1690         (Output_reloc::symbol_value): Likewise.
1691         (Output_data_got::reserve_slot): Move to class definition.
1692         (Output_data_got::reserve_local): New function.
1693         (Output_data_got::reserve_slot_for_global): Remove.
1694         (Output_data_got::reserve_global): New function.
1695         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1696         (all constructors, two instantiations).
1697         (Output_reloc::get_relobj): New function (two instantiations).
1698         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1699         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1700         (Output_data_reloc::add_global): Adjust type of relobj.
1701         (Output_data_reloc::add_global_relative): Likewise.
1702         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1703         (Output_data_reloc::add_local): Likewise.
1704         (Output_data_reloc::add_local_relative): Likewise.
1705         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1706         (Output_data_reloc::add_local_section): Likewise.
1707         (Output_data_reloc::add_output_section): Likewise.
1708         (Output_data_reloc::add_absolute): Likewise.
1709         (Output_data_reloc::add_target_specific): Likewise.
1710         (Output_data_got::reserve_slot): Move definition here.
1711         (Output_data_got::reserve_local): New function.
1712         (Output_data_got::reserve_global): New function.
1713         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1714         section_offsets_ with accessor function.
1715         (Sized_relobj_file::write_sections): Likewise.
1716         (Sized_relobj_file::do_relocate_sections): Likewise.
1717         * target.h (Sized_target::reserve_local_got_entry): New function.
1718         (Sized_target::reserve_global_got_entry): New function.
1719         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1720         (Target_x86_64::reserve_global_got_entry): New function.
1721         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1722
1723 2011-05-23 Cary Coutant  <ccoutant@google.com>
1724
1725         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1726         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1727         bit when checking got_type.
1728         * incremental.cc (Sized_incremental_binary::setup_readers):
1729         Store symbol table and string table locations; initialize bit vector
1730         of file status flags.
1731         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1732         unchanged files.
1733         (Sized_incremental_binary::do_process_got_plt): New function.
1734         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1735         (Output_section_incremental_inputs::set_final_data_size): Record
1736         file index for each input file.
1737         (Output_section_incremental_inputs::write_got_plt): Store file index
1738         instead of input entry offset for each GOT entry.
1739         * incremental.h
1740         (Incremental_input_entry::Incremental_input_entry): Initialize new
1741         data member.
1742         (Incremental_input_entry::set_offset): Store file index.
1743         (Incremental_input_entry::get_file_index): New function.
1744         (Incremental_input_entry::file_index_): New data member.
1745         (Incremental_binary::process_got_plt): New function.
1746         (Incremental_binary::do_process_got_plt): New function.
1747         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1748         data members.
1749         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1750         (Sized_incremental_binary::set_file_is_unchanged): New function.
1751         (Sized_incremental_binary::file_is_unchanged): New function.
1752         (Sized_incremental_binary::do_process_got_plt): New function.
1753         (Sized_incremental_binary::file_status_): New data member.
1754         (Sized_incremental_binary::main_symtab_loc_): New data member.
1755         (Sized_incremental_binary::main_strtab_loc_): New data member.
1756         * output.cc (Output_data_got::Got_entry::write): Add case
1757         RESERVED_CODE.
1758         (Output_data_got::add_global): Call add_got_entry.
1759         (Output_data_got::add_global_plt): Likewise.
1760         (Output_data_got::add_global_with_rel): Likewise.
1761         (Output_data_got::add_global_with_rela): Likewise.
1762         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1763         (Output_data_got::add_global_pair_with_rela): Likewise.
1764         (Output_data_got::add_local): Call add_got_entry.
1765         (Output_data_got::add_local_plt): Likewise.
1766         (Output_data_got::add_local_with_rel): Likewise.
1767         (Output_data_got::add_local_with_rela): Likewise.
1768         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1769         (Output_data_got::add_local_pair_with_rela): Likewise.
1770         (Output_data_got::reserve_slot): New function.
1771         (Output_data_got::reserve_slot_for_global): New function.
1772         (Output_data_got::add_got_entry): New function.
1773         (Output_data_got::add_got_entry_pair): New function.
1774         (Output_section::add_output_section_data): Edit FIXME.
1775         * output.h
1776         (Output_section_data_build::Output_section_data_build): New
1777         constructor with size parameter.
1778         (Output_data_space::Output_data_space): Likewise.
1779         (Output_data_got::Output_data_got): Initialize new data member; new
1780         constructor with size parameter.
1781         (Output_data_got::add_constant): Call add_got_entry.
1782         (Output_data_got::reserve_slot): New function.
1783         (Output_data_got::reserve_slot_for_global): New function.
1784         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1785         (Output_data_got::add_got_entry): New function.
1786         (Output_data_got::add_got_entry_pair): New function.
1787         (Output_data_got::free_list_): New data member.
1788         * target.h (Sized_target::init_got_plt_for_update): New function.
1789         (Sized_target::register_global_plt_entry): New function.
1790         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1791         Initialize new data member; call init; add constructor with PLT count.
1792         (Output_data_plt_x86_64::init): New function.
1793         (Output_data_plt_x86_64::add_relocation): New function.
1794         (Output_data_plt_x86_64::reserve_slot): New function.
1795         (Output_data_plt_x86_64::free_list_): New data member.
1796         (Target_x86_64::init_got_plt_for_update): New function.
1797         (Target_x86_64::register_global_plt_entry): New function.
1798         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1799         incremental updates.
1800         (Output_data_plt_x86_64::add_relocation): New function.
1801         * testsuite/object_unittest.cc (Object_test): Set default options.
1802
1803 2011-05-16  Ian Lance Taylor  <iant@google.com>
1804
1805         * options.h (class General_options): Make -i a synonym for -r.
1806
1807 2011-05-16  Ian Lance Taylor  <iant@google.com>
1808
1809         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1810
1811 2011-05-10 Cary Coutant  <ccoutant@google.com>
1812
1813         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1814         strip_all (-s).
1815
1816 2011-05-06  Ian Lance Taylor  <iant@google.com>
1817
1818         * layout.cc (Layout::layout): If the output section flags change,
1819         update the ordering.
1820
1821 2011-04-25 Cary Coutant  <ccoutant@google.com>
1822
1823         * incremental-dump.cc (dump_incremental_inputs): Print local
1824         symbol info for each input file.
1825         * incremental.cc
1826         (Output_section_incremental_inputs::set_final_data_size): Add local
1827         symbol info to input file entries in incremental info.
1828         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1829         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1830         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1831         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1832         implementation.
1833         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1834         (Sized_incr_relobj::do_relocate): Write the local symbols.
1835         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1836         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1837         Adjust size of input file header.
1838         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1839         (Incremental_inputs_reader::get_local_symbol_count): New function.
1840         (Incremental_inputs_reader::get_input_section): Adjust size of input
1841         file header.
1842         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1843         (Sized_incr_relobj::This): New typedef.
1844         (Sized_incr_relobj::sym_size): New const data member.
1845         (Sized_incr_relobj::Local_symbol): New struct.
1846         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1847         (Sized_incr_relobj::do_local_symbol_offset): New function.
1848         (Sized_incr_relobj::local_symbol_count_): New data member.
1849         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1850         (Sized_incr_relobj::local_symbol_index_): New data member.
1851         (Sized_incr_relobj::local_symbol_offset_): New data member.
1852         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1853         (Sized_incr_relobj::local_symbols_): New data member.
1854         * object.h (Relobj::output_local_symbol_count): New function.
1855         (Relobj::local_symbol_offset): New function.
1856         (Relobj::do_output_local_symbol_count): New function.
1857         (Relobj::do_local_symbol_offset): New function.
1858         (Sized_relobj::do_output_local_symbol_count): New function.
1859         (Sized_relobj::do_local_symbol_offset): New function.
1860
1861 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1862
1863         * descriptors.cc (set_close_on_exec): New function.
1864         (Descriptors::open): Use set_close_on_exec.
1865         * output.cc (S_ISLNK): Define if not defined.
1866
1867 2011-04-22 Cary Coutant  <ccoutant@google.com>
1868
1869         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1870         global symbol map.
1871         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1872         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1873         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1874         relocations.
1875         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1876         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1877         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1878         * incremental.h
1879         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1880         function.
1881         (Incremental_binary::apply_incremental_relocs): New function.
1882         (Incremental_binary::do_apply_incremental_relocs): New function.
1883         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1884         data member.
1885         (Sized_incremental_binary::add_global_symbol): New function.
1886         (Sized_incremental_binary::global_symbol): New function.
1887         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1888         (Sized_incremental_binary::symbol_map_): New data member.
1889         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1890         * target.h (Sized_target::apply_relocation): New function.
1891         * target-reloc.h (apply_relocation): New function.
1892         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1893
1894 2011-04-22  Doug Kwan  <dougkwan@google.com>
1895
1896         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1897         flag of a SHT_ARM_EXIDX section.
1898         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1899         * testsuite/Makefile.in: Regenerate.
1900         * testsuite/arm_exidx_test.s: New file.
1901         * testsuite/arm_exidx_test.sh: Same.
1902
1903 2011-04-20 Cary Coutant  <ccoutant@google.com>
1904
1905         PR gold/12689
1906         * archive.h (Incremental_archive_entry::Archive_member):
1907         Initialize arg_serial_ (second constructor).
1908
1909 2011-04-17  Ian Lance Taylor  <iant@google.com>
1910
1911         * object.cc (Relocate_info::location): Simplify location string.
1912         * errors.cc (Errors::error_at_location): Don't print program
1913         name.
1914         (Errors::warning_at_location): Likewise.
1915         (Errors::undefined_symbol): Likewise.
1916         * testsuite/debug_msg.sh: Update accordingly.
1917
1918 2011-04-14 Cary Coutant  <ccoutant@google.com>
1919
1920         * gold/layout.cc (Layout::symtab_section_offset): New function.
1921         * gold/layout.h (Layout::symtab_section_offset): New function.
1922         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1923
1924 2011-04-12  Ian Lance Taylor  <iant@google.com>
1925
1926         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1927         with MREMAP_MAYMOVE.
1928         * output.h (class Output_file): Add map_is_allocated_ field.
1929         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1930         not available, provide stubs.  If mremap is not available, #define
1931         it to gold_mremap.
1932         (MREMAP_MAYMOVE): Define if not defined.
1933         (Output_file::Output_file): Initialize map_is_allocated_.
1934         (Output_file::resize): Check map_is_allocated_.
1935         (Output_file::map_anonymous): If mmap fails, use malloc.
1936         (Output_file::unmap): Don't do anything for an anonymous map.
1937         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1938         is not available, provide stubs.
1939         (File_read::View::~View): Use free rather than delete[].
1940         (File_read::make_view): Use malloc rather than new[].  If mmap
1941         fails, use malloc.
1942         (File_read::find_or_make_view): Use malloc rather than new[].
1943         * gold.h: Remove HAVE_REMAP code.
1944         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1945         exists.  Rename mremap to gold_mremap.  If mmap is not available
1946         don't do anything.
1947         * configure, config.in: Rebuild.
1948
1949 2011-04-11  Ian Lance Taylor  <iant@google.com>
1950
1951         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1952         initialize local variable v.
1953
1954 2011-04-11  Cary Coutant  <ccoutant@google.com>
1955
1956         * archive.cc (Archive::include_member): Adjust call to
1957         report_object.
1958         (Add_archive_symbols::run): Track argument serial numbers.
1959         (Lib_group::include_member): Likewise.
1960         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1961         * archive.h (Incremental_archive_entry::Archive_member):
1962         Initialize arg_serial_.
1963         (Archive_member::arg_serial_): New data member.
1964         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1965         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1966         incremental link.
1967         (Sized_dynobj::do_for_all_local_got_entries): New function.
1968         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1969         function.
1970         * fileread.cc (get_mtime): New function.
1971         * fileread.h (get_mtime): New function.
1972         * gold.cc (queue_initial_tasks): Check for incremental update.
1973         (process_incremental_input): New function.
1974         (queue_middle_tasks): Don't force valid target for incremental
1975         update.
1976         * incremental-dump.cc (find_input_containing_global): Adjust
1977         size of symbol info entry.
1978         (dump_incremental_inputs): Dump argument serial number and
1979         in_system_directory flag; bias shndx by 1; print symbol names
1980         when dumping per-file symbol lists; use new symbol info readers.
1981         * incremental.cc
1982         (Output_section_incremental_inputs:update_data_size): New function.
1983         (Sized_incremental_binary::setup_readers): Setup input readers
1984         for each input file; build maps for files added from libraries
1985         and scripts.
1986         (Sized_incremental_binary::check_input_args): New function.
1987         (Sized_incremental_binary::do_check_inputs): Build map of argument
1988         serial numbers to input arguments.
1989         (Sized_incremental_binary::do_file_has_changed): Rename
1990         do_file_is_unchanged to this; compare file modification times.
1991         (Sized_incremental_binary::do_init_layout): New function.
1992         (Sized_incremental_binary::do_reserve_layout): New function.
1993         (Sized_incremental_binary::do_get_input_reader): Remove.
1994         (Sized_incremental_binary::get_symtab_view): New function.
1995         (Incremental_checker::can_incrementally_link_output_file): Remove.
1996         (Incremental_inputs::report_command_line): Exclude --debug options.
1997         (Incremental_inputs::report_archive_begin): Add parameter; track
1998         argument serial numbers; don't put input file entry for archive
1999         before archive members.
2000         (Incremental_inputs::report_archive_end): Put input file entry
2001         for archive after archive members.
2002         (Incremental_inputs::report_object): Add parameter; track argument
2003         serial numbers and in_system_directory flag.
2004         (Incremental_inputs::report_script): Add parameter; track argument
2005         serial numbers.
2006         (Output_section_incremental_inputs::set_final_data_size): Adjust
2007         size of symbol info entry; check for forwarding symbols.
2008         (Output_section_incremental_inputs::write_input_files): Write
2009         in_system_directory flag and argument serial number.
2010         (Output_section_incremental_inputs::write_info_blocks): Map section
2011         indices between incremental info and original input file; store
2012         input section index for each symbol.
2013         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2014         change operator() to visit().
2015         (class Global_got_offset_visitor): Likewise.
2016         (class Global_symbol_visitor_got_plt):
2017         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2018         classes.
2019         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2020         (Sized_incr_relobj::do_read_symbols): New function.
2021         (Sized_incr_relobj::do_layout): New function.
2022         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2023         (Sized_incr_relobj::do_add_symbols): New function.
2024         (Sized_incr_relobj::do_should_include_member): New function.
2025         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2026         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2027         (Sized_incr_relobj::do_section_size): New function.
2028         (Sized_incr_relobj::do_section_name): New function.
2029         (Sized_incr_relobj::do_section_contents): New function.
2030         (Sized_incr_relobj::do_section_flags): New function.
2031         (Sized_incr_relobj::do_section_entsize): New function.
2032         (Sized_incr_relobj::do_section_address): New function.
2033         (Sized_incr_relobj::do_section_type): New function.
2034         (Sized_incr_relobj::do_section_link): New function.
2035         (Sized_incr_relobj::do_section_info): New function.
2036         (Sized_incr_relobj::do_section_addralign): New function.
2037         (Sized_incr_relobj::do_initialize_xindex): New function.
2038         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2039         (Sized_incr_relobj::do_read_relocs): New function.
2040         (Sized_incr_relobj::do_gc_process_relocs): New function.
2041         (Sized_incr_relobj::do_scan_relocs): New function.
2042         (Sized_incr_relobj::do_count_local_symbols): New function.
2043         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2044         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2045         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2046         (Sized_incr_relobj::do_relocate): New function.
2047         (Sized_incr_relobj::do_set_section_offset): New function.
2048         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2049         (Sized_incr_dynobj::do_read_symbols): New function.
2050         (Sized_incr_dynobj::do_layout): New function.
2051         (Sized_incr_dynobj::do_add_symbols): New function.
2052         (Sized_incr_dynobj::do_should_include_member): New function.
2053         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2054         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2055         (Sized_incr_dynobj::do_section_size): New function.
2056         (Sized_incr_dynobj::do_section_name): New function.
2057         (Sized_incr_dynobj::do_section_contents): New function.
2058         (Sized_incr_dynobj::do_section_flags): New function.
2059         (Sized_incr_dynobj::do_section_entsize): New function.
2060         (Sized_incr_dynobj::do_section_address): New function.
2061         (Sized_incr_dynobj::do_section_type): New function.
2062         (Sized_incr_dynobj::do_section_link): New function.
2063         (Sized_incr_dynobj::do_section_info): New function.
2064         (Sized_incr_dynobj::do_section_addralign): New function.
2065         (Sized_incr_dynobj::do_initialize_xindex): New function.
2066         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2067         (make_sized_incremental_object): New function.
2068         (Incremental_library::copy_unused_symbols): New function.
2069         (Incremental_library::do_for_all_unused_symbols): New function.
2070         * incremental.h (enum Incremental_input_flags): New type.
2071         (class Incremental_checker): Remove.
2072         (Incremental_input_entry::Incremental_input_entry): Add argument
2073         serial number.
2074         (Incremental_input_entry::arg_serial): New function.
2075         (Incremental_input_entry::set_is_in_system_directory): New function.
2076         (Incremental_input_entry::is_in_system_directory): New function.
2077         (Incremental_input_entry::arg_serial_): New data member.
2078         (Incremental_input_entry::is_in_system_directory_): New data member.
2079         (class Script_info): Move here from script.h.
2080         (Script_info::Script_info): Add filename parameter.
2081         (Script_info::filename): New function.
2082         (Script_info::filename_): New data member.
2083         (Incremental_script_entry::Incremental_script_entry): Add argument
2084         serial number.
2085         (Incremental_object_entry::Incremental_object_entry): Likewise.
2086         (Incremental_object_entry::add_input_section): Build list of input
2087         sections with map to original shndx.
2088         (Incremental_object_entry::get_input_section_index): New function.
2089         (Incremental_object_entry::shndx_): New data member.
2090         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2091         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2092         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2093         serial number.
2094         (Incremental_inputs::report_archive_begin): Likewise.
2095         (Incremental_inputs::report_object): Likewise.
2096         (Incremental_inputs::report_script): Likewise.
2097         (class Incremental_global_symbol_reader): New class.
2098         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2099         and store flags and input file type.
2100         (Incremental_input_entry_reader::arg_serial): New function.
2101         (Incremental_input_entry_reader::type): Extract type from flags.
2102         (Incremental_input_entry_reader::is_in_system_directory): New function.
2103         (Incremental_input_entry_reader::get_input_section_count): Call
2104         accessor function for type.
2105         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2106         function for type; adjust size of global symbol entry.
2107         (Incremental_input_entry_reader::get_global_symbol_count): Call
2108         accessor function for type.
2109         (Incremental_input_entry_reader::get_object_count): Likewise.
2110         (Incremental_input_entry_reader::get_object_offset): Likewise.
2111         (Incremental_input_entry_reader::get_member_count): Likewise.
2112         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2113         (Incremental_input_entry_reader::get_member_offset): Likewise.
2114         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2115         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2116         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2117         (Incremental_input_entry_reader::get_global_symbol_reader): New
2118         function.
2119         (Incremental_input_entry_reader::get_output_symbol_index): New
2120         function.
2121         (Incremental_input_entry_reader::type_): Remove.
2122         (Incremental_input_entry_reader::flags_): New data member.
2123         (Incremental_inputs_reader::input_file_offset): New function.
2124         (Incremental_inputs_reader::input_file_index): New function.
2125         (Incremental_inputs_reader::input_file): Call input_file_offset.
2126         (Incremental_inputs_reader::input_file_at_offset): New function.
2127         (Incremental_relocs_reader::get_r_type): Reformat.
2128         (Incremental_relocs_reader::get_r_shndx): Reformat.
2129         (Incremental_relocs_reader::get_r_offset): Reformat.
2130         (Incremental_relocs_reader::data): New function.
2131         (Incremental_binary::Incremental_binary): Initialize new data members.
2132         (Incremental_binary::check_inputs): Add cmdline parameter.
2133         (Incremental_binary::file_is_unchanged): Remove.
2134         (Input_reader::arg_serial): New function.
2135         (Input_reader::get_unused_symbol_count): New function.
2136         (Input_reader::get_unused_symbol): New function.
2137         (Input_reader::do_arg_serial): New function.
2138         (Input_reader::do_get_unused_symbol_count): New function.
2139         (Input_reader::do_get_unused_symbol): New function.
2140         (Incremental_binary::input_file_count): New function.
2141         (Incremental_binary::get_input_reader): Change signature to use
2142         index instead of filename.
2143         (Incremental_binary::file_has_changed): New function.
2144         (Incremental_binary::get_input_argument): New function.
2145         (Incremental_binary::get_library): New function.
2146         (Incremental_binary::get_script_info): New function.
2147         (Incremental_binary::init_layout): New function.
2148         (Incremental_binary::reserve_layout): New function.
2149         (Incremental_binary::output_file): New function.
2150         (Incremental_binary::do_check_inputs): New function.
2151         (Incremental_binary::do_file_is_unchanged): Remove.
2152         (Incremental_binary::do_file_has_changed): New function.
2153         (Incremental_binary::do_init_layout): New function.
2154         (Incremental_binary::do_reserve_layout): New function.
2155         (Incremental_binary::do_input_file_count): New function.
2156         (Incremental_binary::do_get_input_reader): Change signature.
2157         (Incremental_binary::input_args_map_): New data member.
2158         (Incremental_binary::library_map_): New data member.
2159         (Incremental_binary::script_map_): New data member.
2160         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2161         new data members.
2162         (Sized_incremental_binary::output_section): New function.
2163         (Sized_incremental_binary::inputs_reader): Add const.
2164         (Sized_incremental_binary::symtab_reader): Add const.
2165         (Sized_incremental_binary::relocs_reader): Add const.
2166         (Sized_incremental_binary::got_plt_reader): Add const.
2167         (Sized_incremental_binary::get_symtab_view): New function.
2168         (Sized_incremental_binary::Inputs_reader): New typedef.
2169         (Sized_incremental_binary::Input_entry_reader): New typedef.
2170         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2171         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2172         (Sized_incremental_binary::do_file_has_changed): New function.
2173         (Sized_incremental_binary::do_init_layout): New function.
2174         (Sized_incremental_binary::do_reserve_layout): New function.
2175         (Sized_input_reader::Inputs_reader): Remove.
2176         (Sized_input_reader::Input_entry_reader): Remove.
2177         (Sized_input_reader::do_arg_serial): New function.
2178         (Sized_input_reader::do_get_unused_symbol_count): New function.
2179         (Sized_input_reader::do_get_unused_symbol): New function.
2180         (Sized_incremental_binary::do_input_file_count): New function.
2181         (Sized_incremental_binary::do_get_input_reader): Change signature;
2182         use index instead of filename.
2183         (Sized_incremental_binary::section_map_): New data member.
2184         (Sized_incremental_binary::input_entry_readers_): New data member.
2185         (class Sized_incr_relobj): New class.
2186         (class Sized_incr_dynobj): New class.
2187         (make_sized_incremental_object): New function.
2188         (class Incremental_library): New class.
2189         * layout.cc (Free_list::num_lists): New static data member.
2190         (Free_list::num_nodes): New static data member.
2191         (Free_list::num_removes): New static data member.
2192         (Free_list::num_remove_visits): New static data member.
2193         (Free_list::num_allocates): New static data member.
2194         (Free_list::num_allocate_visits): New static data member.
2195         (Free_list::init): New function.
2196         (Free_list::remove): New function.
2197         (Free_list::allocate): New function.
2198         (Free_list::dump): New function.
2199         (Free_list::print_stats): New function.
2200         (Layout_task_runner::run): Resize output file for incremental updates.
2201         (Layout::Layout): Initialize new data members.
2202         (Layout::set_incremental_base): New function.
2203         (Layout::init_fixed_output_section): New function.
2204         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2205         incremental updates.
2206         (Layout::create_gold_note): Do not create gold note section for
2207         incremental updates.
2208         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2209         for incremental updates.
2210         (Layout::set_section_offsets): For incremental updates, allocate space
2211         from free list.
2212         (Layout::create_symtab_sections): Layout with offsets relative to
2213         start of section; for incremental updates, allocate space from free
2214         list.
2215         (Layout::create_shdrs): For incremental updates, allocate space from
2216         free list.
2217         (Layout::finish_dynamic_section): For incremental updates, do not
2218         check --as-needed (fixed in subsequent patch).
2219         * layout.h (class Free_list): New class.
2220         (Layout::set_incremental_base): New function.
2221         (Layout::incremental_base): New function.
2222         (Layout::init_fixed_output_section): New function.
2223         (Layout::allocate): New function.
2224         (Layout::incremental_base_): New data member.
2225         (Layout::free_list_): New data member.
2226         * main.cc (main): Print Free_list statistics.
2227         * object.cc (Relobj::finalize_incremental_relocs): Add
2228         clear_counts parameter; clear counts only when clear_counts is set.
2229         (Sized_relobj::Sized_relobj): Initialize new base class.
2230         (Sized_relobj::do_layout): Don't report special sections.
2231         (Sized_relobj::do_for_all_local_got_entries): New function.
2232         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2233         symtab_off to all symbol table offsets.
2234         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2235         * object.h (class Got_offset_list): Move to top of file.
2236         (Object::Object): Allow case where input_file == NULL.
2237         (Object::~Object): Likewise.
2238         (Object::input_file): Assert that input_file != NULL.
2239         (Object::lock): Allow case where input_file == NULL.
2240         (Object::unlock): Likewise.
2241         (Object::is_locked): Likewise.
2242         (Object::token): Likewise.
2243         (Object::release): Likewise.
2244         (Object::is_incremental): New function.
2245         (Object::get_mtime): New function.
2246         (Object::for_all_local_got_entries): New function.
2247         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2248         (Object::set_is_in_system_directory): New function.
2249         (Object::is_in_system_directory): New function.
2250         (Object::do_is_incremental): New function.
2251         (Object::do_get_mtime): New function.
2252         (Object::do_for_all_local_got_entries): New function.
2253         (Object::is_in_system_directory_): New data member.
2254         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2255         (class Sized_relobj_base): New class.
2256         (class Sized_relobj): Derive from Sized_relobj_base.
2257         (class Sized_relobj::Symbols): Redeclare from base class.
2258         (class Sized_relobj::local_got_offset_list): Remove.
2259         (class Sized_relobj::Output_sections): Redeclare from base class.
2260         (class Sized_relobj::do_for_all_local_got_entries): New function.
2261         (class Sized_relobj::write_local_symbols): Add offset parameter.
2262         (class Sized_relobj::local_symbol_offset_): Update comment.
2263         (class Sized_relobj::local_dynsym_offset_): Update comment.
2264         * options.cc (Input_arguments::add_file): Remove const.
2265         * options.h (Input_file_argument::Input_file_argument):
2266         Initialize arg_serial_ (all constructors).
2267         (Input_file_argument::set_arg_serial): New function.
2268         (Input_file_argument::arg_serial): New function.
2269         (Input_file_argument::arg_serial_): New data member.
2270         (Input_arguments::Input_arguments): Initialize file_count_.
2271         (Input_arguments::add_file): Remove const.
2272         (Input_arguments::number_of_input_files): New function.
2273         (Input_arguments::file_count_): New data member.
2274         (Command_line::number_of_input_files): Call
2275         Input_arguments::number_of_input_files.
2276         * output.cc (Output_segment_headers::Output_segment_headers):
2277         Set current size.
2278         (Output_section::Input_section::current_data_size): New function.
2279         (Output_section::Output_section): Initialize new data members.
2280         (Output_section::add_input_section): Don't do merge sections for
2281         an incremental link; allocate space from free list for an
2282         incremental update.
2283         (Output_section::add_output_section_data): Allocate space from
2284         free list for an incremental update.
2285         (Output_section::update_data_size): New function.
2286         (Output_section::set_fixed_layout): New function.
2287         (Output_section::reserve): New function.
2288         (Output_segment::set_section_addresses): Remove const.
2289         (Output_segment::set_section_list_addresses): Remove const; allocate
2290         space from free list for an incremental update.
2291         (Output_segment::set_offset): Adjust size of RELRO segment for an
2292         incremental update.
2293         * output.h (Output_data::current_data_size): Move here from
2294         child classes.
2295         (Output_data::pre_finalize_data_size): New function.
2296         (Output_data::update_data_size): New function.
2297         (Output_section_headers::update_data_size): new function.
2298         (Output_section_data_build::current_data_size): Move to Output_data.
2299         (Output_data_strtab::update_data_size): New function.
2300         (Output_section::current_data_size): Move to Output_data.
2301         (Output_section::set_fixed_layout): New function.
2302         (Output_section::has_fixed_layout): New function.
2303         (Output_section::reserve): New function.
2304         (Output_section::update_data_size): New function.
2305         (Output_section::has_fixed_layout_): New data member.
2306         (Output_section::free_list_): New data member.
2307         (Output_segment::set_section_addresses): Remove const.
2308         (Output_segment::set_section_list_addresses): Remove const.
2309         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2310         New function.
2311         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2312         New function.
2313         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2314         parameter when calling Add_symbols constructor; store argument
2315         serial number for members of a lib group.
2316         (Add_symbols::locks): Allow case where token == NULL.
2317         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2318         (Read_member::~Read_member): New function.
2319         (Read_member::is_runnable): New function.
2320         (Read_member::locks): New function.
2321         (Read_member::run): New function.
2322         (Check_script::~Check_script): New function.
2323         (Check_script::is_runnable): New function.
2324         (Check_script::locks): New function.
2325         (Check_script::run): New function.
2326         (Check_library::~Check_library): New function.
2327         (Check_library::is_runnable): New function.
2328         (Check_library::locks): New function.
2329         (Check_library::run): New function.
2330         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2331         (Add_symbols::library_): New data member.
2332         (class Read_member): New class.
2333         (class Check_script): New class.
2334         (class Check_library): New class.
2335         * reloc.cc (Read_relocs::is_runnable): Allow case where
2336         token == NULL.
2337         (Read_relocs::locks): Likewise.
2338         (Scan_relocs::locks): Likewise.
2339         (Relocate_task::locks): Likewise.
2340         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2341         to clear counters.
2342         (Sized_relobj::incremental_relocs_scan): Fix comment.
2343         (Sized_relobj::do_relocate): Pass output file offset to
2344         write_local_symbols.
2345         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2346         from class declaration.
2347         * script.cc (read_input_script): Allocate Script_info; pass
2348         argument serial number to report_script.
2349         * script.h (class Script_info): Move to incremental.h.
2350         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2351         * symtab.h (Symbol_table::add_from_incrobj): New function.
2352         (Symbol_table::set_file_offset): New function.
2353
2354 2011-04-05  Cary Coutant  <ccoutant@google.com>
2355
2356         * incremental-dump.cc (dump_incremental_inputs): Change signature
2357         to take a Sized_incremental_binary; change caller.  Use readers
2358         in Sized_incremental_binary.
2359         * incremental.cc
2360         (Sized_incremental_binary::find_incremental_inputs_sections):
2361         Rename do_find_incremental_inputs_sections to this.
2362         (Sized_incremental_binary::setup_readers): New function.
2363         (Sized_incremental_binary::do_check_inputs): Check
2364         has_incremental_info_ flag; move setup code to setup_readers;
2365         use input readers.
2366         (Sized_incremental_binary::do_file_is_unchanged): New function.
2367         (Sized_incremental_binary::do_get_input_reader): New function.
2368         * incremental.h (class Incremental_binary): Move to end of file.
2369         (Incremental_binary::file_is_unchanged): New function.
2370         (Incremental_binary::do_file_is_unchanged): New function.
2371         (Incremental_binary::Input_reader): New class.
2372         (Incremental_binary::get_input_reader): New function.
2373         (class Sized_incremental_binary): Move to end of file.
2374         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2375         input section reader classes.
2376         (Sized_incremental_binary::has_incremental_info): New function.
2377         (Sized_incremental_binary::inputs_reader): New function.
2378         (Sized_incremental_binary::symtab_reader): New function.
2379         (Sized_incremental_binary::relocs_reader): New function.
2380         (Sized_incremental_binary::got_plt_reader): New function.
2381         (Sized_incremental_binary::do_file_is_unchanged): New function.
2382         (Sized_incremental_binary::Sized_input_reader): New class.
2383         (Sized_incremental_binary::get_input_reader): New function.
2384         (Sized_incremental_binary::find_incremental_inputs_sections):
2385         Rename do_find_incremental_inputs_sections to this.
2386         (Sized_incremental_binary::setup_readers): New function.
2387         (Sized_incremental_binary::has_incremental_info_): New data member.
2388         (Sized_incremental_binary::inputs_reader_): New data member.
2389         (Sized_incremental_binary::symtab_reader_): New data member.
2390         (Sized_incremental_binary::relocs_reader_): New data member.
2391         (Sized_incremental_binary::got_plt_reader_): New data member.
2392         (Sized_incremental_binary::current_input_file_): New data member.
2393
2394 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2395
2396         PR gold/12640
2397         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2398         violation.
2399
2400 2011-03-30  Cary Coutant  <ccoutant@google.com>
2401
2402         * archive.cc (Archive::include_member): Adjust call to report_object.
2403         (Add_archive_symbols::run): Add script_info to call to
2404         report_archive_begin.
2405         (Lib_group::include_member): Adjust call to report_object.
2406         (Add_lib_group_symbols::run): Adjust call to report_object.
2407         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2408         blocks.  Add object count for script input files.
2409         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2410         script_info parameter; change all callers.
2411         (Incremental_inputs::report_object): Add script_info parameter;
2412         change all callers.
2413         (Incremental_inputs::report_script): Store backpointer to
2414         incremental info entry.
2415         (Output_section_incremental_inputs::set_final_data_size): Record
2416         additional information for scripts.
2417         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2418         * incremental.h (Incremental_script_entry::add_object): New function.
2419         (Incremental_script_entry::get_object_count): New function.
2420         (Incremental_script_entry::get_object): New function.
2421         (Incremental_script_entry::objects_): New data member; adjust
2422         constructor.
2423         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2424         (Incremental_inputs::report_object): Add script_info parameter.
2425         (Incremental_inputs_reader::get_object_count): New function.
2426         (Incremental_inputs_reader::get_object_offset): New function.
2427         * options.cc (Input_arguments::add_file): Return reference to
2428         new input argument.
2429         * options.h (Input_argument::set_script_info): New function.
2430         (Input_argument::script_info): New function.
2431         (Input_argument::script_info_): New data member; adjust all
2432         constructors.
2433         (Input_file_group::add_file): Return reference to new input argument.
2434         (Input_file_lib::add_file): Likewise.
2435         (Input_arguments::add_file): Likewise.
2436         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2437         * script.cc (Parser_closure::Parser_closure): Add script_info
2438         parameter; adjust all callers.
2439         (Parser_closure::script_info): New function.
2440         (Parser_closure::script_info_): New data member.
2441         (read_input_script): Report scripts earlier to incremental info.
2442         (script_add_file): Set script_info in Input_argument.
2443         (script_add_library): Likewise.
2444         * script.h (Script_options::Script_info): Rewrite class.
2445
2446 2011-03-29  Cary Coutant  <ccoutant@google.com>
2447
2448         * archive.cc (Library_base::should_include_member): Move
2449         method here from class Archive.
2450         (Archive::Archive): Initialize base class.
2451         (Archive::should_include_member): Move to base class.
2452         (Archive::do_for_all_unused_symbols): New function.
2453         (Add_archive_symbols::run): Remove redundant access to
2454         incremental_inputs.
2455         (Lib_group::Lib_group): Initialize base class.
2456         (Lib_group::do_filename): New function.
2457         (Lib_group::include_member): Pass pointer to Lib_group to
2458         report_object.
2459         (Lib_group::do_for_all_unused_symbols): New function.
2460         (Add_lib_group_symbols::run): Report archive information for
2461         incremental links.
2462         * archive.h (class Library_base): New base class.
2463         (class Archive): Derive from Library_base.
2464         (Archive::filename): Move to base class.
2465         (Archive::set_incremental_info): Likewise.
2466         (Archive::incremental_info): Likewise.
2467         (Archive::Should_include): Likewise.
2468         (Archive::should_include_member): Likewise.
2469         (Archive::Armap_entry): Remove.
2470         (Archive::Unused_symbol_iterator): Remove.
2471         (Archive::unused_symbols_begin): Remove.
2472         (Archive::unused_symbols_end): Remove.
2473         (Archive::do_filename): New function.
2474         (Archive::do_get_mtime): New function.
2475         (Archive::do_for_all_unused_symbols): New function.
2476         (Archive::task_): Move to base class.
2477         (Archive::incremental_info_): Likewise.
2478         (class Lib_group): Derive from Library_base.
2479         (Lib_group::do_filename): New function.
2480         (Lib_group::do_get_mtime): New function.
2481         (Lib_group::do_for_all_unused_symbols): New function.
2482         (Lib_group::task_): Move to base class.
2483         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2484         function.
2485         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2486         function.
2487         * incremental.cc (Incremental_inputs::report_archive_begin):
2488         Use Library_base; call library's get_mtime; add incremental inputs
2489         entry before members.
2490         (class Unused_symbol_visitor): New class.
2491         (Incremental_inputs::report_archive_end): Use Library_base; use
2492         visitor class to record unused symbols; don't add incremental inputs
2493         entry after members.
2494         (Incremental_inputs::report_object): Use Library_base.
2495         * incremental.h
2496         (Incremental_archive_entry::Incremental_archive_entry): Remove
2497         unused Archive parameter.
2498         (Incremental_inputs::report_archive_begin): Use Library_base.
2499         (Incremental_inputs::report_archive_end): Likewise.
2500         (Incremental_inputs::report_object): Likewise.
2501         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2502         function.
2503         * object.h (Object::for_all_global_symbols): New function.
2504         (Object::do_for_all_global_symbols): New function.
2505         (Sized_relobj::do_for_all_global_symbols): New function.
2506         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2507         function.
2508         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2509         function.
2510
2511 2011-03-27  Ian Lance Taylor  <iant@google.com>
2512
2513         * archive.cc (Archive::interpret_header): Return -1 if something
2514         goes wrong.  Change callers accordingly.
2515
2516 2011-03-25  Cary Coutant  <ccoutant@google.com>
2517
2518         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2519         * testsuite/Makefile.in: Regenerate.
2520
2521 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2522
2523         * plugin.cc (get_view): New.
2524         (Plugin::load): Pass get_view to the plugin.
2525         (Plugin_manager::get_view): New.
2526
2527 2011-03-21  Ian Lance Taylor  <iant@google.com>
2528
2529         * testsuite/final_layout.sh: Rewrite to not use dc.
2530         * testsuite/relro_test.sh: Fail if dc is not present.
2531
2532 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2533
2534         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2535         Change == to -eq.
2536         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2537         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2538         Change == to -eq.
2539         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2540         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2541
2542 2011-03-14  Ian Lance Taylor  <iant@google.com>
2543
2544         * script-sections.cc (Sort_output_sections::script_compare):
2545         Rename from is_before, change return type.
2546         (Sort_output_sections::operator()): Adjust accordingly.
2547
2548 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2549
2550         PR gold/12572
2551         * testsuite/odr_violation2.cc: Add comment to make all error line
2552         numbers double digits.
2553         * testsuite/debug_msg.sh: Adjust expected errors.
2554
2555 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2556
2557         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2558         but mark earlier ones as non-canonical
2559         (offset_to_iterator): Update search target and example
2560         (do_addr2line): Return extra lines in a vector*
2561         (format_file_lineno): Extract from do_addr2line
2562         (one_addr2line): Add vector* out-param
2563         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2564         when a lineno entry appeared last for its instruction
2565         (Dwarf_line_info): Add vector* out-param
2566         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2567         * symtab.cc (Odr_violation_compare): Include the lineno in the
2568         comparison again.
2569         (linenos_from_loc): New. Combine the canonical line for an
2570         address with its other lines.
2571         (True_if_intersect): New. Helper functor to make
2572         std::set_intersection a query.
2573         (detect_odr_violations): Compare sets of lines instead of just
2574         one line for each function. This became less deterministic, but
2575         has fewer false positives.
2576         * symtab.h: Declarations.
2577         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2578         mix an optimized and non-optimized object in the same binary
2579         (odr_violation2.so): Same.
2580         * testsuite/Makefile.in: Regenerate from Makefile.am.
2581         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2582         * testsuite/debug_msg.sh: Update line numbers and add
2583         assertions.
2584         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2585         non-optimized context.
2586         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2587         isn't inlined, and use OdrDerived in an optimized context.
2588         * testsuite/odr_header1.h: Defines OdrDerived, where
2589         optimization will change the
2590         first-instruction-in-the-destructor's file and line number.
2591         * testsuite/odr_header2.h: Defines OdrBase.
2592
2593 2011-03-09  Ian Lance Taylor  <iant@google.com>
2594
2595         * fileread.cc (File_read::clear_views): Don't delete the whole
2596         file view.
2597
2598 2011-03-08  Ian Lance Taylor  <iant@google.com>
2599
2600         PR gold/12525
2601         * fileread.cc: #include <climits>.
2602         (GOLD_IOV_MAX): Define.
2603         (File_read::read_multiple): Limit number of entries by iov_max.
2604         * fileread.h (class File_read): Always set max_readv_entries to
2605         128.
2606
2607 2011-03-07  Ian Lance Taylor  <iant@google.com>
2608
2609         PR gold/12525
2610         * options.h (class General_options): Add -dy and -dn.
2611
2612 2011-03-02  Cary Coutant  <ccoutant@google.com>
2613
2614         * testsuite/script_test_9.t: Add TLS segment.
2615
2616 2011-03-02  Simon Baldwin  <simonb@google.com>
2617
2618         * configure.ac: Add check for gnu_indirect_function support in
2619         the toolchain building binutils.
2620         * configure: Rebuild.
2621
2622 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2623
2624         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2625         plugin only symbols.
2626         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2627         in plugin files as not needed in the symbol table.
2628
2629 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2630
2631         * output.cc (Output_section::add_input_section): Delay fill
2632         generation for section ordering.
2633
2634 2011-02-09  Ian Lance Taylor  <iant@google.com>
2635
2636         PR gold/12316
2637         * object.h (class Sized_relobj): Remove clear_local_symbols.
2638         * reloc.cc (Sized_relobj::do_relocate): Don't call
2639         clear_local_symbols.
2640
2641 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2642
2643         * plugin.cc (is_visible_from_outside): Return true for symbols
2644         in the -u option.
2645
2646 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2647
2648         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2649         filename.
2650
2651 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2652
2653         * icf.h (is_section_foldable_candidate): Change type of parameter
2654         to std::string.
2655         * icf.cc (Icf::find_identical_sections): Change type of local variable
2656         section_name to be std::string.
2657         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2658
2659 2011-01-25  Ian Lance Taylor  <iant@google.com>
2660
2661         * script.cc (script_add_extern): Rewrite to use
2662         add_symbol_reference.
2663
2664 2011-01-25  Doug Kwan  <dougkwan@google.com>
2665
2666         * icf.cc (get_section_contents): Always lock section's object.
2667
2668 2011-01-24  Ian Lance Taylor  <iant@google.com>
2669
2670         * options.h (class General_options): Accept
2671         --no-detect-odr-violations.
2672
2673 2011-01-24  Ian Lance Taylor  <iant@google.com>
2674
2675         * version.cc (version_string): Bump to 1.11.
2676
2677 2011-01-24  Ian Lance Taylor  <iant@google.com>
2678
2679         * plugin.cc (class Plugin_rescan): Define new class.
2680         (Plugin_manager::claim_file): Set any_claimed_.
2681         (Plugin_manager::save_archive): New function.
2682         (Plugin_manager::save_input_group): New function.
2683         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2684         necessary.
2685         (Plugin_manager::new_undefined_symbol): New function.
2686         (Plugin_manager::rescan): New function.
2687         (Plugin_manager::rescannable_defines): New function.
2688         (Plugin_manager::add_input_file): Set any_added_.
2689         * plugin.h (class Plugin_manager): define new fields rescannable_,
2690         undefined_symbols_, any_claimed_, and any_added_.  Declare
2691         Plugin_rescan as friend.  Declare new functions.
2692         (Plugin_manager::Rescannable): Define type.
2693         (Plugin_manager::Rescannable_list): Define type.
2694         (Plugin_manager::Undefined_symbol_list): Define type.
2695         (Plugin_manager::Plugin_manager): Initialize new fields.
2696         * archive.cc (Archive::defines_symbol): New function.
2697         (Add_archive_symbols::run): Pass archive to plugins if any.
2698         * archive.h (class Archive): Declare defines_symbol.
2699         * readsyms.cc (Input_group::~Input_group): New function.
2700         (Finish_group::run): Pass input_group to plugins if any.
2701         * readsyms.h (class Input_group): Declare destructor.
2702         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2703         any.
2704
2705 2011-01-10  Ian Lance Taylor  <iant@google.com>
2706
2707         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2708         section as relro.
2709         (Layout::set_segment_offsets): Reset increase_relro before calling
2710         set_section_addresses a second time.
2711
2712 2011-01-04  Cary Coutant  <ccoutant@google.com>
2713
2714         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2715         sections before NOBITS sections.
2716
2717 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2718
2719         * version.cc (print_version): Update copyright to 2011.
2720
2721 2010-12-23  Cary Coutant  <ccoutant@google.com>
2722
2723         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2724         of OS to this->add.  Add OD parameter to second form of the function.
2725
2726 2010-12-20  Ian Lance Taylor  <iant@google.com>
2727
2728         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2729         second of two consecutive entries with same offset.
2730
2731 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2732
2733         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2734         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2735         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2736         to avoid unneeded links against $(LDADD).
2737         * testsuite/Makefile.in: Regenerate.
2738
2739 2010-12-15  Ian Lance Taylor  <iant@google.com>
2740
2741         PR gold/12324
2742         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2743         for R_X86_64_32 and R_X86_64_PC32.
2744         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2745         ver_matching_def_pic.o.
2746         (ver_matching_def_pic.o): New target.
2747
2748 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2749
2750         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2751         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2752         Move definition before File_read::View member definitions.
2753         (File_read::View::~View): Initialize and hold lock before
2754         updating current_mapped_bytes.
2755
2756 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2757
2758         * dwarf_reader.cc: Remove outdated comment.
2759         * gold-threads.cc: Fix typo in error message.
2760         * archive.cc: Fix typos in comments.
2761         * archive.h: Likewise.
2762         * arm-reloc-property.cc: Likewise.
2763         * arm-reloc-property.h: Likewise.
2764         * arm-reloc.def: Likewise.
2765         * arm.cc: Likewise.
2766         * attributes.h: Likewise.
2767         * cref.cc: Likewise.
2768         * ehframe.cc: Likewise.
2769         * fileread.h: Likewise.
2770         * gold.h: Likewise.
2771         * i386.cc: Likewise.
2772         * icf.cc: Likewise.
2773         * incremental.h: Likewise.
2774         * int_encoding.cc: Likewise.
2775         * layout.h: Likewise.
2776         * main.cc: Likewise.
2777         * merge.h: Likewise.
2778         * object.cc: Likewise.
2779         * object.h: Likewise.
2780         * options.cc: Likewise.
2781         * readsyms.cc: Likewise.
2782         * reduced_debug_output.cc: Likewise.
2783         * reloc.cc: Likewise.
2784         * script-sections.cc: Likewise.
2785         * sparc.cc: Likewise.
2786         * symtab.h: Likewise.
2787         * target-reloc.h: Likewise.
2788         * target.cc: Likewise.
2789         * target.h: Likewise.
2790         * timer.cc: Likewise.
2791         * timer.h: Likewise.
2792         * x86_64.cc: Likewise.
2793
2794 2010-12-09  Cary Coutant  <ccoutant@google.com>
2795
2796         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2797         stack.
2798         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2799         parameter; change all callers.
2800         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2801         * options.h (warn_execstack): New option.
2802
2803 2010-12-07  Doug Kwan  <dougkwan@google.com>
2804
2805         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2806         like function call relocations.
2807
2808 2010-12-07  Ian Lance Taylor  <iant@google.com>
2809
2810         * archive.cc (Archive::get_elf_object_for_member): Permit
2811         punconfigured to be NULL.
2812         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2813         (Archive::include_member): Pass NULL to get_elf_object_for_member
2814         if we searched for the archive and this is the first included
2815         object.
2816
2817 2010-12-01  Ian Lance Taylor  <iant@google.com>
2818
2819         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2820         track_relocs_type_ field.
2821         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2822         Set track_relocs_type_.
2823         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2824         contents when using RELA relocs.
2825         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2826         reloc_map_.
2827         * reloc.cc (Track_relocs::next_addend): New function.
2828         * reloc.h (class Track_relocs): Declare next_addend.
2829
2830 2010-12-01  Ian Lance Taylor  <iant@google.com>
2831
2832         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2833         virtual destructor.
2834
2835 2010-12-01  Ian Lance Taylor  <iant@google.com>
2836
2837         * README: Update compilers known to work and fail.
2838
2839 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2840
2841         * configure.in: For --enable-gold, handle value `default' instead of
2842         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2843         not the default.
2844         * configure: Regenerate.
2845
2846 2010-11-18  Doug Kwan  <dougkwan@google.com>
2847
2848         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2849         and right_alignment to be zero.  Store result alignment only if it is
2850         greater than existing alignment.
2851
2852 2010-11-16  Cary Coutant  <ccoutant@google.com>
2853
2854         PR gold/12220
2855         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2856         Check for ".zdebug_line".
2857
2858 2010-11-16  Doug Kwan  <dougkwan@google.com>
2859             Cary Coutant  <ccoutant@google.com>
2860
2861         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2862         by reference; adjust all callers.
2863         * output.cc (Output_segment::set_section_addresses): Adjust references
2864         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2865         list is empty.
2866         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2867         end at page boundary.
2868
2869 2010-11-16  Cary Coutant  <ccoutant@google.com>
2870
2871         PR gold/12220
2872         * layout.cc (Layout::choose_output_section): Transform names of
2873         compressed sections even when using a script with a SECTIONS clause.
2874         (Layout::output_section_name): Remove code to transform
2875         compressed debug section names.
2876         * output.cc (Output_section::add_input_section): Use uncompressed
2877         section size when tracking input sections.
2878
2879 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2880
2881         * symtab.h (Symbol::NON_PIC_REF): Remove.
2882         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2883         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2884         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2885         (Symbol::use_plt_offset): Take a flags argument and pass it
2886         directly to needs_dynamic_reloc.  Restrict check for undefined
2887         weak symbols to function calls.
2888         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2889         (Target_arm::Scan::global): Use it.
2890         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2891         (Target_arm::Relocate::relocate): Likewise.
2892         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2893         parameter with an r_type parameter.  Use get_reference_flags
2894         to get the flags.
2895         (Target_arm::Relocate::relocate): Update accordingly.
2896         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2897         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2898         (Target_i386::Scan::global): Likewise.
2899         (Target_i386::Relocate::relocate): Likewise.
2900         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2901         parameter with an r_type parameter.  Use get_reference_flags
2902         to get the flags.
2903         (Target_i386::Relocate::relocate): Update accordingly.
2904         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2905         (Target_powerpc::Scan::global): Use it.
2906         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2907         (Target_powerpc::Relocate::relocate): Likewise.
2908         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2909         (Target_sparc::Scan::global): Use it.
2910         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2911         (Target_sparc::Relocate::relocate): Likewise.
2912         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2913         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2914         (Target_x86_64::Scan::global): Likewise.
2915         (Target_x86_64::Relocate::relocate): Likewise.
2916
2917 2010-11-08  Doug Kwan  <dougkwan@google.com>
2918             Cary Coutant  <ccoutant@google.com>
2919
2920         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2921         (Arm_exidx_merge_section::section_contents_): New data member.
2922         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2923         (Arm_input_section::~Arm_input_section): De-allocate memory.
2924         (Arm_input_section::original_contents_): New data member.       
2925         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2926         in parameters instead of calling Object::section_contents without
2927         locking.
2928         (Arm_output_section::group_section): New parameter TASK.  Pass it
2929         to callees that need locking objects.
2930         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2931         to lock EXIDX input sections.  Fix a formatting issue.  Call
2932         Arm_exidx_merged_section::build_contents to create merged section
2933         contents.
2934         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2935         to lock object of stub table owner.
2936         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2937         TEXT_SIZE to initialize data member TEXT_SIZE_.
2938         (Arm_exidx_input_section::addralign): Fix typo in comment.
2939         (Arm_exidx_input_section::text_size): New method.
2940         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2941         that require locking objects.  Lock objects before scanning for stubs
2942         and updating local symbols.
2943         (Arm_input_section<big_endian>::init): Copy contents of original
2944         input section.
2945         (Arm_input_section<big_endian>::do_write): Use saved contents of
2946         original input section instead of calling Object::section_contents
2947         without locking.
2948         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2949         size without calling Object::section_size().
2950         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2951         for size.  Allocate a buffer for merged EXIDX entries.
2952         (Arm_exidx_merged_section::build_contents): New method.
2953         (Arm_exidx_merged_section::do_write): Move merge section contents
2954         building code to Arm_exidx_merged_section::build_contetns.  Write
2955         out contetns in buffer instead of building it on the fly.
2956         (Arm_relobj::make_exidx_input_section): Also pass text section size
2957         to Arm_exidx_input_section constructor.
2958         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2959         (Arm_dynobj::do_read_symbols): Fix memory leak.
2960         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2961         * target.h: (class Task): Add forward declaration.
2962         (Target::relax): Add new parameter TASK and pass it to
2963         Target::do_relax().
2964         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2965
2966 2010-11-05  Cary Coutant  <ccoutant@google.com>
2967
2968         PR gold/10708
2969         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2970         object when reading from the file.
2971         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2972         second layout pass.
2973         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2974         when reading section contents.
2975         (get_section_contents): Likewise.
2976         (icf::find_identical_sections): Likewise.
2977         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2978         object when reading from the file.
2979         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2980         the object when doing deferred section layout.
2981
2982 2010-11-03  Nick Clifton  <nickc@redhat.com>
2983
2984         PR gold/12001
2985         * script.h (class Symbol_assignment: name): New member.  Returns
2986         the name of the symbol.
2987         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2988         Returns true if the given symbol name is on the list of
2989         assignments wating to be processed.
2990         * archive.cc (should_incldue_member): If the symbol is undefined,
2991         check to see if it is on the list of symbols pending assignment.
2992
2993 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2994
2995         * script-sections.cc (Script_sections::find_memory_region): Check
2996         for a NULL output section pointer.
2997
2998 2010-10-29  Doug Kwan  <dougkwan@google.com>
2999
3000         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3001         Output_section::add_relaxed_input_section.
3002         * output.cc (Output_section::add_relaxed_input_section): Add new
3003         arguments LAYOUT and NAME.  Set section order index.
3004         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3005         Copy section order index.
3006         * output.h (Output_section::add_relaxed_input_section): Add new
3007         arguments LAYOUT and NAME.
3008
3009 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3010
3011         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3012         NATIVE_OR_CROSS_LINKER.
3013         * testsuite/Makefile.in: Regenerate.
3014
3015 2010-10-20  Doug Kwan  <dougkwan@google.com>
3016
3017         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3018         without SHF_LINK_ORDER flags.
3019         * layout.cc (Layout::choose_output_section): Do not filter
3020         SHF_LINK_ORDER flag in a relocatable link.
3021
3022 2010-10-17  Cary Coutant  <ccoutant@google.com>
3023
3024         * output.h (Output_segment::set_section_addresses): Change function
3025         signature.  Update all callers.
3026         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3027         sections.
3028         (Output_segment::set_section_addresses): Align after last TLS
3029         section.  Add padding before last relro section instead of after.
3030
3031 2010-10-17  Doug Kwan  <dougkwan@google.com>
3032
3033         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3034         GOT output section to be writable.
3035
3036 2010-10-14  Cary Coutant  <ccoutant@google.com>
3037
3038         * debug.h (DEBUG_INCREMENTAL): New flag.
3039         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3040         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3041         mode.
3042         * incremental.cc (report_command_line): Ignore all forms of
3043         --incremental.
3044         * layout.cc (Layout::Layout): Check parameters for incremental link
3045         mode.
3046         * options.cc (General_options::parse_incremental): New function.
3047         (General_options::parse_no_incremental): New function.
3048         (General_options::parse_incremental_full): New function.
3049         (General_options::parse_incremental_update): New function.
3050         (General_options::incremental_mode_): New data member.
3051         (General_options::finalize): Check incremental_mode_.
3052         * options.h (General_options): Update help text for --incremental.
3053         Add --no-incremental, --incremental-full, --incremental-update.
3054         (General_options::Incremental_mode): New enum type.
3055         (General_options::incremental_mode): New function.
3056         (General_options::incremental_mode_): New data member.
3057         * parameters.cc (Parameters::incremental_mode_): New data member.
3058         (Parameters::set_options): Set incremental_mode_.
3059         (Parameters::set_incremental_full): New function.
3060         (Parameters::incremental): New function.
3061         (Parameters::incremental_update): New function.
3062         (set_parameters_incremental_full): New function.
3063         * parameters.h (Parameters::set_incremental_full): New function.
3064         (Parameters::incremental): New function.
3065         (Parameters::incremental_update): New function.
3066         (Parameters::incremental_mode_): New data member.
3067         (set_parameters_incremental_full): New function.
3068         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3069         incremental link mode.
3070         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3071         (Sized_relobj::do_relocate_sections): Likewise.
3072         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3073         option.
3074         * testsuite/Makefile.in: Regenerate.
3075         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3076
3077 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3078
3079         * script-sections.h (class Script_sections): Make
3080         Sections_elements typedef public.
3081         * script-sections.cc (class Sort_output_sections): Add elements_
3082         field.  Add constructor which sets it; change all callers.
3083         (Sort_output_sections::is_before): New function.
3084         (Sort_output_sections::operator()): Call is_before.
3085         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3086         conditional.
3087         * testsuite/script_test_10.sh: New test. Test script section
3088         order.
3089         * testsuite/script_test_10.t: Likewise.
3090         * testsuite/script_test_10.s: Likewise.
3091         * testsuite/Makefile.am: Wrap the cross linker tests and the
3092         common tests into NATIVE_OR_CROSS_LINKER.
3093         (check_SCRIPTS): Add script_test_10.sh.
3094         (check_DATA): Add script_test_10.stdout.
3095         (script_test_10.o, script_test_10): New targets.
3096         (script_test_10.stdout): New target.
3097         * configure, testsuite/Makefile.in: Regenerate.
3098
3099 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3100
3101         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3102         error for the deprecated relocations.
3103         (Target_arm::Scan::global): Likewise.
3104         (Target_arm::Relocate::relocate): Likewise.
3105
3106 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3107
3108         * fileread.cc (Input_file::find_file): Initialize *found_name
3109         and *namep when using the fallback search for case 4.
3110
3111 2010-10-11  Cary Coutant  <ccoutant@google.com>
3112
3113         * options.h (class General_options): Redefine -z lazy as an alias for
3114         the negation of -z now.
3115
3116 2010-10-11  Ian Lance Taylor  <iant@google.com>
3117
3118         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3119         binding.
3120
3121 2010-10-06  Nick Clifton  <nickc@redhat.com>
3122
3123         * script-sections.cc(class Memory_region): Remove
3124         current_lma_offset_ field.  Rename current_vma_offset_ to
3125         current_offset_.  Add last_section_ field.
3126         (Memory_region::get_current_vma_address): Rename to
3127         get_current_address.
3128         (Memory_region::get_current_lma_address): Delete.
3129         (Memory_region::increment_vma_offset): Rename to
3130         increment_offset.
3131         (Memory_region::increment_lma_offset): Delete.
3132         (Memory_region::attributes_compatible): New method.  Returns
3133         true if the provided section is compatible with the region.
3134         (Memory_region::get_last_section): New method.  Returns the last
3135         section to use the region.
3136         (Memory_region::set_last_section): New method.  Stores the last
3137         section to use the region.
3138         (Script_sections::block_in_region): New method.  Returns true if
3139         a block of memory is contained within a region.
3140         (Script_sections::find_memory_region): New method.  Locates a
3141         memory region to be used to set a VMA or LMA address.
3142         (Output_section_definition::set_section_addresses): Add code to
3143         check for addresses set by memory regions.
3144         (Output_segment::set_section_addresses): Remove memory region
3145         walking code.
3146         (Script_sections::create_segment): Add a warning if a header
3147         segment is created outside of any region.
3148         * script-sections.h (class Script_sections): Add prototypes for
3149         find_memory_region and block_in_region methods.
3150         * testsuite/memory_test.s: Use .long instead of .word.
3151         * testsuite/memory_test.t: Add some more output sections.
3152         * testsuite/memory_test.sh: Update expected output.
3153
3154 2010-10-02  Doug Kwan  <dougkwan@google.com>
3155
3156         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3157         defintion to symtab.h
3158         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3159         declaration to defintion.
3160
3161 2010-10-01  Nick Clifton  <nickc@redhat.com>
3162
3163         * expression.cc (eval): Replace dummy argument with NULL.
3164         (eval_maybe_dot): Check for a NULL result section pointer.
3165         (Symbol_expression::value): Likewise.
3166         (Dot_expression::value): Likewise.
3167         (BINARY_EXPRESSION): Likewise.
3168         (Max_expression::value): Likewise.
3169         (Min_expression::value): Likewise.
3170         (Absolute_expression::value): Likewise.
3171         (Addr_expression::value_from_output_section): Likewise.
3172         (Loaddddr_expression::value_from_output_section): Likewise.
3173         (Segment_start_expression::value): Likewise.
3174         * script-sections.cc
3175         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3176         argument with NULL.
3177         (Sections_elememt_dot_assignment::set_section_addresses):
3178         Likewise.
3179         (Output_data_expression::do_write_to_buffer): Likewise.
3180         (Output_section_definition::finalize_symbols): Likewise.
3181         (Output_section_definition::set_section_addresses): Likewise.
3182
3183 2010-09-30  Doug Kwan  <dougkwan@google.com>
3184
3185         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3186
3187 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3188
3189         * target.h (Target::can_icf_inline_merge_sections): New virtual
3190         function.
3191         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3192         virtual function.
3193         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3194         virtual function.
3195         * icf.cc (get_section_contents): Inline merge sections only when
3196         target allows it.
3197
3198 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3199
3200         * configure: Regenerate.
3201
3202 2010-09-17  Ian Lance Taylor  <iant@google.com>
3203
3204         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3205         * testsuite/Makefile.am (memory_test.o): New target.
3206         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3207         memory_test.t.
3208         * testsuite/Makefile.in: Rebuild.
3209
3210 2010-09-17  Doug Kwan  <dougkwan@google.com>
3211
3212         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3213         defintion if relocation uses GOT entries of the symbol.
3214         * testsuite/icf_safe_test.sh: Fix test.
3215         * testsuite/icf_safe_so_test.sh: Fix test.
3216
3217 2010-09-16  Cary Coutant  <ccoutant@google.com>
3218
3219         * script_sections.cc (class Memory_region): Remove "NULL" from
3220         vector initializations.
3221
3222 2010-09-15  Cary Coutant  <ccoutant@google.com>
3223
3224         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3225         Resolve forwarding symbols.
3226
3227 2010-09-15  Doug Kwan  <dougkwan@google.com>
3228
3229         * gold/testsuite/script_test_3.t: Add ARM special sections.
3230         * gold/testsuite/script_test_4.t: Same.
3231         * gold/testsuite/script_test_5.t: Same.
3232         * gold/testsuite/script_test_6.t: Same.
3233         * gold/testsuite/script_test_7.t: Same.
3234         * gold/testsuite/script_test_7.t: Same.
3235         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3236
3237 2010-09-14  Cary Coutant  <ccoutant@google.com>
3238
3239         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3240         (Target_x86_64::Relocate::relocate_tls): Replace check for
3241         saw_tls_block_reloc_ with test for executable section.
3242
3243 2010-09-12  Cary Coutant  <ccoutant@google.com>
3244
3245         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3246         position-independent executables to shared libraries need dynamic
3247         relocations.
3248         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3249         position-independent executables.
3250         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3251         * testsuite/Makefile.in: Regenerate.
3252
3253 2010-09-10  Nick Clifton  <nickc@redhat.com>
3254
3255         PR gold/11997
3256         * testsuite/memory_test.t: Discard any sections that are not
3257         needed.
3258
3259 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3260
3261         PR gold/11996
3262         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3263         "This::" to work around a bug in gcc 4.2.
3264
3265         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3266
3267 2010-09-09  Rafael Espindola  <espindola@google.com>
3268
3269         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3270         sections with different PF_X flags in the same segment.
3271         (Layout::find_first_load_seg): Search all segments to find the first
3272         one.
3273         * options.h (rosegment): New.
3274
3275 2010-09-08  Rafael Espindola  <espindola@google.com>
3276
3277         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3278
3279 2010-09-08  Doug Kwan  <dougkwan@google.com>
3280
3281         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3282         (Arm_relobj::do_relocate_sections): Add new parameter for output
3283         file to match the parent.
3284         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3285         of local symbols instead of input values.  Update code to track
3286         changes in gold::relocate_section.
3287         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3288         (Sized_relobj::compute_final_local_value_internal): New methods.
3289         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3290         body into private version of Sized_relobj::compute_final_local_value.
3291         Call the inline method.
3292         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3293         merged symbol value if there is one.
3294         (Symbol_value::has_output_value): New method defintiion.
3295         (Sized_relobj::Compute_final_local_value_status): New enum type.
3296         (Sized_relobj::compute_final_local_value): New methods.
3297         (Sized_relobj::compute_final_local_value_internal): New methods.
3298         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3299         and arm_cortex_a8.sh.
3300         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3301         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3302         New tests.
3303         * Makefile.in: Regenerate.
3304         * testsuite/arm_bl_out_of_range.s: Update test.
3305         * testsuite/thumb_bl_out_of_range.s: Ditto.
3306         * testsuite/thumb_blx_out_of_range.s: Ditto.
3307         * testsuite/arm_branch_out_of_range.sh: New file.
3308         * testsuite/arm_cortex_a8.sh: Ditto.
3309         * testsuite/arm_cortex_a8_b.s: Ditto.
3310         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3311         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3312         * testsuite/arm_cortex_a8_bl.s: Ditto.
3313         * testsuite/arm_cortex_a8_blx.s: Ditto.
3314         * testsuite/arm_cortex_a8_local.s: Ditto.
3315         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3316         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3317
3318 2010-09-08  Rafael Espindola  <espindola@google.com>
3319
3320         * Makefile.am (memory_test.stdout): Run readelf with -W.
3321         * Makefile.in: Regenerate.
3322         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3323         64 bit output.
3324
3325 2010-09-08  Rafael Espindola  <espindola@google.com>
3326
3327         * script-sections.cc (Script_sections::add_memory_region): Convert
3328         field precision to int.
3329         * script.cc (script_set_section_region, script_set_section_region):
3330         Convert field precision to int.
3331
3332 2010-09-08  Rafael Espindola  <espindola@google.com>
3333
3334         * arm.cc (do_finalize_sections): Create the __exidx_start and
3335         __exdix_end symbols even when the section is missing.
3336
3337 2010-09-08  Nick Clifton  <nickc@redhat.com>
3338
3339         * README: Remove claim that MEMORY is not supported.
3340         * expression.cc (script_exp_function_origin)
3341         (script_exp_function_length): Move from here to ...
3342         * script.cc: ... here.
3343         (script_set_section_region, script_add_memory)
3344         (script_parse_memory_attr, script_include_directive): New
3345         functions.
3346         * script-sections.cc
3347         (class Memory_region): New class.
3348         (class Output_section_definition): Add set_memory_region,
3349         set_section_vma, set_section_lma and get_section_name methods.
3350         (class Script_Sections): Add add_memory_region,
3351         find_memory_region, find_memory_region_origin,
3352         find_memory_region_length and set_memory_region methods.
3353         Have set_section_addresses method walk the list of set memory
3354         regions.
3355         Extend the print methos to display memory regions.
3356         * script-sections.h: Add prototypes for new methods.
3357         Add enum for MEMORY region attributes.
3358         * yyscript.y: Add support for parsing MEMORY regions.
3359         * script-c.h: Add prototypes for new functions.
3360         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3361         * testsuite/Makefile.in: Regenerate.
3362         * testsuite/memory_test.sh: New script.
3363         * testsuite/memory_test.s: New assembler source file.
3364         * testsuite/memory_test.t: New linker script.
3365
3366 2010-08-27  Doug Kwan  <dougkwan@google.com>
3367
3368         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3369         reference override an existing dynamic weak reference.
3370         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3371         * testsuite/Makefile.in: Regenerate.
3372         * testsuite/dyn_weak_ref.sh: New file.
3373         * testsuite/dyn_weak_ref_1.c: Ditto.
3374         * testsuite/dyn_weak_ref_2.c: Ditto.
3375
3376 2010-08-27  Ian Lance Taylor  <iant@google.com>
3377
3378         * incremental.h (class Incremental_input_entry): Add virtual
3379         destructor.
3380
3381 2010-08-27  Ian Lance Taylor  <iant@google.com>
3382
3383         * testsuite/start_lib_test_3.c: Mark t3 as used.
3384
3385 2010-08-27  Nick Clifton  <nickc@redhat.com>
3386
3387         * options.cc (version_script): Fix small typo in previous
3388         whitespace tidyup.
3389
3390 2010-08-25  Nick Clifton  <nickc@redhat.com>
3391
3392         * archive.cc: Formatting fixes: Remove whitespace between
3393         typename and following asterisk.  Remove whitespace between
3394         function name and opening parenthesis.
3395         * archive.h: Likewise.
3396         * arm.cc: Likewise.
3397         * attributes.cc: Likewise.
3398         * attributes.h: Likewise.
3399         * common.cc: Likewise.
3400         * copy-relocs.cc: Likewise.
3401         * dirsearch.h: Likewise.
3402         * dynobj.cc: Likewise.
3403         * ehframe.cc: Likewise.
3404         * ehframe.h: Likewise.
3405         * expression.cc: Likewise.
3406         * fileread.cc: Likewise.
3407         * fileread.h: Likewise.
3408         * gc.h: Likewise.
3409         * gold-threads.cc: Likewise.
3410         * gold.cc: Likewise.
3411         * i386.cc: Likewise.
3412         * icf.h: Likewise.
3413         * incremental-dump.cc: Likewise.
3414         * incremental.cc: Likewise.
3415         * layout.cc: Likewise.
3416         * layout.h: Likewise.
3417         * main.cc: Likewise.
3418         * merge.cc: Likewise.
3419         * merge.h: Likewise.
3420         * object.cc: Likewise.
3421         * object.h: Likewise.
3422         * options.cc: Likewise.
3423         * options.h: Likewise.
3424         * output.cc: Likewise.
3425         * output.h: Likewise.
3426         * plugin.cc: Likewise.
3427         * plugin.h: Likewise.
3428         * powerpc.cc: Likewise.
3429         * reloc.cc: Likewise.
3430         * script-c.h: Likewise.
3431         * script-sections.cc: Likewise.
3432         * script.cc: Likewise.
3433         * stringpool.cc: Likewise.
3434         * symtab.cc: Likewise.
3435         * symtab.h: Likewise.
3436         * target.cc: Likewise.
3437         * timer.cc: Likewise.
3438         * timer.h: Likewise.
3439         * version.cc: Likewise.
3440         * x86_64.cc: Likewise.
3441
3442 2010-08-24  Nick Clifton  <nickc@redhat.com>
3443
3444         PR 11899
3445         * layout.cc (segment_precedes): Sort segments by their physical
3446         addresses, if they have been set.
3447
3448 2010-08-23  Cary Coutant  <ccoutant@google.com>
3449
3450         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3451         symbols data.
3452         (Lib_group::include_member): Unlock object after deleting its
3453         symbols data.
3454         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3455         the bug fixed here.
3456
3457 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3458             Cary Coutant  <ccoutant@google.com>
3459
3460         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3461         constructor, and set_blocker.
3462         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3463         readsyms_blocker_.
3464         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3465         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3466         * testsuite/Makefile.am (start_lib_test): New test case.
3467         * testsuite/Makefile.in: Regenerate.
3468         * testsuite/start_lib_test_main.c: New file.
3469         * testsuite/start_lib_test_1.c: New file.
3470         * testsuite/start_lib_test_2.c: New file.
3471         * testsuite/start_lib_test_3.c: New file.
3472
3473 2010-08-19  Ian Lance Taylor  <iant@google.com>
3474
3475         * Makefile.in: Rebuild with automake 1.11.1.
3476         * aclocal.m4: Likewise.
3477         * testsuite/Makefile.in: Likewise.
3478
3479 2010-08-19  Ian Lance Taylor  <iant@google.com>
3480
3481         PR 10893
3482         * i386.cc (class Output_data_plt_i386): Update declarations.
3483         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3484         local_ifuncs_ fields.
3485         (Target_i386::do_plt_section_for_global): New function.
3486         (Target_i386::do_plt_section_for_local): New function.
3487         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3488         parameter; change all callers.  Initialize global_ifuncs_ and
3489         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3490         __rel_iplt_end.
3491         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3492         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3493         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3494         symbols.
3495         (Target_i386::make_plt_section): New function, broken out of
3496         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3497         (Target_i386::make_plt_entry): Call make_plt_section.
3498         (Target_i386::make_local_ifunc_plt_entry): New function.
3499         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3500         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3501         R_386_IRELATIVE to switch.
3502         (Target_i386::Scan::global): Likewise.
3503         (Target_i386::Relocate::relocate): Likewise.
3504         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3505         switch.
3506         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3507         (Target_x86_64::do_plt_section_for_global): New function.
3508         (Target_x86_64::do_plt_section_for_local): New function.
3509         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3510         parameter; change all callers.  If doing a static link define
3511         __rela_iplt_start and __rela_iplt_end.
3512         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3513         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3514         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3515         to point to .plt.
3516         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3517         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3518         switch.
3519         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3520         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3521         R_X86_64_IRELATIVE to switch.
3522         (Target_x86_64::Scan::global): Likewise.
3523         (Target_x86_64::Relocate::relocate): Likewise.
3524         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3525         switch.
3526         * target.h (class Target): Add plt_section_for_global and
3527         plt_section_for_local functions.  Add do_plt_section_for_global
3528         and do_plt_section_for_local virtual functions.
3529         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3530         clarifying comments.
3531         (Symbol::use_plt_offset): Handle IFUNC symbol.
3532         * object.cc (Sized_relobj::Sized_relobj): Initialize
3533         local_plt_offsets_.
3534         (Sized_relobj::local_has_plt_offset): New function.
3535         (Sized_relobj::local_plt_offset): New function.
3536         (Sized_relobj::set_local_plt_offset): New function.
3537         (Sized_relobj::do_count): Handle IFUNC symbol.
3538         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3539         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3540         is_ifunc_symbol functions.
3541         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3542         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3543         local_plt_offsets_ field.
3544         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3545         * output.h (class Output_section_data): Add non-const
3546         output_section function.
3547         (class Output_data_got): Update declarations.
3548         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3549         Add use_plt_offset parameter to global and local constructors.
3550         Change all callers.  Change local_sym_index_ field to 31 bits.
3551         Change GSYM_CODE and CONSTANT_CODE accordingly.
3552         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3553         doing a static link don't set sh_link field.
3554         (Output_data_got::Got_entry::write): Use PLT offset if
3555         appropriate.
3556         (Output_data_got::add_global_plt): New function.
3557         (Output_data_got::add_local_plt): New function.
3558         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3559         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3560         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3561         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3562         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3563         IFUNC conditional.
3564         * testsuite/ifunc-sel.h: New file.
3565         * testsuite/ifuncmain1.c: New file.
3566         * testsuite/ifuncmain1vis.c: New file.
3567         * testsuite/ifuncmod1.c: New file.
3568         * testsuite/ifuncdep2.c: New file.
3569         * testsuite/ifuncmain2.c: New file.
3570         * testsuite/ifuncmain3.c: New file.
3571         * testsuite/ifuncmod3.c: New file.
3572         * testsuite/ifuncmain4.c: New file.
3573         * testsuite/ifuncmain5.c: New file.
3574         * testsuite/ifuncmod5.c: New file.
3575         * testsuite/ifuncmain6pie.c: New file.
3576         * testsuite/ifuncmod6.c: New file.
3577         * testsuite/ifuncmain7.c: New file.
3578         * configure, testsuite/Makefile.in: Rebuild.
3579
3580 2010-08-18  Ian Lance Taylor  <iant@google.com>
3581
3582         * incremental.cc
3583         (Output_section_incremental_inputs::write_input_files): Add cast
3584         to avoid signed/unsigned comparison warning.
3585         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3586
3587 2010-08-12  Cary Coutant  <ccoutant@google.com>
3588
3589         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3590
3591 2010-08-13  Ian Lance Taylor  <iant@google.com>
3592
3593         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3594
3595 2010-08-12  Cary Coutant  <ccoutant@google.com>
3596             Doug Kwan  <dougkwan@google.com>
3597
3598         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3599         defintion overrides non-weak undef, remember that the original undef
3600         is not weak.
3601         * symtab.cc (Symbol_table::sized_write_global): For undef without
3602         an original weak binding, set binding to global in output.
3603         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3604         * testsuite/Makefile.in: Regenerate.
3605         * testsuite/strong_ref_weak_def.sh: New file.
3606         * testsuite/strong_ref_weak_def_1.c: Ditto.
3607         * testsuite/strong_ref_weak_def_2.c: Ditto.
3608
3609 2010-08-12  Cary Coutant  <ccoutant@google.com>
3610
3611         * testsuite/incremental_test.sh: Rewrite.
3612         * testsuite/incremental_test_1.c: Rewrite.
3613         * testsuite/incremental_test_2.c: Rewrite.
3614
3615 2010-08-12  Cary Coutant  <ccoutant@google.com>
3616
3617         * arm.cc (Target_arm::got_size): Add const.
3618         (Target_arm::got_entry_count): New function.
3619         (Target_arm::plt_entry_count): New function.
3620         (Target_arm::first_plt_entry_offset): New function.
3621         (Target_arm::plt_entry_size): New function.
3622         (Output_data_plt_arm::entry_count): New function.
3623         (Output_data_plt_arm::first_plt_entry_offset): New function.
3624         (Output_data_plt_arm::get_plt_entry_size): New function.
3625         * i386.cc (Target_i386::got_size): Add const.
3626         (Target_i386::got_entry_count): New function.
3627         (Target_i386::plt_entry_count): New function.
3628         (Target_i386::first_plt_entry_offset): New function.
3629         (Target_i386::plt_entry_size): New function.
3630         (Output_data_plt_i386::entry_count): New function.
3631         (Output_data_plt_i386::first_plt_entry_offset): New function.
3632         (Output_data_plt_i386::get_plt_entry_size): New function.
3633         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3634         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3635         * incremental.cc: Include target.h.
3636         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3637         parameter.  Adjust all callers.  Find incremental_got_plt section.
3638         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3639         section.
3640         (Output_section_incremental_inputs::set_final_data_size): Calculate
3641         size of incremental_got_plt section.
3642         (Output_section_incremental_inputs::do_write): Write the
3643         incremental_got_plt section.
3644         (Got_plt_view_info): New struct.
3645         (Local_got_offset_visitor): New class.
3646         (Global_got_offset_visitor): New class.
3647         (Global_symbol_visitor_got_plt): New class.
3648         (Output_section_incremental_inputs::write_got_plt): New function.
3649         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3650         Add parameter.  Adjust all callers.
3651         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3652         (Incremental_inputs::got_plt_section): New function.
3653         (Incremental_inputs::got_plt_section_): New data member.
3654         (Incremental_got_plt_reader): New class.
3655         * layout.cc (Layout::create_incremental_info_sections): Add the
3656         incremental_got_plt section.
3657         * object.h (Got_offset_list::get_list): New function.
3658         (Got offset_list::for_all_got_offsets): New function.
3659         (Sized_relobj::local_got_offset_list): New function.
3660         * powerpc.cc (Target_powerpc::got_size): Add const.
3661         (Target_powerpc::got_entry_count): New function.
3662         (Target_powerpc::plt_entry_count): New function.
3663         (Target_powerpc::first_plt_entry_offset): New function.
3664         (Target_powerpc::plt_entry_size): New function.
3665         (Output_data_plt_powerpc::entry_count): New function.
3666         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3667         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3668         * sparc.cc (Target_sparc::got_size): Add const.
3669         (Target_sparc::got_entry_count): New function.
3670         (Target_sparc::plt_entry_count): New function.
3671         (Target_sparc::first_plt_entry_offset): New function.
3672         (Target_sparc::plt_entry_size): New function.
3673         (Output_data_plt_sparc::entry_count): New function.
3674         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3675         (Output_data_plt_sparc::get_plt_entry_size): New function.
3676         * symtab.h (Symbol::got_offset_list): New function.
3677         (Symbol_table::for_all_symbols): New function.
3678         * target.h (Sized_target::got_entry_count): New function.
3679         (Sized_target::plt_entry_count): New function.
3680         (Sized_target::plt_entry_size): New function.
3681         * x86_64.cc (Target_x86_64::got_size): Add const.
3682         (Target_x86_64::got_entry_count): New function.
3683         (Target_x86_64::plt_entry_count): New function.
3684         (Target_x86_64::first_plt_entry_offset): New function.
3685         (Target_x86_64::plt_entry_size): New function.
3686         (Output_data_plt_x86_64::entry_count): New function.
3687         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3688         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3689
3690 2010-08-12  Cary Coutant  <ccoutant@google.com>
3691
3692         * archive.cc: Include incremental.h.
3693         (Archive::Archive): Initialize incremental_info_.
3694         (Archive::include_member): Record archive members in incremental info.
3695         (Add_archive_symbols::run): Record begin and end of an archive in
3696         incremental info.
3697         (Lib_group::include_member): Record objects in incremental info.
3698         * archive.h (Incremental_archive_entry): Forward declaration.
3699         (Archive::set_incremental_info): New member function.
3700         (Archive::incremental_info): New member function.
3701         (Archive::Unused_symbol_iterator): New class.
3702         (Archive::unused_symbols_begin): New member function.
3703         (Archive::unused_symbols_end): New member function.
3704         (Archive::incremental_info_): New data member.
3705         * incremental-dump.cc (find_input_containing_global): New function.
3706         (dump_incremental_inputs): Dump new incremental info sections.
3707         * incremental.cc: Include symtab.h.
3708         (Output_section_incremental_inputs): New class.
3709         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3710         new incremental info sections.
3711         (Sized_incremental_binary::do_check_inputs): Likewise.
3712         (Incremental_inputs::report_archive): Remove.
3713         (Incremental_inputs::report_archive_begin): New function.
3714         (Incremental_inputs::report_archive_end): New function.
3715         (Incremental_inputs::report_object): New function.
3716         (Incremental_inputs::finalize_inputs): Remove.
3717         (Incremental_inputs::report_input_section): New function.
3718         (Incremental_inputs::report_script): Rewrite.
3719         (Incremental_inputs::finalize): Do nothing but finalize string table.
3720         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3721         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3722         (Incremental_inputs::create_data_sections): New function.
3723         (Incremental_inputs::relocs_entsize): New function.
3724         (Output_section_incremental_inputs::set_final_data_size): New function.
3725         (Output_section_incremental_inputs::do_write): New function.
3726         (Output_section_incremental_inputs::write_header): New function.
3727         (Output_section_incremental_inputs::write_input_files): New function.
3728         (Output_section_incremental_inputs::write_info_blocks): New function.
3729         (Output_section_incremental_inputs::write_symtab): New function.
3730         * incremental.h (Incremental_script_entry): Forward declaration.
3731         (Incremental_object_entry): Forward declaration.
3732         (Incremental_archive_entry): Forward declaration.
3733         (Incremental_inputs): Forward declaration.
3734         (Incremental_inputs_header_data): Remove.
3735         (Incremental_inputs_header): Remove.
3736         (Incremental_inputs_header_write): Remove.
3737         (Incremental_inputs_entry_data): Remove.
3738         (Incremental_inputs_entry): Remove.
3739         (Incremental_inputs_entry_write): Remove.
3740         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3741         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3742         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3743         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3744         Likewise.
3745         (Incremental_input_entry): New class.
3746         (Incremental_script_entry): New class.
3747         (Incremental_object_entry): New class.
3748         (Incremental_archive_entry): New class.
3749         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3750         (Incremental_inputs::report_inputs): Remove.
3751         (Incremental_inputs::report_archive): Remove.
3752         (Incremental_inputs::report_archive_begin): New function.
3753         (Incremental_inputs::report_archive_end): New function.
3754         (Incremental_inputs::report_object): Change prototype.
3755         (Incremental_inputs::report_input_section): New function.
3756         (Incremental_inputs::report_script): Change prototype.
3757         (Incremental_inputs::get_reloc_count): New function.
3758         (Incremental_inputs::set_reloc_count): New function.
3759         (Incremental_inputs::create_data_sections): New function.
3760         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3761         (Incremental_inputs::inputs_section): New function.
3762         (Incremental_inputs::symtab_section): New function.
3763         (Incremental_inputs::relocs_section): New function.
3764         (Incremental_inputs::get_stringpool): Add const.
3765         (Incremental_inputs::command_line): Add const.
3766         (Incremental_inputs::inputs): Remove.
3767         (Incremental_inputs::command_line_key): New function.
3768         (Incremental_inputs::input_file_count): New function.
3769         (Incremental_inputs::input_files): New function.
3770         (Incremental_inputs::relocs_entsize): New function.
3771         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3772         (Incremental_inputs::finalize_inputs): Remove.
3773         (Incremental_inputs::Input_info): Remove.
3774         (Incremental_inputs::lock_): Remove.
3775         (Incremental_inputs::inputs_): Change type.
3776         (Incremental_inputs::inputs_map_): Remove.
3777         (Incremental_inputs::current_object_entry_): New data member.
3778         (Incremental_inputs::inputs_section_): New data member.
3779         (Incremental_inputs::symtab_section_): New data member.
3780         (Incremental_inputs::relocs_section_): New data member.
3781         (Incremental_inputs::reloc_count_): New data member.
3782         (Incremental_inputs_reader): New class.
3783         (Incremental_symtab_reader): New class.
3784         (Incremental_relocs_reader): New class.
3785         * layout.cc (Layout::finalize): Move finalization of incremental info
3786         and creation of incremental info sections to follow finalization of
3787         symbol table.  Set offsets for postprocessing sections.
3788         (Layout::create_incremental_info_sections): Call
3789         Incremental_inputs::create_data_sections.  Add incremental symtab
3790         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3791         sections to layout after input sections.
3792         * layout.h (struct Timespec): Forward declaration.
3793         (Layout::incremental_inputs): Add const.
3794         (Layout::create_incremental_info_sections): Add parameter.
3795         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3796         * object.cc: Include incremental.h.
3797         (Relobj::finalize_incremental_relocs): New function.
3798         (Sized_relobj::do_layout): Record input sections in incremental info.
3799         * object.h (Object::output_section): New function.
3800         (Object::output_section_offset): Moved from Relobj.
3801         (Object::get_incremental_reloc_base): New function.
3802         (Object::get_incremental_reloc_count): New function.
3803         (Object::do_output_section): New function.
3804         (Object::do_output_section_offset): Moved from Relobj.
3805         (Object::do_get_incremental_reloc_base): New function.
3806         (Object::do_get_incremental_reloc_count): New function.
3807         (Object::Object): Initialize new data members.
3808         (Relobj::output_section): Renamed do_output_section and moved to
3809         protected.
3810         (Relobj::output_section_offset): Moved to Object.
3811         (Relobj::do_get_incremental_reloc_base): New function.
3812         (Relobj::do_get_incremental_reloc_count): New function.
3813         (Relobj::allocate_incremental_reloc_counts): New function.
3814         (Relobj::count_incremental_reloc): New function.
3815         (Relobj::finalize_incremental_relocs): New function.
3816         (Relobj::next_incremental_reloc_index): New function.
3817         (Relobj::reloc_counts_): New data member.
3818         (Relobj::reloc_bases_): New data member.
3819         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3820         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3821         (Sized_relobj::incremental_relocs_scan): New function.
3822         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3823         (Sized_relobj::incremental_relocs_write): New function.
3824         (Sized_relobj::incremental_relocs_write_reltype): New function.
3825         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3826         incremental link.
3827         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3828         archives and object files elsewhere.
3829         (Add_symbols::run): Report object files here.
3830         (Finish_group::run): Report end of archive at end of group.
3831         * reloc.cc: Include layout.h, incremental.h.
3832         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3833         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3834         (Sized_relobj::incremental_relocs_scan): New function.
3835         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3836         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3837         (Sized_relobj::incremental_relocs_write): New function.
3838         (Sized_relobj::incremental_relocs_write_reltype): New function.
3839         * script.cc (read_input_script): Rewrite test for incremental link.
3840         Change call to Incremental_inputs::report_script.
3841         * symtab.h (Symbol_table::first_global_index): New function.
3842         (Symbol_table::output_count): New function.
3843
3844 2010-08-12  Doug Kwan  <dougkwan@google.com>
3845
3846         * arm.cc (Target_arm::merge_object_attributes): Check command line
3847         options --no-wchar-size-warning and --no-enum-size-warning.
3848         * options.h (General_options): Add ld-compatible options
3849         --no-enum-size-warning and --no-wchar-size-warning.
3850
3851 2010-08-04  Ian Lance Taylor  <iant@google.com>
3852
3853         * x86_64.cc (Target_x86_64::Scan::local): Use
3854         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3855         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3856         (Target_x86_64::Scan::global): Likewise.
3857         (Target_x86_64::Relocate::relocate): Likewise.
3858         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3859         Likewise.
3860
3861 2010-08-03  Cary Coutant  <ccoutant@google.com>
3862
3863         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3864         to reserve space in merged_strings vector. Keep total input size
3865         for stats.
3866         (Output_merge_string::do_print_merge_stats): Print total input size.
3867         * merge.h (Output_merge_string): Add input_size_ field.
3868         * stringpool.cc (Stringpool_template::string_length): Move
3869         implementations out of Stringpool_template class and place in
3870         stringpool.h.
3871         * stringpool.h (string_length): Move out of Stringpool_template.
3872
3873 2010-08-03  Ian Lance Taylor  <iant@google.com>
3874
3875         PR 11712
3876         * layout.cc (relaxation_loop_body): If address of load segment is
3877         set, adjust address to include headers if possible.
3878
3879 2010-08-03  Ian Lance Taylor  <iant@google.com>
3880
3881         * version.cc (version_string): Bump to 1.10.
3882
3883 2010-08-03  Ian Lance Taylor  <iant@google.com>
3884
3885         PR 11805
3886         * layout.h (enum Output_section_order): Define.
3887         (class Layout): Update declarations.
3888         * layout.cc (Layout::get_output_section): Add order parameter.
3889         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3890         is_first_non_relro parameters.  Change all callers.
3891         (Layout::choose_output_section): Likewise.
3892         (Layout::add_output_section_data): Likewise.
3893         (Layout::make_output_section): Likewise.  Set order.
3894         (Layout::default_section_order): New function.
3895         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3896         * output.cc (Output_section::Output_section): Initialize order_.
3897         Don't initialize deleted fields.
3898         (Output_segment::Output_segment): Don't initialize deleted
3899         fields.
3900         (Output_segment::add_output_section_to_load): New function
3901         replacing add_output_section.  Change all callers to call this or
3902         add_output_section_to_nonload.
3903         (Output_segment::add_output_section_to_nonload): New function.
3904         (Output_segment::remove_output_section): Rewrite.
3905         (Output_segment::add_initial_output_data): Likewise.
3906         (Output_segment::has_any_data_sections): Likewise.
3907         (Output_segment::is_first_section_relro): Likewise.
3908         (Output_segment::maximum_alignment): Likewise.
3909         (Output_segment::has_dynamic_reloc): New function replacing
3910         dynamic_reloc_count.  Change all callers.
3911         (Output_segment::has_dynamic_reloc_list): New function replacing
3912         dynamic_reloc_count_list.  Change all callers.
3913         (Output_segment::set_section_addresses): Rewrite.
3914         (Output_segment::set_offset): Rewrite.
3915         (Output_segment::find_first_and_last_list): Remove.
3916         (Output_segment::set_tls_offsets): Rewrite.
3917         (Output_segment::first_section_load_address): Likewise.
3918         (Output_segment::output_section_count): Likewise.
3919         (Output_segment::section_with_lowest_load_address): Likewise.
3920         (Output_segment::write_section_headers): Likewise.
3921         (Output_segment::print_sections_to_map): Likewise.
3922         * output.h (class Output_data): Remove dynamic_reloc_count_
3923         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3924         (Output_data::add_dynamic_reloc): Rewrite.
3925         (Output_data::has_dynamic_reloc): New function.
3926         (Output_data::dynamic_reloc_count): Remove.
3927         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3928         is_last_relro_, is_first_non_relro_, is_interp_,
3929         is_dynamic_linker_section_ fields.  Add order and set_order
3930         functions.  Remove is_relro_local, set_is_relro_local,
3931         is_last_relro, set_is_last_relro, is_first_non_relro,
3932         set_is_first_non_relro functions, is_interp, set_is_interp,
3933         is_dynamic_linker_section, and set_is_dynamic_linker_section
3934         functions.
3935         (class Output_segment): Change Output_data_list from std::list to
3936         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3937         output_bss_ fields.  Update declarations.
3938
3939 2010-08-02  Ian Lance Taylor  <iant@google.com>
3940
3941         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3942         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3943         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3944
3945 2010-08-02  Ian Lance Taylor  <iant@google.com>
3946
3947         PR 11855
3948         * script.cc (Script_options::Script_options): Initialize
3949         symbol_definitions_ and symbol_references_.
3950         (Script_options::add_symbol_assignment): Update
3951         symbol_definitions_ and symbol_references_.
3952         (Script_options::add_symbol_reference): New function.
3953         (script_symbol): New function.
3954         * script.h (class Script_options): Add symbol_definitions_ and
3955         symbol_references_ fields.
3956         (Script_options::referenced_const_iterator): New type.
3957         (Script_options::referenced_begin): New function.
3958         (Script_options::referenced_end): New function.
3959         (Script_options::is_referenced): New function.
3960         (Script_options::any_unreferenced): New function.
3961         * script-c.h (script_symbol): Declare.
3962         * yyscript.y (exp): Call script_symbol.
3963         * symtab.cc: Include "script.h".
3964         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3965         Change all callers.  Check symbols referenced by scripts.
3966         (Symbol_table::add_undefined_symbols_from_command_line): Add
3967         layout parameter.  Change all callers.
3968         (Symbol_table::do_add_undefined_symbols_from_command_line):
3969         Likewise.  Break out loop body.  Check symbols referenced by
3970         scripts.
3971         (Symbol_table::add_undefined_symbol_from_command_line): New
3972         function broken out of
3973         do_add_undefined_symbols_from_command_line.
3974         * symtab.h (class Symbol_table): Update declarations.
3975         * archive.cc: Include "layout.h".
3976         (Archive::should_include_member): Add layout parameter.  Change
3977         all callers.  Check for symbol mentioned in expression.
3978         * archive.h (class Archive): Update declaration.
3979         * object.cc (Sized_relobj::do_should_include_member): Add layout
3980         parameter.
3981         * object.h (Object::should_include_member): Add layout parameter.
3982         Change all callers.
3983         (Object::do_should_include_member): Add layout parameter.
3984         (class Sized_relobj): Update declaration.
3985         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3986         parameter.
3987         * dynobj.h (class Sized_dynobj): Update declaration.
3988         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3989         layout parameter.
3990         * plugin.h (class Sized_pluginobj): Update declaration.
3991
3992 2010-08-02  Ian Lance Taylor  <iant@google.com>
3993
3994         PR 11866
3995         * output.cc (Output_segment::set_offset): Search for the first and
3996         last sections rather than assuming that the list is in order.
3997         (Output_segment::find_first_and_last_list): New function.
3998         * output.h (class Output_segment): Update declarations.
3999         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4000         (relro_strip_test_SOURCES): New variable.
4001         (relro_strip_test_DEPENDENCIES): New variable.
4002         (relro_strip_test_LDFLAGS): New variable.
4003         (relro_strip_test_LDADD): New variable.
4004         (relro_strip_test.so): New target.
4005
4006 2010-08-02  Ian Lance Taylor  <iant@google.com>
4007
4008         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4009         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4010         (Target_i386::got_tlsdesc_section): New function.
4011         (Target_i386::got_section): Create space for GOT entries for
4012         TLSDESC relocations.
4013         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4014         R_386_TLS_GOTDESC.
4015         (Target_i386::Scan::global): Likewise.
4016         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4017         using TLSDESC GOT.
4018         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4019         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4020         (Target_x86_64::got_tlsdesc_section): New function.
4021         (Target_x86_64::got_section): Create space for GOT entries for
4022         TLSDESC relocations.
4023         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4024         R_386_TLS_GOTDESC.
4025         (Target_x86_64::Scan::global): Likewise.
4026         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4027         using TLSDESC GOT.
4028
4029 2010-08-02  Ian Lance Taylor  <iant@google.com>
4030
4031         * testsuite/final_layout.sh: Use dc to convert from hex to
4032         decimal.
4033
4034 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4035
4036         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4037         paramter to the call to gold::gc_process_relocs.
4038         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4039         paramter to the call to gold::gc_process_relocs.
4040         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4041         parameter to the call to gold::gc_process_relocs.
4042         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4043         template parameter to the call to gold::gc_process_relocs.
4044         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4045         paramter to the call to gold::gc_process_relocs.
4046         * gc.h (get_embedded_addend_size): New function.
4047         (gc_process_relocs): Save the size of the reloc for use by ICF.
4048         * icf.cc (get_section_contents): Get the addend from the text section
4049         for SHT_REL relocation sections.
4050         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4051         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4052         * int_encoding.h (read_from_pointer): New overloaded function.
4053         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4054         * testsuite/icf_sht_rel_addend_test.sh: New file.
4055         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4056         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4057
4058 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4059
4060         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4061         * Makefile.in: Regenerate.
4062         * testsuite/Makefile.in: Regenerate.
4063
4064 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4065
4066         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4067         * gold/testsuite/debug_msg.cc: Likewise.
4068         * gold/testsuite/odr_violation1.cc
4069         * gold/testsuite/odr_violation2.cc
4070
4071 2010-07-21  Cary Coutant  <ccoutant@google.com>
4072
4073         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4074         string, and length fields.
4075         (Output_merge_string::Merged_strings_list): New type.
4076         (Output_merge_string::Merged_strings_lists): New typedef.
4077         (Output_merge_string): Replace merged_strings_ with
4078         merged_strings_lists_.
4079         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4080         Merged_strings_list per input object and section.  Don't store pointer
4081         to the string.  Don't store length with each merged string entry.
4082         (Output_merge_string::finalize_merged_data): Loop over list of merged
4083         strings lists.  Recompute length of each merged string.
4084
4085 2010-07-15  Cary Coutant  <ccoutant@google.com>
4086
4087         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4088         here.
4089
4090 2010-07-14  Ian Lance Taylor  <iant@google.com>
4091
4092         * descriptors.cc (Descriptors::open): Report correct name in error
4093         message.
4094
4095 2010-07-13  Doug Kwan  <dougkwan@google.com>
4096
4097         * arm.cc (Arm_input_section::Arm_input_section): For a
4098         SHT_ARM_EXIDX section, always keeps the input sections.
4099         (Arm_input_section::set_exidx_section_link): New method.
4100         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4101         has_errors_ to false.
4102         (Arm_exidx_input_section::has_errors,
4103         Arm_exidx_input_section::set_has_errors): New methods.
4104         (Arm_exidx_input_section::has_errors_): New data member.
4105         (Arm_relobj::get_exidx_shndx_list): New method.
4106         (Arm_output_section::append_text_sections_to_list): Do not skip
4107         section without SHF_EXECINSTR.
4108         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4109         errors.
4110         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4111         section header.  Make error messages more verbose.  Check for
4112         a non-executable section linked to an EXIDX section.
4113         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4114         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4115         check that there is no deferred EXIDX section if we exit early.
4116         Instead of not making an EXIDX section in case of an error, make one
4117         and set the has_errors flag of it.
4118         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4119         in a relocatable link.
4120         (Target_arm::do_relax): Look for the EXIDX output section instead of
4121         assuming that it is called .ARM.exidx.
4122         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4123         section list.  Do not check for SHF_EXECINSTR section flags but
4124         skip any input section with errors.
4125         * output.cc (Output_section::Output_section): Initialize
4126         always_keeps_input_sections_ to false.
4127         (Output_section::add_input_section): Check for
4128         always_keeps_input_sections_.
4129         *  output.h (Output_section::always_keeps_input_sections,
4130         Output_section::set_always_keeps_input_sections): New methods.
4131         (Output_section::always_keeps_input_sections): New data member.
4132
4133 2010-07-13  Rafael Espindola  <espindola@google.com>
4134
4135         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4136         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4137
4138 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4139             Ian Lance Taylor  <iant@google.com>
4140
4141         * output.h (Output_section_lookup_maps::add_merge_section):
4142         Correct check of whether value was inserted.
4143         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4144         (Output_section_lookup_maps::add_relaxed_input_section):
4145         Likewise.
4146         * arm.cc (Target_arm::got_section): Remove used local os.
4147         * i386.cc (Target_i386::got_section): Likewise.
4148         * x86_64.cc (Target_x86_64::got_section): Likewise.
4149         * sparc.cc (Target_sparc::got_section): Likewise.
4150         (Target_sparc::relocate): Remove unused local have_got_offset.
4151         * powerpc.cc (Target_powerpc::relocate): Likewise.
4152
4153 2010-07-13  Ian Lance Taylor  <iant@google.com>
4154
4155         * compressed_output.cc (zlib_decompress): Fix signature in
4156         !HAVE_ZLIB_H case.
4157
4158         * archive.cc (Archive::include_member): Unlock an external member
4159         of a thin archive.  Don't bother to delete an object we know is
4160         NULL.
4161
4162 2010-07-12  Cary Coutant  <ccoutant@google.com>
4163
4164         * compressed_output.cc (zlib_decompress): New function.
4165         (get_uncompressed_size): New function.
4166         (decompress_input_section): New function.
4167         * compressed_output.h (get_uncompressed_size): New function.
4168         (decompress_input_section): New function.
4169         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4170         Handle compressed debug sections.
4171         * layout.cc (is_compressed_debug_section): New function.
4172         (Layout::output_section_name): Map compressed section names to
4173         canonical names.
4174         * layout.h (is_compressed_debug_section): New function.
4175         (is_debug_info_section): Recognize compressed debug sections.
4176         * merge.cc: Include compressed_output.h.
4177         (Output_merge_data::do_add_input_section): Handle compressed
4178         debug sections.
4179         (Output_merge_string::do_add_input_section): Handle compressed
4180         debug sections.
4181         * object.cc: Include compressed_output.h.
4182         (Sized_relobj::Sized_relobj): Initialize new data members.
4183         (build_compressed_section_map): New function.
4184         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4185         * object.h (Object::section_is_compressed): New method.
4186         (Object::do_section_is_compressed): New method.
4187         (Sized_relobj::Compressed_section_map): New type.
4188         (Sized_relobj::do_section_is_compressed): New method.
4189         (Sized_relobj::compressed_sections_): New data member.
4190         * output.cc (Output_section::add_input_section): Handle compressed
4191         debug sections.
4192         * reloc.cc: Include compressed_output.h.
4193         (Sized_relobj::write_sections): Handle compressed debug sections.
4194
4195 2010-07-08  Cary Coutant  <ccoutant@google.com>
4196
4197         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4198         weak when resolving to a dynamic def.
4199         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4200         for weak undef/dynamic def cases. Adjust callers.
4201         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4202         undef_binding_weak_.
4203         (Symbol_table::sized_write_globals): Adjust symbol binding.
4204         (Symbol_table::sized_write_symbol): Add binding parameter.
4205         * symtab.h (Symbol::set_undef_binding): New method.
4206         (Symbol::is_undef_binding_weak): New method.
4207         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4208         (Symbol_table::should_override): Add new parameter.
4209         (Symbol_table::sized_write_symbol): Add new parameter.
4210
4211         * testsuite/weak_undef_file1.cc: Add new test case.
4212         * testsuite/weak_undef_file2.cc: Fix header comment.
4213         * testsuite/weak_undef_test.cc: Add new test case.
4214
4215 2010-06-29  Doug Kwan  <dougkwan@google.com>
4216
4217         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4218         Initialize USE_SYMBOL_.
4219         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4220         definition.
4221         (Arm_reloc_property::uses_symbol_): New data member declaration.
4222         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4223         uses symbol value and symbol is undefined but not weakly undefined.
4224
4225 2010-06-28  Rafael Espindola  <espindola@google.com>
4226
4227         * plugin.cc (Plugin::load): Use dlerror.
4228
4229 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4230
4231         * symtab.cc (detect_odr_violations): When reporting an ODR
4232         violation, report an object where the symbol is defined.
4233
4234 2010-06-25  Doug Kwan  <dougkwan@google.com>
4235
4236         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4237         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4238         definition.
4239         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4240         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4241         target hook to detect function points.
4242         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4243         * icf.h (Icf::check_section_for_function_pointers): Change type of
4244         parameter SECTION_NAME to const reference to std::string.  Use
4245         target hook to determine if section may have unsafe pointers.
4246         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4247         method definition.
4248
4249 2010-06-21  Rafael Espindola  <espindola@google.com>
4250
4251         * fileread.cc (Input_file::find_fie): New
4252         (Input_file::open): Use Input_file::find_fie.
4253         * fileread.h (Input_file::find_fie): New
4254         * plugin.cc (set_extra_library_path): New.
4255         (Plugin::load): Add set_extra_library_path to the transfer vector.
4256         (Plugin_manager::set_extra_library_path): New.
4257         (Plugin_manager::add_input_file): Use the extra search path if set.
4258         (set_extra_library_path(): New.
4259         * plugin.h (Plugin_manager): Add set_extra_library_path and
4260         extra_search_path_.
4261
4262 2010-06-19  Cary Coutant  <ccoutant@google.com>
4263
4264         * layout.cc (gdb_sections): Add .debug_types.
4265         (lines_only_debug_sections): Likewise.
4266
4267 2010-06-18  Rafael Espindola  <espindola@google.com>
4268
4269         * plugin.cc (add_input_file,add_input_library)
4270         (Plugin_manager::add_input_file): Make filename arguments const.
4271         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4272         const.
4273
4274 2010-06-16  Doug Kwan  <dougkwan@google.com>
4275
4276         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4277         .ARM.attributes section if we have not merged any input
4278         attributes sections.
4279
4280 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4281
4282         * arm.cc: Allow combining objects with no EABI version
4283         information.
4284
4285 2010-06-15  Rafael Espindola  <espindola@google.com>
4286
4287         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4288
4289 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4290
4291         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4292         (struct iovec): Correct !HAVE_READV definition.
4293
4294 2010-06-10  Cary Coutant  <ccoutant@google.com>
4295
4296         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4297         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4298         reloc sections.
4299         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4300
4301         PR 11683
4302         * symtab.h (Symbol::is_placeholder): New member function.
4303         * target-reloc.h (relocate_section): Check for placeholder symbols.
4304
4305         * testsuite/Makefile.am (plugin_test_8): New test.
4306         (plugin_test_9): New test.
4307         * testsuite/Makefile.in: Regenerate.
4308
4309 2010-06-09  Nick Clifton  <nickc@redhat.com>
4310
4311         * yyscript.y (input_list_element): Allow strings prefixed with
4312         the '-' character.  Treat these as libraries.
4313         * script.cc (script_add_library): New function.  Adds a library
4314         specified by "-l<name>" found in an input script.
4315         * script-c.h: Add prototype for script_add_library.
4316
4317 2010-06-07  Doug Kwan  <dougkwan@google.com>
4318
4319         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4320         Restrict stub-group size to be within long conditional branch
4321         range when working around cortex-A8 erratum.
4322
4323 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4324
4325         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4326         #ifdef typo.
4327
4328 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4329
4330         PR gold/11658
4331         * output.cc
4332         (Output_section::Input_section_sort_entry::compare_section_ordering):
4333         Change to return non-zero correctly.
4334         (Output_section::Input_section_sort_section_order_index_compare
4335         ::operator()): Change to fix ambiguity in comparisons.
4336
4337 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4338
4339         * gold.h (is_wildcard_string): New function.
4340         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4341         (Layout::layout_eh_frame): Ditto.
4342         (Layout::find_section_order_index): New method.
4343         (Layout::read_layout_from_file): New method.
4344         * layout.h (Layout::find_section_order_index): New method.
4345         (Layout::read_layout_from_file): New method.
4346         (Layout::input_section_position_): New private member.
4347         (Layout::input_section_glob_): New private member.
4348         * main.cc (main): Call read_layout_from_file here.
4349         * options.h (--section-ordering-file): New option.
4350         * output.cc (Output_section::input_section_order_specified_): New
4351         member.
4352         (Output_section::Output_section): Initialize new member.
4353         (Output_section::add_input_section): Add new parameter.
4354         Keep input sections when --section-ordering-file is used.
4355         (Output_section::set_final_data_size): Sort input sections when
4356         section ordering file is specified.
4357         (Output_section::Input_section_sort_entry): Add new parameter.
4358         Check sorting type.
4359         (Output_section::Input_section_sort_entry::compare_section_ordering):
4360         New method.
4361         (Output_section::Input_section_sort_compare::operator()): Change to
4362         consider section_order_index.
4363         (Output_section::Input_section_sort_init_fini_compare::operator()):
4364         Change to consider section_order_index.
4365         (Output_section::Input_section_sort_section_order_index_compare
4366         ::operator()): New method.
4367         (Output_section::sort_attached_input_sections): Change to sort
4368         according to section order when specified.
4369         (Output_section::add_input_section<32, true>): Add new parameter.
4370         (Output_section::add_input_section<64, true>): Add new parameter.
4371         (Output_section::add_input_section<32, false>): Add new parameter.
4372         (Output_section::add_input_section<64, false>): Add new parameter.
4373         * output.h (Output_section::add_input_section): Add new parameter.
4374         (Output_section::input_section_order_specified): New
4375         method.
4376         (Output_section::set_input_section_order_specified): New method.
4377         (Input_section::Input_section): Initialize section_order_index_.
4378         (Input_section::section_order_index): New method.
4379         (Input_section::set_section_order_index): New method.
4380         (Input_section::section_order_index_): New member.
4381         (Input_section::Input_section_sort_section_order_index_compare): New
4382         struct.
4383         (Output_section::input_section_order_specified_): New member.
4384         * script-sections.cc (is_wildcard_string): Delete and move modified
4385         method to gold.h.
4386         (Output_section_element_input::Output_section_element_input): Modify
4387         call to is_wildcard_string.
4388         (Output_section_element_input::Input_section_pattern
4389         ::Input_section_pattern): Ditto.
4390         (Output_section_element_input::Output_section_element_input): Ditto.
4391         * testsuite/Makefile.am (final_layout): New test case.
4392         * testsuite/Makefile.in: Regenerate.
4393         * testsuite/final_layout.cc: New file.
4394         * testsuite/final_layout.sh: New file.
4395
4396 2010-06-01  Rafael Espindola  <espindola@google.com>
4397
4398         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4399
4400 2010-06-01  Rafael Espindola  <espindola@google.com>
4401
4402         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4403         visibility of symbols.
4404
4405 2010-05-27  Doug Kwan  <dougkwan@google.com>
4406
4407         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4408         from start of output section instead of address for a local symbol
4409         in a merged or relaxed section when doing a relocatable link.
4410
4411 2010-05-26  Rafael Espindola  <espindola@google.com>
4412
4413        PR 11604
4414         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4415         adding sections the garbage collector removed.
4416         * gold/testsuite/Makefile.am: Add test.
4417         * gold/testsuite/Makefile.in: Regenerate.
4418         * gold/testsuite/plugin_test_7.sh: New.
4419         * gold/testsuite/plugin_test_7_1.c: New.
4420         * gold/testsuite/plugin_test_7_2.c: New.
4421
4422 2010-05-26  Rafael Espindola  <espindola@google.com>
4423
4424         * script-sections.cc (Output_section_definition::set_section_addresses):
4425         Check for --section-start.
4426
4427 2010-05-26  Doug Kwan  <dougkwan@google.com>
4428
4429         * arm.cc (Arm_scan_relocatable_relocs): New class.
4430         (Target_arm::relocate_special_relocatable): New method.
4431         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4432         (Arm_relocate_functions::thumb_branch_common): Same.
4433         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4434         instead of Default_scan_relocatable_relocs.
4435         * target-reloc.h (relocate_for_relocatable): Let target handle
4436         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4437         * target.h (Sized_target::relocate_special_relocatable): New method.
4438
4439 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4440
4441         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4442
4443 2010-05-23  Doug Kwan  <dougkwan@google.com>
4444
4445         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4446         instead of a cast.
4447         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4448         with a direct branch, not a conditional branch, to a stub.
4449         * merge.cc (Output_merge_base::record_input_section): New method
4450         defintion.
4451         (Output_merge_data::do_add_input_section): Record input section if
4452         keeps-input-sections flag is set.
4453         (Output_merge_string::do_add_input_section): Ditto.
4454         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4455         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4456         INPUT_SECTIONS_.
4457         (Output_merge_base::keeps_input_sections,
4458         Output_merge_base::set_keeps_input_sections,
4459         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4460         method definitions.
4461         (Output_merge_base::Input_sections): New type declaration.
4462         (Output_merge_base::input_sections_begin,
4463         Output_merge_base::input_sections_end,
4464         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4465         (Output_merge_base::bool keeps_input_sections_,
4466         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4467         Output_merge_base::input_sections_): New data members.
4468         (Output_merge_data::do_set_keeps_input_sections): New method
4469         defintion.
4470         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4471         * output.cc (Output_section::Input_section::relobj): Move method
4472         defintion from class declaration to here and handle merge sections.
4473         (Output_section::Input_section::shndx): Ditto.
4474         (Output_section::Output_section): Remove initializations of removed
4475         data members and initialize new data member LOOKUP_MAPS_.
4476         (Output_section::add_input_section): Set keeps-input-sections flag
4477         for a newly created merge output section as appropriate.  Adjust code
4478         to use Output_section_lookup_maps class.
4479         (Output_section::add_relaxed_input_section): Adjst code for lookup
4480         maps code refactoring.
4481         (Output_section::add_merge_input_section): Add a new parameter
4482         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4483         class.  If adding input section to a newly created merge output
4484         section fails, remove the new merge section.
4485         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4486         Adjust code for use of the Output_section_lookup_maps class.
4487         (Output_section::find_merge_section): Ditto.
4488         (Output_section::build_lookup_maps): New method defintion.
4489         (Output_section::find_relaxed_input_section): Adjust code to use
4490         Output_section_lookup_maps class.
4491         (Output_section::get_input_sections): Export merge sections.  Adjust
4492         code to use Output_section_lookup_maps class.
4493         (Output_section:::add_script_input_section): Adjust code to use
4494         Output_section_lookup_maps class.  Update lookup maps for merge
4495         sections also.
4496         (Output_section::discard_states): Use Output_section_lookup_maps.
4497         (Output_section::restore_states): Same.
4498         * output.h (Merge_section_properties): Move class defintion out of
4499         Output_section.
4500         (Output_section_lookup_maps): New class.
4501         (Output_section::Input_section::is_merge_section): New method
4502         defintion.
4503         (Output_section::Input_section::relobj): Move defintion out of class
4504         defintion.  Declare method only.
4505         (Output_section::Input_section::shndx): Ditto.
4506         (Output_section::Input_section::output_merge_base): New method defintion.
4507         (Output_section::Input_section::u2_.pomb): New union field.
4508         (Output_section::Merge_section_by_properties_map,
4509         Output_section::Output_section_data_by_input_section_map,
4510         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4511         Remove types.
4512         (Output_section::add_merge_input_section): Add new parameter
4513         KEEPS_INPUT_SECTIONS.
4514         (Output_section::build_lookup_maps): New method declaration.
4515         (Output_section::merge_section_map_,
4516         Output_section::merge_section_by_properties_map_,
4517         Output_section::relaxed_input_section_map_,
4518         Output_section::is_relaxed_input_section_map_valid_): Remove data
4519         members.
4520         (Output_section::lookup_maps_): New data member.
4521
4522 2010-05-21  Doug Kwan  <dougkwan@google.com>
4523
4524         PR gold/11619
4525         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4526         avoid a compilation error.
4527
4528 2010-05-19  Rafael Espindola  <espindola@google.com>
4529
4530         * script-sections.cc (Output_section_definition::allocate_to_segment):
4531         Update the phdrs_list even when the output section is NULL.
4532         * testsuite/Makefile.am: Add test.
4533         * testsuite/Makefile.in: Regenerate.
4534         * testsuite/script_test_9.cc: New.
4535         * testsuite/script_test_9.sh: New.
4536         * testsuite/script_test_9.t: New.
4537
4538 2010-05-19  Doug Kwan  <dougkwan@google.com>
4539
4540         * arm.cc (Arm_input_section::original_size): New method.
4541         (Arm_input_section::do_addralign): Add a cast.
4542         (Arm_input_section::do_output_offset): Remove static cast.
4543         (Arm_input_section::original_addralign,
4544          Arm_input_section::original_size_): Change type to uint32_t.
4545         (Arm_input_section::init): Add safe casts for section alignment
4546         and size.
4547         (Arm_input_section::set_final_data_size): Do not set address and
4548         offset of stub table.
4549         (Arm_output_section::fix_exidx_coverage): Change use of of
4550         Output_section::Simple_input_section to that of
4551         Output_section::Input_section.
4552         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4553         except for the first pass.
4554         * output.cc (Output_section::get_input_sections): Change type of
4555         input_sections to std::list<Input_section>.
4556         (Output_section::add_script_input_section): Rename from
4557         Output_section::add_simple_input_section.  Change type of SIS
4558         parameter from Simple_input_section to Input_section.
4559         * output.h (Output_section::Simple_input_section): Remove class.
4560         (Output_section::Input_section): Change class visibility to public.
4561         (Output_section::Input_section::addralign): Use stored alignments
4562         for special input sections if set.
4563         (Output_section::Input_section::set_addralign): New method.
4564         (Output_section::get_input_sections): Change parameter type from
4565         list of Simple_input_section to list of Input_section.
4566         (Output_section::add_script_input_section): Rename from
4567         Output_section::add_simple_input_section. Change first parameter's
4568         type from Simple_input_section to Input_section and remove the
4569         second and third parameters.
4570         * script-sections.cc (Input_section::Input_section_list): Change
4571         type to list of Output_section::Input_section/
4572         (Input_section_info::Input_section_info): Change parameter type of
4573         INPUT_SECTION to Output_section::Input_section.
4574         (Input_section_info::input_section): Change return type.
4575         (Input_section_info::input_section_): Change type to
4576         Output_section::Input_section.
4577         (Output_section_element_input::set_section_addresses): Adjust code
4578         to use Output_section::Input_section instead of
4579         Output_section::Simple_input_section.  Adjust code for renaming
4580         of Output_section::add_simple_input_section.
4581         (Orphan_output_section::set_section_addresses): Ditto.
4582
4583 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4584
4585         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4586         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4587
4588 2010-05-18  Rafael Espindola  <espindola@google.com>
4589
4590         * options.cc (General_options::finalize): Handle -nostdlib.
4591         * options.h (nostdlib): New option.
4592         * script.cc (script_add_search_dir): Handle -nostdlib.
4593
4594 2010-05-12  Doug Kwan  <dougkwan@google.com>
4595
4596         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4597         attributes section only if there no attributes section after merging.
4598         (Target_arm::merge_object_attributes): Move value of
4599         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4600         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4601         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4602         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4603         and arm_attr_merge_7.stdout.
4604         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4605         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4606         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4607         arm_attr_merge_7b.o): New rules.
4608         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4609         arm_attr_merge_7
4610         * testsuite/Makefile.in: Regenerate.
4611         * testsuite/arm_attr_merge.sh: New file.
4612         * testsuite/arm_attr_merge_[67][ab].s: Same.
4613
4614 2010-05-05  Nick Clifton  <nickc@redhat.com>
4615
4616         * po/es.po: Updated Spanish translation.
4617
4618 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4619
4620         * Makefile.am (install-exec-local): Properly install gold as
4621         default cross linker.
4622         * Makefile.in: Regenerated.
4623
4624 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4625             Nick Clifton  <nickc@redhat.com>
4626
4627         * configure.ac (install_as_default): Define and set to false
4628         unless --enable-gold or --enable-gold=both/gold has been
4629         specified.
4630         * configure: Regenerate.
4631
4632         * Makefile.am (install-exec-local): Install the executable as
4633         'ld.gold'.  If install_as_default is true then also install it as
4634         'ld'.
4635         * Makefile.in: Regenerated.
4636
4637 2010-04-24  Ian Lance Taylor  <iant@google.com>
4638
4639         * layout.cc (Layout::layout_reloc): In relocatable link don't
4640         combine reloc sections for grouped sections.
4641
4642 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4643
4644         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4645         sections that are not ordinary to icf.
4646         * icf.cc (get_section_contents): Handle relocation pointing to section
4647         with no object or shndx information.
4648         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4649         * testsuite/Makefile.in: Regenerate.
4650         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4651         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4652
4653 2010-04-22  Ian Lance Taylor  <iant@google.com>
4654
4655         * expression.cc (Expression::Expression_eval_info): Add
4656         result_alignment_pointer field.
4657         (Expression::eval_with_dot): Add result_alignment_pointer
4658         parameter.  Change all callers.
4659         (Expression::eval_maybe_dot): Likewise.
4660         (class Binary_expression): Add alignment_pointer parameter to
4661         left_value and right_value.  Change all callers.
4662         (BINARY_EXPRESSION): Set result alignment.
4663         (class Trinary_expression): Add alignment_pointer parameter to
4664         arg2_value and arg3_value.  Change all callers.
4665         (Trinary_cond::value): Set result alignment.
4666         (Max_expression::value, Min_expression::value): Likewise.
4667         (Align_expression::value): Likewise.
4668         * script-sections.cc (class Sections_element): Add dot_alignment
4669         parameter to set_section_addresses virtual function.  Update
4670         instantiations.
4671         (class Output_section_element): Likewise.
4672         (Script_sections::create_segments): Add dot_alignment parameter.
4673         Change all callers.
4674         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4675         (Script_sections::set_phdrs_clause_addresses): Likewise.
4676         * script-sections.h: Update declarations.
4677         * script.h: Update declarations.
4678         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4679         min_p_align.
4680         * testsuite/script_test_3.t: Set large alignment.
4681         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4682         segment has expected alignment.
4683
4684 2010-04-22  Nick Clifton  <nickc@redhat.com>
4685
4686         * po/gold.pot: Updated by the Translation project.
4687         * po/vi.po: Updated Vietnamese translation.
4688
4689 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4690
4691         * testsuite/Makefile.am (check_PROGRAMS): Add
4692         icf_virtual_function_folding_test.
4693         * testsuite/Makefile.in: Regenerated.
4694
4695 2010-04-15  Andrew Haley  <aph@redhat.com>
4696
4697         * options.h (merge_exidx_entries): New option.
4698         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4699         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4700         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4701         (Target_arm::merge_exidx_entries): New function.
4702         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4703         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4704         to Arm_exidx_fixup constructor.
4705         Add new arg, merge_exidx_entries.
4706         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4707         Arm_output_section::fix_exidx_coverage.
4708
4709 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4710
4711         * icf.cc (get_section_contents): Check for preemptible functions.
4712         Ignore addend when appropriate.
4713         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4714         section folded.
4715         (add_from_relobj): Check for section folded.
4716         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4717         * symtab.h (should_add_dynsym_entry): Add new parameter.
4718         * target-reloc.h (scan_relocs): Check for section folded.
4719         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4720         Check reloc types for function pointers in shared objects.
4721         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4722         case.
4723         (icf_preemptible_functions_test): New test case.
4724         (icf_string_merge_test): New test case.
4725         * testsuite.Makefile.in: Regenerate.
4726         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4727         bar_glob.  Refactor code.
4728         * testsuite/icf_preemptible_functions_test.cc: New file.
4729         * testsuite/icf_preemptible_functions_test.sh: New file.
4730         * testsuite/icf_string_merge_test.cc: New file.
4731         * testsuite/icf_string_merge_test.sh: New file.
4732         * testsuite/icf_virtual_function_folding_test.cc: New file.
4733         * testsuite/icf_virtual_function_folding_test.sh: New file.
4734
4735 2010-04-14  Doug Kwan  <dougkwan@google.com>
4736
4737         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4738         for local symbol recounting if we remove a section due to ICF.
4739         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4740         there are no regular objects in input.
4741
4742 2010-04-13  Doug Kwan  <dougkwan@google.com>
4743
4744         * arm.cc (Arm_input_section::set_final_data_size): Compute
4745         accurate final data size instead of using current data size.
4746
4747 2010-04-09  Doug Kwan  <dougkwan@google.com>
4748
4749         * layout.cc (Layout::choose_output_section): Handle script section
4750         types.
4751         (Layout::make_output_section_for_script): Add section type parameter.
4752         Handle script section types.
4753         * layout.h (Layout::make_output_section_for_script): Add section
4754         type parameter.
4755         * output.cc (Output_section::Output_section): Initialize data member
4756         is_noload_.
4757         (Output_section::do_reset_address_and_file_offset): Do not set address
4758         to 0 if section is a NOLOAD section.
4759         * output.h (Output_section::is_noload): New method.
4760         (Output_section::set_is_noload): Ditto.
4761         (Output_section::is_noload_): New data member.
4762         * script-c.h (Script_section_type): New enum type.
4763         (struct Parser_output_section_header): Add new file section_type.
4764         * script-sections.cc (Sections_element::output_section_name): Add
4765         parameter for returning script section type.
4766         (Output_section_definition::output_section_name): Ditto.
4767         (Output_section_definition::section_type)P; New method.
4768         (Output_section_definiton::script_section_type_name): Ditto.
4769         (Output_section_definition::script_section_type_): New data member.
4770         (Output_section_definition::Output_section_definition): Initialize
4771         data member Output_section_definition::script_section_type_.
4772         (Output_section_definition::create_sections): Pass script section type
4773         to Layout::make_output_section_for_script.
4774         (Output_section_definition::output_section_name): Return script
4775         section type to caller.
4776         (Output_section_definition::set_section_address): Do not advance
4777         dot value and load address if section type is NOLOAD.  Set address
4778         of NOLOAD sections regardless of section flags.
4779         (Output_section_definition::print): Print section type if it is
4780         not SCRIPT_SECTION_TYPE_NONE.
4781         (Output_section_definition::section_type): New method.
4782         (Output_section_definition::script_section_type_name): Ditto.
4783         (Script_sections::output_section_name): Add new parameter
4784         PSECTION_TYPE for returning script section type.  Pass it to
4785         section elements.  Handle discard sections.
4786         (Sort_output_sections::operator()): Handle NOLOAD sections.
4787         * script-sections.h (Script_sections::Section_type): New enum type.
4788         (Script_sections::output_section_name): Add a new parameter for
4789         returning script section type.
4790         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4791         INFO and NOLOAD.
4792         * yyscript.y (union): Add new field SECTION_TYPE.
4793         (COPY, DSECT, INFO, NOLOAD): New tokens.
4794         (opt_address_and_section_type): Change type to output_section_header.
4795         (section_type): New non-terminal
4796         (section_header): Handle section type.
4797         (opt_address_and_section_type): Return section type value.
4798
4799 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4800
4801         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4802         * testsuite/plugin_common_test_2.c (foo): Likewise.
4803
4804 2010-04-08  Doug Kwan  <dougkwan@google.com>
4805
4806         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4807         Output_merge_data.
4808         * output.cc (Output_section::add_merge_input_section): Simplify
4809         code and return status of Output_merge_base::add_input_section.
4810         Update merge section map only if Output_merge_base::add_input_section
4811         returns true.
4812
4813 2010-04-07  Doug Kwan  <dougkwan@google.com>
4814
4815         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4816         if section is marked as containing instructions but has no mapping
4817         symbols.
4818         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4819         correct section index.
4820         (Arm_relobj::find_linked_text_section): Ditto.
4821
4822 2010-04-07  Cary Coutant  <ccoutant@google.com>
4823
4824         * archive.cc (include_member): Destroy Read_symbols_data object before
4825         releasing file.
4826         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4827         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4828         (Read_symbols_data::~Read_symbols_data) New destructor.
4829         (Section_relocs::Section_relocs) New constructor.
4830         (Section_relocs::~Section_relocs) New destructor.
4831         (Read_relocs_data::Read_relocs_data) New constructor.
4832         (Read_relocs_data::~Read_relocs_data) New destructor.
4833         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4834         pointers to NULL after deleting.
4835
4836 2010-04-07  Doug Kwan  <dougkwan@google.com>
4837
4838         * arm.cc: Replace "endianity" with "endianness" in comments.
4839         (Arm_exidx_cantunwind): Ditto.
4840         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4841         (Arm_relobj::merge_flags_and_attributes): New method.
4842         (Arm_relobj::merge_flags_and_attributes_): New data member.
4843         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4844         (Arm_relobj::scan_sections_for_stubs): Ditto.
4845         (Arm_relobj::do_read_symbols): Check to see if we really want to
4846         merge processor-specific flags and attributes.  Exit early if
4847         an object is empty except for section names and the undefined symbol.
4848         (Target_arm::do_finalize_sections): Move check for ELF format to
4849         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4850         attributes from a regular object only when we have determined that
4851         it is aapropriate.  Do not create an .ARM.attributes section in
4852         output if there is no regular input object.
4853         (Target_arm::merge_processor_specific_flags): Check
4854         --warn-mismatch before printing any error.
4855         (Target_arm::merge_object_attributes): Ditto.
4856         * gold.cc (queue_middle_tasks): Handle the case in which there is
4857         no regular object in input.
4858         * options.cc (General_options::parse_EB): New method.
4859         (General_options::parse_EL): Same.
4860         (General_options::General_options): Initialize endianness_.
4861         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4862         New options.
4863         (General_options::Endianness): New enum.
4864         (General_options::endianness): New method.
4865         (General_options::endianness_): New data member.
4866         * parameters.cc (Parameters::set_options): Check target endianness.
4867         (Parameters::set_target_once): Ditto.
4868         (Parameters::check_target_endianness): New method.
4869         (parameters_force_valid_target): If either -EL or -EB is specified,
4870         use it to define endianness of default target.
4871         * parameters.h (Parameters::check_target_endianness): New method
4872         declaration.
4873         * target.h (class Target): Change "endianity" to "endianness"
4874         in comments.
4875
4876 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4877
4878         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4879         * configure: Regenerate.
4880         * Makefile.in: Regenerate.
4881         * testsuite/Makefile.in: Regenerate.
4882
4883 2010-04-06  Cary Coutant  <ccoutant@google.com>
4884
4885         gcc PR lto/42757
4886         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4887         prevailing definitions of common symbols.
4888         * testsuite/plugin_test_6.sh: New test case.
4889         * testsuite/plugin_common_test_1.c: New test case.
4890         * testsuite/plugin_common_test_2.c: New test case.
4891         * testsuite/Makefile.am (plugin_test_6): New test case.
4892         * testsuite/Makefile.in: Regenerate.
4893
4894 2010-04-06  Nick Clifton  <nickc@redhat.com>
4895
4896         * po/vi.po: New Vietnamese translation.
4897
4898 2010-03-30  Doug Kwan  <dougkwan@google.com>
4899
4900         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4901
4902 2010-03-25  Doug Kwan  <dougkwan@google.com>
4903
4904         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4905         to avoid a conversion warning on a 32-bit host.
4906
4907 2010-03-24  Ian Lance Taylor  <iant@google.com>
4908
4909         * testsuite/script_test_3.t: Add a TLS segment.
4910         * testsuite/Makefile.am (check_PROGRAMS): Add
4911         tls_phdrs_script_test.
4912         (tls_phdrs_script_test_SOURCES): Define.
4913         (tls_phdrs_script_test_DEPENDENCIES): Define.
4914         (tls_phdrs_script_test_LDFLAGS): Define.
4915         (tls_phdrs_script_test_LDADD): Define.
4916         * testsuite/Makefile.in: Rebuild.
4917
4918 2010-03-23  Cary Coutant  <ccoutant@google.com>
4919
4920         * fileread.cc (find_or_make_view): Fix comment.
4921
4922 2010-03-23  Ian Lance Taylor  <iant@google.com>
4923
4924         * script-sections.cc (class Orphan_section_placement): Define
4925         PLACE_TLS and PLACE_TLS_BSS.
4926         (Orphan_section_placement::Orphan_section_placement): Initialize
4927         new places.
4928         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4929         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4930         (tls_script_test_SOURCES): Define.
4931         (tls_script_test_DEPENDENCIES): Define.
4932         (tls_script_test_LDFLAGS): Define.
4933         (tls_script_test_LDADD): Define.
4934         * testsuite/Makefile.in: Rebuild.
4935
4936 2010-03-22  Doug Kwan  <dougkwan@google.com>
4937
4938         * arm.cc (Arm_relocate_functions::abs8,
4939         Arm_relocate_functions::abs16): Use correct check for overflow
4940         specified in the ARM ELF specs.
4941         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4942         target of a BLX instruction specially.
4943         (Reloc_stub::stub_type_for_reloc): Ditto.
4944         (Relocate::relocate): Use symbolic names instead of numeric relocation
4945         codes to report error.
4946         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4947         workaround.
4948         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4949         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4950         thumb2_blx_out_of_range.stdout
4951         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4952         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4953         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4954         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4955         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4956         thumb2_blx_in_range, thumb2_blx_in_range.o,
4957         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4958         thumb2_blx_out_of_range.o): New rules.
4959         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4960         thumb2_blx_in_range and thumb2_blx_out_of_range.
4961         * testsuite/Makefile.in: Regenerate.
4962         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4963         * testsuite/thumb_blx_in_range.s: New file.
4964         * testsuite/thumb_blx_out_of_range.s: New file.
4965
4966 2010-03-22  Rafael Espindola  <espindola@google.com>
4967
4968         * archive.cc (Should_include): Move to archive.h.
4969         (should_include_member): Make it a member of Archive.
4970         (Lib_group): New.
4971         (Add_lib_group_symbols): New.
4972         * archive.h: Include options.h.
4973         (Archive_member): Moved from Archive.
4974         (Should_include): Moved from archive.cc.
4975         (Lib_group): New.
4976         (Add_lib_group_symbols): New.
4977         * dynobj.cc (do_should_include_member): New.
4978         * dynobj.h (do_should_include_member): New.
4979         * gold.cc (queue_initial_tasks): Update call to queue.
4980         * main.cc (main): Print lib group stats.
4981         * object.cc (do_should_include_member): New.
4982         * object.h: Include archive.h.
4983         (Object::should_include_member): New.
4984         (Object::do_should_include_member): New.
4985         (Sized_relobj::do_should_include_member): New.
4986         * options.cc (General_options::parse_start_lib): New.
4987         (General_options::parse_end_lib): New.
4988         (Input_arguments::add_file): Handle lib groups.
4989         (Input_arguments::start_group): Check we are not in a lib.
4990         (Input_arguments::start_lib): New.
4991         (Input_arguments::end_lib): New.
4992         * options.h (General_options): Add start_lib and end_lib.
4993         (Input_argument::lib_): New.
4994         (Input_argument::lib): New.
4995         (Input_argument::is_lib): New.
4996         (Input_file_lib): New.
4997         (Input_arguments::in_lib_): New.
4998         (Input_arguments::in_lib): New.
4999         (Input_arguments::start_lib): New.
5000         (Input_arguments::end_lib_): New.
5001         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5002         in unused members as preempted.
5003         (Sized_pluginobj::do_should_include_member): New.
5004         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5005         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5006         return the blocker.
5007         (Read_symbols::do_whole_lib_group): New.
5008         (Read_symbols::do_lib_group): New.
5009         (Read_symbols::do_read_symbols): Handle lib groups.
5010         (Read_symbols::get_name): Handle lib groups.
5011         * readsyms.h (Read_symbols): Add an archive member pointer.
5012         (Read_symbols::do_whole_lib_group): New.
5013         (Read_symbols::do_lib_group): New.
5014         (Read_symbols::member_): New.
5015         * script.cc (read_input_script): Update call to queue_soon.
5016
5017 2010-03-19  Doug Kwan  <dougkwan@google.com>
5018
5019         * arm.cc (Stub_table::Stub_table): Initialize new data members
5020         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5021         (Stub_table::add_reloc_stub): Assign stub offset and update
5022         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5023         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5024         New data members.
5025         (Stub_table::update_data_size_and_addralign): Use
5026         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5027         instead of going over all reloc stubs.
5028         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5029         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5030         Stringpool_template::offset_ to size of Stringpool_char.
5031         (Stringpool_template::new_key_offset): Remove code to initialize
5032         Stringpool_template::offset_.
5033         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5034         Stringpool_template::offset_ to zero.
5035
5036 2010-03-15  Doug Kwan  <dougkwan@google.com>
5037
5038         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5039         offset_.
5040         (Stringpool_template::new_key_offset): New method.
5041         (Stringpool_template::add_string): Assign offsets when adding new
5042         strings.
5043         (Stringpool_template::set_string_offsets): Do not set string offsets
5044         when not optimizing.
5045         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5046         member size_.
5047         (Chunked_vector::clear): Clear size_.
5048         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5049         (Chunked_vector::size): Return size_.
5050         (Chunked_vector::push_back): Use size_ to find insert position.
5051         (Chunked_vector::size_): New data member.
5052         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5053         (Stringpool_template::new_key_offset): New method declaration.
5054         (Stringpool_template::offset_): New data member.
5055
5056 2010-03-15   Rafael Espindola  <espindola@google.com>
5057
5058         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5059         Add_symbols' constructor.
5060         * readsyms.h (Add_symbols): Remove the input_group member.
5061
5062 2010-03-10  Ian Lance Taylor  <iant@google.com>
5063
5064         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5065         target to ask whether a reference to a symbol requires a stack
5066         split.
5067         * target.h (Target::is_call_to_non_split): New function.
5068         (Target::do_is_call_to_non_split): Declare virtual function.
5069         * target.cc: Include "symtab.h".
5070         (Target::do_is_call_to_non_split): New function.
5071         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5072
5073 2010-03-10  Cary Coutant  <ccoutant@google.com>
5074
5075         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5076         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5077         (File_read::open[2]): Add whole_file_view_ to list of views.
5078         (File_read::make_view): Remove test of whole_file_view_.
5079         (File_read::find_or_make_view): Create whole_file_view_ if
5080         necessary.
5081         (File_read::clear_views): Replace bool parameter with enum;
5082         adjust all callers.  Don't delete views with permanent data;
5083         do delete cached views and views from archives if
5084         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5085         if clearing the corresponding view.
5086         * fileread.h (File_read::Clear_views_mode): New enum.
5087         (File_read::View::is_permanent_view): New method.
5088         (File_read::clear_views): Replace bool parameter
5089         with enum; adjust all callers.
5090         * options.h (General_options): Change keep_files_mapped option;
5091         add map_whole_files.
5092         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5093         releasing the file.
5094         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5095         the file.
5096
5097 2010-03-10  David S. Miller  <davem@davemloft.net>
5098
5099         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5100
5101 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5102
5103         * icf.cc (get_section_contents): Add '@' marker after processing the
5104         merge reloc.
5105
5106 2010-03-08  Doug Kwan  <dougkwan@google.com>
5107
5108         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5109         due to a conversion warning.
5110         (Arm_relobj::update_output_local_symbol_count): Check for local
5111         symbol with unset output index.
5112
5113 2010-03-05  Ian Lance Taylor  <iant@google.com>
5114
5115         * options.h (class General_options): Add --spare-dynamic-tags.
5116         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5117         --spare-dynamic-tags.
5118
5119 2010-03-05  Ian Lance Taylor  <iant@google.com>
5120
5121         * incremental.cc: Include "libiberty.h".
5122
5123 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5124
5125         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5126         function, is_info_ member.
5127         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5128         (Versions::Versions): Update caller.
5129         (Versions::define_base_version): Likewise.
5130         (Versions::add_def): Likewise.
5131
5132 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5133
5134         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5135         (Scan::possible_function_pointer_reloc): New function.
5136         (Scan::local_reloc_may_be_function_pointer): Change to call
5137         possible_function_pointer_reloc.
5138         (Scan::global_reloc_may_be_function_pointer): Ditto.
5139         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5140         relocations in ".data.rel.ro._ZTV" section.
5141         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5142         * testsuite/icf_safe_so_test.cc: Ditto.
5143         * testsuite/icf_safe_test.cc: Ditto.
5144         * testsuite/icf_safe_test.sh: Ditto.
5145
5146 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5147             Ian Lance Taylor  <iant@google.com>
5148
5149         * target-reloc.h (relocate_section): Check the symbol table index
5150         for -1U before setting the local symbol index.
5151         (scan_relocatable_relocs): If copying the relocation, record that
5152         the local symbol is required.
5153         * object.h (Symbol_value::is_output_symtab_index_set): New
5154         function.
5155         (Symbol_value::may_be_discarded_from_output_symtab): New
5156         function.
5157         (Symbol_value::has_output_symtab_entry): New function.
5158         (Symbol_value::needs_output_symtab_entry): Remove.
5159         (Symbol_value::output_symtab_index): Make sure the symbol index is
5160         set.
5161         (Symbol_value::set_output_symtab_index): Make sure the symbol
5162         index is not set.  Make sure the new index is valid.
5163         (Symbol_value::set_must_have_output_symtab_entry): New function.
5164         (Symbol_value::has_output_dynsym_entry): New function.
5165         (Symbol_value::set_output_dynsym_index): Make sure the new index
5166         is valid.
5167         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5168         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5169         local symbol if permitted.
5170         (Sized_relobj::do_finalize_local_symbols): Call
5171         is_output_symtab_index_set rather than needs_output_symtab_entry.
5172         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5173         rather than needs_output_symtab_entry.  Call
5174         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5175         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5176         is_output_symtab_index_set rather than needs_output_symtab_entry.
5177         * testsuite/discard_locals_relocatable_test.c: New file.
5178         * testsuite/discard_locals_test.sh: Test -r.
5179         * testsuite/Makefile.am (check_DATA): Add
5180         discard_locals_relocatable_test1.syms,
5181         discard_local_relocatable_test2.syms.
5182         (MOSTLYCLEANFILES): Likewise.  Also add
5183         discard_locals_relocatable_test1.lout and
5184         discard_locals_relocatable_test2.out.
5185         (discard_locals_relocatable_test1.syms): New target.
5186         (discard_locals_relocatable_test.o): New target.
5187         (discard_locals_relocatable_test1.out): New target.
5188         (discard_locals_relocatable_test2.syms): New target.
5189         (discard_locals_relocatable_test2.out): New target.
5190         (various): Add missing ../ld-new dependencies.
5191         * testsuite/Makefile.in: Rebuild.
5192
5193 2010-03-03  Nick Clifton  <nickc@redhat.com>
5194
5195         * po/fi.po: New Finnish translation.
5196
5197 2010-03-01  Doug Kwan  <dougkwan@google.com>
5198
5199         * layout.cc (Layout::Layout): Force section types of .init_array*,
5200         .preinit_array* and .fini_array* sections.
5201         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5202         Fix check of return value of std::string::find.().
5203         (Output_section::Input_section_sort_compare::operator()): Remove
5204         comment about .init_array.
5205         (Output_section::Input_section_sort_init_fini_compare::operator()):
5206         New method.
5207         (Output_section::sort_attached_input_sections): Handle .init_array
5208         and .fini_array specially.
5209         * output.h (Output_section::Inut_section_sort_compare): Update
5210         comment.
5211         (Output_section::Input_section_sort_init_fini_compare): New struct.
5212
5213 2010-02-26  Doug Kwan  <dougkwan@google.com>
5214
5215         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5216         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5217         * testsuite/debug_msg.sh: Avoid matching source line number for
5218         use of global variable undef_int.
5219
5220 2010-02-26  Doug Kwan  <dougkwan@google.com>
5221
5222         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5223         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5224         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5225         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5226         * options.cc (General_options::General_options): Initialize member
5227         fix_v4bx_.
5228         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5229         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5230         and rm_no_fix_v4bx.stdout
5231         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5232         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5233         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5234         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5235         and arm_no_fix_v4bx.
5236         * Makefile.in: Regenerate.
5237         * testsuite/arm_fix_v4bx.s: New file.
5238         * testsuite/arm_fix_v4bx.sh: Ditto.
5239
5240 2010-02-24  Doug Kwan  <dougkwan@google.com>
5241
5242         * arm.cc (Target_arm::got_section): Make the .got section the first
5243         non RELRO section in the data segment.
5244         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5245         suffixes of section names.
5246
5247 2010-02-24  Doug Kwan  <dougkwan@google.com>
5248
5249         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5250         flags and attributes merging if an input file is a binary file.
5251         * fileread.cc (Input_file::open): Record format of original file.
5252         * fileread.h (Input_file::Format): New enum type.
5253         (Input_file::Input_file): Initialize data member format_.
5254         (Input_file::format): New method definition.
5255         (Input_file::format_):: New data member.
5256
5257 2010-02-24  Doug Kwan  <dougkwan@google.com>
5258
5259         * arm.cc (Arm_output_data_got): New class.
5260         (ARM_TCB_SIZE): New constant
5261         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5262         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5263         If user uses a script with a SECTIONS clause, issue only a warning
5264         for a misplaced EXIDX input section.  Otherwise, issue an error.
5265         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5266         garbage collection.
5267         (Target_arm::got_mode_index_entry): Handle static linking.
5268         (Target_arm::Scan::local): Ditto.
5269         (Target_arm::Scan::global): Ditto.
5270         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5271         all incorrectly implemented relocations.
5272         (Target_arm::fix_exidx_coverage): Pass layout to
5273         Arm_output_section::fix_exidx_coverage.
5274         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5275         from ".ARM.exidx." and ".ARM.extab.".
5276
5277 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5278
5279         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5280         section if it does not already exist.
5281         * attributes.cc (Attributes_section_data::Attributes_section_data):
5282         Don't crash if size is zero.
5283
5284 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5285             Ian Lance Taylor  <iant@google.com>
5286
5287         * gold.cc (queue_middle_tasks): If no input files were opened,
5288         exit.
5289         * workqueue.h (Task_function::Task_function): Assert that there is
5290         a blocker.
5291
5292 2010-02-22  Doug Kwan  <dougkwan@google.com>
5293
5294         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5295         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5296         types to avoid warnings due to different uint64_t implementations
5297         on different hosts.
5298
5299 2010-02-21  Doug Kwan  <dougkwan@google.com>
5300
5301         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5302         handling of the maximum backward branch offset.
5303         (Arm_relocate_functions::thumb_branch_common): Ditto.
5304         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5305         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5306         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5307         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5308         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5309         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5310         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5311         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5312         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5313         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5314         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5315         thumb2_bl_out_of_range.o): New rules.
5316         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5317         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5318         thumb2_bl_out_of_range
5319         * testsuite/Makefile.in: Regenerate.
5320         * testsuite/arm_bl_in_range.s: New file.
5321         * testsuite/arm_bl_out_of_range.s: Ditto.
5322         * testsuite/arm_branch_in_range.sh: Ditto.
5323         * testsuite/arm_branch_range.t: Ditto.
5324         * testsuite/thumb2_branch_range.t: Ditto.
5325         * testsuite/thumb_bl_in_range.s: Ditto.
5326         * testsuite/thumb_bl_out_of_range.s: Ditto.
5327         * testsuite/thumb_branch_range.t: Ditto.
5328
5329 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5330
5331         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5332         Add reloc offset information.
5333         * icf.cc (get_section_contents): Change iterators to point to the new
5334         vectors. Add reloc offset information to the contents.
5335         * icf.h (Icf::Sections_reachable_info): New typedef.
5336         (Icf::Sections_reachable_list): New typedef.
5337         (Icf::Offset_info): New typedef.
5338         (Icf::Reloc_info): New struct typedef.
5339         (Icf::Reloc_info_list): New typedef.
5340         (Icf::symbol_reloc_list): Delete method.
5341         (Icf::addend_reloc_list): Delete method.
5342         (Icf::section_reloc_list): Delete method.
5343         (Icf::reloc_info_list): New method.
5344         (Icf::reloc_info_list_): New member.
5345
5346 2010-02-19  Doug Kwan  <dougkwan@google.com>
5347
5348         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5349         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5350         * arm.cc (Arm_relocation_functions): New forward declaration.
5351         (Target_arm::Target_arm): Initialize new data members
5352         got_mod_index_offset_ and tls_base_symbol_defined_.
5353         (Target_arm::Relocate::relocate_tls): New method.
5354         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5355          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5356         New methods.
5357         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5358         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5359         (Target_arm::got_mod_index_offset_,
5360         Target_arm::tls_base_symbol_defined_): New data members.
5361         (Target_arm::Scan::local, Target::Scan::global,
5362         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5363         relocations.
5364
5365 2010-02-18  Doug Kwan  <dougkwan@google.com>
5366
5367         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5368         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5369         text section as a parameter becuase some broken tools may not set
5370         the link in section header.
5371         (Target_arm::has_got_section): New method.
5372         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5373         without any mapping symbol as data only.  Remove warning.
5374         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5375         link in its section header, try to discover the link by inspecting the
5376         REL31 relocation at the beginning of the section.
5377         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5378         in error message.
5379         (Target_arm::Scan::global): Treat any reference to the symbol
5380         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5381
5382 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5383
5384         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5385         (Scan::global_reloc_may_be_function_pointer): New function.
5386         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5387         (Scan::global_reloc_may_be_function_pointer): New function.
5388         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5389         (Scan::global_reloc_may_be_function_pointer): New function.
5390         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5391         (Scan::global_reloc_may_be_function_pointer): New function.
5392         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5393         (Scan::global_reloc_may_be_function_pointer): New function.
5394         (Scan::possible_function_pointer_reloc): New function.
5395         (Target_x86_64::can_check_for_function_pointers): New function.
5396         * gc.h (gc_process_relocs): Scan relocation types to determine if
5397         function pointers were taken for targets that support it.
5398         * icf.cc (Icf::find_identical_sections): Include functions for
5399         folding in safe ICF whose pointer is not taken.
5400         * icf.h (Secn_fptr_taken_set): New typedef.
5401         (fptr_section_id_): New member.
5402         (section_has_function_pointers): New function.
5403         (set_section_has_function_pointers): New function.
5404         (check_section_for_function_pointers): New function.
5405         * options.h: Fix comment for safe ICF option.
5406         * target.h (can_check_for_function_pointers): New function.
5407         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5408         Modify icf_safe_test for X86-64.
5409         * testsuite/Makefile.in: Regenerate.
5410         * testsuite/icf_safe_so_test.cc: New file.
5411         * testsuite/icf_safe_so_test.sh: New file.
5412         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5413         (main): Change to take pointer to function kept_func_3.
5414         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5415         folding is done correctly for X86-64.
5416
5417 2010-02-12  David S. Miller  <davem@davemloft.net>
5418
5419         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5420         is_symbolless parameter.
5421         (Output_reloc<SHT_REL>::is_symbolless): New.
5422         (Output_reloc<SHT_REL>::is_symbolless_): New.
5423         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5424         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5425         (Output_reloc<SHT_RELA>::is_symbolless): New.
5426         (Output_data_reloc::add_global): Handle is_symbolless.
5427         (Output_data_reloc::add_global_relative): Likewise.
5428         (Output_data_reloc::add_local): Likewise.
5429         (Output_data_reloc::add_local_relative): Likewise.
5430         (Output_data_reloc::add_symbolless_global_addend): New.
5431         (Output_data_reloc::add_symbolless_local_addend): New.
5432         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5433         is_symbolless.
5434         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5435         instead of ->is_relative_
5436         (Output_reloc::write): Likewise.
5437         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5438         (Output_reloc::write_rel): Simplify.
5439
5440         * sparc.cc (Target_sparc::Scan::local): Use
5441         ->add_symbolless_local_addend as needed.
5442         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5443         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5444         based upon relocation offset.
5445
5446 2010-02-11  Doug Kwan  <dougkwan@google.com>
5447
5448         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5449         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5450         beginning of function.
5451         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5452         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5453         parameter is_32bit in calls to should_apply_static_reloc.
5454         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5455         (check_DATA): Add arm_abs_global.stdout.
5456         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5457         arm_abs_global.stdout): New rules.
5458         (MOSTLLYCLEANFILES): Add arm_abs_global
5459         * Makefile.in: Regenerate.
5460         * testsuite/arm_abs_global.s: New file.
5461         * testsuite/arm_abs_global.sh: Ditto.
5462         * testsuite/arm_abs_lib.s: Ditto.
5463
5464 2010-02-11  Ian Lance Taylor  <iant@google.com>
5465
5466         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5467         Read_relocs task.
5468         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5469         Allocate_commons_task first.
5470         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5471         task, rather than symtab_lock_.
5472         (Gc_process_relocs::~Gc_process_relocs): New function.
5473         (Gc_process_relocs::is_runnable): Check this_blocker_.
5474         (Gc_process_relocs::locks): Use next_blocker_ rather than
5475         blocker_.
5476         (Scan_relocs::~Scan_relocs): New function.
5477         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5478         symtab_lock_.
5479         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5480         next_blocker_.
5481         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5482         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5483         constructor accordingly.
5484         (class Gc_process_relocs): Likewise.
5485         (class Scan_relocs): Likewise.
5486         * common.h (class Allocate_commons_task): Remove symtab_lock_
5487         field, and corresponding constructor parameter.
5488         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5489         symtab_lock_.
5490         (Allocate_commons_task::locks): Likewise.
5491
5492 2010-02-11  Ian Lance Taylor  <iant@google.com>
5493
5494         * gold-threads.h (class Once): Define.
5495         (class Initialize_lock): Rewrite as child of Once.
5496         * gold-threads.cc (class Once_initialize): Define.
5497         (once_pointer_control): New static variable.
5498         (once_pointer, once_arg): New static variables.
5499         (c_run_once): New static function.
5500         (Once::Once, Once::run_once, Once::internal_run): New functions.
5501         (class Initialize_lock_once): Remove.
5502         (initialize_lock_control): Remove.
5503         (initialize_lock_pointer): Remove.
5504         (initialize_lock_once): Remove.
5505         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5506         (Initialize_lock::initialize): Rewrite.
5507         (Initialize_lock::do_run_once): New function.
5508         * archive.cc (Archive::interpret_header): Only clear name if it is
5509         not already empty.
5510         * fileread.cc: Include "gold-threads.h"
5511         (file_counts_lock): New static variable.
5512         (file_counts_initialize_lock): Likewise.
5513         (File_read::release): Only increment counts when using --stats.
5514         Use a lock around the increment.
5515         * parameters.cc (class Set_parameters_target_once): Define.
5516         (set_parameters_target_once): New static variable.
5517         (Parameters::Parameters): Move here from parameters.h.
5518         (Parameters::set_target): Rewrite.
5519         (Parameters::set_target_once): New function.
5520         (Parameters::clear_target): Move here and rewrite.
5521         * parameters.h (class Parameters): Update declarations.  Add
5522         set_parameters_target_once_ field.
5523         (Parameters::Parameters): Move to parameters.cc.
5524         (Parameters::clear_target): Likewise.
5525         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5526         task.
5527         (Start_group::~Start_group): New function.
5528         (Start_group::is_runnable): New function.
5529         (Start_group::locks, Start_group::run): New functions.
5530         (Finish_group::run): Change saw_undefined to size_t.
5531         * readsyms.h (class Start_group): Define.
5532         (class Finish_group): Change saw_undefined_ field to size_t.
5533         (Finish_group::Finish_group): Remove saw_undefined and
5534         this_blocker parameters.  Change all callers.
5535         (Finish_group::set_saw_undefined): New function.
5536         (Finish_group::set_blocker): New function.
5537         * symtab.h (class Symbol_table): Change saw_undefined to return
5538         size_t.  Change saw_undefined_ field to size_t.
5539         * target-select.cc (Set_target_once::do_run_once): New function.
5540         (Target_selector::Target_selector): Initialize set_target_once_
5541         field.  Don't initialize lock_ and initialize_lock_ fields.
5542         (Target_selector::instantiate_target): Rewrite.
5543         (Target_selector::set_target): New function.
5544         * target-select.h (class Set_target_once): Define.
5545         (class Target_selector): Update declarations.  Make
5546         Set_target_once a friend.  Remove lock_ and initialize_lock_
5547         fields.  Add set_target_once_ field.
5548
5549 2010-02-10  Ian Lance Taylor  <iant@google.com>
5550
5551         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5552         queueing any tasks.
5553         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5554         (queue_middle_tasks): Add all blockers before queueing any tasks.
5555         (queue_final_tasks): Likewise.
5556         * token.h (Task_token::add_blockers): New function.
5557         * object.h (Input_objects::number_of_relobjs): New function.
5558
5559 2010-02-10  Ian Lance Taylor  <iant@google.com>
5560
5561         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5562         shared, not if not position independent.
5563         * x86_64.cc (Relocate::relocate_tls): Likewise.
5564         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5565         (tls_pie_pic_test): New target.
5566         * testsuite/Makefile.in: Rebuild.
5567
5568         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5569         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5570         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5571         * testsuite/Makefile.in: Rebuild.
5572
5573 2010-02-09  David S. Miller  <davem@davemloft.net>
5574
5575         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5576         R_SPARC_RELATIVE using ->add_local_relative().
5577         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5578
5579         * output.h (Output_data_dynamic::add_section_size): New method
5580         that takes two Output_data objects.
5581         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5582         entry param.  Handle it in initializers.
5583         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5584         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5585         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5586         arg.
5587         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5588         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5589         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5590         for dynrel_includes_plt.
5591         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5592         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5593         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5594         before .rela.plt
5595         (Target_sparc::do_finalize_sections): Update to pass true for
5596         dynrel_includes_plt.
5597         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5598         output before .rela.plt
5599         (Target_powerpc::do_finalize_sections): Update to pass true for
5600         dynrel_includes_plt when 32-bit.
5601
5602 2010-02-08  Doug Kwan  <dougkwan@google.com>
5603
5604         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5605         method.
5606         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5607         Arm_relobj::scan_section_for_cortex_a8_stubs,
5608         Arm_relobj::do_relocation_section): Instead of calling
5609         Output_section::output_address, use faster
5610         Arm_relobj::simple_input_section_output_address.
5611
5612 2010-02-08  David S. Miller  <davem@davemloft.net>
5613
5614         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5615         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5616         relocation helper function.
5617
5618         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5619         just like R_SPARC_GOT{10,13,22}.
5620         (Target_sparc::Scan::local): Likewise.
5621         (Target_sparc::Relocate:relocate): Likewise.
5622
5623 2010-02-06  Ian Lance Taylor  <iant@google.com>
5624
5625         * configure.ac: Rewrite targetobjs duplicate removal code to use
5626         only shell constructs.
5627         * configure: Rebuild.
5628
5629 2010-02-05  Doug Kwan  <dougkwan@google.com>
5630
5631         PR 11247
5632         * arm.cc (Arm_relobj::section_is_scannable): New method.
5633         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5634         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5635
5636 2010-02-04  Doug Kwan  <dougkwan@google.com>
5637
5638         PR 11247
5639         * arm-reloc-property.cc (cstdio): Include.
5640         * configure.ac (targetobjs): Remove duplicates.
5641         * configure: Regenerate.
5642         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5643         big and little endian version for a given address size.
5644
5645 2010-02-03  Doug Kwan  <dougkwan@google.com>
5646
5647         * arm-reloc-property.cc
5648         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5649         definition.
5650         * arm-reloc-property.h
5651         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5652         New method definition.
5653         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5654         declaration.
5655         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5656         overflow to N.
5657         (GOT_PREL): Change implemented to Y.
5658         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5659         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5660         (Arm_relocate_functions::movw_abs_nc): Remove method.
5661         (Arm_relocate_functions::movt_abs): Ditto.
5662         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5663         (Arm_relocate_functions::thm_movt_abs): Ditto.
5664         (Arm_relocate_functions::movw_rel_nc): Ditto.
5665         (Arm_relocate_functions::movw_rel): Ditto.
5666         (Arm_relocate_functions::movt_rel): Ditto.
5667         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5668         (Arm_relocate_functions:thm_movw_rel): Ditto.
5669         (Arm_relocate_functions:thm_movt_rel): Ditto.
5670         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5671         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5672         New method definitions.
5673         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5674         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5675         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5676         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5677         (Target_arm::Relocate::relocate): Check for non-static or
5678         unimplemented relocation code and exit early.  Change calls to
5679         Target_arm::reloc_uses_thumb_bit and
5680         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5681         instead.  Refactor code to handle similar relocations to increase
5682         code sharing.  Remove check for unsupported relocation code in switch
5683         statement.
5684         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5685         relocation property table to find out size.  Change error message to
5686         print out the name of a relocation code instead of the numeric value.
5687         (Target_arm::scan_reloc_for_stub): Use relocation property table
5688         instead of calling Target_arm::reloc_uses_thumb_bit().
5689
5690 2010-02-02  Doug Kwan  <dougkwan@google.com>
5691
5692         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5693         types of relaxed input section.
5694
5695 2010-02-02  Doug Kwan  <dougkwan@google.com>
5696
5697         * Makefile.am (HFILES): Add arm-reloc-property.h.
5698         (DEFFILES): New.
5699         (TARGETSOURCES): Add arm-reloc-property.cc
5700         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5701         (libgold_a_SOURCES): $(DEFFILES)
5702         * Makefile.in: Regenerate.
5703         * arm-reloc-property.cc: New file.
5704         * arm-reloc-property.h: New file.
5705         * arm-reloc.def: New file.
5706         * arm.cc: Update comments.
5707         (arm-reloc-property.h): New included header.
5708         (arm_reloc_property_table): New global variable.
5709         (Target_arm::do_select_as_default_target): New method definition.
5710         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5711         arm-reloc-property to targ_extra_obj.
5712         * parameters.cc (set_parameters_target): Call
5713         Target::select_as_default_target().
5714         * target.h (Target::select_as_default_target): New method definition.
5715         (Target::do_select_as_default_target): Same.
5716
5717 2010-02-01  Doug Kwan  <dougkwan@google.com>
5718
5719         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5720         first_output_text_section_.
5721         (Arm_exidx_fixup::first_output_text_section): New method definition.
5722         (Arm_exidx_fixup::first_output_text_section_): New data member.
5723         (Arm_exidx_fixup::process_exidx_section): Record the first text
5724         output section seen.
5725         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5726         and entsize in output section header.
5727
5728 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5729
5730         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5731         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5732         (Arm_relocate_functions::thm_alu11): New Method.
5733         (Arm_relocate_functions::thm_pc8): New Method.
5734         (Arm_relocate_functions::thm_pc12): New Method.
5735         (Target_arm::Scan::local): Handle the relocations.
5736         (Target_arm::Scan::global): Likewise.
5737         (Target_arm::Relocate::relocate): Likewise.
5738         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5739
5740 2010-01-29  Doug Kwan  <dougkwan@google.com>
5741
5742         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5743         of relocation types as ld.
5744
5745 2010-01-29  Doug Kwan  <dougkwan@google.com>
5746
5747         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5748         to public.
5749         (Arm_relocate_functions::thumb_branch_common): Ditto.
5750         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5751         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5752         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5753         Arm_relocate_functions::jump24): Remove.
5754         (Target_arm::Relocate::relocate): Adjust code to call
5755         Arm_relocation_functions::arm_branch_common and
5756         Arm_relocation_functions::thumb_branch_common instead of their removed
5757         wrappers.  Merge switch-cases together to reduce source code size.
5758
5759 2010-01-29  Doug Kwan  <dougkwan@google.com>
5760
5761         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5762         output_local_symbol_count_needs_update_.
5763         (Arm_relobj::output_local_symbol_count_needs_update,
5764          Arm_relobj::set_output_local_symbol_count_needs_update,
5765          Arm_relobj::update_output_local_symbol_count): New methods.
5766         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5767         member.
5768         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5769         of pointed function as in a R_ARM_PREL31 relocation.
5770         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5771         for output local symbol count updating.
5772         (Target_arm::do_relax): Update output local symbol counts in objects
5773         if necessary.
5774         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5775
5776 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5777
5778         * arm.cc: Added support for the ARM relocations:
5779         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5780         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5781         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5782         movw_prel_nc).
5783         (Arm_relocate_functions::movw_rel): New method.
5784         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5785         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5786         thm_movw_prel_nc).
5787         (Arm_relocate_functions::thm_movw_rel): New method.
5788         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5789         thm_movt_prel).
5790         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5791         relocations.
5792         (Target_arm::Scan::global): Likewise.
5793         (Target_arm::Relocate::relocate): Likewise.
5794         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5795         Likewise.
5796
5797 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5798
5799         * arm.cc: Added support for ARM group relocations.
5800         (Target_arm::reloc_needs_sym_origin): New method.
5801         (Arm_relocate_functions::calc_grp_kn): New method.
5802         (Arm_relocate_functions::calc_grp_residual): New method.
5803         (Arm_relocate_functions::calc_grp_gn): New method.
5804         (Arm_relocate_functions::arm_grp_alu): New Method.
5805         (Arm_relocate_functions::arm_grp_ldr): New Method.
5806         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5807         (Arm_relocate_functions::arm_grp_ldc): New Method.
5808         (Target_arm::Scan::local): Handle the ARM group relocations.
5809         (Target_arm::Scan::global): Likewise.
5810         (Target_arm::Relocate::relocate): Likewise.
5811         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5812         Likewise.
5813
5814 2010-01-26  Doug Kwan  <dougkwan@google.com>
5815
5816         * arm.cc (set): Include.
5817         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5818         pointer type.
5819         (Arm_output_section::Text_section_list): New type.
5820         (Arm_output_section::append_text_sections_to_list): New method.
5821         (Arm_output_section::fix_exidx_coverage): Ditto.
5822         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5823         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5824         Relobj::set_section_offset() instead of
5825         Sized_relobj::invalidate_section_offset().
5826         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5827         parameter for section headers. Ignore relocation sections for
5828         unallocated sections and EXIDX sections.
5829         (Target_arm::fix_exidx_coverage): New method.
5830         (Target_arm::output_section_address_less_than): New type.
5831         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5832         linked text section instead of the EXIDX section.
5833         (Arm_output_section::create_stub_group): Add an assertion to check
5834         that this is not an EXIDX output section.
5835         (Arm_output_section::append_text_sections_to_list): New method.
5836         (Arm_output_section::fix_exidx_coverage): Ditto.
5837         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5838         Arm_relobj::section_needs_reloc_stub_scanning.
5839         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5840         first pass.
5841         (Target_arm::fix_exidx_coverage): New method.
5842         * object.h (Relobj::set_output_section): New method.
5843         (Sized_relobj::invalidate_section_offset): Remove method.
5844         (Sized_relobj::do_invalidate_section_offset): Remove method.
5845         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5846
5847 2010-01-25  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5850         Fix warning due to signed and unsigned comparison on a 32-bit host.
5851
5852 2010-01-22  Doug Kwan  <dougkwan@google.com>
5853
5854         * arm.cc (Target_arm::do_relax): Record an output section for section
5855         offset adjustment it contains any stub table that has changed.
5856         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5857         offsets in an output section if necessary.
5858         * output.cc (Output_section::Output_section): Initialize
5859         section_offsets_need_adjustments_.
5860         (Output_section::add_input_section_for_script): Renamed to
5861         Output_section::add_simple_input_section.
5862         (Output_section::save_states): Add a comment.
5863         (Output_section::discard_states): New method defintion.
5864         (Output_section::adjust_section_offsets): Same.
5865         * output.h (Output_section::add_input_section_for_script): Renamed to
5866         Output_section::add_simple_input_section.
5867         (Output_section::discard_states): New method declaration.
5868         (Output_section::adjust_section_offsets): Same.
5869         (Output_section::section_offsets_need_adjustment,
5870         Output_section::set_section_offsets_need_adjustment): New method
5871         definitions.
5872         (Output_section::section_offsets_need_adjustment_): New data member.
5873         * script-sections.cc
5874         (Output_section_element_input::set_section_address): Adjust code for
5875         renaming of Output_section::add_input_section_for_script.
5876         (Orphan_output_section::set_section_address): Same.
5877
5878 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5879
5880         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5881         Fix_v4bx enum values .
5882         * gold/options.h (General_options): New option definitions.
5883         (General_options::fix_v4bx): New method.
5884         (General_options::Fix_v4bx): New enum.
5885         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5886         (General_options::parse_fix_v4bx_interworking): New method.
5887
5888 2010-01-22  Doug Kwan  <dougkwan@google.com>
5889
5890         * arm.cc (Arm_exidx_fixup): New class.
5891
5892 2010-01-21  Doug Kwan  <dougkwan@google.com>
5893
5894         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5895         classes.
5896         (Arm_exidx_section_offset_map): New type.
5897
5898 2010-01-21  Doug Kwan  <dougkwan@google.com>
5899
5900         * arm.cc (Arm_exidx_input_section): New class.
5901         (Arm_relobj::exidx_input_section_by_link,
5902         Arm_relobj::exidx_input_section_by_shndx,
5903         Arm_relobj::make_exidx_input_section): New methods.
5904         (read_arm_attributes_section): Remove.
5905         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5906         information about them.
5907         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5908         to here.
5909
5910 2010-01-20  Doug Kwan  <dougkwan@google.com>
5911
5912         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5913         Input_section_specifier to Section_id.
5914         (Target_arm::new_arm_input_section: Adjust code for change of key
5915         type.
5916         (Target_arm::find_arm_input_section): Ditto.
5917         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5918         (Section_id): Remove.
5919         (Garbage_collection::Section_id_hash): Remove.
5920         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5921         (Section_id): Remove.
5922         (Icf::Section_id_hash): Remove.
5923         * object.h (Section_id, Const_section_id, Section_id_hash,
5924         Const_section_id_hash): New type definitions.
5925         * output.cc (Output_section::add_relaxed_input_section): Change to
5926         use Const_section_id instead of Input_section_specifier as key type.
5927         (Output_section::add_merge_input_section): Ditto.
5928         (Output_section::build_relaxation_map): Change to use Section_id
5929         instead of Input_section_specifier as key type.
5930         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5931         Ditto.
5932         (Output_section::convert_input_sections_to_relaxed_sections): Change
5933         to use Const_section_id instead of Input_section_specifier as key type.
5934         (Output_section::find_merge_section): Ditto.
5935         (Output_section::find_relaxed_input_section): Ditto.
5936         * output.h (Input_section_specifier): Remove class.
5937         (Output_section::Output_section_data_by_input_section_map): Change
5938         key type to Const_section_id.
5939         (Output_section::Output_relaxed_input_section_by_input_section_map):
5940         Ditto.
5941         (Output_section::Relaxation_map): Change key type to Section_id.
5942
5943 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5944
5945         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5946         (class Arm_v4bx_stub): New class.
5947         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5948         (Stub_factory::make_arm_v4bx_stub): New method.
5949         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5950         (Stub_table::empty): Handle v4bx stubs.
5951         (Stub_table::add_arm_v4bx_stub): New method.
5952         (Stub_table::find_arm_v4bx_stub): New method.
5953         (Arm_relocate_functions::v4bx): New method.
5954         (Target_arm::fix_v4bx): New method.
5955         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5956         (Stub_table::relocate_stubs): Likewise.
5957         (Stub_table::do_write): Likewise.
5958         (Stub_table::update_data_size_and_addralign): Likewise.
5959         (Stub_table::finalize_stubs):  Likewise.
5960         (Target_arm::Scan::local): Likewise.
5961         (Target_arm::Scan::global): Likewise.
5962         (Target_arm::do_finalize_sections): Likewise.
5963         (Target_arm::Relocate::relocate): Likewise.
5964         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5965         Likewise.
5966         (Target_arm::scan_reloc_for_stub): Likewise.
5967         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5968
5969 2010-01-19  Ian Lance Taylor  <iant@google.com>
5970
5971         * output.cc (Output_section_headers::do_sized_write): Write large
5972         segment count to sh_info field.
5973         (Output_file_header::do_sized_write): For large segment count,
5974         write PN_XNUM to e_phnum field.
5975
5976 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5977
5978         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5979         (Arm_relocate_functions::thm_jump8): New function.
5980         (Arm_relocate_functions::thm_jump11): New function.
5981         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5982         R_ARM_THM_JUMP11.
5983         (Target_arm::Scan::global): Likewise.
5984         (Target_arm::Relocate::relocate): Likewise.
5985         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5986         Likewise.
5987
5988 2010-01-14  Doug Kwan  <dougkwan@google.com>
5989
5990         * arm.cc (map, utility): Include headers.
5991         (Target_arm::apply_cortex_a8_workaround): New method.
5992         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5993         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5994         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5995         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5996         the --[no-]fix-cortex-a8 command line options.
5997         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5998         (Target_arm::relocate_stub): Use addend in instruction template.
5999         * options.h (DEFINE_bool): Set the user-set flag.
6000         (General_options): Add --[no-]-fix-cortex options.
6001         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6002         : Update fast look-up map after conversion.
6003
6004 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6005
6006         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6007         in the first pass of do_layout.
6008
6009 2010-01-13  Doug Kwan  <dougkwan@google.com>
6010
6011         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6012         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6013         apparent compiler problem of not folding static constant integral
6014         data members of elfcpp::Elf_sizes<32>.
6015
6016 2010-01-13  Doug Kwan  <dougkwan@google.com>
6017
6018         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6019         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6020         Arm_relobj::scan_section_for_cortex_a8_erratum,
6021         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6022         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6023         sections to scan for relocation stubs into a new method
6024         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6025         relocation and Cortex-A8 stub scanning.
6026         (Target_arm::do_relax): Force stubs to be after stubbed sections
6027         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6028         the beginning of a new relaxation pass.  Update a comment.
6029         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6030
6031 2010-01-12  Ian Lance Taylor  <iant@google.com>
6032
6033         * target-reloc.h (visibility_error): New inline function.
6034         (relocate_section): Call visibility_error.
6035         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6036         (MOSTLYCLEANFILES): Likewise.
6037         (protected_4_pic.o, protected_3.err): New targets.
6038         * testsuite/protected_4.cc: New file.
6039
6040 2010-01-12  Doug Kwan  <dougkwan@google.com>
6041
6042         * arm.cc (Cortex_a8_reloc): New class.
6043         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6044         and cortex_a8_relocs_info_.
6045         (Target_arm::fix_cortex_a8): New method definition.
6046         (Target_arm::Cortex_a8_relocs_info): New type.
6047         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6048         New data member declarations.
6049         (Target_arm::scan_reloc_for_stub): Record information about
6050         relocations for THUMB branches that might be exempted from the
6051         Cortex-A8 workaround.
6052         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6053         at the beginning of a relaxation pass.
6054
6055 2010-01-12  Doug Kwan  <dougkwan@google.com>
6056
6057         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6058         (Arm_relobj::Mapping_symbol_position,
6059          Arm_reloj::Mapping_symbol_position_less,
6060          Arm_relobj::Mapping_symbols_info): New types.
6061         (Target_arm::is_mapping_symbol_name): New method definition.
6062         (Arm_relobj::do_count_local_symbols): Save information about mapping
6063         symbols.
6064
6065 2010-01-11  Doug Kwan  <dougkwan@google.com>
6066
6067         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6068         Arm_relocate_functions::thumb32_branch_upper,
6069         Arm_relocate_functions::thumb32_branch_lower,
6070         Arm_relocate_functions::thumb32_cond_branch_offset,
6071         Arm_relocate_functions::thumb32_cond_branch_upper,
6072         Arm_relocate_functions::thumb32_cond_branch_lower,
6073         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6074         branch offset encoding.
6075         (Arm_relocate_functions::thumb_branch_common): Use new branch
6076         offset encoding methods to avoid code duplication.
6077         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6078         (Stub_addend_reader::operator()): Use new branch encoding method
6079         to avoid code duplication.
6080
6081 2010-01-11  Doug Kwan  <dougkwan@google.com>
6082
6083         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6084         (Target_arm::do_finalize_sections): Define special EXIDX section
6085         symbols only if referenced.
6086         * gc.h (Garbage_collection::add_reference): New method.
6087         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6088         code duplication.
6089
6090 2010-01-11  Ian Lance Taylor  <iant@google.com>
6091
6092         * script.cc (Version_script_info::build_expression_list_lookup):
6093         Change complaing about duplicate wildcard match from error to
6094         warning.
6095
6096         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6097         of 2009-12-30.
6098         (Version_script_info::Version_script_info): Initialize globs_,
6099         default_version_, default_is_global_, and exact_.  Don't
6100         initialize globals_ or locals_.
6101         (Version_script_info::build_lookup_tables): Build local symbols
6102         first.
6103         (Version_script_info::unquote): New function.
6104         (Version_script_info::add_exact_match): New function.
6105         (Version_script_info::build_expression_list_lookup): Remove lookup
6106         parameter.  Add is_global parameter.  Change all callers.  Handle
6107         wildcard pattern specially.  Unquote pattern.  Call
6108         add_exact_match.
6109         (Version_script_info::get_name_to_match): New function.
6110         (Version_script_info::get_symbol_version): New function.
6111         (Version_script_info::get_symbol_version_helper): Remove.
6112         (Version_script_info::check_unmatched_names): Call unquote.
6113         * script.h (class Version_script_info): Change get_symbol_version
6114         to be non-inline and add is_global parameter; change all callers.
6115         Rewrite symbol_is_local.  Update declarations.  Define struct
6116         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6117         Remove globals_ and locals_ members.  Add exact_, globs_,
6118         default_version_, is_global_.
6119         (Version_script_info::Glob): Remove pattern, add expression and
6120         is_global.  Update constructor.  Change all callers.
6121         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6122         default version.
6123         (Versions::symbol_section_contents): If a symbol is undefined, or
6124         defined in a dynamic object, set the version index to
6125         VER_NDX_LOCAL.
6126         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6127         symbol_is_local.
6128         (Symbol_table::add_from_pluginobj): Likewise.
6129         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6130
6131 2010-01-11  Doug Kwan  <dougkwan@google.com>
6132
6133         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6134         (incremental_dump_LDADD): Add linking option for libintl.
6135         * Makefile.in: Regenerate.
6136
6137 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6138
6139         PR gold/11144
6140         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6141         instead of -Ds.
6142         * testsuite/Makefile.in: Regenerated.
6143
6144 2010-01-10  Doug Kwan  <dougkwan@google.com>
6145
6146         * options.h (DEFINE_var): Use parentheses around argument varname__
6147         in macro body to avoid any unintended subsequent substitutions.
6148
6149 2010-01-10  Ian Lance Taylor  <iant@google.com>
6150
6151         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6152         candidates before doing symbol resolution.
6153
6154         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6155         ODR candidates if only one is weak.
6156
6157 2010-01-08  Ian Lance Taylor  <iant@google.com>
6158
6159         * script.cc (Version_script_info::build_expression_list_lookup):
6160         Don't warn about ambiguous version, just record the ambiguity.
6161         (Version_script_info::get_symbol_version_helper): Give error if
6162         version is ambiguous.
6163
6164 2010-01-08  Doug Kwan  <dougkwan@google.com>
6165
6166         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6167           prev_data_size_ and prev_addralign_.  Remove initializer for
6168           deleted data member has_been_changed_.
6169           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6170           to determine if the table is empty.
6171           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6172           Remove.
6173           (Stub_table::add_reloc_stub): Define method in class definition
6174           instead of just declaring it there.
6175           (Stub_table::add_cortex_a8_stub): New method definition.
6176           (Stub_table::update_data_size_and_addralign): Ditto.
6177           (Stub_table::finalize_stubs): Ditto.
6178           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6179           (Stub_table::do_addralign_): Return address alignment in the
6180           (Stub_table::do_reset_address_and_file_offset): Define method in
6181           class definition instead of declaring it there.  Set current data
6182           size to be the data size of the previous pass.
6183           (Stub_table::set_final_data_size): Use current data size as the
6184           final data size.
6185           (Stub_table::relocate_stub): Change parameter type of stub from
6186           Reloc_stub pointer to Stub pointer.
6187           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6188           (Stub_table::Cortex_a8_stub_list): New typedef.
6189           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6190            Stub_table::prev_addralign_): New data member.
6191           (Arm_relobj::Arm_relobj): Initialize data member
6192           section_has_cortex_a8_workaround_.
6193           (Arm_relobj::section_has_cortex_a8_workaround,
6194            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6195            definitions.
6196           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6197           declarations.
6198           (Target_arm::relocate_stub): Change parameter type of stub from
6199           Reloc_stub pointer to Stub pointer.
6200           (Insn_template::size, Insn_template::alignment): Handle
6201           THUMB16_SPECIAL_TYPE.
6202           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6203            Stub_table::update_data_size_and_addralign,
6204            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6205           definitions.
6206           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6207           (Stub_table::do_write): Ditto.
6208           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6209
6210 2010-01-08  Ian Lance Taylor  <iant@google.com>
6211
6212         PR 11108
6213         * symtab.h (class Symbol): Remove fields is_target_special_ and
6214         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6215         (Symbol::is_defined_in_discarded_section): New function.
6216         (Symbol::set_is_defined_in_discarded_section): New function.
6217         (Symbol::has_plt_offset): Rewrite.
6218         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6219         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6220         Don't initialize is_target_special_ or has_plt_offset_.
6221         Initialize is_defined_in_discarded_section_.
6222         (Symbol_table::add_from_relobj): If appropriate, set
6223         is_defined_in_discarded_section.
6224         * resolve.cc (Symbol::override_base_with_special): Don't test
6225         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6226         * target-reloc.h (relocate_section): Do special handling for
6227         symbols defined in discarded sections for global symbols as well
6228         as local symbols.
6229
6230 2010-01-08  Ian Lance Taylor  <iant@google.com>
6231
6232         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6233         the SHT_SYMTAB case.
6234
6235 2010-01-08  Ian Lance Taylor  <iant@google.com>
6236
6237         * object.cc (Sized_relobj::do_layout): Don't get confused if
6238         layout_eh_frame returns NULL.
6239
6240 2010-01-08  Ian Lance Taylor  <iant@google.com>
6241
6242         PR 11084
6243         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6244         dynamic symbol table, use the normal symbol table.
6245         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6246         symbol table.
6247
6248 2010-01-08  Ian Lance Taylor  <iant@google.com>
6249
6250         PR 11072
6251         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6252         sections.
6253
6254 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6255
6256         * version.cc (print_version): Change to "Copyright 2010".
6257
6258 2010-01-08  Ian Lance Taylor  <iant@google.com>
6259
6260         PR 10287
6261         PR 11063
6262         * i386.cc (class Target_i386): Change return type of plt_section
6263         to be non-const.
6264         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6265         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6266         tls_desc_rel_ field.
6267         (Output_data_plt_i386::rel_tls_desc): New function.
6268         (Target_i386::rel_tls_desc_section): New function.
6269         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6270         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6271         R_386_TLS_DESC reloc in rel_tls_desc_section.
6272         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6273         Define struct Tlsdesc_info.
6274         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6275         (Target_x86_64::do_reloc_symbol_index): New function.
6276         (Target_x86_64::add_tlsdesc_info): New function.
6277         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6278         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6279         tlsdesc_rel_ field.
6280         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6281         all callers.
6282         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6283         (Target_x86_64::rela_tlsdesc_section): New function.
6284         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6285         handling.
6286         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6287         (Target_x86_64::do_reloc_addend): New function.
6288         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6289         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6290         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6291         (Output_reloc::type): New function.
6292         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6293         (Output_reloc::is_target_specific): New function.
6294         (Output_reloc::target_arg): New function.
6295         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6296         absolute relocs and target specific relocs.
6297         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6298         add_target_specific.
6299         (class Output_data_reloc) [SHT_RELA]: Likewise.
6300         * output.cc (Output_reloc::Output_reloc): Add four new versions
6301         for absolute relocs and target specific relocs.
6302         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6303         (Output_reloc::get_symbol_index): Likewise.
6304         (Output_reloc::local_section_offset): Check that local_sym_index_
6305         is not TARGET_CODE or 0.
6306         (Output_reloc::symbol_value): Likewise.
6307         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6308         reloc.
6309         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6310         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6311         functions.
6312         * layout.cc (add_target_dynamic_tags): Use output section for
6313         DT_PLTRELSZ and DT_JMPREL.
6314
6315 2010-01-07  Ian Lance Taylor  <iant@google.com>
6316
6317         PR 11061
6318         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6319         function.
6320         (class Output_data_reloc_generic): Define.
6321         (class Output_data_reloc_base): Change base class to
6322         Output_data_reloc_generic.  Change add() method to call
6323         bump_relative_reloc_count for a relative reloc.  Remove
6324         sort_relocs_ field.
6325         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6326         to sort_relocs().
6327         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6328         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6329         appropriate.
6330         * layout.h (class Layout): Update declaration.
6331
6332 2010-01-07  Ian Lance Taylor  <iant@google.com>
6333
6334         * output.h (class Output_data): Add const version of
6335         output_section and do_output_section.
6336         (class Output_section_data): Add const version of
6337         do_output_section.
6338         (class Output_section): Likewise.
6339         * layout.cc (Layout::add_target_dynamic_tags): New function.
6340         * layout.h (class Layout): Update declarations.
6341         * arm.cc (Target_arm::do_finalize_sections): Use
6342         add_target_dynamic_tags.
6343         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6344         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6345         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6346         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6347
6348 2010-01-07  Ian Lance Taylor  <iant@google.com>
6349
6350         PR 11042
6351         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6352         object as needed.
6353
6354 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6355             Ian Lance Taylor  <iant@google.com>
6356
6357         PR 11019
6358         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6359         Xindex::read_symtab_xindex.
6360
6361 2010-01-07  Doug Kwan  <dougkwan@google.com>
6362
6363         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6364         (Insn_template::thumb16_bcond_insn): New method declaration.
6365         (Insn_template): Fix spelling.
6366         (Stub::thumb16_special): New method declaration.
6367         (Stub::do_write): Define virtual method which was previously pure
6368         virtual.
6369         (Stub::do_thumb16_special): New method declaration.
6370         (Stub::do_fixed_endian_write): New template member.
6371         (Reloc_stub::do_write): Remove.
6372         (Reloc_stub::do_fixed_endian_write): Remove.
6373         (Cortex_a8_stub): New class definition.
6374         (Stub_factory::make_cortex_a8_stub): New method definition.
6375         (Stub_factory::Stub_factory): Add missing static storage class
6376         qualifier for elf32_arm_stub_a8_veneer_blx.
6377
6378 2010-01-07  Ian Lance Taylor  <iant@google.com>
6379
6380         PR 10980
6381         * options.h (class General_options): Add --warn-unresolved-symbols
6382         and --error-unresolved-symbols.
6383         * errors.cc (Errors::undefined_symbol): Implement
6384         --warn-unresolved-symbols.
6385
6386         * options.h (class General_options): Add -z text and -z textoff.
6387         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6388
6389 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6390
6391         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6392         (Garbage_collection::cident_sections): New function.
6393         (Garbage_collection::add_cident_section): New function.
6394         (Garbage_collection::cident_sections_): New member.
6395         (gc_process_relocs): Add references to sections whose names are C
6396         identifiers.
6397         * gold.h (cident_section_start_prefix): New constant.
6398         (cident_section_stop_prefix): New constant.
6399         (is_cident): New function.
6400         * layout.cc (Layout::define_section_symbols): Replace string constants
6401         with the newly defined constants.
6402         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6403         C identifiers.
6404         * testsuite/Makefile.am: Add gc_orphan_section_test.
6405         * testsuite/Makefile.in: Regenerate.
6406         * testsuite/gc_orphan_section_test.cc: New file.
6407         * testsuite/gc_orphan_section_test.sh: New file.
6408
6409 2010-01-06  Ian Lance Taylor  <iant@google.com>
6410
6411         PR 10980
6412         * options.h (class General_options): Add --warn-shared-textrel.
6413         * layout.cc (Layout::finish_dynamic_section): Implement
6414         --warn-shared-textrel.
6415
6416         PR 10980
6417         * options.h (class General_options): Add --warn-multiple-gp.
6418
6419 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6420
6421         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6422         $(THREADSLIB) and $(LIBDL).
6423         * Makefile.in: Rebuild.
6424
6425 2010-01-06  Ian Lance Taylor  <iant@google.com>
6426
6427         PR 10980
6428         * options.cc (General_options::parse_section_start): New function.
6429         (General_options::section_start): New function.
6430         (General_options::General_options): Initialize all members.
6431         * options.h: Include <map>
6432         (class General_options): Add --section-start.  Add section_starts_
6433         member.
6434         * layout.cc (Layout::attach_allocated_section_to_segment): If
6435         --section-start was used, set the address of the segment.  Remove
6436         local sort_sections.
6437         (Layout::relaxation_loop_body): If the address of the load segment
6438         has been set by --section-start, don't use it.
6439         * output.h (Output_segment::update_flags_for_output_section): New
6440         function.
6441         * output.cc (Output_segment::add_output_section): Call
6442         update_flags_for_output_section.
6443
6444 2010-01-05  Ian Lance Taylor  <iant@google.com>
6445
6446         PR 10980
6447         * options.h (class General_options): Add --undefined-version.
6448         * script.cc (struct Version_expression): Add was_matched_by_symbol
6449         field.
6450         (Version_script_info::matched_symbol): New function.
6451         (Version_script_info::get_symbol_version_helper): Call
6452         matched_symbol.
6453         (Version_script_info::check_unmatched_names): New function.
6454         * script.h (class Version_script_info): Update declarations.
6455         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6456
6457         * options.h (class General_options): Use DEFINE_bool_alias for
6458         allow_multiple_definition.
6459         * resolve.cc (Symbol_table::should_override): Don't test
6460         allow_multiple_definition.
6461
6462         PR 10980
6463         * options.h (class General_options): Add --cref.
6464         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6465         until after printing cref table.
6466         * cref.cc: Include "symtab.h".
6467         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6468         (Cref_table_compare::operator()): New function.
6469         (Cref_inputs::gather_cref): New function.
6470         (filecol): New static const.
6471         (Cref_inputs::print_cref): New function.
6472         (Cref::print_cref): New function.
6473         * cref.h: Include <cstdio>.
6474         (class Cref): Update declarations.
6475         * mapfile.h (Mapfile::file): New function.
6476         * object.h (class Object): Define Symbols.  Declare virtual
6477         do_get_global_symbols.
6478         (Object::get_global_symbols): New function.
6479         * object.cc (Input_objects::add_object): Pass object to cref_ if
6480         --cref.
6481         (Input_objects::archive_start): Likewise.
6482         (Input_objects::archive_stop): Likewise.
6483         (Input_objects::print_cref): New function.
6484         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6485         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6486         --cref.
6487         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6488         function.
6489         * plugin.h (class Sized_pluginobj): Update declarations.
6490
6491 2010-01-05  Ian Lance Taylor  <iant@google.com>
6492
6493         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6494         to is_default_version.  Rename insdef to insdefault.
6495         (Symbol_table::add_from_relobj): Rename def to is_default_version
6496         and local to is_forced_local.
6497         (Symbol_table::add_from_pluginobj): Likewise.
6498         (Symbol_table::add_from_dynobj): Likewise.
6499         (Symbol_table::define_special_symbol): Rename insdef to
6500         insdefault.
6501
6502 2010-01-04  Ian Lance Taylor  <iant@google.com>
6503
6504         PR 10980
6505         * options.h (class General_options): Add
6506         --allow-multiple-definition and -z muldefs.
6507         * resolve.cc (Symbol_table::should_override): Don't warn about a
6508         multiple symbol definition if --allow-multiple-definition or -z
6509         muldefs.
6510
6511         PR 10980
6512         * options.h (class General_options): Add --add-needed and
6513         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6514         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6515         error if --copy-dt-needed-entries aka --add-needed is used and
6516         would cause a change in behaviour.
6517
6518         PR 10980
6519         * options.h (class General_options): Add -G as a short version of
6520         --shared.  Add no-op options -assert, -g, and -i.
6521
6522 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6523
6524         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6525         check for .text or .gnu.linkonce.t sections.
6526         * icf.cc (Icf::find_identical_sections): Ditto.
6527         Change the detection for mangled function name within the section
6528         name.
6529         * icf.h (is_section_foldable_candidate): New function.
6530
6531 2009-12-30  Ian Lance Taylor  <iant@google.com>
6532
6533         PR 10980
6534         * options.h (class General_options): Permit two dashes with
6535         --retain-symbols-file.
6536
6537 2009-12-30  Ian Lance Taylor  <iant@google.com>
6538
6539         PR 10979
6540         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6541         don't put the file header and segment headers in the text
6542         segment.
6543
6544         PR 10979
6545         * common.cc (Sort_commons::operator()): Stabilize sort when both
6546         entries are NULL.
6547         (Symbol_table::do_allocate_commons_list): When allocating common
6548         symbols, skip a symbol which is no longer common.
6549         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6550         an object before checking its type.
6551         * testsuite/common_test_2.c: New file.
6552         * testsuite/common_test_3.c: New file.
6553         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6554         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6555         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6556         (common_test_2_pic.o, common_test_2.so): New targets.
6557         (common_test_3_pic.o, common_test_3.so): New targets.
6558         * testsuite/Makefile.in: Rebuild.
6559
6560         PR 10979
6561         * script.cc (read_input_script): If we see a new SECTIONS clause,
6562         and we have added an input section, give an error.
6563         * layout.h (class Layout): Add have_added_input_section function.
6564         Add have_added_input_section_ field.
6565         * layout.cc (Layout::Layout): Initialize
6566         have_added_input_section_.
6567         (Layout::layout): Set have_added_input_section_.
6568         (Layout::layout_eh_frame): Likewise.
6569
6570 2009-12-30  Ian Lance Taylor  <iant@google.com>
6571
6572         PR 10931
6573         * options.h (class General_options): Add --sort-common option.
6574         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6575         * common.cc (Sort_common): Add sort_order parameter to
6576         constructor.  Add sort_order_ field.
6577         (Sort_commons::operator): Check sort_order_.
6578         (Symbol_table::allocate_commons): Determine the sort order.
6579         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6580         Change all callers.
6581         (Symbol_table::do_allocate_commons_list): Likewise.
6582
6583 2009-12-30  Ian Lance Taylor  <iant@google.com>
6584
6585         PR 10916
6586         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6587         symbols from this object, don't change the visibility of an
6588         undefined symbol.
6589         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6590
6591 2009-12-30  Ian Lance Taylor  <iant@google.com>
6592
6593         PR 10861
6594         * script.h (class Version_script_info): Define Language enum.
6595         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6596         new fields globals_, locals_, and is_finalized_.
6597         * script.cc: Various formatting fixes.
6598         (class Parser_closure): Change language_stack_ from a vector of
6599         std::string to one of Version_script_info::Language.  Adjust all
6600         uses accordingly.
6601         (class Lazy_demangler): Remove.
6602         (struct Version_expression): Change language from std::string to
6603         Version_script_info::Language.
6604         (Version_script_info::Version_script_info): New function.
6605         (Version_script_info::~Version_script_info): Don't call clear.
6606         (Version_script_info::finalize): New function.
6607         (Version_script_info::build_lookup_tables): New function.
6608         (Version_script_info::build_expression_list_lookup): New
6609         function.
6610         (Version_script_info::get_symbol_version_helper): Rewrite to use
6611         lookup tables.
6612         (Version_script_info::print_expression_list): Adjust to use
6613         Version_script_info::Language.
6614         (script_push_lex_into_version_mode): Check that the version script
6615         has not been finalized.
6616         (version_script_push_lang): Change language string to
6617         Version_script_info::Language.
6618         * options.cc (Command_line::version_script): New function.
6619         * options.h (class General_options): Add finalize_dynamic_list
6620         function.  Change version_script from declaration to definition.
6621         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6622         * testsuite/version_script.map: Remove duplicate def of foo.
6623         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6624         version_script.map.
6625         * testsuite/Makefile.in: Rebuild.
6626
6627 2009-12-30  Ian Lance Taylor  <iant@google.com>
6628
6629         PR 10843
6630         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6631         if the input symbol index is 0, make the output symbol index 0.
6632
6633 2009-12-30  Ian Lance Taylor  <iant@google.com>
6634
6635         PR 10670
6636         * options.h (class General_options): Add -x/--discard-all.
6637         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6638         --discard-all.  If the local symbol needs a dynamic entry, check
6639         that before handling --discard-locals.
6640
6641 2009-12-30  Ian Lance Taylor  <iant@google.com>
6642
6643         PR 10450
6644         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6645         flags to PF_R.
6646         (Output_segment::add_output_section): Don't change the flags if
6647         the type is PT_TLS.
6648
6649         PR 10450
6650         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6651         GNU hash table if they need a dynamic value.  Otherwise, don't add
6652         them if they are defined in a dynamic object or are forced local.
6653
6654 2009-12-29  Ian Lance Taylor  <iant@google.com>
6655
6656         PR 10450
6657         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6658         .gnu.hash table for a 32-bit target.
6659
6660         PR 10450
6661         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6662         regular and a dynamic object only needs a dynamic symbol table
6663         entry if it is externally visible.
6664
6665         PR 10450
6666         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6667         constructor.  Add global_offset_table_ field.
6668         (Target_i386::got_section): Set global_offset_table_.
6669         (Target_i386::do_finalize_sections): Set global_offset_table_
6670         size.
6671         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6672         in constructor.  Add global_offset_table_ field.
6673         (Target_x86_64::got_section): Set global_offset_table_.
6674         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6675         size.
6676
6677         * layout.cc (Layout::Layout): Initialize increase_relro_.
6678         (Layout::get_output_section): Add is_relro, is_last_relro, and
6679         is_first_non_relro parameters.  Change all callers.
6680         (Layout::choose_output_section): Likewise.
6681         (Layout::add_output_section_data): Likewise.
6682         (Layout::make_output_section): Likewise.
6683         (Layout::set_segment_offsets): Clear increase_relro when using a
6684         linker script.
6685         * layout.h (class Layout): Add increase_relro method.  Add
6686         increase_relro_ field.  Update declarations.
6687         * output.cc (Output_section::Output_section): Initialize
6688         is_last_relro_ and is_first_non_relro_.
6689         (Output_segment::add_output_section): Group relro sections is
6690         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6691         (Output_segment::maximum_alignment): Remove relro handling.
6692         (Output_segment::set_section_addresses): Add increase_relro
6693         parameter.  Change all callers.  Add initial alignment to align
6694         relro sections on separate page.  Remove old relro handling.
6695         (Output_segment::set_section_list_addresses): Remove in_relro
6696         parameter.  Change all callers.
6697         (Output_segment::set_offset): Add increase parameter.  Change all
6698         callers.  Remove old relro handling.
6699         * output.h (class Output_section): Add new methods: is_last_relro,
6700         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6701         Add is_last_relro_ and is_first_non_relro_ fields.
6702         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6703         Create separate .got.plt section.  Call increase_relro.
6704         * x86_64.cc (Target_x86_64::got_section): Likewise.
6705         * testsuite/relro_script_test.t: Add .got.plt.
6706
6707         PR 10450
6708         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6709         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6710         (Layout::finalize): Call set_dynamic_symbol_size.
6711         (Layout::set_dynamic_symbol_size): New function.
6712         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6713         set_dynamic_symbol_size.
6714
6715         PR 10450
6716         * output.h (class Output_section): Add is_entsize_zero_ field.
6717         * output.cc (Output_section::Output_section): Initialize
6718         is_entsize_zero_.
6719         (Output_section::set_entsize): If two different entsizes are
6720         requested, force it to zero.
6721         (Output_section::add_input_section): Set flags for .debug_str
6722         before updating section flags.  Set entsize.
6723         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6724         and SHF_STRING if all input sections have those flags.
6725
6726 2009-12-29   Rafael Espindola  <espindola@google.com>
6727
6728         * main.cc (main): Fix the sys time reporting.
6729         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6730         reporting.
6731
6732 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6733
6734         * options.cc (General_options::parse_version): Allow -v to exit
6735         without an error if there is nothing to link.
6736
6737 2009-12-29  Ian Lance Taylor  <iant@google.com>
6738
6739         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6740         using a version of gcc before 4.1.
6741         * configure: Rebuild.
6742
6743 2009-12-28  Chris Demetriou  <cgd@google.com>
6744
6745         * attributes.cc (Output_attributes_section_data::do_write): Use
6746         std::vector::front rather than std::vector::data.
6747
6748 2009-12-28  Ian Lance Taylor  <iant@google.com>
6749
6750         * symtab.h (class Symbol_table): Add enum Defined.
6751         * resolve.cc (Symbol_table::should_override): Add defined
6752         parameter.  Change all callers.  Test whether object is NULL
6753         before calling a method on it.
6754         (Symbol_table::report_resolve_problem): Add defined parameter.
6755         Change all callers.
6756         (Symbol_table::should_override_with_special): Likewise.
6757         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6758         parameter.  Change all callers.
6759         (Symbol_table::do_define_in_output_data): Likewise.
6760         (Symbol_table::define_in_output_segment): Likewise.
6761         (Symbol_table::do_define_in_output_segment): Likewise.
6762         (Symbol_table::define_as_constant): Likewise.
6763         (Symbol_table::do_define_as_constant): Likewise.
6764         * script.h (class Symbol_assignment): Add is_defsym parameter to
6765         constructor; change all callers.
6766         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6767         parameter.  Change all callers.  Add is_defsym_ field.
6768         (class Parser_closure): Add parsing_defsym parameter to
6769         constructor; change all callers.  Add parsing_defsym accessor
6770         function.  Add parsing_defsym_ field.
6771
6772 2009-12-28  Ian Lance Taylor  <iant@google.com>
6773
6774         * gold.cc (queue_middle_tasks): Fix formatting.
6775         * object.cc (Relobj::is_section_name_included): Likewise.
6776
6777 2009-12-23  Ian Lance Taylor  <iant@google.com>
6778
6779         * i386.cc (Target_i386::do_calls_non_split): Recognize
6780         -fsplit-stack prologue for a function with a static chain.
6781         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6782         -fsplit-stack prologue when using %r11.
6783
6784 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6785
6786         * options.cc (General_options::parse_version): Make -v continue and do
6787         the link like GNU ld does.
6788
6789 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6790
6791         * Makefile.am (CCFILES): Add timer.cc.
6792         (HFILES): Add timer.h.
6793         * configure.ac: Check for sysconf and times.
6794         * main.cc: include timer.h.
6795         (main): Use Timer instead of get_run_time.
6796         * timer.cc: New.
6797         * timer.h: New.
6798         * workqueue.cc: include timer.h.
6799         (Workqueue::find_and_run_task):
6800         Report user, sys and wall time.
6801         * Makefile.in: Regenerate.
6802         * config.in: Regenerate.
6803         * configure: Regenerate.
6804
6805 2009-12-16  Doug Kwan  <dougkwan@google.com>
6806
6807         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6808         sections.
6809         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6810         relaxed input sections.
6811         * output.cc (Output_section::find_relaxed_input_section): Change
6812         return type to Output_relaxed_input_section pointer.  Adjust code
6813         for new type of relaxed_input_section_map_.
6814         * output.h (Output_section::find_relaxed_input_section): Change
6815         return type to Output_relaxed_input_section pointer.
6816         (Output_section::Output_relaxed_input_section_by_input_section_map):
6817         New type.
6818         (Output_section::relaxed_input_section_map_): Change type to
6819         Output_section::Output_relaxed_input_section_by_input_section_map.
6820         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6821         input section.
6822
6823 2009-12-15  Ian Lance Taylor  <iant@google.com>
6824
6825         * layout.cc (Layout::create_shstrtab): Only write out after input
6826         sections if we are compressing debug sections.
6827
6828 2009-12-15  Ian Lance Taylor  <iant@google.com>
6829
6830         * archive.cc (Archive::add_symbols): Only look up a symbol without
6831         a version if there is, in fact, a version.
6832
6833 2009-12-14  Ian Lance Taylor  <iant@google.com>
6834
6835         Revert -Wshadow changes, all changes from:
6836         2009-12-11  Doug Kwan  <dougkwan@google.com>
6837         2009-12-11  Nick Clifton  <nickc@redhat.com>
6838         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6839
6840 2009-12-11  Doug Kwan  <dougkwan@google.com>
6841
6842         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6843         due to -Wshadow.
6844         * attributes.cc (Object_attribute::size): Ditto.
6845         (Attributes_section_data::size): Ditto.
6846         (Attributes_section_data::Attributes_section_data): Ditto.
6847         (Output_attributes_section_data::do_write): Ditto.
6848         * attributes.h (Object_attribute::set_type): Ditto.
6849         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6850
6851 2009-12-11  Nick Clifton  <nickc@redhat.com>
6852
6853         * archive.cc: Fix shadowed variable warnings.
6854         * arm.cc: Likewise.
6855         * compressed_output.cc: Likewise.
6856         * compressed_output.h: Likewise.
6857         * configure: Likewise.
6858         * dwarf_reader.cc: Likewise.
6859         * dynobj.cc: Likewise.
6860         * dynobj.h: Likewise.
6861         * ehframe.cc: Likewise.
6862         * ehframe.h: Likewise.
6863         * errors.cc: Likewise.
6864         * expression.cc: Likewise.
6865         * fileread.cc: Likewise.
6866         * fileread.h: Likewise.
6867         * freebsd.h: Likewise.
6868         * i386.cc: Likewise.
6869         * icf.cc: Likewise.
6870         * incremental.h: Likewise.
6871         * layout.cc: Likewise.
6872         * layout.h: Likewise.
6873         * mapfile.cc: Likewise.
6874         * merge.cc: Likewise.
6875         * merge.h: Likewise.
6876         * object.cc: Likewise.
6877         * object.h: Likewise.
6878         * options.h: Likewise.
6879         * output.cc: Likewise.
6880         * output.h: Likewise.
6881         * parameters.cc: Likewise.
6882         * plugin.cc: Likewise.
6883         * powerpc.cc: Likewise.
6884         * reduced_debug_output.cc: Likewise.
6885         * reduced_debug_output.h: Likewise.
6886         * reloc.cc: Likewise.
6887         * reloc.h: Likewise.
6888         * resolve.cc: Likewise.
6889         * script-sections.cc: Likewise.
6890         * script.cc: Likewise.
6891         * script.h: Likewise.
6892         * sparc.cc: Likewise.
6893         * symtab.cc: Likewise.
6894         * symtab.h: Likewise.
6895         * target-select.cc: Likewise.
6896         * target-select.h: Likewise.
6897         * token.h: Likewise.
6898         * workqueue.cc: Likewise.
6899         * workqueue.h: Likewise.
6900         * x86_64.cc: Likewise.
6901
6902 2009-12-10  Doug Kwan  <dougkwan@google.com>
6903
6904         * arm.cc (attributes.h): New include.
6905         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6906         (Arm_relobj::~Arm_relobj): Delete object pointed by
6907         attributes_section_data_.
6908         (Arm_relobj::attributes_section_data): New method definition.
6909         (Arm_relobj::attributes_section_data_): New data member declaration.
6910         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6911         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6912         attributes_section_data_.
6913         (Arm_dynobj::attributes_section_data): New method definition.
6914         (Arm_dynobj::attributes_section_data_): New data member declaration.
6915         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6916         initialization value of may_use_blx_ to false.
6917         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6918         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6919         object attributes to compute results instead of hard-coding.
6920         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6921         Target_arm::get_secondary_compatible_arch,
6922         Target_arm::set_secondary_compatible_arch
6923         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6924         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6925         New method declarations.
6926         (Target_arm::get_aeabi_object_attribute): New method definition.
6927         (Target_arm::attributes_section_data_): New data member declaration.
6928         (read_arm_attributes_section): New template definition.
6929         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6930         (Arm_dynobj::do_read_symbols): Ditto.
6931         (Target_arm::do_finalize_sections): Merge attributes sections from
6932         input.  Check for BLX use after attributes section merging.
6933         Fix __exidx_start and __exidx_end visibility.  Create an
6934         .ARM.attributes section if necessary.
6935         (Target_arm::get_secondary_compatible_arch,
6936         Target_arm::set_secondary_compatible_arch,
6937         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6938         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6939         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6940         New method definitions.
6941
6942 2009-12-09  Ian Lance Taylor  <iant@google.com>
6943
6944         * plugin.cc (Plugin::load): Don't cast from void* to a function
6945         pointer.
6946
6947 2009-12-09  Ian Lance Taylor  <iant@google.com>
6948
6949         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6950         information fields.
6951
6952 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6953
6954         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6955         Replace two_file_shared_1.so with two_file_shared_2.so.
6956         * testsuite/Makefile.in: Regenerated.
6957
6958 2009-12-08  Doug Kwan  <dougkwan@google.com>
6959
6960         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6961         (HFILES): Add attributes.h and int_encoding.h.
6962         * Makefile.in: Regenerate.
6963         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6964         function definitions to int_encoding.cc
6965         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6966         prototypes to int_encoding.h
6967         * reduced_debug_output.cc (int_encoding.h): New include.
6968         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6969         function definitions to int_encoding.cc
6970         (insert_into_vector, read_from_pointer): Move template definitions to
6971         int_encoding.h
6972         * attributes.cc: New file.
6973         * attributes.h: New file.
6974         * int_encoding.cc: New file.
6975         * int_encoding.h: New file.
6976
6977 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6978
6979         PR gold/11055
6980         * incremental-dump.cc (dump_incremental_inputs): New.
6981         (main): Use dump_incremental_inputs.
6982
6983 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6984
6985         PR gold/10893
6986         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6987         checking elfcpp::STT_FUNC.
6988         (Target_i386::Relocate::relocate): Likewise.
6989         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6990
6991         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6992         symbols from shared libraries into normal FUNC symbols.
6993
6994         * symtab.h (Symbol): Add is_func and use it.
6995
6996 2009-12-05  Doug Kwan  <dougkwan@google.com>
6997
6998         * arm.cc (Target_arm::arm_info): Initialize new fields
6999         attributes_section and attributes_vendor.
7000         * i386.cc (Target_i386::i386_info): Same.
7001         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7002         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7003         fields attributes_section and attributes_vendor.
7004         * sparc.cc (Target_sparc::sparc_info): Same.
7005         * target.h (Target::attributes_section, Target::attributes_vendor,
7006         Target::is_attributes_section, Target::attribute_arg_type,
7007         Target::attributes_order): New method definitions.
7008         (Target::Target_info::attributes_section,
7009         Target::Target_info::attributes_vendor): New fields.
7010         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7011         virtual method definitions.
7012         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7013         attributes_section and attributes_vendor.
7014         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7015
7016 2009-12-05  Doug Kwan  <dougkwan@google.com>
7017
7018         * arm.cc: Update comments about interworking and stub generation.
7019         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7020         considered as non-PIC.
7021         (Arm_relocate_functions::base_abs): Fix formatting.
7022         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7023         of function to use GOT entry address instead of offset.
7024         (Target_arm::Scan::global): Issue an error if a symbol would need a
7025         PLT does not get one because it is untyped.  Remove code to create
7026         dynamic symbols for relative branches.
7027         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7028         takes unsigned integer instead of boolean.
7029
7030 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7031
7032         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7033         (two_file_test_LDADD): Likewise.
7034         (common_test_1_LDADD): Likewise.
7035         (exception_test_LDADD) Likewise.
7036         (weak_test_LDADD): Likewise.
7037         (many_sections_test_LDADD): Likewise.
7038         (initpri1_LDADD): Likewise.
7039         (script_test_1_LDADD): Likewise.
7040         (script_test_2_LDADD): Likewise.
7041         (justsyms_LDADD): Likewise.
7042         (binary_test_LDADD): Likewise.
7043         (large_LDADD): Likewise.
7044         * testsuite/Makefile.in: Regenerated.
7045
7046 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7047
7048         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7049         (Symbol_table::override_with_special): Likewise.
7050         (Symbol_table::add_from_object): Likewise.
7051
7052 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7053
7054         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7055         Don't set the data_offset twice.
7056
7057 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7058
7059         * testsuite/Makefile.in: Regenerate.
7060
7061 2009-12-03  Doug Kwan  <dougkwan@google.com>
7062
7063         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7064         (Target_arm::do_finalize_sections): Add parameter for symbol table
7065         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7066         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7067         parameter for symbol table pointer.
7068         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7069         an additional parameter for a pointer to symbol table.
7070         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7071         parameter for a symbol table pointer.
7072         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7073         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7074         Ditto.
7075         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7076         parameter for a symbol table pointer.
7077
7078 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7079
7080         * incremental.cc (Incremental_inputs_header)
7081         (Incremental_inputs_header_write, Incremental_inputs_entry)
7082         (Incremental_inputs_entry_write): Move ...
7083         * incremental.h (Incremental_inputs_header)
7084         (Incremental_inputs_header_write, Incremental_inputs_entry)
7085         (Incremental_inputs_entry_write): here.
7086
7087 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7088
7089         * incremental.cc (make_sized_incremental_binary): Set the target.
7090         Error if it is incompatible.
7091         * output.h (Output_file): Add filename method.
7092
7093 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7094
7095         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7096         from the get_* methods.
7097
7098 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7099
7100         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7101         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7102         Write 0 for the data_offset of scripts.
7103
7104 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7105
7106         * testsuite/Makefile.am: Add the incremental_test.sh test.
7107         * testsuite/incremental_test.sh: New.
7108         * testsuite/incremental_test_1.c: New.
7109         * testsuite/incremental_test_2.c: New.
7110
7111 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7112
7113        * incremental-dump.cc (main): Fix typos.
7114
7115 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7116
7117         PR gold/11025
7118         * incremental-dump.cc (main): Use llu to print 64 bit values.
7119
7120 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7121             H.J. Lu  <hongjiu.lu@intel.com>
7122
7123         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7124         $(LIBDL).
7125         (incremental_dump_LDADD): Likewise.
7126         * Makefile.in: Regenerated.
7127
7128 2009-11-25  Doug Kwan  <dougkwan@google.com>
7129
7130         Revert:
7131
7132         2009-11-25  Doug Kwan  <dougkwan@google.com>
7133
7134                 * arm.cc (Target_arm::Target_arm): Move method definition
7135                 outside of class definition.  Add code to handle
7136                 --target1-rel, --target1-abs and --target2= options.
7137                 (Target_arm::get_reloc_reloc_type): Change method to be
7138                 non-static and const.
7139                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7140                 New data member declaration.
7141                 (Target_arm::Scan::local, Target_arm::Scan::global,
7142                 Target_arm::Relocate::relocate,
7143                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7144                 Adjust call to Target_arm::get_real_reloc_type.
7145                 (Target_arm::get_real_reloc_type): Use command line options
7146                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7147                 * options.h (--target1-rel, --target1-abs, --target2): New
7148                 ARM-only options.
7149
7150 2009-11-25  Doug Kwan  <dougkwan@google.com>
7151
7152         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7153         class definition.  Add code to handle --target1-rel, --target1-abs
7154         and --target2= options.
7155         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7156         and const.
7157         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7158         member declaration.
7159         (Target_arm::Scan::local, Target_arm::Scan::global,
7160         Target_arm::Relocate::relocate,
7161         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7162         call to Target_arm::get_real_reloc_type.
7163         (Target_arm::get_real_reloc_type): Use command line options to
7164         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7165         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7166         options.
7167
7168 2009-11-25  Doug Kwan  <dougkwan@google.com>
7169
7170         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7171         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7172         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7173         formatting.
7174         (Arm_relocate_functions::thm_call): Replace body with a call to
7175         Arm_relocate_functions::thumb_branch_common.
7176         (Arm_relocate_functions::thm_jump24,
7177         Arm_relocate_functions::thm_xpc22): New method definitions.
7178         (Arm_relocate_functions::thumb_branch_common): New method definition.
7179         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7180         operator.
7181         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7182         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7183
7184 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7185
7186         * Makefile.am: Build incremental-dump
7187         * Makefile.in: Regenerate.
7188         * incremental-dump.cc: New.
7189         * incremental.cc (Incremental_inputs_header_data,
7190         Incremental_inputs_entry_data): Move to incremental.h
7191         * incremental.h: (Incremental_inputs_header_data,
7192         Incremental_inputs_entry_data): Move from incremental.cc
7193
7194 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7195
7196         * incremental.cc (Incremental_inputs_header,
7197         Incremental_inputs_header_write, Incremental_inputs_entry,
7198         Incremental_inputs_entry_write): Add a typedef with the data type.
7199
7200 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7201
7202         * incremental.cc (Incremental_inputs_header,
7203         Incremental_inputs_header_write, Incremental_inputs_entry,
7204         Incremental_inputs_entry_write): Update comment about which
7205         type has the filed descriptions.
7206
7207 2009-11-15  Doug Kwan  <dougkwan@google.com>
7208
7209         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7210         (Arm_relocate_functions::arm_branch_common): Change method defintion
7211         in class definition to a method declaration and update list of formal
7212         parameters.
7213         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7214         Arm_relocation_functions::jump24): Adjust call to
7215         Arm_relocate_functions::arm_branch_common.  Update list of formal
7216         parameters.
7217         (Arm_relocate_functions::xpc25): New method definition.
7218         (Arm_relocate_functions::arm_branch_common): Move method defintion
7219         out from class definition.  Use stubs for mode-switching and extending
7220         branch ranges.
7221         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7222         specially.  Change code to enable use of stubs in ARM branches.
7223
7224 2009-11-10  Doug Kwan  <dougkwan@google.com>
7225
7226         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7227         in method declaration.
7228         (Target_arm::relocate_stub): New method declaration.
7229         (Target_arm::default_target): Change to return a pointer instead of
7230         a const reference.
7231         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7232         Target_arm::default_target.
7233         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7234         method definition.
7235         (Target_arm::relocate_section): Adjust view.
7236         (Target_arm::relocate_stub): New method definition.
7237
7238 2009-11-10  Doug Kwan  <dougkwan@google.com>
7239
7240         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7241         a format warning.
7242         * incremental.cc (open_incremental_binary): Initialized local
7243         variables to avoid warnings.
7244         * object.cc (make_elf_object): Ditto.
7245         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7246         a format warning.
7247
7248 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7249
7250         PR gold/10930
7251         * testsuite/plugin_test.c: Include "config.h".
7252
7253 2009-11-09  Doug Kwan  <dougkwan@google.com>
7254
7255         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7256         (arm_symbol_value): Remove.
7257         (Arm_relocate_functions::arm_branch_common,
7258         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7259         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7260         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7261         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7262         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7263         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7264         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7265         Arm_relocate_functions::thm_mobw_abs_nc,
7266         Arm_relocate_functions::thm_mov_abs,
7267         Arm_relocate_functions::movw_prel_nc,
7268         Arm_relocate_functions::thm_movt_abs,
7269         Arm_relocate_functions::movt_prel,
7270         Arm_relocate_functions::thm_movw_prel_nc,
7271         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7272         (Target_arm::Relocate::relocate): Only decompose address into two
7273         parts if relocation type uses the thumb-bit and pass the actual
7274         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7275         calls to methods in Arm_relocate_functions for this change.
7276
7277 2009-11-08  Ian Lance Taylor  <iant@google.com>
7278
7279         PR 10925
7280         * reloc.cc: Instantiate
7281         Sized_relobj::initialize_input_to_output_maps and
7282         Sized_relobj:free_input_to_output_maps.
7283
7284 2009-11-06  Ian Lance Taylor  <iant@google.com>
7285
7286         PR 10876
7287         * defstd.cc (in_segment): Set only_if_ref true for "end".
7288
7289 2009-11-06  Doug Kwan  <dougkwan@google.com>
7290
7291         * arm.cc (class Reloc_stub): Correct a comment.
7292         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7293         (Target_arm::scan_section_for_stubs): New method declaration.
7294         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7295         Change methods from private to protected.
7296         (Target_arm::do_may_relax): New method definition.
7297         (Target_arm::do_relax, Target_arm::group_sections,
7298         Target_arm::scan_reloc_for_stub,
7299         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7300         (Target_arm::arm_input_section_map_): New data member declaration.
7301         (Target_arm::scan_reloc_for_stub,
7302         Target_arm::scan_reloc_section_for_stubs,
7303         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7304         Target_arm::do_relax): New method definitions.
7305
7306 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7307
7308         * configure.ac: Check for (struct stat)::st_mtim
7309         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7310         * config.in: Regenerate.
7311         * configure: Regenerate.
7312
7313 2009-11-05  Ian Lance Taylor  <iant@google.com>
7314
7315         PR 10910
7316         * output.cc (Output_segment::add_output_section): Add missing
7317         return statement.
7318
7319 2009-11-04  Ian Lance Taylor  <iant@google.com>
7320
7321         PR 10880
7322         * object.h (class Object): Add is_needed and set_is_needed
7323         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7324         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7325         defined in a dynamic object and referenced by a regular object,
7326         set is_needed for the dynamic object.
7327         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7328         if the file is marked with as_needed and it is not needed.
7329
7330 2009-11-04  Ian Lance Taylor  <iant@google.com>
7331
7332         PR 10887
7333         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7334         tags if data is discarded by linker script.
7335         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7336         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7337         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7338         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7339
7340 2009-11-04  Ian Lance Taylor  <iant@google.com>
7341
7342         * layout.cc (Layout::get_output_section): Add is_interp and
7343         is_dynamic_linker_section parameters.  Change all callers.
7344         (Layout::choose_output_section): Likewise.
7345         (Layout::make_output_section): Likewise.
7346         (Layout::add_output_section_data): Add is_dynamic_linker_section
7347         parameter.  Change all callers.
7348         * layout.h (class Layout): Update declarations.
7349         * output.h (class Output_section): Add is_interp, set_is_interp,
7350         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7351         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7352         generate_code_fills_at_write_ to a bitfield.
7353         * output.cc (Output_section::Output_sections): Initialize new
7354         fields.
7355         (Output_segment::add_output_section): Add do_sort parameter.
7356         Change all callers.
7357
7358 2009-11-03  Ian Lance Taylor  <iant@google.com>
7359
7360         PR 10860
7361         * options.h (class General_options): Add --warn-common.
7362         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7363         merging two common symbols.
7364         (Symbol_table::should_override): Handle --warn-common when merging
7365         a common symbol with a defined symbol.  Use report_resolve_problem
7366         for multiple definitions.
7367         (Symbol_table::report_resolve_problem): New function.
7368         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7369
7370 2009-11-03  Doug Kwan  <dougkwan@google.com>
7371
7372         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7373         stub_factory_.
7374         (Target_arm::stub_factory): New method definition.
7375         (Target_arm::new_arm_input_section,
7376         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7377         Target_arm::reloc_uses_thumb_bit): New method declarations.
7378         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7379         New type definitions.
7380         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7381         member declarations.
7382         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7383         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7384         New method definitions.
7385
7386 2009-11-03  Ian Lance Taylor  <iant@google.com>
7387
7388         * options.h (class General_options): Add --warn_constructors.
7389
7390 2009-11-03  Ian Lance Taylor  <iant@google.com>
7391
7392         PR 10893
7393         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7394         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7395
7396 2009-11-03  Ian Lance Taylor  <iant@google.com>
7397
7398         PR 10895
7399         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7400         --msgid-bugs-address.
7401         (install-pdf): New target.
7402         (install-data_yes): Look up one directory to find mkinstalldirs.
7403
7404 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7405
7406         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7407         tree.
7408
7409 2009-10-30  Doug Kwan  <dougkwan@google.com>
7410
7411         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7412
7413 2009-10-30  Doug Kwan  <dougkwan@google.com>
7414
7415         * arm.cc (Stub_addend_reader): New struct template definition
7416         and partial specializations.
7417         (Stub_addend_reader::operator()): New method definition for a
7418         partially specialized template.
7419
7420 2009-10-30  Doug Kwan  <dougkwan@google.com>
7421
7422         * arm.cc (Arm_relobj::processor_specific_flags): New method
7423         definition.
7424         (Arm_relobj::do_read_symbols): New method declaration.
7425         (Arm_relobj::processor_specific_flags_): New data member declaration.
7426         (Arm_dynobj): New class definition.
7427         (Target_arm::do_finalize_sections): Add input_objects parameter.
7428         (Target_arm::do_adjust_elf_header): New method declaration.
7429         (Target_arm::are_eabi_versions_compatible,
7430         (Target_arm::merge_processor_specific_flags): New method declaration.
7431         (Target_arm::do_make_elf_object): New overloaded method definitions
7432         and declaration.
7433         (Arm_relobj::do_read_symbols): New method definition.
7434         (Arm_dynobj::do_read_symbols): Ditto.
7435         (Target_arm::do_finalize_sections): Add input_objects parameters.
7436         Merge processor-specific flags from all input objects.
7437         (Target_arm::are_eabi_versions_compatible,
7438         Target_arm::merge_processor_specific_flags,
7439         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7440         New method definitions.
7441         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7442         Input_objects pointer type parameter.
7443         * layout.cc (Layout::finalize): Pass input objects to target's.
7444         finalize_sections function.
7445         * output.cc (Output_file_header::do_sized_write): Set ELF file
7446         header's processor-specific flags.
7447         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7448         Input_objects pointer type parameter.
7449         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7450         * target.h (Input_objects): New forward class declaration.
7451         (Target::processor_specific_flags,
7452         Target::are_processor_specific_flags_sect): New method definitions.
7453         (Target::finalize_sections): Add input_objects parameter.
7454         (Target::Target): Initialize processor_specific_flags_ and
7455         are_processor_specific_flags_set_.
7456         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7457         parameter.
7458         (Target::set_processor_specific_flags): New method definition.
7459         (Target::processor_specific_flags_,
7460         Target::are_processor_specific_flags_set_): New data member
7461         declarations.
7462         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7463         Input_objects pointer type parameter.
7464
7465 2009-10-30  Doug Kwan  <dougkwan@google.com>
7466
7467         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7468
7469 2009-10-28  Ian Lance Taylor  <iant@google.com>
7470
7471         * object.h (class Relobj): Drop options parameter from
7472         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7473         do_scan_relocs, do_relocate.  Change all callers.
7474         (class Sized_relobj): Drop options parameters from
7475         do_gc_process_relocs, do_scan_relocs, do_relocate,
7476         do_relocate_sections, relocate_sections, emit_relocs_scan,
7477         emit_relocs_scan_reltype.  Change all callers.
7478         (struct Relocate_info): Remove options field and all references to
7479         it.
7480         * reloc.h (class Read_relocs): Remove options constructor
7481         parameter and options_ field.  Change all callers.
7482         (class Gc_process_relocs, class Scan_relocs): Likewise.
7483         (class Relocate_task): Likewise.
7484         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7485         all callers.
7486         (scan_relocatable_relocs): Likewise.
7487         * target.h (class Sized_target): Remove options parameter from
7488         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7489         all callers.
7490         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7491         callers.
7492         * arm.cc: Update functions to remove options parameters.
7493         * i386.cc: Likewise.
7494         * powerpc.cc: Likewise.
7495         * sparc.cc: Likewise.
7496         * x86_64.cc: Likewise.
7497         * testsuite/testfile.cc: Likewise.
7498
7499 2009-10-28  Doug Kwan  <dougkwan@google.com>
7500
7501         * arm.cc (Arm_relobj): New class definition.
7502         (Arm_relobj::scan_sections_for_stubs,
7503         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7504         New method definitions.
7505
7506 2009-10-28  Cary Coutant  <ccoutant@google.com>
7507
7508         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7509         (Plugin::cleanup_done_): New member.
7510         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7511         (Plugin_manager::cleanup_done_): Remove.
7512         (Plugin_manager::add_input_file): Edit error message.
7513         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7514         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7515
7516 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7517
7518         * fileread.cc: (File_read::View::~View): Use the new
7519         data_ownership_ filed.
7520         (File_read::~File_read): Dispose the new whole_file_view_.
7521         (File_read::open): Mmap the whole file if needed.
7522         (File_read::open): Use whole_file_view_ instead of contents_.
7523         (File_read::find_view): Use whole_file_view_ if applicable.
7524         (File_read::do_read): Use whole_file_view_ instead of contents_.
7525         (File_read::make_view): Use whole_file_view_ instead of contents_,
7526         update File_read::View::View call.
7527         (File_read::find_or_make_view): Update File_read::View::View
7528         call.
7529         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7530         remove contents_
7531         (File_read::View::Data_ownership): New enum.
7532         (File_read::View::View): Replace bool mapped_ with Data_ownership
7533         argument.
7534         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7535         (File_read::View::data_ownership_): New field.
7536         (File_read::contents_): Remove (replaced by whole_file_view_).
7537         (File_read::whole_file_view_): New field.
7538         * options.h (class General_options): Add --keep-files-mapped.
7539
7540 2009-10-27  Cary Coutant  <ccoutant@google.com>
7541
7542         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7543         * testsuite/Makefile.am (plugin_test_5): New test case.
7544         * testsuite/Makefile.in: Regenerate.
7545
7546 2009-10-25  Doug Kwan  <dougkwan@google.com>
7547
7548         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7549         from private to protected to allow access by child class.
7550         (Sized_relobj::do_relocate_sections): New method declaration.
7551         (Sized_relobj::relocate_sections): Virtualize.
7552         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7553         Sized_relobj::relocate_sections.  Instantiate template explicitly
7554         for different target sizes and endianity.
7555
7556 2009-10-24  Doug Kwan  <dougkwan@google.com>
7557
7558         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7559         (Arm_input_section::as_arm_input_section): New method.
7560         (Arm_output_section): New class definition.
7561         (Arm_output_section::create_stub_group,
7562         Arm_output_section::group_sections): New method definitions.
7563
7564 2009-10-22  Doug Kwan  <dougkwan@google.com>
7565
7566         * arm.cc (Arm_input_section): New class definition.
7567         (Arm_input_section::init, Arm_input_section:do_write,
7568         Arm_input_section::set_final_data_size,
7569         Arm_input_section::do_reset_address_and_file_offset): New method
7570         definitions.
7571
7572 2009-10-21  Doug Kwan  <dougkwan@google.com>
7573
7574         * arm.cc (Stub_table, Arm_input_section): New forward class
7575         declarations.
7576         (Stub_table): New class defintion.
7577         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7578         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7579         New method definition.
7580
7581 2009-10-21  Doug Kwan  <dougkwan@google.com>
7582
7583         * arm.cc: Update copyright comments.
7584         (Target_arm): New forward class template declaration.
7585         (Arm_address): New type.
7586         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7587         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7588         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7589         constants.
7590         (Insn_template): Same.
7591         (DEF_STUBS): New macro.
7592         (Stub_type): New enum type.
7593         (Stub_template): New class definition.
7594         (Stub): Same.
7595         (Reloc_stub): Same.
7596         (Stub_factory): Same.
7597         (Target_arm::Target_arm): Initialize may_use_blx_ and
7598         should_force_pic_veneer_.
7599         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7600         Target_arm::should_force_pic_veneer,
7601         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7602         Target_arm::using_thumb_only, Target_arm:;default_target): New
7603         method defintions.
7604         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7605         New data member declarations.
7606         (Insn_template::size, Insn_template::alignment): New method defintions.
7607         (Stub_template::Stub_template): New method definition.
7608         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7609         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7610         (Stub_factory::Stub_factory): New method definition.
7611         * gold.h (string_hash): New template.
7612         * output.h (Input_section_specifier::hash_value): Use
7613         gold::string_hash.
7614         (Input_section_specifier::string_hash): Remove.
7615         * stringpool.cc (Stringpool_template::string_hash): Use
7616         gold::string_hash.
7617
7618 2009-10-20  Doug Kwan  <dougkwan@google.com>
7619
7620         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7621         symbols of relaxed input sections.
7622         * output.h (Output_section::find_relaxed_input_section): Make
7623         method public.
7624
7625 2009-10-16  Doug Kwan  <dougkwan@google.com>
7626
7627         * dynobj.cc (Versions::Versions): Initialize version_script_.
7628         Only insert base version symbol definition for a shared object
7629         if version script defines any version versions.
7630         (Versions::define_base_version): New method definition.
7631         (Versions::add_def): Check that base version is not needed.
7632         (Versions::add_need): Define base version lazily.
7633         * dynobj.h (Versions::define_base_version): New method declaration.
7634         (Versions::needs_base_version_): New data member declaration.
7635         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7636         (check_DATA): Add no_version_test.stdout.
7637         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7638         New make rules.
7639         * testsuite/Makefile.in: Regenerate.
7640         * testsuite/no_version_test.c: New file.
7641         * testsuite/no_version_test.sh: Ditto.
7642
7643 2009-10-16  Doug Kwan  <dougkwan@google.com>
7644
7645         * expression.cc (class Segment_start_expression): New class definition.
7646         (Segment_start_expression::value): New method definition.
7647         (script_exp_function_segment_start): Return a new
7648         Segment_start_expression.
7649         * gold/script-c.h (script_saw_segment_start_expression): New function
7650         prototype.
7651         * script-sections.cc (Script_sections::Script_sections): Initialize
7652         SAW_SEGMENT_START_EXPRESSION_ to false.
7653         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7654         and -Tbbs options to specify section addresses if given in
7655         command line and no SEGMENT_START expression is seen in a script.
7656         * script-sections.h (Script_sections::saw_segment_start_expression,
7657         Script_sections::set_saw_segment_start_expression): New method
7658         definition.
7659         (Script_sections::saw_segment_start_expression_): New data member
7660         declaration.
7661         * script.cc (script_saw_segment_start_expression): New function.
7662         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7663         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7664         script_test_7.sh and script_test_8.sh.
7665         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7666         script_test_8.stdout.
7667         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7668         (script_test_6, script_test_6.stdout, script_test_7,
7669         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7670         * Makefile.in: Regenerate.
7671         * testsuite/script_test_6.sh: New file.
7672         * testsuite/script_test_6.t: Same.
7673         * testsuite/script_test_7.sh: Same.
7674         * testsuite/script_test_7.t: Same.
7675         * testsuite/script_test_8.sh: Same.
7676
7677 2009-10-16  Doug Kwan  <dougkwan@google.com>
7678
7679         * output.cc (Output_segment::set_section_list_address): Cast
7680         expressions to unsigned long long type to avoid format warnings.
7681
7682 2009-10-15  Ian Lance Taylor  <iant@google.com>
7683
7684         * script.cc (Script_options::add_symbol_assignment): Always add a
7685         dot assignment to script_sections_.
7686         * script-sections.cc (Script_sections::add_dot_assignment):
7687         Initialize if necessary.
7688
7689         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7690         program headers with no load segment if there is a linker script.
7691
7692         * layout.cc (Layout::set_segment_offsets): Align the file offset
7693         to the segment aligment for -N or -n with no load segment.
7694         * output.cc (Output_segment::add_output_section): Don't crash if
7695         the first section is a TLS section.
7696         (Output_segment::set_section_list_addresses): Print an error
7697         message if the address moves backward in a linker script.
7698         * script-sections.cc
7699         (Output_section_element_input::set_section_addresses): Don't
7700         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7701         (Orphan_output_section::set_section_addresses): Likewise.
7702
7703 2009-10-15  Doug Kwan  <dougkwan@google.com>
7704
7705         * layout.cc (Layout::finish_dynamic_section): Generate tags
7706         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7707         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7708         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7709
7710 2009-10-14  Ian Lance Taylor  <iant@google.com>
7711
7712         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7713         fields.
7714         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7715         data_shdr fields of relinfo.
7716         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7717         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7718         R_386_TLS_LDO_32, adjust based on section flags.
7719         (Target_i386::Relocate::fix_up_ldo): Remove.
7720
7721 2009-10-13  Ian Lance Taylor  <iant@google.com>
7722
7723         Add support for -pie.
7724         * options.h (class General_options): Add -pie and
7725         --pic-executable.
7726         (General_options::output_is_position_independent): Test -pie.
7727         (General_options::output_is_executable): Return true if not shared
7728         and not relocatable.
7729         (General_options::output_is_pie): Remove.
7730         * options.cc (General_options::finalize): Reject incompatible uses
7731         of -pie.
7732         * gold.cc (queue_middle_tasks): A -pie link is not static.
7733         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7734         * symtab.cc (Symbol::final_value_is_known): Return false if
7735         output_is_position_independent.
7736         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7737         output_is_position_independent.
7738         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7739         output_is_position_independent.
7740         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7741         output_is_position_independent.
7742         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7743         two_file_pie_test.
7744         (basic_pie_test.o, basic_pie_test): New targets.
7745         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7746         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7747         (two_file_pie_test): New target.
7748         * testsuite/Makefile.in: Rebuild.
7749         * README: Remove note saying that -pie is not supported.
7750
7751 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7752
7753         * options.h (class General_options): Add -init and -fini.
7754         * layout.cc (Layout::finish_dynamic_section): Emit
7755         given init and fini functions.
7756
7757 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7758
7759         * gc.h (gc_process_relocs): Check if icf is enabled using new
7760         function.
7761         * gold.cc (queue_initial_tasks): Likewise.
7762         (queue_middle_tasks): Likewise.
7763         * object.cc (do_layout): Likewise.
7764         * symtab.cc (is_section_folded): Likewise.
7765         * main.cc (main): Likewise.
7766         * reloc.cc (Read_relocs::run): Likewise.
7767         (Sized_relobj::do_scan_relocs): Likewise.
7768         * icf.cc (is_function_ctor_or_dtor): New function.
7769         (Icf::find_identical_sections): Check if function is ctor or dtor when
7770         safe icf is chosen.
7771         * options.h (General_options::icf): Change option to be an enum.
7772         (Icf_status): New enum.
7773         (icf_enabled): New method.
7774         (icf_safe_folding): New method.
7775         (set_icf_status): New method.
7776         (icf_status_): New variable.
7777         * (options.cc) (General_options::finalize): Set icf_status_.
7778         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7779         icf_test and icf_keep_unique_test to use the --icf enum flag.
7780         * testsuite/icf_safe_test.sh: New file.
7781         * testsuite/icf_safe_test.cc: New file.
7782
7783 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7784
7785         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7786         includes to gc.h and icf.h.
7787         * arm.cc: Include gc.h.
7788         * gold.cc: Likewise.
7789         * i386.cc: Likewise.
7790         * powerpc.cc: Likewise.
7791         * sparc.cc: Likewise.
7792         * x86_64.cc: Likewise.
7793         * gc.h: Include icf.h.
7794
7795 2009-10-11  Ian Lance Taylor  <iant@google.com>
7796
7797         * plugin.cc: Include "gold.h" before other header files.
7798
7799 2009-10-10  Chris Demetriou  <cgd@google.com>
7800
7801         * options.h (Input_file_argument::Input_file_type): New enum.
7802         (Input_file_argument::is_lib_): Replace with...
7803         (Input_file_argument::type_): New member.
7804         (Input_file_argument::Input_file_argument): Take Input_file_type
7805         'type' rather than boolean 'is_lib' as second argument.
7806         (Input_file_argument::is_lib): Use type_.
7807         (Input_file_argument::is_searched_file): New function.
7808         (Input_file_argument::may_need_search): Handle is_searched_file.
7809         * options.cc (General_options::parse_library): Support -l:filename.
7810         (General_options::parse_just_symbols): Update for Input_file_argument
7811         changes.
7812         (Command_line::process): Likewise.
7813         * archive.cc (Archive::get_file_and_offset): Likewise.
7814         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7815         * script.cc (read_script_file, script_add_file): Likewise.
7816         * fileread.cc (Input_file::Input_file): Likewise.
7817         (Input_file::will_search_for): Handle is_searched_file.
7818         (Input_file::open): Likewise.
7819         * readsyms.cc (Read_symbols::get_name): Likewise.
7820         * testsuite/Makefile.am (searched_file_test): New test.
7821         * testsuite/Makefile.in: Regenerate.
7822         * testsuite/searched_file_test.cc: New file.
7823         * testsuite/searched_file_test_lib.cc: New file.
7824
7825 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7826             Ian Lance Taylor  <iant@google.com>
7827
7828         * descriptor.cc: Include <cstdio> and "binary-io.h".
7829         (Descriptors::open): Open the files in binary mode always.
7830         * script.cc (Lex::get_token): Treat \r as whitespace.
7831
7832 2009-10-09  Ian Lance Taylor  <iant@google.com>
7833
7834         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7835
7836 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7837             Ian Lance Taylor  <iant@google.com>
7838
7839         * configure.ac: Check for readv function also.
7840         * fileread.cc (readv): Define if not HAVE_READV.
7841         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7842         does not exist.
7843         * config.in: Regenerate.
7844         * configure: Regenerate.
7845
7846 2009-10-09  Doug Kwan  <dougkwan@google.com>
7847
7848         * layout.cc (Layout::make_output_section): Call target hook to make
7849         ordinary output section.
7850         (Layout::finalize): Adjust parameter list of call the
7851         Target::may_relax().
7852         * layout.h (class Layout::section_list): New method.
7853         * merge.h (Output_merge_base::entsize): Change visibility to public.
7854         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7855         New methods.
7856         (Output_merge_string::do_is_string): New method.
7857         * object.cc (Sized_relobj::do_setup): renamed from
7858         Sized_relobj::set_up.
7859         * object.h (Sized_relobj::adjust_shndx,
7860         Sized_relobj::initializ_input_to_output_maps,
7861         Sized_relobj::free_input_to_output_maps): Change visibilities to
7862         protected.
7863         (Sized_relobj::setup): Virtualize.
7864         (Sized_relobj::do_setup): New method declaration.
7865         (Sized_relobj::invalidate_section_offset,
7866         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7867         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7868         * options.cc (parse_int): New function.
7869         * options.h (parse_int): New declaration.
7870         (DEFINE_int): New macro.
7871         (stub_group_size): New option.
7872         * output.cc (Output_section::Output_section): Initialize memebers
7873         merge_section_map_, merge_section_by_properties_map_,
7874         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7875         (Output_section::add_input_section): Handled deferred code-fill
7876         generation and remove an old comment.
7877         (Output_section::add_relaxed_input_section): New method definition.
7878         (Output_section::add_merge_input_section): Use merge section by
7879         properties map to speed to search.  Update merge section maps
7880         as appropriate.
7881         (Output_section::build_relaxation_map): New method definition.
7882         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7883         Same.
7884         (Output_section::relax_input_section): Renamed to
7885         Output_section::convert_input_sections_to_relaxed_sections and change
7886         interface to take a vector of pointers to relaxed sections.
7887         (Output_section::find_merge_section,
7888         Output_section::find_relaxed_input_section): New method definitions.
7889         (Output_section::is_input_address_mapped,
7890         Output_section::output_offset, Output_section::output_address):
7891         Use output section data maps to speed up searching.
7892         (Output_section::find_starting_output_address): Add comments.
7893         (Output_section::do_write,
7894         Output_section::write_to_postprocessing_buffer): Do code-fill
7895         generation as appropriate.
7896         (Output_section::get_input_sections): Invalidate relaxed input section
7897         map.
7898         (Output_section::restore_states): Adjust type of checkpoint .
7899         Invalidate relaxed input section map.
7900         * output.h (Output_merge_base): New class declaration.
7901         (Input_section_specifier): New class defintion.
7902         (class Output_relaxed_input_section) Change base class to
7903         Output_section_data_build.
7904         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7905         base class initializer.
7906         (Output_section::add_relaxed_input_section): New method declaration.
7907         (Output_section::Input_section): Change visibility to protected.
7908         (Output_section::Input_section::relobj,
7909         Output_section::Input_section::shndx): Handle relaxed input sections.
7910         Output_section::input_sections) Change visibility to protected.  Also
7911         define overload to return a non-const pointer.
7912         (Output_section::Merge_section_properties): New class defintion.
7913         (Output_section::Merge_section_by_properties_map,
7914         Output_section::Output_section_data_by_input_section_map,
7915         Output_section::Relaxation_map): New types.
7916         (Output_section::relax_input_section): Rename method to
7917         Output_section::convert_input_sections_to_relaxed_sections and change
7918         interface to take a vector of relaxed section pointers.
7919         (Output_section::find_merge_section,
7920         Output_section::find_relaxed_input_section,
7921         Output_section::build_relaxation_map,
7922         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7923         New method declarations.
7924         (Output_section::merge_section_map_
7925         Output_section::merge_section_by_properties_map_,
7926         Output_section::relaxed_input_section_map_,
7927         Output_section::is_relaxed_input_section_map_valid_,
7928         Output_section::generate_code_fills_at_write_): New data members.
7929         * script-sections.cc
7930         (Output_section_element_input::set_section_addresses): Call
7931         current_data_size and addralign methods of relaxed input sections.
7932         (Orphan_output_section::set_section_addresses): Call current_data_size
7933         and addralign methods of relaxed input sections.
7934         * symtab.cc (Symbol_table::compute_final_value): Extract template
7935         from the body of Symbol_table::sized_finalize_symbol.
7936         (Symbol_table::sized_finalized_symbol): Call
7937         Symbol_table::compute_final_value.
7938         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7939         (Symbol_table::compute_final_value): New templated method declaration.
7940         * target.cc (Target::do_make_output_section): New method defintion.
7941         * target.h (Target::make_output_section): New method declaration.
7942         (Target::relax): Add more parameters for input objects, symbol table
7943         and layout.  Adjust call to do_relax.
7944         (Target::do_make_output_section): New method declaration.
7945         (Target::do_relax): Add parameters for input objects, symbol table
7946         and layout.
7947
7948 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7949
7950         * pread.c: Include stdio.h.
7951
7952 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7953
7954         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7955         defined.
7956
7957 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7958
7959         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7960         Change read_shndx type to unsigned int.
7961         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7962         int.
7963         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7964         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7965         Change read_shndx type to unsigned int.
7966         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7967         int.
7968         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7969         * layout.cc (Layout::create_symtab_sections): Cast the result of
7970         local_symcount * symsize to off_t in the gold_assert.
7971
7972 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7973
7974         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7975         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7976         R_ARM_BASE_ABS.
7977         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7978         (Arm_relocate_functions::thm_abs5): New function.
7979         (Arm_relocate_functions::abs12): New function.
7980         (Arm_relocate_functions::abs16): New function.
7981         (Arm_relocate_functions::base_abs): New function.
7982         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7983         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7984         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7985         R_ARM_BASE_ABS.
7986         (Scan::global): Likewise.
7987         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7988         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7989         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7990         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7991         R_ARM_BASE_ABS.
7992
7993 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7994
7995         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7996         (Arm_relocate_functions::movt_prel): New function.
7997         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7998         (Arm_relocate_functions::thm_movt_prel): New function.
7999         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8000         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8001         (Scan::global, Relocate::relocate): Likewise.
8002         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8003
8004 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8005
8006         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8007         Incremental_checker.
8008         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8009         unsigned int.
8010         (class Incremental_inputs_header): New class.
8011         (Incremental_inputs_header_writer): Edit comment.
8012         (Incremental_inputs_entry): New class.
8013         (Incremental_inputs_entry_writer): Edit comment.
8014         (Sized_incremental_binary::do_find_incremental_inputs_section):
8015         Add *strtab_shndx parameter, fill it.
8016         (Sized_incremental_binary::do_check_inputs): New method.
8017         (Incremental_checker::can_incrementally_link_output_file): Use
8018         Sized_incremental_binary::check_inputs.
8019         (Incremental_inputs::report_command_line): Save command line in
8020         command_line_.
8021         * incremental.h:
8022         (Incremental_binary::find_incremental_inputs_section): New
8023         method.
8024         (Incremental_binary::do_find_incremental_inputs_section): Add
8025         strtab_shndx parameter.
8026         (Incremental_binary::do_check_inputs): New pure virtual method.
8027         (Sized_incremental_binary::do_check_inputs): Declare.
8028         (Incremental_checker::Incremental_checker): Add incremental_inputs
8029         parameter, use it to initialize incremental_inputs_.
8030         (Incremental_checker::incremental_inputs_): New field.
8031         (Incremental_checker::command_line): New method.
8032         (Incremental_checker::inputs): New method.
8033         (Incremental_checker::command_line_): New field.
8034
8035 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8036
8037         * incremental.cc: Include <cstdarg> and "target-select.h".
8038         (vexplain_no_incremental): New function.
8039         (explain_no_incremental): New function.
8040         (Incremental_binary::error): New method.
8041         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8042         method.
8043         (make_sized_incremental_binary): New function.
8044         (open_incremental_binary): New function.
8045         (can_incrementally_link_file): Add checks if output is ELF and has
8046         inputs section.
8047         * incremental.h: Include "elfcpp_file.h" and "output.h".
8048         (Incremental_binary): New class.
8049         (Sized_incremental_binary): New class.
8050         (open_incremental_binary): Declare.
8051         * object.cc (is_elf_object): Use
8052         elfcpp::Elf_recognizer::is_elf_file.
8053         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8054         * output.h (Output_file::filesize): New method.
8055
8056 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8057
8058         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8059         New function.
8060         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8061         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8062         function.
8063         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8064         function.
8065         (Arm_relocate_functions::movw_abs_nc): New function.
8066         (Arm_relocate_functions::movt_abs): New function.
8067         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8068         (Arm_relocate_functions::thm_movt_abs): New function.
8069         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8070         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8071         (Scan::global): Likewise.
8072         (Relocate::relocate): Likewise.
8073         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8074
8075 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8076
8077         * arm.cc (Arm_relocate_functions::got_prel) New function.
8078         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8079         (Relocate::relocate): Likewise.
8080         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8081
8082 2009-10-06  Ian Lance Taylor  <iant@google.com>
8083
8084         * options.h (class General_options): Define
8085         split_stack_adjust_size parameter.
8086         * object.h (class Object): Add uses_split_stack_ and
8087         has_no_split_stack_ fields.  Add uses_split_stack and
8088         has_no_split_stack accessor functions.  Declare
8089         handle_split_stack_section.
8090         (class Reloc_symbol_changes): Define.
8091         (class Sized_relobj): Define Function_offsets.  Declare
8092         split_stack_adjust, split_stack_adjust_reltype, and
8093         find_functions.
8094         * object.cc (Object::handle_split_stack_section): New function.
8095         (Sized_relobj::do_layout): Call handle_split_stack_section.
8096         * dynobj.cc (Sized_dynobj::do_layout): Call
8097         handle_split_stack_section.
8098         * reloc.cc (Sized_relobj::relocate_sections): Call
8099         split_stack_adjust for executable sections in split_stack
8100         objects.  Pass reloc_map to relocate_section.
8101         (Sized_relobj::split_stack_adjust): New function.
8102         (Sized_relobj::split_stack_adjust_reltype): New function.
8103         (Sized_relobj::find_functions): New function.
8104         * target-reloc.h: Include "object.h".
8105         (relocate_section): Add reloc_symbol_changes parameter.  Change
8106         all callers.
8107         * target.h (class Target): Add calls_non_split method.  Declare
8108         do_calls_non_split virtual method.  Declare match_view and
8109         set_view_to_nop.
8110         * target.cc: Include "elfcpp.h".
8111         (Target::do_calls_non_split): New function.
8112         (Target::match_view): New function.
8113         (Target::set_view_to_nop): New function.
8114         * gold.cc (queue_middle_tasks): Give an error if mixing
8115         split-stack and non-split-stack objects with -r.
8116         * i386.cc (Target_i386::relocate_section): Add
8117         reloc_symbol_changes parameter.
8118         (Target_i386::do_calls_non_split): New function.
8119         * x86_64.cc (Target_x86_64::relocate_section): Add
8120         reloc_symbol_changes parameter.
8121         (Target_x86_64::do_calls_non_split): New function.
8122         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8123         parameter.
8124         * powerpc.cc (Target_powerpc::relocate_section): Add
8125         reloc_symbol_changes parameter.
8126         * sparc.cc (Target_sparc::relocate_section): Add
8127         reloc_symbol_changes parameter.
8128         * configure.ac: Call AM_CONDITIONAL for the default target.
8129         * configure: Rebuild.
8130         * testsuite/Makefile.am (TEST_AS): New variable.
8131         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8132         (check_DATA): Add split_i386 and split_x86_64 files.
8133         (SPLIT_DEFSYMS): Define.
8134         (split_i386_[1234n].o): New targets.
8135         (split_i386_[124]): New targets.
8136         (split_i386_[1234r].stdout): New targets.
8137         (split_x86_64_[1234n].o): New targets.
8138         (split_x86_64_[124]): New targets.
8139         (split_x86_64_[1234r].stdout): New targets.
8140         (MOSTLYCLEANFILES): Add new executables.
8141         * testsuite/split_i386.sh: New file.
8142         * testsuite/split_x86_64.sh: New file.
8143         * testsuite/split_i386_1.s: New file.
8144         * testsuite/split_i386_2.s: New file.
8145         * testsuite/split_i386_3.s: New file.
8146         * testsuite/split_i386_4.s: New file.
8147         * testsuite/split_i386_n.s: New file.
8148         * testsuite/split_x86_64_1.s: New file.
8149         * testsuite/split_x86_64_2.s: New file.
8150         * testsuite/split_x86_64_3.s: New file.
8151         * testsuite/split_x86_64_4.s: New file.
8152         * testsuite/split_x86_64_n.s: New file.
8153         * testsuite/testfile.cc (Target_test): Update relocation_section
8154         function.
8155         * testsuite/Makefile.in: Rebuild.
8156
8157 2009-10-06  Ian Lance Taylor  <iant@google.com>
8158
8159         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8160         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8161         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8162         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8163         the address on ldo_addrs_.
8164         (Target_i386::Relocate::fix_up_ldo): New function.
8165
8166 2009-10-06   Rafael Espindola  <espindola@google.com>
8167
8168         * plugin.cc (add_input_library): New.
8169         (Plugin::load): Add add_input_library to tv.
8170         (Plugin_manager::add_input_file): Add the is_lib argument.
8171         (add_input_file): Update call to Plugin_manager::add_input_file.
8172         (add_input_library): New.
8173         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8174
8175 2009-09-30  Doug Kwan  <dougkwan@google.com>
8176
8177         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8178         symbol and call Symbol::may_need_copy_reloc to determine if
8179         a copy reloc is needed.
8180         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8181         nocopyreloc is given in command line.
8182         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8183         given in command line.
8184         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8185         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8186         of the removed Target_i386::may_need_copy_reloc.
8187         * options.h (copyreloc): New option with default value false.
8188         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8189         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8190         instead of the removed Target_powerpc::may_need_copy_reloc.
8191         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8192         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8193         instead of the removed Target_sparc::may_need_copy_reloc.
8194         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8195         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8196         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8197         instead of the removed Target_x86_64::may_need_copy_reloc.
8198
8199 2009-09-30  Ian Lance Taylor  <iant@google.com>
8200
8201         * object.h (class Object): Remove target_ field, and target,
8202         sized_target, and set_target methods.
8203         (Object::sized_target): Remove.
8204         (class Sized_relobj): Update declarations.  Remove sized_target.
8205         * object.cc (Sized_relobj::setup): Remove target parameter.
8206         Change all callers.
8207         (Input_objects::add_object): Don't do anything with the target.
8208         (make_elf_sized_object): Add punconfigured parameter.  Change all
8209         callers.  Set or test parameter target.
8210         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8211         Change all callers.
8212         * parameters.cc (Parameters::set_target): Change parameter type to
8213         be non-const.
8214         (Parameters::default_target): Remove.
8215         (set_parameters_target): Change parameter type to be non-const.
8216         (parameters_force_valid_target): New function.
8217         (parameters_clear_target): New function.
8218         * parameters.h (class Parameters): Update declarations.  Remove
8219         default_target method.  Add sized_target and clear_target
8220         methods.  Change target_ to be non-const.
8221         (set_parameters_target): Update declaration.
8222         (parameters_force_valid_target): Declare.
8223         (parameters_clear_target): Declare.
8224         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8225         as NULL if we aren't searching.
8226         (Add_symbols::run): Don't check for compatible target.
8227         * fileread.cc (Input_file::open_binary): Call
8228         parameters_force_valid_target.
8229         * gold.cc (queue_middle_tasks): Likewise.
8230         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8231         set_target on object.
8232         * dynobj.h (class Sized_dynobj): Update declarations.
8233         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8234         make_elf_object returns NULL.
8235         (Archive::include_member): Don't check whether object target is
8236         compatible.
8237         * output.cc (Output_section::add_input_section): Get target from
8238         parameters.
8239         (Output_section::relax_input_section): Likewise.
8240         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8241         parameters.
8242         (Sized_relobj::do_scan_relocs): Likewise.
8243         (Sized_relobj::relocate_sections): Likewise.
8244         * resolve.cc (Symbol_table::resolve): Likewise.
8245         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8246         parameter.  Change all callers.
8247         (Symbol_table::add_from_object): Get target from parameters.
8248         (Symbol_table::add_from_relobj): Don't check object target.
8249         (Symbol_table::add_from_dynobj): Likewise.
8250         (Symbol_table::define_special_symbol): Get target from
8251         parameters.
8252         * symtab.h (class Symbol_table): Update declaration.
8253         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8254         parameter.  Change all callers.  Clear parameter target.
8255         (Binary_test): Test target here.
8256         * testsuite/object_unittest.cc (gold_testsuite): Remove
8257         target_test_pointer parameter.  Change all callers.
8258         (Object_test): Test target here.
8259
8260 2009-09-26  Ian Lance Taylor  <iant@google.com>
8261
8262         * testsuite/initpri1.c: Don't try to use constructor priorities if
8263         compiling with gcc before 4.3.
8264
8265 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8266
8267         * testsuite/retain_symbols_file_test.sh (check_present): Change
8268         output file name to retain_symbols_file_test.stdout.
8269         (check_absent): Likewise.
8270
8271 2009-09-18  Craig Silverstein  <csilvers@google.com>
8272
8273         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8274         * options.cc: Include <cerrno> and <fstream>.
8275         (General_options::finalize): Parse -retain-symbols-file tag.
8276         * options.h: New flag.
8277         (General_options): New method should_retain_symbol, new
8278         variable symbols_to_retain.
8279         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8280         should_retain_symbol map.
8281         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8282         * testsuite/Makefile.in: Regenerate.
8283         * testsuite/retain_symbols_file_test.sh: New file.
8284
8285 2009-09-18  Nick Clifton  <nickc@redhat.com>
8286
8287         * po/es.po: Updated Spanish translation.
8288
8289 2009-09-17  Doug Kwan  <dougkwan@google.com>
8290
8291         * debug.h (DEBUG_RELAXATION): New constant.
8292         (DEBUG_ALL): Add DEBUG_RELAXATION.
8293         (debug_string_to_enum): Add relaxation debug option.
8294         * layout.cc
8295         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8296         Layout::Relaxation_debug_check::read_sections,
8297         Layout::Relaxation_debug_check::read_sections): New method definitions.
8298         (Layout::Layout): Initialize data members
8299         record_output_section_data_from_scrips_,
8300         script_output_section_data_list_ and relaxation_debug_check_.
8301         (Layout::save_segments, Layout::restore_segments,
8302         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8303         Layout::relaxation_loop_body): New method definitions.
8304         (Layout::finalize): Support relaxation.  Move section layout code to
8305         Layout::relaxation_loop_body.
8306         (Layout::set_asection_address_from_script): Move code for orphan
8307         section placement out.
8308         (Layout::place_orphan_sections_in_script): New method definition.
8309         * layout.h (Output_segment_headers, Output_file_header):
8310         New forward class declarations.
8311         (Layout::~Layout): Define.
8312         (Layout::new_output_section_data_from_script): New method definition.
8313         (Layout::place_orphan_sections_in_script): New method declaration.
8314         (Layout::Segment_states): New type declaration.
8315         (Layout::save_segments, Layout::restore_segments,
8316         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8317         Layout::relaxation_loop_body): New method declarations.
8318         (Layout::Output_section_data_list): New type declaration.
8319         (Layout::Relaxation_debug_check): New class definition.
8320         (Layout::record_output_section_data_from_script_,
8321         Layout::script_output_section_data_list_, Layout::segment_states_,
8322         Layout::relaxation_debug_check_): New data members.
8323         * output.cc: (Output_section_headers::do_size): New method definition.
8324         (Output_section_headers::Output_section_headers): Move size
8325         computation to Output_section_headers::do_size.
8326         (Output_segment_headers::do_size): New method definition.
8327         (Output_file_header::Output_file_header): Move size computation to
8328         Output_file_header::do_size and call it.
8329         (Output_file_header::do_size): New method definition.
8330         (Output_data_group::Output_data_group): Adjust call to
8331         Output_section_data.
8332         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8333         (Output_symtab_xindex::do_write): Add array bound check.
8334         (Output_section::Input_section::print_to_mapfile): Handle
8335         RELAXED_INPUT_SECTION_CODE.
8336         (Output_section::Output_section): Initialize data member checkpoint_.
8337         (Output_section::~Output_section): Delete checkpoint object pointed
8338         by checkpoint_.
8339         (Output_section::add_input_section): Always add an Input_section if
8340         relaxing.
8341         (Output_section::add_merge_input_section): Add assert.
8342         (Output_section::relax_input_section): New method definition.
8343         (Output_section::set_final_data_size): Set load address to zero for
8344         an unallocated section.
8345         (Output_section::do_address_and_file_offset_have_reset_values):
8346         New method definition.
8347         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8348         Handle relaxed input section.
8349         (Output_section::sort_attached_input_sections): Checkpoint input
8350         section list lazily.
8351         (Output_section::get_input_sections): Change type of input_sections to
8352         list of Simple_input_section pointers.  Checkpoint input section list
8353         lazily.  Also handle relaxed input sections.
8354         (Output_section::add_input_section_for_script): Take a reference to
8355         a Simple_input_section object instead of Relobj pointer and section
8356         index as parameter.  Handle relaxed input sections.
8357         (Output_section::save_states, Output_section::restore_states): New
8358         method definitions.
8359         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8360         (Output_data::is_data_size_fixed): New method definition.
8361         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8362         if it is fixed.
8363         (Output_data::address_and_file_offset_have_reset_values): New method
8364         definition.
8365         (Output_data::do_address_and_file_offset_have_reset_values): New method
8366         definition.
8367         (Output_data::set_data_size): Check that data size is not fixed.
8368         (Output_data::fix_data_size): New method definition.
8369         (Output_data::is_data_size_fixed_): New data member.
8370         (Output_section_headers::set_final_data_size): New method definition.
8371         (Output_section_headers::do_size): New method declaration.
8372         (Output_segment_headers::set_final_data_size): New method definition.
8373         (Output_segment_headers::do_size): New method declaration.
8374         (Output_file_header::set_final_data_size)::New method definition.
8375         (Output_file_header::do_size)::New method declaration.
8376         (Output_section_data::Output_section_data): Add new parameter
8377         is_data_size_fixed and use it to fix data size.
8378         (Output_data_const::Output_data_const): Adjust call to base class
8379         constructor and fix data size.
8380         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8381         base class constructor and fix data size.
8382         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8383         base class constructor and fix data size.
8384         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8385         class constructor and fix data size.
8386         (Output_data_group::set_final_data_size): New method definition.
8387         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8388         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8389         class constructor and fix data size.
8390         (Output_relaxed_input_section): New class definition.
8391         (Output_section::Simple_input_section): New class definition.
8392         (Output_section::get_input_sections): Adjust parameter list.
8393         (Output_section::add_input_section_for_script): Same.
8394         (Output_section::save_states, Output_section::restore_states,
8395         Output_section::do_address_and_file_offset_have_reset_values,
8396         (Output_section::Input_section::Input_section): Handle
8397         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8398         Output_relaxed_input_section.
8399         (Output_section::Input_section::is_input_section,
8400         Output_section::Input_section::set_output_section): Handle relaxed
8401         input section.
8402         (Output_section::Input_section::is_relaxed_input_section,
8403         Output_section::Input_section::output_section_data,
8404         Output_section::Input_section::relaxed_input_section): New method
8405         definitions.
8406         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8407         value.
8408         (Output_section::Input_section::u1_): Update comments.
8409         (Output_section::Input_section::u2_): Add new union member poris.
8410         (Output_section::Checkpoint_output_section): New classs definition.
8411         (Output_section::relax_input_section): New method declaration.
8412         (Output_section::checkpoint_): New data member.
8413         (Output_segment): Update comments.
8414         (Output_segment::Output_segment): Un-privatize copy constructor.
8415         (Output_segment::operator=): Un-privatize.
8416         * script-sections.cc (Output_section_element::Input_section_list):
8417         Change element type to Output_section::Simple_input_section.
8418         (Output_section_element_dot_assignment::set_section_addresses):
8419         Register output section data for relaxation clean up.
8420         (Output_data_exression::Output_data_expression): Adjust call to base
8421         constructor to fix data size.
8422         (Output_section_element_data::set_section_addresses): Register
8423         Output_data_expression object for relaxation clean up.
8424         (struct Input_section_info): Replace Relobj pointer and section index
8425         pair with Output_section::Simple_input_section and Convert struct to a
8426         class.
8427         (Input_section_sorter::operator()): Adjust access to
8428         Input_section_info data member to use accessors.
8429         (Output_section_element_input::set_section_addresses): Use layout
8430         parameter.  Adjust code to use Output_section::Simple_input_section
8431         and Input_secction_info classes.  Register filler for relaxation
8432         clean up.
8433         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8434         and section index pair with Output_section::Simple_input_section
8435         class.  Adjust code accordingly.
8436         (Phdrs_element::release_segment): New method definition.
8437         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8438         segment list.
8439         (Script_sections::release_segments): New method definition.
8440         * gold/script-sections.h (Script_sections::release_segments): New
8441         method declaration.
8442         * gold/target.h (Target::may_relax, Target::relax,
8443         Target::do_may_relax, Target::do_relax): New method definitions.
8444
8445 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8446
8447         * arm.cc (has_signed_unsigned_overflow): New function.
8448         (Arm_relocate_functions::abs8): New function.
8449         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8450         (Target_arm::Scan::global): Likewise.
8451         (Target_arm::relocate::relocate): Likewise.
8452         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8453         Likewise.
8454
8455 2009-09-16  Cary Coutant  <ccoutant@google.com>
8456
8457         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8458         * testsuite/Makefile.in: Regenerate.
8459
8460 2009-09-11  Nick Clifton  <nickc@redhat.com>
8461
8462         * po/gold.pot: Updated by the Translation project.
8463
8464 2009-09-08  Cary Coutant  <ccoutant@google.com>
8465
8466         * output.cc (Output_file::open): Add execute permission to empty file.
8467         * testsuite/Makefile.am (permission_test): New test.
8468         * testsuite/Makefile.in: Regenerate.
8469
8470 2009-09-02  Ian Lance Taylor  <iant@google.com>
8471
8472         * output.cc (Output_file::resize): Call map_no_anonymous rather
8473         than map.
8474
8475 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8476
8477         * gold.cc: Include "incremental.h".
8478         (queue_initial_tasks): Call Incremental_checker methods.
8479         * incremental.cc: Include "output.h".
8480         (Incremental_checker::can_incrementally_link_output_file): New
8481         method.
8482         * incremental.h (Incremental_checker): New class.
8483
8484         * output.cc (Output_file::open_for_modification): New method.
8485         (Output_file::map_anonymous): Changed return type to bool.  Record
8486         map in base_ field.
8487         (Output_file::map_no_anonymous): New method, broken out of map.
8488         (Output_file::map): Use map_no_anonymous and map_anonymous.
8489         * output.h (class Output_file): Update declarations.
8490
8491 2009-08-24  Cary Coutant  <ccoutant@google.com>
8492
8493         * options.h (Command_line::Pre_options): New class.
8494         (Command_line::pre_options): New member.
8495         * options.cc (gold::options::ready_to_register): New variable.
8496         (One_option::register_option): Do nothing if not registering options.
8497         Assert if same short option registered twice.
8498         (General_options::General_options): Turn off option registration when
8499         done constructing.
8500         (Command_line::Pre_options::Pre_options): New constructor.
8501
8502 2009-08-24  Cary Coutant  <ccoutant@google.com>
8503
8504         * options.h (General_options::no_keep_memory): Remove incorrect
8505         short option.
8506
8507 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8508
8509         * Makefile.am (am__skiplex, am__skipyacc): New.
8510         * Makefile.in: Regenerate.
8511
8512 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8513
8514         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8515         (INCLUDES): ... this.
8516         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8517         (AM_CPPFLAGS): Renamed from ...
8518         (INCLUDE): ... this.
8519         * Makefile.in, testsuite/Makefile.in: Regenerate.
8520
8521         * Makefile.in: Regenerate.
8522         * aclocal.m4: Likewise.
8523         * config.in: Likewise.
8524         * configure: Likewise.
8525         * testsuite/Makefile.in: Likewise.
8526
8527         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8528         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8529         * Makefile.in: Regenerate.
8530         * testsuite/Makefile.in: Regenerate.
8531
8532 2009-08-19  Cary Coutant  <ccoutant@google.com>
8533
8534         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8535         symbols in shared libraries overridden by hidden or internal symbols
8536         in the main program.
8537
8538 2009-08-19  Chris Demetriou  <cgd@google.com>
8539
8540         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8541         checking source file names in error messages.
8542
8543 2009-08-18  Doug Kwan  <dougkwan@google.com>
8544
8545         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8546         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8547         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8548         an elfcpp::Ehdr as parameter.
8549         * object.cc (Object::set_target): Remove the version that looks up
8550         a target and sets it.
8551         (Sized_relobj::setup): Take a Target object instead of
8552         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8553         (make_elf_sized_object): Find target and ask target to
8554         make an ELF object.
8555         * object.h: (Object::set_target): Remove the version that looks up
8556         a target and sets it.
8557         (Sized_relobj::setup): Take a Target object instead of
8558         an elfcpp:Ehdr as parameter.
8559         * target.cc: Include dynobj.h.
8560         (Target::do_make_elf_object_implementation): New.
8561         (Target::do_make_elf_object): New.
8562         * target.h (Target::make_elf_object): New template declaration.
8563         (Target::do_make_elf_object): New method declarations.
8564         (Target::do_make_elf_object_implementation): New template declaration.
8565
8566 2009-08-14  Ian Lance Taylor  <iant@google.com>
8567
8568         * gold.h (FUNCTION_NAME): Define.
8569         (gold_unreachable): Use FUNCTION_NAME.
8570
8571 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8572
8573         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8574         symbol in the --keep-unique list is not found.
8575
8576 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8577
8578         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8579         been maked as --keep-unique.
8580         (Icf::unfold_section): New function.
8581         * icf.h (Icf::unfold_section): New function.
8582         * options.h (General_options::keep_unique): New option.
8583         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8584         * testsuite/Makefile.in: Regenerate.
8585         * testsuite/icf_keep_unique_test.sh: New file.
8586         * testsuite/icf_keep_unique_test.cc: New file.
8587
8588 2009-08-12  Cary Coutant  <ccoutant@google.com>
8589
8590         PR 10471
8591         * resolve.cc (Symbol_table::resolve): Check for references from
8592         dynamic objects to hidden and internal symbols.
8593         * testsuite/Makefile.am (hidden_test.sh): New test.
8594         * testsuite/Makefile.in: Regenerate.
8595         * testsuite/hidden_test.sh: New script.
8596         * testsuite/hidden_test_1.c: New test source.
8597         * testsuite/hidden_test_main.c: New test source.
8598
8599 2009-08-11  Doug Kwan  <dougkwan@google.com>
8600
8601         * arm.cc: Update comments.
8602         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8603         segment to locate the .ARM.exidx section if present.
8604
8605 2009-08-09  Doug Kwan  <dougkwan@google.com>
8606
8607         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8608         patch.
8609
8610 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8611         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8612         compiler warnings.
8613
8614 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8615
8616         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8617         valid tls_segment only for non-debug-section relocations.
8618         * testsuite/Makefile.am: Add gc_tls_test.
8619         * testsuite/Makefile.in: Regenerate.
8620         * testsuite/gc_tls_test.cc: New file.
8621         * testsuite/gc_tls_test.sh: New file.
8622
8623 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8624
8625         * icf.cc: New file.
8626         * icf.h: New file.
8627         * Makefile.am (CCFILES): Add icf.cc.
8628         (HFILES): Add icf.h
8629         * Makefile.in: Regenerate.
8630         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8631         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8632         section, symbol and addend information for the relocs.
8633         * gold.cc (queue_middle_tasks): Call identical code folding.
8634         * gold.h: Add defines for multimap.
8635         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8636         to the call of finalize_local_symbols.
8637         * main.cc (main): Create object of class Icf.
8638         * object.cc (Sized_relobj::do_layout): Allow this function to be
8639         called twice during icf.
8640         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8641         to sections marked as identical by icf.
8642         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8643         when available.
8644         (Sized_relobj::do_section_entsize): New function.
8645         * object.h (Object::section_entsize): New function.
8646         (Object::do_section_entsize): New pure virtual function.
8647         (Relobj::finalize_local_symbols): Add new parameter.
8648         (Relobj::do_section_entsize): New function.
8649         * options.h (General_options::icf): New option.
8650         (General_options::icf_iterations): New option.
8651         (General_options::print_icf_sections): New option.
8652         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8653         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8654         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8655         icf.
8656         * symtab.cc (Symbol_table::is_section_folded): New function.
8657         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8658         to sections marked as identical by icf.
8659         * symtab.h (Symbol_table::set_icf): New function.
8660         (Symbol_table::icf): New function.
8661         (Symbol_table::is_section_folded): New function.
8662         (Symbol_table::icf_): New data member.
8663         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8664         * testsuite/Makefile.am: Add commands to build icf_test.
8665         * testsuite/Makefile.in: Regenerate.
8666         * testsuite/icf_test.sh: New file.
8667         * testsuite/icf_test.cc: New file.
8668
8669 2009-07-24  Chris Demetriou  <cgd@google.com>
8670
8671         * layout.cc (is_compressible_debug_section): Fix incorrect
8672         comment about compressed section names.
8673
8674 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8675
8676         PR 10419
8677         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8678
8679 2009-07-16  Ian Lance Taylor  <iant@google.com>
8680
8681         PR 10400
8682         * layout.h: #include <map>.
8683         (class Kept_section): Change from struct to class.  Add accessors
8684         and setters.  Add section size to Comdat_group mapping.  Change
8685         Comdat_group to std::map.  Add is_comdat_ field.  Add
8686         linkonce_size field in union.
8687         (class Layout): Update declaration of find_or_add_kept_section.
8688         Don't declare find_kept_object.
8689         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8690         parameter.  Add object, shndx, is_comdat, and is_group_name
8691         parameters.  Change all callers.  Adjust for new Kept_section.
8692         (Layout::find_kept_object): Remove.
8693         * object.cc (Sized_relobj::include_section_group): Update use of
8694         Kept_section.  Rename secnum to shndx.  Only record
8695         Kept_comdat_section if sections are the same size.
8696         (Sized_relobj::include_linkonce_section): Update use of
8697         Kept_section.  Only record Kept_comdat_section if sections are the
8698         same size.  Set size of linkonce section.
8699         (Sized_relobj::map_to_kept_section): Update call to
8700         get_kept_comdat_section.
8701         * object.h (class Sized_relobj): Rename fields in
8702         Kept_comdat_section to drop trailing underscores; change object
8703         field to Relobj*.  Change Kept_comdat_section_table to store
8704         struct rather than pointer.
8705         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8706         Add kept_object and kept_shndx parameters.  Change all callers.
8707         (Sized_relobj::get_kept_comdat_section): Change return type to
8708         bool.  Add kept_object and kept_shndx parameters.  Change all
8709         callers.
8710         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8711         Layout::find_or_add_kept_section.
8712
8713 2009-07-09  Ian Lance Taylor  <iant@google.com>
8714
8715         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8716         Reserve space in the hash table.
8717
8718 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8719
8720         * fileread.cc (File_read::get_mtime): New method.
8721         * fileread.h (Timespec): New structure.
8722         (File_read::get_mtime): New method.
8723         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8724         Renamed from timestamp_nsec.
8725         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8726         Elf_Xword.
8727         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8728         timestamp_nsec.
8729         (Incremental_inputs::report_archive): Save mtime; style fix.
8730         (Incremental_inputs::report_obejct): Save mtime; style fix.
8731         (Incremental_inputs::report_script): Save mtime; style fix.
8732         (Incremental_inputs::finalize_inputs): Style fix.
8733         (Incremental_inputs::finalize): Style fix.
8734         (Incremental_inputs::create_input_section_data): Store inputs
8735         mtime.
8736         * incremental.h (Incremental_inputs::report_script): Add mtime
8737         argument.
8738         (Incremental_inputs::Input_info::Input_info): Intialize only one
8739         union member.
8740         (Incremental_inputs::Input_info::archive): Move to nameless
8741         union.
8742         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8743         (Incremental_inputs::Input_info::script): Move to nameless union.
8744         (Incremental_inputs::mtime): New field.
8745         * script.cc (read_input_script): Pass file mtime to
8746         Incremental_input.
8747         * script.h (Script_info::inputs): Style fix.
8748
8749 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8750
8751         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8752         instead of 32.
8753
8754 2009-06-24  Ian Lance Taylor  <iant@google.com>
8755
8756         PR 10156
8757         * layout.cc (Layout::choose_output_section): If we find an
8758         existing section, update the flags.
8759         (Layout::create_notes): New function, broken out of
8760         Layout::finalize.
8761         (Layout::finalize): Don't create note sections.
8762         (Layout::create_note): Don't crash if linker script discards
8763         section.
8764         (Layout::create_gold_note): Likewise.
8765         (Layout::create_build_id): Likewise.  Don't set
8766         after_input_sections on the section.
8767         (Layout::create_executable_stack_info): Remove target parameter.
8768         Change caller.
8769         * layout.h (class Layout): Declare create_notes.  Update
8770         declaration of create_executable_stack_info.
8771         * gold.cc (queue_middle_tasks): Call create_notes.
8772         * output.cc (Output_section::update_flags_for_input_section): Move
8773         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8774         invalid.
8775         * output.h (Output_data::mark_address_invalid): New function.
8776         (class Output_section): Only declare, not define,
8777         update_flags_for_input_section.  Remove set_flags.
8778
8779 2009-06-24  Ian Lance Taylor  <iant@google.com>
8780
8781         * script-sections.cc (Output_section_definition::
8782         set_section_addresses): Rename shadowing local load_address to
8783         laddr.
8784
8785 2009-06-24  Ian Lance Taylor  <iant@google.com>
8786
8787         PR 10244
8788         * reloc.cc (relocate_sections): Skip empty relocation sections.
8789
8790 2009-06-23  Ian Lance Taylor  <iant@google.com>
8791
8792         PR 10156
8793         * layout.cc (Layout::create_note): Use choose_output_section
8794         rather than make_output_section.
8795
8796 2009-06-23  Ian Lance Taylor  <iant@google.com>
8797
8798         PR 10237
8799         * options.cc (General_options::parse_V): Set printed_version_.
8800         (General_options::General_options): Initialize printed_version_.
8801         * options.h (class General_options): Add printed_version_ field.
8802         * gold.cc (queue_initial_tasks): If there are no input files,
8803         don't give a fatal error if we printed the version information.
8804         (queue_middle_tasks): If using -r with a shared object, give a
8805         fatal error rather than an ordinary error.
8806
8807 2009-06-23  Ian Lance Taylor  <iant@google.com>
8808
8809         PR 10219
8810         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8811         (Layout::make_output_section): Set have_stabstr_section_ if we see
8812         a .stab*str section.
8813         (Layout::finalize): Call link_stabs_sections.
8814         (Layout::link_stabs_sections): New file.
8815         * layout.h (class Layout): Add have_stabstr_section_ field.
8816         Declare link_stabs_sections.
8817
8818 2009-06-23  Doug Kwan  <dougkwan@google.com>
8819
8820         * Makefile.am (libgold_a_LIBADD): New.
8821         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8822         * Makefile.in: Regenerate.
8823         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8824         * configure: Regenerate.
8825         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8826         * fileread.cc: Include sys/state.h
8827         * gold.h: Declare memmem and strndup if found missing.
8828         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8829
8830 2009-06-23  Ian Lance Taylor  <iant@google.com>
8831
8832         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8833         * configure: Rebuild.
8834
8835 2009-06-23  Ian Lance Taylor  <iant@google.com>
8836
8837         PR 10147
8838         * object.cc (Object::section_contents): Don't try to get a view if
8839         the section has length zero.
8840         (Object::handle_gnu_warning_section): If the section is empty, use
8841         the name of the section as the warning.
8842
8843 2009-06-23  Ian Lance Taylor  <iant@google.com>
8844
8845         PR 10133
8846         * stringpool.h (class Stringpool_template): Add optimize_ field.
8847         (Stringpool_template::set_optimize): New function.
8848         * stringpool.cc (Stringpool_template::Stringpool_template):
8849         Initialize optimize_ field.
8850         (Stringpool_template::set_string_offsets): Test local optimize
8851         fild rather than parameter.
8852         * layout.cc (Layout::Layout): Call set_optimize on the section
8853         name stringpool.
8854
8855 2009-06-22  Ian Lance Taylor  <iant@google.com>
8856
8857         PR 10030
8858         * yyscript.y: Parse TARGET.
8859         * script.cc (script_set_target): New function.
8860         * script-c.h (script_set_target): Declare.
8861         * options.cc (General_options::string_to_object_format): Rename
8862         from string_to_object_format in anonymous namespace.  Change
8863         callers.
8864         * options.h (class General_options): Declare
8865         string_to_object_format.
8866
8867 2009-06-22  Ian Lance Taylor  <iant@google.com>
8868
8869         * script-sections.cc (Script_sections::create_segments): Don't put
8870         program headers in a PT_LOAD segment if -n or -N.
8871
8872 2009-06-22  Ian Lance Taylor  <iant@google.com>
8873
8874         PR 10141
8875         * options.h (class General_options): Add -z lazy and -z now.  Sort
8876         -z options into alphabetical order.
8877         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8878
8879 2009-06-21  Ian Lance Taylor  <iant@google.com>
8880
8881         * layout.cc (Layout::make_output_section): Call
8882         Target::new_output_section.
8883         (Layout::attach_allocated_section_to_segment): Put large section
8884         sections in a separate load segment with the large segment flag
8885         set.
8886         (Layout::segment_precedes): Sort large data segments after other
8887         load segments.
8888         (align_file_offset): New static function.
8889         (Layout::set_segment_offsets): Use align_file_offset.
8890         * output.h (class Output_section): Add is_small_section_ and
8891         is_large_section_ fields.
8892         (Output_section::is_small_section): New function.
8893         (Output_section::set_is_small_section):  New function.
8894         (Output_section::is_large_section): New function.
8895         (Output_section::set_is_large_section): New function.
8896         (Output_section::is_large_data_section): New function.
8897         (class Output_segment): Add is_large_data_segment_ field.
8898         (Output_segment::is_large_data_segment): New function.
8899         (Output_segment::set_is_large_data_segment): New function.
8900         * output.cc (Output_section::Output_section): Initialize new
8901         fields.
8902         (Output_segment::Output_segment): Likewise.
8903         (Output_segment::add_output_section): Add assertion that large
8904         data sections always go in large data segments.  Force small data
8905         sections to the end of the list of data sections.  Force small BSS
8906         sections to the start of the list of BSS sections.  For large BSS
8907         sections to the end of the list of BSS sections.
8908         * symtab.h (class Symbol): Declare is_common_shndx.
8909         (Symbol::is_defined): Check Symbol::is_common_shndx.
8910         (Symbol::is_common): Likewise.
8911         (class Symbol_table): Define enum Commons_section_type.  Update
8912         declarations.  Add small_commons_ and large_commons_ fields.
8913         * symtab.cc (Symbol::is_common_shndx): New function.
8914         (Symbol_table::Symbol_table): Initialize new fields.
8915         (Symbol_table::add_from_object): Put small and large common
8916         symbols in the right list.
8917         (Symbol_table::sized_finalized_symbol): Check
8918         Symbol::is_common_shndx.
8919         (Symbol_table::sized_write_globals): Likewise.
8920         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8921         common symbol lists.  Don't call do_allocate_commons_list if the
8922         list is empty.
8923         (Symbol_table::do_allocate_commons_list): Remove is_tls
8924         parameter.  Add comons_section_type parameter.  Change all
8925         callers.  Handle small and large common symbols.
8926         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8927         Symbol::is_common_shndx.
8928         * resolve.cc (symbol_to_bits): Likewise.
8929         * target.h (Target::small_common_shndx): New function.
8930         (Target::small_common_section_flags): New function.
8931         (Target::large_common_shndx): New function.
8932         (Target::large_common_section_flags): New function.
8933         (Target::new_output_section): New function.
8934         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8935         small_common_section_flags, and large_common_section_flags
8936         fields.
8937         (Target::do_new_output_section): New virtual function.
8938         * arm.cc (Target_arm::arm_info): Initialize new fields.
8939         * i386.cc (Target_i386::i386_info): Likewise.
8940         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8941         Likewise.
8942         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8943         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8944         (Target_x86_64::do_new_output_section): New function.
8945         * configure.ac: Define conditional MCMODEL_MEDIUM.
8946         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8947         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8948         (large_LDFLAGS): Define.
8949         * testsuite/large.c: New file.
8950         * testsuite/testfile.cc (Target_test::test_target_info):
8951         Initialize new fields.
8952         * configure, testsuite/Makefile.in: Rebuild.
8953
8954 2009-06-05  Doug Kwan  <dougkwan@google.com>
8955
8956         * Makefile.am (CCFILES): Add target.cc.
8957         * Makefile.in: Regenerate.
8958         * i386.cc (class Target_i386): Define new virtual method to
8959         override do_is_local_label_name in parent.
8960         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8961         local symbols if --discard-locals or -X is given.
8962         * options.h (class General_options): Declare new options
8963         '--discard-locals' and '-X' for discarding locals.
8964         * target.h (class Target): Define new methods is_local_label_name.
8965         Declare new virtual method do_is_local_label_name.
8966         * target.cc: New file.
8967         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8968         (check_SCRIPTS): Add discard_locals_test.sh.
8969         (check_DATA): Add discard_local_tests.syms.
8970         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8971         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8972         * testsuite/Makefile.in: Regenerate.
8973         * testsuite/discard_locals_test.c: New file.
8974         * testsuite/discard_locals_test.sh: Same.
8975
8976 2009-06-05  Doug Kwan  <dougkwan@google.com>
8977
8978         * object.cc (Sized_relobj::Sized_relobj): Initialize
8979         discarded_eh_frame_shndx_ to -1U.
8980         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8981         section.
8982         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8983         a discarded .eh_frame section.
8984         (Sized_relobj::do_finalize_local_symbols): Ditto.
8985         * object.h (class Sized_relobj): Declare new member
8986         discarded_eh_frame_shndx_.
8987         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8988         (local_labels_test.o, local_labels_test): New rules.
8989         * testsuite/Makefile.in: Regenerate.
8990
8991 2009-06-04  Doug Kwan  <dougkwan@google.com>
8992
8993         * layout.cc (Layout::section_name_mapping): Add mapping for
8994         special ARM sections.
8995
8996 2009-06-03  Doug Kwan  <dougkwan@google.com>
8997
8998         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8999         (utils::has_overflow): Same.
9000
9001 2009-06-03  Ian Lance Taylor  <iant@google.com>
9002
9003         * layout.cc (Layout::section_name_mapping): New array, replacing
9004         Layout::linkonce_mapping.
9005         (Layout::section_name_mapping_count): New variable, replacing
9006         Layout::linkonce_mapping_count.
9007         (Layout::linkonce_output_name): Remove.
9008         (Layout::output_section_name): Rewrite.
9009         * layout.h (class Layout): Rename Linkonce_mapping to
9010         Section_name_mapping, linkonce_mapping to section_name_mapping,
9011         linkonce_mapping_count to section_name_mapping_count.  Don't
9012         declare linkonce_output_name.
9013
9014 2009-06-03  Doug Kwan  <dougkwan@google.com>
9015
9016         * gold/arm.cc (namespace utils): New.
9017         (Target_arm::reloc_is_non_pic): Define new method.
9018         (class Arm_relocate_functions): New.
9019         (Target_arm::Relocate::relocate): Handle relocation types used by
9020         Android.
9021
9022 2009-06-03  Ian Lance Taylor  <iant@google.com>
9023
9024         * arm.cc (Target_arm::scan::global): Use || instead of |.
9025
9026 2009-06-02  Doug Kwan  <dougkwan@google.com>
9027
9028         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9029         issued_non_pic_error_.
9030         (class Target_arm::Scan): Declare new method check_non_pic.
9031         Define new method symbol_needs_plt_entry.
9032         Declare new data member issued_non_pic_error_.
9033         (class Target_arm::Relocate): Declare new method
9034         should_apply_static_reloc.
9035         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9036         (Target_arm::Scan::check_non_pic): Define new method.
9037         (Target_arm::Scan::local): Handle a small subset of reloc types used
9038         by Android.
9039         (Target_arm::Scan::local): Same.
9040         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9041
9042 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9043
9044         * incremental.cc (Incremental_inputs::report_command_line): Filter
9045         out --incremental-* options.
9046
9047 2009-05-29  Doug Kwan  <dougkwan@google.com>
9048
9049         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9050         template class.
9051         (class Target_arm): Update comment.
9052         (Target_arm::Target_arm): Initialize new data members GOT_,
9053         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9054         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9055         and Target_arm::rel_dyn_section.
9056         Declare new_enum Target_arm::Got_type.
9057         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9058         and DYNBSS_.
9059         Update commments for member do_dynsym_value.
9060         (Target_arm::got_size, Target_arm::plt_section,
9061         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9062         new methods inside class defintion.
9063         (Target_arm::got_section): Define new method.
9064         (Target_arm::rel_dyn_section): Same.
9065         (Output_data_plt_arm): New template class.
9066         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9067         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9068         (Output_data_plt_arm::add_entry): Same.
9069         (Output_data_plt_arm::first_plt_entry): Define new
9070         static data member for PLT instruction template.
9071         (Output_data_plt_arm::plt_entry): Same.
9072         (Output_data_plt_arm::do_write): Define new method.
9073         (Target_arm::make_plt_entry): Same.
9074         (Target_arm::do_finalize_sections): Same.
9075         (Target_arm::do_dynsym_value): Same.
9076
9077 2009-05-28  Doug Kwan  <dougkwan@google.com>
9078
9079         * Makefile.am (TARGETSOURCES): Add arm.cc.
9080         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9081         * Makefile.in: Regenerate.
9082         * arm.cc: New file.
9083         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9084
9085 2009-05-26  Doug Kwan  <dougkwan@google.com>
9086
9087         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9088         (General_options::check_excluded_libs): Strip off directories in
9089         archive name before matching like GNU ld does.
9090         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9091         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9092         (exclude_libs_test_LDFLAGS): Add linker option
9093         -Wl,--exclude-libs,libexclude_libs_test_3
9094         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9095         an explicit archive without using -l.
9096         (alt/libexclude_libs_test_3.a): New make rule.
9097         * testsuite/Makefile.in: Regenerate.
9098         * testsuite/exclude_libs_test.c : Declare lib3_default().
9099         (main): Call it.
9100         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9101         * exclude_libs_test_3.c: New file.
9102
9103 2009-05-26  Nick Clifton  <nickc@redhat.com>
9104
9105         * po/id.po: New Indonesian translation.
9106         * po/gold.pot: Updated template file.
9107
9108 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9109
9110         * testsuite/Makefile.am: Add -ffunction-sections to compile
9111         gc_comdat_test files.  Add -Wl,--gc-sections to build
9112         gc_comdat_test.
9113         * testsuite/Makefile.in: Regenerate.
9114         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9115
9116 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9117
9118         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9119         kept comdat section was garbage collected.
9120         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9121         * testsuite/Makefile.in: Regenerate.
9122         * testsuite/gc_comdat_test.sh: New file.
9123         * testsuite/gc_comdat_test_1.cc: New file.
9124         * testsuite/gc_comdat_test_2.cc: New file.
9125
9126 2009-05-19  Doug Kwan  <dougkwan@google.com>
9127
9128         * archive.cc (Archive::Archive): Move constructor from archive.h
9129         to here.  Initialize no_export_.
9130         (Archive::get_elf_object_for_member): Set no_export flag of object.
9131         * archive.h (Archive::Archive): Move constructor body to
9132         archive.cc.
9133         (Archive::no_export): New method.
9134         (Archive::no_export_): New field.
9135         * object.h (Object::Object): Initialize no_export_ to false.
9136         (Object::no_export, Object::set_no_export): New methods.
9137         (Object::no_export_): New field.
9138         * options.cc (General_options::parse_exclude_libs): New method.
9139         (General_options::check_excluded_libs) Same.
9140         * options.h (exclude_libs): New option.
9141         (General_options::check_excluded_libs): New method declaration.
9142         (General_options::excluded_libs_): New field.
9143         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9144         default or protected visibility if an object has no-export flag set.
9145         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9146         (check_SCRIPTS): Add exclude_libs_test.sh.
9147         (check_DATA): Add exclude_libs_test.syms.
9148         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9149         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9150         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9151         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9152         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9153         libexclude_libs_test_2.a): New rules.
9154         * testsuite/Makefile.in: Regenerate.
9155         * testsuite/exclude_libs_test.c: New file.
9156         * testsuite/exclude_libs_test.sh: Ditto.
9157         * testsuite/exclude_libs_test_1.c: Ditto.
9158         * testsuite/exclude_libs_test_2.c: Ditto.
9159
9160 2009-05-15  Ian Lance Taylor  <iant@google.com>
9161
9162         * configure.ac: Check for declarations for cases where libiberty.h
9163         checks HAVE_DECL_xxx.
9164         * configure, config.in: Rebuild.
9165
9166 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9167
9168         * gold.h (Incremental_argument_list): Remove (invalid) forward
9169         declaration.
9170         * incremental.cc (Incremental_inputs::report_achive): New method.
9171         (Incremental_inputs::report_object): New method.
9172         (Incremental_inputs::report_script): New method.
9173         (Incremental_inputs::finalize_inputs): New method.
9174         (Incremental_inputs::finalize): Call finalize_inputs().
9175         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9176         Create inputs entries.
9177         * incremental.h (Incremental_input_type): New enum.
9178         (Incremental_inputs::Incremental_input): Initialize new fields.
9179         (Incremental_inputs::report_inputs): New method.
9180         (Incremental_inputs::report_achive): New method.
9181         (Incremental_inputs::report_object): New method.
9182         (Incremental_inputs::report_script): New method.
9183         (Incremental_inputs::finalize_inputs): New method.
9184         (Incremental_inputs::Input_info): New struct.
9185         (Incremental_inputs::Input_info_map): New typedef.
9186         (Incremental_inputs::lock_): New field.
9187         (Incremental_inputs::Inputs_): New field.
9188         (Incremental_inputs::Inputs_map): New field.
9189         * main.cc (main): Call Incremental_input::report_inputs.
9190         * options.h (Input_argument_list): Typedef moved from
9191         Input_arguments.
9192         (Input_file_group::Files): Remove, use ::Input_argument_list.
9193         (Input_file_group::Input_argument_list): Remove, use
9194         ::Input_argument_list.
9195         * plugin.cc (Plugin_manager::add_input_file): Add error in
9196         incremental build.
9197         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9198         functions.
9199         * script.cc (read_input_script): Call
9200         Incremental_input::report_script.
9201         * script.h (Script_info): New class.
9202
9203 2009-04-27  Ian Lance Taylor  <iant@google.com>
9204
9205         * x86_64.cc (do_adjust_output_section): Set entsize to
9206         plt_entry_size.
9207
9208 2009-04-23  Elliott Hughes  <enh@google.com>
9209
9210         * output.cc (Output_file::close): After short writes, continue
9211         writing from the correct offset in the buffer being written.
9212
9213 2009-04-23  Chris Demetriou  <cgd@google.com>
9214
9215         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9216         * configure: Regenerate.
9217         * config.in: Regenerate.
9218         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9219         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9220
9221 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9222
9223         * incremental.cc (Incremental_inputs_header_data): Renamed from
9224         Incremental_input_header_data.
9225         (Incremental_inputs_header_data::data_size): New field.
9226         (Incremental_inputs_header_data::put_input_file_count): Renamed
9227         from input_file_count.
9228         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9229         from command_line_offset.
9230         (Incremental_inputs_header_data::put_reserved): Renamed from
9231         put_reserved.
9232         (Incremental_inputs_entry_data): Renamed from
9233         Incremental_input_entry_data.
9234         (Incremental_inputs_entry_data::data_size): New field.
9235         (Incremental_inputs::report_command_line): New method.
9236         (Incremental_inputs::finalize): New method.
9237         (Incremental_inputs::create_incremental_inputs_data): New method.
9238         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9239         * incremental.h: New file.
9240         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9241        (Layout::finalize): Create incremental inputs section in
9242         incremental builds.
9243        (Layout::create_incremental_info_sections): New method.
9244         * layout.h (Layout::incremental_inputs): New method.
9245        (Layout::create_incremental_info_sections): New method.
9246        (Layout::incremental_inputs_): New field.
9247         * main.cc (main): Notify Incremental_input of the command line.
9248
9249 2009-04-01  Ian Lance Taylor  <iant@google.com>
9250             Mikolaj Zalewski  <mikolajz@google.com>
9251
9252         * gold.h (reserve_unordered_map): Define, three versions, one for
9253         each version of Unordered_map.
9254         * layout.cc (Layout::Layout): Remove options parameter.  Add
9255         number_of_input_files parameter.  Don't initialize options_.
9256         Initialize number_of_input_files_ and resized_signatures_.  Move
9257         sections_are_attached_.
9258         (Layout::layout_group): Reserve space for group_signatures_.
9259         (Layout::find_or_add_kept_section): Change name parameter to be a
9260         reference.  Resize signatures_ map when it gets large enough.
9261         (Layout::layout_eh_frame): Use parameters->options() instead of
9262         this->options_.
9263         (Layout::make_output_section): Likewise.
9264         (Layout::attach_allocated_section_to_segment): Likewise.
9265         (Layout::finalize, Layout::create_executable_stack): Likewise.
9266         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9267         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9268         * layout.h (class Layout): Update declarations.  Remove options_
9269         field.  Add number_of_input_files_ and resized_signatures_
9270         fields.  Move sections_are_attached_ field.
9271         * main.cc (main): Pass number of input files to Layout
9272         constructor.  Don't pass options.
9273
9274 2009-03-30  Ian Lance Taylor  <iant@google.com>
9275
9276         * ffsll.c (ffsll): Correct implementation.
9277
9278 2009-03-27  Ian Lance Taylor  <iant@google.com>
9279
9280         * ffsll.c: New file.
9281         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9282         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9283         * ftruncate.c (ftruncate): Declare before definition.
9284         * mremap.c (mremap): Likewise.
9285         * pread.c (pread): Likewise.
9286         * configure, Makefile.in, config.in: Rebuild.
9287
9288         * mremap.c: New file.
9289         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9290         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9291         (mremap): Declare if HAVE_MREMAP is not defined.
9292         * configure, Makefile.in, config.in: Rebuild.
9293
9294 2009-03-27  Cary Coutant  <ccoutant@google.com>
9295
9296         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9297         position independent.
9298         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9299         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9300
9301 2009-03-24  Cary Coutant  <ccoutant@google.com>
9302
9303         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9304         an executable.
9305         (needs_dynamic_reloc): Likewise.
9306
9307 2009-03-24  Ian Lance Taylor  <iant@google.com>
9308
9309         * yyscript.y (file_cmd): Recognize EXTERN.
9310         (extern_name_list, extern_name_list_body): New nonterminals.
9311         * script.cc (script_add_extern): Define.
9312         * script-c.h (script_add_extern): Declare.
9313
9314 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9315
9316         * object.cc (is_elf_object): Define.
9317         * object.h (is_elf_object): Declare.
9318         * archive.cc (Archive::get_elf_object_for_member): Call
9319         is_elf_object.
9320         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9321
9322 2009-03-24  Elliott Hughes  <enh@google.com>
9323
9324         * output.cc (Output_file::map_anonymous): Define.
9325         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9326         try an anonymous one.  Report the size if the mmap fails.
9327         * output.h (class Output_file): Declare map_anonymous.
9328
9329 2009-03-24  Ian Lance Taylor  <iant@google.com>
9330
9331         * target-select.cc (instantiate_target): Don't acquire the lock if
9332         the instantiated_target_ field has already been set.
9333
9334 2009-03-23  Ian Lance Taylor  <iant@google.com>
9335
9336         * gold-threads.h (class Initialize_lock): Define.
9337         * gold-threads.cc (class Initialize_lock_once): Define.
9338         (initialize_lock_control): New static variable.
9339         (initialize_lock_pointer): New static variable.
9340         (initialize_lock_once): New static function.
9341         (Initialize_lock::Initialize_lock): Define.
9342         (Initialize_lock::initialize): Define.
9343         * target-select.h: Include "gold-threads.h".
9344         (class Target_selector): Add lock_ and initialize_lock_ fields.
9345         Don't define instantiate_target, just declare it.
9346         * target-select.cc (Target_selector::Target_selector): Initialize
9347         new fields.
9348         (Target_selector::instantiate_target): Define.
9349         * descriptors.h: Include "gold-threads.h".
9350         (class Descriptors): Add initialize_lock_ field.
9351         * descriptors.cc (Descriptors::Descriptors): Initialize new
9352         field.
9353         (Descriptors::open): Use initialize_lock_ field
9354         * errors.h (class Errors): Add initialize_lock_ field.
9355         * errors.cc (Errors::Errors): Initialize new field.
9356         (Errors::initialize_lock): Use initialize_lock_ field.
9357         * powerpc.cc (class Target_selector_powerpc): Remove
9358         instantiated_target_ field.  In do_recognize call
9359         instantiate_target rather than do_instantiate_target.  In
9360         do_instantiate_target just allocate a new target.
9361         * sparc.cc (class Target_selector_sparc): Likewise.
9362
9363         * freebsd.h: New file.
9364         * i386.cc: Include "freebsd.h".
9365         (Target_i386): Derive from Target_freebsd rather than
9366         Sized_target.
9367         (Target_selector_i386): Derive from Target_selector_freebsd rather
9368         than Target_selector.
9369         * x86_64.cc: Include "freebsd.h".
9370         (Target_x86_64): Derive from Target_freebsd rather than
9371         Sized_target.
9372         (Target_selector_x86_64): Derive from Target_selector_freebsd
9373         rather than Target_selector.
9374         * target.h (class Target): Add adjust_elf_header and
9375         do_adjust_elf_header.
9376         * output.cc (Output_file_header:: do_sized_write): Call target
9377         adjust_elf_header routine.
9378         * configure.tgt: Set targ_osabi.
9379         * configure.ac: Define GOLD_DEFAULT_OSABI.
9380         * parameters.cc (Parameters::default_target): Pass
9381         GOLD_DEFAULT_OSABI to select_target.
9382         * target-select.h (class Target_selector): Make instantiate_target
9383         protected rather than private.
9384         * Makefile.am (HFILES): Add freebsd.h.
9385         * configure, Makefile.in, config.in: Rebuild.
9386
9387         * merge.cc (do_add_input_section): Correct pend value.  Change
9388         message about last entry not being null terminated from error to
9389         warning.
9390
9391 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9392
9393         * incremental.cc: New file.
9394         * Makefile.am (CCFILES): Add incremental.cc.
9395         * Makefile.in: Rebuild.
9396
9397 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9398
9399         * layout.cc (Layout::output_section_name): Preserve names
9400         of '.note.' sections.
9401
9402 2009-03-19  Ian Lance Taylor  <iant@google.com>
9403
9404         * descriptors.cc (Descriptors::open): Check that the options are
9405         valid before using them.
9406
9407 2009-03-18  Ian Lance Taylor  <iant@google.com>
9408
9409         * script-sections.h: Include <list>.
9410         (class Script_sections): Change Sections_elements from std::vector
9411         to std::list.  Typedef public Elements_iterator.  Add
9412         orphan_section_placement_, data_segment_align_start_, and
9413         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9414         field.
9415         * script-sections.cc (class Orphan_section_placement): New class.
9416         (class Sections_element): Add virtual functions is_relro and
9417         orphan_section_init.  Remove virtual function place_orphan_here.
9418         (class Output_section_definition): Add is_relro and
9419         orphan_section_init.  Remove place_orphan_here.
9420         (class Orphan_output_section): Likewise.
9421         (Script_sections::Script_sections): Update for field changes.
9422         (Script_sections::data_segment_align): Set saw_data_segment_align_
9423         and data_segment_align_start_, not data_segment_align_index.
9424         (Script_sections::data_segment_relro_end): Check
9425         saw_data_segment_align_.  Use data_segment_align_start_ rather
9426         than data_segment_align_index_.
9427         (Script_sections::place_orphan): Rewrite to use
9428         Orphan_section_placement.
9429
9430 2009-03-17  Ian Lance Taylor  <iant@google.com>
9431
9432         * archive.cc (Archive::add_symbols): Check for a version attached
9433         to the symbol name in the archive map.
9434         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9435         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9436         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9437         (ver_test_11.a): New target.
9438         * testsuite/Makefile.in: Rebuild.
9439
9440         * configure.ac: Check for chsize and posix_fallocate.  Replace
9441         ftruncate.
9442         * ftruncate.c: New file, from gnulib.
9443         * output.cc (posix_fallocate): Define dummy version if not
9444         HAVE_POSIX_FALLOCATE.
9445         (Output_file::map): Call posix_fallocate rather than lseek and
9446         write.
9447         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9448         * configure, Makefile.in, config.in: Rebuild.
9449
9450 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9451
9452         * layout.h (Layout::create_note): Add section_name parameter.
9453         * layout.cc (Layout::create_note): Likewise.
9454         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9455
9456 2009-03-17  Ian Lance Taylor  <iant@google.com>
9457
9458         * descriptors.cc: Include "options.h".
9459         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9460         (Descriptors::open): Always use O_CLOEXEC when opening a new
9461         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9462         then set FD_CLOEXEC.
9463
9464         * sparc.cc (class Target_sparc): Add has_got_section.
9465         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9466         make sure we have a GOT section.
9467
9468         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9469         (Target_sparc::Scan::local): Likewise.
9470         (Target_sparc::Scan::global): Likewise.
9471         (Target_sparc::Relocate::relocate): Likewise.
9472         (Target_sparc::Relocate::relocate_tls): Likewise.
9473
9474         * symtab.cc (Symbol_table::define_default_version): New function,
9475         broken out of add_from_object.
9476         (Symbol_table::add_from_object): Call define_default_version.
9477         (Symbol_table::define_special_symbol): Add resolve_oldsym
9478         parameter.  Change all callers.  If the version for a symbol comes
9479         from a version script, resolve it with the symbol with the same
9480         name with no version.  Also add the symbol without a version if
9481         appropriate.
9482         (do_define_in_output_data): If resolving with oldsym, don't delete
9483         sym.
9484         (do_define_in_output_segment): Likewise.
9485         (do_define_as_constant): Likewise.
9486         * symtab.h (class Symbol_table): Update declarations.
9487
9488 2009-03-13  Ian Lance Taylor  <iant@google.com>
9489
9490         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9491         (Read_symbols::requeue): New function.
9492         (Read_symbols::do_read_symbols): If make_elf_object fails because
9493         the target type is not configured, and the file was searched for,
9494         issue a warning and retry with the next directory.
9495         (Add_symbols::run): If the file has an incompatible format, and
9496         it was searched for, requeue the Read_symbols task.  On error,
9497         release the object.
9498         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9499         dirindex parameter to constructor.  Change all callers.  Declare
9500         incompatible_warning and requeue.
9501         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9502         input_argument_ and input_group_ fields.  Add them to
9503         constructor.  Change all callers.
9504         (class Read_script): Add dirindex_ field.  Add it to constructor.
9505         Change all callers.
9506         * archive.cc (Archive::setup): Remove input_objects parameter.
9507         Change all callers.
9508         (Archive::get_file_and_offset): Likewise.
9509         (Archive::read_all_symbols): Likewise.
9510         (Archive::read_symbols): Likewise.
9511         (Archive::get_elf_object_for_member): Remove input_objects
9512         parameter.  Add punconfigured parameter.  Change all callers.
9513         (Archive::add_symbols): Change return type to bool.  Check return
9514         value of include_member.
9515         (Archive::include_all_members): Likewise.
9516         (Archive::include_member): Change return type to bool.  Return
9517         false if first included object has incompatible target.  Set
9518         included_member_ field.
9519         (Add_archive_symbols::run): If add_symbols returns false, requeue
9520         Read_symbols task.
9521         * archive.h (class Archive): Add included_member_ field.
9522         Initialize it in constructor.  Add input_file and searched_for
9523         methods.  Update declarations.
9524         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9525         input_argument_ fields.  Add them to constructor.  Change all
9526         callers.
9527         * script.cc: Include "target-select.h".
9528         (class Parser_closure): Add skip_on_incompatible_target_ and
9529         found_incompatible_target_ fields.  Add
9530         skip_on_incompatible_target parameter to constructor.  Change all
9531         callers.  Add methods skip_on_incompatible_target,
9532         clear_skip_on_incompatible_target, found_incompatible_target, and
9533         set_found_incompatible_target.
9534         (read_input_script): Add dirindex parameter.  Change all callers.
9535         If parser finds an incompatible target, requeue Read_symbols
9536         task.
9537         (script_set_symbol): Clear skip_on_incompatible_target in
9538         closure.
9539         (script_add_assertion, script_parse_option): Likewise.
9540         (script_start_sections, script_add_phdr): Likewise.
9541         (script_check_output_format): New function.
9542         * script.h (read_input_script): Update declaration.
9543         * script-c.h (script_check_output_format): Declare.
9544         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9545         (ignore_cmd): Remove OUTPUT_FORMAT.
9546         * fileread.cc (Input_file::Input_file): Add explicit this.
9547         (Input_file::will_search_for): New function.
9548         (Input_file::open): Add pindex parameter.  Change all callers.
9549         * fileread.h (class Input_file): Add input_file_argument method.
9550         Declare will_search_for.  Update declarations.
9551         * object.cc (make_elf_object): Add punconfigured parameter.
9552         Change all callers.
9553         * object.h (class Object): Make input_file public.  Add
9554         searched_for method.
9555         (make_elf_object): Update declaration.
9556         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9557         restart search.
9558         * dirsearch.h (class Dirsearch): Update declaration.
9559         * options.h (class General_options): Add --warn-search-mismatch.
9560         * parameters.cc (Parameters::is_compatible_target): New function.
9561         * parameters.h (class Parameters): Declare is_compatible_target.
9562         * workqueue.cc (Workqueue::add_blocker): New function.
9563         * workqueue.h (class Workqueue): Declare add_blocker.
9564
9565         * fileread.cc (Input_file::open): Remove options parameter.
9566         Change all callers.
9567         (Input_file::open_binary): Likewise.
9568         * script.cc (read_input_script): Likewise.
9569         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9570         options parameter from constructor.  Change all callers.
9571         (class Read_script): Likewise.
9572         * fileread.h (class Input_file): Update declarations.
9573         * script.h (read_input_script): Update declaration.
9574
9575 2009-03-10  Nick Clifton  <nickc@redhat.com>
9576
9577         * po/es.po: New Spanish translation.
9578
9579 2009-03-06  Cary Coutant  <ccoutant@google.com>
9580
9581         * options.cc (parse_short_option): Keep dash_z from registering itself.
9582
9583 2009-03-03  Ian Lance Taylor  <iant@google.com>
9584
9585         PR 9918
9586         * target-reloc.h (relocate_section): Pass output_section to
9587         relocate.
9588         * i386.cc (Target_i386::should_apply_static_reloc): Add
9589         output_section parameter.  Change all callers.
9590         (Target_i386::Relocate::relocate): Add output_section parameter.
9591         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9592         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9593         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9594         * testsuite/two_file_shared.sh: New script.
9595         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9596         (check_DATA): Add two_file_shared.dbg.
9597         (two_file_shared.dbg): New target.
9598         * testsuite/Makefile.in: Rebuild.
9599
9600 2009-03-01  Ian Lance Taylor  <iant@google.com>
9601
9602         * configure.ac: Check for byteswap.h.
9603         * configure: Rebuild.
9604         * config.in: Rebuild.
9605
9606 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9607
9608         * layout.cc (Layout::find_or_add_kept_section): New function.
9609         (Layout::add_comdat): Removed.
9610         * layout.h (struct Kept_section): Move out of class Layout.
9611         Remove trailing underscores from field names.  Add group_sections
9612         field.  Rename group_ field to is_group.  Change all uses.
9613         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9614         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9615         comdat_groups_ field.
9616         (Sized_relobj::include_section_group): Use
9617         find_or_add_kept_section and Kept_section::group_sections.
9618         (Sized_relobj::include_linkonce_section): Likewise.
9619         * object.cc (class Sized_relobj): Don't define Comdat_group or
9620         Comdat_group_table.  Remove find_comdat_group and
9621         add_comdat_group.  Remove comdat_groups_ field.
9622         * plugin.cc (include_comdat_group): Use
9623         Layout::find_or_add_kept_section.
9624
9625 2009-02-28  Ian Lance Taylor  <iant@google.com>
9626
9627         * README: --gc-sections and map files are now supported.  Document
9628         some build requirements.
9629
9630         PR 6992
9631         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9632         relocatable link set the value of the section symbol to zero.
9633         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9634         relocatable link don't include the section address in the local
9635         symbol value.
9636
9637 2009-02-27  Ian Lance Taylor  <iant@google.com>
9638
9639         PR 6811
9640         * options.h (class Search_directory): Add is_system_directory.
9641         (class General_options): Declare is_in_system_directory.
9642         * options.cc (get_relative_sysroot): Make static.
9643         (get_default_sysroot): Make static.
9644         (General_optoins::is_in_system_directory): New function.
9645         * fileread.cc (Input_file::is_in_system_directory): New function.
9646         * fileread.h (class Input_file): Declare is_in_system_directory.
9647         * object.h (class Object): Add is_in_system_directory.
9648         (class Input_objects): Remove system_library_directory_ field.
9649         * object.cc (Input_objects::add_object): Don't set
9650         system_library_directory_.
9651         (input_objects::found_in_system_library_directory): Remove.
9652         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9653         parameter.  Change all callers.
9654         (Symbol_table::sized_write_globals): Likewise.
9655         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9656         Call Object::is_in_system_directory.
9657         * symtab.h (class Symbol_table): Update declarations.
9658
9659         PR 5990
9660         * descriptors.h (Open_descriptor): Add is_on_stack field.
9661         * descriptors.cc (Descriptors::open): If the descriptor is on the
9662         top of the stack, remove it.  Initialize is_on_stack field.
9663         (Descriptors::release): Only add pod to stack if it is not on the
9664         stack already.
9665         (Descriptors::close_some_descriptor): Clear stack_next and
9666         is_on_stack fields.
9667
9668         PR 7091
9669         * output.cc (Output_section::find_starting_output_address): Rename
9670         from starting_output_address; add PADDR parameter; change return
9671         type.
9672         * output.h (class Output_section): Declare
9673         find_starting_output_address instead of starting_output_address.
9674         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9675         section symbol for which we can't find a merge section.
9676
9677         PR 9836
9678         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9679         hidden or internal, force the symbol to be local.
9680         * resolve.cc (Symbol::override_visibility): Define.
9681         (Symbol::override_base): Use override_visibility.
9682         (Symbol_table::resolve): Likewise.
9683         (Symbol::override_base_with_special): Likewise.
9684         (Symbol_table::override_with_special): If the visibility is hidden
9685         or internal, force the symbol to be local.
9686         * symtab.h (class Symbol): Add set_visibility and
9687         override_visibility.
9688         * testsuite/ver_test_1.sh: New file.
9689         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9690         (check_DATA): Add ver_test_1.syms.
9691         (ver_test_1.syms): New target.
9692         * testsuite/Makefile.in: Rebuild.
9693
9694 2009-02-25  Cary Coutant  <ccoutant@google.com>
9695
9696         * layout.cc (Layout::choose_output_section): Don't rename sections
9697         when using a linker script that has a SECTIONS clause.
9698         * Makefile.in: Regenerate.
9699
9700         * testsuite/Makefile.am (script_test_5.sh): New test case.
9701         * testsuite/Makefile.in: Regenerate.
9702         * testsuite/script_test_5.cc: New file.
9703         * testsuite/script_test_5.sh: New file.
9704         * testsuite/script_test_5.t: New file.
9705
9706 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9707
9708         * archive.cc (Archive::include_member): Update calls to add_symbols.
9709         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9710         the Layout argument.
9711         * dynobj.h (do_add_symbols): Add the Layout argument.
9712         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9713         Layout argument.
9714         * object.h (Object::add_symbols): Add the Layout argument.
9715         (Object::do_add_symbols): Add the Layout argument.
9716         (Sized_relobj::do_add_symbols): Add the Layout argument.
9717         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9718         Unify the two versions.
9719         (Add_plugin_symbols): Remove.
9720         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9721         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9722         (Add_plugin_symbols): Remove.
9723         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9724         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9725         (Add_symbols::run): Make it work with Pulginobj.
9726
9727 2009-02-06  Ian Lance Taylor  <iant@google.com>
9728
9729         * object.cc (Sized_relobj::do_layout): Make info message start
9730         with lower case letter.
9731
9732 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9733
9734         * binary.cc: Fix file comment.
9735
9736         * options.h (enum Incremental_disposition): Define.
9737         (class General_options): Add new options: --incremental,
9738         --incremental_changed, --incremental_unchanged,
9739         --incremental_unknown.  Add incremental_disposition_ and
9740         implicit_incremental_ fields.
9741         (General_options::incremental_disposition): New function.
9742         (class Position_dependent_options): Add incremental_disposition
9743         option.
9744         (Position_dependent_options::copy_from_options): Set incremental
9745         dispositions.
9746         * options.cc (General_options::parse_incremental_changed): New
9747         function.
9748         (General_options::parse_incremental_unchanged): New function.
9749         (General_options::parse_incremental_unknown): New function.
9750         (General_options::General_options): Initialize new fields
9751         incremental_disposition_ and implicit_incremental_.
9752         (General_options::finalize): Check for uasge of --incremental-*
9753         without --incremental.
9754
9755 2009-02-06  Chris Demetriou  <cgd@google.com>
9756
9757         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9758         pointer and to report location as the file name associated with
9759         the symbol.
9760         (gold_undefined_symbol_at_location): New function to replace the
9761         old gold_undefined_symbol functionality.
9762         * target-reloc.h (relocate_section): Update to use
9763         gold_undefined_symbol_at_location.
9764         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9765         Call gold_undefined_symbol function rather than gold_error.
9766         * errors.h (Errors::undefined_symbol): Take location as a
9767         string, rather than calculating it from a relocation.
9768         * errors.cc (Errors::fatal): Print "fatal error:" before the
9769         formatted message.
9770         (Errors::error, Errors::error_at_location): Print "error: "
9771         before the formatted message.
9772         (Errors::undefined_symbol): Take location as a string, rather
9773         than calculating it from a relocation.
9774         (gold_undefined_symbol_at_location): New function akin to
9775         old gold_undefined_symbol, calculates location from relocation.
9776         (gold_undefined_symbol): Change to take only a Symbol pointer
9777         and to report location as the file name associated with the symbol.
9778         * testsuite/debug_msg.sh: Update for changed error messages.
9779         * testsuite/undef_symbol.sh: Likewise.
9780
9781 2009-02-04  Duncan Sands  <baldrick@free.fr>
9782
9783         PR 9812
9784         * reduced_debug_output.h
9785         (Output_reduced_debug_abbrev_section::failed): Use format for
9786         gold_warning.
9787         (Output_reduced_debug_info_section::faild): Likewise.
9788
9789 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9790
9791         * script.cc (Lazy_demangler): New class.
9792         (Version_script_info::get_symbol_version_helper): Demangle a
9793         symbol only once.
9794
9795 2009-01-29  Cary Coutant  <ccoutant@google.com>
9796
9797         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9798         to __tls_get_addr.
9799         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9800
9801 2009-01-28  Ian Lance Taylor  <iant@google.com>
9802
9803         * version.cc (version_string): Bump to 1.9.
9804
9805         * gold.h: Include <cstring> and <stdint.h>.
9806         * version.cc: Include <cstdio>.
9807         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9808         warning.
9809         * reduced_debug_output.cc (insert_into_vector): Rename from
9810         Insert_into_vector; change all callers.  Use Swap_unaligned to
9811         avoid aliasing issue; remove union since it is unnecessary.
9812
9813 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9814
9815         * Makefile.am (CCFILES): Add gc.cc.
9816         (HFILES): Add gc.h.
9817         * Makefile.in: Regenerate.
9818         * gold.cc (Gc_runner): New class.
9819         (queue_initial_tasks): Call garbage collection related tasks
9820         when corresponding options are invoked.
9821         (queue_middle_gc_tasks): New function.
9822         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9823         processed early before laying out sections during garbage collection.
9824         * gold.h (queue_middle_gc_tasks): New function.
9825         (is_prefix_of): Move from "layout.cc".
9826         * i386.cc (Target_i386::gc_process_relocs): New function.
9827         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9828         * main.cc (main): Create object of class "Garbage_collection".
9829         * object.cc (Relobj::copy_symbols_data): New function.
9830         (Relobj::is_section_name_included): New function.
9831         (Sized_relobj::do_layout): Allow this function to be called twice
9832         during garbage collection and defer layout of section during the
9833         first call.
9834         * object.h (Relobj::get_symbols_data): New function.
9835         (Relobj::is_section_name_included): New function.
9836         (Relobj::copy_symbols_data): New function.
9837         (Relobj::set_symbols_data): New function.
9838         (Relobj::get_relocs_data): New function.
9839         (Relobj::set_relocs_data): New function.
9840         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9841         (Relobj::gc_process_relocs): New function.
9842         (Relobj::do_gc_process_relocs): New pure virtual function.
9843         (Relobj::sd_): New data member.
9844         (Sized_relobj::is_output_section_offset_invalid): New function.
9845         (Sized_relobj::do_gc_process_relocs): New function.
9846         * options.h (General_options::gc_sections): Modify to not be a no-op.
9847         (General_options::print_gc_sections): New option.
9848         * plugin.cc (Plugin_finish::run): Remove function call to
9849         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9850         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9851         * reloc.cc (Read_relocs::run): Add task to process relocs and
9852         determine unreferenced sections when doing garbage collection.
9853         (Gc_process_relocs): New class.
9854         (Sized_relobj::do_gc_process_relocs): New function.
9855         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9856         sections that are garbage collected.
9857         * reloc.h (Gc_process_relocs): New class.
9858         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9859         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9860         symbols whose corresponding sections are garbage collected.
9861         (Symbol_table::Symbol_table): Add new parameter for the garbage
9862         collection object.
9863         (Symbol_table::gc_mark_undef_symbols): New function.
9864         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9865         (Symbol_table::gc_mark_dyn_syms): New function.
9866         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9867         as garbage.
9868         (Symbol_table::add_from_object): Likewise.
9869         (Symbol_table::add_from_relobj): When building shared objects, do not
9870         treat externally visible symbols as garbage.
9871         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9872         table information for static and relocatable links.
9873         * symtab.h (Symbol_table::set_gc): New function.
9874         (Symbol_table::gc): New function.
9875         (Symbol_table::gc_mark_undef_symbols): New function.
9876         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9877         (Symbol_table::gc_mark_dyn_syms): New function.
9878         (Symbol_table::gc_): New data member.
9879         * target.h (Sized_target::gc_process_relocs): New pure virtual
9880         function.
9881         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9882         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9883
9884 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9885
9886         * options.h (General_options::gc_sections): Define as a no-op for now.
9887         (General_options::no_keep_memory): Ditto.
9888         (General_options::Bshareable): Define.
9889         * options.cc (General_options::finalize): Honor -Bshareable.
9890
9891 2009-01-20  Andreas Schwab  <schwab@suse.de>
9892
9893         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9894         read the value in the contents, since we don't use it.  Use the
9895         template endianness when writing.
9896         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9897
9898 2009-01-19  Andreas Schwab  <schwab@suse.de>
9899
9900         * configure.tgt (powerpc64-*): Fix targ_obj.
9901
9902 2009-01-15  Ian Lance Taylor  <iant@google.com>
9903
9904         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9905         local symbols when stripping all symbols.
9906
9907 2009-01-14  Cary Coutant  <ccoutant@google.com>
9908
9909         * output.cc (Output_reloc): Add explicit instantiations.
9910
9911 2009-01-14  Cary Coutant  <ccoutant@google.com>
9912
9913         * archive.cc (Archive::get_elf_object_for_member): Remove call
9914         to File_read::claim_for_plugin.
9915         * descriptors.cc (Descriptors::open): Remove reference to
9916         is_claimed.
9917         (Descriptors::claim_for_plugin): Remove.
9918         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9919         (Descriptors::is_claimed): Remove.
9920         (claim_descriptor_for_plugin): Remove.
9921         * fileread.cc (File_read::claim_for_plugin): Remove.
9922         * fileread.h (File_read::claim_for_plugin): Remove.
9923         (File_read::descriptor): Reopen descriptor if necessary.
9924         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9925         (Plugin_manager::all_symbols_read): Add task parameter. Change
9926         all callers.
9927         (Plugin_manager::get_input_file): New function.
9928         (Plugin_manager::release_input_file): New function.
9929         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9930         corresponding data member.
9931         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9932         and pass to base constructor. Change all callers.
9933         (get_input_file, release_input_file): New functions.
9934         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9935         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9936         (Plugin_manager::all_symbols_read): Add task parameter.
9937         (Plugin_manager::get_input_file): New function.
9938         (Plugin_manager::release_input_file): New function.
9939         (Plugin_manager::task_): New data member.
9940         (Pluginobj::Pluginobj): Add filesize parameter.
9941         (Pluginobj::filename): New function.
9942         (Pluginobj::descriptor): New function.
9943         (Pluginobj::filesize): New function.
9944         (Pluginobj::filesize_): New data member.
9945         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9946         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9947         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9948
9949         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9950         with archive libraries.
9951         * testsuite/Makefile.in: Regenerate.
9952         * testsuite/plugin_test.c (struct sym_info): New type.
9953         (get_input_file, release_input_file): New static variables.
9954         (onload): Capture new transfer vector entries.
9955         (claim_file_hook): Stop reading at end of file according to filesize.
9956         Factor out parsing of readelf output into separate function.
9957         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9958         APIs and get the source file name from the symbol table.  Convert
9959         source file name to corresponding object file name.  Print info
9960         message when adding new input files.
9961         (parse_readelf_line): New function.
9962         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9963         * testsuite/plugin_test_2.sh: Likewise.
9964         * testsuite/plugin_test_3.sh: Likewise.
9965         * testsuite/plugin_test_4.sh: New test case.
9966
9967 2009-01-07  Ian Lance Taylor  <iant@google.com>
9968
9969         * version.cc (version_string): Bump to 1.8.
9970
9971 2008-12-23  Cary Coutant  <ccoutant@google.com>
9972
9973         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9974         * plugin.cc (Plugin_manager::finish): Rename as
9975         layout_deferred_objects.  Move cleanup to separate function.
9976         (Plugin_manager::cleanup): New function.
9977         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9978         separately.
9979         * plugin.h (Plugin_manager::finish): Rename as
9980         layout_deferred_objects.
9981         (Plugin_manager::cleanup): New function.
9982         (Plugin_manager::cleanup_done): New field.
9983
9984 2008-12-23  Cary Coutant  <ccoutant@google.com>
9985
9986         * plugin.cc (is_visible_from_outside): New function.
9987         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9988         so we don't return "IR only" status for exported symbols or -r links.
9989
9990         * testsuite/Makefile.am (plugin_test_3): New test case.
9991         * testsuite/Makefile.in: Regenerate.
9992         * testsuite/plugin_test_3.sh: New file.
9993
9994 2008-12-22  Cary Coutant  <ccoutant@google.com>
9995
9996         * object.cc (Sized_relobj::layout_section): New function.
9997         (Sized_relobj::do_layout): Defer layout of input sections until after
9998         plugin has provided replacement files.
9999         (Sized_relobj::do_layout_deferred_sections): New function.
10000         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10001         (Relobj::layout_deferred_sections): New function.
10002         (Relobj::do_layout_deferred_sections): New function.
10003         (Sized_relobj::do_layout_deferred_sections): New function.
10004         (Sized_relobj::layout_section): New function.
10005         (Sized_relobj::Deferred_layout): New structure.
10006         (Sized_relobj::deferred_layout_): New field.
10007         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10008         Change all callers.  Layout deferred sections.
10009         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10010         references.
10011         (Plugin_hook::run): Move code from do_plugin_hook inline.
10012         (Plugin_hook::do_plugin_hook): Remove.
10013         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10014         (Plugin_manager::finish): Renamed, was cleanup.
10015         (Plugin_manager::should_defer_layout): New function.
10016         (Plugin_manager::add_deferred_layout_object): New function.
10017         (Plugin_manager::Deferred_layout_list): New type.
10018         (Plugin_manager::deferred_layout_objects_): New field.
10019         (Plugin_hook::do_plugin_hook): Remove.
10020
10021 2008-12-17  Ian Lance Taylor  <iant@google.com>
10022
10023         * options.h (class General_options): Add --no case for
10024         --export-dynamic.
10025
10026 2008-12-16  Cary Coutant  <ccoutant@google.com>
10027
10028         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10029         vector.
10030         (Plugin_manager::claim_file): Create plugin object even if
10031         plugin did not call the add_symbols callback.
10032         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10033         asking for more symbols than were added.
10034         * testsuite/Makefile.am (plugin_test_1): Add test case with
10035         no global symbols.
10036         (empty.syms): New target.
10037         * testsuite/Makefile.in: Regenerate.
10038         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10039         message. Don't call add_symbols if no globals.
10040         (all_symbols_read_hook): Don't provide replacement for empty
10041         claimed file.
10042
10043 2008-12-12  Ian Lance Taylor  <iant@google.com>
10044
10045         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10046         r_type == 0 for a local symbol with r_sym == 0.
10047         (scan_relocatable_relocs): Pass r_sym to
10048         local_non_section_strategy.
10049         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10050         r_sym parameter.
10051
10052         * configure.ac: Update test for TLS descriptors: they are
10053         supported as of glibc 2.9.
10054         * configure: Rebuild.
10055
10056 2008-12-11  Ian Lance Taylor  <iant@google.com>
10057
10058         PR 7091
10059         * target-reloc.h (Default_scan_relocatable_relocs): For each
10060         function, map r_type == 0 to RELOC_DISCARD.
10061
10062 2008-12-10  Cary Coutant  <ccoutant@google.com>
10063
10064         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10065         object to override a kept COMDAT group from a plugin object.
10066
10067 2008-12-09  Ian Lance Taylor  <iant@google.com>
10068
10069         PR 7088
10070         * yyscript.y (file_cmd): Handle INPUT.
10071
10072         * testsuite/initpri1.c: Change all declarations to be full
10073         prototypes by adding void, to avoid compiler warnings.
10074
10075 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10076
10077         * options.cc (General_options::parse_plugin_opt): New.
10078         (General_options::add_plugin): The argument now is just the filename.
10079         (General_options::add_plugin_option): New.
10080         * options.h (plugin_opt): New.
10081         (add_plugin): Change argument name.
10082         (add_plugin_option): New.
10083         * plugin.cc (Plugin::load): Don't parse the plugin option.
10084         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10085         (Plugin::add_option): New.
10086         (Plugin::args_): Change type.
10087         (Plugin::filename_): New.
10088         (Plugin_manager::add_plugin_option): New.
10089         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10090         * testsuite/Makefile.in: Regenerate.
10091
10092 2008-12-05  Cary Coutant  <ccoutant@google.com>
10093
10094         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10095         Handle --strip-lto-sections option.
10096         * options.h (strip_lto_sections): New option.
10097
10098 2008-12-01  Cary Coutant  <ccoutant@google.com>
10099
10100         * plugin.cc (ld_plugin_message): Change format parameter to const.
10101         Fix mismatch between new[] and delete.
10102
10103 2008-11-14  Cary Coutant  <ccoutant@google.com>
10104
10105         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10106         instead of -1U.
10107
10108 2008-11-05  Craig Silverstein  <csilvers@google.com>
10109
10110         * options.cc (General_options::parse_dynamic_list): New function.
10111         * options.h (General_options): New flags dynamic_list,
10112         dynamic_list_data, dynamic_list_cpp_new, and
10113         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10114         (General_options::in_dynamic_list): New function.
10115         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10116         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10117         (Lex::can_continue_name): Likewise.
10118         (yylex): Likewise.
10119         (read_script_file): New parameter script_options.
10120         (read_dynamic_list): New function.
10121         (Script_options::define_dynamic_list): New function.
10122         (dynamic_list_keyword_parsecodes): New variable.
10123         (dynamic_list_keywords): New variable.
10124         * script.h (Script_options::define_dynamic_list): New function
10125         prototype.
10126         (read_dynamic_list): New function prototype.
10127         * symtab.cc (strprefix): New macro.
10128         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10129         dynamic_list_data, dynamic_list_cpp_new, and
10130         dynamic_list_cpp_typeinfo.
10131         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10132         (dynamic_list_expr): New rule.
10133         (dynamic_list_nodes): Likewise.
10134         (dynamic_list_node): Likewise.
10135         * testsuite/Makefile.am (dynamic_list): New test.
10136         * testsuite/Makefile.in: Regenerated.
10137         * testsuite/dynamic_list.t: New file.
10138         * testsuite/dynamic_list.sh: New file.
10139
10140 2008-11-05  Craig Silverstein  <csilvers@google.com>
10141
10142         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10143         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10144         (t11_last): Likewise.
10145         * testsuite/ver_test_6.c (main): Likewise.
10146
10147 2008-10-07  Cary Coutant  <ccoutant@google.com>
10148
10149         * options.c (General_options::finalize): Add check for -static and
10150         -shared.
10151         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10152         is not empty.
10153
10154 2008-10-02  Cary Coutant  <ccoutant@google.com>
10155
10156         * plugin.cc (make_sized_plugin_object): Fix conditional
10157         compilation to work when not all targets are enabled.
10158
10159 2008-09-29  Cary Coutant  <ccoutant@google.com>
10160
10161         * archive.cc (Archive::get_file_and_offset): Use filename instead
10162         of name to get library path.
10163         (Archive::include_member): Unlock external member of a thin archive.
10164
10165         * testsuite/Makefile.am (TEST_AR): New variable.
10166         (thin_archive_test_1): New test.
10167         (thin_archive_test_2): New test.
10168         * testsuite/Makefile.in: Regenerate.
10169         * testsuite/thin_archive_main.cc: New file.
10170         * testsuite/thin_archive_test_1.cc: New file.
10171         * testsuite/thin_archive_test_2.cc: New file.
10172         * testsuite/thin_archive_test_3.cc: New file.
10173         * testsuite/thin_archive_test_4.cc: New file.
10174
10175 2008-09-29  Cary Coutant  <ccoutant@google.com>
10176
10177         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10178         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10179         instead of -1U.
10180         (Sized_relobj::do_finalize_local_symbols): Likewise.
10181         (Sized_relobj::map_to_kept_section): Likewise.
10182         * object.h (Sized_relobj::invalid_address): New constant.
10183         (Sized_relobj::do_output_section_offset): Check for invalid_address
10184         and return -1ULL.
10185         * output.cc (Output_reloc::local_section_offset): Use constant
10186         invalid_address instead of -1U.
10187         (Output_reloc::get_address): Likewise.
10188         (Output_section::output_address): Change -1U to -1ULL.
10189         * output.h (Output_reloc::invalid_address): New constant.
10190         * reloc.cc (Sized_relobj::write_sections): Use constant
10191         invalid_address instead of -1U.
10192         (Sized_relobj::relocate_sections): Likewise.
10193         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10194         values for merge sections.
10195         * target-reloc.h (relocate_for_relocatable): Use constant
10196         invalid_address instead of -1U.
10197
10198 2008-09-19  Cary Coutant  <ccoutant@google.com>
10199
10200         Add plugin functionality for link-time optimization (LTO).
10201         * configure.ac (plugins): Add --enable-plugins option.
10202         * configure: Regenerate.
10203         * config.in: Regenerate.
10204         * Makefile.am (LIBDL): New variable.
10205         (CCFILES): Add plugin.cc.
10206         (HFILES): Add plugin.h.
10207         (ldadd_var): Add LIBDL.
10208         * Makefile.in: Regenerate.
10209
10210         * archive.cc: Include "plugin.h".
10211         (Archive::setup): Don't preread archive symbols when using a plugin.
10212         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10213         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10214         files.
10215         (Archive::include_member): Add symbols from plugin objects.
10216         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10217         * descriptors.cc (Descriptors::open): Check for file descriptors
10218         abandoned by plugins.
10219         (Descriptors::claim_for_plugin): New function.
10220         * descriptors.h (Descriptors::claim_for_plugin): New function.
10221         (Open_descriptor::is_claimed): New field.
10222         (claim_descriptor_for_plugin): New function.
10223         * fileread.cc (File_read::claim_for_plugin): New function.
10224         * fileread.h (File_read::claim_for_plugin): New function.
10225         (File_read::descriptor): New function.
10226         * gold.cc: Include "plugin.h".
10227         (queue_initial_tasks): Add task to call plugin hooks for generating
10228         new object files.
10229         * main.cc: Include "plugin.h".
10230         (main): Load plugin libraries.
10231         * object.h (Pluginobj): Declare.
10232         (Object::pluginobj): New function.
10233         (Object::do_pluginobj): New function.
10234         (Object::set_target): New function.
10235         * options.cc: Include "plugin.h".
10236         (General_options::parse_plugin): New function.
10237         (General_options::General_options): Initialize plugins_ field.
10238         (General_options::add_plugin): New function.
10239         * options.h (Plugin_manager): Declare.
10240         (General_options): Add --plugin option.
10241         (General_options::has_plugins): New function.
10242         (General_options::plugins): New function.
10243         (General_options::add_plugin): New function.
10244         (General_options::plugins_): New field.
10245         * plugin.cc: New file.
10246         * plugin.h: New file.
10247         * readsyms.cc: Include "plugin.h".
10248         (Read_symbols::do_read_symbols): Check for archive before checking
10249         for ELF file.  Call plugin hooks to claim files.
10250         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10251         from a real object file; force override when processing replacement
10252         files.
10253         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10254         (Symbol::init_base_object): Likewise.
10255         (Symbol::init_base_output_data): Likewise.
10256         (Symbol::init_base_output_segment): Likewise.
10257         (Symbol::init_base_constant): Likewise.
10258         (Symbol::init_base_undefined): Likewise.
10259         (Symbol::output_section): Assert that object is not a plugin.
10260         (Symbol_table::add_from_pluginobj): New function.
10261         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10262         undefined.
10263         (Symbol_table::sized_write_globals): Likewise.
10264         (Symbol_table::add_from_pluginobj): Instantiate template.
10265         * symtab.h (Sized_pluginobj): Declare.
10266         (Symbol::in_real_elf): New function.
10267         (Symbol::set_in_real_elf): New function.
10268         (Symbol::in_real_elf_): New field.
10269         (Symbol_table::add_from_pluginobj): New function.
10270
10271         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10272         (LIBDL): New variable.
10273         (LDADD): Add LIBDL.
10274         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10275         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10276         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10277         (MOSTLYCLEANFILES): Likewise.
10278         * testsuite/Makefile.in: Regenerate.
10279         * testsuite/plugin_test.c: New file.
10280         * testsuite/plugin_test_1.sh: New file.
10281         * testsuite/plugin_test_2.sh: New file.
10282
10283 2008-09-16  Ian Lance Taylor  <iant@google.com>
10284
10285         * target-reloc.h (relocate_section): Check whether a symbol is
10286         defined by the ABI before reporting an undefined symbol error.
10287         * target.h (Target::is_defined_by_abi): Make parameter const.
10288         (Target::do_is_defined_by_abi): Likewise.
10289         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10290         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10291         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10292         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10293         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10294         * testsuite/Makefile.in: Rebuild.
10295
10296         * fileread.cc (make_view): Add casts to avoid warning.
10297
10298 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10299
10300         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10301         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10302
10303 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10304
10305         * options.h (General_options::output_is_executable): New.
10306         (General_options::output_is_pie): New.
10307         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10308         for shared libraries.
10309         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10310
10311 2008-09-11  Chris Demetriou  <cgd@google.com>
10312
10313         * options.h (origin): New -z option.
10314         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10315         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10316         in DT_FLAGS_1.
10317
10318 2008-09-05  Cary Coutant  <ccoutant@google.com>
10319
10320         * fileread.cc (File_read::make_view): Add check for attempt to map
10321         beyond end of file.
10322
10323 2008-09-05  Cary Coutant  <ccoutant@google.com>
10324
10325         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10326         explicit instantiations.
10327
10328 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10329
10330         PR gold/6858
10331         * options.cc (General_options::finalize): Allow undefined symbols
10332         in shlibs if linking -shared.
10333
10334         PR gold/6859
10335         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10336         symbols as not needing a dynsym entry.
10337
10338 2008-08-20  Craig Silverstein  <csilvers@google.com>
10339
10340         * fileread.cc (File_read::open): Do not lock the file unless it
10341         was successfully opened.
10342
10343 2008-08-14  Cary Coutant  <ccoutant@google.com>
10344
10345         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10346         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10347         * testsuite/tls_test.cc (struct int128): 128-bit struct
10348         for testing TLS relocs with non-zero addend.
10349         (v12): New TLS variable.
10350         (t12): New test.
10351         (t_last): Add check for v12.
10352         * testsuite/tls_test.h (t12): New function.
10353         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10354
10355 2008-08-13  Ian Lance Taylor  <iant@google.com>
10356
10357         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10358         set tls_segment_ or relro_segment_.
10359         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10360         when appropriate.
10361         * output.h (Output_section::clear_is_relro): New function.
10362         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10363         sections specially even when output_data_ is empty.
10364         (Output_segment::maximum_alignment): When first section is relro,
10365         only force alignment for PT_LOAD segments.
10366         * script.cc (script_data_segment_align): New function.
10367         (script_data_segment_relro_end): New function.
10368         * script-c.h (script_data_segment_align): Declare.
10369         (script_data_segment_relro_end): Declare.
10370         * script-sections.h (class Script_sections): Declare
10371         data_segment_align and data_segment_relro_end.  Add fields
10372         segment_align_index_ and saw_relro_end_.
10373         * script-sections.cc (class Sections_element): Add set_is_relro
10374         virtual function.  Add new bool* parameter to place_orphan_here.
10375         Add get_output_section virtual function.
10376         (class Output_section_definition): Add set_is_relro.  Add new
10377         bool* parameter to place_orphan_here.  Add get_output_section.
10378         Add is_relro_ field.
10379         (Output_section_definition::Output_section_definition): Initialize
10380         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10381         and is_relro_ fields.
10382         (Output_section_definition::place_orphan_here): Add is_relro
10383         parameter.
10384         (Output_section_definition::set_section_addresses): Set relro for
10385         output section.
10386         (Output_section_definition::alternate_constraint): Likewise.
10387         (class Orphan_output_section): Add new bool* parameter to
10388         place_orphan_here.  Add get_output_section.
10389         (Orphan_output_section::place_orphan_here): Add is_relro
10390         parameter.
10391         (Script_sections::Script_sections): Initialize
10392         data_segment_align_index_ and saw_relro_end_.
10393         (Script_sections::data_segment_align): New function.
10394         (Script_sections::data_segment_relro_end): New function.
10395         (Script_sections::place_orphan): Set or clear is_relro.
10396         (Script_sections::set_section_addresses): Force alignment of first
10397         TLS section.
10398         * yyscript.y (exp): Call script_data_segment_align and
10399         script_data_segment_relro_end.
10400         * testsuite/relro_script_test.t: New file.
10401         * testsuite/relro_test.cc (using_script): Declare.
10402         (t1, t2): Test using_script.
10403         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10404         (relro_script_test_SOURCES): Define.
10405         (relro_script_test_DEPENDENCIES): Define.
10406         (relro_script_test_LDFLAGS): Define.
10407         (relro_script_test_LDADD): Define.
10408         (relro_script_test.so): New target.
10409         * testsuite/Makefile.in: Rebuild.
10410
10411 2008-08-06  Cary Coutant <ccoutant@google.com>
10412
10413         * archive.cc (Archive::total_archives, Archive::total_members)
10414         (Archive::total_members_loaded): New variables.
10415         (Archive::setup): Add parameter.  Add option to preread
10416         archive symbols.
10417         (Archive::read_armap): Add counter.
10418         (Archive::get_file_and_offset): New function.
10419         (Archive::get_elf_object_for_member): New function.
10420         (Archive::read_all_symbols): New function.
10421         (Archive::read_symbols): New function.
10422         (Archive::add_symbols): Add counters.
10423         (Archive::include_all_members): Use armap to find members if it's
10424         already built.
10425         (Archive::include_member): Skip reading symbols if already read.
10426         Factored code into Archive::get_file_and_offset and
10427         Archive::get_elf_object_for_member.  Changed call to
10428         Mapfile::report_include_archive_member.
10429         (Archive::print_stats): New function.
10430         * archive.h: Declare Object and Read_symbols_data classes.
10431         (Archive::Archive): Add initializers for new members.
10432         (Archive::setup): Add parameter.
10433         (Archive::print_stats): New function.
10434         (Archive::total_archives, Archive::total_members)
10435         (Archive::total_members_loaded): New variables.
10436         (Archive::get_file_and_offset): New function.
10437         (Archive::get_elf_object_for_member): New function.
10438         (Archive::read_all_symbols): New function.
10439         (Archive::read_symbols): New function.
10440         (Archive::Archive_member): New class.
10441         (Archive::members_): New member.
10442         (Archive::num_members_): New member.
10443         * main.cc: Include archive.h.
10444         (main): Call Archive::print_stats.
10445         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10446         archive parameter; member_name is now the fully-decorated name.
10447         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10448         * options.h: (General_options): Add --preread-archive-symbols option.
10449         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10450         Archive::setup.
10451
10452 2008-08-04  Ian Lance Taylor  <iant@google.com>
10453
10454         * symtab.h (Symbol::use_plt_offset): New function.
10455         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10456         * powerpc.cc (Relocate::relocate): Likewise.
10457         * sparc.cc (Relocate::relocate): Likewise.
10458         * x86_64.cc (Relocate::relocate): Likewise.
10459         * testsuite/weak_plt.sh: New test.
10460         * testsuite/weak_plt_main.cc: New test.
10461         * testsuite/weak_plt_shared.cc: New test.
10462         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10463         (check_PROGRAMS): Add weak_plt.
10464         (check_DATA): Add weak_plt_shared.so.
10465         (weak_plt_main_pic.o, weak_plt): New targets.
10466         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10467         * testsuite/Makefile.in: Rebuild.
10468
10469         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10470         gcctestdir/ld.
10471         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10472         * testsuite/Makefile.in: Rebuild.
10473
10474 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10475
10476         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10477         * Makefile.in: Regenerate.
10478         * po/POTFILES.in: Regenerate.
10479
10480 2008-07-29  Ian Lance Taylor  <iant@google.com>
10481
10482         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10483         symbols before other symbols.
10484         * testsuite/script_test_2.cc (test_addr): Declare.
10485         (test_addr_alias): Declare.
10486         (main): Check that test_addr and test_addr_alias have the right
10487         values.
10488         * testsuite/script_test_2.t: Define test_addr_alias and
10489         test_addr.
10490
10491 2008-07-24  Ian Lance Taylor  <iant@google.com>
10492
10493         PR 5990
10494         * descriptors.cc: New file.
10495         * descriptors.h: New file.
10496         * gold-threads.h (class Hold_optional_lock): New class.
10497         * fileread.cc: Include "descriptors.h".
10498         (File_read::~File_read): Release descriptor rather than closing
10499         it.
10500         (File_read::open) [file]: Call open_descriptor rather than open.
10501         Set is_descriptor_opened_.
10502         (File_read::open) [memory]: Assert that descriptor is not open.
10503         (File_read::reopen_descriptor): New function.
10504         (File_read::release): Release descriptor.
10505         (File_read::do_read): Make non-const.  Reopen descriptor.
10506         (File_read::read): Make non-const.
10507         (File_read::make_view): Reopen descriptor.
10508         (File_read::do_readv): Likewise.
10509         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10510         Update declarations.
10511         * layout.cc: Include "descriptors.h".
10512         (Layout::create_build_id): Use open_descriptor rather than open.
10513         * output.cc: Include "descriptors.h".
10514         (Output_file::open): Use open_descriptor rather than open.
10515         * archive.cc (Archive::const_iterator): Change Archive to be
10516         non-const.
10517         (Archive::begin, Archive::end): Make non-const.
10518         (Archive::count_members): Likewise.
10519         * archive.h (class Archive): Update declarations.
10520         * object.h (Object::read): Make non-const.
10521         * Makefile.am (CCFILES): Add descriptors.cc.
10522         (HFILES): Add descriptors.h.
10523         * Makefile.in: Rebuild.
10524
10525         PR 6716
10526         * gold.h: Always include <clocale>.  Add Solaris workarounds
10527         following code in binutils/sysdep.h.
10528
10529         PR 6048
10530         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10531         this->eh_frame_hdr_ is NULL before using it.
10532
10533         * dynobj.cc (Versions::Versions): Update comment.
10534
10535         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10536         the base version name.
10537
10538         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10539         array size plus one.
10540         (Stringpool_template::set_string_offsets): Subtract one from key
10541         before using it as an array index.
10542         (Stringpool_template::get_offset_with_length): Likewise.
10543         (Stringpool_template::write_to_buffer): Likewise.
10544         * stringpool.h (Stringpool_template::get_offset_from_key):
10545         Likewise.
10546
10547 2008-07-23  Ian Lance Taylor  <iant@google.com>
10548
10549         PR 6658
10550         * object.h (Merged_symbol_value::value): Do our best to handle a
10551         negative addend.
10552
10553         PR 6647
10554         * script.cc (Version_script_info::get_versions): Don't add empty
10555         version tag to return value.
10556         (Version_script_info::get_symbol_version_helper): Change return
10557         type to bool.  Add pversion parameter.  Change all callers.
10558         (script_register_vers_node): Don't require a non-NULL tag.
10559         * script.h (class Version_script_info): Update declarations.
10560         (Version_script_info::get_symbol_version): Change return type to
10561         bool.  Add version parameter.  Change all callers.
10562         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10563         handling.  Handle an empty version from a version script.
10564         (Symbol_table::define_special_symbol): Likewise.
10565         * testsuite/ver_test_10.script: New file.
10566         * testsuite/ver_test_10.sh: New file.
10567         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10568         (check_DATA): Add ver_test_10.syms.
10569         (ver_test_10.syms, ver_test_10.so): New target.
10570         * testsuite/Makefile.in: Rebuild.
10571
10572 2008-07-23  Simon Baldwin  <simonb@google.com>
10573
10574         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10575         to zero for undefined symbols from dynamic libraries.
10576
10577 2008-07-23  Ian Lance Taylor  <iant@google.com>
10578
10579         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10580         Change all callers.
10581         * symtab.h (class Symbol_table): Update declaration.
10582         * testsuite/ver_test_9.cc: New file.
10583         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10584         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10585         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10586         (ver_test_9.so, ver_test_9.o): New targets.
10587         * testsuite/Makefile.in: Rebuild.
10588
10589 2008-07-22  Ian Lance Taylor  <iant@google.com>
10590
10591         * options.h (class General_options): Define --check-sections.
10592         * layout.cc (Layout::set_segment_offsets): Handle
10593         --check-sections.
10594
10595         * options.h (class General_options): Define -n/--nmagic and
10596         -N/--omagic.
10597         * options.cc (General_options::finalize): For -n/--nmagic or
10598         -N/--omagic, set -static.
10599         * layout.cc (Layout::attach_allocated_section_to_segment): If
10600         -N/--omagic, don't put read-only and read-write sections in
10601         different segments.
10602         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10603         finding a read-only segment.
10604         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10605         don't set the minimum segment alignment to the common page size,
10606         and don't set the file offset to the address modulo the page size.
10607         * script-sections.cc (Script_sections::create_segments): If
10608         -n/--omagic, don't put read-only and read-write sections in
10609         different segments.
10610
10611         * cref.cc: New file.
10612         * cref.h: New file.
10613         * options.h (class General_options): Add --print-symbol-counts.
10614         * main.cc (main): Issue defined symbol report if requested.
10615         * archive.cc (Archive::interpret_header): Make into a const member
10616         function.
10617         (Archive::add_symbols): Call Input_objects::archive_start and
10618         archive_stop.
10619         (Archive::const_iterator): Define new class.
10620         (Archive::begin, Archive::end): New functions.
10621         (Archive::include_all_members): Rewrite to use iterator.
10622         (Archive::count_members): New function.
10623         * archive.h (class Archive): Update declarations.
10624         (Archive::filename): New function.
10625         * object.cc: Include "cref.h".
10626         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10627         (Sized_relobj::do_get_global_symbol_counts): New function.
10628         (Input_objects::add_object): Add object to cross-referencer.
10629         (Input_objects::archive_start): New function.
10630         (Input_objects::archive_stop): New function.
10631         (Input_objects::print_symbol_counts): New function.
10632         * object.h: Declare Cref and Archive.
10633         (Object::get_global_symbol_counts): New function.
10634         (Object::do_get_global_symbol_counts): New pure virtual function.
10635         (class Sized_relobj): Add defined_count_ field.  Update
10636         declarations.
10637         (class Input_objects): Add cref_ field.  Update constructor.
10638         Update declarations.
10639         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10640         defined_count_.
10641         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10642         symbol counts.
10643         (Sized_dynobj::do_get_global_symbol_counts): New function.
10644         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10645         defined_count_.  Update declarations.  Define Symbols typedef.
10646         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10647         parameter.  Change all callers.
10648         (Symbol_table::add_from_dynobj): Add sympointers and defined
10649         parameters.  Change all callers.
10650         * symtab.h (class Symbol_table): Update declarations.
10651         * Makefile.am (CCFILES): Add cref.cc.
10652         (HFILES): Add cref.h.
10653         * Makefile.in: Rebuild.
10654
10655 2008-07-22  Simon Baldwin  <simonb@google.com>
10656
10657         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10658         to zero when writing undefined symbols.
10659
10660 2008-07-22  Ian Lance Taylor  <iant@google.com>
10661
10662         * output.cc (Output_section::add_input_section): Don't try to
10663         merge empty merge sections.
10664
10665 2008-07-21  Craig Silverstein  <csilvers@google.com>
10666
10667         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10668         Include symbol version in error message.
10669
10670 2008-07-20  Chris Demetriou  <cgd@google.com>
10671
10672         * configure.ac (gold_cv_c_random_seed): New configured variable.
10673         (RANDOM_SEED_CFLAGS): New substituted variable.
10674         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10675         * configure: Rebuild.
10676         * Makefile.in: Likewise.
10677         * testsuite/Makefile.in: Likewise.
10678
10679 2008-07-18  Ian Lance Taylor  <iant@google.com>
10680
10681         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10682         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10683         * testsuite/ver_test_main.cc (main): Call t4.
10684         (t4, t4_2a): Define.
10685         * testsuite/ver_test_2.cc (t4_2): Define.
10686         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10687         * testsuite/ver_test_4.cc (t4_2a): Define.
10688         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10689         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10690
10691 2008-07-17  Ian Lance Taylor  <iant@google.com>
10692
10693         * dynobj.cc (Versions::add_def): If we give an error about a
10694         missing version, go ahead and create the version anyhow.
10695
10696 2008-07-10  Ian Lance Taylor  <iant@google.com>
10697
10698         Handle output sections with more than 0x7fffffff bytes.
10699         * object.h (class Relobj): Change map_to_output_ to
10700         output_sections_, and just keep a section pointer.  Change all
10701         uses.  Move comdat group support to Sized_relobj.
10702         (Relobj::is_section_specially_mapped): Remove.
10703         (Relobj::output_section): Remove poff parameter.  Change all
10704         callers.
10705         (Relobj::output_section_offset): New function.
10706         (Relobj::set_section_offset): Rewrite.
10707         (Relobj::map_to_output): Remove.
10708         (Relobj::output_sections): New function.
10709         (Relobj::do_output_section_offset): New pure virtual function.
10710         (Relobj::do_set_section_offset): Likewise.
10711         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10712         group support from Relobj.  Update declarations.
10713         (Sized_relobj::get_output_section_offset): New function.
10714         (Sized_relobj::do_output_section_offset): New function.
10715         (Sized_relobj::do_set_section_offset): New function.
10716         * object.cc (Relobj::output_section_address): Remove.
10717         (Sized_relobj::Sized_relobj): Initialize new fields.
10718         (Sized_relobj::include_section_group): Cast find_kept_object to
10719         Sized_relobj.
10720         (Sized_relobj::include_linkonce_section): Likewise.
10721         (Sized_relobj::do_layout): Use separate arrays for output section
10722         and output offset.
10723         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10724         output_sections.
10725         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10726         output_sections and section_offsets.
10727         (Sized_relobj::write_local_symbols): Likewise.
10728         (map_to_kept_section): Compute output address directly.
10729         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10730         output_sections and section_offsets.
10731         (Sized_relobj::write_sections): Likewise.
10732         (Sized_relobj::relocate_sections): Likewise.
10733         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10734         * output.h (class Output_reloc): Update declarations.  Change
10735         u2_.relobj to Sized_relobj*.
10736         (class Output_data_reloc): Change add functions to use
10737         Sized_relobj*.
10738         * output.cc (Output_reloc::Output_reloc): Change relobj to
10739         Sized_relobj*.
10740         (Output_reloc::local_section_offset): Change return type to
10741         Elf_Addr.  Use get_output_section_offset.
10742         (Output_reloc::get_address): Likewise.
10743         (Output_section::is_input_address_mapped): Don't call
10744         is_section_specially_mapped.
10745         (Output_section::output_offset): Likewise.
10746         (Output_section::output_address): Likewise.
10747         (Output_section::starting_output_address): Likewise.
10748         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10749         parameter to Sized_relobj*.
10750         (Copy_relocs::need_copy_reloc): Likewise.
10751         (Copy_relocs::save): Likewise.
10752         * copy-relocs.h (class Copy_relocs): Update declarations.
10753         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10754         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10755         * target-reloc.h (relocate_for_relocatable): Change
10756         offset_in_output_section type to Elf_Addr.  Change code that uses
10757         it as well.
10758         * layout.cc (Layout::layout): Always set *off.
10759         * mapfile.cc (Mapfile::print_input_section): Use
10760         output_section_offset.
10761         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10762         Sized_relobj*.
10763         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10764         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10765         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10766
10767 2008-07-03  Ian Lance Taylor  <iant@google.com>
10768
10769         * layout.cc (Layout::include_section): Do not discard unrecognized
10770         SHT_STRTAB sections.
10771
10772 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10773
10774         * script.cc (Lex::can_continue_name): Make '?' allowable in
10775         version-script names.
10776         * testsuite/version_script.map: Change glob pattern to use '?'
10777
10778 2008-06-30  Manish Singh  <yosh@gimp.org>
10779
10780         PR 6585
10781         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10782         Correct typo.
10783
10784 2008-06-30  Ian Lance Taylor  <iant@google.com>
10785
10786         PR 6660
10787         PR 6682
10788         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10789         versions]: Don't try to read the value in the contents, since we
10790         don't use it.  Use the template endianness when writing.
10791
10792 2008-06-25  Cary Coutant  <ccoutant@google.com>
10793
10794         * fileread.cc (File_read::make_view): Assert on zero-length view.
10795         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10796         symbol table when there are no symbols to read.
10797
10798 2008-06-23  Craig Silverstein  <csilvers@google.com>
10799
10800         * version.cc (version_string): Bump to 1.7
10801
10802 2008-06-18  Craig Silverstein  <csilvers@google.com>
10803
10804         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10805         constant 0xFFFF to type Valtype.
10806         (Powerpc_relocate_functions::rel16_ha): Likewise.
10807
10808 2008-06-17  Ian Lance Taylor  <iant@google.com>
10809
10810         * output.h (Output_section::Input_section): Initialize p2align_ to
10811         zero for Output_section_data constructors.
10812         (Output_section::Input_section::addralign): If not an input
10813         section, return the alignment of the Output_section_data.
10814         * testsuite/copy_test.cc: New file.
10815         * testsuite/copy_test_1.cc: New file.
10816         * testsuite/copy_test_2.cc: New file.
10817         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10818         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10819         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10820         (copy_test_1_pic.o, copy_test_1.so): New targets.
10821         (copy_test_2_pic.o, copy_test_2.so): New targets.
10822         * testsuite/Makefile.in: Rebuild.
10823
10824         * script-sections.cc (Script_sections::place_orphan): Initialize
10825         local variable exact.
10826
10827 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10828
10829         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10830
10831 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10832             David S. Miller  <davem@davemloft.net>
10833
10834         * powerpc.cc: New file.
10835         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10836         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10837         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10838         * Makefile.in: Rebuild.
10839
10840 2008-06-09  Ian Lance Taylor  <iant@google.com>
10841
10842         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10843         <exception>.
10844         (throwing, orig_terminate): New static variables.
10845         (terminate_handler): New static function.
10846         (t2): Set terminate handler.
10847
10848 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10849
10850         PR 6584
10851         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10852         alignment.
10853
10854 2008-05-30  Cary Coutant  <ccoutant@google.com>
10855
10856         * archive.cc (Archive::include_all_members) Correct to step
10857         over symbol table and extended name table in thin archives.
10858
10859 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10860
10861         PR 6407
10862         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10863         calculation.
10864
10865 2008-05-28  Caleb Howe  <cshowe@google.com>
10866
10867         * reduced_debug_output.cc: New file.
10868         * reduced_debug_output.h: New file.
10869         * options.h (class General_options): Add --strip-debug-non-line.
10870         * options.cc (General_options::finalize): Add strip_debug_non_line
10871         to the strip heirarchy.
10872         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10873         fields.
10874         * layout.cc: Include "reduced_debug_output.h".
10875         (Layout::Layout): Initialize new fields.
10876         (line_only_debug_sections): New static array.
10877         (is_lines_only_debug_sections): New static inline function.
10878         (Layout::include_section): Handle --strip-debug-non-line.
10879         (Layout::make_output_section): If --strip-debug-non-line, build
10880         new output sections for .debug_abbrev and .debug_info.
10881         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10882         gold.  Warn about possible overflow.
10883         (read_signed_LEB_128): Likewise.
10884         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10885         (read_signed_LEB_128): Declare.
10886         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10887         (HFILES): Add reduced_debug_output.h.
10888         * Makefile.in: Rebuild.
10889
10890 2008-05-21  Ian Lance Taylor  <iant@google.com>
10891
10892         * mapfile.cc: New file.
10893         * mapfile.h: New file.
10894         * options.h (class General_options): Add -M/--print-map and -Map.
10895         * options.cc (General_options::finalize): Make -M equivalent to
10896         -Map -.
10897         * main.cc: Include <cstdio> and "mapfile.h".
10898         (main): Open mapfile if requested.
10899         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10900         constructor.  Change caller.
10901         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10902         (queue_middle_tasks): Likewise.
10903         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10904         declarations.
10905         * archive.cc: Include "mapfile.h".
10906         (Archive::add_symbols): Add mapfile parameter.  Change all
10907         callers.  Pass mapfile, symbol, and reason to include_member.
10908         (Archive::include_all_members): Add mapfile parameter.  Change all
10909         callers.
10910         (Archive::include_member): Add mapfile, sym, and why parameters.
10911         Change all callers.  Report inclusion to map file.
10912         * archive.h: Include "fileread.h".
10913         (class Archive): Update declarations.
10914         (Archive::file): New const method.
10915         (class Add_archive_symbols): Add mapfile_ field.  Update
10916         constructor.  Change all callers.
10917         * readsyms.h (class Read_symbols): Likewise.
10918         (class Finish_group): Likewise.
10919         (class Read_script): Likewise.
10920         * common.cc: Include "mapfile.h".
10921         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10922         all callers.
10923         (Symbol_table::do_allocate_commons): Likewise.
10924         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10925         symbol allocation to mapfile.
10926         * common.h (class Allocate_commons_task): Add mapfile_ field.
10927         Update constructor.  Change all callers.
10928         * symtab.h (class Symbol_table): Update declarations.
10929         * layout.cc: Include "mapfile.h".
10930         (Layout_task_runner::run): Print information to mapfile.
10931         (Layout::create_gold_note): Change Output_data_fixed_space to
10932         Output_data_zero_fill.
10933         (Layout::create_build_id): Likewise.
10934         (Layout::print_to_mapfile): New function.
10935         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10936         constructor.  Change caller.
10937         (class Layout): Declare print_to_mapfile.
10938         * output.cc (Output_section::Input_section::print_to_mapfile): New
10939         function.
10940         (Output_section::add_input_section): If producing a map, always
10941         add to input_sections_ list.
10942         (Output_section::do_print_to_mapfile): New function.
10943         (Output_segment::print_sections_to_mapfile): New function.
10944         (Output_segment::print_section_list_to_mapfile): New function.
10945         * output.h: Include "mapfile.h".
10946         (Output_data::print_to_mapfile): New function.
10947         (Output_data::do_print_to_mapfile): New virtual function.
10948         (Output_segment_headers::do_print_to_mapfile): New function.
10949         (Output_file_header::do_print_to_mapfile): New function.
10950         (Output_data_const::do_print_to_mapfile): New function.
10951         (class Output_data_const_buffer): Add map_name_ field.  Update
10952         constructor.  Change all callers.  Add do_print_to_mapfile
10953         function.
10954         (class Output_data_fixed_space): Likewise.
10955         (class Output_data_space): Likewise.
10956         (class Output_data_zero_fill): New class.
10957         (Output_data_strtab::do_print_to_mapfile): New function.
10958         (Output_data_reloc_base::do_print_to_mapfile): New function.
10959         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10960         (Output_data_group::do_print_to_mapfile): New function.
10961         (Output_data_got::do_print_to_mapfile): New function.
10962         (Output_data_dynamic::do_print_to_mapfile): New function.
10963         (Output_symtab_xindex::do_print_to_mapfile): New function.
10964         (class Output_section): Declare do_print_to_mapflie.  Declare
10965         print_to_mapfile in Input_section.
10966         (class Output_segment): Declare new functions.
10967         * object.h (Sized_relobj::symbol_count): New function.
10968         * script-sections.cc
10969         (Output_section_element_dot_assignment::set_section_addresses):
10970         Change Output_data_fixed_space to Output_data_zero_fill.
10971         (Output_data_expression::do_print_to_mapfile): New function.
10972         * script.cc (read_input_script): Add mapfile parameter.  Change
10973         all callers.
10974         * script.h (read_input_script): Update declaration.
10975         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10976         (Eh_frame::do_print_to_mapfile): New function.
10977         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10978         (Output_merge_string::do_print_to_mapfile): New function.
10979         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10980         function.
10981         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10982         function.
10983         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10984         function.
10985         * Makefile.am (CCFILES): Add mapfile.cc.
10986         (HFILES): Add mapfile.h.
10987         * Makefile.in: Rebuild.
10988
10989 2008-05-19  Ian Lance Taylor  <iant@google.com>
10990
10991         * options.h (class General_options): Add -z relro.
10992         * layout.cc (Layout::Layout): Initialize relro_segment_.
10993         (Layout::add_output_section_data): Return the output section.
10994         (Layout::make_output_section): Rcognize relro sections and mark
10995         them appropriately.
10996         (Layout::attach_allocated_section_to_segment): Put relro sections
10997         in a PT_GNU_RELRO segment.
10998         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10999         section as relro.
11000         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11001         PT_TLS segments.
11002         (Layout::linkonce_mapping): Map d.rel.ro.local to
11003         .data.rel.ro.local.
11004         (Layout::output_section_name): Us .data.rel.ro.local for any
11005         section which begins with that.
11006         * layout.h (class Layout): Update add_output_section_data
11007         declaration.  Add relro_segment_ field.
11008         * output.cc (Output_section::Output_section): Initialize is_relro_
11009         and is_relro_local_ fields.
11010         (Output_segment::add_output_section): Group relro sections.
11011         (Output_segment::is_first_section_relro): New function.
11012         (Output_segment::maximum_alignment): If there is a relro section,
11013         align the segment to the common page size.
11014         (Output_segment::set_section_addresses): Track whether we are
11015         looking at relro sections.  If the last section is a relro
11016         section, align to the common page size.
11017         (Output_segment::set_section_list_addresses): Add in_relro
11018         parameter.  Change all callers.  Align to the page size when
11019         moving from relro to non-relro section.
11020         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11021         segment.
11022         * output.h (class Output_section): Add is_relro_ and
11023         is_relro_local_ fields.
11024         (Output_section::is_relro): New function.
11025         (Output_section::set_is_relro): New function.
11026         (Output_section::is_relro_local): New function.
11027         (Output_section::set_is_relro_local): New function.
11028         (class Output_segment): Update declarations.
11029         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11030         * sparc.cc (Target_sparc::got_section): Likewise.
11031         * x86_64.cc (Target_x86_64::got_section): Likewise.
11032         * testsuite/relro_test_main.cc: New file.
11033         * testsuite/relro_test.cc: New file.
11034         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11035         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11036         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11037         (relro_test.so, relro_test_pic.o): New targets.
11038         * testsuite/Makefile.in: Rebuild.
11039
11040 2008-05-16  Ian Lance Taylor  <iant@google.com>
11041
11042         * output.cc (Output_segment::add_output_section): Remove front
11043         parameter.
11044         * output.h (class Output_segment): Remove
11045         add_initial_output_section and overloaded add_output_section.
11046         Update declaration of remaining add_output_section.
11047         * layout.cc (Layout::create_interp): Call add_output_section
11048         rather than add_initial_output_section.
11049         (Layout::finish_dynamic_section): Likewise.
11050
11051         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11052         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11053         know the dynamic type.
11054         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11055         field.  Initialize it in constructor.
11056         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11057         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11058         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11059         reloc.
11060
11061         * output.cc (Output_reloc::get_address): Change return type to
11062         Elf_Addr.
11063         * output.h (class Output_reloc): Update get_address declaration.
11064         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11065         for section addresses.
11066
11067 2008-05-09  Ian Lance Taylor  <iant@google.com>
11068
11069         PR 6493
11070         * gold.cc (gold_nomem): Use return value of write.
11071
11072 2008-05-08  Ian Lance Taylor  <iant@google.com>
11073
11074         * symtab.c (Symbol::init_base_output_data): Add version
11075         parameter.  Change all callers.
11076         (Symbol::init_base_output_segment): Likewise.
11077         (Symbol::init_base_constant): Likewise.
11078         (Symbol::init_base_undefined): Likewise.
11079         (Sized_symbol::init_output_data): Likewise.
11080         (Sized_symbol::init_output_segment): Likewise.
11081         (Sized_symbol::init_constant): Likewise.
11082         (Sized_symbol::init_undefined): Likewise.
11083         (Symbol_table::do_define_in_output_data): If the new symbol has a
11084         version, mark it as the default.
11085         (Symbol_table::do_define_in_output_segment): Likewise.
11086         (Symbol_table::do_define_as_constant): Likewise.
11087         * symtab.h (class Symbol): Update declarations.
11088         (class Sized_symbol): Likewise.
11089         * resolve.cc (Symbol::override_version): New function.
11090         (Symbol::override_base): Call override_version.
11091         (Symbol::override_base_with_special): Likewise.
11092         * testsuite/ver_script_8.script: New file.
11093         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11094         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11095         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11096         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11097
11098 2008-05-06  Ian Lance Taylor  <iant@google.com>
11099
11100         PR 6049
11101         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11102         functions.
11103         (class General_options): Remove existing --undefined, and add
11104         --no-undefined instead.  Add new --undefined as synonym for -u.
11105         * archive.cc (Archive::add_symbols): Check whether symbol was
11106         named with -u.
11107         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11108         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11109         all uses.  Add IS_UNDEFINED.  Update declarations to split
11110         different versions of init_base.  Declare init_base_undefined.
11111         (Symbol::is_defined): Handle IS_UNDEFINED.
11112         (Symbol::is_undefined): Likewise.
11113         (Symbol::is_weak_undefined): Call is_undefined.
11114         (Symbol::is_absolute): Handle IS_CONSTANT.
11115         (class Sized_symbol): Update declarations to split different
11116         versions of init.  Declare init_undefined.
11117         (class Symbol_table): Declare new functions.
11118         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11119         Change all callers.
11120         (Symbol::init_base_output_data): Likewise.
11121         (Symbol::init_base_output_segment): Likewise.
11122         (Symbol::init_base_constant): Likewise.
11123         (Symbol::init_base_undefined): New function.
11124         (Sized_symbol::init_object): Rename from init.  Change all
11125         callers.
11126         (Sized_symbol::init_output_data): Likewise.
11127         (Sized_symbol::init_output_segment): Likewise.
11128         (Sized_symbol::init_constant): Likewise.
11129         (Sized_symbol::init_undefined): New function.
11130         (Symbol_table::add_undefined_symbols_from_command_line): New
11131         function.
11132         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11133         function.
11134         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11135         (Symbol::output_section): Likewise.
11136         (Symbol::set_output_section): Likewise.
11137         (Symbol_table::sized_finalize_symbol): Likewise.
11138         (Symbol_table::sized_write_globals): Likewise.
11139         * resolve.cc (Symbol_table::should_override): Likewise.
11140         (Symbol::override_base_with_special): Likewise.
11141
11142         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11143         symbol, change it to have default visibility.
11144         * testsuite/protected_1.cc: New file.
11145         * testsuite/protected_2.cc: New file.
11146         * testsuite/protected_3.cc: New file.
11147         * testsuite/protected_main_1.cc: New file.
11148         * testsuite/protected_main_2.cc: New file.
11149         * testsuite/protected_main_3.cc: New file.
11150         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11151         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11152         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11153         (protected_1.so): New target.
11154         (protected_1_pic.o, protected_2_pic.o): New targets.
11155         (protected_3_pic.o): New target.
11156         (check_PROGRAMS): Add protected_2.
11157         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11158         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11159         * testsuite/Makefile.in: Rebuild.
11160
11161         * options.h (DEFINE_var): Add set_user_set_##varname__.
11162         (DEFINE_bool_alias): New macro.
11163         (class General_options): Define -Bstatic using DEFINE_bool_alias
11164         rather than DEFINE_special.  Add --undefined as an alias for -z
11165         defs.
11166         * options.cc (General_options::parse_Bstatic): Remove.
11167
11168         * options.h (class General_options): Add --fatal-warnings.
11169         * main.cc (main): Implement --fatal-warnings.
11170         * errors.h (Errors::warning_count): New function.
11171
11172         * options.h (class General_options): Add -Bsymbolic-functions.
11173         * symtab.h (Symbol::is_preemptible): Check for
11174         -Bsymbolic-functions.
11175
11176 2008-05-05  Ian Lance Taylor  <iant@google.com>
11177
11178         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11179         as noVARNAME rather than no-VARNAME.
11180         (class General_options): Add option -z combreloc.
11181         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11182         get_address.
11183         (Output_reloc::sort_before) [SHT_REL]: New function.
11184         (Output_reloc::sort_before) [SHT_RELA]: New function.
11185         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11186         Sort_relocs_comparison.
11187         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11188         parameter.  Change all callers.
11189         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11190         sort_relocs parameter.  Change all callers.
11191         * output.cc (Output_reloc::get_address): New function, broken out
11192         of write_rel.
11193         (Output_reloc::write_rel): Call it.
11194         (Output_reloc::compare): New function.
11195         (Output_data_reloc_base::do_write): Optionally sort relocs.
11196
11197         * configure.ac: If targ_extra_obj is set, link it in.
11198         * configure.tgt: Initialize all variables.
11199         (x86_64*): Set targ_extra_obj and targ_extra_size.
11200         * configure: Rebuild.
11201
11202         * object.cc (Sized_relobj::include_section_group): Adjust section
11203         indexes read from group data.  Build vector to pass to
11204         layout_group.
11205         * layout.cc (Layout::layout_group): Add flags and shndxes
11206         parameters.  Remove contents parameter.  Change caller.  Update
11207         explicit instantiations.
11208         * layout.h (class Layout): Update layout_group declaration.
11209         * output.cc (Output_data_group::Output_data_group): Add flags and
11210         input_shndxes parameters.  Remove contents parameter.  Change
11211         caller.
11212         (Output_data_group::do_write): Change input_sections_ to
11213         input_shndxes_.
11214         * output.h (class Output_data_group): Update constructor
11215         declaration.  Rename input_sections_ to input_shndxes_.
11216         * testsuite/many_sections_test.cc: Add template.
11217
11218 2008-04-30  Cary Coutant  <ccoutant@google.com>
11219
11220         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11221
11222         * layout.cc (Layout::include_section): Refactored check for debug
11223         info section.
11224         (Layout::add_comdat): Add new parameters.  Change type
11225         of signature parameter.  Add object and shndx to signatures table.
11226         (Layout::find_kept_object): New function.
11227         * layout.h: Include <cstring>.
11228         (Layout::is_debug_info_section): New function.
11229         (Layout::add_comdat): Add new parameters.
11230         (Layout::find_kept_object): New function.
11231         (Layout::Kept_section): New struct.
11232         (Layout::Signatures): Change type of map range.
11233         * object.cc (Relobj::output_section_address): New function.
11234         (Sized_relobj::include_section_group): Add new parameters.  Change
11235         calls to Layout::add_comdat.  Change to build table of kept comdat
11236         groups and table mapping discarded sections to kept sections.
11237         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11238         (Sized_relobj::do_layout): Change calls to include_section_group and
11239         include_linkonce_section.
11240         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11241         value to zero when section is discarded.
11242         (Sized_relobj::map_to_kept_section): New function.
11243         * object.h (Relobj::output_section_address): New function.
11244         (Relobj::Comdat_group): New type.
11245         (Relobj::find_comdat_group): New function.
11246         (Relobj::Comdat_group_table): New type.
11247         (Relobj::Kept_comdat_section): New type.
11248         (Relobj::Kept_comdat_section_table): New type.
11249         (Relobj::add_comdat_group): New function.
11250         (Relobj::set_kept_comdat_section): New function.
11251         (Relobj::get_kept_comdat_section): New function.
11252         (Relobj::comdat_groups_): New field.
11253         (Relobj::kept_comdat_sections_): New field.
11254         (Symbol_value::input_value): Update comment.
11255         (Sized_relobj::map_to_kept_section) New function.
11256         (Sized_relobj::include_linkonce_section): Add new parameter.
11257         * target-reloc.h (Comdat_behavior): New type.
11258         (get_comdat_behavior): New function.
11259         (relocate_section): Add code to map a discarded section to the
11260         corresponding kept section when applying a relocation.
11261
11262 2008-04-30  Craig Silverstein  <csilvers@google.com>
11263
11264         * dwarf_reader.cc (next_generation_count): New static var.
11265         (Addr2line_cache_entry): New struct.
11266         (addr2line_cache): New static var.
11267         (Dwarf_line_info::one_addr2line): Added caching.
11268         (Dwarf_line_info::clear_addr2line_cache): New function.
11269         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11270         cache-size parameter.
11271         (Dwarf_line_info::one_addr2line_cache): New function.
11272         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11273         new cache-size argument to one_addr2line(), and clear cache.
11274
11275 2008-04-28  Cary Coutant  <ccoutant@google.com>
11276
11277         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11278         R_386_PC8 relocations.
11279
11280 2008-04-23  Ian Lance Taylor  <iant@google.com>
11281
11282         * object.cc (Sized_relobj::include_section_group): Check for
11283         invalid section group.
11284
11285         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11286         header size.
11287
11288         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11289         than read for file header.
11290         * archive.cc (Archive::include_member): Likewise.
11291
11292 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11293
11294         * aclocal.m4: Regenerate.
11295         * configure: Regenerate.
11296
11297 2008-04-19  Ian Lance Taylor  <iant@google.com>
11298
11299         * version.cc (version_string): Bump to 1.6.
11300
11301         * testsuite/Makefile.am (many_sections_r_test): New target.
11302         (many_sections_r_test_SOURCES): Remove.
11303         (many_sections_r_test_DEPENDENCIES): Remove.
11304         (many_sections_r_test_LDFLAGS): Remove.
11305         (many_sections_r_test_LDADD): Remove.
11306
11307         * object.cc (Sized_relobj::do_add_symbols): Always pass
11308         local_symbol_count_ to add_from_relobj.
11309
11310         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11311         every thousand variables.
11312         * testsuite/Makefile.in: Rebuild.
11313
11314         * object.cc (Xindex::initialize_symtab_xindex): New function.
11315         (Xindex::read_symtab_xindex): New function.
11316         (Xindex::sym_xindex_to_shndx): New function.
11317         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11318         available.
11319         (Sized_relobj::do_initialize_xindex): New function.
11320         (Sized_relobj::do_read_symbols): Adjust section links.
11321         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11322         parameter.  Change all callers.
11323         (Sized_relobj::include_section_group): Adjust section links and
11324         symbol section indexes.
11325         (Sized_relobj::do_layout): Adjust section links.
11326         (Sized_relobj::do_count_local_symbols): Adjust section links and
11327         symbol section indexes.
11328         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11329         ordinary and special symbols.
11330         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11331         dynsym_xindex parameters.  Change all callers.  Adjust section
11332         links.  Use SHN_XINDEX when needed.
11333         (Sized_relobj::get_symbol_location_info): Adjust section links.
11334         Don't get fooled by special symbols.
11335         * object.h (class Xindex): Define.
11336         (class Object): Add xindex_ parameter.  Declare virtual functoin
11337         do_initialize_xindex.
11338         (Object::adjust_sym_shndx): New function.
11339         (Object::set_xindex): New protected function.
11340         (class Symbol_value): Add is_ordinary_shndx_ field.
11341         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11342         (Symbol_value::value): Assert ordinary section.
11343         (Symbol_value::initialize_input_to_output_map): Likewise.
11344         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11345         Change all callers.
11346         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11347         all callers.
11348         (class Sized_relobj): Update declarations.
11349         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11350         parameter.  Change all callers.
11351         (Sized_relobj::adjust_shndx): New function.
11352         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11353         field.
11354         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11355         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11356         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11357         (Sized_dynobj::read_dynsym_section): Adjust section links.
11358         (Sized_dynobj::read_dynamic): Likewise.
11359         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11360         section links.
11361         (Sized_dynobj::do_initialize_xindex): New function.
11362         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11363         do_initialize_xindex.
11364         (Sized_dynobj::adjust_shndx): New function.
11365         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11366         dynsym_xindex_ fields.
11367         (Layout::finalize): Add a call to set_section_indexes before
11368         creating the symtab sections.
11369         (Layout::set_section_indexes): Don't do anything if the section
11370         already has a section index.
11371         (Layout::create_symtab_sections): Add shnum parameter.  Change
11372         caller.  Create .symtab_shndx section if needed.
11373         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11374         caller.
11375         (Layout::allocated_output_section_count): New function.
11376         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11377         needed.
11378         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11379         fields.  Update declarations.
11380         (Layout::symtab_xindex): New function.
11381         (Layout::dynsym_xindex): New function.
11382         (class Write_symbols_task): Add layout_ field.
11383         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11384         Change caller.
11385         * output.cc (Output_section_headers::Output_section_headers): Add
11386         shstrtab_section parameter.  Change all callers.
11387         (Output_section_headers::do_sized_write): Store overflow values
11388         for section count and section string table section index in
11389         section header zero.
11390         (Output_file_header::do_sized_write): Check for overflow of
11391         section count and section string table section index.
11392         (Output_symtab_xindex::do_write): New function.
11393         (Output_symtab_xindex::endian_do_write): New function.
11394         * output.h (class Output_section_headers): Add shstrtab_section_.
11395         Update declarations.
11396         (class Output_symtab_xindex): Define.
11397         (Output_section::has_out_shndx): New function.
11398         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11399         field.
11400         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11401         Change all callers.
11402         (Sized_symbol::init): Likewise.
11403         (Symbol::output_section): Check for ordinary symbol.
11404         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11405         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11406         callers.
11407         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11408         Change all callers.  Simplify handling of symbols from sections
11409         not included in the link.
11410         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11411         distinction.
11412         (Weak_alias_sorter::operator()): Assert that symbols are
11413         ordinary.
11414         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11415         distinction.
11416         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11417         parameters.  Change all callers.
11418         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11419         symbol distinction.  Use SHN_XINDEX when needed.
11420         (Symbol_table::write_section_symbol): Add symtab_xindex
11421         parameter.  Change all callers.
11422         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11423         SHN_XINDEX when needed.
11424         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11425         declarations.
11426         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11427         (Symbol::is_defined): Check is_ordinary.
11428         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11429         (Symbol::is_absolute, Symbol::is_common): Likewise.
11430         (class Sized_symbol): Update declarations.
11431         (class Symbol_table): Update declarations.
11432         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11433         parameters.  Change all callers.
11434         (Sized_symbol::override): Likewise.
11435         (Symbol_table::override): Likewise.
11436         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11437         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11438         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11439         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11440         to be in an ordinary section.
11441         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11442         object and is_ordinary parameters.  Change all callers.
11443         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11444         Change all callers.  Don't add undefined or non-ordinary symbols
11445         to reloc_map_.
11446         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11447         Change all callers.
11448         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11449         declarations.
11450         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11451         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11452         (Sized_relobj::relocate_sections): Likewise.
11453         * target-reloc.h (scan_relocs): Adjust section symbol index.
11454         (scan_relocatable_relocs): Likewise.
11455         * i386.cc (Scan::local): Check for ordinary symbols.
11456         * sparc.cc (Scan::local): Likewise.
11457         * x86_64.cc (Scan::local): Likewise.
11458         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11459         to symbol_section_and_value.
11460         * testsuite/many_sections_test.cc: New file.
11461         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11462         (check_PROGRAMS): Add many_sections_test.
11463         (many_sections_test_SOURCES): Define.
11464         (many_sections_test_DEPENDENCIES): Define.
11465         (many_sections_test_LDFLAGS): Define.
11466         (BUILT_SOURCES): Add many_sections_define.h.
11467         (many_sections_define.h): New target.
11468         (BUILT_SOURCES): Add many_sections_check.h.
11469         (many_sections_check.h): New target.
11470         (check_PROGRAMS): Add many_sections_r_test.
11471         (many_sections_r_test_SOURCES): Define.
11472         (many_sections_r_test_DEPENDENCIES): Define.
11473         (many_sections_r_test_LDFLAGS): Define.
11474         (many_sections_r_test_LDADD): Define.
11475         (many_sections_r_test.o): New target.
11476         * testsuite/Makefile.in: Rebuild.
11477
11478 2008-04-17  Cary Coutant  <ccoutant@google.com>
11479
11480         * errors.cc (Errors::info): New function.
11481         (gold_info): New function.
11482         * errors.h (Errors::info): New function.
11483         * gold.h (gold_info): New function.
11484         * object.cc (Input_objects::add_object): Print trace output.
11485         * options.cc (options::parse_set): New function.
11486         (General_options::parse_wrap): Deleted.
11487         (General_options::General_options): Deleted initializer.
11488         * options.h (options::String_set): New typedef.
11489         (options::parse_set): New function.
11490         (DEFINE_set): New macro.
11491         (General_options::wrap): Changed to use DEFINE_set. Changed
11492         callers of any_wrap_symbols and is_wrap_symbol.
11493         (General_options::trace, General_options::trace_symbol):
11494         New options.
11495         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11496         (General_options::wrap_symbols_): Deleted.
11497         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11498
11499 2008-04-17  David S. Miller  <davem@davemloft.net>
11500
11501         * options.cc (General_options::parse_V): New function.
11502         * options.h: Add entries for -V and -Qy.
11503
11504 2008-04-17  Ian Lance Taylor  <iant@google.com>
11505
11506         * common.cc (Symbol_table::allocate_commons): Remove options
11507         parameter.  Change caller.
11508         (Symbol_table::do_allocate_commons): Remove options parameter.
11509         Change caller.  Just call do_allocate_commons_list twice.
11510         (Symbol_table::do_allocate_commons_list): New function, broken out
11511         of do_allocate_commons.
11512         * common.h (class Allocate_commons_task): Remove options_ field.
11513         Update constructor.
11514         * symtab.cc (Symbol_table::Symbol_table): Initialize
11515         tls_commons_.
11516         (Symbol_table::add_from_object): Put TLS common symbols on
11517         tls_commons_ list.
11518         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11519         which are IN_OUTPUT_DATA.
11520         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11521         allocate_commons and do_allocate_commons declarations.  Declare
11522         do_allocate_commons_list.
11523         * gold.cc (queue_middle_tasks): Update creation of
11524         Allocate_commons_task to not pass options.
11525         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11526         (TLS_TEST_C_FLAGS): New variable.
11527         (tls_test_c_pic.o): New target.
11528         (tls_test_shared.so): Link in tls_test_c_pic.o.
11529         (tls_test_c_pic_ie.o): New target.
11530         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11531         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11532         (tls_test_c.o): New target.
11533         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11534         (tls_pic_test_LDADD): Likewise.
11535         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11536         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11537         (tls_test_c_gnu2.o): New target.
11538         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11539         tls_test_c_gnu2.o.
11540         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11541         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11542         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11543         * testsuite/tls_test.cc: Include "config.h".
11544         (t_last): Call t11_last.
11545         * testsuite/tls_test.h (t11, t11_last): Declare.
11546         * testsuite/tls_test_c.c: New file.
11547         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11548         * configure.ac: Check for OpenMP support.
11549         * configure, config.in, Makefile.in: Rebuild.
11550         * testsuite/Makefile.in: Rebuild.
11551
11552 2008-04-16  Cary Coutant  <ccoutant@google.com>
11553
11554         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11555         (Target_i386::tls_base_symbol_defined_): New field.
11556         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11557         (Target_i386::Scan::global): Likewise.
11558         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11559         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11560         (Target_x86_64::tls_base_symbol_defined_): New field.
11561         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11562         (Target_x86_64::Scan::global): Likewise.
11563
11564 2008-04-16  Cary Coutant  <ccoutant@google.com>
11565
11566         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11567         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11568         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11569         building shared libraries.
11570         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11571         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11572         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11573         * testsuite/Makefile.in: Rebuild.
11574         * testsuite/weak_undef.h: New file.
11575         * testsuite/weak_undef_file1.cc: Add extra test cases.
11576         * testsuite/weak_undef_file2.cc: Likewise.
11577         * testsuite/weak_undef_test.cc: Likewise.
11578
11579 2008-04-16  David S. Miller  <davem@davemloft.net>
11580
11581         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11582         Add issued_non_pic_error_ field.  Declare check_non_pic.
11583         (Target_sparc::Scan::check_non_pic): New function.
11584         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11585         (Target_sparc::Scan::global): Likewise.
11586
11587         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11588         * configure: Rebuild.
11589
11590         * options.h (DEFINE_enable): New macro.
11591         (new_dtags): New enable option.
11592         (initfirst, interpose, loadfltr, nodefaultlib,
11593         nodelete, nodlopen, nodump): New -z options.
11594         * layout.cc (Layout:finish_dynamic_section): If new
11595         dtags enabled, emit DT_RUNPATH.  Also, emit a
11596         DT_FLAGS_1 containing any specified -z flags.
11597
11598 2008-04-16  Ian Lance Taylor  <iant@google.com>
11599
11600         * copy-relocs.cc: New file.
11601         * copy-relocs.h: New file.
11602         * reloc.cc: Remove Copy_relocs code.
11603         * reloc.h: Likewise.
11604         * reloc-types.h (struct Reloc_types) [both versions]: Add
11605         get_reloc_addend_noerror.
11606         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11607         variants of add_global which take an addend which must be zero.
11608         * i386.cc: Include "copy-relocs.h".
11609         (class Target_i386): Change type of copy_relocs_ to variable,
11610         update initializer.
11611         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11612         Change all callers.
11613         (Target_i386::do_finalize_sections): Change handling of
11614         copy_relocs_.
11615         * sparc.cc: Include "copy-relocs.h".
11616         (class Target_sparc): Change type of copy_relocs_ to variable,
11617         update initializer.
11618         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11619         Change all callers.
11620         (Target_sparc::do_finalize_sections): Change handling of
11621         copy_relocs_.
11622         * x86_64.cc: Include "copy-relocs.h".
11623         (class Target_x86_64): Change type of copy_relocs_ to variable,
11624         update initializer.
11625         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11626         class.  Change all callers.
11627         (Target_x86_64::do_finalize_sections): Change handling of
11628         copy_relocs_.
11629         * Makefile.am (CCFILES): Add copy-relocs.cc.
11630         (HFILES): Add copy-relocs.h.
11631
11632         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11633
11634         * testsuite/script_test_4.sh: Permit leading zeroes.
11635
11636 2008-04-15  Ian Lance Taylor  <iant@google.com>
11637
11638         * script-sections.cc (Script_sections::create_segments): Use
11639         header_size_adjustment even when there is enough room for the
11640         headers.
11641         * testsuite/script_test_4.sh: New file.
11642         * testsuite/script_test_4.t: New file.
11643         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11644         (check_DATA): Add script_test_4.stdout.
11645         (MOSTLYCLEANFILES): Likewise.
11646         (script_test_4): New target.
11647         (script_test_4.stdout): New target.
11648         * testsuite/Makefile.in: Rebuild.
11649
11650         * sparc.cc: Add definitions for Output_data_plt_sparc class
11651         constants.
11652
11653 2008-04-14  David S. Miller  <davem@davemloft.net>
11654
11655         * sparc.cc: New file.
11656         * Makefile.am (TARGETSOURCES): Add sparc.cc
11657         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11658         * configure.tgt: Document targ_extra_size and
11659         targ_extra_big_endian.  Add entries for sparc-* and
11660         sparc64-*.
11661         * configure.ac: Handle targ_extra_size and
11662         targ_extra_big_endian.
11663         * Makefile.in: Rebuild.
11664         * configure: Likewise.
11665         * po/POTFILES.in: Likewise.
11666         * po/gold.pot: Likewise.
11667
11668 2008-04-14  Ian Lance Taylor  <iant@google.com>
11669
11670         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11671         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11672         in the name/type/flags to section mapping.  Don't call
11673         allocate_output_section.
11674         (Layout::choose_output_section): Change parameter from adjust_name
11675         to is_input_section.  Don't permit input sections after sections
11676         are attached to segments.  Don't call allocate_output_section.
11677         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11678         not write_enable_output_section.
11679         (Layout::make_output_section): Don't push to
11680         unattached_section_list_ nor call attach_to_segment.  Call
11681         attach_section_to_segment if sections are attached.
11682         (Layout::attach_sections_to_segments): New function.
11683         (Layout::attach_section_to_segment): New function.
11684         (Layout::attach_allocated_section_to_segment): Rename from
11685         attach_to_segment.  Remove flags parameter.
11686         (Layout::allocate_output_section): Remove function.
11687         (Layout::write_enable_output_section): Remove function.
11688         * layout.h (class Layout): Update for above changes.  Add new
11689         field sections_are_attached_.
11690         * output.h (Output_section::update_flags_for_input_section): New
11691         function.
11692         * output.cc (Output_section::add_input_section): Call
11693         update_flags_for_input_section.
11694         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11695
11696 2008-04-11  Cary Coutant  <ccoutant@google.com>
11697
11698         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11699         thought unnecessary.
11700         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11701
11702 2008-04-11  Ian Lance Taylor  <iant@google.com>
11703
11704         * output.h (class Output_section_data): Remove inline definition
11705         of set_addralign.
11706         * output.cc (Output_section_data::set_addralign): New function.
11707
11708 2008-04-11  Cary Coutant  <ccoutant@google.com>
11709
11710         Add support for TLS descriptors for i386 and x86_64.
11711         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11712         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11713         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11714         GOT_TYPE_TLS_DESC.
11715         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11716         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11717         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11718         relocations.
11719         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11720         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11721         Fix problem with initial-exec relocations.
11722         (Target_i386::Relocate::relocate_tls): Likewise.
11723         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11724         relaxation.
11725         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11726         support for section-plus-offset dynamic table entries.
11727         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11728         (Output_data_dynamic::Dynamic_entry): Add support for
11729         section-plus-offset dynamic table entries.
11730         (Output_data_dynamic::Classification): Likewise.
11731         (Output_data_dynamic::classification_): Renamed offset_.
11732         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11733         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11734         (Target_x86_64::make_plt_section): New function.
11735         (Target_x86_64::reserve_tlsdesc_entries): New function.
11736         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11737         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11738         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11739         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11740         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11741         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11742         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11743         add extra PLT entry for TLS descriptors.
11744         (Output_data_plt_x86_64::got_): New field.
11745         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11746         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11747         fields.
11748         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11749         descriptors.
11750         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11751         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11752         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11753         R_386_TLS_DESC_CALL relocations.
11754         (Target_x86_64::Scan::global): Likewise.
11755         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11756         for TLS descriptors.
11757         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11758         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11759         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11760         GD-to-IE relaxation.
11761         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11762         and TLS_DESCRIPTORS.
11763         * Makefile.in: Rebuild.
11764         * configure: Rebuild.
11765         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11766         (tls_test_shared2.so): New target.
11767         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11768         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11769         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11770         (tls_shared_gd_to_ie_test_LDADD): New variable.
11771         (tls_shared_gnu2_gd_to_ie_test): New target.
11772         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11773         New targets.
11774         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11775         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11776         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11777         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11778         (tls_shared_gnu2_test): New target.
11779         (tls_test_gnu2_shared.so): New target.
11780         (tls_shared_gnu2_test_SOURCES): New variable.
11781         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11782         (tls_shared_gnu2_test_LDFLAGS): New variable.
11783         (tls_shared_gnu2_test_LDADD): New variable.
11784         * testsuite/Makefile.in: Rebuild.
11785         * testsuite/Makefile.
11786
11787 2008-04-11  Ian Lance Taylor  <iant@google.com>
11788
11789         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11790         justsyms.t.
11791         * testsuite/Makefile.in: Rebuild.
11792
11793         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11794         long.
11795         * testsuite/script_test_2.cc (main): Adjust test.
11796
11797 2008-04-11  David S. Miller  <davem@davemloft.net>
11798             Ian Lance Taylor  <iant@google.com>
11799
11800         * options.h (General_options): Add entries for '-Y' and
11801         '-relax'.
11802         * options.cc (General_options:finalize): If -Y was used, add those
11803         entries to the library path instead of the default "/lib" and
11804         "/usr/lib".
11805
11806 2008-04-11  David S. Miller  <davem@davemloft.net>
11807
11808         * testsuite/justsyms.t: Start at 0x100.
11809         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11810         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11811         long.
11812         * testsuite/script_test_2.cc: Adjust string and section length
11813         checks.
11814
11815 2008-04-09  Ian Lance Taylor  <iant@google.com>
11816
11817         PR gold/5996
11818         * script-sections.cc (Sections_element::allocate_to_segment): Add
11819         orphan parameter.
11820         (Output_section_definition::allocate_to_segment): Likewise.
11821         (Orphan_output_section::allocate_to_segment): Likewise.
11822         (Script_sections::attach_sections_using_phdrs_clause): Don't
11823         propagate non-PT_LOAD segments to orphan sections.
11824         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11825         readelf rather than objdump.
11826         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11827         .interp section and PT_INTERP segment are the same size.
11828         * testsuite/Makefile.in: Rebuild.
11829
11830         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11831         aliases for symbols defined in the same object.
11832         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11833         (weak_alias_test_SOURCES): New variable.
11834         (weak_alias_test_DEPENDENCIES): New variable.
11835         (weak_alias_test_LDFLAGS): New variable.
11836         (weak_alias_test_LDADD): New variable.
11837         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11838         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11839         (weak_alias_test_3.o): New target.
11840         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11841         * testsuite/weak_alias_test_main.cc: New file.
11842         * testsuite/weak_alias_test_1.cc: New file.
11843         * testsuite/weak_alias_test_2.cc: New file.
11844         * testsuite/weak_alias_test_3.cc: New file.
11845
11846 2008-04-08  Ian Lance Taylor  <iant@google.com>
11847
11848         * options.h (class General_options): Add --noinhibit-exec option.
11849         * main.cc (main): Check --noinhibit-exec.
11850
11851         * options.h (class General_options): Define --wrap as a special
11852         option.  Add wrap_symbols_ field.
11853         (General_options::any_wrap_symbols): New function.
11854         (General_options::is_wrap_symbol): New function.
11855         * options.cc (General_options::parse_wrap): New function.
11856         (General_options::General_options): Initialize wrap_symbols_.
11857         * symtab.cc (Symbol_table::wrap_symbol): New function.
11858         (Symbol_table::add_from_object): Handle --wrap.
11859         * symtab.h (class Symbol_table): Declare wrap_symbol.
11860         * target.h (Target::wrap_char): New function.
11861         (Target::Target_info): Add wrap_char field.
11862         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11863         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11864         * testsuite/testfile.cc (Target_test::test_target_info):
11865         Likewise.
11866
11867         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11868         there is one.
11869
11870         * layout.h (class Layout): Add added_eh_frame_data_ field.
11871         * layout.cc (Layout::Layout): Initialize new field.
11872         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11873         output section until we find a section we merged successfully.
11874         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11875         that the size be non-zero.
11876
11877         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11878         qualifier.
11879
11880 2008-04-08  Craig Silverstein  <csilvers@google.com>
11881
11882         * configure.ac: Export new conditional variable HAVE_ZLIB.
11883         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11884         on HAVE_ZLIB.
11885         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11886         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11887
11888 2008-04-07  Ian Lance Taylor  <iant@google.com>
11889
11890         * version.cc (version_string): Set to "1.5".
11891
11892         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11893         Add issued_non_pic_error_ field.  Declare check_non_pic.
11894         (Target_x86_64::Scan::check_non_pic): New function.
11895         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11896         (Target_x86_64::Scan::global): Likewise.
11897
11898         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11899         addend parameter.  Change caller.  Handle merge sections.
11900         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11901         Address to Addend.  Don't add in the result of
11902         local_section_offset, pass down the addend and use the returned
11903         value.
11904         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11905         Update declarations of local_section_offset and symbol_value.
11906         * testsuite/two_file_test_1.cc (t18): New function.
11907         * testsuite/two_file_test_2.cc (f18): New function.
11908         * testsuite/two_file_test_main.cc (main): Call t18.
11909         * testsuite/two_file_test.h (t18, f18): Declare.
11910
11911         * configure.ac: Don't test for objdump, c++filt, or readelf.
11912         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11913         conditionals.
11914         (TEST_READELF): New variable.
11915         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11916         (check_PROGRAMS): Add two_file_strip_test.
11917         (two_file_strip_test): New target.
11918         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11919         (two_file_same_shared_strip_test_SOURCES): New variable.
11920         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11921         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11922         (two_file_same_shared_strip_test_LDADD): New variable.
11923         (two_file_shared_strip.so): New target.
11924         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11925         (ver_test_5.syms, ver_test_7.syms): Likewise.
11926         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11927         (strip_test_3.stdout): Use TEST_OBJDUMP.
11928         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11929
11930 2008-04-04  Cary Coutant  <ccoutant@google.com>
11931
11932         * symtab.h (Symbol::is_weak_undefined): New function.
11933         (Symbol::is_strong_undefined): New function.
11934         (Symbol::is_absolute): New function.
11935         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11936         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11937         absolute symbols.
11938         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11939         (weak_undef_test): New target.
11940         * testsuite/Makefile.in: Rebuild.
11941         * testsuite/weak_undef_file1.cc: New file.
11942         * testsuite/weak_undef_file2.cc: New file.
11943         * testsuite/weak_undef_test.cc: New file.
11944
11945 2008-04-03  Craig Silverstein  <csilvers@google.com>
11946
11947         * compressed_output.h (class Output_compressed_section): Use
11948         unsigned buffer.
11949         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11950         add zlib header.
11951         (zlib_compressed_suffix): Removed.
11952         (Output_compressed_section::set_final_data_size): Use unsigned
11953         buffers.
11954         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11955         Fix linker invocation.
11956         (flagstest_o_specialfile_and_compress_debug_sections):
11957         Likewise.
11958         * testsuite/Makefile.in: Regenerated.
11959
11960 2008-04-02  David S. Miller  <davem@davemloft.net>
11961
11962         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11963         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11964
11965 2008-04-02  Craig Silverstein  <csilvers@google.com>
11966
11967         * TODO: New file.
11968
11969 2008-04-02  Ian Lance Taylor  <iant@google.com>
11970
11971         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11972         parameters.  Update for new key type to views_.  Change all
11973         callers.
11974         (File_read::read): Adjust for byteshift in returned view.
11975         (File_read::add_view): New function, broken out of
11976         find_and_make_view.
11977         (File_read::make_view): New function, broken out of
11978         find_and_make_view.
11979         (File_read::find_or_make_view): Add offset and aligned
11980         parameters.  Rewrite accordingly.  Change all callers.
11981         (File_read::get_view): Add offset and aligned parameters.  Adjust
11982         for byteshift in return value.
11983         (File_read::get_lasting_view): Likewise.
11984         * fileread.h (class File_read): Update declarations.
11985         (class File_read::View): Add byteshift_ field.  Add byteshift to
11986         constructor.  Add byteshift method.
11987         * archive.h (Archive::clear_uncached_views): New function.
11988         (Archive::get_view): Add aligned parameter.  Change all callers.
11989         * object.h (Object::get_view): Add aligned parameter.  Change all
11990         callers.
11991         (Object::get_lasting_view): Likewise.
11992
11993         * fileread.cc (File_read::release): Don't call clear_views if
11994         there are multiple objects.
11995         * fileread.h (File_read::clear_uncached_views): New function.
11996         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11997         on the archive.
11998
11999 2008-03-31  Cary Coutant  <ccoutant@google.com>
12000
12001         Add thin archive support.
12002         * archive.cc (Archive::armagt): New const.
12003         (Archive::setup): Remove task parameter and calls to unlock.
12004         (Archive::unlock_nested_archives): New function.
12005         (Archive::read_header): Add nested_off parameter. Change
12006         all callers.
12007         (Archive::interpret_header): Likewise.
12008         (Archive::include_all_members): Change to handle thin
12009         archives.
12010         (Archive::include_member): Likewise.
12011         * archive.h (Archive::Archive): Add new parameters and
12012         initializers.
12013         (Archive::armagt): New const.
12014         (Archive::setup): Remove task parameter.
12015         (Archive::unlock_nested_archives): New function.
12016         (Archive::read_header): Add nested_off parameter.
12017         (Archive::interpret_header): Likewise.
12018         (Archive::Nested_archive_table): New typedef.
12019         (Archive::is_thin_archive_): New field.
12020         (Archive::nested_archives_): New field.
12021         (Archive::options_): New field.
12022         (Archive::dirpath_): New field.
12023         (Archive::task_): New field.
12024         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12025         for thin archives.  Pass additional parameters to
12026         Archive::Archive.  Unlock the archive file after calling
12027         Archive::setup.
12028
12029 2008-03-29  Ian Lance Taylor  <iant@google.com>
12030
12031         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12032         version symbol to be local.
12033         * testsuite/ver_test_4.sh: New file.
12034         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12035         (check_DATA): Add ver_test_4.syms.
12036         (ver_test_4.syms): New target.
12037         * testsuite/Makefile.in: Rebuild.
12038
12039         * output.cc
12040         (Output_section::Input_section_sort_entry::has_priority): New
12041         function.
12042         (Output_section::Input_section_sort_entry::match_file_name): New
12043         function.
12044         (Output_section::Input_section_sort_entry::match_section_name):
12045         Remove.
12046         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12047         Remove.
12048         (Output_section::Input_section_sort_entry::match_section_file):
12049         Remove.
12050         (Output_section::Input_section_sort_compare::operator()): Rewrite
12051         using new Input_section_sort_entry functions.  Sort crtbegin and
12052         crtend first.  Sort sections with no priority before sections with
12053         a priority.
12054         * testsuite/initpri1.c (d3): Check j != 4.
12055         (cd5): New constructor/destructor function.
12056         (main): Check j != 2.
12057
12058         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12059         new symbol when resolving, don't call set_is_default.
12060         * testsuite/ver_test_7.cc: New file.
12061         * testsuite/ver_test_7.sh: New file.
12062         * testsuite/Makefile.am (ver_test_7.so): New target.
12063         (ver_test_7.o): New target.
12064         (check_SCRIPTS): Add ver_test_7.sh.
12065         (check_DATA): Add ver_test_7.syms.
12066         (ver_test_7.syms): New target.
12067
12068 2008-03-28  Ian Lance Taylor  <iant@google.com>
12069
12070         * layout.cc (Layout::layout): If we see an input section with a
12071         name that needs sorting, set the must_sort flag for the output
12072         section.
12073         (Layout::make_output_section): If the name of the output section
12074         indicates that it might require sorting, set the may_sort flag.
12075         * output.h (Output_section::may_sort_attached_input_sections): New
12076         function.
12077         (Output_section::set_may_sort_attached_input_sections): New
12078         function.
12079         (Output_section::must_sort_attached_input_sections): New
12080         function.
12081         (Output_section::set_must_sort_attached_input_sections): New
12082         function.
12083         (class Output_section): Declare Input_section_sort_entry.  Define
12084         Input_section_sort_compare.  Declare
12085         sort_attached_input_sections.  Add new fields:
12086         may_sort_attached_input_sections_,
12087         must_sort_attached_input_sections_,
12088         attached_input_sections_are_sorted_.
12089         * output.cc (Output_section::Output_section): Initialize new
12090         fields.
12091         (Output_section::add_input_section): Add an entry to
12092         input_sections_ if may_sort or must_sort are true.
12093         (Output_section::set_final_data_size): Call
12094         sort_attached_input_sections if necessary.
12095         (Output_section::Input_section_sort_entry): Define new class.
12096         (Output_section::Input_section_sort_compare::operator()): New
12097         function.
12098         (Output_section::sort_attached_input_sections): New function.
12099         * configure.ac: Check whether the compiler supports constructor
12100         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12101         * testsuite/initpri1.c: New file.
12102         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12103         CONSTRUCTOR_PRIORITY.
12104         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12105         (initpri1_LDFLAGS): New variable.
12106         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12107
12108 2008-03-27  Ian Lance Taylor  <iant@google.com>
12109
12110         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12111         * testsuite/common_test_1.c: New file.
12112         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12113         (common_test_1_SOURCES): New variable.
12114         (common_test_1_DEPENDENCIES): New variable.
12115         (common_test_1_LDFLAGS): New variable.
12116
12117         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12118         and commons_ correctly when NAME/VERSION does not override
12119         NAME/NULL.
12120         * testsuite/ver_test_6.c: New file.
12121         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12122         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12123         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12124
12125 2008-03-26  Ian Lance Taylor  <iant@google.com>
12126
12127         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12128         of an undefined symbol from a version script.
12129         * testsuite/Makefile.am (ver_test_5.so): New target.
12130         (ver_test_5.o): New target.
12131         (check_SCRIPTS): Add ver_test_5.sh.
12132         (check_DATA): Add ver_test_5.syms.
12133         (ver_test_5.syms): New target.
12134         * testsuite/ver_test_5.cc: New file.
12135         * testsuite/ver_test_5.script: New file.
12136         * testsuite/ver_test_5.sh: New file.
12137         * Makefile.in, testsuite/Makefile.in: Rebuild.
12138
12139         PR gold/5986
12140         Fix problems building gold with gcc 4.3.0.
12141         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12142         (gold_error_at_location, gold_warning_at_location): Use it.
12143         * configure.ac: Check whether we can compile and use a template
12144         function with a printf attribute.
12145         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12146         when jumping over bytes.
12147         * object.cc: Instantiate Object::read_section_data.
12148         * debug.h: Include <cstring>
12149         * dwarf_reader.cc: Include <algorithm>
12150         * main.cc: Include <cstring>.
12151         * options.cc: Include <cstring>.
12152         * output.cc: Include <cstring>.
12153         * script.cc: Include <cstring>.
12154         * script.h: Include <string>.
12155         * symtab.cc: Include <cstring> and <algorithm>.
12156         * target-select.cc: Include <cstring>.
12157         * version.cc: Include <string>.
12158         * testsuite/testmain.cc: Include <cstdlib>.
12159         * configure, config.in: Rebuild.
12160
12161 2008-03-25  Ian Lance Taylor  <iant@google.com>
12162
12163         * options.cc: Include "../bfd/bfdver.h".
12164         (options::help): Print bug reporting address.
12165
12166         * version.cc (print_version): Adjust output for current value of
12167         BFD_VERSION_STRING.
12168
12169         * NEWS: New file.
12170
12171         * options.cc (options::help): Print list of supported targets.
12172         * target-select.h: Include <vector>.
12173         (class Target_selector): Make machine_, size_, and is_big_endian_
12174         fields const.  Add bfd_name_ and instantiated_target_ fields.
12175         (Target_selector::Target_selector): Add bfd_name parameter.
12176         (Target_selector::recognize): Make non-virtual, call
12177         do_recognize.
12178         (Target_selector::recognize_by_name): Make non-virtual, call
12179         do_recognize_by_name.
12180         (Target_selector::supported_names): New function.
12181         (Target_selector::bfd_name): New function.
12182         (Target_selector::do_instantiate_target): New pure virtual
12183         function.
12184         (Target_selector::do_recognize): New virtual function.
12185         (Target_selector::do_recognize_by_name): New virtual function.
12186         (Target_selector::instantiate_target): New private function.
12187         (supported_target_names): Declare.
12188         * target-select.cc (Target_selector::Target_selector): Update for
12189         new parameter and fields.
12190         (select_target_by_name): Check that the name matches before
12191         calling recognize_by_name.
12192         (supported_target_names): New function.
12193         * i386.cc (class Target_selector_i386): Update Target_selector
12194         constructor call.  Remove recognize and recognize_by_name.  Add
12195         do_instantiate_target.
12196         * x86_64.cc (class Target_selector_x86_64): Likewise.
12197         * testsuite/testfile.cc (class Target_selector_test): Update for
12198         changes to Target_selector.
12199
12200         * README: Rewrite, with some notes on unsupported features.
12201
12202 2008-03-24  Cary Coutant  <ccoutant@google.com>
12203
12204         * i386.cc (Target_i386::Got_type): New enum declaration.
12205         (Target_i386::Scan::local): Updated callers of Output_data_got
12206         member functions.
12207         (Target_i386::Scan::global): Likewise.
12208         (Target_i386::Relocate::relocate): Likewise.
12209         (Target_i386::Relocate::relocate_tls): Likewise.
12210         * object.h (Got_offset_list): New class.
12211         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12212         (Sized_relobj::local_got_offset): Likewise.
12213         (Sized_relobj::set_local_got_offset): Likewise.
12214         (Sized_relobj::local_has_tls_got_offset): Removed.
12215         (Sized_relobj::local_tls_got_offset): Removed.
12216         (Sized_relobj::set_local_tls_got_offset): Removed.
12217         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12218         * output.cc (Output_data_got::add_global): Added got_type parameter.
12219         (Output_data_got::add_global_with_rel): Likewise.
12220         (Output_data_got::add_global_with_rela): Likewise.
12221         (Output_data_got::add_global_pair_with_rel): New function.
12222         (Output_data_got::add_global_pair_with_rela): New function.
12223         (Output_data_got::add_local): Added got_type parameter.
12224         (Output_data_got::add_local_with_rel): Likewise.
12225         (Output_data_got::add_local_with_rela): Likewise.
12226         (Output_data_got::add_local_pair_with_rel): New function.
12227         (Output_data_got::add_local_pair_with_rela): New function.
12228         (Output_data_got::add_global_tls): Removed.
12229         (Output_data_got::add_global_tls_with_rel): Removed.
12230         (Output_data_got::add_global_tls_with_rela): Removed.
12231         (Output_data_got::add_local_tls): Removed.
12232         (Output_data_got::add_local_tls_with_rel): Removed.
12233         (Output_data_got::add_local_tls_with_rela): Removed.
12234         * output.h (Output_data_got::add_global): Added got_type parameter.
12235         (Output_data_got::add_global_with_rel): Likewise.
12236         (Output_data_got::add_global_with_rela): Likewise.
12237         (Output_data_got::add_global_pair_with_rel): New function.
12238         (Output_data_got::add_global_pair_with_rela): New function.
12239         (Output_data_got::add_local): Added got_type parameter.
12240         (Output_data_got::add_local_with_rel): Likewise.
12241         (Output_data_got::add_local_with_rela): Likewise.
12242         (Output_data_got::add_local_pair_with_rel): New function.
12243         (Output_data_got::add_local_pair_with_rela): New function.
12244         (Output_data_got::add_global_tls): Removed.
12245         (Output_data_got::add_global_tls_with_rel): Removed.
12246         (Output_data_got::add_global_tls_with_rela): Removed.
12247         (Output_data_got::add_local_tls): Removed.
12248         (Output_data_got::add_local_tls_with_rel): Removed.
12249         (Output_data_got::add_local_tls_with_rela): Removed.
12250         * resolve.cc (Symbol::override_base_with_special): Removed
12251         reference to has_got_offset_ field.
12252         * symtab.cc (Symbol::init_fields): Replaced initialization
12253         of got_offset_ with got_offsets_.  Removed initialization
12254         of has_got_offset_
12255         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12256         (Symbol::got_offset): Likewise.
12257         (Symbol::set_got_offset): Likewise.
12258         (Symbol::has_tls_got_offset): Removed.
12259         (Symbol::tls_got_offset): Removed.
12260         (Symbol::set_tls_got_offset): Removed.
12261         (Symbol::got_offset_): Removed.
12262         (Symbol::tls_mod_got_offset_): Removed.
12263         (Symbol::tls_pair_got_offset_): Removed.
12264         (Symbol::got_offsets_): New field.
12265         (Symbol::has_got_offset): Removed.
12266         (Symbol::has_tls_mod_got_offset): Removed.
12267         (Symbol::has_tls_pair_got_offset): Removed.
12268         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12269         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12270         member functions.
12271         (Target_x86_64::Scan::global): Likewise.
12272         (Target_x86_64::Relocate::relocate): Likewise.
12273         (Target_x86_64::Relocate::relocate_tls): Likewise.
12274
12275 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12276
12277         * yyscript.y: Fix spelling error in comment.
12278
12279 2008-03-24  Ian Lance Taylor  <iant@google.com>
12280
12281         * options.h (class General_options): Define build_id option.
12282         * layout.h (class Layout): Declare write_build_id, create_note,
12283         create_build_id.  Add build_id_note_ member.
12284         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12285         "libiberty.h", "md5.h", "sha1.h".
12286         (Layout::Layout): Initialize eh_frame_data_,
12287         eh_frame_hdr_section_, and build_id_note_.
12288         (Layout::finalize): Call create_build_id.
12289         (Layout::create_note): New function, broken out of
12290         Layout::create_gold_note.
12291         (Layout::create_gold_note): Call create_note.
12292         (Layout::create_build_id): New function.
12293         (Layout::write_build_id): New function.
12294         (Close_task_runner::run): Call write_build_id.
12295
12296         * x86_64.cc: Correct license to GPLv3.
12297
12298 2008-03-23  Ian Lance Taylor  <iant@google.com>
12299
12300         * options.cc: Include "demangle.h".
12301         (parse_optional_string): New function.
12302         (parse_long_option): Handle takes_optional_argument.
12303         (parse_short_option): Update dash_z initializer.  Handle
12304         takes_optional_argument.
12305         (General_options::General_options): Initialize do_demangle_.
12306         (General_options::finalize): Set do_demangle_.  Handle demangling
12307         style.
12308         * options.h (parse_optional_string): Declare.
12309         (struct One_option): Add optional_arg field.  Update constructor.
12310         Update call constructor calls.  Add takes_optional_argument
12311         function.
12312         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12313         (DEFINE_optional_string): Define.
12314         (General_options::demangle): Change from DEFINE_bool to
12315         DEFINE_optional_string.
12316         (General_options::no_demangle): New function.
12317         (General_options::do_demangle): New function.
12318         (General_options::set_do_demangle): New function.
12319         (General_options::execstack_status_): Move definition to end of
12320         class definition.
12321         (General_options::static_): Likewise.
12322         (General_options::do_demangle_): New field.
12323         * object.cc (big_endian>::get_symbol_location_info): Call
12324         Options::do_demangle, not Options::demangle.
12325         * symtab.cc (demangle): Likewise.
12326
12327 2008-03-22  Ian Lance Taylor  <iant@google.com>
12328
12329         * gold.h: Include <cstddef> and <sys/types.h>
12330         * options.h: Include <cstring>.
12331
12332 2008-03-21  Ian Lance Taylor  <iant@google.com>
12333
12334         * Added source code to GNU binutils.