2011-11-17 Sterling Augustine <saugustine@google.com>
[external/binutils.git] / gold / ChangeLog
1 2011-11-17  Sterling Augustine  <saugustine@google.com>
2
3         * script.cc (script_include_directive): Implement.
4         (read_script_file): New local variables name and search_path. Update
5         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
6         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
7         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
8
9 2011-11-11  Sterling Augustine  <saugustine@google.com>
10
11         * yyscript.y (section_cmd): Add support for INCLUDE directive.
12         (file_or_sections_cmd): Likewise.
13
14 2011-11-11  Doug Kwan  <dougkwan@google.com>
15
16         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
17         if --just-symbols is given.
18
19 2011-11-10  Doug Kwan  <dougkwan@google.com>
20
21         PR gold/13362
22         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
23         when processing data relocs.
24         * reloc.h (Relocate_functions::rel_unaligned): New method.
25         (Relocate_functions::pcrel_unaligned): Ditto.
26         (Relocate_functions::rel32_unaligned): Ditto.
27         (Relocate_functions::pcrel32_unaligned): Ditto.
28
29 2011-11-09  Doug Kwan  <dougkwan@google.com>
30
31         PR gold/13362
32         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
33         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
34         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
35         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
36         (Relocate_functions::rel_unaligned): New.
37         (Relocate_functions::rel32_unaligned): New.
38         * target-reloc.h (relocate_for_relocatable): Add code to handle
39         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
40         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
41         arm_unaligned_reloc_r): New targets.
42         * testsuite/Makefile.in: Regenerate.
43         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
44         linking.
45
46 2011-11-02  Ian Lance Taylor  <iant@google.com>
47
48         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
49         NATIVE_LINKER.
50         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
51         * options.cc (General_options::finalize): Use library search path
52         from configure script if specified.  If not native and no sysroot,
53         only search TOOLLIBDIR.
54         * options.h (Search_directory::Search_directory): Change name to
55         const std::string&.
56         (General_options::add_to_library_path_with_sysroot): Change arg to
57         const std::string&.
58         * configure, Makefile.in, config.in: Rebuild.
59
60 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
61
62         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
63         we are working around the ARM1176 Erratum.
64         * options.h (General_options::fix_arm1176): Add option.
65         * testsuite/Makefile.am: Add testcases, and keep current ones
66         working.
67         * testsuite/Makefile.in: Regenerate.
68         * testsuite/arm_fix_1176.s: New file.
69         * testsuite/arm_fix_1176.sh: Likewise.
70
71 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
72
73         * arm.cc (Target_arm::Target_arm): Remove initialisation of
74         may_use_blx_.
75         (Target_arm::may_use_blx): Remove method.
76         (Target_arm::set_may_use_blx): Likewise.
77         (Target_arm::may_use_v4t_interworking): New method.
78         (Target_arm::may_use_v5t_interworking): Likewise.
79         (Target_arm::may_use_blx_): Remove member variable.
80         (Arm_relocate_functions::arm_branch_common): Check for v5T
81         interworking.
82         (Arm_relocate_functions::thumb_branch_common): Likewise.
83         (Reloc_stub::stub_type_for_reloc): Likewise.
84         (Target_arm::do_finalize_sections): Correct interworking checks.
85         * testsuite/Makefile.am: Add new tests.
86         * testsuite/Makefile.in: Regenerate.
87         * testsuite/arm_farcall_arm_arm.s: New test.
88         * testsuite/arm_farcall_arm_arm.sh: Likewise.
89         * testsuite/arm_farcall_arm_thumb.s: Likewise.
90         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
91         * testsuite/arm_farcall_thumb_arm.s: Likewise.
92         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
93         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
94         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
95
96 2011-10-31  Cary Coutant  <ccoutant@google.com>
97
98         PR gold/13023
99         * expression.cc (Expression::eval_with_dot): Add
100         is_section_dot_assignment parameter.
101         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
102         absolute and assigning to dot within a section.
103         * script-sections.cc
104         (Output_section_element_assignment::set_section_addresses): Pass
105         dot_section to set_if_absolute.
106         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
107         as is_section_dot_assignment flag to eval_with_dot.
108         (Output_section_element_dot_assignment::set_section_addresses):
109         Likewise.
110         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
111         parameter.  Also set value if relative to dot_section; set the
112         symbol's output_section.
113         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
114         parameter.  Adjust all callers.
115         (Expression::eval_maybe_dot): Likewise.
116         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
117         Adjust all callers.
118         * testsuite/script_test_2.t: Test assignment of an absolute value
119         to dot within an output section element.
120
121 2011-10-31  Cary Coutant  <ccoutant@google.com>
122
123         * options.h (class General_options): Add --[no-]gnu-unique options.
124         * symtab.cc (Symbol_table::sized_write_globals): Convert
125         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
126
127 2011-10-31  Cary Coutant  <ccoutant@google.com>
128
129         PR gold/13359
130         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
131         unnecessary assertion.
132         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
133
134 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
135
136         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
137         gc_mark_symbol.
138         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
139         gc_mark_symbol.
140         Change to just keep the section associated with symbol.
141         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
142         they are externally visible and --export-dynamic is turned on.
143         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
144
145 2011-10-19  Ian Lance Taylor  <iant@google.com>
146
147         PR gold/13163
148         * script-sections.cc
149         (Output_section_element_dot_assignment::needs_output_section): New
150         function.
151
152 2011-10-19  Ian Lance Taylor  <iant@google.com>
153
154         PR gold/13204
155         * layout.cc (Layout::segment_precedes): Don't assert failure if a
156         --section-start option was seen.
157         * options.h (General_options::any_section_start): New function.
158
159 2011-10-18  David S. Miller  <davem@davemloft.net>
160
161         PR binutils/13301
162         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
163         member to track relocation locations that have moved during TLS
164         reloc optimizations.
165         (Target_sparc::Relocate::Relocate): Initialize to NULL.
166         (Target_sparc::Relocate::relocate): Adjust view down by 4
167         bytes if it matches reloc_adjust_addr_.
168         (Target_sparc::Relocate::relocate_tls): Always move the
169         __tls_get_addr call delay slot instruction forward 4 bytes when
170         performing relaxation.
171
172 2011-10-18  Cary Coutant  <ccoutant@google.com>
173
174         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
175         (Output_file::map_no_anonymous): Check for non-zero
176         return code from posix_fallocate.
177
178 2011-10-17  Cary Coutant  <ccoutant@google.com>
179
180         PR gold/13245
181         * plugin.cc (is_visible_from_outside): Check for symbols
182         referenced from dynamic objects.
183         * resolve.cc (Symbol_table::resolve): Don't count references
184         from dynamic objects as references from real ELF files.
185         * testsuite/plugin_test_2.sh: Adjust expected result.
186
187 2011-10-17  Cary Coutant  <ccoutant@google.com>
188
189         * gold.cc: Include timer.h.
190         (queue_middle_tasks): Stamp time.
191         (queue_final_tasks): Likewise.
192         * main.cc (main): Store timer in parameters.  Print timers
193         for each pass.
194         * parameters.cc (Parameters::Parameters): Initialize timer_.
195         (Parameters::set_timer): New function.
196         (set_parameters_timer): New function.
197         * parameters.h (Parameters::set_timer): New function.
198         (Parameters::timer): New function.
199         (Parameters::timer_): New data member.
200         (set_parameters_timer): New function.
201         * timer.cc (Timer::stamp): New function.
202         (Timer::get_pass_time): New function.
203         * timer.h (Timer::stamp): New function.
204         (Timer::get_pass_time): New function.
205         (Timer::pass_times_): New data member.
206
207 2011-10-17  Cary Coutant  <ccoutant@google.com>
208
209         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
210         task for members of lib groups.
211
212 2011-10-17  Cary Coutant  <ccoutant@google.com>
213
214         PR gold/13288
215         * fileread.cc (File_read::find_view): Add assert.
216         (File_read::make_view): Move bounds check (replace with assert)...
217         (File_read::find_or_make_view): ... to here.
218
219 2011-10-12  Cary Coutant  <ccoutant@google.com>
220
221         * output.cc (Output_file::open_base_file): Handle case where
222         ::read returns less than requested size.
223
224 2011-10-10  Cary Coutant  <ccoutant@google.com>
225
226         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
227         Initialize defined_count_.
228         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
229         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
230         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
231         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
232         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
233         * incremental.h (Sized_relobj_incr::defined_count_): New data
234         member.
235         (Sized_incr_dynobj::defined_count_): New data member.
236         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
237         Return zeroes instead of internal error.
238
239 2011-10-10  Cary Coutant  <ccoutant@google.com>
240
241         PR gold/13249
242         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
243         (Output_reloc::symbol_value): Return PLT offset if flag is set.
244         * output.h (class Output_reloc): Add use_plt_offset flag.
245         (Output_reloc::type_): Adjust size of bit field.
246         (Output_reloc::use_plt_offset_): New bit field.
247         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
248         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
249         flag.  Adjust all callers.
250         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
251         creating RELATIVE relocations.
252
253 2011-10-10  Nick Clifton  <nickc@redhat.com>
254
255         * po/es.po: Updated Spanish translation.
256         * po/fi.po: Updated Finnish translation.
257
258 2011-10-03   Diego Novillo  <dnovillo@google.com>
259
260         * options.cc (parse_uint): Fix dereference of RETVAL.
261
262 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
263
264         * layout.h (section_order_map_): New member.
265         (get_section_order_map): New member function.
266         * output.cc (Output_section::add_input_section): Check for patterns
267         only when --section-ordering-file is specified.
268         * gold.cc (queue_middle_tasks): Delay updating order of sections till
269         output_sections have been formed.
270         * layout.cc (Layout_Layout): Initialize section_order_map_.
271         * plugin.cc (update_section_order): Store order in order_map. Do not
272         update the order.
273         * testsuite/Makefile.am: Add test case for plugin_final_layout.
274         * testsuite/Makefile.in: Regenerate.
275         * testsuite/plugin_section_order.c: New file.
276         * testsuite/plugin_final_layout.cc: New file.
277         * testsuite/plugin_final_layout.sh: New file.
278
279 2011-09-29  Cary Coutant  <ccoutant@google.com>
280
281         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
282         Check for NULL.
283         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
284         symbols during incremental update.
285         (Symbol_table::add_from_dynobj): Likewise.
286
287 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
288             Ian Lance Taylor  <iant@google.com>
289
290         * symtab.cc (Symbol_table::define_special_symbol): Always
291         canonicalize version string.
292
293 2011-09-26  Cary Coutant  <ccoutant@google.com>
294
295         * gold.cc (queue_initial_tasks): Move option checks ...
296         * options.cc (General_options::finalize): ... to here. Disable
297         some options; make others fatal.
298
299 2011-09-26  Cary Coutant  <ccoutant@google.com>
300
301         gcc PR lto/47247
302         * plugin.cc (get_symbols_v2): New function.
303         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
304         (is_referenced_from_outside): New function.
305         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
306         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
307         (get_symbols): Pass version parameter.
308         (get_symbols_v2): New function.
309         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
310         parameter.
311         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
312         (onload): Add LDPT_GET_SYMBOLS_V2.
313         (all_symbols_read_hook): Use get_symbols_v2; check for
314         LDPR_PREVAILING_DEF_IRONLY_EXP.
315         * testsuite/plugin_test_3.sh: Update expected results.
316
317 2011-09-23  Simon Baldwin  <simonb@google.com>
318
319         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
320         configuration options.
321         * configure: Regenerate.
322         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
323         * Makefile.in: Regenerate.
324         * testsuite/Makefile.in: Regenerate.
325
326 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
327
328         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
329
330 2011-09-19  Cary Coutant  <ccoutant@google.com>
331
332         * incremental.cc (can_incremental_update): Fix typo in comment.
333         * incremental.h (can_incremental_update): Likewise.
334
335 2011-09-18  Cary Coutant  <ccoutant@google.com>
336
337         * incremental.cc (can_incremental_update): New function.
338         * incremental.h (can_incremental_update): New function.
339         * layout.cc (Layout::init_fixed_output_section): Call it.
340         (Layout::make_output_section): Don't allow patch space in .eh_frame.
341         * object.cc (Sized_relobj_file::do_layout): Call
342         can_incremental_update.
343
344 2011-09-13  Cary Coutant  <ccoutant@google.com>
345
346         * configure.ac: Check for glibc support for gnu_indirect_function
347         support with static linking, setting automake conditional
348         IFUNC_STATIC.
349         * Makefile.in: Regenerate.
350         * configure: Regenerate.
351
352         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
353         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
354         for IFUNC_STATIC.
355         * testsuite/Makefile.in: Regenerate.
356
357 2011-09-13  Cary Coutant  <ccoutant@google.com>
358
359         * incremental.cc (Sized_relobj_incr::do_layout): Call
360         report_comdat_group for kept comdat sections.
361         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
362         * testsuite/Makefile.in: Regenerate.
363         * testsuite/incr_comdat_test_1.cc: New source file.
364         * testsuite/incr_comdat_test_2_v1.cc: New source file.
365         * testsuite/incr_comdat_test_2_v2.cc: New source file.
366         * testsuite/incr_comdat_test_2_v3.cc: New source file.
367
368 2011-09-13  Ian Lance Taylor  <iant@google.com>
369
370         * object.cc (Sized_relobj_file::do_layout): Remove unused local
371         variable external_symbols_offset.
372
373 2011-09-12  Ian Lance Taylor  <iant@google.com>
374
375         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
376         triggered if object has no symbols.
377
378 2011-09-09  David S. Miller  <davem@davemloft.net>
379
380         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
381         (Output_fill_debug_line::do_write): Likewise.
382
383 2011-08-29  Cary Coutant  <ccoutant@google.com>
384
385         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
386         casts to match formatting specs.
387         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
388
389 2011-08-26  Cary Coutant  <ccoutant@google.com>
390
391         * layout.cc (Free_list::allocate): Provide guarantee of minimum
392         remaining hole size when allocating.
393         (Layout::make_output_section): Set fill methods for debug sections.
394         * layout.h (Free_list::Free_list_node): Move from private to
395         public.
396         (Free_list::set_min_hole_size): New function.
397         (Free_list::begin, Free_list::end): New functions.
398         (Free_list::min_hole_): New data member.
399         * output.cc: Include dwarf.h.
400         (Output_fill_debug_info::do_minimum_hole_size): New function.
401         (Output_fill_debug_info::do_write): New function.
402         (Output_fill_debug_line::do_minimum_hole_size): New function.
403         (Output_fill_debug_line::do_write): New function.
404         (Output_section::Output_section): Initialize new data member.
405         (Output_section::set_final_data_size): Ensure patch space is larger
406         than minimum hole size.
407         (Output_section::do_write): Fill holes in debug sections.
408         * output.h (Output_fill): New class.
409         (Output_fill_debug_info): New class.
410         (Output_fill_debug_line): New class.
411         (Output_section::set_free_space_fill): New function.
412         (Output_section::free_space_fill_): New data member.
413         * testsuite/Makefile.am (incremental_test_3): Add
414         --incremental-patch option.
415         (incremental_test_4): Likewise.
416         (incremental_test_5): Likewise.
417         (incremental_test_6): Likewise.
418         (incremental_copy_test): Likewise.
419         (incremental_common_test_1): Likewise.
420         * testsuite/Makefile.in: Regenerate.
421
422 2011-08-26  Nick Clifton  <nickc@redhat.com>
423
424         * po/es.po: Updated Spanish translation.
425
426 2011-08-01  Cary Coutant  <ccoutant@google.com>
427
428         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
429         * gold/testsuite/Makefile.in: Regenerate.
430         * gold/testsuite/justsyms_exec.c: New source file.
431         * gold/testsuite/justsyms_lib.c: New source file.
432
433 2011-08-01  Cary Coutant  <ccoutant@google.com>
434
435         * layout.cc (Layout::set_segment_offsets): Don't realign text
436         segment if -Ttext was specified.
437         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
438         file type.
439         * object.h (Sized_relobj_file::e_type): New function.
440         (Sized_relobj_file::e_type_): New data member.
441         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
442         base address for ET_EXEC files.
443         * target.cc (Target::do_make_elf_object_implementation): Allow
444         ET_EXEC files with --just-symbols option.
445
446 2011-07-28  Cary Coutant  <ccoutant@google.com>
447
448         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
449         Add thread_number parameter.
450         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
451         * workqueue-threads.cc
452         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
453         current thread if its thread number is greater than desired thread
454         count.
455         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
456         Add thread_number parameter.
457         (Workqueue::should_cancel_thread): Likewise.
458         (Workqueue::find_runnable_or_wait): Pass thread_number to
459         should_cancel_thread.
460         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
461         parameter.
462
463 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
464
465         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
466         only after checking if it cannot be forced local.
467         * symtab.h (is_externally_visible): Check if the symbol is not forced
468         local.
469
470 2011-07-15  Ian Lance Taylor  <iant@google.com>
471
472         * options.h (class General_options): Add --print-output-format.
473         Move -EL next to -EB, for  better --help output.
474         * target-select.cc: Include <cstdio>, "options.h", and
475         "parameters.h".
476         (Target_selector::do_target_bfd_name): New function.
477         (print_output_format): New function.
478         * target-select.h (class Target_selector): Update declarations.
479         (Target_selector::target_bfd_name): New function.
480         (print_output_format): Declare.
481         * main.cc: Include "target-select.h".
482         (main): Handle --print-output-format.
483         * gold.cc: Include "target-select.h".
484         (queue_initial_tasks): Handle --print-output-format when there are
485         no input files.
486         * parameters.cc (parameters_force_valid_target): Give a better
487         error message if -EB/-EL does not match target.
488         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
489         function.
490
491 2011-07-15  Ian Lance Taylor  <iant@google.com>
492
493         * i386.cc (class Output_data_plt_i386): Add layout_ field.
494         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
495         (Output_data_plt_i386::do_write): Write address of .dynamic
496         section to first entry in .got.plt section.
497         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
498         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
499         Initialize layout_.
500         (Output_data_plt_x86_64::do_write): Write address of .dynamic
501         section to first entry in .got.plt section.
502         * layout.h (Layout::dynamic_section): New function.
503
504 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
505
506         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
507         to claim_file call.
508         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
509         input_section_position_, and input_section_glob_.
510         (read_layout_from_file): Call function section_ordering_specified.
511         * layout.h (is_section_ordering_specified): New function.
512         (section_ordering_specified): New function.
513         (section_ordering_specified_): New boolean member.
514         * main.cc(main): Call load_plugins after layout object is defined.
515         * output.cc (Output_section::add_input_section): Use
516         function section_ordering_specified to check if section ordering is
517         needed.
518         * output.cc (Output_section::add_relaxed_input_section): Use
519         function section_ordering_specified to check if section ordering is
520         needed.
521         (Output_section::update_section_layout): New function.
522         (Output_section::sort_attached_input_sections): Check if input section
523         must be reordered.
524         * output.h (Output_section::update_section_layout): New function.
525         * plugin.cc (get_section_count): New function.
526         (get_section_type): New function.
527         (get_section_name): New function.
528         (get_section_contents): New function.
529         (update_section_order): New function.
530         (allow_section_ordering): New function. 
531         (Plugin::load): Add the new interfaces to the transfer vector.
532         (Plugin_manager::load_plugins): New parameter.
533         (Plugin_manager::all_symbols_read): New parameter.
534         (Plugin_manager::claim_file): New parameter. Save the elf object for
535         unclaimed objects.
536         (Plugin_manager::get_elf_object): New function.
537         (Plugin_manager::get_view): Change to directly use the bool to check
538         if get_view is called from claim_file_hook.
539         * plugin.h (input_objects): New function
540         (Plugin__manager::load_plugins): New parameter.
541         (Plugin_manager::claim_file): New parameter.
542         (Plugin_manager::get_elf_object): New function.
543         (Plugin_manager::in_claim_file_handler): New function.
544         (Plugin_manager::in_claim_file_handler_): New member.
545         (layout): New function.
546         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
547         handler with an extra parameter. Make the elf object before calling
548         claim_file handler.
549         * testsuite/plugin_test.c (get_section_count): New function pointer.
550         (get_section_type): New function pointer.
551         (get_section_name): New function pointer.
552         (get_section_contents): New function pointer.
553         (update_section_order): New function pointer.
554         (allow_section_ordering): New function pointer.
555         (onload): Check if the new interfaces exist.
556
557 2011-07-13  Ian Lance Taylor  <iant@google.com>
558
559         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
560         relro section.
561         * x86_64.cc (Target_x86_64::got_section): Likewise.
562         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
563         (relro_now_test_SOURCES): New variable.
564         (relro_now_test_DEPENDENCIES): New variable.
565         (relro_now_test_LDFLAGS): New variable.
566         (relro_now_test_LDADD): New variable.
567         (relro_now_test.so): New target.
568         * testsuite/Makefile.in: Rebuild.
569
570 2011-07-12  Ian Lance Taylor  <iant@google.com>
571
572         PR gold/12980
573         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
574         GLOB_DAT relocation rather than a RELATIVE relocation for a
575         protected symbol when creating a shared library.
576         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
577         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
578         * testsuite/protected_main_1.cc (main): Test that protected
579         function has same address.
580
581 2011-07-11  Ian Lance Taylor  <iant@google.com>
582
583         PR gold/12979
584         * options.h (class General_options): Add -Bgroup.
585         * options.cc (General_options::finalize): If -Bgroup is set,
586         default to --unresolved-symbols=report-all.
587         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
588         * target-reloc.h (issue_undefined_symbol_error): Handle
589         --unresolved-symbols=report-all.
590
591 2011-07-08  Ian Lance Taylor  <iant@google.com>
592
593         PR gold/11985
594         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
595         if linker script discards key sections.
596         (Layout::create_dynamic_symtab): Likewise.
597         (Layout::assign_local_dynsym_offsets): Likewise.
598         (Layout::sized_create_version_sections): Likewise.
599         (Layout::create_interp): Likewise.
600         (Layout::finish_dynamic_section): Likewise.
601         (Layout::set_dynamic_symbol_size): Likewise.
602
603 2011-07-08  Ian Lance Taylor  <iant@google.com>
604
605         PR gold/12386
606         * options.h (class General_options): Add --unresolved-symbols.
607         * target-reloc.h (issue_undefined_symbol_error): Check
608         --unresolved-symbols.  Add comments.
609
610 2011-07-08  Ian Lance Taylor  <iant@google.com>
611
612         * testsuite/odr_violation2.cc (Ordering::operator()): Make
613         expression more complex.
614
615 2011-07-08  Ian Lance Taylor  <iant@google.com>
616
617         PR gold/11317
618         * target-reloc.h (issue_undefined_symbol_error): New inline
619         function, broken out of relocate_section.
620         (relocate_section): Call issue_undefined_symbol_error.
621         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
622         there is no TLS segment if we are about to issue an undefined
623         symbol error.
624         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
625
626 2011-07-08  Ian Lance Taylor  <iant@google.com>
627
628         PR gold/12279
629         * resolve.cc (Symbol_table::should_override): Add fromtype
630         parameter.  Change all callers.  Give error when linking together
631         TLS and non-TLS symbol.
632         (Symbol_table::should_override_with_special): Add fromtype
633         parameter.  Change all callers.
634         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
635         there is no TLS segment if we have reported some errors.
636         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
637
638 2011-07-08  Ian Lance Taylor  <iant@google.com>
639
640         PR gold/12372
641         * target.h (Target::plt_address_for_global): New function.
642         (Target::plt_address_for_local): New function.
643         (Target::plt_section_for_global): Remove.
644         (Target::plt_section_for_local): Remove.
645         (Target::do_plt_address_for_global): New virtual function.
646         (Target::do_plt_address_for_local): New virtual function.
647         (Target::do_plt_section_for_global): Remove.
648         (Target::do_plt_section_for_local): Remove.
649         (Target::register_global_plt_entry): Add Symbol_table and Layout
650         parameters.
651         * output.cc (Output_data_got::Got_entry::write): Use
652         plt_address_for_global and plt_address_for_local.
653         * layout.cc (Layout::add_target_dynamic_tags): Use size and
654         address of output section.
655         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
656         got_irelative_, and irelative_count_ fields.  Update
657         declarations.
658         (Output_data_plt_i386::has_irelative_section): New function.
659         (Output_data_plt_i386::entry_count): Add irelative_count_.
660         (Output_data_plt_i386::set_final_data_size): Likewise.
661         (class Target_i386): Add got_irelative_ and rel_irelative_
662         fields.  Update declarations.
663         (Target_i386::Target_i386): Initialize new fields.
664         (Target_i386::do_plt_address_for_global): New function replacing
665         do_plt_section_for_global.
666         (Target_i386::do_plt_address_for_local): New function replacing
667         do_plt_section_for_local.
668         (Target_i386::got_section): Create got_irelative_.
669         (Target_i386::rel_irelative_section): New function.
670         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
671         fields.  Don't define __rel_iplt_{start,end}.
672         (Output_data_plt_i386::add_entry): Add symtab and layout
673         parameters.  Change all callers.  Use different PLT and GOT for
674         IFUNC symbols.
675         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
676         layout parameters.  Change all callers.  Use different PLT and
677         GOT.
678         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
679         (Output_data_plt_i386::rel_irelative): New function.
680         (Output_data_plt_i386::address_for_global): New function.
681         (Output_data_plt_i386::address_for_local): New function.
682         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
683         IRELATIVE GOT when changing IFUNC GOT entries.
684         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
685         reloc.
686         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
687         if we didn't create an IRELATIVE GOT.
688         (Target_i386::Relocate::relocate): Use plt_address_for_global and
689         plt_address_for_local.
690         (Target_i386::do_dynsym_value): Use plt_address_for_global.
691         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
692         got_irelative_, and irelative_count_ fields.  Update
693         declarations.
694         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
695         Initialize new fields.  Remove symtab parameter.  Change all
696         callers.
697         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
698         irelative_count_.
699         (Output_data_plt_x86_64::has_irelative_section): New function.
700         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
701         (class Target_x86_64): Add got_irelative_ and rel_irelative_
702         fields.  Update declarations.
703         (Target_x86_64::Target_x86_64): Initialize new fields.
704         (Target_x86_64::do_plt_address_for_global): New function replacing
705         do_plt_section_for_global.
706         (Target_x86_64::do_plt_address_for_local): New function replacing
707         do_plt_section_for_local.
708         (Target_x86_64::got_section): Create got_irelative_.
709         (Target_x86_64::rela_irelative_section): New function.
710         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
711         all callers.  Don't create __rel_iplt_{start,end}.
712         (Output_data_plt_x86_64::add_entry): Add symtab and layout
713         parameters.  Change all callers.  Use different PLT and GOT for
714         IFUNC symbols.
715         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
716         layout parameters.  Change all callers.  Use different PLT and
717         GOT.
718         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
719         parameters.  Change all callers.  Use different PLT and GOT for
720         IFUNC symbols.
721         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
722         (Output_data_plt_x86_64::rela_irelative): New function.
723         (Output_data_plt_x86_64::address_for_global): New function.
724         (Output_data_plt_x86_64::address_for_local): New function.
725         (Output_data_plt_x86_64::set_final_data_size): Likewise.
726         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
727         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
728         (Target_x86_64::register_global_plt_entry): Add symtab and layout
729         parameters.
730         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
731         reloc.
732         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
733         symbols if we didn't create an IRELATIVE GOT.
734         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
735         plt_address_for_local.
736         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
737         * testsuite/ifuncvar1.c: New test file.
738         * testsuite/ifuncvar2.c: New test file.
739         * testsuite/ifuncvar3.c: New test file.
740         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
741         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
742         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
743         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
744         * testsuite/Makefile.in: Rebuild.
745
746 2011-07-07  Cary Coutant  <ccoutant@google.com>
747
748         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
749         (two_file_test_1_ndebug.o): Likewise.
750         (two_file_test_1b_ndebug.o): Likewise.
751         (two_file_test_2_ndebug.o): Likewise.
752         (two_file_test_main_ndebug.o): Likewise.
753         (incremental_test_2): Link with no-debug versions.
754
755 2011-07-06  Cary Coutant  <ccoutant@google.com>
756
757         * gold/incremental.cc
758         (Output_section_incremental_inputs::write_info_blocks): Check for
759         hidden and internal symbols.
760
761 2011-07-06  Cary Coutant  <ccoutant@google.com>
762
763         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
764         Check disposition for startup file.
765         (Incremental_inputs::report_command_line): Ignore
766         --incremental-startup-unchanged option.
767         * options.cc (General_options::parse_incremental_startup_unchanged):
768         New function.
769         (General_options::General_options): Initialize new data member.
770         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
771         (General_options): Add --incremental-startup-unchanged option.
772         (General_options::incremental_startup_disposition): New function.
773         (General_options::incremental_startup_disposition_): New data member.
774
775 2011-07-06  Cary Coutant  <ccoutant@google.com>
776
777         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
778         input file index to Script_info ctor.
779         (Sized_incremental_binary::do_file_has_changed): Find the
780         command-line argument for files named in scripts.
781         * incremental.h (Script_info::Script_info): New ctor
782         with input file index.
783         (Script_info::input_file_index): New function.
784         (Script_info::input_file_index_): New data member.
785         (Incremental_binary::get_library): Add const.
786         (Incremental_binary::get_script_info): Add const.
787         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
788         * testsuite/Makefile.am (incremental_test_5): New test case.
789         (incremental_test_6): New test case.
790         * testsuite/Makefile.in: Regenerate.
791
792 2011-07-06  Cary Coutant  <ccoutant@google.com>
793
794         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
795         debug output when command lines differ.
796
797 2011-07-06  Cary Coutant  <ccoutant@google.com>
798
799         * incremental.cc (Incremental_inputs::report_command_line): Ignore
800         --incremental-patch option.
801         * layout.cc (Free_list::allocate): Extend allocation beyond original
802         end if enabled.
803         (Layout::make_output_section): Mark sections that should get
804         patch space.
805         * options.cc (parse_percent): New function.
806         * options.h (parse_percent): New function.
807         (DEFINE_percent): New macro.
808         (General_options): Add --incremental-patch option.
809         * output.cc (Output_section::Output_section): Initialize new data
810         members.
811         (Output_section::add_input_section): Print section name when out
812         of patch space.
813         (Output_section::add_output_section_data): Likewise.
814         (Output_section::set_final_data_size): Add patch space when
815         doing --incremental-full.
816         (Output_section::do_reset_address_and_file_offset): Remove patch
817         space.
818         (Output_segment::set_section_list_addresses): Print debug output
819         only if --incremental-update.
820         * output.h (Output_section::set_is_patch_space_allowed): New function.
821         (Output_section::is_patch_space_allowed_): New data member.
822         (Output_section::patch_space_): New data member.
823         * parameters.cc (Parameters::incremental_full): New function.
824         * parameters.h (Parameters::incremental_full): New function
825         * testsuite/Makefile.am (incremental_test_2): Add test for
826         --incremental-patch option.
827         * testsuite/Makefile.in: Regenerate.
828         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
829         (t18): Remove function body.
830
831 2011-07-05  Doug Kwan  <dougkwan@google.com>
832
833         PR gold/12771
834         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
835         Arm_Address type for relocation result.
836         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
837         overflow check.
838         (Arm_relocate_functions::abs32): Use unaligned access.
839         (Arm_relocate_functions::rel32): Ditto.
840         (Arm_relocate_functions::prel31): Ditto.
841         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
842         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
843         static data relocations.
844         * testsuite/Makefile.in: Regnerate.
845         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
846
847 2011-07-05  Ian Lance Taylor  <iant@google.com>
848
849         PR gold/12392
850         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
851         symbols if necessary.
852         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
853
854 2011-07-05  Ian Lance Taylor  <iant@google.com>
855
856         PR gold/12952
857         * resolve.cc (Symbol::override_base_with_special): Simply override
858         version with special symbol version, ignoring previous version.
859
860 2011-07-05  Ian Lance Taylor  <iant@google.com>
861
862         * object.cc (Sized_relobj_file::include_section_group): Add
863         information to comment about signature location.
864
865 2011-07-02  Ian Lance Taylor  <iant@google.com>
866
867         PR gold/12957
868         * options.h (class General_options): Add -f and -F.
869         * options.cc (General_options::finalize): Fatal error if -f/-F
870         are used without -shared.
871         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
872
873 2011-07-02  Ian Lance Taylor  <iant@google.com>
874
875         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
876
877 2011-07-01  Ian Lance Taylor  <iant@google.com>
878
879         PR gold/12525
880         PR gold/12952
881         * resolve.cc (Symbol::override_base_with_special): Don't override
882         the version if the overriding symbol has a different name.
883         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
884         all callers.  If we give an error about an undefined version,
885         define the base version if necessary.
886         * dynobj.h (class Versions): Update declaration.
887         * testsuite/weak_alias_test_5.cc: New file.
888         * testsuite/weak_alias_test.script: New file.
889         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
890         and versioned_alias have the right value, and call t2.
891         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
892         weak_alias_test_5.so.
893         (weak_alias_test_LDADD): Likewise.
894         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
895         * testsuite/Makefile.in: Rebuild.
896
897 2011-07-01  Ian Lance Taylor  <iant@google.com>
898
899         PR gold/12525
900         * options.h (class General_options): Support -z notext.
901         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
902         -Wl,-z,notext.
903         (two_file_shared_nonpic.so): Likewise.
904         (two_file_shared_mixed.so): Likewise.
905         (two_file_shared_mixed_1.so): Likewise.
906         (weak_undef_lib_nonpic.so): Likewise.
907         (alt/weak_undef_lib_nonpic.so): Likewise.
908         (tls_test_shared_nonpic.so): Likewise.
909         * testsuite/Makefile.in: Rebuild.
910
911 2011-07-01  Ian Lance Taylor  <iant@google.com>
912
913         PR gold/12525
914         * configure.ac: Test whether static linking works, setting
915         the automake conditional HAVE_STATIC.
916         * testsuite/Makefile.am: Disable tests using -static if
917         HAVE_STATIC is not true.
918         * configure, testsuite/Makefile.in: Rebuild.
919
920 2011-07-01  Ian Lance Taylor  <iant@google.com>
921
922         PR gold/12525
923         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
924         Assert if we see DW_EH_PE_indirect.
925         * target.h (Target::ehframe_datarel_base): New function.
926         (Target::do_ehframe_datarel_base): New target function.
927         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
928         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
929         function.
930
931 2011-07-01  Ian Lance Taylor  <iant@google.com>
932
933         PR gold/12571
934         * options.h (class General_options): Add
935         --ld-generated-unwind-info.
936         * ehframe.cc (Fde::write): Add address parameter.  Change all
937         callers.  If associated with PLT, fill in address and size.
938         (Cie::set_output_offset): Only add merge mapping if there is an
939         object.
940         (Cie::write): Add address parameter.  Change all callers.
941         (Eh_frame::add_ehframe_for_plt): New function.
942         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
943         input_offset_ fields into union u_, with new plt field.
944         (Fde::Fde): Adjust for new union field.
945         (Fde::Fde) [Output_data version]: New constructor.
946         (Fde::add_mapping): Only add merge mapping if there is an object.
947         (class Cie): Update declarations.
948         (class Eh_frame): Declare add_ehframe_for_plt.
949         * layout.cc (Layout::layout_eh_frame): Break out code into
950         make_eh_frame_section, and call it.
951         (Layout::make_eh_frame_section): New function.
952         (Layout::add_eh_frame_for_plt): New function.
953         * layout.h (class Layout): Update declarations.
954         * merge.cc (Merge_map::add_mapping): Add assertion.
955         * i386.cc: Include "dwarf.h".
956         (class Output_data_plt_i386): Make first_plt_entry,
957         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
958         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
959         and plt_eh_frame_fde.
960         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
961         boundary.  Call add_eh_frame_for_plt if appropriate.
962         * x86_64.cc: Include "dwarf.h".
963         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
964         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
965         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
966         and plt_eh_frame_fde.
967         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
968         appropriate.
969
970 2011-06-29  Ian Lance Taylor  <iant@google.com>
971
972         PR gold/12629
973         * object.cc (Sized_relobj_file::layout_section): Change shdr
974         parameter to be const.
975         (Sized_relobj_file::layout_eh_frame_section): New function, broken
976         out of do_layout.
977         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
978         appropriate.  Call layout_eh_frame_section.
979         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
980         sections.
981         * object.h (class Sized_relobj_file): Update declarations.
982
983 2011-06-29  Ian Lance Taylor  <iant@google.com>
984
985         PR gold/12652
986         * script.cc (Token::integer_value): Accept trailing M/m/K/k
987         modifier.
988         (Lex::gather_token): Accept trailing M/m/K/k for integers.
989
990 2011-06-29  Ian Lance Taylor  <iant@google.com>
991
992         PR gold/12675
993         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
994         SHT_X86_64_UNWIND.
995         * layout.cc (Layout::layout_eh_frame): Likewise.
996
997 2011-06-29  Ian Lance Taylor  <iant@google.com>
998
999         PR gold/12695
1000         * layout.cc (Layout::symtab_section_shndx): New function.
1001         * layout.h (class Layout): Declare symtab_section_shndx.
1002         * output.cc (Output_section::write_header): Call it.
1003
1004 2011-06-29  Ian Lance Taylor  <iant@google.com>
1005
1006         PR gold/12818
1007         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1008         symbols which are not used in a relocation.
1009
1010 2011-06-28  Ian Lance Taylor  <iant@google.com>
1011
1012         PR gold/12898
1013         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1014         script create indistinguishable segments.
1015         (Layout::set_segment_offsets): Use stable_sort when sorting
1016         segments.  Pass this to Compare_segments constructor.
1017         * layout.h (class Layout): Make segment_precedes non-static.
1018         (class Compare_segments): Change from struct to class.  Add
1019         layout_ field.  Add constructor.
1020         * script-sections.cc
1021         (Script_sections::attach_sections_using_phdrs_clause): Rename
1022         local orphan to is_orphan.  Don't report failure to put empty
1023         section in segment.  On attachment failure, report name of
1024         section, and attach to first PT_LOAD segment.
1025
1026 2011-06-28  Ian Lance Taylor  <iant@google.com>
1027
1028         PR gold/12934
1029         * target-select.cc (Target_selector::Target_selector): Add
1030         emulation parameter.  Change all callers.
1031         (select_target_by_bfd_name): Rename from select_target_by_name.
1032         Change all callers.
1033         (select_target_by_emulation): New function.
1034         (supported_emulation_names): New function.
1035         * target-select.h (class Target_selector): Add emulation_ field.
1036         Update declarations.
1037         (Target_selector::recognize_by_bfd_name): Rename from
1038         recognize_by_name.  Change all callers.
1039         (Target_selector::supported_bfd_names): Rename from
1040         supported_names.  Change all callers.
1041         (Target_selector::recognize_by_emulation): New function.
1042         (Target_selector::supported_emulations): New function.
1043         (Target_selector::emulation): New function.
1044         (Target_selector::do_recognize_by_bfd_name): Rename from
1045         do_recognize_by_name.  Change all callers.
1046         (Target_selector::do_supported_bfd_names): Rename from
1047         do_supported_names.  Change all callers.
1048         (Target_selector::do_recognize_by_emulation): New function.
1049         (Target_selector::do_supported_emulations): New function.
1050         (select_target_by_bfd_name): Change name in declaration.
1051         (select_target_by_emulation): Declare.
1052         (supported_emulation_names): Declare.
1053         * parameters.cc (parameters_force_valid_target): Try to find
1054         target based on emulation from -m option.
1055         * options.h (class General_options): Change doc string for -m.
1056         * options.cc (help): Print emulations.
1057         (General_options::parse_V): Likewise.
1058         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1059         Add emulation parameter.  Change all callers.
1060
1061 2011-06-28  Ian Lance Taylor  <iant@google.com>
1062
1063         * target.h (class Target): Add osabi_ field.
1064         (Target::osabi): New function.
1065         (Target::set_osabi): New function.
1066         (Target::Target): Initialize osabi_.
1067         (Target::do_adjust_elf_header): Make pure virtual.
1068         (Sized_target::do_adjust_elf_header): Declare.
1069         * target.cc (Sized_target::do_adjust_elf_header): New function.
1070         (class Sized_target): Instantiate all versions.
1071         * freebsd.h (class Target_freebsd): Remove.
1072         (Target_selector_freebsd::do_recognize): Call set_osabi on
1073         Target.
1074         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1075         (Target_selector_freebsd::set_osabi): Remove.
1076         * i386.cc (class Target_i386): Inherit from Sized_target rather
1077         than Target_freebsd.
1078         * x86_64.cc (class Target_x86_64): Likewise.
1079
1080 2011-06-28  Ian Lance Taylor  <iant@google.com>
1081
1082         * target.h (Target::can_check_for_function_pointers): Rewrite.
1083         Make non-virtual.
1084         (Target::can_icf_inline_merge_sections): Likewise.
1085         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1086         (Target::Target_info): Add can_icf_inline_merge_sections field.
1087         (Target::do_can_check_for_function_pointers): New virtual
1088         function.
1089         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1090         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1091         from can_check_for_function_pointers, move in file.
1092         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1093         section_may_have_icf_unsafe_poineters, move in file.
1094         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1095         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1096         Rename from can_check_for_function_pointers, move in file.
1097         (Target_i386::can_icf_inline_merge_sections): Remove.
1098         (Target_i386::i386_info): Initialize
1099         can_icf_inline_merge_sections.
1100         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1101         Initialize can_icf_inline_merge_sections.
1102         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1103         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1104         Rename from can_check_for_function_pointers, move in file.
1105         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1106         (Target_x86_64::x86_64_info): Initialize
1107         can_icf_inline_merge_sections.
1108         * testsuite/testfile.cc (Target_test::test_target_info):
1109         Likewise.
1110         * icf.cc (get_section_contents): Correct formatting.
1111
1112 2011-06-27  Ian Lance Taylor  <iant@google.com>
1113
1114         * symtab.cc (Symbol::versioned_name): New function.
1115         (Symbol_table::add_to_final_symtab): Use versioned_name when
1116         appropriate.
1117         (Symbol_table::sized_write_symbol): Likewise.
1118         * symtab.h (class Symbol): Declare versioned_name.
1119         * stringpool.h (class Stringpool_template): Add variant of add
1120         which takes a std::basic_string.
1121         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1122         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1123         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1124         (ver_test_12.o): New target.
1125         * testsuite/Makefile.in: Rebuild.
1126
1127 2011-06-27  Doug Kwan  <dougkwan@google.com>
1128
1129         * arm.cc (Arm_relocate_functions::thm_jump8,
1130         Arm_relocate_functions::thm_jump11): Use a wider signed
1131         type to compute offset.
1132         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1133         arm_thm_jump8.
1134         * testsuite/Makefile.in: Regenerate.
1135         * testsuite/arm_branch_in_range.sh: Check test results of
1136         arm_thm_jump11 and arm_thm_jump8.
1137         * testsuite/arm_thm_jump11.s: New test source file.
1138         * testsuite/arm_thm_jump11.t: New linker script.
1139         * testsuite/arm_thm_jump8.s: New test source file.
1140         * testsuite/arm_thm_jump8.t: New linker script.
1141
1142 2011-06-24  Ian Lance Taylor  <iant@google.com>
1143
1144         * layout.cc: Include "object.h".
1145         (ctors_sections_in_init_array): New static variable.
1146         (Layout::is_ctors_in_init_array): New function.
1147         (Layout::layout): Add entry to ctors_sections_in_init_array if
1148         appropriate.
1149         * layout.h (class Layout): Declare is_ctors_in_init_array.
1150         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1151         is_ctors_reverse_view is set.
1152         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1153         all callers.  Set is_ctors_reverse_view field of View_size.
1154         (Sized_relobj_file::reverse_words): New function.
1155         * object.h (Sized_relobj_file::View_size): Add
1156         is_ctors_reverse_view field.
1157         (class Sized_relobj_file): Update declarations.
1158         * testsuite/initpri3.c: New test.
1159         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1160         initpri3b.
1161         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1162         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1163         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1164         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1165         * testsuite/Makefile.in: Rebuild.
1166
1167 2011-06-24  Cary Coutant  <ccoutant@google.com>
1168
1169         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1170         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1171         (debug_msg_cdebug.err): New targets.
1172         * testsuite/Makefile.in: Regenerate.
1173         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1174         Fix checks for link with shared library.
1175
1176 2011-06-24  Doug Kwan  <dougkwan@google.com>
1177
1178         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1179         skip empty text sections.
1180         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1181
1182 2011-06-22  Ian Lance Taylor  <iant@google.com>
1183
1184         PR gold/12910
1185         * options.h (class General_options): Add --ctors-in-init-array.
1186         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1187         friends as SHT_PROGBITS for merging sections.
1188         (Layout::layout): Remove special handling of .init_array and
1189         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1190         and .dtors if ctors_in_init_array.
1191         (Layout::make_output_section): Force correct section types for
1192         .init_array and friends.  Don't sort if doing relocatable link,
1193         Don't sort .ctors and .dtors if ctors_in_init_array.
1194         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1195         (Layout::output_section_name): Add relobj parameter.  Change all
1196         callers.  Handle .ctors. and .dtors. in code rather than table.
1197         Handle .ctors and .dtors if ctors_in_init_array.
1198         (Layout::match_file_name): New function, moved from output.cc.
1199         * layout.h (class Layout): Update declarations.
1200         * output.cc: Include "layout.h".
1201         (Input_section_sort_entry::get_priority): New function.
1202         (Input_section_sort_entry::match_file_name): Just call
1203         Layout::match_file_name.
1204         (Output_section::Input_section_sort_init_fini_compare::operator()):
1205         Handle .ctors and .dtors.  Sort by explicit priority rather than
1206         by name.
1207         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1208         * testsuite/initpri2.c: New test.
1209         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1210         (check_PROGRAMS): Add initpri2.
1211         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1212         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1213         * configure, testsuite/Makefile.in: Rebuild.
1214
1215 2011-06-19  Ian Lance Taylor  <iant@google.com>
1216
1217         PR gold/12880
1218         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1219         .interp section to a PT_INTERP segment even if we have seen a
1220         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1221         clause in a linker script.
1222         (Layout::finalize): Don't create a .interp section if we've
1223         already create a PT_INTERP segment.
1224         (Layout::create_interp): Always call choose_output_section (revert
1225         patch of 2011-06-17).  Don't create PT_INTERP segment.
1226         * script-sections.cc
1227         (Script_sections::create_note_and_tls_segments): Add a .interp
1228         section to a PT_INTERP segment even if we have seen a
1229         --dynamic-linker option.
1230
1231 2011-06-18  Ian Lance Taylor  <iant@google.com>
1232
1233         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1234         merely because a non-PT_LOAD segment has a dynamic reloc.
1235
1236 2011-06-18  Ian Lance Taylor  <iant@google.com>
1237
1238         * layout.cc (Layout::finish_dynamic_section): Don't create
1239         DT_FLAGS entry if not needed.
1240
1241 2011-06-18  Ian Lance Taylor  <iant@google.com>
1242
1243         PR gold/12745
1244         * layout.cc (Layout::layout_eh_frame): Correct handling of
1245         writable .eh_frame section.
1246
1247 2011-06-17  Ian Lance Taylor  <iant@google.com>
1248
1249         PR gold/12893
1250         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1251         symbol is redefined with the exact same object and value.
1252
1253 2011-06-17  Ian Lance Taylor  <iant@google.com>
1254
1255         PR gold/12880
1256         * layout.h (class Layout): Add interp_segment_ field.
1257         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1258         (Layout::attach_allocated_section_to_segment): If making shared
1259         library, put .interp section in PT_INTERP segment.
1260         (Layout::finalize): Also call create_interp if -dynamic-linker
1261         option was used.
1262         (Layout::create_interp): Assert that there is no PT_INTERP
1263         segment.  If not using a SECTIONS clause, use make_output_section.
1264         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1265         * script-sections.cc
1266         (Script_sections::create_note_and_tls_segments): If making shared
1267         library, put .interp section in PT_INTERP segment.
1268
1269 2011-06-17  Ian Lance Taylor  <iant@google.com>
1270
1271         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1272         when making a shared library.
1273
1274 2011-06-17  Ian Lance Taylor  <iant@google.com>
1275
1276         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1277         parameter.  Change all callers.  Don't issue warning about PC32
1278         against locally defined symbol.
1279
1280 2011-06-16  Ian Lance Taylor  <iant@google.com>
1281
1282         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1283         occurs in same object.
1284
1285 2011-06-14  Alan Modra  <amodra@gmail.com>
1286
1287         * po/POTFILES.in: Regenerate.
1288
1289 2011-06-09  Ian Lance Taylor  <iant@google.com>
1290
1291         * script-sections.cc
1292         (Orphan_output_section::set_section_addresses): For a relocatable
1293         link set address to 0.
1294
1295 2011-06-09  Cary Coutant  <ccoutant@google.com>
1296
1297         PR gold/12804
1298         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1299         used with --compress-debug-sections.
1300         * gold/object.cc (Sized_relobj_file::do_layout): Report
1301         uncompressed size of compressed input sections.
1302
1303 2011-06-08  Cary Coutant  <ccoutant@google.com>
1304
1305         PR gold/12804
1306         * testsuite/two_file_test_2_v1.cc: Change initialization of
1307         v2 to keep it in .data.
1308
1309 2011-06-07  Cary Coutant  <ccoutant@google.com>
1310
1311         * common.cc (Symbol_table::do_allocate_commons_list): Call
1312         gold_fallback.
1313         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1314         (Errors::fallback): New function.
1315         (gold_fallback): New function.
1316         * errors.h (Errors::fallback): New function.
1317         * gold.cc (gold_exit): Change status parameter to enum; adjust
1318         all callers.
1319         (queue_initial_tasks): Call gold_fallback.
1320         * gold.h: Include cstdlib.
1321         (Exit_status): New enum type.
1322         (gold_exit): Change status parameter to enum.
1323         (gold_fallback): New function.
1324         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1325         (Layout::create_symtab_sections): Likewise.
1326         (Layout::create_shdrs): Likewise.
1327         * main.cc (main): Adjust call to gold_exit.
1328         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1329         (Output_data_got::add_got_entry_pair): Likewise.
1330         (Output_section::add_input_section): Likewise.
1331         (Output_section::add_output_section_data): Likewise.
1332         (Output_segment::set_section_list_addresses): Likewise.
1333         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1334
1335 2011-06-07  Cary Coutant  <ccoutant@google.com>
1336
1337         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1338         for incremental links.
1339         * output.cc (Output_segment::set_section_list_addresses): Remove
1340         FIXME and test for TLS or BSS.
1341
1342 2011-06-07  Cary Coutant  <ccoutant@google.com>
1343
1344         * testsuite/Makefile.am: Add incremental_copy_test,
1345         incremental_common_test_1.
1346         * testsuite/Makefile.in: Regenerate.
1347         * testsuite/common_test_1_v1.c: New source file.
1348         * testsuite/common_test_1_v2.c: New source file.
1349         * testsuite/copy_test_v1.cc: New source file.
1350
1351 2011-06-07  Cary Coutant  <ccoutant@google.com>
1352
1353         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1354         update, allocate common from bss section's free list.
1355         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1356         linker-defined symbols.
1357         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1358         Skip GOT and PLT entries that are no longer referenced.
1359         (Output_section_incremental_inputs::write_info_blocks): Mark
1360         linker-defined symbols.
1361         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1362         * output.cc (Output_section::allocate): New function.
1363         * output.h (Output_section::allocate): New function.
1364         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1365         linker-defined symbols.
1366         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1367         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1368         (Symbol::init_base_output_data): Likewise.
1369         (Symbol::init_base_output_segment): Likewise.
1370         (Symbol::init_base_constant): Likewise.
1371         (Sized_symbol::init_output_data): Likewise.
1372         (Sized_symbol::init_output_segment): Likewise.
1373         (Sized_symbol::init_constant): Likewise.
1374         (Symbol_table::do_define_in_output_data): Likewise.
1375         (Symbol_table::do_define_in_output_segment): Likewise.
1376         (Symbol_table::do_define_as_constant): Likewise.
1377         * symtab.h (Symbol::is_predefined): New function.
1378         (Symbol::init_base_output_data): Add is_predefined parameter.
1379         (Symbol::init_base_output_segment): Likewise.
1380         (Symbol::init_base_constant): Likewise.
1381         (Symbol::is_predefined_): New data member.
1382         (Sized_symbol::init_output_data): Add is_predefined parameter.
1383         (Sized_symbol::init_output_segment): Likewise.
1384         (Sized_symbol::init_constant): Likewise.
1385         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1386
1387 2011-06-07  Cary Coutant  <ccoutant@google.com>
1388
1389         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1390         instead of emit_copy_reloc.
1391         (Copy_relocs::emit_copy_reloc): Refactor.
1392         (Copy_relocs::make_copy_reloc): New function.
1393         (Copy_relocs::add_copy_reloc): Remove.
1394         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1395         section.
1396         (Copy_relocs::make_copy_reloc): New function.
1397         (Copy_relocs::add_copy_reloc): Remove.
1398         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1399         unchanged input files.
1400         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1401         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1402         Reserve BSS space for COPY relocations.
1403         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1404         (Output_section_incremental_inputs::write_info_blocks): Record
1405         whether a symbol is copied from a shared object.
1406         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1407         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1408         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1409         (Incremental_input_entry_reader::get_output_symbol_index): Add
1410         is_copy parameter.
1411         (Incremental_binary::emit_copy_relocs): New function.
1412         (Incremental_binary::do_emit_copy_relocs): New function.
1413         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1414         new data member.
1415         (Sized_incremental_binary::add_copy_reloc): New function.
1416         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1417         (Sized_incremental_binary::Copy_reloc): New struct.
1418         (Sized_incremental_binary::Copy_relocs): New typedef.
1419         (Sized_incremental_binary::copy_relocs_): New data member.
1420         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1421         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1422         * target.h (Sized_target::emit_copy_reloc): New function.
1423         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1424
1425 2011-06-02  Cary Coutant  <ccoutant@google.com>
1426
1427         PR gold/12163
1428         * gold/archive.cc (Archive::Archive): Initialize new data member.
1429         (Archive::include_all_members): Return if archive has already been
1430         included.
1431         * gold/archive.h (Archive::include_all_members_): New data member.
1432
1433 2011-06-02  Nick Clifton  <nickc@redhat.com>
1434
1435         * dynobj.h: Fix spelling mistake in comment.
1436         * output.cc: Likewise.
1437
1438 2011-05-31  Doug Kwan  <dougkwan@google.com>
1439             Asier Llano
1440
1441         PR gold/12826
1442         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1443         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1444         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1445         redundant arm_exidx_test.so.
1446         * testsuite/Makefile.in: Regenerate.
1447         (check_SCRIPTS): Add pr12826.sh
1448         (check_DATA): Add pr12826.stdout
1449         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1450         * testsuite/pr12826.sh: New file.
1451         * testsuite/pr12826_1.s: Ditto.
1452         * testsuite/pr12826_1.s: Ditto.
1453
1454 2011-05-30  Ian Lance Taylor  <iant@google.com>
1455
1456         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1457         sections.
1458
1459 2011-05-29  Ian Lance Taylor  <iant@google.com>
1460
1461         PR gold/12804
1462         * testsuite/Makefile.am: Use different file name for two_file_test
1463         temporary file for each incremental test.
1464         * testsuite/Makefile.in: Rebuild.
1465
1466 2011-05-29  Ian Lance Taylor  <iant@google.com>
1467
1468         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1469         binary input file is empty.
1470
1471 2011-05-27  Ian Lance Taylor  <iant@google.com>
1472
1473         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1474         (ver_test_9.so): Likewise.
1475         * testsuite/Makefile.in: Rebuild.
1476
1477 2011-05-26 Cary Coutant  <ccoutant@google.com>
1478
1479         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1480         * incremental.cc (Incremental_inputs::report_input_section): Fix
1481         comment, indentation.
1482         (Incremental_inputs::report_comdat_group): New function.
1483         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1484         of data for incremental input file entry.
1485         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1486         group count, COMDAT group signatures.
1487         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1488         an unchanged input file.
1489         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1490         Initialize new data member.
1491         (Incremental_object_entry::add_comdat_group): New function.
1492         (Incremental_object_entry::get_comdat_group_count): New function.
1493         (Incremental_object_entry::get_comdat_signature_key): New function.
1494         (Incremental_object_entry::groups_): New data member.
1495         (Incremental_inputs::report_comdat_group): New function.
1496         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1497         data for incremental input file entry.
1498         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1499         (Incremental_input_entry_reader::get_input_section): Adjust size of
1500         data for incremental input file entry.
1501         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1502         (Incremental_input_entry_reader::get_comdat_group_signature): New
1503         function.
1504         * object.cc (Sized_relobj::include_section_group): Report kept
1505         COMDAT groups for incremental links.
1506
1507 2011-05-24  David Meyer  <pdox@google.com>
1508
1509         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1510         with name parameter.  Add found_name parameter.
1511         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1512         * dirsearch.h (class Dirsearch): Update declaration.
1513
1514 2011-05-24  Ian Lance Taylor  <iant@google.com>
1515
1516         * archive.cc (Library_base::should_include_member): Pull in object
1517         from archive if it defines the entry symbol.
1518         * parameters.cc (Parameters::entry): New function.
1519         * parameters.h (class Parameters): Declare entry.
1520         * output.h (class Output_file_header): Remove entry_ field.
1521         * output.cc (Output_file_header::Output_file_header): Remove entry
1522         parameter.  Change all callers.
1523         (Output_file_header::entry): Use parameters->entry.
1524         * gold.cc (queue_middle_tasks): Likewise.
1525         * plugin.cc (Plugin_hook::run): Likewise.
1526
1527 2011-05-24 Cary Coutant  <ccoutant@google.com>
1528
1529         * gold.cc (queue_initial_tasks): Pass incremental base filename
1530         to Output_file::open_base_file; don't print error message.
1531         * incremental-dump.cc (main): Adjust call to
1532         Output_file::open_for_modification.
1533         * incremental-dump.cc (main): Likewise.
1534         * incremental.cc (Incremental_inputs::report_command_line):
1535         Ignore --incremental-base option when comparing command lines.
1536         Ignore parameter when given as separate argument.
1537         * options.h (class General_options): Add --incremental-base.
1538         * output.cc (Output_file::Output_file):
1539         (Output_file::open_base_file): Add base_name and writable parameters;
1540         read base file into new file; print error message here.
1541         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1542         callers.
1543         * output.h (Output_file::open_for_modification): Rename to...
1544         (Output_file::open_base_file): ...this; add base_name and
1545         writable parameters; adjust all callers.
1546         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1547         callers.
1548         * testsuite/Makefile.am (incremental_test_4): Test
1549         --incremental-base.
1550         * testsuite/Makefile.in: Regenerate.
1551
1552 2011-05-24 Cary Coutant  <ccoutant@google.com>
1553
1554         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1555         incremental_test_4.
1556         * testsuite/Makefile.in: Regenerate.
1557         * testsuite/two_file_test_1_v1.cc: New test source file.
1558         * testsuite/two_file_test_1b_v1.cc: New test source file.
1559         * testsuite/two_file_test_2_v1.cc: New test source file.
1560
1561 2011-05-24 Cary Coutant  <ccoutant@google.com>
1562
1563         * dynobj.h (Dynobj::do_dynobj): New function.
1564         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1565         flag and soname for shared objects.
1566         * incremental.cc (Incremental_inputs::report_object): Make
1567         either Incremental_object_entry or Incremental_dynobj_entry; add
1568         soname to string table.
1569         (Incremental_inputs::report_input_section): Add assertion.
1570         (Output_section_incremental_inputs::set_final_data_size): Adjust
1571         type of input file entry for shared libraries; adjust size of
1572         shared library info entry.
1573         (Output_section_incremental_inputs::write_input_files): Write
1574         as_needed flag for shared libraries.
1575         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1576         of input file entry for shared libraries; write soname.
1577         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1578         soname from incremental info.
1579         * incremental.h (enum Incremental_input_flags): Add
1580         INCREMENTAL_INPUT_AS_NEEDED.
1581         (Incremental_input_entry::Incremental_input_entry): Initialize new
1582         data member.
1583         (Incremental_input_entry::set_as_needed): New function.
1584         (Incremental_input_entry::as_needed): New function.
1585         (Incremental_input_entry::do_dynobj_entry): New function.
1586         (Incremental_input_entry::as_needed_): New data member.
1587         (Incremental_object_entry::Incremental_object_entry): Don't check
1588         for shared library.
1589         (Incremental_object_entry::do_type): Likewise.
1590         (class Incremental_dynobj_entry): New class.
1591         (Incremental_input_entry_reader::as_needed): New function.
1592         (Incremental_input_entry_reader::get_soname): New function.
1593         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1594         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1595         size of shared library info entry.
1596         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1597         incremental link when adding DT_NEEDED entries.
1598         * object.h (Object::Object): Initialize new data member.
1599         (Object::dynobj): New function.
1600         (Object::set_as_needed): New function.
1601         (Object::as_needed): New function.
1602         (Object::do_dynobj): New function.
1603         (Object::as_needed_): New data member.
1604
1605 2011-05-24 Cary Coutant  <ccoutant@google.com>
1606
1607         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1608         info; adjust display of GOT entries.
1609         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1610         vector of input objects; remove file_status_.
1611         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1612         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1613         got_plt reader; call target hooks to reserve GOT entries.
1614         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1615         of input file info header and GOT info entry.
1616         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1617         relocation info.
1618         (Got_plt_view_info::got_descriptor): Remove.
1619         (Got_plt_view_info::sym_index): New data member.
1620         (Got_plt_view_info::input_index): New data member.
1621         (Local_got_offset_visitor::visit): Write input file index.
1622         (Global_got_offset_visitor::visit): Write 0 for input file index.
1623         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1624         with sym_index and input_index.
1625         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1626         incremental info GOT entry; replace got_descriptor with input_index.
1627         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1628         map from input file index to object.
1629         (Sized_relobj_incr::do_layout): Replace direct data member reference
1630         with accessor function.
1631         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1632         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1633         Adjust size of input file info header.
1634         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1635         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1636         (Incremental_input_entry_reader::get_input_section): Adjust size of
1637         input file info header.
1638         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1639         of incremental info GOT entry.
1640         (Incremental_got_plt_reader::get_got_desc): Remove.
1641         (Incremental_got_plt_reader::get_got_symndx): New function.
1642         (Incremental_got_plt_reader::get_got_input_index): New function.
1643         (Sized_incremental_binary::Sized_incremental_binary): Remove
1644         file_status_; add input_objects_.
1645         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1646         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1647         (Sized_incremental_binary::file_is_unchanged): Remove.
1648         (Sized_incremental_binary::set_input_object): New function.
1649         (Sized_incremental_binary::input_object): New function.
1650         (Sized_incremental_binary::file_status_): Remove.
1651         (Sized_incremental_binary::input_objects_): New data member.
1652         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1653         references.
1654         (Sized_relobj_incr::invalid_address): Move to base class.
1655         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1656         class.
1657         (Sized_relobj_incr::do_output_section_offset): Likewise.
1658         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1659         (Sized_relobj_incr::section_offsets_): Likewise.
1660         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1661         function.
1662         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1663         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1664         with accessor function.
1665         (Sized_relobj_file::do_layout): Likewise.
1666         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1667         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1668         (Sized_relobj_file::compute_final_local_value): Replace refs to
1669         section_offsets_ with accessor function.
1670         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1671         * object.h (Relobj::Relobj): Initialize new data members.
1672         (Relobj::add_dyn_reloc): New function.
1673         (Relobj::first_dyn_reloc): New function.
1674         (Relobj::dyn_reloc_count): New function.
1675         (Relobj::first_dyn_reloc_): New data member.
1676         (Relobj::dyn_reloc_count_): New data member.
1677         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1678         references.
1679         (Sized_relobj::Address): New typedef.
1680         (Sized_relobj::invalid_address): Move here from child class.
1681         (Sized_relobj::Sized_relobj): Initialize new data members.
1682         (Sized_relobj::sized_relobj): New function.
1683         (Sized_relobj::is_output_section_offset_invalid): Move here from
1684         child class.
1685         (Sized_relobj::get_output_section_offset): Likewise.
1686         (Sized_relobj::local_has_got_offset): Likewise.
1687         (Sized_relobj::local_got_offset): Likewise.
1688         (Sized_relobj::set_local_got_offset): Likewise.
1689         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1690         (Sized_relobj::clear_got_offsets): New function.
1691         (Sized_relobj::section_offsets): Move here from child class.
1692         (Sized_relobj::do_output_section_offset): Likewise.
1693         (Sized_relobj::do_set_section_offset): Likewise.
1694         (Sized_relobj::Local_got_offsets): Likewise.
1695         (Sized_relobj::local_got_offsets_): Likewise.
1696         (Sized_relobj::section_offsets_): Likewise.
1697         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1698         references.
1699         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1700         class.
1701         (Sized_relobj_file::sized_relobj): New function
1702         (Sized_relobj_file::local_has_got_offset): Move to base class.
1703         (Sized_relobj_file::local_got_offset): Likewise.
1704         (Sized_relobj_file::set_local_got_offset): Likewise.
1705         (Sized_relobj_file::get_output_section_offset): Likewise.
1706         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1707         (Sized_relobj_file::do_output_section_offset): Likewise.
1708         (Sized_relobj_file::do_set_section_offset): Likewise.
1709         (Sized_relobj_file::Local_got_offsets): Likewise.
1710         (Sized_relobj_file::local_got_offsets_): Likewise.
1711         (Sized_relobj_file::section_offsets_): Likewise.
1712         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1713         (all constructors).
1714         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1715         (Output_reloc::get_symbol_index): Likewise.
1716         (Output_reloc::local_section_offset): Likewise.
1717         (Output_reloc::get_address): Likewise.
1718         (Output_reloc::symbol_value): Likewise.
1719         (Output_data_got::reserve_slot): Move to class definition.
1720         (Output_data_got::reserve_local): New function.
1721         (Output_data_got::reserve_slot_for_global): Remove.
1722         (Output_data_got::reserve_global): New function.
1723         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1724         (all constructors, two instantiations).
1725         (Output_reloc::get_relobj): New function (two instantiations).
1726         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1727         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1728         (Output_data_reloc::add_global): Adjust type of relobj.
1729         (Output_data_reloc::add_global_relative): Likewise.
1730         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1731         (Output_data_reloc::add_local): Likewise.
1732         (Output_data_reloc::add_local_relative): Likewise.
1733         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1734         (Output_data_reloc::add_local_section): Likewise.
1735         (Output_data_reloc::add_output_section): Likewise.
1736         (Output_data_reloc::add_absolute): Likewise.
1737         (Output_data_reloc::add_target_specific): Likewise.
1738         (Output_data_got::reserve_slot): Move definition here.
1739         (Output_data_got::reserve_local): New function.
1740         (Output_data_got::reserve_global): New function.
1741         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1742         section_offsets_ with accessor function.
1743         (Sized_relobj_file::write_sections): Likewise.
1744         (Sized_relobj_file::do_relocate_sections): Likewise.
1745         * target.h (Sized_target::reserve_local_got_entry): New function.
1746         (Sized_target::reserve_global_got_entry): New function.
1747         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1748         (Target_x86_64::reserve_global_got_entry): New function.
1749         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1750
1751 2011-05-23 Cary Coutant  <ccoutant@google.com>
1752
1753         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1754         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1755         bit when checking got_type.
1756         * incremental.cc (Sized_incremental_binary::setup_readers):
1757         Store symbol table and string table locations; initialize bit vector
1758         of file status flags.
1759         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1760         unchanged files.
1761         (Sized_incremental_binary::do_process_got_plt): New function.
1762         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1763         (Output_section_incremental_inputs::set_final_data_size): Record
1764         file index for each input file.
1765         (Output_section_incremental_inputs::write_got_plt): Store file index
1766         instead of input entry offset for each GOT entry.
1767         * incremental.h
1768         (Incremental_input_entry::Incremental_input_entry): Initialize new
1769         data member.
1770         (Incremental_input_entry::set_offset): Store file index.
1771         (Incremental_input_entry::get_file_index): New function.
1772         (Incremental_input_entry::file_index_): New data member.
1773         (Incremental_binary::process_got_plt): New function.
1774         (Incremental_binary::do_process_got_plt): New function.
1775         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1776         data members.
1777         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1778         (Sized_incremental_binary::set_file_is_unchanged): New function.
1779         (Sized_incremental_binary::file_is_unchanged): New function.
1780         (Sized_incremental_binary::do_process_got_plt): New function.
1781         (Sized_incremental_binary::file_status_): New data member.
1782         (Sized_incremental_binary::main_symtab_loc_): New data member.
1783         (Sized_incremental_binary::main_strtab_loc_): New data member.
1784         * output.cc (Output_data_got::Got_entry::write): Add case
1785         RESERVED_CODE.
1786         (Output_data_got::add_global): Call add_got_entry.
1787         (Output_data_got::add_global_plt): Likewise.
1788         (Output_data_got::add_global_with_rel): Likewise.
1789         (Output_data_got::add_global_with_rela): Likewise.
1790         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1791         (Output_data_got::add_global_pair_with_rela): Likewise.
1792         (Output_data_got::add_local): Call add_got_entry.
1793         (Output_data_got::add_local_plt): Likewise.
1794         (Output_data_got::add_local_with_rel): Likewise.
1795         (Output_data_got::add_local_with_rela): Likewise.
1796         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1797         (Output_data_got::add_local_pair_with_rela): Likewise.
1798         (Output_data_got::reserve_slot): New function.
1799         (Output_data_got::reserve_slot_for_global): New function.
1800         (Output_data_got::add_got_entry): New function.
1801         (Output_data_got::add_got_entry_pair): New function.
1802         (Output_section::add_output_section_data): Edit FIXME.
1803         * output.h
1804         (Output_section_data_build::Output_section_data_build): New
1805         constructor with size parameter.
1806         (Output_data_space::Output_data_space): Likewise.
1807         (Output_data_got::Output_data_got): Initialize new data member; new
1808         constructor with size parameter.
1809         (Output_data_got::add_constant): Call add_got_entry.
1810         (Output_data_got::reserve_slot): New function.
1811         (Output_data_got::reserve_slot_for_global): New function.
1812         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1813         (Output_data_got::add_got_entry): New function.
1814         (Output_data_got::add_got_entry_pair): New function.
1815         (Output_data_got::free_list_): New data member.
1816         * target.h (Sized_target::init_got_plt_for_update): New function.
1817         (Sized_target::register_global_plt_entry): New function.
1818         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1819         Initialize new data member; call init; add constructor with PLT count.
1820         (Output_data_plt_x86_64::init): New function.
1821         (Output_data_plt_x86_64::add_relocation): New function.
1822         (Output_data_plt_x86_64::reserve_slot): New function.
1823         (Output_data_plt_x86_64::free_list_): New data member.
1824         (Target_x86_64::init_got_plt_for_update): New function.
1825         (Target_x86_64::register_global_plt_entry): New function.
1826         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1827         incremental updates.
1828         (Output_data_plt_x86_64::add_relocation): New function.
1829         * testsuite/object_unittest.cc (Object_test): Set default options.
1830
1831 2011-05-16  Ian Lance Taylor  <iant@google.com>
1832
1833         * options.h (class General_options): Make -i a synonym for -r.
1834
1835 2011-05-16  Ian Lance Taylor  <iant@google.com>
1836
1837         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1838
1839 2011-05-10 Cary Coutant  <ccoutant@google.com>
1840
1841         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1842         strip_all (-s).
1843
1844 2011-05-06  Ian Lance Taylor  <iant@google.com>
1845
1846         * layout.cc (Layout::layout): If the output section flags change,
1847         update the ordering.
1848
1849 2011-04-25 Cary Coutant  <ccoutant@google.com>
1850
1851         * incremental-dump.cc (dump_incremental_inputs): Print local
1852         symbol info for each input file.
1853         * incremental.cc
1854         (Output_section_incremental_inputs::set_final_data_size): Add local
1855         symbol info to input file entries in incremental info.
1856         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1857         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1858         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1859         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1860         implementation.
1861         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1862         (Sized_incr_relobj::do_relocate): Write the local symbols.
1863         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1864         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1865         Adjust size of input file header.
1866         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1867         (Incremental_inputs_reader::get_local_symbol_count): New function.
1868         (Incremental_inputs_reader::get_input_section): Adjust size of input
1869         file header.
1870         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1871         (Sized_incr_relobj::This): New typedef.
1872         (Sized_incr_relobj::sym_size): New const data member.
1873         (Sized_incr_relobj::Local_symbol): New struct.
1874         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1875         (Sized_incr_relobj::do_local_symbol_offset): New function.
1876         (Sized_incr_relobj::local_symbol_count_): New data member.
1877         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1878         (Sized_incr_relobj::local_symbol_index_): New data member.
1879         (Sized_incr_relobj::local_symbol_offset_): New data member.
1880         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1881         (Sized_incr_relobj::local_symbols_): New data member.
1882         * object.h (Relobj::output_local_symbol_count): New function.
1883         (Relobj::local_symbol_offset): New function.
1884         (Relobj::do_output_local_symbol_count): New function.
1885         (Relobj::do_local_symbol_offset): New function.
1886         (Sized_relobj::do_output_local_symbol_count): New function.
1887         (Sized_relobj::do_local_symbol_offset): New function.
1888
1889 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1890
1891         * descriptors.cc (set_close_on_exec): New function.
1892         (Descriptors::open): Use set_close_on_exec.
1893         * output.cc (S_ISLNK): Define if not defined.
1894
1895 2011-04-22 Cary Coutant  <ccoutant@google.com>
1896
1897         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1898         global symbol map.
1899         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1900         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1901         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1902         relocations.
1903         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1904         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1905         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1906         * incremental.h
1907         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1908         function.
1909         (Incremental_binary::apply_incremental_relocs): New function.
1910         (Incremental_binary::do_apply_incremental_relocs): New function.
1911         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1912         data member.
1913         (Sized_incremental_binary::add_global_symbol): New function.
1914         (Sized_incremental_binary::global_symbol): New function.
1915         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1916         (Sized_incremental_binary::symbol_map_): New data member.
1917         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1918         * target.h (Sized_target::apply_relocation): New function.
1919         * target-reloc.h (apply_relocation): New function.
1920         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1921
1922 2011-04-22  Doug Kwan  <dougkwan@google.com>
1923
1924         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1925         flag of a SHT_ARM_EXIDX section.
1926         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1927         * testsuite/Makefile.in: Regenerate.
1928         * testsuite/arm_exidx_test.s: New file.
1929         * testsuite/arm_exidx_test.sh: Same.
1930
1931 2011-04-20 Cary Coutant  <ccoutant@google.com>
1932
1933         PR gold/12689
1934         * archive.h (Incremental_archive_entry::Archive_member):
1935         Initialize arg_serial_ (second constructor).
1936
1937 2011-04-17  Ian Lance Taylor  <iant@google.com>
1938
1939         * object.cc (Relocate_info::location): Simplify location string.
1940         * errors.cc (Errors::error_at_location): Don't print program
1941         name.
1942         (Errors::warning_at_location): Likewise.
1943         (Errors::undefined_symbol): Likewise.
1944         * testsuite/debug_msg.sh: Update accordingly.
1945
1946 2011-04-14 Cary Coutant  <ccoutant@google.com>
1947
1948         * gold/layout.cc (Layout::symtab_section_offset): New function.
1949         * gold/layout.h (Layout::symtab_section_offset): New function.
1950         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1951
1952 2011-04-12  Ian Lance Taylor  <iant@google.com>
1953
1954         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1955         with MREMAP_MAYMOVE.
1956         * output.h (class Output_file): Add map_is_allocated_ field.
1957         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1958         not available, provide stubs.  If mremap is not available, #define
1959         it to gold_mremap.
1960         (MREMAP_MAYMOVE): Define if not defined.
1961         (Output_file::Output_file): Initialize map_is_allocated_.
1962         (Output_file::resize): Check map_is_allocated_.
1963         (Output_file::map_anonymous): If mmap fails, use malloc.
1964         (Output_file::unmap): Don't do anything for an anonymous map.
1965         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1966         is not available, provide stubs.
1967         (File_read::View::~View): Use free rather than delete[].
1968         (File_read::make_view): Use malloc rather than new[].  If mmap
1969         fails, use malloc.
1970         (File_read::find_or_make_view): Use malloc rather than new[].
1971         * gold.h: Remove HAVE_REMAP code.
1972         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1973         exists.  Rename mremap to gold_mremap.  If mmap is not available
1974         don't do anything.
1975         * configure, config.in: Rebuild.
1976
1977 2011-04-11  Ian Lance Taylor  <iant@google.com>
1978
1979         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1980         initialize local variable v.
1981
1982 2011-04-11  Cary Coutant  <ccoutant@google.com>
1983
1984         * archive.cc (Archive::include_member): Adjust call to
1985         report_object.
1986         (Add_archive_symbols::run): Track argument serial numbers.
1987         (Lib_group::include_member): Likewise.
1988         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1989         * archive.h (Incremental_archive_entry::Archive_member):
1990         Initialize arg_serial_.
1991         (Archive_member::arg_serial_): New data member.
1992         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1993         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1994         incremental link.
1995         (Sized_dynobj::do_for_all_local_got_entries): New function.
1996         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1997         function.
1998         * fileread.cc (get_mtime): New function.
1999         * fileread.h (get_mtime): New function.
2000         * gold.cc (queue_initial_tasks): Check for incremental update.
2001         (process_incremental_input): New function.
2002         (queue_middle_tasks): Don't force valid target for incremental
2003         update.
2004         * incremental-dump.cc (find_input_containing_global): Adjust
2005         size of symbol info entry.
2006         (dump_incremental_inputs): Dump argument serial number and
2007         in_system_directory flag; bias shndx by 1; print symbol names
2008         when dumping per-file symbol lists; use new symbol info readers.
2009         * incremental.cc
2010         (Output_section_incremental_inputs:update_data_size): New function.
2011         (Sized_incremental_binary::setup_readers): Setup input readers
2012         for each input file; build maps for files added from libraries
2013         and scripts.
2014         (Sized_incremental_binary::check_input_args): New function.
2015         (Sized_incremental_binary::do_check_inputs): Build map of argument
2016         serial numbers to input arguments.
2017         (Sized_incremental_binary::do_file_has_changed): Rename
2018         do_file_is_unchanged to this; compare file modification times.
2019         (Sized_incremental_binary::do_init_layout): New function.
2020         (Sized_incremental_binary::do_reserve_layout): New function.
2021         (Sized_incremental_binary::do_get_input_reader): Remove.
2022         (Sized_incremental_binary::get_symtab_view): New function.
2023         (Incremental_checker::can_incrementally_link_output_file): Remove.
2024         (Incremental_inputs::report_command_line): Exclude --debug options.
2025         (Incremental_inputs::report_archive_begin): Add parameter; track
2026         argument serial numbers; don't put input file entry for archive
2027         before archive members.
2028         (Incremental_inputs::report_archive_end): Put input file entry
2029         for archive after archive members.
2030         (Incremental_inputs::report_object): Add parameter; track argument
2031         serial numbers and in_system_directory flag.
2032         (Incremental_inputs::report_script): Add parameter; track argument
2033         serial numbers.
2034         (Output_section_incremental_inputs::set_final_data_size): Adjust
2035         size of symbol info entry; check for forwarding symbols.
2036         (Output_section_incremental_inputs::write_input_files): Write
2037         in_system_directory flag and argument serial number.
2038         (Output_section_incremental_inputs::write_info_blocks): Map section
2039         indices between incremental info and original input file; store
2040         input section index for each symbol.
2041         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2042         change operator() to visit().
2043         (class Global_got_offset_visitor): Likewise.
2044         (class Global_symbol_visitor_got_plt):
2045         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2046         classes.
2047         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2048         (Sized_incr_relobj::do_read_symbols): New function.
2049         (Sized_incr_relobj::do_layout): New function.
2050         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2051         (Sized_incr_relobj::do_add_symbols): New function.
2052         (Sized_incr_relobj::do_should_include_member): New function.
2053         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2054         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2055         (Sized_incr_relobj::do_section_size): New function.
2056         (Sized_incr_relobj::do_section_name): New function.
2057         (Sized_incr_relobj::do_section_contents): New function.
2058         (Sized_incr_relobj::do_section_flags): New function.
2059         (Sized_incr_relobj::do_section_entsize): New function.
2060         (Sized_incr_relobj::do_section_address): New function.
2061         (Sized_incr_relobj::do_section_type): New function.
2062         (Sized_incr_relobj::do_section_link): New function.
2063         (Sized_incr_relobj::do_section_info): New function.
2064         (Sized_incr_relobj::do_section_addralign): New function.
2065         (Sized_incr_relobj::do_initialize_xindex): New function.
2066         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2067         (Sized_incr_relobj::do_read_relocs): New function.
2068         (Sized_incr_relobj::do_gc_process_relocs): New function.
2069         (Sized_incr_relobj::do_scan_relocs): New function.
2070         (Sized_incr_relobj::do_count_local_symbols): New function.
2071         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2072         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2073         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2074         (Sized_incr_relobj::do_relocate): New function.
2075         (Sized_incr_relobj::do_set_section_offset): New function.
2076         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2077         (Sized_incr_dynobj::do_read_symbols): New function.
2078         (Sized_incr_dynobj::do_layout): New function.
2079         (Sized_incr_dynobj::do_add_symbols): New function.
2080         (Sized_incr_dynobj::do_should_include_member): New function.
2081         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2082         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2083         (Sized_incr_dynobj::do_section_size): New function.
2084         (Sized_incr_dynobj::do_section_name): New function.
2085         (Sized_incr_dynobj::do_section_contents): New function.
2086         (Sized_incr_dynobj::do_section_flags): New function.
2087         (Sized_incr_dynobj::do_section_entsize): New function.
2088         (Sized_incr_dynobj::do_section_address): New function.
2089         (Sized_incr_dynobj::do_section_type): New function.
2090         (Sized_incr_dynobj::do_section_link): New function.
2091         (Sized_incr_dynobj::do_section_info): New function.
2092         (Sized_incr_dynobj::do_section_addralign): New function.
2093         (Sized_incr_dynobj::do_initialize_xindex): New function.
2094         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2095         (make_sized_incremental_object): New function.
2096         (Incremental_library::copy_unused_symbols): New function.
2097         (Incremental_library::do_for_all_unused_symbols): New function.
2098         * incremental.h (enum Incremental_input_flags): New type.
2099         (class Incremental_checker): Remove.
2100         (Incremental_input_entry::Incremental_input_entry): Add argument
2101         serial number.
2102         (Incremental_input_entry::arg_serial): New function.
2103         (Incremental_input_entry::set_is_in_system_directory): New function.
2104         (Incremental_input_entry::is_in_system_directory): New function.
2105         (Incremental_input_entry::arg_serial_): New data member.
2106         (Incremental_input_entry::is_in_system_directory_): New data member.
2107         (class Script_info): Move here from script.h.
2108         (Script_info::Script_info): Add filename parameter.
2109         (Script_info::filename): New function.
2110         (Script_info::filename_): New data member.
2111         (Incremental_script_entry::Incremental_script_entry): Add argument
2112         serial number.
2113         (Incremental_object_entry::Incremental_object_entry): Likewise.
2114         (Incremental_object_entry::add_input_section): Build list of input
2115         sections with map to original shndx.
2116         (Incremental_object_entry::get_input_section_index): New function.
2117         (Incremental_object_entry::shndx_): New data member.
2118         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2119         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2120         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2121         serial number.
2122         (Incremental_inputs::report_archive_begin): Likewise.
2123         (Incremental_inputs::report_object): Likewise.
2124         (Incremental_inputs::report_script): Likewise.
2125         (class Incremental_global_symbol_reader): New class.
2126         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2127         and store flags and input file type.
2128         (Incremental_input_entry_reader::arg_serial): New function.
2129         (Incremental_input_entry_reader::type): Extract type from flags.
2130         (Incremental_input_entry_reader::is_in_system_directory): New function.
2131         (Incremental_input_entry_reader::get_input_section_count): Call
2132         accessor function for type.
2133         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2134         function for type; adjust size of global symbol entry.
2135         (Incremental_input_entry_reader::get_global_symbol_count): Call
2136         accessor function for type.
2137         (Incremental_input_entry_reader::get_object_count): Likewise.
2138         (Incremental_input_entry_reader::get_object_offset): Likewise.
2139         (Incremental_input_entry_reader::get_member_count): Likewise.
2140         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2141         (Incremental_input_entry_reader::get_member_offset): Likewise.
2142         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2143         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2144         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2145         (Incremental_input_entry_reader::get_global_symbol_reader): New
2146         function.
2147         (Incremental_input_entry_reader::get_output_symbol_index): New
2148         function.
2149         (Incremental_input_entry_reader::type_): Remove.
2150         (Incremental_input_entry_reader::flags_): New data member.
2151         (Incremental_inputs_reader::input_file_offset): New function.
2152         (Incremental_inputs_reader::input_file_index): New function.
2153         (Incremental_inputs_reader::input_file): Call input_file_offset.
2154         (Incremental_inputs_reader::input_file_at_offset): New function.
2155         (Incremental_relocs_reader::get_r_type): Reformat.
2156         (Incremental_relocs_reader::get_r_shndx): Reformat.
2157         (Incremental_relocs_reader::get_r_offset): Reformat.
2158         (Incremental_relocs_reader::data): New function.
2159         (Incremental_binary::Incremental_binary): Initialize new data members.
2160         (Incremental_binary::check_inputs): Add cmdline parameter.
2161         (Incremental_binary::file_is_unchanged): Remove.
2162         (Input_reader::arg_serial): New function.
2163         (Input_reader::get_unused_symbol_count): New function.
2164         (Input_reader::get_unused_symbol): New function.
2165         (Input_reader::do_arg_serial): New function.
2166         (Input_reader::do_get_unused_symbol_count): New function.
2167         (Input_reader::do_get_unused_symbol): New function.
2168         (Incremental_binary::input_file_count): New function.
2169         (Incremental_binary::get_input_reader): Change signature to use
2170         index instead of filename.
2171         (Incremental_binary::file_has_changed): New function.
2172         (Incremental_binary::get_input_argument): New function.
2173         (Incremental_binary::get_library): New function.
2174         (Incremental_binary::get_script_info): New function.
2175         (Incremental_binary::init_layout): New function.
2176         (Incremental_binary::reserve_layout): New function.
2177         (Incremental_binary::output_file): New function.
2178         (Incremental_binary::do_check_inputs): New function.
2179         (Incremental_binary::do_file_is_unchanged): Remove.
2180         (Incremental_binary::do_file_has_changed): New function.
2181         (Incremental_binary::do_init_layout): New function.
2182         (Incremental_binary::do_reserve_layout): New function.
2183         (Incremental_binary::do_input_file_count): New function.
2184         (Incremental_binary::do_get_input_reader): Change signature.
2185         (Incremental_binary::input_args_map_): New data member.
2186         (Incremental_binary::library_map_): New data member.
2187         (Incremental_binary::script_map_): New data member.
2188         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2189         new data members.
2190         (Sized_incremental_binary::output_section): New function.
2191         (Sized_incremental_binary::inputs_reader): Add const.
2192         (Sized_incremental_binary::symtab_reader): Add const.
2193         (Sized_incremental_binary::relocs_reader): Add const.
2194         (Sized_incremental_binary::got_plt_reader): Add const.
2195         (Sized_incremental_binary::get_symtab_view): New function.
2196         (Sized_incremental_binary::Inputs_reader): New typedef.
2197         (Sized_incremental_binary::Input_entry_reader): New typedef.
2198         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2199         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2200         (Sized_incremental_binary::do_file_has_changed): New function.
2201         (Sized_incremental_binary::do_init_layout): New function.
2202         (Sized_incremental_binary::do_reserve_layout): New function.
2203         (Sized_input_reader::Inputs_reader): Remove.
2204         (Sized_input_reader::Input_entry_reader): Remove.
2205         (Sized_input_reader::do_arg_serial): New function.
2206         (Sized_input_reader::do_get_unused_symbol_count): New function.
2207         (Sized_input_reader::do_get_unused_symbol): New function.
2208         (Sized_incremental_binary::do_input_file_count): New function.
2209         (Sized_incremental_binary::do_get_input_reader): Change signature;
2210         use index instead of filename.
2211         (Sized_incremental_binary::section_map_): New data member.
2212         (Sized_incremental_binary::input_entry_readers_): New data member.
2213         (class Sized_incr_relobj): New class.
2214         (class Sized_incr_dynobj): New class.
2215         (make_sized_incremental_object): New function.
2216         (class Incremental_library): New class.
2217         * layout.cc (Free_list::num_lists): New static data member.
2218         (Free_list::num_nodes): New static data member.
2219         (Free_list::num_removes): New static data member.
2220         (Free_list::num_remove_visits): New static data member.
2221         (Free_list::num_allocates): New static data member.
2222         (Free_list::num_allocate_visits): New static data member.
2223         (Free_list::init): New function.
2224         (Free_list::remove): New function.
2225         (Free_list::allocate): New function.
2226         (Free_list::dump): New function.
2227         (Free_list::print_stats): New function.
2228         (Layout_task_runner::run): Resize output file for incremental updates.
2229         (Layout::Layout): Initialize new data members.
2230         (Layout::set_incremental_base): New function.
2231         (Layout::init_fixed_output_section): New function.
2232         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2233         incremental updates.
2234         (Layout::create_gold_note): Do not create gold note section for
2235         incremental updates.
2236         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2237         for incremental updates.
2238         (Layout::set_section_offsets): For incremental updates, allocate space
2239         from free list.
2240         (Layout::create_symtab_sections): Layout with offsets relative to
2241         start of section; for incremental updates, allocate space from free
2242         list.
2243         (Layout::create_shdrs): For incremental updates, allocate space from
2244         free list.
2245         (Layout::finish_dynamic_section): For incremental updates, do not
2246         check --as-needed (fixed in subsequent patch).
2247         * layout.h (class Free_list): New class.
2248         (Layout::set_incremental_base): New function.
2249         (Layout::incremental_base): New function.
2250         (Layout::init_fixed_output_section): New function.
2251         (Layout::allocate): New function.
2252         (Layout::incremental_base_): New data member.
2253         (Layout::free_list_): New data member.
2254         * main.cc (main): Print Free_list statistics.
2255         * object.cc (Relobj::finalize_incremental_relocs): Add
2256         clear_counts parameter; clear counts only when clear_counts is set.
2257         (Sized_relobj::Sized_relobj): Initialize new base class.
2258         (Sized_relobj::do_layout): Don't report special sections.
2259         (Sized_relobj::do_for_all_local_got_entries): New function.
2260         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2261         symtab_off to all symbol table offsets.
2262         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2263         * object.h (class Got_offset_list): Move to top of file.
2264         (Object::Object): Allow case where input_file == NULL.
2265         (Object::~Object): Likewise.
2266         (Object::input_file): Assert that input_file != NULL.
2267         (Object::lock): Allow case where input_file == NULL.
2268         (Object::unlock): Likewise.
2269         (Object::is_locked): Likewise.
2270         (Object::token): Likewise.
2271         (Object::release): Likewise.
2272         (Object::is_incremental): New function.
2273         (Object::get_mtime): New function.
2274         (Object::for_all_local_got_entries): New function.
2275         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2276         (Object::set_is_in_system_directory): New function.
2277         (Object::is_in_system_directory): New function.
2278         (Object::do_is_incremental): New function.
2279         (Object::do_get_mtime): New function.
2280         (Object::do_for_all_local_got_entries): New function.
2281         (Object::is_in_system_directory_): New data member.
2282         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2283         (class Sized_relobj_base): New class.
2284         (class Sized_relobj): Derive from Sized_relobj_base.
2285         (class Sized_relobj::Symbols): Redeclare from base class.
2286         (class Sized_relobj::local_got_offset_list): Remove.
2287         (class Sized_relobj::Output_sections): Redeclare from base class.
2288         (class Sized_relobj::do_for_all_local_got_entries): New function.
2289         (class Sized_relobj::write_local_symbols): Add offset parameter.
2290         (class Sized_relobj::local_symbol_offset_): Update comment.
2291         (class Sized_relobj::local_dynsym_offset_): Update comment.
2292         * options.cc (Input_arguments::add_file): Remove const.
2293         * options.h (Input_file_argument::Input_file_argument):
2294         Initialize arg_serial_ (all constructors).
2295         (Input_file_argument::set_arg_serial): New function.
2296         (Input_file_argument::arg_serial): New function.
2297         (Input_file_argument::arg_serial_): New data member.
2298         (Input_arguments::Input_arguments): Initialize file_count_.
2299         (Input_arguments::add_file): Remove const.
2300         (Input_arguments::number_of_input_files): New function.
2301         (Input_arguments::file_count_): New data member.
2302         (Command_line::number_of_input_files): Call
2303         Input_arguments::number_of_input_files.
2304         * output.cc (Output_segment_headers::Output_segment_headers):
2305         Set current size.
2306         (Output_section::Input_section::current_data_size): New function.
2307         (Output_section::Output_section): Initialize new data members.
2308         (Output_section::add_input_section): Don't do merge sections for
2309         an incremental link; allocate space from free list for an
2310         incremental update.
2311         (Output_section::add_output_section_data): Allocate space from
2312         free list for an incremental update.
2313         (Output_section::update_data_size): New function.
2314         (Output_section::set_fixed_layout): New function.
2315         (Output_section::reserve): New function.
2316         (Output_segment::set_section_addresses): Remove const.
2317         (Output_segment::set_section_list_addresses): Remove const; allocate
2318         space from free list for an incremental update.
2319         (Output_segment::set_offset): Adjust size of RELRO segment for an
2320         incremental update.
2321         * output.h (Output_data::current_data_size): Move here from
2322         child classes.
2323         (Output_data::pre_finalize_data_size): New function.
2324         (Output_data::update_data_size): New function.
2325         (Output_section_headers::update_data_size): new function.
2326         (Output_section_data_build::current_data_size): Move to Output_data.
2327         (Output_data_strtab::update_data_size): New function.
2328         (Output_section::current_data_size): Move to Output_data.
2329         (Output_section::set_fixed_layout): New function.
2330         (Output_section::has_fixed_layout): New function.
2331         (Output_section::reserve): New function.
2332         (Output_section::update_data_size): New function.
2333         (Output_section::has_fixed_layout_): New data member.
2334         (Output_section::free_list_): New data member.
2335         (Output_segment::set_section_addresses): Remove const.
2336         (Output_segment::set_section_list_addresses): Remove const.
2337         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2338         New function.
2339         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2340         New function.
2341         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2342         parameter when calling Add_symbols constructor; store argument
2343         serial number for members of a lib group.
2344         (Add_symbols::locks): Allow case where token == NULL.
2345         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2346         (Read_member::~Read_member): New function.
2347         (Read_member::is_runnable): New function.
2348         (Read_member::locks): New function.
2349         (Read_member::run): New function.
2350         (Check_script::~Check_script): New function.
2351         (Check_script::is_runnable): New function.
2352         (Check_script::locks): New function.
2353         (Check_script::run): New function.
2354         (Check_library::~Check_library): New function.
2355         (Check_library::is_runnable): New function.
2356         (Check_library::locks): New function.
2357         (Check_library::run): New function.
2358         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2359         (Add_symbols::library_): New data member.
2360         (class Read_member): New class.
2361         (class Check_script): New class.
2362         (class Check_library): New class.
2363         * reloc.cc (Read_relocs::is_runnable): Allow case where
2364         token == NULL.
2365         (Read_relocs::locks): Likewise.
2366         (Scan_relocs::locks): Likewise.
2367         (Relocate_task::locks): Likewise.
2368         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2369         to clear counters.
2370         (Sized_relobj::incremental_relocs_scan): Fix comment.
2371         (Sized_relobj::do_relocate): Pass output file offset to
2372         write_local_symbols.
2373         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2374         from class declaration.
2375         * script.cc (read_input_script): Allocate Script_info; pass
2376         argument serial number to report_script.
2377         * script.h (class Script_info): Move to incremental.h.
2378         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2379         * symtab.h (Symbol_table::add_from_incrobj): New function.
2380         (Symbol_table::set_file_offset): New function.
2381
2382 2011-04-05  Cary Coutant  <ccoutant@google.com>
2383
2384         * incremental-dump.cc (dump_incremental_inputs): Change signature
2385         to take a Sized_incremental_binary; change caller.  Use readers
2386         in Sized_incremental_binary.
2387         * incremental.cc
2388         (Sized_incremental_binary::find_incremental_inputs_sections):
2389         Rename do_find_incremental_inputs_sections to this.
2390         (Sized_incremental_binary::setup_readers): New function.
2391         (Sized_incremental_binary::do_check_inputs): Check
2392         has_incremental_info_ flag; move setup code to setup_readers;
2393         use input readers.
2394         (Sized_incremental_binary::do_file_is_unchanged): New function.
2395         (Sized_incremental_binary::do_get_input_reader): New function.
2396         * incremental.h (class Incremental_binary): Move to end of file.
2397         (Incremental_binary::file_is_unchanged): New function.
2398         (Incremental_binary::do_file_is_unchanged): New function.
2399         (Incremental_binary::Input_reader): New class.
2400         (Incremental_binary::get_input_reader): New function.
2401         (class Sized_incremental_binary): Move to end of file.
2402         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2403         input section reader classes.
2404         (Sized_incremental_binary::has_incremental_info): New function.
2405         (Sized_incremental_binary::inputs_reader): New function.
2406         (Sized_incremental_binary::symtab_reader): New function.
2407         (Sized_incremental_binary::relocs_reader): New function.
2408         (Sized_incremental_binary::got_plt_reader): New function.
2409         (Sized_incremental_binary::do_file_is_unchanged): New function.
2410         (Sized_incremental_binary::Sized_input_reader): New class.
2411         (Sized_incremental_binary::get_input_reader): New function.
2412         (Sized_incremental_binary::find_incremental_inputs_sections):
2413         Rename do_find_incremental_inputs_sections to this.
2414         (Sized_incremental_binary::setup_readers): New function.
2415         (Sized_incremental_binary::has_incremental_info_): New data member.
2416         (Sized_incremental_binary::inputs_reader_): New data member.
2417         (Sized_incremental_binary::symtab_reader_): New data member.
2418         (Sized_incremental_binary::relocs_reader_): New data member.
2419         (Sized_incremental_binary::got_plt_reader_): New data member.
2420         (Sized_incremental_binary::current_input_file_): New data member.
2421
2422 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2423
2424         PR gold/12640
2425         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2426         violation.
2427
2428 2011-03-30  Cary Coutant  <ccoutant@google.com>
2429
2430         * archive.cc (Archive::include_member): Adjust call to report_object.
2431         (Add_archive_symbols::run): Add script_info to call to
2432         report_archive_begin.
2433         (Lib_group::include_member): Adjust call to report_object.
2434         (Add_lib_group_symbols::run): Adjust call to report_object.
2435         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2436         blocks.  Add object count for script input files.
2437         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2438         script_info parameter; change all callers.
2439         (Incremental_inputs::report_object): Add script_info parameter;
2440         change all callers.
2441         (Incremental_inputs::report_script): Store backpointer to
2442         incremental info entry.
2443         (Output_section_incremental_inputs::set_final_data_size): Record
2444         additional information for scripts.
2445         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2446         * incremental.h (Incremental_script_entry::add_object): New function.
2447         (Incremental_script_entry::get_object_count): New function.
2448         (Incremental_script_entry::get_object): New function.
2449         (Incremental_script_entry::objects_): New data member; adjust
2450         constructor.
2451         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2452         (Incremental_inputs::report_object): Add script_info parameter.
2453         (Incremental_inputs_reader::get_object_count): New function.
2454         (Incremental_inputs_reader::get_object_offset): New function.
2455         * options.cc (Input_arguments::add_file): Return reference to
2456         new input argument.
2457         * options.h (Input_argument::set_script_info): New function.
2458         (Input_argument::script_info): New function.
2459         (Input_argument::script_info_): New data member; adjust all
2460         constructors.
2461         (Input_file_group::add_file): Return reference to new input argument.
2462         (Input_file_lib::add_file): Likewise.
2463         (Input_arguments::add_file): Likewise.
2464         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2465         * script.cc (Parser_closure::Parser_closure): Add script_info
2466         parameter; adjust all callers.
2467         (Parser_closure::script_info): New function.
2468         (Parser_closure::script_info_): New data member.
2469         (read_input_script): Report scripts earlier to incremental info.
2470         (script_add_file): Set script_info in Input_argument.
2471         (script_add_library): Likewise.
2472         * script.h (Script_options::Script_info): Rewrite class.
2473
2474 2011-03-29  Cary Coutant  <ccoutant@google.com>
2475
2476         * archive.cc (Library_base::should_include_member): Move
2477         method here from class Archive.
2478         (Archive::Archive): Initialize base class.
2479         (Archive::should_include_member): Move to base class.
2480         (Archive::do_for_all_unused_symbols): New function.
2481         (Add_archive_symbols::run): Remove redundant access to
2482         incremental_inputs.
2483         (Lib_group::Lib_group): Initialize base class.
2484         (Lib_group::do_filename): New function.
2485         (Lib_group::include_member): Pass pointer to Lib_group to
2486         report_object.
2487         (Lib_group::do_for_all_unused_symbols): New function.
2488         (Add_lib_group_symbols::run): Report archive information for
2489         incremental links.
2490         * archive.h (class Library_base): New base class.
2491         (class Archive): Derive from Library_base.
2492         (Archive::filename): Move to base class.
2493         (Archive::set_incremental_info): Likewise.
2494         (Archive::incremental_info): Likewise.
2495         (Archive::Should_include): Likewise.
2496         (Archive::should_include_member): Likewise.
2497         (Archive::Armap_entry): Remove.
2498         (Archive::Unused_symbol_iterator): Remove.
2499         (Archive::unused_symbols_begin): Remove.
2500         (Archive::unused_symbols_end): Remove.
2501         (Archive::do_filename): New function.
2502         (Archive::do_get_mtime): New function.
2503         (Archive::do_for_all_unused_symbols): New function.
2504         (Archive::task_): Move to base class.
2505         (Archive::incremental_info_): Likewise.
2506         (class Lib_group): Derive from Library_base.
2507         (Lib_group::do_filename): New function.
2508         (Lib_group::do_get_mtime): New function.
2509         (Lib_group::do_for_all_unused_symbols): New function.
2510         (Lib_group::task_): Move to base class.
2511         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2512         function.
2513         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2514         function.
2515         * incremental.cc (Incremental_inputs::report_archive_begin):
2516         Use Library_base; call library's get_mtime; add incremental inputs
2517         entry before members.
2518         (class Unused_symbol_visitor): New class.
2519         (Incremental_inputs::report_archive_end): Use Library_base; use
2520         visitor class to record unused symbols; don't add incremental inputs
2521         entry after members.
2522         (Incremental_inputs::report_object): Use Library_base.
2523         * incremental.h
2524         (Incremental_archive_entry::Incremental_archive_entry): Remove
2525         unused Archive parameter.
2526         (Incremental_inputs::report_archive_begin): Use Library_base.
2527         (Incremental_inputs::report_archive_end): Likewise.
2528         (Incremental_inputs::report_object): Likewise.
2529         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2530         function.
2531         * object.h (Object::for_all_global_symbols): New function.
2532         (Object::do_for_all_global_symbols): New function.
2533         (Sized_relobj::do_for_all_global_symbols): New function.
2534         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2535         function.
2536         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2537         function.
2538
2539 2011-03-27  Ian Lance Taylor  <iant@google.com>
2540
2541         * archive.cc (Archive::interpret_header): Return -1 if something
2542         goes wrong.  Change callers accordingly.
2543
2544 2011-03-25  Cary Coutant  <ccoutant@google.com>
2545
2546         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2547         * testsuite/Makefile.in: Regenerate.
2548
2549 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2550
2551         * plugin.cc (get_view): New.
2552         (Plugin::load): Pass get_view to the plugin.
2553         (Plugin_manager::get_view): New.
2554
2555 2011-03-21  Ian Lance Taylor  <iant@google.com>
2556
2557         * testsuite/final_layout.sh: Rewrite to not use dc.
2558         * testsuite/relro_test.sh: Fail if dc is not present.
2559
2560 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2561
2562         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2563         Change == to -eq.
2564         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2565         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2566         Change == to -eq.
2567         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2568         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2569
2570 2011-03-14  Ian Lance Taylor  <iant@google.com>
2571
2572         * script-sections.cc (Sort_output_sections::script_compare):
2573         Rename from is_before, change return type.
2574         (Sort_output_sections::operator()): Adjust accordingly.
2575
2576 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2577
2578         PR gold/12572
2579         * testsuite/odr_violation2.cc: Add comment to make all error line
2580         numbers double digits.
2581         * testsuite/debug_msg.sh: Adjust expected errors.
2582
2583 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2584
2585         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2586         but mark earlier ones as non-canonical
2587         (offset_to_iterator): Update search target and example
2588         (do_addr2line): Return extra lines in a vector*
2589         (format_file_lineno): Extract from do_addr2line
2590         (one_addr2line): Add vector* out-param
2591         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2592         when a lineno entry appeared last for its instruction
2593         (Dwarf_line_info): Add vector* out-param
2594         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2595         * symtab.cc (Odr_violation_compare): Include the lineno in the
2596         comparison again.
2597         (linenos_from_loc): New. Combine the canonical line for an
2598         address with its other lines.
2599         (True_if_intersect): New. Helper functor to make
2600         std::set_intersection a query.
2601         (detect_odr_violations): Compare sets of lines instead of just
2602         one line for each function. This became less deterministic, but
2603         has fewer false positives.
2604         * symtab.h: Declarations.
2605         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2606         mix an optimized and non-optimized object in the same binary
2607         (odr_violation2.so): Same.
2608         * testsuite/Makefile.in: Regenerate from Makefile.am.
2609         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2610         * testsuite/debug_msg.sh: Update line numbers and add
2611         assertions.
2612         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2613         non-optimized context.
2614         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2615         isn't inlined, and use OdrDerived in an optimized context.
2616         * testsuite/odr_header1.h: Defines OdrDerived, where
2617         optimization will change the
2618         first-instruction-in-the-destructor's file and line number.
2619         * testsuite/odr_header2.h: Defines OdrBase.
2620
2621 2011-03-09  Ian Lance Taylor  <iant@google.com>
2622
2623         * fileread.cc (File_read::clear_views): Don't delete the whole
2624         file view.
2625
2626 2011-03-08  Ian Lance Taylor  <iant@google.com>
2627
2628         PR gold/12525
2629         * fileread.cc: #include <climits>.
2630         (GOLD_IOV_MAX): Define.
2631         (File_read::read_multiple): Limit number of entries by iov_max.
2632         * fileread.h (class File_read): Always set max_readv_entries to
2633         128.
2634
2635 2011-03-07  Ian Lance Taylor  <iant@google.com>
2636
2637         PR gold/12525
2638         * options.h (class General_options): Add -dy and -dn.
2639
2640 2011-03-02  Cary Coutant  <ccoutant@google.com>
2641
2642         * testsuite/script_test_9.t: Add TLS segment.
2643
2644 2011-03-02  Simon Baldwin  <simonb@google.com>
2645
2646         * configure.ac: Add check for gnu_indirect_function support in
2647         the toolchain building binutils.
2648         * configure: Rebuild.
2649
2650 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2651
2652         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2653         plugin only symbols.
2654         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2655         in plugin files as not needed in the symbol table.
2656
2657 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2658
2659         * output.cc (Output_section::add_input_section): Delay fill
2660         generation for section ordering.
2661
2662 2011-02-09  Ian Lance Taylor  <iant@google.com>
2663
2664         PR gold/12316
2665         * object.h (class Sized_relobj): Remove clear_local_symbols.
2666         * reloc.cc (Sized_relobj::do_relocate): Don't call
2667         clear_local_symbols.
2668
2669 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2670
2671         * plugin.cc (is_visible_from_outside): Return true for symbols
2672         in the -u option.
2673
2674 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2675
2676         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2677         filename.
2678
2679 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2680
2681         * icf.h (is_section_foldable_candidate): Change type of parameter
2682         to std::string.
2683         * icf.cc (Icf::find_identical_sections): Change type of local variable
2684         section_name to be std::string.
2685         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2686
2687 2011-01-25  Ian Lance Taylor  <iant@google.com>
2688
2689         * script.cc (script_add_extern): Rewrite to use
2690         add_symbol_reference.
2691
2692 2011-01-25  Doug Kwan  <dougkwan@google.com>
2693
2694         * icf.cc (get_section_contents): Always lock section's object.
2695
2696 2011-01-24  Ian Lance Taylor  <iant@google.com>
2697
2698         * options.h (class General_options): Accept
2699         --no-detect-odr-violations.
2700
2701 2011-01-24  Ian Lance Taylor  <iant@google.com>
2702
2703         * version.cc (version_string): Bump to 1.11.
2704
2705 2011-01-24  Ian Lance Taylor  <iant@google.com>
2706
2707         * plugin.cc (class Plugin_rescan): Define new class.
2708         (Plugin_manager::claim_file): Set any_claimed_.
2709         (Plugin_manager::save_archive): New function.
2710         (Plugin_manager::save_input_group): New function.
2711         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2712         necessary.
2713         (Plugin_manager::new_undefined_symbol): New function.
2714         (Plugin_manager::rescan): New function.
2715         (Plugin_manager::rescannable_defines): New function.
2716         (Plugin_manager::add_input_file): Set any_added_.
2717         * plugin.h (class Plugin_manager): define new fields rescannable_,
2718         undefined_symbols_, any_claimed_, and any_added_.  Declare
2719         Plugin_rescan as friend.  Declare new functions.
2720         (Plugin_manager::Rescannable): Define type.
2721         (Plugin_manager::Rescannable_list): Define type.
2722         (Plugin_manager::Undefined_symbol_list): Define type.
2723         (Plugin_manager::Plugin_manager): Initialize new fields.
2724         * archive.cc (Archive::defines_symbol): New function.
2725         (Add_archive_symbols::run): Pass archive to plugins if any.
2726         * archive.h (class Archive): Declare defines_symbol.
2727         * readsyms.cc (Input_group::~Input_group): New function.
2728         (Finish_group::run): Pass input_group to plugins if any.
2729         * readsyms.h (class Input_group): Declare destructor.
2730         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2731         any.
2732
2733 2011-01-10  Ian Lance Taylor  <iant@google.com>
2734
2735         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2736         section as relro.
2737         (Layout::set_segment_offsets): Reset increase_relro before calling
2738         set_section_addresses a second time.
2739
2740 2011-01-04  Cary Coutant  <ccoutant@google.com>
2741
2742         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2743         sections before NOBITS sections.
2744
2745 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2746
2747         * version.cc (print_version): Update copyright to 2011.
2748
2749 2010-12-23  Cary Coutant  <ccoutant@google.com>
2750
2751         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2752         of OS to this->add.  Add OD parameter to second form of the function.
2753
2754 2010-12-20  Ian Lance Taylor  <iant@google.com>
2755
2756         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2757         second of two consecutive entries with same offset.
2758
2759 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2760
2761         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2762         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2763         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2764         to avoid unneeded links against $(LDADD).
2765         * testsuite/Makefile.in: Regenerate.
2766
2767 2010-12-15  Ian Lance Taylor  <iant@google.com>
2768
2769         PR gold/12324
2770         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2771         for R_X86_64_32 and R_X86_64_PC32.
2772         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2773         ver_matching_def_pic.o.
2774         (ver_matching_def_pic.o): New target.
2775
2776 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2777
2778         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2779         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2780         Move definition before File_read::View member definitions.
2781         (File_read::View::~View): Initialize and hold lock before
2782         updating current_mapped_bytes.
2783
2784 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2785
2786         * dwarf_reader.cc: Remove outdated comment.
2787         * gold-threads.cc: Fix typo in error message.
2788         * archive.cc: Fix typos in comments.
2789         * archive.h: Likewise.
2790         * arm-reloc-property.cc: Likewise.
2791         * arm-reloc-property.h: Likewise.
2792         * arm-reloc.def: Likewise.
2793         * arm.cc: Likewise.
2794         * attributes.h: Likewise.
2795         * cref.cc: Likewise.
2796         * ehframe.cc: Likewise.
2797         * fileread.h: Likewise.
2798         * gold.h: Likewise.
2799         * i386.cc: Likewise.
2800         * icf.cc: Likewise.
2801         * incremental.h: Likewise.
2802         * int_encoding.cc: Likewise.
2803         * layout.h: Likewise.
2804         * main.cc: Likewise.
2805         * merge.h: Likewise.
2806         * object.cc: Likewise.
2807         * object.h: Likewise.
2808         * options.cc: Likewise.
2809         * readsyms.cc: Likewise.
2810         * reduced_debug_output.cc: Likewise.
2811         * reloc.cc: Likewise.
2812         * script-sections.cc: Likewise.
2813         * sparc.cc: Likewise.
2814         * symtab.h: Likewise.
2815         * target-reloc.h: Likewise.
2816         * target.cc: Likewise.
2817         * target.h: Likewise.
2818         * timer.cc: Likewise.
2819         * timer.h: Likewise.
2820         * x86_64.cc: Likewise.
2821
2822 2010-12-09  Cary Coutant  <ccoutant@google.com>
2823
2824         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2825         stack.
2826         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2827         parameter; change all callers.
2828         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2829         * options.h (warn_execstack): New option.
2830
2831 2010-12-07  Doug Kwan  <dougkwan@google.com>
2832
2833         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2834         like function call relocations.
2835
2836 2010-12-07  Ian Lance Taylor  <iant@google.com>
2837
2838         * archive.cc (Archive::get_elf_object_for_member): Permit
2839         punconfigured to be NULL.
2840         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2841         (Archive::include_member): Pass NULL to get_elf_object_for_member
2842         if we searched for the archive and this is the first included
2843         object.
2844
2845 2010-12-01  Ian Lance Taylor  <iant@google.com>
2846
2847         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2848         track_relocs_type_ field.
2849         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2850         Set track_relocs_type_.
2851         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2852         contents when using RELA relocs.
2853         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2854         reloc_map_.
2855         * reloc.cc (Track_relocs::next_addend): New function.
2856         * reloc.h (class Track_relocs): Declare next_addend.
2857
2858 2010-12-01  Ian Lance Taylor  <iant@google.com>
2859
2860         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2861         virtual destructor.
2862
2863 2010-12-01  Ian Lance Taylor  <iant@google.com>
2864
2865         * README: Update compilers known to work and fail.
2866
2867 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2868
2869         * configure.in: For --enable-gold, handle value `default' instead of
2870         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2871         not the default.
2872         * configure: Regenerate.
2873
2874 2010-11-18  Doug Kwan  <dougkwan@google.com>
2875
2876         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2877         and right_alignment to be zero.  Store result alignment only if it is
2878         greater than existing alignment.
2879
2880 2010-11-16  Cary Coutant  <ccoutant@google.com>
2881
2882         PR gold/12220
2883         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2884         Check for ".zdebug_line".
2885
2886 2010-11-16  Doug Kwan  <dougkwan@google.com>
2887             Cary Coutant  <ccoutant@google.com>
2888
2889         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2890         by reference; adjust all callers.
2891         * output.cc (Output_segment::set_section_addresses): Adjust references
2892         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2893         list is empty.
2894         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2895         end at page boundary.
2896
2897 2010-11-16  Cary Coutant  <ccoutant@google.com>
2898
2899         PR gold/12220
2900         * layout.cc (Layout::choose_output_section): Transform names of
2901         compressed sections even when using a script with a SECTIONS clause.
2902         (Layout::output_section_name): Remove code to transform
2903         compressed debug section names.
2904         * output.cc (Output_section::add_input_section): Use uncompressed
2905         section size when tracking input sections.
2906
2907 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2908
2909         * symtab.h (Symbol::NON_PIC_REF): Remove.
2910         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2911         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2912         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2913         (Symbol::use_plt_offset): Take a flags argument and pass it
2914         directly to needs_dynamic_reloc.  Restrict check for undefined
2915         weak symbols to function calls.
2916         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2917         (Target_arm::Scan::global): Use it.
2918         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2919         (Target_arm::Relocate::relocate): Likewise.
2920         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2921         parameter with an r_type parameter.  Use get_reference_flags
2922         to get the flags.
2923         (Target_arm::Relocate::relocate): Update accordingly.
2924         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2925         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2926         (Target_i386::Scan::global): Likewise.
2927         (Target_i386::Relocate::relocate): Likewise.
2928         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2929         parameter with an r_type parameter.  Use get_reference_flags
2930         to get the flags.
2931         (Target_i386::Relocate::relocate): Update accordingly.
2932         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2933         (Target_powerpc::Scan::global): Use it.
2934         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2935         (Target_powerpc::Relocate::relocate): Likewise.
2936         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2937         (Target_sparc::Scan::global): Use it.
2938         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2939         (Target_sparc::Relocate::relocate): Likewise.
2940         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2941         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2942         (Target_x86_64::Scan::global): Likewise.
2943         (Target_x86_64::Relocate::relocate): Likewise.
2944
2945 2010-11-08  Doug Kwan  <dougkwan@google.com>
2946             Cary Coutant  <ccoutant@google.com>
2947
2948         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2949         (Arm_exidx_merge_section::section_contents_): New data member.
2950         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2951         (Arm_input_section::~Arm_input_section): De-allocate memory.
2952         (Arm_input_section::original_contents_): New data member.       
2953         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2954         in parameters instead of calling Object::section_contents without
2955         locking.
2956         (Arm_output_section::group_section): New parameter TASK.  Pass it
2957         to callees that need locking objects.
2958         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2959         to lock EXIDX input sections.  Fix a formatting issue.  Call
2960         Arm_exidx_merged_section::build_contents to create merged section
2961         contents.
2962         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2963         to lock object of stub table owner.
2964         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2965         TEXT_SIZE to initialize data member TEXT_SIZE_.
2966         (Arm_exidx_input_section::addralign): Fix typo in comment.
2967         (Arm_exidx_input_section::text_size): New method.
2968         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2969         that require locking objects.  Lock objects before scanning for stubs
2970         and updating local symbols.
2971         (Arm_input_section<big_endian>::init): Copy contents of original
2972         input section.
2973         (Arm_input_section<big_endian>::do_write): Use saved contents of
2974         original input section instead of calling Object::section_contents
2975         without locking.
2976         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2977         size without calling Object::section_size().
2978         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2979         for size.  Allocate a buffer for merged EXIDX entries.
2980         (Arm_exidx_merged_section::build_contents): New method.
2981         (Arm_exidx_merged_section::do_write): Move merge section contents
2982         building code to Arm_exidx_merged_section::build_contetns.  Write
2983         out contetns in buffer instead of building it on the fly.
2984         (Arm_relobj::make_exidx_input_section): Also pass text section size
2985         to Arm_exidx_input_section constructor.
2986         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2987         (Arm_dynobj::do_read_symbols): Fix memory leak.
2988         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2989         * target.h: (class Task): Add forward declaration.
2990         (Target::relax): Add new parameter TASK and pass it to
2991         Target::do_relax().
2992         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2993
2994 2010-11-05  Cary Coutant  <ccoutant@google.com>
2995
2996         PR gold/10708
2997         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2998         object when reading from the file.
2999         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3000         second layout pass.
3001         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3002         when reading section contents.
3003         (get_section_contents): Likewise.
3004         (icf::find_identical_sections): Likewise.
3005         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3006         object when reading from the file.
3007         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3008         the object when doing deferred section layout.
3009
3010 2010-11-03  Nick Clifton  <nickc@redhat.com>
3011
3012         PR gold/12001
3013         * script.h (class Symbol_assignment: name): New member.  Returns
3014         the name of the symbol.
3015         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3016         Returns true if the given symbol name is on the list of
3017         assignments wating to be processed.
3018         * archive.cc (should_incldue_member): If the symbol is undefined,
3019         check to see if it is on the list of symbols pending assignment.
3020
3021 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3022
3023         * script-sections.cc (Script_sections::find_memory_region): Check
3024         for a NULL output section pointer.
3025
3026 2010-10-29  Doug Kwan  <dougkwan@google.com>
3027
3028         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3029         Output_section::add_relaxed_input_section.
3030         * output.cc (Output_section::add_relaxed_input_section): Add new
3031         arguments LAYOUT and NAME.  Set section order index.
3032         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3033         Copy section order index.
3034         * output.h (Output_section::add_relaxed_input_section): Add new
3035         arguments LAYOUT and NAME.
3036
3037 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3038
3039         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3040         NATIVE_OR_CROSS_LINKER.
3041         * testsuite/Makefile.in: Regenerate.
3042
3043 2010-10-20  Doug Kwan  <dougkwan@google.com>
3044
3045         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3046         without SHF_LINK_ORDER flags.
3047         * layout.cc (Layout::choose_output_section): Do not filter
3048         SHF_LINK_ORDER flag in a relocatable link.
3049
3050 2010-10-17  Cary Coutant  <ccoutant@google.com>
3051
3052         * output.h (Output_segment::set_section_addresses): Change function
3053         signature.  Update all callers.
3054         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3055         sections.
3056         (Output_segment::set_section_addresses): Align after last TLS
3057         section.  Add padding before last relro section instead of after.
3058
3059 2010-10-17  Doug Kwan  <dougkwan@google.com>
3060
3061         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3062         GOT output section to be writable.
3063
3064 2010-10-14  Cary Coutant  <ccoutant@google.com>
3065
3066         * debug.h (DEBUG_INCREMENTAL): New flag.
3067         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3068         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3069         mode.
3070         * incremental.cc (report_command_line): Ignore all forms of
3071         --incremental.
3072         * layout.cc (Layout::Layout): Check parameters for incremental link
3073         mode.
3074         * options.cc (General_options::parse_incremental): New function.
3075         (General_options::parse_no_incremental): New function.
3076         (General_options::parse_incremental_full): New function.
3077         (General_options::parse_incremental_update): New function.
3078         (General_options::incremental_mode_): New data member.
3079         (General_options::finalize): Check incremental_mode_.
3080         * options.h (General_options): Update help text for --incremental.
3081         Add --no-incremental, --incremental-full, --incremental-update.
3082         (General_options::Incremental_mode): New enum type.
3083         (General_options::incremental_mode): New function.
3084         (General_options::incremental_mode_): New data member.
3085         * parameters.cc (Parameters::incremental_mode_): New data member.
3086         (Parameters::set_options): Set incremental_mode_.
3087         (Parameters::set_incremental_full): New function.
3088         (Parameters::incremental): New function.
3089         (Parameters::incremental_update): New function.
3090         (set_parameters_incremental_full): New function.
3091         * parameters.h (Parameters::set_incremental_full): New function.
3092         (Parameters::incremental): New function.
3093         (Parameters::incremental_update): New function.
3094         (Parameters::incremental_mode_): New data member.
3095         (set_parameters_incremental_full): New function.
3096         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3097         incremental link mode.
3098         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3099         (Sized_relobj::do_relocate_sections): Likewise.
3100         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3101         option.
3102         * testsuite/Makefile.in: Regenerate.
3103         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3104
3105 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3106
3107         * script-sections.h (class Script_sections): Make
3108         Sections_elements typedef public.
3109         * script-sections.cc (class Sort_output_sections): Add elements_
3110         field.  Add constructor which sets it; change all callers.
3111         (Sort_output_sections::is_before): New function.
3112         (Sort_output_sections::operator()): Call is_before.
3113         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3114         conditional.
3115         * testsuite/script_test_10.sh: New test. Test script section
3116         order.
3117         * testsuite/script_test_10.t: Likewise.
3118         * testsuite/script_test_10.s: Likewise.
3119         * testsuite/Makefile.am: Wrap the cross linker tests and the
3120         common tests into NATIVE_OR_CROSS_LINKER.
3121         (check_SCRIPTS): Add script_test_10.sh.
3122         (check_DATA): Add script_test_10.stdout.
3123         (script_test_10.o, script_test_10): New targets.
3124         (script_test_10.stdout): New target.
3125         * configure, testsuite/Makefile.in: Regenerate.
3126
3127 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3128
3129         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3130         error for the deprecated relocations.
3131         (Target_arm::Scan::global): Likewise.
3132         (Target_arm::Relocate::relocate): Likewise.
3133
3134 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3135
3136         * fileread.cc (Input_file::find_file): Initialize *found_name
3137         and *namep when using the fallback search for case 4.
3138
3139 2010-10-11  Cary Coutant  <ccoutant@google.com>
3140
3141         * options.h (class General_options): Redefine -z lazy as an alias for
3142         the negation of -z now.
3143
3144 2010-10-11  Ian Lance Taylor  <iant@google.com>
3145
3146         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3147         binding.
3148
3149 2010-10-06  Nick Clifton  <nickc@redhat.com>
3150
3151         * script-sections.cc(class Memory_region): Remove
3152         current_lma_offset_ field.  Rename current_vma_offset_ to
3153         current_offset_.  Add last_section_ field.
3154         (Memory_region::get_current_vma_address): Rename to
3155         get_current_address.
3156         (Memory_region::get_current_lma_address): Delete.
3157         (Memory_region::increment_vma_offset): Rename to
3158         increment_offset.
3159         (Memory_region::increment_lma_offset): Delete.
3160         (Memory_region::attributes_compatible): New method.  Returns
3161         true if the provided section is compatible with the region.
3162         (Memory_region::get_last_section): New method.  Returns the last
3163         section to use the region.
3164         (Memory_region::set_last_section): New method.  Stores the last
3165         section to use the region.
3166         (Script_sections::block_in_region): New method.  Returns true if
3167         a block of memory is contained within a region.
3168         (Script_sections::find_memory_region): New method.  Locates a
3169         memory region to be used to set a VMA or LMA address.
3170         (Output_section_definition::set_section_addresses): Add code to
3171         check for addresses set by memory regions.
3172         (Output_segment::set_section_addresses): Remove memory region
3173         walking code.
3174         (Script_sections::create_segment): Add a warning if a header
3175         segment is created outside of any region.
3176         * script-sections.h (class Script_sections): Add prototypes for
3177         find_memory_region and block_in_region methods.
3178         * testsuite/memory_test.s: Use .long instead of .word.
3179         * testsuite/memory_test.t: Add some more output sections.
3180         * testsuite/memory_test.sh: Update expected output.
3181
3182 2010-10-02  Doug Kwan  <dougkwan@google.com>
3183
3184         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3185         defintion to symtab.h
3186         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3187         declaration to defintion.
3188
3189 2010-10-01  Nick Clifton  <nickc@redhat.com>
3190
3191         * expression.cc (eval): Replace dummy argument with NULL.
3192         (eval_maybe_dot): Check for a NULL result section pointer.
3193         (Symbol_expression::value): Likewise.
3194         (Dot_expression::value): Likewise.
3195         (BINARY_EXPRESSION): Likewise.
3196         (Max_expression::value): Likewise.
3197         (Min_expression::value): Likewise.
3198         (Absolute_expression::value): Likewise.
3199         (Addr_expression::value_from_output_section): Likewise.
3200         (Loaddddr_expression::value_from_output_section): Likewise.
3201         (Segment_start_expression::value): Likewise.
3202         * script-sections.cc
3203         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3204         argument with NULL.
3205         (Sections_elememt_dot_assignment::set_section_addresses):
3206         Likewise.
3207         (Output_data_expression::do_write_to_buffer): Likewise.
3208         (Output_section_definition::finalize_symbols): Likewise.
3209         (Output_section_definition::set_section_addresses): Likewise.
3210
3211 2010-09-30  Doug Kwan  <dougkwan@google.com>
3212
3213         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3214
3215 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3216
3217         * target.h (Target::can_icf_inline_merge_sections): New virtual
3218         function.
3219         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3220         virtual function.
3221         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3222         virtual function.
3223         * icf.cc (get_section_contents): Inline merge sections only when
3224         target allows it.
3225
3226 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3227
3228         * configure: Regenerate.
3229
3230 2010-09-17  Ian Lance Taylor  <iant@google.com>
3231
3232         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3233         * testsuite/Makefile.am (memory_test.o): New target.
3234         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3235         memory_test.t.
3236         * testsuite/Makefile.in: Rebuild.
3237
3238 2010-09-17  Doug Kwan  <dougkwan@google.com>
3239
3240         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3241         defintion if relocation uses GOT entries of the symbol.
3242         * testsuite/icf_safe_test.sh: Fix test.
3243         * testsuite/icf_safe_so_test.sh: Fix test.
3244
3245 2010-09-16  Cary Coutant  <ccoutant@google.com>
3246
3247         * script_sections.cc (class Memory_region): Remove "NULL" from
3248         vector initializations.
3249
3250 2010-09-15  Cary Coutant  <ccoutant@google.com>
3251
3252         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3253         Resolve forwarding symbols.
3254
3255 2010-09-15  Doug Kwan  <dougkwan@google.com>
3256
3257         * gold/testsuite/script_test_3.t: Add ARM special sections.
3258         * gold/testsuite/script_test_4.t: Same.
3259         * gold/testsuite/script_test_5.t: Same.
3260         * gold/testsuite/script_test_6.t: Same.
3261         * gold/testsuite/script_test_7.t: Same.
3262         * gold/testsuite/script_test_7.t: Same.
3263         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3264
3265 2010-09-14  Cary Coutant  <ccoutant@google.com>
3266
3267         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3268         (Target_x86_64::Relocate::relocate_tls): Replace check for
3269         saw_tls_block_reloc_ with test for executable section.
3270
3271 2010-09-12  Cary Coutant  <ccoutant@google.com>
3272
3273         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3274         position-independent executables to shared libraries need dynamic
3275         relocations.
3276         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3277         position-independent executables.
3278         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3279         * testsuite/Makefile.in: Regenerate.
3280
3281 2010-09-10  Nick Clifton  <nickc@redhat.com>
3282
3283         PR gold/11997
3284         * testsuite/memory_test.t: Discard any sections that are not
3285         needed.
3286
3287 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3288
3289         PR gold/11996
3290         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3291         "This::" to work around a bug in gcc 4.2.
3292
3293         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3294
3295 2010-09-09  Rafael Espindola  <espindola@google.com>
3296
3297         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3298         sections with different PF_X flags in the same segment.
3299         (Layout::find_first_load_seg): Search all segments to find the first
3300         one.
3301         * options.h (rosegment): New.
3302
3303 2010-09-08  Rafael Espindola  <espindola@google.com>
3304
3305         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3306
3307 2010-09-08  Doug Kwan  <dougkwan@google.com>
3308
3309         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3310         (Arm_relobj::do_relocate_sections): Add new parameter for output
3311         file to match the parent.
3312         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3313         of local symbols instead of input values.  Update code to track
3314         changes in gold::relocate_section.
3315         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3316         (Sized_relobj::compute_final_local_value_internal): New methods.
3317         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3318         body into private version of Sized_relobj::compute_final_local_value.
3319         Call the inline method.
3320         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3321         merged symbol value if there is one.
3322         (Symbol_value::has_output_value): New method defintiion.
3323         (Sized_relobj::Compute_final_local_value_status): New enum type.
3324         (Sized_relobj::compute_final_local_value): New methods.
3325         (Sized_relobj::compute_final_local_value_internal): New methods.
3326         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3327         and arm_cortex_a8.sh.
3328         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3329         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3330         New tests.
3331         * Makefile.in: Regenerate.
3332         * testsuite/arm_bl_out_of_range.s: Update test.
3333         * testsuite/thumb_bl_out_of_range.s: Ditto.
3334         * testsuite/thumb_blx_out_of_range.s: Ditto.
3335         * testsuite/arm_branch_out_of_range.sh: New file.
3336         * testsuite/arm_cortex_a8.sh: Ditto.
3337         * testsuite/arm_cortex_a8_b.s: Ditto.
3338         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3339         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3340         * testsuite/arm_cortex_a8_bl.s: Ditto.
3341         * testsuite/arm_cortex_a8_blx.s: Ditto.
3342         * testsuite/arm_cortex_a8_local.s: Ditto.
3343         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3344         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3345
3346 2010-09-08  Rafael Espindola  <espindola@google.com>
3347
3348         * Makefile.am (memory_test.stdout): Run readelf with -W.
3349         * Makefile.in: Regenerate.
3350         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3351         64 bit output.
3352
3353 2010-09-08  Rafael Espindola  <espindola@google.com>
3354
3355         * script-sections.cc (Script_sections::add_memory_region): Convert
3356         field precision to int.
3357         * script.cc (script_set_section_region, script_set_section_region):
3358         Convert field precision to int.
3359
3360 2010-09-08  Rafael Espindola  <espindola@google.com>
3361
3362         * arm.cc (do_finalize_sections): Create the __exidx_start and
3363         __exdix_end symbols even when the section is missing.
3364
3365 2010-09-08  Nick Clifton  <nickc@redhat.com>
3366
3367         * README: Remove claim that MEMORY is not supported.
3368         * expression.cc (script_exp_function_origin)
3369         (script_exp_function_length): Move from here to ...
3370         * script.cc: ... here.
3371         (script_set_section_region, script_add_memory)
3372         (script_parse_memory_attr, script_include_directive): New
3373         functions.
3374         * script-sections.cc
3375         (class Memory_region): New class.
3376         (class Output_section_definition): Add set_memory_region,
3377         set_section_vma, set_section_lma and get_section_name methods.
3378         (class Script_Sections): Add add_memory_region,
3379         find_memory_region, find_memory_region_origin,
3380         find_memory_region_length and set_memory_region methods.
3381         Have set_section_addresses method walk the list of set memory
3382         regions.
3383         Extend the print methos to display memory regions.
3384         * script-sections.h: Add prototypes for new methods.
3385         Add enum for MEMORY region attributes.
3386         * yyscript.y: Add support for parsing MEMORY regions.
3387         * script-c.h: Add prototypes for new functions.
3388         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3389         * testsuite/Makefile.in: Regenerate.
3390         * testsuite/memory_test.sh: New script.
3391         * testsuite/memory_test.s: New assembler source file.
3392         * testsuite/memory_test.t: New linker script.
3393
3394 2010-08-27  Doug Kwan  <dougkwan@google.com>
3395
3396         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3397         reference override an existing dynamic weak reference.
3398         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3399         * testsuite/Makefile.in: Regenerate.
3400         * testsuite/dyn_weak_ref.sh: New file.
3401         * testsuite/dyn_weak_ref_1.c: Ditto.
3402         * testsuite/dyn_weak_ref_2.c: Ditto.
3403
3404 2010-08-27  Ian Lance Taylor  <iant@google.com>
3405
3406         * incremental.h (class Incremental_input_entry): Add virtual
3407         destructor.
3408
3409 2010-08-27  Ian Lance Taylor  <iant@google.com>
3410
3411         * testsuite/start_lib_test_3.c: Mark t3 as used.
3412
3413 2010-08-27  Nick Clifton  <nickc@redhat.com>
3414
3415         * options.cc (version_script): Fix small typo in previous
3416         whitespace tidyup.
3417
3418 2010-08-25  Nick Clifton  <nickc@redhat.com>
3419
3420         * archive.cc: Formatting fixes: Remove whitespace between
3421         typename and following asterisk.  Remove whitespace between
3422         function name and opening parenthesis.
3423         * archive.h: Likewise.
3424         * arm.cc: Likewise.
3425         * attributes.cc: Likewise.
3426         * attributes.h: Likewise.
3427         * common.cc: Likewise.
3428         * copy-relocs.cc: Likewise.
3429         * dirsearch.h: Likewise.
3430         * dynobj.cc: Likewise.
3431         * ehframe.cc: Likewise.
3432         * ehframe.h: Likewise.
3433         * expression.cc: Likewise.
3434         * fileread.cc: Likewise.
3435         * fileread.h: Likewise.
3436         * gc.h: Likewise.
3437         * gold-threads.cc: Likewise.
3438         * gold.cc: Likewise.
3439         * i386.cc: Likewise.
3440         * icf.h: Likewise.
3441         * incremental-dump.cc: Likewise.
3442         * incremental.cc: Likewise.
3443         * layout.cc: Likewise.
3444         * layout.h: Likewise.
3445         * main.cc: Likewise.
3446         * merge.cc: Likewise.
3447         * merge.h: Likewise.
3448         * object.cc: Likewise.
3449         * object.h: Likewise.
3450         * options.cc: Likewise.
3451         * options.h: Likewise.
3452         * output.cc: Likewise.
3453         * output.h: Likewise.
3454         * plugin.cc: Likewise.
3455         * plugin.h: Likewise.
3456         * powerpc.cc: Likewise.
3457         * reloc.cc: Likewise.
3458         * script-c.h: Likewise.
3459         * script-sections.cc: Likewise.
3460         * script.cc: Likewise.
3461         * stringpool.cc: Likewise.
3462         * symtab.cc: Likewise.
3463         * symtab.h: Likewise.
3464         * target.cc: Likewise.
3465         * timer.cc: Likewise.
3466         * timer.h: Likewise.
3467         * version.cc: Likewise.
3468         * x86_64.cc: Likewise.
3469
3470 2010-08-24  Nick Clifton  <nickc@redhat.com>
3471
3472         PR 11899
3473         * layout.cc (segment_precedes): Sort segments by their physical
3474         addresses, if they have been set.
3475
3476 2010-08-23  Cary Coutant  <ccoutant@google.com>
3477
3478         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3479         symbols data.
3480         (Lib_group::include_member): Unlock object after deleting its
3481         symbols data.
3482         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3483         the bug fixed here.
3484
3485 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3486             Cary Coutant  <ccoutant@google.com>
3487
3488         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3489         constructor, and set_blocker.
3490         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3491         readsyms_blocker_.
3492         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3493         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3494         * testsuite/Makefile.am (start_lib_test): New test case.
3495         * testsuite/Makefile.in: Regenerate.
3496         * testsuite/start_lib_test_main.c: New file.
3497         * testsuite/start_lib_test_1.c: New file.
3498         * testsuite/start_lib_test_2.c: New file.
3499         * testsuite/start_lib_test_3.c: New file.
3500
3501 2010-08-19  Ian Lance Taylor  <iant@google.com>
3502
3503         * Makefile.in: Rebuild with automake 1.11.1.
3504         * aclocal.m4: Likewise.
3505         * testsuite/Makefile.in: Likewise.
3506
3507 2010-08-19  Ian Lance Taylor  <iant@google.com>
3508
3509         PR 10893
3510         * i386.cc (class Output_data_plt_i386): Update declarations.
3511         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3512         local_ifuncs_ fields.
3513         (Target_i386::do_plt_section_for_global): New function.
3514         (Target_i386::do_plt_section_for_local): New function.
3515         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3516         parameter; change all callers.  Initialize global_ifuncs_ and
3517         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3518         __rel_iplt_end.
3519         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3520         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3521         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3522         symbols.
3523         (Target_i386::make_plt_section): New function, broken out of
3524         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3525         (Target_i386::make_plt_entry): Call make_plt_section.
3526         (Target_i386::make_local_ifunc_plt_entry): New function.
3527         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3528         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3529         R_386_IRELATIVE to switch.
3530         (Target_i386::Scan::global): Likewise.
3531         (Target_i386::Relocate::relocate): Likewise.
3532         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3533         switch.
3534         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3535         (Target_x86_64::do_plt_section_for_global): New function.
3536         (Target_x86_64::do_plt_section_for_local): New function.
3537         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3538         parameter; change all callers.  If doing a static link define
3539         __rela_iplt_start and __rela_iplt_end.
3540         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3541         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3542         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3543         to point to .plt.
3544         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3545         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3546         switch.
3547         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3548         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3549         R_X86_64_IRELATIVE to switch.
3550         (Target_x86_64::Scan::global): Likewise.
3551         (Target_x86_64::Relocate::relocate): Likewise.
3552         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3553         switch.
3554         * target.h (class Target): Add plt_section_for_global and
3555         plt_section_for_local functions.  Add do_plt_section_for_global
3556         and do_plt_section_for_local virtual functions.
3557         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3558         clarifying comments.
3559         (Symbol::use_plt_offset): Handle IFUNC symbol.
3560         * object.cc (Sized_relobj::Sized_relobj): Initialize
3561         local_plt_offsets_.
3562         (Sized_relobj::local_has_plt_offset): New function.
3563         (Sized_relobj::local_plt_offset): New function.
3564         (Sized_relobj::set_local_plt_offset): New function.
3565         (Sized_relobj::do_count): Handle IFUNC symbol.
3566         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3567         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3568         is_ifunc_symbol functions.
3569         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3570         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3571         local_plt_offsets_ field.
3572         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3573         * output.h (class Output_section_data): Add non-const
3574         output_section function.
3575         (class Output_data_got): Update declarations.
3576         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3577         Add use_plt_offset parameter to global and local constructors.
3578         Change all callers.  Change local_sym_index_ field to 31 bits.
3579         Change GSYM_CODE and CONSTANT_CODE accordingly.
3580         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3581         doing a static link don't set sh_link field.
3582         (Output_data_got::Got_entry::write): Use PLT offset if
3583         appropriate.
3584         (Output_data_got::add_global_plt): New function.
3585         (Output_data_got::add_local_plt): New function.
3586         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3587         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3588         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3589         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3590         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3591         IFUNC conditional.
3592         * testsuite/ifunc-sel.h: New file.
3593         * testsuite/ifuncmain1.c: New file.
3594         * testsuite/ifuncmain1vis.c: New file.
3595         * testsuite/ifuncmod1.c: New file.
3596         * testsuite/ifuncdep2.c: New file.
3597         * testsuite/ifuncmain2.c: New file.
3598         * testsuite/ifuncmain3.c: New file.
3599         * testsuite/ifuncmod3.c: New file.
3600         * testsuite/ifuncmain4.c: New file.
3601         * testsuite/ifuncmain5.c: New file.
3602         * testsuite/ifuncmod5.c: New file.
3603         * testsuite/ifuncmain6pie.c: New file.
3604         * testsuite/ifuncmod6.c: New file.
3605         * testsuite/ifuncmain7.c: New file.
3606         * configure, testsuite/Makefile.in: Rebuild.
3607
3608 2010-08-18  Ian Lance Taylor  <iant@google.com>
3609
3610         * incremental.cc
3611         (Output_section_incremental_inputs::write_input_files): Add cast
3612         to avoid signed/unsigned comparison warning.
3613         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3614
3615 2010-08-12  Cary Coutant  <ccoutant@google.com>
3616
3617         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3618
3619 2010-08-13  Ian Lance Taylor  <iant@google.com>
3620
3621         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3622
3623 2010-08-12  Cary Coutant  <ccoutant@google.com>
3624             Doug Kwan  <dougkwan@google.com>
3625
3626         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3627         defintion overrides non-weak undef, remember that the original undef
3628         is not weak.
3629         * symtab.cc (Symbol_table::sized_write_global): For undef without
3630         an original weak binding, set binding to global in output.
3631         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3632         * testsuite/Makefile.in: Regenerate.
3633         * testsuite/strong_ref_weak_def.sh: New file.
3634         * testsuite/strong_ref_weak_def_1.c: Ditto.
3635         * testsuite/strong_ref_weak_def_2.c: Ditto.
3636
3637 2010-08-12  Cary Coutant  <ccoutant@google.com>
3638
3639         * testsuite/incremental_test.sh: Rewrite.
3640         * testsuite/incremental_test_1.c: Rewrite.
3641         * testsuite/incremental_test_2.c: Rewrite.
3642
3643 2010-08-12  Cary Coutant  <ccoutant@google.com>
3644
3645         * arm.cc (Target_arm::got_size): Add const.
3646         (Target_arm::got_entry_count): New function.
3647         (Target_arm::plt_entry_count): New function.
3648         (Target_arm::first_plt_entry_offset): New function.
3649         (Target_arm::plt_entry_size): New function.
3650         (Output_data_plt_arm::entry_count): New function.
3651         (Output_data_plt_arm::first_plt_entry_offset): New function.
3652         (Output_data_plt_arm::get_plt_entry_size): New function.
3653         * i386.cc (Target_i386::got_size): Add const.
3654         (Target_i386::got_entry_count): New function.
3655         (Target_i386::plt_entry_count): New function.
3656         (Target_i386::first_plt_entry_offset): New function.
3657         (Target_i386::plt_entry_size): New function.
3658         (Output_data_plt_i386::entry_count): New function.
3659         (Output_data_plt_i386::first_plt_entry_offset): New function.
3660         (Output_data_plt_i386::get_plt_entry_size): New function.
3661         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3662         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3663         * incremental.cc: Include target.h.
3664         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3665         parameter.  Adjust all callers.  Find incremental_got_plt section.
3666         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3667         section.
3668         (Output_section_incremental_inputs::set_final_data_size): Calculate
3669         size of incremental_got_plt section.
3670         (Output_section_incremental_inputs::do_write): Write the
3671         incremental_got_plt section.
3672         (Got_plt_view_info): New struct.
3673         (Local_got_offset_visitor): New class.
3674         (Global_got_offset_visitor): New class.
3675         (Global_symbol_visitor_got_plt): New class.
3676         (Output_section_incremental_inputs::write_got_plt): New function.
3677         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3678         Add parameter.  Adjust all callers.
3679         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3680         (Incremental_inputs::got_plt_section): New function.
3681         (Incremental_inputs::got_plt_section_): New data member.
3682         (Incremental_got_plt_reader): New class.
3683         * layout.cc (Layout::create_incremental_info_sections): Add the
3684         incremental_got_plt section.
3685         * object.h (Got_offset_list::get_list): New function.
3686         (Got offset_list::for_all_got_offsets): New function.
3687         (Sized_relobj::local_got_offset_list): New function.
3688         * powerpc.cc (Target_powerpc::got_size): Add const.
3689         (Target_powerpc::got_entry_count): New function.
3690         (Target_powerpc::plt_entry_count): New function.
3691         (Target_powerpc::first_plt_entry_offset): New function.
3692         (Target_powerpc::plt_entry_size): New function.
3693         (Output_data_plt_powerpc::entry_count): New function.
3694         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3695         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3696         * sparc.cc (Target_sparc::got_size): Add const.
3697         (Target_sparc::got_entry_count): New function.
3698         (Target_sparc::plt_entry_count): New function.
3699         (Target_sparc::first_plt_entry_offset): New function.
3700         (Target_sparc::plt_entry_size): New function.
3701         (Output_data_plt_sparc::entry_count): New function.
3702         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3703         (Output_data_plt_sparc::get_plt_entry_size): New function.
3704         * symtab.h (Symbol::got_offset_list): New function.
3705         (Symbol_table::for_all_symbols): New function.
3706         * target.h (Sized_target::got_entry_count): New function.
3707         (Sized_target::plt_entry_count): New function.
3708         (Sized_target::plt_entry_size): New function.
3709         * x86_64.cc (Target_x86_64::got_size): Add const.
3710         (Target_x86_64::got_entry_count): New function.
3711         (Target_x86_64::plt_entry_count): New function.
3712         (Target_x86_64::first_plt_entry_offset): New function.
3713         (Target_x86_64::plt_entry_size): New function.
3714         (Output_data_plt_x86_64::entry_count): New function.
3715         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3716         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3717
3718 2010-08-12  Cary Coutant  <ccoutant@google.com>
3719
3720         * archive.cc: Include incremental.h.
3721         (Archive::Archive): Initialize incremental_info_.
3722         (Archive::include_member): Record archive members in incremental info.
3723         (Add_archive_symbols::run): Record begin and end of an archive in
3724         incremental info.
3725         (Lib_group::include_member): Record objects in incremental info.
3726         * archive.h (Incremental_archive_entry): Forward declaration.
3727         (Archive::set_incremental_info): New member function.
3728         (Archive::incremental_info): New member function.
3729         (Archive::Unused_symbol_iterator): New class.
3730         (Archive::unused_symbols_begin): New member function.
3731         (Archive::unused_symbols_end): New member function.
3732         (Archive::incremental_info_): New data member.
3733         * incremental-dump.cc (find_input_containing_global): New function.
3734         (dump_incremental_inputs): Dump new incremental info sections.
3735         * incremental.cc: Include symtab.h.
3736         (Output_section_incremental_inputs): New class.
3737         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3738         new incremental info sections.
3739         (Sized_incremental_binary::do_check_inputs): Likewise.
3740         (Incremental_inputs::report_archive): Remove.
3741         (Incremental_inputs::report_archive_begin): New function.
3742         (Incremental_inputs::report_archive_end): New function.
3743         (Incremental_inputs::report_object): New function.
3744         (Incremental_inputs::finalize_inputs): Remove.
3745         (Incremental_inputs::report_input_section): New function.
3746         (Incremental_inputs::report_script): Rewrite.
3747         (Incremental_inputs::finalize): Do nothing but finalize string table.
3748         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3749         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3750         (Incremental_inputs::create_data_sections): New function.
3751         (Incremental_inputs::relocs_entsize): New function.
3752         (Output_section_incremental_inputs::set_final_data_size): New function.
3753         (Output_section_incremental_inputs::do_write): New function.
3754         (Output_section_incremental_inputs::write_header): New function.
3755         (Output_section_incremental_inputs::write_input_files): New function.
3756         (Output_section_incremental_inputs::write_info_blocks): New function.
3757         (Output_section_incremental_inputs::write_symtab): New function.
3758         * incremental.h (Incremental_script_entry): Forward declaration.
3759         (Incremental_object_entry): Forward declaration.
3760         (Incremental_archive_entry): Forward declaration.
3761         (Incremental_inputs): Forward declaration.
3762         (Incremental_inputs_header_data): Remove.
3763         (Incremental_inputs_header): Remove.
3764         (Incremental_inputs_header_write): Remove.
3765         (Incremental_inputs_entry_data): Remove.
3766         (Incremental_inputs_entry): Remove.
3767         (Incremental_inputs_entry_write): Remove.
3768         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3769         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3770         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3771         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3772         Likewise.
3773         (Incremental_input_entry): New class.
3774         (Incremental_script_entry): New class.
3775         (Incremental_object_entry): New class.
3776         (Incremental_archive_entry): New class.
3777         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3778         (Incremental_inputs::report_inputs): Remove.
3779         (Incremental_inputs::report_archive): Remove.
3780         (Incremental_inputs::report_archive_begin): New function.
3781         (Incremental_inputs::report_archive_end): New function.
3782         (Incremental_inputs::report_object): Change prototype.
3783         (Incremental_inputs::report_input_section): New function.
3784         (Incremental_inputs::report_script): Change prototype.
3785         (Incremental_inputs::get_reloc_count): New function.
3786         (Incremental_inputs::set_reloc_count): New function.
3787         (Incremental_inputs::create_data_sections): New function.
3788         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3789         (Incremental_inputs::inputs_section): New function.
3790         (Incremental_inputs::symtab_section): New function.
3791         (Incremental_inputs::relocs_section): New function.
3792         (Incremental_inputs::get_stringpool): Add const.
3793         (Incremental_inputs::command_line): Add const.
3794         (Incremental_inputs::inputs): Remove.
3795         (Incremental_inputs::command_line_key): New function.
3796         (Incremental_inputs::input_file_count): New function.
3797         (Incremental_inputs::input_files): New function.
3798         (Incremental_inputs::relocs_entsize): New function.
3799         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3800         (Incremental_inputs::finalize_inputs): Remove.
3801         (Incremental_inputs::Input_info): Remove.
3802         (Incremental_inputs::lock_): Remove.
3803         (Incremental_inputs::inputs_): Change type.
3804         (Incremental_inputs::inputs_map_): Remove.
3805         (Incremental_inputs::current_object_entry_): New data member.
3806         (Incremental_inputs::inputs_section_): New data member.
3807         (Incremental_inputs::symtab_section_): New data member.
3808         (Incremental_inputs::relocs_section_): New data member.
3809         (Incremental_inputs::reloc_count_): New data member.
3810         (Incremental_inputs_reader): New class.
3811         (Incremental_symtab_reader): New class.
3812         (Incremental_relocs_reader): New class.
3813         * layout.cc (Layout::finalize): Move finalization of incremental info
3814         and creation of incremental info sections to follow finalization of
3815         symbol table.  Set offsets for postprocessing sections.
3816         (Layout::create_incremental_info_sections): Call
3817         Incremental_inputs::create_data_sections.  Add incremental symtab
3818         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3819         sections to layout after input sections.
3820         * layout.h (struct Timespec): Forward declaration.
3821         (Layout::incremental_inputs): Add const.
3822         (Layout::create_incremental_info_sections): Add parameter.
3823         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3824         * object.cc: Include incremental.h.
3825         (Relobj::finalize_incremental_relocs): New function.
3826         (Sized_relobj::do_layout): Record input sections in incremental info.
3827         * object.h (Object::output_section): New function.
3828         (Object::output_section_offset): Moved from Relobj.
3829         (Object::get_incremental_reloc_base): New function.
3830         (Object::get_incremental_reloc_count): New function.
3831         (Object::do_output_section): New function.
3832         (Object::do_output_section_offset): Moved from Relobj.
3833         (Object::do_get_incremental_reloc_base): New function.
3834         (Object::do_get_incremental_reloc_count): New function.
3835         (Object::Object): Initialize new data members.
3836         (Relobj::output_section): Renamed do_output_section and moved to
3837         protected.
3838         (Relobj::output_section_offset): Moved to Object.
3839         (Relobj::do_get_incremental_reloc_base): New function.
3840         (Relobj::do_get_incremental_reloc_count): New function.
3841         (Relobj::allocate_incremental_reloc_counts): New function.
3842         (Relobj::count_incremental_reloc): New function.
3843         (Relobj::finalize_incremental_relocs): New function.
3844         (Relobj::next_incremental_reloc_index): New function.
3845         (Relobj::reloc_counts_): New data member.
3846         (Relobj::reloc_bases_): New data member.
3847         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3848         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3849         (Sized_relobj::incremental_relocs_scan): New function.
3850         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3851         (Sized_relobj::incremental_relocs_write): New function.
3852         (Sized_relobj::incremental_relocs_write_reltype): New function.
3853         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3854         incremental link.
3855         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3856         archives and object files elsewhere.
3857         (Add_symbols::run): Report object files here.
3858         (Finish_group::run): Report end of archive at end of group.
3859         * reloc.cc: Include layout.h, incremental.h.
3860         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3861         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3862         (Sized_relobj::incremental_relocs_scan): New function.
3863         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3864         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3865         (Sized_relobj::incremental_relocs_write): New function.
3866         (Sized_relobj::incremental_relocs_write_reltype): New function.
3867         * script.cc (read_input_script): Rewrite test for incremental link.
3868         Change call to Incremental_inputs::report_script.
3869         * symtab.h (Symbol_table::first_global_index): New function.
3870         (Symbol_table::output_count): New function.
3871
3872 2010-08-12  Doug Kwan  <dougkwan@google.com>
3873
3874         * arm.cc (Target_arm::merge_object_attributes): Check command line
3875         options --no-wchar-size-warning and --no-enum-size-warning.
3876         * options.h (General_options): Add ld-compatible options
3877         --no-enum-size-warning and --no-wchar-size-warning.
3878
3879 2010-08-04  Ian Lance Taylor  <iant@google.com>
3880
3881         * x86_64.cc (Target_x86_64::Scan::local): Use
3882         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3883         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3884         (Target_x86_64::Scan::global): Likewise.
3885         (Target_x86_64::Relocate::relocate): Likewise.
3886         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3887         Likewise.
3888
3889 2010-08-03  Cary Coutant  <ccoutant@google.com>
3890
3891         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3892         to reserve space in merged_strings vector. Keep total input size
3893         for stats.
3894         (Output_merge_string::do_print_merge_stats): Print total input size.
3895         * merge.h (Output_merge_string): Add input_size_ field.
3896         * stringpool.cc (Stringpool_template::string_length): Move
3897         implementations out of Stringpool_template class and place in
3898         stringpool.h.
3899         * stringpool.h (string_length): Move out of Stringpool_template.
3900
3901 2010-08-03  Ian Lance Taylor  <iant@google.com>
3902
3903         PR 11712
3904         * layout.cc (relaxation_loop_body): If address of load segment is
3905         set, adjust address to include headers if possible.
3906
3907 2010-08-03  Ian Lance Taylor  <iant@google.com>
3908
3909         * version.cc (version_string): Bump to 1.10.
3910
3911 2010-08-03  Ian Lance Taylor  <iant@google.com>
3912
3913         PR 11805
3914         * layout.h (enum Output_section_order): Define.
3915         (class Layout): Update declarations.
3916         * layout.cc (Layout::get_output_section): Add order parameter.
3917         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3918         is_first_non_relro parameters.  Change all callers.
3919         (Layout::choose_output_section): Likewise.
3920         (Layout::add_output_section_data): Likewise.
3921         (Layout::make_output_section): Likewise.  Set order.
3922         (Layout::default_section_order): New function.
3923         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3924         * output.cc (Output_section::Output_section): Initialize order_.
3925         Don't initialize deleted fields.
3926         (Output_segment::Output_segment): Don't initialize deleted
3927         fields.
3928         (Output_segment::add_output_section_to_load): New function
3929         replacing add_output_section.  Change all callers to call this or
3930         add_output_section_to_nonload.
3931         (Output_segment::add_output_section_to_nonload): New function.
3932         (Output_segment::remove_output_section): Rewrite.
3933         (Output_segment::add_initial_output_data): Likewise.
3934         (Output_segment::has_any_data_sections): Likewise.
3935         (Output_segment::is_first_section_relro): Likewise.
3936         (Output_segment::maximum_alignment): Likewise.
3937         (Output_segment::has_dynamic_reloc): New function replacing
3938         dynamic_reloc_count.  Change all callers.
3939         (Output_segment::has_dynamic_reloc_list): New function replacing
3940         dynamic_reloc_count_list.  Change all callers.
3941         (Output_segment::set_section_addresses): Rewrite.
3942         (Output_segment::set_offset): Rewrite.
3943         (Output_segment::find_first_and_last_list): Remove.
3944         (Output_segment::set_tls_offsets): Rewrite.
3945         (Output_segment::first_section_load_address): Likewise.
3946         (Output_segment::output_section_count): Likewise.
3947         (Output_segment::section_with_lowest_load_address): Likewise.
3948         (Output_segment::write_section_headers): Likewise.
3949         (Output_segment::print_sections_to_map): Likewise.
3950         * output.h (class Output_data): Remove dynamic_reloc_count_
3951         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3952         (Output_data::add_dynamic_reloc): Rewrite.
3953         (Output_data::has_dynamic_reloc): New function.
3954         (Output_data::dynamic_reloc_count): Remove.
3955         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3956         is_last_relro_, is_first_non_relro_, is_interp_,
3957         is_dynamic_linker_section_ fields.  Add order and set_order
3958         functions.  Remove is_relro_local, set_is_relro_local,
3959         is_last_relro, set_is_last_relro, is_first_non_relro,
3960         set_is_first_non_relro functions, is_interp, set_is_interp,
3961         is_dynamic_linker_section, and set_is_dynamic_linker_section
3962         functions.
3963         (class Output_segment): Change Output_data_list from std::list to
3964         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3965         output_bss_ fields.  Update declarations.
3966
3967 2010-08-02  Ian Lance Taylor  <iant@google.com>
3968
3969         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3970         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3971         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3972
3973 2010-08-02  Ian Lance Taylor  <iant@google.com>
3974
3975         PR 11855
3976         * script.cc (Script_options::Script_options): Initialize
3977         symbol_definitions_ and symbol_references_.
3978         (Script_options::add_symbol_assignment): Update
3979         symbol_definitions_ and symbol_references_.
3980         (Script_options::add_symbol_reference): New function.
3981         (script_symbol): New function.
3982         * script.h (class Script_options): Add symbol_definitions_ and
3983         symbol_references_ fields.
3984         (Script_options::referenced_const_iterator): New type.
3985         (Script_options::referenced_begin): New function.
3986         (Script_options::referenced_end): New function.
3987         (Script_options::is_referenced): New function.
3988         (Script_options::any_unreferenced): New function.
3989         * script-c.h (script_symbol): Declare.
3990         * yyscript.y (exp): Call script_symbol.
3991         * symtab.cc: Include "script.h".
3992         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3993         Change all callers.  Check symbols referenced by scripts.
3994         (Symbol_table::add_undefined_symbols_from_command_line): Add
3995         layout parameter.  Change all callers.
3996         (Symbol_table::do_add_undefined_symbols_from_command_line):
3997         Likewise.  Break out loop body.  Check symbols referenced by
3998         scripts.
3999         (Symbol_table::add_undefined_symbol_from_command_line): New
4000         function broken out of
4001         do_add_undefined_symbols_from_command_line.
4002         * symtab.h (class Symbol_table): Update declarations.
4003         * archive.cc: Include "layout.h".
4004         (Archive::should_include_member): Add layout parameter.  Change
4005         all callers.  Check for symbol mentioned in expression.
4006         * archive.h (class Archive): Update declaration.
4007         * object.cc (Sized_relobj::do_should_include_member): Add layout
4008         parameter.
4009         * object.h (Object::should_include_member): Add layout parameter.
4010         Change all callers.
4011         (Object::do_should_include_member): Add layout parameter.
4012         (class Sized_relobj): Update declaration.
4013         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4014         parameter.
4015         * dynobj.h (class Sized_dynobj): Update declaration.
4016         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4017         layout parameter.
4018         * plugin.h (class Sized_pluginobj): Update declaration.
4019
4020 2010-08-02  Ian Lance Taylor  <iant@google.com>
4021
4022         PR 11866
4023         * output.cc (Output_segment::set_offset): Search for the first and
4024         last sections rather than assuming that the list is in order.
4025         (Output_segment::find_first_and_last_list): New function.
4026         * output.h (class Output_segment): Update declarations.
4027         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4028         (relro_strip_test_SOURCES): New variable.
4029         (relro_strip_test_DEPENDENCIES): New variable.
4030         (relro_strip_test_LDFLAGS): New variable.
4031         (relro_strip_test_LDADD): New variable.
4032         (relro_strip_test.so): New target.
4033
4034 2010-08-02  Ian Lance Taylor  <iant@google.com>
4035
4036         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4037         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4038         (Target_i386::got_tlsdesc_section): New function.
4039         (Target_i386::got_section): Create space for GOT entries for
4040         TLSDESC relocations.
4041         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4042         R_386_TLS_GOTDESC.
4043         (Target_i386::Scan::global): Likewise.
4044         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4045         using TLSDESC GOT.
4046         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4047         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4048         (Target_x86_64::got_tlsdesc_section): New function.
4049         (Target_x86_64::got_section): Create space for GOT entries for
4050         TLSDESC relocations.
4051         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4052         R_386_TLS_GOTDESC.
4053         (Target_x86_64::Scan::global): Likewise.
4054         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4055         using TLSDESC GOT.
4056
4057 2010-08-02  Ian Lance Taylor  <iant@google.com>
4058
4059         * testsuite/final_layout.sh: Use dc to convert from hex to
4060         decimal.
4061
4062 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4063
4064         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4065         paramter to the call to gold::gc_process_relocs.
4066         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4067         paramter to the call to gold::gc_process_relocs.
4068         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4069         parameter to the call to gold::gc_process_relocs.
4070         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4071         template parameter to the call to gold::gc_process_relocs.
4072         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4073         paramter to the call to gold::gc_process_relocs.
4074         * gc.h (get_embedded_addend_size): New function.
4075         (gc_process_relocs): Save the size of the reloc for use by ICF.
4076         * icf.cc (get_section_contents): Get the addend from the text section
4077         for SHT_REL relocation sections.
4078         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4079         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4080         * int_encoding.h (read_from_pointer): New overloaded function.
4081         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4082         * testsuite/icf_sht_rel_addend_test.sh: New file.
4083         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4084         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4085
4086 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4087
4088         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4089         * Makefile.in: Regenerate.
4090         * testsuite/Makefile.in: Regenerate.
4091
4092 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4093
4094         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4095         * gold/testsuite/debug_msg.cc: Likewise.
4096         * gold/testsuite/odr_violation1.cc
4097         * gold/testsuite/odr_violation2.cc
4098
4099 2010-07-21  Cary Coutant  <ccoutant@google.com>
4100
4101         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4102         string, and length fields.
4103         (Output_merge_string::Merged_strings_list): New type.
4104         (Output_merge_string::Merged_strings_lists): New typedef.
4105         (Output_merge_string): Replace merged_strings_ with
4106         merged_strings_lists_.
4107         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4108         Merged_strings_list per input object and section.  Don't store pointer
4109         to the string.  Don't store length with each merged string entry.
4110         (Output_merge_string::finalize_merged_data): Loop over list of merged
4111         strings lists.  Recompute length of each merged string.
4112
4113 2010-07-15  Cary Coutant  <ccoutant@google.com>
4114
4115         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4116         here.
4117
4118 2010-07-14  Ian Lance Taylor  <iant@google.com>
4119
4120         * descriptors.cc (Descriptors::open): Report correct name in error
4121         message.
4122
4123 2010-07-13  Doug Kwan  <dougkwan@google.com>
4124
4125         * arm.cc (Arm_input_section::Arm_input_section): For a
4126         SHT_ARM_EXIDX section, always keeps the input sections.
4127         (Arm_input_section::set_exidx_section_link): New method.
4128         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4129         has_errors_ to false.
4130         (Arm_exidx_input_section::has_errors,
4131         Arm_exidx_input_section::set_has_errors): New methods.
4132         (Arm_exidx_input_section::has_errors_): New data member.
4133         (Arm_relobj::get_exidx_shndx_list): New method.
4134         (Arm_output_section::append_text_sections_to_list): Do not skip
4135         section without SHF_EXECINSTR.
4136         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4137         errors.
4138         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4139         section header.  Make error messages more verbose.  Check for
4140         a non-executable section linked to an EXIDX section.
4141         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4142         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4143         check that there is no deferred EXIDX section if we exit early.
4144         Instead of not making an EXIDX section in case of an error, make one
4145         and set the has_errors flag of it.
4146         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4147         in a relocatable link.
4148         (Target_arm::do_relax): Look for the EXIDX output section instead of
4149         assuming that it is called .ARM.exidx.
4150         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4151         section list.  Do not check for SHF_EXECINSTR section flags but
4152         skip any input section with errors.
4153         * output.cc (Output_section::Output_section): Initialize
4154         always_keeps_input_sections_ to false.
4155         (Output_section::add_input_section): Check for
4156         always_keeps_input_sections_.
4157         *  output.h (Output_section::always_keeps_input_sections,
4158         Output_section::set_always_keeps_input_sections): New methods.
4159         (Output_section::always_keeps_input_sections): New data member.
4160
4161 2010-07-13  Rafael Espindola  <espindola@google.com>
4162
4163         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4164         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4165
4166 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4167             Ian Lance Taylor  <iant@google.com>
4168
4169         * output.h (Output_section_lookup_maps::add_merge_section):
4170         Correct check of whether value was inserted.
4171         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4172         (Output_section_lookup_maps::add_relaxed_input_section):
4173         Likewise.
4174         * arm.cc (Target_arm::got_section): Remove used local os.
4175         * i386.cc (Target_i386::got_section): Likewise.
4176         * x86_64.cc (Target_x86_64::got_section): Likewise.
4177         * sparc.cc (Target_sparc::got_section): Likewise.
4178         (Target_sparc::relocate): Remove unused local have_got_offset.
4179         * powerpc.cc (Target_powerpc::relocate): Likewise.
4180
4181 2010-07-13  Ian Lance Taylor  <iant@google.com>
4182
4183         * compressed_output.cc (zlib_decompress): Fix signature in
4184         !HAVE_ZLIB_H case.
4185
4186         * archive.cc (Archive::include_member): Unlock an external member
4187         of a thin archive.  Don't bother to delete an object we know is
4188         NULL.
4189
4190 2010-07-12  Cary Coutant  <ccoutant@google.com>
4191
4192         * compressed_output.cc (zlib_decompress): New function.
4193         (get_uncompressed_size): New function.
4194         (decompress_input_section): New function.
4195         * compressed_output.h (get_uncompressed_size): New function.
4196         (decompress_input_section): New function.
4197         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4198         Handle compressed debug sections.
4199         * layout.cc (is_compressed_debug_section): New function.
4200         (Layout::output_section_name): Map compressed section names to
4201         canonical names.
4202         * layout.h (is_compressed_debug_section): New function.
4203         (is_debug_info_section): Recognize compressed debug sections.
4204         * merge.cc: Include compressed_output.h.
4205         (Output_merge_data::do_add_input_section): Handle compressed
4206         debug sections.
4207         (Output_merge_string::do_add_input_section): Handle compressed
4208         debug sections.
4209         * object.cc: Include compressed_output.h.
4210         (Sized_relobj::Sized_relobj): Initialize new data members.
4211         (build_compressed_section_map): New function.
4212         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4213         * object.h (Object::section_is_compressed): New method.
4214         (Object::do_section_is_compressed): New method.
4215         (Sized_relobj::Compressed_section_map): New type.
4216         (Sized_relobj::do_section_is_compressed): New method.
4217         (Sized_relobj::compressed_sections_): New data member.
4218         * output.cc (Output_section::add_input_section): Handle compressed
4219         debug sections.
4220         * reloc.cc: Include compressed_output.h.
4221         (Sized_relobj::write_sections): Handle compressed debug sections.
4222
4223 2010-07-08  Cary Coutant  <ccoutant@google.com>
4224
4225         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4226         weak when resolving to a dynamic def.
4227         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4228         for weak undef/dynamic def cases. Adjust callers.
4229         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4230         undef_binding_weak_.
4231         (Symbol_table::sized_write_globals): Adjust symbol binding.
4232         (Symbol_table::sized_write_symbol): Add binding parameter.
4233         * symtab.h (Symbol::set_undef_binding): New method.
4234         (Symbol::is_undef_binding_weak): New method.
4235         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4236         (Symbol_table::should_override): Add new parameter.
4237         (Symbol_table::sized_write_symbol): Add new parameter.
4238
4239         * testsuite/weak_undef_file1.cc: Add new test case.
4240         * testsuite/weak_undef_file2.cc: Fix header comment.
4241         * testsuite/weak_undef_test.cc: Add new test case.
4242
4243 2010-06-29  Doug Kwan  <dougkwan@google.com>
4244
4245         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4246         Initialize USE_SYMBOL_.
4247         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4248         definition.
4249         (Arm_reloc_property::uses_symbol_): New data member declaration.
4250         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4251         uses symbol value and symbol is undefined but not weakly undefined.
4252
4253 2010-06-28  Rafael Espindola  <espindola@google.com>
4254
4255         * plugin.cc (Plugin::load): Use dlerror.
4256
4257 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4258
4259         * symtab.cc (detect_odr_violations): When reporting an ODR
4260         violation, report an object where the symbol is defined.
4261
4262 2010-06-25  Doug Kwan  <dougkwan@google.com>
4263
4264         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4265         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4266         definition.
4267         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4268         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4269         target hook to detect function points.
4270         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4271         * icf.h (Icf::check_section_for_function_pointers): Change type of
4272         parameter SECTION_NAME to const reference to std::string.  Use
4273         target hook to determine if section may have unsafe pointers.
4274         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4275         method definition.
4276
4277 2010-06-21  Rafael Espindola  <espindola@google.com>
4278
4279         * fileread.cc (Input_file::find_fie): New
4280         (Input_file::open): Use Input_file::find_fie.
4281         * fileread.h (Input_file::find_fie): New
4282         * plugin.cc (set_extra_library_path): New.
4283         (Plugin::load): Add set_extra_library_path to the transfer vector.
4284         (Plugin_manager::set_extra_library_path): New.
4285         (Plugin_manager::add_input_file): Use the extra search path if set.
4286         (set_extra_library_path(): New.
4287         * plugin.h (Plugin_manager): Add set_extra_library_path and
4288         extra_search_path_.
4289
4290 2010-06-19  Cary Coutant  <ccoutant@google.com>
4291
4292         * layout.cc (gdb_sections): Add .debug_types.
4293         (lines_only_debug_sections): Likewise.
4294
4295 2010-06-18  Rafael Espindola  <espindola@google.com>
4296
4297         * plugin.cc (add_input_file,add_input_library)
4298         (Plugin_manager::add_input_file): Make filename arguments const.
4299         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4300         const.
4301
4302 2010-06-16  Doug Kwan  <dougkwan@google.com>
4303
4304         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4305         .ARM.attributes section if we have not merged any input
4306         attributes sections.
4307
4308 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4309
4310         * arm.cc: Allow combining objects with no EABI version
4311         information.
4312
4313 2010-06-15  Rafael Espindola  <espindola@google.com>
4314
4315         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4316
4317 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4318
4319         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4320         (struct iovec): Correct !HAVE_READV definition.
4321
4322 2010-06-10  Cary Coutant  <ccoutant@google.com>
4323
4324         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4325         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4326         reloc sections.
4327         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4328
4329         PR 11683
4330         * symtab.h (Symbol::is_placeholder): New member function.
4331         * target-reloc.h (relocate_section): Check for placeholder symbols.
4332
4333         * testsuite/Makefile.am (plugin_test_8): New test.
4334         (plugin_test_9): New test.
4335         * testsuite/Makefile.in: Regenerate.
4336
4337 2010-06-09  Nick Clifton  <nickc@redhat.com>
4338
4339         * yyscript.y (input_list_element): Allow strings prefixed with
4340         the '-' character.  Treat these as libraries.
4341         * script.cc (script_add_library): New function.  Adds a library
4342         specified by "-l<name>" found in an input script.
4343         * script-c.h: Add prototype for script_add_library.
4344
4345 2010-06-07  Doug Kwan  <dougkwan@google.com>
4346
4347         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4348         Restrict stub-group size to be within long conditional branch
4349         range when working around cortex-A8 erratum.
4350
4351 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4352
4353         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4354         #ifdef typo.
4355
4356 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4357
4358         PR gold/11658
4359         * output.cc
4360         (Output_section::Input_section_sort_entry::compare_section_ordering):
4361         Change to return non-zero correctly.
4362         (Output_section::Input_section_sort_section_order_index_compare
4363         ::operator()): Change to fix ambiguity in comparisons.
4364
4365 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4366
4367         * gold.h (is_wildcard_string): New function.
4368         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4369         (Layout::layout_eh_frame): Ditto.
4370         (Layout::find_section_order_index): New method.
4371         (Layout::read_layout_from_file): New method.
4372         * layout.h (Layout::find_section_order_index): New method.
4373         (Layout::read_layout_from_file): New method.
4374         (Layout::input_section_position_): New private member.
4375         (Layout::input_section_glob_): New private member.
4376         * main.cc (main): Call read_layout_from_file here.
4377         * options.h (--section-ordering-file): New option.
4378         * output.cc (Output_section::input_section_order_specified_): New
4379         member.
4380         (Output_section::Output_section): Initialize new member.
4381         (Output_section::add_input_section): Add new parameter.
4382         Keep input sections when --section-ordering-file is used.
4383         (Output_section::set_final_data_size): Sort input sections when
4384         section ordering file is specified.
4385         (Output_section::Input_section_sort_entry): Add new parameter.
4386         Check sorting type.
4387         (Output_section::Input_section_sort_entry::compare_section_ordering):
4388         New method.
4389         (Output_section::Input_section_sort_compare::operator()): Change to
4390         consider section_order_index.
4391         (Output_section::Input_section_sort_init_fini_compare::operator()):
4392         Change to consider section_order_index.
4393         (Output_section::Input_section_sort_section_order_index_compare
4394         ::operator()): New method.
4395         (Output_section::sort_attached_input_sections): Change to sort
4396         according to section order when specified.
4397         (Output_section::add_input_section<32, true>): Add new parameter.
4398         (Output_section::add_input_section<64, true>): Add new parameter.
4399         (Output_section::add_input_section<32, false>): Add new parameter.
4400         (Output_section::add_input_section<64, false>): Add new parameter.
4401         * output.h (Output_section::add_input_section): Add new parameter.
4402         (Output_section::input_section_order_specified): New
4403         method.
4404         (Output_section::set_input_section_order_specified): New method.
4405         (Input_section::Input_section): Initialize section_order_index_.
4406         (Input_section::section_order_index): New method.
4407         (Input_section::set_section_order_index): New method.
4408         (Input_section::section_order_index_): New member.
4409         (Input_section::Input_section_sort_section_order_index_compare): New
4410         struct.
4411         (Output_section::input_section_order_specified_): New member.
4412         * script-sections.cc (is_wildcard_string): Delete and move modified
4413         method to gold.h.
4414         (Output_section_element_input::Output_section_element_input): Modify
4415         call to is_wildcard_string.
4416         (Output_section_element_input::Input_section_pattern
4417         ::Input_section_pattern): Ditto.
4418         (Output_section_element_input::Output_section_element_input): Ditto.
4419         * testsuite/Makefile.am (final_layout): New test case.
4420         * testsuite/Makefile.in: Regenerate.
4421         * testsuite/final_layout.cc: New file.
4422         * testsuite/final_layout.sh: New file.
4423
4424 2010-06-01  Rafael Espindola  <espindola@google.com>
4425
4426         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4427
4428 2010-06-01  Rafael Espindola  <espindola@google.com>
4429
4430         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4431         visibility of symbols.
4432
4433 2010-05-27  Doug Kwan  <dougkwan@google.com>
4434
4435         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4436         from start of output section instead of address for a local symbol
4437         in a merged or relaxed section when doing a relocatable link.
4438
4439 2010-05-26  Rafael Espindola  <espindola@google.com>
4440
4441        PR 11604
4442         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4443         adding sections the garbage collector removed.
4444         * gold/testsuite/Makefile.am: Add test.
4445         * gold/testsuite/Makefile.in: Regenerate.
4446         * gold/testsuite/plugin_test_7.sh: New.
4447         * gold/testsuite/plugin_test_7_1.c: New.
4448         * gold/testsuite/plugin_test_7_2.c: New.
4449
4450 2010-05-26  Rafael Espindola  <espindola@google.com>
4451
4452         * script-sections.cc (Output_section_definition::set_section_addresses):
4453         Check for --section-start.
4454
4455 2010-05-26  Doug Kwan  <dougkwan@google.com>
4456
4457         * arm.cc (Arm_scan_relocatable_relocs): New class.
4458         (Target_arm::relocate_special_relocatable): New method.
4459         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4460         (Arm_relocate_functions::thumb_branch_common): Same.
4461         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4462         instead of Default_scan_relocatable_relocs.
4463         * target-reloc.h (relocate_for_relocatable): Let target handle
4464         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4465         * target.h (Sized_target::relocate_special_relocatable): New method.
4466
4467 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4468
4469         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4470
4471 2010-05-23  Doug Kwan  <dougkwan@google.com>
4472
4473         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4474         instead of a cast.
4475         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4476         with a direct branch, not a conditional branch, to a stub.
4477         * merge.cc (Output_merge_base::record_input_section): New method
4478         defintion.
4479         (Output_merge_data::do_add_input_section): Record input section if
4480         keeps-input-sections flag is set.
4481         (Output_merge_string::do_add_input_section): Ditto.
4482         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4483         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4484         INPUT_SECTIONS_.
4485         (Output_merge_base::keeps_input_sections,
4486         Output_merge_base::set_keeps_input_sections,
4487         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4488         method definitions.
4489         (Output_merge_base::Input_sections): New type declaration.
4490         (Output_merge_base::input_sections_begin,
4491         Output_merge_base::input_sections_end,
4492         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4493         (Output_merge_base::bool keeps_input_sections_,
4494         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4495         Output_merge_base::input_sections_): New data members.
4496         (Output_merge_data::do_set_keeps_input_sections): New method
4497         defintion.
4498         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4499         * output.cc (Output_section::Input_section::relobj): Move method
4500         defintion from class declaration to here and handle merge sections.
4501         (Output_section::Input_section::shndx): Ditto.
4502         (Output_section::Output_section): Remove initializations of removed
4503         data members and initialize new data member LOOKUP_MAPS_.
4504         (Output_section::add_input_section): Set keeps-input-sections flag
4505         for a newly created merge output section as appropriate.  Adjust code
4506         to use Output_section_lookup_maps class.
4507         (Output_section::add_relaxed_input_section): Adjst code for lookup
4508         maps code refactoring.
4509         (Output_section::add_merge_input_section): Add a new parameter
4510         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4511         class.  If adding input section to a newly created merge output
4512         section fails, remove the new merge section.
4513         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4514         Adjust code for use of the Output_section_lookup_maps class.
4515         (Output_section::find_merge_section): Ditto.
4516         (Output_section::build_lookup_maps): New method defintion.
4517         (Output_section::find_relaxed_input_section): Adjust code to use
4518         Output_section_lookup_maps class.
4519         (Output_section::get_input_sections): Export merge sections.  Adjust
4520         code to use Output_section_lookup_maps class.
4521         (Output_section:::add_script_input_section): Adjust code to use
4522         Output_section_lookup_maps class.  Update lookup maps for merge
4523         sections also.
4524         (Output_section::discard_states): Use Output_section_lookup_maps.
4525         (Output_section::restore_states): Same.
4526         * output.h (Merge_section_properties): Move class defintion out of
4527         Output_section.
4528         (Output_section_lookup_maps): New class.
4529         (Output_section::Input_section::is_merge_section): New method
4530         defintion.
4531         (Output_section::Input_section::relobj): Move defintion out of class
4532         defintion.  Declare method only.
4533         (Output_section::Input_section::shndx): Ditto.
4534         (Output_section::Input_section::output_merge_base): New method defintion.
4535         (Output_section::Input_section::u2_.pomb): New union field.
4536         (Output_section::Merge_section_by_properties_map,
4537         Output_section::Output_section_data_by_input_section_map,
4538         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4539         Remove types.
4540         (Output_section::add_merge_input_section): Add new parameter
4541         KEEPS_INPUT_SECTIONS.
4542         (Output_section::build_lookup_maps): New method declaration.
4543         (Output_section::merge_section_map_,
4544         Output_section::merge_section_by_properties_map_,
4545         Output_section::relaxed_input_section_map_,
4546         Output_section::is_relaxed_input_section_map_valid_): Remove data
4547         members.
4548         (Output_section::lookup_maps_): New data member.
4549
4550 2010-05-21  Doug Kwan  <dougkwan@google.com>
4551
4552         PR gold/11619
4553         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4554         avoid a compilation error.
4555
4556 2010-05-19  Rafael Espindola  <espindola@google.com>
4557
4558         * script-sections.cc (Output_section_definition::allocate_to_segment):
4559         Update the phdrs_list even when the output section is NULL.
4560         * testsuite/Makefile.am: Add test.
4561         * testsuite/Makefile.in: Regenerate.
4562         * testsuite/script_test_9.cc: New.
4563         * testsuite/script_test_9.sh: New.
4564         * testsuite/script_test_9.t: New.
4565
4566 2010-05-19  Doug Kwan  <dougkwan@google.com>
4567
4568         * arm.cc (Arm_input_section::original_size): New method.
4569         (Arm_input_section::do_addralign): Add a cast.
4570         (Arm_input_section::do_output_offset): Remove static cast.
4571         (Arm_input_section::original_addralign,
4572          Arm_input_section::original_size_): Change type to uint32_t.
4573         (Arm_input_section::init): Add safe casts for section alignment
4574         and size.
4575         (Arm_input_section::set_final_data_size): Do not set address and
4576         offset of stub table.
4577         (Arm_output_section::fix_exidx_coverage): Change use of of
4578         Output_section::Simple_input_section to that of
4579         Output_section::Input_section.
4580         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4581         except for the first pass.
4582         * output.cc (Output_section::get_input_sections): Change type of
4583         input_sections to std::list<Input_section>.
4584         (Output_section::add_script_input_section): Rename from
4585         Output_section::add_simple_input_section.  Change type of SIS
4586         parameter from Simple_input_section to Input_section.
4587         * output.h (Output_section::Simple_input_section): Remove class.
4588         (Output_section::Input_section): Change class visibility to public.
4589         (Output_section::Input_section::addralign): Use stored alignments
4590         for special input sections if set.
4591         (Output_section::Input_section::set_addralign): New method.
4592         (Output_section::get_input_sections): Change parameter type from
4593         list of Simple_input_section to list of Input_section.
4594         (Output_section::add_script_input_section): Rename from
4595         Output_section::add_simple_input_section. Change first parameter's
4596         type from Simple_input_section to Input_section and remove the
4597         second and third parameters.
4598         * script-sections.cc (Input_section::Input_section_list): Change
4599         type to list of Output_section::Input_section/
4600         (Input_section_info::Input_section_info): Change parameter type of
4601         INPUT_SECTION to Output_section::Input_section.
4602         (Input_section_info::input_section): Change return type.
4603         (Input_section_info::input_section_): Change type to
4604         Output_section::Input_section.
4605         (Output_section_element_input::set_section_addresses): Adjust code
4606         to use Output_section::Input_section instead of
4607         Output_section::Simple_input_section.  Adjust code for renaming
4608         of Output_section::add_simple_input_section.
4609         (Orphan_output_section::set_section_addresses): Ditto.
4610
4611 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4612
4613         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4614         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4615
4616 2010-05-18  Rafael Espindola  <espindola@google.com>
4617
4618         * options.cc (General_options::finalize): Handle -nostdlib.
4619         * options.h (nostdlib): New option.
4620         * script.cc (script_add_search_dir): Handle -nostdlib.
4621
4622 2010-05-12  Doug Kwan  <dougkwan@google.com>
4623
4624         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4625         attributes section only if there no attributes section after merging.
4626         (Target_arm::merge_object_attributes): Move value of
4627         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4628         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4629         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4630         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4631         and arm_attr_merge_7.stdout.
4632         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4633         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4634         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4635         arm_attr_merge_7b.o): New rules.
4636         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4637         arm_attr_merge_7
4638         * testsuite/Makefile.in: Regenerate.
4639         * testsuite/arm_attr_merge.sh: New file.
4640         * testsuite/arm_attr_merge_[67][ab].s: Same.
4641
4642 2010-05-05  Nick Clifton  <nickc@redhat.com>
4643
4644         * po/es.po: Updated Spanish translation.
4645
4646 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4647
4648         * Makefile.am (install-exec-local): Properly install gold as
4649         default cross linker.
4650         * Makefile.in: Regenerated.
4651
4652 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4653             Nick Clifton  <nickc@redhat.com>
4654
4655         * configure.ac (install_as_default): Define and set to false
4656         unless --enable-gold or --enable-gold=both/gold has been
4657         specified.
4658         * configure: Regenerate.
4659
4660         * Makefile.am (install-exec-local): Install the executable as
4661         'ld.gold'.  If install_as_default is true then also install it as
4662         'ld'.
4663         * Makefile.in: Regenerated.
4664
4665 2010-04-24  Ian Lance Taylor  <iant@google.com>
4666
4667         * layout.cc (Layout::layout_reloc): In relocatable link don't
4668         combine reloc sections for grouped sections.
4669
4670 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4671
4672         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4673         sections that are not ordinary to icf.
4674         * icf.cc (get_section_contents): Handle relocation pointing to section
4675         with no object or shndx information.
4676         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4677         * testsuite/Makefile.in: Regenerate.
4678         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4679         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4680
4681 2010-04-22  Ian Lance Taylor  <iant@google.com>
4682
4683         * expression.cc (Expression::Expression_eval_info): Add
4684         result_alignment_pointer field.
4685         (Expression::eval_with_dot): Add result_alignment_pointer
4686         parameter.  Change all callers.
4687         (Expression::eval_maybe_dot): Likewise.
4688         (class Binary_expression): Add alignment_pointer parameter to
4689         left_value and right_value.  Change all callers.
4690         (BINARY_EXPRESSION): Set result alignment.
4691         (class Trinary_expression): Add alignment_pointer parameter to
4692         arg2_value and arg3_value.  Change all callers.
4693         (Trinary_cond::value): Set result alignment.
4694         (Max_expression::value, Min_expression::value): Likewise.
4695         (Align_expression::value): Likewise.
4696         * script-sections.cc (class Sections_element): Add dot_alignment
4697         parameter to set_section_addresses virtual function.  Update
4698         instantiations.
4699         (class Output_section_element): Likewise.
4700         (Script_sections::create_segments): Add dot_alignment parameter.
4701         Change all callers.
4702         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4703         (Script_sections::set_phdrs_clause_addresses): Likewise.
4704         * script-sections.h: Update declarations.
4705         * script.h: Update declarations.
4706         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4707         min_p_align.
4708         * testsuite/script_test_3.t: Set large alignment.
4709         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4710         segment has expected alignment.
4711
4712 2010-04-22  Nick Clifton  <nickc@redhat.com>
4713
4714         * po/gold.pot: Updated by the Translation project.
4715         * po/vi.po: Updated Vietnamese translation.
4716
4717 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4718
4719         * testsuite/Makefile.am (check_PROGRAMS): Add
4720         icf_virtual_function_folding_test.
4721         * testsuite/Makefile.in: Regenerated.
4722
4723 2010-04-15  Andrew Haley  <aph@redhat.com>
4724
4725         * options.h (merge_exidx_entries): New option.
4726         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4727         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4728         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4729         (Target_arm::merge_exidx_entries): New function.
4730         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4731         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4732         to Arm_exidx_fixup constructor.
4733         Add new arg, merge_exidx_entries.
4734         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4735         Arm_output_section::fix_exidx_coverage.
4736
4737 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4738
4739         * icf.cc (get_section_contents): Check for preemptible functions.
4740         Ignore addend when appropriate.
4741         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4742         section folded.
4743         (add_from_relobj): Check for section folded.
4744         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4745         * symtab.h (should_add_dynsym_entry): Add new parameter.
4746         * target-reloc.h (scan_relocs): Check for section folded.
4747         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4748         Check reloc types for function pointers in shared objects.
4749         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4750         case.
4751         (icf_preemptible_functions_test): New test case.
4752         (icf_string_merge_test): New test case.
4753         * testsuite.Makefile.in: Regenerate.
4754         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4755         bar_glob.  Refactor code.
4756         * testsuite/icf_preemptible_functions_test.cc: New file.
4757         * testsuite/icf_preemptible_functions_test.sh: New file.
4758         * testsuite/icf_string_merge_test.cc: New file.
4759         * testsuite/icf_string_merge_test.sh: New file.
4760         * testsuite/icf_virtual_function_folding_test.cc: New file.
4761         * testsuite/icf_virtual_function_folding_test.sh: New file.
4762
4763 2010-04-14  Doug Kwan  <dougkwan@google.com>
4764
4765         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4766         for local symbol recounting if we remove a section due to ICF.
4767         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4768         there are no regular objects in input.
4769
4770 2010-04-13  Doug Kwan  <dougkwan@google.com>
4771
4772         * arm.cc (Arm_input_section::set_final_data_size): Compute
4773         accurate final data size instead of using current data size.
4774
4775 2010-04-09  Doug Kwan  <dougkwan@google.com>
4776
4777         * layout.cc (Layout::choose_output_section): Handle script section
4778         types.
4779         (Layout::make_output_section_for_script): Add section type parameter.
4780         Handle script section types.
4781         * layout.h (Layout::make_output_section_for_script): Add section
4782         type parameter.
4783         * output.cc (Output_section::Output_section): Initialize data member
4784         is_noload_.
4785         (Output_section::do_reset_address_and_file_offset): Do not set address
4786         to 0 if section is a NOLOAD section.
4787         * output.h (Output_section::is_noload): New method.
4788         (Output_section::set_is_noload): Ditto.
4789         (Output_section::is_noload_): New data member.
4790         * script-c.h (Script_section_type): New enum type.
4791         (struct Parser_output_section_header): Add new file section_type.
4792         * script-sections.cc (Sections_element::output_section_name): Add
4793         parameter for returning script section type.
4794         (Output_section_definition::output_section_name): Ditto.
4795         (Output_section_definition::section_type)P; New method.
4796         (Output_section_definiton::script_section_type_name): Ditto.
4797         (Output_section_definition::script_section_type_): New data member.
4798         (Output_section_definition::Output_section_definition): Initialize
4799         data member Output_section_definition::script_section_type_.
4800         (Output_section_definition::create_sections): Pass script section type
4801         to Layout::make_output_section_for_script.
4802         (Output_section_definition::output_section_name): Return script
4803         section type to caller.
4804         (Output_section_definition::set_section_address): Do not advance
4805         dot value and load address if section type is NOLOAD.  Set address
4806         of NOLOAD sections regardless of section flags.
4807         (Output_section_definition::print): Print section type if it is
4808         not SCRIPT_SECTION_TYPE_NONE.
4809         (Output_section_definition::section_type): New method.
4810         (Output_section_definition::script_section_type_name): Ditto.
4811         (Script_sections::output_section_name): Add new parameter
4812         PSECTION_TYPE for returning script section type.  Pass it to
4813         section elements.  Handle discard sections.
4814         (Sort_output_sections::operator()): Handle NOLOAD sections.
4815         * script-sections.h (Script_sections::Section_type): New enum type.
4816         (Script_sections::output_section_name): Add a new parameter for
4817         returning script section type.
4818         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4819         INFO and NOLOAD.
4820         * yyscript.y (union): Add new field SECTION_TYPE.
4821         (COPY, DSECT, INFO, NOLOAD): New tokens.
4822         (opt_address_and_section_type): Change type to output_section_header.
4823         (section_type): New non-terminal
4824         (section_header): Handle section type.
4825         (opt_address_and_section_type): Return section type value.
4826
4827 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4828
4829         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4830         * testsuite/plugin_common_test_2.c (foo): Likewise.
4831
4832 2010-04-08  Doug Kwan  <dougkwan@google.com>
4833
4834         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4835         Output_merge_data.
4836         * output.cc (Output_section::add_merge_input_section): Simplify
4837         code and return status of Output_merge_base::add_input_section.
4838         Update merge section map only if Output_merge_base::add_input_section
4839         returns true.
4840
4841 2010-04-07  Doug Kwan  <dougkwan@google.com>
4842
4843         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4844         if section is marked as containing instructions but has no mapping
4845         symbols.
4846         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4847         correct section index.
4848         (Arm_relobj::find_linked_text_section): Ditto.
4849
4850 2010-04-07  Cary Coutant  <ccoutant@google.com>
4851
4852         * archive.cc (include_member): Destroy Read_symbols_data object before
4853         releasing file.
4854         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4855         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4856         (Read_symbols_data::~Read_symbols_data) New destructor.
4857         (Section_relocs::Section_relocs) New constructor.
4858         (Section_relocs::~Section_relocs) New destructor.
4859         (Read_relocs_data::Read_relocs_data) New constructor.
4860         (Read_relocs_data::~Read_relocs_data) New destructor.
4861         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4862         pointers to NULL after deleting.
4863
4864 2010-04-07  Doug Kwan  <dougkwan@google.com>
4865
4866         * arm.cc: Replace "endianity" with "endianness" in comments.
4867         (Arm_exidx_cantunwind): Ditto.
4868         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4869         (Arm_relobj::merge_flags_and_attributes): New method.
4870         (Arm_relobj::merge_flags_and_attributes_): New data member.
4871         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4872         (Arm_relobj::scan_sections_for_stubs): Ditto.
4873         (Arm_relobj::do_read_symbols): Check to see if we really want to
4874         merge processor-specific flags and attributes.  Exit early if
4875         an object is empty except for section names and the undefined symbol.
4876         (Target_arm::do_finalize_sections): Move check for ELF format to
4877         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4878         attributes from a regular object only when we have determined that
4879         it is aapropriate.  Do not create an .ARM.attributes section in
4880         output if there is no regular input object.
4881         (Target_arm::merge_processor_specific_flags): Check
4882         --warn-mismatch before printing any error.
4883         (Target_arm::merge_object_attributes): Ditto.
4884         * gold.cc (queue_middle_tasks): Handle the case in which there is
4885         no regular object in input.
4886         * options.cc (General_options::parse_EB): New method.
4887         (General_options::parse_EL): Same.
4888         (General_options::General_options): Initialize endianness_.
4889         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4890         New options.
4891         (General_options::Endianness): New enum.
4892         (General_options::endianness): New method.
4893         (General_options::endianness_): New data member.
4894         * parameters.cc (Parameters::set_options): Check target endianness.
4895         (Parameters::set_target_once): Ditto.
4896         (Parameters::check_target_endianness): New method.
4897         (parameters_force_valid_target): If either -EL or -EB is specified,
4898         use it to define endianness of default target.
4899         * parameters.h (Parameters::check_target_endianness): New method
4900         declaration.
4901         * target.h (class Target): Change "endianity" to "endianness"
4902         in comments.
4903
4904 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4905
4906         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4907         * configure: Regenerate.
4908         * Makefile.in: Regenerate.
4909         * testsuite/Makefile.in: Regenerate.
4910
4911 2010-04-06  Cary Coutant  <ccoutant@google.com>
4912
4913         gcc PR lto/42757
4914         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4915         prevailing definitions of common symbols.
4916         * testsuite/plugin_test_6.sh: New test case.
4917         * testsuite/plugin_common_test_1.c: New test case.
4918         * testsuite/plugin_common_test_2.c: New test case.
4919         * testsuite/Makefile.am (plugin_test_6): New test case.
4920         * testsuite/Makefile.in: Regenerate.
4921
4922 2010-04-06  Nick Clifton  <nickc@redhat.com>
4923
4924         * po/vi.po: New Vietnamese translation.
4925
4926 2010-03-30  Doug Kwan  <dougkwan@google.com>
4927
4928         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4929
4930 2010-03-25  Doug Kwan  <dougkwan@google.com>
4931
4932         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4933         to avoid a conversion warning on a 32-bit host.
4934
4935 2010-03-24  Ian Lance Taylor  <iant@google.com>
4936
4937         * testsuite/script_test_3.t: Add a TLS segment.
4938         * testsuite/Makefile.am (check_PROGRAMS): Add
4939         tls_phdrs_script_test.
4940         (tls_phdrs_script_test_SOURCES): Define.
4941         (tls_phdrs_script_test_DEPENDENCIES): Define.
4942         (tls_phdrs_script_test_LDFLAGS): Define.
4943         (tls_phdrs_script_test_LDADD): Define.
4944         * testsuite/Makefile.in: Rebuild.
4945
4946 2010-03-23  Cary Coutant  <ccoutant@google.com>
4947
4948         * fileread.cc (find_or_make_view): Fix comment.
4949
4950 2010-03-23  Ian Lance Taylor  <iant@google.com>
4951
4952         * script-sections.cc (class Orphan_section_placement): Define
4953         PLACE_TLS and PLACE_TLS_BSS.
4954         (Orphan_section_placement::Orphan_section_placement): Initialize
4955         new places.
4956         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4957         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4958         (tls_script_test_SOURCES): Define.
4959         (tls_script_test_DEPENDENCIES): Define.
4960         (tls_script_test_LDFLAGS): Define.
4961         (tls_script_test_LDADD): Define.
4962         * testsuite/Makefile.in: Rebuild.
4963
4964 2010-03-22  Doug Kwan  <dougkwan@google.com>
4965
4966         * arm.cc (Arm_relocate_functions::abs8,
4967         Arm_relocate_functions::abs16): Use correct check for overflow
4968         specified in the ARM ELF specs.
4969         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4970         target of a BLX instruction specially.
4971         (Reloc_stub::stub_type_for_reloc): Ditto.
4972         (Relocate::relocate): Use symbolic names instead of numeric relocation
4973         codes to report error.
4974         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4975         workaround.
4976         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4977         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4978         thumb2_blx_out_of_range.stdout
4979         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4980         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4981         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4982         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4983         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4984         thumb2_blx_in_range, thumb2_blx_in_range.o,
4985         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4986         thumb2_blx_out_of_range.o): New rules.
4987         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4988         thumb2_blx_in_range and thumb2_blx_out_of_range.
4989         * testsuite/Makefile.in: Regenerate.
4990         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4991         * testsuite/thumb_blx_in_range.s: New file.
4992         * testsuite/thumb_blx_out_of_range.s: New file.
4993
4994 2010-03-22  Rafael Espindola  <espindola@google.com>
4995
4996         * archive.cc (Should_include): Move to archive.h.
4997         (should_include_member): Make it a member of Archive.
4998         (Lib_group): New.
4999         (Add_lib_group_symbols): New.
5000         * archive.h: Include options.h.
5001         (Archive_member): Moved from Archive.
5002         (Should_include): Moved from archive.cc.
5003         (Lib_group): New.
5004         (Add_lib_group_symbols): New.
5005         * dynobj.cc (do_should_include_member): New.
5006         * dynobj.h (do_should_include_member): New.
5007         * gold.cc (queue_initial_tasks): Update call to queue.
5008         * main.cc (main): Print lib group stats.
5009         * object.cc (do_should_include_member): New.
5010         * object.h: Include archive.h.
5011         (Object::should_include_member): New.
5012         (Object::do_should_include_member): New.
5013         (Sized_relobj::do_should_include_member): New.
5014         * options.cc (General_options::parse_start_lib): New.
5015         (General_options::parse_end_lib): New.
5016         (Input_arguments::add_file): Handle lib groups.
5017         (Input_arguments::start_group): Check we are not in a lib.
5018         (Input_arguments::start_lib): New.
5019         (Input_arguments::end_lib): New.
5020         * options.h (General_options): Add start_lib and end_lib.
5021         (Input_argument::lib_): New.
5022         (Input_argument::lib): New.
5023         (Input_argument::is_lib): New.
5024         (Input_file_lib): New.
5025         (Input_arguments::in_lib_): New.
5026         (Input_arguments::in_lib): New.
5027         (Input_arguments::start_lib): New.
5028         (Input_arguments::end_lib_): New.
5029         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5030         in unused members as preempted.
5031         (Sized_pluginobj::do_should_include_member): New.
5032         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5033         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5034         return the blocker.
5035         (Read_symbols::do_whole_lib_group): New.
5036         (Read_symbols::do_lib_group): New.
5037         (Read_symbols::do_read_symbols): Handle lib groups.
5038         (Read_symbols::get_name): Handle lib groups.
5039         * readsyms.h (Read_symbols): Add an archive member pointer.
5040         (Read_symbols::do_whole_lib_group): New.
5041         (Read_symbols::do_lib_group): New.
5042         (Read_symbols::member_): New.
5043         * script.cc (read_input_script): Update call to queue_soon.
5044
5045 2010-03-19  Doug Kwan  <dougkwan@google.com>
5046
5047         * arm.cc (Stub_table::Stub_table): Initialize new data members
5048         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5049         (Stub_table::add_reloc_stub): Assign stub offset and update
5050         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5051         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5052         New data members.
5053         (Stub_table::update_data_size_and_addralign): Use
5054         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5055         instead of going over all reloc stubs.
5056         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5057         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5058         Stringpool_template::offset_ to size of Stringpool_char.
5059         (Stringpool_template::new_key_offset): Remove code to initialize
5060         Stringpool_template::offset_.
5061         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5062         Stringpool_template::offset_ to zero.
5063
5064 2010-03-15  Doug Kwan  <dougkwan@google.com>
5065
5066         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5067         offset_.
5068         (Stringpool_template::new_key_offset): New method.
5069         (Stringpool_template::add_string): Assign offsets when adding new
5070         strings.
5071         (Stringpool_template::set_string_offsets): Do not set string offsets
5072         when not optimizing.
5073         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5074         member size_.
5075         (Chunked_vector::clear): Clear size_.
5076         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5077         (Chunked_vector::size): Return size_.
5078         (Chunked_vector::push_back): Use size_ to find insert position.
5079         (Chunked_vector::size_): New data member.
5080         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5081         (Stringpool_template::new_key_offset): New method declaration.
5082         (Stringpool_template::offset_): New data member.
5083
5084 2010-03-15   Rafael Espindola  <espindola@google.com>
5085
5086         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5087         Add_symbols' constructor.
5088         * readsyms.h (Add_symbols): Remove the input_group member.
5089
5090 2010-03-10  Ian Lance Taylor  <iant@google.com>
5091
5092         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5093         target to ask whether a reference to a symbol requires a stack
5094         split.
5095         * target.h (Target::is_call_to_non_split): New function.
5096         (Target::do_is_call_to_non_split): Declare virtual function.
5097         * target.cc: Include "symtab.h".
5098         (Target::do_is_call_to_non_split): New function.
5099         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5100
5101 2010-03-10  Cary Coutant  <ccoutant@google.com>
5102
5103         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5104         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5105         (File_read::open[2]): Add whole_file_view_ to list of views.
5106         (File_read::make_view): Remove test of whole_file_view_.
5107         (File_read::find_or_make_view): Create whole_file_view_ if
5108         necessary.
5109         (File_read::clear_views): Replace bool parameter with enum;
5110         adjust all callers.  Don't delete views with permanent data;
5111         do delete cached views and views from archives if
5112         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5113         if clearing the corresponding view.
5114         * fileread.h (File_read::Clear_views_mode): New enum.
5115         (File_read::View::is_permanent_view): New method.
5116         (File_read::clear_views): Replace bool parameter
5117         with enum; adjust all callers.
5118         * options.h (General_options): Change keep_files_mapped option;
5119         add map_whole_files.
5120         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5121         releasing the file.
5122         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5123         the file.
5124
5125 2010-03-10  David S. Miller  <davem@davemloft.net>
5126
5127         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5128
5129 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5130
5131         * icf.cc (get_section_contents): Add '@' marker after processing the
5132         merge reloc.
5133
5134 2010-03-08  Doug Kwan  <dougkwan@google.com>
5135
5136         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5137         due to a conversion warning.
5138         (Arm_relobj::update_output_local_symbol_count): Check for local
5139         symbol with unset output index.
5140
5141 2010-03-05  Ian Lance Taylor  <iant@google.com>
5142
5143         * options.h (class General_options): Add --spare-dynamic-tags.
5144         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5145         --spare-dynamic-tags.
5146
5147 2010-03-05  Ian Lance Taylor  <iant@google.com>
5148
5149         * incremental.cc: Include "libiberty.h".
5150
5151 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5152
5153         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5154         function, is_info_ member.
5155         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5156         (Versions::Versions): Update caller.
5157         (Versions::define_base_version): Likewise.
5158         (Versions::add_def): Likewise.
5159
5160 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5161
5162         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5163         (Scan::possible_function_pointer_reloc): New function.
5164         (Scan::local_reloc_may_be_function_pointer): Change to call
5165         possible_function_pointer_reloc.
5166         (Scan::global_reloc_may_be_function_pointer): Ditto.
5167         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5168         relocations in ".data.rel.ro._ZTV" section.
5169         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5170         * testsuite/icf_safe_so_test.cc: Ditto.
5171         * testsuite/icf_safe_test.cc: Ditto.
5172         * testsuite/icf_safe_test.sh: Ditto.
5173
5174 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5175             Ian Lance Taylor  <iant@google.com>
5176
5177         * target-reloc.h (relocate_section): Check the symbol table index
5178         for -1U before setting the local symbol index.
5179         (scan_relocatable_relocs): If copying the relocation, record that
5180         the local symbol is required.
5181         * object.h (Symbol_value::is_output_symtab_index_set): New
5182         function.
5183         (Symbol_value::may_be_discarded_from_output_symtab): New
5184         function.
5185         (Symbol_value::has_output_symtab_entry): New function.
5186         (Symbol_value::needs_output_symtab_entry): Remove.
5187         (Symbol_value::output_symtab_index): Make sure the symbol index is
5188         set.
5189         (Symbol_value::set_output_symtab_index): Make sure the symbol
5190         index is not set.  Make sure the new index is valid.
5191         (Symbol_value::set_must_have_output_symtab_entry): New function.
5192         (Symbol_value::has_output_dynsym_entry): New function.
5193         (Symbol_value::set_output_dynsym_index): Make sure the new index
5194         is valid.
5195         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5196         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5197         local symbol if permitted.
5198         (Sized_relobj::do_finalize_local_symbols): Call
5199         is_output_symtab_index_set rather than needs_output_symtab_entry.
5200         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5201         rather than needs_output_symtab_entry.  Call
5202         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5203         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5204         is_output_symtab_index_set rather than needs_output_symtab_entry.
5205         * testsuite/discard_locals_relocatable_test.c: New file.
5206         * testsuite/discard_locals_test.sh: Test -r.
5207         * testsuite/Makefile.am (check_DATA): Add
5208         discard_locals_relocatable_test1.syms,
5209         discard_local_relocatable_test2.syms.
5210         (MOSTLYCLEANFILES): Likewise.  Also add
5211         discard_locals_relocatable_test1.lout and
5212         discard_locals_relocatable_test2.out.
5213         (discard_locals_relocatable_test1.syms): New target.
5214         (discard_locals_relocatable_test.o): New target.
5215         (discard_locals_relocatable_test1.out): New target.
5216         (discard_locals_relocatable_test2.syms): New target.
5217         (discard_locals_relocatable_test2.out): New target.
5218         (various): Add missing ../ld-new dependencies.
5219         * testsuite/Makefile.in: Rebuild.
5220
5221 2010-03-03  Nick Clifton  <nickc@redhat.com>
5222
5223         * po/fi.po: New Finnish translation.
5224
5225 2010-03-01  Doug Kwan  <dougkwan@google.com>
5226
5227         * layout.cc (Layout::Layout): Force section types of .init_array*,
5228         .preinit_array* and .fini_array* sections.
5229         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5230         Fix check of return value of std::string::find.().
5231         (Output_section::Input_section_sort_compare::operator()): Remove
5232         comment about .init_array.
5233         (Output_section::Input_section_sort_init_fini_compare::operator()):
5234         New method.
5235         (Output_section::sort_attached_input_sections): Handle .init_array
5236         and .fini_array specially.
5237         * output.h (Output_section::Inut_section_sort_compare): Update
5238         comment.
5239         (Output_section::Input_section_sort_init_fini_compare): New struct.
5240
5241 2010-02-26  Doug Kwan  <dougkwan@google.com>
5242
5243         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5244         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5245         * testsuite/debug_msg.sh: Avoid matching source line number for
5246         use of global variable undef_int.
5247
5248 2010-02-26  Doug Kwan  <dougkwan@google.com>
5249
5250         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5251         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5252         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5253         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5254         * options.cc (General_options::General_options): Initialize member
5255         fix_v4bx_.
5256         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5257         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5258         and rm_no_fix_v4bx.stdout
5259         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5260         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5261         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5262         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5263         and arm_no_fix_v4bx.
5264         * Makefile.in: Regenerate.
5265         * testsuite/arm_fix_v4bx.s: New file.
5266         * testsuite/arm_fix_v4bx.sh: Ditto.
5267
5268 2010-02-24  Doug Kwan  <dougkwan@google.com>
5269
5270         * arm.cc (Target_arm::got_section): Make the .got section the first
5271         non RELRO section in the data segment.
5272         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5273         suffixes of section names.
5274
5275 2010-02-24  Doug Kwan  <dougkwan@google.com>
5276
5277         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5278         flags and attributes merging if an input file is a binary file.
5279         * fileread.cc (Input_file::open): Record format of original file.
5280         * fileread.h (Input_file::Format): New enum type.
5281         (Input_file::Input_file): Initialize data member format_.
5282         (Input_file::format): New method definition.
5283         (Input_file::format_):: New data member.
5284
5285 2010-02-24  Doug Kwan  <dougkwan@google.com>
5286
5287         * arm.cc (Arm_output_data_got): New class.
5288         (ARM_TCB_SIZE): New constant
5289         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5290         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5291         If user uses a script with a SECTIONS clause, issue only a warning
5292         for a misplaced EXIDX input section.  Otherwise, issue an error.
5293         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5294         garbage collection.
5295         (Target_arm::got_mode_index_entry): Handle static linking.
5296         (Target_arm::Scan::local): Ditto.
5297         (Target_arm::Scan::global): Ditto.
5298         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5299         all incorrectly implemented relocations.
5300         (Target_arm::fix_exidx_coverage): Pass layout to
5301         Arm_output_section::fix_exidx_coverage.
5302         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5303         from ".ARM.exidx." and ".ARM.extab.".
5304
5305 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5306
5307         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5308         section if it does not already exist.
5309         * attributes.cc (Attributes_section_data::Attributes_section_data):
5310         Don't crash if size is zero.
5311
5312 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5313             Ian Lance Taylor  <iant@google.com>
5314
5315         * gold.cc (queue_middle_tasks): If no input files were opened,
5316         exit.
5317         * workqueue.h (Task_function::Task_function): Assert that there is
5318         a blocker.
5319
5320 2010-02-22  Doug Kwan  <dougkwan@google.com>
5321
5322         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5323         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5324         types to avoid warnings due to different uint64_t implementations
5325         on different hosts.
5326
5327 2010-02-21  Doug Kwan  <dougkwan@google.com>
5328
5329         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5330         handling of the maximum backward branch offset.
5331         (Arm_relocate_functions::thumb_branch_common): Ditto.
5332         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5333         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5334         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5335         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5336         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5337         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5338         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5339         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5340         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5341         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5342         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5343         thumb2_bl_out_of_range.o): New rules.
5344         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5345         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5346         thumb2_bl_out_of_range
5347         * testsuite/Makefile.in: Regenerate.
5348         * testsuite/arm_bl_in_range.s: New file.
5349         * testsuite/arm_bl_out_of_range.s: Ditto.
5350         * testsuite/arm_branch_in_range.sh: Ditto.
5351         * testsuite/arm_branch_range.t: Ditto.
5352         * testsuite/thumb2_branch_range.t: Ditto.
5353         * testsuite/thumb_bl_in_range.s: Ditto.
5354         * testsuite/thumb_bl_out_of_range.s: Ditto.
5355         * testsuite/thumb_branch_range.t: Ditto.
5356
5357 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5358
5359         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5360         Add reloc offset information.
5361         * icf.cc (get_section_contents): Change iterators to point to the new
5362         vectors. Add reloc offset information to the contents.
5363         * icf.h (Icf::Sections_reachable_info): New typedef.
5364         (Icf::Sections_reachable_list): New typedef.
5365         (Icf::Offset_info): New typedef.
5366         (Icf::Reloc_info): New struct typedef.
5367         (Icf::Reloc_info_list): New typedef.
5368         (Icf::symbol_reloc_list): Delete method.
5369         (Icf::addend_reloc_list): Delete method.
5370         (Icf::section_reloc_list): Delete method.
5371         (Icf::reloc_info_list): New method.
5372         (Icf::reloc_info_list_): New member.
5373
5374 2010-02-19  Doug Kwan  <dougkwan@google.com>
5375
5376         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5377         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5378         * arm.cc (Arm_relocation_functions): New forward declaration.
5379         (Target_arm::Target_arm): Initialize new data members
5380         got_mod_index_offset_ and tls_base_symbol_defined_.
5381         (Target_arm::Relocate::relocate_tls): New method.
5382         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5383          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5384         New methods.
5385         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5386         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5387         (Target_arm::got_mod_index_offset_,
5388         Target_arm::tls_base_symbol_defined_): New data members.
5389         (Target_arm::Scan::local, Target::Scan::global,
5390         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5391         relocations.
5392
5393 2010-02-18  Doug Kwan  <dougkwan@google.com>
5394
5395         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5396         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5397         text section as a parameter becuase some broken tools may not set
5398         the link in section header.
5399         (Target_arm::has_got_section): New method.
5400         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5401         without any mapping symbol as data only.  Remove warning.
5402         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5403         link in its section header, try to discover the link by inspecting the
5404         REL31 relocation at the beginning of the section.
5405         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5406         in error message.
5407         (Target_arm::Scan::global): Treat any reference to the symbol
5408         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5409
5410 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5411
5412         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5413         (Scan::global_reloc_may_be_function_pointer): New function.
5414         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5415         (Scan::global_reloc_may_be_function_pointer): New function.
5416         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5417         (Scan::global_reloc_may_be_function_pointer): New function.
5418         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5419         (Scan::global_reloc_may_be_function_pointer): New function.
5420         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5421         (Scan::global_reloc_may_be_function_pointer): New function.
5422         (Scan::possible_function_pointer_reloc): New function.
5423         (Target_x86_64::can_check_for_function_pointers): New function.
5424         * gc.h (gc_process_relocs): Scan relocation types to determine if
5425         function pointers were taken for targets that support it.
5426         * icf.cc (Icf::find_identical_sections): Include functions for
5427         folding in safe ICF whose pointer is not taken.
5428         * icf.h (Secn_fptr_taken_set): New typedef.
5429         (fptr_section_id_): New member.
5430         (section_has_function_pointers): New function.
5431         (set_section_has_function_pointers): New function.
5432         (check_section_for_function_pointers): New function.
5433         * options.h: Fix comment for safe ICF option.
5434         * target.h (can_check_for_function_pointers): New function.
5435         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5436         Modify icf_safe_test for X86-64.
5437         * testsuite/Makefile.in: Regenerate.
5438         * testsuite/icf_safe_so_test.cc: New file.
5439         * testsuite/icf_safe_so_test.sh: New file.
5440         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5441         (main): Change to take pointer to function kept_func_3.
5442         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5443         folding is done correctly for X86-64.
5444
5445 2010-02-12  David S. Miller  <davem@davemloft.net>
5446
5447         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5448         is_symbolless parameter.
5449         (Output_reloc<SHT_REL>::is_symbolless): New.
5450         (Output_reloc<SHT_REL>::is_symbolless_): New.
5451         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5452         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5453         (Output_reloc<SHT_RELA>::is_symbolless): New.
5454         (Output_data_reloc::add_global): Handle is_symbolless.
5455         (Output_data_reloc::add_global_relative): Likewise.
5456         (Output_data_reloc::add_local): Likewise.
5457         (Output_data_reloc::add_local_relative): Likewise.
5458         (Output_data_reloc::add_symbolless_global_addend): New.
5459         (Output_data_reloc::add_symbolless_local_addend): New.
5460         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5461         is_symbolless.
5462         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5463         instead of ->is_relative_
5464         (Output_reloc::write): Likewise.
5465         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5466         (Output_reloc::write_rel): Simplify.
5467
5468         * sparc.cc (Target_sparc::Scan::local): Use
5469         ->add_symbolless_local_addend as needed.
5470         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5471         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5472         based upon relocation offset.
5473
5474 2010-02-11  Doug Kwan  <dougkwan@google.com>
5475
5476         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5477         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5478         beginning of function.
5479         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5480         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5481         parameter is_32bit in calls to should_apply_static_reloc.
5482         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5483         (check_DATA): Add arm_abs_global.stdout.
5484         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5485         arm_abs_global.stdout): New rules.
5486         (MOSTLLYCLEANFILES): Add arm_abs_global
5487         * Makefile.in: Regenerate.
5488         * testsuite/arm_abs_global.s: New file.
5489         * testsuite/arm_abs_global.sh: Ditto.
5490         * testsuite/arm_abs_lib.s: Ditto.
5491
5492 2010-02-11  Ian Lance Taylor  <iant@google.com>
5493
5494         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5495         Read_relocs task.
5496         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5497         Allocate_commons_task first.
5498         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5499         task, rather than symtab_lock_.
5500         (Gc_process_relocs::~Gc_process_relocs): New function.
5501         (Gc_process_relocs::is_runnable): Check this_blocker_.
5502         (Gc_process_relocs::locks): Use next_blocker_ rather than
5503         blocker_.
5504         (Scan_relocs::~Scan_relocs): New function.
5505         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5506         symtab_lock_.
5507         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5508         next_blocker_.
5509         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5510         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5511         constructor accordingly.
5512         (class Gc_process_relocs): Likewise.
5513         (class Scan_relocs): Likewise.
5514         * common.h (class Allocate_commons_task): Remove symtab_lock_
5515         field, and corresponding constructor parameter.
5516         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5517         symtab_lock_.
5518         (Allocate_commons_task::locks): Likewise.
5519
5520 2010-02-11  Ian Lance Taylor  <iant@google.com>
5521
5522         * gold-threads.h (class Once): Define.
5523         (class Initialize_lock): Rewrite as child of Once.
5524         * gold-threads.cc (class Once_initialize): Define.
5525         (once_pointer_control): New static variable.
5526         (once_pointer, once_arg): New static variables.
5527         (c_run_once): New static function.
5528         (Once::Once, Once::run_once, Once::internal_run): New functions.
5529         (class Initialize_lock_once): Remove.
5530         (initialize_lock_control): Remove.
5531         (initialize_lock_pointer): Remove.
5532         (initialize_lock_once): Remove.
5533         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5534         (Initialize_lock::initialize): Rewrite.
5535         (Initialize_lock::do_run_once): New function.
5536         * archive.cc (Archive::interpret_header): Only clear name if it is
5537         not already empty.
5538         * fileread.cc: Include "gold-threads.h"
5539         (file_counts_lock): New static variable.
5540         (file_counts_initialize_lock): Likewise.
5541         (File_read::release): Only increment counts when using --stats.
5542         Use a lock around the increment.
5543         * parameters.cc (class Set_parameters_target_once): Define.
5544         (set_parameters_target_once): New static variable.
5545         (Parameters::Parameters): Move here from parameters.h.
5546         (Parameters::set_target): Rewrite.
5547         (Parameters::set_target_once): New function.
5548         (Parameters::clear_target): Move here and rewrite.
5549         * parameters.h (class Parameters): Update declarations.  Add
5550         set_parameters_target_once_ field.
5551         (Parameters::Parameters): Move to parameters.cc.
5552         (Parameters::clear_target): Likewise.
5553         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5554         task.
5555         (Start_group::~Start_group): New function.
5556         (Start_group::is_runnable): New function.
5557         (Start_group::locks, Start_group::run): New functions.
5558         (Finish_group::run): Change saw_undefined to size_t.
5559         * readsyms.h (class Start_group): Define.
5560         (class Finish_group): Change saw_undefined_ field to size_t.
5561         (Finish_group::Finish_group): Remove saw_undefined and
5562         this_blocker parameters.  Change all callers.
5563         (Finish_group::set_saw_undefined): New function.
5564         (Finish_group::set_blocker): New function.
5565         * symtab.h (class Symbol_table): Change saw_undefined to return
5566         size_t.  Change saw_undefined_ field to size_t.
5567         * target-select.cc (Set_target_once::do_run_once): New function.
5568         (Target_selector::Target_selector): Initialize set_target_once_
5569         field.  Don't initialize lock_ and initialize_lock_ fields.
5570         (Target_selector::instantiate_target): Rewrite.
5571         (Target_selector::set_target): New function.
5572         * target-select.h (class Set_target_once): Define.
5573         (class Target_selector): Update declarations.  Make
5574         Set_target_once a friend.  Remove lock_ and initialize_lock_
5575         fields.  Add set_target_once_ field.
5576
5577 2010-02-10  Ian Lance Taylor  <iant@google.com>
5578
5579         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5580         queueing any tasks.
5581         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5582         (queue_middle_tasks): Add all blockers before queueing any tasks.
5583         (queue_final_tasks): Likewise.
5584         * token.h (Task_token::add_blockers): New function.
5585         * object.h (Input_objects::number_of_relobjs): New function.
5586
5587 2010-02-10  Ian Lance Taylor  <iant@google.com>
5588
5589         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5590         shared, not if not position independent.
5591         * x86_64.cc (Relocate::relocate_tls): Likewise.
5592         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5593         (tls_pie_pic_test): New target.
5594         * testsuite/Makefile.in: Rebuild.
5595
5596         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5597         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5598         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5599         * testsuite/Makefile.in: Rebuild.
5600
5601 2010-02-09  David S. Miller  <davem@davemloft.net>
5602
5603         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5604         R_SPARC_RELATIVE using ->add_local_relative().
5605         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5606
5607         * output.h (Output_data_dynamic::add_section_size): New method
5608         that takes two Output_data objects.
5609         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5610         entry param.  Handle it in initializers.
5611         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5612         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5613         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5614         arg.
5615         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5616         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5617         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5618         for dynrel_includes_plt.
5619         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5620         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5621         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5622         before .rela.plt
5623         (Target_sparc::do_finalize_sections): Update to pass true for
5624         dynrel_includes_plt.
5625         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5626         output before .rela.plt
5627         (Target_powerpc::do_finalize_sections): Update to pass true for
5628         dynrel_includes_plt when 32-bit.
5629
5630 2010-02-08  Doug Kwan  <dougkwan@google.com>
5631
5632         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5633         method.
5634         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5635         Arm_relobj::scan_section_for_cortex_a8_stubs,
5636         Arm_relobj::do_relocation_section): Instead of calling
5637         Output_section::output_address, use faster
5638         Arm_relobj::simple_input_section_output_address.
5639
5640 2010-02-08  David S. Miller  <davem@davemloft.net>
5641
5642         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5643         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5644         relocation helper function.
5645
5646         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5647         just like R_SPARC_GOT{10,13,22}.
5648         (Target_sparc::Scan::local): Likewise.
5649         (Target_sparc::Relocate:relocate): Likewise.
5650
5651 2010-02-06  Ian Lance Taylor  <iant@google.com>
5652
5653         * configure.ac: Rewrite targetobjs duplicate removal code to use
5654         only shell constructs.
5655         * configure: Rebuild.
5656
5657 2010-02-05  Doug Kwan  <dougkwan@google.com>
5658
5659         PR 11247
5660         * arm.cc (Arm_relobj::section_is_scannable): New method.
5661         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5662         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5663
5664 2010-02-04  Doug Kwan  <dougkwan@google.com>
5665
5666         PR 11247
5667         * arm-reloc-property.cc (cstdio): Include.
5668         * configure.ac (targetobjs): Remove duplicates.
5669         * configure: Regenerate.
5670         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5671         big and little endian version for a given address size.
5672
5673 2010-02-03  Doug Kwan  <dougkwan@google.com>
5674
5675         * arm-reloc-property.cc
5676         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5677         definition.
5678         * arm-reloc-property.h
5679         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5680         New method definition.
5681         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5682         declaration.
5683         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5684         overflow to N.
5685         (GOT_PREL): Change implemented to Y.
5686         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5687         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5688         (Arm_relocate_functions::movw_abs_nc): Remove method.
5689         (Arm_relocate_functions::movt_abs): Ditto.
5690         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5691         (Arm_relocate_functions::thm_movt_abs): Ditto.
5692         (Arm_relocate_functions::movw_rel_nc): Ditto.
5693         (Arm_relocate_functions::movw_rel): Ditto.
5694         (Arm_relocate_functions::movt_rel): Ditto.
5695         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5696         (Arm_relocate_functions:thm_movw_rel): Ditto.
5697         (Arm_relocate_functions:thm_movt_rel): Ditto.
5698         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5699         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5700         New method definitions.
5701         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5702         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5703         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5704         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5705         (Target_arm::Relocate::relocate): Check for non-static or
5706         unimplemented relocation code and exit early.  Change calls to
5707         Target_arm::reloc_uses_thumb_bit and
5708         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5709         instead.  Refactor code to handle similar relocations to increase
5710         code sharing.  Remove check for unsupported relocation code in switch
5711         statement.
5712         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5713         relocation property table to find out size.  Change error message to
5714         print out the name of a relocation code instead of the numeric value.
5715         (Target_arm::scan_reloc_for_stub): Use relocation property table
5716         instead of calling Target_arm::reloc_uses_thumb_bit().
5717
5718 2010-02-02  Doug Kwan  <dougkwan@google.com>
5719
5720         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5721         types of relaxed input section.
5722
5723 2010-02-02  Doug Kwan  <dougkwan@google.com>
5724
5725         * Makefile.am (HFILES): Add arm-reloc-property.h.
5726         (DEFFILES): New.
5727         (TARGETSOURCES): Add arm-reloc-property.cc
5728         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5729         (libgold_a_SOURCES): $(DEFFILES)
5730         * Makefile.in: Regenerate.
5731         * arm-reloc-property.cc: New file.
5732         * arm-reloc-property.h: New file.
5733         * arm-reloc.def: New file.
5734         * arm.cc: Update comments.
5735         (arm-reloc-property.h): New included header.
5736         (arm_reloc_property_table): New global variable.
5737         (Target_arm::do_select_as_default_target): New method definition.
5738         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5739         arm-reloc-property to targ_extra_obj.
5740         * parameters.cc (set_parameters_target): Call
5741         Target::select_as_default_target().
5742         * target.h (Target::select_as_default_target): New method definition.
5743         (Target::do_select_as_default_target): Same.
5744
5745 2010-02-01  Doug Kwan  <dougkwan@google.com>
5746
5747         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5748         first_output_text_section_.
5749         (Arm_exidx_fixup::first_output_text_section): New method definition.
5750         (Arm_exidx_fixup::first_output_text_section_): New data member.
5751         (Arm_exidx_fixup::process_exidx_section): Record the first text
5752         output section seen.
5753         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5754         and entsize in output section header.
5755
5756 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5757
5758         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5759         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5760         (Arm_relocate_functions::thm_alu11): New Method.
5761         (Arm_relocate_functions::thm_pc8): New Method.
5762         (Arm_relocate_functions::thm_pc12): New Method.
5763         (Target_arm::Scan::local): Handle the relocations.
5764         (Target_arm::Scan::global): Likewise.
5765         (Target_arm::Relocate::relocate): Likewise.
5766         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5767
5768 2010-01-29  Doug Kwan  <dougkwan@google.com>
5769
5770         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5771         of relocation types as ld.
5772
5773 2010-01-29  Doug Kwan  <dougkwan@google.com>
5774
5775         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5776         to public.
5777         (Arm_relocate_functions::thumb_branch_common): Ditto.
5778         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5779         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5780         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5781         Arm_relocate_functions::jump24): Remove.
5782         (Target_arm::Relocate::relocate): Adjust code to call
5783         Arm_relocation_functions::arm_branch_common and
5784         Arm_relocation_functions::thumb_branch_common instead of their removed
5785         wrappers.  Merge switch-cases together to reduce source code size.
5786
5787 2010-01-29  Doug Kwan  <dougkwan@google.com>
5788
5789         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5790         output_local_symbol_count_needs_update_.
5791         (Arm_relobj::output_local_symbol_count_needs_update,
5792          Arm_relobj::set_output_local_symbol_count_needs_update,
5793          Arm_relobj::update_output_local_symbol_count): New methods.
5794         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5795         member.
5796         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5797         of pointed function as in a R_ARM_PREL31 relocation.
5798         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5799         for output local symbol count updating.
5800         (Target_arm::do_relax): Update output local symbol counts in objects
5801         if necessary.
5802         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5803
5804 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5805
5806         * arm.cc: Added support for the ARM relocations:
5807         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5808         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5809         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5810         movw_prel_nc).
5811         (Arm_relocate_functions::movw_rel): New method.
5812         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5813         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5814         thm_movw_prel_nc).
5815         (Arm_relocate_functions::thm_movw_rel): New method.
5816         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5817         thm_movt_prel).
5818         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5819         relocations.
5820         (Target_arm::Scan::global): Likewise.
5821         (Target_arm::Relocate::relocate): Likewise.
5822         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5823         Likewise.
5824
5825 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5826
5827         * arm.cc: Added support for ARM group relocations.
5828         (Target_arm::reloc_needs_sym_origin): New method.
5829         (Arm_relocate_functions::calc_grp_kn): New method.
5830         (Arm_relocate_functions::calc_grp_residual): New method.
5831         (Arm_relocate_functions::calc_grp_gn): New method.
5832         (Arm_relocate_functions::arm_grp_alu): New Method.
5833         (Arm_relocate_functions::arm_grp_ldr): New Method.
5834         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5835         (Arm_relocate_functions::arm_grp_ldc): New Method.
5836         (Target_arm::Scan::local): Handle the ARM group relocations.
5837         (Target_arm::Scan::global): Likewise.
5838         (Target_arm::Relocate::relocate): Likewise.
5839         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5840         Likewise.
5841
5842 2010-01-26  Doug Kwan  <dougkwan@google.com>
5843
5844         * arm.cc (set): Include.
5845         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5846         pointer type.
5847         (Arm_output_section::Text_section_list): New type.
5848         (Arm_output_section::append_text_sections_to_list): New method.
5849         (Arm_output_section::fix_exidx_coverage): Ditto.
5850         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5851         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5852         Relobj::set_section_offset() instead of
5853         Sized_relobj::invalidate_section_offset().
5854         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5855         parameter for section headers. Ignore relocation sections for
5856         unallocated sections and EXIDX sections.
5857         (Target_arm::fix_exidx_coverage): New method.
5858         (Target_arm::output_section_address_less_than): New type.
5859         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5860         linked text section instead of the EXIDX section.
5861         (Arm_output_section::create_stub_group): Add an assertion to check
5862         that this is not an EXIDX output section.
5863         (Arm_output_section::append_text_sections_to_list): New method.
5864         (Arm_output_section::fix_exidx_coverage): Ditto.
5865         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5866         Arm_relobj::section_needs_reloc_stub_scanning.
5867         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5868         first pass.
5869         (Target_arm::fix_exidx_coverage): New method.
5870         * object.h (Relobj::set_output_section): New method.
5871         (Sized_relobj::invalidate_section_offset): Remove method.
5872         (Sized_relobj::do_invalidate_section_offset): Remove method.
5873         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5874
5875 2010-01-25  Doug Kwan  <dougkwan@google.com>
5876
5877         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5878         Fix warning due to signed and unsigned comparison on a 32-bit host.
5879
5880 2010-01-22  Doug Kwan  <dougkwan@google.com>
5881
5882         * arm.cc (Target_arm::do_relax): Record an output section for section
5883         offset adjustment it contains any stub table that has changed.
5884         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5885         offsets in an output section if necessary.
5886         * output.cc (Output_section::Output_section): Initialize
5887         section_offsets_need_adjustments_.
5888         (Output_section::add_input_section_for_script): Renamed to
5889         Output_section::add_simple_input_section.
5890         (Output_section::save_states): Add a comment.
5891         (Output_section::discard_states): New method defintion.
5892         (Output_section::adjust_section_offsets): Same.
5893         * output.h (Output_section::add_input_section_for_script): Renamed to
5894         Output_section::add_simple_input_section.
5895         (Output_section::discard_states): New method declaration.
5896         (Output_section::adjust_section_offsets): Same.
5897         (Output_section::section_offsets_need_adjustment,
5898         Output_section::set_section_offsets_need_adjustment): New method
5899         definitions.
5900         (Output_section::section_offsets_need_adjustment_): New data member.
5901         * script-sections.cc
5902         (Output_section_element_input::set_section_address): Adjust code for
5903         renaming of Output_section::add_input_section_for_script.
5904         (Orphan_output_section::set_section_address): Same.
5905
5906 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5907
5908         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5909         Fix_v4bx enum values .
5910         * gold/options.h (General_options): New option definitions.
5911         (General_options::fix_v4bx): New method.
5912         (General_options::Fix_v4bx): New enum.
5913         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5914         (General_options::parse_fix_v4bx_interworking): New method.
5915
5916 2010-01-22  Doug Kwan  <dougkwan@google.com>
5917
5918         * arm.cc (Arm_exidx_fixup): New class.
5919
5920 2010-01-21  Doug Kwan  <dougkwan@google.com>
5921
5922         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5923         classes.
5924         (Arm_exidx_section_offset_map): New type.
5925
5926 2010-01-21  Doug Kwan  <dougkwan@google.com>
5927
5928         * arm.cc (Arm_exidx_input_section): New class.
5929         (Arm_relobj::exidx_input_section_by_link,
5930         Arm_relobj::exidx_input_section_by_shndx,
5931         Arm_relobj::make_exidx_input_section): New methods.
5932         (read_arm_attributes_section): Remove.
5933         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5934         information about them.
5935         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5936         to here.
5937
5938 2010-01-20  Doug Kwan  <dougkwan@google.com>
5939
5940         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5941         Input_section_specifier to Section_id.
5942         (Target_arm::new_arm_input_section: Adjust code for change of key
5943         type.
5944         (Target_arm::find_arm_input_section): Ditto.
5945         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5946         (Section_id): Remove.
5947         (Garbage_collection::Section_id_hash): Remove.
5948         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5949         (Section_id): Remove.
5950         (Icf::Section_id_hash): Remove.
5951         * object.h (Section_id, Const_section_id, Section_id_hash,
5952         Const_section_id_hash): New type definitions.
5953         * output.cc (Output_section::add_relaxed_input_section): Change to
5954         use Const_section_id instead of Input_section_specifier as key type.
5955         (Output_section::add_merge_input_section): Ditto.
5956         (Output_section::build_relaxation_map): Change to use Section_id
5957         instead of Input_section_specifier as key type.
5958         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5959         Ditto.
5960         (Output_section::convert_input_sections_to_relaxed_sections): Change
5961         to use Const_section_id instead of Input_section_specifier as key type.
5962         (Output_section::find_merge_section): Ditto.
5963         (Output_section::find_relaxed_input_section): Ditto.
5964         * output.h (Input_section_specifier): Remove class.
5965         (Output_section::Output_section_data_by_input_section_map): Change
5966         key type to Const_section_id.
5967         (Output_section::Output_relaxed_input_section_by_input_section_map):
5968         Ditto.
5969         (Output_section::Relaxation_map): Change key type to Section_id.
5970
5971 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5972
5973         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5974         (class Arm_v4bx_stub): New class.
5975         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5976         (Stub_factory::make_arm_v4bx_stub): New method.
5977         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5978         (Stub_table::empty): Handle v4bx stubs.
5979         (Stub_table::add_arm_v4bx_stub): New method.
5980         (Stub_table::find_arm_v4bx_stub): New method.
5981         (Arm_relocate_functions::v4bx): New method.
5982         (Target_arm::fix_v4bx): New method.
5983         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5984         (Stub_table::relocate_stubs): Likewise.
5985         (Stub_table::do_write): Likewise.
5986         (Stub_table::update_data_size_and_addralign): Likewise.
5987         (Stub_table::finalize_stubs):  Likewise.
5988         (Target_arm::Scan::local): Likewise.
5989         (Target_arm::Scan::global): Likewise.
5990         (Target_arm::do_finalize_sections): Likewise.
5991         (Target_arm::Relocate::relocate): Likewise.
5992         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5993         Likewise.
5994         (Target_arm::scan_reloc_for_stub): Likewise.
5995         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5996
5997 2010-01-19  Ian Lance Taylor  <iant@google.com>
5998
5999         * output.cc (Output_section_headers::do_sized_write): Write large
6000         segment count to sh_info field.
6001         (Output_file_header::do_sized_write): For large segment count,
6002         write PN_XNUM to e_phnum field.
6003
6004 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6005
6006         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6007         (Arm_relocate_functions::thm_jump8): New function.
6008         (Arm_relocate_functions::thm_jump11): New function.
6009         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6010         R_ARM_THM_JUMP11.
6011         (Target_arm::Scan::global): Likewise.
6012         (Target_arm::Relocate::relocate): Likewise.
6013         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6014         Likewise.
6015
6016 2010-01-14  Doug Kwan  <dougkwan@google.com>
6017
6018         * arm.cc (map, utility): Include headers.
6019         (Target_arm::apply_cortex_a8_workaround): New method.
6020         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6021         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6022         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6023         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6024         the --[no-]fix-cortex-a8 command line options.
6025         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6026         (Target_arm::relocate_stub): Use addend in instruction template.
6027         * options.h (DEFINE_bool): Set the user-set flag.
6028         (General_options): Add --[no-]-fix-cortex options.
6029         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6030         : Update fast look-up map after conversion.
6031
6032 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6033
6034         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6035         in the first pass of do_layout.
6036
6037 2010-01-13  Doug Kwan  <dougkwan@google.com>
6038
6039         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6040         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6041         apparent compiler problem of not folding static constant integral
6042         data members of elfcpp::Elf_sizes<32>.
6043
6044 2010-01-13  Doug Kwan  <dougkwan@google.com>
6045
6046         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6047         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6048         Arm_relobj::scan_section_for_cortex_a8_erratum,
6049         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6050         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6051         sections to scan for relocation stubs into a new method
6052         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6053         relocation and Cortex-A8 stub scanning.
6054         (Target_arm::do_relax): Force stubs to be after stubbed sections
6055         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6056         the beginning of a new relaxation pass.  Update a comment.
6057         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6058
6059 2010-01-12  Ian Lance Taylor  <iant@google.com>
6060
6061         * target-reloc.h (visibility_error): New inline function.
6062         (relocate_section): Call visibility_error.
6063         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6064         (MOSTLYCLEANFILES): Likewise.
6065         (protected_4_pic.o, protected_3.err): New targets.
6066         * testsuite/protected_4.cc: New file.
6067
6068 2010-01-12  Doug Kwan  <dougkwan@google.com>
6069
6070         * arm.cc (Cortex_a8_reloc): New class.
6071         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6072         and cortex_a8_relocs_info_.
6073         (Target_arm::fix_cortex_a8): New method definition.
6074         (Target_arm::Cortex_a8_relocs_info): New type.
6075         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6076         New data member declarations.
6077         (Target_arm::scan_reloc_for_stub): Record information about
6078         relocations for THUMB branches that might be exempted from the
6079         Cortex-A8 workaround.
6080         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6081         at the beginning of a relaxation pass.
6082
6083 2010-01-12  Doug Kwan  <dougkwan@google.com>
6084
6085         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6086         (Arm_relobj::Mapping_symbol_position,
6087          Arm_reloj::Mapping_symbol_position_less,
6088          Arm_relobj::Mapping_symbols_info): New types.
6089         (Target_arm::is_mapping_symbol_name): New method definition.
6090         (Arm_relobj::do_count_local_symbols): Save information about mapping
6091         symbols.
6092
6093 2010-01-11  Doug Kwan  <dougkwan@google.com>
6094
6095         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6096         Arm_relocate_functions::thumb32_branch_upper,
6097         Arm_relocate_functions::thumb32_branch_lower,
6098         Arm_relocate_functions::thumb32_cond_branch_offset,
6099         Arm_relocate_functions::thumb32_cond_branch_upper,
6100         Arm_relocate_functions::thumb32_cond_branch_lower,
6101         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6102         branch offset encoding.
6103         (Arm_relocate_functions::thumb_branch_common): Use new branch
6104         offset encoding methods to avoid code duplication.
6105         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6106         (Stub_addend_reader::operator()): Use new branch encoding method
6107         to avoid code duplication.
6108
6109 2010-01-11  Doug Kwan  <dougkwan@google.com>
6110
6111         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6112         (Target_arm::do_finalize_sections): Define special EXIDX section
6113         symbols only if referenced.
6114         * gc.h (Garbage_collection::add_reference): New method.
6115         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6116         code duplication.
6117
6118 2010-01-11  Ian Lance Taylor  <iant@google.com>
6119
6120         * script.cc (Version_script_info::build_expression_list_lookup):
6121         Change complaing about duplicate wildcard match from error to
6122         warning.
6123
6124         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6125         of 2009-12-30.
6126         (Version_script_info::Version_script_info): Initialize globs_,
6127         default_version_, default_is_global_, and exact_.  Don't
6128         initialize globals_ or locals_.
6129         (Version_script_info::build_lookup_tables): Build local symbols
6130         first.
6131         (Version_script_info::unquote): New function.
6132         (Version_script_info::add_exact_match): New function.
6133         (Version_script_info::build_expression_list_lookup): Remove lookup
6134         parameter.  Add is_global parameter.  Change all callers.  Handle
6135         wildcard pattern specially.  Unquote pattern.  Call
6136         add_exact_match.
6137         (Version_script_info::get_name_to_match): New function.
6138         (Version_script_info::get_symbol_version): New function.
6139         (Version_script_info::get_symbol_version_helper): Remove.
6140         (Version_script_info::check_unmatched_names): Call unquote.
6141         * script.h (class Version_script_info): Change get_symbol_version
6142         to be non-inline and add is_global parameter; change all callers.
6143         Rewrite symbol_is_local.  Update declarations.  Define struct
6144         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6145         Remove globals_ and locals_ members.  Add exact_, globs_,
6146         default_version_, is_global_.
6147         (Version_script_info::Glob): Remove pattern, add expression and
6148         is_global.  Update constructor.  Change all callers.
6149         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6150         default version.
6151         (Versions::symbol_section_contents): If a symbol is undefined, or
6152         defined in a dynamic object, set the version index to
6153         VER_NDX_LOCAL.
6154         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6155         symbol_is_local.
6156         (Symbol_table::add_from_pluginobj): Likewise.
6157         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6158
6159 2010-01-11  Doug Kwan  <dougkwan@google.com>
6160
6161         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6162         (incremental_dump_LDADD): Add linking option for libintl.
6163         * Makefile.in: Regenerate.
6164
6165 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6166
6167         PR gold/11144
6168         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6169         instead of -Ds.
6170         * testsuite/Makefile.in: Regenerated.
6171
6172 2010-01-10  Doug Kwan  <dougkwan@google.com>
6173
6174         * options.h (DEFINE_var): Use parentheses around argument varname__
6175         in macro body to avoid any unintended subsequent substitutions.
6176
6177 2010-01-10  Ian Lance Taylor  <iant@google.com>
6178
6179         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6180         candidates before doing symbol resolution.
6181
6182         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6183         ODR candidates if only one is weak.
6184
6185 2010-01-08  Ian Lance Taylor  <iant@google.com>
6186
6187         * script.cc (Version_script_info::build_expression_list_lookup):
6188         Don't warn about ambiguous version, just record the ambiguity.
6189         (Version_script_info::get_symbol_version_helper): Give error if
6190         version is ambiguous.
6191
6192 2010-01-08  Doug Kwan  <dougkwan@google.com>
6193
6194         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6195           prev_data_size_ and prev_addralign_.  Remove initializer for
6196           deleted data member has_been_changed_.
6197           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6198           to determine if the table is empty.
6199           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6200           Remove.
6201           (Stub_table::add_reloc_stub): Define method in class definition
6202           instead of just declaring it there.
6203           (Stub_table::add_cortex_a8_stub): New method definition.
6204           (Stub_table::update_data_size_and_addralign): Ditto.
6205           (Stub_table::finalize_stubs): Ditto.
6206           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6207           (Stub_table::do_addralign_): Return address alignment in the
6208           (Stub_table::do_reset_address_and_file_offset): Define method in
6209           class definition instead of declaring it there.  Set current data
6210           size to be the data size of the previous pass.
6211           (Stub_table::set_final_data_size): Use current data size as the
6212           final data size.
6213           (Stub_table::relocate_stub): Change parameter type of stub from
6214           Reloc_stub pointer to Stub pointer.
6215           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6216           (Stub_table::Cortex_a8_stub_list): New typedef.
6217           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6218            Stub_table::prev_addralign_): New data member.
6219           (Arm_relobj::Arm_relobj): Initialize data member
6220           section_has_cortex_a8_workaround_.
6221           (Arm_relobj::section_has_cortex_a8_workaround,
6222            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6223            definitions.
6224           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6225           declarations.
6226           (Target_arm::relocate_stub): Change parameter type of stub from
6227           Reloc_stub pointer to Stub pointer.
6228           (Insn_template::size, Insn_template::alignment): Handle
6229           THUMB16_SPECIAL_TYPE.
6230           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6231            Stub_table::update_data_size_and_addralign,
6232            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6233           definitions.
6234           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6235           (Stub_table::do_write): Ditto.
6236           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6237
6238 2010-01-08  Ian Lance Taylor  <iant@google.com>
6239
6240         PR 11108
6241         * symtab.h (class Symbol): Remove fields is_target_special_ and
6242         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6243         (Symbol::is_defined_in_discarded_section): New function.
6244         (Symbol::set_is_defined_in_discarded_section): New function.
6245         (Symbol::has_plt_offset): Rewrite.
6246         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6247         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6248         Don't initialize is_target_special_ or has_plt_offset_.
6249         Initialize is_defined_in_discarded_section_.
6250         (Symbol_table::add_from_relobj): If appropriate, set
6251         is_defined_in_discarded_section.
6252         * resolve.cc (Symbol::override_base_with_special): Don't test
6253         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6254         * target-reloc.h (relocate_section): Do special handling for
6255         symbols defined in discarded sections for global symbols as well
6256         as local symbols.
6257
6258 2010-01-08  Ian Lance Taylor  <iant@google.com>
6259
6260         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6261         the SHT_SYMTAB case.
6262
6263 2010-01-08  Ian Lance Taylor  <iant@google.com>
6264
6265         * object.cc (Sized_relobj::do_layout): Don't get confused if
6266         layout_eh_frame returns NULL.
6267
6268 2010-01-08  Ian Lance Taylor  <iant@google.com>
6269
6270         PR 11084
6271         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6272         dynamic symbol table, use the normal symbol table.
6273         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6274         symbol table.
6275
6276 2010-01-08  Ian Lance Taylor  <iant@google.com>
6277
6278         PR 11072
6279         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6280         sections.
6281
6282 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6283
6284         * version.cc (print_version): Change to "Copyright 2010".
6285
6286 2010-01-08  Ian Lance Taylor  <iant@google.com>
6287
6288         PR 10287
6289         PR 11063
6290         * i386.cc (class Target_i386): Change return type of plt_section
6291         to be non-const.
6292         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6293         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6294         tls_desc_rel_ field.
6295         (Output_data_plt_i386::rel_tls_desc): New function.
6296         (Target_i386::rel_tls_desc_section): New function.
6297         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6298         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6299         R_386_TLS_DESC reloc in rel_tls_desc_section.
6300         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6301         Define struct Tlsdesc_info.
6302         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6303         (Target_x86_64::do_reloc_symbol_index): New function.
6304         (Target_x86_64::add_tlsdesc_info): New function.
6305         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6306         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6307         tlsdesc_rel_ field.
6308         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6309         all callers.
6310         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6311         (Target_x86_64::rela_tlsdesc_section): New function.
6312         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6313         handling.
6314         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6315         (Target_x86_64::do_reloc_addend): New function.
6316         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6317         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6318         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6319         (Output_reloc::type): New function.
6320         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6321         (Output_reloc::is_target_specific): New function.
6322         (Output_reloc::target_arg): New function.
6323         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6324         absolute relocs and target specific relocs.
6325         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6326         add_target_specific.
6327         (class Output_data_reloc) [SHT_RELA]: Likewise.
6328         * output.cc (Output_reloc::Output_reloc): Add four new versions
6329         for absolute relocs and target specific relocs.
6330         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6331         (Output_reloc::get_symbol_index): Likewise.
6332         (Output_reloc::local_section_offset): Check that local_sym_index_
6333         is not TARGET_CODE or 0.
6334         (Output_reloc::symbol_value): Likewise.
6335         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6336         reloc.
6337         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6338         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6339         functions.
6340         * layout.cc (add_target_dynamic_tags): Use output section for
6341         DT_PLTRELSZ and DT_JMPREL.
6342
6343 2010-01-07  Ian Lance Taylor  <iant@google.com>
6344
6345         PR 11061
6346         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6347         function.
6348         (class Output_data_reloc_generic): Define.
6349         (class Output_data_reloc_base): Change base class to
6350         Output_data_reloc_generic.  Change add() method to call
6351         bump_relative_reloc_count for a relative reloc.  Remove
6352         sort_relocs_ field.
6353         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6354         to sort_relocs().
6355         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6356         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6357         appropriate.
6358         * layout.h (class Layout): Update declaration.
6359
6360 2010-01-07  Ian Lance Taylor  <iant@google.com>
6361
6362         * output.h (class Output_data): Add const version of
6363         output_section and do_output_section.
6364         (class Output_section_data): Add const version of
6365         do_output_section.
6366         (class Output_section): Likewise.
6367         * layout.cc (Layout::add_target_dynamic_tags): New function.
6368         * layout.h (class Layout): Update declarations.
6369         * arm.cc (Target_arm::do_finalize_sections): Use
6370         add_target_dynamic_tags.
6371         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6372         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6373         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6374         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6375
6376 2010-01-07  Ian Lance Taylor  <iant@google.com>
6377
6378         PR 11042
6379         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6380         object as needed.
6381
6382 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6383             Ian Lance Taylor  <iant@google.com>
6384
6385         PR 11019
6386         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6387         Xindex::read_symtab_xindex.
6388
6389 2010-01-07  Doug Kwan  <dougkwan@google.com>
6390
6391         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6392         (Insn_template::thumb16_bcond_insn): New method declaration.
6393         (Insn_template): Fix spelling.
6394         (Stub::thumb16_special): New method declaration.
6395         (Stub::do_write): Define virtual method which was previously pure
6396         virtual.
6397         (Stub::do_thumb16_special): New method declaration.
6398         (Stub::do_fixed_endian_write): New template member.
6399         (Reloc_stub::do_write): Remove.
6400         (Reloc_stub::do_fixed_endian_write): Remove.
6401         (Cortex_a8_stub): New class definition.
6402         (Stub_factory::make_cortex_a8_stub): New method definition.
6403         (Stub_factory::Stub_factory): Add missing static storage class
6404         qualifier for elf32_arm_stub_a8_veneer_blx.
6405
6406 2010-01-07  Ian Lance Taylor  <iant@google.com>
6407
6408         PR 10980
6409         * options.h (class General_options): Add --warn-unresolved-symbols
6410         and --error-unresolved-symbols.
6411         * errors.cc (Errors::undefined_symbol): Implement
6412         --warn-unresolved-symbols.
6413
6414         * options.h (class General_options): Add -z text and -z textoff.
6415         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6416
6417 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6418
6419         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6420         (Garbage_collection::cident_sections): New function.
6421         (Garbage_collection::add_cident_section): New function.
6422         (Garbage_collection::cident_sections_): New member.
6423         (gc_process_relocs): Add references to sections whose names are C
6424         identifiers.
6425         * gold.h (cident_section_start_prefix): New constant.
6426         (cident_section_stop_prefix): New constant.
6427         (is_cident): New function.
6428         * layout.cc (Layout::define_section_symbols): Replace string constants
6429         with the newly defined constants.
6430         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6431         C identifiers.
6432         * testsuite/Makefile.am: Add gc_orphan_section_test.
6433         * testsuite/Makefile.in: Regenerate.
6434         * testsuite/gc_orphan_section_test.cc: New file.
6435         * testsuite/gc_orphan_section_test.sh: New file.
6436
6437 2010-01-06  Ian Lance Taylor  <iant@google.com>
6438
6439         PR 10980
6440         * options.h (class General_options): Add --warn-shared-textrel.
6441         * layout.cc (Layout::finish_dynamic_section): Implement
6442         --warn-shared-textrel.
6443
6444         PR 10980
6445         * options.h (class General_options): Add --warn-multiple-gp.
6446
6447 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6448
6449         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6450         $(THREADSLIB) and $(LIBDL).
6451         * Makefile.in: Rebuild.
6452
6453 2010-01-06  Ian Lance Taylor  <iant@google.com>
6454
6455         PR 10980
6456         * options.cc (General_options::parse_section_start): New function.
6457         (General_options::section_start): New function.
6458         (General_options::General_options): Initialize all members.
6459         * options.h: Include <map>
6460         (class General_options): Add --section-start.  Add section_starts_
6461         member.
6462         * layout.cc (Layout::attach_allocated_section_to_segment): If
6463         --section-start was used, set the address of the segment.  Remove
6464         local sort_sections.
6465         (Layout::relaxation_loop_body): If the address of the load segment
6466         has been set by --section-start, don't use it.
6467         * output.h (Output_segment::update_flags_for_output_section): New
6468         function.
6469         * output.cc (Output_segment::add_output_section): Call
6470         update_flags_for_output_section.
6471
6472 2010-01-05  Ian Lance Taylor  <iant@google.com>
6473
6474         PR 10980
6475         * options.h (class General_options): Add --undefined-version.
6476         * script.cc (struct Version_expression): Add was_matched_by_symbol
6477         field.
6478         (Version_script_info::matched_symbol): New function.
6479         (Version_script_info::get_symbol_version_helper): Call
6480         matched_symbol.
6481         (Version_script_info::check_unmatched_names): New function.
6482         * script.h (class Version_script_info): Update declarations.
6483         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6484
6485         * options.h (class General_options): Use DEFINE_bool_alias for
6486         allow_multiple_definition.
6487         * resolve.cc (Symbol_table::should_override): Don't test
6488         allow_multiple_definition.
6489
6490         PR 10980
6491         * options.h (class General_options): Add --cref.
6492         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6493         until after printing cref table.
6494         * cref.cc: Include "symtab.h".
6495         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6496         (Cref_table_compare::operator()): New function.
6497         (Cref_inputs::gather_cref): New function.
6498         (filecol): New static const.
6499         (Cref_inputs::print_cref): New function.
6500         (Cref::print_cref): New function.
6501         * cref.h: Include <cstdio>.
6502         (class Cref): Update declarations.
6503         * mapfile.h (Mapfile::file): New function.
6504         * object.h (class Object): Define Symbols.  Declare virtual
6505         do_get_global_symbols.
6506         (Object::get_global_symbols): New function.
6507         * object.cc (Input_objects::add_object): Pass object to cref_ if
6508         --cref.
6509         (Input_objects::archive_start): Likewise.
6510         (Input_objects::archive_stop): Likewise.
6511         (Input_objects::print_cref): New function.
6512         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6513         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6514         --cref.
6515         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6516         function.
6517         * plugin.h (class Sized_pluginobj): Update declarations.
6518
6519 2010-01-05  Ian Lance Taylor  <iant@google.com>
6520
6521         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6522         to is_default_version.  Rename insdef to insdefault.
6523         (Symbol_table::add_from_relobj): Rename def to is_default_version
6524         and local to is_forced_local.
6525         (Symbol_table::add_from_pluginobj): Likewise.
6526         (Symbol_table::add_from_dynobj): Likewise.
6527         (Symbol_table::define_special_symbol): Rename insdef to
6528         insdefault.
6529
6530 2010-01-04  Ian Lance Taylor  <iant@google.com>
6531
6532         PR 10980
6533         * options.h (class General_options): Add
6534         --allow-multiple-definition and -z muldefs.
6535         * resolve.cc (Symbol_table::should_override): Don't warn about a
6536         multiple symbol definition if --allow-multiple-definition or -z
6537         muldefs.
6538
6539         PR 10980
6540         * options.h (class General_options): Add --add-needed and
6541         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6542         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6543         error if --copy-dt-needed-entries aka --add-needed is used and
6544         would cause a change in behaviour.
6545
6546         PR 10980
6547         * options.h (class General_options): Add -G as a short version of
6548         --shared.  Add no-op options -assert, -g, and -i.
6549
6550 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6551
6552         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6553         check for .text or .gnu.linkonce.t sections.
6554         * icf.cc (Icf::find_identical_sections): Ditto.
6555         Change the detection for mangled function name within the section
6556         name.
6557         * icf.h (is_section_foldable_candidate): New function.
6558
6559 2009-12-30  Ian Lance Taylor  <iant@google.com>
6560
6561         PR 10980
6562         * options.h (class General_options): Permit two dashes with
6563         --retain-symbols-file.
6564
6565 2009-12-30  Ian Lance Taylor  <iant@google.com>
6566
6567         PR 10979
6568         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6569         don't put the file header and segment headers in the text
6570         segment.
6571
6572         PR 10979
6573         * common.cc (Sort_commons::operator()): Stabilize sort when both
6574         entries are NULL.
6575         (Symbol_table::do_allocate_commons_list): When allocating common
6576         symbols, skip a symbol which is no longer common.
6577         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6578         an object before checking its type.
6579         * testsuite/common_test_2.c: New file.
6580         * testsuite/common_test_3.c: New file.
6581         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6582         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6583         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6584         (common_test_2_pic.o, common_test_2.so): New targets.
6585         (common_test_3_pic.o, common_test_3.so): New targets.
6586         * testsuite/Makefile.in: Rebuild.
6587
6588         PR 10979
6589         * script.cc (read_input_script): If we see a new SECTIONS clause,
6590         and we have added an input section, give an error.
6591         * layout.h (class Layout): Add have_added_input_section function.
6592         Add have_added_input_section_ field.
6593         * layout.cc (Layout::Layout): Initialize
6594         have_added_input_section_.
6595         (Layout::layout): Set have_added_input_section_.
6596         (Layout::layout_eh_frame): Likewise.
6597
6598 2009-12-30  Ian Lance Taylor  <iant@google.com>
6599
6600         PR 10931
6601         * options.h (class General_options): Add --sort-common option.
6602         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6603         * common.cc (Sort_common): Add sort_order parameter to
6604         constructor.  Add sort_order_ field.
6605         (Sort_commons::operator): Check sort_order_.
6606         (Symbol_table::allocate_commons): Determine the sort order.
6607         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6608         Change all callers.
6609         (Symbol_table::do_allocate_commons_list): Likewise.
6610
6611 2009-12-30  Ian Lance Taylor  <iant@google.com>
6612
6613         PR 10916
6614         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6615         symbols from this object, don't change the visibility of an
6616         undefined symbol.
6617         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6618
6619 2009-12-30  Ian Lance Taylor  <iant@google.com>
6620
6621         PR 10861
6622         * script.h (class Version_script_info): Define Language enum.
6623         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6624         new fields globals_, locals_, and is_finalized_.
6625         * script.cc: Various formatting fixes.
6626         (class Parser_closure): Change language_stack_ from a vector of
6627         std::string to one of Version_script_info::Language.  Adjust all
6628         uses accordingly.
6629         (class Lazy_demangler): Remove.
6630         (struct Version_expression): Change language from std::string to
6631         Version_script_info::Language.
6632         (Version_script_info::Version_script_info): New function.
6633         (Version_script_info::~Version_script_info): Don't call clear.
6634         (Version_script_info::finalize): New function.
6635         (Version_script_info::build_lookup_tables): New function.
6636         (Version_script_info::build_expression_list_lookup): New
6637         function.
6638         (Version_script_info::get_symbol_version_helper): Rewrite to use
6639         lookup tables.
6640         (Version_script_info::print_expression_list): Adjust to use
6641         Version_script_info::Language.
6642         (script_push_lex_into_version_mode): Check that the version script
6643         has not been finalized.
6644         (version_script_push_lang): Change language string to
6645         Version_script_info::Language.
6646         * options.cc (Command_line::version_script): New function.
6647         * options.h (class General_options): Add finalize_dynamic_list
6648         function.  Change version_script from declaration to definition.
6649         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6650         * testsuite/version_script.map: Remove duplicate def of foo.
6651         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6652         version_script.map.
6653         * testsuite/Makefile.in: Rebuild.
6654
6655 2009-12-30  Ian Lance Taylor  <iant@google.com>
6656
6657         PR 10843
6658         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6659         if the input symbol index is 0, make the output symbol index 0.
6660
6661 2009-12-30  Ian Lance Taylor  <iant@google.com>
6662
6663         PR 10670
6664         * options.h (class General_options): Add -x/--discard-all.
6665         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6666         --discard-all.  If the local symbol needs a dynamic entry, check
6667         that before handling --discard-locals.
6668
6669 2009-12-30  Ian Lance Taylor  <iant@google.com>
6670
6671         PR 10450
6672         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6673         flags to PF_R.
6674         (Output_segment::add_output_section): Don't change the flags if
6675         the type is PT_TLS.
6676
6677         PR 10450
6678         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6679         GNU hash table if they need a dynamic value.  Otherwise, don't add
6680         them if they are defined in a dynamic object or are forced local.
6681
6682 2009-12-29  Ian Lance Taylor  <iant@google.com>
6683
6684         PR 10450
6685         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6686         .gnu.hash table for a 32-bit target.
6687
6688         PR 10450
6689         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6690         regular and a dynamic object only needs a dynamic symbol table
6691         entry if it is externally visible.
6692
6693         PR 10450
6694         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6695         constructor.  Add global_offset_table_ field.
6696         (Target_i386::got_section): Set global_offset_table_.
6697         (Target_i386::do_finalize_sections): Set global_offset_table_
6698         size.
6699         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6700         in constructor.  Add global_offset_table_ field.
6701         (Target_x86_64::got_section): Set global_offset_table_.
6702         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6703         size.
6704
6705         * layout.cc (Layout::Layout): Initialize increase_relro_.
6706         (Layout::get_output_section): Add is_relro, is_last_relro, and
6707         is_first_non_relro parameters.  Change all callers.
6708         (Layout::choose_output_section): Likewise.
6709         (Layout::add_output_section_data): Likewise.
6710         (Layout::make_output_section): Likewise.
6711         (Layout::set_segment_offsets): Clear increase_relro when using a
6712         linker script.
6713         * layout.h (class Layout): Add increase_relro method.  Add
6714         increase_relro_ field.  Update declarations.
6715         * output.cc (Output_section::Output_section): Initialize
6716         is_last_relro_ and is_first_non_relro_.
6717         (Output_segment::add_output_section): Group relro sections is
6718         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6719         (Output_segment::maximum_alignment): Remove relro handling.
6720         (Output_segment::set_section_addresses): Add increase_relro
6721         parameter.  Change all callers.  Add initial alignment to align
6722         relro sections on separate page.  Remove old relro handling.
6723         (Output_segment::set_section_list_addresses): Remove in_relro
6724         parameter.  Change all callers.
6725         (Output_segment::set_offset): Add increase parameter.  Change all
6726         callers.  Remove old relro handling.
6727         * output.h (class Output_section): Add new methods: is_last_relro,
6728         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6729         Add is_last_relro_ and is_first_non_relro_ fields.
6730         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6731         Create separate .got.plt section.  Call increase_relro.
6732         * x86_64.cc (Target_x86_64::got_section): Likewise.
6733         * testsuite/relro_script_test.t: Add .got.plt.
6734
6735         PR 10450
6736         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6737         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6738         (Layout::finalize): Call set_dynamic_symbol_size.
6739         (Layout::set_dynamic_symbol_size): New function.
6740         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6741         set_dynamic_symbol_size.
6742
6743         PR 10450
6744         * output.h (class Output_section): Add is_entsize_zero_ field.
6745         * output.cc (Output_section::Output_section): Initialize
6746         is_entsize_zero_.
6747         (Output_section::set_entsize): If two different entsizes are
6748         requested, force it to zero.
6749         (Output_section::add_input_section): Set flags for .debug_str
6750         before updating section flags.  Set entsize.
6751         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6752         and SHF_STRING if all input sections have those flags.
6753
6754 2009-12-29   Rafael Espindola  <espindola@google.com>
6755
6756         * main.cc (main): Fix the sys time reporting.
6757         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6758         reporting.
6759
6760 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6761
6762         * options.cc (General_options::parse_version): Allow -v to exit
6763         without an error if there is nothing to link.
6764
6765 2009-12-29  Ian Lance Taylor  <iant@google.com>
6766
6767         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6768         using a version of gcc before 4.1.
6769         * configure: Rebuild.
6770
6771 2009-12-28  Chris Demetriou  <cgd@google.com>
6772
6773         * attributes.cc (Output_attributes_section_data::do_write): Use
6774         std::vector::front rather than std::vector::data.
6775
6776 2009-12-28  Ian Lance Taylor  <iant@google.com>
6777
6778         * symtab.h (class Symbol_table): Add enum Defined.
6779         * resolve.cc (Symbol_table::should_override): Add defined
6780         parameter.  Change all callers.  Test whether object is NULL
6781         before calling a method on it.
6782         (Symbol_table::report_resolve_problem): Add defined parameter.
6783         Change all callers.
6784         (Symbol_table::should_override_with_special): Likewise.
6785         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6786         parameter.  Change all callers.
6787         (Symbol_table::do_define_in_output_data): Likewise.
6788         (Symbol_table::define_in_output_segment): Likewise.
6789         (Symbol_table::do_define_in_output_segment): Likewise.
6790         (Symbol_table::define_as_constant): Likewise.
6791         (Symbol_table::do_define_as_constant): Likewise.
6792         * script.h (class Symbol_assignment): Add is_defsym parameter to
6793         constructor; change all callers.
6794         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6795         parameter.  Change all callers.  Add is_defsym_ field.
6796         (class Parser_closure): Add parsing_defsym parameter to
6797         constructor; change all callers.  Add parsing_defsym accessor
6798         function.  Add parsing_defsym_ field.
6799
6800 2009-12-28  Ian Lance Taylor  <iant@google.com>
6801
6802         * gold.cc (queue_middle_tasks): Fix formatting.
6803         * object.cc (Relobj::is_section_name_included): Likewise.
6804
6805 2009-12-23  Ian Lance Taylor  <iant@google.com>
6806
6807         * i386.cc (Target_i386::do_calls_non_split): Recognize
6808         -fsplit-stack prologue for a function with a static chain.
6809         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6810         -fsplit-stack prologue when using %r11.
6811
6812 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6813
6814         * options.cc (General_options::parse_version): Make -v continue and do
6815         the link like GNU ld does.
6816
6817 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6818
6819         * Makefile.am (CCFILES): Add timer.cc.
6820         (HFILES): Add timer.h.
6821         * configure.ac: Check for sysconf and times.
6822         * main.cc: include timer.h.
6823         (main): Use Timer instead of get_run_time.
6824         * timer.cc: New.
6825         * timer.h: New.
6826         * workqueue.cc: include timer.h.
6827         (Workqueue::find_and_run_task):
6828         Report user, sys and wall time.
6829         * Makefile.in: Regenerate.
6830         * config.in: Regenerate.
6831         * configure: Regenerate.
6832
6833 2009-12-16  Doug Kwan  <dougkwan@google.com>
6834
6835         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6836         sections.
6837         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6838         relaxed input sections.
6839         * output.cc (Output_section::find_relaxed_input_section): Change
6840         return type to Output_relaxed_input_section pointer.  Adjust code
6841         for new type of relaxed_input_section_map_.
6842         * output.h (Output_section::find_relaxed_input_section): Change
6843         return type to Output_relaxed_input_section pointer.
6844         (Output_section::Output_relaxed_input_section_by_input_section_map):
6845         New type.
6846         (Output_section::relaxed_input_section_map_): Change type to
6847         Output_section::Output_relaxed_input_section_by_input_section_map.
6848         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6849         input section.
6850
6851 2009-12-15  Ian Lance Taylor  <iant@google.com>
6852
6853         * layout.cc (Layout::create_shstrtab): Only write out after input
6854         sections if we are compressing debug sections.
6855
6856 2009-12-15  Ian Lance Taylor  <iant@google.com>
6857
6858         * archive.cc (Archive::add_symbols): Only look up a symbol without
6859         a version if there is, in fact, a version.
6860
6861 2009-12-14  Ian Lance Taylor  <iant@google.com>
6862
6863         Revert -Wshadow changes, all changes from:
6864         2009-12-11  Doug Kwan  <dougkwan@google.com>
6865         2009-12-11  Nick Clifton  <nickc@redhat.com>
6866         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6867
6868 2009-12-11  Doug Kwan  <dougkwan@google.com>
6869
6870         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6871         due to -Wshadow.
6872         * attributes.cc (Object_attribute::size): Ditto.
6873         (Attributes_section_data::size): Ditto.
6874         (Attributes_section_data::Attributes_section_data): Ditto.
6875         (Output_attributes_section_data::do_write): Ditto.
6876         * attributes.h (Object_attribute::set_type): Ditto.
6877         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6878
6879 2009-12-11  Nick Clifton  <nickc@redhat.com>
6880
6881         * archive.cc: Fix shadowed variable warnings.
6882         * arm.cc: Likewise.
6883         * compressed_output.cc: Likewise.
6884         * compressed_output.h: Likewise.
6885         * configure: Likewise.
6886         * dwarf_reader.cc: Likewise.
6887         * dynobj.cc: Likewise.
6888         * dynobj.h: Likewise.
6889         * ehframe.cc: Likewise.
6890         * ehframe.h: Likewise.
6891         * errors.cc: Likewise.
6892         * expression.cc: Likewise.
6893         * fileread.cc: Likewise.
6894         * fileread.h: Likewise.
6895         * freebsd.h: Likewise.
6896         * i386.cc: Likewise.
6897         * icf.cc: Likewise.
6898         * incremental.h: Likewise.
6899         * layout.cc: Likewise.
6900         * layout.h: Likewise.
6901         * mapfile.cc: Likewise.
6902         * merge.cc: Likewise.
6903         * merge.h: Likewise.
6904         * object.cc: Likewise.
6905         * object.h: Likewise.
6906         * options.h: Likewise.
6907         * output.cc: Likewise.
6908         * output.h: Likewise.
6909         * parameters.cc: Likewise.
6910         * plugin.cc: Likewise.
6911         * powerpc.cc: Likewise.
6912         * reduced_debug_output.cc: Likewise.
6913         * reduced_debug_output.h: Likewise.
6914         * reloc.cc: Likewise.
6915         * reloc.h: Likewise.
6916         * resolve.cc: Likewise.
6917         * script-sections.cc: Likewise.
6918         * script.cc: Likewise.
6919         * script.h: Likewise.
6920         * sparc.cc: Likewise.
6921         * symtab.cc: Likewise.
6922         * symtab.h: Likewise.
6923         * target-select.cc: Likewise.
6924         * target-select.h: Likewise.
6925         * token.h: Likewise.
6926         * workqueue.cc: Likewise.
6927         * workqueue.h: Likewise.
6928         * x86_64.cc: Likewise.
6929
6930 2009-12-10  Doug Kwan  <dougkwan@google.com>
6931
6932         * arm.cc (attributes.h): New include.
6933         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6934         (Arm_relobj::~Arm_relobj): Delete object pointed by
6935         attributes_section_data_.
6936         (Arm_relobj::attributes_section_data): New method definition.
6937         (Arm_relobj::attributes_section_data_): New data member declaration.
6938         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6939         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6940         attributes_section_data_.
6941         (Arm_dynobj::attributes_section_data): New method definition.
6942         (Arm_dynobj::attributes_section_data_): New data member declaration.
6943         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6944         initialization value of may_use_blx_ to false.
6945         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6946         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6947         object attributes to compute results instead of hard-coding.
6948         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6949         Target_arm::get_secondary_compatible_arch,
6950         Target_arm::set_secondary_compatible_arch
6951         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6952         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6953         New method declarations.
6954         (Target_arm::get_aeabi_object_attribute): New method definition.
6955         (Target_arm::attributes_section_data_): New data member declaration.
6956         (read_arm_attributes_section): New template definition.
6957         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6958         (Arm_dynobj::do_read_symbols): Ditto.
6959         (Target_arm::do_finalize_sections): Merge attributes sections from
6960         input.  Check for BLX use after attributes section merging.
6961         Fix __exidx_start and __exidx_end visibility.  Create an
6962         .ARM.attributes section if necessary.
6963         (Target_arm::get_secondary_compatible_arch,
6964         Target_arm::set_secondary_compatible_arch,
6965         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6966         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6967         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6968         New method definitions.
6969
6970 2009-12-09  Ian Lance Taylor  <iant@google.com>
6971
6972         * plugin.cc (Plugin::load): Don't cast from void* to a function
6973         pointer.
6974
6975 2009-12-09  Ian Lance Taylor  <iant@google.com>
6976
6977         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6978         information fields.
6979
6980 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6981
6982         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6983         Replace two_file_shared_1.so with two_file_shared_2.so.
6984         * testsuite/Makefile.in: Regenerated.
6985
6986 2009-12-08  Doug Kwan  <dougkwan@google.com>
6987
6988         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6989         (HFILES): Add attributes.h and int_encoding.h.
6990         * Makefile.in: Regenerate.
6991         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6992         function definitions to int_encoding.cc
6993         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6994         prototypes to int_encoding.h
6995         * reduced_debug_output.cc (int_encoding.h): New include.
6996         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6997         function definitions to int_encoding.cc
6998         (insert_into_vector, read_from_pointer): Move template definitions to
6999         int_encoding.h
7000         * attributes.cc: New file.
7001         * attributes.h: New file.
7002         * int_encoding.cc: New file.
7003         * int_encoding.h: New file.
7004
7005 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7006
7007         PR gold/11055
7008         * incremental-dump.cc (dump_incremental_inputs): New.
7009         (main): Use dump_incremental_inputs.
7010
7011 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7012
7013         PR gold/10893
7014         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7015         checking elfcpp::STT_FUNC.
7016         (Target_i386::Relocate::relocate): Likewise.
7017         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7018
7019         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7020         symbols from shared libraries into normal FUNC symbols.
7021
7022         * symtab.h (Symbol): Add is_func and use it.
7023
7024 2009-12-05  Doug Kwan  <dougkwan@google.com>
7025
7026         * arm.cc (Target_arm::arm_info): Initialize new fields
7027         attributes_section and attributes_vendor.
7028         * i386.cc (Target_i386::i386_info): Same.
7029         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7030         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7031         fields attributes_section and attributes_vendor.
7032         * sparc.cc (Target_sparc::sparc_info): Same.
7033         * target.h (Target::attributes_section, Target::attributes_vendor,
7034         Target::is_attributes_section, Target::attribute_arg_type,
7035         Target::attributes_order): New method definitions.
7036         (Target::Target_info::attributes_section,
7037         Target::Target_info::attributes_vendor): New fields.
7038         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7039         virtual method definitions.
7040         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7041         attributes_section and attributes_vendor.
7042         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7043
7044 2009-12-05  Doug Kwan  <dougkwan@google.com>
7045
7046         * arm.cc: Update comments about interworking and stub generation.
7047         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7048         considered as non-PIC.
7049         (Arm_relocate_functions::base_abs): Fix formatting.
7050         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7051         of function to use GOT entry address instead of offset.
7052         (Target_arm::Scan::global): Issue an error if a symbol would need a
7053         PLT does not get one because it is untyped.  Remove code to create
7054         dynamic symbols for relative branches.
7055         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7056         takes unsigned integer instead of boolean.
7057
7058 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7059
7060         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7061         (two_file_test_LDADD): Likewise.
7062         (common_test_1_LDADD): Likewise.
7063         (exception_test_LDADD) Likewise.
7064         (weak_test_LDADD): Likewise.
7065         (many_sections_test_LDADD): Likewise.
7066         (initpri1_LDADD): Likewise.
7067         (script_test_1_LDADD): Likewise.
7068         (script_test_2_LDADD): Likewise.
7069         (justsyms_LDADD): Likewise.
7070         (binary_test_LDADD): Likewise.
7071         (large_LDADD): Likewise.
7072         * testsuite/Makefile.in: Regenerated.
7073
7074 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7075
7076         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7077         (Symbol_table::override_with_special): Likewise.
7078         (Symbol_table::add_from_object): Likewise.
7079
7080 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7081
7082         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7083         Don't set the data_offset twice.
7084
7085 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7086
7087         * testsuite/Makefile.in: Regenerate.
7088
7089 2009-12-03  Doug Kwan  <dougkwan@google.com>
7090
7091         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7092         (Target_arm::do_finalize_sections): Add parameter for symbol table
7093         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7094         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7095         parameter for symbol table pointer.
7096         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7097         an additional parameter for a pointer to symbol table.
7098         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7099         parameter for a symbol table pointer.
7100         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7101         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7102         Ditto.
7103         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7104         parameter for a symbol table pointer.
7105
7106 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7107
7108         * incremental.cc (Incremental_inputs_header)
7109         (Incremental_inputs_header_write, Incremental_inputs_entry)
7110         (Incremental_inputs_entry_write): Move ...
7111         * incremental.h (Incremental_inputs_header)
7112         (Incremental_inputs_header_write, Incremental_inputs_entry)
7113         (Incremental_inputs_entry_write): here.
7114
7115 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7116
7117         * incremental.cc (make_sized_incremental_binary): Set the target.
7118         Error if it is incompatible.
7119         * output.h (Output_file): Add filename method.
7120
7121 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7122
7123         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7124         from the get_* methods.
7125
7126 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7127
7128         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7129         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7130         Write 0 for the data_offset of scripts.
7131
7132 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7133
7134         * testsuite/Makefile.am: Add the incremental_test.sh test.
7135         * testsuite/incremental_test.sh: New.
7136         * testsuite/incremental_test_1.c: New.
7137         * testsuite/incremental_test_2.c: New.
7138
7139 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7140
7141        * incremental-dump.cc (main): Fix typos.
7142
7143 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7144
7145         PR gold/11025
7146         * incremental-dump.cc (main): Use llu to print 64 bit values.
7147
7148 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7149             H.J. Lu  <hongjiu.lu@intel.com>
7150
7151         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7152         $(LIBDL).
7153         (incremental_dump_LDADD): Likewise.
7154         * Makefile.in: Regenerated.
7155
7156 2009-11-25  Doug Kwan  <dougkwan@google.com>
7157
7158         Revert:
7159
7160         2009-11-25  Doug Kwan  <dougkwan@google.com>
7161
7162                 * arm.cc (Target_arm::Target_arm): Move method definition
7163                 outside of class definition.  Add code to handle
7164                 --target1-rel, --target1-abs and --target2= options.
7165                 (Target_arm::get_reloc_reloc_type): Change method to be
7166                 non-static and const.
7167                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7168                 New data member declaration.
7169                 (Target_arm::Scan::local, Target_arm::Scan::global,
7170                 Target_arm::Relocate::relocate,
7171                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7172                 Adjust call to Target_arm::get_real_reloc_type.
7173                 (Target_arm::get_real_reloc_type): Use command line options
7174                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7175                 * options.h (--target1-rel, --target1-abs, --target2): New
7176                 ARM-only options.
7177
7178 2009-11-25  Doug Kwan  <dougkwan@google.com>
7179
7180         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7181         class definition.  Add code to handle --target1-rel, --target1-abs
7182         and --target2= options.
7183         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7184         and const.
7185         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7186         member declaration.
7187         (Target_arm::Scan::local, Target_arm::Scan::global,
7188         Target_arm::Relocate::relocate,
7189         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7190         call to Target_arm::get_real_reloc_type.
7191         (Target_arm::get_real_reloc_type): Use command line options to
7192         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7193         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7194         options.
7195
7196 2009-11-25  Doug Kwan  <dougkwan@google.com>
7197
7198         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7199         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7200         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7201         formatting.
7202         (Arm_relocate_functions::thm_call): Replace body with a call to
7203         Arm_relocate_functions::thumb_branch_common.
7204         (Arm_relocate_functions::thm_jump24,
7205         Arm_relocate_functions::thm_xpc22): New method definitions.
7206         (Arm_relocate_functions::thumb_branch_common): New method definition.
7207         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7208         operator.
7209         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7210         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7211
7212 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7213
7214         * Makefile.am: Build incremental-dump
7215         * Makefile.in: Regenerate.
7216         * incremental-dump.cc: New.
7217         * incremental.cc (Incremental_inputs_header_data,
7218         Incremental_inputs_entry_data): Move to incremental.h
7219         * incremental.h: (Incremental_inputs_header_data,
7220         Incremental_inputs_entry_data): Move from incremental.cc
7221
7222 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7223
7224         * incremental.cc (Incremental_inputs_header,
7225         Incremental_inputs_header_write, Incremental_inputs_entry,
7226         Incremental_inputs_entry_write): Add a typedef with the data type.
7227
7228 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7229
7230         * incremental.cc (Incremental_inputs_header,
7231         Incremental_inputs_header_write, Incremental_inputs_entry,
7232         Incremental_inputs_entry_write): Update comment about which
7233         type has the filed descriptions.
7234
7235 2009-11-15  Doug Kwan  <dougkwan@google.com>
7236
7237         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7238         (Arm_relocate_functions::arm_branch_common): Change method defintion
7239         in class definition to a method declaration and update list of formal
7240         parameters.
7241         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7242         Arm_relocation_functions::jump24): Adjust call to
7243         Arm_relocate_functions::arm_branch_common.  Update list of formal
7244         parameters.
7245         (Arm_relocate_functions::xpc25): New method definition.
7246         (Arm_relocate_functions::arm_branch_common): Move method defintion
7247         out from class definition.  Use stubs for mode-switching and extending
7248         branch ranges.
7249         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7250         specially.  Change code to enable use of stubs in ARM branches.
7251
7252 2009-11-10  Doug Kwan  <dougkwan@google.com>
7253
7254         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7255         in method declaration.
7256         (Target_arm::relocate_stub): New method declaration.
7257         (Target_arm::default_target): Change to return a pointer instead of
7258         a const reference.
7259         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7260         Target_arm::default_target.
7261         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7262         method definition.
7263         (Target_arm::relocate_section): Adjust view.
7264         (Target_arm::relocate_stub): New method definition.
7265
7266 2009-11-10  Doug Kwan  <dougkwan@google.com>
7267
7268         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7269         a format warning.
7270         * incremental.cc (open_incremental_binary): Initialized local
7271         variables to avoid warnings.
7272         * object.cc (make_elf_object): Ditto.
7273         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7274         a format warning.
7275
7276 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7277
7278         PR gold/10930
7279         * testsuite/plugin_test.c: Include "config.h".
7280
7281 2009-11-09  Doug Kwan  <dougkwan@google.com>
7282
7283         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7284         (arm_symbol_value): Remove.
7285         (Arm_relocate_functions::arm_branch_common,
7286         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7287         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7288         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7289         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7290         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7291         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7292         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7293         Arm_relocate_functions::thm_mobw_abs_nc,
7294         Arm_relocate_functions::thm_mov_abs,
7295         Arm_relocate_functions::movw_prel_nc,
7296         Arm_relocate_functions::thm_movt_abs,
7297         Arm_relocate_functions::movt_prel,
7298         Arm_relocate_functions::thm_movw_prel_nc,
7299         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7300         (Target_arm::Relocate::relocate): Only decompose address into two
7301         parts if relocation type uses the thumb-bit and pass the actual
7302         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7303         calls to methods in Arm_relocate_functions for this change.
7304
7305 2009-11-08  Ian Lance Taylor  <iant@google.com>
7306
7307         PR 10925
7308         * reloc.cc: Instantiate
7309         Sized_relobj::initialize_input_to_output_maps and
7310         Sized_relobj:free_input_to_output_maps.
7311
7312 2009-11-06  Ian Lance Taylor  <iant@google.com>
7313
7314         PR 10876
7315         * defstd.cc (in_segment): Set only_if_ref true for "end".
7316
7317 2009-11-06  Doug Kwan  <dougkwan@google.com>
7318
7319         * arm.cc (class Reloc_stub): Correct a comment.
7320         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7321         (Target_arm::scan_section_for_stubs): New method declaration.
7322         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7323         Change methods from private to protected.
7324         (Target_arm::do_may_relax): New method definition.
7325         (Target_arm::do_relax, Target_arm::group_sections,
7326         Target_arm::scan_reloc_for_stub,
7327         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7328         (Target_arm::arm_input_section_map_): New data member declaration.
7329         (Target_arm::scan_reloc_for_stub,
7330         Target_arm::scan_reloc_section_for_stubs,
7331         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7332         Target_arm::do_relax): New method definitions.
7333
7334 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7335
7336         * configure.ac: Check for (struct stat)::st_mtim
7337         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7338         * config.in: Regenerate.
7339         * configure: Regenerate.
7340
7341 2009-11-05  Ian Lance Taylor  <iant@google.com>
7342
7343         PR 10910
7344         * output.cc (Output_segment::add_output_section): Add missing
7345         return statement.
7346
7347 2009-11-04  Ian Lance Taylor  <iant@google.com>
7348
7349         PR 10880
7350         * object.h (class Object): Add is_needed and set_is_needed
7351         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7352         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7353         defined in a dynamic object and referenced by a regular object,
7354         set is_needed for the dynamic object.
7355         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7356         if the file is marked with as_needed and it is not needed.
7357
7358 2009-11-04  Ian Lance Taylor  <iant@google.com>
7359
7360         PR 10887
7361         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7362         tags if data is discarded by linker script.
7363         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7364         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7365         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7366         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7367
7368 2009-11-04  Ian Lance Taylor  <iant@google.com>
7369
7370         * layout.cc (Layout::get_output_section): Add is_interp and
7371         is_dynamic_linker_section parameters.  Change all callers.
7372         (Layout::choose_output_section): Likewise.
7373         (Layout::make_output_section): Likewise.
7374         (Layout::add_output_section_data): Add is_dynamic_linker_section
7375         parameter.  Change all callers.
7376         * layout.h (class Layout): Update declarations.
7377         * output.h (class Output_section): Add is_interp, set_is_interp,
7378         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7379         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7380         generate_code_fills_at_write_ to a bitfield.
7381         * output.cc (Output_section::Output_sections): Initialize new
7382         fields.
7383         (Output_segment::add_output_section): Add do_sort parameter.
7384         Change all callers.
7385
7386 2009-11-03  Ian Lance Taylor  <iant@google.com>
7387
7388         PR 10860
7389         * options.h (class General_options): Add --warn-common.
7390         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7391         merging two common symbols.
7392         (Symbol_table::should_override): Handle --warn-common when merging
7393         a common symbol with a defined symbol.  Use report_resolve_problem
7394         for multiple definitions.
7395         (Symbol_table::report_resolve_problem): New function.
7396         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7397
7398 2009-11-03  Doug Kwan  <dougkwan@google.com>
7399
7400         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7401         stub_factory_.
7402         (Target_arm::stub_factory): New method definition.
7403         (Target_arm::new_arm_input_section,
7404         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7405         Target_arm::reloc_uses_thumb_bit): New method declarations.
7406         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7407         New type definitions.
7408         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7409         member declarations.
7410         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7411         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7412         New method definitions.
7413
7414 2009-11-03  Ian Lance Taylor  <iant@google.com>
7415
7416         * options.h (class General_options): Add --warn_constructors.
7417
7418 2009-11-03  Ian Lance Taylor  <iant@google.com>
7419
7420         PR 10893
7421         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7422         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7423
7424 2009-11-03  Ian Lance Taylor  <iant@google.com>
7425
7426         PR 10895
7427         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7428         --msgid-bugs-address.
7429         (install-pdf): New target.
7430         (install-data_yes): Look up one directory to find mkinstalldirs.
7431
7432 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7433
7434         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7435         tree.
7436
7437 2009-10-30  Doug Kwan  <dougkwan@google.com>
7438
7439         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7440
7441 2009-10-30  Doug Kwan  <dougkwan@google.com>
7442
7443         * arm.cc (Stub_addend_reader): New struct template definition
7444         and partial specializations.
7445         (Stub_addend_reader::operator()): New method definition for a
7446         partially specialized template.
7447
7448 2009-10-30  Doug Kwan  <dougkwan@google.com>
7449
7450         * arm.cc (Arm_relobj::processor_specific_flags): New method
7451         definition.
7452         (Arm_relobj::do_read_symbols): New method declaration.
7453         (Arm_relobj::processor_specific_flags_): New data member declaration.
7454         (Arm_dynobj): New class definition.
7455         (Target_arm::do_finalize_sections): Add input_objects parameter.
7456         (Target_arm::do_adjust_elf_header): New method declaration.
7457         (Target_arm::are_eabi_versions_compatible,
7458         (Target_arm::merge_processor_specific_flags): New method declaration.
7459         (Target_arm::do_make_elf_object): New overloaded method definitions
7460         and declaration.
7461         (Arm_relobj::do_read_symbols): New method definition.
7462         (Arm_dynobj::do_read_symbols): Ditto.
7463         (Target_arm::do_finalize_sections): Add input_objects parameters.
7464         Merge processor-specific flags from all input objects.
7465         (Target_arm::are_eabi_versions_compatible,
7466         Target_arm::merge_processor_specific_flags,
7467         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7468         New method definitions.
7469         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7470         Input_objects pointer type parameter.
7471         * layout.cc (Layout::finalize): Pass input objects to target's.
7472         finalize_sections function.
7473         * output.cc (Output_file_header::do_sized_write): Set ELF file
7474         header's processor-specific flags.
7475         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7476         Input_objects pointer type parameter.
7477         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7478         * target.h (Input_objects): New forward class declaration.
7479         (Target::processor_specific_flags,
7480         Target::are_processor_specific_flags_sect): New method definitions.
7481         (Target::finalize_sections): Add input_objects parameter.
7482         (Target::Target): Initialize processor_specific_flags_ and
7483         are_processor_specific_flags_set_.
7484         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7485         parameter.
7486         (Target::set_processor_specific_flags): New method definition.
7487         (Target::processor_specific_flags_,
7488         Target::are_processor_specific_flags_set_): New data member
7489         declarations.
7490         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7491         Input_objects pointer type parameter.
7492
7493 2009-10-30  Doug Kwan  <dougkwan@google.com>
7494
7495         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7496
7497 2009-10-28  Ian Lance Taylor  <iant@google.com>
7498
7499         * object.h (class Relobj): Drop options parameter from
7500         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7501         do_scan_relocs, do_relocate.  Change all callers.
7502         (class Sized_relobj): Drop options parameters from
7503         do_gc_process_relocs, do_scan_relocs, do_relocate,
7504         do_relocate_sections, relocate_sections, emit_relocs_scan,
7505         emit_relocs_scan_reltype.  Change all callers.
7506         (struct Relocate_info): Remove options field and all references to
7507         it.
7508         * reloc.h (class Read_relocs): Remove options constructor
7509         parameter and options_ field.  Change all callers.
7510         (class Gc_process_relocs, class Scan_relocs): Likewise.
7511         (class Relocate_task): Likewise.
7512         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7513         all callers.
7514         (scan_relocatable_relocs): Likewise.
7515         * target.h (class Sized_target): Remove options parameter from
7516         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7517         all callers.
7518         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7519         callers.
7520         * arm.cc: Update functions to remove options parameters.
7521         * i386.cc: Likewise.
7522         * powerpc.cc: Likewise.
7523         * sparc.cc: Likewise.
7524         * x86_64.cc: Likewise.
7525         * testsuite/testfile.cc: Likewise.
7526
7527 2009-10-28  Doug Kwan  <dougkwan@google.com>
7528
7529         * arm.cc (Arm_relobj): New class definition.
7530         (Arm_relobj::scan_sections_for_stubs,
7531         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7532         New method definitions.
7533
7534 2009-10-28  Cary Coutant  <ccoutant@google.com>
7535
7536         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7537         (Plugin::cleanup_done_): New member.
7538         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7539         (Plugin_manager::cleanup_done_): Remove.
7540         (Plugin_manager::add_input_file): Edit error message.
7541         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7542         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7543
7544 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7545
7546         * fileread.cc: (File_read::View::~View): Use the new
7547         data_ownership_ filed.
7548         (File_read::~File_read): Dispose the new whole_file_view_.
7549         (File_read::open): Mmap the whole file if needed.
7550         (File_read::open): Use whole_file_view_ instead of contents_.
7551         (File_read::find_view): Use whole_file_view_ if applicable.
7552         (File_read::do_read): Use whole_file_view_ instead of contents_.
7553         (File_read::make_view): Use whole_file_view_ instead of contents_,
7554         update File_read::View::View call.
7555         (File_read::find_or_make_view): Update File_read::View::View
7556         call.
7557         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7558         remove contents_
7559         (File_read::View::Data_ownership): New enum.
7560         (File_read::View::View): Replace bool mapped_ with Data_ownership
7561         argument.
7562         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7563         (File_read::View::data_ownership_): New field.
7564         (File_read::contents_): Remove (replaced by whole_file_view_).
7565         (File_read::whole_file_view_): New field.
7566         * options.h (class General_options): Add --keep-files-mapped.
7567
7568 2009-10-27  Cary Coutant  <ccoutant@google.com>
7569
7570         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7571         * testsuite/Makefile.am (plugin_test_5): New test case.
7572         * testsuite/Makefile.in: Regenerate.
7573
7574 2009-10-25  Doug Kwan  <dougkwan@google.com>
7575
7576         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7577         from private to protected to allow access by child class.
7578         (Sized_relobj::do_relocate_sections): New method declaration.
7579         (Sized_relobj::relocate_sections): Virtualize.
7580         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7581         Sized_relobj::relocate_sections.  Instantiate template explicitly
7582         for different target sizes and endianity.
7583
7584 2009-10-24  Doug Kwan  <dougkwan@google.com>
7585
7586         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7587         (Arm_input_section::as_arm_input_section): New method.
7588         (Arm_output_section): New class definition.
7589         (Arm_output_section::create_stub_group,
7590         Arm_output_section::group_sections): New method definitions.
7591
7592 2009-10-22  Doug Kwan  <dougkwan@google.com>
7593
7594         * arm.cc (Arm_input_section): New class definition.
7595         (Arm_input_section::init, Arm_input_section:do_write,
7596         Arm_input_section::set_final_data_size,
7597         Arm_input_section::do_reset_address_and_file_offset): New method
7598         definitions.
7599
7600 2009-10-21  Doug Kwan  <dougkwan@google.com>
7601
7602         * arm.cc (Stub_table, Arm_input_section): New forward class
7603         declarations.
7604         (Stub_table): New class defintion.
7605         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7606         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7607         New method definition.
7608
7609 2009-10-21  Doug Kwan  <dougkwan@google.com>
7610
7611         * arm.cc: Update copyright comments.
7612         (Target_arm): New forward class template declaration.
7613         (Arm_address): New type.
7614         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7615         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7616         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7617         constants.
7618         (Insn_template): Same.
7619         (DEF_STUBS): New macro.
7620         (Stub_type): New enum type.
7621         (Stub_template): New class definition.
7622         (Stub): Same.
7623         (Reloc_stub): Same.
7624         (Stub_factory): Same.
7625         (Target_arm::Target_arm): Initialize may_use_blx_ and
7626         should_force_pic_veneer_.
7627         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7628         Target_arm::should_force_pic_veneer,
7629         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7630         Target_arm::using_thumb_only, Target_arm:;default_target): New
7631         method defintions.
7632         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7633         New data member declarations.
7634         (Insn_template::size, Insn_template::alignment): New method defintions.
7635         (Stub_template::Stub_template): New method definition.
7636         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7637         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7638         (Stub_factory::Stub_factory): New method definition.
7639         * gold.h (string_hash): New template.
7640         * output.h (Input_section_specifier::hash_value): Use
7641         gold::string_hash.
7642         (Input_section_specifier::string_hash): Remove.
7643         * stringpool.cc (Stringpool_template::string_hash): Use
7644         gold::string_hash.
7645
7646 2009-10-20  Doug Kwan  <dougkwan@google.com>
7647
7648         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7649         symbols of relaxed input sections.
7650         * output.h (Output_section::find_relaxed_input_section): Make
7651         method public.
7652
7653 2009-10-16  Doug Kwan  <dougkwan@google.com>
7654
7655         * dynobj.cc (Versions::Versions): Initialize version_script_.
7656         Only insert base version symbol definition for a shared object
7657         if version script defines any version versions.
7658         (Versions::define_base_version): New method definition.
7659         (Versions::add_def): Check that base version is not needed.
7660         (Versions::add_need): Define base version lazily.
7661         * dynobj.h (Versions::define_base_version): New method declaration.
7662         (Versions::needs_base_version_): New data member declaration.
7663         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7664         (check_DATA): Add no_version_test.stdout.
7665         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7666         New make rules.
7667         * testsuite/Makefile.in: Regenerate.
7668         * testsuite/no_version_test.c: New file.
7669         * testsuite/no_version_test.sh: Ditto.
7670
7671 2009-10-16  Doug Kwan  <dougkwan@google.com>
7672
7673         * expression.cc (class Segment_start_expression): New class definition.
7674         (Segment_start_expression::value): New method definition.
7675         (script_exp_function_segment_start): Return a new
7676         Segment_start_expression.
7677         * gold/script-c.h (script_saw_segment_start_expression): New function
7678         prototype.
7679         * script-sections.cc (Script_sections::Script_sections): Initialize
7680         SAW_SEGMENT_START_EXPRESSION_ to false.
7681         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7682         and -Tbbs options to specify section addresses if given in
7683         command line and no SEGMENT_START expression is seen in a script.
7684         * script-sections.h (Script_sections::saw_segment_start_expression,
7685         Script_sections::set_saw_segment_start_expression): New method
7686         definition.
7687         (Script_sections::saw_segment_start_expression_): New data member
7688         declaration.
7689         * script.cc (script_saw_segment_start_expression): New function.
7690         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7691         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7692         script_test_7.sh and script_test_8.sh.
7693         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7694         script_test_8.stdout.
7695         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7696         (script_test_6, script_test_6.stdout, script_test_7,
7697         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7698         * Makefile.in: Regenerate.
7699         * testsuite/script_test_6.sh: New file.
7700         * testsuite/script_test_6.t: Same.
7701         * testsuite/script_test_7.sh: Same.
7702         * testsuite/script_test_7.t: Same.
7703         * testsuite/script_test_8.sh: Same.
7704
7705 2009-10-16  Doug Kwan  <dougkwan@google.com>
7706
7707         * output.cc (Output_segment::set_section_list_address): Cast
7708         expressions to unsigned long long type to avoid format warnings.
7709
7710 2009-10-15  Ian Lance Taylor  <iant@google.com>
7711
7712         * script.cc (Script_options::add_symbol_assignment): Always add a
7713         dot assignment to script_sections_.
7714         * script-sections.cc (Script_sections::add_dot_assignment):
7715         Initialize if necessary.
7716
7717         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7718         program headers with no load segment if there is a linker script.
7719
7720         * layout.cc (Layout::set_segment_offsets): Align the file offset
7721         to the segment aligment for -N or -n with no load segment.
7722         * output.cc (Output_segment::add_output_section): Don't crash if
7723         the first section is a TLS section.
7724         (Output_segment::set_section_list_addresses): Print an error
7725         message if the address moves backward in a linker script.
7726         * script-sections.cc
7727         (Output_section_element_input::set_section_addresses): Don't
7728         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7729         (Orphan_output_section::set_section_addresses): Likewise.
7730
7731 2009-10-15  Doug Kwan  <dougkwan@google.com>
7732
7733         * layout.cc (Layout::finish_dynamic_section): Generate tags
7734         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7735         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7736         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7737
7738 2009-10-14  Ian Lance Taylor  <iant@google.com>
7739
7740         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7741         fields.
7742         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7743         data_shdr fields of relinfo.
7744         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7745         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7746         R_386_TLS_LDO_32, adjust based on section flags.
7747         (Target_i386::Relocate::fix_up_ldo): Remove.
7748
7749 2009-10-13  Ian Lance Taylor  <iant@google.com>
7750
7751         Add support for -pie.
7752         * options.h (class General_options): Add -pie and
7753         --pic-executable.
7754         (General_options::output_is_position_independent): Test -pie.
7755         (General_options::output_is_executable): Return true if not shared
7756         and not relocatable.
7757         (General_options::output_is_pie): Remove.
7758         * options.cc (General_options::finalize): Reject incompatible uses
7759         of -pie.
7760         * gold.cc (queue_middle_tasks): A -pie link is not static.
7761         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7762         * symtab.cc (Symbol::final_value_is_known): Return false if
7763         output_is_position_independent.
7764         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7765         output_is_position_independent.
7766         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7767         output_is_position_independent.
7768         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7769         output_is_position_independent.
7770         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7771         two_file_pie_test.
7772         (basic_pie_test.o, basic_pie_test): New targets.
7773         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7774         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7775         (two_file_pie_test): New target.
7776         * testsuite/Makefile.in: Rebuild.
7777         * README: Remove note saying that -pie is not supported.
7778
7779 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7780
7781         * options.h (class General_options): Add -init and -fini.
7782         * layout.cc (Layout::finish_dynamic_section): Emit
7783         given init and fini functions.
7784
7785 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7786
7787         * gc.h (gc_process_relocs): Check if icf is enabled using new
7788         function.
7789         * gold.cc (queue_initial_tasks): Likewise.
7790         (queue_middle_tasks): Likewise.
7791         * object.cc (do_layout): Likewise.
7792         * symtab.cc (is_section_folded): Likewise.
7793         * main.cc (main): Likewise.
7794         * reloc.cc (Read_relocs::run): Likewise.
7795         (Sized_relobj::do_scan_relocs): Likewise.
7796         * icf.cc (is_function_ctor_or_dtor): New function.
7797         (Icf::find_identical_sections): Check if function is ctor or dtor when
7798         safe icf is chosen.
7799         * options.h (General_options::icf): Change option to be an enum.
7800         (Icf_status): New enum.
7801         (icf_enabled): New method.
7802         (icf_safe_folding): New method.
7803         (set_icf_status): New method.
7804         (icf_status_): New variable.
7805         * (options.cc) (General_options::finalize): Set icf_status_.
7806         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7807         icf_test and icf_keep_unique_test to use the --icf enum flag.
7808         * testsuite/icf_safe_test.sh: New file.
7809         * testsuite/icf_safe_test.cc: New file.
7810
7811 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7812
7813         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7814         includes to gc.h and icf.h.
7815         * arm.cc: Include gc.h.
7816         * gold.cc: Likewise.
7817         * i386.cc: Likewise.
7818         * powerpc.cc: Likewise.
7819         * sparc.cc: Likewise.
7820         * x86_64.cc: Likewise.
7821         * gc.h: Include icf.h.
7822
7823 2009-10-11  Ian Lance Taylor  <iant@google.com>
7824
7825         * plugin.cc: Include "gold.h" before other header files.
7826
7827 2009-10-10  Chris Demetriou  <cgd@google.com>
7828
7829         * options.h (Input_file_argument::Input_file_type): New enum.
7830         (Input_file_argument::is_lib_): Replace with...
7831         (Input_file_argument::type_): New member.
7832         (Input_file_argument::Input_file_argument): Take Input_file_type
7833         'type' rather than boolean 'is_lib' as second argument.
7834         (Input_file_argument::is_lib): Use type_.
7835         (Input_file_argument::is_searched_file): New function.
7836         (Input_file_argument::may_need_search): Handle is_searched_file.
7837         * options.cc (General_options::parse_library): Support -l:filename.
7838         (General_options::parse_just_symbols): Update for Input_file_argument
7839         changes.
7840         (Command_line::process): Likewise.
7841         * archive.cc (Archive::get_file_and_offset): Likewise.
7842         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7843         * script.cc (read_script_file, script_add_file): Likewise.
7844         * fileread.cc (Input_file::Input_file): Likewise.
7845         (Input_file::will_search_for): Handle is_searched_file.
7846         (Input_file::open): Likewise.
7847         * readsyms.cc (Read_symbols::get_name): Likewise.
7848         * testsuite/Makefile.am (searched_file_test): New test.
7849         * testsuite/Makefile.in: Regenerate.
7850         * testsuite/searched_file_test.cc: New file.
7851         * testsuite/searched_file_test_lib.cc: New file.
7852
7853 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7854             Ian Lance Taylor  <iant@google.com>
7855
7856         * descriptor.cc: Include <cstdio> and "binary-io.h".
7857         (Descriptors::open): Open the files in binary mode always.
7858         * script.cc (Lex::get_token): Treat \r as whitespace.
7859
7860 2009-10-09  Ian Lance Taylor  <iant@google.com>
7861
7862         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7863
7864 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7865             Ian Lance Taylor  <iant@google.com>
7866
7867         * configure.ac: Check for readv function also.
7868         * fileread.cc (readv): Define if not HAVE_READV.
7869         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7870         does not exist.
7871         * config.in: Regenerate.
7872         * configure: Regenerate.
7873
7874 2009-10-09  Doug Kwan  <dougkwan@google.com>
7875
7876         * layout.cc (Layout::make_output_section): Call target hook to make
7877         ordinary output section.
7878         (Layout::finalize): Adjust parameter list of call the
7879         Target::may_relax().
7880         * layout.h (class Layout::section_list): New method.
7881         * merge.h (Output_merge_base::entsize): Change visibility to public.
7882         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7883         New methods.
7884         (Output_merge_string::do_is_string): New method.
7885         * object.cc (Sized_relobj::do_setup): renamed from
7886         Sized_relobj::set_up.
7887         * object.h (Sized_relobj::adjust_shndx,
7888         Sized_relobj::initializ_input_to_output_maps,
7889         Sized_relobj::free_input_to_output_maps): Change visibilities to
7890         protected.
7891         (Sized_relobj::setup): Virtualize.
7892         (Sized_relobj::do_setup): New method declaration.
7893         (Sized_relobj::invalidate_section_offset,
7894         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7895         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7896         * options.cc (parse_int): New function.
7897         * options.h (parse_int): New declaration.
7898         (DEFINE_int): New macro.
7899         (stub_group_size): New option.
7900         * output.cc (Output_section::Output_section): Initialize memebers
7901         merge_section_map_, merge_section_by_properties_map_,
7902         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7903         (Output_section::add_input_section): Handled deferred code-fill
7904         generation and remove an old comment.
7905         (Output_section::add_relaxed_input_section): New method definition.
7906         (Output_section::add_merge_input_section): Use merge section by
7907         properties map to speed to search.  Update merge section maps
7908         as appropriate.
7909         (Output_section::build_relaxation_map): New method definition.
7910         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7911         Same.
7912         (Output_section::relax_input_section): Renamed to
7913         Output_section::convert_input_sections_to_relaxed_sections and change
7914         interface to take a vector of pointers to relaxed sections.
7915         (Output_section::find_merge_section,
7916         Output_section::find_relaxed_input_section): New method definitions.
7917         (Output_section::is_input_address_mapped,
7918         Output_section::output_offset, Output_section::output_address):
7919         Use output section data maps to speed up searching.
7920         (Output_section::find_starting_output_address): Add comments.
7921         (Output_section::do_write,
7922         Output_section::write_to_postprocessing_buffer): Do code-fill
7923         generation as appropriate.
7924         (Output_section::get_input_sections): Invalidate relaxed input section
7925         map.
7926         (Output_section::restore_states): Adjust type of checkpoint .
7927         Invalidate relaxed input section map.
7928         * output.h (Output_merge_base): New class declaration.
7929         (Input_section_specifier): New class defintion.
7930         (class Output_relaxed_input_section) Change base class to
7931         Output_section_data_build.
7932         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7933         base class initializer.
7934         (Output_section::add_relaxed_input_section): New method declaration.
7935         (Output_section::Input_section): Change visibility to protected.
7936         (Output_section::Input_section::relobj,
7937         Output_section::Input_section::shndx): Handle relaxed input sections.
7938         Output_section::input_sections) Change visibility to protected.  Also
7939         define overload to return a non-const pointer.
7940         (Output_section::Merge_section_properties): New class defintion.
7941         (Output_section::Merge_section_by_properties_map,
7942         Output_section::Output_section_data_by_input_section_map,
7943         Output_section::Relaxation_map): New types.
7944         (Output_section::relax_input_section): Rename method to
7945         Output_section::convert_input_sections_to_relaxed_sections and change
7946         interface to take a vector of relaxed section pointers.
7947         (Output_section::find_merge_section,
7948         Output_section::find_relaxed_input_section,
7949         Output_section::build_relaxation_map,
7950         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7951         New method declarations.
7952         (Output_section::merge_section_map_
7953         Output_section::merge_section_by_properties_map_,
7954         Output_section::relaxed_input_section_map_,
7955         Output_section::is_relaxed_input_section_map_valid_,
7956         Output_section::generate_code_fills_at_write_): New data members.
7957         * script-sections.cc
7958         (Output_section_element_input::set_section_addresses): Call
7959         current_data_size and addralign methods of relaxed input sections.
7960         (Orphan_output_section::set_section_addresses): Call current_data_size
7961         and addralign methods of relaxed input sections.
7962         * symtab.cc (Symbol_table::compute_final_value): Extract template
7963         from the body of Symbol_table::sized_finalize_symbol.
7964         (Symbol_table::sized_finalized_symbol): Call
7965         Symbol_table::compute_final_value.
7966         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7967         (Symbol_table::compute_final_value): New templated method declaration.
7968         * target.cc (Target::do_make_output_section): New method defintion.
7969         * target.h (Target::make_output_section): New method declaration.
7970         (Target::relax): Add more parameters for input objects, symbol table
7971         and layout.  Adjust call to do_relax.
7972         (Target::do_make_output_section): New method declaration.
7973         (Target::do_relax): Add parameters for input objects, symbol table
7974         and layout.
7975
7976 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7977
7978         * pread.c: Include stdio.h.
7979
7980 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7981
7982         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7983         defined.
7984
7985 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7986
7987         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7988         Change read_shndx type to unsigned int.
7989         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7990         int.
7991         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7992         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7993         Change read_shndx type to unsigned int.
7994         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7995         int.
7996         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7997         * layout.cc (Layout::create_symtab_sections): Cast the result of
7998         local_symcount * symsize to off_t in the gold_assert.
7999
8000 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8001
8002         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8003         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8004         R_ARM_BASE_ABS.
8005         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8006         (Arm_relocate_functions::thm_abs5): New function.
8007         (Arm_relocate_functions::abs12): New function.
8008         (Arm_relocate_functions::abs16): New function.
8009         (Arm_relocate_functions::base_abs): New function.
8010         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8011         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8012         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8013         R_ARM_BASE_ABS.
8014         (Scan::global): Likewise.
8015         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8016         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8017         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8018         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8019         R_ARM_BASE_ABS.
8020
8021 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8022
8023         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8024         (Arm_relocate_functions::movt_prel): New function.
8025         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8026         (Arm_relocate_functions::thm_movt_prel): New function.
8027         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8028         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8029         (Scan::global, Relocate::relocate): Likewise.
8030         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8031
8032 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8033
8034         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8035         Incremental_checker.
8036         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8037         unsigned int.
8038         (class Incremental_inputs_header): New class.
8039         (Incremental_inputs_header_writer): Edit comment.
8040         (Incremental_inputs_entry): New class.
8041         (Incremental_inputs_entry_writer): Edit comment.
8042         (Sized_incremental_binary::do_find_incremental_inputs_section):
8043         Add *strtab_shndx parameter, fill it.
8044         (Sized_incremental_binary::do_check_inputs): New method.
8045         (Incremental_checker::can_incrementally_link_output_file): Use
8046         Sized_incremental_binary::check_inputs.
8047         (Incremental_inputs::report_command_line): Save command line in
8048         command_line_.
8049         * incremental.h:
8050         (Incremental_binary::find_incremental_inputs_section): New
8051         method.
8052         (Incremental_binary::do_find_incremental_inputs_section): Add
8053         strtab_shndx parameter.
8054         (Incremental_binary::do_check_inputs): New pure virtual method.
8055         (Sized_incremental_binary::do_check_inputs): Declare.
8056         (Incremental_checker::Incremental_checker): Add incremental_inputs
8057         parameter, use it to initialize incremental_inputs_.
8058         (Incremental_checker::incremental_inputs_): New field.
8059         (Incremental_checker::command_line): New method.
8060         (Incremental_checker::inputs): New method.
8061         (Incremental_checker::command_line_): New field.
8062
8063 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8064
8065         * incremental.cc: Include <cstdarg> and "target-select.h".
8066         (vexplain_no_incremental): New function.
8067         (explain_no_incremental): New function.
8068         (Incremental_binary::error): New method.
8069         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8070         method.
8071         (make_sized_incremental_binary): New function.
8072         (open_incremental_binary): New function.
8073         (can_incrementally_link_file): Add checks if output is ELF and has
8074         inputs section.
8075         * incremental.h: Include "elfcpp_file.h" and "output.h".
8076         (Incremental_binary): New class.
8077         (Sized_incremental_binary): New class.
8078         (open_incremental_binary): Declare.
8079         * object.cc (is_elf_object): Use
8080         elfcpp::Elf_recognizer::is_elf_file.
8081         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8082         * output.h (Output_file::filesize): New method.
8083
8084 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8085
8086         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8087         New function.
8088         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8089         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8090         function.
8091         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8092         function.
8093         (Arm_relocate_functions::movw_abs_nc): New function.
8094         (Arm_relocate_functions::movt_abs): New function.
8095         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8096         (Arm_relocate_functions::thm_movt_abs): New function.
8097         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8098         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8099         (Scan::global): Likewise.
8100         (Relocate::relocate): Likewise.
8101         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8102
8103 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8104
8105         * arm.cc (Arm_relocate_functions::got_prel) New function.
8106         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8107         (Relocate::relocate): Likewise.
8108         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8109
8110 2009-10-06  Ian Lance Taylor  <iant@google.com>
8111
8112         * options.h (class General_options): Define
8113         split_stack_adjust_size parameter.
8114         * object.h (class Object): Add uses_split_stack_ and
8115         has_no_split_stack_ fields.  Add uses_split_stack and
8116         has_no_split_stack accessor functions.  Declare
8117         handle_split_stack_section.
8118         (class Reloc_symbol_changes): Define.
8119         (class Sized_relobj): Define Function_offsets.  Declare
8120         split_stack_adjust, split_stack_adjust_reltype, and
8121         find_functions.
8122         * object.cc (Object::handle_split_stack_section): New function.
8123         (Sized_relobj::do_layout): Call handle_split_stack_section.
8124         * dynobj.cc (Sized_dynobj::do_layout): Call
8125         handle_split_stack_section.
8126         * reloc.cc (Sized_relobj::relocate_sections): Call
8127         split_stack_adjust for executable sections in split_stack
8128         objects.  Pass reloc_map to relocate_section.
8129         (Sized_relobj::split_stack_adjust): New function.
8130         (Sized_relobj::split_stack_adjust_reltype): New function.
8131         (Sized_relobj::find_functions): New function.
8132         * target-reloc.h: Include "object.h".
8133         (relocate_section): Add reloc_symbol_changes parameter.  Change
8134         all callers.
8135         * target.h (class Target): Add calls_non_split method.  Declare
8136         do_calls_non_split virtual method.  Declare match_view and
8137         set_view_to_nop.
8138         * target.cc: Include "elfcpp.h".
8139         (Target::do_calls_non_split): New function.
8140         (Target::match_view): New function.
8141         (Target::set_view_to_nop): New function.
8142         * gold.cc (queue_middle_tasks): Give an error if mixing
8143         split-stack and non-split-stack objects with -r.
8144         * i386.cc (Target_i386::relocate_section): Add
8145         reloc_symbol_changes parameter.
8146         (Target_i386::do_calls_non_split): New function.
8147         * x86_64.cc (Target_x86_64::relocate_section): Add
8148         reloc_symbol_changes parameter.
8149         (Target_x86_64::do_calls_non_split): New function.
8150         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8151         parameter.
8152         * powerpc.cc (Target_powerpc::relocate_section): Add
8153         reloc_symbol_changes parameter.
8154         * sparc.cc (Target_sparc::relocate_section): Add
8155         reloc_symbol_changes parameter.
8156         * configure.ac: Call AM_CONDITIONAL for the default target.
8157         * configure: Rebuild.
8158         * testsuite/Makefile.am (TEST_AS): New variable.
8159         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8160         (check_DATA): Add split_i386 and split_x86_64 files.
8161         (SPLIT_DEFSYMS): Define.
8162         (split_i386_[1234n].o): New targets.
8163         (split_i386_[124]): New targets.
8164         (split_i386_[1234r].stdout): New targets.
8165         (split_x86_64_[1234n].o): New targets.
8166         (split_x86_64_[124]): New targets.
8167         (split_x86_64_[1234r].stdout): New targets.
8168         (MOSTLYCLEANFILES): Add new executables.
8169         * testsuite/split_i386.sh: New file.
8170         * testsuite/split_x86_64.sh: New file.
8171         * testsuite/split_i386_1.s: New file.
8172         * testsuite/split_i386_2.s: New file.
8173         * testsuite/split_i386_3.s: New file.
8174         * testsuite/split_i386_4.s: New file.
8175         * testsuite/split_i386_n.s: New file.
8176         * testsuite/split_x86_64_1.s: New file.
8177         * testsuite/split_x86_64_2.s: New file.
8178         * testsuite/split_x86_64_3.s: New file.
8179         * testsuite/split_x86_64_4.s: New file.
8180         * testsuite/split_x86_64_n.s: New file.
8181         * testsuite/testfile.cc (Target_test): Update relocation_section
8182         function.
8183         * testsuite/Makefile.in: Rebuild.
8184
8185 2009-10-06  Ian Lance Taylor  <iant@google.com>
8186
8187         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8188         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8189         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8190         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8191         the address on ldo_addrs_.
8192         (Target_i386::Relocate::fix_up_ldo): New function.
8193
8194 2009-10-06   Rafael Espindola  <espindola@google.com>
8195
8196         * plugin.cc (add_input_library): New.
8197         (Plugin::load): Add add_input_library to tv.
8198         (Plugin_manager::add_input_file): Add the is_lib argument.
8199         (add_input_file): Update call to Plugin_manager::add_input_file.
8200         (add_input_library): New.
8201         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8202
8203 2009-09-30  Doug Kwan  <dougkwan@google.com>
8204
8205         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8206         symbol and call Symbol::may_need_copy_reloc to determine if
8207         a copy reloc is needed.
8208         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8209         nocopyreloc is given in command line.
8210         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8211         given in command line.
8212         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8213         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8214         of the removed Target_i386::may_need_copy_reloc.
8215         * options.h (copyreloc): New option with default value false.
8216         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8217         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8218         instead of the removed Target_powerpc::may_need_copy_reloc.
8219         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8220         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8221         instead of the removed Target_sparc::may_need_copy_reloc.
8222         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8223         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8224         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8225         instead of the removed Target_x86_64::may_need_copy_reloc.
8226
8227 2009-09-30  Ian Lance Taylor  <iant@google.com>
8228
8229         * object.h (class Object): Remove target_ field, and target,
8230         sized_target, and set_target methods.
8231         (Object::sized_target): Remove.
8232         (class Sized_relobj): Update declarations.  Remove sized_target.
8233         * object.cc (Sized_relobj::setup): Remove target parameter.
8234         Change all callers.
8235         (Input_objects::add_object): Don't do anything with the target.
8236         (make_elf_sized_object): Add punconfigured parameter.  Change all
8237         callers.  Set or test parameter target.
8238         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8239         Change all callers.
8240         * parameters.cc (Parameters::set_target): Change parameter type to
8241         be non-const.
8242         (Parameters::default_target): Remove.
8243         (set_parameters_target): Change parameter type to be non-const.
8244         (parameters_force_valid_target): New function.
8245         (parameters_clear_target): New function.
8246         * parameters.h (class Parameters): Update declarations.  Remove
8247         default_target method.  Add sized_target and clear_target
8248         methods.  Change target_ to be non-const.
8249         (set_parameters_target): Update declaration.
8250         (parameters_force_valid_target): Declare.
8251         (parameters_clear_target): Declare.
8252         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8253         as NULL if we aren't searching.
8254         (Add_symbols::run): Don't check for compatible target.
8255         * fileread.cc (Input_file::open_binary): Call
8256         parameters_force_valid_target.
8257         * gold.cc (queue_middle_tasks): Likewise.
8258         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8259         set_target on object.
8260         * dynobj.h (class Sized_dynobj): Update declarations.
8261         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8262         make_elf_object returns NULL.
8263         (Archive::include_member): Don't check whether object target is
8264         compatible.
8265         * output.cc (Output_section::add_input_section): Get target from
8266         parameters.
8267         (Output_section::relax_input_section): Likewise.
8268         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8269         parameters.
8270         (Sized_relobj::do_scan_relocs): Likewise.
8271         (Sized_relobj::relocate_sections): Likewise.
8272         * resolve.cc (Symbol_table::resolve): Likewise.
8273         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8274         parameter.  Change all callers.
8275         (Symbol_table::add_from_object): Get target from parameters.
8276         (Symbol_table::add_from_relobj): Don't check object target.
8277         (Symbol_table::add_from_dynobj): Likewise.
8278         (Symbol_table::define_special_symbol): Get target from
8279         parameters.
8280         * symtab.h (class Symbol_table): Update declaration.
8281         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8282         parameter.  Change all callers.  Clear parameter target.
8283         (Binary_test): Test target here.
8284         * testsuite/object_unittest.cc (gold_testsuite): Remove
8285         target_test_pointer parameter.  Change all callers.
8286         (Object_test): Test target here.
8287
8288 2009-09-26  Ian Lance Taylor  <iant@google.com>
8289
8290         * testsuite/initpri1.c: Don't try to use constructor priorities if
8291         compiling with gcc before 4.3.
8292
8293 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8294
8295         * testsuite/retain_symbols_file_test.sh (check_present): Change
8296         output file name to retain_symbols_file_test.stdout.
8297         (check_absent): Likewise.
8298
8299 2009-09-18  Craig Silverstein  <csilvers@google.com>
8300
8301         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8302         * options.cc: Include <cerrno> and <fstream>.
8303         (General_options::finalize): Parse -retain-symbols-file tag.
8304         * options.h: New flag.
8305         (General_options): New method should_retain_symbol, new
8306         variable symbols_to_retain.
8307         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8308         should_retain_symbol map.
8309         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8310         * testsuite/Makefile.in: Regenerate.
8311         * testsuite/retain_symbols_file_test.sh: New file.
8312
8313 2009-09-18  Nick Clifton  <nickc@redhat.com>
8314
8315         * po/es.po: Updated Spanish translation.
8316
8317 2009-09-17  Doug Kwan  <dougkwan@google.com>
8318
8319         * debug.h (DEBUG_RELAXATION): New constant.
8320         (DEBUG_ALL): Add DEBUG_RELAXATION.
8321         (debug_string_to_enum): Add relaxation debug option.
8322         * layout.cc
8323         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8324         Layout::Relaxation_debug_check::read_sections,
8325         Layout::Relaxation_debug_check::read_sections): New method definitions.
8326         (Layout::Layout): Initialize data members
8327         record_output_section_data_from_scrips_,
8328         script_output_section_data_list_ and relaxation_debug_check_.
8329         (Layout::save_segments, Layout::restore_segments,
8330         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8331         Layout::relaxation_loop_body): New method definitions.
8332         (Layout::finalize): Support relaxation.  Move section layout code to
8333         Layout::relaxation_loop_body.
8334         (Layout::set_asection_address_from_script): Move code for orphan
8335         section placement out.
8336         (Layout::place_orphan_sections_in_script): New method definition.
8337         * layout.h (Output_segment_headers, Output_file_header):
8338         New forward class declarations.
8339         (Layout::~Layout): Define.
8340         (Layout::new_output_section_data_from_script): New method definition.
8341         (Layout::place_orphan_sections_in_script): New method declaration.
8342         (Layout::Segment_states): New type declaration.
8343         (Layout::save_segments, Layout::restore_segments,
8344         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8345         Layout::relaxation_loop_body): New method declarations.
8346         (Layout::Output_section_data_list): New type declaration.
8347         (Layout::Relaxation_debug_check): New class definition.
8348         (Layout::record_output_section_data_from_script_,
8349         Layout::script_output_section_data_list_, Layout::segment_states_,
8350         Layout::relaxation_debug_check_): New data members.
8351         * output.cc: (Output_section_headers::do_size): New method definition.
8352         (Output_section_headers::Output_section_headers): Move size
8353         computation to Output_section_headers::do_size.
8354         (Output_segment_headers::do_size): New method definition.
8355         (Output_file_header::Output_file_header): Move size computation to
8356         Output_file_header::do_size and call it.
8357         (Output_file_header::do_size): New method definition.
8358         (Output_data_group::Output_data_group): Adjust call to
8359         Output_section_data.
8360         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8361         (Output_symtab_xindex::do_write): Add array bound check.
8362         (Output_section::Input_section::print_to_mapfile): Handle
8363         RELAXED_INPUT_SECTION_CODE.
8364         (Output_section::Output_section): Initialize data member checkpoint_.
8365         (Output_section::~Output_section): Delete checkpoint object pointed
8366         by checkpoint_.
8367         (Output_section::add_input_section): Always add an Input_section if
8368         relaxing.
8369         (Output_section::add_merge_input_section): Add assert.
8370         (Output_section::relax_input_section): New method definition.
8371         (Output_section::set_final_data_size): Set load address to zero for
8372         an unallocated section.
8373         (Output_section::do_address_and_file_offset_have_reset_values):
8374         New method definition.
8375         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8376         Handle relaxed input section.
8377         (Output_section::sort_attached_input_sections): Checkpoint input
8378         section list lazily.
8379         (Output_section::get_input_sections): Change type of input_sections to
8380         list of Simple_input_section pointers.  Checkpoint input section list
8381         lazily.  Also handle relaxed input sections.
8382         (Output_section::add_input_section_for_script): Take a reference to
8383         a Simple_input_section object instead of Relobj pointer and section
8384         index as parameter.  Handle relaxed input sections.
8385         (Output_section::save_states, Output_section::restore_states): New
8386         method definitions.
8387         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8388         (Output_data::is_data_size_fixed): New method definition.
8389         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8390         if it is fixed.
8391         (Output_data::address_and_file_offset_have_reset_values): New method
8392         definition.
8393         (Output_data::do_address_and_file_offset_have_reset_values): New method
8394         definition.
8395         (Output_data::set_data_size): Check that data size is not fixed.
8396         (Output_data::fix_data_size): New method definition.
8397         (Output_data::is_data_size_fixed_): New data member.
8398         (Output_section_headers::set_final_data_size): New method definition.
8399         (Output_section_headers::do_size): New method declaration.
8400         (Output_segment_headers::set_final_data_size): New method definition.
8401         (Output_segment_headers::do_size): New method declaration.
8402         (Output_file_header::set_final_data_size)::New method definition.
8403         (Output_file_header::do_size)::New method declaration.
8404         (Output_section_data::Output_section_data): Add new parameter
8405         is_data_size_fixed and use it to fix data size.
8406         (Output_data_const::Output_data_const): Adjust call to base class
8407         constructor and fix data size.
8408         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8409         base class constructor and fix data size.
8410         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8411         base class constructor and fix data size.
8412         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8413         class constructor and fix data size.
8414         (Output_data_group::set_final_data_size): New method definition.
8415         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8416         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8417         class constructor and fix data size.
8418         (Output_relaxed_input_section): New class definition.
8419         (Output_section::Simple_input_section): New class definition.
8420         (Output_section::get_input_sections): Adjust parameter list.
8421         (Output_section::add_input_section_for_script): Same.
8422         (Output_section::save_states, Output_section::restore_states,
8423         Output_section::do_address_and_file_offset_have_reset_values,
8424         (Output_section::Input_section::Input_section): Handle
8425         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8426         Output_relaxed_input_section.
8427         (Output_section::Input_section::is_input_section,
8428         Output_section::Input_section::set_output_section): Handle relaxed
8429         input section.
8430         (Output_section::Input_section::is_relaxed_input_section,
8431         Output_section::Input_section::output_section_data,
8432         Output_section::Input_section::relaxed_input_section): New method
8433         definitions.
8434         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8435         value.
8436         (Output_section::Input_section::u1_): Update comments.
8437         (Output_section::Input_section::u2_): Add new union member poris.
8438         (Output_section::Checkpoint_output_section): New classs definition.
8439         (Output_section::relax_input_section): New method declaration.
8440         (Output_section::checkpoint_): New data member.
8441         (Output_segment): Update comments.
8442         (Output_segment::Output_segment): Un-privatize copy constructor.
8443         (Output_segment::operator=): Un-privatize.
8444         * script-sections.cc (Output_section_element::Input_section_list):
8445         Change element type to Output_section::Simple_input_section.
8446         (Output_section_element_dot_assignment::set_section_addresses):
8447         Register output section data for relaxation clean up.
8448         (Output_data_exression::Output_data_expression): Adjust call to base
8449         constructor to fix data size.
8450         (Output_section_element_data::set_section_addresses): Register
8451         Output_data_expression object for relaxation clean up.
8452         (struct Input_section_info): Replace Relobj pointer and section index
8453         pair with Output_section::Simple_input_section and Convert struct to a
8454         class.
8455         (Input_section_sorter::operator()): Adjust access to
8456         Input_section_info data member to use accessors.
8457         (Output_section_element_input::set_section_addresses): Use layout
8458         parameter.  Adjust code to use Output_section::Simple_input_section
8459         and Input_secction_info classes.  Register filler for relaxation
8460         clean up.
8461         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8462         and section index pair with Output_section::Simple_input_section
8463         class.  Adjust code accordingly.
8464         (Phdrs_element::release_segment): New method definition.
8465         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8466         segment list.
8467         (Script_sections::release_segments): New method definition.
8468         * gold/script-sections.h (Script_sections::release_segments): New
8469         method declaration.
8470         * gold/target.h (Target::may_relax, Target::relax,
8471         Target::do_may_relax, Target::do_relax): New method definitions.
8472
8473 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8474
8475         * arm.cc (has_signed_unsigned_overflow): New function.
8476         (Arm_relocate_functions::abs8): New function.
8477         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8478         (Target_arm::Scan::global): Likewise.
8479         (Target_arm::relocate::relocate): Likewise.
8480         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8481         Likewise.
8482
8483 2009-09-16  Cary Coutant  <ccoutant@google.com>
8484
8485         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8486         * testsuite/Makefile.in: Regenerate.
8487
8488 2009-09-11  Nick Clifton  <nickc@redhat.com>
8489
8490         * po/gold.pot: Updated by the Translation project.
8491
8492 2009-09-08  Cary Coutant  <ccoutant@google.com>
8493
8494         * output.cc (Output_file::open): Add execute permission to empty file.
8495         * testsuite/Makefile.am (permission_test): New test.
8496         * testsuite/Makefile.in: Regenerate.
8497
8498 2009-09-02  Ian Lance Taylor  <iant@google.com>
8499
8500         * output.cc (Output_file::resize): Call map_no_anonymous rather
8501         than map.
8502
8503 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8504
8505         * gold.cc: Include "incremental.h".
8506         (queue_initial_tasks): Call Incremental_checker methods.
8507         * incremental.cc: Include "output.h".
8508         (Incremental_checker::can_incrementally_link_output_file): New
8509         method.
8510         * incremental.h (Incremental_checker): New class.
8511
8512         * output.cc (Output_file::open_for_modification): New method.
8513         (Output_file::map_anonymous): Changed return type to bool.  Record
8514         map in base_ field.
8515         (Output_file::map_no_anonymous): New method, broken out of map.
8516         (Output_file::map): Use map_no_anonymous and map_anonymous.
8517         * output.h (class Output_file): Update declarations.
8518
8519 2009-08-24  Cary Coutant  <ccoutant@google.com>
8520
8521         * options.h (Command_line::Pre_options): New class.
8522         (Command_line::pre_options): New member.
8523         * options.cc (gold::options::ready_to_register): New variable.
8524         (One_option::register_option): Do nothing if not registering options.
8525         Assert if same short option registered twice.
8526         (General_options::General_options): Turn off option registration when
8527         done constructing.
8528         (Command_line::Pre_options::Pre_options): New constructor.
8529
8530 2009-08-24  Cary Coutant  <ccoutant@google.com>
8531
8532         * options.h (General_options::no_keep_memory): Remove incorrect
8533         short option.
8534
8535 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8536
8537         * Makefile.am (am__skiplex, am__skipyacc): New.
8538         * Makefile.in: Regenerate.
8539
8540 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8541
8542         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8543         (INCLUDES): ... this.
8544         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8545         (AM_CPPFLAGS): Renamed from ...
8546         (INCLUDE): ... this.
8547         * Makefile.in, testsuite/Makefile.in: Regenerate.
8548
8549         * Makefile.in: Regenerate.
8550         * aclocal.m4: Likewise.
8551         * config.in: Likewise.
8552         * configure: Likewise.
8553         * testsuite/Makefile.in: Likewise.
8554
8555         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8556         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8557         * Makefile.in: Regenerate.
8558         * testsuite/Makefile.in: Regenerate.
8559
8560 2009-08-19  Cary Coutant  <ccoutant@google.com>
8561
8562         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8563         symbols in shared libraries overridden by hidden or internal symbols
8564         in the main program.
8565
8566 2009-08-19  Chris Demetriou  <cgd@google.com>
8567
8568         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8569         checking source file names in error messages.
8570
8571 2009-08-18  Doug Kwan  <dougkwan@google.com>
8572
8573         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8574         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8575         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8576         an elfcpp::Ehdr as parameter.
8577         * object.cc (Object::set_target): Remove the version that looks up
8578         a target and sets it.
8579         (Sized_relobj::setup): Take a Target object instead of
8580         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8581         (make_elf_sized_object): Find target and ask target to
8582         make an ELF object.
8583         * object.h: (Object::set_target): Remove the version that looks up
8584         a target and sets it.
8585         (Sized_relobj::setup): Take a Target object instead of
8586         an elfcpp:Ehdr as parameter.
8587         * target.cc: Include dynobj.h.
8588         (Target::do_make_elf_object_implementation): New.
8589         (Target::do_make_elf_object): New.
8590         * target.h (Target::make_elf_object): New template declaration.
8591         (Target::do_make_elf_object): New method declarations.
8592         (Target::do_make_elf_object_implementation): New template declaration.
8593
8594 2009-08-14  Ian Lance Taylor  <iant@google.com>
8595
8596         * gold.h (FUNCTION_NAME): Define.
8597         (gold_unreachable): Use FUNCTION_NAME.
8598
8599 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8600
8601         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8602         symbol in the --keep-unique list is not found.
8603
8604 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8605
8606         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8607         been maked as --keep-unique.
8608         (Icf::unfold_section): New function.
8609         * icf.h (Icf::unfold_section): New function.
8610         * options.h (General_options::keep_unique): New option.
8611         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8612         * testsuite/Makefile.in: Regenerate.
8613         * testsuite/icf_keep_unique_test.sh: New file.
8614         * testsuite/icf_keep_unique_test.cc: New file.
8615
8616 2009-08-12  Cary Coutant  <ccoutant@google.com>
8617
8618         PR 10471
8619         * resolve.cc (Symbol_table::resolve): Check for references from
8620         dynamic objects to hidden and internal symbols.
8621         * testsuite/Makefile.am (hidden_test.sh): New test.
8622         * testsuite/Makefile.in: Regenerate.
8623         * testsuite/hidden_test.sh: New script.
8624         * testsuite/hidden_test_1.c: New test source.
8625         * testsuite/hidden_test_main.c: New test source.
8626
8627 2009-08-11  Doug Kwan  <dougkwan@google.com>
8628
8629         * arm.cc: Update comments.
8630         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8631         segment to locate the .ARM.exidx section if present.
8632
8633 2009-08-09  Doug Kwan  <dougkwan@google.com>
8634
8635         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8636         patch.
8637
8638 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8639         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8640         compiler warnings.
8641
8642 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8643
8644         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8645         valid tls_segment only for non-debug-section relocations.
8646         * testsuite/Makefile.am: Add gc_tls_test.
8647         * testsuite/Makefile.in: Regenerate.
8648         * testsuite/gc_tls_test.cc: New file.
8649         * testsuite/gc_tls_test.sh: New file.
8650
8651 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8652
8653         * icf.cc: New file.
8654         * icf.h: New file.
8655         * Makefile.am (CCFILES): Add icf.cc.
8656         (HFILES): Add icf.h
8657         * Makefile.in: Regenerate.
8658         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8659         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8660         section, symbol and addend information for the relocs.
8661         * gold.cc (queue_middle_tasks): Call identical code folding.
8662         * gold.h: Add defines for multimap.
8663         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8664         to the call of finalize_local_symbols.
8665         * main.cc (main): Create object of class Icf.
8666         * object.cc (Sized_relobj::do_layout): Allow this function to be
8667         called twice during icf.
8668         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8669         to sections marked as identical by icf.
8670         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8671         when available.
8672         (Sized_relobj::do_section_entsize): New function.
8673         * object.h (Object::section_entsize): New function.
8674         (Object::do_section_entsize): New pure virtual function.
8675         (Relobj::finalize_local_symbols): Add new parameter.
8676         (Relobj::do_section_entsize): New function.
8677         * options.h (General_options::icf): New option.
8678         (General_options::icf_iterations): New option.
8679         (General_options::print_icf_sections): New option.
8680         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8681         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8682         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8683         icf.
8684         * symtab.cc (Symbol_table::is_section_folded): New function.
8685         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8686         to sections marked as identical by icf.
8687         * symtab.h (Symbol_table::set_icf): New function.
8688         (Symbol_table::icf): New function.
8689         (Symbol_table::is_section_folded): New function.
8690         (Symbol_table::icf_): New data member.
8691         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8692         * testsuite/Makefile.am: Add commands to build icf_test.
8693         * testsuite/Makefile.in: Regenerate.
8694         * testsuite/icf_test.sh: New file.
8695         * testsuite/icf_test.cc: New file.
8696
8697 2009-07-24  Chris Demetriou  <cgd@google.com>
8698
8699         * layout.cc (is_compressible_debug_section): Fix incorrect
8700         comment about compressed section names.
8701
8702 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8703
8704         PR 10419
8705         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8706
8707 2009-07-16  Ian Lance Taylor  <iant@google.com>
8708
8709         PR 10400
8710         * layout.h: #include <map>.
8711         (class Kept_section): Change from struct to class.  Add accessors
8712         and setters.  Add section size to Comdat_group mapping.  Change
8713         Comdat_group to std::map.  Add is_comdat_ field.  Add
8714         linkonce_size field in union.
8715         (class Layout): Update declaration of find_or_add_kept_section.
8716         Don't declare find_kept_object.
8717         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8718         parameter.  Add object, shndx, is_comdat, and is_group_name
8719         parameters.  Change all callers.  Adjust for new Kept_section.
8720         (Layout::find_kept_object): Remove.
8721         * object.cc (Sized_relobj::include_section_group): Update use of
8722         Kept_section.  Rename secnum to shndx.  Only record
8723         Kept_comdat_section if sections are the same size.
8724         (Sized_relobj::include_linkonce_section): Update use of
8725         Kept_section.  Only record Kept_comdat_section if sections are the
8726         same size.  Set size of linkonce section.
8727         (Sized_relobj::map_to_kept_section): Update call to
8728         get_kept_comdat_section.
8729         * object.h (class Sized_relobj): Rename fields in
8730         Kept_comdat_section to drop trailing underscores; change object
8731         field to Relobj*.  Change Kept_comdat_section_table to store
8732         struct rather than pointer.
8733         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8734         Add kept_object and kept_shndx parameters.  Change all callers.
8735         (Sized_relobj::get_kept_comdat_section): Change return type to
8736         bool.  Add kept_object and kept_shndx parameters.  Change all
8737         callers.
8738         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8739         Layout::find_or_add_kept_section.
8740
8741 2009-07-09  Ian Lance Taylor  <iant@google.com>
8742
8743         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8744         Reserve space in the hash table.
8745
8746 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8747
8748         * fileread.cc (File_read::get_mtime): New method.
8749         * fileread.h (Timespec): New structure.
8750         (File_read::get_mtime): New method.
8751         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8752         Renamed from timestamp_nsec.
8753         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8754         Elf_Xword.
8755         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8756         timestamp_nsec.
8757         (Incremental_inputs::report_archive): Save mtime; style fix.
8758         (Incremental_inputs::report_obejct): Save mtime; style fix.
8759         (Incremental_inputs::report_script): Save mtime; style fix.
8760         (Incremental_inputs::finalize_inputs): Style fix.
8761         (Incremental_inputs::finalize): Style fix.
8762         (Incremental_inputs::create_input_section_data): Store inputs
8763         mtime.
8764         * incremental.h (Incremental_inputs::report_script): Add mtime
8765         argument.
8766         (Incremental_inputs::Input_info::Input_info): Intialize only one
8767         union member.
8768         (Incremental_inputs::Input_info::archive): Move to nameless
8769         union.
8770         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8771         (Incremental_inputs::Input_info::script): Move to nameless union.
8772         (Incremental_inputs::mtime): New field.
8773         * script.cc (read_input_script): Pass file mtime to
8774         Incremental_input.
8775         * script.h (Script_info::inputs): Style fix.
8776
8777 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8778
8779         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8780         instead of 32.
8781
8782 2009-06-24  Ian Lance Taylor  <iant@google.com>
8783
8784         PR 10156
8785         * layout.cc (Layout::choose_output_section): If we find an
8786         existing section, update the flags.
8787         (Layout::create_notes): New function, broken out of
8788         Layout::finalize.
8789         (Layout::finalize): Don't create note sections.
8790         (Layout::create_note): Don't crash if linker script discards
8791         section.
8792         (Layout::create_gold_note): Likewise.
8793         (Layout::create_build_id): Likewise.  Don't set
8794         after_input_sections on the section.
8795         (Layout::create_executable_stack_info): Remove target parameter.
8796         Change caller.
8797         * layout.h (class Layout): Declare create_notes.  Update
8798         declaration of create_executable_stack_info.
8799         * gold.cc (queue_middle_tasks): Call create_notes.
8800         * output.cc (Output_section::update_flags_for_input_section): Move
8801         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8802         invalid.
8803         * output.h (Output_data::mark_address_invalid): New function.
8804         (class Output_section): Only declare, not define,
8805         update_flags_for_input_section.  Remove set_flags.
8806
8807 2009-06-24  Ian Lance Taylor  <iant@google.com>
8808
8809         * script-sections.cc (Output_section_definition::
8810         set_section_addresses): Rename shadowing local load_address to
8811         laddr.
8812
8813 2009-06-24  Ian Lance Taylor  <iant@google.com>
8814
8815         PR 10244
8816         * reloc.cc (relocate_sections): Skip empty relocation sections.
8817
8818 2009-06-23  Ian Lance Taylor  <iant@google.com>
8819
8820         PR 10156
8821         * layout.cc (Layout::create_note): Use choose_output_section
8822         rather than make_output_section.
8823
8824 2009-06-23  Ian Lance Taylor  <iant@google.com>
8825
8826         PR 10237
8827         * options.cc (General_options::parse_V): Set printed_version_.
8828         (General_options::General_options): Initialize printed_version_.
8829         * options.h (class General_options): Add printed_version_ field.
8830         * gold.cc (queue_initial_tasks): If there are no input files,
8831         don't give a fatal error if we printed the version information.
8832         (queue_middle_tasks): If using -r with a shared object, give a
8833         fatal error rather than an ordinary error.
8834
8835 2009-06-23  Ian Lance Taylor  <iant@google.com>
8836
8837         PR 10219
8838         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8839         (Layout::make_output_section): Set have_stabstr_section_ if we see
8840         a .stab*str section.
8841         (Layout::finalize): Call link_stabs_sections.
8842         (Layout::link_stabs_sections): New file.
8843         * layout.h (class Layout): Add have_stabstr_section_ field.
8844         Declare link_stabs_sections.
8845
8846 2009-06-23  Doug Kwan  <dougkwan@google.com>
8847
8848         * Makefile.am (libgold_a_LIBADD): New.
8849         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8850         * Makefile.in: Regenerate.
8851         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8852         * configure: Regenerate.
8853         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8854         * fileread.cc: Include sys/state.h
8855         * gold.h: Declare memmem and strndup if found missing.
8856         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8857
8858 2009-06-23  Ian Lance Taylor  <iant@google.com>
8859
8860         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8861         * configure: Rebuild.
8862
8863 2009-06-23  Ian Lance Taylor  <iant@google.com>
8864
8865         PR 10147
8866         * object.cc (Object::section_contents): Don't try to get a view if
8867         the section has length zero.
8868         (Object::handle_gnu_warning_section): If the section is empty, use
8869         the name of the section as the warning.
8870
8871 2009-06-23  Ian Lance Taylor  <iant@google.com>
8872
8873         PR 10133
8874         * stringpool.h (class Stringpool_template): Add optimize_ field.
8875         (Stringpool_template::set_optimize): New function.
8876         * stringpool.cc (Stringpool_template::Stringpool_template):
8877         Initialize optimize_ field.
8878         (Stringpool_template::set_string_offsets): Test local optimize
8879         fild rather than parameter.
8880         * layout.cc (Layout::Layout): Call set_optimize on the section
8881         name stringpool.
8882
8883 2009-06-22  Ian Lance Taylor  <iant@google.com>
8884
8885         PR 10030
8886         * yyscript.y: Parse TARGET.
8887         * script.cc (script_set_target): New function.
8888         * script-c.h (script_set_target): Declare.
8889         * options.cc (General_options::string_to_object_format): Rename
8890         from string_to_object_format in anonymous namespace.  Change
8891         callers.
8892         * options.h (class General_options): Declare
8893         string_to_object_format.
8894
8895 2009-06-22  Ian Lance Taylor  <iant@google.com>
8896
8897         * script-sections.cc (Script_sections::create_segments): Don't put
8898         program headers in a PT_LOAD segment if -n or -N.
8899
8900 2009-06-22  Ian Lance Taylor  <iant@google.com>
8901
8902         PR 10141
8903         * options.h (class General_options): Add -z lazy and -z now.  Sort
8904         -z options into alphabetical order.
8905         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8906
8907 2009-06-21  Ian Lance Taylor  <iant@google.com>
8908
8909         * layout.cc (Layout::make_output_section): Call
8910         Target::new_output_section.
8911         (Layout::attach_allocated_section_to_segment): Put large section
8912         sections in a separate load segment with the large segment flag
8913         set.
8914         (Layout::segment_precedes): Sort large data segments after other
8915         load segments.
8916         (align_file_offset): New static function.
8917         (Layout::set_segment_offsets): Use align_file_offset.
8918         * output.h (class Output_section): Add is_small_section_ and
8919         is_large_section_ fields.
8920         (Output_section::is_small_section): New function.
8921         (Output_section::set_is_small_section):  New function.
8922         (Output_section::is_large_section): New function.
8923         (Output_section::set_is_large_section): New function.
8924         (Output_section::is_large_data_section): New function.
8925         (class Output_segment): Add is_large_data_segment_ field.
8926         (Output_segment::is_large_data_segment): New function.
8927         (Output_segment::set_is_large_data_segment): New function.
8928         * output.cc (Output_section::Output_section): Initialize new
8929         fields.
8930         (Output_segment::Output_segment): Likewise.
8931         (Output_segment::add_output_section): Add assertion that large
8932         data sections always go in large data segments.  Force small data
8933         sections to the end of the list of data sections.  Force small BSS
8934         sections to the start of the list of BSS sections.  For large BSS
8935         sections to the end of the list of BSS sections.
8936         * symtab.h (class Symbol): Declare is_common_shndx.
8937         (Symbol::is_defined): Check Symbol::is_common_shndx.
8938         (Symbol::is_common): Likewise.
8939         (class Symbol_table): Define enum Commons_section_type.  Update
8940         declarations.  Add small_commons_ and large_commons_ fields.
8941         * symtab.cc (Symbol::is_common_shndx): New function.
8942         (Symbol_table::Symbol_table): Initialize new fields.
8943         (Symbol_table::add_from_object): Put small and large common
8944         symbols in the right list.
8945         (Symbol_table::sized_finalized_symbol): Check
8946         Symbol::is_common_shndx.
8947         (Symbol_table::sized_write_globals): Likewise.
8948         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8949         common symbol lists.  Don't call do_allocate_commons_list if the
8950         list is empty.
8951         (Symbol_table::do_allocate_commons_list): Remove is_tls
8952         parameter.  Add comons_section_type parameter.  Change all
8953         callers.  Handle small and large common symbols.
8954         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8955         Symbol::is_common_shndx.
8956         * resolve.cc (symbol_to_bits): Likewise.
8957         * target.h (Target::small_common_shndx): New function.
8958         (Target::small_common_section_flags): New function.
8959         (Target::large_common_shndx): New function.
8960         (Target::large_common_section_flags): New function.
8961         (Target::new_output_section): New function.
8962         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8963         small_common_section_flags, and large_common_section_flags
8964         fields.
8965         (Target::do_new_output_section): New virtual function.
8966         * arm.cc (Target_arm::arm_info): Initialize new fields.
8967         * i386.cc (Target_i386::i386_info): Likewise.
8968         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8969         Likewise.
8970         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8971         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8972         (Target_x86_64::do_new_output_section): New function.
8973         * configure.ac: Define conditional MCMODEL_MEDIUM.
8974         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8975         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8976         (large_LDFLAGS): Define.
8977         * testsuite/large.c: New file.
8978         * testsuite/testfile.cc (Target_test::test_target_info):
8979         Initialize new fields.
8980         * configure, testsuite/Makefile.in: Rebuild.
8981
8982 2009-06-05  Doug Kwan  <dougkwan@google.com>
8983
8984         * Makefile.am (CCFILES): Add target.cc.
8985         * Makefile.in: Regenerate.
8986         * i386.cc (class Target_i386): Define new virtual method to
8987         override do_is_local_label_name in parent.
8988         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8989         local symbols if --discard-locals or -X is given.
8990         * options.h (class General_options): Declare new options
8991         '--discard-locals' and '-X' for discarding locals.
8992         * target.h (class Target): Define new methods is_local_label_name.
8993         Declare new virtual method do_is_local_label_name.
8994         * target.cc: New file.
8995         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8996         (check_SCRIPTS): Add discard_locals_test.sh.
8997         (check_DATA): Add discard_local_tests.syms.
8998         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8999         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9000         * testsuite/Makefile.in: Regenerate.
9001         * testsuite/discard_locals_test.c: New file.
9002         * testsuite/discard_locals_test.sh: Same.
9003
9004 2009-06-05  Doug Kwan  <dougkwan@google.com>
9005
9006         * object.cc (Sized_relobj::Sized_relobj): Initialize
9007         discarded_eh_frame_shndx_ to -1U.
9008         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9009         section.
9010         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9011         a discarded .eh_frame section.
9012         (Sized_relobj::do_finalize_local_symbols): Ditto.
9013         * object.h (class Sized_relobj): Declare new member
9014         discarded_eh_frame_shndx_.
9015         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9016         (local_labels_test.o, local_labels_test): New rules.
9017         * testsuite/Makefile.in: Regenerate.
9018
9019 2009-06-04  Doug Kwan  <dougkwan@google.com>
9020
9021         * layout.cc (Layout::section_name_mapping): Add mapping for
9022         special ARM sections.
9023
9024 2009-06-03  Doug Kwan  <dougkwan@google.com>
9025
9026         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9027         (utils::has_overflow): Same.
9028
9029 2009-06-03  Ian Lance Taylor  <iant@google.com>
9030
9031         * layout.cc (Layout::section_name_mapping): New array, replacing
9032         Layout::linkonce_mapping.
9033         (Layout::section_name_mapping_count): New variable, replacing
9034         Layout::linkonce_mapping_count.
9035         (Layout::linkonce_output_name): Remove.
9036         (Layout::output_section_name): Rewrite.
9037         * layout.h (class Layout): Rename Linkonce_mapping to
9038         Section_name_mapping, linkonce_mapping to section_name_mapping,
9039         linkonce_mapping_count to section_name_mapping_count.  Don't
9040         declare linkonce_output_name.
9041
9042 2009-06-03  Doug Kwan  <dougkwan@google.com>
9043
9044         * gold/arm.cc (namespace utils): New.
9045         (Target_arm::reloc_is_non_pic): Define new method.
9046         (class Arm_relocate_functions): New.
9047         (Target_arm::Relocate::relocate): Handle relocation types used by
9048         Android.
9049
9050 2009-06-03  Ian Lance Taylor  <iant@google.com>
9051
9052         * arm.cc (Target_arm::scan::global): Use || instead of |.
9053
9054 2009-06-02  Doug Kwan  <dougkwan@google.com>
9055
9056         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9057         issued_non_pic_error_.
9058         (class Target_arm::Scan): Declare new method check_non_pic.
9059         Define new method symbol_needs_plt_entry.
9060         Declare new data member issued_non_pic_error_.
9061         (class Target_arm::Relocate): Declare new method
9062         should_apply_static_reloc.
9063         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9064         (Target_arm::Scan::check_non_pic): Define new method.
9065         (Target_arm::Scan::local): Handle a small subset of reloc types used
9066         by Android.
9067         (Target_arm::Scan::local): Same.
9068         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9069
9070 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9071
9072         * incremental.cc (Incremental_inputs::report_command_line): Filter
9073         out --incremental-* options.
9074
9075 2009-05-29  Doug Kwan  <dougkwan@google.com>
9076
9077         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9078         template class.
9079         (class Target_arm): Update comment.
9080         (Target_arm::Target_arm): Initialize new data members GOT_,
9081         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9082         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9083         and Target_arm::rel_dyn_section.
9084         Declare new_enum Target_arm::Got_type.
9085         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9086         and DYNBSS_.
9087         Update commments for member do_dynsym_value.
9088         (Target_arm::got_size, Target_arm::plt_section,
9089         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9090         new methods inside class defintion.
9091         (Target_arm::got_section): Define new method.
9092         (Target_arm::rel_dyn_section): Same.
9093         (Output_data_plt_arm): New template class.
9094         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9095         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9096         (Output_data_plt_arm::add_entry): Same.
9097         (Output_data_plt_arm::first_plt_entry): Define new
9098         static data member for PLT instruction template.
9099         (Output_data_plt_arm::plt_entry): Same.
9100         (Output_data_plt_arm::do_write): Define new method.
9101         (Target_arm::make_plt_entry): Same.
9102         (Target_arm::do_finalize_sections): Same.
9103         (Target_arm::do_dynsym_value): Same.
9104
9105 2009-05-28  Doug Kwan  <dougkwan@google.com>
9106
9107         * Makefile.am (TARGETSOURCES): Add arm.cc.
9108         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9109         * Makefile.in: Regenerate.
9110         * arm.cc: New file.
9111         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9112
9113 2009-05-26  Doug Kwan  <dougkwan@google.com>
9114
9115         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9116         (General_options::check_excluded_libs): Strip off directories in
9117         archive name before matching like GNU ld does.
9118         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9119         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9120         (exclude_libs_test_LDFLAGS): Add linker option
9121         -Wl,--exclude-libs,libexclude_libs_test_3
9122         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9123         an explicit archive without using -l.
9124         (alt/libexclude_libs_test_3.a): New make rule.
9125         * testsuite/Makefile.in: Regenerate.
9126         * testsuite/exclude_libs_test.c : Declare lib3_default().
9127         (main): Call it.
9128         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9129         * exclude_libs_test_3.c: New file.
9130
9131 2009-05-26  Nick Clifton  <nickc@redhat.com>
9132
9133         * po/id.po: New Indonesian translation.
9134         * po/gold.pot: Updated template file.
9135
9136 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9137
9138         * testsuite/Makefile.am: Add -ffunction-sections to compile
9139         gc_comdat_test files.  Add -Wl,--gc-sections to build
9140         gc_comdat_test.
9141         * testsuite/Makefile.in: Regenerate.
9142         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9143
9144 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9145
9146         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9147         kept comdat section was garbage collected.
9148         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9149         * testsuite/Makefile.in: Regenerate.
9150         * testsuite/gc_comdat_test.sh: New file.
9151         * testsuite/gc_comdat_test_1.cc: New file.
9152         * testsuite/gc_comdat_test_2.cc: New file.
9153
9154 2009-05-19  Doug Kwan  <dougkwan@google.com>
9155
9156         * archive.cc (Archive::Archive): Move constructor from archive.h
9157         to here.  Initialize no_export_.
9158         (Archive::get_elf_object_for_member): Set no_export flag of object.
9159         * archive.h (Archive::Archive): Move constructor body to
9160         archive.cc.
9161         (Archive::no_export): New method.
9162         (Archive::no_export_): New field.
9163         * object.h (Object::Object): Initialize no_export_ to false.
9164         (Object::no_export, Object::set_no_export): New methods.
9165         (Object::no_export_): New field.
9166         * options.cc (General_options::parse_exclude_libs): New method.
9167         (General_options::check_excluded_libs) Same.
9168         * options.h (exclude_libs): New option.
9169         (General_options::check_excluded_libs): New method declaration.
9170         (General_options::excluded_libs_): New field.
9171         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9172         default or protected visibility if an object has no-export flag set.
9173         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9174         (check_SCRIPTS): Add exclude_libs_test.sh.
9175         (check_DATA): Add exclude_libs_test.syms.
9176         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9177         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9178         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9179         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9180         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9181         libexclude_libs_test_2.a): New rules.
9182         * testsuite/Makefile.in: Regenerate.
9183         * testsuite/exclude_libs_test.c: New file.
9184         * testsuite/exclude_libs_test.sh: Ditto.
9185         * testsuite/exclude_libs_test_1.c: Ditto.
9186         * testsuite/exclude_libs_test_2.c: Ditto.
9187
9188 2009-05-15  Ian Lance Taylor  <iant@google.com>
9189
9190         * configure.ac: Check for declarations for cases where libiberty.h
9191         checks HAVE_DECL_xxx.
9192         * configure, config.in: Rebuild.
9193
9194 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9195
9196         * gold.h (Incremental_argument_list): Remove (invalid) forward
9197         declaration.
9198         * incremental.cc (Incremental_inputs::report_achive): New method.
9199         (Incremental_inputs::report_object): New method.
9200         (Incremental_inputs::report_script): New method.
9201         (Incremental_inputs::finalize_inputs): New method.
9202         (Incremental_inputs::finalize): Call finalize_inputs().
9203         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9204         Create inputs entries.
9205         * incremental.h (Incremental_input_type): New enum.
9206         (Incremental_inputs::Incremental_input): Initialize new fields.
9207         (Incremental_inputs::report_inputs): New method.
9208         (Incremental_inputs::report_achive): New method.
9209         (Incremental_inputs::report_object): New method.
9210         (Incremental_inputs::report_script): New method.
9211         (Incremental_inputs::finalize_inputs): New method.
9212         (Incremental_inputs::Input_info): New struct.
9213         (Incremental_inputs::Input_info_map): New typedef.
9214         (Incremental_inputs::lock_): New field.
9215         (Incremental_inputs::Inputs_): New field.
9216         (Incremental_inputs::Inputs_map): New field.
9217         * main.cc (main): Call Incremental_input::report_inputs.
9218         * options.h (Input_argument_list): Typedef moved from
9219         Input_arguments.
9220         (Input_file_group::Files): Remove, use ::Input_argument_list.
9221         (Input_file_group::Input_argument_list): Remove, use
9222         ::Input_argument_list.
9223         * plugin.cc (Plugin_manager::add_input_file): Add error in
9224         incremental build.
9225         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9226         functions.
9227         * script.cc (read_input_script): Call
9228         Incremental_input::report_script.
9229         * script.h (Script_info): New class.
9230
9231 2009-04-27  Ian Lance Taylor  <iant@google.com>
9232
9233         * x86_64.cc (do_adjust_output_section): Set entsize to
9234         plt_entry_size.
9235
9236 2009-04-23  Elliott Hughes  <enh@google.com>
9237
9238         * output.cc (Output_file::close): After short writes, continue
9239         writing from the correct offset in the buffer being written.
9240
9241 2009-04-23  Chris Demetriou  <cgd@google.com>
9242
9243         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9244         * configure: Regenerate.
9245         * config.in: Regenerate.
9246         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9247         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9248
9249 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9250
9251         * incremental.cc (Incremental_inputs_header_data): Renamed from
9252         Incremental_input_header_data.
9253         (Incremental_inputs_header_data::data_size): New field.
9254         (Incremental_inputs_header_data::put_input_file_count): Renamed
9255         from input_file_count.
9256         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9257         from command_line_offset.
9258         (Incremental_inputs_header_data::put_reserved): Renamed from
9259         put_reserved.
9260         (Incremental_inputs_entry_data): Renamed from
9261         Incremental_input_entry_data.
9262         (Incremental_inputs_entry_data::data_size): New field.
9263         (Incremental_inputs::report_command_line): New method.
9264         (Incremental_inputs::finalize): New method.
9265         (Incremental_inputs::create_incremental_inputs_data): New method.
9266         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9267         * incremental.h: New file.
9268         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9269        (Layout::finalize): Create incremental inputs section in
9270         incremental builds.
9271        (Layout::create_incremental_info_sections): New method.
9272         * layout.h (Layout::incremental_inputs): New method.
9273        (Layout::create_incremental_info_sections): New method.
9274        (Layout::incremental_inputs_): New field.
9275         * main.cc (main): Notify Incremental_input of the command line.
9276
9277 2009-04-01  Ian Lance Taylor  <iant@google.com>
9278             Mikolaj Zalewski  <mikolajz@google.com>
9279
9280         * gold.h (reserve_unordered_map): Define, three versions, one for
9281         each version of Unordered_map.
9282         * layout.cc (Layout::Layout): Remove options parameter.  Add
9283         number_of_input_files parameter.  Don't initialize options_.
9284         Initialize number_of_input_files_ and resized_signatures_.  Move
9285         sections_are_attached_.
9286         (Layout::layout_group): Reserve space for group_signatures_.
9287         (Layout::find_or_add_kept_section): Change name parameter to be a
9288         reference.  Resize signatures_ map when it gets large enough.
9289         (Layout::layout_eh_frame): Use parameters->options() instead of
9290         this->options_.
9291         (Layout::make_output_section): Likewise.
9292         (Layout::attach_allocated_section_to_segment): Likewise.
9293         (Layout::finalize, Layout::create_executable_stack): Likewise.
9294         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9295         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9296         * layout.h (class Layout): Update declarations.  Remove options_
9297         field.  Add number_of_input_files_ and resized_signatures_
9298         fields.  Move sections_are_attached_ field.
9299         * main.cc (main): Pass number of input files to Layout
9300         constructor.  Don't pass options.
9301
9302 2009-03-30  Ian Lance Taylor  <iant@google.com>
9303
9304         * ffsll.c (ffsll): Correct implementation.
9305
9306 2009-03-27  Ian Lance Taylor  <iant@google.com>
9307
9308         * ffsll.c: New file.
9309         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9310         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9311         * ftruncate.c (ftruncate): Declare before definition.
9312         * mremap.c (mremap): Likewise.
9313         * pread.c (pread): Likewise.
9314         * configure, Makefile.in, config.in: Rebuild.
9315
9316         * mremap.c: New file.
9317         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9318         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9319         (mremap): Declare if HAVE_MREMAP is not defined.
9320         * configure, Makefile.in, config.in: Rebuild.
9321
9322 2009-03-27  Cary Coutant  <ccoutant@google.com>
9323
9324         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9325         position independent.
9326         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9327         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9328
9329 2009-03-24  Cary Coutant  <ccoutant@google.com>
9330
9331         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9332         an executable.
9333         (needs_dynamic_reloc): Likewise.
9334
9335 2009-03-24  Ian Lance Taylor  <iant@google.com>
9336
9337         * yyscript.y (file_cmd): Recognize EXTERN.
9338         (extern_name_list, extern_name_list_body): New nonterminals.
9339         * script.cc (script_add_extern): Define.
9340         * script-c.h (script_add_extern): Declare.
9341
9342 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9343
9344         * object.cc (is_elf_object): Define.
9345         * object.h (is_elf_object): Declare.
9346         * archive.cc (Archive::get_elf_object_for_member): Call
9347         is_elf_object.
9348         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9349
9350 2009-03-24  Elliott Hughes  <enh@google.com>
9351
9352         * output.cc (Output_file::map_anonymous): Define.
9353         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9354         try an anonymous one.  Report the size if the mmap fails.
9355         * output.h (class Output_file): Declare map_anonymous.
9356
9357 2009-03-24  Ian Lance Taylor  <iant@google.com>
9358
9359         * target-select.cc (instantiate_target): Don't acquire the lock if
9360         the instantiated_target_ field has already been set.
9361
9362 2009-03-23  Ian Lance Taylor  <iant@google.com>
9363
9364         * gold-threads.h (class Initialize_lock): Define.
9365         * gold-threads.cc (class Initialize_lock_once): Define.
9366         (initialize_lock_control): New static variable.
9367         (initialize_lock_pointer): New static variable.
9368         (initialize_lock_once): New static function.
9369         (Initialize_lock::Initialize_lock): Define.
9370         (Initialize_lock::initialize): Define.
9371         * target-select.h: Include "gold-threads.h".
9372         (class Target_selector): Add lock_ and initialize_lock_ fields.
9373         Don't define instantiate_target, just declare it.
9374         * target-select.cc (Target_selector::Target_selector): Initialize
9375         new fields.
9376         (Target_selector::instantiate_target): Define.
9377         * descriptors.h: Include "gold-threads.h".
9378         (class Descriptors): Add initialize_lock_ field.
9379         * descriptors.cc (Descriptors::Descriptors): Initialize new
9380         field.
9381         (Descriptors::open): Use initialize_lock_ field
9382         * errors.h (class Errors): Add initialize_lock_ field.
9383         * errors.cc (Errors::Errors): Initialize new field.
9384         (Errors::initialize_lock): Use initialize_lock_ field.
9385         * powerpc.cc (class Target_selector_powerpc): Remove
9386         instantiated_target_ field.  In do_recognize call
9387         instantiate_target rather than do_instantiate_target.  In
9388         do_instantiate_target just allocate a new target.
9389         * sparc.cc (class Target_selector_sparc): Likewise.
9390
9391         * freebsd.h: New file.
9392         * i386.cc: Include "freebsd.h".
9393         (Target_i386): Derive from Target_freebsd rather than
9394         Sized_target.
9395         (Target_selector_i386): Derive from Target_selector_freebsd rather
9396         than Target_selector.
9397         * x86_64.cc: Include "freebsd.h".
9398         (Target_x86_64): Derive from Target_freebsd rather than
9399         Sized_target.
9400         (Target_selector_x86_64): Derive from Target_selector_freebsd
9401         rather than Target_selector.
9402         * target.h (class Target): Add adjust_elf_header and
9403         do_adjust_elf_header.
9404         * output.cc (Output_file_header:: do_sized_write): Call target
9405         adjust_elf_header routine.
9406         * configure.tgt: Set targ_osabi.
9407         * configure.ac: Define GOLD_DEFAULT_OSABI.
9408         * parameters.cc (Parameters::default_target): Pass
9409         GOLD_DEFAULT_OSABI to select_target.
9410         * target-select.h (class Target_selector): Make instantiate_target
9411         protected rather than private.
9412         * Makefile.am (HFILES): Add freebsd.h.
9413         * configure, Makefile.in, config.in: Rebuild.
9414
9415         * merge.cc (do_add_input_section): Correct pend value.  Change
9416         message about last entry not being null terminated from error to
9417         warning.
9418
9419 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9420
9421         * incremental.cc: New file.
9422         * Makefile.am (CCFILES): Add incremental.cc.
9423         * Makefile.in: Rebuild.
9424
9425 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9426
9427         * layout.cc (Layout::output_section_name): Preserve names
9428         of '.note.' sections.
9429
9430 2009-03-19  Ian Lance Taylor  <iant@google.com>
9431
9432         * descriptors.cc (Descriptors::open): Check that the options are
9433         valid before using them.
9434
9435 2009-03-18  Ian Lance Taylor  <iant@google.com>
9436
9437         * script-sections.h: Include <list>.
9438         (class Script_sections): Change Sections_elements from std::vector
9439         to std::list.  Typedef public Elements_iterator.  Add
9440         orphan_section_placement_, data_segment_align_start_, and
9441         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9442         field.
9443         * script-sections.cc (class Orphan_section_placement): New class.
9444         (class Sections_element): Add virtual functions is_relro and
9445         orphan_section_init.  Remove virtual function place_orphan_here.
9446         (class Output_section_definition): Add is_relro and
9447         orphan_section_init.  Remove place_orphan_here.
9448         (class Orphan_output_section): Likewise.
9449         (Script_sections::Script_sections): Update for field changes.
9450         (Script_sections::data_segment_align): Set saw_data_segment_align_
9451         and data_segment_align_start_, not data_segment_align_index.
9452         (Script_sections::data_segment_relro_end): Check
9453         saw_data_segment_align_.  Use data_segment_align_start_ rather
9454         than data_segment_align_index_.
9455         (Script_sections::place_orphan): Rewrite to use
9456         Orphan_section_placement.
9457
9458 2009-03-17  Ian Lance Taylor  <iant@google.com>
9459
9460         * archive.cc (Archive::add_symbols): Check for a version attached
9461         to the symbol name in the archive map.
9462         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9463         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9464         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9465         (ver_test_11.a): New target.
9466         * testsuite/Makefile.in: Rebuild.
9467
9468         * configure.ac: Check for chsize and posix_fallocate.  Replace
9469         ftruncate.
9470         * ftruncate.c: New file, from gnulib.
9471         * output.cc (posix_fallocate): Define dummy version if not
9472         HAVE_POSIX_FALLOCATE.
9473         (Output_file::map): Call posix_fallocate rather than lseek and
9474         write.
9475         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9476         * configure, Makefile.in, config.in: Rebuild.
9477
9478 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9479
9480         * layout.h (Layout::create_note): Add section_name parameter.
9481         * layout.cc (Layout::create_note): Likewise.
9482         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9483
9484 2009-03-17  Ian Lance Taylor  <iant@google.com>
9485
9486         * descriptors.cc: Include "options.h".
9487         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9488         (Descriptors::open): Always use O_CLOEXEC when opening a new
9489         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9490         then set FD_CLOEXEC.
9491
9492         * sparc.cc (class Target_sparc): Add has_got_section.
9493         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9494         make sure we have a GOT section.
9495
9496         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9497         (Target_sparc::Scan::local): Likewise.
9498         (Target_sparc::Scan::global): Likewise.
9499         (Target_sparc::Relocate::relocate): Likewise.
9500         (Target_sparc::Relocate::relocate_tls): Likewise.
9501
9502         * symtab.cc (Symbol_table::define_default_version): New function,
9503         broken out of add_from_object.
9504         (Symbol_table::add_from_object): Call define_default_version.
9505         (Symbol_table::define_special_symbol): Add resolve_oldsym
9506         parameter.  Change all callers.  If the version for a symbol comes
9507         from a version script, resolve it with the symbol with the same
9508         name with no version.  Also add the symbol without a version if
9509         appropriate.
9510         (do_define_in_output_data): If resolving with oldsym, don't delete
9511         sym.
9512         (do_define_in_output_segment): Likewise.
9513         (do_define_as_constant): Likewise.
9514         * symtab.h (class Symbol_table): Update declarations.
9515
9516 2009-03-13  Ian Lance Taylor  <iant@google.com>
9517
9518         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9519         (Read_symbols::requeue): New function.
9520         (Read_symbols::do_read_symbols): If make_elf_object fails because
9521         the target type is not configured, and the file was searched for,
9522         issue a warning and retry with the next directory.
9523         (Add_symbols::run): If the file has an incompatible format, and
9524         it was searched for, requeue the Read_symbols task.  On error,
9525         release the object.
9526         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9527         dirindex parameter to constructor.  Change all callers.  Declare
9528         incompatible_warning and requeue.
9529         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9530         input_argument_ and input_group_ fields.  Add them to
9531         constructor.  Change all callers.
9532         (class Read_script): Add dirindex_ field.  Add it to constructor.
9533         Change all callers.
9534         * archive.cc (Archive::setup): Remove input_objects parameter.
9535         Change all callers.
9536         (Archive::get_file_and_offset): Likewise.
9537         (Archive::read_all_symbols): Likewise.
9538         (Archive::read_symbols): Likewise.
9539         (Archive::get_elf_object_for_member): Remove input_objects
9540         parameter.  Add punconfigured parameter.  Change all callers.
9541         (Archive::add_symbols): Change return type to bool.  Check return
9542         value of include_member.
9543         (Archive::include_all_members): Likewise.
9544         (Archive::include_member): Change return type to bool.  Return
9545         false if first included object has incompatible target.  Set
9546         included_member_ field.
9547         (Add_archive_symbols::run): If add_symbols returns false, requeue
9548         Read_symbols task.
9549         * archive.h (class Archive): Add included_member_ field.
9550         Initialize it in constructor.  Add input_file and searched_for
9551         methods.  Update declarations.
9552         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9553         input_argument_ fields.  Add them to constructor.  Change all
9554         callers.
9555         * script.cc: Include "target-select.h".
9556         (class Parser_closure): Add skip_on_incompatible_target_ and
9557         found_incompatible_target_ fields.  Add
9558         skip_on_incompatible_target parameter to constructor.  Change all
9559         callers.  Add methods skip_on_incompatible_target,
9560         clear_skip_on_incompatible_target, found_incompatible_target, and
9561         set_found_incompatible_target.
9562         (read_input_script): Add dirindex parameter.  Change all callers.
9563         If parser finds an incompatible target, requeue Read_symbols
9564         task.
9565         (script_set_symbol): Clear skip_on_incompatible_target in
9566         closure.
9567         (script_add_assertion, script_parse_option): Likewise.
9568         (script_start_sections, script_add_phdr): Likewise.
9569         (script_check_output_format): New function.
9570         * script.h (read_input_script): Update declaration.
9571         * script-c.h (script_check_output_format): Declare.
9572         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9573         (ignore_cmd): Remove OUTPUT_FORMAT.
9574         * fileread.cc (Input_file::Input_file): Add explicit this.
9575         (Input_file::will_search_for): New function.
9576         (Input_file::open): Add pindex parameter.  Change all callers.
9577         * fileread.h (class Input_file): Add input_file_argument method.
9578         Declare will_search_for.  Update declarations.
9579         * object.cc (make_elf_object): Add punconfigured parameter.
9580         Change all callers.
9581         * object.h (class Object): Make input_file public.  Add
9582         searched_for method.
9583         (make_elf_object): Update declaration.
9584         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9585         restart search.
9586         * dirsearch.h (class Dirsearch): Update declaration.
9587         * options.h (class General_options): Add --warn-search-mismatch.
9588         * parameters.cc (Parameters::is_compatible_target): New function.
9589         * parameters.h (class Parameters): Declare is_compatible_target.
9590         * workqueue.cc (Workqueue::add_blocker): New function.
9591         * workqueue.h (class Workqueue): Declare add_blocker.
9592
9593         * fileread.cc (Input_file::open): Remove options parameter.
9594         Change all callers.
9595         (Input_file::open_binary): Likewise.
9596         * script.cc (read_input_script): Likewise.
9597         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9598         options parameter from constructor.  Change all callers.
9599         (class Read_script): Likewise.
9600         * fileread.h (class Input_file): Update declarations.
9601         * script.h (read_input_script): Update declaration.
9602
9603 2009-03-10  Nick Clifton  <nickc@redhat.com>
9604
9605         * po/es.po: New Spanish translation.
9606
9607 2009-03-06  Cary Coutant  <ccoutant@google.com>
9608
9609         * options.cc (parse_short_option): Keep dash_z from registering itself.
9610
9611 2009-03-03  Ian Lance Taylor  <iant@google.com>
9612
9613         PR 9918
9614         * target-reloc.h (relocate_section): Pass output_section to
9615         relocate.
9616         * i386.cc (Target_i386::should_apply_static_reloc): Add
9617         output_section parameter.  Change all callers.
9618         (Target_i386::Relocate::relocate): Add output_section parameter.
9619         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9620         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9621         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9622         * testsuite/two_file_shared.sh: New script.
9623         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9624         (check_DATA): Add two_file_shared.dbg.
9625         (two_file_shared.dbg): New target.
9626         * testsuite/Makefile.in: Rebuild.
9627
9628 2009-03-01  Ian Lance Taylor  <iant@google.com>
9629
9630         * configure.ac: Check for byteswap.h.
9631         * configure: Rebuild.
9632         * config.in: Rebuild.
9633
9634 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9635
9636         * layout.cc (Layout::find_or_add_kept_section): New function.
9637         (Layout::add_comdat): Removed.
9638         * layout.h (struct Kept_section): Move out of class Layout.
9639         Remove trailing underscores from field names.  Add group_sections
9640         field.  Rename group_ field to is_group.  Change all uses.
9641         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9642         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9643         comdat_groups_ field.
9644         (Sized_relobj::include_section_group): Use
9645         find_or_add_kept_section and Kept_section::group_sections.
9646         (Sized_relobj::include_linkonce_section): Likewise.
9647         * object.cc (class Sized_relobj): Don't define Comdat_group or
9648         Comdat_group_table.  Remove find_comdat_group and
9649         add_comdat_group.  Remove comdat_groups_ field.
9650         * plugin.cc (include_comdat_group): Use
9651         Layout::find_or_add_kept_section.
9652
9653 2009-02-28  Ian Lance Taylor  <iant@google.com>
9654
9655         * README: --gc-sections and map files are now supported.  Document
9656         some build requirements.
9657
9658         PR 6992
9659         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9660         relocatable link set the value of the section symbol to zero.
9661         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9662         relocatable link don't include the section address in the local
9663         symbol value.
9664
9665 2009-02-27  Ian Lance Taylor  <iant@google.com>
9666
9667         PR 6811
9668         * options.h (class Search_directory): Add is_system_directory.
9669         (class General_options): Declare is_in_system_directory.
9670         * options.cc (get_relative_sysroot): Make static.
9671         (get_default_sysroot): Make static.
9672         (General_optoins::is_in_system_directory): New function.
9673         * fileread.cc (Input_file::is_in_system_directory): New function.
9674         * fileread.h (class Input_file): Declare is_in_system_directory.
9675         * object.h (class Object): Add is_in_system_directory.
9676         (class Input_objects): Remove system_library_directory_ field.
9677         * object.cc (Input_objects::add_object): Don't set
9678         system_library_directory_.
9679         (input_objects::found_in_system_library_directory): Remove.
9680         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9681         parameter.  Change all callers.
9682         (Symbol_table::sized_write_globals): Likewise.
9683         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9684         Call Object::is_in_system_directory.
9685         * symtab.h (class Symbol_table): Update declarations.
9686
9687         PR 5990
9688         * descriptors.h (Open_descriptor): Add is_on_stack field.
9689         * descriptors.cc (Descriptors::open): If the descriptor is on the
9690         top of the stack, remove it.  Initialize is_on_stack field.
9691         (Descriptors::release): Only add pod to stack if it is not on the
9692         stack already.
9693         (Descriptors::close_some_descriptor): Clear stack_next and
9694         is_on_stack fields.
9695
9696         PR 7091
9697         * output.cc (Output_section::find_starting_output_address): Rename
9698         from starting_output_address; add PADDR parameter; change return
9699         type.
9700         * output.h (class Output_section): Declare
9701         find_starting_output_address instead of starting_output_address.
9702         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9703         section symbol for which we can't find a merge section.
9704
9705         PR 9836
9706         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9707         hidden or internal, force the symbol to be local.
9708         * resolve.cc (Symbol::override_visibility): Define.
9709         (Symbol::override_base): Use override_visibility.
9710         (Symbol_table::resolve): Likewise.
9711         (Symbol::override_base_with_special): Likewise.
9712         (Symbol_table::override_with_special): If the visibility is hidden
9713         or internal, force the symbol to be local.
9714         * symtab.h (class Symbol): Add set_visibility and
9715         override_visibility.
9716         * testsuite/ver_test_1.sh: New file.
9717         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9718         (check_DATA): Add ver_test_1.syms.
9719         (ver_test_1.syms): New target.
9720         * testsuite/Makefile.in: Rebuild.
9721
9722 2009-02-25  Cary Coutant  <ccoutant@google.com>
9723
9724         * layout.cc (Layout::choose_output_section): Don't rename sections
9725         when using a linker script that has a SECTIONS clause.
9726         * Makefile.in: Regenerate.
9727
9728         * testsuite/Makefile.am (script_test_5.sh): New test case.
9729         * testsuite/Makefile.in: Regenerate.
9730         * testsuite/script_test_5.cc: New file.
9731         * testsuite/script_test_5.sh: New file.
9732         * testsuite/script_test_5.t: New file.
9733
9734 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9735
9736         * archive.cc (Archive::include_member): Update calls to add_symbols.
9737         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9738         the Layout argument.
9739         * dynobj.h (do_add_symbols): Add the Layout argument.
9740         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9741         Layout argument.
9742         * object.h (Object::add_symbols): Add the Layout argument.
9743         (Object::do_add_symbols): Add the Layout argument.
9744         (Sized_relobj::do_add_symbols): Add the Layout argument.
9745         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9746         Unify the two versions.
9747         (Add_plugin_symbols): Remove.
9748         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9749         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9750         (Add_plugin_symbols): Remove.
9751         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9752         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9753         (Add_symbols::run): Make it work with Pulginobj.
9754
9755 2009-02-06  Ian Lance Taylor  <iant@google.com>
9756
9757         * object.cc (Sized_relobj::do_layout): Make info message start
9758         with lower case letter.
9759
9760 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9761
9762         * binary.cc: Fix file comment.
9763
9764         * options.h (enum Incremental_disposition): Define.
9765         (class General_options): Add new options: --incremental,
9766         --incremental_changed, --incremental_unchanged,
9767         --incremental_unknown.  Add incremental_disposition_ and
9768         implicit_incremental_ fields.
9769         (General_options::incremental_disposition): New function.
9770         (class Position_dependent_options): Add incremental_disposition
9771         option.
9772         (Position_dependent_options::copy_from_options): Set incremental
9773         dispositions.
9774         * options.cc (General_options::parse_incremental_changed): New
9775         function.
9776         (General_options::parse_incremental_unchanged): New function.
9777         (General_options::parse_incremental_unknown): New function.
9778         (General_options::General_options): Initialize new fields
9779         incremental_disposition_ and implicit_incremental_.
9780         (General_options::finalize): Check for uasge of --incremental-*
9781         without --incremental.
9782
9783 2009-02-06  Chris Demetriou  <cgd@google.com>
9784
9785         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9786         pointer and to report location as the file name associated with
9787         the symbol.
9788         (gold_undefined_symbol_at_location): New function to replace the
9789         old gold_undefined_symbol functionality.
9790         * target-reloc.h (relocate_section): Update to use
9791         gold_undefined_symbol_at_location.
9792         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9793         Call gold_undefined_symbol function rather than gold_error.
9794         * errors.h (Errors::undefined_symbol): Take location as a
9795         string, rather than calculating it from a relocation.
9796         * errors.cc (Errors::fatal): Print "fatal error:" before the
9797         formatted message.
9798         (Errors::error, Errors::error_at_location): Print "error: "
9799         before the formatted message.
9800         (Errors::undefined_symbol): Take location as a string, rather
9801         than calculating it from a relocation.
9802         (gold_undefined_symbol_at_location): New function akin to
9803         old gold_undefined_symbol, calculates location from relocation.
9804         (gold_undefined_symbol): Change to take only a Symbol pointer
9805         and to report location as the file name associated with the symbol.
9806         * testsuite/debug_msg.sh: Update for changed error messages.
9807         * testsuite/undef_symbol.sh: Likewise.
9808
9809 2009-02-04  Duncan Sands  <baldrick@free.fr>
9810
9811         PR 9812
9812         * reduced_debug_output.h
9813         (Output_reduced_debug_abbrev_section::failed): Use format for
9814         gold_warning.
9815         (Output_reduced_debug_info_section::faild): Likewise.
9816
9817 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9818
9819         * script.cc (Lazy_demangler): New class.
9820         (Version_script_info::get_symbol_version_helper): Demangle a
9821         symbol only once.
9822
9823 2009-01-29  Cary Coutant  <ccoutant@google.com>
9824
9825         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9826         to __tls_get_addr.
9827         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9828
9829 2009-01-28  Ian Lance Taylor  <iant@google.com>
9830
9831         * version.cc (version_string): Bump to 1.9.
9832
9833         * gold.h: Include <cstring> and <stdint.h>.
9834         * version.cc: Include <cstdio>.
9835         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9836         warning.
9837         * reduced_debug_output.cc (insert_into_vector): Rename from
9838         Insert_into_vector; change all callers.  Use Swap_unaligned to
9839         avoid aliasing issue; remove union since it is unnecessary.
9840
9841 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9842
9843         * Makefile.am (CCFILES): Add gc.cc.
9844         (HFILES): Add gc.h.
9845         * Makefile.in: Regenerate.
9846         * gold.cc (Gc_runner): New class.
9847         (queue_initial_tasks): Call garbage collection related tasks
9848         when corresponding options are invoked.
9849         (queue_middle_gc_tasks): New function.
9850         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9851         processed early before laying out sections during garbage collection.
9852         * gold.h (queue_middle_gc_tasks): New function.
9853         (is_prefix_of): Move from "layout.cc".
9854         * i386.cc (Target_i386::gc_process_relocs): New function.
9855         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9856         * main.cc (main): Create object of class "Garbage_collection".
9857         * object.cc (Relobj::copy_symbols_data): New function.
9858         (Relobj::is_section_name_included): New function.
9859         (Sized_relobj::do_layout): Allow this function to be called twice
9860         during garbage collection and defer layout of section during the
9861         first call.
9862         * object.h (Relobj::get_symbols_data): New function.
9863         (Relobj::is_section_name_included): New function.
9864         (Relobj::copy_symbols_data): New function.
9865         (Relobj::set_symbols_data): New function.
9866         (Relobj::get_relocs_data): New function.
9867         (Relobj::set_relocs_data): New function.
9868         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9869         (Relobj::gc_process_relocs): New function.
9870         (Relobj::do_gc_process_relocs): New pure virtual function.
9871         (Relobj::sd_): New data member.
9872         (Sized_relobj::is_output_section_offset_invalid): New function.
9873         (Sized_relobj::do_gc_process_relocs): New function.
9874         * options.h (General_options::gc_sections): Modify to not be a no-op.
9875         (General_options::print_gc_sections): New option.
9876         * plugin.cc (Plugin_finish::run): Remove function call to
9877         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9878         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9879         * reloc.cc (Read_relocs::run): Add task to process relocs and
9880         determine unreferenced sections when doing garbage collection.
9881         (Gc_process_relocs): New class.
9882         (Sized_relobj::do_gc_process_relocs): New function.
9883         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9884         sections that are garbage collected.
9885         * reloc.h (Gc_process_relocs): New class.
9886         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9887         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9888         symbols whose corresponding sections are garbage collected.
9889         (Symbol_table::Symbol_table): Add new parameter for the garbage
9890         collection object.
9891         (Symbol_table::gc_mark_undef_symbols): New function.
9892         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9893         (Symbol_table::gc_mark_dyn_syms): New function.
9894         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9895         as garbage.
9896         (Symbol_table::add_from_object): Likewise.
9897         (Symbol_table::add_from_relobj): When building shared objects, do not
9898         treat externally visible symbols as garbage.
9899         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9900         table information for static and relocatable links.
9901         * symtab.h (Symbol_table::set_gc): New function.
9902         (Symbol_table::gc): New function.
9903         (Symbol_table::gc_mark_undef_symbols): New function.
9904         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9905         (Symbol_table::gc_mark_dyn_syms): New function.
9906         (Symbol_table::gc_): New data member.
9907         * target.h (Sized_target::gc_process_relocs): New pure virtual
9908         function.
9909         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9910         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9911
9912 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9913
9914         * options.h (General_options::gc_sections): Define as a no-op for now.
9915         (General_options::no_keep_memory): Ditto.
9916         (General_options::Bshareable): Define.
9917         * options.cc (General_options::finalize): Honor -Bshareable.
9918
9919 2009-01-20  Andreas Schwab  <schwab@suse.de>
9920
9921         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9922         read the value in the contents, since we don't use it.  Use the
9923         template endianness when writing.
9924         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9925
9926 2009-01-19  Andreas Schwab  <schwab@suse.de>
9927
9928         * configure.tgt (powerpc64-*): Fix targ_obj.
9929
9930 2009-01-15  Ian Lance Taylor  <iant@google.com>
9931
9932         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9933         local symbols when stripping all symbols.
9934
9935 2009-01-14  Cary Coutant  <ccoutant@google.com>
9936
9937         * output.cc (Output_reloc): Add explicit instantiations.
9938
9939 2009-01-14  Cary Coutant  <ccoutant@google.com>
9940
9941         * archive.cc (Archive::get_elf_object_for_member): Remove call
9942         to File_read::claim_for_plugin.
9943         * descriptors.cc (Descriptors::open): Remove reference to
9944         is_claimed.
9945         (Descriptors::claim_for_plugin): Remove.
9946         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9947         (Descriptors::is_claimed): Remove.
9948         (claim_descriptor_for_plugin): Remove.
9949         * fileread.cc (File_read::claim_for_plugin): Remove.
9950         * fileread.h (File_read::claim_for_plugin): Remove.
9951         (File_read::descriptor): Reopen descriptor if necessary.
9952         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9953         (Plugin_manager::all_symbols_read): Add task parameter. Change
9954         all callers.
9955         (Plugin_manager::get_input_file): New function.
9956         (Plugin_manager::release_input_file): New function.
9957         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9958         corresponding data member.
9959         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9960         and pass to base constructor. Change all callers.
9961         (get_input_file, release_input_file): New functions.
9962         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9963         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9964         (Plugin_manager::all_symbols_read): Add task parameter.
9965         (Plugin_manager::get_input_file): New function.
9966         (Plugin_manager::release_input_file): New function.
9967         (Plugin_manager::task_): New data member.
9968         (Pluginobj::Pluginobj): Add filesize parameter.
9969         (Pluginobj::filename): New function.
9970         (Pluginobj::descriptor): New function.
9971         (Pluginobj::filesize): New function.
9972         (Pluginobj::filesize_): New data member.
9973         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9974         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9975         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9976
9977         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9978         with archive libraries.
9979         * testsuite/Makefile.in: Regenerate.
9980         * testsuite/plugin_test.c (struct sym_info): New type.
9981         (get_input_file, release_input_file): New static variables.
9982         (onload): Capture new transfer vector entries.
9983         (claim_file_hook): Stop reading at end of file according to filesize.
9984         Factor out parsing of readelf output into separate function.
9985         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9986         APIs and get the source file name from the symbol table.  Convert
9987         source file name to corresponding object file name.  Print info
9988         message when adding new input files.
9989         (parse_readelf_line): New function.
9990         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9991         * testsuite/plugin_test_2.sh: Likewise.
9992         * testsuite/plugin_test_3.sh: Likewise.
9993         * testsuite/plugin_test_4.sh: New test case.
9994
9995 2009-01-07  Ian Lance Taylor  <iant@google.com>
9996
9997         * version.cc (version_string): Bump to 1.8.
9998
9999 2008-12-23  Cary Coutant  <ccoutant@google.com>
10000
10001         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10002         * plugin.cc (Plugin_manager::finish): Rename as
10003         layout_deferred_objects.  Move cleanup to separate function.
10004         (Plugin_manager::cleanup): New function.
10005         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10006         separately.
10007         * plugin.h (Plugin_manager::finish): Rename as
10008         layout_deferred_objects.
10009         (Plugin_manager::cleanup): New function.
10010         (Plugin_manager::cleanup_done): New field.
10011
10012 2008-12-23  Cary Coutant  <ccoutant@google.com>
10013
10014         * plugin.cc (is_visible_from_outside): New function.
10015         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10016         so we don't return "IR only" status for exported symbols or -r links.
10017
10018         * testsuite/Makefile.am (plugin_test_3): New test case.
10019         * testsuite/Makefile.in: Regenerate.
10020         * testsuite/plugin_test_3.sh: New file.
10021
10022 2008-12-22  Cary Coutant  <ccoutant@google.com>
10023
10024         * object.cc (Sized_relobj::layout_section): New function.
10025         (Sized_relobj::do_layout): Defer layout of input sections until after
10026         plugin has provided replacement files.
10027         (Sized_relobj::do_layout_deferred_sections): New function.
10028         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10029         (Relobj::layout_deferred_sections): New function.
10030         (Relobj::do_layout_deferred_sections): New function.
10031         (Sized_relobj::do_layout_deferred_sections): New function.
10032         (Sized_relobj::layout_section): New function.
10033         (Sized_relobj::Deferred_layout): New structure.
10034         (Sized_relobj::deferred_layout_): New field.
10035         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10036         Change all callers.  Layout deferred sections.
10037         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10038         references.
10039         (Plugin_hook::run): Move code from do_plugin_hook inline.
10040         (Plugin_hook::do_plugin_hook): Remove.
10041         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10042         (Plugin_manager::finish): Renamed, was cleanup.
10043         (Plugin_manager::should_defer_layout): New function.
10044         (Plugin_manager::add_deferred_layout_object): New function.
10045         (Plugin_manager::Deferred_layout_list): New type.
10046         (Plugin_manager::deferred_layout_objects_): New field.
10047         (Plugin_hook::do_plugin_hook): Remove.
10048
10049 2008-12-17  Ian Lance Taylor  <iant@google.com>
10050
10051         * options.h (class General_options): Add --no case for
10052         --export-dynamic.
10053
10054 2008-12-16  Cary Coutant  <ccoutant@google.com>
10055
10056         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10057         vector.
10058         (Plugin_manager::claim_file): Create plugin object even if
10059         plugin did not call the add_symbols callback.
10060         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10061         asking for more symbols than were added.
10062         * testsuite/Makefile.am (plugin_test_1): Add test case with
10063         no global symbols.
10064         (empty.syms): New target.
10065         * testsuite/Makefile.in: Regenerate.
10066         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10067         message. Don't call add_symbols if no globals.
10068         (all_symbols_read_hook): Don't provide replacement for empty
10069         claimed file.
10070
10071 2008-12-12  Ian Lance Taylor  <iant@google.com>
10072
10073         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10074         r_type == 0 for a local symbol with r_sym == 0.
10075         (scan_relocatable_relocs): Pass r_sym to
10076         local_non_section_strategy.
10077         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10078         r_sym parameter.
10079
10080         * configure.ac: Update test for TLS descriptors: they are
10081         supported as of glibc 2.9.
10082         * configure: Rebuild.
10083
10084 2008-12-11  Ian Lance Taylor  <iant@google.com>
10085
10086         PR 7091
10087         * target-reloc.h (Default_scan_relocatable_relocs): For each
10088         function, map r_type == 0 to RELOC_DISCARD.
10089
10090 2008-12-10  Cary Coutant  <ccoutant@google.com>
10091
10092         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10093         object to override a kept COMDAT group from a plugin object.
10094
10095 2008-12-09  Ian Lance Taylor  <iant@google.com>
10096
10097         PR 7088
10098         * yyscript.y (file_cmd): Handle INPUT.
10099
10100         * testsuite/initpri1.c: Change all declarations to be full
10101         prototypes by adding void, to avoid compiler warnings.
10102
10103 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10104
10105         * options.cc (General_options::parse_plugin_opt): New.
10106         (General_options::add_plugin): The argument now is just the filename.
10107         (General_options::add_plugin_option): New.
10108         * options.h (plugin_opt): New.
10109         (add_plugin): Change argument name.
10110         (add_plugin_option): New.
10111         * plugin.cc (Plugin::load): Don't parse the plugin option.
10112         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10113         (Plugin::add_option): New.
10114         (Plugin::args_): Change type.
10115         (Plugin::filename_): New.
10116         (Plugin_manager::add_plugin_option): New.
10117         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10118         * testsuite/Makefile.in: Regenerate.
10119
10120 2008-12-05  Cary Coutant  <ccoutant@google.com>
10121
10122         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10123         Handle --strip-lto-sections option.
10124         * options.h (strip_lto_sections): New option.
10125
10126 2008-12-01  Cary Coutant  <ccoutant@google.com>
10127
10128         * plugin.cc (ld_plugin_message): Change format parameter to const.
10129         Fix mismatch between new[] and delete.
10130
10131 2008-11-14  Cary Coutant  <ccoutant@google.com>
10132
10133         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10134         instead of -1U.
10135
10136 2008-11-05  Craig Silverstein  <csilvers@google.com>
10137
10138         * options.cc (General_options::parse_dynamic_list): New function.
10139         * options.h (General_options): New flags dynamic_list,
10140         dynamic_list_data, dynamic_list_cpp_new, and
10141         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10142         (General_options::in_dynamic_list): New function.
10143         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10144         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10145         (Lex::can_continue_name): Likewise.
10146         (yylex): Likewise.
10147         (read_script_file): New parameter script_options.
10148         (read_dynamic_list): New function.
10149         (Script_options::define_dynamic_list): New function.
10150         (dynamic_list_keyword_parsecodes): New variable.
10151         (dynamic_list_keywords): New variable.
10152         * script.h (Script_options::define_dynamic_list): New function
10153         prototype.
10154         (read_dynamic_list): New function prototype.
10155         * symtab.cc (strprefix): New macro.
10156         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10157         dynamic_list_data, dynamic_list_cpp_new, and
10158         dynamic_list_cpp_typeinfo.
10159         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10160         (dynamic_list_expr): New rule.
10161         (dynamic_list_nodes): Likewise.
10162         (dynamic_list_node): Likewise.
10163         * testsuite/Makefile.am (dynamic_list): New test.
10164         * testsuite/Makefile.in: Regenerated.
10165         * testsuite/dynamic_list.t: New file.
10166         * testsuite/dynamic_list.sh: New file.
10167
10168 2008-11-05  Craig Silverstein  <csilvers@google.com>
10169
10170         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10171         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10172         (t11_last): Likewise.
10173         * testsuite/ver_test_6.c (main): Likewise.
10174
10175 2008-10-07  Cary Coutant  <ccoutant@google.com>
10176
10177         * options.c (General_options::finalize): Add check for -static and
10178         -shared.
10179         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10180         is not empty.
10181
10182 2008-10-02  Cary Coutant  <ccoutant@google.com>
10183
10184         * plugin.cc (make_sized_plugin_object): Fix conditional
10185         compilation to work when not all targets are enabled.
10186
10187 2008-09-29  Cary Coutant  <ccoutant@google.com>
10188
10189         * archive.cc (Archive::get_file_and_offset): Use filename instead
10190         of name to get library path.
10191         (Archive::include_member): Unlock external member of a thin archive.
10192
10193         * testsuite/Makefile.am (TEST_AR): New variable.
10194         (thin_archive_test_1): New test.
10195         (thin_archive_test_2): New test.
10196         * testsuite/Makefile.in: Regenerate.
10197         * testsuite/thin_archive_main.cc: New file.
10198         * testsuite/thin_archive_test_1.cc: New file.
10199         * testsuite/thin_archive_test_2.cc: New file.
10200         * testsuite/thin_archive_test_3.cc: New file.
10201         * testsuite/thin_archive_test_4.cc: New file.
10202
10203 2008-09-29  Cary Coutant  <ccoutant@google.com>
10204
10205         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10206         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10207         instead of -1U.
10208         (Sized_relobj::do_finalize_local_symbols): Likewise.
10209         (Sized_relobj::map_to_kept_section): Likewise.
10210         * object.h (Sized_relobj::invalid_address): New constant.
10211         (Sized_relobj::do_output_section_offset): Check for invalid_address
10212         and return -1ULL.
10213         * output.cc (Output_reloc::local_section_offset): Use constant
10214         invalid_address instead of -1U.
10215         (Output_reloc::get_address): Likewise.
10216         (Output_section::output_address): Change -1U to -1ULL.
10217         * output.h (Output_reloc::invalid_address): New constant.
10218         * reloc.cc (Sized_relobj::write_sections): Use constant
10219         invalid_address instead of -1U.
10220         (Sized_relobj::relocate_sections): Likewise.
10221         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10222         values for merge sections.
10223         * target-reloc.h (relocate_for_relocatable): Use constant
10224         invalid_address instead of -1U.
10225
10226 2008-09-19  Cary Coutant  <ccoutant@google.com>
10227
10228         Add plugin functionality for link-time optimization (LTO).
10229         * configure.ac (plugins): Add --enable-plugins option.
10230         * configure: Regenerate.
10231         * config.in: Regenerate.
10232         * Makefile.am (LIBDL): New variable.
10233         (CCFILES): Add plugin.cc.
10234         (HFILES): Add plugin.h.
10235         (ldadd_var): Add LIBDL.
10236         * Makefile.in: Regenerate.
10237
10238         * archive.cc: Include "plugin.h".
10239         (Archive::setup): Don't preread archive symbols when using a plugin.
10240         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10241         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10242         files.
10243         (Archive::include_member): Add symbols from plugin objects.
10244         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10245         * descriptors.cc (Descriptors::open): Check for file descriptors
10246         abandoned by plugins.
10247         (Descriptors::claim_for_plugin): New function.
10248         * descriptors.h (Descriptors::claim_for_plugin): New function.
10249         (Open_descriptor::is_claimed): New field.
10250         (claim_descriptor_for_plugin): New function.
10251         * fileread.cc (File_read::claim_for_plugin): New function.
10252         * fileread.h (File_read::claim_for_plugin): New function.
10253         (File_read::descriptor): New function.
10254         * gold.cc: Include "plugin.h".
10255         (queue_initial_tasks): Add task to call plugin hooks for generating
10256         new object files.
10257         * main.cc: Include "plugin.h".
10258         (main): Load plugin libraries.
10259         * object.h (Pluginobj): Declare.
10260         (Object::pluginobj): New function.
10261         (Object::do_pluginobj): New function.
10262         (Object::set_target): New function.
10263         * options.cc: Include "plugin.h".
10264         (General_options::parse_plugin): New function.
10265         (General_options::General_options): Initialize plugins_ field.
10266         (General_options::add_plugin): New function.
10267         * options.h (Plugin_manager): Declare.
10268         (General_options): Add --plugin option.
10269         (General_options::has_plugins): New function.
10270         (General_options::plugins): New function.
10271         (General_options::add_plugin): New function.
10272         (General_options::plugins_): New field.
10273         * plugin.cc: New file.
10274         * plugin.h: New file.
10275         * readsyms.cc: Include "plugin.h".
10276         (Read_symbols::do_read_symbols): Check for archive before checking
10277         for ELF file.  Call plugin hooks to claim files.
10278         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10279         from a real object file; force override when processing replacement
10280         files.
10281         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10282         (Symbol::init_base_object): Likewise.
10283         (Symbol::init_base_output_data): Likewise.
10284         (Symbol::init_base_output_segment): Likewise.
10285         (Symbol::init_base_constant): Likewise.
10286         (Symbol::init_base_undefined): Likewise.
10287         (Symbol::output_section): Assert that object is not a plugin.
10288         (Symbol_table::add_from_pluginobj): New function.
10289         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10290         undefined.
10291         (Symbol_table::sized_write_globals): Likewise.
10292         (Symbol_table::add_from_pluginobj): Instantiate template.
10293         * symtab.h (Sized_pluginobj): Declare.
10294         (Symbol::in_real_elf): New function.
10295         (Symbol::set_in_real_elf): New function.
10296         (Symbol::in_real_elf_): New field.
10297         (Symbol_table::add_from_pluginobj): New function.
10298
10299         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10300         (LIBDL): New variable.
10301         (LDADD): Add LIBDL.
10302         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10303         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10304         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10305         (MOSTLYCLEANFILES): Likewise.
10306         * testsuite/Makefile.in: Regenerate.
10307         * testsuite/plugin_test.c: New file.
10308         * testsuite/plugin_test_1.sh: New file.
10309         * testsuite/plugin_test_2.sh: New file.
10310
10311 2008-09-16  Ian Lance Taylor  <iant@google.com>
10312
10313         * target-reloc.h (relocate_section): Check whether a symbol is
10314         defined by the ABI before reporting an undefined symbol error.
10315         * target.h (Target::is_defined_by_abi): Make parameter const.
10316         (Target::do_is_defined_by_abi): Likewise.
10317         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10318         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10319         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10320         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10321         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10322         * testsuite/Makefile.in: Rebuild.
10323
10324         * fileread.cc (make_view): Add casts to avoid warning.
10325
10326 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10327
10328         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10329         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10330
10331 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10332
10333         * options.h (General_options::output_is_executable): New.
10334         (General_options::output_is_pie): New.
10335         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10336         for shared libraries.
10337         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10338
10339 2008-09-11  Chris Demetriou  <cgd@google.com>
10340
10341         * options.h (origin): New -z option.
10342         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10343         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10344         in DT_FLAGS_1.
10345
10346 2008-09-05  Cary Coutant  <ccoutant@google.com>
10347
10348         * fileread.cc (File_read::make_view): Add check for attempt to map
10349         beyond end of file.
10350
10351 2008-09-05  Cary Coutant  <ccoutant@google.com>
10352
10353         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10354         explicit instantiations.
10355
10356 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10357
10358         PR gold/6858
10359         * options.cc (General_options::finalize): Allow undefined symbols
10360         in shlibs if linking -shared.
10361
10362         PR gold/6859
10363         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10364         symbols as not needing a dynsym entry.
10365
10366 2008-08-20  Craig Silverstein  <csilvers@google.com>
10367
10368         * fileread.cc (File_read::open): Do not lock the file unless it
10369         was successfully opened.
10370
10371 2008-08-14  Cary Coutant  <ccoutant@google.com>
10372
10373         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10374         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10375         * testsuite/tls_test.cc (struct int128): 128-bit struct
10376         for testing TLS relocs with non-zero addend.
10377         (v12): New TLS variable.
10378         (t12): New test.
10379         (t_last): Add check for v12.
10380         * testsuite/tls_test.h (t12): New function.
10381         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10382
10383 2008-08-13  Ian Lance Taylor  <iant@google.com>
10384
10385         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10386         set tls_segment_ or relro_segment_.
10387         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10388         when appropriate.
10389         * output.h (Output_section::clear_is_relro): New function.
10390         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10391         sections specially even when output_data_ is empty.
10392         (Output_segment::maximum_alignment): When first section is relro,
10393         only force alignment for PT_LOAD segments.
10394         * script.cc (script_data_segment_align): New function.
10395         (script_data_segment_relro_end): New function.
10396         * script-c.h (script_data_segment_align): Declare.
10397         (script_data_segment_relro_end): Declare.
10398         * script-sections.h (class Script_sections): Declare
10399         data_segment_align and data_segment_relro_end.  Add fields
10400         segment_align_index_ and saw_relro_end_.
10401         * script-sections.cc (class Sections_element): Add set_is_relro
10402         virtual function.  Add new bool* parameter to place_orphan_here.
10403         Add get_output_section virtual function.
10404         (class Output_section_definition): Add set_is_relro.  Add new
10405         bool* parameter to place_orphan_here.  Add get_output_section.
10406         Add is_relro_ field.
10407         (Output_section_definition::Output_section_definition): Initialize
10408         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10409         and is_relro_ fields.
10410         (Output_section_definition::place_orphan_here): Add is_relro
10411         parameter.
10412         (Output_section_definition::set_section_addresses): Set relro for
10413         output section.
10414         (Output_section_definition::alternate_constraint): Likewise.
10415         (class Orphan_output_section): Add new bool* parameter to
10416         place_orphan_here.  Add get_output_section.
10417         (Orphan_output_section::place_orphan_here): Add is_relro
10418         parameter.
10419         (Script_sections::Script_sections): Initialize
10420         data_segment_align_index_ and saw_relro_end_.
10421         (Script_sections::data_segment_align): New function.
10422         (Script_sections::data_segment_relro_end): New function.
10423         (Script_sections::place_orphan): Set or clear is_relro.
10424         (Script_sections::set_section_addresses): Force alignment of first
10425         TLS section.
10426         * yyscript.y (exp): Call script_data_segment_align and
10427         script_data_segment_relro_end.
10428         * testsuite/relro_script_test.t: New file.
10429         * testsuite/relro_test.cc (using_script): Declare.
10430         (t1, t2): Test using_script.
10431         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10432         (relro_script_test_SOURCES): Define.
10433         (relro_script_test_DEPENDENCIES): Define.
10434         (relro_script_test_LDFLAGS): Define.
10435         (relro_script_test_LDADD): Define.
10436         (relro_script_test.so): New target.
10437         * testsuite/Makefile.in: Rebuild.
10438
10439 2008-08-06  Cary Coutant <ccoutant@google.com>
10440
10441         * archive.cc (Archive::total_archives, Archive::total_members)
10442         (Archive::total_members_loaded): New variables.
10443         (Archive::setup): Add parameter.  Add option to preread
10444         archive symbols.
10445         (Archive::read_armap): Add counter.
10446         (Archive::get_file_and_offset): New function.
10447         (Archive::get_elf_object_for_member): New function.
10448         (Archive::read_all_symbols): New function.
10449         (Archive::read_symbols): New function.
10450         (Archive::add_symbols): Add counters.
10451         (Archive::include_all_members): Use armap to find members if it's
10452         already built.
10453         (Archive::include_member): Skip reading symbols if already read.
10454         Factored code into Archive::get_file_and_offset and
10455         Archive::get_elf_object_for_member.  Changed call to
10456         Mapfile::report_include_archive_member.
10457         (Archive::print_stats): New function.
10458         * archive.h: Declare Object and Read_symbols_data classes.
10459         (Archive::Archive): Add initializers for new members.
10460         (Archive::setup): Add parameter.
10461         (Archive::print_stats): New function.
10462         (Archive::total_archives, Archive::total_members)
10463         (Archive::total_members_loaded): New variables.
10464         (Archive::get_file_and_offset): New function.
10465         (Archive::get_elf_object_for_member): New function.
10466         (Archive::read_all_symbols): New function.
10467         (Archive::read_symbols): New function.
10468         (Archive::Archive_member): New class.
10469         (Archive::members_): New member.
10470         (Archive::num_members_): New member.
10471         * main.cc: Include archive.h.
10472         (main): Call Archive::print_stats.
10473         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10474         archive parameter; member_name is now the fully-decorated name.
10475         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10476         * options.h: (General_options): Add --preread-archive-symbols option.
10477         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10478         Archive::setup.
10479
10480 2008-08-04  Ian Lance Taylor  <iant@google.com>
10481
10482         * symtab.h (Symbol::use_plt_offset): New function.
10483         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10484         * powerpc.cc (Relocate::relocate): Likewise.
10485         * sparc.cc (Relocate::relocate): Likewise.
10486         * x86_64.cc (Relocate::relocate): Likewise.
10487         * testsuite/weak_plt.sh: New test.
10488         * testsuite/weak_plt_main.cc: New test.
10489         * testsuite/weak_plt_shared.cc: New test.
10490         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10491         (check_PROGRAMS): Add weak_plt.
10492         (check_DATA): Add weak_plt_shared.so.
10493         (weak_plt_main_pic.o, weak_plt): New targets.
10494         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10495         * testsuite/Makefile.in: Rebuild.
10496
10497         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10498         gcctestdir/ld.
10499         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10500         * testsuite/Makefile.in: Rebuild.
10501
10502 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10503
10504         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10505         * Makefile.in: Regenerate.
10506         * po/POTFILES.in: Regenerate.
10507
10508 2008-07-29  Ian Lance Taylor  <iant@google.com>
10509
10510         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10511         symbols before other symbols.
10512         * testsuite/script_test_2.cc (test_addr): Declare.
10513         (test_addr_alias): Declare.
10514         (main): Check that test_addr and test_addr_alias have the right
10515         values.
10516         * testsuite/script_test_2.t: Define test_addr_alias and
10517         test_addr.
10518
10519 2008-07-24  Ian Lance Taylor  <iant@google.com>
10520
10521         PR 5990
10522         * descriptors.cc: New file.
10523         * descriptors.h: New file.
10524         * gold-threads.h (class Hold_optional_lock): New class.
10525         * fileread.cc: Include "descriptors.h".
10526         (File_read::~File_read): Release descriptor rather than closing
10527         it.
10528         (File_read::open) [file]: Call open_descriptor rather than open.
10529         Set is_descriptor_opened_.
10530         (File_read::open) [memory]: Assert that descriptor is not open.
10531         (File_read::reopen_descriptor): New function.
10532         (File_read::release): Release descriptor.
10533         (File_read::do_read): Make non-const.  Reopen descriptor.
10534         (File_read::read): Make non-const.
10535         (File_read::make_view): Reopen descriptor.
10536         (File_read::do_readv): Likewise.
10537         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10538         Update declarations.
10539         * layout.cc: Include "descriptors.h".
10540         (Layout::create_build_id): Use open_descriptor rather than open.
10541         * output.cc: Include "descriptors.h".
10542         (Output_file::open): Use open_descriptor rather than open.
10543         * archive.cc (Archive::const_iterator): Change Archive to be
10544         non-const.
10545         (Archive::begin, Archive::end): Make non-const.
10546         (Archive::count_members): Likewise.
10547         * archive.h (class Archive): Update declarations.
10548         * object.h (Object::read): Make non-const.
10549         * Makefile.am (CCFILES): Add descriptors.cc.
10550         (HFILES): Add descriptors.h.
10551         * Makefile.in: Rebuild.
10552
10553         PR 6716
10554         * gold.h: Always include <clocale>.  Add Solaris workarounds
10555         following code in binutils/sysdep.h.
10556
10557         PR 6048
10558         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10559         this->eh_frame_hdr_ is NULL before using it.
10560
10561         * dynobj.cc (Versions::Versions): Update comment.
10562
10563         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10564         the base version name.
10565
10566         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10567         array size plus one.
10568         (Stringpool_template::set_string_offsets): Subtract one from key
10569         before using it as an array index.
10570         (Stringpool_template::get_offset_with_length): Likewise.
10571         (Stringpool_template::write_to_buffer): Likewise.
10572         * stringpool.h (Stringpool_template::get_offset_from_key):
10573         Likewise.
10574
10575 2008-07-23  Ian Lance Taylor  <iant@google.com>
10576
10577         PR 6658
10578         * object.h (Merged_symbol_value::value): Do our best to handle a
10579         negative addend.
10580
10581         PR 6647
10582         * script.cc (Version_script_info::get_versions): Don't add empty
10583         version tag to return value.
10584         (Version_script_info::get_symbol_version_helper): Change return
10585         type to bool.  Add pversion parameter.  Change all callers.
10586         (script_register_vers_node): Don't require a non-NULL tag.
10587         * script.h (class Version_script_info): Update declarations.
10588         (Version_script_info::get_symbol_version): Change return type to
10589         bool.  Add version parameter.  Change all callers.
10590         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10591         handling.  Handle an empty version from a version script.
10592         (Symbol_table::define_special_symbol): Likewise.
10593         * testsuite/ver_test_10.script: New file.
10594         * testsuite/ver_test_10.sh: New file.
10595         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10596         (check_DATA): Add ver_test_10.syms.
10597         (ver_test_10.syms, ver_test_10.so): New target.
10598         * testsuite/Makefile.in: Rebuild.
10599
10600 2008-07-23  Simon Baldwin  <simonb@google.com>
10601
10602         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10603         to zero for undefined symbols from dynamic libraries.
10604
10605 2008-07-23  Ian Lance Taylor  <iant@google.com>
10606
10607         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10608         Change all callers.
10609         * symtab.h (class Symbol_table): Update declaration.
10610         * testsuite/ver_test_9.cc: New file.
10611         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10612         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10613         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10614         (ver_test_9.so, ver_test_9.o): New targets.
10615         * testsuite/Makefile.in: Rebuild.
10616
10617 2008-07-22  Ian Lance Taylor  <iant@google.com>
10618
10619         * options.h (class General_options): Define --check-sections.
10620         * layout.cc (Layout::set_segment_offsets): Handle
10621         --check-sections.
10622
10623         * options.h (class General_options): Define -n/--nmagic and
10624         -N/--omagic.
10625         * options.cc (General_options::finalize): For -n/--nmagic or
10626         -N/--omagic, set -static.
10627         * layout.cc (Layout::attach_allocated_section_to_segment): If
10628         -N/--omagic, don't put read-only and read-write sections in
10629         different segments.
10630         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10631         finding a read-only segment.
10632         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10633         don't set the minimum segment alignment to the common page size,
10634         and don't set the file offset to the address modulo the page size.
10635         * script-sections.cc (Script_sections::create_segments): If
10636         -n/--omagic, don't put read-only and read-write sections in
10637         different segments.
10638
10639         * cref.cc: New file.
10640         * cref.h: New file.
10641         * options.h (class General_options): Add --print-symbol-counts.
10642         * main.cc (main): Issue defined symbol report if requested.
10643         * archive.cc (Archive::interpret_header): Make into a const member
10644         function.
10645         (Archive::add_symbols): Call Input_objects::archive_start and
10646         archive_stop.
10647         (Archive::const_iterator): Define new class.
10648         (Archive::begin, Archive::end): New functions.
10649         (Archive::include_all_members): Rewrite to use iterator.
10650         (Archive::count_members): New function.
10651         * archive.h (class Archive): Update declarations.
10652         (Archive::filename): New function.
10653         * object.cc: Include "cref.h".
10654         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10655         (Sized_relobj::do_get_global_symbol_counts): New function.
10656         (Input_objects::add_object): Add object to cross-referencer.
10657         (Input_objects::archive_start): New function.
10658         (Input_objects::archive_stop): New function.
10659         (Input_objects::print_symbol_counts): New function.
10660         * object.h: Declare Cref and Archive.
10661         (Object::get_global_symbol_counts): New function.
10662         (Object::do_get_global_symbol_counts): New pure virtual function.
10663         (class Sized_relobj): Add defined_count_ field.  Update
10664         declarations.
10665         (class Input_objects): Add cref_ field.  Update constructor.
10666         Update declarations.
10667         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10668         defined_count_.
10669         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10670         symbol counts.
10671         (Sized_dynobj::do_get_global_symbol_counts): New function.
10672         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10673         defined_count_.  Update declarations.  Define Symbols typedef.
10674         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10675         parameter.  Change all callers.
10676         (Symbol_table::add_from_dynobj): Add sympointers and defined
10677         parameters.  Change all callers.
10678         * symtab.h (class Symbol_table): Update declarations.
10679         * Makefile.am (CCFILES): Add cref.cc.
10680         (HFILES): Add cref.h.
10681         * Makefile.in: Rebuild.
10682
10683 2008-07-22  Simon Baldwin  <simonb@google.com>
10684
10685         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10686         to zero when writing undefined symbols.
10687
10688 2008-07-22  Ian Lance Taylor  <iant@google.com>
10689
10690         * output.cc (Output_section::add_input_section): Don't try to
10691         merge empty merge sections.
10692
10693 2008-07-21  Craig Silverstein  <csilvers@google.com>
10694
10695         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10696         Include symbol version in error message.
10697
10698 2008-07-20  Chris Demetriou  <cgd@google.com>
10699
10700         * configure.ac (gold_cv_c_random_seed): New configured variable.
10701         (RANDOM_SEED_CFLAGS): New substituted variable.
10702         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10703         * configure: Rebuild.
10704         * Makefile.in: Likewise.
10705         * testsuite/Makefile.in: Likewise.
10706
10707 2008-07-18  Ian Lance Taylor  <iant@google.com>
10708
10709         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10710         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10711         * testsuite/ver_test_main.cc (main): Call t4.
10712         (t4, t4_2a): Define.
10713         * testsuite/ver_test_2.cc (t4_2): Define.
10714         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10715         * testsuite/ver_test_4.cc (t4_2a): Define.
10716         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10717         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10718
10719 2008-07-17  Ian Lance Taylor  <iant@google.com>
10720
10721         * dynobj.cc (Versions::add_def): If we give an error about a
10722         missing version, go ahead and create the version anyhow.
10723
10724 2008-07-10  Ian Lance Taylor  <iant@google.com>
10725
10726         Handle output sections with more than 0x7fffffff bytes.
10727         * object.h (class Relobj): Change map_to_output_ to
10728         output_sections_, and just keep a section pointer.  Change all
10729         uses.  Move comdat group support to Sized_relobj.
10730         (Relobj::is_section_specially_mapped): Remove.
10731         (Relobj::output_section): Remove poff parameter.  Change all
10732         callers.
10733         (Relobj::output_section_offset): New function.
10734         (Relobj::set_section_offset): Rewrite.
10735         (Relobj::map_to_output): Remove.
10736         (Relobj::output_sections): New function.
10737         (Relobj::do_output_section_offset): New pure virtual function.
10738         (Relobj::do_set_section_offset): Likewise.
10739         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10740         group support from Relobj.  Update declarations.
10741         (Sized_relobj::get_output_section_offset): New function.
10742         (Sized_relobj::do_output_section_offset): New function.
10743         (Sized_relobj::do_set_section_offset): New function.
10744         * object.cc (Relobj::output_section_address): Remove.
10745         (Sized_relobj::Sized_relobj): Initialize new fields.
10746         (Sized_relobj::include_section_group): Cast find_kept_object to
10747         Sized_relobj.
10748         (Sized_relobj::include_linkonce_section): Likewise.
10749         (Sized_relobj::do_layout): Use separate arrays for output section
10750         and output offset.
10751         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10752         output_sections.
10753         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10754         output_sections and section_offsets.
10755         (Sized_relobj::write_local_symbols): Likewise.
10756         (map_to_kept_section): Compute output address directly.
10757         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10758         output_sections and section_offsets.
10759         (Sized_relobj::write_sections): Likewise.
10760         (Sized_relobj::relocate_sections): Likewise.
10761         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10762         * output.h (class Output_reloc): Update declarations.  Change
10763         u2_.relobj to Sized_relobj*.
10764         (class Output_data_reloc): Change add functions to use
10765         Sized_relobj*.
10766         * output.cc (Output_reloc::Output_reloc): Change relobj to
10767         Sized_relobj*.
10768         (Output_reloc::local_section_offset): Change return type to
10769         Elf_Addr.  Use get_output_section_offset.
10770         (Output_reloc::get_address): Likewise.
10771         (Output_section::is_input_address_mapped): Don't call
10772         is_section_specially_mapped.
10773         (Output_section::output_offset): Likewise.
10774         (Output_section::output_address): Likewise.
10775         (Output_section::starting_output_address): Likewise.
10776         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10777         parameter to Sized_relobj*.
10778         (Copy_relocs::need_copy_reloc): Likewise.
10779         (Copy_relocs::save): Likewise.
10780         * copy-relocs.h (class Copy_relocs): Update declarations.
10781         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10782         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10783         * target-reloc.h (relocate_for_relocatable): Change
10784         offset_in_output_section type to Elf_Addr.  Change code that uses
10785         it as well.
10786         * layout.cc (Layout::layout): Always set *off.
10787         * mapfile.cc (Mapfile::print_input_section): Use
10788         output_section_offset.
10789         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10790         Sized_relobj*.
10791         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10792         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10793         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10794
10795 2008-07-03  Ian Lance Taylor  <iant@google.com>
10796
10797         * layout.cc (Layout::include_section): Do not discard unrecognized
10798         SHT_STRTAB sections.
10799
10800 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10801
10802         * script.cc (Lex::can_continue_name): Make '?' allowable in
10803         version-script names.
10804         * testsuite/version_script.map: Change glob pattern to use '?'
10805
10806 2008-06-30  Manish Singh  <yosh@gimp.org>
10807
10808         PR 6585
10809         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10810         Correct typo.
10811
10812 2008-06-30  Ian Lance Taylor  <iant@google.com>
10813
10814         PR 6660
10815         PR 6682
10816         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10817         versions]: Don't try to read the value in the contents, since we
10818         don't use it.  Use the template endianness when writing.
10819
10820 2008-06-25  Cary Coutant  <ccoutant@google.com>
10821
10822         * fileread.cc (File_read::make_view): Assert on zero-length view.
10823         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10824         symbol table when there are no symbols to read.
10825
10826 2008-06-23  Craig Silverstein  <csilvers@google.com>
10827
10828         * version.cc (version_string): Bump to 1.7
10829
10830 2008-06-18  Craig Silverstein  <csilvers@google.com>
10831
10832         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10833         constant 0xFFFF to type Valtype.
10834         (Powerpc_relocate_functions::rel16_ha): Likewise.
10835
10836 2008-06-17  Ian Lance Taylor  <iant@google.com>
10837
10838         * output.h (Output_section::Input_section): Initialize p2align_ to
10839         zero for Output_section_data constructors.
10840         (Output_section::Input_section::addralign): If not an input
10841         section, return the alignment of the Output_section_data.
10842         * testsuite/copy_test.cc: New file.
10843         * testsuite/copy_test_1.cc: New file.
10844         * testsuite/copy_test_2.cc: New file.
10845         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10846         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10847         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10848         (copy_test_1_pic.o, copy_test_1.so): New targets.
10849         (copy_test_2_pic.o, copy_test_2.so): New targets.
10850         * testsuite/Makefile.in: Rebuild.
10851
10852         * script-sections.cc (Script_sections::place_orphan): Initialize
10853         local variable exact.
10854
10855 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10856
10857         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10858
10859 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10860             David S. Miller  <davem@davemloft.net>
10861
10862         * powerpc.cc: New file.
10863         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10864         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10865         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10866         * Makefile.in: Rebuild.
10867
10868 2008-06-09  Ian Lance Taylor  <iant@google.com>
10869
10870         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10871         <exception>.
10872         (throwing, orig_terminate): New static variables.
10873         (terminate_handler): New static function.
10874         (t2): Set terminate handler.
10875
10876 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10877
10878         PR 6584
10879         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10880         alignment.
10881
10882 2008-05-30  Cary Coutant  <ccoutant@google.com>
10883
10884         * archive.cc (Archive::include_all_members) Correct to step
10885         over symbol table and extended name table in thin archives.
10886
10887 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10888
10889         PR 6407
10890         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10891         calculation.
10892
10893 2008-05-28  Caleb Howe  <cshowe@google.com>
10894
10895         * reduced_debug_output.cc: New file.
10896         * reduced_debug_output.h: New file.
10897         * options.h (class General_options): Add --strip-debug-non-line.
10898         * options.cc (General_options::finalize): Add strip_debug_non_line
10899         to the strip heirarchy.
10900         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10901         fields.
10902         * layout.cc: Include "reduced_debug_output.h".
10903         (Layout::Layout): Initialize new fields.
10904         (line_only_debug_sections): New static array.
10905         (is_lines_only_debug_sections): New static inline function.
10906         (Layout::include_section): Handle --strip-debug-non-line.
10907         (Layout::make_output_section): If --strip-debug-non-line, build
10908         new output sections for .debug_abbrev and .debug_info.
10909         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10910         gold.  Warn about possible overflow.
10911         (read_signed_LEB_128): Likewise.
10912         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10913         (read_signed_LEB_128): Declare.
10914         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10915         (HFILES): Add reduced_debug_output.h.
10916         * Makefile.in: Rebuild.
10917
10918 2008-05-21  Ian Lance Taylor  <iant@google.com>
10919
10920         * mapfile.cc: New file.
10921         * mapfile.h: New file.
10922         * options.h (class General_options): Add -M/--print-map and -Map.
10923         * options.cc (General_options::finalize): Make -M equivalent to
10924         -Map -.
10925         * main.cc: Include <cstdio> and "mapfile.h".
10926         (main): Open mapfile if requested.
10927         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10928         constructor.  Change caller.
10929         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10930         (queue_middle_tasks): Likewise.
10931         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10932         declarations.
10933         * archive.cc: Include "mapfile.h".
10934         (Archive::add_symbols): Add mapfile parameter.  Change all
10935         callers.  Pass mapfile, symbol, and reason to include_member.
10936         (Archive::include_all_members): Add mapfile parameter.  Change all
10937         callers.
10938         (Archive::include_member): Add mapfile, sym, and why parameters.
10939         Change all callers.  Report inclusion to map file.
10940         * archive.h: Include "fileread.h".
10941         (class Archive): Update declarations.
10942         (Archive::file): New const method.
10943         (class Add_archive_symbols): Add mapfile_ field.  Update
10944         constructor.  Change all callers.
10945         * readsyms.h (class Read_symbols): Likewise.
10946         (class Finish_group): Likewise.
10947         (class Read_script): Likewise.
10948         * common.cc: Include "mapfile.h".
10949         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10950         all callers.
10951         (Symbol_table::do_allocate_commons): Likewise.
10952         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10953         symbol allocation to mapfile.
10954         * common.h (class Allocate_commons_task): Add mapfile_ field.
10955         Update constructor.  Change all callers.
10956         * symtab.h (class Symbol_table): Update declarations.
10957         * layout.cc: Include "mapfile.h".
10958         (Layout_task_runner::run): Print information to mapfile.
10959         (Layout::create_gold_note): Change Output_data_fixed_space to
10960         Output_data_zero_fill.
10961         (Layout::create_build_id): Likewise.
10962         (Layout::print_to_mapfile): New function.
10963         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10964         constructor.  Change caller.
10965         (class Layout): Declare print_to_mapfile.
10966         * output.cc (Output_section::Input_section::print_to_mapfile): New
10967         function.
10968         (Output_section::add_input_section): If producing a map, always
10969         add to input_sections_ list.
10970         (Output_section::do_print_to_mapfile): New function.
10971         (Output_segment::print_sections_to_mapfile): New function.
10972         (Output_segment::print_section_list_to_mapfile): New function.
10973         * output.h: Include "mapfile.h".
10974         (Output_data::print_to_mapfile): New function.
10975         (Output_data::do_print_to_mapfile): New virtual function.
10976         (Output_segment_headers::do_print_to_mapfile): New function.
10977         (Output_file_header::do_print_to_mapfile): New function.
10978         (Output_data_const::do_print_to_mapfile): New function.
10979         (class Output_data_const_buffer): Add map_name_ field.  Update
10980         constructor.  Change all callers.  Add do_print_to_mapfile
10981         function.
10982         (class Output_data_fixed_space): Likewise.
10983         (class Output_data_space): Likewise.
10984         (class Output_data_zero_fill): New class.
10985         (Output_data_strtab::do_print_to_mapfile): New function.
10986         (Output_data_reloc_base::do_print_to_mapfile): New function.
10987         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10988         (Output_data_group::do_print_to_mapfile): New function.
10989         (Output_data_got::do_print_to_mapfile): New function.
10990         (Output_data_dynamic::do_print_to_mapfile): New function.
10991         (Output_symtab_xindex::do_print_to_mapfile): New function.
10992         (class Output_section): Declare do_print_to_mapflie.  Declare
10993         print_to_mapfile in Input_section.
10994         (class Output_segment): Declare new functions.
10995         * object.h (Sized_relobj::symbol_count): New function.
10996         * script-sections.cc
10997         (Output_section_element_dot_assignment::set_section_addresses):
10998         Change Output_data_fixed_space to Output_data_zero_fill.
10999         (Output_data_expression::do_print_to_mapfile): New function.
11000         * script.cc (read_input_script): Add mapfile parameter.  Change
11001         all callers.
11002         * script.h (read_input_script): Update declaration.
11003         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11004         (Eh_frame::do_print_to_mapfile): New function.
11005         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11006         (Output_merge_string::do_print_to_mapfile): New function.
11007         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11008         function.
11009         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11010         function.
11011         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11012         function.
11013         * Makefile.am (CCFILES): Add mapfile.cc.
11014         (HFILES): Add mapfile.h.
11015         * Makefile.in: Rebuild.
11016
11017 2008-05-19  Ian Lance Taylor  <iant@google.com>
11018
11019         * options.h (class General_options): Add -z relro.
11020         * layout.cc (Layout::Layout): Initialize relro_segment_.
11021         (Layout::add_output_section_data): Return the output section.
11022         (Layout::make_output_section): Rcognize relro sections and mark
11023         them appropriately.
11024         (Layout::attach_allocated_section_to_segment): Put relro sections
11025         in a PT_GNU_RELRO segment.
11026         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11027         section as relro.
11028         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11029         PT_TLS segments.
11030         (Layout::linkonce_mapping): Map d.rel.ro.local to
11031         .data.rel.ro.local.
11032         (Layout::output_section_name): Us .data.rel.ro.local for any
11033         section which begins with that.
11034         * layout.h (class Layout): Update add_output_section_data
11035         declaration.  Add relro_segment_ field.
11036         * output.cc (Output_section::Output_section): Initialize is_relro_
11037         and is_relro_local_ fields.
11038         (Output_segment::add_output_section): Group relro sections.
11039         (Output_segment::is_first_section_relro): New function.
11040         (Output_segment::maximum_alignment): If there is a relro section,
11041         align the segment to the common page size.
11042         (Output_segment::set_section_addresses): Track whether we are
11043         looking at relro sections.  If the last section is a relro
11044         section, align to the common page size.
11045         (Output_segment::set_section_list_addresses): Add in_relro
11046         parameter.  Change all callers.  Align to the page size when
11047         moving from relro to non-relro section.
11048         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11049         segment.
11050         * output.h (class Output_section): Add is_relro_ and
11051         is_relro_local_ fields.
11052         (Output_section::is_relro): New function.
11053         (Output_section::set_is_relro): New function.
11054         (Output_section::is_relro_local): New function.
11055         (Output_section::set_is_relro_local): New function.
11056         (class Output_segment): Update declarations.
11057         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11058         * sparc.cc (Target_sparc::got_section): Likewise.
11059         * x86_64.cc (Target_x86_64::got_section): Likewise.
11060         * testsuite/relro_test_main.cc: New file.
11061         * testsuite/relro_test.cc: New file.
11062         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11063         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11064         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11065         (relro_test.so, relro_test_pic.o): New targets.
11066         * testsuite/Makefile.in: Rebuild.
11067
11068 2008-05-16  Ian Lance Taylor  <iant@google.com>
11069
11070         * output.cc (Output_segment::add_output_section): Remove front
11071         parameter.
11072         * output.h (class Output_segment): Remove
11073         add_initial_output_section and overloaded add_output_section.
11074         Update declaration of remaining add_output_section.
11075         * layout.cc (Layout::create_interp): Call add_output_section
11076         rather than add_initial_output_section.
11077         (Layout::finish_dynamic_section): Likewise.
11078
11079         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11080         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11081         know the dynamic type.
11082         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11083         field.  Initialize it in constructor.
11084         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11085         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11086         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11087         reloc.
11088
11089         * output.cc (Output_reloc::get_address): Change return type to
11090         Elf_Addr.
11091         * output.h (class Output_reloc): Update get_address declaration.
11092         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11093         for section addresses.
11094
11095 2008-05-09  Ian Lance Taylor  <iant@google.com>
11096
11097         PR 6493
11098         * gold.cc (gold_nomem): Use return value of write.
11099
11100 2008-05-08  Ian Lance Taylor  <iant@google.com>
11101
11102         * symtab.c (Symbol::init_base_output_data): Add version
11103         parameter.  Change all callers.
11104         (Symbol::init_base_output_segment): Likewise.
11105         (Symbol::init_base_constant): Likewise.
11106         (Symbol::init_base_undefined): Likewise.
11107         (Sized_symbol::init_output_data): Likewise.
11108         (Sized_symbol::init_output_segment): Likewise.
11109         (Sized_symbol::init_constant): Likewise.
11110         (Sized_symbol::init_undefined): Likewise.
11111         (Symbol_table::do_define_in_output_data): If the new symbol has a
11112         version, mark it as the default.
11113         (Symbol_table::do_define_in_output_segment): Likewise.
11114         (Symbol_table::do_define_as_constant): Likewise.
11115         * symtab.h (class Symbol): Update declarations.
11116         (class Sized_symbol): Likewise.
11117         * resolve.cc (Symbol::override_version): New function.
11118         (Symbol::override_base): Call override_version.
11119         (Symbol::override_base_with_special): Likewise.
11120         * testsuite/ver_script_8.script: New file.
11121         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11122         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11123         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11124         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11125
11126 2008-05-06  Ian Lance Taylor  <iant@google.com>
11127
11128         PR 6049
11129         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11130         functions.
11131         (class General_options): Remove existing --undefined, and add
11132         --no-undefined instead.  Add new --undefined as synonym for -u.
11133         * archive.cc (Archive::add_symbols): Check whether symbol was
11134         named with -u.
11135         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11136         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11137         all uses.  Add IS_UNDEFINED.  Update declarations to split
11138         different versions of init_base.  Declare init_base_undefined.
11139         (Symbol::is_defined): Handle IS_UNDEFINED.
11140         (Symbol::is_undefined): Likewise.
11141         (Symbol::is_weak_undefined): Call is_undefined.
11142         (Symbol::is_absolute): Handle IS_CONSTANT.
11143         (class Sized_symbol): Update declarations to split different
11144         versions of init.  Declare init_undefined.
11145         (class Symbol_table): Declare new functions.
11146         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11147         Change all callers.
11148         (Symbol::init_base_output_data): Likewise.
11149         (Symbol::init_base_output_segment): Likewise.
11150         (Symbol::init_base_constant): Likewise.
11151         (Symbol::init_base_undefined): New function.
11152         (Sized_symbol::init_object): Rename from init.  Change all
11153         callers.
11154         (Sized_symbol::init_output_data): Likewise.
11155         (Sized_symbol::init_output_segment): Likewise.
11156         (Sized_symbol::init_constant): Likewise.
11157         (Sized_symbol::init_undefined): New function.
11158         (Symbol_table::add_undefined_symbols_from_command_line): New
11159         function.
11160         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11161         function.
11162         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11163         (Symbol::output_section): Likewise.
11164         (Symbol::set_output_section): Likewise.
11165         (Symbol_table::sized_finalize_symbol): Likewise.
11166         (Symbol_table::sized_write_globals): Likewise.
11167         * resolve.cc (Symbol_table::should_override): Likewise.
11168         (Symbol::override_base_with_special): Likewise.
11169
11170         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11171         symbol, change it to have default visibility.
11172         * testsuite/protected_1.cc: New file.
11173         * testsuite/protected_2.cc: New file.
11174         * testsuite/protected_3.cc: New file.
11175         * testsuite/protected_main_1.cc: New file.
11176         * testsuite/protected_main_2.cc: New file.
11177         * testsuite/protected_main_3.cc: New file.
11178         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11179         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11180         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11181         (protected_1.so): New target.
11182         (protected_1_pic.o, protected_2_pic.o): New targets.
11183         (protected_3_pic.o): New target.
11184         (check_PROGRAMS): Add protected_2.
11185         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11186         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11187         * testsuite/Makefile.in: Rebuild.
11188
11189         * options.h (DEFINE_var): Add set_user_set_##varname__.
11190         (DEFINE_bool_alias): New macro.
11191         (class General_options): Define -Bstatic using DEFINE_bool_alias
11192         rather than DEFINE_special.  Add --undefined as an alias for -z
11193         defs.
11194         * options.cc (General_options::parse_Bstatic): Remove.
11195
11196         * options.h (class General_options): Add --fatal-warnings.
11197         * main.cc (main): Implement --fatal-warnings.
11198         * errors.h (Errors::warning_count): New function.
11199
11200         * options.h (class General_options): Add -Bsymbolic-functions.
11201         * symtab.h (Symbol::is_preemptible): Check for
11202         -Bsymbolic-functions.
11203
11204 2008-05-05  Ian Lance Taylor  <iant@google.com>
11205
11206         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11207         as noVARNAME rather than no-VARNAME.
11208         (class General_options): Add option -z combreloc.
11209         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11210         get_address.
11211         (Output_reloc::sort_before) [SHT_REL]: New function.
11212         (Output_reloc::sort_before) [SHT_RELA]: New function.
11213         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11214         Sort_relocs_comparison.
11215         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11216         parameter.  Change all callers.
11217         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11218         sort_relocs parameter.  Change all callers.
11219         * output.cc (Output_reloc::get_address): New function, broken out
11220         of write_rel.
11221         (Output_reloc::write_rel): Call it.
11222         (Output_reloc::compare): New function.
11223         (Output_data_reloc_base::do_write): Optionally sort relocs.
11224
11225         * configure.ac: If targ_extra_obj is set, link it in.
11226         * configure.tgt: Initialize all variables.
11227         (x86_64*): Set targ_extra_obj and targ_extra_size.
11228         * configure: Rebuild.
11229
11230         * object.cc (Sized_relobj::include_section_group): Adjust section
11231         indexes read from group data.  Build vector to pass to
11232         layout_group.
11233         * layout.cc (Layout::layout_group): Add flags and shndxes
11234         parameters.  Remove contents parameter.  Change caller.  Update
11235         explicit instantiations.
11236         * layout.h (class Layout): Update layout_group declaration.
11237         * output.cc (Output_data_group::Output_data_group): Add flags and
11238         input_shndxes parameters.  Remove contents parameter.  Change
11239         caller.
11240         (Output_data_group::do_write): Change input_sections_ to
11241         input_shndxes_.
11242         * output.h (class Output_data_group): Update constructor
11243         declaration.  Rename input_sections_ to input_shndxes_.
11244         * testsuite/many_sections_test.cc: Add template.
11245
11246 2008-04-30  Cary Coutant  <ccoutant@google.com>
11247
11248         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11249
11250         * layout.cc (Layout::include_section): Refactored check for debug
11251         info section.
11252         (Layout::add_comdat): Add new parameters.  Change type
11253         of signature parameter.  Add object and shndx to signatures table.
11254         (Layout::find_kept_object): New function.
11255         * layout.h: Include <cstring>.
11256         (Layout::is_debug_info_section): New function.
11257         (Layout::add_comdat): Add new parameters.
11258         (Layout::find_kept_object): New function.
11259         (Layout::Kept_section): New struct.
11260         (Layout::Signatures): Change type of map range.
11261         * object.cc (Relobj::output_section_address): New function.
11262         (Sized_relobj::include_section_group): Add new parameters.  Change
11263         calls to Layout::add_comdat.  Change to build table of kept comdat
11264         groups and table mapping discarded sections to kept sections.
11265         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11266         (Sized_relobj::do_layout): Change calls to include_section_group and
11267         include_linkonce_section.
11268         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11269         value to zero when section is discarded.
11270         (Sized_relobj::map_to_kept_section): New function.
11271         * object.h (Relobj::output_section_address): New function.
11272         (Relobj::Comdat_group): New type.
11273         (Relobj::find_comdat_group): New function.
11274         (Relobj::Comdat_group_table): New type.
11275         (Relobj::Kept_comdat_section): New type.
11276         (Relobj::Kept_comdat_section_table): New type.
11277         (Relobj::add_comdat_group): New function.
11278         (Relobj::set_kept_comdat_section): New function.
11279         (Relobj::get_kept_comdat_section): New function.
11280         (Relobj::comdat_groups_): New field.
11281         (Relobj::kept_comdat_sections_): New field.
11282         (Symbol_value::input_value): Update comment.
11283         (Sized_relobj::map_to_kept_section) New function.
11284         (Sized_relobj::include_linkonce_section): Add new parameter.
11285         * target-reloc.h (Comdat_behavior): New type.
11286         (get_comdat_behavior): New function.
11287         (relocate_section): Add code to map a discarded section to the
11288         corresponding kept section when applying a relocation.
11289
11290 2008-04-30  Craig Silverstein  <csilvers@google.com>
11291
11292         * dwarf_reader.cc (next_generation_count): New static var.
11293         (Addr2line_cache_entry): New struct.
11294         (addr2line_cache): New static var.
11295         (Dwarf_line_info::one_addr2line): Added caching.
11296         (Dwarf_line_info::clear_addr2line_cache): New function.
11297         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11298         cache-size parameter.
11299         (Dwarf_line_info::one_addr2line_cache): New function.
11300         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11301         new cache-size argument to one_addr2line(), and clear cache.
11302
11303 2008-04-28  Cary Coutant  <ccoutant@google.com>
11304
11305         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11306         R_386_PC8 relocations.
11307
11308 2008-04-23  Ian Lance Taylor  <iant@google.com>
11309
11310         * object.cc (Sized_relobj::include_section_group): Check for
11311         invalid section group.
11312
11313         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11314         header size.
11315
11316         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11317         than read for file header.
11318         * archive.cc (Archive::include_member): Likewise.
11319
11320 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11321
11322         * aclocal.m4: Regenerate.
11323         * configure: Regenerate.
11324
11325 2008-04-19  Ian Lance Taylor  <iant@google.com>
11326
11327         * version.cc (version_string): Bump to 1.6.
11328
11329         * testsuite/Makefile.am (many_sections_r_test): New target.
11330         (many_sections_r_test_SOURCES): Remove.
11331         (many_sections_r_test_DEPENDENCIES): Remove.
11332         (many_sections_r_test_LDFLAGS): Remove.
11333         (many_sections_r_test_LDADD): Remove.
11334
11335         * object.cc (Sized_relobj::do_add_symbols): Always pass
11336         local_symbol_count_ to add_from_relobj.
11337
11338         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11339         every thousand variables.
11340         * testsuite/Makefile.in: Rebuild.
11341
11342         * object.cc (Xindex::initialize_symtab_xindex): New function.
11343         (Xindex::read_symtab_xindex): New function.
11344         (Xindex::sym_xindex_to_shndx): New function.
11345         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11346         available.
11347         (Sized_relobj::do_initialize_xindex): New function.
11348         (Sized_relobj::do_read_symbols): Adjust section links.
11349         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11350         parameter.  Change all callers.
11351         (Sized_relobj::include_section_group): Adjust section links and
11352         symbol section indexes.
11353         (Sized_relobj::do_layout): Adjust section links.
11354         (Sized_relobj::do_count_local_symbols): Adjust section links and
11355         symbol section indexes.
11356         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11357         ordinary and special symbols.
11358         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11359         dynsym_xindex parameters.  Change all callers.  Adjust section
11360         links.  Use SHN_XINDEX when needed.
11361         (Sized_relobj::get_symbol_location_info): Adjust section links.
11362         Don't get fooled by special symbols.
11363         * object.h (class Xindex): Define.
11364         (class Object): Add xindex_ parameter.  Declare virtual functoin
11365         do_initialize_xindex.
11366         (Object::adjust_sym_shndx): New function.
11367         (Object::set_xindex): New protected function.
11368         (class Symbol_value): Add is_ordinary_shndx_ field.
11369         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11370         (Symbol_value::value): Assert ordinary section.
11371         (Symbol_value::initialize_input_to_output_map): Likewise.
11372         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11373         Change all callers.
11374         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11375         all callers.
11376         (class Sized_relobj): Update declarations.
11377         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11378         parameter.  Change all callers.
11379         (Sized_relobj::adjust_shndx): New function.
11380         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11381         field.
11382         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11383         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11384         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11385         (Sized_dynobj::read_dynsym_section): Adjust section links.
11386         (Sized_dynobj::read_dynamic): Likewise.
11387         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11388         section links.
11389         (Sized_dynobj::do_initialize_xindex): New function.
11390         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11391         do_initialize_xindex.
11392         (Sized_dynobj::adjust_shndx): New function.
11393         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11394         dynsym_xindex_ fields.
11395         (Layout::finalize): Add a call to set_section_indexes before
11396         creating the symtab sections.
11397         (Layout::set_section_indexes): Don't do anything if the section
11398         already has a section index.
11399         (Layout::create_symtab_sections): Add shnum parameter.  Change
11400         caller.  Create .symtab_shndx section if needed.
11401         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11402         caller.
11403         (Layout::allocated_output_section_count): New function.
11404         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11405         needed.
11406         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11407         fields.  Update declarations.
11408         (Layout::symtab_xindex): New function.
11409         (Layout::dynsym_xindex): New function.
11410         (class Write_symbols_task): Add layout_ field.
11411         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11412         Change caller.
11413         * output.cc (Output_section_headers::Output_section_headers): Add
11414         shstrtab_section parameter.  Change all callers.
11415         (Output_section_headers::do_sized_write): Store overflow values
11416         for section count and section string table section index in
11417         section header zero.
11418         (Output_file_header::do_sized_write): Check for overflow of
11419         section count and section string table section index.
11420         (Output_symtab_xindex::do_write): New function.
11421         (Output_symtab_xindex::endian_do_write): New function.
11422         * output.h (class Output_section_headers): Add shstrtab_section_.
11423         Update declarations.
11424         (class Output_symtab_xindex): Define.
11425         (Output_section::has_out_shndx): New function.
11426         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11427         field.
11428         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11429         Change all callers.
11430         (Sized_symbol::init): Likewise.
11431         (Symbol::output_section): Check for ordinary symbol.
11432         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11433         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11434         callers.
11435         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11436         Change all callers.  Simplify handling of symbols from sections
11437         not included in the link.
11438         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11439         distinction.
11440         (Weak_alias_sorter::operator()): Assert that symbols are
11441         ordinary.
11442         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11443         distinction.
11444         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11445         parameters.  Change all callers.
11446         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11447         symbol distinction.  Use SHN_XINDEX when needed.
11448         (Symbol_table::write_section_symbol): Add symtab_xindex
11449         parameter.  Change all callers.
11450         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11451         SHN_XINDEX when needed.
11452         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11453         declarations.
11454         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11455         (Symbol::is_defined): Check is_ordinary.
11456         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11457         (Symbol::is_absolute, Symbol::is_common): Likewise.
11458         (class Sized_symbol): Update declarations.
11459         (class Symbol_table): Update declarations.
11460         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11461         parameters.  Change all callers.
11462         (Sized_symbol::override): Likewise.
11463         (Symbol_table::override): Likewise.
11464         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11465         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11466         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11467         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11468         to be in an ordinary section.
11469         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11470         object and is_ordinary parameters.  Change all callers.
11471         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11472         Change all callers.  Don't add undefined or non-ordinary symbols
11473         to reloc_map_.
11474         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11475         Change all callers.
11476         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11477         declarations.
11478         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11479         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11480         (Sized_relobj::relocate_sections): Likewise.
11481         * target-reloc.h (scan_relocs): Adjust section symbol index.
11482         (scan_relocatable_relocs): Likewise.
11483         * i386.cc (Scan::local): Check for ordinary symbols.
11484         * sparc.cc (Scan::local): Likewise.
11485         * x86_64.cc (Scan::local): Likewise.
11486         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11487         to symbol_section_and_value.
11488         * testsuite/many_sections_test.cc: New file.
11489         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11490         (check_PROGRAMS): Add many_sections_test.
11491         (many_sections_test_SOURCES): Define.
11492         (many_sections_test_DEPENDENCIES): Define.
11493         (many_sections_test_LDFLAGS): Define.
11494         (BUILT_SOURCES): Add many_sections_define.h.
11495         (many_sections_define.h): New target.
11496         (BUILT_SOURCES): Add many_sections_check.h.
11497         (many_sections_check.h): New target.
11498         (check_PROGRAMS): Add many_sections_r_test.
11499         (many_sections_r_test_SOURCES): Define.
11500         (many_sections_r_test_DEPENDENCIES): Define.
11501         (many_sections_r_test_LDFLAGS): Define.
11502         (many_sections_r_test_LDADD): Define.
11503         (many_sections_r_test.o): New target.
11504         * testsuite/Makefile.in: Rebuild.
11505
11506 2008-04-17  Cary Coutant  <ccoutant@google.com>
11507
11508         * errors.cc (Errors::info): New function.
11509         (gold_info): New function.
11510         * errors.h (Errors::info): New function.
11511         * gold.h (gold_info): New function.
11512         * object.cc (Input_objects::add_object): Print trace output.
11513         * options.cc (options::parse_set): New function.
11514         (General_options::parse_wrap): Deleted.
11515         (General_options::General_options): Deleted initializer.
11516         * options.h (options::String_set): New typedef.
11517         (options::parse_set): New function.
11518         (DEFINE_set): New macro.
11519         (General_options::wrap): Changed to use DEFINE_set. Changed
11520         callers of any_wrap_symbols and is_wrap_symbol.
11521         (General_options::trace, General_options::trace_symbol):
11522         New options.
11523         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11524         (General_options::wrap_symbols_): Deleted.
11525         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11526
11527 2008-04-17  David S. Miller  <davem@davemloft.net>
11528
11529         * options.cc (General_options::parse_V): New function.
11530         * options.h: Add entries for -V and -Qy.
11531
11532 2008-04-17  Ian Lance Taylor  <iant@google.com>
11533
11534         * common.cc (Symbol_table::allocate_commons): Remove options
11535         parameter.  Change caller.
11536         (Symbol_table::do_allocate_commons): Remove options parameter.
11537         Change caller.  Just call do_allocate_commons_list twice.
11538         (Symbol_table::do_allocate_commons_list): New function, broken out
11539         of do_allocate_commons.
11540         * common.h (class Allocate_commons_task): Remove options_ field.
11541         Update constructor.
11542         * symtab.cc (Symbol_table::Symbol_table): Initialize
11543         tls_commons_.
11544         (Symbol_table::add_from_object): Put TLS common symbols on
11545         tls_commons_ list.
11546         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11547         which are IN_OUTPUT_DATA.
11548         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11549         allocate_commons and do_allocate_commons declarations.  Declare
11550         do_allocate_commons_list.
11551         * gold.cc (queue_middle_tasks): Update creation of
11552         Allocate_commons_task to not pass options.
11553         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11554         (TLS_TEST_C_FLAGS): New variable.
11555         (tls_test_c_pic.o): New target.
11556         (tls_test_shared.so): Link in tls_test_c_pic.o.
11557         (tls_test_c_pic_ie.o): New target.
11558         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11559         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11560         (tls_test_c.o): New target.
11561         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11562         (tls_pic_test_LDADD): Likewise.
11563         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11564         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11565         (tls_test_c_gnu2.o): New target.
11566         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11567         tls_test_c_gnu2.o.
11568         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11569         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11570         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11571         * testsuite/tls_test.cc: Include "config.h".
11572         (t_last): Call t11_last.
11573         * testsuite/tls_test.h (t11, t11_last): Declare.
11574         * testsuite/tls_test_c.c: New file.
11575         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11576         * configure.ac: Check for OpenMP support.
11577         * configure, config.in, Makefile.in: Rebuild.
11578         * testsuite/Makefile.in: Rebuild.
11579
11580 2008-04-16  Cary Coutant  <ccoutant@google.com>
11581
11582         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11583         (Target_i386::tls_base_symbol_defined_): New field.
11584         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11585         (Target_i386::Scan::global): Likewise.
11586         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11587         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11588         (Target_x86_64::tls_base_symbol_defined_): New field.
11589         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11590         (Target_x86_64::Scan::global): Likewise.
11591
11592 2008-04-16  Cary Coutant  <ccoutant@google.com>
11593
11594         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11595         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11596         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11597         building shared libraries.
11598         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11599         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11600         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11601         * testsuite/Makefile.in: Rebuild.
11602         * testsuite/weak_undef.h: New file.
11603         * testsuite/weak_undef_file1.cc: Add extra test cases.
11604         * testsuite/weak_undef_file2.cc: Likewise.
11605         * testsuite/weak_undef_test.cc: Likewise.
11606
11607 2008-04-16  David S. Miller  <davem@davemloft.net>
11608
11609         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11610         Add issued_non_pic_error_ field.  Declare check_non_pic.
11611         (Target_sparc::Scan::check_non_pic): New function.
11612         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11613         (Target_sparc::Scan::global): Likewise.
11614
11615         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11616         * configure: Rebuild.
11617
11618         * options.h (DEFINE_enable): New macro.
11619         (new_dtags): New enable option.
11620         (initfirst, interpose, loadfltr, nodefaultlib,
11621         nodelete, nodlopen, nodump): New -z options.
11622         * layout.cc (Layout:finish_dynamic_section): If new
11623         dtags enabled, emit DT_RUNPATH.  Also, emit a
11624         DT_FLAGS_1 containing any specified -z flags.
11625
11626 2008-04-16  Ian Lance Taylor  <iant@google.com>
11627
11628         * copy-relocs.cc: New file.
11629         * copy-relocs.h: New file.
11630         * reloc.cc: Remove Copy_relocs code.
11631         * reloc.h: Likewise.
11632         * reloc-types.h (struct Reloc_types) [both versions]: Add
11633         get_reloc_addend_noerror.
11634         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11635         variants of add_global which take an addend which must be zero.
11636         * i386.cc: Include "copy-relocs.h".
11637         (class Target_i386): Change type of copy_relocs_ to variable,
11638         update initializer.
11639         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11640         Change all callers.
11641         (Target_i386::do_finalize_sections): Change handling of
11642         copy_relocs_.
11643         * sparc.cc: Include "copy-relocs.h".
11644         (class Target_sparc): Change type of copy_relocs_ to variable,
11645         update initializer.
11646         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11647         Change all callers.
11648         (Target_sparc::do_finalize_sections): Change handling of
11649         copy_relocs_.
11650         * x86_64.cc: Include "copy-relocs.h".
11651         (class Target_x86_64): Change type of copy_relocs_ to variable,
11652         update initializer.
11653         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11654         class.  Change all callers.
11655         (Target_x86_64::do_finalize_sections): Change handling of
11656         copy_relocs_.
11657         * Makefile.am (CCFILES): Add copy-relocs.cc.
11658         (HFILES): Add copy-relocs.h.
11659
11660         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11661
11662         * testsuite/script_test_4.sh: Permit leading zeroes.
11663
11664 2008-04-15  Ian Lance Taylor  <iant@google.com>
11665
11666         * script-sections.cc (Script_sections::create_segments): Use
11667         header_size_adjustment even when there is enough room for the
11668         headers.
11669         * testsuite/script_test_4.sh: New file.
11670         * testsuite/script_test_4.t: New file.
11671         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11672         (check_DATA): Add script_test_4.stdout.
11673         (MOSTLYCLEANFILES): Likewise.
11674         (script_test_4): New target.
11675         (script_test_4.stdout): New target.
11676         * testsuite/Makefile.in: Rebuild.
11677
11678         * sparc.cc: Add definitions for Output_data_plt_sparc class
11679         constants.
11680
11681 2008-04-14  David S. Miller  <davem@davemloft.net>
11682
11683         * sparc.cc: New file.
11684         * Makefile.am (TARGETSOURCES): Add sparc.cc
11685         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11686         * configure.tgt: Document targ_extra_size and
11687         targ_extra_big_endian.  Add entries for sparc-* and
11688         sparc64-*.
11689         * configure.ac: Handle targ_extra_size and
11690         targ_extra_big_endian.
11691         * Makefile.in: Rebuild.
11692         * configure: Likewise.
11693         * po/POTFILES.in: Likewise.
11694         * po/gold.pot: Likewise.
11695
11696 2008-04-14  Ian Lance Taylor  <iant@google.com>
11697
11698         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11699         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11700         in the name/type/flags to section mapping.  Don't call
11701         allocate_output_section.
11702         (Layout::choose_output_section): Change parameter from adjust_name
11703         to is_input_section.  Don't permit input sections after sections
11704         are attached to segments.  Don't call allocate_output_section.
11705         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11706         not write_enable_output_section.
11707         (Layout::make_output_section): Don't push to
11708         unattached_section_list_ nor call attach_to_segment.  Call
11709         attach_section_to_segment if sections are attached.
11710         (Layout::attach_sections_to_segments): New function.
11711         (Layout::attach_section_to_segment): New function.
11712         (Layout::attach_allocated_section_to_segment): Rename from
11713         attach_to_segment.  Remove flags parameter.
11714         (Layout::allocate_output_section): Remove function.
11715         (Layout::write_enable_output_section): Remove function.
11716         * layout.h (class Layout): Update for above changes.  Add new
11717         field sections_are_attached_.
11718         * output.h (Output_section::update_flags_for_input_section): New
11719         function.
11720         * output.cc (Output_section::add_input_section): Call
11721         update_flags_for_input_section.
11722         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11723
11724 2008-04-11  Cary Coutant  <ccoutant@google.com>
11725
11726         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11727         thought unnecessary.
11728         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11729
11730 2008-04-11  Ian Lance Taylor  <iant@google.com>
11731
11732         * output.h (class Output_section_data): Remove inline definition
11733         of set_addralign.
11734         * output.cc (Output_section_data::set_addralign): New function.
11735
11736 2008-04-11  Cary Coutant  <ccoutant@google.com>
11737
11738         Add support for TLS descriptors for i386 and x86_64.
11739         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11740         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11741         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11742         GOT_TYPE_TLS_DESC.
11743         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11744         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11745         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11746         relocations.
11747         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11748         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11749         Fix problem with initial-exec relocations.
11750         (Target_i386::Relocate::relocate_tls): Likewise.
11751         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11752         relaxation.
11753         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11754         support for section-plus-offset dynamic table entries.
11755         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11756         (Output_data_dynamic::Dynamic_entry): Add support for
11757         section-plus-offset dynamic table entries.
11758         (Output_data_dynamic::Classification): Likewise.
11759         (Output_data_dynamic::classification_): Renamed offset_.
11760         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11761         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11762         (Target_x86_64::make_plt_section): New function.
11763         (Target_x86_64::reserve_tlsdesc_entries): New function.
11764         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11765         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11766         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11767         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11768         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11769         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11770         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11771         add extra PLT entry for TLS descriptors.
11772         (Output_data_plt_x86_64::got_): New field.
11773         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11774         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11775         fields.
11776         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11777         descriptors.
11778         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11779         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11780         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11781         R_386_TLS_DESC_CALL relocations.
11782         (Target_x86_64::Scan::global): Likewise.
11783         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11784         for TLS descriptors.
11785         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11786         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11787         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11788         GD-to-IE relaxation.
11789         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11790         and TLS_DESCRIPTORS.
11791         * Makefile.in: Rebuild.
11792         * configure: Rebuild.
11793         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11794         (tls_test_shared2.so): New target.
11795         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11796         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11797         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11798         (tls_shared_gd_to_ie_test_LDADD): New variable.
11799         (tls_shared_gnu2_gd_to_ie_test): New target.
11800         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11801         New targets.
11802         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11803         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11804         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11805         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11806         (tls_shared_gnu2_test): New target.
11807         (tls_test_gnu2_shared.so): New target.
11808         (tls_shared_gnu2_test_SOURCES): New variable.
11809         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11810         (tls_shared_gnu2_test_LDFLAGS): New variable.
11811         (tls_shared_gnu2_test_LDADD): New variable.
11812         * testsuite/Makefile.in: Rebuild.
11813         * testsuite/Makefile.
11814
11815 2008-04-11  Ian Lance Taylor  <iant@google.com>
11816
11817         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11818         justsyms.t.
11819         * testsuite/Makefile.in: Rebuild.
11820
11821         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11822         long.
11823         * testsuite/script_test_2.cc (main): Adjust test.
11824
11825 2008-04-11  David S. Miller  <davem@davemloft.net>
11826             Ian Lance Taylor  <iant@google.com>
11827
11828         * options.h (General_options): Add entries for '-Y' and
11829         '-relax'.
11830         * options.cc (General_options:finalize): If -Y was used, add those
11831         entries to the library path instead of the default "/lib" and
11832         "/usr/lib".
11833
11834 2008-04-11  David S. Miller  <davem@davemloft.net>
11835
11836         * testsuite/justsyms.t: Start at 0x100.
11837         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11838         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11839         long.
11840         * testsuite/script_test_2.cc: Adjust string and section length
11841         checks.
11842
11843 2008-04-09  Ian Lance Taylor  <iant@google.com>
11844
11845         PR gold/5996
11846         * script-sections.cc (Sections_element::allocate_to_segment): Add
11847         orphan parameter.
11848         (Output_section_definition::allocate_to_segment): Likewise.
11849         (Orphan_output_section::allocate_to_segment): Likewise.
11850         (Script_sections::attach_sections_using_phdrs_clause): Don't
11851         propagate non-PT_LOAD segments to orphan sections.
11852         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11853         readelf rather than objdump.
11854         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11855         .interp section and PT_INTERP segment are the same size.
11856         * testsuite/Makefile.in: Rebuild.
11857
11858         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11859         aliases for symbols defined in the same object.
11860         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11861         (weak_alias_test_SOURCES): New variable.
11862         (weak_alias_test_DEPENDENCIES): New variable.
11863         (weak_alias_test_LDFLAGS): New variable.
11864         (weak_alias_test_LDADD): New variable.
11865         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11866         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11867         (weak_alias_test_3.o): New target.
11868         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11869         * testsuite/weak_alias_test_main.cc: New file.
11870         * testsuite/weak_alias_test_1.cc: New file.
11871         * testsuite/weak_alias_test_2.cc: New file.
11872         * testsuite/weak_alias_test_3.cc: New file.
11873
11874 2008-04-08  Ian Lance Taylor  <iant@google.com>
11875
11876         * options.h (class General_options): Add --noinhibit-exec option.
11877         * main.cc (main): Check --noinhibit-exec.
11878
11879         * options.h (class General_options): Define --wrap as a special
11880         option.  Add wrap_symbols_ field.
11881         (General_options::any_wrap_symbols): New function.
11882         (General_options::is_wrap_symbol): New function.
11883         * options.cc (General_options::parse_wrap): New function.
11884         (General_options::General_options): Initialize wrap_symbols_.
11885         * symtab.cc (Symbol_table::wrap_symbol): New function.
11886         (Symbol_table::add_from_object): Handle --wrap.
11887         * symtab.h (class Symbol_table): Declare wrap_symbol.
11888         * target.h (Target::wrap_char): New function.
11889         (Target::Target_info): Add wrap_char field.
11890         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11891         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11892         * testsuite/testfile.cc (Target_test::test_target_info):
11893         Likewise.
11894
11895         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11896         there is one.
11897
11898         * layout.h (class Layout): Add added_eh_frame_data_ field.
11899         * layout.cc (Layout::Layout): Initialize new field.
11900         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11901         output section until we find a section we merged successfully.
11902         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11903         that the size be non-zero.
11904
11905         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11906         qualifier.
11907
11908 2008-04-08  Craig Silverstein  <csilvers@google.com>
11909
11910         * configure.ac: Export new conditional variable HAVE_ZLIB.
11911         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11912         on HAVE_ZLIB.
11913         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11914         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11915
11916 2008-04-07  Ian Lance Taylor  <iant@google.com>
11917
11918         * version.cc (version_string): Set to "1.5".
11919
11920         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11921         Add issued_non_pic_error_ field.  Declare check_non_pic.
11922         (Target_x86_64::Scan::check_non_pic): New function.
11923         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11924         (Target_x86_64::Scan::global): Likewise.
11925
11926         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11927         addend parameter.  Change caller.  Handle merge sections.
11928         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11929         Address to Addend.  Don't add in the result of
11930         local_section_offset, pass down the addend and use the returned
11931         value.
11932         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11933         Update declarations of local_section_offset and symbol_value.
11934         * testsuite/two_file_test_1.cc (t18): New function.
11935         * testsuite/two_file_test_2.cc (f18): New function.
11936         * testsuite/two_file_test_main.cc (main): Call t18.
11937         * testsuite/two_file_test.h (t18, f18): Declare.
11938
11939         * configure.ac: Don't test for objdump, c++filt, or readelf.
11940         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11941         conditionals.
11942         (TEST_READELF): New variable.
11943         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11944         (check_PROGRAMS): Add two_file_strip_test.
11945         (two_file_strip_test): New target.
11946         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11947         (two_file_same_shared_strip_test_SOURCES): New variable.
11948         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11949         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11950         (two_file_same_shared_strip_test_LDADD): New variable.
11951         (two_file_shared_strip.so): New target.
11952         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11953         (ver_test_5.syms, ver_test_7.syms): Likewise.
11954         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11955         (strip_test_3.stdout): Use TEST_OBJDUMP.
11956         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11957
11958 2008-04-04  Cary Coutant  <ccoutant@google.com>
11959
11960         * symtab.h (Symbol::is_weak_undefined): New function.
11961         (Symbol::is_strong_undefined): New function.
11962         (Symbol::is_absolute): New function.
11963         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11964         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11965         absolute symbols.
11966         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11967         (weak_undef_test): New target.
11968         * testsuite/Makefile.in: Rebuild.
11969         * testsuite/weak_undef_file1.cc: New file.
11970         * testsuite/weak_undef_file2.cc: New file.
11971         * testsuite/weak_undef_test.cc: New file.
11972
11973 2008-04-03  Craig Silverstein  <csilvers@google.com>
11974
11975         * compressed_output.h (class Output_compressed_section): Use
11976         unsigned buffer.
11977         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11978         add zlib header.
11979         (zlib_compressed_suffix): Removed.
11980         (Output_compressed_section::set_final_data_size): Use unsigned
11981         buffers.
11982         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11983         Fix linker invocation.
11984         (flagstest_o_specialfile_and_compress_debug_sections):
11985         Likewise.
11986         * testsuite/Makefile.in: Regenerated.
11987
11988 2008-04-02  David S. Miller  <davem@davemloft.net>
11989
11990         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11991         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11992
11993 2008-04-02  Craig Silverstein  <csilvers@google.com>
11994
11995         * TODO: New file.
11996
11997 2008-04-02  Ian Lance Taylor  <iant@google.com>
11998
11999         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12000         parameters.  Update for new key type to views_.  Change all
12001         callers.
12002         (File_read::read): Adjust for byteshift in returned view.
12003         (File_read::add_view): New function, broken out of
12004         find_and_make_view.
12005         (File_read::make_view): New function, broken out of
12006         find_and_make_view.
12007         (File_read::find_or_make_view): Add offset and aligned
12008         parameters.  Rewrite accordingly.  Change all callers.
12009         (File_read::get_view): Add offset and aligned parameters.  Adjust
12010         for byteshift in return value.
12011         (File_read::get_lasting_view): Likewise.
12012         * fileread.h (class File_read): Update declarations.
12013         (class File_read::View): Add byteshift_ field.  Add byteshift to
12014         constructor.  Add byteshift method.
12015         * archive.h (Archive::clear_uncached_views): New function.
12016         (Archive::get_view): Add aligned parameter.  Change all callers.
12017         * object.h (Object::get_view): Add aligned parameter.  Change all
12018         callers.
12019         (Object::get_lasting_view): Likewise.
12020
12021         * fileread.cc (File_read::release): Don't call clear_views if
12022         there are multiple objects.
12023         * fileread.h (File_read::clear_uncached_views): New function.
12024         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12025         on the archive.
12026
12027 2008-03-31  Cary Coutant  <ccoutant@google.com>
12028
12029         Add thin archive support.
12030         * archive.cc (Archive::armagt): New const.
12031         (Archive::setup): Remove task parameter and calls to unlock.
12032         (Archive::unlock_nested_archives): New function.
12033         (Archive::read_header): Add nested_off parameter. Change
12034         all callers.
12035         (Archive::interpret_header): Likewise.
12036         (Archive::include_all_members): Change to handle thin
12037         archives.
12038         (Archive::include_member): Likewise.
12039         * archive.h (Archive::Archive): Add new parameters and
12040         initializers.
12041         (Archive::armagt): New const.
12042         (Archive::setup): Remove task parameter.
12043         (Archive::unlock_nested_archives): New function.
12044         (Archive::read_header): Add nested_off parameter.
12045         (Archive::interpret_header): Likewise.
12046         (Archive::Nested_archive_table): New typedef.
12047         (Archive::is_thin_archive_): New field.
12048         (Archive::nested_archives_): New field.
12049         (Archive::options_): New field.
12050         (Archive::dirpath_): New field.
12051         (Archive::task_): New field.
12052         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12053         for thin archives.  Pass additional parameters to
12054         Archive::Archive.  Unlock the archive file after calling
12055         Archive::setup.
12056
12057 2008-03-29  Ian Lance Taylor  <iant@google.com>
12058
12059         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12060         version symbol to be local.
12061         * testsuite/ver_test_4.sh: New file.
12062         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12063         (check_DATA): Add ver_test_4.syms.
12064         (ver_test_4.syms): New target.
12065         * testsuite/Makefile.in: Rebuild.
12066
12067         * output.cc
12068         (Output_section::Input_section_sort_entry::has_priority): New
12069         function.
12070         (Output_section::Input_section_sort_entry::match_file_name): New
12071         function.
12072         (Output_section::Input_section_sort_entry::match_section_name):
12073         Remove.
12074         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12075         Remove.
12076         (Output_section::Input_section_sort_entry::match_section_file):
12077         Remove.
12078         (Output_section::Input_section_sort_compare::operator()): Rewrite
12079         using new Input_section_sort_entry functions.  Sort crtbegin and
12080         crtend first.  Sort sections with no priority before sections with
12081         a priority.
12082         * testsuite/initpri1.c (d3): Check j != 4.
12083         (cd5): New constructor/destructor function.
12084         (main): Check j != 2.
12085
12086         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12087         new symbol when resolving, don't call set_is_default.
12088         * testsuite/ver_test_7.cc: New file.
12089         * testsuite/ver_test_7.sh: New file.
12090         * testsuite/Makefile.am (ver_test_7.so): New target.
12091         (ver_test_7.o): New target.
12092         (check_SCRIPTS): Add ver_test_7.sh.
12093         (check_DATA): Add ver_test_7.syms.
12094         (ver_test_7.syms): New target.
12095
12096 2008-03-28  Ian Lance Taylor  <iant@google.com>
12097
12098         * layout.cc (Layout::layout): If we see an input section with a
12099         name that needs sorting, set the must_sort flag for the output
12100         section.
12101         (Layout::make_output_section): If the name of the output section
12102         indicates that it might require sorting, set the may_sort flag.
12103         * output.h (Output_section::may_sort_attached_input_sections): New
12104         function.
12105         (Output_section::set_may_sort_attached_input_sections): New
12106         function.
12107         (Output_section::must_sort_attached_input_sections): New
12108         function.
12109         (Output_section::set_must_sort_attached_input_sections): New
12110         function.
12111         (class Output_section): Declare Input_section_sort_entry.  Define
12112         Input_section_sort_compare.  Declare
12113         sort_attached_input_sections.  Add new fields:
12114         may_sort_attached_input_sections_,
12115         must_sort_attached_input_sections_,
12116         attached_input_sections_are_sorted_.
12117         * output.cc (Output_section::Output_section): Initialize new
12118         fields.
12119         (Output_section::add_input_section): Add an entry to
12120         input_sections_ if may_sort or must_sort are true.
12121         (Output_section::set_final_data_size): Call
12122         sort_attached_input_sections if necessary.
12123         (Output_section::Input_section_sort_entry): Define new class.
12124         (Output_section::Input_section_sort_compare::operator()): New
12125         function.
12126         (Output_section::sort_attached_input_sections): New function.
12127         * configure.ac: Check whether the compiler supports constructor
12128         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12129         * testsuite/initpri1.c: New file.
12130         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12131         CONSTRUCTOR_PRIORITY.
12132         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12133         (initpri1_LDFLAGS): New variable.
12134         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12135
12136 2008-03-27  Ian Lance Taylor  <iant@google.com>
12137
12138         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12139         * testsuite/common_test_1.c: New file.
12140         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12141         (common_test_1_SOURCES): New variable.
12142         (common_test_1_DEPENDENCIES): New variable.
12143         (common_test_1_LDFLAGS): New variable.
12144
12145         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12146         and commons_ correctly when NAME/VERSION does not override
12147         NAME/NULL.
12148         * testsuite/ver_test_6.c: New file.
12149         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12150         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12151         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12152
12153 2008-03-26  Ian Lance Taylor  <iant@google.com>
12154
12155         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12156         of an undefined symbol from a version script.
12157         * testsuite/Makefile.am (ver_test_5.so): New target.
12158         (ver_test_5.o): New target.
12159         (check_SCRIPTS): Add ver_test_5.sh.
12160         (check_DATA): Add ver_test_5.syms.
12161         (ver_test_5.syms): New target.
12162         * testsuite/ver_test_5.cc: New file.
12163         * testsuite/ver_test_5.script: New file.
12164         * testsuite/ver_test_5.sh: New file.
12165         * Makefile.in, testsuite/Makefile.in: Rebuild.
12166
12167         PR gold/5986
12168         Fix problems building gold with gcc 4.3.0.
12169         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12170         (gold_error_at_location, gold_warning_at_location): Use it.
12171         * configure.ac: Check whether we can compile and use a template
12172         function with a printf attribute.
12173         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12174         when jumping over bytes.
12175         * object.cc: Instantiate Object::read_section_data.
12176         * debug.h: Include <cstring>
12177         * dwarf_reader.cc: Include <algorithm>
12178         * main.cc: Include <cstring>.
12179         * options.cc: Include <cstring>.
12180         * output.cc: Include <cstring>.
12181         * script.cc: Include <cstring>.
12182         * script.h: Include <string>.
12183         * symtab.cc: Include <cstring> and <algorithm>.
12184         * target-select.cc: Include <cstring>.
12185         * version.cc: Include <string>.
12186         * testsuite/testmain.cc: Include <cstdlib>.
12187         * configure, config.in: Rebuild.
12188
12189 2008-03-25  Ian Lance Taylor  <iant@google.com>
12190
12191         * options.cc: Include "../bfd/bfdver.h".
12192         (options::help): Print bug reporting address.
12193
12194         * version.cc (print_version): Adjust output for current value of
12195         BFD_VERSION_STRING.
12196
12197         * NEWS: New file.
12198
12199         * options.cc (options::help): Print list of supported targets.
12200         * target-select.h: Include <vector>.
12201         (class Target_selector): Make machine_, size_, and is_big_endian_
12202         fields const.  Add bfd_name_ and instantiated_target_ fields.
12203         (Target_selector::Target_selector): Add bfd_name parameter.
12204         (Target_selector::recognize): Make non-virtual, call
12205         do_recognize.
12206         (Target_selector::recognize_by_name): Make non-virtual, call
12207         do_recognize_by_name.
12208         (Target_selector::supported_names): New function.
12209         (Target_selector::bfd_name): New function.
12210         (Target_selector::do_instantiate_target): New pure virtual
12211         function.
12212         (Target_selector::do_recognize): New virtual function.
12213         (Target_selector::do_recognize_by_name): New virtual function.
12214         (Target_selector::instantiate_target): New private function.
12215         (supported_target_names): Declare.
12216         * target-select.cc (Target_selector::Target_selector): Update for
12217         new parameter and fields.
12218         (select_target_by_name): Check that the name matches before
12219         calling recognize_by_name.
12220         (supported_target_names): New function.
12221         * i386.cc (class Target_selector_i386): Update Target_selector
12222         constructor call.  Remove recognize and recognize_by_name.  Add
12223         do_instantiate_target.
12224         * x86_64.cc (class Target_selector_x86_64): Likewise.
12225         * testsuite/testfile.cc (class Target_selector_test): Update for
12226         changes to Target_selector.
12227
12228         * README: Rewrite, with some notes on unsupported features.
12229
12230 2008-03-24  Cary Coutant  <ccoutant@google.com>
12231
12232         * i386.cc (Target_i386::Got_type): New enum declaration.
12233         (Target_i386::Scan::local): Updated callers of Output_data_got
12234         member functions.
12235         (Target_i386::Scan::global): Likewise.
12236         (Target_i386::Relocate::relocate): Likewise.
12237         (Target_i386::Relocate::relocate_tls): Likewise.
12238         * object.h (Got_offset_list): New class.
12239         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12240         (Sized_relobj::local_got_offset): Likewise.
12241         (Sized_relobj::set_local_got_offset): Likewise.
12242         (Sized_relobj::local_has_tls_got_offset): Removed.
12243         (Sized_relobj::local_tls_got_offset): Removed.
12244         (Sized_relobj::set_local_tls_got_offset): Removed.
12245         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12246         * output.cc (Output_data_got::add_global): Added got_type parameter.
12247         (Output_data_got::add_global_with_rel): Likewise.
12248         (Output_data_got::add_global_with_rela): Likewise.
12249         (Output_data_got::add_global_pair_with_rel): New function.
12250         (Output_data_got::add_global_pair_with_rela): New function.
12251         (Output_data_got::add_local): Added got_type parameter.
12252         (Output_data_got::add_local_with_rel): Likewise.
12253         (Output_data_got::add_local_with_rela): Likewise.
12254         (Output_data_got::add_local_pair_with_rel): New function.
12255         (Output_data_got::add_local_pair_with_rela): New function.
12256         (Output_data_got::add_global_tls): Removed.
12257         (Output_data_got::add_global_tls_with_rel): Removed.
12258         (Output_data_got::add_global_tls_with_rela): Removed.
12259         (Output_data_got::add_local_tls): Removed.
12260         (Output_data_got::add_local_tls_with_rel): Removed.
12261         (Output_data_got::add_local_tls_with_rela): Removed.
12262         * output.h (Output_data_got::add_global): Added got_type parameter.
12263         (Output_data_got::add_global_with_rel): Likewise.
12264         (Output_data_got::add_global_with_rela): Likewise.
12265         (Output_data_got::add_global_pair_with_rel): New function.
12266         (Output_data_got::add_global_pair_with_rela): New function.
12267         (Output_data_got::add_local): Added got_type parameter.
12268         (Output_data_got::add_local_with_rel): Likewise.
12269         (Output_data_got::add_local_with_rela): Likewise.
12270         (Output_data_got::add_local_pair_with_rel): New function.
12271         (Output_data_got::add_local_pair_with_rela): New function.
12272         (Output_data_got::add_global_tls): Removed.
12273         (Output_data_got::add_global_tls_with_rel): Removed.
12274         (Output_data_got::add_global_tls_with_rela): Removed.
12275         (Output_data_got::add_local_tls): Removed.
12276         (Output_data_got::add_local_tls_with_rel): Removed.
12277         (Output_data_got::add_local_tls_with_rela): Removed.
12278         * resolve.cc (Symbol::override_base_with_special): Removed
12279         reference to has_got_offset_ field.
12280         * symtab.cc (Symbol::init_fields): Replaced initialization
12281         of got_offset_ with got_offsets_.  Removed initialization
12282         of has_got_offset_
12283         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12284         (Symbol::got_offset): Likewise.
12285         (Symbol::set_got_offset): Likewise.
12286         (Symbol::has_tls_got_offset): Removed.
12287         (Symbol::tls_got_offset): Removed.
12288         (Symbol::set_tls_got_offset): Removed.
12289         (Symbol::got_offset_): Removed.
12290         (Symbol::tls_mod_got_offset_): Removed.
12291         (Symbol::tls_pair_got_offset_): Removed.
12292         (Symbol::got_offsets_): New field.
12293         (Symbol::has_got_offset): Removed.
12294         (Symbol::has_tls_mod_got_offset): Removed.
12295         (Symbol::has_tls_pair_got_offset): Removed.
12296         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12297         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12298         member functions.
12299         (Target_x86_64::Scan::global): Likewise.
12300         (Target_x86_64::Relocate::relocate): Likewise.
12301         (Target_x86_64::Relocate::relocate_tls): Likewise.
12302
12303 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12304
12305         * yyscript.y: Fix spelling error in comment.
12306
12307 2008-03-24  Ian Lance Taylor  <iant@google.com>
12308
12309         * options.h (class General_options): Define build_id option.
12310         * layout.h (class Layout): Declare write_build_id, create_note,
12311         create_build_id.  Add build_id_note_ member.
12312         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12313         "libiberty.h", "md5.h", "sha1.h".
12314         (Layout::Layout): Initialize eh_frame_data_,
12315         eh_frame_hdr_section_, and build_id_note_.
12316         (Layout::finalize): Call create_build_id.
12317         (Layout::create_note): New function, broken out of
12318         Layout::create_gold_note.
12319         (Layout::create_gold_note): Call create_note.
12320         (Layout::create_build_id): New function.
12321         (Layout::write_build_id): New function.
12322         (Close_task_runner::run): Call write_build_id.
12323
12324         * x86_64.cc: Correct license to GPLv3.
12325
12326 2008-03-23  Ian Lance Taylor  <iant@google.com>
12327
12328         * options.cc: Include "demangle.h".
12329         (parse_optional_string): New function.
12330         (parse_long_option): Handle takes_optional_argument.
12331         (parse_short_option): Update dash_z initializer.  Handle
12332         takes_optional_argument.
12333         (General_options::General_options): Initialize do_demangle_.
12334         (General_options::finalize): Set do_demangle_.  Handle demangling
12335         style.
12336         * options.h (parse_optional_string): Declare.
12337         (struct One_option): Add optional_arg field.  Update constructor.
12338         Update call constructor calls.  Add takes_optional_argument
12339         function.
12340         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12341         (DEFINE_optional_string): Define.
12342         (General_options::demangle): Change from DEFINE_bool to
12343         DEFINE_optional_string.
12344         (General_options::no_demangle): New function.
12345         (General_options::do_demangle): New function.
12346         (General_options::set_do_demangle): New function.
12347         (General_options::execstack_status_): Move definition to end of
12348         class definition.
12349         (General_options::static_): Likewise.
12350         (General_options::do_demangle_): New field.
12351         * object.cc (big_endian>::get_symbol_location_info): Call
12352         Options::do_demangle, not Options::demangle.
12353         * symtab.cc (demangle): Likewise.
12354
12355 2008-03-22  Ian Lance Taylor  <iant@google.com>
12356
12357         * gold.h: Include <cstddef> and <sys/types.h>
12358         * options.h: Include <cstring>.
12359
12360 2008-03-21  Ian Lance Taylor  <iant@google.com>
12361
12362         * Added source code to GNU binutils.