PR gold/13359
[binutils.git] / gold / ChangeLog
blobfddf7d0700fb564b7f073033667689fbd9492376
1 2011-10-31  Cary Coutant  <ccoutant@google.com>
3         PR gold/13359
4         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5         unnecessary assertion.
6         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
8 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
10         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
11         gc_mark_symbol.
12         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
13         gc_mark_symbol.
14         Change to just keep the section associated with symbol.
15         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
16         they are externally visible and --export-dynamic is turned on.
17         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
19 2011-10-19  Ian Lance Taylor  <iant@google.com>
21         PR gold/13163
22         * script-sections.cc
23         (Output_section_element_dot_assignment::needs_output_section): New
24         function.
26 2011-10-19  Ian Lance Taylor  <iant@google.com>
28         PR gold/13204
29         * layout.cc (Layout::segment_precedes): Don't assert failure if a
30         --section-start option was seen.
31         * options.h (General_options::any_section_start): New function.
33 2011-10-18  David S. Miller  <davem@davemloft.net>
35         PR binutils/13301
36         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
37         member to track relocation locations that have moved during TLS
38         reloc optimizations.
39         (Target_sparc::Relocate::Relocate): Initialize to NULL.
40         (Target_sparc::Relocate::relocate): Adjust view down by 4
41         bytes if it matches reloc_adjust_addr_.
42         (Target_sparc::Relocate::relocate_tls): Always move the
43         __tls_get_addr call delay slot instruction forward 4 bytes when
44         performing relaxation.
46 2011-10-18  Cary Coutant  <ccoutant@google.com>
48         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
49         (Output_file::map_no_anonymous): Check for non-zero
50         return code from posix_fallocate.
52 2011-10-17  Cary Coutant  <ccoutant@google.com>
54         PR gold/13245
55         * plugin.cc (is_visible_from_outside): Check for symbols
56         referenced from dynamic objects.
57         * resolve.cc (Symbol_table::resolve): Don't count references
58         from dynamic objects as references from real ELF files.
59         * testsuite/plugin_test_2.sh: Adjust expected result.
61 2011-10-17  Cary Coutant  <ccoutant@google.com>
63         * gold.cc: Include timer.h.
64         (queue_middle_tasks): Stamp time.
65         (queue_final_tasks): Likewise.
66         * main.cc (main): Store timer in parameters.  Print timers
67         for each pass.
68         * parameters.cc (Parameters::Parameters): Initialize timer_.
69         (Parameters::set_timer): New function.
70         (set_parameters_timer): New function.
71         * parameters.h (Parameters::set_timer): New function.
72         (Parameters::timer): New function.
73         (Parameters::timer_): New data member.
74         (set_parameters_timer): New function.
75         * timer.cc (Timer::stamp): New function.
76         (Timer::get_pass_time): New function.
77         * timer.h (Timer::stamp): New function.
78         (Timer::get_pass_time): New function.
79         (Timer::pass_times_): New data member.
81 2011-10-17  Cary Coutant  <ccoutant@google.com>
83         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
84         task for members of lib groups.
86 2011-10-17  Cary Coutant  <ccoutant@google.com>
88         PR gold/13288
89         * fileread.cc (File_read::find_view): Add assert.
90         (File_read::make_view): Move bounds check (replace with assert)...
91         (File_read::find_or_make_view): ... to here.
93 2011-10-12  Cary Coutant  <ccoutant@google.com>
95         * output.cc (Output_file::open_base_file): Handle case where
96         ::read returns less than requested size.
98 2011-10-10  Cary Coutant  <ccoutant@google.com>
100         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
101         Initialize defined_count_.
102         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
103         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
104         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
105         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
106         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
107         * incremental.h (Sized_relobj_incr::defined_count_): New data
108         member.
109         (Sized_incr_dynobj::defined_count_): New data member.
110         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
111         Return zeroes instead of internal error.
113 2011-10-10  Cary Coutant  <ccoutant@google.com>
115         PR gold/13249
116         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
117         (Output_reloc::symbol_value): Return PLT offset if flag is set.
118         * output.h (class Output_reloc): Add use_plt_offset flag.
119         (Output_reloc::type_): Adjust size of bit field.
120         (Output_reloc::use_plt_offset_): New bit field.
121         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
122         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
123         flag.  Adjust all callers.
124         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
125         creating RELATIVE relocations.
127 2011-10-10  Nick Clifton  <nickc@redhat.com>
129         * po/es.po: Updated Spanish translation.
130         * po/fi.po: Updated Finnish translation.
132 2011-10-03   Diego Novillo  <dnovillo@google.com>
134         * options.cc (parse_uint): Fix dereference of RETVAL.
136 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
138         * layout.h (section_order_map_): New member.
139         (get_section_order_map): New member function.
140         * output.cc (Output_section::add_input_section): Check for patterns
141         only when --section-ordering-file is specified.
142         * gold.cc (queue_middle_tasks): Delay updating order of sections till
143         output_sections have been formed.
144         * layout.cc (Layout_Layout): Initialize section_order_map_.
145         * plugin.cc (update_section_order): Store order in order_map. Do not
146         update the order.
147         * testsuite/Makefile.am: Add test case for plugin_final_layout.
148         * testsuite/Makefile.in: Regenerate.
149         * testsuite/plugin_section_order.c: New file.
150         * testsuite/plugin_final_layout.cc: New file.
151         * testsuite/plugin_final_layout.sh: New file.
153 2011-09-29  Cary Coutant  <ccoutant@google.com>
155         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
156         Check for NULL.
157         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
158         symbols during incremental update.
159         (Symbol_table::add_from_dynobj): Likewise.
161 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
162             Ian Lance Taylor  <iant@google.com>
164         * symtab.cc (Symbol_table::define_special_symbol): Always
165         canonicalize version string.
167 2011-09-26  Cary Coutant  <ccoutant@google.com>
169         * gold.cc (queue_initial_tasks): Move option checks ...
170         * options.cc (General_options::finalize): ... to here. Disable
171         some options; make others fatal.
173 2011-09-26  Cary Coutant  <ccoutant@google.com>
175         gcc PR lto/47247
176         * plugin.cc (get_symbols_v2): New function.
177         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
178         (is_referenced_from_outside): New function.
179         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
180         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
181         (get_symbols): Pass version parameter.
182         (get_symbols_v2): New function.
183         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
184         parameter.
185         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
186         (onload): Add LDPT_GET_SYMBOLS_V2.
187         (all_symbols_read_hook): Use get_symbols_v2; check for
188         LDPR_PREVAILING_DEF_IRONLY_EXP.
189         * testsuite/plugin_test_3.sh: Update expected results.
191 2011-09-23  Simon Baldwin  <simonb@google.com>
193         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
194         configuration options.
195         * configure: Regenerate.
196         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
197         * Makefile.in: Regenerate.
198         * testsuite/Makefile.in: Regenerate.
200 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
202         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
204 2011-09-19  Cary Coutant  <ccoutant@google.com>
206         * incremental.cc (can_incremental_update): Fix typo in comment.
207         * incremental.h (can_incremental_update): Likewise.
209 2011-09-18  Cary Coutant  <ccoutant@google.com>
211         * incremental.cc (can_incremental_update): New function.
212         * incremental.h (can_incremental_update): New function.
213         * layout.cc (Layout::init_fixed_output_section): Call it.
214         (Layout::make_output_section): Don't allow patch space in .eh_frame.
215         * object.cc (Sized_relobj_file::do_layout): Call
216         can_incremental_update.
218 2011-09-13  Cary Coutant  <ccoutant@google.com>
220         * configure.ac: Check for glibc support for gnu_indirect_function
221         support with static linking, setting automake conditional
222         IFUNC_STATIC.
223         * Makefile.in: Regenerate.
224         * configure: Regenerate.
226         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
227         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
228         for IFUNC_STATIC.
229         * testsuite/Makefile.in: Regenerate.
231 2011-09-13  Cary Coutant  <ccoutant@google.com>
233         * incremental.cc (Sized_relobj_incr::do_layout): Call
234         report_comdat_group for kept comdat sections.
235         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
236         * testsuite/Makefile.in: Regenerate.
237         * testsuite/incr_comdat_test_1.cc: New source file.
238         * testsuite/incr_comdat_test_2_v1.cc: New source file.
239         * testsuite/incr_comdat_test_2_v2.cc: New source file.
240         * testsuite/incr_comdat_test_2_v3.cc: New source file.
242 2011-09-13  Ian Lance Taylor  <iant@google.com>
244         * object.cc (Sized_relobj_file::do_layout): Remove unused local
245         variable external_symbols_offset.
247 2011-09-12  Ian Lance Taylor  <iant@google.com>
249         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
250         triggered if object has no symbols.
252 2011-09-09  David S. Miller  <davem@davemloft.net>
254         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
255         (Output_fill_debug_line::do_write): Likewise.
257 2011-08-29  Cary Coutant  <ccoutant@google.com>
259         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
260         casts to match formatting specs.
261         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
263 2011-08-26  Cary Coutant  <ccoutant@google.com>
265         * layout.cc (Free_list::allocate): Provide guarantee of minimum
266         remaining hole size when allocating.
267         (Layout::make_output_section): Set fill methods for debug sections.
268         * layout.h (Free_list::Free_list_node): Move from private to
269         public.
270         (Free_list::set_min_hole_size): New function.
271         (Free_list::begin, Free_list::end): New functions.
272         (Free_list::min_hole_): New data member.
273         * output.cc: Include dwarf.h.
274         (Output_fill_debug_info::do_minimum_hole_size): New function.
275         (Output_fill_debug_info::do_write): New function.
276         (Output_fill_debug_line::do_minimum_hole_size): New function.
277         (Output_fill_debug_line::do_write): New function.
278         (Output_section::Output_section): Initialize new data member.
279         (Output_section::set_final_data_size): Ensure patch space is larger
280         than minimum hole size.
281         (Output_section::do_write): Fill holes in debug sections.
282         * output.h (Output_fill): New class.
283         (Output_fill_debug_info): New class.
284         (Output_fill_debug_line): New class.
285         (Output_section::set_free_space_fill): New function.
286         (Output_section::free_space_fill_): New data member.
287         * testsuite/Makefile.am (incremental_test_3): Add
288         --incremental-patch option.
289         (incremental_test_4): Likewise.
290         (incremental_test_5): Likewise.
291         (incremental_test_6): Likewise.
292         (incremental_copy_test): Likewise.
293         (incremental_common_test_1): Likewise.
294         * testsuite/Makefile.in: Regenerate.
296 2011-08-26  Nick Clifton  <nickc@redhat.com>
298         * po/es.po: Updated Spanish translation.
300 2011-08-01  Cary Coutant  <ccoutant@google.com>
302         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
303         * gold/testsuite/Makefile.in: Regenerate.
304         * gold/testsuite/justsyms_exec.c: New source file.
305         * gold/testsuite/justsyms_lib.c: New source file.
307 2011-08-01  Cary Coutant  <ccoutant@google.com>
309         * layout.cc (Layout::set_segment_offsets): Don't realign text
310         segment if -Ttext was specified.
311         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
312         file type.
313         * object.h (Sized_relobj_file::e_type): New function.
314         (Sized_relobj_file::e_type_): New data member.
315         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
316         base address for ET_EXEC files.
317         * target.cc (Target::do_make_elf_object_implementation): Allow
318         ET_EXEC files with --just-symbols option.
320 2011-07-28  Cary Coutant  <ccoutant@google.com>
322         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
323         Add thread_number parameter.
324         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
325         * workqueue-threads.cc
326         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
327         current thread if its thread number is greater than desired thread
328         count.
329         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
330         Add thread_number parameter.
331         (Workqueue::should_cancel_thread): Likewise.
332         (Workqueue::find_runnable_or_wait): Pass thread_number to
333         should_cancel_thread.
334         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
335         parameter.
337 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
339         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
340         only after checking if it cannot be forced local.
341         * symtab.h (is_externally_visible): Check if the symbol is not forced
342         local.
344 2011-07-15  Ian Lance Taylor  <iant@google.com>
346         * options.h (class General_options): Add --print-output-format.
347         Move -EL next to -EB, for  better --help output.
348         * target-select.cc: Include <cstdio>, "options.h", and
349         "parameters.h".
350         (Target_selector::do_target_bfd_name): New function.
351         (print_output_format): New function.
352         * target-select.h (class Target_selector): Update declarations.
353         (Target_selector::target_bfd_name): New function.
354         (print_output_format): Declare.
355         * main.cc: Include "target-select.h".
356         (main): Handle --print-output-format.
357         * gold.cc: Include "target-select.h".
358         (queue_initial_tasks): Handle --print-output-format when there are
359         no input files.
360         * parameters.cc (parameters_force_valid_target): Give a better
361         error message if -EB/-EL does not match target.
362         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
363         function.
365 2011-07-15  Ian Lance Taylor  <iant@google.com>
367         * i386.cc (class Output_data_plt_i386): Add layout_ field.
368         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
369         (Output_data_plt_i386::do_write): Write address of .dynamic
370         section to first entry in .got.plt section.
371         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
372         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
373         Initialize layout_.
374         (Output_data_plt_x86_64::do_write): Write address of .dynamic
375         section to first entry in .got.plt section.
376         * layout.h (Layout::dynamic_section): New function.
378 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
380         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
381         to claim_file call.
382         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
383         input_section_position_, and input_section_glob_.
384         (read_layout_from_file): Call function section_ordering_specified.
385         * layout.h (is_section_ordering_specified): New function.
386         (section_ordering_specified): New function.
387         (section_ordering_specified_): New boolean member.
388         * main.cc(main): Call load_plugins after layout object is defined.
389         * output.cc (Output_section::add_input_section): Use
390         function section_ordering_specified to check if section ordering is
391         needed.
392         * output.cc (Output_section::add_relaxed_input_section): Use
393         function section_ordering_specified to check if section ordering is
394         needed.
395         (Output_section::update_section_layout): New function.
396         (Output_section::sort_attached_input_sections): Check if input section
397         must be reordered.
398         * output.h (Output_section::update_section_layout): New function.
399         * plugin.cc (get_section_count): New function.
400         (get_section_type): New function.
401         (get_section_name): New function.
402         (get_section_contents): New function.
403         (update_section_order): New function.
404         (allow_section_ordering): New function. 
405         (Plugin::load): Add the new interfaces to the transfer vector.
406         (Plugin_manager::load_plugins): New parameter.
407         (Plugin_manager::all_symbols_read): New parameter.
408         (Plugin_manager::claim_file): New parameter. Save the elf object for
409         unclaimed objects.
410         (Plugin_manager::get_elf_object): New function.
411         (Plugin_manager::get_view): Change to directly use the bool to check
412         if get_view is called from claim_file_hook.
413         * plugin.h (input_objects): New function
414         (Plugin__manager::load_plugins): New parameter.
415         (Plugin_manager::claim_file): New parameter.
416         (Plugin_manager::get_elf_object): New function.
417         (Plugin_manager::in_claim_file_handler): New function.
418         (Plugin_manager::in_claim_file_handler_): New member.
419         (layout): New function.
420         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
421         handler with an extra parameter. Make the elf object before calling
422         claim_file handler.
423         * testsuite/plugin_test.c (get_section_count): New function pointer.
424         (get_section_type): New function pointer.
425         (get_section_name): New function pointer.
426         (get_section_contents): New function pointer.
427         (update_section_order): New function pointer.
428         (allow_section_ordering): New function pointer.
429         (onload): Check if the new interfaces exist.
431 2011-07-13  Ian Lance Taylor  <iant@google.com>
433         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
434         relro section.
435         * x86_64.cc (Target_x86_64::got_section): Likewise.
436         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
437         (relro_now_test_SOURCES): New variable.
438         (relro_now_test_DEPENDENCIES): New variable.
439         (relro_now_test_LDFLAGS): New variable.
440         (relro_now_test_LDADD): New variable.
441         (relro_now_test.so): New target.
442         * testsuite/Makefile.in: Rebuild.
444 2011-07-12  Ian Lance Taylor  <iant@google.com>
446         PR gold/12980
447         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
448         GLOB_DAT relocation rather than a RELATIVE relocation for a
449         protected symbol when creating a shared library.
450         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
451         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
452         * testsuite/protected_main_1.cc (main): Test that protected
453         function has same address.
455 2011-07-11  Ian Lance Taylor  <iant@google.com>
457         PR gold/12979
458         * options.h (class General_options): Add -Bgroup.
459         * options.cc (General_options::finalize): If -Bgroup is set,
460         default to --unresolved-symbols=report-all.
461         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
462         * target-reloc.h (issue_undefined_symbol_error): Handle
463         --unresolved-symbols=report-all.
465 2011-07-08  Ian Lance Taylor  <iant@google.com>
467         PR gold/11985
468         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
469         if linker script discards key sections.
470         (Layout::create_dynamic_symtab): Likewise.
471         (Layout::assign_local_dynsym_offsets): Likewise.
472         (Layout::sized_create_version_sections): Likewise.
473         (Layout::create_interp): Likewise.
474         (Layout::finish_dynamic_section): Likewise.
475         (Layout::set_dynamic_symbol_size): Likewise.
477 2011-07-08  Ian Lance Taylor  <iant@google.com>
479         PR gold/12386
480         * options.h (class General_options): Add --unresolved-symbols.
481         * target-reloc.h (issue_undefined_symbol_error): Check
482         --unresolved-symbols.  Add comments.
484 2011-07-08  Ian Lance Taylor  <iant@google.com>
486         * testsuite/odr_violation2.cc (Ordering::operator()): Make
487         expression more complex.
489 2011-07-08  Ian Lance Taylor  <iant@google.com>
491         PR gold/11317
492         * target-reloc.h (issue_undefined_symbol_error): New inline
493         function, broken out of relocate_section.
494         (relocate_section): Call issue_undefined_symbol_error.
495         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
496         there is no TLS segment if we are about to issue an undefined
497         symbol error.
498         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
500 2011-07-08  Ian Lance Taylor  <iant@google.com>
502         PR gold/12279
503         * resolve.cc (Symbol_table::should_override): Add fromtype
504         parameter.  Change all callers.  Give error when linking together
505         TLS and non-TLS symbol.
506         (Symbol_table::should_override_with_special): Add fromtype
507         parameter.  Change all callers.
508         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
509         there is no TLS segment if we have reported some errors.
510         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
512 2011-07-08  Ian Lance Taylor  <iant@google.com>
514         PR gold/12372
515         * target.h (Target::plt_address_for_global): New function.
516         (Target::plt_address_for_local): New function.
517         (Target::plt_section_for_global): Remove.
518         (Target::plt_section_for_local): Remove.
519         (Target::do_plt_address_for_global): New virtual function.
520         (Target::do_plt_address_for_local): New virtual function.
521         (Target::do_plt_section_for_global): Remove.
522         (Target::do_plt_section_for_local): Remove.
523         (Target::register_global_plt_entry): Add Symbol_table and Layout
524         parameters.
525         * output.cc (Output_data_got::Got_entry::write): Use
526         plt_address_for_global and plt_address_for_local.
527         * layout.cc (Layout::add_target_dynamic_tags): Use size and
528         address of output section.
529         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
530         got_irelative_, and irelative_count_ fields.  Update
531         declarations.
532         (Output_data_plt_i386::has_irelative_section): New function.
533         (Output_data_plt_i386::entry_count): Add irelative_count_.
534         (Output_data_plt_i386::set_final_data_size): Likewise.
535         (class Target_i386): Add got_irelative_ and rel_irelative_
536         fields.  Update declarations.
537         (Target_i386::Target_i386): Initialize new fields.
538         (Target_i386::do_plt_address_for_global): New function replacing
539         do_plt_section_for_global.
540         (Target_i386::do_plt_address_for_local): New function replacing
541         do_plt_section_for_local.
542         (Target_i386::got_section): Create got_irelative_.
543         (Target_i386::rel_irelative_section): New function.
544         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
545         fields.  Don't define __rel_iplt_{start,end}.
546         (Output_data_plt_i386::add_entry): Add symtab and layout
547         parameters.  Change all callers.  Use different PLT and GOT for
548         IFUNC symbols.
549         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
550         layout parameters.  Change all callers.  Use different PLT and
551         GOT.
552         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
553         (Output_data_plt_i386::rel_irelative): New function.
554         (Output_data_plt_i386::address_for_global): New function.
555         (Output_data_plt_i386::address_for_local): New function.
556         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
557         IRELATIVE GOT when changing IFUNC GOT entries.
558         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
559         reloc.
560         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
561         if we didn't create an IRELATIVE GOT.
562         (Target_i386::Relocate::relocate): Use plt_address_for_global and
563         plt_address_for_local.
564         (Target_i386::do_dynsym_value): Use plt_address_for_global.
565         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
566         got_irelative_, and irelative_count_ fields.  Update
567         declarations.
568         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
569         Initialize new fields.  Remove symtab parameter.  Change all
570         callers.
571         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
572         irelative_count_.
573         (Output_data_plt_x86_64::has_irelative_section): New function.
574         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
575         (class Target_x86_64): Add got_irelative_ and rel_irelative_
576         fields.  Update declarations.
577         (Target_x86_64::Target_x86_64): Initialize new fields.
578         (Target_x86_64::do_plt_address_for_global): New function replacing
579         do_plt_section_for_global.
580         (Target_x86_64::do_plt_address_for_local): New function replacing
581         do_plt_section_for_local.
582         (Target_x86_64::got_section): Create got_irelative_.
583         (Target_x86_64::rela_irelative_section): New function.
584         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
585         all callers.  Don't create __rel_iplt_{start,end}.
586         (Output_data_plt_x86_64::add_entry): Add symtab and layout
587         parameters.  Change all callers.  Use different PLT and GOT for
588         IFUNC symbols.
589         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
590         layout parameters.  Change all callers.  Use different PLT and
591         GOT.
592         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
593         parameters.  Change all callers.  Use different PLT and GOT for
594         IFUNC symbols.
595         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
596         (Output_data_plt_x86_64::rela_irelative): New function.
597         (Output_data_plt_x86_64::address_for_global): New function.
598         (Output_data_plt_x86_64::address_for_local): New function.
599         (Output_data_plt_x86_64::set_final_data_size): Likewise.
600         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
601         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
602         (Target_x86_64::register_global_plt_entry): Add symtab and layout
603         parameters.
604         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
605         reloc.
606         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
607         symbols if we didn't create an IRELATIVE GOT.
608         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
609         plt_address_for_local.
610         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
611         * testsuite/ifuncvar1.c: New test file.
612         * testsuite/ifuncvar2.c: New test file.
613         * testsuite/ifuncvar3.c: New test file.
614         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
615         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
616         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
617         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
618         * testsuite/Makefile.in: Rebuild.
620 2011-07-07  Cary Coutant  <ccoutant@google.com>
622         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
623         (two_file_test_1_ndebug.o): Likewise.
624         (two_file_test_1b_ndebug.o): Likewise.
625         (two_file_test_2_ndebug.o): Likewise.
626         (two_file_test_main_ndebug.o): Likewise.
627         (incremental_test_2): Link with no-debug versions.
629 2011-07-06  Cary Coutant  <ccoutant@google.com>
631         * gold/incremental.cc
632         (Output_section_incremental_inputs::write_info_blocks): Check for
633         hidden and internal symbols.
635 2011-07-06  Cary Coutant  <ccoutant@google.com>
637         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
638         Check disposition for startup file.
639         (Incremental_inputs::report_command_line): Ignore
640         --incremental-startup-unchanged option.
641         * options.cc (General_options::parse_incremental_startup_unchanged):
642         New function.
643         (General_options::General_options): Initialize new data member.
644         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
645         (General_options): Add --incremental-startup-unchanged option.
646         (General_options::incremental_startup_disposition): New function.
647         (General_options::incremental_startup_disposition_): New data member.
649 2011-07-06  Cary Coutant  <ccoutant@google.com>
651         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
652         input file index to Script_info ctor.
653         (Sized_incremental_binary::do_file_has_changed): Find the
654         command-line argument for files named in scripts.
655         * incremental.h (Script_info::Script_info): New ctor
656         with input file index.
657         (Script_info::input_file_index): New function.
658         (Script_info::input_file_index_): New data member.
659         (Incremental_binary::get_library): Add const.
660         (Incremental_binary::get_script_info): Add const.
661         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
662         * testsuite/Makefile.am (incremental_test_5): New test case.
663         (incremental_test_6): New test case.
664         * testsuite/Makefile.in: Regenerate.
666 2011-07-06  Cary Coutant  <ccoutant@google.com>
668         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
669         debug output when command lines differ.
671 2011-07-06  Cary Coutant  <ccoutant@google.com>
673         * incremental.cc (Incremental_inputs::report_command_line): Ignore
674         --incremental-patch option.
675         * layout.cc (Free_list::allocate): Extend allocation beyond original
676         end if enabled.
677         (Layout::make_output_section): Mark sections that should get
678         patch space.
679         * options.cc (parse_percent): New function.
680         * options.h (parse_percent): New function.
681         (DEFINE_percent): New macro.
682         (General_options): Add --incremental-patch option.
683         * output.cc (Output_section::Output_section): Initialize new data
684         members.
685         (Output_section::add_input_section): Print section name when out
686         of patch space.
687         (Output_section::add_output_section_data): Likewise.
688         (Output_section::set_final_data_size): Add patch space when
689         doing --incremental-full.
690         (Output_section::do_reset_address_and_file_offset): Remove patch
691         space.
692         (Output_segment::set_section_list_addresses): Print debug output
693         only if --incremental-update.
694         * output.h (Output_section::set_is_patch_space_allowed): New function.
695         (Output_section::is_patch_space_allowed_): New data member.
696         (Output_section::patch_space_): New data member.
697         * parameters.cc (Parameters::incremental_full): New function.
698         * parameters.h (Parameters::incremental_full): New function
699         * testsuite/Makefile.am (incremental_test_2): Add test for
700         --incremental-patch option.
701         * testsuite/Makefile.in: Regenerate.
702         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
703         (t18): Remove function body.
705 2011-07-05  Doug Kwan  <dougkwan@google.com>
707         PR gold/12771
708         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
709         Arm_Address type for relocation result.
710         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
711         overflow check.
712         (Arm_relocate_functions::abs32): Use unaligned access.
713         (Arm_relocate_functions::rel32): Ditto.
714         (Arm_relocate_functions::prel31): Ditto.
715         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
716         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
717         static data relocations.
718         * testsuite/Makefile.in: Regnerate.
719         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
721 2011-07-05  Ian Lance Taylor  <iant@google.com>
723         PR gold/12392
724         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
725         symbols if necessary.
726         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
728 2011-07-05  Ian Lance Taylor  <iant@google.com>
730         PR gold/12952
731         * resolve.cc (Symbol::override_base_with_special): Simply override
732         version with special symbol version, ignoring previous version.
734 2011-07-05  Ian Lance Taylor  <iant@google.com>
736         * object.cc (Sized_relobj_file::include_section_group): Add
737         information to comment about signature location.
739 2011-07-02  Ian Lance Taylor  <iant@google.com>
741         PR gold/12957
742         * options.h (class General_options): Add -f and -F.
743         * options.cc (General_options::finalize): Fatal error if -f/-F
744         are used without -shared.
745         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
747 2011-07-02  Ian Lance Taylor  <iant@google.com>
749         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
751 2011-07-01  Ian Lance Taylor  <iant@google.com>
753         PR gold/12525
754         PR gold/12952
755         * resolve.cc (Symbol::override_base_with_special): Don't override
756         the version if the overriding symbol has a different name.
757         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
758         all callers.  If we give an error about an undefined version,
759         define the base version if necessary.
760         * dynobj.h (class Versions): Update declaration.
761         * testsuite/weak_alias_test_5.cc: New file.
762         * testsuite/weak_alias_test.script: New file.
763         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
764         and versioned_alias have the right value, and call t2.
765         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
766         weak_alias_test_5.so.
767         (weak_alias_test_LDADD): Likewise.
768         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
769         * testsuite/Makefile.in: Rebuild.
771 2011-07-01  Ian Lance Taylor  <iant@google.com>
773         PR gold/12525
774         * options.h (class General_options): Support -z notext.
775         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
776         -Wl,-z,notext.
777         (two_file_shared_nonpic.so): Likewise.
778         (two_file_shared_mixed.so): Likewise.
779         (two_file_shared_mixed_1.so): Likewise.
780         (weak_undef_lib_nonpic.so): Likewise.
781         (alt/weak_undef_lib_nonpic.so): Likewise.
782         (tls_test_shared_nonpic.so): Likewise.
783         * testsuite/Makefile.in: Rebuild.
785 2011-07-01  Ian Lance Taylor  <iant@google.com>
787         PR gold/12525
788         * configure.ac: Test whether static linking works, setting
789         the automake conditional HAVE_STATIC.
790         * testsuite/Makefile.am: Disable tests using -static if
791         HAVE_STATIC is not true.
792         * configure, testsuite/Makefile.in: Rebuild.
794 2011-07-01  Ian Lance Taylor  <iant@google.com>
796         PR gold/12525
797         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
798         Assert if we see DW_EH_PE_indirect.
799         * target.h (Target::ehframe_datarel_base): New function.
800         (Target::do_ehframe_datarel_base): New target function.
801         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
802         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
803         function.
805 2011-07-01  Ian Lance Taylor  <iant@google.com>
807         PR gold/12571
808         * options.h (class General_options): Add
809         --ld-generated-unwind-info.
810         * ehframe.cc (Fde::write): Add address parameter.  Change all
811         callers.  If associated with PLT, fill in address and size.
812         (Cie::set_output_offset): Only add merge mapping if there is an
813         object.
814         (Cie::write): Add address parameter.  Change all callers.
815         (Eh_frame::add_ehframe_for_plt): New function.
816         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
817         input_offset_ fields into union u_, with new plt field.
818         (Fde::Fde): Adjust for new union field.
819         (Fde::Fde) [Output_data version]: New constructor.
820         (Fde::add_mapping): Only add merge mapping if there is an object.
821         (class Cie): Update declarations.
822         (class Eh_frame): Declare add_ehframe_for_plt.
823         * layout.cc (Layout::layout_eh_frame): Break out code into
824         make_eh_frame_section, and call it.
825         (Layout::make_eh_frame_section): New function.
826         (Layout::add_eh_frame_for_plt): New function.
827         * layout.h (class Layout): Update declarations.
828         * merge.cc (Merge_map::add_mapping): Add assertion.
829         * i386.cc: Include "dwarf.h".
830         (class Output_data_plt_i386): Make first_plt_entry,
831         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
832         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
833         and plt_eh_frame_fde.
834         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
835         boundary.  Call add_eh_frame_for_plt if appropriate.
836         * x86_64.cc: Include "dwarf.h".
837         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
838         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
839         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
840         and plt_eh_frame_fde.
841         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
842         appropriate.
844 2011-06-29  Ian Lance Taylor  <iant@google.com>
846         PR gold/12629
847         * object.cc (Sized_relobj_file::layout_section): Change shdr
848         parameter to be const.
849         (Sized_relobj_file::layout_eh_frame_section): New function, broken
850         out of do_layout.
851         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
852         appropriate.  Call layout_eh_frame_section.
853         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
854         sections.
855         * object.h (class Sized_relobj_file): Update declarations.
857 2011-06-29  Ian Lance Taylor  <iant@google.com>
859         PR gold/12652
860         * script.cc (Token::integer_value): Accept trailing M/m/K/k
861         modifier.
862         (Lex::gather_token): Accept trailing M/m/K/k for integers.
864 2011-06-29  Ian Lance Taylor  <iant@google.com>
866         PR gold/12675
867         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
868         SHT_X86_64_UNWIND.
869         * layout.cc (Layout::layout_eh_frame): Likewise.
871 2011-06-29  Ian Lance Taylor  <iant@google.com>
873         PR gold/12695
874         * layout.cc (Layout::symtab_section_shndx): New function.
875         * layout.h (class Layout): Declare symtab_section_shndx.
876         * output.cc (Output_section::write_header): Call it.
878 2011-06-29  Ian Lance Taylor  <iant@google.com>
880         PR gold/12818
881         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
882         symbols which are not used in a relocation.
884 2011-06-28  Ian Lance Taylor  <iant@google.com>
886         PR gold/12898
887         * layout.cc (Layout::segment_precedes): Don't crash if a linker
888         script create indistinguishable segments.
889         (Layout::set_segment_offsets): Use stable_sort when sorting
890         segments.  Pass this to Compare_segments constructor.
891         * layout.h (class Layout): Make segment_precedes non-static.
892         (class Compare_segments): Change from struct to class.  Add
893         layout_ field.  Add constructor.
894         * script-sections.cc
895         (Script_sections::attach_sections_using_phdrs_clause): Rename
896         local orphan to is_orphan.  Don't report failure to put empty
897         section in segment.  On attachment failure, report name of
898         section, and attach to first PT_LOAD segment.
900 2011-06-28  Ian Lance Taylor  <iant@google.com>
902         PR gold/12934
903         * target-select.cc (Target_selector::Target_selector): Add
904         emulation parameter.  Change all callers.
905         (select_target_by_bfd_name): Rename from select_target_by_name.
906         Change all callers.
907         (select_target_by_emulation): New function.
908         (supported_emulation_names): New function.
909         * target-select.h (class Target_selector): Add emulation_ field.
910         Update declarations.
911         (Target_selector::recognize_by_bfd_name): Rename from
912         recognize_by_name.  Change all callers.
913         (Target_selector::supported_bfd_names): Rename from
914         supported_names.  Change all callers.
915         (Target_selector::recognize_by_emulation): New function.
916         (Target_selector::supported_emulations): New function.
917         (Target_selector::emulation): New function.
918         (Target_selector::do_recognize_by_bfd_name): Rename from
919         do_recognize_by_name.  Change all callers.
920         (Target_selector::do_supported_bfd_names): Rename from
921         do_supported_names.  Change all callers.
922         (Target_selector::do_recognize_by_emulation): New function.
923         (Target_selector::do_supported_emulations): New function.
924         (select_target_by_bfd_name): Change name in declaration.
925         (select_target_by_emulation): Declare.
926         (supported_emulation_names): Declare.
927         * parameters.cc (parameters_force_valid_target): Try to find
928         target based on emulation from -m option.
929         * options.h (class General_options): Change doc string for -m.
930         * options.cc (help): Print emulations.
931         (General_options::parse_V): Likewise.
932         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
933         Add emulation parameter.  Change all callers.
935 2011-06-28  Ian Lance Taylor  <iant@google.com>
937         * target.h (class Target): Add osabi_ field.
938         (Target::osabi): New function.
939         (Target::set_osabi): New function.
940         (Target::Target): Initialize osabi_.
941         (Target::do_adjust_elf_header): Make pure virtual.
942         (Sized_target::do_adjust_elf_header): Declare.
943         * target.cc (Sized_target::do_adjust_elf_header): New function.
944         (class Sized_target): Instantiate all versions.
945         * freebsd.h (class Target_freebsd): Remove.
946         (Target_selector_freebsd::do_recognize): Call set_osabi on
947         Target.
948         (Target_selector_freebsd::do_recognize_by_name): Likewise.
949         (Target_selector_freebsd::set_osabi): Remove.
950         * i386.cc (class Target_i386): Inherit from Sized_target rather
951         than Target_freebsd.
952         * x86_64.cc (class Target_x86_64): Likewise.
954 2011-06-28  Ian Lance Taylor  <iant@google.com>
956         * target.h (Target::can_check_for_function_pointers): Rewrite.
957         Make non-virtual.
958         (Target::can_icf_inline_merge_sections): Likewise.
959         (Target::section_may_have_icf_unsafe_poineters): Likewise.
960         (Target::Target_info): Add can_icf_inline_merge_sections field.
961         (Target::do_can_check_for_function_pointers): New virtual
962         function.
963         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
964         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
965         from can_check_for_function_pointers, move in file.
966         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
967         section_may_have_icf_unsafe_poineters, move in file.
968         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
969         * i386.cc (Target_i386::do_can_check_for_function_pointers):
970         Rename from can_check_for_function_pointers, move in file.
971         (Target_i386::can_icf_inline_merge_sections): Remove.
972         (Target_i386::i386_info): Initialize
973         can_icf_inline_merge_sections.
974         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
975         Initialize can_icf_inline_merge_sections.
976         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
977         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
978         Rename from can_check_for_function_pointers, move in file.
979         (Target_x86_64::can_icf_inline_merge_sections): Remove.
980         (Target_x86_64::x86_64_info): Initialize
981         can_icf_inline_merge_sections.
982         * testsuite/testfile.cc (Target_test::test_target_info):
983         Likewise.
984         * icf.cc (get_section_contents): Correct formatting.
986 2011-06-27  Ian Lance Taylor  <iant@google.com>
988         * symtab.cc (Symbol::versioned_name): New function.
989         (Symbol_table::add_to_final_symtab): Use versioned_name when
990         appropriate.
991         (Symbol_table::sized_write_symbol): Likewise.
992         * symtab.h (class Symbol): Declare versioned_name.
993         * stringpool.h (class Stringpool_template): Add variant of add
994         which takes a std::basic_string.
995         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
996         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
997         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
998         (ver_test_12.o): New target.
999         * testsuite/Makefile.in: Rebuild.
1001 2011-06-27  Doug Kwan  <dougkwan@google.com>
1003         * arm.cc (Arm_relocate_functions::thm_jump8,
1004         Arm_relocate_functions::thm_jump11): Use a wider signed
1005         type to compute offset.
1006         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1007         arm_thm_jump8.
1008         * testsuite/Makefile.in: Regenerate.
1009         * testsuite/arm_branch_in_range.sh: Check test results of
1010         arm_thm_jump11 and arm_thm_jump8.
1011         * testsuite/arm_thm_jump11.s: New test source file.
1012         * testsuite/arm_thm_jump11.t: New linker script.
1013         * testsuite/arm_thm_jump8.s: New test source file.
1014         * testsuite/arm_thm_jump8.t: New linker script.
1016 2011-06-24  Ian Lance Taylor  <iant@google.com>
1018         * layout.cc: Include "object.h".
1019         (ctors_sections_in_init_array): New static variable.
1020         (Layout::is_ctors_in_init_array): New function.
1021         (Layout::layout): Add entry to ctors_sections_in_init_array if
1022         appropriate.
1023         * layout.h (class Layout): Declare is_ctors_in_init_array.
1024         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1025         is_ctors_reverse_view is set.
1026         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1027         all callers.  Set is_ctors_reverse_view field of View_size.
1028         (Sized_relobj_file::reverse_words): New function.
1029         * object.h (Sized_relobj_file::View_size): Add
1030         is_ctors_reverse_view field.
1031         (class Sized_relobj_file): Update declarations.
1032         * testsuite/initpri3.c: New test.
1033         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1034         initpri3b.
1035         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1036         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1037         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1038         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1039         * testsuite/Makefile.in: Rebuild.
1041 2011-06-24  Cary Coutant  <ccoutant@google.com>
1043         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1044         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1045         (debug_msg_cdebug.err): New targets.
1046         * testsuite/Makefile.in: Regenerate.
1047         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1048         Fix checks for link with shared library.
1050 2011-06-24  Doug Kwan  <dougkwan@google.com>
1052         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1053         skip empty text sections.
1054         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1056 2011-06-22  Ian Lance Taylor  <iant@google.com>
1058         PR gold/12910
1059         * options.h (class General_options): Add --ctors-in-init-array.
1060         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1061         friends as SHT_PROGBITS for merging sections.
1062         (Layout::layout): Remove special handling of .init_array and
1063         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1064         and .dtors if ctors_in_init_array.
1065         (Layout::make_output_section): Force correct section types for
1066         .init_array and friends.  Don't sort if doing relocatable link,
1067         Don't sort .ctors and .dtors if ctors_in_init_array.
1068         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1069         (Layout::output_section_name): Add relobj parameter.  Change all
1070         callers.  Handle .ctors. and .dtors. in code rather than table.
1071         Handle .ctors and .dtors if ctors_in_init_array.
1072         (Layout::match_file_name): New function, moved from output.cc.
1073         * layout.h (class Layout): Update declarations.
1074         * output.cc: Include "layout.h".
1075         (Input_section_sort_entry::get_priority): New function.
1076         (Input_section_sort_entry::match_file_name): Just call
1077         Layout::match_file_name.
1078         (Output_section::Input_section_sort_init_fini_compare::operator()):
1079         Handle .ctors and .dtors.  Sort by explicit priority rather than
1080         by name.
1081         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1082         * testsuite/initpri2.c: New test.
1083         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1084         (check_PROGRAMS): Add initpri2.
1085         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1086         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1087         * configure, testsuite/Makefile.in: Rebuild.
1089 2011-06-19  Ian Lance Taylor  <iant@google.com>
1091         PR gold/12880
1092         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1093         .interp section to a PT_INTERP segment even if we have seen a
1094         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1095         clause in a linker script.
1096         (Layout::finalize): Don't create a .interp section if we've
1097         already create a PT_INTERP segment.
1098         (Layout::create_interp): Always call choose_output_section (revert
1099         patch of 2011-06-17).  Don't create PT_INTERP segment.
1100         * script-sections.cc
1101         (Script_sections::create_note_and_tls_segments): Add a .interp
1102         section to a PT_INTERP segment even if we have seen a
1103         --dynamic-linker option.
1105 2011-06-18  Ian Lance Taylor  <iant@google.com>
1107         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1108         merely because a non-PT_LOAD segment has a dynamic reloc.
1110 2011-06-18  Ian Lance Taylor  <iant@google.com>
1112         * layout.cc (Layout::finish_dynamic_section): Don't create
1113         DT_FLAGS entry if not needed.
1115 2011-06-18  Ian Lance Taylor  <iant@google.com>
1117         PR gold/12745
1118         * layout.cc (Layout::layout_eh_frame): Correct handling of
1119         writable .eh_frame section.
1121 2011-06-17  Ian Lance Taylor  <iant@google.com>
1123         PR gold/12893
1124         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1125         symbol is redefined with the exact same object and value.
1127 2011-06-17  Ian Lance Taylor  <iant@google.com>
1129         PR gold/12880
1130         * layout.h (class Layout): Add interp_segment_ field.
1131         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1132         (Layout::attach_allocated_section_to_segment): If making shared
1133         library, put .interp section in PT_INTERP segment.
1134         (Layout::finalize): Also call create_interp if -dynamic-linker
1135         option was used.
1136         (Layout::create_interp): Assert that there is no PT_INTERP
1137         segment.  If not using a SECTIONS clause, use make_output_section.
1138         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1139         * script-sections.cc
1140         (Script_sections::create_note_and_tls_segments): If making shared
1141         library, put .interp section in PT_INTERP segment.
1143 2011-06-17  Ian Lance Taylor  <iant@google.com>
1145         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1146         when making a shared library.
1148 2011-06-17  Ian Lance Taylor  <iant@google.com>
1150         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1151         parameter.  Change all callers.  Don't issue warning about PC32
1152         against locally defined symbol.
1154 2011-06-16  Ian Lance Taylor  <iant@google.com>
1156         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1157         occurs in same object.
1159 2011-06-14  Alan Modra  <amodra@gmail.com>
1161         * po/POTFILES.in: Regenerate.
1163 2011-06-09  Ian Lance Taylor  <iant@google.com>
1165         * script-sections.cc
1166         (Orphan_output_section::set_section_addresses): For a relocatable
1167         link set address to 0.
1169 2011-06-09  Cary Coutant  <ccoutant@google.com>
1171         PR gold/12804
1172         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1173         used with --compress-debug-sections.
1174         * gold/object.cc (Sized_relobj_file::do_layout): Report
1175         uncompressed size of compressed input sections.
1177 2011-06-08  Cary Coutant  <ccoutant@google.com>
1179         PR gold/12804
1180         * testsuite/two_file_test_2_v1.cc: Change initialization of
1181         v2 to keep it in .data.
1183 2011-06-07  Cary Coutant  <ccoutant@google.com>
1185         * common.cc (Symbol_table::do_allocate_commons_list): Call
1186         gold_fallback.
1187         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1188         (Errors::fallback): New function.
1189         (gold_fallback): New function.
1190         * errors.h (Errors::fallback): New function.
1191         * gold.cc (gold_exit): Change status parameter to enum; adjust
1192         all callers.
1193         (queue_initial_tasks): Call gold_fallback.
1194         * gold.h: Include cstdlib.
1195         (Exit_status): New enum type.
1196         (gold_exit): Change status parameter to enum.
1197         (gold_fallback): New function.
1198         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1199         (Layout::create_symtab_sections): Likewise.
1200         (Layout::create_shdrs): Likewise.
1201         * main.cc (main): Adjust call to gold_exit.
1202         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1203         (Output_data_got::add_got_entry_pair): Likewise.
1204         (Output_section::add_input_section): Likewise.
1205         (Output_section::add_output_section_data): Likewise.
1206         (Output_segment::set_section_list_addresses): Likewise.
1207         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1209 2011-06-07  Cary Coutant  <ccoutant@google.com>
1211         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1212         for incremental links.
1213         * output.cc (Output_segment::set_section_list_addresses): Remove
1214         FIXME and test for TLS or BSS.
1216 2011-06-07  Cary Coutant  <ccoutant@google.com>
1218         * testsuite/Makefile.am: Add incremental_copy_test,
1219         incremental_common_test_1.
1220         * testsuite/Makefile.in: Regenerate.
1221         * testsuite/common_test_1_v1.c: New source file.
1222         * testsuite/common_test_1_v2.c: New source file.
1223         * testsuite/copy_test_v1.cc: New source file.
1225 2011-06-07  Cary Coutant  <ccoutant@google.com>
1227         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1228         update, allocate common from bss section's free list.
1229         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1230         linker-defined symbols.
1231         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1232         Skip GOT and PLT entries that are no longer referenced.
1233         (Output_section_incremental_inputs::write_info_blocks): Mark
1234         linker-defined symbols.
1235         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1236         * output.cc (Output_section::allocate): New function.
1237         * output.h (Output_section::allocate): New function.
1238         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1239         linker-defined symbols.
1240         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1241         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1242         (Symbol::init_base_output_data): Likewise.
1243         (Symbol::init_base_output_segment): Likewise.
1244         (Symbol::init_base_constant): Likewise.
1245         (Sized_symbol::init_output_data): Likewise.
1246         (Sized_symbol::init_output_segment): Likewise.
1247         (Sized_symbol::init_constant): Likewise.
1248         (Symbol_table::do_define_in_output_data): Likewise.
1249         (Symbol_table::do_define_in_output_segment): Likewise.
1250         (Symbol_table::do_define_as_constant): Likewise.
1251         * symtab.h (Symbol::is_predefined): New function.
1252         (Symbol::init_base_output_data): Add is_predefined parameter.
1253         (Symbol::init_base_output_segment): Likewise.
1254         (Symbol::init_base_constant): Likewise.
1255         (Symbol::is_predefined_): New data member.
1256         (Sized_symbol::init_output_data): Add is_predefined parameter.
1257         (Sized_symbol::init_output_segment): Likewise.
1258         (Sized_symbol::init_constant): Likewise.
1259         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1261 2011-06-07  Cary Coutant  <ccoutant@google.com>
1263         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1264         instead of emit_copy_reloc.
1265         (Copy_relocs::emit_copy_reloc): Refactor.
1266         (Copy_relocs::make_copy_reloc): New function.
1267         (Copy_relocs::add_copy_reloc): Remove.
1268         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1269         section.
1270         (Copy_relocs::make_copy_reloc): New function.
1271         (Copy_relocs::add_copy_reloc): Remove.
1272         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1273         unchanged input files.
1274         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1275         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1276         Reserve BSS space for COPY relocations.
1277         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1278         (Output_section_incremental_inputs::write_info_blocks): Record
1279         whether a symbol is copied from a shared object.
1280         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1281         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1282         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1283         (Incremental_input_entry_reader::get_output_symbol_index): Add
1284         is_copy parameter.
1285         (Incremental_binary::emit_copy_relocs): New function.
1286         (Incremental_binary::do_emit_copy_relocs): New function.
1287         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1288         new data member.
1289         (Sized_incremental_binary::add_copy_reloc): New function.
1290         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1291         (Sized_incremental_binary::Copy_reloc): New struct.
1292         (Sized_incremental_binary::Copy_relocs): New typedef.
1293         (Sized_incremental_binary::copy_relocs_): New data member.
1294         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1295         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1296         * target.h (Sized_target::emit_copy_reloc): New function.
1297         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1299 2011-06-02  Cary Coutant  <ccoutant@google.com>
1301         PR gold/12163
1302         * gold/archive.cc (Archive::Archive): Initialize new data member.
1303         (Archive::include_all_members): Return if archive has already been
1304         included.
1305         * gold/archive.h (Archive::include_all_members_): New data member.
1307 2011-06-02  Nick Clifton  <nickc@redhat.com>
1309         * dynobj.h: Fix spelling mistake in comment.
1310         * output.cc: Likewise.
1312 2011-05-31  Doug Kwan  <dougkwan@google.com>
1313             Asier Llano
1315         PR gold/12826
1316         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1317         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1318         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1319         redundant arm_exidx_test.so.
1320         * testsuite/Makefile.in: Regenerate.
1321         (check_SCRIPTS): Add pr12826.sh
1322         (check_DATA): Add pr12826.stdout
1323         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1324         * testsuite/pr12826.sh: New file.
1325         * testsuite/pr12826_1.s: Ditto.
1326         * testsuite/pr12826_1.s: Ditto.
1328 2011-05-30  Ian Lance Taylor  <iant@google.com>
1330         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1331         sections.
1333 2011-05-29  Ian Lance Taylor  <iant@google.com>
1335         PR gold/12804
1336         * testsuite/Makefile.am: Use different file name for two_file_test
1337         temporary file for each incremental test.
1338         * testsuite/Makefile.in: Rebuild.
1340 2011-05-29  Ian Lance Taylor  <iant@google.com>
1342         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1343         binary input file is empty.
1345 2011-05-27  Ian Lance Taylor  <iant@google.com>
1347         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1348         (ver_test_9.so): Likewise.
1349         * testsuite/Makefile.in: Rebuild.
1351 2011-05-26 Cary Coutant  <ccoutant@google.com>
1353         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1354         * incremental.cc (Incremental_inputs::report_input_section): Fix
1355         comment, indentation.
1356         (Incremental_inputs::report_comdat_group): New function.
1357         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1358         of data for incremental input file entry.
1359         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1360         group count, COMDAT group signatures.
1361         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1362         an unchanged input file.
1363         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1364         Initialize new data member.
1365         (Incremental_object_entry::add_comdat_group): New function.
1366         (Incremental_object_entry::get_comdat_group_count): New function.
1367         (Incremental_object_entry::get_comdat_signature_key): New function.
1368         (Incremental_object_entry::groups_): New data member.
1369         (Incremental_inputs::report_comdat_group): New function.
1370         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1371         data for incremental input file entry.
1372         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1373         (Incremental_input_entry_reader::get_input_section): Adjust size of
1374         data for incremental input file entry.
1375         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1376         (Incremental_input_entry_reader::get_comdat_group_signature): New
1377         function.
1378         * object.cc (Sized_relobj::include_section_group): Report kept
1379         COMDAT groups for incremental links.
1381 2011-05-24  David Meyer  <pdox@google.com>
1383         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1384         with name parameter.  Add found_name parameter.
1385         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1386         * dirsearch.h (class Dirsearch): Update declaration.
1388 2011-05-24  Ian Lance Taylor  <iant@google.com>
1390         * archive.cc (Library_base::should_include_member): Pull in object
1391         from archive if it defines the entry symbol.
1392         * parameters.cc (Parameters::entry): New function.
1393         * parameters.h (class Parameters): Declare entry.
1394         * output.h (class Output_file_header): Remove entry_ field.
1395         * output.cc (Output_file_header::Output_file_header): Remove entry
1396         parameter.  Change all callers.
1397         (Output_file_header::entry): Use parameters->entry.
1398         * gold.cc (queue_middle_tasks): Likewise.
1399         * plugin.cc (Plugin_hook::run): Likewise.
1401 2011-05-24 Cary Coutant  <ccoutant@google.com>
1403         * gold.cc (queue_initial_tasks): Pass incremental base filename
1404         to Output_file::open_base_file; don't print error message.
1405         * incremental-dump.cc (main): Adjust call to
1406         Output_file::open_for_modification.
1407         * incremental-dump.cc (main): Likewise.
1408         * incremental.cc (Incremental_inputs::report_command_line):
1409         Ignore --incremental-base option when comparing command lines.
1410         Ignore parameter when given as separate argument.
1411         * options.h (class General_options): Add --incremental-base.
1412         * output.cc (Output_file::Output_file):
1413         (Output_file::open_base_file): Add base_name and writable parameters;
1414         read base file into new file; print error message here.
1415         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1416         callers.
1417         * output.h (Output_file::open_for_modification): Rename to...
1418         (Output_file::open_base_file): ...this; add base_name and
1419         writable parameters; adjust all callers.
1420         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1421         callers.
1422         * testsuite/Makefile.am (incremental_test_4): Test
1423         --incremental-base.
1424         * testsuite/Makefile.in: Regenerate.
1426 2011-05-24 Cary Coutant  <ccoutant@google.com>
1428         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1429         incremental_test_4.
1430         * testsuite/Makefile.in: Regenerate.
1431         * testsuite/two_file_test_1_v1.cc: New test source file.
1432         * testsuite/two_file_test_1b_v1.cc: New test source file.
1433         * testsuite/two_file_test_2_v1.cc: New test source file.
1435 2011-05-24 Cary Coutant  <ccoutant@google.com>
1437         * dynobj.h (Dynobj::do_dynobj): New function.
1438         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1439         flag and soname for shared objects.
1440         * incremental.cc (Incremental_inputs::report_object): Make
1441         either Incremental_object_entry or Incremental_dynobj_entry; add
1442         soname to string table.
1443         (Incremental_inputs::report_input_section): Add assertion.
1444         (Output_section_incremental_inputs::set_final_data_size): Adjust
1445         type of input file entry for shared libraries; adjust size of
1446         shared library info entry.
1447         (Output_section_incremental_inputs::write_input_files): Write
1448         as_needed flag for shared libraries.
1449         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1450         of input file entry for shared libraries; write soname.
1451         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1452         soname from incremental info.
1453         * incremental.h (enum Incremental_input_flags): Add
1454         INCREMENTAL_INPUT_AS_NEEDED.
1455         (Incremental_input_entry::Incremental_input_entry): Initialize new
1456         data member.
1457         (Incremental_input_entry::set_as_needed): New function.
1458         (Incremental_input_entry::as_needed): New function.
1459         (Incremental_input_entry::do_dynobj_entry): New function.
1460         (Incremental_input_entry::as_needed_): New data member.
1461         (Incremental_object_entry::Incremental_object_entry): Don't check
1462         for shared library.
1463         (Incremental_object_entry::do_type): Likewise.
1464         (class Incremental_dynobj_entry): New class.
1465         (Incremental_input_entry_reader::as_needed): New function.
1466         (Incremental_input_entry_reader::get_soname): New function.
1467         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1468         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1469         size of shared library info entry.
1470         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1471         incremental link when adding DT_NEEDED entries.
1472         * object.h (Object::Object): Initialize new data member.
1473         (Object::dynobj): New function.
1474         (Object::set_as_needed): New function.
1475         (Object::as_needed): New function.
1476         (Object::do_dynobj): New function.
1477         (Object::as_needed_): New data member.
1479 2011-05-24 Cary Coutant  <ccoutant@google.com>
1481         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1482         info; adjust display of GOT entries.
1483         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1484         vector of input objects; remove file_status_.
1485         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1486         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1487         got_plt reader; call target hooks to reserve GOT entries.
1488         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1489         of input file info header and GOT info entry.
1490         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1491         relocation info.
1492         (Got_plt_view_info::got_descriptor): Remove.
1493         (Got_plt_view_info::sym_index): New data member.
1494         (Got_plt_view_info::input_index): New data member.
1495         (Local_got_offset_visitor::visit): Write input file index.
1496         (Global_got_offset_visitor::visit): Write 0 for input file index.
1497         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1498         with sym_index and input_index.
1499         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1500         incremental info GOT entry; replace got_descriptor with input_index.
1501         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1502         map from input file index to object.
1503         (Sized_relobj_incr::do_layout): Replace direct data member reference
1504         with accessor function.
1505         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1506         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1507         Adjust size of input file info header.
1508         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1509         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1510         (Incremental_input_entry_reader::get_input_section): Adjust size of
1511         input file info header.
1512         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1513         of incremental info GOT entry.
1514         (Incremental_got_plt_reader::get_got_desc): Remove.
1515         (Incremental_got_plt_reader::get_got_symndx): New function.
1516         (Incremental_got_plt_reader::get_got_input_index): New function.
1517         (Sized_incremental_binary::Sized_incremental_binary): Remove
1518         file_status_; add input_objects_.
1519         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1520         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1521         (Sized_incremental_binary::file_is_unchanged): Remove.
1522         (Sized_incremental_binary::set_input_object): New function.
1523         (Sized_incremental_binary::input_object): New function.
1524         (Sized_incremental_binary::file_status_): Remove.
1525         (Sized_incremental_binary::input_objects_): New data member.
1526         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1527         references.
1528         (Sized_relobj_incr::invalid_address): Move to base class.
1529         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1530         class.
1531         (Sized_relobj_incr::do_output_section_offset): Likewise.
1532         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1533         (Sized_relobj_incr::section_offsets_): Likewise.
1534         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1535         function.
1536         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1537         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1538         with accessor function.
1539         (Sized_relobj_file::do_layout): Likewise.
1540         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1541         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1542         (Sized_relobj_file::compute_final_local_value): Replace refs to
1543         section_offsets_ with accessor function.
1544         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1545         * object.h (Relobj::Relobj): Initialize new data members.
1546         (Relobj::add_dyn_reloc): New function.
1547         (Relobj::first_dyn_reloc): New function.
1548         (Relobj::dyn_reloc_count): New function.
1549         (Relobj::first_dyn_reloc_): New data member.
1550         (Relobj::dyn_reloc_count_): New data member.
1551         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1552         references.
1553         (Sized_relobj::Address): New typedef.
1554         (Sized_relobj::invalid_address): Move here from child class.
1555         (Sized_relobj::Sized_relobj): Initialize new data members.
1556         (Sized_relobj::sized_relobj): New function.
1557         (Sized_relobj::is_output_section_offset_invalid): Move here from
1558         child class.
1559         (Sized_relobj::get_output_section_offset): Likewise.
1560         (Sized_relobj::local_has_got_offset): Likewise.
1561         (Sized_relobj::local_got_offset): Likewise.
1562         (Sized_relobj::set_local_got_offset): Likewise.
1563         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1564         (Sized_relobj::clear_got_offsets): New function.
1565         (Sized_relobj::section_offsets): Move here from child class.
1566         (Sized_relobj::do_output_section_offset): Likewise.
1567         (Sized_relobj::do_set_section_offset): Likewise.
1568         (Sized_relobj::Local_got_offsets): Likewise.
1569         (Sized_relobj::local_got_offsets_): Likewise.
1570         (Sized_relobj::section_offsets_): Likewise.
1571         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1572         references.
1573         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1574         class.
1575         (Sized_relobj_file::sized_relobj): New function
1576         (Sized_relobj_file::local_has_got_offset): Move to base class.
1577         (Sized_relobj_file::local_got_offset): Likewise.
1578         (Sized_relobj_file::set_local_got_offset): Likewise.
1579         (Sized_relobj_file::get_output_section_offset): Likewise.
1580         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1581         (Sized_relobj_file::do_output_section_offset): Likewise.
1582         (Sized_relobj_file::do_set_section_offset): Likewise.
1583         (Sized_relobj_file::Local_got_offsets): Likewise.
1584         (Sized_relobj_file::local_got_offsets_): Likewise.
1585         (Sized_relobj_file::section_offsets_): Likewise.
1586         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1587         (all constructors).
1588         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1589         (Output_reloc::get_symbol_index): Likewise.
1590         (Output_reloc::local_section_offset): Likewise.
1591         (Output_reloc::get_address): Likewise.
1592         (Output_reloc::symbol_value): Likewise.
1593         (Output_data_got::reserve_slot): Move to class definition.
1594         (Output_data_got::reserve_local): New function.
1595         (Output_data_got::reserve_slot_for_global): Remove.
1596         (Output_data_got::reserve_global): New function.
1597         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1598         (all constructors, two instantiations).
1599         (Output_reloc::get_relobj): New function (two instantiations).
1600         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1601         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1602         (Output_data_reloc::add_global): Adjust type of relobj.
1603         (Output_data_reloc::add_global_relative): Likewise.
1604         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1605         (Output_data_reloc::add_local): Likewise.
1606         (Output_data_reloc::add_local_relative): Likewise.
1607         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1608         (Output_data_reloc::add_local_section): Likewise.
1609         (Output_data_reloc::add_output_section): Likewise.
1610         (Output_data_reloc::add_absolute): Likewise.
1611         (Output_data_reloc::add_target_specific): Likewise.
1612         (Output_data_got::reserve_slot): Move definition here.
1613         (Output_data_got::reserve_local): New function.
1614         (Output_data_got::reserve_global): New function.
1615         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1616         section_offsets_ with accessor function.
1617         (Sized_relobj_file::write_sections): Likewise.
1618         (Sized_relobj_file::do_relocate_sections): Likewise.
1619         * target.h (Sized_target::reserve_local_got_entry): New function.
1620         (Sized_target::reserve_global_got_entry): New function.
1621         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1622         (Target_x86_64::reserve_global_got_entry): New function.
1623         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1625 2011-05-23 Cary Coutant  <ccoutant@google.com>
1627         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1628         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1629         bit when checking got_type.
1630         * incremental.cc (Sized_incremental_binary::setup_readers):
1631         Store symbol table and string table locations; initialize bit vector
1632         of file status flags.
1633         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1634         unchanged files.
1635         (Sized_incremental_binary::do_process_got_plt): New function.
1636         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1637         (Output_section_incremental_inputs::set_final_data_size): Record
1638         file index for each input file.
1639         (Output_section_incremental_inputs::write_got_plt): Store file index
1640         instead of input entry offset for each GOT entry.
1641         * incremental.h
1642         (Incremental_input_entry::Incremental_input_entry): Initialize new
1643         data member.
1644         (Incremental_input_entry::set_offset): Store file index.
1645         (Incremental_input_entry::get_file_index): New function.
1646         (Incremental_input_entry::file_index_): New data member.
1647         (Incremental_binary::process_got_plt): New function.
1648         (Incremental_binary::do_process_got_plt): New function.
1649         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1650         data members.
1651         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1652         (Sized_incremental_binary::set_file_is_unchanged): New function.
1653         (Sized_incremental_binary::file_is_unchanged): New function.
1654         (Sized_incremental_binary::do_process_got_plt): New function.
1655         (Sized_incremental_binary::file_status_): New data member.
1656         (Sized_incremental_binary::main_symtab_loc_): New data member.
1657         (Sized_incremental_binary::main_strtab_loc_): New data member.
1658         * output.cc (Output_data_got::Got_entry::write): Add case
1659         RESERVED_CODE.
1660         (Output_data_got::add_global): Call add_got_entry.
1661         (Output_data_got::add_global_plt): Likewise.
1662         (Output_data_got::add_global_with_rel): Likewise.
1663         (Output_data_got::add_global_with_rela): Likewise.
1664         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1665         (Output_data_got::add_global_pair_with_rela): Likewise.
1666         (Output_data_got::add_local): Call add_got_entry.
1667         (Output_data_got::add_local_plt): Likewise.
1668         (Output_data_got::add_local_with_rel): Likewise.
1669         (Output_data_got::add_local_with_rela): Likewise.
1670         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1671         (Output_data_got::add_local_pair_with_rela): Likewise.
1672         (Output_data_got::reserve_slot): New function.
1673         (Output_data_got::reserve_slot_for_global): New function.
1674         (Output_data_got::add_got_entry): New function.
1675         (Output_data_got::add_got_entry_pair): New function.
1676         (Output_section::add_output_section_data): Edit FIXME.
1677         * output.h
1678         (Output_section_data_build::Output_section_data_build): New
1679         constructor with size parameter.
1680         (Output_data_space::Output_data_space): Likewise.
1681         (Output_data_got::Output_data_got): Initialize new data member; new
1682         constructor with size parameter.
1683         (Output_data_got::add_constant): Call add_got_entry.
1684         (Output_data_got::reserve_slot): New function.
1685         (Output_data_got::reserve_slot_for_global): New function.
1686         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1687         (Output_data_got::add_got_entry): New function.
1688         (Output_data_got::add_got_entry_pair): New function.
1689         (Output_data_got::free_list_): New data member.
1690         * target.h (Sized_target::init_got_plt_for_update): New function.
1691         (Sized_target::register_global_plt_entry): New function.
1692         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1693         Initialize new data member; call init; add constructor with PLT count.
1694         (Output_data_plt_x86_64::init): New function.
1695         (Output_data_plt_x86_64::add_relocation): New function.
1696         (Output_data_plt_x86_64::reserve_slot): New function.
1697         (Output_data_plt_x86_64::free_list_): New data member.
1698         (Target_x86_64::init_got_plt_for_update): New function.
1699         (Target_x86_64::register_global_plt_entry): New function.
1700         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1701         incremental updates.
1702         (Output_data_plt_x86_64::add_relocation): New function.
1703         * testsuite/object_unittest.cc (Object_test): Set default options.
1705 2011-05-16  Ian Lance Taylor  <iant@google.com>
1707         * options.h (class General_options): Make -i a synonym for -r.
1709 2011-05-16  Ian Lance Taylor  <iant@google.com>
1711         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1713 2011-05-10 Cary Coutant  <ccoutant@google.com>
1715         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1716         strip_all (-s).
1718 2011-05-06  Ian Lance Taylor  <iant@google.com>
1720         * layout.cc (Layout::layout): If the output section flags change,
1721         update the ordering.
1723 2011-04-25 Cary Coutant  <ccoutant@google.com>
1725         * incremental-dump.cc (dump_incremental_inputs): Print local
1726         symbol info for each input file.
1727         * incremental.cc
1728         (Output_section_incremental_inputs::set_final_data_size): Add local
1729         symbol info to input file entries in incremental info.
1730         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1731         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1732         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1733         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1734         implementation.
1735         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1736         (Sized_incr_relobj::do_relocate): Write the local symbols.
1737         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1738         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1739         Adjust size of input file header.
1740         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1741         (Incremental_inputs_reader::get_local_symbol_count): New function.
1742         (Incremental_inputs_reader::get_input_section): Adjust size of input
1743         file header.
1744         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1745         (Sized_incr_relobj::This): New typedef.
1746         (Sized_incr_relobj::sym_size): New const data member.
1747         (Sized_incr_relobj::Local_symbol): New struct.
1748         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1749         (Sized_incr_relobj::do_local_symbol_offset): New function.
1750         (Sized_incr_relobj::local_symbol_count_): New data member.
1751         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1752         (Sized_incr_relobj::local_symbol_index_): New data member.
1753         (Sized_incr_relobj::local_symbol_offset_): New data member.
1754         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1755         (Sized_incr_relobj::local_symbols_): New data member.
1756         * object.h (Relobj::output_local_symbol_count): New function.
1757         (Relobj::local_symbol_offset): New function.
1758         (Relobj::do_output_local_symbol_count): New function.
1759         (Relobj::do_local_symbol_offset): New function.
1760         (Sized_relobj::do_output_local_symbol_count): New function.
1761         (Sized_relobj::do_local_symbol_offset): New function.
1763 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1765         * descriptors.cc (set_close_on_exec): New function.
1766         (Descriptors::open): Use set_close_on_exec.
1767         * output.cc (S_ISLNK): Define if not defined.
1769 2011-04-22 Cary Coutant  <ccoutant@google.com>
1771         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1772         global symbol map.
1773         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1774         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1775         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1776         relocations.
1777         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1778         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1779         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1780         * incremental.h
1781         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1782         function.
1783         (Incremental_binary::apply_incremental_relocs): New function.
1784         (Incremental_binary::do_apply_incremental_relocs): New function.
1785         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1786         data member.
1787         (Sized_incremental_binary::add_global_symbol): New function.
1788         (Sized_incremental_binary::global_symbol): New function.
1789         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1790         (Sized_incremental_binary::symbol_map_): New data member.
1791         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1792         * target.h (Sized_target::apply_relocation): New function.
1793         * target-reloc.h (apply_relocation): New function.
1794         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1796 2011-04-22  Doug Kwan  <dougkwan@google.com>
1798         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1799         flag of a SHT_ARM_EXIDX section.
1800         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1801         * testsuite/Makefile.in: Regenerate.
1802         * testsuite/arm_exidx_test.s: New file.
1803         * testsuite/arm_exidx_test.sh: Same.
1805 2011-04-20 Cary Coutant  <ccoutant@google.com>
1807         PR gold/12689
1808         * archive.h (Incremental_archive_entry::Archive_member):
1809         Initialize arg_serial_ (second constructor).
1811 2011-04-17  Ian Lance Taylor  <iant@google.com>
1813         * object.cc (Relocate_info::location): Simplify location string.
1814         * errors.cc (Errors::error_at_location): Don't print program
1815         name.
1816         (Errors::warning_at_location): Likewise.
1817         (Errors::undefined_symbol): Likewise.
1818         * testsuite/debug_msg.sh: Update accordingly.
1820 2011-04-14 Cary Coutant  <ccoutant@google.com>
1822         * gold/layout.cc (Layout::symtab_section_offset): New function.
1823         * gold/layout.h (Layout::symtab_section_offset): New function.
1824         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1826 2011-04-12  Ian Lance Taylor  <iant@google.com>
1828         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1829         with MREMAP_MAYMOVE.
1830         * output.h (class Output_file): Add map_is_allocated_ field.
1831         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1832         not available, provide stubs.  If mremap is not available, #define
1833         it to gold_mremap.
1834         (MREMAP_MAYMOVE): Define if not defined.
1835         (Output_file::Output_file): Initialize map_is_allocated_.
1836         (Output_file::resize): Check map_is_allocated_.
1837         (Output_file::map_anonymous): If mmap fails, use malloc.
1838         (Output_file::unmap): Don't do anything for an anonymous map.
1839         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1840         is not available, provide stubs.
1841         (File_read::View::~View): Use free rather than delete[].
1842         (File_read::make_view): Use malloc rather than new[].  If mmap
1843         fails, use malloc.
1844         (File_read::find_or_make_view): Use malloc rather than new[].
1845         * gold.h: Remove HAVE_REMAP code.
1846         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1847         exists.  Rename mremap to gold_mremap.  If mmap is not available
1848         don't do anything.
1849         * configure, config.in: Rebuild.
1851 2011-04-11  Ian Lance Taylor  <iant@google.com>
1853         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1854         initialize local variable v.
1856 2011-04-11  Cary Coutant  <ccoutant@google.com>
1858         * archive.cc (Archive::include_member): Adjust call to
1859         report_object.
1860         (Add_archive_symbols::run): Track argument serial numbers.
1861         (Lib_group::include_member): Likewise.
1862         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1863         * archive.h (Incremental_archive_entry::Archive_member):
1864         Initialize arg_serial_.
1865         (Archive_member::arg_serial_): New data member.
1866         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1867         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1868         incremental link.
1869         (Sized_dynobj::do_for_all_local_got_entries): New function.
1870         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1871         function.
1872         * fileread.cc (get_mtime): New function.
1873         * fileread.h (get_mtime): New function.
1874         * gold.cc (queue_initial_tasks): Check for incremental update.
1875         (process_incremental_input): New function.
1876         (queue_middle_tasks): Don't force valid target for incremental
1877         update.
1878         * incremental-dump.cc (find_input_containing_global): Adjust
1879         size of symbol info entry.
1880         (dump_incremental_inputs): Dump argument serial number and
1881         in_system_directory flag; bias shndx by 1; print symbol names
1882         when dumping per-file symbol lists; use new symbol info readers.
1883         * incremental.cc
1884         (Output_section_incremental_inputs:update_data_size): New function.
1885         (Sized_incremental_binary::setup_readers): Setup input readers
1886         for each input file; build maps for files added from libraries
1887         and scripts.
1888         (Sized_incremental_binary::check_input_args): New function.
1889         (Sized_incremental_binary::do_check_inputs): Build map of argument
1890         serial numbers to input arguments.
1891         (Sized_incremental_binary::do_file_has_changed): Rename
1892         do_file_is_unchanged to this; compare file modification times.
1893         (Sized_incremental_binary::do_init_layout): New function.
1894         (Sized_incremental_binary::do_reserve_layout): New function.
1895         (Sized_incremental_binary::do_get_input_reader): Remove.
1896         (Sized_incremental_binary::get_symtab_view): New function.
1897         (Incremental_checker::can_incrementally_link_output_file): Remove.
1898         (Incremental_inputs::report_command_line): Exclude --debug options.
1899         (Incremental_inputs::report_archive_begin): Add parameter; track
1900         argument serial numbers; don't put input file entry for archive
1901         before archive members.
1902         (Incremental_inputs::report_archive_end): Put input file entry
1903         for archive after archive members.
1904         (Incremental_inputs::report_object): Add parameter; track argument
1905         serial numbers and in_system_directory flag.
1906         (Incremental_inputs::report_script): Add parameter; track argument
1907         serial numbers.
1908         (Output_section_incremental_inputs::set_final_data_size): Adjust
1909         size of symbol info entry; check for forwarding symbols.
1910         (Output_section_incremental_inputs::write_input_files): Write
1911         in_system_directory flag and argument serial number.
1912         (Output_section_incremental_inputs::write_info_blocks): Map section
1913         indices between incremental info and original input file; store
1914         input section index for each symbol.
1915         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1916         change operator() to visit().
1917         (class Global_got_offset_visitor): Likewise.
1918         (class Global_symbol_visitor_got_plt):
1919         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1920         classes.
1921         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1922         (Sized_incr_relobj::do_read_symbols): New function.
1923         (Sized_incr_relobj::do_layout): New function.
1924         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1925         (Sized_incr_relobj::do_add_symbols): New function.
1926         (Sized_incr_relobj::do_should_include_member): New function.
1927         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1928         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1929         (Sized_incr_relobj::do_section_size): New function.
1930         (Sized_incr_relobj::do_section_name): New function.
1931         (Sized_incr_relobj::do_section_contents): New function.
1932         (Sized_incr_relobj::do_section_flags): New function.
1933         (Sized_incr_relobj::do_section_entsize): New function.
1934         (Sized_incr_relobj::do_section_address): New function.
1935         (Sized_incr_relobj::do_section_type): New function.
1936         (Sized_incr_relobj::do_section_link): New function.
1937         (Sized_incr_relobj::do_section_info): New function.
1938         (Sized_incr_relobj::do_section_addralign): New function.
1939         (Sized_incr_relobj::do_initialize_xindex): New function.
1940         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1941         (Sized_incr_relobj::do_read_relocs): New function.
1942         (Sized_incr_relobj::do_gc_process_relocs): New function.
1943         (Sized_incr_relobj::do_scan_relocs): New function.
1944         (Sized_incr_relobj::do_count_local_symbols): New function.
1945         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1946         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1947         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1948         (Sized_incr_relobj::do_relocate): New function.
1949         (Sized_incr_relobj::do_set_section_offset): New function.
1950         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1951         (Sized_incr_dynobj::do_read_symbols): New function.
1952         (Sized_incr_dynobj::do_layout): New function.
1953         (Sized_incr_dynobj::do_add_symbols): New function.
1954         (Sized_incr_dynobj::do_should_include_member): New function.
1955         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1956         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1957         (Sized_incr_dynobj::do_section_size): New function.
1958         (Sized_incr_dynobj::do_section_name): New function.
1959         (Sized_incr_dynobj::do_section_contents): New function.
1960         (Sized_incr_dynobj::do_section_flags): New function.
1961         (Sized_incr_dynobj::do_section_entsize): New function.
1962         (Sized_incr_dynobj::do_section_address): New function.
1963         (Sized_incr_dynobj::do_section_type): New function.
1964         (Sized_incr_dynobj::do_section_link): New function.
1965         (Sized_incr_dynobj::do_section_info): New function.
1966         (Sized_incr_dynobj::do_section_addralign): New function.
1967         (Sized_incr_dynobj::do_initialize_xindex): New function.
1968         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1969         (make_sized_incremental_object): New function.
1970         (Incremental_library::copy_unused_symbols): New function.
1971         (Incremental_library::do_for_all_unused_symbols): New function.
1972         * incremental.h (enum Incremental_input_flags): New type.
1973         (class Incremental_checker): Remove.
1974         (Incremental_input_entry::Incremental_input_entry): Add argument
1975         serial number.
1976         (Incremental_input_entry::arg_serial): New function.
1977         (Incremental_input_entry::set_is_in_system_directory): New function.
1978         (Incremental_input_entry::is_in_system_directory): New function.
1979         (Incremental_input_entry::arg_serial_): New data member.
1980         (Incremental_input_entry::is_in_system_directory_): New data member.
1981         (class Script_info): Move here from script.h.
1982         (Script_info::Script_info): Add filename parameter.
1983         (Script_info::filename): New function.
1984         (Script_info::filename_): New data member.
1985         (Incremental_script_entry::Incremental_script_entry): Add argument
1986         serial number.
1987         (Incremental_object_entry::Incremental_object_entry): Likewise.
1988         (Incremental_object_entry::add_input_section): Build list of input
1989         sections with map to original shndx.
1990         (Incremental_object_entry::get_input_section_index): New function.
1991         (Incremental_object_entry::shndx_): New data member.
1992         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1993         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1994         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1995         serial number.
1996         (Incremental_inputs::report_archive_begin): Likewise.
1997         (Incremental_inputs::report_object): Likewise.
1998         (Incremental_inputs::report_script): Likewise.
1999         (class Incremental_global_symbol_reader): New class.
2000         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2001         and store flags and input file type.
2002         (Incremental_input_entry_reader::arg_serial): New function.
2003         (Incremental_input_entry_reader::type): Extract type from flags.
2004         (Incremental_input_entry_reader::is_in_system_directory): New function.
2005         (Incremental_input_entry_reader::get_input_section_count): Call
2006         accessor function for type.
2007         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2008         function for type; adjust size of global symbol entry.
2009         (Incremental_input_entry_reader::get_global_symbol_count): Call
2010         accessor function for type.
2011         (Incremental_input_entry_reader::get_object_count): Likewise.
2012         (Incremental_input_entry_reader::get_object_offset): Likewise.
2013         (Incremental_input_entry_reader::get_member_count): Likewise.
2014         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2015         (Incremental_input_entry_reader::get_member_offset): Likewise.
2016         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2017         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2018         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2019         (Incremental_input_entry_reader::get_global_symbol_reader): New
2020         function.
2021         (Incremental_input_entry_reader::get_output_symbol_index): New
2022         function.
2023         (Incremental_input_entry_reader::type_): Remove.
2024         (Incremental_input_entry_reader::flags_): New data member.
2025         (Incremental_inputs_reader::input_file_offset): New function.
2026         (Incremental_inputs_reader::input_file_index): New function.
2027         (Incremental_inputs_reader::input_file): Call input_file_offset.
2028         (Incremental_inputs_reader::input_file_at_offset): New function.
2029         (Incremental_relocs_reader::get_r_type): Reformat.
2030         (Incremental_relocs_reader::get_r_shndx): Reformat.
2031         (Incremental_relocs_reader::get_r_offset): Reformat.
2032         (Incremental_relocs_reader::data): New function.
2033         (Incremental_binary::Incremental_binary): Initialize new data members.
2034         (Incremental_binary::check_inputs): Add cmdline parameter.
2035         (Incremental_binary::file_is_unchanged): Remove.
2036         (Input_reader::arg_serial): New function.
2037         (Input_reader::get_unused_symbol_count): New function.
2038         (Input_reader::get_unused_symbol): New function.
2039         (Input_reader::do_arg_serial): New function.
2040         (Input_reader::do_get_unused_symbol_count): New function.
2041         (Input_reader::do_get_unused_symbol): New function.
2042         (Incremental_binary::input_file_count): New function.
2043         (Incremental_binary::get_input_reader): Change signature to use
2044         index instead of filename.
2045         (Incremental_binary::file_has_changed): New function.
2046         (Incremental_binary::get_input_argument): New function.
2047         (Incremental_binary::get_library): New function.
2048         (Incremental_binary::get_script_info): New function.
2049         (Incremental_binary::init_layout): New function.
2050         (Incremental_binary::reserve_layout): New function.
2051         (Incremental_binary::output_file): New function.
2052         (Incremental_binary::do_check_inputs): New function.
2053         (Incremental_binary::do_file_is_unchanged): Remove.
2054         (Incremental_binary::do_file_has_changed): New function.
2055         (Incremental_binary::do_init_layout): New function.
2056         (Incremental_binary::do_reserve_layout): New function.
2057         (Incremental_binary::do_input_file_count): New function.
2058         (Incremental_binary::do_get_input_reader): Change signature.
2059         (Incremental_binary::input_args_map_): New data member.
2060         (Incremental_binary::library_map_): New data member.
2061         (Incremental_binary::script_map_): New data member.
2062         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2063         new data members.
2064         (Sized_incremental_binary::output_section): New function.
2065         (Sized_incremental_binary::inputs_reader): Add const.
2066         (Sized_incremental_binary::symtab_reader): Add const.
2067         (Sized_incremental_binary::relocs_reader): Add const.
2068         (Sized_incremental_binary::got_plt_reader): Add const.
2069         (Sized_incremental_binary::get_symtab_view): New function.
2070         (Sized_incremental_binary::Inputs_reader): New typedef.
2071         (Sized_incremental_binary::Input_entry_reader): New typedef.
2072         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2073         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2074         (Sized_incremental_binary::do_file_has_changed): New function.
2075         (Sized_incremental_binary::do_init_layout): New function.
2076         (Sized_incremental_binary::do_reserve_layout): New function.
2077         (Sized_input_reader::Inputs_reader): Remove.
2078         (Sized_input_reader::Input_entry_reader): Remove.
2079         (Sized_input_reader::do_arg_serial): New function.
2080         (Sized_input_reader::do_get_unused_symbol_count): New function.
2081         (Sized_input_reader::do_get_unused_symbol): New function.
2082         (Sized_incremental_binary::do_input_file_count): New function.
2083         (Sized_incremental_binary::do_get_input_reader): Change signature;
2084         use index instead of filename.
2085         (Sized_incremental_binary::section_map_): New data member.
2086         (Sized_incremental_binary::input_entry_readers_): New data member.
2087         (class Sized_incr_relobj): New class.
2088         (class Sized_incr_dynobj): New class.
2089         (make_sized_incremental_object): New function.
2090         (class Incremental_library): New class.
2091         * layout.cc (Free_list::num_lists): New static data member.
2092         (Free_list::num_nodes): New static data member.
2093         (Free_list::num_removes): New static data member.
2094         (Free_list::num_remove_visits): New static data member.
2095         (Free_list::num_allocates): New static data member.
2096         (Free_list::num_allocate_visits): New static data member.
2097         (Free_list::init): New function.
2098         (Free_list::remove): New function.
2099         (Free_list::allocate): New function.
2100         (Free_list::dump): New function.
2101         (Free_list::print_stats): New function.
2102         (Layout_task_runner::run): Resize output file for incremental updates.
2103         (Layout::Layout): Initialize new data members.
2104         (Layout::set_incremental_base): New function.
2105         (Layout::init_fixed_output_section): New function.
2106         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2107         incremental updates.
2108         (Layout::create_gold_note): Do not create gold note section for
2109         incremental updates.
2110         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2111         for incremental updates.
2112         (Layout::set_section_offsets): For incremental updates, allocate space
2113         from free list.
2114         (Layout::create_symtab_sections): Layout with offsets relative to
2115         start of section; for incremental updates, allocate space from free
2116         list.
2117         (Layout::create_shdrs): For incremental updates, allocate space from
2118         free list.
2119         (Layout::finish_dynamic_section): For incremental updates, do not
2120         check --as-needed (fixed in subsequent patch).
2121         * layout.h (class Free_list): New class.
2122         (Layout::set_incremental_base): New function.
2123         (Layout::incremental_base): New function.
2124         (Layout::init_fixed_output_section): New function.
2125         (Layout::allocate): New function.
2126         (Layout::incremental_base_): New data member.
2127         (Layout::free_list_): New data member.
2128         * main.cc (main): Print Free_list statistics.
2129         * object.cc (Relobj::finalize_incremental_relocs): Add
2130         clear_counts parameter; clear counts only when clear_counts is set.
2131         (Sized_relobj::Sized_relobj): Initialize new base class.
2132         (Sized_relobj::do_layout): Don't report special sections.
2133         (Sized_relobj::do_for_all_local_got_entries): New function.
2134         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2135         symtab_off to all symbol table offsets.
2136         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2137         * object.h (class Got_offset_list): Move to top of file.
2138         (Object::Object): Allow case where input_file == NULL.
2139         (Object::~Object): Likewise.
2140         (Object::input_file): Assert that input_file != NULL.
2141         (Object::lock): Allow case where input_file == NULL.
2142         (Object::unlock): Likewise.
2143         (Object::is_locked): Likewise.
2144         (Object::token): Likewise.
2145         (Object::release): Likewise.
2146         (Object::is_incremental): New function.
2147         (Object::get_mtime): New function.
2148         (Object::for_all_local_got_entries): New function.
2149         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2150         (Object::set_is_in_system_directory): New function.
2151         (Object::is_in_system_directory): New function.
2152         (Object::do_is_incremental): New function.
2153         (Object::do_get_mtime): New function.
2154         (Object::do_for_all_local_got_entries): New function.
2155         (Object::is_in_system_directory_): New data member.
2156         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2157         (class Sized_relobj_base): New class.
2158         (class Sized_relobj): Derive from Sized_relobj_base.
2159         (class Sized_relobj::Symbols): Redeclare from base class.
2160         (class Sized_relobj::local_got_offset_list): Remove.
2161         (class Sized_relobj::Output_sections): Redeclare from base class.
2162         (class Sized_relobj::do_for_all_local_got_entries): New function.
2163         (class Sized_relobj::write_local_symbols): Add offset parameter.
2164         (class Sized_relobj::local_symbol_offset_): Update comment.
2165         (class Sized_relobj::local_dynsym_offset_): Update comment.
2166         * options.cc (Input_arguments::add_file): Remove const.
2167         * options.h (Input_file_argument::Input_file_argument):
2168         Initialize arg_serial_ (all constructors).
2169         (Input_file_argument::set_arg_serial): New function.
2170         (Input_file_argument::arg_serial): New function.
2171         (Input_file_argument::arg_serial_): New data member.
2172         (Input_arguments::Input_arguments): Initialize file_count_.
2173         (Input_arguments::add_file): Remove const.
2174         (Input_arguments::number_of_input_files): New function.
2175         (Input_arguments::file_count_): New data member.
2176         (Command_line::number_of_input_files): Call
2177         Input_arguments::number_of_input_files.
2178         * output.cc (Output_segment_headers::Output_segment_headers):
2179         Set current size.
2180         (Output_section::Input_section::current_data_size): New function.
2181         (Output_section::Output_section): Initialize new data members.
2182         (Output_section::add_input_section): Don't do merge sections for
2183         an incremental link; allocate space from free list for an
2184         incremental update.
2185         (Output_section::add_output_section_data): Allocate space from
2186         free list for an incremental update.
2187         (Output_section::update_data_size): New function.
2188         (Output_section::set_fixed_layout): New function.
2189         (Output_section::reserve): New function.
2190         (Output_segment::set_section_addresses): Remove const.
2191         (Output_segment::set_section_list_addresses): Remove const; allocate
2192         space from free list for an incremental update.
2193         (Output_segment::set_offset): Adjust size of RELRO segment for an
2194         incremental update.
2195         * output.h (Output_data::current_data_size): Move here from
2196         child classes.
2197         (Output_data::pre_finalize_data_size): New function.
2198         (Output_data::update_data_size): New function.
2199         (Output_section_headers::update_data_size): new function.
2200         (Output_section_data_build::current_data_size): Move to Output_data.
2201         (Output_data_strtab::update_data_size): New function.
2202         (Output_section::current_data_size): Move to Output_data.
2203         (Output_section::set_fixed_layout): New function.
2204         (Output_section::has_fixed_layout): New function.
2205         (Output_section::reserve): New function.
2206         (Output_section::update_data_size): New function.
2207         (Output_section::has_fixed_layout_): New data member.
2208         (Output_section::free_list_): New data member.
2209         (Output_segment::set_section_addresses): Remove const.
2210         (Output_segment::set_section_list_addresses): Remove const.
2211         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2212         New function.
2213         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2214         New function.
2215         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2216         parameter when calling Add_symbols constructor; store argument
2217         serial number for members of a lib group.
2218         (Add_symbols::locks): Allow case where token == NULL.
2219         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2220         (Read_member::~Read_member): New function.
2221         (Read_member::is_runnable): New function.
2222         (Read_member::locks): New function.
2223         (Read_member::run): New function.
2224         (Check_script::~Check_script): New function.
2225         (Check_script::is_runnable): New function.
2226         (Check_script::locks): New function.
2227         (Check_script::run): New function.
2228         (Check_library::~Check_library): New function.
2229         (Check_library::is_runnable): New function.
2230         (Check_library::locks): New function.
2231         (Check_library::run): New function.
2232         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2233         (Add_symbols::library_): New data member.
2234         (class Read_member): New class.
2235         (class Check_script): New class.
2236         (class Check_library): New class.
2237         * reloc.cc (Read_relocs::is_runnable): Allow case where
2238         token == NULL.
2239         (Read_relocs::locks): Likewise.
2240         (Scan_relocs::locks): Likewise.
2241         (Relocate_task::locks): Likewise.
2242         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2243         to clear counters.
2244         (Sized_relobj::incremental_relocs_scan): Fix comment.
2245         (Sized_relobj::do_relocate): Pass output file offset to
2246         write_local_symbols.
2247         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2248         from class declaration.
2249         * script.cc (read_input_script): Allocate Script_info; pass
2250         argument serial number to report_script.
2251         * script.h (class Script_info): Move to incremental.h.
2252         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2253         * symtab.h (Symbol_table::add_from_incrobj): New function.
2254         (Symbol_table::set_file_offset): New function.
2256 2011-04-05  Cary Coutant  <ccoutant@google.com>
2258         * incremental-dump.cc (dump_incremental_inputs): Change signature
2259         to take a Sized_incremental_binary; change caller.  Use readers
2260         in Sized_incremental_binary.
2261         * incremental.cc
2262         (Sized_incremental_binary::find_incremental_inputs_sections):
2263         Rename do_find_incremental_inputs_sections to this.
2264         (Sized_incremental_binary::setup_readers): New function.
2265         (Sized_incremental_binary::do_check_inputs): Check
2266         has_incremental_info_ flag; move setup code to setup_readers;
2267         use input readers.
2268         (Sized_incremental_binary::do_file_is_unchanged): New function.
2269         (Sized_incremental_binary::do_get_input_reader): New function.
2270         * incremental.h (class Incremental_binary): Move to end of file.
2271         (Incremental_binary::file_is_unchanged): New function.
2272         (Incremental_binary::do_file_is_unchanged): New function.
2273         (Incremental_binary::Input_reader): New class.
2274         (Incremental_binary::get_input_reader): New function.
2275         (class Sized_incremental_binary): Move to end of file.
2276         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2277         input section reader classes.
2278         (Sized_incremental_binary::has_incremental_info): New function.
2279         (Sized_incremental_binary::inputs_reader): New function.
2280         (Sized_incremental_binary::symtab_reader): New function.
2281         (Sized_incremental_binary::relocs_reader): New function.
2282         (Sized_incremental_binary::got_plt_reader): New function.
2283         (Sized_incremental_binary::do_file_is_unchanged): New function.
2284         (Sized_incremental_binary::Sized_input_reader): New class.
2285         (Sized_incremental_binary::get_input_reader): New function.
2286         (Sized_incremental_binary::find_incremental_inputs_sections):
2287         Rename do_find_incremental_inputs_sections to this.
2288         (Sized_incremental_binary::setup_readers): New function.
2289         (Sized_incremental_binary::has_incremental_info_): New data member.
2290         (Sized_incremental_binary::inputs_reader_): New data member.
2291         (Sized_incremental_binary::symtab_reader_): New data member.
2292         (Sized_incremental_binary::relocs_reader_): New data member.
2293         (Sized_incremental_binary::got_plt_reader_): New data member.
2294         (Sized_incremental_binary::current_input_file_): New data member.
2296 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2298         PR gold/12640
2299         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2300         violation.
2302 2011-03-30  Cary Coutant  <ccoutant@google.com>
2304         * archive.cc (Archive::include_member): Adjust call to report_object.
2305         (Add_archive_symbols::run): Add script_info to call to
2306         report_archive_begin.
2307         (Lib_group::include_member): Adjust call to report_object.
2308         (Add_lib_group_symbols::run): Adjust call to report_object.
2309         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2310         blocks.  Add object count for script input files.
2311         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2312         script_info parameter; change all callers.
2313         (Incremental_inputs::report_object): Add script_info parameter;
2314         change all callers.
2315         (Incremental_inputs::report_script): Store backpointer to
2316         incremental info entry.
2317         (Output_section_incremental_inputs::set_final_data_size): Record
2318         additional information for scripts.
2319         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2320         * incremental.h (Incremental_script_entry::add_object): New function.
2321         (Incremental_script_entry::get_object_count): New function.
2322         (Incremental_script_entry::get_object): New function.
2323         (Incremental_script_entry::objects_): New data member; adjust
2324         constructor.
2325         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2326         (Incremental_inputs::report_object): Add script_info parameter.
2327         (Incremental_inputs_reader::get_object_count): New function.
2328         (Incremental_inputs_reader::get_object_offset): New function.
2329         * options.cc (Input_arguments::add_file): Return reference to
2330         new input argument.
2331         * options.h (Input_argument::set_script_info): New function.
2332         (Input_argument::script_info): New function.
2333         (Input_argument::script_info_): New data member; adjust all
2334         constructors.
2335         (Input_file_group::add_file): Return reference to new input argument.
2336         (Input_file_lib::add_file): Likewise.
2337         (Input_arguments::add_file): Likewise.
2338         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2339         * script.cc (Parser_closure::Parser_closure): Add script_info
2340         parameter; adjust all callers.
2341         (Parser_closure::script_info): New function.
2342         (Parser_closure::script_info_): New data member.
2343         (read_input_script): Report scripts earlier to incremental info.
2344         (script_add_file): Set script_info in Input_argument.
2345         (script_add_library): Likewise.
2346         * script.h (Script_options::Script_info): Rewrite class.
2348 2011-03-29  Cary Coutant  <ccoutant@google.com>
2350         * archive.cc (Library_base::should_include_member): Move
2351         method here from class Archive.
2352         (Archive::Archive): Initialize base class.
2353         (Archive::should_include_member): Move to base class.
2354         (Archive::do_for_all_unused_symbols): New function.
2355         (Add_archive_symbols::run): Remove redundant access to
2356         incremental_inputs.
2357         (Lib_group::Lib_group): Initialize base class.
2358         (Lib_group::do_filename): New function.
2359         (Lib_group::include_member): Pass pointer to Lib_group to
2360         report_object.
2361         (Lib_group::do_for_all_unused_symbols): New function.
2362         (Add_lib_group_symbols::run): Report archive information for
2363         incremental links.
2364         * archive.h (class Library_base): New base class.
2365         (class Archive): Derive from Library_base.
2366         (Archive::filename): Move to base class.
2367         (Archive::set_incremental_info): Likewise.
2368         (Archive::incremental_info): Likewise.
2369         (Archive::Should_include): Likewise.
2370         (Archive::should_include_member): Likewise.
2371         (Archive::Armap_entry): Remove.
2372         (Archive::Unused_symbol_iterator): Remove.
2373         (Archive::unused_symbols_begin): Remove.
2374         (Archive::unused_symbols_end): Remove.
2375         (Archive::do_filename): New function.
2376         (Archive::do_get_mtime): New function.
2377         (Archive::do_for_all_unused_symbols): New function.
2378         (Archive::task_): Move to base class.
2379         (Archive::incremental_info_): Likewise.
2380         (class Lib_group): Derive from Library_base.
2381         (Lib_group::do_filename): New function.
2382         (Lib_group::do_get_mtime): New function.
2383         (Lib_group::do_for_all_unused_symbols): New function.
2384         (Lib_group::task_): Move to base class.
2385         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2386         function.
2387         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2388         function.
2389         * incremental.cc (Incremental_inputs::report_archive_begin):
2390         Use Library_base; call library's get_mtime; add incremental inputs
2391         entry before members.
2392         (class Unused_symbol_visitor): New class.
2393         (Incremental_inputs::report_archive_end): Use Library_base; use
2394         visitor class to record unused symbols; don't add incremental inputs
2395         entry after members.
2396         (Incremental_inputs::report_object): Use Library_base.
2397         * incremental.h
2398         (Incremental_archive_entry::Incremental_archive_entry): Remove
2399         unused Archive parameter.
2400         (Incremental_inputs::report_archive_begin): Use Library_base.
2401         (Incremental_inputs::report_archive_end): Likewise.
2402         (Incremental_inputs::report_object): Likewise.
2403         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2404         function.
2405         * object.h (Object::for_all_global_symbols): New function.
2406         (Object::do_for_all_global_symbols): New function.
2407         (Sized_relobj::do_for_all_global_symbols): New function.
2408         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2409         function.
2410         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2411         function.
2413 2011-03-27  Ian Lance Taylor  <iant@google.com>
2415         * archive.cc (Archive::interpret_header): Return -1 if something
2416         goes wrong.  Change callers accordingly.
2418 2011-03-25  Cary Coutant  <ccoutant@google.com>
2420         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2421         * testsuite/Makefile.in: Regenerate.
2423 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2425         * plugin.cc (get_view): New.
2426         (Plugin::load): Pass get_view to the plugin.
2427         (Plugin_manager::get_view): New.
2429 2011-03-21  Ian Lance Taylor  <iant@google.com>
2431         * testsuite/final_layout.sh: Rewrite to not use dc.
2432         * testsuite/relro_test.sh: Fail if dc is not present.
2434 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2436         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2437         Change == to -eq.
2438         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2439         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2440         Change == to -eq.
2441         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2442         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2444 2011-03-14  Ian Lance Taylor  <iant@google.com>
2446         * script-sections.cc (Sort_output_sections::script_compare):
2447         Rename from is_before, change return type.
2448         (Sort_output_sections::operator()): Adjust accordingly.
2450 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2452         PR gold/12572
2453         * testsuite/odr_violation2.cc: Add comment to make all error line
2454         numbers double digits.
2455         * testsuite/debug_msg.sh: Adjust expected errors.
2457 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2459         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2460         but mark earlier ones as non-canonical
2461         (offset_to_iterator): Update search target and example
2462         (do_addr2line): Return extra lines in a vector*
2463         (format_file_lineno): Extract from do_addr2line
2464         (one_addr2line): Add vector* out-param
2465         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2466         when a lineno entry appeared last for its instruction
2467         (Dwarf_line_info): Add vector* out-param
2468         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2469         * symtab.cc (Odr_violation_compare): Include the lineno in the
2470         comparison again.
2471         (linenos_from_loc): New. Combine the canonical line for an
2472         address with its other lines.
2473         (True_if_intersect): New. Helper functor to make
2474         std::set_intersection a query.
2475         (detect_odr_violations): Compare sets of lines instead of just
2476         one line for each function. This became less deterministic, but
2477         has fewer false positives.
2478         * symtab.h: Declarations.
2479         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2480         mix an optimized and non-optimized object in the same binary
2481         (odr_violation2.so): Same.
2482         * testsuite/Makefile.in: Regenerate from Makefile.am.
2483         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2484         * testsuite/debug_msg.sh: Update line numbers and add
2485         assertions.
2486         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2487         non-optimized context.
2488         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2489         isn't inlined, and use OdrDerived in an optimized context.
2490         * testsuite/odr_header1.h: Defines OdrDerived, where
2491         optimization will change the
2492         first-instruction-in-the-destructor's file and line number.
2493         * testsuite/odr_header2.h: Defines OdrBase.
2495 2011-03-09  Ian Lance Taylor  <iant@google.com>
2497         * fileread.cc (File_read::clear_views): Don't delete the whole
2498         file view.
2500 2011-03-08  Ian Lance Taylor  <iant@google.com>
2502         PR gold/12525
2503         * fileread.cc: #include <climits>.
2504         (GOLD_IOV_MAX): Define.
2505         (File_read::read_multiple): Limit number of entries by iov_max.
2506         * fileread.h (class File_read): Always set max_readv_entries to
2507         128.
2509 2011-03-07  Ian Lance Taylor  <iant@google.com>
2511         PR gold/12525
2512         * options.h (class General_options): Add -dy and -dn.
2514 2011-03-02  Cary Coutant  <ccoutant@google.com>
2516         * testsuite/script_test_9.t: Add TLS segment.
2518 2011-03-02  Simon Baldwin  <simonb@google.com>
2520         * configure.ac: Add check for gnu_indirect_function support in
2521         the toolchain building binutils.
2522         * configure: Rebuild.
2524 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2526         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2527         plugin only symbols.
2528         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2529         in plugin files as not needed in the symbol table.
2531 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2533         * output.cc (Output_section::add_input_section): Delay fill
2534         generation for section ordering.
2536 2011-02-09  Ian Lance Taylor  <iant@google.com>
2538         PR gold/12316
2539         * object.h (class Sized_relobj): Remove clear_local_symbols.
2540         * reloc.cc (Sized_relobj::do_relocate): Don't call
2541         clear_local_symbols.
2543 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2545         * plugin.cc (is_visible_from_outside): Return true for symbols
2546         in the -u option.
2548 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2550         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2551         filename.
2553 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2555         * icf.h (is_section_foldable_candidate): Change type of parameter
2556         to std::string.
2557         * icf.cc (Icf::find_identical_sections): Change type of local variable
2558         section_name to be std::string.
2559         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2561 2011-01-25  Ian Lance Taylor  <iant@google.com>
2563         * script.cc (script_add_extern): Rewrite to use
2564         add_symbol_reference.
2566 2011-01-25  Doug Kwan  <dougkwan@google.com>
2568         * icf.cc (get_section_contents): Always lock section's object.
2570 2011-01-24  Ian Lance Taylor  <iant@google.com>
2572         * options.h (class General_options): Accept
2573         --no-detect-odr-violations.
2575 2011-01-24  Ian Lance Taylor  <iant@google.com>
2577         * version.cc (version_string): Bump to 1.11.
2579 2011-01-24  Ian Lance Taylor  <iant@google.com>
2581         * plugin.cc (class Plugin_rescan): Define new class.
2582         (Plugin_manager::claim_file): Set any_claimed_.
2583         (Plugin_manager::save_archive): New function.
2584         (Plugin_manager::save_input_group): New function.
2585         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2586         necessary.
2587         (Plugin_manager::new_undefined_symbol): New function.
2588         (Plugin_manager::rescan): New function.
2589         (Plugin_manager::rescannable_defines): New function.
2590         (Plugin_manager::add_input_file): Set any_added_.
2591         * plugin.h (class Plugin_manager): define new fields rescannable_,
2592         undefined_symbols_, any_claimed_, and any_added_.  Declare
2593         Plugin_rescan as friend.  Declare new functions.
2594         (Plugin_manager::Rescannable): Define type.
2595         (Plugin_manager::Rescannable_list): Define type.
2596         (Plugin_manager::Undefined_symbol_list): Define type.
2597         (Plugin_manager::Plugin_manager): Initialize new fields.
2598         * archive.cc (Archive::defines_symbol): New function.
2599         (Add_archive_symbols::run): Pass archive to plugins if any.
2600         * archive.h (class Archive): Declare defines_symbol.
2601         * readsyms.cc (Input_group::~Input_group): New function.
2602         (Finish_group::run): Pass input_group to plugins if any.
2603         * readsyms.h (class Input_group): Declare destructor.
2604         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2605         any.
2607 2011-01-10  Ian Lance Taylor  <iant@google.com>
2609         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2610         section as relro.
2611         (Layout::set_segment_offsets): Reset increase_relro before calling
2612         set_section_addresses a second time.
2614 2011-01-04  Cary Coutant  <ccoutant@google.com>
2616         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2617         sections before NOBITS sections.
2619 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2621         * version.cc (print_version): Update copyright to 2011.
2623 2010-12-23  Cary Coutant  <ccoutant@google.com>
2625         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2626         of OS to this->add.  Add OD parameter to second form of the function.
2628 2010-12-20  Ian Lance Taylor  <iant@google.com>
2630         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2631         second of two consecutive entries with same offset.
2633 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2635         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2636         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2637         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2638         to avoid unneeded links against $(LDADD).
2639         * testsuite/Makefile.in: Regenerate.
2641 2010-12-15  Ian Lance Taylor  <iant@google.com>
2643         PR gold/12324
2644         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2645         for R_X86_64_32 and R_X86_64_PC32.
2646         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2647         ver_matching_def_pic.o.
2648         (ver_matching_def_pic.o): New target.
2650 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2652         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2653         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2654         Move definition before File_read::View member definitions.
2655         (File_read::View::~View): Initialize and hold lock before
2656         updating current_mapped_bytes.
2658 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2660         * dwarf_reader.cc: Remove outdated comment.
2661         * gold-threads.cc: Fix typo in error message.
2662         * archive.cc: Fix typos in comments.
2663         * archive.h: Likewise.
2664         * arm-reloc-property.cc: Likewise.
2665         * arm-reloc-property.h: Likewise.
2666         * arm-reloc.def: Likewise.
2667         * arm.cc: Likewise.
2668         * attributes.h: Likewise.
2669         * cref.cc: Likewise.
2670         * ehframe.cc: Likewise.
2671         * fileread.h: Likewise.
2672         * gold.h: Likewise.
2673         * i386.cc: Likewise.
2674         * icf.cc: Likewise.
2675         * incremental.h: Likewise.
2676         * int_encoding.cc: Likewise.
2677         * layout.h: Likewise.
2678         * main.cc: Likewise.
2679         * merge.h: Likewise.
2680         * object.cc: Likewise.
2681         * object.h: Likewise.
2682         * options.cc: Likewise.
2683         * readsyms.cc: Likewise.
2684         * reduced_debug_output.cc: Likewise.
2685         * reloc.cc: Likewise.
2686         * script-sections.cc: Likewise.
2687         * sparc.cc: Likewise.
2688         * symtab.h: Likewise.
2689         * target-reloc.h: Likewise.
2690         * target.cc: Likewise.
2691         * target.h: Likewise.
2692         * timer.cc: Likewise.
2693         * timer.h: Likewise.
2694         * x86_64.cc: Likewise.
2696 2010-12-09  Cary Coutant  <ccoutant@google.com>
2698         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2699         stack.
2700         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2701         parameter; change all callers.
2702         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2703         * options.h (warn_execstack): New option.
2705 2010-12-07  Doug Kwan  <dougkwan@google.com>
2707         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2708         like function call relocations.
2710 2010-12-07  Ian Lance Taylor  <iant@google.com>
2712         * archive.cc (Archive::get_elf_object_for_member): Permit
2713         punconfigured to be NULL.
2714         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2715         (Archive::include_member): Pass NULL to get_elf_object_for_member
2716         if we searched for the archive and this is the first included
2717         object.
2719 2010-12-01  Ian Lance Taylor  <iant@google.com>
2721         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2722         track_relocs_type_ field.
2723         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2724         Set track_relocs_type_.
2725         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2726         contents when using RELA relocs.
2727         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2728         reloc_map_.
2729         * reloc.cc (Track_relocs::next_addend): New function.
2730         * reloc.h (class Track_relocs): Declare next_addend.
2732 2010-12-01  Ian Lance Taylor  <iant@google.com>
2734         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2735         virtual destructor.
2737 2010-12-01  Ian Lance Taylor  <iant@google.com>
2739         * README: Update compilers known to work and fail.
2741 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2743         * configure.in: For --enable-gold, handle value `default' instead of
2744         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2745         not the default.
2746         * configure: Regenerate.
2748 2010-11-18  Doug Kwan  <dougkwan@google.com>
2750         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2751         and right_alignment to be zero.  Store result alignment only if it is
2752         greater than existing alignment.
2754 2010-11-16  Cary Coutant  <ccoutant@google.com>
2756         PR gold/12220
2757         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2758         Check for ".zdebug_line".
2760 2010-11-16  Doug Kwan  <dougkwan@google.com>
2761             Cary Coutant  <ccoutant@google.com>
2763         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2764         by reference; adjust all callers.
2765         * output.cc (Output_segment::set_section_addresses): Adjust references
2766         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2767         list is empty.
2768         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2769         end at page boundary.
2771 2010-11-16  Cary Coutant  <ccoutant@google.com>
2773         PR gold/12220
2774         * layout.cc (Layout::choose_output_section): Transform names of
2775         compressed sections even when using a script with a SECTIONS clause.
2776         (Layout::output_section_name): Remove code to transform
2777         compressed debug section names.
2778         * output.cc (Output_section::add_input_section): Use uncompressed
2779         section size when tracking input sections.
2781 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2783         * symtab.h (Symbol::NON_PIC_REF): Remove.
2784         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2785         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2786         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2787         (Symbol::use_plt_offset): Take a flags argument and pass it
2788         directly to needs_dynamic_reloc.  Restrict check for undefined
2789         weak symbols to function calls.
2790         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2791         (Target_arm::Scan::global): Use it.
2792         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2793         (Target_arm::Relocate::relocate): Likewise.
2794         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2795         parameter with an r_type parameter.  Use get_reference_flags
2796         to get the flags.
2797         (Target_arm::Relocate::relocate): Update accordingly.
2798         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2799         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2800         (Target_i386::Scan::global): Likewise.
2801         (Target_i386::Relocate::relocate): Likewise.
2802         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2803         parameter with an r_type parameter.  Use get_reference_flags
2804         to get the flags.
2805         (Target_i386::Relocate::relocate): Update accordingly.
2806         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2807         (Target_powerpc::Scan::global): Use it.
2808         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2809         (Target_powerpc::Relocate::relocate): Likewise.
2810         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2811         (Target_sparc::Scan::global): Use it.
2812         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2813         (Target_sparc::Relocate::relocate): Likewise.
2814         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2815         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2816         (Target_x86_64::Scan::global): Likewise.
2817         (Target_x86_64::Relocate::relocate): Likewise.
2819 2010-11-08  Doug Kwan  <dougkwan@google.com>
2820             Cary Coutant  <ccoutant@google.com>
2822         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2823         (Arm_exidx_merge_section::section_contents_): New data member.
2824         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2825         (Arm_input_section::~Arm_input_section): De-allocate memory.
2826         (Arm_input_section::original_contents_): New data member.       
2827         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2828         in parameters instead of calling Object::section_contents without
2829         locking.
2830         (Arm_output_section::group_section): New parameter TASK.  Pass it
2831         to callees that need locking objects.
2832         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2833         to lock EXIDX input sections.  Fix a formatting issue.  Call
2834         Arm_exidx_merged_section::build_contents to create merged section
2835         contents.
2836         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2837         to lock object of stub table owner.
2838         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2839         TEXT_SIZE to initialize data member TEXT_SIZE_.
2840         (Arm_exidx_input_section::addralign): Fix typo in comment.
2841         (Arm_exidx_input_section::text_size): New method.
2842         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2843         that require locking objects.  Lock objects before scanning for stubs
2844         and updating local symbols.
2845         (Arm_input_section<big_endian>::init): Copy contents of original
2846         input section.
2847         (Arm_input_section<big_endian>::do_write): Use saved contents of
2848         original input section instead of calling Object::section_contents
2849         without locking.
2850         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2851         size without calling Object::section_size().
2852         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2853         for size.  Allocate a buffer for merged EXIDX entries.
2854         (Arm_exidx_merged_section::build_contents): New method.
2855         (Arm_exidx_merged_section::do_write): Move merge section contents
2856         building code to Arm_exidx_merged_section::build_contetns.  Write
2857         out contetns in buffer instead of building it on the fly.
2858         (Arm_relobj::make_exidx_input_section): Also pass text section size
2859         to Arm_exidx_input_section constructor.
2860         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2861         (Arm_dynobj::do_read_symbols): Fix memory leak.
2862         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2863         * target.h: (class Task): Add forward declaration.
2864         (Target::relax): Add new parameter TASK and pass it to
2865         Target::do_relax().
2866         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2868 2010-11-05  Cary Coutant  <ccoutant@google.com>
2870         PR gold/10708
2871         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2872         object when reading from the file.
2873         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2874         second layout pass.
2875         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2876         when reading section contents.
2877         (get_section_contents): Likewise.
2878         (icf::find_identical_sections): Likewise.
2879         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2880         object when reading from the file.
2881         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2882         the object when doing deferred section layout.
2884 2010-11-03  Nick Clifton  <nickc@redhat.com>
2886         PR gold/12001
2887         * script.h (class Symbol_assignment: name): New member.  Returns
2888         the name of the symbol.
2889         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2890         Returns true if the given symbol name is on the list of
2891         assignments wating to be processed.
2892         * archive.cc (should_incldue_member): If the symbol is undefined,
2893         check to see if it is on the list of symbols pending assignment.
2895 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2897         * script-sections.cc (Script_sections::find_memory_region): Check
2898         for a NULL output section pointer.
2900 2010-10-29  Doug Kwan  <dougkwan@google.com>
2902         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2903         Output_section::add_relaxed_input_section.
2904         * output.cc (Output_section::add_relaxed_input_section): Add new
2905         arguments LAYOUT and NAME.  Set section order index.
2906         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2907         Copy section order index.
2908         * output.h (Output_section::add_relaxed_input_section): Add new
2909         arguments LAYOUT and NAME.
2911 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2913         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2914         NATIVE_OR_CROSS_LINKER.
2915         * testsuite/Makefile.in: Regenerate.
2917 2010-10-20  Doug Kwan  <dougkwan@google.com>
2919         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2920         without SHF_LINK_ORDER flags.
2921         * layout.cc (Layout::choose_output_section): Do not filter
2922         SHF_LINK_ORDER flag in a relocatable link.
2924 2010-10-17  Cary Coutant  <ccoutant@google.com>
2926         * output.h (Output_segment::set_section_addresses): Change function
2927         signature.  Update all callers.
2928         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2929         sections.
2930         (Output_segment::set_section_addresses): Align after last TLS
2931         section.  Add padding before last relro section instead of after.
2933 2010-10-17  Doug Kwan  <dougkwan@google.com>
2935         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2936         GOT output section to be writable.
2938 2010-10-14  Cary Coutant  <ccoutant@google.com>
2940         * debug.h (DEBUG_INCREMENTAL): New flag.
2941         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2942         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2943         mode.
2944         * incremental.cc (report_command_line): Ignore all forms of
2945         --incremental.
2946         * layout.cc (Layout::Layout): Check parameters for incremental link
2947         mode.
2948         * options.cc (General_options::parse_incremental): New function.
2949         (General_options::parse_no_incremental): New function.
2950         (General_options::parse_incremental_full): New function.
2951         (General_options::parse_incremental_update): New function.
2952         (General_options::incremental_mode_): New data member.
2953         (General_options::finalize): Check incremental_mode_.
2954         * options.h (General_options): Update help text for --incremental.
2955         Add --no-incremental, --incremental-full, --incremental-update.
2956         (General_options::Incremental_mode): New enum type.
2957         (General_options::incremental_mode): New function.
2958         (General_options::incremental_mode_): New data member.
2959         * parameters.cc (Parameters::incremental_mode_): New data member.
2960         (Parameters::set_options): Set incremental_mode_.
2961         (Parameters::set_incremental_full): New function.
2962         (Parameters::incremental): New function.
2963         (Parameters::incremental_update): New function.
2964         (set_parameters_incremental_full): New function.
2965         * parameters.h (Parameters::set_incremental_full): New function.
2966         (Parameters::incremental): New function.
2967         (Parameters::incremental_update): New function.
2968         (Parameters::incremental_mode_): New data member.
2969         (set_parameters_incremental_full): New function.
2970         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2971         incremental link mode.
2972         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2973         (Sized_relobj::do_relocate_sections): Likewise.
2974         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2975         option.
2976         * testsuite/Makefile.in: Regenerate.
2977         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2979 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2981         * script-sections.h (class Script_sections): Make
2982         Sections_elements typedef public.
2983         * script-sections.cc (class Sort_output_sections): Add elements_
2984         field.  Add constructor which sets it; change all callers.
2985         (Sort_output_sections::is_before): New function.
2986         (Sort_output_sections::operator()): Call is_before.
2987         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2988         conditional.
2989         * testsuite/script_test_10.sh: New test. Test script section
2990         order.
2991         * testsuite/script_test_10.t: Likewise.
2992         * testsuite/script_test_10.s: Likewise.
2993         * testsuite/Makefile.am: Wrap the cross linker tests and the
2994         common tests into NATIVE_OR_CROSS_LINKER.
2995         (check_SCRIPTS): Add script_test_10.sh.
2996         (check_DATA): Add script_test_10.stdout.
2997         (script_test_10.o, script_test_10): New targets.
2998         (script_test_10.stdout): New target.
2999         * configure, testsuite/Makefile.in: Regenerate.
3001 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3003         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3004         error for the deprecated relocations.
3005         (Target_arm::Scan::global): Likewise.
3006         (Target_arm::Relocate::relocate): Likewise.
3008 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3010         * fileread.cc (Input_file::find_file): Initialize *found_name
3011         and *namep when using the fallback search for case 4.
3013 2010-10-11  Cary Coutant  <ccoutant@google.com>
3015         * options.h (class General_options): Redefine -z lazy as an alias for
3016         the negation of -z now.
3018 2010-10-11  Ian Lance Taylor  <iant@google.com>
3020         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3021         binding.
3023 2010-10-06  Nick Clifton  <nickc@redhat.com>
3025         * script-sections.cc(class Memory_region): Remove
3026         current_lma_offset_ field.  Rename current_vma_offset_ to
3027         current_offset_.  Add last_section_ field.
3028         (Memory_region::get_current_vma_address): Rename to
3029         get_current_address.
3030         (Memory_region::get_current_lma_address): Delete.
3031         (Memory_region::increment_vma_offset): Rename to
3032         increment_offset.
3033         (Memory_region::increment_lma_offset): Delete.
3034         (Memory_region::attributes_compatible): New method.  Returns
3035         true if the provided section is compatible with the region.
3036         (Memory_region::get_last_section): New method.  Returns the last
3037         section to use the region.
3038         (Memory_region::set_last_section): New method.  Stores the last
3039         section to use the region.
3040         (Script_sections::block_in_region): New method.  Returns true if
3041         a block of memory is contained within a region.
3042         (Script_sections::find_memory_region): New method.  Locates a
3043         memory region to be used to set a VMA or LMA address.
3044         (Output_section_definition::set_section_addresses): Add code to
3045         check for addresses set by memory regions.
3046         (Output_segment::set_section_addresses): Remove memory region
3047         walking code.
3048         (Script_sections::create_segment): Add a warning if a header
3049         segment is created outside of any region.
3050         * script-sections.h (class Script_sections): Add prototypes for
3051         find_memory_region and block_in_region methods.
3052         * testsuite/memory_test.s: Use .long instead of .word.
3053         * testsuite/memory_test.t: Add some more output sections.
3054         * testsuite/memory_test.sh: Update expected output.
3056 2010-10-02  Doug Kwan  <dougkwan@google.com>
3058         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3059         defintion to symtab.h
3060         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3061         declaration to defintion.
3063 2010-10-01  Nick Clifton  <nickc@redhat.com>
3065         * expression.cc (eval): Replace dummy argument with NULL.
3066         (eval_maybe_dot): Check for a NULL result section pointer.
3067         (Symbol_expression::value): Likewise.
3068         (Dot_expression::value): Likewise.
3069         (BINARY_EXPRESSION): Likewise.
3070         (Max_expression::value): Likewise.
3071         (Min_expression::value): Likewise.
3072         (Absolute_expression::value): Likewise.
3073         (Addr_expression::value_from_output_section): Likewise.
3074         (Loaddddr_expression::value_from_output_section): Likewise.
3075         (Segment_start_expression::value): Likewise.
3076         * script-sections.cc
3077         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3078         argument with NULL.
3079         (Sections_elememt_dot_assignment::set_section_addresses):
3080         Likewise.
3081         (Output_data_expression::do_write_to_buffer): Likewise.
3082         (Output_section_definition::finalize_symbols): Likewise.
3083         (Output_section_definition::set_section_addresses): Likewise.
3085 2010-09-30  Doug Kwan  <dougkwan@google.com>
3087         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3089 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3091         * target.h (Target::can_icf_inline_merge_sections): New virtual
3092         function.
3093         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3094         virtual function.
3095         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3096         virtual function.
3097         * icf.cc (get_section_contents): Inline merge sections only when
3098         target allows it.
3100 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3102         * configure: Regenerate.
3104 2010-09-17  Ian Lance Taylor  <iant@google.com>
3106         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3107         * testsuite/Makefile.am (memory_test.o): New target.
3108         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3109         memory_test.t.
3110         * testsuite/Makefile.in: Rebuild.
3112 2010-09-17  Doug Kwan  <dougkwan@google.com>
3114         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3115         defintion if relocation uses GOT entries of the symbol.
3116         * testsuite/icf_safe_test.sh: Fix test.
3117         * testsuite/icf_safe_so_test.sh: Fix test.
3119 2010-09-16  Cary Coutant  <ccoutant@google.com>
3121         * script_sections.cc (class Memory_region): Remove "NULL" from
3122         vector initializations.
3124 2010-09-15  Cary Coutant  <ccoutant@google.com>
3126         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3127         Resolve forwarding symbols.
3129 2010-09-15  Doug Kwan  <dougkwan@google.com>
3131         * gold/testsuite/script_test_3.t: Add ARM special sections.
3132         * gold/testsuite/script_test_4.t: Same.
3133         * gold/testsuite/script_test_5.t: Same.
3134         * gold/testsuite/script_test_6.t: Same.
3135         * gold/testsuite/script_test_7.t: Same.
3136         * gold/testsuite/script_test_7.t: Same.
3137         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3139 2010-09-14  Cary Coutant  <ccoutant@google.com>
3141         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3142         (Target_x86_64::Relocate::relocate_tls): Replace check for
3143         saw_tls_block_reloc_ with test for executable section.
3145 2010-09-12  Cary Coutant  <ccoutant@google.com>
3147         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3148         position-independent executables to shared libraries need dynamic
3149         relocations.
3150         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3151         position-independent executables.
3152         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3153         * testsuite/Makefile.in: Regenerate.
3155 2010-09-10  Nick Clifton  <nickc@redhat.com>
3157         PR gold/11997
3158         * testsuite/memory_test.t: Discard any sections that are not
3159         needed.
3161 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3163         PR gold/11996
3164         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3165         "This::" to work around a bug in gcc 4.2.
3167         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3169 2010-09-09  Rafael Espindola  <espindola@google.com>
3171         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3172         sections with different PF_X flags in the same segment.
3173         (Layout::find_first_load_seg): Search all segments to find the first
3174         one.
3175         * options.h (rosegment): New.
3177 2010-09-08  Rafael Espindola  <espindola@google.com>
3179         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3181 2010-09-08  Doug Kwan  <dougkwan@google.com>
3183         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3184         (Arm_relobj::do_relocate_sections): Add new parameter for output
3185         file to match the parent.
3186         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3187         of local symbols instead of input values.  Update code to track
3188         changes in gold::relocate_section.
3189         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3190         (Sized_relobj::compute_final_local_value_internal): New methods.
3191         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3192         body into private version of Sized_relobj::compute_final_local_value.
3193         Call the inline method.
3194         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3195         merged symbol value if there is one.
3196         (Symbol_value::has_output_value): New method defintiion.
3197         (Sized_relobj::Compute_final_local_value_status): New enum type.
3198         (Sized_relobj::compute_final_local_value): New methods.
3199         (Sized_relobj::compute_final_local_value_internal): New methods.
3200         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3201         and arm_cortex_a8.sh.
3202         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3203         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3204         New tests.
3205         * Makefile.in: Regenerate.
3206         * testsuite/arm_bl_out_of_range.s: Update test.
3207         * testsuite/thumb_bl_out_of_range.s: Ditto.
3208         * testsuite/thumb_blx_out_of_range.s: Ditto.
3209         * testsuite/arm_branch_out_of_range.sh: New file.
3210         * testsuite/arm_cortex_a8.sh: Ditto.
3211         * testsuite/arm_cortex_a8_b.s: Ditto.
3212         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3213         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3214         * testsuite/arm_cortex_a8_bl.s: Ditto.
3215         * testsuite/arm_cortex_a8_blx.s: Ditto.
3216         * testsuite/arm_cortex_a8_local.s: Ditto.
3217         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3218         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3220 2010-09-08  Rafael Espindola  <espindola@google.com>
3222         * Makefile.am (memory_test.stdout): Run readelf with -W.
3223         * Makefile.in: Regenerate.
3224         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3225         64 bit output.
3227 2010-09-08  Rafael Espindola  <espindola@google.com>
3229         * script-sections.cc (Script_sections::add_memory_region): Convert
3230         field precision to int.
3231         * script.cc (script_set_section_region, script_set_section_region):
3232         Convert field precision to int.
3234 2010-09-08  Rafael Espindola  <espindola@google.com>
3236         * arm.cc (do_finalize_sections): Create the __exidx_start and
3237         __exdix_end symbols even when the section is missing.
3239 2010-09-08  Nick Clifton  <nickc@redhat.com>
3241         * README: Remove claim that MEMORY is not supported.
3242         * expression.cc (script_exp_function_origin)
3243         (script_exp_function_length): Move from here to ...
3244         * script.cc: ... here.
3245         (script_set_section_region, script_add_memory)
3246         (script_parse_memory_attr, script_include_directive): New
3247         functions.
3248         * script-sections.cc
3249         (class Memory_region): New class.
3250         (class Output_section_definition): Add set_memory_region,
3251         set_section_vma, set_section_lma and get_section_name methods.
3252         (class Script_Sections): Add add_memory_region,
3253         find_memory_region, find_memory_region_origin,
3254         find_memory_region_length and set_memory_region methods.
3255         Have set_section_addresses method walk the list of set memory
3256         regions.
3257         Extend the print methos to display memory regions.
3258         * script-sections.h: Add prototypes for new methods.
3259         Add enum for MEMORY region attributes.
3260         * yyscript.y: Add support for parsing MEMORY regions.
3261         * script-c.h: Add prototypes for new functions.
3262         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3263         * testsuite/Makefile.in: Regenerate.
3264         * testsuite/memory_test.sh: New script.
3265         * testsuite/memory_test.s: New assembler source file.
3266         * testsuite/memory_test.t: New linker script.
3268 2010-08-27  Doug Kwan  <dougkwan@google.com>
3270         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3271         reference override an existing dynamic weak reference.
3272         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3273         * testsuite/Makefile.in: Regenerate.
3274         * testsuite/dyn_weak_ref.sh: New file.
3275         * testsuite/dyn_weak_ref_1.c: Ditto.
3276         * testsuite/dyn_weak_ref_2.c: Ditto.
3278 2010-08-27  Ian Lance Taylor  <iant@google.com>
3280         * incremental.h (class Incremental_input_entry): Add virtual
3281         destructor.
3283 2010-08-27  Ian Lance Taylor  <iant@google.com>
3285         * testsuite/start_lib_test_3.c: Mark t3 as used.
3287 2010-08-27  Nick Clifton  <nickc@redhat.com>
3289         * options.cc (version_script): Fix small typo in previous
3290         whitespace tidyup.
3292 2010-08-25  Nick Clifton  <nickc@redhat.com>
3294         * archive.cc: Formatting fixes: Remove whitespace between
3295         typename and following asterisk.  Remove whitespace between
3296         function name and opening parenthesis.
3297         * archive.h: Likewise.
3298         * arm.cc: Likewise.
3299         * attributes.cc: Likewise.
3300         * attributes.h: Likewise.
3301         * common.cc: Likewise.
3302         * copy-relocs.cc: Likewise.
3303         * dirsearch.h: Likewise.
3304         * dynobj.cc: Likewise.
3305         * ehframe.cc: Likewise.
3306         * ehframe.h: Likewise.
3307         * expression.cc: Likewise.
3308         * fileread.cc: Likewise.
3309         * fileread.h: Likewise.
3310         * gc.h: Likewise.
3311         * gold-threads.cc: Likewise.
3312         * gold.cc: Likewise.
3313         * i386.cc: Likewise.
3314         * icf.h: Likewise.
3315         * incremental-dump.cc: Likewise.
3316         * incremental.cc: Likewise.
3317         * layout.cc: Likewise.
3318         * layout.h: Likewise.
3319         * main.cc: Likewise.
3320         * merge.cc: Likewise.
3321         * merge.h: Likewise.
3322         * object.cc: Likewise.
3323         * object.h: Likewise.
3324         * options.cc: Likewise.
3325         * options.h: Likewise.
3326         * output.cc: Likewise.
3327         * output.h: Likewise.
3328         * plugin.cc: Likewise.
3329         * plugin.h: Likewise.
3330         * powerpc.cc: Likewise.
3331         * reloc.cc: Likewise.
3332         * script-c.h: Likewise.
3333         * script-sections.cc: Likewise.
3334         * script.cc: Likewise.
3335         * stringpool.cc: Likewise.
3336         * symtab.cc: Likewise.
3337         * symtab.h: Likewise.
3338         * target.cc: Likewise.
3339         * timer.cc: Likewise.
3340         * timer.h: Likewise.
3341         * version.cc: Likewise.
3342         * x86_64.cc: Likewise.
3344 2010-08-24  Nick Clifton  <nickc@redhat.com>
3346         PR 11899
3347         * layout.cc (segment_precedes): Sort segments by their physical
3348         addresses, if they have been set.
3350 2010-08-23  Cary Coutant  <ccoutant@google.com>
3352         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3353         symbols data.
3354         (Lib_group::include_member): Unlock object after deleting its
3355         symbols data.
3356         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3357         the bug fixed here.
3359 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3360             Cary Coutant  <ccoutant@google.com>
3362         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3363         constructor, and set_blocker.
3364         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3365         readsyms_blocker_.
3366         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3367         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3368         * testsuite/Makefile.am (start_lib_test): New test case.
3369         * testsuite/Makefile.in: Regenerate.
3370         * testsuite/start_lib_test_main.c: New file.
3371         * testsuite/start_lib_test_1.c: New file.
3372         * testsuite/start_lib_test_2.c: New file.
3373         * testsuite/start_lib_test_3.c: New file.
3375 2010-08-19  Ian Lance Taylor  <iant@google.com>
3377         * Makefile.in: Rebuild with automake 1.11.1.
3378         * aclocal.m4: Likewise.
3379         * testsuite/Makefile.in: Likewise.
3381 2010-08-19  Ian Lance Taylor  <iant@google.com>
3383         PR 10893
3384         * i386.cc (class Output_data_plt_i386): Update declarations.
3385         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3386         local_ifuncs_ fields.
3387         (Target_i386::do_plt_section_for_global): New function.
3388         (Target_i386::do_plt_section_for_local): New function.
3389         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3390         parameter; change all callers.  Initialize global_ifuncs_ and
3391         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3392         __rel_iplt_end.
3393         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3394         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3395         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3396         symbols.
3397         (Target_i386::make_plt_section): New function, broken out of
3398         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3399         (Target_i386::make_plt_entry): Call make_plt_section.
3400         (Target_i386::make_local_ifunc_plt_entry): New function.
3401         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3402         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3403         R_386_IRELATIVE to switch.
3404         (Target_i386::Scan::global): Likewise.
3405         (Target_i386::Relocate::relocate): Likewise.
3406         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3407         switch.
3408         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3409         (Target_x86_64::do_plt_section_for_global): New function.
3410         (Target_x86_64::do_plt_section_for_local): New function.
3411         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3412         parameter; change all callers.  If doing a static link define
3413         __rela_iplt_start and __rela_iplt_end.
3414         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3415         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3416         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3417         to point to .plt.
3418         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3419         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3420         switch.
3421         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3422         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3423         R_X86_64_IRELATIVE to switch.
3424         (Target_x86_64::Scan::global): Likewise.
3425         (Target_x86_64::Relocate::relocate): Likewise.
3426         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3427         switch.
3428         * target.h (class Target): Add plt_section_for_global and
3429         plt_section_for_local functions.  Add do_plt_section_for_global
3430         and do_plt_section_for_local virtual functions.
3431         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3432         clarifying comments.
3433         (Symbol::use_plt_offset): Handle IFUNC symbol.
3434         * object.cc (Sized_relobj::Sized_relobj): Initialize
3435         local_plt_offsets_.
3436         (Sized_relobj::local_has_plt_offset): New function.
3437         (Sized_relobj::local_plt_offset): New function.
3438         (Sized_relobj::set_local_plt_offset): New function.
3439         (Sized_relobj::do_count): Handle IFUNC symbol.
3440         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3441         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3442         is_ifunc_symbol functions.
3443         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3444         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3445         local_plt_offsets_ field.
3446         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3447         * output.h (class Output_section_data): Add non-const
3448         output_section function.
3449         (class Output_data_got): Update declarations.
3450         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3451         Add use_plt_offset parameter to global and local constructors.
3452         Change all callers.  Change local_sym_index_ field to 31 bits.
3453         Change GSYM_CODE and CONSTANT_CODE accordingly.
3454         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3455         doing a static link don't set sh_link field.
3456         (Output_data_got::Got_entry::write): Use PLT offset if
3457         appropriate.
3458         (Output_data_got::add_global_plt): New function.
3459         (Output_data_got::add_local_plt): New function.
3460         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3461         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3462         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3463         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3464         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3465         IFUNC conditional.
3466         * testsuite/ifunc-sel.h: New file.
3467         * testsuite/ifuncmain1.c: New file.
3468         * testsuite/ifuncmain1vis.c: New file.
3469         * testsuite/ifuncmod1.c: New file.
3470         * testsuite/ifuncdep2.c: New file.
3471         * testsuite/ifuncmain2.c: New file.
3472         * testsuite/ifuncmain3.c: New file.
3473         * testsuite/ifuncmod3.c: New file.
3474         * testsuite/ifuncmain4.c: New file.
3475         * testsuite/ifuncmain5.c: New file.
3476         * testsuite/ifuncmod5.c: New file.
3477         * testsuite/ifuncmain6pie.c: New file.
3478         * testsuite/ifuncmod6.c: New file.
3479         * testsuite/ifuncmain7.c: New file.
3480         * configure, testsuite/Makefile.in: Rebuild.
3482 2010-08-18  Ian Lance Taylor  <iant@google.com>
3484         * incremental.cc
3485         (Output_section_incremental_inputs::write_input_files): Add cast
3486         to avoid signed/unsigned comparison warning.
3487         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3489 2010-08-12  Cary Coutant  <ccoutant@google.com>
3491         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3493 2010-08-13  Ian Lance Taylor  <iant@google.com>
3495         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3497 2010-08-12  Cary Coutant  <ccoutant@google.com>
3498             Doug Kwan  <dougkwan@google.com>
3500         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3501         defintion overrides non-weak undef, remember that the original undef
3502         is not weak.
3503         * symtab.cc (Symbol_table::sized_write_global): For undef without
3504         an original weak binding, set binding to global in output.
3505         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3506         * testsuite/Makefile.in: Regenerate.
3507         * testsuite/strong_ref_weak_def.sh: New file.
3508         * testsuite/strong_ref_weak_def_1.c: Ditto.
3509         * testsuite/strong_ref_weak_def_2.c: Ditto.
3511 2010-08-12  Cary Coutant  <ccoutant@google.com>
3513         * testsuite/incremental_test.sh: Rewrite.
3514         * testsuite/incremental_test_1.c: Rewrite.
3515         * testsuite/incremental_test_2.c: Rewrite.
3517 2010-08-12  Cary Coutant  <ccoutant@google.com>
3519         * arm.cc (Target_arm::got_size): Add const.
3520         (Target_arm::got_entry_count): New function.
3521         (Target_arm::plt_entry_count): New function.
3522         (Target_arm::first_plt_entry_offset): New function.
3523         (Target_arm::plt_entry_size): New function.
3524         (Output_data_plt_arm::entry_count): New function.
3525         (Output_data_plt_arm::first_plt_entry_offset): New function.
3526         (Output_data_plt_arm::get_plt_entry_size): New function.
3527         * i386.cc (Target_i386::got_size): Add const.
3528         (Target_i386::got_entry_count): New function.
3529         (Target_i386::plt_entry_count): New function.
3530         (Target_i386::first_plt_entry_offset): New function.
3531         (Target_i386::plt_entry_size): New function.
3532         (Output_data_plt_i386::entry_count): New function.
3533         (Output_data_plt_i386::first_plt_entry_offset): New function.
3534         (Output_data_plt_i386::get_plt_entry_size): New function.
3535         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3536         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3537         * incremental.cc: Include target.h.
3538         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3539         parameter.  Adjust all callers.  Find incremental_got_plt section.
3540         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3541         section.
3542         (Output_section_incremental_inputs::set_final_data_size): Calculate
3543         size of incremental_got_plt section.
3544         (Output_section_incremental_inputs::do_write): Write the
3545         incremental_got_plt section.
3546         (Got_plt_view_info): New struct.
3547         (Local_got_offset_visitor): New class.
3548         (Global_got_offset_visitor): New class.
3549         (Global_symbol_visitor_got_plt): New class.
3550         (Output_section_incremental_inputs::write_got_plt): New function.
3551         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3552         Add parameter.  Adjust all callers.
3553         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3554         (Incremental_inputs::got_plt_section): New function.
3555         (Incremental_inputs::got_plt_section_): New data member.
3556         (Incremental_got_plt_reader): New class.
3557         * layout.cc (Layout::create_incremental_info_sections): Add the
3558         incremental_got_plt section.
3559         * object.h (Got_offset_list::get_list): New function.
3560         (Got offset_list::for_all_got_offsets): New function.
3561         (Sized_relobj::local_got_offset_list): New function.
3562         * powerpc.cc (Target_powerpc::got_size): Add const.
3563         (Target_powerpc::got_entry_count): New function.
3564         (Target_powerpc::plt_entry_count): New function.
3565         (Target_powerpc::first_plt_entry_offset): New function.
3566         (Target_powerpc::plt_entry_size): New function.
3567         (Output_data_plt_powerpc::entry_count): New function.
3568         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3569         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3570         * sparc.cc (Target_sparc::got_size): Add const.
3571         (Target_sparc::got_entry_count): New function.
3572         (Target_sparc::plt_entry_count): New function.
3573         (Target_sparc::first_plt_entry_offset): New function.
3574         (Target_sparc::plt_entry_size): New function.
3575         (Output_data_plt_sparc::entry_count): New function.
3576         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3577         (Output_data_plt_sparc::get_plt_entry_size): New function.
3578         * symtab.h (Symbol::got_offset_list): New function.
3579         (Symbol_table::for_all_symbols): New function.
3580         * target.h (Sized_target::got_entry_count): New function.
3581         (Sized_target::plt_entry_count): New function.
3582         (Sized_target::plt_entry_size): New function.
3583         * x86_64.cc (Target_x86_64::got_size): Add const.
3584         (Target_x86_64::got_entry_count): New function.
3585         (Target_x86_64::plt_entry_count): New function.
3586         (Target_x86_64::first_plt_entry_offset): New function.
3587         (Target_x86_64::plt_entry_size): New function.
3588         (Output_data_plt_x86_64::entry_count): New function.
3589         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3590         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3592 2010-08-12  Cary Coutant  <ccoutant@google.com>
3594         * archive.cc: Include incremental.h.
3595         (Archive::Archive): Initialize incremental_info_.
3596         (Archive::include_member): Record archive members in incremental info.
3597         (Add_archive_symbols::run): Record begin and end of an archive in
3598         incremental info.
3599         (Lib_group::include_member): Record objects in incremental info.
3600         * archive.h (Incremental_archive_entry): Forward declaration.
3601         (Archive::set_incremental_info): New member function.
3602         (Archive::incremental_info): New member function.
3603         (Archive::Unused_symbol_iterator): New class.
3604         (Archive::unused_symbols_begin): New member function.
3605         (Archive::unused_symbols_end): New member function.
3606         (Archive::incremental_info_): New data member.
3607         * incremental-dump.cc (find_input_containing_global): New function.
3608         (dump_incremental_inputs): Dump new incremental info sections.
3609         * incremental.cc: Include symtab.h.
3610         (Output_section_incremental_inputs): New class.
3611         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3612         new incremental info sections.
3613         (Sized_incremental_binary::do_check_inputs): Likewise.
3614         (Incremental_inputs::report_archive): Remove.
3615         (Incremental_inputs::report_archive_begin): New function.
3616         (Incremental_inputs::report_archive_end): New function.
3617         (Incremental_inputs::report_object): New function.
3618         (Incremental_inputs::finalize_inputs): Remove.
3619         (Incremental_inputs::report_input_section): New function.
3620         (Incremental_inputs::report_script): Rewrite.
3621         (Incremental_inputs::finalize): Do nothing but finalize string table.
3622         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3623         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3624         (Incremental_inputs::create_data_sections): New function.
3625         (Incremental_inputs::relocs_entsize): New function.
3626         (Output_section_incremental_inputs::set_final_data_size): New function.
3627         (Output_section_incremental_inputs::do_write): New function.
3628         (Output_section_incremental_inputs::write_header): New function.
3629         (Output_section_incremental_inputs::write_input_files): New function.
3630         (Output_section_incremental_inputs::write_info_blocks): New function.
3631         (Output_section_incremental_inputs::write_symtab): New function.
3632         * incremental.h (Incremental_script_entry): Forward declaration.
3633         (Incremental_object_entry): Forward declaration.
3634         (Incremental_archive_entry): Forward declaration.
3635         (Incremental_inputs): Forward declaration.
3636         (Incremental_inputs_header_data): Remove.
3637         (Incremental_inputs_header): Remove.
3638         (Incremental_inputs_header_write): Remove.
3639         (Incremental_inputs_entry_data): Remove.
3640         (Incremental_inputs_entry): Remove.
3641         (Incremental_inputs_entry_write): Remove.
3642         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3643         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3644         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3645         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3646         Likewise.
3647         (Incremental_input_entry): New class.
3648         (Incremental_script_entry): New class.
3649         (Incremental_object_entry): New class.
3650         (Incremental_archive_entry): New class.
3651         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3652         (Incremental_inputs::report_inputs): Remove.
3653         (Incremental_inputs::report_archive): Remove.
3654         (Incremental_inputs::report_archive_begin): New function.
3655         (Incremental_inputs::report_archive_end): New function.
3656         (Incremental_inputs::report_object): Change prototype.
3657         (Incremental_inputs::report_input_section): New function.
3658         (Incremental_inputs::report_script): Change prototype.
3659         (Incremental_inputs::get_reloc_count): New function.
3660         (Incremental_inputs::set_reloc_count): New function.
3661         (Incremental_inputs::create_data_sections): New function.
3662         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3663         (Incremental_inputs::inputs_section): New function.
3664         (Incremental_inputs::symtab_section): New function.
3665         (Incremental_inputs::relocs_section): New function.
3666         (Incremental_inputs::get_stringpool): Add const.
3667         (Incremental_inputs::command_line): Add const.
3668         (Incremental_inputs::inputs): Remove.
3669         (Incremental_inputs::command_line_key): New function.
3670         (Incremental_inputs::input_file_count): New function.
3671         (Incremental_inputs::input_files): New function.
3672         (Incremental_inputs::relocs_entsize): New function.
3673         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3674         (Incremental_inputs::finalize_inputs): Remove.
3675         (Incremental_inputs::Input_info): Remove.
3676         (Incremental_inputs::lock_): Remove.
3677         (Incremental_inputs::inputs_): Change type.
3678         (Incremental_inputs::inputs_map_): Remove.
3679         (Incremental_inputs::current_object_entry_): New data member.
3680         (Incremental_inputs::inputs_section_): New data member.
3681         (Incremental_inputs::symtab_section_): New data member.
3682         (Incremental_inputs::relocs_section_): New data member.
3683         (Incremental_inputs::reloc_count_): New data member.
3684         (Incremental_inputs_reader): New class.
3685         (Incremental_symtab_reader): New class.
3686         (Incremental_relocs_reader): New class.
3687         * layout.cc (Layout::finalize): Move finalization of incremental info
3688         and creation of incremental info sections to follow finalization of
3689         symbol table.  Set offsets for postprocessing sections.
3690         (Layout::create_incremental_info_sections): Call
3691         Incremental_inputs::create_data_sections.  Add incremental symtab
3692         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3693         sections to layout after input sections.
3694         * layout.h (struct Timespec): Forward declaration.
3695         (Layout::incremental_inputs): Add const.
3696         (Layout::create_incremental_info_sections): Add parameter.
3697         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3698         * object.cc: Include incremental.h.
3699         (Relobj::finalize_incremental_relocs): New function.
3700         (Sized_relobj::do_layout): Record input sections in incremental info.
3701         * object.h (Object::output_section): New function.
3702         (Object::output_section_offset): Moved from Relobj.
3703         (Object::get_incremental_reloc_base): New function.
3704         (Object::get_incremental_reloc_count): New function.
3705         (Object::do_output_section): New function.
3706         (Object::do_output_section_offset): Moved from Relobj.
3707         (Object::do_get_incremental_reloc_base): New function.
3708         (Object::do_get_incremental_reloc_count): New function.
3709         (Object::Object): Initialize new data members.
3710         (Relobj::output_section): Renamed do_output_section and moved to
3711         protected.
3712         (Relobj::output_section_offset): Moved to Object.
3713         (Relobj::do_get_incremental_reloc_base): New function.
3714         (Relobj::do_get_incremental_reloc_count): New function.
3715         (Relobj::allocate_incremental_reloc_counts): New function.
3716         (Relobj::count_incremental_reloc): New function.
3717         (Relobj::finalize_incremental_relocs): New function.
3718         (Relobj::next_incremental_reloc_index): New function.
3719         (Relobj::reloc_counts_): New data member.
3720         (Relobj::reloc_bases_): New data member.
3721         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3722         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3723         (Sized_relobj::incremental_relocs_scan): New function.
3724         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3725         (Sized_relobj::incremental_relocs_write): New function.
3726         (Sized_relobj::incremental_relocs_write_reltype): New function.
3727         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3728         incremental link.
3729         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3730         archives and object files elsewhere.
3731         (Add_symbols::run): Report object files here.
3732         (Finish_group::run): Report end of archive at end of group.
3733         * reloc.cc: Include layout.h, incremental.h.
3734         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3735         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3736         (Sized_relobj::incremental_relocs_scan): New function.
3737         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3738         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3739         (Sized_relobj::incremental_relocs_write): New function.
3740         (Sized_relobj::incremental_relocs_write_reltype): New function.
3741         * script.cc (read_input_script): Rewrite test for incremental link.
3742         Change call to Incremental_inputs::report_script.
3743         * symtab.h (Symbol_table::first_global_index): New function.
3744         (Symbol_table::output_count): New function.
3746 2010-08-12  Doug Kwan  <dougkwan@google.com>
3748         * arm.cc (Target_arm::merge_object_attributes): Check command line
3749         options --no-wchar-size-warning and --no-enum-size-warning.
3750         * options.h (General_options): Add ld-compatible options
3751         --no-enum-size-warning and --no-wchar-size-warning.
3753 2010-08-04  Ian Lance Taylor  <iant@google.com>
3755         * x86_64.cc (Target_x86_64::Scan::local): Use
3756         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3757         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3758         (Target_x86_64::Scan::global): Likewise.
3759         (Target_x86_64::Relocate::relocate): Likewise.
3760         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3761         Likewise.
3763 2010-08-03  Cary Coutant  <ccoutant@google.com>
3765         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3766         to reserve space in merged_strings vector. Keep total input size
3767         for stats.
3768         (Output_merge_string::do_print_merge_stats): Print total input size.
3769         * merge.h (Output_merge_string): Add input_size_ field.
3770         * stringpool.cc (Stringpool_template::string_length): Move
3771         implementations out of Stringpool_template class and place in
3772         stringpool.h.
3773         * stringpool.h (string_length): Move out of Stringpool_template.
3775 2010-08-03  Ian Lance Taylor  <iant@google.com>
3777         PR 11712
3778         * layout.cc (relaxation_loop_body): If address of load segment is
3779         set, adjust address to include headers if possible.
3781 2010-08-03  Ian Lance Taylor  <iant@google.com>
3783         * version.cc (version_string): Bump to 1.10.
3785 2010-08-03  Ian Lance Taylor  <iant@google.com>
3787         PR 11805
3788         * layout.h (enum Output_section_order): Define.
3789         (class Layout): Update declarations.
3790         * layout.cc (Layout::get_output_section): Add order parameter.
3791         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3792         is_first_non_relro parameters.  Change all callers.
3793         (Layout::choose_output_section): Likewise.
3794         (Layout::add_output_section_data): Likewise.
3795         (Layout::make_output_section): Likewise.  Set order.
3796         (Layout::default_section_order): New function.
3797         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3798         * output.cc (Output_section::Output_section): Initialize order_.
3799         Don't initialize deleted fields.
3800         (Output_segment::Output_segment): Don't initialize deleted
3801         fields.
3802         (Output_segment::add_output_section_to_load): New function
3803         replacing add_output_section.  Change all callers to call this or
3804         add_output_section_to_nonload.
3805         (Output_segment::add_output_section_to_nonload): New function.
3806         (Output_segment::remove_output_section): Rewrite.
3807         (Output_segment::add_initial_output_data): Likewise.
3808         (Output_segment::has_any_data_sections): Likewise.
3809         (Output_segment::is_first_section_relro): Likewise.
3810         (Output_segment::maximum_alignment): Likewise.
3811         (Output_segment::has_dynamic_reloc): New function replacing
3812         dynamic_reloc_count.  Change all callers.
3813         (Output_segment::has_dynamic_reloc_list): New function replacing
3814         dynamic_reloc_count_list.  Change all callers.
3815         (Output_segment::set_section_addresses): Rewrite.
3816         (Output_segment::set_offset): Rewrite.
3817         (Output_segment::find_first_and_last_list): Remove.
3818         (Output_segment::set_tls_offsets): Rewrite.
3819         (Output_segment::first_section_load_address): Likewise.
3820         (Output_segment::output_section_count): Likewise.
3821         (Output_segment::section_with_lowest_load_address): Likewise.
3822         (Output_segment::write_section_headers): Likewise.
3823         (Output_segment::print_sections_to_map): Likewise.
3824         * output.h (class Output_data): Remove dynamic_reloc_count_
3825         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3826         (Output_data::add_dynamic_reloc): Rewrite.
3827         (Output_data::has_dynamic_reloc): New function.
3828         (Output_data::dynamic_reloc_count): Remove.
3829         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3830         is_last_relro_, is_first_non_relro_, is_interp_,
3831         is_dynamic_linker_section_ fields.  Add order and set_order
3832         functions.  Remove is_relro_local, set_is_relro_local,
3833         is_last_relro, set_is_last_relro, is_first_non_relro,
3834         set_is_first_non_relro functions, is_interp, set_is_interp,
3835         is_dynamic_linker_section, and set_is_dynamic_linker_section
3836         functions.
3837         (class Output_segment): Change Output_data_list from std::list to
3838         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3839         output_bss_ fields.  Update declarations.
3841 2010-08-02  Ian Lance Taylor  <iant@google.com>
3843         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3844         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3845         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3847 2010-08-02  Ian Lance Taylor  <iant@google.com>
3849         PR 11855
3850         * script.cc (Script_options::Script_options): Initialize
3851         symbol_definitions_ and symbol_references_.
3852         (Script_options::add_symbol_assignment): Update
3853         symbol_definitions_ and symbol_references_.
3854         (Script_options::add_symbol_reference): New function.
3855         (script_symbol): New function.
3856         * script.h (class Script_options): Add symbol_definitions_ and
3857         symbol_references_ fields.
3858         (Script_options::referenced_const_iterator): New type.
3859         (Script_options::referenced_begin): New function.
3860         (Script_options::referenced_end): New function.
3861         (Script_options::is_referenced): New function.
3862         (Script_options::any_unreferenced): New function.
3863         * script-c.h (script_symbol): Declare.
3864         * yyscript.y (exp): Call script_symbol.
3865         * symtab.cc: Include "script.h".
3866         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3867         Change all callers.  Check symbols referenced by scripts.
3868         (Symbol_table::add_undefined_symbols_from_command_line): Add
3869         layout parameter.  Change all callers.
3870         (Symbol_table::do_add_undefined_symbols_from_command_line):
3871         Likewise.  Break out loop body.  Check symbols referenced by
3872         scripts.
3873         (Symbol_table::add_undefined_symbol_from_command_line): New
3874         function broken out of
3875         do_add_undefined_symbols_from_command_line.
3876         * symtab.h (class Symbol_table): Update declarations.
3877         * archive.cc: Include "layout.h".
3878         (Archive::should_include_member): Add layout parameter.  Change
3879         all callers.  Check for symbol mentioned in expression.
3880         * archive.h (class Archive): Update declaration.
3881         * object.cc (Sized_relobj::do_should_include_member): Add layout
3882         parameter.
3883         * object.h (Object::should_include_member): Add layout parameter.
3884         Change all callers.
3885         (Object::do_should_include_member): Add layout parameter.
3886         (class Sized_relobj): Update declaration.
3887         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3888         parameter.
3889         * dynobj.h (class Sized_dynobj): Update declaration.
3890         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3891         layout parameter.
3892         * plugin.h (class Sized_pluginobj): Update declaration.
3894 2010-08-02  Ian Lance Taylor  <iant@google.com>
3896         PR 11866
3897         * output.cc (Output_segment::set_offset): Search for the first and
3898         last sections rather than assuming that the list is in order.
3899         (Output_segment::find_first_and_last_list): New function.
3900         * output.h (class Output_segment): Update declarations.
3901         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3902         (relro_strip_test_SOURCES): New variable.
3903         (relro_strip_test_DEPENDENCIES): New variable.
3904         (relro_strip_test_LDFLAGS): New variable.
3905         (relro_strip_test_LDADD): New variable.
3906         (relro_strip_test.so): New target.
3908 2010-08-02  Ian Lance Taylor  <iant@google.com>
3910         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3911         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3912         (Target_i386::got_tlsdesc_section): New function.
3913         (Target_i386::got_section): Create space for GOT entries for
3914         TLSDESC relocations.
3915         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3916         R_386_TLS_GOTDESC.
3917         (Target_i386::Scan::global): Likewise.
3918         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3919         using TLSDESC GOT.
3920         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3921         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3922         (Target_x86_64::got_tlsdesc_section): New function.
3923         (Target_x86_64::got_section): Create space for GOT entries for
3924         TLSDESC relocations.
3925         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3926         R_386_TLS_GOTDESC.
3927         (Target_x86_64::Scan::global): Likewise.
3928         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3929         using TLSDESC GOT.
3931 2010-08-02  Ian Lance Taylor  <iant@google.com>
3933         * testsuite/final_layout.sh: Use dc to convert from hex to
3934         decimal.
3936 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3938         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3939         paramter to the call to gold::gc_process_relocs.
3940         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3941         paramter to the call to gold::gc_process_relocs.
3942         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3943         parameter to the call to gold::gc_process_relocs.
3944         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3945         template parameter to the call to gold::gc_process_relocs.
3946         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3947         paramter to the call to gold::gc_process_relocs.
3948         * gc.h (get_embedded_addend_size): New function.
3949         (gc_process_relocs): Save the size of the reloc for use by ICF.
3950         * icf.cc (get_section_contents): Get the addend from the text section
3951         for SHT_REL relocation sections.
3952         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3953         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3954         * int_encoding.h (read_from_pointer): New overloaded function.
3955         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3956         * testsuite/icf_sht_rel_addend_test.sh: New file.
3957         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3958         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3960 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3962         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3963         * Makefile.in: Regenerate.
3964         * testsuite/Makefile.in: Regenerate.
3966 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3968         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3969         * gold/testsuite/debug_msg.cc: Likewise.
3970         * gold/testsuite/odr_violation1.cc
3971         * gold/testsuite/odr_violation2.cc
3973 2010-07-21  Cary Coutant  <ccoutant@google.com>
3975         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3976         string, and length fields.
3977         (Output_merge_string::Merged_strings_list): New type.
3978         (Output_merge_string::Merged_strings_lists): New typedef.
3979         (Output_merge_string): Replace merged_strings_ with
3980         merged_strings_lists_.
3981         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3982         Merged_strings_list per input object and section.  Don't store pointer
3983         to the string.  Don't store length with each merged string entry.
3984         (Output_merge_string::finalize_merged_data): Loop over list of merged
3985         strings lists.  Recompute length of each merged string.
3987 2010-07-15  Cary Coutant  <ccoutant@google.com>
3989         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3990         here.
3992 2010-07-14  Ian Lance Taylor  <iant@google.com>
3994         * descriptors.cc (Descriptors::open): Report correct name in error
3995         message.
3997 2010-07-13  Doug Kwan  <dougkwan@google.com>
3999         * arm.cc (Arm_input_section::Arm_input_section): For a
4000         SHT_ARM_EXIDX section, always keeps the input sections.
4001         (Arm_input_section::set_exidx_section_link): New method.
4002         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4003         has_errors_ to false.
4004         (Arm_exidx_input_section::has_errors,
4005         Arm_exidx_input_section::set_has_errors): New methods.
4006         (Arm_exidx_input_section::has_errors_): New data member.
4007         (Arm_relobj::get_exidx_shndx_list): New method.
4008         (Arm_output_section::append_text_sections_to_list): Do not skip
4009         section without SHF_EXECINSTR.
4010         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4011         errors.
4012         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4013         section header.  Make error messages more verbose.  Check for
4014         a non-executable section linked to an EXIDX section.
4015         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4016         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4017         check that there is no deferred EXIDX section if we exit early.
4018         Instead of not making an EXIDX section in case of an error, make one
4019         and set the has_errors flag of it.
4020         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4021         in a relocatable link.
4022         (Target_arm::do_relax): Look for the EXIDX output section instead of
4023         assuming that it is called .ARM.exidx.
4024         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4025         section list.  Do not check for SHF_EXECINSTR section flags but
4026         skip any input section with errors.
4027         * output.cc (Output_section::Output_section): Initialize
4028         always_keeps_input_sections_ to false.
4029         (Output_section::add_input_section): Check for
4030         always_keeps_input_sections_.
4031         *  output.h (Output_section::always_keeps_input_sections,
4032         Output_section::set_always_keeps_input_sections): New methods.
4033         (Output_section::always_keeps_input_sections): New data member.
4035 2010-07-13  Rafael Espindola  <espindola@google.com>
4037         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4038         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4040 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4041             Ian Lance Taylor  <iant@google.com>
4043         * output.h (Output_section_lookup_maps::add_merge_section):
4044         Correct check of whether value was inserted.
4045         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4046         (Output_section_lookup_maps::add_relaxed_input_section):
4047         Likewise.
4048         * arm.cc (Target_arm::got_section): Remove used local os.
4049         * i386.cc (Target_i386::got_section): Likewise.
4050         * x86_64.cc (Target_x86_64::got_section): Likewise.
4051         * sparc.cc (Target_sparc::got_section): Likewise.
4052         (Target_sparc::relocate): Remove unused local have_got_offset.
4053         * powerpc.cc (Target_powerpc::relocate): Likewise.
4055 2010-07-13  Ian Lance Taylor  <iant@google.com>
4057         * compressed_output.cc (zlib_decompress): Fix signature in
4058         !HAVE_ZLIB_H case.
4060         * archive.cc (Archive::include_member): Unlock an external member
4061         of a thin archive.  Don't bother to delete an object we know is
4062         NULL.
4064 2010-07-12  Cary Coutant  <ccoutant@google.com>
4066         * compressed_output.cc (zlib_decompress): New function.
4067         (get_uncompressed_size): New function.
4068         (decompress_input_section): New function.
4069         * compressed_output.h (get_uncompressed_size): New function.
4070         (decompress_input_section): New function.
4071         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4072         Handle compressed debug sections.
4073         * layout.cc (is_compressed_debug_section): New function.
4074         (Layout::output_section_name): Map compressed section names to
4075         canonical names.
4076         * layout.h (is_compressed_debug_section): New function.
4077         (is_debug_info_section): Recognize compressed debug sections.
4078         * merge.cc: Include compressed_output.h.
4079         (Output_merge_data::do_add_input_section): Handle compressed
4080         debug sections.
4081         (Output_merge_string::do_add_input_section): Handle compressed
4082         debug sections.
4083         * object.cc: Include compressed_output.h.
4084         (Sized_relobj::Sized_relobj): Initialize new data members.
4085         (build_compressed_section_map): New function.
4086         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4087         * object.h (Object::section_is_compressed): New method.
4088         (Object::do_section_is_compressed): New method.
4089         (Sized_relobj::Compressed_section_map): New type.
4090         (Sized_relobj::do_section_is_compressed): New method.
4091         (Sized_relobj::compressed_sections_): New data member.
4092         * output.cc (Output_section::add_input_section): Handle compressed
4093         debug sections.
4094         * reloc.cc: Include compressed_output.h.
4095         (Sized_relobj::write_sections): Handle compressed debug sections.
4097 2010-07-08  Cary Coutant  <ccoutant@google.com>
4099         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4100         weak when resolving to a dynamic def.
4101         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4102         for weak undef/dynamic def cases. Adjust callers.
4103         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4104         undef_binding_weak_.
4105         (Symbol_table::sized_write_globals): Adjust symbol binding.
4106         (Symbol_table::sized_write_symbol): Add binding parameter.
4107         * symtab.h (Symbol::set_undef_binding): New method.
4108         (Symbol::is_undef_binding_weak): New method.
4109         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4110         (Symbol_table::should_override): Add new parameter.
4111         (Symbol_table::sized_write_symbol): Add new parameter.
4113         * testsuite/weak_undef_file1.cc: Add new test case.
4114         * testsuite/weak_undef_file2.cc: Fix header comment.
4115         * testsuite/weak_undef_test.cc: Add new test case.
4117 2010-06-29  Doug Kwan  <dougkwan@google.com>
4119         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4120         Initialize USE_SYMBOL_.
4121         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4122         definition.
4123         (Arm_reloc_property::uses_symbol_): New data member declaration.
4124         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4125         uses symbol value and symbol is undefined but not weakly undefined.
4127 2010-06-28  Rafael Espindola  <espindola@google.com>
4129         * plugin.cc (Plugin::load): Use dlerror.
4131 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4133         * symtab.cc (detect_odr_violations): When reporting an ODR
4134         violation, report an object where the symbol is defined.
4136 2010-06-25  Doug Kwan  <dougkwan@google.com>
4138         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4139         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4140         definition.
4141         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4142         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4143         target hook to detect function points.
4144         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4145         * icf.h (Icf::check_section_for_function_pointers): Change type of
4146         parameter SECTION_NAME to const reference to std::string.  Use
4147         target hook to determine if section may have unsafe pointers.
4148         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4149         method definition.
4151 2010-06-21  Rafael Espindola  <espindola@google.com>
4153         * fileread.cc (Input_file::find_fie): New
4154         (Input_file::open): Use Input_file::find_fie.
4155         * fileread.h (Input_file::find_fie): New
4156         * plugin.cc (set_extra_library_path): New.
4157         (Plugin::load): Add set_extra_library_path to the transfer vector.
4158         (Plugin_manager::set_extra_library_path): New.
4159         (Plugin_manager::add_input_file): Use the extra search path if set.
4160         (set_extra_library_path(): New.
4161         * plugin.h (Plugin_manager): Add set_extra_library_path and
4162         extra_search_path_.
4164 2010-06-19  Cary Coutant  <ccoutant@google.com>
4166         * layout.cc (gdb_sections): Add .debug_types.
4167         (lines_only_debug_sections): Likewise.
4169 2010-06-18  Rafael Espindola  <espindola@google.com>
4171         * plugin.cc (add_input_file,add_input_library)
4172         (Plugin_manager::add_input_file): Make filename arguments const.
4173         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4174         const.
4176 2010-06-16  Doug Kwan  <dougkwan@google.com>
4178         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4179         .ARM.attributes section if we have not merged any input
4180         attributes sections.
4182 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4184         * arm.cc: Allow combining objects with no EABI version
4185         information.
4187 2010-06-15  Rafael Espindola  <espindola@google.com>
4189         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4191 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4193         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4194         (struct iovec): Correct !HAVE_READV definition.
4196 2010-06-10  Cary Coutant  <ccoutant@google.com>
4198         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4199         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4200         reloc sections.
4201         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4203         PR 11683
4204         * symtab.h (Symbol::is_placeholder): New member function.
4205         * target-reloc.h (relocate_section): Check for placeholder symbols.
4207         * testsuite/Makefile.am (plugin_test_8): New test.
4208         (plugin_test_9): New test.
4209         * testsuite/Makefile.in: Regenerate.
4211 2010-06-09  Nick Clifton  <nickc@redhat.com>
4213         * yyscript.y (input_list_element): Allow strings prefixed with
4214         the '-' character.  Treat these as libraries.
4215         * script.cc (script_add_library): New function.  Adds a library
4216         specified by "-l<name>" found in an input script.
4217         * script-c.h: Add prototype for script_add_library.
4219 2010-06-07  Doug Kwan  <dougkwan@google.com>
4221         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4222         Restrict stub-group size to be within long conditional branch
4223         range when working around cortex-A8 erratum.
4225 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4227         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4228         #ifdef typo.
4230 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4232         PR gold/11658
4233         * output.cc
4234         (Output_section::Input_section_sort_entry::compare_section_ordering):
4235         Change to return non-zero correctly.
4236         (Output_section::Input_section_sort_section_order_index_compare
4237         ::operator()): Change to fix ambiguity in comparisons.
4239 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4241         * gold.h (is_wildcard_string): New function.
4242         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4243         (Layout::layout_eh_frame): Ditto.
4244         (Layout::find_section_order_index): New method.
4245         (Layout::read_layout_from_file): New method.
4246         * layout.h (Layout::find_section_order_index): New method.
4247         (Layout::read_layout_from_file): New method.
4248         (Layout::input_section_position_): New private member.
4249         (Layout::input_section_glob_): New private member.
4250         * main.cc (main): Call read_layout_from_file here.
4251         * options.h (--section-ordering-file): New option.
4252         * output.cc (Output_section::input_section_order_specified_): New
4253         member.
4254         (Output_section::Output_section): Initialize new member.
4255         (Output_section::add_input_section): Add new parameter.
4256         Keep input sections when --section-ordering-file is used.
4257         (Output_section::set_final_data_size): Sort input sections when
4258         section ordering file is specified.
4259         (Output_section::Input_section_sort_entry): Add new parameter.
4260         Check sorting type.
4261         (Output_section::Input_section_sort_entry::compare_section_ordering):
4262         New method.
4263         (Output_section::Input_section_sort_compare::operator()): Change to
4264         consider section_order_index.
4265         (Output_section::Input_section_sort_init_fini_compare::operator()):
4266         Change to consider section_order_index.
4267         (Output_section::Input_section_sort_section_order_index_compare
4268         ::operator()): New method.
4269         (Output_section::sort_attached_input_sections): Change to sort
4270         according to section order when specified.
4271         (Output_section::add_input_section<32, true>): Add new parameter.
4272         (Output_section::add_input_section<64, true>): Add new parameter.
4273         (Output_section::add_input_section<32, false>): Add new parameter.
4274         (Output_section::add_input_section<64, false>): Add new parameter.
4275         * output.h (Output_section::add_input_section): Add new parameter.
4276         (Output_section::input_section_order_specified): New
4277         method.
4278         (Output_section::set_input_section_order_specified): New method.
4279         (Input_section::Input_section): Initialize section_order_index_.
4280         (Input_section::section_order_index): New method.
4281         (Input_section::set_section_order_index): New method.
4282         (Input_section::section_order_index_): New member.
4283         (Input_section::Input_section_sort_section_order_index_compare): New
4284         struct.
4285         (Output_section::input_section_order_specified_): New member.
4286         * script-sections.cc (is_wildcard_string): Delete and move modified
4287         method to gold.h.
4288         (Output_section_element_input::Output_section_element_input): Modify
4289         call to is_wildcard_string.
4290         (Output_section_element_input::Input_section_pattern
4291         ::Input_section_pattern): Ditto.
4292         (Output_section_element_input::Output_section_element_input): Ditto.
4293         * testsuite/Makefile.am (final_layout): New test case.
4294         * testsuite/Makefile.in: Regenerate.
4295         * testsuite/final_layout.cc: New file.
4296         * testsuite/final_layout.sh: New file.
4298 2010-06-01  Rafael Espindola  <espindola@google.com>
4300         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4302 2010-06-01  Rafael Espindola  <espindola@google.com>
4304         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4305         visibility of symbols.
4307 2010-05-27  Doug Kwan  <dougkwan@google.com>
4309         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4310         from start of output section instead of address for a local symbol
4311         in a merged or relaxed section when doing a relocatable link.
4313 2010-05-26  Rafael Espindola  <espindola@google.com>
4315        PR 11604
4316         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4317         adding sections the garbage collector removed.
4318         * gold/testsuite/Makefile.am: Add test.
4319         * gold/testsuite/Makefile.in: Regenerate.
4320         * gold/testsuite/plugin_test_7.sh: New.
4321         * gold/testsuite/plugin_test_7_1.c: New.
4322         * gold/testsuite/plugin_test_7_2.c: New.
4324 2010-05-26  Rafael Espindola  <espindola@google.com>
4326         * script-sections.cc (Output_section_definition::set_section_addresses):
4327         Check for --section-start.
4329 2010-05-26  Doug Kwan  <dougkwan@google.com>
4331         * arm.cc (Arm_scan_relocatable_relocs): New class.
4332         (Target_arm::relocate_special_relocatable): New method.
4333         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4334         (Arm_relocate_functions::thumb_branch_common): Same.
4335         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4336         instead of Default_scan_relocatable_relocs.
4337         * target-reloc.h (relocate_for_relocatable): Let target handle
4338         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4339         * target.h (Sized_target::relocate_special_relocatable): New method.
4341 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4343         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4345 2010-05-23  Doug Kwan  <dougkwan@google.com>
4347         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4348         instead of a cast.
4349         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4350         with a direct branch, not a conditional branch, to a stub.
4351         * merge.cc (Output_merge_base::record_input_section): New method
4352         defintion.
4353         (Output_merge_data::do_add_input_section): Record input section if
4354         keeps-input-sections flag is set.
4355         (Output_merge_string::do_add_input_section): Ditto.
4356         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4357         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4358         INPUT_SECTIONS_.
4359         (Output_merge_base::keeps_input_sections,
4360         Output_merge_base::set_keeps_input_sections,
4361         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4362         method definitions.
4363         (Output_merge_base::Input_sections): New type declaration.
4364         (Output_merge_base::input_sections_begin,
4365         Output_merge_base::input_sections_end,
4366         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4367         (Output_merge_base::bool keeps_input_sections_,
4368         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4369         Output_merge_base::input_sections_): New data members.
4370         (Output_merge_data::do_set_keeps_input_sections): New method
4371         defintion.
4372         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4373         * output.cc (Output_section::Input_section::relobj): Move method
4374         defintion from class declaration to here and handle merge sections.
4375         (Output_section::Input_section::shndx): Ditto.
4376         (Output_section::Output_section): Remove initializations of removed
4377         data members and initialize new data member LOOKUP_MAPS_.
4378         (Output_section::add_input_section): Set keeps-input-sections flag
4379         for a newly created merge output section as appropriate.  Adjust code
4380         to use Output_section_lookup_maps class.
4381         (Output_section::add_relaxed_input_section): Adjst code for lookup
4382         maps code refactoring.
4383         (Output_section::add_merge_input_section): Add a new parameter
4384         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4385         class.  If adding input section to a newly created merge output
4386         section fails, remove the new merge section.
4387         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4388         Adjust code for use of the Output_section_lookup_maps class.
4389         (Output_section::find_merge_section): Ditto.
4390         (Output_section::build_lookup_maps): New method defintion.
4391         (Output_section::find_relaxed_input_section): Adjust code to use
4392         Output_section_lookup_maps class.
4393         (Output_section::get_input_sections): Export merge sections.  Adjust
4394         code to use Output_section_lookup_maps class.
4395         (Output_section:::add_script_input_section): Adjust code to use
4396         Output_section_lookup_maps class.  Update lookup maps for merge
4397         sections also.
4398         (Output_section::discard_states): Use Output_section_lookup_maps.
4399         (Output_section::restore_states): Same.
4400         * output.h (Merge_section_properties): Move class defintion out of
4401         Output_section.
4402         (Output_section_lookup_maps): New class.
4403         (Output_section::Input_section::is_merge_section): New method
4404         defintion.
4405         (Output_section::Input_section::relobj): Move defintion out of class
4406         defintion.  Declare method only.
4407         (Output_section::Input_section::shndx): Ditto.
4408         (Output_section::Input_section::output_merge_base): New method defintion.
4409         (Output_section::Input_section::u2_.pomb): New union field.
4410         (Output_section::Merge_section_by_properties_map,
4411         Output_section::Output_section_data_by_input_section_map,
4412         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4413         Remove types.
4414         (Output_section::add_merge_input_section): Add new parameter
4415         KEEPS_INPUT_SECTIONS.
4416         (Output_section::build_lookup_maps): New method declaration.
4417         (Output_section::merge_section_map_,
4418         Output_section::merge_section_by_properties_map_,
4419         Output_section::relaxed_input_section_map_,
4420         Output_section::is_relaxed_input_section_map_valid_): Remove data
4421         members.
4422         (Output_section::lookup_maps_): New data member.
4424 2010-05-21  Doug Kwan  <dougkwan@google.com>
4426         PR gold/11619
4427         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4428         avoid a compilation error.
4430 2010-05-19  Rafael Espindola  <espindola@google.com>
4432         * script-sections.cc (Output_section_definition::allocate_to_segment):
4433         Update the phdrs_list even when the output section is NULL.
4434         * testsuite/Makefile.am: Add test.
4435         * testsuite/Makefile.in: Regenerate.
4436         * testsuite/script_test_9.cc: New.
4437         * testsuite/script_test_9.sh: New.
4438         * testsuite/script_test_9.t: New.
4440 2010-05-19  Doug Kwan  <dougkwan@google.com>
4442         * arm.cc (Arm_input_section::original_size): New method.
4443         (Arm_input_section::do_addralign): Add a cast.
4444         (Arm_input_section::do_output_offset): Remove static cast.
4445         (Arm_input_section::original_addralign,
4446          Arm_input_section::original_size_): Change type to uint32_t.
4447         (Arm_input_section::init): Add safe casts for section alignment
4448         and size.
4449         (Arm_input_section::set_final_data_size): Do not set address and
4450         offset of stub table.
4451         (Arm_output_section::fix_exidx_coverage): Change use of of
4452         Output_section::Simple_input_section to that of
4453         Output_section::Input_section.
4454         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4455         except for the first pass.
4456         * output.cc (Output_section::get_input_sections): Change type of
4457         input_sections to std::list<Input_section>.
4458         (Output_section::add_script_input_section): Rename from
4459         Output_section::add_simple_input_section.  Change type of SIS
4460         parameter from Simple_input_section to Input_section.
4461         * output.h (Output_section::Simple_input_section): Remove class.
4462         (Output_section::Input_section): Change class visibility to public.
4463         (Output_section::Input_section::addralign): Use stored alignments
4464         for special input sections if set.
4465         (Output_section::Input_section::set_addralign): New method.
4466         (Output_section::get_input_sections): Change parameter type from
4467         list of Simple_input_section to list of Input_section.
4468         (Output_section::add_script_input_section): Rename from
4469         Output_section::add_simple_input_section. Change first parameter's
4470         type from Simple_input_section to Input_section and remove the
4471         second and third parameters.
4472         * script-sections.cc (Input_section::Input_section_list): Change
4473         type to list of Output_section::Input_section/
4474         (Input_section_info::Input_section_info): Change parameter type of
4475         INPUT_SECTION to Output_section::Input_section.
4476         (Input_section_info::input_section): Change return type.
4477         (Input_section_info::input_section_): Change type to
4478         Output_section::Input_section.
4479         (Output_section_element_input::set_section_addresses): Adjust code
4480         to use Output_section::Input_section instead of
4481         Output_section::Simple_input_section.  Adjust code for renaming
4482         of Output_section::add_simple_input_section.
4483         (Orphan_output_section::set_section_addresses): Ditto.
4485 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4487         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4488         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4490 2010-05-18  Rafael Espindola  <espindola@google.com>
4492         * options.cc (General_options::finalize): Handle -nostdlib.
4493         * options.h (nostdlib): New option.
4494         * script.cc (script_add_search_dir): Handle -nostdlib.
4496 2010-05-12  Doug Kwan  <dougkwan@google.com>
4498         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4499         attributes section only if there no attributes section after merging.
4500         (Target_arm::merge_object_attributes): Move value of
4501         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4502         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4503         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4504         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4505         and arm_attr_merge_7.stdout.
4506         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4507         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4508         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4509         arm_attr_merge_7b.o): New rules.
4510         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4511         arm_attr_merge_7
4512         * testsuite/Makefile.in: Regenerate.
4513         * testsuite/arm_attr_merge.sh: New file.
4514         * testsuite/arm_attr_merge_[67][ab].s: Same.
4516 2010-05-05  Nick Clifton  <nickc@redhat.com>
4518         * po/es.po: Updated Spanish translation.
4520 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4522         * Makefile.am (install-exec-local): Properly install gold as
4523         default cross linker.
4524         * Makefile.in: Regenerated.
4526 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4527             Nick Clifton  <nickc@redhat.com>
4529         * configure.ac (install_as_default): Define and set to false
4530         unless --enable-gold or --enable-gold=both/gold has been
4531         specified.
4532         * configure: Regenerate.
4534         * Makefile.am (install-exec-local): Install the executable as
4535         'ld.gold'.  If install_as_default is true then also install it as
4536         'ld'.
4537         * Makefile.in: Regenerated.
4539 2010-04-24  Ian Lance Taylor  <iant@google.com>
4541         * layout.cc (Layout::layout_reloc): In relocatable link don't
4542         combine reloc sections for grouped sections.
4544 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4546         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4547         sections that are not ordinary to icf.
4548         * icf.cc (get_section_contents): Handle relocation pointing to section
4549         with no object or shndx information.
4550         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4551         * testsuite/Makefile.in: Regenerate.
4552         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4553         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4555 2010-04-22  Ian Lance Taylor  <iant@google.com>
4557         * expression.cc (Expression::Expression_eval_info): Add
4558         result_alignment_pointer field.
4559         (Expression::eval_with_dot): Add result_alignment_pointer
4560         parameter.  Change all callers.
4561         (Expression::eval_maybe_dot): Likewise.
4562         (class Binary_expression): Add alignment_pointer parameter to
4563         left_value and right_value.  Change all callers.
4564         (BINARY_EXPRESSION): Set result alignment.
4565         (class Trinary_expression): Add alignment_pointer parameter to
4566         arg2_value and arg3_value.  Change all callers.
4567         (Trinary_cond::value): Set result alignment.
4568         (Max_expression::value, Min_expression::value): Likewise.
4569         (Align_expression::value): Likewise.
4570         * script-sections.cc (class Sections_element): Add dot_alignment
4571         parameter to set_section_addresses virtual function.  Update
4572         instantiations.
4573         (class Output_section_element): Likewise.
4574         (Script_sections::create_segments): Add dot_alignment parameter.
4575         Change all callers.
4576         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4577         (Script_sections::set_phdrs_clause_addresses): Likewise.
4578         * script-sections.h: Update declarations.
4579         * script.h: Update declarations.
4580         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4581         min_p_align.
4582         * testsuite/script_test_3.t: Set large alignment.
4583         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4584         segment has expected alignment.
4586 2010-04-22  Nick Clifton  <nickc@redhat.com>
4588         * po/gold.pot: Updated by the Translation project.
4589         * po/vi.po: Updated Vietnamese translation.
4591 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4593         * testsuite/Makefile.am (check_PROGRAMS): Add
4594         icf_virtual_function_folding_test.
4595         * testsuite/Makefile.in: Regenerated.
4597 2010-04-15  Andrew Haley  <aph@redhat.com>
4599         * options.h (merge_exidx_entries): New option.
4600         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4601         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4602         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4603         (Target_arm::merge_exidx_entries): New function.
4604         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4605         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4606         to Arm_exidx_fixup constructor.
4607         Add new arg, merge_exidx_entries.
4608         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4609         Arm_output_section::fix_exidx_coverage.
4611 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4613         * icf.cc (get_section_contents): Check for preemptible functions.
4614         Ignore addend when appropriate.
4615         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4616         section folded.
4617         (add_from_relobj): Check for section folded.
4618         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4619         * symtab.h (should_add_dynsym_entry): Add new parameter.
4620         * target-reloc.h (scan_relocs): Check for section folded.
4621         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4622         Check reloc types for function pointers in shared objects.
4623         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4624         case.
4625         (icf_preemptible_functions_test): New test case.
4626         (icf_string_merge_test): New test case.
4627         * testsuite.Makefile.in: Regenerate.
4628         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4629         bar_glob.  Refactor code.
4630         * testsuite/icf_preemptible_functions_test.cc: New file.
4631         * testsuite/icf_preemptible_functions_test.sh: New file.
4632         * testsuite/icf_string_merge_test.cc: New file.
4633         * testsuite/icf_string_merge_test.sh: New file.
4634         * testsuite/icf_virtual_function_folding_test.cc: New file.
4635         * testsuite/icf_virtual_function_folding_test.sh: New file.
4637 2010-04-14  Doug Kwan  <dougkwan@google.com>
4639         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4640         for local symbol recounting if we remove a section due to ICF.
4641         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4642         there are no regular objects in input.
4644 2010-04-13  Doug Kwan  <dougkwan@google.com>
4646         * arm.cc (Arm_input_section::set_final_data_size): Compute
4647         accurate final data size instead of using current data size.
4649 2010-04-09  Doug Kwan  <dougkwan@google.com>
4651         * layout.cc (Layout::choose_output_section): Handle script section
4652         types.
4653         (Layout::make_output_section_for_script): Add section type parameter.
4654         Handle script section types.
4655         * layout.h (Layout::make_output_section_for_script): Add section
4656         type parameter.
4657         * output.cc (Output_section::Output_section): Initialize data member
4658         is_noload_.
4659         (Output_section::do_reset_address_and_file_offset): Do not set address
4660         to 0 if section is a NOLOAD section.
4661         * output.h (Output_section::is_noload): New method.
4662         (Output_section::set_is_noload): Ditto.
4663         (Output_section::is_noload_): New data member.
4664         * script-c.h (Script_section_type): New enum type.
4665         (struct Parser_output_section_header): Add new file section_type.
4666         * script-sections.cc (Sections_element::output_section_name): Add
4667         parameter for returning script section type.
4668         (Output_section_definition::output_section_name): Ditto.
4669         (Output_section_definition::section_type)P; New method.
4670         (Output_section_definiton::script_section_type_name): Ditto.
4671         (Output_section_definition::script_section_type_): New data member.
4672         (Output_section_definition::Output_section_definition): Initialize
4673         data member Output_section_definition::script_section_type_.
4674         (Output_section_definition::create_sections): Pass script section type
4675         to Layout::make_output_section_for_script.
4676         (Output_section_definition::output_section_name): Return script
4677         section type to caller.
4678         (Output_section_definition::set_section_address): Do not advance
4679         dot value and load address if section type is NOLOAD.  Set address
4680         of NOLOAD sections regardless of section flags.
4681         (Output_section_definition::print): Print section type if it is
4682         not SCRIPT_SECTION_TYPE_NONE.
4683         (Output_section_definition::section_type): New method.
4684         (Output_section_definition::script_section_type_name): Ditto.
4685         (Script_sections::output_section_name): Add new parameter
4686         PSECTION_TYPE for returning script section type.  Pass it to
4687         section elements.  Handle discard sections.
4688         (Sort_output_sections::operator()): Handle NOLOAD sections.
4689         * script-sections.h (Script_sections::Section_type): New enum type.
4690         (Script_sections::output_section_name): Add a new parameter for
4691         returning script section type.
4692         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4693         INFO and NOLOAD.
4694         * yyscript.y (union): Add new field SECTION_TYPE.
4695         (COPY, DSECT, INFO, NOLOAD): New tokens.
4696         (opt_address_and_section_type): Change type to output_section_header.
4697         (section_type): New non-terminal
4698         (section_header): Handle section type.
4699         (opt_address_and_section_type): Return section type value.
4701 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4703         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4704         * testsuite/plugin_common_test_2.c (foo): Likewise.
4706 2010-04-08  Doug Kwan  <dougkwan@google.com>
4708         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4709         Output_merge_data.
4710         * output.cc (Output_section::add_merge_input_section): Simplify
4711         code and return status of Output_merge_base::add_input_section.
4712         Update merge section map only if Output_merge_base::add_input_section
4713         returns true.
4715 2010-04-07  Doug Kwan  <dougkwan@google.com>
4717         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4718         if section is marked as containing instructions but has no mapping
4719         symbols.
4720         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4721         correct section index.
4722         (Arm_relobj::find_linked_text_section): Ditto.
4724 2010-04-07  Cary Coutant  <ccoutant@google.com>
4726         * archive.cc (include_member): Destroy Read_symbols_data object before
4727         releasing file.
4728         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4729         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4730         (Read_symbols_data::~Read_symbols_data) New destructor.
4731         (Section_relocs::Section_relocs) New constructor.
4732         (Section_relocs::~Section_relocs) New destructor.
4733         (Read_relocs_data::Read_relocs_data) New constructor.
4734         (Read_relocs_data::~Read_relocs_data) New destructor.
4735         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4736         pointers to NULL after deleting.
4738 2010-04-07  Doug Kwan  <dougkwan@google.com>
4740         * arm.cc: Replace "endianity" with "endianness" in comments.
4741         (Arm_exidx_cantunwind): Ditto.
4742         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4743         (Arm_relobj::merge_flags_and_attributes): New method.
4744         (Arm_relobj::merge_flags_and_attributes_): New data member.
4745         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4746         (Arm_relobj::scan_sections_for_stubs): Ditto.
4747         (Arm_relobj::do_read_symbols): Check to see if we really want to
4748         merge processor-specific flags and attributes.  Exit early if
4749         an object is empty except for section names and the undefined symbol.
4750         (Target_arm::do_finalize_sections): Move check for ELF format to
4751         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4752         attributes from a regular object only when we have determined that
4753         it is aapropriate.  Do not create an .ARM.attributes section in
4754         output if there is no regular input object.
4755         (Target_arm::merge_processor_specific_flags): Check
4756         --warn-mismatch before printing any error.
4757         (Target_arm::merge_object_attributes): Ditto.
4758         * gold.cc (queue_middle_tasks): Handle the case in which there is
4759         no regular object in input.
4760         * options.cc (General_options::parse_EB): New method.
4761         (General_options::parse_EL): Same.
4762         (General_options::General_options): Initialize endianness_.
4763         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4764         New options.
4765         (General_options::Endianness): New enum.
4766         (General_options::endianness): New method.
4767         (General_options::endianness_): New data member.
4768         * parameters.cc (Parameters::set_options): Check target endianness.
4769         (Parameters::set_target_once): Ditto.
4770         (Parameters::check_target_endianness): New method.
4771         (parameters_force_valid_target): If either -EL or -EB is specified,
4772         use it to define endianness of default target.
4773         * parameters.h (Parameters::check_target_endianness): New method
4774         declaration.
4775         * target.h (class Target): Change "endianity" to "endianness"
4776         in comments.
4778 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4780         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4781         * configure: Regenerate.
4782         * Makefile.in: Regenerate.
4783         * testsuite/Makefile.in: Regenerate.
4785 2010-04-06  Cary Coutant  <ccoutant@google.com>
4787         gcc PR lto/42757
4788         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4789         prevailing definitions of common symbols.
4790         * testsuite/plugin_test_6.sh: New test case.
4791         * testsuite/plugin_common_test_1.c: New test case.
4792         * testsuite/plugin_common_test_2.c: New test case.
4793         * testsuite/Makefile.am (plugin_test_6): New test case.
4794         * testsuite/Makefile.in: Regenerate.
4796 2010-04-06  Nick Clifton  <nickc@redhat.com>
4798         * po/vi.po: New Vietnamese translation.
4800 2010-03-30  Doug Kwan  <dougkwan@google.com>
4802         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4804 2010-03-25  Doug Kwan  <dougkwan@google.com>
4806         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4807         to avoid a conversion warning on a 32-bit host.
4809 2010-03-24  Ian Lance Taylor  <iant@google.com>
4811         * testsuite/script_test_3.t: Add a TLS segment.
4812         * testsuite/Makefile.am (check_PROGRAMS): Add
4813         tls_phdrs_script_test.
4814         (tls_phdrs_script_test_SOURCES): Define.
4815         (tls_phdrs_script_test_DEPENDENCIES): Define.
4816         (tls_phdrs_script_test_LDFLAGS): Define.
4817         (tls_phdrs_script_test_LDADD): Define.
4818         * testsuite/Makefile.in: Rebuild.
4820 2010-03-23  Cary Coutant  <ccoutant@google.com>
4822         * fileread.cc (find_or_make_view): Fix comment.
4824 2010-03-23  Ian Lance Taylor  <iant@google.com>
4826         * script-sections.cc (class Orphan_section_placement): Define
4827         PLACE_TLS and PLACE_TLS_BSS.
4828         (Orphan_section_placement::Orphan_section_placement): Initialize
4829         new places.
4830         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4831         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4832         (tls_script_test_SOURCES): Define.
4833         (tls_script_test_DEPENDENCIES): Define.
4834         (tls_script_test_LDFLAGS): Define.
4835         (tls_script_test_LDADD): Define.
4836         * testsuite/Makefile.in: Rebuild.
4838 2010-03-22  Doug Kwan  <dougkwan@google.com>
4840         * arm.cc (Arm_relocate_functions::abs8,
4841         Arm_relocate_functions::abs16): Use correct check for overflow
4842         specified in the ARM ELF specs.
4843         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4844         target of a BLX instruction specially.
4845         (Reloc_stub::stub_type_for_reloc): Ditto.
4846         (Relocate::relocate): Use symbolic names instead of numeric relocation
4847         codes to report error.
4848         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4849         workaround.
4850         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4851         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4852         thumb2_blx_out_of_range.stdout
4853         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4854         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4855         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4856         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4857         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4858         thumb2_blx_in_range, thumb2_blx_in_range.o,
4859         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4860         thumb2_blx_out_of_range.o): New rules.
4861         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4862         thumb2_blx_in_range and thumb2_blx_out_of_range.
4863         * testsuite/Makefile.in: Regenerate.
4864         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4865         * testsuite/thumb_blx_in_range.s: New file.
4866         * testsuite/thumb_blx_out_of_range.s: New file.
4868 2010-03-22  Rafael Espindola  <espindola@google.com>
4870         * archive.cc (Should_include): Move to archive.h.
4871         (should_include_member): Make it a member of Archive.
4872         (Lib_group): New.
4873         (Add_lib_group_symbols): New.
4874         * archive.h: Include options.h.
4875         (Archive_member): Moved from Archive.
4876         (Should_include): Moved from archive.cc.
4877         (Lib_group): New.
4878         (Add_lib_group_symbols): New.
4879         * dynobj.cc (do_should_include_member): New.
4880         * dynobj.h (do_should_include_member): New.
4881         * gold.cc (queue_initial_tasks): Update call to queue.
4882         * main.cc (main): Print lib group stats.
4883         * object.cc (do_should_include_member): New.
4884         * object.h: Include archive.h.
4885         (Object::should_include_member): New.
4886         (Object::do_should_include_member): New.
4887         (Sized_relobj::do_should_include_member): New.
4888         * options.cc (General_options::parse_start_lib): New.
4889         (General_options::parse_end_lib): New.
4890         (Input_arguments::add_file): Handle lib groups.
4891         (Input_arguments::start_group): Check we are not in a lib.
4892         (Input_arguments::start_lib): New.
4893         (Input_arguments::end_lib): New.
4894         * options.h (General_options): Add start_lib and end_lib.
4895         (Input_argument::lib_): New.
4896         (Input_argument::lib): New.
4897         (Input_argument::is_lib): New.
4898         (Input_file_lib): New.
4899         (Input_arguments::in_lib_): New.
4900         (Input_arguments::in_lib): New.
4901         (Input_arguments::start_lib): New.
4902         (Input_arguments::end_lib_): New.
4903         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4904         in unused members as preempted.
4905         (Sized_pluginobj::do_should_include_member): New.
4906         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4907         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4908         return the blocker.
4909         (Read_symbols::do_whole_lib_group): New.
4910         (Read_symbols::do_lib_group): New.
4911         (Read_symbols::do_read_symbols): Handle lib groups.
4912         (Read_symbols::get_name): Handle lib groups.
4913         * readsyms.h (Read_symbols): Add an archive member pointer.
4914         (Read_symbols::do_whole_lib_group): New.
4915         (Read_symbols::do_lib_group): New.
4916         (Read_symbols::member_): New.
4917         * script.cc (read_input_script): Update call to queue_soon.
4919 2010-03-19  Doug Kwan  <dougkwan@google.com>
4921         * arm.cc (Stub_table::Stub_table): Initialize new data members
4922         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4923         (Stub_table::add_reloc_stub): Assign stub offset and update
4924         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4925         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4926         New data members.
4927         (Stub_table::update_data_size_and_addralign): Use
4928         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4929         instead of going over all reloc stubs.
4930         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4931         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4932         Stringpool_template::offset_ to size of Stringpool_char.
4933         (Stringpool_template::new_key_offset): Remove code to initialize
4934         Stringpool_template::offset_.
4935         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4936         Stringpool_template::offset_ to zero.
4938 2010-03-15  Doug Kwan  <dougkwan@google.com>
4940         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4941         offset_.
4942         (Stringpool_template::new_key_offset): New method.
4943         (Stringpool_template::add_string): Assign offsets when adding new
4944         strings.
4945         (Stringpool_template::set_string_offsets): Do not set string offsets
4946         when not optimizing.
4947         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4948         member size_.
4949         (Chunked_vector::clear): Clear size_.
4950         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4951         (Chunked_vector::size): Return size_.
4952         (Chunked_vector::push_back): Use size_ to find insert position.
4953         (Chunked_vector::size_): New data member.
4954         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4955         (Stringpool_template::new_key_offset): New method declaration.
4956         (Stringpool_template::offset_): New data member.
4958 2010-03-15   Rafael Espindola  <espindola@google.com>
4960         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4961         Add_symbols' constructor.
4962         * readsyms.h (Add_symbols): Remove the input_group member.
4964 2010-03-10  Ian Lance Taylor  <iant@google.com>
4966         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4967         target to ask whether a reference to a symbol requires a stack
4968         split.
4969         * target.h (Target::is_call_to_non_split): New function.
4970         (Target::do_is_call_to_non_split): Declare virtual function.
4971         * target.cc: Include "symtab.h".
4972         (Target::do_is_call_to_non_split): New function.
4973         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4975 2010-03-10  Cary Coutant  <ccoutant@google.com>
4977         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4978         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4979         (File_read::open[2]): Add whole_file_view_ to list of views.
4980         (File_read::make_view): Remove test of whole_file_view_.
4981         (File_read::find_or_make_view): Create whole_file_view_ if
4982         necessary.
4983         (File_read::clear_views): Replace bool parameter with enum;
4984         adjust all callers.  Don't delete views with permanent data;
4985         do delete cached views and views from archives if
4986         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4987         if clearing the corresponding view.
4988         * fileread.h (File_read::Clear_views_mode): New enum.
4989         (File_read::View::is_permanent_view): New method.
4990         (File_read::clear_views): Replace bool parameter
4991         with enum; adjust all callers.
4992         * options.h (General_options): Change keep_files_mapped option;
4993         add map_whole_files.
4994         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4995         releasing the file.
4996         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4997         the file.
4999 2010-03-10  David S. Miller  <davem@davemloft.net>
5001         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5003 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5005         * icf.cc (get_section_contents): Add '@' marker after processing the
5006         merge reloc.
5008 2010-03-08  Doug Kwan  <dougkwan@google.com>
5010         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5011         due to a conversion warning.
5012         (Arm_relobj::update_output_local_symbol_count): Check for local
5013         symbol with unset output index.
5015 2010-03-05  Ian Lance Taylor  <iant@google.com>
5017         * options.h (class General_options): Add --spare-dynamic-tags.
5018         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5019         --spare-dynamic-tags.
5021 2010-03-05  Ian Lance Taylor  <iant@google.com>
5023         * incremental.cc: Include "libiberty.h".
5025 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5027         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5028         function, is_info_ member.
5029         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5030         (Versions::Versions): Update caller.
5031         (Versions::define_base_version): Likewise.
5032         (Versions::add_def): Likewise.
5034 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5036         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5037         (Scan::possible_function_pointer_reloc): New function.
5038         (Scan::local_reloc_may_be_function_pointer): Change to call
5039         possible_function_pointer_reloc.
5040         (Scan::global_reloc_may_be_function_pointer): Ditto.
5041         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5042         relocations in ".data.rel.ro._ZTV" section.
5043         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5044         * testsuite/icf_safe_so_test.cc: Ditto.
5045         * testsuite/icf_safe_test.cc: Ditto.
5046         * testsuite/icf_safe_test.sh: Ditto.
5048 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5049             Ian Lance Taylor  <iant@google.com>
5051         * target-reloc.h (relocate_section): Check the symbol table index
5052         for -1U before setting the local symbol index.
5053         (scan_relocatable_relocs): If copying the relocation, record that
5054         the local symbol is required.
5055         * object.h (Symbol_value::is_output_symtab_index_set): New
5056         function.
5057         (Symbol_value::may_be_discarded_from_output_symtab): New
5058         function.
5059         (Symbol_value::has_output_symtab_entry): New function.
5060         (Symbol_value::needs_output_symtab_entry): Remove.
5061         (Symbol_value::output_symtab_index): Make sure the symbol index is
5062         set.
5063         (Symbol_value::set_output_symtab_index): Make sure the symbol
5064         index is not set.  Make sure the new index is valid.
5065         (Symbol_value::set_must_have_output_symtab_entry): New function.
5066         (Symbol_value::has_output_dynsym_entry): New function.
5067         (Symbol_value::set_output_dynsym_index): Make sure the new index
5068         is valid.
5069         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5070         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5071         local symbol if permitted.
5072         (Sized_relobj::do_finalize_local_symbols): Call
5073         is_output_symtab_index_set rather than needs_output_symtab_entry.
5074         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5075         rather than needs_output_symtab_entry.  Call
5076         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5077         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5078         is_output_symtab_index_set rather than needs_output_symtab_entry.
5079         * testsuite/discard_locals_relocatable_test.c: New file.
5080         * testsuite/discard_locals_test.sh: Test -r.
5081         * testsuite/Makefile.am (check_DATA): Add
5082         discard_locals_relocatable_test1.syms,
5083         discard_local_relocatable_test2.syms.
5084         (MOSTLYCLEANFILES): Likewise.  Also add
5085         discard_locals_relocatable_test1.lout and
5086         discard_locals_relocatable_test2.out.
5087         (discard_locals_relocatable_test1.syms): New target.
5088         (discard_locals_relocatable_test.o): New target.
5089         (discard_locals_relocatable_test1.out): New target.
5090         (discard_locals_relocatable_test2.syms): New target.
5091         (discard_locals_relocatable_test2.out): New target.
5092         (various): Add missing ../ld-new dependencies.
5093         * testsuite/Makefile.in: Rebuild.
5095 2010-03-03  Nick Clifton  <nickc@redhat.com>
5097         * po/fi.po: New Finnish translation.
5099 2010-03-01  Doug Kwan  <dougkwan@google.com>
5101         * layout.cc (Layout::Layout): Force section types of .init_array*,
5102         .preinit_array* and .fini_array* sections.
5103         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5104         Fix check of return value of std::string::find.().
5105         (Output_section::Input_section_sort_compare::operator()): Remove
5106         comment about .init_array.
5107         (Output_section::Input_section_sort_init_fini_compare::operator()):
5108         New method.
5109         (Output_section::sort_attached_input_sections): Handle .init_array
5110         and .fini_array specially.
5111         * output.h (Output_section::Inut_section_sort_compare): Update
5112         comment.
5113         (Output_section::Input_section_sort_init_fini_compare): New struct.
5115 2010-02-26  Doug Kwan  <dougkwan@google.com>
5117         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5118         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5119         * testsuite/debug_msg.sh: Avoid matching source line number for
5120         use of global variable undef_int.
5122 2010-02-26  Doug Kwan  <dougkwan@google.com>
5124         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5125         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5126         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5127         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5128         * options.cc (General_options::General_options): Initialize member
5129         fix_v4bx_.
5130         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5131         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5132         and rm_no_fix_v4bx.stdout
5133         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5134         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5135         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5136         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5137         and arm_no_fix_v4bx.
5138         * Makefile.in: Regenerate.
5139         * testsuite/arm_fix_v4bx.s: New file.
5140         * testsuite/arm_fix_v4bx.sh: Ditto.
5142 2010-02-24  Doug Kwan  <dougkwan@google.com>
5144         * arm.cc (Target_arm::got_section): Make the .got section the first
5145         non RELRO section in the data segment.
5146         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5147         suffixes of section names.
5149 2010-02-24  Doug Kwan  <dougkwan@google.com>
5151         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5152         flags and attributes merging if an input file is a binary file.
5153         * fileread.cc (Input_file::open): Record format of original file.
5154         * fileread.h (Input_file::Format): New enum type.
5155         (Input_file::Input_file): Initialize data member format_.
5156         (Input_file::format): New method definition.
5157         (Input_file::format_):: New data member.
5159 2010-02-24  Doug Kwan  <dougkwan@google.com>
5161         * arm.cc (Arm_output_data_got): New class.
5162         (ARM_TCB_SIZE): New constant
5163         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5164         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5165         If user uses a script with a SECTIONS clause, issue only a warning
5166         for a misplaced EXIDX input section.  Otherwise, issue an error.
5167         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5168         garbage collection.
5169         (Target_arm::got_mode_index_entry): Handle static linking.
5170         (Target_arm::Scan::local): Ditto.
5171         (Target_arm::Scan::global): Ditto.
5172         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5173         all incorrectly implemented relocations.
5174         (Target_arm::fix_exidx_coverage): Pass layout to
5175         Arm_output_section::fix_exidx_coverage.
5176         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5177         from ".ARM.exidx." and ".ARM.extab.".
5179 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5181         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5182         section if it does not already exist.
5183         * attributes.cc (Attributes_section_data::Attributes_section_data):
5184         Don't crash if size is zero.
5186 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5187             Ian Lance Taylor  <iant@google.com>
5189         * gold.cc (queue_middle_tasks): If no input files were opened,
5190         exit.
5191         * workqueue.h (Task_function::Task_function): Assert that there is
5192         a blocker.
5194 2010-02-22  Doug Kwan  <dougkwan@google.com>
5196         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5197         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5198         types to avoid warnings due to different uint64_t implementations
5199         on different hosts.
5201 2010-02-21  Doug Kwan  <dougkwan@google.com>
5203         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5204         handling of the maximum backward branch offset.
5205         (Arm_relocate_functions::thumb_branch_common): Ditto.
5206         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5207         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5208         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5209         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5210         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5211         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5212         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5213         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5214         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5215         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5216         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5217         thumb2_bl_out_of_range.o): New rules.
5218         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5219         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5220         thumb2_bl_out_of_range
5221         * testsuite/Makefile.in: Regenerate.
5222         * testsuite/arm_bl_in_range.s: New file.
5223         * testsuite/arm_bl_out_of_range.s: Ditto.
5224         * testsuite/arm_branch_in_range.sh: Ditto.
5225         * testsuite/arm_branch_range.t: Ditto.
5226         * testsuite/thumb2_branch_range.t: Ditto.
5227         * testsuite/thumb_bl_in_range.s: Ditto.
5228         * testsuite/thumb_bl_out_of_range.s: Ditto.
5229         * testsuite/thumb_branch_range.t: Ditto.
5231 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5233         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5234         Add reloc offset information.
5235         * icf.cc (get_section_contents): Change iterators to point to the new
5236         vectors. Add reloc offset information to the contents.
5237         * icf.h (Icf::Sections_reachable_info): New typedef.
5238         (Icf::Sections_reachable_list): New typedef.
5239         (Icf::Offset_info): New typedef.
5240         (Icf::Reloc_info): New struct typedef.
5241         (Icf::Reloc_info_list): New typedef.
5242         (Icf::symbol_reloc_list): Delete method.
5243         (Icf::addend_reloc_list): Delete method.
5244         (Icf::section_reloc_list): Delete method.
5245         (Icf::reloc_info_list): New method.
5246         (Icf::reloc_info_list_): New member.
5248 2010-02-19  Doug Kwan  <dougkwan@google.com>
5250         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5251         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5252         * arm.cc (Arm_relocation_functions): New forward declaration.
5253         (Target_arm::Target_arm): Initialize new data members
5254         got_mod_index_offset_ and tls_base_symbol_defined_.
5255         (Target_arm::Relocate::relocate_tls): New method.
5256         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5257          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5258         New methods.
5259         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5260         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5261         (Target_arm::got_mod_index_offset_,
5262         Target_arm::tls_base_symbol_defined_): New data members.
5263         (Target_arm::Scan::local, Target::Scan::global,
5264         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5265         relocations.
5267 2010-02-18  Doug Kwan  <dougkwan@google.com>
5269         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5270         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5271         text section as a parameter becuase some broken tools may not set
5272         the link in section header.
5273         (Target_arm::has_got_section): New method.
5274         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5275         without any mapping symbol as data only.  Remove warning.
5276         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5277         link in its section header, try to discover the link by inspecting the
5278         REL31 relocation at the beginning of the section.
5279         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5280         in error message.
5281         (Target_arm::Scan::global): Treat any reference to the symbol
5282         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5284 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5286         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5287         (Scan::global_reloc_may_be_function_pointer): New function.
5288         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5289         (Scan::global_reloc_may_be_function_pointer): New function.
5290         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5291         (Scan::global_reloc_may_be_function_pointer): New function.
5292         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5293         (Scan::global_reloc_may_be_function_pointer): New function.
5294         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5295         (Scan::global_reloc_may_be_function_pointer): New function.
5296         (Scan::possible_function_pointer_reloc): New function.
5297         (Target_x86_64::can_check_for_function_pointers): New function.
5298         * gc.h (gc_process_relocs): Scan relocation types to determine if
5299         function pointers were taken for targets that support it.
5300         * icf.cc (Icf::find_identical_sections): Include functions for
5301         folding in safe ICF whose pointer is not taken.
5302         * icf.h (Secn_fptr_taken_set): New typedef.
5303         (fptr_section_id_): New member.
5304         (section_has_function_pointers): New function.
5305         (set_section_has_function_pointers): New function.
5306         (check_section_for_function_pointers): New function.
5307         * options.h: Fix comment for safe ICF option.
5308         * target.h (can_check_for_function_pointers): New function.
5309         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5310         Modify icf_safe_test for X86-64.
5311         * testsuite/Makefile.in: Regenerate.
5312         * testsuite/icf_safe_so_test.cc: New file.
5313         * testsuite/icf_safe_so_test.sh: New file.
5314         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5315         (main): Change to take pointer to function kept_func_3.
5316         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5317         folding is done correctly for X86-64.
5319 2010-02-12  David S. Miller  <davem@davemloft.net>
5321         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5322         is_symbolless parameter.
5323         (Output_reloc<SHT_REL>::is_symbolless): New.
5324         (Output_reloc<SHT_REL>::is_symbolless_): New.
5325         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5326         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5327         (Output_reloc<SHT_RELA>::is_symbolless): New.
5328         (Output_data_reloc::add_global): Handle is_symbolless.
5329         (Output_data_reloc::add_global_relative): Likewise.
5330         (Output_data_reloc::add_local): Likewise.
5331         (Output_data_reloc::add_local_relative): Likewise.
5332         (Output_data_reloc::add_symbolless_global_addend): New.
5333         (Output_data_reloc::add_symbolless_local_addend): New.
5334         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5335         is_symbolless.
5336         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5337         instead of ->is_relative_
5338         (Output_reloc::write): Likewise.
5339         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5340         (Output_reloc::write_rel): Simplify.
5342         * sparc.cc (Target_sparc::Scan::local): Use
5343         ->add_symbolless_local_addend as needed.
5344         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5345         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5346         based upon relocation offset.
5348 2010-02-11  Doug Kwan  <dougkwan@google.com>
5350         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5351         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5352         beginning of function.
5353         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5354         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5355         parameter is_32bit in calls to should_apply_static_reloc.
5356         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5357         (check_DATA): Add arm_abs_global.stdout.
5358         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5359         arm_abs_global.stdout): New rules.
5360         (MOSTLLYCLEANFILES): Add arm_abs_global
5361         * Makefile.in: Regenerate.
5362         * testsuite/arm_abs_global.s: New file.
5363         * testsuite/arm_abs_global.sh: Ditto.
5364         * testsuite/arm_abs_lib.s: Ditto.
5366 2010-02-11  Ian Lance Taylor  <iant@google.com>
5368         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5369         Read_relocs task.
5370         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5371         Allocate_commons_task first.
5372         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5373         task, rather than symtab_lock_.
5374         (Gc_process_relocs::~Gc_process_relocs): New function.
5375         (Gc_process_relocs::is_runnable): Check this_blocker_.
5376         (Gc_process_relocs::locks): Use next_blocker_ rather than
5377         blocker_.
5378         (Scan_relocs::~Scan_relocs): New function.
5379         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5380         symtab_lock_.
5381         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5382         next_blocker_.
5383         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5384         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5385         constructor accordingly.
5386         (class Gc_process_relocs): Likewise.
5387         (class Scan_relocs): Likewise.
5388         * common.h (class Allocate_commons_task): Remove symtab_lock_
5389         field, and corresponding constructor parameter.
5390         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5391         symtab_lock_.
5392         (Allocate_commons_task::locks): Likewise.
5394 2010-02-11  Ian Lance Taylor  <iant@google.com>
5396         * gold-threads.h (class Once): Define.
5397         (class Initialize_lock): Rewrite as child of Once.
5398         * gold-threads.cc (class Once_initialize): Define.
5399         (once_pointer_control): New static variable.
5400         (once_pointer, once_arg): New static variables.
5401         (c_run_once): New static function.
5402         (Once::Once, Once::run_once, Once::internal_run): New functions.
5403         (class Initialize_lock_once): Remove.
5404         (initialize_lock_control): Remove.
5405         (initialize_lock_pointer): Remove.
5406         (initialize_lock_once): Remove.
5407         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5408         (Initialize_lock::initialize): Rewrite.
5409         (Initialize_lock::do_run_once): New function.
5410         * archive.cc (Archive::interpret_header): Only clear name if it is
5411         not already empty.
5412         * fileread.cc: Include "gold-threads.h"
5413         (file_counts_lock): New static variable.
5414         (file_counts_initialize_lock): Likewise.
5415         (File_read::release): Only increment counts when using --stats.
5416         Use a lock around the increment.
5417         * parameters.cc (class Set_parameters_target_once): Define.
5418         (set_parameters_target_once): New static variable.
5419         (Parameters::Parameters): Move here from parameters.h.
5420         (Parameters::set_target): Rewrite.
5421         (Parameters::set_target_once): New function.
5422         (Parameters::clear_target): Move here and rewrite.
5423         * parameters.h (class Parameters): Update declarations.  Add
5424         set_parameters_target_once_ field.
5425         (Parameters::Parameters): Move to parameters.cc.
5426         (Parameters::clear_target): Likewise.
5427         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5428         task.
5429         (Start_group::~Start_group): New function.
5430         (Start_group::is_runnable): New function.
5431         (Start_group::locks, Start_group::run): New functions.
5432         (Finish_group::run): Change saw_undefined to size_t.
5433         * readsyms.h (class Start_group): Define.
5434         (class Finish_group): Change saw_undefined_ field to size_t.
5435         (Finish_group::Finish_group): Remove saw_undefined and
5436         this_blocker parameters.  Change all callers.
5437         (Finish_group::set_saw_undefined): New function.
5438         (Finish_group::set_blocker): New function.
5439         * symtab.h (class Symbol_table): Change saw_undefined to return
5440         size_t.  Change saw_undefined_ field to size_t.
5441         * target-select.cc (Set_target_once::do_run_once): New function.
5442         (Target_selector::Target_selector): Initialize set_target_once_
5443         field.  Don't initialize lock_ and initialize_lock_ fields.
5444         (Target_selector::instantiate_target): Rewrite.
5445         (Target_selector::set_target): New function.
5446         * target-select.h (class Set_target_once): Define.
5447         (class Target_selector): Update declarations.  Make
5448         Set_target_once a friend.  Remove lock_ and initialize_lock_
5449         fields.  Add set_target_once_ field.
5451 2010-02-10  Ian Lance Taylor  <iant@google.com>
5453         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5454         queueing any tasks.
5455         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5456         (queue_middle_tasks): Add all blockers before queueing any tasks.
5457         (queue_final_tasks): Likewise.
5458         * token.h (Task_token::add_blockers): New function.
5459         * object.h (Input_objects::number_of_relobjs): New function.
5461 2010-02-10  Ian Lance Taylor  <iant@google.com>
5463         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5464         shared, not if not position independent.
5465         * x86_64.cc (Relocate::relocate_tls): Likewise.
5466         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5467         (tls_pie_pic_test): New target.
5468         * testsuite/Makefile.in: Rebuild.
5470         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5471         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5472         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5473         * testsuite/Makefile.in: Rebuild.
5475 2010-02-09  David S. Miller  <davem@davemloft.net>
5477         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5478         R_SPARC_RELATIVE using ->add_local_relative().
5479         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5481         * output.h (Output_data_dynamic::add_section_size): New method
5482         that takes two Output_data objects.
5483         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5484         entry param.  Handle it in initializers.
5485         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5486         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5487         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5488         arg.
5489         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5490         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5491         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5492         for dynrel_includes_plt.
5493         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5494         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5495         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5496         before .rela.plt
5497         (Target_sparc::do_finalize_sections): Update to pass true for
5498         dynrel_includes_plt.
5499         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5500         output before .rela.plt
5501         (Target_powerpc::do_finalize_sections): Update to pass true for
5502         dynrel_includes_plt when 32-bit.
5504 2010-02-08  Doug Kwan  <dougkwan@google.com>
5506         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5507         method.
5508         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5509         Arm_relobj::scan_section_for_cortex_a8_stubs,
5510         Arm_relobj::do_relocation_section): Instead of calling
5511         Output_section::output_address, use faster
5512         Arm_relobj::simple_input_section_output_address.
5514 2010-02-08  David S. Miller  <davem@davemloft.net>
5516         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5517         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5518         relocation helper function.
5520         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5521         just like R_SPARC_GOT{10,13,22}.
5522         (Target_sparc::Scan::local): Likewise.
5523         (Target_sparc::Relocate:relocate): Likewise.
5525 2010-02-06  Ian Lance Taylor  <iant@google.com>
5527         * configure.ac: Rewrite targetobjs duplicate removal code to use
5528         only shell constructs.
5529         * configure: Rebuild.
5531 2010-02-05  Doug Kwan  <dougkwan@google.com>
5533         PR 11247
5534         * arm.cc (Arm_relobj::section_is_scannable): New method.
5535         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5536         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5538 2010-02-04  Doug Kwan  <dougkwan@google.com>
5540         PR 11247
5541         * arm-reloc-property.cc (cstdio): Include.
5542         * configure.ac (targetobjs): Remove duplicates.
5543         * configure: Regenerate.
5544         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5545         big and little endian version for a given address size.
5547 2010-02-03  Doug Kwan  <dougkwan@google.com>
5549         * arm-reloc-property.cc
5550         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5551         definition.
5552         * arm-reloc-property.h
5553         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5554         New method definition.
5555         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5556         declaration.
5557         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5558         overflow to N.
5559         (GOT_PREL): Change implemented to Y.
5560         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5561         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5562         (Arm_relocate_functions::movw_abs_nc): Remove method.
5563         (Arm_relocate_functions::movt_abs): Ditto.
5564         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5565         (Arm_relocate_functions::thm_movt_abs): Ditto.
5566         (Arm_relocate_functions::movw_rel_nc): Ditto.
5567         (Arm_relocate_functions::movw_rel): Ditto.
5568         (Arm_relocate_functions::movt_rel): Ditto.
5569         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5570         (Arm_relocate_functions:thm_movw_rel): Ditto.
5571         (Arm_relocate_functions:thm_movt_rel): Ditto.
5572         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5573         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5574         New method definitions.
5575         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5576         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5577         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5578         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5579         (Target_arm::Relocate::relocate): Check for non-static or
5580         unimplemented relocation code and exit early.  Change calls to
5581         Target_arm::reloc_uses_thumb_bit and
5582         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5583         instead.  Refactor code to handle similar relocations to increase
5584         code sharing.  Remove check for unsupported relocation code in switch
5585         statement.
5586         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5587         relocation property table to find out size.  Change error message to
5588         print out the name of a relocation code instead of the numeric value.
5589         (Target_arm::scan_reloc_for_stub): Use relocation property table
5590         instead of calling Target_arm::reloc_uses_thumb_bit().
5592 2010-02-02  Doug Kwan  <dougkwan@google.com>
5594         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5595         types of relaxed input section.
5597 2010-02-02  Doug Kwan  <dougkwan@google.com>
5599         * Makefile.am (HFILES): Add arm-reloc-property.h.
5600         (DEFFILES): New.
5601         (TARGETSOURCES): Add arm-reloc-property.cc
5602         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5603         (libgold_a_SOURCES): $(DEFFILES)
5604         * Makefile.in: Regenerate.
5605         * arm-reloc-property.cc: New file.
5606         * arm-reloc-property.h: New file.
5607         * arm-reloc.def: New file.
5608         * arm.cc: Update comments.
5609         (arm-reloc-property.h): New included header.
5610         (arm_reloc_property_table): New global variable.
5611         (Target_arm::do_select_as_default_target): New method definition.
5612         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5613         arm-reloc-property to targ_extra_obj.
5614         * parameters.cc (set_parameters_target): Call
5615         Target::select_as_default_target().
5616         * target.h (Target::select_as_default_target): New method definition.
5617         (Target::do_select_as_default_target): Same.
5619 2010-02-01  Doug Kwan  <dougkwan@google.com>
5621         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5622         first_output_text_section_.
5623         (Arm_exidx_fixup::first_output_text_section): New method definition.
5624         (Arm_exidx_fixup::first_output_text_section_): New data member.
5625         (Arm_exidx_fixup::process_exidx_section): Record the first text
5626         output section seen.
5627         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5628         and entsize in output section header.
5630 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5632         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5633         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5634         (Arm_relocate_functions::thm_alu11): New Method.
5635         (Arm_relocate_functions::thm_pc8): New Method.
5636         (Arm_relocate_functions::thm_pc12): New Method.
5637         (Target_arm::Scan::local): Handle the relocations.
5638         (Target_arm::Scan::global): Likewise.
5639         (Target_arm::Relocate::relocate): Likewise.
5640         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5642 2010-01-29  Doug Kwan  <dougkwan@google.com>
5644         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5645         of relocation types as ld.
5647 2010-01-29  Doug Kwan  <dougkwan@google.com>
5649         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5650         to public.
5651         (Arm_relocate_functions::thumb_branch_common): Ditto.
5652         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5653         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5654         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5655         Arm_relocate_functions::jump24): Remove.
5656         (Target_arm::Relocate::relocate): Adjust code to call
5657         Arm_relocation_functions::arm_branch_common and
5658         Arm_relocation_functions::thumb_branch_common instead of their removed
5659         wrappers.  Merge switch-cases together to reduce source code size.
5661 2010-01-29  Doug Kwan  <dougkwan@google.com>
5663         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5664         output_local_symbol_count_needs_update_.
5665         (Arm_relobj::output_local_symbol_count_needs_update,
5666          Arm_relobj::set_output_local_symbol_count_needs_update,
5667          Arm_relobj::update_output_local_symbol_count): New methods.
5668         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5669         member.
5670         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5671         of pointed function as in a R_ARM_PREL31 relocation.
5672         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5673         for output local symbol count updating.
5674         (Target_arm::do_relax): Update output local symbol counts in objects
5675         if necessary.
5676         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5678 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5680         * arm.cc: Added support for the ARM relocations:
5681         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5682         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5683         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5684         movw_prel_nc).
5685         (Arm_relocate_functions::movw_rel): New method.
5686         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5687         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5688         thm_movw_prel_nc).
5689         (Arm_relocate_functions::thm_movw_rel): New method.
5690         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5691         thm_movt_prel).
5692         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5693         relocations.
5694         (Target_arm::Scan::global): Likewise.
5695         (Target_arm::Relocate::relocate): Likewise.
5696         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5697         Likewise.
5699 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5701         * arm.cc: Added support for ARM group relocations.
5702         (Target_arm::reloc_needs_sym_origin): New method.
5703         (Arm_relocate_functions::calc_grp_kn): New method.
5704         (Arm_relocate_functions::calc_grp_residual): New method.
5705         (Arm_relocate_functions::calc_grp_gn): New method.
5706         (Arm_relocate_functions::arm_grp_alu): New Method.
5707         (Arm_relocate_functions::arm_grp_ldr): New Method.
5708         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5709         (Arm_relocate_functions::arm_grp_ldc): New Method.
5710         (Target_arm::Scan::local): Handle the ARM group relocations.
5711         (Target_arm::Scan::global): Likewise.
5712         (Target_arm::Relocate::relocate): Likewise.
5713         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5714         Likewise.
5716 2010-01-26  Doug Kwan  <dougkwan@google.com>
5718         * arm.cc (set): Include.
5719         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5720         pointer type.
5721         (Arm_output_section::Text_section_list): New type.
5722         (Arm_output_section::append_text_sections_to_list): New method.
5723         (Arm_output_section::fix_exidx_coverage): Ditto.
5724         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5725         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5726         Relobj::set_section_offset() instead of
5727         Sized_relobj::invalidate_section_offset().
5728         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5729         parameter for section headers. Ignore relocation sections for
5730         unallocated sections and EXIDX sections.
5731         (Target_arm::fix_exidx_coverage): New method.
5732         (Target_arm::output_section_address_less_than): New type.
5733         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5734         linked text section instead of the EXIDX section.
5735         (Arm_output_section::create_stub_group): Add an assertion to check
5736         that this is not an EXIDX output section.
5737         (Arm_output_section::append_text_sections_to_list): New method.
5738         (Arm_output_section::fix_exidx_coverage): Ditto.
5739         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5740         Arm_relobj::section_needs_reloc_stub_scanning.
5741         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5742         first pass.
5743         (Target_arm::fix_exidx_coverage): New method.
5744         * object.h (Relobj::set_output_section): New method.
5745         (Sized_relobj::invalidate_section_offset): Remove method.
5746         (Sized_relobj::do_invalidate_section_offset): Remove method.
5747         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5749 2010-01-25  Doug Kwan  <dougkwan@google.com>
5751         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5752         Fix warning due to signed and unsigned comparison on a 32-bit host.
5754 2010-01-22  Doug Kwan  <dougkwan@google.com>
5756         * arm.cc (Target_arm::do_relax): Record an output section for section
5757         offset adjustment it contains any stub table that has changed.
5758         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5759         offsets in an output section if necessary.
5760         * output.cc (Output_section::Output_section): Initialize
5761         section_offsets_need_adjustments_.
5762         (Output_section::add_input_section_for_script): Renamed to
5763         Output_section::add_simple_input_section.
5764         (Output_section::save_states): Add a comment.
5765         (Output_section::discard_states): New method defintion.
5766         (Output_section::adjust_section_offsets): Same.
5767         * output.h (Output_section::add_input_section_for_script): Renamed to
5768         Output_section::add_simple_input_section.
5769         (Output_section::discard_states): New method declaration.
5770         (Output_section::adjust_section_offsets): Same.
5771         (Output_section::section_offsets_need_adjustment,
5772         Output_section::set_section_offsets_need_adjustment): New method
5773         definitions.
5774         (Output_section::section_offsets_need_adjustment_): New data member.
5775         * script-sections.cc
5776         (Output_section_element_input::set_section_address): Adjust code for
5777         renaming of Output_section::add_input_section_for_script.
5778         (Orphan_output_section::set_section_address): Same.
5780 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5782         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5783         Fix_v4bx enum values .
5784         * gold/options.h (General_options): New option definitions.
5785         (General_options::fix_v4bx): New method.
5786         (General_options::Fix_v4bx): New enum.
5787         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5788         (General_options::parse_fix_v4bx_interworking): New method.
5790 2010-01-22  Doug Kwan  <dougkwan@google.com>
5792         * arm.cc (Arm_exidx_fixup): New class.
5794 2010-01-21  Doug Kwan  <dougkwan@google.com>
5796         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5797         classes.
5798         (Arm_exidx_section_offset_map): New type.
5800 2010-01-21  Doug Kwan  <dougkwan@google.com>
5802         * arm.cc (Arm_exidx_input_section): New class.
5803         (Arm_relobj::exidx_input_section_by_link,
5804         Arm_relobj::exidx_input_section_by_shndx,
5805         Arm_relobj::make_exidx_input_section): New methods.
5806         (read_arm_attributes_section): Remove.
5807         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5808         information about them.
5809         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5810         to here.
5812 2010-01-20  Doug Kwan  <dougkwan@google.com>
5814         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5815         Input_section_specifier to Section_id.
5816         (Target_arm::new_arm_input_section: Adjust code for change of key
5817         type.
5818         (Target_arm::find_arm_input_section): Ditto.
5819         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5820         (Section_id): Remove.
5821         (Garbage_collection::Section_id_hash): Remove.
5822         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5823         (Section_id): Remove.
5824         (Icf::Section_id_hash): Remove.
5825         * object.h (Section_id, Const_section_id, Section_id_hash,
5826         Const_section_id_hash): New type definitions.
5827         * output.cc (Output_section::add_relaxed_input_section): Change to
5828         use Const_section_id instead of Input_section_specifier as key type.
5829         (Output_section::add_merge_input_section): Ditto.
5830         (Output_section::build_relaxation_map): Change to use Section_id
5831         instead of Input_section_specifier as key type.
5832         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5833         Ditto.
5834         (Output_section::convert_input_sections_to_relaxed_sections): Change
5835         to use Const_section_id instead of Input_section_specifier as key type.
5836         (Output_section::find_merge_section): Ditto.
5837         (Output_section::find_relaxed_input_section): Ditto.
5838         * output.h (Input_section_specifier): Remove class.
5839         (Output_section::Output_section_data_by_input_section_map): Change
5840         key type to Const_section_id.
5841         (Output_section::Output_relaxed_input_section_by_input_section_map):
5842         Ditto.
5843         (Output_section::Relaxation_map): Change key type to Section_id.
5845 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5847         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5848         (class Arm_v4bx_stub): New class.
5849         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5850         (Stub_factory::make_arm_v4bx_stub): New method.
5851         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5852         (Stub_table::empty): Handle v4bx stubs.
5853         (Stub_table::add_arm_v4bx_stub): New method.
5854         (Stub_table::find_arm_v4bx_stub): New method.
5855         (Arm_relocate_functions::v4bx): New method.
5856         (Target_arm::fix_v4bx): New method.
5857         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5858         (Stub_table::relocate_stubs): Likewise.
5859         (Stub_table::do_write): Likewise.
5860         (Stub_table::update_data_size_and_addralign): Likewise.
5861         (Stub_table::finalize_stubs):  Likewise.
5862         (Target_arm::Scan::local): Likewise.
5863         (Target_arm::Scan::global): Likewise.
5864         (Target_arm::do_finalize_sections): Likewise.
5865         (Target_arm::Relocate::relocate): Likewise.
5866         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5867         Likewise.
5868         (Target_arm::scan_reloc_for_stub): Likewise.
5869         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5871 2010-01-19  Ian Lance Taylor  <iant@google.com>
5873         * output.cc (Output_section_headers::do_sized_write): Write large
5874         segment count to sh_info field.
5875         (Output_file_header::do_sized_write): For large segment count,
5876         write PN_XNUM to e_phnum field.
5878 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5880         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5881         (Arm_relocate_functions::thm_jump8): New function.
5882         (Arm_relocate_functions::thm_jump11): New function.
5883         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5884         R_ARM_THM_JUMP11.
5885         (Target_arm::Scan::global): Likewise.
5886         (Target_arm::Relocate::relocate): Likewise.
5887         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5888         Likewise.
5890 2010-01-14  Doug Kwan  <dougkwan@google.com>
5892         * arm.cc (map, utility): Include headers.
5893         (Target_arm::apply_cortex_a8_workaround): New method.
5894         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5895         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5896         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5897         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5898         the --[no-]fix-cortex-a8 command line options.
5899         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5900         (Target_arm::relocate_stub): Use addend in instruction template.
5901         * options.h (DEFINE_bool): Set the user-set flag.
5902         (General_options): Add --[no-]-fix-cortex options.
5903         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5904         : Update fast look-up map after conversion.
5906 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5908         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5909         in the first pass of do_layout.
5911 2010-01-13  Doug Kwan  <dougkwan@google.com>
5913         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5914         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5915         apparent compiler problem of not folding static constant integral
5916         data members of elfcpp::Elf_sizes<32>.
5918 2010-01-13  Doug Kwan  <dougkwan@google.com>
5920         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5921         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5922         Arm_relobj::scan_section_for_cortex_a8_erratum,
5923         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5924         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5925         sections to scan for relocation stubs into a new method
5926         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5927         relocation and Cortex-A8 stub scanning.
5928         (Target_arm::do_relax): Force stubs to be after stubbed sections
5929         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5930         the beginning of a new relaxation pass.  Update a comment.
5931         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5933 2010-01-12  Ian Lance Taylor  <iant@google.com>
5935         * target-reloc.h (visibility_error): New inline function.
5936         (relocate_section): Call visibility_error.
5937         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5938         (MOSTLYCLEANFILES): Likewise.
5939         (protected_4_pic.o, protected_3.err): New targets.
5940         * testsuite/protected_4.cc: New file.
5942 2010-01-12  Doug Kwan  <dougkwan@google.com>
5944         * arm.cc (Cortex_a8_reloc): New class.
5945         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5946         and cortex_a8_relocs_info_.
5947         (Target_arm::fix_cortex_a8): New method definition.
5948         (Target_arm::Cortex_a8_relocs_info): New type.
5949         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5950         New data member declarations.
5951         (Target_arm::scan_reloc_for_stub): Record information about
5952         relocations for THUMB branches that might be exempted from the
5953         Cortex-A8 workaround.
5954         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5955         at the beginning of a relaxation pass.
5957 2010-01-12  Doug Kwan  <dougkwan@google.com>
5959         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5960         (Arm_relobj::Mapping_symbol_position,
5961          Arm_reloj::Mapping_symbol_position_less,
5962          Arm_relobj::Mapping_symbols_info): New types.
5963         (Target_arm::is_mapping_symbol_name): New method definition.
5964         (Arm_relobj::do_count_local_symbols): Save information about mapping
5965         symbols.
5967 2010-01-11  Doug Kwan  <dougkwan@google.com>
5969         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5970         Arm_relocate_functions::thumb32_branch_upper,
5971         Arm_relocate_functions::thumb32_branch_lower,
5972         Arm_relocate_functions::thumb32_cond_branch_offset,
5973         Arm_relocate_functions::thumb32_cond_branch_upper,
5974         Arm_relocate_functions::thumb32_cond_branch_lower,
5975         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5976         branch offset encoding.
5977         (Arm_relocate_functions::thumb_branch_common): Use new branch
5978         offset encoding methods to avoid code duplication.
5979         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5980         (Stub_addend_reader::operator()): Use new branch encoding method
5981         to avoid code duplication.
5983 2010-01-11  Doug Kwan  <dougkwan@google.com>
5985         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5986         (Target_arm::do_finalize_sections): Define special EXIDX section
5987         symbols only if referenced.
5988         * gc.h (Garbage_collection::add_reference): New method.
5989         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5990         code duplication.
5992 2010-01-11  Ian Lance Taylor  <iant@google.com>
5994         * script.cc (Version_script_info::build_expression_list_lookup):
5995         Change complaing about duplicate wildcard match from error to
5996         warning.
5998         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5999         of 2009-12-30.
6000         (Version_script_info::Version_script_info): Initialize globs_,
6001         default_version_, default_is_global_, and exact_.  Don't
6002         initialize globals_ or locals_.
6003         (Version_script_info::build_lookup_tables): Build local symbols
6004         first.
6005         (Version_script_info::unquote): New function.
6006         (Version_script_info::add_exact_match): New function.
6007         (Version_script_info::build_expression_list_lookup): Remove lookup
6008         parameter.  Add is_global parameter.  Change all callers.  Handle
6009         wildcard pattern specially.  Unquote pattern.  Call
6010         add_exact_match.
6011         (Version_script_info::get_name_to_match): New function.
6012         (Version_script_info::get_symbol_version): New function.
6013         (Version_script_info::get_symbol_version_helper): Remove.
6014         (Version_script_info::check_unmatched_names): Call unquote.
6015         * script.h (class Version_script_info): Change get_symbol_version
6016         to be non-inline and add is_global parameter; change all callers.
6017         Rewrite symbol_is_local.  Update declarations.  Define struct
6018         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6019         Remove globals_ and locals_ members.  Add exact_, globs_,
6020         default_version_, is_global_.
6021         (Version_script_info::Glob): Remove pattern, add expression and
6022         is_global.  Update constructor.  Change all callers.
6023         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6024         default version.
6025         (Versions::symbol_section_contents): If a symbol is undefined, or
6026         defined in a dynamic object, set the version index to
6027         VER_NDX_LOCAL.
6028         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6029         symbol_is_local.
6030         (Symbol_table::add_from_pluginobj): Likewise.
6031         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6033 2010-01-11  Doug Kwan  <dougkwan@google.com>
6035         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6036         (incremental_dump_LDADD): Add linking option for libintl.
6037         * Makefile.in: Regenerate.
6039 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6041         PR gold/11144
6042         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6043         instead of -Ds.
6044         * testsuite/Makefile.in: Regenerated.
6046 2010-01-10  Doug Kwan  <dougkwan@google.com>
6048         * options.h (DEFINE_var): Use parentheses around argument varname__
6049         in macro body to avoid any unintended subsequent substitutions.
6051 2010-01-10  Ian Lance Taylor  <iant@google.com>
6053         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6054         candidates before doing symbol resolution.
6056         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6057         ODR candidates if only one is weak.
6059 2010-01-08  Ian Lance Taylor  <iant@google.com>
6061         * script.cc (Version_script_info::build_expression_list_lookup):
6062         Don't warn about ambiguous version, just record the ambiguity.
6063         (Version_script_info::get_symbol_version_helper): Give error if
6064         version is ambiguous.
6066 2010-01-08  Doug Kwan  <dougkwan@google.com>
6068         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6069           prev_data_size_ and prev_addralign_.  Remove initializer for
6070           deleted data member has_been_changed_.
6071           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6072           to determine if the table is empty.
6073           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6074           Remove.
6075           (Stub_table::add_reloc_stub): Define method in class definition
6076           instead of just declaring it there.
6077           (Stub_table::add_cortex_a8_stub): New method definition.
6078           (Stub_table::update_data_size_and_addralign): Ditto.
6079           (Stub_table::finalize_stubs): Ditto.
6080           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6081           (Stub_table::do_addralign_): Return address alignment in the
6082           (Stub_table::do_reset_address_and_file_offset): Define method in
6083           class definition instead of declaring it there.  Set current data
6084           size to be the data size of the previous pass.
6085           (Stub_table::set_final_data_size): Use current data size as the
6086           final data size.
6087           (Stub_table::relocate_stub): Change parameter type of stub from
6088           Reloc_stub pointer to Stub pointer.
6089           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6090           (Stub_table::Cortex_a8_stub_list): New typedef.
6091           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6092            Stub_table::prev_addralign_): New data member.
6093           (Arm_relobj::Arm_relobj): Initialize data member
6094           section_has_cortex_a8_workaround_.
6095           (Arm_relobj::section_has_cortex_a8_workaround,
6096            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6097            definitions.
6098           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6099           declarations.
6100           (Target_arm::relocate_stub): Change parameter type of stub from
6101           Reloc_stub pointer to Stub pointer.
6102           (Insn_template::size, Insn_template::alignment): Handle
6103           THUMB16_SPECIAL_TYPE.
6104           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6105            Stub_table::update_data_size_and_addralign,
6106            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6107           definitions.
6108           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6109           (Stub_table::do_write): Ditto.
6110           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6112 2010-01-08  Ian Lance Taylor  <iant@google.com>
6114         PR 11108
6115         * symtab.h (class Symbol): Remove fields is_target_special_ and
6116         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6117         (Symbol::is_defined_in_discarded_section): New function.
6118         (Symbol::set_is_defined_in_discarded_section): New function.
6119         (Symbol::has_plt_offset): Rewrite.
6120         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6121         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6122         Don't initialize is_target_special_ or has_plt_offset_.
6123         Initialize is_defined_in_discarded_section_.
6124         (Symbol_table::add_from_relobj): If appropriate, set
6125         is_defined_in_discarded_section.
6126         * resolve.cc (Symbol::override_base_with_special): Don't test
6127         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6128         * target-reloc.h (relocate_section): Do special handling for
6129         symbols defined in discarded sections for global symbols as well
6130         as local symbols.
6132 2010-01-08  Ian Lance Taylor  <iant@google.com>
6134         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6135         the SHT_SYMTAB case.
6137 2010-01-08  Ian Lance Taylor  <iant@google.com>
6139         * object.cc (Sized_relobj::do_layout): Don't get confused if
6140         layout_eh_frame returns NULL.
6142 2010-01-08  Ian Lance Taylor  <iant@google.com>
6144         PR 11084
6145         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6146         dynamic symbol table, use the normal symbol table.
6147         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6148         symbol table.
6150 2010-01-08  Ian Lance Taylor  <iant@google.com>
6152         PR 11072
6153         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6154         sections.
6156 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6158         * version.cc (print_version): Change to "Copyright 2010".
6160 2010-01-08  Ian Lance Taylor  <iant@google.com>
6162         PR 10287
6163         PR 11063
6164         * i386.cc (class Target_i386): Change return type of plt_section
6165         to be non-const.
6166         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6167         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6168         tls_desc_rel_ field.
6169         (Output_data_plt_i386::rel_tls_desc): New function.
6170         (Target_i386::rel_tls_desc_section): New function.
6171         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6172         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6173         R_386_TLS_DESC reloc in rel_tls_desc_section.
6174         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6175         Define struct Tlsdesc_info.
6176         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6177         (Target_x86_64::do_reloc_symbol_index): New function.
6178         (Target_x86_64::add_tlsdesc_info): New function.
6179         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6180         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6181         tlsdesc_rel_ field.
6182         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6183         all callers.
6184         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6185         (Target_x86_64::rela_tlsdesc_section): New function.
6186         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6187         handling.
6188         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6189         (Target_x86_64::do_reloc_addend): New function.
6190         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6191         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6192         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6193         (Output_reloc::type): New function.
6194         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6195         (Output_reloc::is_target_specific): New function.
6196         (Output_reloc::target_arg): New function.
6197         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6198         absolute relocs and target specific relocs.
6199         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6200         add_target_specific.
6201         (class Output_data_reloc) [SHT_RELA]: Likewise.
6202         * output.cc (Output_reloc::Output_reloc): Add four new versions
6203         for absolute relocs and target specific relocs.
6204         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6205         (Output_reloc::get_symbol_index): Likewise.
6206         (Output_reloc::local_section_offset): Check that local_sym_index_
6207         is not TARGET_CODE or 0.
6208         (Output_reloc::symbol_value): Likewise.
6209         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6210         reloc.
6211         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6212         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6213         functions.
6214         * layout.cc (add_target_dynamic_tags): Use output section for
6215         DT_PLTRELSZ and DT_JMPREL.
6217 2010-01-07  Ian Lance Taylor  <iant@google.com>
6219         PR 11061
6220         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6221         function.
6222         (class Output_data_reloc_generic): Define.
6223         (class Output_data_reloc_base): Change base class to
6224         Output_data_reloc_generic.  Change add() method to call
6225         bump_relative_reloc_count for a relative reloc.  Remove
6226         sort_relocs_ field.
6227         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6228         to sort_relocs().
6229         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6230         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6231         appropriate.
6232         * layout.h (class Layout): Update declaration.
6234 2010-01-07  Ian Lance Taylor  <iant@google.com>
6236         * output.h (class Output_data): Add const version of
6237         output_section and do_output_section.
6238         (class Output_section_data): Add const version of
6239         do_output_section.
6240         (class Output_section): Likewise.
6241         * layout.cc (Layout::add_target_dynamic_tags): New function.
6242         * layout.h (class Layout): Update declarations.
6243         * arm.cc (Target_arm::do_finalize_sections): Use
6244         add_target_dynamic_tags.
6245         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6246         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6247         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6248         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6250 2010-01-07  Ian Lance Taylor  <iant@google.com>
6252         PR 11042
6253         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6254         object as needed.
6256 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6257             Ian Lance Taylor  <iant@google.com>
6259         PR 11019
6260         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6261         Xindex::read_symtab_xindex.
6263 2010-01-07  Doug Kwan  <dougkwan@google.com>
6265         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6266         (Insn_template::thumb16_bcond_insn): New method declaration.
6267         (Insn_template): Fix spelling.
6268         (Stub::thumb16_special): New method declaration.
6269         (Stub::do_write): Define virtual method which was previously pure
6270         virtual.
6271         (Stub::do_thumb16_special): New method declaration.
6272         (Stub::do_fixed_endian_write): New template member.
6273         (Reloc_stub::do_write): Remove.
6274         (Reloc_stub::do_fixed_endian_write): Remove.
6275         (Cortex_a8_stub): New class definition.
6276         (Stub_factory::make_cortex_a8_stub): New method definition.
6277         (Stub_factory::Stub_factory): Add missing static storage class
6278         qualifier for elf32_arm_stub_a8_veneer_blx.
6280 2010-01-07  Ian Lance Taylor  <iant@google.com>
6282         PR 10980
6283         * options.h (class General_options): Add --warn-unresolved-symbols
6284         and --error-unresolved-symbols.
6285         * errors.cc (Errors::undefined_symbol): Implement
6286         --warn-unresolved-symbols.
6288         * options.h (class General_options): Add -z text and -z textoff.
6289         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6291 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6293         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6294         (Garbage_collection::cident_sections): New function.
6295         (Garbage_collection::add_cident_section): New function.
6296         (Garbage_collection::cident_sections_): New member.
6297         (gc_process_relocs): Add references to sections whose names are C
6298         identifiers.
6299         * gold.h (cident_section_start_prefix): New constant.
6300         (cident_section_stop_prefix): New constant.
6301         (is_cident): New function.
6302         * layout.cc (Layout::define_section_symbols): Replace string constants
6303         with the newly defined constants.
6304         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6305         C identifiers.
6306         * testsuite/Makefile.am: Add gc_orphan_section_test.
6307         * testsuite/Makefile.in: Regenerate.
6308         * testsuite/gc_orphan_section_test.cc: New file.
6309         * testsuite/gc_orphan_section_test.sh: New file.
6311 2010-01-06  Ian Lance Taylor  <iant@google.com>
6313         PR 10980
6314         * options.h (class General_options): Add --warn-shared-textrel.
6315         * layout.cc (Layout::finish_dynamic_section): Implement
6316         --warn-shared-textrel.
6318         PR 10980
6319         * options.h (class General_options): Add --warn-multiple-gp.
6321 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6323         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6324         $(THREADSLIB) and $(LIBDL).
6325         * Makefile.in: Rebuild.
6327 2010-01-06  Ian Lance Taylor  <iant@google.com>
6329         PR 10980
6330         * options.cc (General_options::parse_section_start): New function.
6331         (General_options::section_start): New function.
6332         (General_options::General_options): Initialize all members.
6333         * options.h: Include <map>
6334         (class General_options): Add --section-start.  Add section_starts_
6335         member.
6336         * layout.cc (Layout::attach_allocated_section_to_segment): If
6337         --section-start was used, set the address of the segment.  Remove
6338         local sort_sections.
6339         (Layout::relaxation_loop_body): If the address of the load segment
6340         has been set by --section-start, don't use it.
6341         * output.h (Output_segment::update_flags_for_output_section): New
6342         function.
6343         * output.cc (Output_segment::add_output_section): Call
6344         update_flags_for_output_section.
6346 2010-01-05  Ian Lance Taylor  <iant@google.com>
6348         PR 10980
6349         * options.h (class General_options): Add --undefined-version.
6350         * script.cc (struct Version_expression): Add was_matched_by_symbol
6351         field.
6352         (Version_script_info::matched_symbol): New function.
6353         (Version_script_info::get_symbol_version_helper): Call
6354         matched_symbol.
6355         (Version_script_info::check_unmatched_names): New function.
6356         * script.h (class Version_script_info): Update declarations.
6357         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6359         * options.h (class General_options): Use DEFINE_bool_alias for
6360         allow_multiple_definition.
6361         * resolve.cc (Symbol_table::should_override): Don't test
6362         allow_multiple_definition.
6364         PR 10980
6365         * options.h (class General_options): Add --cref.
6366         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6367         until after printing cref table.
6368         * cref.cc: Include "symtab.h".
6369         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6370         (Cref_table_compare::operator()): New function.
6371         (Cref_inputs::gather_cref): New function.
6372         (filecol): New static const.
6373         (Cref_inputs::print_cref): New function.
6374         (Cref::print_cref): New function.
6375         * cref.h: Include <cstdio>.
6376         (class Cref): Update declarations.
6377         * mapfile.h (Mapfile::file): New function.
6378         * object.h (class Object): Define Symbols.  Declare virtual
6379         do_get_global_symbols.
6380         (Object::get_global_symbols): New function.
6381         * object.cc (Input_objects::add_object): Pass object to cref_ if
6382         --cref.
6383         (Input_objects::archive_start): Likewise.
6384         (Input_objects::archive_stop): Likewise.
6385         (Input_objects::print_cref): New function.
6386         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6387         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6388         --cref.
6389         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6390         function.
6391         * plugin.h (class Sized_pluginobj): Update declarations.
6393 2010-01-05  Ian Lance Taylor  <iant@google.com>
6395         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6396         to is_default_version.  Rename insdef to insdefault.
6397         (Symbol_table::add_from_relobj): Rename def to is_default_version
6398         and local to is_forced_local.
6399         (Symbol_table::add_from_pluginobj): Likewise.
6400         (Symbol_table::add_from_dynobj): Likewise.
6401         (Symbol_table::define_special_symbol): Rename insdef to
6402         insdefault.
6404 2010-01-04  Ian Lance Taylor  <iant@google.com>
6406         PR 10980
6407         * options.h (class General_options): Add
6408         --allow-multiple-definition and -z muldefs.
6409         * resolve.cc (Symbol_table::should_override): Don't warn about a
6410         multiple symbol definition if --allow-multiple-definition or -z
6411         muldefs.
6413         PR 10980
6414         * options.h (class General_options): Add --add-needed and
6415         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6416         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6417         error if --copy-dt-needed-entries aka --add-needed is used and
6418         would cause a change in behaviour.
6420         PR 10980
6421         * options.h (class General_options): Add -G as a short version of
6422         --shared.  Add no-op options -assert, -g, and -i.
6424 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6426         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6427         check for .text or .gnu.linkonce.t sections.
6428         * icf.cc (Icf::find_identical_sections): Ditto.
6429         Change the detection for mangled function name within the section
6430         name.
6431         * icf.h (is_section_foldable_candidate): New function.
6433 2009-12-30  Ian Lance Taylor  <iant@google.com>
6435         PR 10980
6436         * options.h (class General_options): Permit two dashes with
6437         --retain-symbols-file.
6439 2009-12-30  Ian Lance Taylor  <iant@google.com>
6441         PR 10979
6442         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6443         don't put the file header and segment headers in the text
6444         segment.
6446         PR 10979
6447         * common.cc (Sort_commons::operator()): Stabilize sort when both
6448         entries are NULL.
6449         (Symbol_table::do_allocate_commons_list): When allocating common
6450         symbols, skip a symbol which is no longer common.
6451         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6452         an object before checking its type.
6453         * testsuite/common_test_2.c: New file.
6454         * testsuite/common_test_3.c: New file.
6455         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6456         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6457         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6458         (common_test_2_pic.o, common_test_2.so): New targets.
6459         (common_test_3_pic.o, common_test_3.so): New targets.
6460         * testsuite/Makefile.in: Rebuild.
6462         PR 10979
6463         * script.cc (read_input_script): If we see a new SECTIONS clause,
6464         and we have added an input section, give an error.
6465         * layout.h (class Layout): Add have_added_input_section function.
6466         Add have_added_input_section_ field.
6467         * layout.cc (Layout::Layout): Initialize
6468         have_added_input_section_.
6469         (Layout::layout): Set have_added_input_section_.
6470         (Layout::layout_eh_frame): Likewise.
6472 2009-12-30  Ian Lance Taylor  <iant@google.com>
6474         PR 10931
6475         * options.h (class General_options): Add --sort-common option.
6476         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6477         * common.cc (Sort_common): Add sort_order parameter to
6478         constructor.  Add sort_order_ field.
6479         (Sort_commons::operator): Check sort_order_.
6480         (Symbol_table::allocate_commons): Determine the sort order.
6481         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6482         Change all callers.
6483         (Symbol_table::do_allocate_commons_list): Likewise.
6485 2009-12-30  Ian Lance Taylor  <iant@google.com>
6487         PR 10916
6488         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6489         symbols from this object, don't change the visibility of an
6490         undefined symbol.
6491         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6493 2009-12-30  Ian Lance Taylor  <iant@google.com>
6495         PR 10861
6496         * script.h (class Version_script_info): Define Language enum.
6497         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6498         new fields globals_, locals_, and is_finalized_.
6499         * script.cc: Various formatting fixes.
6500         (class Parser_closure): Change language_stack_ from a vector of
6501         std::string to one of Version_script_info::Language.  Adjust all
6502         uses accordingly.
6503         (class Lazy_demangler): Remove.
6504         (struct Version_expression): Change language from std::string to
6505         Version_script_info::Language.
6506         (Version_script_info::Version_script_info): New function.
6507         (Version_script_info::~Version_script_info): Don't call clear.
6508         (Version_script_info::finalize): New function.
6509         (Version_script_info::build_lookup_tables): New function.
6510         (Version_script_info::build_expression_list_lookup): New
6511         function.
6512         (Version_script_info::get_symbol_version_helper): Rewrite to use
6513         lookup tables.
6514         (Version_script_info::print_expression_list): Adjust to use
6515         Version_script_info::Language.
6516         (script_push_lex_into_version_mode): Check that the version script
6517         has not been finalized.
6518         (version_script_push_lang): Change language string to
6519         Version_script_info::Language.
6520         * options.cc (Command_line::version_script): New function.
6521         * options.h (class General_options): Add finalize_dynamic_list
6522         function.  Change version_script from declaration to definition.
6523         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6524         * testsuite/version_script.map: Remove duplicate def of foo.
6525         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6526         version_script.map.
6527         * testsuite/Makefile.in: Rebuild.
6529 2009-12-30  Ian Lance Taylor  <iant@google.com>
6531         PR 10843
6532         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6533         if the input symbol index is 0, make the output symbol index 0.
6535 2009-12-30  Ian Lance Taylor  <iant@google.com>
6537         PR 10670
6538         * options.h (class General_options): Add -x/--discard-all.
6539         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6540         --discard-all.  If the local symbol needs a dynamic entry, check
6541         that before handling --discard-locals.
6543 2009-12-30  Ian Lance Taylor  <iant@google.com>
6545         PR 10450
6546         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6547         flags to PF_R.
6548         (Output_segment::add_output_section): Don't change the flags if
6549         the type is PT_TLS.
6551         PR 10450
6552         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6553         GNU hash table if they need a dynamic value.  Otherwise, don't add
6554         them if they are defined in a dynamic object or are forced local.
6556 2009-12-29  Ian Lance Taylor  <iant@google.com>
6558         PR 10450
6559         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6560         .gnu.hash table for a 32-bit target.
6562         PR 10450
6563         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6564         regular and a dynamic object only needs a dynamic symbol table
6565         entry if it is externally visible.
6567         PR 10450
6568         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6569         constructor.  Add global_offset_table_ field.
6570         (Target_i386::got_section): Set global_offset_table_.
6571         (Target_i386::do_finalize_sections): Set global_offset_table_
6572         size.
6573         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6574         in constructor.  Add global_offset_table_ field.
6575         (Target_x86_64::got_section): Set global_offset_table_.
6576         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6577         size.
6579         * layout.cc (Layout::Layout): Initialize increase_relro_.
6580         (Layout::get_output_section): Add is_relro, is_last_relro, and
6581         is_first_non_relro parameters.  Change all callers.
6582         (Layout::choose_output_section): Likewise.
6583         (Layout::add_output_section_data): Likewise.
6584         (Layout::make_output_section): Likewise.
6585         (Layout::set_segment_offsets): Clear increase_relro when using a
6586         linker script.
6587         * layout.h (class Layout): Add increase_relro method.  Add
6588         increase_relro_ field.  Update declarations.
6589         * output.cc (Output_section::Output_section): Initialize
6590         is_last_relro_ and is_first_non_relro_.
6591         (Output_segment::add_output_section): Group relro sections is
6592         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6593         (Output_segment::maximum_alignment): Remove relro handling.
6594         (Output_segment::set_section_addresses): Add increase_relro
6595         parameter.  Change all callers.  Add initial alignment to align
6596         relro sections on separate page.  Remove old relro handling.
6597         (Output_segment::set_section_list_addresses): Remove in_relro
6598         parameter.  Change all callers.
6599         (Output_segment::set_offset): Add increase parameter.  Change all
6600         callers.  Remove old relro handling.
6601         * output.h (class Output_section): Add new methods: is_last_relro,
6602         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6603         Add is_last_relro_ and is_first_non_relro_ fields.
6604         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6605         Create separate .got.plt section.  Call increase_relro.
6606         * x86_64.cc (Target_x86_64::got_section): Likewise.
6607         * testsuite/relro_script_test.t: Add .got.plt.
6609         PR 10450
6610         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6611         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6612         (Layout::finalize): Call set_dynamic_symbol_size.
6613         (Layout::set_dynamic_symbol_size): New function.
6614         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6615         set_dynamic_symbol_size.
6617         PR 10450
6618         * output.h (class Output_section): Add is_entsize_zero_ field.
6619         * output.cc (Output_section::Output_section): Initialize
6620         is_entsize_zero_.
6621         (Output_section::set_entsize): If two different entsizes are
6622         requested, force it to zero.
6623         (Output_section::add_input_section): Set flags for .debug_str
6624         before updating section flags.  Set entsize.
6625         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6626         and SHF_STRING if all input sections have those flags.
6628 2009-12-29   Rafael Espindola  <espindola@google.com>
6630         * main.cc (main): Fix the sys time reporting.
6631         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6632         reporting.
6634 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6636         * options.cc (General_options::parse_version): Allow -v to exit
6637         without an error if there is nothing to link.
6639 2009-12-29  Ian Lance Taylor  <iant@google.com>
6641         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6642         using a version of gcc before 4.1.
6643         * configure: Rebuild.
6645 2009-12-28  Chris Demetriou  <cgd@google.com>
6647         * attributes.cc (Output_attributes_section_data::do_write): Use
6648         std::vector::front rather than std::vector::data.
6650 2009-12-28  Ian Lance Taylor  <iant@google.com>
6652         * symtab.h (class Symbol_table): Add enum Defined.
6653         * resolve.cc (Symbol_table::should_override): Add defined
6654         parameter.  Change all callers.  Test whether object is NULL
6655         before calling a method on it.
6656         (Symbol_table::report_resolve_problem): Add defined parameter.
6657         Change all callers.
6658         (Symbol_table::should_override_with_special): Likewise.
6659         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6660         parameter.  Change all callers.
6661         (Symbol_table::do_define_in_output_data): Likewise.
6662         (Symbol_table::define_in_output_segment): Likewise.
6663         (Symbol_table::do_define_in_output_segment): Likewise.
6664         (Symbol_table::define_as_constant): Likewise.
6665         (Symbol_table::do_define_as_constant): Likewise.
6666         * script.h (class Symbol_assignment): Add is_defsym parameter to
6667         constructor; change all callers.
6668         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6669         parameter.  Change all callers.  Add is_defsym_ field.
6670         (class Parser_closure): Add parsing_defsym parameter to
6671         constructor; change all callers.  Add parsing_defsym accessor
6672         function.  Add parsing_defsym_ field.
6674 2009-12-28  Ian Lance Taylor  <iant@google.com>
6676         * gold.cc (queue_middle_tasks): Fix formatting.
6677         * object.cc (Relobj::is_section_name_included): Likewise.
6679 2009-12-23  Ian Lance Taylor  <iant@google.com>
6681         * i386.cc (Target_i386::do_calls_non_split): Recognize
6682         -fsplit-stack prologue for a function with a static chain.
6683         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6684         -fsplit-stack prologue when using %r11.
6686 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6688         * options.cc (General_options::parse_version): Make -v continue and do
6689         the link like GNU ld does.
6691 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6693         * Makefile.am (CCFILES): Add timer.cc.
6694         (HFILES): Add timer.h.
6695         * configure.ac: Check for sysconf and times.
6696         * main.cc: include timer.h.
6697         (main): Use Timer instead of get_run_time.
6698         * timer.cc: New.
6699         * timer.h: New.
6700         * workqueue.cc: include timer.h.
6701         (Workqueue::find_and_run_task):
6702         Report user, sys and wall time.
6703         * Makefile.in: Regenerate.
6704         * config.in: Regenerate.
6705         * configure: Regenerate.
6707 2009-12-16  Doug Kwan  <dougkwan@google.com>
6709         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6710         sections.
6711         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6712         relaxed input sections.
6713         * output.cc (Output_section::find_relaxed_input_section): Change
6714         return type to Output_relaxed_input_section pointer.  Adjust code
6715         for new type of relaxed_input_section_map_.
6716         * output.h (Output_section::find_relaxed_input_section): Change
6717         return type to Output_relaxed_input_section pointer.
6718         (Output_section::Output_relaxed_input_section_by_input_section_map):
6719         New type.
6720         (Output_section::relaxed_input_section_map_): Change type to
6721         Output_section::Output_relaxed_input_section_by_input_section_map.
6722         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6723         input section.
6725 2009-12-15  Ian Lance Taylor  <iant@google.com>
6727         * layout.cc (Layout::create_shstrtab): Only write out after input
6728         sections if we are compressing debug sections.
6730 2009-12-15  Ian Lance Taylor  <iant@google.com>
6732         * archive.cc (Archive::add_symbols): Only look up a symbol without
6733         a version if there is, in fact, a version.
6735 2009-12-14  Ian Lance Taylor  <iant@google.com>
6737         Revert -Wshadow changes, all changes from:
6738         2009-12-11  Doug Kwan  <dougkwan@google.com>
6739         2009-12-11  Nick Clifton  <nickc@redhat.com>
6740         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6742 2009-12-11  Doug Kwan  <dougkwan@google.com>
6744         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6745         due to -Wshadow.
6746         * attributes.cc (Object_attribute::size): Ditto.
6747         (Attributes_section_data::size): Ditto.
6748         (Attributes_section_data::Attributes_section_data): Ditto.
6749         (Output_attributes_section_data::do_write): Ditto.
6750         * attributes.h (Object_attribute::set_type): Ditto.
6751         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6753 2009-12-11  Nick Clifton  <nickc@redhat.com>
6755         * archive.cc: Fix shadowed variable warnings.
6756         * arm.cc: Likewise.
6757         * compressed_output.cc: Likewise.
6758         * compressed_output.h: Likewise.
6759         * configure: Likewise.
6760         * dwarf_reader.cc: Likewise.
6761         * dynobj.cc: Likewise.
6762         * dynobj.h: Likewise.
6763         * ehframe.cc: Likewise.
6764         * ehframe.h: Likewise.
6765         * errors.cc: Likewise.
6766         * expression.cc: Likewise.
6767         * fileread.cc: Likewise.
6768         * fileread.h: Likewise.
6769         * freebsd.h: Likewise.
6770         * i386.cc: Likewise.
6771         * icf.cc: Likewise.
6772         * incremental.h: Likewise.
6773         * layout.cc: Likewise.
6774         * layout.h: Likewise.
6775         * mapfile.cc: Likewise.
6776         * merge.cc: Likewise.
6777         * merge.h: Likewise.
6778         * object.cc: Likewise.
6779         * object.h: Likewise.
6780         * options.h: Likewise.
6781         * output.cc: Likewise.
6782         * output.h: Likewise.
6783         * parameters.cc: Likewise.
6784         * plugin.cc: Likewise.
6785         * powerpc.cc: Likewise.
6786         * reduced_debug_output.cc: Likewise.
6787         * reduced_debug_output.h: Likewise.
6788         * reloc.cc: Likewise.
6789         * reloc.h: Likewise.
6790         * resolve.cc: Likewise.
6791         * script-sections.cc: Likewise.
6792         * script.cc: Likewise.
6793         * script.h: Likewise.
6794         * sparc.cc: Likewise.
6795         * symtab.cc: Likewise.
6796         * symtab.h: Likewise.
6797         * target-select.cc: Likewise.
6798         * target-select.h: Likewise.
6799         * token.h: Likewise.
6800         * workqueue.cc: Likewise.
6801         * workqueue.h: Likewise.
6802         * x86_64.cc: Likewise.
6804 2009-12-10  Doug Kwan  <dougkwan@google.com>
6806         * arm.cc (attributes.h): New include.
6807         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6808         (Arm_relobj::~Arm_relobj): Delete object pointed by
6809         attributes_section_data_.
6810         (Arm_relobj::attributes_section_data): New method definition.
6811         (Arm_relobj::attributes_section_data_): New data member declaration.
6812         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6813         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6814         attributes_section_data_.
6815         (Arm_dynobj::attributes_section_data): New method definition.
6816         (Arm_dynobj::attributes_section_data_): New data member declaration.
6817         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6818         initialization value of may_use_blx_ to false.
6819         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6820         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6821         object attributes to compute results instead of hard-coding.
6822         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6823         Target_arm::get_secondary_compatible_arch,
6824         Target_arm::set_secondary_compatible_arch
6825         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6826         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6827         New method declarations.
6828         (Target_arm::get_aeabi_object_attribute): New method definition.
6829         (Target_arm::attributes_section_data_): New data member declaration.
6830         (read_arm_attributes_section): New template definition.
6831         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6832         (Arm_dynobj::do_read_symbols): Ditto.
6833         (Target_arm::do_finalize_sections): Merge attributes sections from
6834         input.  Check for BLX use after attributes section merging.
6835         Fix __exidx_start and __exidx_end visibility.  Create an
6836         .ARM.attributes section if necessary.
6837         (Target_arm::get_secondary_compatible_arch,
6838         Target_arm::set_secondary_compatible_arch,
6839         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6840         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6841         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6842         New method definitions.
6844 2009-12-09  Ian Lance Taylor  <iant@google.com>
6846         * plugin.cc (Plugin::load): Don't cast from void* to a function
6847         pointer.
6849 2009-12-09  Ian Lance Taylor  <iant@google.com>
6851         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6852         information fields.
6854 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6856         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6857         Replace two_file_shared_1.so with two_file_shared_2.so.
6858         * testsuite/Makefile.in: Regenerated.
6860 2009-12-08  Doug Kwan  <dougkwan@google.com>
6862         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6863         (HFILES): Add attributes.h and int_encoding.h.
6864         * Makefile.in: Regenerate.
6865         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6866         function definitions to int_encoding.cc
6867         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6868         prototypes to int_encoding.h
6869         * reduced_debug_output.cc (int_encoding.h): New include.
6870         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6871         function definitions to int_encoding.cc
6872         (insert_into_vector, read_from_pointer): Move template definitions to
6873         int_encoding.h
6874         * attributes.cc: New file.
6875         * attributes.h: New file.
6876         * int_encoding.cc: New file.
6877         * int_encoding.h: New file.
6879 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6881         PR gold/11055
6882         * incremental-dump.cc (dump_incremental_inputs): New.
6883         (main): Use dump_incremental_inputs.
6885 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6887         PR gold/10893
6888         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6889         checking elfcpp::STT_FUNC.
6890         (Target_i386::Relocate::relocate): Likewise.
6891         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6893         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6894         symbols from shared libraries into normal FUNC symbols.
6896         * symtab.h (Symbol): Add is_func and use it.
6898 2009-12-05  Doug Kwan  <dougkwan@google.com>
6900         * arm.cc (Target_arm::arm_info): Initialize new fields
6901         attributes_section and attributes_vendor.
6902         * i386.cc (Target_i386::i386_info): Same.
6903         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6904         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6905         fields attributes_section and attributes_vendor.
6906         * sparc.cc (Target_sparc::sparc_info): Same.
6907         * target.h (Target::attributes_section, Target::attributes_vendor,
6908         Target::is_attributes_section, Target::attribute_arg_type,
6909         Target::attributes_order): New method definitions.
6910         (Target::Target_info::attributes_section,
6911         Target::Target_info::attributes_vendor): New fields.
6912         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6913         virtual method definitions.
6914         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6915         attributes_section and attributes_vendor.
6916         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6918 2009-12-05  Doug Kwan  <dougkwan@google.com>
6920         * arm.cc: Update comments about interworking and stub generation.
6921         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6922         considered as non-PIC.
6923         (Arm_relocate_functions::base_abs): Fix formatting.
6924         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6925         of function to use GOT entry address instead of offset.
6926         (Target_arm::Scan::global): Issue an error if a symbol would need a
6927         PLT does not get one because it is untyped.  Remove code to create
6928         dynamic symbols for relative branches.
6929         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6930         takes unsigned integer instead of boolean.
6932 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6934         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6935         (two_file_test_LDADD): Likewise.
6936         (common_test_1_LDADD): Likewise.
6937         (exception_test_LDADD) Likewise.
6938         (weak_test_LDADD): Likewise.
6939         (many_sections_test_LDADD): Likewise.
6940         (initpri1_LDADD): Likewise.
6941         (script_test_1_LDADD): Likewise.
6942         (script_test_2_LDADD): Likewise.
6943         (justsyms_LDADD): Likewise.
6944         (binary_test_LDADD): Likewise.
6945         (large_LDADD): Likewise.
6946         * testsuite/Makefile.in: Regenerated.
6948 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6950         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6951         (Symbol_table::override_with_special): Likewise.
6952         (Symbol_table::add_from_object): Likewise.
6954 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6956         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6957         Don't set the data_offset twice.
6959 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6961         * testsuite/Makefile.in: Regenerate.
6963 2009-12-03  Doug Kwan  <dougkwan@google.com>
6965         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6966         (Target_arm::do_finalize_sections): Add parameter for symbol table
6967         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6968         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6969         parameter for symbol table pointer.
6970         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6971         an additional parameter for a pointer to symbol table.
6972         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6973         parameter for a symbol table pointer.
6974         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6975         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6976         Ditto.
6977         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6978         parameter for a symbol table pointer.
6980 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6982         * incremental.cc (Incremental_inputs_header)
6983         (Incremental_inputs_header_write, Incremental_inputs_entry)
6984         (Incremental_inputs_entry_write): Move ...
6985         * incremental.h (Incremental_inputs_header)
6986         (Incremental_inputs_header_write, Incremental_inputs_entry)
6987         (Incremental_inputs_entry_write): here.
6989 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6991         * incremental.cc (make_sized_incremental_binary): Set the target.
6992         Error if it is incompatible.
6993         * output.h (Output_file): Add filename method.
6995 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6997         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6998         from the get_* methods.
7000 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7002         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7003         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7004         Write 0 for the data_offset of scripts.
7006 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7008         * testsuite/Makefile.am: Add the incremental_test.sh test.
7009         * testsuite/incremental_test.sh: New.
7010         * testsuite/incremental_test_1.c: New.
7011         * testsuite/incremental_test_2.c: New.
7013 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7015        * incremental-dump.cc (main): Fix typos.
7017 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7019         PR gold/11025
7020         * incremental-dump.cc (main): Use llu to print 64 bit values.
7022 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7023             H.J. Lu  <hongjiu.lu@intel.com>
7025         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7026         $(LIBDL).
7027         (incremental_dump_LDADD): Likewise.
7028         * Makefile.in: Regenerated.
7030 2009-11-25  Doug Kwan  <dougkwan@google.com>
7032         Revert:
7034         2009-11-25  Doug Kwan  <dougkwan@google.com>
7036                 * arm.cc (Target_arm::Target_arm): Move method definition
7037                 outside of class definition.  Add code to handle
7038                 --target1-rel, --target1-abs and --target2= options.
7039                 (Target_arm::get_reloc_reloc_type): Change method to be
7040                 non-static and const.
7041                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7042                 New data member declaration.
7043                 (Target_arm::Scan::local, Target_arm::Scan::global,
7044                 Target_arm::Relocate::relocate,
7045                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7046                 Adjust call to Target_arm::get_real_reloc_type.
7047                 (Target_arm::get_real_reloc_type): Use command line options
7048                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7049                 * options.h (--target1-rel, --target1-abs, --target2): New
7050                 ARM-only options.
7052 2009-11-25  Doug Kwan  <dougkwan@google.com>
7054         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7055         class definition.  Add code to handle --target1-rel, --target1-abs
7056         and --target2= options.
7057         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7058         and const.
7059         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7060         member declaration.
7061         (Target_arm::Scan::local, Target_arm::Scan::global,
7062         Target_arm::Relocate::relocate,
7063         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7064         call to Target_arm::get_real_reloc_type.
7065         (Target_arm::get_real_reloc_type): Use command line options to
7066         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7067         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7068         options.
7070 2009-11-25  Doug Kwan  <dougkwan@google.com>
7072         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7073         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7074         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7075         formatting.
7076         (Arm_relocate_functions::thm_call): Replace body with a call to
7077         Arm_relocate_functions::thumb_branch_common.
7078         (Arm_relocate_functions::thm_jump24,
7079         Arm_relocate_functions::thm_xpc22): New method definitions.
7080         (Arm_relocate_functions::thumb_branch_common): New method definition.
7081         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7082         operator.
7083         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7084         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7086 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7088         * Makefile.am: Build incremental-dump
7089         * Makefile.in: Regenerate.
7090         * incremental-dump.cc: New.
7091         * incremental.cc (Incremental_inputs_header_data,
7092         Incremental_inputs_entry_data): Move to incremental.h
7093         * incremental.h: (Incremental_inputs_header_data,
7094         Incremental_inputs_entry_data): Move from incremental.cc
7096 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7098         * incremental.cc (Incremental_inputs_header,
7099         Incremental_inputs_header_write, Incremental_inputs_entry,
7100         Incremental_inputs_entry_write): Add a typedef with the data type.
7102 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7104         * incremental.cc (Incremental_inputs_header,
7105         Incremental_inputs_header_write, Incremental_inputs_entry,
7106         Incremental_inputs_entry_write): Update comment about which
7107         type has the filed descriptions.
7109 2009-11-15  Doug Kwan  <dougkwan@google.com>
7111         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7112         (Arm_relocate_functions::arm_branch_common): Change method defintion
7113         in class definition to a method declaration and update list of formal
7114         parameters.
7115         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7116         Arm_relocation_functions::jump24): Adjust call to
7117         Arm_relocate_functions::arm_branch_common.  Update list of formal
7118         parameters.
7119         (Arm_relocate_functions::xpc25): New method definition.
7120         (Arm_relocate_functions::arm_branch_common): Move method defintion
7121         out from class definition.  Use stubs for mode-switching and extending
7122         branch ranges.
7123         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7124         specially.  Change code to enable use of stubs in ARM branches.
7126 2009-11-10  Doug Kwan  <dougkwan@google.com>
7128         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7129         in method declaration.
7130         (Target_arm::relocate_stub): New method declaration.
7131         (Target_arm::default_target): Change to return a pointer instead of
7132         a const reference.
7133         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7134         Target_arm::default_target.
7135         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7136         method definition.
7137         (Target_arm::relocate_section): Adjust view.
7138         (Target_arm::relocate_stub): New method definition.
7140 2009-11-10  Doug Kwan  <dougkwan@google.com>
7142         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7143         a format warning.
7144         * incremental.cc (open_incremental_binary): Initialized local
7145         variables to avoid warnings.
7146         * object.cc (make_elf_object): Ditto.
7147         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7148         a format warning.
7150 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7152         PR gold/10930
7153         * testsuite/plugin_test.c: Include "config.h".
7155 2009-11-09  Doug Kwan  <dougkwan@google.com>
7157         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7158         (arm_symbol_value): Remove.
7159         (Arm_relocate_functions::arm_branch_common,
7160         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7161         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7162         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7163         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7164         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7165         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7166         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7167         Arm_relocate_functions::thm_mobw_abs_nc,
7168         Arm_relocate_functions::thm_mov_abs,
7169         Arm_relocate_functions::movw_prel_nc,
7170         Arm_relocate_functions::thm_movt_abs,
7171         Arm_relocate_functions::movt_prel,
7172         Arm_relocate_functions::thm_movw_prel_nc,
7173         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7174         (Target_arm::Relocate::relocate): Only decompose address into two
7175         parts if relocation type uses the thumb-bit and pass the actual
7176         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7177         calls to methods in Arm_relocate_functions for this change.
7179 2009-11-08  Ian Lance Taylor  <iant@google.com>
7181         PR 10925
7182         * reloc.cc: Instantiate
7183         Sized_relobj::initialize_input_to_output_maps and
7184         Sized_relobj:free_input_to_output_maps.
7186 2009-11-06  Ian Lance Taylor  <iant@google.com>
7188         PR 10876
7189         * defstd.cc (in_segment): Set only_if_ref true for "end".
7191 2009-11-06  Doug Kwan  <dougkwan@google.com>
7193         * arm.cc (class Reloc_stub): Correct a comment.
7194         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7195         (Target_arm::scan_section_for_stubs): New method declaration.
7196         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7197         Change methods from private to protected.
7198         (Target_arm::do_may_relax): New method definition.
7199         (Target_arm::do_relax, Target_arm::group_sections,
7200         Target_arm::scan_reloc_for_stub,
7201         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7202         (Target_arm::arm_input_section_map_): New data member declaration.
7203         (Target_arm::scan_reloc_for_stub,
7204         Target_arm::scan_reloc_section_for_stubs,
7205         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7206         Target_arm::do_relax): New method definitions.
7208 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7210         * configure.ac: Check for (struct stat)::st_mtim
7211         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7212         * config.in: Regenerate.
7213         * configure: Regenerate.
7215 2009-11-05  Ian Lance Taylor  <iant@google.com>
7217         PR 10910
7218         * output.cc (Output_segment::add_output_section): Add missing
7219         return statement.
7221 2009-11-04  Ian Lance Taylor  <iant@google.com>
7223         PR 10880
7224         * object.h (class Object): Add is_needed and set_is_needed
7225         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7226         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7227         defined in a dynamic object and referenced by a regular object,
7228         set is_needed for the dynamic object.
7229         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7230         if the file is marked with as_needed and it is not needed.
7232 2009-11-04  Ian Lance Taylor  <iant@google.com>
7234         PR 10887
7235         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7236         tags if data is discarded by linker script.
7237         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7238         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7239         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7240         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7242 2009-11-04  Ian Lance Taylor  <iant@google.com>
7244         * layout.cc (Layout::get_output_section): Add is_interp and
7245         is_dynamic_linker_section parameters.  Change all callers.
7246         (Layout::choose_output_section): Likewise.
7247         (Layout::make_output_section): Likewise.
7248         (Layout::add_output_section_data): Add is_dynamic_linker_section
7249         parameter.  Change all callers.
7250         * layout.h (class Layout): Update declarations.
7251         * output.h (class Output_section): Add is_interp, set_is_interp,
7252         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7253         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7254         generate_code_fills_at_write_ to a bitfield.
7255         * output.cc (Output_section::Output_sections): Initialize new
7256         fields.
7257         (Output_segment::add_output_section): Add do_sort parameter.
7258         Change all callers.
7260 2009-11-03  Ian Lance Taylor  <iant@google.com>
7262         PR 10860
7263         * options.h (class General_options): Add --warn-common.
7264         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7265         merging two common symbols.
7266         (Symbol_table::should_override): Handle --warn-common when merging
7267         a common symbol with a defined symbol.  Use report_resolve_problem
7268         for multiple definitions.
7269         (Symbol_table::report_resolve_problem): New function.
7270         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7272 2009-11-03  Doug Kwan  <dougkwan@google.com>
7274         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7275         stub_factory_.
7276         (Target_arm::stub_factory): New method definition.
7277         (Target_arm::new_arm_input_section,
7278         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7279         Target_arm::reloc_uses_thumb_bit): New method declarations.
7280         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7281         New type definitions.
7282         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7283         member declarations.
7284         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7285         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7286         New method definitions.
7288 2009-11-03  Ian Lance Taylor  <iant@google.com>
7290         * options.h (class General_options): Add --warn_constructors.
7292 2009-11-03  Ian Lance Taylor  <iant@google.com>
7294         PR 10893
7295         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7296         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7298 2009-11-03  Ian Lance Taylor  <iant@google.com>
7300         PR 10895
7301         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7302         --msgid-bugs-address.
7303         (install-pdf): New target.
7304         (install-data_yes): Look up one directory to find mkinstalldirs.
7306 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7308         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7309         tree.
7311 2009-10-30  Doug Kwan  <dougkwan@google.com>
7313         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7315 2009-10-30  Doug Kwan  <dougkwan@google.com>
7317         * arm.cc (Stub_addend_reader): New struct template definition
7318         and partial specializations.
7319         (Stub_addend_reader::operator()): New method definition for a
7320         partially specialized template.
7322 2009-10-30  Doug Kwan  <dougkwan@google.com>
7324         * arm.cc (Arm_relobj::processor_specific_flags): New method
7325         definition.
7326         (Arm_relobj::do_read_symbols): New method declaration.
7327         (Arm_relobj::processor_specific_flags_): New data member declaration.
7328         (Arm_dynobj): New class definition.
7329         (Target_arm::do_finalize_sections): Add input_objects parameter.
7330         (Target_arm::do_adjust_elf_header): New method declaration.
7331         (Target_arm::are_eabi_versions_compatible,
7332         (Target_arm::merge_processor_specific_flags): New method declaration.
7333         (Target_arm::do_make_elf_object): New overloaded method definitions
7334         and declaration.
7335         (Arm_relobj::do_read_symbols): New method definition.
7336         (Arm_dynobj::do_read_symbols): Ditto.
7337         (Target_arm::do_finalize_sections): Add input_objects parameters.
7338         Merge processor-specific flags from all input objects.
7339         (Target_arm::are_eabi_versions_compatible,
7340         Target_arm::merge_processor_specific_flags,
7341         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7342         New method definitions.
7343         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7344         Input_objects pointer type parameter.
7345         * layout.cc (Layout::finalize): Pass input objects to target's.
7346         finalize_sections function.
7347         * output.cc (Output_file_header::do_sized_write): Set ELF file
7348         header's processor-specific flags.
7349         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7350         Input_objects pointer type parameter.
7351         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7352         * target.h (Input_objects): New forward class declaration.
7353         (Target::processor_specific_flags,
7354         Target::are_processor_specific_flags_sect): New method definitions.
7355         (Target::finalize_sections): Add input_objects parameter.
7356         (Target::Target): Initialize processor_specific_flags_ and
7357         are_processor_specific_flags_set_.
7358         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7359         parameter.
7360         (Target::set_processor_specific_flags): New method definition.
7361         (Target::processor_specific_flags_,
7362         Target::are_processor_specific_flags_set_): New data member
7363         declarations.
7364         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7365         Input_objects pointer type parameter.
7367 2009-10-30  Doug Kwan  <dougkwan@google.com>
7369         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7371 2009-10-28  Ian Lance Taylor  <iant@google.com>
7373         * object.h (class Relobj): Drop options parameter from
7374         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7375         do_scan_relocs, do_relocate.  Change all callers.
7376         (class Sized_relobj): Drop options parameters from
7377         do_gc_process_relocs, do_scan_relocs, do_relocate,
7378         do_relocate_sections, relocate_sections, emit_relocs_scan,
7379         emit_relocs_scan_reltype.  Change all callers.
7380         (struct Relocate_info): Remove options field and all references to
7381         it.
7382         * reloc.h (class Read_relocs): Remove options constructor
7383         parameter and options_ field.  Change all callers.
7384         (class Gc_process_relocs, class Scan_relocs): Likewise.
7385         (class Relocate_task): Likewise.
7386         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7387         all callers.
7388         (scan_relocatable_relocs): Likewise.
7389         * target.h (class Sized_target): Remove options parameter from
7390         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7391         all callers.
7392         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7393         callers.
7394         * arm.cc: Update functions to remove options parameters.
7395         * i386.cc: Likewise.
7396         * powerpc.cc: Likewise.
7397         * sparc.cc: Likewise.
7398         * x86_64.cc: Likewise.
7399         * testsuite/testfile.cc: Likewise.
7401 2009-10-28  Doug Kwan  <dougkwan@google.com>
7403         * arm.cc (Arm_relobj): New class definition.
7404         (Arm_relobj::scan_sections_for_stubs,
7405         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7406         New method definitions.
7408 2009-10-28  Cary Coutant  <ccoutant@google.com>
7410         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7411         (Plugin::cleanup_done_): New member.
7412         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7413         (Plugin_manager::cleanup_done_): Remove.
7414         (Plugin_manager::add_input_file): Edit error message.
7415         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7416         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7418 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7420         * fileread.cc: (File_read::View::~View): Use the new
7421         data_ownership_ filed.
7422         (File_read::~File_read): Dispose the new whole_file_view_.
7423         (File_read::open): Mmap the whole file if needed.
7424         (File_read::open): Use whole_file_view_ instead of contents_.
7425         (File_read::find_view): Use whole_file_view_ if applicable.
7426         (File_read::do_read): Use whole_file_view_ instead of contents_.
7427         (File_read::make_view): Use whole_file_view_ instead of contents_,
7428         update File_read::View::View call.
7429         (File_read::find_or_make_view): Update File_read::View::View
7430         call.
7431         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7432         remove contents_
7433         (File_read::View::Data_ownership): New enum.
7434         (File_read::View::View): Replace bool mapped_ with Data_ownership
7435         argument.
7436         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7437         (File_read::View::data_ownership_): New field.
7438         (File_read::contents_): Remove (replaced by whole_file_view_).
7439         (File_read::whole_file_view_): New field.
7440         * options.h (class General_options): Add --keep-files-mapped.
7442 2009-10-27  Cary Coutant  <ccoutant@google.com>
7444         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7445         * testsuite/Makefile.am (plugin_test_5): New test case.
7446         * testsuite/Makefile.in: Regenerate.
7448 2009-10-25  Doug Kwan  <dougkwan@google.com>
7450         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7451         from private to protected to allow access by child class.
7452         (Sized_relobj::do_relocate_sections): New method declaration.
7453         (Sized_relobj::relocate_sections): Virtualize.
7454         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7455         Sized_relobj::relocate_sections.  Instantiate template explicitly
7456         for different target sizes and endianity.
7458 2009-10-24  Doug Kwan  <dougkwan@google.com>
7460         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7461         (Arm_input_section::as_arm_input_section): New method.
7462         (Arm_output_section): New class definition.
7463         (Arm_output_section::create_stub_group,
7464         Arm_output_section::group_sections): New method definitions.
7466 2009-10-22  Doug Kwan  <dougkwan@google.com>
7468         * arm.cc (Arm_input_section): New class definition.
7469         (Arm_input_section::init, Arm_input_section:do_write,
7470         Arm_input_section::set_final_data_size,
7471         Arm_input_section::do_reset_address_and_file_offset): New method
7472         definitions.
7474 2009-10-21  Doug Kwan  <dougkwan@google.com>
7476         * arm.cc (Stub_table, Arm_input_section): New forward class
7477         declarations.
7478         (Stub_table): New class defintion.
7479         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7480         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7481         New method definition.
7483 2009-10-21  Doug Kwan  <dougkwan@google.com>
7485         * arm.cc: Update copyright comments.
7486         (Target_arm): New forward class template declaration.
7487         (Arm_address): New type.
7488         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7489         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7490         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7491         constants.
7492         (Insn_template): Same.
7493         (DEF_STUBS): New macro.
7494         (Stub_type): New enum type.
7495         (Stub_template): New class definition.
7496         (Stub): Same.
7497         (Reloc_stub): Same.
7498         (Stub_factory): Same.
7499         (Target_arm::Target_arm): Initialize may_use_blx_ and
7500         should_force_pic_veneer_.
7501         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7502         Target_arm::should_force_pic_veneer,
7503         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7504         Target_arm::using_thumb_only, Target_arm:;default_target): New
7505         method defintions.
7506         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7507         New data member declarations.
7508         (Insn_template::size, Insn_template::alignment): New method defintions.
7509         (Stub_template::Stub_template): New method definition.
7510         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7511         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7512         (Stub_factory::Stub_factory): New method definition.
7513         * gold.h (string_hash): New template.
7514         * output.h (Input_section_specifier::hash_value): Use
7515         gold::string_hash.
7516         (Input_section_specifier::string_hash): Remove.
7517         * stringpool.cc (Stringpool_template::string_hash): Use
7518         gold::string_hash.
7520 2009-10-20  Doug Kwan  <dougkwan@google.com>
7522         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7523         symbols of relaxed input sections.
7524         * output.h (Output_section::find_relaxed_input_section): Make
7525         method public.
7527 2009-10-16  Doug Kwan  <dougkwan@google.com>
7529         * dynobj.cc (Versions::Versions): Initialize version_script_.
7530         Only insert base version symbol definition for a shared object
7531         if version script defines any version versions.
7532         (Versions::define_base_version): New method definition.
7533         (Versions::add_def): Check that base version is not needed.
7534         (Versions::add_need): Define base version lazily.
7535         * dynobj.h (Versions::define_base_version): New method declaration.
7536         (Versions::needs_base_version_): New data member declaration.
7537         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7538         (check_DATA): Add no_version_test.stdout.
7539         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7540         New make rules.
7541         * testsuite/Makefile.in: Regenerate.
7542         * testsuite/no_version_test.c: New file.
7543         * testsuite/no_version_test.sh: Ditto.
7545 2009-10-16  Doug Kwan  <dougkwan@google.com>
7547         * expression.cc (class Segment_start_expression): New class definition.
7548         (Segment_start_expression::value): New method definition.
7549         (script_exp_function_segment_start): Return a new
7550         Segment_start_expression.
7551         * gold/script-c.h (script_saw_segment_start_expression): New function
7552         prototype.
7553         * script-sections.cc (Script_sections::Script_sections): Initialize
7554         SAW_SEGMENT_START_EXPRESSION_ to false.
7555         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7556         and -Tbbs options to specify section addresses if given in
7557         command line and no SEGMENT_START expression is seen in a script.
7558         * script-sections.h (Script_sections::saw_segment_start_expression,
7559         Script_sections::set_saw_segment_start_expression): New method
7560         definition.
7561         (Script_sections::saw_segment_start_expression_): New data member
7562         declaration.
7563         * script.cc (script_saw_segment_start_expression): New function.
7564         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7565         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7566         script_test_7.sh and script_test_8.sh.
7567         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7568         script_test_8.stdout.
7569         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7570         (script_test_6, script_test_6.stdout, script_test_7,
7571         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7572         * Makefile.in: Regenerate.
7573         * testsuite/script_test_6.sh: New file.
7574         * testsuite/script_test_6.t: Same.
7575         * testsuite/script_test_7.sh: Same.
7576         * testsuite/script_test_7.t: Same.
7577         * testsuite/script_test_8.sh: Same.
7579 2009-10-16  Doug Kwan  <dougkwan@google.com>
7581         * output.cc (Output_segment::set_section_list_address): Cast
7582         expressions to unsigned long long type to avoid format warnings.
7584 2009-10-15  Ian Lance Taylor  <iant@google.com>
7586         * script.cc (Script_options::add_symbol_assignment): Always add a
7587         dot assignment to script_sections_.
7588         * script-sections.cc (Script_sections::add_dot_assignment):
7589         Initialize if necessary.
7591         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7592         program headers with no load segment if there is a linker script.
7594         * layout.cc (Layout::set_segment_offsets): Align the file offset
7595         to the segment aligment for -N or -n with no load segment.
7596         * output.cc (Output_segment::add_output_section): Don't crash if
7597         the first section is a TLS section.
7598         (Output_segment::set_section_list_addresses): Print an error
7599         message if the address moves backward in a linker script.
7600         * script-sections.cc
7601         (Output_section_element_input::set_section_addresses): Don't
7602         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7603         (Orphan_output_section::set_section_addresses): Likewise.
7605 2009-10-15  Doug Kwan  <dougkwan@google.com>
7607         * layout.cc (Layout::finish_dynamic_section): Generate tags
7608         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7609         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7610         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7612 2009-10-14  Ian Lance Taylor  <iant@google.com>
7614         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7615         fields.
7616         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7617         data_shdr fields of relinfo.
7618         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7619         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7620         R_386_TLS_LDO_32, adjust based on section flags.
7621         (Target_i386::Relocate::fix_up_ldo): Remove.
7623 2009-10-13  Ian Lance Taylor  <iant@google.com>
7625         Add support for -pie.
7626         * options.h (class General_options): Add -pie and
7627         --pic-executable.
7628         (General_options::output_is_position_independent): Test -pie.
7629         (General_options::output_is_executable): Return true if not shared
7630         and not relocatable.
7631         (General_options::output_is_pie): Remove.
7632         * options.cc (General_options::finalize): Reject incompatible uses
7633         of -pie.
7634         * gold.cc (queue_middle_tasks): A -pie link is not static.
7635         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7636         * symtab.cc (Symbol::final_value_is_known): Return false if
7637         output_is_position_independent.
7638         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7639         output_is_position_independent.
7640         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7641         output_is_position_independent.
7642         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7643         output_is_position_independent.
7644         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7645         two_file_pie_test.
7646         (basic_pie_test.o, basic_pie_test): New targets.
7647         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7648         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7649         (two_file_pie_test): New target.
7650         * testsuite/Makefile.in: Rebuild.
7651         * README: Remove note saying that -pie is not supported.
7653 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7655         * options.h (class General_options): Add -init and -fini.
7656         * layout.cc (Layout::finish_dynamic_section): Emit
7657         given init and fini functions.
7659 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7661         * gc.h (gc_process_relocs): Check if icf is enabled using new
7662         function.
7663         * gold.cc (queue_initial_tasks): Likewise.
7664         (queue_middle_tasks): Likewise.
7665         * object.cc (do_layout): Likewise.
7666         * symtab.cc (is_section_folded): Likewise.
7667         * main.cc (main): Likewise.
7668         * reloc.cc (Read_relocs::run): Likewise.
7669         (Sized_relobj::do_scan_relocs): Likewise.
7670         * icf.cc (is_function_ctor_or_dtor): New function.
7671         (Icf::find_identical_sections): Check if function is ctor or dtor when
7672         safe icf is chosen.
7673         * options.h (General_options::icf): Change option to be an enum.
7674         (Icf_status): New enum.
7675         (icf_enabled): New method.
7676         (icf_safe_folding): New method.
7677         (set_icf_status): New method.
7678         (icf_status_): New variable.
7679         * (options.cc) (General_options::finalize): Set icf_status_.
7680         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7681         icf_test and icf_keep_unique_test to use the --icf enum flag.
7682         * testsuite/icf_safe_test.sh: New file.
7683         * testsuite/icf_safe_test.cc: New file.
7685 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7687         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7688         includes to gc.h and icf.h.
7689         * arm.cc: Include gc.h.
7690         * gold.cc: Likewise.
7691         * i386.cc: Likewise.
7692         * powerpc.cc: Likewise.
7693         * sparc.cc: Likewise.
7694         * x86_64.cc: Likewise.
7695         * gc.h: Include icf.h.
7697 2009-10-11  Ian Lance Taylor  <iant@google.com>
7699         * plugin.cc: Include "gold.h" before other header files.
7701 2009-10-10  Chris Demetriou  <cgd@google.com>
7703         * options.h (Input_file_argument::Input_file_type): New enum.
7704         (Input_file_argument::is_lib_): Replace with...
7705         (Input_file_argument::type_): New member.
7706         (Input_file_argument::Input_file_argument): Take Input_file_type
7707         'type' rather than boolean 'is_lib' as second argument.
7708         (Input_file_argument::is_lib): Use type_.
7709         (Input_file_argument::is_searched_file): New function.
7710         (Input_file_argument::may_need_search): Handle is_searched_file.
7711         * options.cc (General_options::parse_library): Support -l:filename.
7712         (General_options::parse_just_symbols): Update for Input_file_argument
7713         changes.
7714         (Command_line::process): Likewise.
7715         * archive.cc (Archive::get_file_and_offset): Likewise.
7716         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7717         * script.cc (read_script_file, script_add_file): Likewise.
7718         * fileread.cc (Input_file::Input_file): Likewise.
7719         (Input_file::will_search_for): Handle is_searched_file.
7720         (Input_file::open): Likewise.
7721         * readsyms.cc (Read_symbols::get_name): Likewise.
7722         * testsuite/Makefile.am (searched_file_test): New test.
7723         * testsuite/Makefile.in: Regenerate.
7724         * testsuite/searched_file_test.cc: New file.
7725         * testsuite/searched_file_test_lib.cc: New file.
7727 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7728             Ian Lance Taylor  <iant@google.com>
7730         * descriptor.cc: Include <cstdio> and "binary-io.h".
7731         (Descriptors::open): Open the files in binary mode always.
7732         * script.cc (Lex::get_token): Treat \r as whitespace.
7734 2009-10-09  Ian Lance Taylor  <iant@google.com>
7736         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7738 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7739             Ian Lance Taylor  <iant@google.com>
7741         * configure.ac: Check for readv function also.
7742         * fileread.cc (readv): Define if not HAVE_READV.
7743         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7744         does not exist.
7745         * config.in: Regenerate.
7746         * configure: Regenerate.
7748 2009-10-09  Doug Kwan  <dougkwan@google.com>
7750         * layout.cc (Layout::make_output_section): Call target hook to make
7751         ordinary output section.
7752         (Layout::finalize): Adjust parameter list of call the
7753         Target::may_relax().
7754         * layout.h (class Layout::section_list): New method.
7755         * merge.h (Output_merge_base::entsize): Change visibility to public.
7756         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7757         New methods.
7758         (Output_merge_string::do_is_string): New method.
7759         * object.cc (Sized_relobj::do_setup): renamed from
7760         Sized_relobj::set_up.
7761         * object.h (Sized_relobj::adjust_shndx,
7762         Sized_relobj::initializ_input_to_output_maps,
7763         Sized_relobj::free_input_to_output_maps): Change visibilities to
7764         protected.
7765         (Sized_relobj::setup): Virtualize.
7766         (Sized_relobj::do_setup): New method declaration.
7767         (Sized_relobj::invalidate_section_offset,
7768         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7769         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7770         * options.cc (parse_int): New function.
7771         * options.h (parse_int): New declaration.
7772         (DEFINE_int): New macro.
7773         (stub_group_size): New option.
7774         * output.cc (Output_section::Output_section): Initialize memebers
7775         merge_section_map_, merge_section_by_properties_map_,
7776         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7777         (Output_section::add_input_section): Handled deferred code-fill
7778         generation and remove an old comment.
7779         (Output_section::add_relaxed_input_section): New method definition.
7780         (Output_section::add_merge_input_section): Use merge section by
7781         properties map to speed to search.  Update merge section maps
7782         as appropriate.
7783         (Output_section::build_relaxation_map): New method definition.
7784         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7785         Same.
7786         (Output_section::relax_input_section): Renamed to
7787         Output_section::convert_input_sections_to_relaxed_sections and change
7788         interface to take a vector of pointers to relaxed sections.
7789         (Output_section::find_merge_section,
7790         Output_section::find_relaxed_input_section): New method definitions.
7791         (Output_section::is_input_address_mapped,
7792         Output_section::output_offset, Output_section::output_address):
7793         Use output section data maps to speed up searching.
7794         (Output_section::find_starting_output_address): Add comments.
7795         (Output_section::do_write,
7796         Output_section::write_to_postprocessing_buffer): Do code-fill
7797         generation as appropriate.
7798         (Output_section::get_input_sections): Invalidate relaxed input section
7799         map.
7800         (Output_section::restore_states): Adjust type of checkpoint .
7801         Invalidate relaxed input section map.
7802         * output.h (Output_merge_base): New class declaration.
7803         (Input_section_specifier): New class defintion.
7804         (class Output_relaxed_input_section) Change base class to
7805         Output_section_data_build.
7806         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7807         base class initializer.
7808         (Output_section::add_relaxed_input_section): New method declaration.
7809         (Output_section::Input_section): Change visibility to protected.
7810         (Output_section::Input_section::relobj,
7811         Output_section::Input_section::shndx): Handle relaxed input sections.
7812         Output_section::input_sections) Change visibility to protected.  Also
7813         define overload to return a non-const pointer.
7814         (Output_section::Merge_section_properties): New class defintion.
7815         (Output_section::Merge_section_by_properties_map,
7816         Output_section::Output_section_data_by_input_section_map,
7817         Output_section::Relaxation_map): New types.
7818         (Output_section::relax_input_section): Rename method to
7819         Output_section::convert_input_sections_to_relaxed_sections and change
7820         interface to take a vector of relaxed section pointers.
7821         (Output_section::find_merge_section,
7822         Output_section::find_relaxed_input_section,
7823         Output_section::build_relaxation_map,
7824         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7825         New method declarations.
7826         (Output_section::merge_section_map_
7827         Output_section::merge_section_by_properties_map_,
7828         Output_section::relaxed_input_section_map_,
7829         Output_section::is_relaxed_input_section_map_valid_,
7830         Output_section::generate_code_fills_at_write_): New data members.
7831         * script-sections.cc
7832         (Output_section_element_input::set_section_addresses): Call
7833         current_data_size and addralign methods of relaxed input sections.
7834         (Orphan_output_section::set_section_addresses): Call current_data_size
7835         and addralign methods of relaxed input sections.
7836         * symtab.cc (Symbol_table::compute_final_value): Extract template
7837         from the body of Symbol_table::sized_finalize_symbol.
7838         (Symbol_table::sized_finalized_symbol): Call
7839         Symbol_table::compute_final_value.
7840         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7841         (Symbol_table::compute_final_value): New templated method declaration.
7842         * target.cc (Target::do_make_output_section): New method defintion.
7843         * target.h (Target::make_output_section): New method declaration.
7844         (Target::relax): Add more parameters for input objects, symbol table
7845         and layout.  Adjust call to do_relax.
7846         (Target::do_make_output_section): New method declaration.
7847         (Target::do_relax): Add parameters for input objects, symbol table
7848         and layout.
7850 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7852         * pread.c: Include stdio.h.
7854 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7856         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7857         defined.
7859 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7861         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7862         Change read_shndx type to unsigned int.
7863         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7864         int.
7865         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7866         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7867         Change read_shndx type to unsigned int.
7868         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7869         int.
7870         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7871         * layout.cc (Layout::create_symtab_sections): Cast the result of
7872         local_symcount * symsize to off_t in the gold_assert.
7874 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7876         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7877         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7878         R_ARM_BASE_ABS.
7879         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7880         (Arm_relocate_functions::thm_abs5): New function.
7881         (Arm_relocate_functions::abs12): New function.
7882         (Arm_relocate_functions::abs16): New function.
7883         (Arm_relocate_functions::base_abs): New function.
7884         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7885         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7886         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7887         R_ARM_BASE_ABS.
7888         (Scan::global): Likewise.
7889         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7890         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7891         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7892         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7893         R_ARM_BASE_ABS.
7895 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7897         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7898         (Arm_relocate_functions::movt_prel): New function.
7899         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7900         (Arm_relocate_functions::thm_movt_prel): New function.
7901         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7902         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7903         (Scan::global, Relocate::relocate): Likewise.
7904         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7906 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7908         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7909         Incremental_checker.
7910         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7911         unsigned int.
7912         (class Incremental_inputs_header): New class.
7913         (Incremental_inputs_header_writer): Edit comment.
7914         (Incremental_inputs_entry): New class.
7915         (Incremental_inputs_entry_writer): Edit comment.
7916         (Sized_incremental_binary::do_find_incremental_inputs_section):
7917         Add *strtab_shndx parameter, fill it.
7918         (Sized_incremental_binary::do_check_inputs): New method.
7919         (Incremental_checker::can_incrementally_link_output_file): Use
7920         Sized_incremental_binary::check_inputs.
7921         (Incremental_inputs::report_command_line): Save command line in
7922         command_line_.
7923         * incremental.h:
7924         (Incremental_binary::find_incremental_inputs_section): New
7925         method.
7926         (Incremental_binary::do_find_incremental_inputs_section): Add
7927         strtab_shndx parameter.
7928         (Incremental_binary::do_check_inputs): New pure virtual method.
7929         (Sized_incremental_binary::do_check_inputs): Declare.
7930         (Incremental_checker::Incremental_checker): Add incremental_inputs
7931         parameter, use it to initialize incremental_inputs_.
7932         (Incremental_checker::incremental_inputs_): New field.
7933         (Incremental_checker::command_line): New method.
7934         (Incremental_checker::inputs): New method.
7935         (Incremental_checker::command_line_): New field.
7937 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7939         * incremental.cc: Include <cstdarg> and "target-select.h".
7940         (vexplain_no_incremental): New function.
7941         (explain_no_incremental): New function.
7942         (Incremental_binary::error): New method.
7943         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7944         method.
7945         (make_sized_incremental_binary): New function.
7946         (open_incremental_binary): New function.
7947         (can_incrementally_link_file): Add checks if output is ELF and has
7948         inputs section.
7949         * incremental.h: Include "elfcpp_file.h" and "output.h".
7950         (Incremental_binary): New class.
7951         (Sized_incremental_binary): New class.
7952         (open_incremental_binary): Declare.
7953         * object.cc (is_elf_object): Use
7954         elfcpp::Elf_recognizer::is_elf_file.
7955         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7956         * output.h (Output_file::filesize): New method.
7958 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7960         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7961         New function.
7962         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7963         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7964         function.
7965         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7966         function.
7967         (Arm_relocate_functions::movw_abs_nc): New function.
7968         (Arm_relocate_functions::movt_abs): New function.
7969         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7970         (Arm_relocate_functions::thm_movt_abs): New function.
7971         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7972         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7973         (Scan::global): Likewise.
7974         (Relocate::relocate): Likewise.
7975         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7977 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7979         * arm.cc (Arm_relocate_functions::got_prel) New function.
7980         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7981         (Relocate::relocate): Likewise.
7982         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7984 2009-10-06  Ian Lance Taylor  <iant@google.com>
7986         * options.h (class General_options): Define
7987         split_stack_adjust_size parameter.
7988         * object.h (class Object): Add uses_split_stack_ and
7989         has_no_split_stack_ fields.  Add uses_split_stack and
7990         has_no_split_stack accessor functions.  Declare
7991         handle_split_stack_section.
7992         (class Reloc_symbol_changes): Define.
7993         (class Sized_relobj): Define Function_offsets.  Declare
7994         split_stack_adjust, split_stack_adjust_reltype, and
7995         find_functions.
7996         * object.cc (Object::handle_split_stack_section): New function.
7997         (Sized_relobj::do_layout): Call handle_split_stack_section.
7998         * dynobj.cc (Sized_dynobj::do_layout): Call
7999         handle_split_stack_section.
8000         * reloc.cc (Sized_relobj::relocate_sections): Call
8001         split_stack_adjust for executable sections in split_stack
8002         objects.  Pass reloc_map to relocate_section.
8003         (Sized_relobj::split_stack_adjust): New function.
8004         (Sized_relobj::split_stack_adjust_reltype): New function.
8005         (Sized_relobj::find_functions): New function.
8006         * target-reloc.h: Include "object.h".
8007         (relocate_section): Add reloc_symbol_changes parameter.  Change
8008         all callers.
8009         * target.h (class Target): Add calls_non_split method.  Declare
8010         do_calls_non_split virtual method.  Declare match_view and
8011         set_view_to_nop.
8012         * target.cc: Include "elfcpp.h".
8013         (Target::do_calls_non_split): New function.
8014         (Target::match_view): New function.
8015         (Target::set_view_to_nop): New function.
8016         * gold.cc (queue_middle_tasks): Give an error if mixing
8017         split-stack and non-split-stack objects with -r.
8018         * i386.cc (Target_i386::relocate_section): Add
8019         reloc_symbol_changes parameter.
8020         (Target_i386::do_calls_non_split): New function.
8021         * x86_64.cc (Target_x86_64::relocate_section): Add
8022         reloc_symbol_changes parameter.
8023         (Target_x86_64::do_calls_non_split): New function.
8024         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8025         parameter.
8026         * powerpc.cc (Target_powerpc::relocate_section): Add
8027         reloc_symbol_changes parameter.
8028         * sparc.cc (Target_sparc::relocate_section): Add
8029         reloc_symbol_changes parameter.
8030         * configure.ac: Call AM_CONDITIONAL for the default target.
8031         * configure: Rebuild.
8032         * testsuite/Makefile.am (TEST_AS): New variable.
8033         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8034         (check_DATA): Add split_i386 and split_x86_64 files.
8035         (SPLIT_DEFSYMS): Define.
8036         (split_i386_[1234n].o): New targets.
8037         (split_i386_[124]): New targets.
8038         (split_i386_[1234r].stdout): New targets.
8039         (split_x86_64_[1234n].o): New targets.
8040         (split_x86_64_[124]): New targets.
8041         (split_x86_64_[1234r].stdout): New targets.
8042         (MOSTLYCLEANFILES): Add new executables.
8043         * testsuite/split_i386.sh: New file.
8044         * testsuite/split_x86_64.sh: New file.
8045         * testsuite/split_i386_1.s: New file.
8046         * testsuite/split_i386_2.s: New file.
8047         * testsuite/split_i386_3.s: New file.
8048         * testsuite/split_i386_4.s: New file.
8049         * testsuite/split_i386_n.s: New file.
8050         * testsuite/split_x86_64_1.s: New file.
8051         * testsuite/split_x86_64_2.s: New file.
8052         * testsuite/split_x86_64_3.s: New file.
8053         * testsuite/split_x86_64_4.s: New file.
8054         * testsuite/split_x86_64_n.s: New file.
8055         * testsuite/testfile.cc (Target_test): Update relocation_section
8056         function.
8057         * testsuite/Makefile.in: Rebuild.
8059 2009-10-06  Ian Lance Taylor  <iant@google.com>
8061         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8062         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8063         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8064         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8065         the address on ldo_addrs_.
8066         (Target_i386::Relocate::fix_up_ldo): New function.
8068 2009-10-06   Rafael Espindola  <espindola@google.com>
8070         * plugin.cc (add_input_library): New.
8071         (Plugin::load): Add add_input_library to tv.
8072         (Plugin_manager::add_input_file): Add the is_lib argument.
8073         (add_input_file): Update call to Plugin_manager::add_input_file.
8074         (add_input_library): New.
8075         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8077 2009-09-30  Doug Kwan  <dougkwan@google.com>
8079         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8080         symbol and call Symbol::may_need_copy_reloc to determine if
8081         a copy reloc is needed.
8082         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8083         nocopyreloc is given in command line.
8084         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8085         given in command line.
8086         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8087         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8088         of the removed Target_i386::may_need_copy_reloc.
8089         * options.h (copyreloc): New option with default value false.
8090         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8091         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8092         instead of the removed Target_powerpc::may_need_copy_reloc.
8093         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8094         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8095         instead of the removed Target_sparc::may_need_copy_reloc.
8096         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8097         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8098         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8099         instead of the removed Target_x86_64::may_need_copy_reloc.
8101 2009-09-30  Ian Lance Taylor  <iant@google.com>
8103         * object.h (class Object): Remove target_ field, and target,
8104         sized_target, and set_target methods.
8105         (Object::sized_target): Remove.
8106         (class Sized_relobj): Update declarations.  Remove sized_target.
8107         * object.cc (Sized_relobj::setup): Remove target parameter.
8108         Change all callers.
8109         (Input_objects::add_object): Don't do anything with the target.
8110         (make_elf_sized_object): Add punconfigured parameter.  Change all
8111         callers.  Set or test parameter target.
8112         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8113         Change all callers.
8114         * parameters.cc (Parameters::set_target): Change parameter type to
8115         be non-const.
8116         (Parameters::default_target): Remove.
8117         (set_parameters_target): Change parameter type to be non-const.
8118         (parameters_force_valid_target): New function.
8119         (parameters_clear_target): New function.
8120         * parameters.h (class Parameters): Update declarations.  Remove
8121         default_target method.  Add sized_target and clear_target
8122         methods.  Change target_ to be non-const.
8123         (set_parameters_target): Update declaration.
8124         (parameters_force_valid_target): Declare.
8125         (parameters_clear_target): Declare.
8126         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8127         as NULL if we aren't searching.
8128         (Add_symbols::run): Don't check for compatible target.
8129         * fileread.cc (Input_file::open_binary): Call
8130         parameters_force_valid_target.
8131         * gold.cc (queue_middle_tasks): Likewise.
8132         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8133         set_target on object.
8134         * dynobj.h (class Sized_dynobj): Update declarations.
8135         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8136         make_elf_object returns NULL.
8137         (Archive::include_member): Don't check whether object target is
8138         compatible.
8139         * output.cc (Output_section::add_input_section): Get target from
8140         parameters.
8141         (Output_section::relax_input_section): Likewise.
8142         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8143         parameters.
8144         (Sized_relobj::do_scan_relocs): Likewise.
8145         (Sized_relobj::relocate_sections): Likewise.
8146         * resolve.cc (Symbol_table::resolve): Likewise.
8147         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8148         parameter.  Change all callers.
8149         (Symbol_table::add_from_object): Get target from parameters.
8150         (Symbol_table::add_from_relobj): Don't check object target.
8151         (Symbol_table::add_from_dynobj): Likewise.
8152         (Symbol_table::define_special_symbol): Get target from
8153         parameters.
8154         * symtab.h (class Symbol_table): Update declaration.
8155         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8156         parameter.  Change all callers.  Clear parameter target.
8157         (Binary_test): Test target here.
8158         * testsuite/object_unittest.cc (gold_testsuite): Remove
8159         target_test_pointer parameter.  Change all callers.
8160         (Object_test): Test target here.
8162 2009-09-26  Ian Lance Taylor  <iant@google.com>
8164         * testsuite/initpri1.c: Don't try to use constructor priorities if
8165         compiling with gcc before 4.3.
8167 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8169         * testsuite/retain_symbols_file_test.sh (check_present): Change
8170         output file name to retain_symbols_file_test.stdout.
8171         (check_absent): Likewise.
8173 2009-09-18  Craig Silverstein  <csilvers@google.com>
8175         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8176         * options.cc: Include <cerrno> and <fstream>.
8177         (General_options::finalize): Parse -retain-symbols-file tag.
8178         * options.h: New flag.
8179         (General_options): New method should_retain_symbol, new
8180         variable symbols_to_retain.
8181         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8182         should_retain_symbol map.
8183         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8184         * testsuite/Makefile.in: Regenerate.
8185         * testsuite/retain_symbols_file_test.sh: New file.
8187 2009-09-18  Nick Clifton  <nickc@redhat.com>
8189         * po/es.po: Updated Spanish translation.
8191 2009-09-17  Doug Kwan  <dougkwan@google.com>
8193         * debug.h (DEBUG_RELAXATION): New constant.
8194         (DEBUG_ALL): Add DEBUG_RELAXATION.
8195         (debug_string_to_enum): Add relaxation debug option.
8196         * layout.cc
8197         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8198         Layout::Relaxation_debug_check::read_sections,
8199         Layout::Relaxation_debug_check::read_sections): New method definitions.
8200         (Layout::Layout): Initialize data members
8201         record_output_section_data_from_scrips_,
8202         script_output_section_data_list_ and relaxation_debug_check_.
8203         (Layout::save_segments, Layout::restore_segments,
8204         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8205         Layout::relaxation_loop_body): New method definitions.
8206         (Layout::finalize): Support relaxation.  Move section layout code to
8207         Layout::relaxation_loop_body.
8208         (Layout::set_asection_address_from_script): Move code for orphan
8209         section placement out.
8210         (Layout::place_orphan_sections_in_script): New method definition.
8211         * layout.h (Output_segment_headers, Output_file_header):
8212         New forward class declarations.
8213         (Layout::~Layout): Define.
8214         (Layout::new_output_section_data_from_script): New method definition.
8215         (Layout::place_orphan_sections_in_script): New method declaration.
8216         (Layout::Segment_states): New type declaration.
8217         (Layout::save_segments, Layout::restore_segments,
8218         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8219         Layout::relaxation_loop_body): New method declarations.
8220         (Layout::Output_section_data_list): New type declaration.
8221         (Layout::Relaxation_debug_check): New class definition.
8222         (Layout::record_output_section_data_from_script_,
8223         Layout::script_output_section_data_list_, Layout::segment_states_,
8224         Layout::relaxation_debug_check_): New data members.
8225         * output.cc: (Output_section_headers::do_size): New method definition.
8226         (Output_section_headers::Output_section_headers): Move size
8227         computation to Output_section_headers::do_size.
8228         (Output_segment_headers::do_size): New method definition.
8229         (Output_file_header::Output_file_header): Move size computation to
8230         Output_file_header::do_size and call it.
8231         (Output_file_header::do_size): New method definition.
8232         (Output_data_group::Output_data_group): Adjust call to
8233         Output_section_data.
8234         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8235         (Output_symtab_xindex::do_write): Add array bound check.
8236         (Output_section::Input_section::print_to_mapfile): Handle
8237         RELAXED_INPUT_SECTION_CODE.
8238         (Output_section::Output_section): Initialize data member checkpoint_.
8239         (Output_section::~Output_section): Delete checkpoint object pointed
8240         by checkpoint_.
8241         (Output_section::add_input_section): Always add an Input_section if
8242         relaxing.
8243         (Output_section::add_merge_input_section): Add assert.
8244         (Output_section::relax_input_section): New method definition.
8245         (Output_section::set_final_data_size): Set load address to zero for
8246         an unallocated section.
8247         (Output_section::do_address_and_file_offset_have_reset_values):
8248         New method definition.
8249         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8250         Handle relaxed input section.
8251         (Output_section::sort_attached_input_sections): Checkpoint input
8252         section list lazily.
8253         (Output_section::get_input_sections): Change type of input_sections to
8254         list of Simple_input_section pointers.  Checkpoint input section list
8255         lazily.  Also handle relaxed input sections.
8256         (Output_section::add_input_section_for_script): Take a reference to
8257         a Simple_input_section object instead of Relobj pointer and section
8258         index as parameter.  Handle relaxed input sections.
8259         (Output_section::save_states, Output_section::restore_states): New
8260         method definitions.
8261         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8262         (Output_data::is_data_size_fixed): New method definition.
8263         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8264         if it is fixed.
8265         (Output_data::address_and_file_offset_have_reset_values): New method
8266         definition.
8267         (Output_data::do_address_and_file_offset_have_reset_values): New method
8268         definition.
8269         (Output_data::set_data_size): Check that data size is not fixed.
8270         (Output_data::fix_data_size): New method definition.
8271         (Output_data::is_data_size_fixed_): New data member.
8272         (Output_section_headers::set_final_data_size): New method definition.
8273         (Output_section_headers::do_size): New method declaration.
8274         (Output_segment_headers::set_final_data_size): New method definition.
8275         (Output_segment_headers::do_size): New method declaration.
8276         (Output_file_header::set_final_data_size)::New method definition.
8277         (Output_file_header::do_size)::New method declaration.
8278         (Output_section_data::Output_section_data): Add new parameter
8279         is_data_size_fixed and use it to fix data size.
8280         (Output_data_const::Output_data_const): Adjust call to base class
8281         constructor and fix data size.
8282         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8283         base class constructor and fix data size.
8284         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8285         base class constructor and fix data size.
8286         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8287         class constructor and fix data size.
8288         (Output_data_group::set_final_data_size): New method definition.
8289         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8290         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8291         class constructor and fix data size.
8292         (Output_relaxed_input_section): New class definition.
8293         (Output_section::Simple_input_section): New class definition.
8294         (Output_section::get_input_sections): Adjust parameter list.
8295         (Output_section::add_input_section_for_script): Same.
8296         (Output_section::save_states, Output_section::restore_states,
8297         Output_section::do_address_and_file_offset_have_reset_values,
8298         (Output_section::Input_section::Input_section): Handle
8299         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8300         Output_relaxed_input_section.
8301         (Output_section::Input_section::is_input_section,
8302         Output_section::Input_section::set_output_section): Handle relaxed
8303         input section.
8304         (Output_section::Input_section::is_relaxed_input_section,
8305         Output_section::Input_section::output_section_data,
8306         Output_section::Input_section::relaxed_input_section): New method
8307         definitions.
8308         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8309         value.
8310         (Output_section::Input_section::u1_): Update comments.
8311         (Output_section::Input_section::u2_): Add new union member poris.
8312         (Output_section::Checkpoint_output_section): New classs definition.
8313         (Output_section::relax_input_section): New method declaration.
8314         (Output_section::checkpoint_): New data member.
8315         (Output_segment): Update comments.
8316         (Output_segment::Output_segment): Un-privatize copy constructor.
8317         (Output_segment::operator=): Un-privatize.
8318         * script-sections.cc (Output_section_element::Input_section_list):
8319         Change element type to Output_section::Simple_input_section.
8320         (Output_section_element_dot_assignment::set_section_addresses):
8321         Register output section data for relaxation clean up.
8322         (Output_data_exression::Output_data_expression): Adjust call to base
8323         constructor to fix data size.
8324         (Output_section_element_data::set_section_addresses): Register
8325         Output_data_expression object for relaxation clean up.
8326         (struct Input_section_info): Replace Relobj pointer and section index
8327         pair with Output_section::Simple_input_section and Convert struct to a
8328         class.
8329         (Input_section_sorter::operator()): Adjust access to
8330         Input_section_info data member to use accessors.
8331         (Output_section_element_input::set_section_addresses): Use layout
8332         parameter.  Adjust code to use Output_section::Simple_input_section
8333         and Input_secction_info classes.  Register filler for relaxation
8334         clean up.
8335         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8336         and section index pair with Output_section::Simple_input_section
8337         class.  Adjust code accordingly.
8338         (Phdrs_element::release_segment): New method definition.
8339         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8340         segment list.
8341         (Script_sections::release_segments): New method definition.
8342         * gold/script-sections.h (Script_sections::release_segments): New
8343         method declaration.
8344         * gold/target.h (Target::may_relax, Target::relax,
8345         Target::do_may_relax, Target::do_relax): New method definitions.
8347 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8349         * arm.cc (has_signed_unsigned_overflow): New function.
8350         (Arm_relocate_functions::abs8): New function.
8351         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8352         (Target_arm::Scan::global): Likewise.
8353         (Target_arm::relocate::relocate): Likewise.
8354         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8355         Likewise.
8357 2009-09-16  Cary Coutant  <ccoutant@google.com>
8359         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8360         * testsuite/Makefile.in: Regenerate.
8362 2009-09-11  Nick Clifton  <nickc@redhat.com>
8364         * po/gold.pot: Updated by the Translation project.
8366 2009-09-08  Cary Coutant  <ccoutant@google.com>
8368         * output.cc (Output_file::open): Add execute permission to empty file.
8369         * testsuite/Makefile.am (permission_test): New test.
8370         * testsuite/Makefile.in: Regenerate.
8372 2009-09-02  Ian Lance Taylor  <iant@google.com>
8374         * output.cc (Output_file::resize): Call map_no_anonymous rather
8375         than map.
8377 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8379         * gold.cc: Include "incremental.h".
8380         (queue_initial_tasks): Call Incremental_checker methods.
8381         * incremental.cc: Include "output.h".
8382         (Incremental_checker::can_incrementally_link_output_file): New
8383         method.
8384         * incremental.h (Incremental_checker): New class.
8386         * output.cc (Output_file::open_for_modification): New method.
8387         (Output_file::map_anonymous): Changed return type to bool.  Record
8388         map in base_ field.
8389         (Output_file::map_no_anonymous): New method, broken out of map.
8390         (Output_file::map): Use map_no_anonymous and map_anonymous.
8391         * output.h (class Output_file): Update declarations.
8393 2009-08-24  Cary Coutant  <ccoutant@google.com>
8395         * options.h (Command_line::Pre_options): New class.
8396         (Command_line::pre_options): New member.
8397         * options.cc (gold::options::ready_to_register): New variable.
8398         (One_option::register_option): Do nothing if not registering options.
8399         Assert if same short option registered twice.
8400         (General_options::General_options): Turn off option registration when
8401         done constructing.
8402         (Command_line::Pre_options::Pre_options): New constructor.
8404 2009-08-24  Cary Coutant  <ccoutant@google.com>
8406         * options.h (General_options::no_keep_memory): Remove incorrect
8407         short option.
8409 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8411         * Makefile.am (am__skiplex, am__skipyacc): New.
8412         * Makefile.in: Regenerate.
8414 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8416         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8417         (INCLUDES): ... this.
8418         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8419         (AM_CPPFLAGS): Renamed from ...
8420         (INCLUDE): ... this.
8421         * Makefile.in, testsuite/Makefile.in: Regenerate.
8423         * Makefile.in: Regenerate.
8424         * aclocal.m4: Likewise.
8425         * config.in: Likewise.
8426         * configure: Likewise.
8427         * testsuite/Makefile.in: Likewise.
8429         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8430         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8431         * Makefile.in: Regenerate.
8432         * testsuite/Makefile.in: Regenerate.
8434 2009-08-19  Cary Coutant  <ccoutant@google.com>
8436         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8437         symbols in shared libraries overridden by hidden or internal symbols
8438         in the main program.
8440 2009-08-19  Chris Demetriou  <cgd@google.com>
8442         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8443         checking source file names in error messages.
8445 2009-08-18  Doug Kwan  <dougkwan@google.com>
8447         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8448         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8449         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8450         an elfcpp::Ehdr as parameter.
8451         * object.cc (Object::set_target): Remove the version that looks up
8452         a target and sets it.
8453         (Sized_relobj::setup): Take a Target object instead of
8454         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8455         (make_elf_sized_object): Find target and ask target to
8456         make an ELF object.
8457         * object.h: (Object::set_target): Remove the version that looks up
8458         a target and sets it.
8459         (Sized_relobj::setup): Take a Target object instead of
8460         an elfcpp:Ehdr as parameter.
8461         * target.cc: Include dynobj.h.
8462         (Target::do_make_elf_object_implementation): New.
8463         (Target::do_make_elf_object): New.
8464         * target.h (Target::make_elf_object): New template declaration.
8465         (Target::do_make_elf_object): New method declarations.
8466         (Target::do_make_elf_object_implementation): New template declaration.
8468 2009-08-14  Ian Lance Taylor  <iant@google.com>
8470         * gold.h (FUNCTION_NAME): Define.
8471         (gold_unreachable): Use FUNCTION_NAME.
8473 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8475         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8476         symbol in the --keep-unique list is not found.
8478 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8480         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8481         been maked as --keep-unique.
8482         (Icf::unfold_section): New function.
8483         * icf.h (Icf::unfold_section): New function.
8484         * options.h (General_options::keep_unique): New option.
8485         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8486         * testsuite/Makefile.in: Regenerate.
8487         * testsuite/icf_keep_unique_test.sh: New file.
8488         * testsuite/icf_keep_unique_test.cc: New file.
8490 2009-08-12  Cary Coutant  <ccoutant@google.com>
8492         PR 10471
8493         * resolve.cc (Symbol_table::resolve): Check for references from
8494         dynamic objects to hidden and internal symbols.
8495         * testsuite/Makefile.am (hidden_test.sh): New test.
8496         * testsuite/Makefile.in: Regenerate.
8497         * testsuite/hidden_test.sh: New script.
8498         * testsuite/hidden_test_1.c: New test source.
8499         * testsuite/hidden_test_main.c: New test source.
8501 2009-08-11  Doug Kwan  <dougkwan@google.com>
8503         * arm.cc: Update comments.
8504         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8505         segment to locate the .ARM.exidx section if present.
8507 2009-08-09  Doug Kwan  <dougkwan@google.com>
8509         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8510         patch.
8512 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8513         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8514         compiler warnings.
8516 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8518         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8519         valid tls_segment only for non-debug-section relocations.
8520         * testsuite/Makefile.am: Add gc_tls_test.
8521         * testsuite/Makefile.in: Regenerate.
8522         * testsuite/gc_tls_test.cc: New file.
8523         * testsuite/gc_tls_test.sh: New file.
8525 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8527         * icf.cc: New file.
8528         * icf.h: New file.
8529         * Makefile.am (CCFILES): Add icf.cc.
8530         (HFILES): Add icf.h
8531         * Makefile.in: Regenerate.
8532         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8533         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8534         section, symbol and addend information for the relocs.
8535         * gold.cc (queue_middle_tasks): Call identical code folding.
8536         * gold.h: Add defines for multimap.
8537         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8538         to the call of finalize_local_symbols.
8539         * main.cc (main): Create object of class Icf.
8540         * object.cc (Sized_relobj::do_layout): Allow this function to be
8541         called twice during icf.
8542         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8543         to sections marked as identical by icf.
8544         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8545         when available.
8546         (Sized_relobj::do_section_entsize): New function.
8547         * object.h (Object::section_entsize): New function.
8548         (Object::do_section_entsize): New pure virtual function.
8549         (Relobj::finalize_local_symbols): Add new parameter.
8550         (Relobj::do_section_entsize): New function.
8551         * options.h (General_options::icf): New option.
8552         (General_options::icf_iterations): New option.
8553         (General_options::print_icf_sections): New option.
8554         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8555         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8556         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8557         icf.
8558         * symtab.cc (Symbol_table::is_section_folded): New function.
8559         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8560         to sections marked as identical by icf.
8561         * symtab.h (Symbol_table::set_icf): New function.
8562         (Symbol_table::icf): New function.
8563         (Symbol_table::is_section_folded): New function.
8564         (Symbol_table::icf_): New data member.
8565         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8566         * testsuite/Makefile.am: Add commands to build icf_test.
8567         * testsuite/Makefile.in: Regenerate.
8568         * testsuite/icf_test.sh: New file.
8569         * testsuite/icf_test.cc: New file.
8571 2009-07-24  Chris Demetriou  <cgd@google.com>
8573         * layout.cc (is_compressible_debug_section): Fix incorrect
8574         comment about compressed section names.
8576 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8578         PR 10419
8579         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8581 2009-07-16  Ian Lance Taylor  <iant@google.com>
8583         PR 10400
8584         * layout.h: #include <map>.
8585         (class Kept_section): Change from struct to class.  Add accessors
8586         and setters.  Add section size to Comdat_group mapping.  Change
8587         Comdat_group to std::map.  Add is_comdat_ field.  Add
8588         linkonce_size field in union.
8589         (class Layout): Update declaration of find_or_add_kept_section.
8590         Don't declare find_kept_object.
8591         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8592         parameter.  Add object, shndx, is_comdat, and is_group_name
8593         parameters.  Change all callers.  Adjust for new Kept_section.
8594         (Layout::find_kept_object): Remove.
8595         * object.cc (Sized_relobj::include_section_group): Update use of
8596         Kept_section.  Rename secnum to shndx.  Only record
8597         Kept_comdat_section if sections are the same size.
8598         (Sized_relobj::include_linkonce_section): Update use of
8599         Kept_section.  Only record Kept_comdat_section if sections are the
8600         same size.  Set size of linkonce section.
8601         (Sized_relobj::map_to_kept_section): Update call to
8602         get_kept_comdat_section.
8603         * object.h (class Sized_relobj): Rename fields in
8604         Kept_comdat_section to drop trailing underscores; change object
8605         field to Relobj*.  Change Kept_comdat_section_table to store
8606         struct rather than pointer.
8607         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8608         Add kept_object and kept_shndx parameters.  Change all callers.
8609         (Sized_relobj::get_kept_comdat_section): Change return type to
8610         bool.  Add kept_object and kept_shndx parameters.  Change all
8611         callers.
8612         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8613         Layout::find_or_add_kept_section.
8615 2009-07-09  Ian Lance Taylor  <iant@google.com>
8617         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8618         Reserve space in the hash table.
8620 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8622         * fileread.cc (File_read::get_mtime): New method.
8623         * fileread.h (Timespec): New structure.
8624         (File_read::get_mtime): New method.
8625         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8626         Renamed from timestamp_nsec.
8627         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8628         Elf_Xword.
8629         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8630         timestamp_nsec.
8631         (Incremental_inputs::report_archive): Save mtime; style fix.
8632         (Incremental_inputs::report_obejct): Save mtime; style fix.
8633         (Incremental_inputs::report_script): Save mtime; style fix.
8634         (Incremental_inputs::finalize_inputs): Style fix.
8635         (Incremental_inputs::finalize): Style fix.
8636         (Incremental_inputs::create_input_section_data): Store inputs
8637         mtime.
8638         * incremental.h (Incremental_inputs::report_script): Add mtime
8639         argument.
8640         (Incremental_inputs::Input_info::Input_info): Intialize only one
8641         union member.
8642         (Incremental_inputs::Input_info::archive): Move to nameless
8643         union.
8644         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8645         (Incremental_inputs::Input_info::script): Move to nameless union.
8646         (Incremental_inputs::mtime): New field.
8647         * script.cc (read_input_script): Pass file mtime to
8648         Incremental_input.
8649         * script.h (Script_info::inputs): Style fix.
8651 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8653         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8654         instead of 32.
8656 2009-06-24  Ian Lance Taylor  <iant@google.com>
8658         PR 10156
8659         * layout.cc (Layout::choose_output_section): If we find an
8660         existing section, update the flags.
8661         (Layout::create_notes): New function, broken out of
8662         Layout::finalize.
8663         (Layout::finalize): Don't create note sections.
8664         (Layout::create_note): Don't crash if linker script discards
8665         section.
8666         (Layout::create_gold_note): Likewise.
8667         (Layout::create_build_id): Likewise.  Don't set
8668         after_input_sections on the section.
8669         (Layout::create_executable_stack_info): Remove target parameter.
8670         Change caller.
8671         * layout.h (class Layout): Declare create_notes.  Update
8672         declaration of create_executable_stack_info.
8673         * gold.cc (queue_middle_tasks): Call create_notes.
8674         * output.cc (Output_section::update_flags_for_input_section): Move
8675         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8676         invalid.
8677         * output.h (Output_data::mark_address_invalid): New function.
8678         (class Output_section): Only declare, not define,
8679         update_flags_for_input_section.  Remove set_flags.
8681 2009-06-24  Ian Lance Taylor  <iant@google.com>
8683         * script-sections.cc (Output_section_definition::
8684         set_section_addresses): Rename shadowing local load_address to
8685         laddr.
8687 2009-06-24  Ian Lance Taylor  <iant@google.com>
8689         PR 10244
8690         * reloc.cc (relocate_sections): Skip empty relocation sections.
8692 2009-06-23  Ian Lance Taylor  <iant@google.com>
8694         PR 10156
8695         * layout.cc (Layout::create_note): Use choose_output_section
8696         rather than make_output_section.
8698 2009-06-23  Ian Lance Taylor  <iant@google.com>
8700         PR 10237
8701         * options.cc (General_options::parse_V): Set printed_version_.
8702         (General_options::General_options): Initialize printed_version_.
8703         * options.h (class General_options): Add printed_version_ field.
8704         * gold.cc (queue_initial_tasks): If there are no input files,
8705         don't give a fatal error if we printed the version information.
8706         (queue_middle_tasks): If using -r with a shared object, give a
8707         fatal error rather than an ordinary error.
8709 2009-06-23  Ian Lance Taylor  <iant@google.com>
8711         PR 10219
8712         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8713         (Layout::make_output_section): Set have_stabstr_section_ if we see
8714         a .stab*str section.
8715         (Layout::finalize): Call link_stabs_sections.
8716         (Layout::link_stabs_sections): New file.
8717         * layout.h (class Layout): Add have_stabstr_section_ field.
8718         Declare link_stabs_sections.
8720 2009-06-23  Doug Kwan  <dougkwan@google.com>
8722         * Makefile.am (libgold_a_LIBADD): New.
8723         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8724         * Makefile.in: Regenerate.
8725         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8726         * configure: Regenerate.
8727         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8728         * fileread.cc: Include sys/state.h
8729         * gold.h: Declare memmem and strndup if found missing.
8730         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8732 2009-06-23  Ian Lance Taylor  <iant@google.com>
8734         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8735         * configure: Rebuild.
8737 2009-06-23  Ian Lance Taylor  <iant@google.com>
8739         PR 10147
8740         * object.cc (Object::section_contents): Don't try to get a view if
8741         the section has length zero.
8742         (Object::handle_gnu_warning_section): If the section is empty, use
8743         the name of the section as the warning.
8745 2009-06-23  Ian Lance Taylor  <iant@google.com>
8747         PR 10133
8748         * stringpool.h (class Stringpool_template): Add optimize_ field.
8749         (Stringpool_template::set_optimize): New function.
8750         * stringpool.cc (Stringpool_template::Stringpool_template):
8751         Initialize optimize_ field.
8752         (Stringpool_template::set_string_offsets): Test local optimize
8753         fild rather than parameter.
8754         * layout.cc (Layout::Layout): Call set_optimize on the section
8755         name stringpool.
8757 2009-06-22  Ian Lance Taylor  <iant@google.com>
8759         PR 10030
8760         * yyscript.y: Parse TARGET.
8761         * script.cc (script_set_target): New function.
8762         * script-c.h (script_set_target): Declare.
8763         * options.cc (General_options::string_to_object_format): Rename
8764         from string_to_object_format in anonymous namespace.  Change
8765         callers.
8766         * options.h (class General_options): Declare
8767         string_to_object_format.
8769 2009-06-22  Ian Lance Taylor  <iant@google.com>
8771         * script-sections.cc (Script_sections::create_segments): Don't put
8772         program headers in a PT_LOAD segment if -n or -N.
8774 2009-06-22  Ian Lance Taylor  <iant@google.com>
8776         PR 10141
8777         * options.h (class General_options): Add -z lazy and -z now.  Sort
8778         -z options into alphabetical order.
8779         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8781 2009-06-21  Ian Lance Taylor  <iant@google.com>
8783         * layout.cc (Layout::make_output_section): Call
8784         Target::new_output_section.
8785         (Layout::attach_allocated_section_to_segment): Put large section
8786         sections in a separate load segment with the large segment flag
8787         set.
8788         (Layout::segment_precedes): Sort large data segments after other
8789         load segments.
8790         (align_file_offset): New static function.
8791         (Layout::set_segment_offsets): Use align_file_offset.
8792         * output.h (class Output_section): Add is_small_section_ and
8793         is_large_section_ fields.
8794         (Output_section::is_small_section): New function.
8795         (Output_section::set_is_small_section):  New function.
8796         (Output_section::is_large_section): New function.
8797         (Output_section::set_is_large_section): New function.
8798         (Output_section::is_large_data_section): New function.
8799         (class Output_segment): Add is_large_data_segment_ field.
8800         (Output_segment::is_large_data_segment): New function.
8801         (Output_segment::set_is_large_data_segment): New function.
8802         * output.cc (Output_section::Output_section): Initialize new
8803         fields.
8804         (Output_segment::Output_segment): Likewise.
8805         (Output_segment::add_output_section): Add assertion that large
8806         data sections always go in large data segments.  Force small data
8807         sections to the end of the list of data sections.  Force small BSS
8808         sections to the start of the list of BSS sections.  For large BSS
8809         sections to the end of the list of BSS sections.
8810         * symtab.h (class Symbol): Declare is_common_shndx.
8811         (Symbol::is_defined): Check Symbol::is_common_shndx.
8812         (Symbol::is_common): Likewise.
8813         (class Symbol_table): Define enum Commons_section_type.  Update
8814         declarations.  Add small_commons_ and large_commons_ fields.
8815         * symtab.cc (Symbol::is_common_shndx): New function.
8816         (Symbol_table::Symbol_table): Initialize new fields.
8817         (Symbol_table::add_from_object): Put small and large common
8818         symbols in the right list.
8819         (Symbol_table::sized_finalized_symbol): Check
8820         Symbol::is_common_shndx.
8821         (Symbol_table::sized_write_globals): Likewise.
8822         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8823         common symbol lists.  Don't call do_allocate_commons_list if the
8824         list is empty.
8825         (Symbol_table::do_allocate_commons_list): Remove is_tls
8826         parameter.  Add comons_section_type parameter.  Change all
8827         callers.  Handle small and large common symbols.
8828         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8829         Symbol::is_common_shndx.
8830         * resolve.cc (symbol_to_bits): Likewise.
8831         * target.h (Target::small_common_shndx): New function.
8832         (Target::small_common_section_flags): New function.
8833         (Target::large_common_shndx): New function.
8834         (Target::large_common_section_flags): New function.
8835         (Target::new_output_section): New function.
8836         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8837         small_common_section_flags, and large_common_section_flags
8838         fields.
8839         (Target::do_new_output_section): New virtual function.
8840         * arm.cc (Target_arm::arm_info): Initialize new fields.
8841         * i386.cc (Target_i386::i386_info): Likewise.
8842         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8843         Likewise.
8844         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8845         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8846         (Target_x86_64::do_new_output_section): New function.
8847         * configure.ac: Define conditional MCMODEL_MEDIUM.
8848         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8849         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8850         (large_LDFLAGS): Define.
8851         * testsuite/large.c: New file.
8852         * testsuite/testfile.cc (Target_test::test_target_info):
8853         Initialize new fields.
8854         * configure, testsuite/Makefile.in: Rebuild.
8856 2009-06-05  Doug Kwan  <dougkwan@google.com>
8858         * Makefile.am (CCFILES): Add target.cc.
8859         * Makefile.in: Regenerate.
8860         * i386.cc (class Target_i386): Define new virtual method to
8861         override do_is_local_label_name in parent.
8862         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8863         local symbols if --discard-locals or -X is given.
8864         * options.h (class General_options): Declare new options
8865         '--discard-locals' and '-X' for discarding locals.
8866         * target.h (class Target): Define new methods is_local_label_name.
8867         Declare new virtual method do_is_local_label_name.
8868         * target.cc: New file.
8869         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8870         (check_SCRIPTS): Add discard_locals_test.sh.
8871         (check_DATA): Add discard_local_tests.syms.
8872         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8873         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8874         * testsuite/Makefile.in: Regenerate.
8875         * testsuite/discard_locals_test.c: New file.
8876         * testsuite/discard_locals_test.sh: Same.
8878 2009-06-05  Doug Kwan  <dougkwan@google.com>
8880         * object.cc (Sized_relobj::Sized_relobj): Initialize
8881         discarded_eh_frame_shndx_ to -1U.
8882         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8883         section.
8884         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8885         a discarded .eh_frame section.
8886         (Sized_relobj::do_finalize_local_symbols): Ditto.
8887         * object.h (class Sized_relobj): Declare new member
8888         discarded_eh_frame_shndx_.
8889         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8890         (local_labels_test.o, local_labels_test): New rules.
8891         * testsuite/Makefile.in: Regenerate.
8893 2009-06-04  Doug Kwan  <dougkwan@google.com>
8895         * layout.cc (Layout::section_name_mapping): Add mapping for
8896         special ARM sections.
8898 2009-06-03  Doug Kwan  <dougkwan@google.com>
8900         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8901         (utils::has_overflow): Same.
8903 2009-06-03  Ian Lance Taylor  <iant@google.com>
8905         * layout.cc (Layout::section_name_mapping): New array, replacing
8906         Layout::linkonce_mapping.
8907         (Layout::section_name_mapping_count): New variable, replacing
8908         Layout::linkonce_mapping_count.
8909         (Layout::linkonce_output_name): Remove.
8910         (Layout::output_section_name): Rewrite.
8911         * layout.h (class Layout): Rename Linkonce_mapping to
8912         Section_name_mapping, linkonce_mapping to section_name_mapping,
8913         linkonce_mapping_count to section_name_mapping_count.  Don't
8914         declare linkonce_output_name.
8916 2009-06-03  Doug Kwan  <dougkwan@google.com>
8918         * gold/arm.cc (namespace utils): New.
8919         (Target_arm::reloc_is_non_pic): Define new method.
8920         (class Arm_relocate_functions): New.
8921         (Target_arm::Relocate::relocate): Handle relocation types used by
8922         Android.
8924 2009-06-03  Ian Lance Taylor  <iant@google.com>
8926         * arm.cc (Target_arm::scan::global): Use || instead of |.
8928 2009-06-02  Doug Kwan  <dougkwan@google.com>
8930         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8931         issued_non_pic_error_.
8932         (class Target_arm::Scan): Declare new method check_non_pic.
8933         Define new method symbol_needs_plt_entry.
8934         Declare new data member issued_non_pic_error_.
8935         (class Target_arm::Relocate): Declare new method
8936         should_apply_static_reloc.
8937         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8938         (Target_arm::Scan::check_non_pic): Define new method.
8939         (Target_arm::Scan::local): Handle a small subset of reloc types used
8940         by Android.
8941         (Target_arm::Scan::local): Same.
8942         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8944 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8946         * incremental.cc (Incremental_inputs::report_command_line): Filter
8947         out --incremental-* options.
8949 2009-05-29  Doug Kwan  <dougkwan@google.com>
8951         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8952         template class.
8953         (class Target_arm): Update comment.
8954         (Target_arm::Target_arm): Initialize new data members GOT_,
8955         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8956         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8957         and Target_arm::rel_dyn_section.
8958         Declare new_enum Target_arm::Got_type.
8959         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8960         and DYNBSS_.
8961         Update commments for member do_dynsym_value.
8962         (Target_arm::got_size, Target_arm::plt_section,
8963         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8964         new methods inside class defintion.
8965         (Target_arm::got_section): Define new method.
8966         (Target_arm::rel_dyn_section): Same.
8967         (Output_data_plt_arm): New template class.
8968         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8969         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8970         (Output_data_plt_arm::add_entry): Same.
8971         (Output_data_plt_arm::first_plt_entry): Define new
8972         static data member for PLT instruction template.
8973         (Output_data_plt_arm::plt_entry): Same.
8974         (Output_data_plt_arm::do_write): Define new method.
8975         (Target_arm::make_plt_entry): Same.
8976         (Target_arm::do_finalize_sections): Same.
8977         (Target_arm::do_dynsym_value): Same.
8979 2009-05-28  Doug Kwan  <dougkwan@google.com>
8981         * Makefile.am (TARGETSOURCES): Add arm.cc.
8982         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8983         * Makefile.in: Regenerate.
8984         * arm.cc: New file.
8985         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8987 2009-05-26  Doug Kwan  <dougkwan@google.com>
8989         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8990         (General_options::check_excluded_libs): Strip off directories in
8991         archive name before matching like GNU ld does.
8992         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8993         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8994         (exclude_libs_test_LDFLAGS): Add linker option
8995         -Wl,--exclude-libs,libexclude_libs_test_3
8996         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8997         an explicit archive without using -l.
8998         (alt/libexclude_libs_test_3.a): New make rule.
8999         * testsuite/Makefile.in: Regenerate.
9000         * testsuite/exclude_libs_test.c : Declare lib3_default().
9001         (main): Call it.
9002         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9003         * exclude_libs_test_3.c: New file.
9005 2009-05-26  Nick Clifton  <nickc@redhat.com>
9007         * po/id.po: New Indonesian translation.
9008         * po/gold.pot: Updated template file.
9010 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9012         * testsuite/Makefile.am: Add -ffunction-sections to compile
9013         gc_comdat_test files.  Add -Wl,--gc-sections to build
9014         gc_comdat_test.
9015         * testsuite/Makefile.in: Regenerate.
9016         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9018 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9020         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9021         kept comdat section was garbage collected.
9022         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9023         * testsuite/Makefile.in: Regenerate.
9024         * testsuite/gc_comdat_test.sh: New file.
9025         * testsuite/gc_comdat_test_1.cc: New file.
9026         * testsuite/gc_comdat_test_2.cc: New file.
9028 2009-05-19  Doug Kwan  <dougkwan@google.com>
9030         * archive.cc (Archive::Archive): Move constructor from archive.h
9031         to here.  Initialize no_export_.
9032         (Archive::get_elf_object_for_member): Set no_export flag of object.
9033         * archive.h (Archive::Archive): Move constructor body to
9034         archive.cc.
9035         (Archive::no_export): New method.
9036         (Archive::no_export_): New field.
9037         * object.h (Object::Object): Initialize no_export_ to false.
9038         (Object::no_export, Object::set_no_export): New methods.
9039         (Object::no_export_): New field.
9040         * options.cc (General_options::parse_exclude_libs): New method.
9041         (General_options::check_excluded_libs) Same.
9042         * options.h (exclude_libs): New option.
9043         (General_options::check_excluded_libs): New method declaration.
9044         (General_options::excluded_libs_): New field.
9045         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9046         default or protected visibility if an object has no-export flag set.
9047         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9048         (check_SCRIPTS): Add exclude_libs_test.sh.
9049         (check_DATA): Add exclude_libs_test.syms.
9050         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9051         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9052         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9053         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9054         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9055         libexclude_libs_test_2.a): New rules.
9056         * testsuite/Makefile.in: Regenerate.
9057         * testsuite/exclude_libs_test.c: New file.
9058         * testsuite/exclude_libs_test.sh: Ditto.
9059         * testsuite/exclude_libs_test_1.c: Ditto.
9060         * testsuite/exclude_libs_test_2.c: Ditto.
9062 2009-05-15  Ian Lance Taylor  <iant@google.com>
9064         * configure.ac: Check for declarations for cases where libiberty.h
9065         checks HAVE_DECL_xxx.
9066         * configure, config.in: Rebuild.
9068 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9070         * gold.h (Incremental_argument_list): Remove (invalid) forward
9071         declaration.
9072         * incremental.cc (Incremental_inputs::report_achive): New method.
9073         (Incremental_inputs::report_object): New method.
9074         (Incremental_inputs::report_script): New method.
9075         (Incremental_inputs::finalize_inputs): New method.
9076         (Incremental_inputs::finalize): Call finalize_inputs().
9077         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9078         Create inputs entries.
9079         * incremental.h (Incremental_input_type): New enum.
9080         (Incremental_inputs::Incremental_input): Initialize new fields.
9081         (Incremental_inputs::report_inputs): New method.
9082         (Incremental_inputs::report_achive): New method.
9083         (Incremental_inputs::report_object): New method.
9084         (Incremental_inputs::report_script): New method.
9085         (Incremental_inputs::finalize_inputs): New method.
9086         (Incremental_inputs::Input_info): New struct.
9087         (Incremental_inputs::Input_info_map): New typedef.
9088         (Incremental_inputs::lock_): New field.
9089         (Incremental_inputs::Inputs_): New field.
9090         (Incremental_inputs::Inputs_map): New field.
9091         * main.cc (main): Call Incremental_input::report_inputs.
9092         * options.h (Input_argument_list): Typedef moved from
9093         Input_arguments.
9094         (Input_file_group::Files): Remove, use ::Input_argument_list.
9095         (Input_file_group::Input_argument_list): Remove, use
9096         ::Input_argument_list.
9097         * plugin.cc (Plugin_manager::add_input_file): Add error in
9098         incremental build.
9099         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9100         functions.
9101         * script.cc (read_input_script): Call
9102         Incremental_input::report_script.
9103         * script.h (Script_info): New class.
9105 2009-04-27  Ian Lance Taylor  <iant@google.com>
9107         * x86_64.cc (do_adjust_output_section): Set entsize to
9108         plt_entry_size.
9110 2009-04-23  Elliott Hughes  <enh@google.com>
9112         * output.cc (Output_file::close): After short writes, continue
9113         writing from the correct offset in the buffer being written.
9115 2009-04-23  Chris Demetriou  <cgd@google.com>
9117         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9118         * configure: Regenerate.
9119         * config.in: Regenerate.
9120         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9121         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9123 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9125         * incremental.cc (Incremental_inputs_header_data): Renamed from
9126         Incremental_input_header_data.
9127         (Incremental_inputs_header_data::data_size): New field.
9128         (Incremental_inputs_header_data::put_input_file_count): Renamed
9129         from input_file_count.
9130         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9131         from command_line_offset.
9132         (Incremental_inputs_header_data::put_reserved): Renamed from
9133         put_reserved.
9134         (Incremental_inputs_entry_data): Renamed from
9135         Incremental_input_entry_data.
9136         (Incremental_inputs_entry_data::data_size): New field.
9137         (Incremental_inputs::report_command_line): New method.
9138         (Incremental_inputs::finalize): New method.
9139         (Incremental_inputs::create_incremental_inputs_data): New method.
9140         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9141         * incremental.h: New file.
9142         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9143        (Layout::finalize): Create incremental inputs section in
9144         incremental builds.
9145        (Layout::create_incremental_info_sections): New method.
9146         * layout.h (Layout::incremental_inputs): New method.
9147        (Layout::create_incremental_info_sections): New method.
9148        (Layout::incremental_inputs_): New field.
9149         * main.cc (main): Notify Incremental_input of the command line.
9151 2009-04-01  Ian Lance Taylor  <iant@google.com>
9152             Mikolaj Zalewski  <mikolajz@google.com>
9154         * gold.h (reserve_unordered_map): Define, three versions, one for
9155         each version of Unordered_map.
9156         * layout.cc (Layout::Layout): Remove options parameter.  Add
9157         number_of_input_files parameter.  Don't initialize options_.
9158         Initialize number_of_input_files_ and resized_signatures_.  Move
9159         sections_are_attached_.
9160         (Layout::layout_group): Reserve space for group_signatures_.
9161         (Layout::find_or_add_kept_section): Change name parameter to be a
9162         reference.  Resize signatures_ map when it gets large enough.
9163         (Layout::layout_eh_frame): Use parameters->options() instead of
9164         this->options_.
9165         (Layout::make_output_section): Likewise.
9166         (Layout::attach_allocated_section_to_segment): Likewise.
9167         (Layout::finalize, Layout::create_executable_stack): Likewise.
9168         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9169         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9170         * layout.h (class Layout): Update declarations.  Remove options_
9171         field.  Add number_of_input_files_ and resized_signatures_
9172         fields.  Move sections_are_attached_ field.
9173         * main.cc (main): Pass number of input files to Layout
9174         constructor.  Don't pass options.
9176 2009-03-30  Ian Lance Taylor  <iant@google.com>
9178         * ffsll.c (ffsll): Correct implementation.
9180 2009-03-27  Ian Lance Taylor  <iant@google.com>
9182         * ffsll.c: New file.
9183         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9184         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9185         * ftruncate.c (ftruncate): Declare before definition.
9186         * mremap.c (mremap): Likewise.
9187         * pread.c (pread): Likewise.
9188         * configure, Makefile.in, config.in: Rebuild.
9190         * mremap.c: New file.
9191         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9192         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9193         (mremap): Declare if HAVE_MREMAP is not defined.
9194         * configure, Makefile.in, config.in: Rebuild.
9196 2009-03-27  Cary Coutant  <ccoutant@google.com>
9198         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9199         position independent.
9200         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9201         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9203 2009-03-24  Cary Coutant  <ccoutant@google.com>
9205         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9206         an executable.
9207         (needs_dynamic_reloc): Likewise.
9209 2009-03-24  Ian Lance Taylor  <iant@google.com>
9211         * yyscript.y (file_cmd): Recognize EXTERN.
9212         (extern_name_list, extern_name_list_body): New nonterminals.
9213         * script.cc (script_add_extern): Define.
9214         * script-c.h (script_add_extern): Declare.
9216 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9218         * object.cc (is_elf_object): Define.
9219         * object.h (is_elf_object): Declare.
9220         * archive.cc (Archive::get_elf_object_for_member): Call
9221         is_elf_object.
9222         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9224 2009-03-24  Elliott Hughes  <enh@google.com>
9226         * output.cc (Output_file::map_anonymous): Define.
9227         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9228         try an anonymous one.  Report the size if the mmap fails.
9229         * output.h (class Output_file): Declare map_anonymous.
9231 2009-03-24  Ian Lance Taylor  <iant@google.com>
9233         * target-select.cc (instantiate_target): Don't acquire the lock if
9234         the instantiated_target_ field has already been set.
9236 2009-03-23  Ian Lance Taylor  <iant@google.com>
9238         * gold-threads.h (class Initialize_lock): Define.
9239         * gold-threads.cc (class Initialize_lock_once): Define.
9240         (initialize_lock_control): New static variable.
9241         (initialize_lock_pointer): New static variable.
9242         (initialize_lock_once): New static function.
9243         (Initialize_lock::Initialize_lock): Define.
9244         (Initialize_lock::initialize): Define.
9245         * target-select.h: Include "gold-threads.h".
9246         (class Target_selector): Add lock_ and initialize_lock_ fields.
9247         Don't define instantiate_target, just declare it.
9248         * target-select.cc (Target_selector::Target_selector): Initialize
9249         new fields.
9250         (Target_selector::instantiate_target): Define.
9251         * descriptors.h: Include "gold-threads.h".
9252         (class Descriptors): Add initialize_lock_ field.
9253         * descriptors.cc (Descriptors::Descriptors): Initialize new
9254         field.
9255         (Descriptors::open): Use initialize_lock_ field
9256         * errors.h (class Errors): Add initialize_lock_ field.
9257         * errors.cc (Errors::Errors): Initialize new field.
9258         (Errors::initialize_lock): Use initialize_lock_ field.
9259         * powerpc.cc (class Target_selector_powerpc): Remove
9260         instantiated_target_ field.  In do_recognize call
9261         instantiate_target rather than do_instantiate_target.  In
9262         do_instantiate_target just allocate a new target.
9263         * sparc.cc (class Target_selector_sparc): Likewise.
9265         * freebsd.h: New file.
9266         * i386.cc: Include "freebsd.h".
9267         (Target_i386): Derive from Target_freebsd rather than
9268         Sized_target.
9269         (Target_selector_i386): Derive from Target_selector_freebsd rather
9270         than Target_selector.
9271         * x86_64.cc: Include "freebsd.h".
9272         (Target_x86_64): Derive from Target_freebsd rather than
9273         Sized_target.
9274         (Target_selector_x86_64): Derive from Target_selector_freebsd
9275         rather than Target_selector.
9276         * target.h (class Target): Add adjust_elf_header and
9277         do_adjust_elf_header.
9278         * output.cc (Output_file_header:: do_sized_write): Call target
9279         adjust_elf_header routine.
9280         * configure.tgt: Set targ_osabi.
9281         * configure.ac: Define GOLD_DEFAULT_OSABI.
9282         * parameters.cc (Parameters::default_target): Pass
9283         GOLD_DEFAULT_OSABI to select_target.
9284         * target-select.h (class Target_selector): Make instantiate_target
9285         protected rather than private.
9286         * Makefile.am (HFILES): Add freebsd.h.
9287         * configure, Makefile.in, config.in: Rebuild.
9289         * merge.cc (do_add_input_section): Correct pend value.  Change
9290         message about last entry not being null terminated from error to
9291         warning.
9293 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9295         * incremental.cc: New file.
9296         * Makefile.am (CCFILES): Add incremental.cc.
9297         * Makefile.in: Rebuild.
9299 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9301         * layout.cc (Layout::output_section_name): Preserve names
9302         of '.note.' sections.
9304 2009-03-19  Ian Lance Taylor  <iant@google.com>
9306         * descriptors.cc (Descriptors::open): Check that the options are
9307         valid before using them.
9309 2009-03-18  Ian Lance Taylor  <iant@google.com>
9311         * script-sections.h: Include <list>.
9312         (class Script_sections): Change Sections_elements from std::vector
9313         to std::list.  Typedef public Elements_iterator.  Add
9314         orphan_section_placement_, data_segment_align_start_, and
9315         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9316         field.
9317         * script-sections.cc (class Orphan_section_placement): New class.
9318         (class Sections_element): Add virtual functions is_relro and
9319         orphan_section_init.  Remove virtual function place_orphan_here.
9320         (class Output_section_definition): Add is_relro and
9321         orphan_section_init.  Remove place_orphan_here.
9322         (class Orphan_output_section): Likewise.
9323         (Script_sections::Script_sections): Update for field changes.
9324         (Script_sections::data_segment_align): Set saw_data_segment_align_
9325         and data_segment_align_start_, not data_segment_align_index.
9326         (Script_sections::data_segment_relro_end): Check
9327         saw_data_segment_align_.  Use data_segment_align_start_ rather
9328         than data_segment_align_index_.
9329         (Script_sections::place_orphan): Rewrite to use
9330         Orphan_section_placement.
9332 2009-03-17  Ian Lance Taylor  <iant@google.com>
9334         * archive.cc (Archive::add_symbols): Check for a version attached
9335         to the symbol name in the archive map.
9336         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9337         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9338         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9339         (ver_test_11.a): New target.
9340         * testsuite/Makefile.in: Rebuild.
9342         * configure.ac: Check for chsize and posix_fallocate.  Replace
9343         ftruncate.
9344         * ftruncate.c: New file, from gnulib.
9345         * output.cc (posix_fallocate): Define dummy version if not
9346         HAVE_POSIX_FALLOCATE.
9347         (Output_file::map): Call posix_fallocate rather than lseek and
9348         write.
9349         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9350         * configure, Makefile.in, config.in: Rebuild.
9352 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9354         * layout.h (Layout::create_note): Add section_name parameter.
9355         * layout.cc (Layout::create_note): Likewise.
9356         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9358 2009-03-17  Ian Lance Taylor  <iant@google.com>
9360         * descriptors.cc: Include "options.h".
9361         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9362         (Descriptors::open): Always use O_CLOEXEC when opening a new
9363         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9364         then set FD_CLOEXEC.
9366         * sparc.cc (class Target_sparc): Add has_got_section.
9367         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9368         make sure we have a GOT section.
9370         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9371         (Target_sparc::Scan::local): Likewise.
9372         (Target_sparc::Scan::global): Likewise.
9373         (Target_sparc::Relocate::relocate): Likewise.
9374         (Target_sparc::Relocate::relocate_tls): Likewise.
9376         * symtab.cc (Symbol_table::define_default_version): New function,
9377         broken out of add_from_object.
9378         (Symbol_table::add_from_object): Call define_default_version.
9379         (Symbol_table::define_special_symbol): Add resolve_oldsym
9380         parameter.  Change all callers.  If the version for a symbol comes
9381         from a version script, resolve it with the symbol with the same
9382         name with no version.  Also add the symbol without a version if
9383         appropriate.
9384         (do_define_in_output_data): If resolving with oldsym, don't delete
9385         sym.
9386         (do_define_in_output_segment): Likewise.
9387         (do_define_as_constant): Likewise.
9388         * symtab.h (class Symbol_table): Update declarations.
9390 2009-03-13  Ian Lance Taylor  <iant@google.com>
9392         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9393         (Read_symbols::requeue): New function.
9394         (Read_symbols::do_read_symbols): If make_elf_object fails because
9395         the target type is not configured, and the file was searched for,
9396         issue a warning and retry with the next directory.
9397         (Add_symbols::run): If the file has an incompatible format, and
9398         it was searched for, requeue the Read_symbols task.  On error,
9399         release the object.
9400         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9401         dirindex parameter to constructor.  Change all callers.  Declare
9402         incompatible_warning and requeue.
9403         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9404         input_argument_ and input_group_ fields.  Add them to
9405         constructor.  Change all callers.
9406         (class Read_script): Add dirindex_ field.  Add it to constructor.
9407         Change all callers.
9408         * archive.cc (Archive::setup): Remove input_objects parameter.
9409         Change all callers.
9410         (Archive::get_file_and_offset): Likewise.
9411         (Archive::read_all_symbols): Likewise.
9412         (Archive::read_symbols): Likewise.
9413         (Archive::get_elf_object_for_member): Remove input_objects
9414         parameter.  Add punconfigured parameter.  Change all callers.
9415         (Archive::add_symbols): Change return type to bool.  Check return
9416         value of include_member.
9417         (Archive::include_all_members): Likewise.
9418         (Archive::include_member): Change return type to bool.  Return
9419         false if first included object has incompatible target.  Set
9420         included_member_ field.
9421         (Add_archive_symbols::run): If add_symbols returns false, requeue
9422         Read_symbols task.
9423         * archive.h (class Archive): Add included_member_ field.
9424         Initialize it in constructor.  Add input_file and searched_for
9425         methods.  Update declarations.
9426         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9427         input_argument_ fields.  Add them to constructor.  Change all
9428         callers.
9429         * script.cc: Include "target-select.h".
9430         (class Parser_closure): Add skip_on_incompatible_target_ and
9431         found_incompatible_target_ fields.  Add
9432         skip_on_incompatible_target parameter to constructor.  Change all
9433         callers.  Add methods skip_on_incompatible_target,
9434         clear_skip_on_incompatible_target, found_incompatible_target, and
9435         set_found_incompatible_target.
9436         (read_input_script): Add dirindex parameter.  Change all callers.
9437         If parser finds an incompatible target, requeue Read_symbols
9438         task.
9439         (script_set_symbol): Clear skip_on_incompatible_target in
9440         closure.
9441         (script_add_assertion, script_parse_option): Likewise.
9442         (script_start_sections, script_add_phdr): Likewise.
9443         (script_check_output_format): New function.
9444         * script.h (read_input_script): Update declaration.
9445         * script-c.h (script_check_output_format): Declare.
9446         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9447         (ignore_cmd): Remove OUTPUT_FORMAT.
9448         * fileread.cc (Input_file::Input_file): Add explicit this.
9449         (Input_file::will_search_for): New function.
9450         (Input_file::open): Add pindex parameter.  Change all callers.
9451         * fileread.h (class Input_file): Add input_file_argument method.
9452         Declare will_search_for.  Update declarations.
9453         * object.cc (make_elf_object): Add punconfigured parameter.
9454         Change all callers.
9455         * object.h (class Object): Make input_file public.  Add
9456         searched_for method.
9457         (make_elf_object): Update declaration.
9458         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9459         restart search.
9460         * dirsearch.h (class Dirsearch): Update declaration.
9461         * options.h (class General_options): Add --warn-search-mismatch.
9462         * parameters.cc (Parameters::is_compatible_target): New function.
9463         * parameters.h (class Parameters): Declare is_compatible_target.
9464         * workqueue.cc (Workqueue::add_blocker): New function.
9465         * workqueue.h (class Workqueue): Declare add_blocker.
9467         * fileread.cc (Input_file::open): Remove options parameter.
9468         Change all callers.
9469         (Input_file::open_binary): Likewise.
9470         * script.cc (read_input_script): Likewise.
9471         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9472         options parameter from constructor.  Change all callers.
9473         (class Read_script): Likewise.
9474         * fileread.h (class Input_file): Update declarations.
9475         * script.h (read_input_script): Update declaration.
9477 2009-03-10  Nick Clifton  <nickc@redhat.com>
9479         * po/es.po: New Spanish translation.
9481 2009-03-06  Cary Coutant  <ccoutant@google.com>
9483         * options.cc (parse_short_option): Keep dash_z from registering itself.
9485 2009-03-03  Ian Lance Taylor  <iant@google.com>
9487         PR 9918
9488         * target-reloc.h (relocate_section): Pass output_section to
9489         relocate.
9490         * i386.cc (Target_i386::should_apply_static_reloc): Add
9491         output_section parameter.  Change all callers.
9492         (Target_i386::Relocate::relocate): Add output_section parameter.
9493         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9494         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9495         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9496         * testsuite/two_file_shared.sh: New script.
9497         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9498         (check_DATA): Add two_file_shared.dbg.
9499         (two_file_shared.dbg): New target.
9500         * testsuite/Makefile.in: Rebuild.
9502 2009-03-01  Ian Lance Taylor  <iant@google.com>
9504         * configure.ac: Check for byteswap.h.
9505         * configure: Rebuild.
9506         * config.in: Rebuild.
9508 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9510         * layout.cc (Layout::find_or_add_kept_section): New function.
9511         (Layout::add_comdat): Removed.
9512         * layout.h (struct Kept_section): Move out of class Layout.
9513         Remove trailing underscores from field names.  Add group_sections
9514         field.  Rename group_ field to is_group.  Change all uses.
9515         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9516         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9517         comdat_groups_ field.
9518         (Sized_relobj::include_section_group): Use
9519         find_or_add_kept_section and Kept_section::group_sections.
9520         (Sized_relobj::include_linkonce_section): Likewise.
9521         * object.cc (class Sized_relobj): Don't define Comdat_group or
9522         Comdat_group_table.  Remove find_comdat_group and
9523         add_comdat_group.  Remove comdat_groups_ field.
9524         * plugin.cc (include_comdat_group): Use
9525         Layout::find_or_add_kept_section.
9527 2009-02-28  Ian Lance Taylor  <iant@google.com>
9529         * README: --gc-sections and map files are now supported.  Document
9530         some build requirements.
9532         PR 6992
9533         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9534         relocatable link set the value of the section symbol to zero.
9535         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9536         relocatable link don't include the section address in the local
9537         symbol value.
9539 2009-02-27  Ian Lance Taylor  <iant@google.com>
9541         PR 6811
9542         * options.h (class Search_directory): Add is_system_directory.
9543         (class General_options): Declare is_in_system_directory.
9544         * options.cc (get_relative_sysroot): Make static.
9545         (get_default_sysroot): Make static.
9546         (General_optoins::is_in_system_directory): New function.
9547         * fileread.cc (Input_file::is_in_system_directory): New function.
9548         * fileread.h (class Input_file): Declare is_in_system_directory.
9549         * object.h (class Object): Add is_in_system_directory.
9550         (class Input_objects): Remove system_library_directory_ field.
9551         * object.cc (Input_objects::add_object): Don't set
9552         system_library_directory_.
9553         (input_objects::found_in_system_library_directory): Remove.
9554         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9555         parameter.  Change all callers.
9556         (Symbol_table::sized_write_globals): Likewise.
9557         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9558         Call Object::is_in_system_directory.
9559         * symtab.h (class Symbol_table): Update declarations.
9561         PR 5990
9562         * descriptors.h (Open_descriptor): Add is_on_stack field.
9563         * descriptors.cc (Descriptors::open): If the descriptor is on the
9564         top of the stack, remove it.  Initialize is_on_stack field.
9565         (Descriptors::release): Only add pod to stack if it is not on the
9566         stack already.
9567         (Descriptors::close_some_descriptor): Clear stack_next and
9568         is_on_stack fields.
9570         PR 7091
9571         * output.cc (Output_section::find_starting_output_address): Rename
9572         from starting_output_address; add PADDR parameter; change return
9573         type.
9574         * output.h (class Output_section): Declare
9575         find_starting_output_address instead of starting_output_address.
9576         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9577         section symbol for which we can't find a merge section.
9579         PR 9836
9580         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9581         hidden or internal, force the symbol to be local.
9582         * resolve.cc (Symbol::override_visibility): Define.
9583         (Symbol::override_base): Use override_visibility.
9584         (Symbol_table::resolve): Likewise.
9585         (Symbol::override_base_with_special): Likewise.
9586         (Symbol_table::override_with_special): If the visibility is hidden
9587         or internal, force the symbol to be local.
9588         * symtab.h (class Symbol): Add set_visibility and
9589         override_visibility.
9590         * testsuite/ver_test_1.sh: New file.
9591         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9592         (check_DATA): Add ver_test_1.syms.
9593         (ver_test_1.syms): New target.
9594         * testsuite/Makefile.in: Rebuild.
9596 2009-02-25  Cary Coutant  <ccoutant@google.com>
9598         * layout.cc (Layout::choose_output_section): Don't rename sections
9599         when using a linker script that has a SECTIONS clause.
9600         * Makefile.in: Regenerate.
9602         * testsuite/Makefile.am (script_test_5.sh): New test case.
9603         * testsuite/Makefile.in: Regenerate.
9604         * testsuite/script_test_5.cc: New file.
9605         * testsuite/script_test_5.sh: New file.
9606         * testsuite/script_test_5.t: New file.
9608 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9610         * archive.cc (Archive::include_member): Update calls to add_symbols.
9611         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9612         the Layout argument.
9613         * dynobj.h (do_add_symbols): Add the Layout argument.
9614         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9615         Layout argument.
9616         * object.h (Object::add_symbols): Add the Layout argument.
9617         (Object::do_add_symbols): Add the Layout argument.
9618         (Sized_relobj::do_add_symbols): Add the Layout argument.
9619         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9620         Unify the two versions.
9621         (Add_plugin_symbols): Remove.
9622         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9623         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9624         (Add_plugin_symbols): Remove.
9625         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9626         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9627         (Add_symbols::run): Make it work with Pulginobj.
9629 2009-02-06  Ian Lance Taylor  <iant@google.com>
9631         * object.cc (Sized_relobj::do_layout): Make info message start
9632         with lower case letter.
9634 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9636         * binary.cc: Fix file comment.
9638         * options.h (enum Incremental_disposition): Define.
9639         (class General_options): Add new options: --incremental,
9640         --incremental_changed, --incremental_unchanged,
9641         --incremental_unknown.  Add incremental_disposition_ and
9642         implicit_incremental_ fields.
9643         (General_options::incremental_disposition): New function.
9644         (class Position_dependent_options): Add incremental_disposition
9645         option.
9646         (Position_dependent_options::copy_from_options): Set incremental
9647         dispositions.
9648         * options.cc (General_options::parse_incremental_changed): New
9649         function.
9650         (General_options::parse_incremental_unchanged): New function.
9651         (General_options::parse_incremental_unknown): New function.
9652         (General_options::General_options): Initialize new fields
9653         incremental_disposition_ and implicit_incremental_.
9654         (General_options::finalize): Check for uasge of --incremental-*
9655         without --incremental.
9657 2009-02-06  Chris Demetriou  <cgd@google.com>
9659         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9660         pointer and to report location as the file name associated with
9661         the symbol.
9662         (gold_undefined_symbol_at_location): New function to replace the
9663         old gold_undefined_symbol functionality.
9664         * target-reloc.h (relocate_section): Update to use
9665         gold_undefined_symbol_at_location.
9666         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9667         Call gold_undefined_symbol function rather than gold_error.
9668         * errors.h (Errors::undefined_symbol): Take location as a
9669         string, rather than calculating it from a relocation.
9670         * errors.cc (Errors::fatal): Print "fatal error:" before the
9671         formatted message.
9672         (Errors::error, Errors::error_at_location): Print "error: "
9673         before the formatted message.
9674         (Errors::undefined_symbol): Take location as a string, rather
9675         than calculating it from a relocation.
9676         (gold_undefined_symbol_at_location): New function akin to
9677         old gold_undefined_symbol, calculates location from relocation.
9678         (gold_undefined_symbol): Change to take only a Symbol pointer
9679         and to report location as the file name associated with the symbol.
9680         * testsuite/debug_msg.sh: Update for changed error messages.
9681         * testsuite/undef_symbol.sh: Likewise.
9683 2009-02-04  Duncan Sands  <baldrick@free.fr>
9685         PR 9812
9686         * reduced_debug_output.h
9687         (Output_reduced_debug_abbrev_section::failed): Use format for
9688         gold_warning.
9689         (Output_reduced_debug_info_section::faild): Likewise.
9691 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9693         * script.cc (Lazy_demangler): New class.
9694         (Version_script_info::get_symbol_version_helper): Demangle a
9695         symbol only once.
9697 2009-01-29  Cary Coutant  <ccoutant@google.com>
9699         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9700         to __tls_get_addr.
9701         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9703 2009-01-28  Ian Lance Taylor  <iant@google.com>
9705         * version.cc (version_string): Bump to 1.9.
9707         * gold.h: Include <cstring> and <stdint.h>.
9708         * version.cc: Include <cstdio>.
9709         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9710         warning.
9711         * reduced_debug_output.cc (insert_into_vector): Rename from
9712         Insert_into_vector; change all callers.  Use Swap_unaligned to
9713         avoid aliasing issue; remove union since it is unnecessary.
9715 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9717         * Makefile.am (CCFILES): Add gc.cc.
9718         (HFILES): Add gc.h.
9719         * Makefile.in: Regenerate.
9720         * gold.cc (Gc_runner): New class.
9721         (queue_initial_tasks): Call garbage collection related tasks
9722         when corresponding options are invoked.
9723         (queue_middle_gc_tasks): New function.
9724         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9725         processed early before laying out sections during garbage collection.
9726         * gold.h (queue_middle_gc_tasks): New function.
9727         (is_prefix_of): Move from "layout.cc".
9728         * i386.cc (Target_i386::gc_process_relocs): New function.
9729         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9730         * main.cc (main): Create object of class "Garbage_collection".
9731         * object.cc (Relobj::copy_symbols_data): New function.
9732         (Relobj::is_section_name_included): New function.
9733         (Sized_relobj::do_layout): Allow this function to be called twice
9734         during garbage collection and defer layout of section during the
9735         first call.
9736         * object.h (Relobj::get_symbols_data): New function.
9737         (Relobj::is_section_name_included): New function.
9738         (Relobj::copy_symbols_data): New function.
9739         (Relobj::set_symbols_data): New function.
9740         (Relobj::get_relocs_data): New function.
9741         (Relobj::set_relocs_data): New function.
9742         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9743         (Relobj::gc_process_relocs): New function.
9744         (Relobj::do_gc_process_relocs): New pure virtual function.
9745         (Relobj::sd_): New data member.
9746         (Sized_relobj::is_output_section_offset_invalid): New function.
9747         (Sized_relobj::do_gc_process_relocs): New function.
9748         * options.h (General_options::gc_sections): Modify to not be a no-op.
9749         (General_options::print_gc_sections): New option.
9750         * plugin.cc (Plugin_finish::run): Remove function call to
9751         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9752         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9753         * reloc.cc (Read_relocs::run): Add task to process relocs and
9754         determine unreferenced sections when doing garbage collection.
9755         (Gc_process_relocs): New class.
9756         (Sized_relobj::do_gc_process_relocs): New function.
9757         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9758         sections that are garbage collected.
9759         * reloc.h (Gc_process_relocs): New class.
9760         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9761         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9762         symbols whose corresponding sections are garbage collected.
9763         (Symbol_table::Symbol_table): Add new parameter for the garbage
9764         collection object.
9765         (Symbol_table::gc_mark_undef_symbols): New function.
9766         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9767         (Symbol_table::gc_mark_dyn_syms): New function.
9768         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9769         as garbage.
9770         (Symbol_table::add_from_object): Likewise.
9771         (Symbol_table::add_from_relobj): When building shared objects, do not
9772         treat externally visible symbols as garbage.
9773         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9774         table information for static and relocatable links.
9775         * symtab.h (Symbol_table::set_gc): New function.
9776         (Symbol_table::gc): New function.
9777         (Symbol_table::gc_mark_undef_symbols): New function.
9778         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9779         (Symbol_table::gc_mark_dyn_syms): New function.
9780         (Symbol_table::gc_): New data member.
9781         * target.h (Sized_target::gc_process_relocs): New pure virtual
9782         function.
9783         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9784         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9786 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9788         * options.h (General_options::gc_sections): Define as a no-op for now.
9789         (General_options::no_keep_memory): Ditto.
9790         (General_options::Bshareable): Define.
9791         * options.cc (General_options::finalize): Honor -Bshareable.
9793 2009-01-20  Andreas Schwab  <schwab@suse.de>
9795         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9796         read the value in the contents, since we don't use it.  Use the
9797         template endianness when writing.
9798         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9800 2009-01-19  Andreas Schwab  <schwab@suse.de>
9802         * configure.tgt (powerpc64-*): Fix targ_obj.
9804 2009-01-15  Ian Lance Taylor  <iant@google.com>
9806         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9807         local symbols when stripping all symbols.
9809 2009-01-14  Cary Coutant  <ccoutant@google.com>
9811         * output.cc (Output_reloc): Add explicit instantiations.
9813 2009-01-14  Cary Coutant  <ccoutant@google.com>
9815         * archive.cc (Archive::get_elf_object_for_member): Remove call
9816         to File_read::claim_for_plugin.
9817         * descriptors.cc (Descriptors::open): Remove reference to
9818         is_claimed.
9819         (Descriptors::claim_for_plugin): Remove.
9820         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9821         (Descriptors::is_claimed): Remove.
9822         (claim_descriptor_for_plugin): Remove.
9823         * fileread.cc (File_read::claim_for_plugin): Remove.
9824         * fileread.h (File_read::claim_for_plugin): Remove.
9825         (File_read::descriptor): Reopen descriptor if necessary.
9826         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9827         (Plugin_manager::all_symbols_read): Add task parameter. Change
9828         all callers.
9829         (Plugin_manager::get_input_file): New function.
9830         (Plugin_manager::release_input_file): New function.
9831         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9832         corresponding data member.
9833         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9834         and pass to base constructor. Change all callers.
9835         (get_input_file, release_input_file): New functions.
9836         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9837         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9838         (Plugin_manager::all_symbols_read): Add task parameter.
9839         (Plugin_manager::get_input_file): New function.
9840         (Plugin_manager::release_input_file): New function.
9841         (Plugin_manager::task_): New data member.
9842         (Pluginobj::Pluginobj): Add filesize parameter.
9843         (Pluginobj::filename): New function.
9844         (Pluginobj::descriptor): New function.
9845         (Pluginobj::filesize): New function.
9846         (Pluginobj::filesize_): New data member.
9847         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9848         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9849         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9851         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9852         with archive libraries.
9853         * testsuite/Makefile.in: Regenerate.
9854         * testsuite/plugin_test.c (struct sym_info): New type.
9855         (get_input_file, release_input_file): New static variables.
9856         (onload): Capture new transfer vector entries.
9857         (claim_file_hook): Stop reading at end of file according to filesize.
9858         Factor out parsing of readelf output into separate function.
9859         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9860         APIs and get the source file name from the symbol table.  Convert
9861         source file name to corresponding object file name.  Print info
9862         message when adding new input files.
9863         (parse_readelf_line): New function.
9864         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9865         * testsuite/plugin_test_2.sh: Likewise.
9866         * testsuite/plugin_test_3.sh: Likewise.
9867         * testsuite/plugin_test_4.sh: New test case.
9869 2009-01-07  Ian Lance Taylor  <iant@google.com>
9871         * version.cc (version_string): Bump to 1.8.
9873 2008-12-23  Cary Coutant  <ccoutant@google.com>
9875         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9876         * plugin.cc (Plugin_manager::finish): Rename as
9877         layout_deferred_objects.  Move cleanup to separate function.
9878         (Plugin_manager::cleanup): New function.
9879         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9880         separately.
9881         * plugin.h (Plugin_manager::finish): Rename as
9882         layout_deferred_objects.
9883         (Plugin_manager::cleanup): New function.
9884         (Plugin_manager::cleanup_done): New field.
9886 2008-12-23  Cary Coutant  <ccoutant@google.com>
9888         * plugin.cc (is_visible_from_outside): New function.
9889         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9890         so we don't return "IR only" status for exported symbols or -r links.
9892         * testsuite/Makefile.am (plugin_test_3): New test case.
9893         * testsuite/Makefile.in: Regenerate.
9894         * testsuite/plugin_test_3.sh: New file.
9896 2008-12-22  Cary Coutant  <ccoutant@google.com>
9898         * object.cc (Sized_relobj::layout_section): New function.
9899         (Sized_relobj::do_layout): Defer layout of input sections until after
9900         plugin has provided replacement files.
9901         (Sized_relobj::do_layout_deferred_sections): New function.
9902         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9903         (Relobj::layout_deferred_sections): New function.
9904         (Relobj::do_layout_deferred_sections): New function.
9905         (Sized_relobj::do_layout_deferred_sections): New function.
9906         (Sized_relobj::layout_section): New function.
9907         (Sized_relobj::Deferred_layout): New structure.
9908         (Sized_relobj::deferred_layout_): New field.
9909         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9910         Change all callers.  Layout deferred sections.
9911         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9912         references.
9913         (Plugin_hook::run): Move code from do_plugin_hook inline.
9914         (Plugin_hook::do_plugin_hook): Remove.
9915         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9916         (Plugin_manager::finish): Renamed, was cleanup.
9917         (Plugin_manager::should_defer_layout): New function.
9918         (Plugin_manager::add_deferred_layout_object): New function.
9919         (Plugin_manager::Deferred_layout_list): New type.
9920         (Plugin_manager::deferred_layout_objects_): New field.
9921         (Plugin_hook::do_plugin_hook): Remove.
9923 2008-12-17  Ian Lance Taylor  <iant@google.com>
9925         * options.h (class General_options): Add --no case for
9926         --export-dynamic.
9928 2008-12-16  Cary Coutant  <ccoutant@google.com>
9930         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9931         vector.
9932         (Plugin_manager::claim_file): Create plugin object even if
9933         plugin did not call the add_symbols callback.
9934         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9935         asking for more symbols than were added.
9936         * testsuite/Makefile.am (plugin_test_1): Add test case with
9937         no global symbols.
9938         (empty.syms): New target.
9939         * testsuite/Makefile.in: Regenerate.
9940         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9941         message. Don't call add_symbols if no globals.
9942         (all_symbols_read_hook): Don't provide replacement for empty
9943         claimed file.
9945 2008-12-12  Ian Lance Taylor  <iant@google.com>
9947         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9948         r_type == 0 for a local symbol with r_sym == 0.
9949         (scan_relocatable_relocs): Pass r_sym to
9950         local_non_section_strategy.
9951         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9952         r_sym parameter.
9954         * configure.ac: Update test for TLS descriptors: they are
9955         supported as of glibc 2.9.
9956         * configure: Rebuild.
9958 2008-12-11  Ian Lance Taylor  <iant@google.com>
9960         PR 7091
9961         * target-reloc.h (Default_scan_relocatable_relocs): For each
9962         function, map r_type == 0 to RELOC_DISCARD.
9964 2008-12-10  Cary Coutant  <ccoutant@google.com>
9966         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9967         object to override a kept COMDAT group from a plugin object.
9969 2008-12-09  Ian Lance Taylor  <iant@google.com>
9971         PR 7088
9972         * yyscript.y (file_cmd): Handle INPUT.
9974         * testsuite/initpri1.c: Change all declarations to be full
9975         prototypes by adding void, to avoid compiler warnings.
9977 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9979         * options.cc (General_options::parse_plugin_opt): New.
9980         (General_options::add_plugin): The argument now is just the filename.
9981         (General_options::add_plugin_option): New.
9982         * options.h (plugin_opt): New.
9983         (add_plugin): Change argument name.
9984         (add_plugin_option): New.
9985         * plugin.cc (Plugin::load): Don't parse the plugin option.
9986         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9987         (Plugin::add_option): New.
9988         (Plugin::args_): Change type.
9989         (Plugin::filename_): New.
9990         (Plugin_manager::add_plugin_option): New.
9991         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9992         * testsuite/Makefile.in: Regenerate.
9994 2008-12-05  Cary Coutant  <ccoutant@google.com>
9996         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9997         Handle --strip-lto-sections option.
9998         * options.h (strip_lto_sections): New option.
10000 2008-12-01  Cary Coutant  <ccoutant@google.com>
10002         * plugin.cc (ld_plugin_message): Change format parameter to const.
10003         Fix mismatch between new[] and delete.
10005 2008-11-14  Cary Coutant  <ccoutant@google.com>
10007         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10008         instead of -1U.
10010 2008-11-05  Craig Silverstein  <csilvers@google.com>
10012         * options.cc (General_options::parse_dynamic_list): New function.
10013         * options.h (General_options): New flags dynamic_list,
10014         dynamic_list_data, dynamic_list_cpp_new, and
10015         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10016         (General_options::in_dynamic_list): New function.
10017         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10018         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10019         (Lex::can_continue_name): Likewise.
10020         (yylex): Likewise.
10021         (read_script_file): New parameter script_options.
10022         (read_dynamic_list): New function.
10023         (Script_options::define_dynamic_list): New function.
10024         (dynamic_list_keyword_parsecodes): New variable.
10025         (dynamic_list_keywords): New variable.
10026         * script.h (Script_options::define_dynamic_list): New function
10027         prototype.
10028         (read_dynamic_list): New function prototype.
10029         * symtab.cc (strprefix): New macro.
10030         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10031         dynamic_list_data, dynamic_list_cpp_new, and
10032         dynamic_list_cpp_typeinfo.
10033         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10034         (dynamic_list_expr): New rule.
10035         (dynamic_list_nodes): Likewise.
10036         (dynamic_list_node): Likewise.
10037         * testsuite/Makefile.am (dynamic_list): New test.
10038         * testsuite/Makefile.in: Regenerated.
10039         * testsuite/dynamic_list.t: New file.
10040         * testsuite/dynamic_list.sh: New file.
10042 2008-11-05  Craig Silverstein  <csilvers@google.com>
10044         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10045         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10046         (t11_last): Likewise.
10047         * testsuite/ver_test_6.c (main): Likewise.
10049 2008-10-07  Cary Coutant  <ccoutant@google.com>
10051         * options.c (General_options::finalize): Add check for -static and
10052         -shared.
10053         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10054         is not empty.
10056 2008-10-02  Cary Coutant  <ccoutant@google.com>
10058         * plugin.cc (make_sized_plugin_object): Fix conditional
10059         compilation to work when not all targets are enabled.
10061 2008-09-29  Cary Coutant  <ccoutant@google.com>
10063         * archive.cc (Archive::get_file_and_offset): Use filename instead
10064         of name to get library path.
10065         (Archive::include_member): Unlock external member of a thin archive.
10067         * testsuite/Makefile.am (TEST_AR): New variable.
10068         (thin_archive_test_1): New test.
10069         (thin_archive_test_2): New test.
10070         * testsuite/Makefile.in: Regenerate.
10071         * testsuite/thin_archive_main.cc: New file.
10072         * testsuite/thin_archive_test_1.cc: New file.
10073         * testsuite/thin_archive_test_2.cc: New file.
10074         * testsuite/thin_archive_test_3.cc: New file.
10075         * testsuite/thin_archive_test_4.cc: New file.
10077 2008-09-29  Cary Coutant  <ccoutant@google.com>
10079         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10080         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10081         instead of -1U.
10082         (Sized_relobj::do_finalize_local_symbols): Likewise.
10083         (Sized_relobj::map_to_kept_section): Likewise.
10084         * object.h (Sized_relobj::invalid_address): New constant.
10085         (Sized_relobj::do_output_section_offset): Check for invalid_address
10086         and return -1ULL.
10087         * output.cc (Output_reloc::local_section_offset): Use constant
10088         invalid_address instead of -1U.
10089         (Output_reloc::get_address): Likewise.
10090         (Output_section::output_address): Change -1U to -1ULL.
10091         * output.h (Output_reloc::invalid_address): New constant.
10092         * reloc.cc (Sized_relobj::write_sections): Use constant
10093         invalid_address instead of -1U.
10094         (Sized_relobj::relocate_sections): Likewise.
10095         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10096         values for merge sections.
10097         * target-reloc.h (relocate_for_relocatable): Use constant
10098         invalid_address instead of -1U.
10100 2008-09-19  Cary Coutant  <ccoutant@google.com>
10102         Add plugin functionality for link-time optimization (LTO).
10103         * configure.ac (plugins): Add --enable-plugins option.
10104         * configure: Regenerate.
10105         * config.in: Regenerate.
10106         * Makefile.am (LIBDL): New variable.
10107         (CCFILES): Add plugin.cc.
10108         (HFILES): Add plugin.h.
10109         (ldadd_var): Add LIBDL.
10110         * Makefile.in: Regenerate.
10112         * archive.cc: Include "plugin.h".
10113         (Archive::setup): Don't preread archive symbols when using a plugin.
10114         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10115         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10116         files.
10117         (Archive::include_member): Add symbols from plugin objects.
10118         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10119         * descriptors.cc (Descriptors::open): Check for file descriptors
10120         abandoned by plugins.
10121         (Descriptors::claim_for_plugin): New function.
10122         * descriptors.h (Descriptors::claim_for_plugin): New function.
10123         (Open_descriptor::is_claimed): New field.
10124         (claim_descriptor_for_plugin): New function.
10125         * fileread.cc (File_read::claim_for_plugin): New function.
10126         * fileread.h (File_read::claim_for_plugin): New function.
10127         (File_read::descriptor): New function.
10128         * gold.cc: Include "plugin.h".
10129         (queue_initial_tasks): Add task to call plugin hooks for generating
10130         new object files.
10131         * main.cc: Include "plugin.h".
10132         (main): Load plugin libraries.
10133         * object.h (Pluginobj): Declare.
10134         (Object::pluginobj): New function.
10135         (Object::do_pluginobj): New function.
10136         (Object::set_target): New function.
10137         * options.cc: Include "plugin.h".
10138         (General_options::parse_plugin): New function.
10139         (General_options::General_options): Initialize plugins_ field.
10140         (General_options::add_plugin): New function.
10141         * options.h (Plugin_manager): Declare.
10142         (General_options): Add --plugin option.
10143         (General_options::has_plugins): New function.
10144         (General_options::plugins): New function.
10145         (General_options::add_plugin): New function.
10146         (General_options::plugins_): New field.
10147         * plugin.cc: New file.
10148         * plugin.h: New file.
10149         * readsyms.cc: Include "plugin.h".
10150         (Read_symbols::do_read_symbols): Check for archive before checking
10151         for ELF file.  Call plugin hooks to claim files.
10152         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10153         from a real object file; force override when processing replacement
10154         files.
10155         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10156         (Symbol::init_base_object): Likewise.
10157         (Symbol::init_base_output_data): Likewise.
10158         (Symbol::init_base_output_segment): Likewise.
10159         (Symbol::init_base_constant): Likewise.
10160         (Symbol::init_base_undefined): Likewise.
10161         (Symbol::output_section): Assert that object is not a plugin.
10162         (Symbol_table::add_from_pluginobj): New function.
10163         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10164         undefined.
10165         (Symbol_table::sized_write_globals): Likewise.
10166         (Symbol_table::add_from_pluginobj): Instantiate template.
10167         * symtab.h (Sized_pluginobj): Declare.
10168         (Symbol::in_real_elf): New function.
10169         (Symbol::set_in_real_elf): New function.
10170         (Symbol::in_real_elf_): New field.
10171         (Symbol_table::add_from_pluginobj): New function.
10173         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10174         (LIBDL): New variable.
10175         (LDADD): Add LIBDL.
10176         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10177         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10178         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10179         (MOSTLYCLEANFILES): Likewise.
10180         * testsuite/Makefile.in: Regenerate.
10181         * testsuite/plugin_test.c: New file.
10182         * testsuite/plugin_test_1.sh: New file.
10183         * testsuite/plugin_test_2.sh: New file.
10185 2008-09-16  Ian Lance Taylor  <iant@google.com>
10187         * target-reloc.h (relocate_section): Check whether a symbol is
10188         defined by the ABI before reporting an undefined symbol error.
10189         * target.h (Target::is_defined_by_abi): Make parameter const.
10190         (Target::do_is_defined_by_abi): Likewise.
10191         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10192         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10193         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10194         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10195         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10196         * testsuite/Makefile.in: Rebuild.
10198         * fileread.cc (make_view): Add casts to avoid warning.
10200 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10202         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10203         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10205 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10207         * options.h (General_options::output_is_executable): New.
10208         (General_options::output_is_pie): New.
10209         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10210         for shared libraries.
10211         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10213 2008-09-11  Chris Demetriou  <cgd@google.com>
10215         * options.h (origin): New -z option.
10216         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10217         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10218         in DT_FLAGS_1.
10220 2008-09-05  Cary Coutant  <ccoutant@google.com>
10222         * fileread.cc (File_read::make_view): Add check for attempt to map
10223         beyond end of file.
10225 2008-09-05  Cary Coutant  <ccoutant@google.com>
10227         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10228         explicit instantiations.
10230 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10232         PR gold/6858
10233         * options.cc (General_options::finalize): Allow undefined symbols
10234         in shlibs if linking -shared.
10236         PR gold/6859
10237         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10238         symbols as not needing a dynsym entry.
10240 2008-08-20  Craig Silverstein  <csilvers@google.com>
10242         * fileread.cc (File_read::open): Do not lock the file unless it
10243         was successfully opened.
10245 2008-08-14  Cary Coutant  <ccoutant@google.com>
10247         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10248         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10249         * testsuite/tls_test.cc (struct int128): 128-bit struct
10250         for testing TLS relocs with non-zero addend.
10251         (v12): New TLS variable.
10252         (t12): New test.
10253         (t_last): Add check for v12.
10254         * testsuite/tls_test.h (t12): New function.
10255         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10257 2008-08-13  Ian Lance Taylor  <iant@google.com>
10259         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10260         set tls_segment_ or relro_segment_.
10261         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10262         when appropriate.
10263         * output.h (Output_section::clear_is_relro): New function.
10264         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10265         sections specially even when output_data_ is empty.
10266         (Output_segment::maximum_alignment): When first section is relro,
10267         only force alignment for PT_LOAD segments.
10268         * script.cc (script_data_segment_align): New function.
10269         (script_data_segment_relro_end): New function.
10270         * script-c.h (script_data_segment_align): Declare.
10271         (script_data_segment_relro_end): Declare.
10272         * script-sections.h (class Script_sections): Declare
10273         data_segment_align and data_segment_relro_end.  Add fields
10274         segment_align_index_ and saw_relro_end_.
10275         * script-sections.cc (class Sections_element): Add set_is_relro
10276         virtual function.  Add new bool* parameter to place_orphan_here.
10277         Add get_output_section virtual function.
10278         (class Output_section_definition): Add set_is_relro.  Add new
10279         bool* parameter to place_orphan_here.  Add get_output_section.
10280         Add is_relro_ field.
10281         (Output_section_definition::Output_section_definition): Initialize
10282         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10283         and is_relro_ fields.
10284         (Output_section_definition::place_orphan_here): Add is_relro
10285         parameter.
10286         (Output_section_definition::set_section_addresses): Set relro for
10287         output section.
10288         (Output_section_definition::alternate_constraint): Likewise.
10289         (class Orphan_output_section): Add new bool* parameter to
10290         place_orphan_here.  Add get_output_section.
10291         (Orphan_output_section::place_orphan_here): Add is_relro
10292         parameter.
10293         (Script_sections::Script_sections): Initialize
10294         data_segment_align_index_ and saw_relro_end_.
10295         (Script_sections::data_segment_align): New function.
10296         (Script_sections::data_segment_relro_end): New function.
10297         (Script_sections::place_orphan): Set or clear is_relro.
10298         (Script_sections::set_section_addresses): Force alignment of first
10299         TLS section.
10300         * yyscript.y (exp): Call script_data_segment_align and
10301         script_data_segment_relro_end.
10302         * testsuite/relro_script_test.t: New file.
10303         * testsuite/relro_test.cc (using_script): Declare.
10304         (t1, t2): Test using_script.
10305         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10306         (relro_script_test_SOURCES): Define.
10307         (relro_script_test_DEPENDENCIES): Define.
10308         (relro_script_test_LDFLAGS): Define.
10309         (relro_script_test_LDADD): Define.
10310         (relro_script_test.so): New target.
10311         * testsuite/Makefile.in: Rebuild.
10313 2008-08-06  Cary Coutant <ccoutant@google.com>
10315         * archive.cc (Archive::total_archives, Archive::total_members)
10316         (Archive::total_members_loaded): New variables.
10317         (Archive::setup): Add parameter.  Add option to preread
10318         archive symbols.
10319         (Archive::read_armap): Add counter.
10320         (Archive::get_file_and_offset): New function.
10321         (Archive::get_elf_object_for_member): New function.
10322         (Archive::read_all_symbols): New function.
10323         (Archive::read_symbols): New function.
10324         (Archive::add_symbols): Add counters.
10325         (Archive::include_all_members): Use armap to find members if it's
10326         already built.
10327         (Archive::include_member): Skip reading symbols if already read.
10328         Factored code into Archive::get_file_and_offset and
10329         Archive::get_elf_object_for_member.  Changed call to
10330         Mapfile::report_include_archive_member.
10331         (Archive::print_stats): New function.
10332         * archive.h: Declare Object and Read_symbols_data classes.
10333         (Archive::Archive): Add initializers for new members.
10334         (Archive::setup): Add parameter.
10335         (Archive::print_stats): New function.
10336         (Archive::total_archives, Archive::total_members)
10337         (Archive::total_members_loaded): New variables.
10338         (Archive::get_file_and_offset): New function.
10339         (Archive::get_elf_object_for_member): New function.
10340         (Archive::read_all_symbols): New function.
10341         (Archive::read_symbols): New function.
10342         (Archive::Archive_member): New class.
10343         (Archive::members_): New member.
10344         (Archive::num_members_): New member.
10345         * main.cc: Include archive.h.
10346         (main): Call Archive::print_stats.
10347         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10348         archive parameter; member_name is now the fully-decorated name.
10349         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10350         * options.h: (General_options): Add --preread-archive-symbols option.
10351         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10352         Archive::setup.
10354 2008-08-04  Ian Lance Taylor  <iant@google.com>
10356         * symtab.h (Symbol::use_plt_offset): New function.
10357         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10358         * powerpc.cc (Relocate::relocate): Likewise.
10359         * sparc.cc (Relocate::relocate): Likewise.
10360         * x86_64.cc (Relocate::relocate): Likewise.
10361         * testsuite/weak_plt.sh: New test.
10362         * testsuite/weak_plt_main.cc: New test.
10363         * testsuite/weak_plt_shared.cc: New test.
10364         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10365         (check_PROGRAMS): Add weak_plt.
10366         (check_DATA): Add weak_plt_shared.so.
10367         (weak_plt_main_pic.o, weak_plt): New targets.
10368         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10369         * testsuite/Makefile.in: Rebuild.
10371         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10372         gcctestdir/ld.
10373         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10374         * testsuite/Makefile.in: Rebuild.
10376 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10378         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10379         * Makefile.in: Regenerate.
10380         * po/POTFILES.in: Regenerate.
10382 2008-07-29  Ian Lance Taylor  <iant@google.com>
10384         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10385         symbols before other symbols.
10386         * testsuite/script_test_2.cc (test_addr): Declare.
10387         (test_addr_alias): Declare.
10388         (main): Check that test_addr and test_addr_alias have the right
10389         values.
10390         * testsuite/script_test_2.t: Define test_addr_alias and
10391         test_addr.
10393 2008-07-24  Ian Lance Taylor  <iant@google.com>
10395         PR 5990
10396         * descriptors.cc: New file.
10397         * descriptors.h: New file.
10398         * gold-threads.h (class Hold_optional_lock): New class.
10399         * fileread.cc: Include "descriptors.h".
10400         (File_read::~File_read): Release descriptor rather than closing
10401         it.
10402         (File_read::open) [file]: Call open_descriptor rather than open.
10403         Set is_descriptor_opened_.
10404         (File_read::open) [memory]: Assert that descriptor is not open.
10405         (File_read::reopen_descriptor): New function.
10406         (File_read::release): Release descriptor.
10407         (File_read::do_read): Make non-const.  Reopen descriptor.
10408         (File_read::read): Make non-const.
10409         (File_read::make_view): Reopen descriptor.
10410         (File_read::do_readv): Likewise.
10411         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10412         Update declarations.
10413         * layout.cc: Include "descriptors.h".
10414         (Layout::create_build_id): Use open_descriptor rather than open.
10415         * output.cc: Include "descriptors.h".
10416         (Output_file::open): Use open_descriptor rather than open.
10417         * archive.cc (Archive::const_iterator): Change Archive to be
10418         non-const.
10419         (Archive::begin, Archive::end): Make non-const.
10420         (Archive::count_members): Likewise.
10421         * archive.h (class Archive): Update declarations.
10422         * object.h (Object::read): Make non-const.
10423         * Makefile.am (CCFILES): Add descriptors.cc.
10424         (HFILES): Add descriptors.h.
10425         * Makefile.in: Rebuild.
10427         PR 6716
10428         * gold.h: Always include <clocale>.  Add Solaris workarounds
10429         following code in binutils/sysdep.h.
10431         PR 6048
10432         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10433         this->eh_frame_hdr_ is NULL before using it.
10435         * dynobj.cc (Versions::Versions): Update comment.
10437         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10438         the base version name.
10440         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10441         array size plus one.
10442         (Stringpool_template::set_string_offsets): Subtract one from key
10443         before using it as an array index.
10444         (Stringpool_template::get_offset_with_length): Likewise.
10445         (Stringpool_template::write_to_buffer): Likewise.
10446         * stringpool.h (Stringpool_template::get_offset_from_key):
10447         Likewise.
10449 2008-07-23  Ian Lance Taylor  <iant@google.com>
10451         PR 6658
10452         * object.h (Merged_symbol_value::value): Do our best to handle a
10453         negative addend.
10455         PR 6647
10456         * script.cc (Version_script_info::get_versions): Don't add empty
10457         version tag to return value.
10458         (Version_script_info::get_symbol_version_helper): Change return
10459         type to bool.  Add pversion parameter.  Change all callers.
10460         (script_register_vers_node): Don't require a non-NULL tag.
10461         * script.h (class Version_script_info): Update declarations.
10462         (Version_script_info::get_symbol_version): Change return type to
10463         bool.  Add version parameter.  Change all callers.
10464         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10465         handling.  Handle an empty version from a version script.
10466         (Symbol_table::define_special_symbol): Likewise.
10467         * testsuite/ver_test_10.script: New file.
10468         * testsuite/ver_test_10.sh: New file.
10469         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10470         (check_DATA): Add ver_test_10.syms.
10471         (ver_test_10.syms, ver_test_10.so): New target.
10472         * testsuite/Makefile.in: Rebuild.
10474 2008-07-23  Simon Baldwin  <simonb@google.com>
10476         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10477         to zero for undefined symbols from dynamic libraries.
10479 2008-07-23  Ian Lance Taylor  <iant@google.com>
10481         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10482         Change all callers.
10483         * symtab.h (class Symbol_table): Update declaration.
10484         * testsuite/ver_test_9.cc: New file.
10485         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10486         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10487         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10488         (ver_test_9.so, ver_test_9.o): New targets.
10489         * testsuite/Makefile.in: Rebuild.
10491 2008-07-22  Ian Lance Taylor  <iant@google.com>
10493         * options.h (class General_options): Define --check-sections.
10494         * layout.cc (Layout::set_segment_offsets): Handle
10495         --check-sections.
10497         * options.h (class General_options): Define -n/--nmagic and
10498         -N/--omagic.
10499         * options.cc (General_options::finalize): For -n/--nmagic or
10500         -N/--omagic, set -static.
10501         * layout.cc (Layout::attach_allocated_section_to_segment): If
10502         -N/--omagic, don't put read-only and read-write sections in
10503         different segments.
10504         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10505         finding a read-only segment.
10506         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10507         don't set the minimum segment alignment to the common page size,
10508         and don't set the file offset to the address modulo the page size.
10509         * script-sections.cc (Script_sections::create_segments): If
10510         -n/--omagic, don't put read-only and read-write sections in
10511         different segments.
10513         * cref.cc: New file.
10514         * cref.h: New file.
10515         * options.h (class General_options): Add --print-symbol-counts.
10516         * main.cc (main): Issue defined symbol report if requested.
10517         * archive.cc (Archive::interpret_header): Make into a const member
10518         function.
10519         (Archive::add_symbols): Call Input_objects::archive_start and
10520         archive_stop.
10521         (Archive::const_iterator): Define new class.
10522         (Archive::begin, Archive::end): New functions.
10523         (Archive::include_all_members): Rewrite to use iterator.
10524         (Archive::count_members): New function.
10525         * archive.h (class Archive): Update declarations.
10526         (Archive::filename): New function.
10527         * object.cc: Include "cref.h".
10528         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10529         (Sized_relobj::do_get_global_symbol_counts): New function.
10530         (Input_objects::add_object): Add object to cross-referencer.
10531         (Input_objects::archive_start): New function.
10532         (Input_objects::archive_stop): New function.
10533         (Input_objects::print_symbol_counts): New function.
10534         * object.h: Declare Cref and Archive.
10535         (Object::get_global_symbol_counts): New function.
10536         (Object::do_get_global_symbol_counts): New pure virtual function.
10537         (class Sized_relobj): Add defined_count_ field.  Update
10538         declarations.
10539         (class Input_objects): Add cref_ field.  Update constructor.
10540         Update declarations.
10541         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10542         defined_count_.
10543         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10544         symbol counts.
10545         (Sized_dynobj::do_get_global_symbol_counts): New function.
10546         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10547         defined_count_.  Update declarations.  Define Symbols typedef.
10548         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10549         parameter.  Change all callers.
10550         (Symbol_table::add_from_dynobj): Add sympointers and defined
10551         parameters.  Change all callers.
10552         * symtab.h (class Symbol_table): Update declarations.
10553         * Makefile.am (CCFILES): Add cref.cc.
10554         (HFILES): Add cref.h.
10555         * Makefile.in: Rebuild.
10557 2008-07-22  Simon Baldwin  <simonb@google.com>
10559         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10560         to zero when writing undefined symbols.
10562 2008-07-22  Ian Lance Taylor  <iant@google.com>
10564         * output.cc (Output_section::add_input_section): Don't try to
10565         merge empty merge sections.
10567 2008-07-21  Craig Silverstein  <csilvers@google.com>
10569         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10570         Include symbol version in error message.
10572 2008-07-20  Chris Demetriou  <cgd@google.com>
10574         * configure.ac (gold_cv_c_random_seed): New configured variable.
10575         (RANDOM_SEED_CFLAGS): New substituted variable.
10576         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10577         * configure: Rebuild.
10578         * Makefile.in: Likewise.
10579         * testsuite/Makefile.in: Likewise.
10581 2008-07-18  Ian Lance Taylor  <iant@google.com>
10583         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10584         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10585         * testsuite/ver_test_main.cc (main): Call t4.
10586         (t4, t4_2a): Define.
10587         * testsuite/ver_test_2.cc (t4_2): Define.
10588         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10589         * testsuite/ver_test_4.cc (t4_2a): Define.
10590         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10591         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10593 2008-07-17  Ian Lance Taylor  <iant@google.com>
10595         * dynobj.cc (Versions::add_def): If we give an error about a
10596         missing version, go ahead and create the version anyhow.
10598 2008-07-10  Ian Lance Taylor  <iant@google.com>
10600         Handle output sections with more than 0x7fffffff bytes.
10601         * object.h (class Relobj): Change map_to_output_ to
10602         output_sections_, and just keep a section pointer.  Change all
10603         uses.  Move comdat group support to Sized_relobj.
10604         (Relobj::is_section_specially_mapped): Remove.
10605         (Relobj::output_section): Remove poff parameter.  Change all
10606         callers.
10607         (Relobj::output_section_offset): New function.
10608         (Relobj::set_section_offset): Rewrite.
10609         (Relobj::map_to_output): Remove.
10610         (Relobj::output_sections): New function.
10611         (Relobj::do_output_section_offset): New pure virtual function.
10612         (Relobj::do_set_section_offset): Likewise.
10613         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10614         group support from Relobj.  Update declarations.
10615         (Sized_relobj::get_output_section_offset): New function.
10616         (Sized_relobj::do_output_section_offset): New function.
10617         (Sized_relobj::do_set_section_offset): New function.
10618         * object.cc (Relobj::output_section_address): Remove.
10619         (Sized_relobj::Sized_relobj): Initialize new fields.
10620         (Sized_relobj::include_section_group): Cast find_kept_object to
10621         Sized_relobj.
10622         (Sized_relobj::include_linkonce_section): Likewise.
10623         (Sized_relobj::do_layout): Use separate arrays for output section
10624         and output offset.
10625         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10626         output_sections.
10627         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10628         output_sections and section_offsets.
10629         (Sized_relobj::write_local_symbols): Likewise.
10630         (map_to_kept_section): Compute output address directly.
10631         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10632         output_sections and section_offsets.
10633         (Sized_relobj::write_sections): Likewise.
10634         (Sized_relobj::relocate_sections): Likewise.
10635         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10636         * output.h (class Output_reloc): Update declarations.  Change
10637         u2_.relobj to Sized_relobj*.
10638         (class Output_data_reloc): Change add functions to use
10639         Sized_relobj*.
10640         * output.cc (Output_reloc::Output_reloc): Change relobj to
10641         Sized_relobj*.
10642         (Output_reloc::local_section_offset): Change return type to
10643         Elf_Addr.  Use get_output_section_offset.
10644         (Output_reloc::get_address): Likewise.
10645         (Output_section::is_input_address_mapped): Don't call
10646         is_section_specially_mapped.
10647         (Output_section::output_offset): Likewise.
10648         (Output_section::output_address): Likewise.
10649         (Output_section::starting_output_address): Likewise.
10650         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10651         parameter to Sized_relobj*.
10652         (Copy_relocs::need_copy_reloc): Likewise.
10653         (Copy_relocs::save): Likewise.
10654         * copy-relocs.h (class Copy_relocs): Update declarations.
10655         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10656         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10657         * target-reloc.h (relocate_for_relocatable): Change
10658         offset_in_output_section type to Elf_Addr.  Change code that uses
10659         it as well.
10660         * layout.cc (Layout::layout): Always set *off.
10661         * mapfile.cc (Mapfile::print_input_section): Use
10662         output_section_offset.
10663         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10664         Sized_relobj*.
10665         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10666         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10667         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10669 2008-07-03  Ian Lance Taylor  <iant@google.com>
10671         * layout.cc (Layout::include_section): Do not discard unrecognized
10672         SHT_STRTAB sections.
10674 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10676         * script.cc (Lex::can_continue_name): Make '?' allowable in
10677         version-script names.
10678         * testsuite/version_script.map: Change glob pattern to use '?'
10680 2008-06-30  Manish Singh  <yosh@gimp.org>
10682         PR 6585
10683         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10684         Correct typo.
10686 2008-06-30  Ian Lance Taylor  <iant@google.com>
10688         PR 6660
10689         PR 6682
10690         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10691         versions]: Don't try to read the value in the contents, since we
10692         don't use it.  Use the template endianness when writing.
10694 2008-06-25  Cary Coutant  <ccoutant@google.com>
10696         * fileread.cc (File_read::make_view): Assert on zero-length view.
10697         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10698         symbol table when there are no symbols to read.
10700 2008-06-23  Craig Silverstein  <csilvers@google.com>
10702         * version.cc (version_string): Bump to 1.7
10704 2008-06-18  Craig Silverstein  <csilvers@google.com>
10706         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10707         constant 0xFFFF to type Valtype.
10708         (Powerpc_relocate_functions::rel16_ha): Likewise.
10710 2008-06-17  Ian Lance Taylor  <iant@google.com>
10712         * output.h (Output_section::Input_section): Initialize p2align_ to
10713         zero for Output_section_data constructors.
10714         (Output_section::Input_section::addralign): If not an input
10715         section, return the alignment of the Output_section_data.
10716         * testsuite/copy_test.cc: New file.
10717         * testsuite/copy_test_1.cc: New file.
10718         * testsuite/copy_test_2.cc: New file.
10719         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10720         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10721         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10722         (copy_test_1_pic.o, copy_test_1.so): New targets.
10723         (copy_test_2_pic.o, copy_test_2.so): New targets.
10724         * testsuite/Makefile.in: Rebuild.
10726         * script-sections.cc (Script_sections::place_orphan): Initialize
10727         local variable exact.
10729 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10731         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10733 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10734             David S. Miller  <davem@davemloft.net>
10736         * powerpc.cc: New file.
10737         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10738         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10739         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10740         * Makefile.in: Rebuild.
10742 2008-06-09  Ian Lance Taylor  <iant@google.com>
10744         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10745         <exception>.
10746         (throwing, orig_terminate): New static variables.
10747         (terminate_handler): New static function.
10748         (t2): Set terminate handler.
10750 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10752         PR 6584
10753         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10754         alignment.
10756 2008-05-30  Cary Coutant  <ccoutant@google.com>
10758         * archive.cc (Archive::include_all_members) Correct to step
10759         over symbol table and extended name table in thin archives.
10761 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10763         PR 6407
10764         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10765         calculation.
10767 2008-05-28  Caleb Howe  <cshowe@google.com>
10769         * reduced_debug_output.cc: New file.
10770         * reduced_debug_output.h: New file.
10771         * options.h (class General_options): Add --strip-debug-non-line.
10772         * options.cc (General_options::finalize): Add strip_debug_non_line
10773         to the strip heirarchy.
10774         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10775         fields.
10776         * layout.cc: Include "reduced_debug_output.h".
10777         (Layout::Layout): Initialize new fields.
10778         (line_only_debug_sections): New static array.
10779         (is_lines_only_debug_sections): New static inline function.
10780         (Layout::include_section): Handle --strip-debug-non-line.
10781         (Layout::make_output_section): If --strip-debug-non-line, build
10782         new output sections for .debug_abbrev and .debug_info.
10783         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10784         gold.  Warn about possible overflow.
10785         (read_signed_LEB_128): Likewise.
10786         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10787         (read_signed_LEB_128): Declare.
10788         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10789         (HFILES): Add reduced_debug_output.h.
10790         * Makefile.in: Rebuild.
10792 2008-05-21  Ian Lance Taylor  <iant@google.com>
10794         * mapfile.cc: New file.
10795         * mapfile.h: New file.
10796         * options.h (class General_options): Add -M/--print-map and -Map.
10797         * options.cc (General_options::finalize): Make -M equivalent to
10798         -Map -.
10799         * main.cc: Include <cstdio> and "mapfile.h".
10800         (main): Open mapfile if requested.
10801         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10802         constructor.  Change caller.
10803         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10804         (queue_middle_tasks): Likewise.
10805         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10806         declarations.
10807         * archive.cc: Include "mapfile.h".
10808         (Archive::add_symbols): Add mapfile parameter.  Change all
10809         callers.  Pass mapfile, symbol, and reason to include_member.
10810         (Archive::include_all_members): Add mapfile parameter.  Change all
10811         callers.
10812         (Archive::include_member): Add mapfile, sym, and why parameters.
10813         Change all callers.  Report inclusion to map file.
10814         * archive.h: Include "fileread.h".
10815         (class Archive): Update declarations.
10816         (Archive::file): New const method.
10817         (class Add_archive_symbols): Add mapfile_ field.  Update
10818         constructor.  Change all callers.
10819         * readsyms.h (class Read_symbols): Likewise.
10820         (class Finish_group): Likewise.
10821         (class Read_script): Likewise.
10822         * common.cc: Include "mapfile.h".
10823         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10824         all callers.
10825         (Symbol_table::do_allocate_commons): Likewise.
10826         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10827         symbol allocation to mapfile.
10828         * common.h (class Allocate_commons_task): Add mapfile_ field.
10829         Update constructor.  Change all callers.
10830         * symtab.h (class Symbol_table): Update declarations.
10831         * layout.cc: Include "mapfile.h".
10832         (Layout_task_runner::run): Print information to mapfile.
10833         (Layout::create_gold_note): Change Output_data_fixed_space to
10834         Output_data_zero_fill.
10835         (Layout::create_build_id): Likewise.
10836         (Layout::print_to_mapfile): New function.
10837         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10838         constructor.  Change caller.
10839         (class Layout): Declare print_to_mapfile.
10840         * output.cc (Output_section::Input_section::print_to_mapfile): New
10841         function.
10842         (Output_section::add_input_section): If producing a map, always
10843         add to input_sections_ list.
10844         (Output_section::do_print_to_mapfile): New function.
10845         (Output_segment::print_sections_to_mapfile): New function.
10846         (Output_segment::print_section_list_to_mapfile): New function.
10847         * output.h: Include "mapfile.h".
10848         (Output_data::print_to_mapfile): New function.
10849         (Output_data::do_print_to_mapfile): New virtual function.
10850         (Output_segment_headers::do_print_to_mapfile): New function.
10851         (Output_file_header::do_print_to_mapfile): New function.
10852         (Output_data_const::do_print_to_mapfile): New function.
10853         (class Output_data_const_buffer): Add map_name_ field.  Update
10854         constructor.  Change all callers.  Add do_print_to_mapfile
10855         function.
10856         (class Output_data_fixed_space): Likewise.
10857         (class Output_data_space): Likewise.
10858         (class Output_data_zero_fill): New class.
10859         (Output_data_strtab::do_print_to_mapfile): New function.
10860         (Output_data_reloc_base::do_print_to_mapfile): New function.
10861         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10862         (Output_data_group::do_print_to_mapfile): New function.
10863         (Output_data_got::do_print_to_mapfile): New function.
10864         (Output_data_dynamic::do_print_to_mapfile): New function.
10865         (Output_symtab_xindex::do_print_to_mapfile): New function.
10866         (class Output_section): Declare do_print_to_mapflie.  Declare
10867         print_to_mapfile in Input_section.
10868         (class Output_segment): Declare new functions.
10869         * object.h (Sized_relobj::symbol_count): New function.
10870         * script-sections.cc
10871         (Output_section_element_dot_assignment::set_section_addresses):
10872         Change Output_data_fixed_space to Output_data_zero_fill.
10873         (Output_data_expression::do_print_to_mapfile): New function.
10874         * script.cc (read_input_script): Add mapfile parameter.  Change
10875         all callers.
10876         * script.h (read_input_script): Update declaration.
10877         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10878         (Eh_frame::do_print_to_mapfile): New function.
10879         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10880         (Output_merge_string::do_print_to_mapfile): New function.
10881         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10882         function.
10883         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10884         function.
10885         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10886         function.
10887         * Makefile.am (CCFILES): Add mapfile.cc.
10888         (HFILES): Add mapfile.h.
10889         * Makefile.in: Rebuild.
10891 2008-05-19  Ian Lance Taylor  <iant@google.com>
10893         * options.h (class General_options): Add -z relro.
10894         * layout.cc (Layout::Layout): Initialize relro_segment_.
10895         (Layout::add_output_section_data): Return the output section.
10896         (Layout::make_output_section): Rcognize relro sections and mark
10897         them appropriately.
10898         (Layout::attach_allocated_section_to_segment): Put relro sections
10899         in a PT_GNU_RELRO segment.
10900         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10901         section as relro.
10902         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10903         PT_TLS segments.
10904         (Layout::linkonce_mapping): Map d.rel.ro.local to
10905         .data.rel.ro.local.
10906         (Layout::output_section_name): Us .data.rel.ro.local for any
10907         section which begins with that.
10908         * layout.h (class Layout): Update add_output_section_data
10909         declaration.  Add relro_segment_ field.
10910         * output.cc (Output_section::Output_section): Initialize is_relro_
10911         and is_relro_local_ fields.
10912         (Output_segment::add_output_section): Group relro sections.
10913         (Output_segment::is_first_section_relro): New function.
10914         (Output_segment::maximum_alignment): If there is a relro section,
10915         align the segment to the common page size.
10916         (Output_segment::set_section_addresses): Track whether we are
10917         looking at relro sections.  If the last section is a relro
10918         section, align to the common page size.
10919         (Output_segment::set_section_list_addresses): Add in_relro
10920         parameter.  Change all callers.  Align to the page size when
10921         moving from relro to non-relro section.
10922         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10923         segment.
10924         * output.h (class Output_section): Add is_relro_ and
10925         is_relro_local_ fields.
10926         (Output_section::is_relro): New function.
10927         (Output_section::set_is_relro): New function.
10928         (Output_section::is_relro_local): New function.
10929         (Output_section::set_is_relro_local): New function.
10930         (class Output_segment): Update declarations.
10931         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10932         * sparc.cc (Target_sparc::got_section): Likewise.
10933         * x86_64.cc (Target_x86_64::got_section): Likewise.
10934         * testsuite/relro_test_main.cc: New file.
10935         * testsuite/relro_test.cc: New file.
10936         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10937         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10938         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10939         (relro_test.so, relro_test_pic.o): New targets.
10940         * testsuite/Makefile.in: Rebuild.
10942 2008-05-16  Ian Lance Taylor  <iant@google.com>
10944         * output.cc (Output_segment::add_output_section): Remove front
10945         parameter.
10946         * output.h (class Output_segment): Remove
10947         add_initial_output_section and overloaded add_output_section.
10948         Update declaration of remaining add_output_section.
10949         * layout.cc (Layout::create_interp): Call add_output_section
10950         rather than add_initial_output_section.
10951         (Layout::finish_dynamic_section): Likewise.
10953         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10954         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10955         know the dynamic type.
10956         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10957         field.  Initialize it in constructor.
10958         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10959         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10960         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10961         reloc.
10963         * output.cc (Output_reloc::get_address): Change return type to
10964         Elf_Addr.
10965         * output.h (class Output_reloc): Update get_address declaration.
10966         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10967         for section addresses.
10969 2008-05-09  Ian Lance Taylor  <iant@google.com>
10971         PR 6493
10972         * gold.cc (gold_nomem): Use return value of write.
10974 2008-05-08  Ian Lance Taylor  <iant@google.com>
10976         * symtab.c (Symbol::init_base_output_data): Add version
10977         parameter.  Change all callers.
10978         (Symbol::init_base_output_segment): Likewise.
10979         (Symbol::init_base_constant): Likewise.
10980         (Symbol::init_base_undefined): Likewise.
10981         (Sized_symbol::init_output_data): Likewise.
10982         (Sized_symbol::init_output_segment): Likewise.
10983         (Sized_symbol::init_constant): Likewise.
10984         (Sized_symbol::init_undefined): Likewise.
10985         (Symbol_table::do_define_in_output_data): If the new symbol has a
10986         version, mark it as the default.
10987         (Symbol_table::do_define_in_output_segment): Likewise.
10988         (Symbol_table::do_define_as_constant): Likewise.
10989         * symtab.h (class Symbol): Update declarations.
10990         (class Sized_symbol): Likewise.
10991         * resolve.cc (Symbol::override_version): New function.
10992         (Symbol::override_base): Call override_version.
10993         (Symbol::override_base_with_special): Likewise.
10994         * testsuite/ver_script_8.script: New file.
10995         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10996         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10997         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10998         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11000 2008-05-06  Ian Lance Taylor  <iant@google.com>
11002         PR 6049
11003         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11004         functions.
11005         (class General_options): Remove existing --undefined, and add
11006         --no-undefined instead.  Add new --undefined as synonym for -u.
11007         * archive.cc (Archive::add_symbols): Check whether symbol was
11008         named with -u.
11009         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11010         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11011         all uses.  Add IS_UNDEFINED.  Update declarations to split
11012         different versions of init_base.  Declare init_base_undefined.
11013         (Symbol::is_defined): Handle IS_UNDEFINED.
11014         (Symbol::is_undefined): Likewise.
11015         (Symbol::is_weak_undefined): Call is_undefined.
11016         (Symbol::is_absolute): Handle IS_CONSTANT.
11017         (class Sized_symbol): Update declarations to split different
11018         versions of init.  Declare init_undefined.
11019         (class Symbol_table): Declare new functions.
11020         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11021         Change all callers.
11022         (Symbol::init_base_output_data): Likewise.
11023         (Symbol::init_base_output_segment): Likewise.
11024         (Symbol::init_base_constant): Likewise.
11025         (Symbol::init_base_undefined): New function.
11026         (Sized_symbol::init_object): Rename from init.  Change all
11027         callers.
11028         (Sized_symbol::init_output_data): Likewise.
11029         (Sized_symbol::init_output_segment): Likewise.
11030         (Sized_symbol::init_constant): Likewise.
11031         (Sized_symbol::init_undefined): New function.
11032         (Symbol_table::add_undefined_symbols_from_command_line): New
11033         function.
11034         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11035         function.
11036         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11037         (Symbol::output_section): Likewise.
11038         (Symbol::set_output_section): Likewise.
11039         (Symbol_table::sized_finalize_symbol): Likewise.
11040         (Symbol_table::sized_write_globals): Likewise.
11041         * resolve.cc (Symbol_table::should_override): Likewise.
11042         (Symbol::override_base_with_special): Likewise.
11044         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11045         symbol, change it to have default visibility.
11046         * testsuite/protected_1.cc: New file.
11047         * testsuite/protected_2.cc: New file.
11048         * testsuite/protected_3.cc: New file.
11049         * testsuite/protected_main_1.cc: New file.
11050         * testsuite/protected_main_2.cc: New file.
11051         * testsuite/protected_main_3.cc: New file.
11052         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11053         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11054         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11055         (protected_1.so): New target.
11056         (protected_1_pic.o, protected_2_pic.o): New targets.
11057         (protected_3_pic.o): New target.
11058         (check_PROGRAMS): Add protected_2.
11059         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11060         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11061         * testsuite/Makefile.in: Rebuild.
11063         * options.h (DEFINE_var): Add set_user_set_##varname__.
11064         (DEFINE_bool_alias): New macro.
11065         (class General_options): Define -Bstatic using DEFINE_bool_alias
11066         rather than DEFINE_special.  Add --undefined as an alias for -z
11067         defs.
11068         * options.cc (General_options::parse_Bstatic): Remove.
11070         * options.h (class General_options): Add --fatal-warnings.
11071         * main.cc (main): Implement --fatal-warnings.
11072         * errors.h (Errors::warning_count): New function.
11074         * options.h (class General_options): Add -Bsymbolic-functions.
11075         * symtab.h (Symbol::is_preemptible): Check for
11076         -Bsymbolic-functions.
11078 2008-05-05  Ian Lance Taylor  <iant@google.com>
11080         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11081         as noVARNAME rather than no-VARNAME.
11082         (class General_options): Add option -z combreloc.
11083         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11084         get_address.
11085         (Output_reloc::sort_before) [SHT_REL]: New function.
11086         (Output_reloc::sort_before) [SHT_RELA]: New function.
11087         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11088         Sort_relocs_comparison.
11089         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11090         parameter.  Change all callers.
11091         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11092         sort_relocs parameter.  Change all callers.
11093         * output.cc (Output_reloc::get_address): New function, broken out
11094         of write_rel.
11095         (Output_reloc::write_rel): Call it.
11096         (Output_reloc::compare): New function.
11097         (Output_data_reloc_base::do_write): Optionally sort relocs.
11099         * configure.ac: If targ_extra_obj is set, link it in.
11100         * configure.tgt: Initialize all variables.
11101         (x86_64*): Set targ_extra_obj and targ_extra_size.
11102         * configure: Rebuild.
11104         * object.cc (Sized_relobj::include_section_group): Adjust section
11105         indexes read from group data.  Build vector to pass to
11106         layout_group.
11107         * layout.cc (Layout::layout_group): Add flags and shndxes
11108         parameters.  Remove contents parameter.  Change caller.  Update
11109         explicit instantiations.
11110         * layout.h (class Layout): Update layout_group declaration.
11111         * output.cc (Output_data_group::Output_data_group): Add flags and
11112         input_shndxes parameters.  Remove contents parameter.  Change
11113         caller.
11114         (Output_data_group::do_write): Change input_sections_ to
11115         input_shndxes_.
11116         * output.h (class Output_data_group): Update constructor
11117         declaration.  Rename input_sections_ to input_shndxes_.
11118         * testsuite/many_sections_test.cc: Add template.
11120 2008-04-30  Cary Coutant  <ccoutant@google.com>
11122         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11124         * layout.cc (Layout::include_section): Refactored check for debug
11125         info section.
11126         (Layout::add_comdat): Add new parameters.  Change type
11127         of signature parameter.  Add object and shndx to signatures table.
11128         (Layout::find_kept_object): New function.
11129         * layout.h: Include <cstring>.
11130         (Layout::is_debug_info_section): New function.
11131         (Layout::add_comdat): Add new parameters.
11132         (Layout::find_kept_object): New function.
11133         (Layout::Kept_section): New struct.
11134         (Layout::Signatures): Change type of map range.
11135         * object.cc (Relobj::output_section_address): New function.
11136         (Sized_relobj::include_section_group): Add new parameters.  Change
11137         calls to Layout::add_comdat.  Change to build table of kept comdat
11138         groups and table mapping discarded sections to kept sections.
11139         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11140         (Sized_relobj::do_layout): Change calls to include_section_group and
11141         include_linkonce_section.
11142         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11143         value to zero when section is discarded.
11144         (Sized_relobj::map_to_kept_section): New function.
11145         * object.h (Relobj::output_section_address): New function.
11146         (Relobj::Comdat_group): New type.
11147         (Relobj::find_comdat_group): New function.
11148         (Relobj::Comdat_group_table): New type.
11149         (Relobj::Kept_comdat_section): New type.
11150         (Relobj::Kept_comdat_section_table): New type.
11151         (Relobj::add_comdat_group): New function.
11152         (Relobj::set_kept_comdat_section): New function.
11153         (Relobj::get_kept_comdat_section): New function.
11154         (Relobj::comdat_groups_): New field.
11155         (Relobj::kept_comdat_sections_): New field.
11156         (Symbol_value::input_value): Update comment.
11157         (Sized_relobj::map_to_kept_section) New function.
11158         (Sized_relobj::include_linkonce_section): Add new parameter.
11159         * target-reloc.h (Comdat_behavior): New type.
11160         (get_comdat_behavior): New function.
11161         (relocate_section): Add code to map a discarded section to the
11162         corresponding kept section when applying a relocation.
11164 2008-04-30  Craig Silverstein  <csilvers@google.com>
11166         * dwarf_reader.cc (next_generation_count): New static var.
11167         (Addr2line_cache_entry): New struct.
11168         (addr2line_cache): New static var.
11169         (Dwarf_line_info::one_addr2line): Added caching.
11170         (Dwarf_line_info::clear_addr2line_cache): New function.
11171         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11172         cache-size parameter.
11173         (Dwarf_line_info::one_addr2line_cache): New function.
11174         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11175         new cache-size argument to one_addr2line(), and clear cache.
11177 2008-04-28  Cary Coutant  <ccoutant@google.com>
11179         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11180         R_386_PC8 relocations.
11182 2008-04-23  Ian Lance Taylor  <iant@google.com>
11184         * object.cc (Sized_relobj::include_section_group): Check for
11185         invalid section group.
11187         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11188         header size.
11190         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11191         than read for file header.
11192         * archive.cc (Archive::include_member): Likewise.
11194 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11196         * aclocal.m4: Regenerate.
11197         * configure: Regenerate.
11199 2008-04-19  Ian Lance Taylor  <iant@google.com>
11201         * version.cc (version_string): Bump to 1.6.
11203         * testsuite/Makefile.am (many_sections_r_test): New target.
11204         (many_sections_r_test_SOURCES): Remove.
11205         (many_sections_r_test_DEPENDENCIES): Remove.
11206         (many_sections_r_test_LDFLAGS): Remove.
11207         (many_sections_r_test_LDADD): Remove.
11209         * object.cc (Sized_relobj::do_add_symbols): Always pass
11210         local_symbol_count_ to add_from_relobj.
11212         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11213         every thousand variables.
11214         * testsuite/Makefile.in: Rebuild.
11216         * object.cc (Xindex::initialize_symtab_xindex): New function.
11217         (Xindex::read_symtab_xindex): New function.
11218         (Xindex::sym_xindex_to_shndx): New function.
11219         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11220         available.
11221         (Sized_relobj::do_initialize_xindex): New function.
11222         (Sized_relobj::do_read_symbols): Adjust section links.
11223         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11224         parameter.  Change all callers.
11225         (Sized_relobj::include_section_group): Adjust section links and
11226         symbol section indexes.
11227         (Sized_relobj::do_layout): Adjust section links.
11228         (Sized_relobj::do_count_local_symbols): Adjust section links and
11229         symbol section indexes.
11230         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11231         ordinary and special symbols.
11232         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11233         dynsym_xindex parameters.  Change all callers.  Adjust section
11234         links.  Use SHN_XINDEX when needed.
11235         (Sized_relobj::get_symbol_location_info): Adjust section links.
11236         Don't get fooled by special symbols.
11237         * object.h (class Xindex): Define.
11238         (class Object): Add xindex_ parameter.  Declare virtual functoin
11239         do_initialize_xindex.
11240         (Object::adjust_sym_shndx): New function.
11241         (Object::set_xindex): New protected function.
11242         (class Symbol_value): Add is_ordinary_shndx_ field.
11243         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11244         (Symbol_value::value): Assert ordinary section.
11245         (Symbol_value::initialize_input_to_output_map): Likewise.
11246         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11247         Change all callers.
11248         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11249         all callers.
11250         (class Sized_relobj): Update declarations.
11251         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11252         parameter.  Change all callers.
11253         (Sized_relobj::adjust_shndx): New function.
11254         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11255         field.
11256         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11257         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11258         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11259         (Sized_dynobj::read_dynsym_section): Adjust section links.
11260         (Sized_dynobj::read_dynamic): Likewise.
11261         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11262         section links.
11263         (Sized_dynobj::do_initialize_xindex): New function.
11264         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11265         do_initialize_xindex.
11266         (Sized_dynobj::adjust_shndx): New function.
11267         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11268         dynsym_xindex_ fields.
11269         (Layout::finalize): Add a call to set_section_indexes before
11270         creating the symtab sections.
11271         (Layout::set_section_indexes): Don't do anything if the section
11272         already has a section index.
11273         (Layout::create_symtab_sections): Add shnum parameter.  Change
11274         caller.  Create .symtab_shndx section if needed.
11275         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11276         caller.
11277         (Layout::allocated_output_section_count): New function.
11278         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11279         needed.
11280         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11281         fields.  Update declarations.
11282         (Layout::symtab_xindex): New function.
11283         (Layout::dynsym_xindex): New function.
11284         (class Write_symbols_task): Add layout_ field.
11285         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11286         Change caller.
11287         * output.cc (Output_section_headers::Output_section_headers): Add
11288         shstrtab_section parameter.  Change all callers.
11289         (Output_section_headers::do_sized_write): Store overflow values
11290         for section count and section string table section index in
11291         section header zero.
11292         (Output_file_header::do_sized_write): Check for overflow of
11293         section count and section string table section index.
11294         (Output_symtab_xindex::do_write): New function.
11295         (Output_symtab_xindex::endian_do_write): New function.
11296         * output.h (class Output_section_headers): Add shstrtab_section_.
11297         Update declarations.
11298         (class Output_symtab_xindex): Define.
11299         (Output_section::has_out_shndx): New function.
11300         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11301         field.
11302         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11303         Change all callers.
11304         (Sized_symbol::init): Likewise.
11305         (Symbol::output_section): Check for ordinary symbol.
11306         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11307         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11308         callers.
11309         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11310         Change all callers.  Simplify handling of symbols from sections
11311         not included in the link.
11312         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11313         distinction.
11314         (Weak_alias_sorter::operator()): Assert that symbols are
11315         ordinary.
11316         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11317         distinction.
11318         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11319         parameters.  Change all callers.
11320         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11321         symbol distinction.  Use SHN_XINDEX when needed.
11322         (Symbol_table::write_section_symbol): Add symtab_xindex
11323         parameter.  Change all callers.
11324         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11325         SHN_XINDEX when needed.
11326         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11327         declarations.
11328         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11329         (Symbol::is_defined): Check is_ordinary.
11330         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11331         (Symbol::is_absolute, Symbol::is_common): Likewise.
11332         (class Sized_symbol): Update declarations.
11333         (class Symbol_table): Update declarations.
11334         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11335         parameters.  Change all callers.
11336         (Sized_symbol::override): Likewise.
11337         (Symbol_table::override): Likewise.
11338         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11339         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11340         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11341         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11342         to be in an ordinary section.
11343         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11344         object and is_ordinary parameters.  Change all callers.
11345         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11346         Change all callers.  Don't add undefined or non-ordinary symbols
11347         to reloc_map_.
11348         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11349         Change all callers.
11350         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11351         declarations.
11352         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11353         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11354         (Sized_relobj::relocate_sections): Likewise.
11355         * target-reloc.h (scan_relocs): Adjust section symbol index.
11356         (scan_relocatable_relocs): Likewise.
11357         * i386.cc (Scan::local): Check for ordinary symbols.
11358         * sparc.cc (Scan::local): Likewise.
11359         * x86_64.cc (Scan::local): Likewise.
11360         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11361         to symbol_section_and_value.
11362         * testsuite/many_sections_test.cc: New file.
11363         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11364         (check_PROGRAMS): Add many_sections_test.
11365         (many_sections_test_SOURCES): Define.
11366         (many_sections_test_DEPENDENCIES): Define.
11367         (many_sections_test_LDFLAGS): Define.
11368         (BUILT_SOURCES): Add many_sections_define.h.
11369         (many_sections_define.h): New target.
11370         (BUILT_SOURCES): Add many_sections_check.h.
11371         (many_sections_check.h): New target.
11372         (check_PROGRAMS): Add many_sections_r_test.
11373         (many_sections_r_test_SOURCES): Define.
11374         (many_sections_r_test_DEPENDENCIES): Define.
11375         (many_sections_r_test_LDFLAGS): Define.
11376         (many_sections_r_test_LDADD): Define.
11377         (many_sections_r_test.o): New target.
11378         * testsuite/Makefile.in: Rebuild.
11380 2008-04-17  Cary Coutant  <ccoutant@google.com>
11382         * errors.cc (Errors::info): New function.
11383         (gold_info): New function.
11384         * errors.h (Errors::info): New function.
11385         * gold.h (gold_info): New function.
11386         * object.cc (Input_objects::add_object): Print trace output.
11387         * options.cc (options::parse_set): New function.
11388         (General_options::parse_wrap): Deleted.
11389         (General_options::General_options): Deleted initializer.
11390         * options.h (options::String_set): New typedef.
11391         (options::parse_set): New function.
11392         (DEFINE_set): New macro.
11393         (General_options::wrap): Changed to use DEFINE_set. Changed
11394         callers of any_wrap_symbols and is_wrap_symbol.
11395         (General_options::trace, General_options::trace_symbol):
11396         New options.
11397         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11398         (General_options::wrap_symbols_): Deleted.
11399         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11401 2008-04-17  David S. Miller  <davem@davemloft.net>
11403         * options.cc (General_options::parse_V): New function.
11404         * options.h: Add entries for -V and -Qy.
11406 2008-04-17  Ian Lance Taylor  <iant@google.com>
11408         * common.cc (Symbol_table::allocate_commons): Remove options
11409         parameter.  Change caller.
11410         (Symbol_table::do_allocate_commons): Remove options parameter.
11411         Change caller.  Just call do_allocate_commons_list twice.
11412         (Symbol_table::do_allocate_commons_list): New function, broken out
11413         of do_allocate_commons.
11414         * common.h (class Allocate_commons_task): Remove options_ field.
11415         Update constructor.
11416         * symtab.cc (Symbol_table::Symbol_table): Initialize
11417         tls_commons_.
11418         (Symbol_table::add_from_object): Put TLS common symbols on
11419         tls_commons_ list.
11420         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11421         which are IN_OUTPUT_DATA.
11422         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11423         allocate_commons and do_allocate_commons declarations.  Declare
11424         do_allocate_commons_list.
11425         * gold.cc (queue_middle_tasks): Update creation of
11426         Allocate_commons_task to not pass options.
11427         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11428         (TLS_TEST_C_FLAGS): New variable.
11429         (tls_test_c_pic.o): New target.
11430         (tls_test_shared.so): Link in tls_test_c_pic.o.
11431         (tls_test_c_pic_ie.o): New target.
11432         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11433         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11434         (tls_test_c.o): New target.
11435         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11436         (tls_pic_test_LDADD): Likewise.
11437         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11438         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11439         (tls_test_c_gnu2.o): New target.
11440         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11441         tls_test_c_gnu2.o.
11442         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11443         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11444         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11445         * testsuite/tls_test.cc: Include "config.h".
11446         (t_last): Call t11_last.
11447         * testsuite/tls_test.h (t11, t11_last): Declare.
11448         * testsuite/tls_test_c.c: New file.
11449         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11450         * configure.ac: Check for OpenMP support.
11451         * configure, config.in, Makefile.in: Rebuild.
11452         * testsuite/Makefile.in: Rebuild.
11454 2008-04-16  Cary Coutant  <ccoutant@google.com>
11456         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11457         (Target_i386::tls_base_symbol_defined_): New field.
11458         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11459         (Target_i386::Scan::global): Likewise.
11460         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11461         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11462         (Target_x86_64::tls_base_symbol_defined_): New field.
11463         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11464         (Target_x86_64::Scan::global): Likewise.
11466 2008-04-16  Cary Coutant  <ccoutant@google.com>
11468         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11469         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11470         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11471         building shared libraries.
11472         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11473         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11474         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11475         * testsuite/Makefile.in: Rebuild.
11476         * testsuite/weak_undef.h: New file.
11477         * testsuite/weak_undef_file1.cc: Add extra test cases.
11478         * testsuite/weak_undef_file2.cc: Likewise.
11479         * testsuite/weak_undef_test.cc: Likewise.
11481 2008-04-16  David S. Miller  <davem@davemloft.net>
11483         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11484         Add issued_non_pic_error_ field.  Declare check_non_pic.
11485         (Target_sparc::Scan::check_non_pic): New function.
11486         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11487         (Target_sparc::Scan::global): Likewise.
11489         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11490         * configure: Rebuild.
11492         * options.h (DEFINE_enable): New macro.
11493         (new_dtags): New enable option.
11494         (initfirst, interpose, loadfltr, nodefaultlib,
11495         nodelete, nodlopen, nodump): New -z options.
11496         * layout.cc (Layout:finish_dynamic_section): If new
11497         dtags enabled, emit DT_RUNPATH.  Also, emit a
11498         DT_FLAGS_1 containing any specified -z flags.
11500 2008-04-16  Ian Lance Taylor  <iant@google.com>
11502         * copy-relocs.cc: New file.
11503         * copy-relocs.h: New file.
11504         * reloc.cc: Remove Copy_relocs code.
11505         * reloc.h: Likewise.
11506         * reloc-types.h (struct Reloc_types) [both versions]: Add
11507         get_reloc_addend_noerror.
11508         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11509         variants of add_global which take an addend which must be zero.
11510         * i386.cc: Include "copy-relocs.h".
11511         (class Target_i386): Change type of copy_relocs_ to variable,
11512         update initializer.
11513         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11514         Change all callers.
11515         (Target_i386::do_finalize_sections): Change handling of
11516         copy_relocs_.
11517         * sparc.cc: Include "copy-relocs.h".
11518         (class Target_sparc): Change type of copy_relocs_ to variable,
11519         update initializer.
11520         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11521         Change all callers.
11522         (Target_sparc::do_finalize_sections): Change handling of
11523         copy_relocs_.
11524         * x86_64.cc: Include "copy-relocs.h".
11525         (class Target_x86_64): Change type of copy_relocs_ to variable,
11526         update initializer.
11527         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11528         class.  Change all callers.
11529         (Target_x86_64::do_finalize_sections): Change handling of
11530         copy_relocs_.
11531         * Makefile.am (CCFILES): Add copy-relocs.cc.
11532         (HFILES): Add copy-relocs.h.
11534         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11536         * testsuite/script_test_4.sh: Permit leading zeroes.
11538 2008-04-15  Ian Lance Taylor  <iant@google.com>
11540         * script-sections.cc (Script_sections::create_segments): Use
11541         header_size_adjustment even when there is enough room for the
11542         headers.
11543         * testsuite/script_test_4.sh: New file.
11544         * testsuite/script_test_4.t: New file.
11545         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11546         (check_DATA): Add script_test_4.stdout.
11547         (MOSTLYCLEANFILES): Likewise.
11548         (script_test_4): New target.
11549         (script_test_4.stdout): New target.
11550         * testsuite/Makefile.in: Rebuild.
11552         * sparc.cc: Add definitions for Output_data_plt_sparc class
11553         constants.
11555 2008-04-14  David S. Miller  <davem@davemloft.net>
11557         * sparc.cc: New file.
11558         * Makefile.am (TARGETSOURCES): Add sparc.cc
11559         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11560         * configure.tgt: Document targ_extra_size and
11561         targ_extra_big_endian.  Add entries for sparc-* and
11562         sparc64-*.
11563         * configure.ac: Handle targ_extra_size and
11564         targ_extra_big_endian.
11565         * Makefile.in: Rebuild.
11566         * configure: Likewise.
11567         * po/POTFILES.in: Likewise.
11568         * po/gold.pot: Likewise.
11570 2008-04-14  Ian Lance Taylor  <iant@google.com>
11572         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11573         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11574         in the name/type/flags to section mapping.  Don't call
11575         allocate_output_section.
11576         (Layout::choose_output_section): Change parameter from adjust_name
11577         to is_input_section.  Don't permit input sections after sections
11578         are attached to segments.  Don't call allocate_output_section.
11579         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11580         not write_enable_output_section.
11581         (Layout::make_output_section): Don't push to
11582         unattached_section_list_ nor call attach_to_segment.  Call
11583         attach_section_to_segment if sections are attached.
11584         (Layout::attach_sections_to_segments): New function.
11585         (Layout::attach_section_to_segment): New function.
11586         (Layout::attach_allocated_section_to_segment): Rename from
11587         attach_to_segment.  Remove flags parameter.
11588         (Layout::allocate_output_section): Remove function.
11589         (Layout::write_enable_output_section): Remove function.
11590         * layout.h (class Layout): Update for above changes.  Add new
11591         field sections_are_attached_.
11592         * output.h (Output_section::update_flags_for_input_section): New
11593         function.
11594         * output.cc (Output_section::add_input_section): Call
11595         update_flags_for_input_section.
11596         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11598 2008-04-11  Cary Coutant  <ccoutant@google.com>
11600         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11601         thought unnecessary.
11602         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11604 2008-04-11  Ian Lance Taylor  <iant@google.com>
11606         * output.h (class Output_section_data): Remove inline definition
11607         of set_addralign.
11608         * output.cc (Output_section_data::set_addralign): New function.
11610 2008-04-11  Cary Coutant  <ccoutant@google.com>
11612         Add support for TLS descriptors for i386 and x86_64.
11613         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11614         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11615         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11616         GOT_TYPE_TLS_DESC.
11617         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11618         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11619         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11620         relocations.
11621         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11622         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11623         Fix problem with initial-exec relocations.
11624         (Target_i386::Relocate::relocate_tls): Likewise.
11625         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11626         relaxation.
11627         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11628         support for section-plus-offset dynamic table entries.
11629         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11630         (Output_data_dynamic::Dynamic_entry): Add support for
11631         section-plus-offset dynamic table entries.
11632         (Output_data_dynamic::Classification): Likewise.
11633         (Output_data_dynamic::classification_): Renamed offset_.
11634         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11635         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11636         (Target_x86_64::make_plt_section): New function.
11637         (Target_x86_64::reserve_tlsdesc_entries): New function.
11638         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11639         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11640         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11641         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11642         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11643         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11644         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11645         add extra PLT entry for TLS descriptors.
11646         (Output_data_plt_x86_64::got_): New field.
11647         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11648         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11649         fields.
11650         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11651         descriptors.
11652         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11653         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11654         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11655         R_386_TLS_DESC_CALL relocations.
11656         (Target_x86_64::Scan::global): Likewise.
11657         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11658         for TLS descriptors.
11659         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11660         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11661         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11662         GD-to-IE relaxation.
11663         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11664         and TLS_DESCRIPTORS.
11665         * Makefile.in: Rebuild.
11666         * configure: Rebuild.
11667         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11668         (tls_test_shared2.so): New target.
11669         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11670         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11671         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11672         (tls_shared_gd_to_ie_test_LDADD): New variable.
11673         (tls_shared_gnu2_gd_to_ie_test): New target.
11674         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11675         New targets.
11676         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11677         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11678         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11679         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11680         (tls_shared_gnu2_test): New target.
11681         (tls_test_gnu2_shared.so): New target.
11682         (tls_shared_gnu2_test_SOURCES): New variable.
11683         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11684         (tls_shared_gnu2_test_LDFLAGS): New variable.
11685         (tls_shared_gnu2_test_LDADD): New variable.
11686         * testsuite/Makefile.in: Rebuild.
11687         * testsuite/Makefile.
11689 2008-04-11  Ian Lance Taylor  <iant@google.com>
11691         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11692         justsyms.t.
11693         * testsuite/Makefile.in: Rebuild.
11695         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11696         long.
11697         * testsuite/script_test_2.cc (main): Adjust test.
11699 2008-04-11  David S. Miller  <davem@davemloft.net>
11700             Ian Lance Taylor  <iant@google.com>
11702         * options.h (General_options): Add entries for '-Y' and
11703         '-relax'.
11704         * options.cc (General_options:finalize): If -Y was used, add those
11705         entries to the library path instead of the default "/lib" and
11706         "/usr/lib".
11708 2008-04-11  David S. Miller  <davem@davemloft.net>
11710         * testsuite/justsyms.t: Start at 0x100.
11711         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11712         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11713         long.
11714         * testsuite/script_test_2.cc: Adjust string and section length
11715         checks.
11717 2008-04-09  Ian Lance Taylor  <iant@google.com>
11719         PR gold/5996
11720         * script-sections.cc (Sections_element::allocate_to_segment): Add
11721         orphan parameter.
11722         (Output_section_definition::allocate_to_segment): Likewise.
11723         (Orphan_output_section::allocate_to_segment): Likewise.
11724         (Script_sections::attach_sections_using_phdrs_clause): Don't
11725         propagate non-PT_LOAD segments to orphan sections.
11726         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11727         readelf rather than objdump.
11728         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11729         .interp section and PT_INTERP segment are the same size.
11730         * testsuite/Makefile.in: Rebuild.
11732         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11733         aliases for symbols defined in the same object.
11734         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11735         (weak_alias_test_SOURCES): New variable.
11736         (weak_alias_test_DEPENDENCIES): New variable.
11737         (weak_alias_test_LDFLAGS): New variable.
11738         (weak_alias_test_LDADD): New variable.
11739         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11740         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11741         (weak_alias_test_3.o): New target.
11742         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11743         * testsuite/weak_alias_test_main.cc: New file.
11744         * testsuite/weak_alias_test_1.cc: New file.
11745         * testsuite/weak_alias_test_2.cc: New file.
11746         * testsuite/weak_alias_test_3.cc: New file.
11748 2008-04-08  Ian Lance Taylor  <iant@google.com>
11750         * options.h (class General_options): Add --noinhibit-exec option.
11751         * main.cc (main): Check --noinhibit-exec.
11753         * options.h (class General_options): Define --wrap as a special
11754         option.  Add wrap_symbols_ field.
11755         (General_options::any_wrap_symbols): New function.
11756         (General_options::is_wrap_symbol): New function.
11757         * options.cc (General_options::parse_wrap): New function.
11758         (General_options::General_options): Initialize wrap_symbols_.
11759         * symtab.cc (Symbol_table::wrap_symbol): New function.
11760         (Symbol_table::add_from_object): Handle --wrap.
11761         * symtab.h (class Symbol_table): Declare wrap_symbol.
11762         * target.h (Target::wrap_char): New function.
11763         (Target::Target_info): Add wrap_char field.
11764         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11765         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11766         * testsuite/testfile.cc (Target_test::test_target_info):
11767         Likewise.
11769         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11770         there is one.
11772         * layout.h (class Layout): Add added_eh_frame_data_ field.
11773         * layout.cc (Layout::Layout): Initialize new field.
11774         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11775         output section until we find a section we merged successfully.
11776         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11777         that the size be non-zero.
11779         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11780         qualifier.
11782 2008-04-08  Craig Silverstein  <csilvers@google.com>
11784         * configure.ac: Export new conditional variable HAVE_ZLIB.
11785         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11786         on HAVE_ZLIB.
11787         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11788         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11790 2008-04-07  Ian Lance Taylor  <iant@google.com>
11792         * version.cc (version_string): Set to "1.5".
11794         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11795         Add issued_non_pic_error_ field.  Declare check_non_pic.
11796         (Target_x86_64::Scan::check_non_pic): New function.
11797         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11798         (Target_x86_64::Scan::global): Likewise.
11800         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11801         addend parameter.  Change caller.  Handle merge sections.
11802         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11803         Address to Addend.  Don't add in the result of
11804         local_section_offset, pass down the addend and use the returned
11805         value.
11806         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11807         Update declarations of local_section_offset and symbol_value.
11808         * testsuite/two_file_test_1.cc (t18): New function.
11809         * testsuite/two_file_test_2.cc (f18): New function.
11810         * testsuite/two_file_test_main.cc (main): Call t18.
11811         * testsuite/two_file_test.h (t18, f18): Declare.
11813         * configure.ac: Don't test for objdump, c++filt, or readelf.
11814         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11815         conditionals.
11816         (TEST_READELF): New variable.
11817         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11818         (check_PROGRAMS): Add two_file_strip_test.
11819         (two_file_strip_test): New target.
11820         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11821         (two_file_same_shared_strip_test_SOURCES): New variable.
11822         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11823         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11824         (two_file_same_shared_strip_test_LDADD): New variable.
11825         (two_file_shared_strip.so): New target.
11826         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11827         (ver_test_5.syms, ver_test_7.syms): Likewise.
11828         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11829         (strip_test_3.stdout): Use TEST_OBJDUMP.
11830         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11832 2008-04-04  Cary Coutant  <ccoutant@google.com>
11834         * symtab.h (Symbol::is_weak_undefined): New function.
11835         (Symbol::is_strong_undefined): New function.
11836         (Symbol::is_absolute): New function.
11837         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11838         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11839         absolute symbols.
11840         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11841         (weak_undef_test): New target.
11842         * testsuite/Makefile.in: Rebuild.
11843         * testsuite/weak_undef_file1.cc: New file.
11844         * testsuite/weak_undef_file2.cc: New file.
11845         * testsuite/weak_undef_test.cc: New file.
11847 2008-04-03  Craig Silverstein  <csilvers@google.com>
11849         * compressed_output.h (class Output_compressed_section): Use
11850         unsigned buffer.
11851         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11852         add zlib header.
11853         (zlib_compressed_suffix): Removed.
11854         (Output_compressed_section::set_final_data_size): Use unsigned
11855         buffers.
11856         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11857         Fix linker invocation.
11858         (flagstest_o_specialfile_and_compress_debug_sections):
11859         Likewise.
11860         * testsuite/Makefile.in: Regenerated.
11862 2008-04-02  David S. Miller  <davem@davemloft.net>
11864         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11865         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11867 2008-04-02  Craig Silverstein  <csilvers@google.com>
11869         * TODO: New file.
11871 2008-04-02  Ian Lance Taylor  <iant@google.com>
11873         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11874         parameters.  Update for new key type to views_.  Change all
11875         callers.
11876         (File_read::read): Adjust for byteshift in returned view.
11877         (File_read::add_view): New function, broken out of
11878         find_and_make_view.
11879         (File_read::make_view): New function, broken out of
11880         find_and_make_view.
11881         (File_read::find_or_make_view): Add offset and aligned
11882         parameters.  Rewrite accordingly.  Change all callers.
11883         (File_read::get_view): Add offset and aligned parameters.  Adjust
11884         for byteshift in return value.
11885         (File_read::get_lasting_view): Likewise.
11886         * fileread.h (class File_read): Update declarations.
11887         (class File_read::View): Add byteshift_ field.  Add byteshift to
11888         constructor.  Add byteshift method.
11889         * archive.h (Archive::clear_uncached_views): New function.
11890         (Archive::get_view): Add aligned parameter.  Change all callers.
11891         * object.h (Object::get_view): Add aligned parameter.  Change all
11892         callers.
11893         (Object::get_lasting_view): Likewise.
11895         * fileread.cc (File_read::release): Don't call clear_views if
11896         there are multiple objects.
11897         * fileread.h (File_read::clear_uncached_views): New function.
11898         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11899         on the archive.
11901 2008-03-31  Cary Coutant  <ccoutant@google.com>
11903         Add thin archive support.
11904         * archive.cc (Archive::armagt): New const.
11905         (Archive::setup): Remove task parameter and calls to unlock.
11906         (Archive::unlock_nested_archives): New function.
11907         (Archive::read_header): Add nested_off parameter. Change
11908         all callers.
11909         (Archive::interpret_header): Likewise.
11910         (Archive::include_all_members): Change to handle thin
11911         archives.
11912         (Archive::include_member): Likewise.
11913         * archive.h (Archive::Archive): Add new parameters and
11914         initializers.
11915         (Archive::armagt): New const.
11916         (Archive::setup): Remove task parameter.
11917         (Archive::unlock_nested_archives): New function.
11918         (Archive::read_header): Add nested_off parameter.
11919         (Archive::interpret_header): Likewise.
11920         (Archive::Nested_archive_table): New typedef.
11921         (Archive::is_thin_archive_): New field.
11922         (Archive::nested_archives_): New field.
11923         (Archive::options_): New field.
11924         (Archive::dirpath_): New field.
11925         (Archive::task_): New field.
11926         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11927         for thin archives.  Pass additional parameters to
11928         Archive::Archive.  Unlock the archive file after calling
11929         Archive::setup.
11931 2008-03-29  Ian Lance Taylor  <iant@google.com>
11933         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11934         version symbol to be local.
11935         * testsuite/ver_test_4.sh: New file.
11936         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11937         (check_DATA): Add ver_test_4.syms.
11938         (ver_test_4.syms): New target.
11939         * testsuite/Makefile.in: Rebuild.
11941         * output.cc
11942         (Output_section::Input_section_sort_entry::has_priority): New
11943         function.
11944         (Output_section::Input_section_sort_entry::match_file_name): New
11945         function.
11946         (Output_section::Input_section_sort_entry::match_section_name):
11947         Remove.
11948         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11949         Remove.
11950         (Output_section::Input_section_sort_entry::match_section_file):
11951         Remove.
11952         (Output_section::Input_section_sort_compare::operator()): Rewrite
11953         using new Input_section_sort_entry functions.  Sort crtbegin and
11954         crtend first.  Sort sections with no priority before sections with
11955         a priority.
11956         * testsuite/initpri1.c (d3): Check j != 4.
11957         (cd5): New constructor/destructor function.
11958         (main): Check j != 2.
11960         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11961         new symbol when resolving, don't call set_is_default.
11962         * testsuite/ver_test_7.cc: New file.
11963         * testsuite/ver_test_7.sh: New file.
11964         * testsuite/Makefile.am (ver_test_7.so): New target.
11965         (ver_test_7.o): New target.
11966         (check_SCRIPTS): Add ver_test_7.sh.
11967         (check_DATA): Add ver_test_7.syms.
11968         (ver_test_7.syms): New target.
11970 2008-03-28  Ian Lance Taylor  <iant@google.com>
11972         * layout.cc (Layout::layout): If we see an input section with a
11973         name that needs sorting, set the must_sort flag for the output
11974         section.
11975         (Layout::make_output_section): If the name of the output section
11976         indicates that it might require sorting, set the may_sort flag.
11977         * output.h (Output_section::may_sort_attached_input_sections): New
11978         function.
11979         (Output_section::set_may_sort_attached_input_sections): New
11980         function.
11981         (Output_section::must_sort_attached_input_sections): New
11982         function.
11983         (Output_section::set_must_sort_attached_input_sections): New
11984         function.
11985         (class Output_section): Declare Input_section_sort_entry.  Define
11986         Input_section_sort_compare.  Declare
11987         sort_attached_input_sections.  Add new fields:
11988         may_sort_attached_input_sections_,
11989         must_sort_attached_input_sections_,
11990         attached_input_sections_are_sorted_.
11991         * output.cc (Output_section::Output_section): Initialize new
11992         fields.
11993         (Output_section::add_input_section): Add an entry to
11994         input_sections_ if may_sort or must_sort are true.
11995         (Output_section::set_final_data_size): Call
11996         sort_attached_input_sections if necessary.
11997         (Output_section::Input_section_sort_entry): Define new class.
11998         (Output_section::Input_section_sort_compare::operator()): New
11999         function.
12000         (Output_section::sort_attached_input_sections): New function.
12001         * configure.ac: Check whether the compiler supports constructor
12002         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12003         * testsuite/initpri1.c: New file.
12004         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12005         CONSTRUCTOR_PRIORITY.
12006         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12007         (initpri1_LDFLAGS): New variable.
12008         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12010 2008-03-27  Ian Lance Taylor  <iant@google.com>
12012         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12013         * testsuite/common_test_1.c: New file.
12014         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12015         (common_test_1_SOURCES): New variable.
12016         (common_test_1_DEPENDENCIES): New variable.
12017         (common_test_1_LDFLAGS): New variable.
12019         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12020         and commons_ correctly when NAME/VERSION does not override
12021         NAME/NULL.
12022         * testsuite/ver_test_6.c: New file.
12023         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12024         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12025         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12027 2008-03-26  Ian Lance Taylor  <iant@google.com>
12029         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12030         of an undefined symbol from a version script.
12031         * testsuite/Makefile.am (ver_test_5.so): New target.
12032         (ver_test_5.o): New target.
12033         (check_SCRIPTS): Add ver_test_5.sh.
12034         (check_DATA): Add ver_test_5.syms.
12035         (ver_test_5.syms): New target.
12036         * testsuite/ver_test_5.cc: New file.
12037         * testsuite/ver_test_5.script: New file.
12038         * testsuite/ver_test_5.sh: New file.
12039         * Makefile.in, testsuite/Makefile.in: Rebuild.
12041         PR gold/5986
12042         Fix problems building gold with gcc 4.3.0.
12043         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12044         (gold_error_at_location, gold_warning_at_location): Use it.
12045         * configure.ac: Check whether we can compile and use a template
12046         function with a printf attribute.
12047         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12048         when jumping over bytes.
12049         * object.cc: Instantiate Object::read_section_data.
12050         * debug.h: Include <cstring>
12051         * dwarf_reader.cc: Include <algorithm>
12052         * main.cc: Include <cstring>.
12053         * options.cc: Include <cstring>.
12054         * output.cc: Include <cstring>.
12055         * script.cc: Include <cstring>.
12056         * script.h: Include <string>.
12057         * symtab.cc: Include <cstring> and <algorithm>.
12058         * target-select.cc: Include <cstring>.
12059         * version.cc: Include <string>.
12060         * testsuite/testmain.cc: Include <cstdlib>.
12061         * configure, config.in: Rebuild.
12063 2008-03-25  Ian Lance Taylor  <iant@google.com>
12065         * options.cc: Include "../bfd/bfdver.h".
12066         (options::help): Print bug reporting address.
12068         * version.cc (print_version): Adjust output for current value of
12069         BFD_VERSION_STRING.
12071         * NEWS: New file.
12073         * options.cc (options::help): Print list of supported targets.
12074         * target-select.h: Include <vector>.
12075         (class Target_selector): Make machine_, size_, and is_big_endian_
12076         fields const.  Add bfd_name_ and instantiated_target_ fields.
12077         (Target_selector::Target_selector): Add bfd_name parameter.
12078         (Target_selector::recognize): Make non-virtual, call
12079         do_recognize.
12080         (Target_selector::recognize_by_name): Make non-virtual, call
12081         do_recognize_by_name.
12082         (Target_selector::supported_names): New function.
12083         (Target_selector::bfd_name): New function.
12084         (Target_selector::do_instantiate_target): New pure virtual
12085         function.
12086         (Target_selector::do_recognize): New virtual function.
12087         (Target_selector::do_recognize_by_name): New virtual function.
12088         (Target_selector::instantiate_target): New private function.
12089         (supported_target_names): Declare.
12090         * target-select.cc (Target_selector::Target_selector): Update for
12091         new parameter and fields.
12092         (select_target_by_name): Check that the name matches before
12093         calling recognize_by_name.
12094         (supported_target_names): New function.
12095         * i386.cc (class Target_selector_i386): Update Target_selector
12096         constructor call.  Remove recognize and recognize_by_name.  Add
12097         do_instantiate_target.
12098         * x86_64.cc (class Target_selector_x86_64): Likewise.
12099         * testsuite/testfile.cc (class Target_selector_test): Update for
12100         changes to Target_selector.
12102         * README: Rewrite, with some notes on unsupported features.
12104 2008-03-24  Cary Coutant  <ccoutant@google.com>
12106         * i386.cc (Target_i386::Got_type): New enum declaration.
12107         (Target_i386::Scan::local): Updated callers of Output_data_got
12108         member functions.
12109         (Target_i386::Scan::global): Likewise.
12110         (Target_i386::Relocate::relocate): Likewise.
12111         (Target_i386::Relocate::relocate_tls): Likewise.
12112         * object.h (Got_offset_list): New class.
12113         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12114         (Sized_relobj::local_got_offset): Likewise.
12115         (Sized_relobj::set_local_got_offset): Likewise.
12116         (Sized_relobj::local_has_tls_got_offset): Removed.
12117         (Sized_relobj::local_tls_got_offset): Removed.
12118         (Sized_relobj::set_local_tls_got_offset): Removed.
12119         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12120         * output.cc (Output_data_got::add_global): Added got_type parameter.
12121         (Output_data_got::add_global_with_rel): Likewise.
12122         (Output_data_got::add_global_with_rela): Likewise.
12123         (Output_data_got::add_global_pair_with_rel): New function.
12124         (Output_data_got::add_global_pair_with_rela): New function.
12125         (Output_data_got::add_local): Added got_type parameter.
12126         (Output_data_got::add_local_with_rel): Likewise.
12127         (Output_data_got::add_local_with_rela): Likewise.
12128         (Output_data_got::add_local_pair_with_rel): New function.
12129         (Output_data_got::add_local_pair_with_rela): New function.
12130         (Output_data_got::add_global_tls): Removed.
12131         (Output_data_got::add_global_tls_with_rel): Removed.
12132         (Output_data_got::add_global_tls_with_rela): Removed.
12133         (Output_data_got::add_local_tls): Removed.
12134         (Output_data_got::add_local_tls_with_rel): Removed.
12135         (Output_data_got::add_local_tls_with_rela): Removed.
12136         * output.h (Output_data_got::add_global): Added got_type parameter.
12137         (Output_data_got::add_global_with_rel): Likewise.
12138         (Output_data_got::add_global_with_rela): Likewise.
12139         (Output_data_got::add_global_pair_with_rel): New function.
12140         (Output_data_got::add_global_pair_with_rela): New function.
12141         (Output_data_got::add_local): Added got_type parameter.
12142         (Output_data_got::add_local_with_rel): Likewise.
12143         (Output_data_got::add_local_with_rela): Likewise.
12144         (Output_data_got::add_local_pair_with_rel): New function.
12145         (Output_data_got::add_local_pair_with_rela): New function.
12146         (Output_data_got::add_global_tls): Removed.
12147         (Output_data_got::add_global_tls_with_rel): Removed.
12148         (Output_data_got::add_global_tls_with_rela): Removed.
12149         (Output_data_got::add_local_tls): Removed.
12150         (Output_data_got::add_local_tls_with_rel): Removed.
12151         (Output_data_got::add_local_tls_with_rela): Removed.
12152         * resolve.cc (Symbol::override_base_with_special): Removed
12153         reference to has_got_offset_ field.
12154         * symtab.cc (Symbol::init_fields): Replaced initialization
12155         of got_offset_ with got_offsets_.  Removed initialization
12156         of has_got_offset_
12157         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12158         (Symbol::got_offset): Likewise.
12159         (Symbol::set_got_offset): Likewise.
12160         (Symbol::has_tls_got_offset): Removed.
12161         (Symbol::tls_got_offset): Removed.
12162         (Symbol::set_tls_got_offset): Removed.
12163         (Symbol::got_offset_): Removed.
12164         (Symbol::tls_mod_got_offset_): Removed.
12165         (Symbol::tls_pair_got_offset_): Removed.
12166         (Symbol::got_offsets_): New field.
12167         (Symbol::has_got_offset): Removed.
12168         (Symbol::has_tls_mod_got_offset): Removed.
12169         (Symbol::has_tls_pair_got_offset): Removed.
12170         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12171         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12172         member functions.
12173         (Target_x86_64::Scan::global): Likewise.
12174         (Target_x86_64::Relocate::relocate): Likewise.
12175         (Target_x86_64::Relocate::relocate_tls): Likewise.
12177 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12179         * yyscript.y: Fix spelling error in comment.
12181 2008-03-24  Ian Lance Taylor  <iant@google.com>
12183         * options.h (class General_options): Define build_id option.
12184         * layout.h (class Layout): Declare write_build_id, create_note,
12185         create_build_id.  Add build_id_note_ member.
12186         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12187         "libiberty.h", "md5.h", "sha1.h".
12188         (Layout::Layout): Initialize eh_frame_data_,
12189         eh_frame_hdr_section_, and build_id_note_.
12190         (Layout::finalize): Call create_build_id.
12191         (Layout::create_note): New function, broken out of
12192         Layout::create_gold_note.
12193         (Layout::create_gold_note): Call create_note.
12194         (Layout::create_build_id): New function.
12195         (Layout::write_build_id): New function.
12196         (Close_task_runner::run): Call write_build_id.
12198         * x86_64.cc: Correct license to GPLv3.
12200 2008-03-23  Ian Lance Taylor  <iant@google.com>
12202         * options.cc: Include "demangle.h".
12203         (parse_optional_string): New function.
12204         (parse_long_option): Handle takes_optional_argument.
12205         (parse_short_option): Update dash_z initializer.  Handle
12206         takes_optional_argument.
12207         (General_options::General_options): Initialize do_demangle_.
12208         (General_options::finalize): Set do_demangle_.  Handle demangling
12209         style.
12210         * options.h (parse_optional_string): Declare.
12211         (struct One_option): Add optional_arg field.  Update constructor.
12212         Update call constructor calls.  Add takes_optional_argument
12213         function.
12214         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12215         (DEFINE_optional_string): Define.
12216         (General_options::demangle): Change from DEFINE_bool to
12217         DEFINE_optional_string.
12218         (General_options::no_demangle): New function.
12219         (General_options::do_demangle): New function.
12220         (General_options::set_do_demangle): New function.
12221         (General_options::execstack_status_): Move definition to end of
12222         class definition.
12223         (General_options::static_): Likewise.
12224         (General_options::do_demangle_): New field.
12225         * object.cc (big_endian>::get_symbol_location_info): Call
12226         Options::do_demangle, not Options::demangle.
12227         * symtab.cc (demangle): Likewise.
12229 2008-03-22  Ian Lance Taylor  <iant@google.com>
12231         * gold.h: Include <cstddef> and <sys/types.h>
12232         * options.h: Include <cstring>.
12234 2008-03-21  Ian Lance Taylor  <iant@google.com>
12236         * Added source code to GNU binutils.