PR gold/13204
[external/binutils.git] / gold / ChangeLog
1 2011-10-19  Ian Lance Taylor  <iant@google.com>
2
3         PR gold/13204
4         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5         --section-start option was seen.
6         * options.h (General_options::any_section_start): New function.
7
8 2011-10-18  David S. Miller  <davem@davemloft.net>
9
10         PR binutils/13301
11         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
12         member to track relocation locations that have moved during TLS
13         reloc optimizations.
14         (Target_sparc::Relocate::Relocate): Initialize to NULL.
15         (Target_sparc::Relocate::relocate): Adjust view down by 4
16         bytes if it matches reloc_adjust_addr_.
17         (Target_sparc::Relocate::relocate_tls): Always move the
18         __tls_get_addr call delay slot instruction forward 4 bytes when
19         performing relaxation.
20
21 2011-10-18  Cary Coutant  <ccoutant@google.com>
22
23         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
24         (Output_file::map_no_anonymous): Check for non-zero
25         return code from posix_fallocate.
26
27 2011-10-17  Cary Coutant  <ccoutant@google.com>
28
29         PR gold/13245
30         * plugin.cc (is_visible_from_outside): Check for symbols
31         referenced from dynamic objects.
32         * resolve.cc (Symbol_table::resolve): Don't count references
33         from dynamic objects as references from real ELF files.
34         * testsuite/plugin_test_2.sh: Adjust expected result.
35
36 2011-10-17  Cary Coutant  <ccoutant@google.com>
37
38         * gold.cc: Include timer.h.
39         (queue_middle_tasks): Stamp time.
40         (queue_final_tasks): Likewise.
41         * main.cc (main): Store timer in parameters.  Print timers
42         for each pass.
43         * parameters.cc (Parameters::Parameters): Initialize timer_.
44         (Parameters::set_timer): New function.
45         (set_parameters_timer): New function.
46         * parameters.h (Parameters::set_timer): New function.
47         (Parameters::timer): New function.
48         (Parameters::timer_): New data member.
49         (set_parameters_timer): New function.
50         * timer.cc (Timer::stamp): New function.
51         (Timer::get_pass_time): New function.
52         * timer.h (Timer::stamp): New function.
53         (Timer::get_pass_time): New function.
54         (Timer::pass_times_): New data member.
55
56 2011-10-17  Cary Coutant  <ccoutant@google.com>
57
58         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
59         task for members of lib groups.
60
61 2011-10-17  Cary Coutant  <ccoutant@google.com>
62
63         PR gold/13288
64         * fileread.cc (File_read::find_view): Add assert.
65         (File_read::make_view): Move bounds check (replace with assert)...
66         (File_read::find_or_make_view): ... to here.
67
68 2011-10-12  Cary Coutant  <ccoutant@google.com>
69
70         * output.cc (Output_file::open_base_file): Handle case where
71         ::read returns less than requested size.
72
73 2011-10-10  Cary Coutant  <ccoutant@google.com>
74
75         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
76         Initialize defined_count_.
77         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
78         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
79         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
80         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
81         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
82         * incremental.h (Sized_relobj_incr::defined_count_): New data
83         member.
84         (Sized_incr_dynobj::defined_count_): New data member.
85         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
86         Return zeroes instead of internal error.
87
88 2011-10-10  Cary Coutant  <ccoutant@google.com>
89
90         PR gold/13249
91         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
92         (Output_reloc::symbol_value): Return PLT offset if flag is set.
93         * output.h (class Output_reloc): Add use_plt_offset flag.
94         (Output_reloc::type_): Adjust size of bit field.
95         (Output_reloc::use_plt_offset_): New bit field.
96         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
97         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
98         flag.  Adjust all callers.
99         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
100         creating RELATIVE relocations.
101
102 2011-10-10  Nick Clifton  <nickc@redhat.com>
103
104         * po/es.po: Updated Spanish translation.
105         * po/fi.po: Updated Finnish translation.
106
107 2011-10-03   Diego Novillo  <dnovillo@google.com>
108
109         * options.cc (parse_uint): Fix dereference of RETVAL.
110
111 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
112
113         * layout.h (section_order_map_): New member.
114         (get_section_order_map): New member function.
115         * output.cc (Output_section::add_input_section): Check for patterns
116         only when --section-ordering-file is specified.
117         * gold.cc (queue_middle_tasks): Delay updating order of sections till
118         output_sections have been formed.
119         * layout.cc (Layout_Layout): Initialize section_order_map_.
120         * plugin.cc (update_section_order): Store order in order_map. Do not
121         update the order.
122         * testsuite/Makefile.am: Add test case for plugin_final_layout.
123         * testsuite/Makefile.in: Regenerate.
124         * testsuite/plugin_section_order.c: New file.
125         * testsuite/plugin_final_layout.cc: New file.
126         * testsuite/plugin_final_layout.sh: New file.
127
128 2011-09-29  Cary Coutant  <ccoutant@google.com>
129
130         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
131         Check for NULL.
132         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
133         symbols during incremental update.
134         (Symbol_table::add_from_dynobj): Likewise.
135
136 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
137             Ian Lance Taylor  <iant@google.com>
138
139         * symtab.cc (Symbol_table::define_special_symbol): Always
140         canonicalize version string.
141
142 2011-09-26  Cary Coutant  <ccoutant@google.com>
143
144         * gold.cc (queue_initial_tasks): Move option checks ...
145         * options.cc (General_options::finalize): ... to here. Disable
146         some options; make others fatal.
147
148 2011-09-26  Cary Coutant  <ccoutant@google.com>
149
150         gcc PR lto/47247
151         * plugin.cc (get_symbols_v2): New function.
152         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
153         (is_referenced_from_outside): New function.
154         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
155         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
156         (get_symbols): Pass version parameter.
157         (get_symbols_v2): New function.
158         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
159         parameter.
160         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
161         (onload): Add LDPT_GET_SYMBOLS_V2.
162         (all_symbols_read_hook): Use get_symbols_v2; check for
163         LDPR_PREVAILING_DEF_IRONLY_EXP.
164         * testsuite/plugin_test_3.sh: Update expected results.
165
166 2011-09-23  Simon Baldwin  <simonb@google.com>
167
168         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
169         configuration options.
170         * configure: Regenerate.
171         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
172         * Makefile.in: Regenerate.
173         * testsuite/Makefile.in: Regenerate.
174
175 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
176
177         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
178
179 2011-09-19  Cary Coutant  <ccoutant@google.com>
180
181         * incremental.cc (can_incremental_update): Fix typo in comment.
182         * incremental.h (can_incremental_update): Likewise.
183
184 2011-09-18  Cary Coutant  <ccoutant@google.com>
185
186         * incremental.cc (can_incremental_update): New function.
187         * incremental.h (can_incremental_update): New function.
188         * layout.cc (Layout::init_fixed_output_section): Call it.
189         (Layout::make_output_section): Don't allow patch space in .eh_frame.
190         * object.cc (Sized_relobj_file::do_layout): Call
191         can_incremental_update.
192
193 2011-09-13  Cary Coutant  <ccoutant@google.com>
194
195         * configure.ac: Check for glibc support for gnu_indirect_function
196         support with static linking, setting automake conditional
197         IFUNC_STATIC.
198         * Makefile.in: Regenerate.
199         * configure: Regenerate.
200
201         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
202         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
203         for IFUNC_STATIC.
204         * testsuite/Makefile.in: Regenerate.
205
206 2011-09-13  Cary Coutant  <ccoutant@google.com>
207
208         * incremental.cc (Sized_relobj_incr::do_layout): Call
209         report_comdat_group for kept comdat sections.
210         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
211         * testsuite/Makefile.in: Regenerate.
212         * testsuite/incr_comdat_test_1.cc: New source file.
213         * testsuite/incr_comdat_test_2_v1.cc: New source file.
214         * testsuite/incr_comdat_test_2_v2.cc: New source file.
215         * testsuite/incr_comdat_test_2_v3.cc: New source file.
216
217 2011-09-13  Ian Lance Taylor  <iant@google.com>
218
219         * object.cc (Sized_relobj_file::do_layout): Remove unused local
220         variable external_symbols_offset.
221
222 2011-09-12  Ian Lance Taylor  <iant@google.com>
223
224         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
225         triggered if object has no symbols.
226
227 2011-09-09  David S. Miller  <davem@davemloft.net>
228
229         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
230         (Output_fill_debug_line::do_write): Likewise.
231
232 2011-08-29  Cary Coutant  <ccoutant@google.com>
233
234         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
235         casts to match formatting specs.
236         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
237
238 2011-08-26  Cary Coutant  <ccoutant@google.com>
239
240         * layout.cc (Free_list::allocate): Provide guarantee of minimum
241         remaining hole size when allocating.
242         (Layout::make_output_section): Set fill methods for debug sections.
243         * layout.h (Free_list::Free_list_node): Move from private to
244         public.
245         (Free_list::set_min_hole_size): New function.
246         (Free_list::begin, Free_list::end): New functions.
247         (Free_list::min_hole_): New data member.
248         * output.cc: Include dwarf.h.
249         (Output_fill_debug_info::do_minimum_hole_size): New function.
250         (Output_fill_debug_info::do_write): New function.
251         (Output_fill_debug_line::do_minimum_hole_size): New function.
252         (Output_fill_debug_line::do_write): New function.
253         (Output_section::Output_section): Initialize new data member.
254         (Output_section::set_final_data_size): Ensure patch space is larger
255         than minimum hole size.
256         (Output_section::do_write): Fill holes in debug sections.
257         * output.h (Output_fill): New class.
258         (Output_fill_debug_info): New class.
259         (Output_fill_debug_line): New class.
260         (Output_section::set_free_space_fill): New function.
261         (Output_section::free_space_fill_): New data member.
262         * testsuite/Makefile.am (incremental_test_3): Add
263         --incremental-patch option.
264         (incremental_test_4): Likewise.
265         (incremental_test_5): Likewise.
266         (incremental_test_6): Likewise.
267         (incremental_copy_test): Likewise.
268         (incremental_common_test_1): Likewise.
269         * testsuite/Makefile.in: Regenerate.
270
271 2011-08-26  Nick Clifton  <nickc@redhat.com>
272
273         * po/es.po: Updated Spanish translation.
274
275 2011-08-01  Cary Coutant  <ccoutant@google.com>
276
277         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
278         * gold/testsuite/Makefile.in: Regenerate.
279         * gold/testsuite/justsyms_exec.c: New source file.
280         * gold/testsuite/justsyms_lib.c: New source file.
281
282 2011-08-01  Cary Coutant  <ccoutant@google.com>
283
284         * layout.cc (Layout::set_segment_offsets): Don't realign text
285         segment if -Ttext was specified.
286         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
287         file type.
288         * object.h (Sized_relobj_file::e_type): New function.
289         (Sized_relobj_file::e_type_): New data member.
290         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
291         base address for ET_EXEC files.
292         * target.cc (Target::do_make_elf_object_implementation): Allow
293         ET_EXEC files with --just-symbols option.
294
295 2011-07-28  Cary Coutant  <ccoutant@google.com>
296
297         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
298         Add thread_number parameter.
299         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
300         * workqueue-threads.cc
301         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
302         current thread if its thread number is greater than desired thread
303         count.
304         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
305         Add thread_number parameter.
306         (Workqueue::should_cancel_thread): Likewise.
307         (Workqueue::find_runnable_or_wait): Pass thread_number to
308         should_cancel_thread.
309         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
310         parameter.
311
312 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
313
314         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
315         only after checking if it cannot be forced local.
316         * symtab.h (is_externally_visible): Check if the symbol is not forced
317         local.
318
319 2011-07-15  Ian Lance Taylor  <iant@google.com>
320
321         * options.h (class General_options): Add --print-output-format.
322         Move -EL next to -EB, for  better --help output.
323         * target-select.cc: Include <cstdio>, "options.h", and
324         "parameters.h".
325         (Target_selector::do_target_bfd_name): New function.
326         (print_output_format): New function.
327         * target-select.h (class Target_selector): Update declarations.
328         (Target_selector::target_bfd_name): New function.
329         (print_output_format): Declare.
330         * main.cc: Include "target-select.h".
331         (main): Handle --print-output-format.
332         * gold.cc: Include "target-select.h".
333         (queue_initial_tasks): Handle --print-output-format when there are
334         no input files.
335         * parameters.cc (parameters_force_valid_target): Give a better
336         error message if -EB/-EL does not match target.
337         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
338         function.
339
340 2011-07-15  Ian Lance Taylor  <iant@google.com>
341
342         * i386.cc (class Output_data_plt_i386): Add layout_ field.
343         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
344         (Output_data_plt_i386::do_write): Write address of .dynamic
345         section to first entry in .got.plt section.
346         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
347         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
348         Initialize layout_.
349         (Output_data_plt_x86_64::do_write): Write address of .dynamic
350         section to first entry in .got.plt section.
351         * layout.h (Layout::dynamic_section): New function.
352
353 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
354
355         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
356         to claim_file call.
357         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
358         input_section_position_, and input_section_glob_.
359         (read_layout_from_file): Call function section_ordering_specified.
360         * layout.h (is_section_ordering_specified): New function.
361         (section_ordering_specified): New function.
362         (section_ordering_specified_): New boolean member.
363         * main.cc(main): Call load_plugins after layout object is defined.
364         * output.cc (Output_section::add_input_section): Use
365         function section_ordering_specified to check if section ordering is
366         needed.
367         * output.cc (Output_section::add_relaxed_input_section): Use
368         function section_ordering_specified to check if section ordering is
369         needed.
370         (Output_section::update_section_layout): New function.
371         (Output_section::sort_attached_input_sections): Check if input section
372         must be reordered.
373         * output.h (Output_section::update_section_layout): New function.
374         * plugin.cc (get_section_count): New function.
375         (get_section_type): New function.
376         (get_section_name): New function.
377         (get_section_contents): New function.
378         (update_section_order): New function.
379         (allow_section_ordering): New function. 
380         (Plugin::load): Add the new interfaces to the transfer vector.
381         (Plugin_manager::load_plugins): New parameter.
382         (Plugin_manager::all_symbols_read): New parameter.
383         (Plugin_manager::claim_file): New parameter. Save the elf object for
384         unclaimed objects.
385         (Plugin_manager::get_elf_object): New function.
386         (Plugin_manager::get_view): Change to directly use the bool to check
387         if get_view is called from claim_file_hook.
388         * plugin.h (input_objects): New function
389         (Plugin__manager::load_plugins): New parameter.
390         (Plugin_manager::claim_file): New parameter.
391         (Plugin_manager::get_elf_object): New function.
392         (Plugin_manager::in_claim_file_handler): New function.
393         (Plugin_manager::in_claim_file_handler_): New member.
394         (layout): New function.
395         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
396         handler with an extra parameter. Make the elf object before calling
397         claim_file handler.
398         * testsuite/plugin_test.c (get_section_count): New function pointer.
399         (get_section_type): New function pointer.
400         (get_section_name): New function pointer.
401         (get_section_contents): New function pointer.
402         (update_section_order): New function pointer.
403         (allow_section_ordering): New function pointer.
404         (onload): Check if the new interfaces exist.
405
406 2011-07-13  Ian Lance Taylor  <iant@google.com>
407
408         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
409         relro section.
410         * x86_64.cc (Target_x86_64::got_section): Likewise.
411         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
412         (relro_now_test_SOURCES): New variable.
413         (relro_now_test_DEPENDENCIES): New variable.
414         (relro_now_test_LDFLAGS): New variable.
415         (relro_now_test_LDADD): New variable.
416         (relro_now_test.so): New target.
417         * testsuite/Makefile.in: Rebuild.
418
419 2011-07-12  Ian Lance Taylor  <iant@google.com>
420
421         PR gold/12980
422         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
423         GLOB_DAT relocation rather than a RELATIVE relocation for a
424         protected symbol when creating a shared library.
425         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
426         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
427         * testsuite/protected_main_1.cc (main): Test that protected
428         function has same address.
429
430 2011-07-11  Ian Lance Taylor  <iant@google.com>
431
432         PR gold/12979
433         * options.h (class General_options): Add -Bgroup.
434         * options.cc (General_options::finalize): If -Bgroup is set,
435         default to --unresolved-symbols=report-all.
436         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
437         * target-reloc.h (issue_undefined_symbol_error): Handle
438         --unresolved-symbols=report-all.
439
440 2011-07-08  Ian Lance Taylor  <iant@google.com>
441
442         PR gold/11985
443         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
444         if linker script discards key sections.
445         (Layout::create_dynamic_symtab): Likewise.
446         (Layout::assign_local_dynsym_offsets): Likewise.
447         (Layout::sized_create_version_sections): Likewise.
448         (Layout::create_interp): Likewise.
449         (Layout::finish_dynamic_section): Likewise.
450         (Layout::set_dynamic_symbol_size): Likewise.
451
452 2011-07-08  Ian Lance Taylor  <iant@google.com>
453
454         PR gold/12386
455         * options.h (class General_options): Add --unresolved-symbols.
456         * target-reloc.h (issue_undefined_symbol_error): Check
457         --unresolved-symbols.  Add comments.
458
459 2011-07-08  Ian Lance Taylor  <iant@google.com>
460
461         * testsuite/odr_violation2.cc (Ordering::operator()): Make
462         expression more complex.
463
464 2011-07-08  Ian Lance Taylor  <iant@google.com>
465
466         PR gold/11317
467         * target-reloc.h (issue_undefined_symbol_error): New inline
468         function, broken out of relocate_section.
469         (relocate_section): Call issue_undefined_symbol_error.
470         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
471         there is no TLS segment if we are about to issue an undefined
472         symbol error.
473         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
474
475 2011-07-08  Ian Lance Taylor  <iant@google.com>
476
477         PR gold/12279
478         * resolve.cc (Symbol_table::should_override): Add fromtype
479         parameter.  Change all callers.  Give error when linking together
480         TLS and non-TLS symbol.
481         (Symbol_table::should_override_with_special): Add fromtype
482         parameter.  Change all callers.
483         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
484         there is no TLS segment if we have reported some errors.
485         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
486
487 2011-07-08  Ian Lance Taylor  <iant@google.com>
488
489         PR gold/12372
490         * target.h (Target::plt_address_for_global): New function.
491         (Target::plt_address_for_local): New function.
492         (Target::plt_section_for_global): Remove.
493         (Target::plt_section_for_local): Remove.
494         (Target::do_plt_address_for_global): New virtual function.
495         (Target::do_plt_address_for_local): New virtual function.
496         (Target::do_plt_section_for_global): Remove.
497         (Target::do_plt_section_for_local): Remove.
498         (Target::register_global_plt_entry): Add Symbol_table and Layout
499         parameters.
500         * output.cc (Output_data_got::Got_entry::write): Use
501         plt_address_for_global and plt_address_for_local.
502         * layout.cc (Layout::add_target_dynamic_tags): Use size and
503         address of output section.
504         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
505         got_irelative_, and irelative_count_ fields.  Update
506         declarations.
507         (Output_data_plt_i386::has_irelative_section): New function.
508         (Output_data_plt_i386::entry_count): Add irelative_count_.
509         (Output_data_plt_i386::set_final_data_size): Likewise.
510         (class Target_i386): Add got_irelative_ and rel_irelative_
511         fields.  Update declarations.
512         (Target_i386::Target_i386): Initialize new fields.
513         (Target_i386::do_plt_address_for_global): New function replacing
514         do_plt_section_for_global.
515         (Target_i386::do_plt_address_for_local): New function replacing
516         do_plt_section_for_local.
517         (Target_i386::got_section): Create got_irelative_.
518         (Target_i386::rel_irelative_section): New function.
519         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
520         fields.  Don't define __rel_iplt_{start,end}.
521         (Output_data_plt_i386::add_entry): Add symtab and layout
522         parameters.  Change all callers.  Use different PLT and GOT for
523         IFUNC symbols.
524         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
525         layout parameters.  Change all callers.  Use different PLT and
526         GOT.
527         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
528         (Output_data_plt_i386::rel_irelative): New function.
529         (Output_data_plt_i386::address_for_global): New function.
530         (Output_data_plt_i386::address_for_local): New function.
531         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
532         IRELATIVE GOT when changing IFUNC GOT entries.
533         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
534         reloc.
535         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
536         if we didn't create an IRELATIVE GOT.
537         (Target_i386::Relocate::relocate): Use plt_address_for_global and
538         plt_address_for_local.
539         (Target_i386::do_dynsym_value): Use plt_address_for_global.
540         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
541         got_irelative_, and irelative_count_ fields.  Update
542         declarations.
543         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
544         Initialize new fields.  Remove symtab parameter.  Change all
545         callers.
546         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
547         irelative_count_.
548         (Output_data_plt_x86_64::has_irelative_section): New function.
549         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
550         (class Target_x86_64): Add got_irelative_ and rel_irelative_
551         fields.  Update declarations.
552         (Target_x86_64::Target_x86_64): Initialize new fields.
553         (Target_x86_64::do_plt_address_for_global): New function replacing
554         do_plt_section_for_global.
555         (Target_x86_64::do_plt_address_for_local): New function replacing
556         do_plt_section_for_local.
557         (Target_x86_64::got_section): Create got_irelative_.
558         (Target_x86_64::rela_irelative_section): New function.
559         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
560         all callers.  Don't create __rel_iplt_{start,end}.
561         (Output_data_plt_x86_64::add_entry): Add symtab and layout
562         parameters.  Change all callers.  Use different PLT and GOT for
563         IFUNC symbols.
564         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
565         layout parameters.  Change all callers.  Use different PLT and
566         GOT.
567         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
568         parameters.  Change all callers.  Use different PLT and GOT for
569         IFUNC symbols.
570         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
571         (Output_data_plt_x86_64::rela_irelative): New function.
572         (Output_data_plt_x86_64::address_for_global): New function.
573         (Output_data_plt_x86_64::address_for_local): New function.
574         (Output_data_plt_x86_64::set_final_data_size): Likewise.
575         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
576         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
577         (Target_x86_64::register_global_plt_entry): Add symtab and layout
578         parameters.
579         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
580         reloc.
581         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
582         symbols if we didn't create an IRELATIVE GOT.
583         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
584         plt_address_for_local.
585         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
586         * testsuite/ifuncvar1.c: New test file.
587         * testsuite/ifuncvar2.c: New test file.
588         * testsuite/ifuncvar3.c: New test file.
589         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
590         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
591         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
592         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
593         * testsuite/Makefile.in: Rebuild.
594
595 2011-07-07  Cary Coutant  <ccoutant@google.com>
596
597         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
598         (two_file_test_1_ndebug.o): Likewise.
599         (two_file_test_1b_ndebug.o): Likewise.
600         (two_file_test_2_ndebug.o): Likewise.
601         (two_file_test_main_ndebug.o): Likewise.
602         (incremental_test_2): Link with no-debug versions.
603
604 2011-07-06  Cary Coutant  <ccoutant@google.com>
605
606         * gold/incremental.cc
607         (Output_section_incremental_inputs::write_info_blocks): Check for
608         hidden and internal symbols.
609
610 2011-07-06  Cary Coutant  <ccoutant@google.com>
611
612         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
613         Check disposition for startup file.
614         (Incremental_inputs::report_command_line): Ignore
615         --incremental-startup-unchanged option.
616         * options.cc (General_options::parse_incremental_startup_unchanged):
617         New function.
618         (General_options::General_options): Initialize new data member.
619         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
620         (General_options): Add --incremental-startup-unchanged option.
621         (General_options::incremental_startup_disposition): New function.
622         (General_options::incremental_startup_disposition_): New data member.
623
624 2011-07-06  Cary Coutant  <ccoutant@google.com>
625
626         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
627         input file index to Script_info ctor.
628         (Sized_incremental_binary::do_file_has_changed): Find the
629         command-line argument for files named in scripts.
630         * incremental.h (Script_info::Script_info): New ctor
631         with input file index.
632         (Script_info::input_file_index): New function.
633         (Script_info::input_file_index_): New data member.
634         (Incremental_binary::get_library): Add const.
635         (Incremental_binary::get_script_info): Add const.
636         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
637         * testsuite/Makefile.am (incremental_test_5): New test case.
638         (incremental_test_6): New test case.
639         * testsuite/Makefile.in: Regenerate.
640
641 2011-07-06  Cary Coutant  <ccoutant@google.com>
642
643         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
644         debug output when command lines differ.
645
646 2011-07-06  Cary Coutant  <ccoutant@google.com>
647
648         * incremental.cc (Incremental_inputs::report_command_line): Ignore
649         --incremental-patch option.
650         * layout.cc (Free_list::allocate): Extend allocation beyond original
651         end if enabled.
652         (Layout::make_output_section): Mark sections that should get
653         patch space.
654         * options.cc (parse_percent): New function.
655         * options.h (parse_percent): New function.
656         (DEFINE_percent): New macro.
657         (General_options): Add --incremental-patch option.
658         * output.cc (Output_section::Output_section): Initialize new data
659         members.
660         (Output_section::add_input_section): Print section name when out
661         of patch space.
662         (Output_section::add_output_section_data): Likewise.
663         (Output_section::set_final_data_size): Add patch space when
664         doing --incremental-full.
665         (Output_section::do_reset_address_and_file_offset): Remove patch
666         space.
667         (Output_segment::set_section_list_addresses): Print debug output
668         only if --incremental-update.
669         * output.h (Output_section::set_is_patch_space_allowed): New function.
670         (Output_section::is_patch_space_allowed_): New data member.
671         (Output_section::patch_space_): New data member.
672         * parameters.cc (Parameters::incremental_full): New function.
673         * parameters.h (Parameters::incremental_full): New function
674         * testsuite/Makefile.am (incremental_test_2): Add test for
675         --incremental-patch option.
676         * testsuite/Makefile.in: Regenerate.
677         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
678         (t18): Remove function body.
679
680 2011-07-05  Doug Kwan  <dougkwan@google.com>
681
682         PR gold/12771
683         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
684         Arm_Address type for relocation result.
685         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
686         overflow check.
687         (Arm_relocate_functions::abs32): Use unaligned access.
688         (Arm_relocate_functions::rel32): Ditto.
689         (Arm_relocate_functions::prel31): Ditto.
690         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
691         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
692         static data relocations.
693         * testsuite/Makefile.in: Regnerate.
694         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
695
696 2011-07-05  Ian Lance Taylor  <iant@google.com>
697
698         PR gold/12392
699         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
700         symbols if necessary.
701         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
702
703 2011-07-05  Ian Lance Taylor  <iant@google.com>
704
705         PR gold/12952
706         * resolve.cc (Symbol::override_base_with_special): Simply override
707         version with special symbol version, ignoring previous version.
708
709 2011-07-05  Ian Lance Taylor  <iant@google.com>
710
711         * object.cc (Sized_relobj_file::include_section_group): Add
712         information to comment about signature location.
713
714 2011-07-02  Ian Lance Taylor  <iant@google.com>
715
716         PR gold/12957
717         * options.h (class General_options): Add -f and -F.
718         * options.cc (General_options::finalize): Fatal error if -f/-F
719         are used without -shared.
720         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
721
722 2011-07-02  Ian Lance Taylor  <iant@google.com>
723
724         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
725
726 2011-07-01  Ian Lance Taylor  <iant@google.com>
727
728         PR gold/12525
729         PR gold/12952
730         * resolve.cc (Symbol::override_base_with_special): Don't override
731         the version if the overriding symbol has a different name.
732         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
733         all callers.  If we give an error about an undefined version,
734         define the base version if necessary.
735         * dynobj.h (class Versions): Update declaration.
736         * testsuite/weak_alias_test_5.cc: New file.
737         * testsuite/weak_alias_test.script: New file.
738         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
739         and versioned_alias have the right value, and call t2.
740         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
741         weak_alias_test_5.so.
742         (weak_alias_test_LDADD): Likewise.
743         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
744         * testsuite/Makefile.in: Rebuild.
745
746 2011-07-01  Ian Lance Taylor  <iant@google.com>
747
748         PR gold/12525
749         * options.h (class General_options): Support -z notext.
750         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
751         -Wl,-z,notext.
752         (two_file_shared_nonpic.so): Likewise.
753         (two_file_shared_mixed.so): Likewise.
754         (two_file_shared_mixed_1.so): Likewise.
755         (weak_undef_lib_nonpic.so): Likewise.
756         (alt/weak_undef_lib_nonpic.so): Likewise.
757         (tls_test_shared_nonpic.so): Likewise.
758         * testsuite/Makefile.in: Rebuild.
759
760 2011-07-01  Ian Lance Taylor  <iant@google.com>
761
762         PR gold/12525
763         * configure.ac: Test whether static linking works, setting
764         the automake conditional HAVE_STATIC.
765         * testsuite/Makefile.am: Disable tests using -static if
766         HAVE_STATIC is not true.
767         * configure, testsuite/Makefile.in: Rebuild.
768
769 2011-07-01  Ian Lance Taylor  <iant@google.com>
770
771         PR gold/12525
772         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
773         Assert if we see DW_EH_PE_indirect.
774         * target.h (Target::ehframe_datarel_base): New function.
775         (Target::do_ehframe_datarel_base): New target function.
776         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
777         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
778         function.
779
780 2011-07-01  Ian Lance Taylor  <iant@google.com>
781
782         PR gold/12571
783         * options.h (class General_options): Add
784         --ld-generated-unwind-info.
785         * ehframe.cc (Fde::write): Add address parameter.  Change all
786         callers.  If associated with PLT, fill in address and size.
787         (Cie::set_output_offset): Only add merge mapping if there is an
788         object.
789         (Cie::write): Add address parameter.  Change all callers.
790         (Eh_frame::add_ehframe_for_plt): New function.
791         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
792         input_offset_ fields into union u_, with new plt field.
793         (Fde::Fde): Adjust for new union field.
794         (Fde::Fde) [Output_data version]: New constructor.
795         (Fde::add_mapping): Only add merge mapping if there is an object.
796         (class Cie): Update declarations.
797         (class Eh_frame): Declare add_ehframe_for_plt.
798         * layout.cc (Layout::layout_eh_frame): Break out code into
799         make_eh_frame_section, and call it.
800         (Layout::make_eh_frame_section): New function.
801         (Layout::add_eh_frame_for_plt): New function.
802         * layout.h (class Layout): Update declarations.
803         * merge.cc (Merge_map::add_mapping): Add assertion.
804         * i386.cc: Include "dwarf.h".
805         (class Output_data_plt_i386): Make first_plt_entry,
806         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
807         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
808         and plt_eh_frame_fde.
809         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
810         boundary.  Call add_eh_frame_for_plt if appropriate.
811         * x86_64.cc: Include "dwarf.h".
812         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
813         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
814         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
815         and plt_eh_frame_fde.
816         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
817         appropriate.
818
819 2011-06-29  Ian Lance Taylor  <iant@google.com>
820
821         PR gold/12629
822         * object.cc (Sized_relobj_file::layout_section): Change shdr
823         parameter to be const.
824         (Sized_relobj_file::layout_eh_frame_section): New function, broken
825         out of do_layout.
826         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
827         appropriate.  Call layout_eh_frame_section.
828         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
829         sections.
830         * object.h (class Sized_relobj_file): Update declarations.
831
832 2011-06-29  Ian Lance Taylor  <iant@google.com>
833
834         PR gold/12652
835         * script.cc (Token::integer_value): Accept trailing M/m/K/k
836         modifier.
837         (Lex::gather_token): Accept trailing M/m/K/k for integers.
838
839 2011-06-29  Ian Lance Taylor  <iant@google.com>
840
841         PR gold/12675
842         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
843         SHT_X86_64_UNWIND.
844         * layout.cc (Layout::layout_eh_frame): Likewise.
845
846 2011-06-29  Ian Lance Taylor  <iant@google.com>
847
848         PR gold/12695
849         * layout.cc (Layout::symtab_section_shndx): New function.
850         * layout.h (class Layout): Declare symtab_section_shndx.
851         * output.cc (Output_section::write_header): Call it.
852
853 2011-06-29  Ian Lance Taylor  <iant@google.com>
854
855         PR gold/12818
856         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
857         symbols which are not used in a relocation.
858
859 2011-06-28  Ian Lance Taylor  <iant@google.com>
860
861         PR gold/12898
862         * layout.cc (Layout::segment_precedes): Don't crash if a linker
863         script create indistinguishable segments.
864         (Layout::set_segment_offsets): Use stable_sort when sorting
865         segments.  Pass this to Compare_segments constructor.
866         * layout.h (class Layout): Make segment_precedes non-static.
867         (class Compare_segments): Change from struct to class.  Add
868         layout_ field.  Add constructor.
869         * script-sections.cc
870         (Script_sections::attach_sections_using_phdrs_clause): Rename
871         local orphan to is_orphan.  Don't report failure to put empty
872         section in segment.  On attachment failure, report name of
873         section, and attach to first PT_LOAD segment.
874
875 2011-06-28  Ian Lance Taylor  <iant@google.com>
876
877         PR gold/12934
878         * target-select.cc (Target_selector::Target_selector): Add
879         emulation parameter.  Change all callers.
880         (select_target_by_bfd_name): Rename from select_target_by_name.
881         Change all callers.
882         (select_target_by_emulation): New function.
883         (supported_emulation_names): New function.
884         * target-select.h (class Target_selector): Add emulation_ field.
885         Update declarations.
886         (Target_selector::recognize_by_bfd_name): Rename from
887         recognize_by_name.  Change all callers.
888         (Target_selector::supported_bfd_names): Rename from
889         supported_names.  Change all callers.
890         (Target_selector::recognize_by_emulation): New function.
891         (Target_selector::supported_emulations): New function.
892         (Target_selector::emulation): New function.
893         (Target_selector::do_recognize_by_bfd_name): Rename from
894         do_recognize_by_name.  Change all callers.
895         (Target_selector::do_supported_bfd_names): Rename from
896         do_supported_names.  Change all callers.
897         (Target_selector::do_recognize_by_emulation): New function.
898         (Target_selector::do_supported_emulations): New function.
899         (select_target_by_bfd_name): Change name in declaration.
900         (select_target_by_emulation): Declare.
901         (supported_emulation_names): Declare.
902         * parameters.cc (parameters_force_valid_target): Try to find
903         target based on emulation from -m option.
904         * options.h (class General_options): Change doc string for -m.
905         * options.cc (help): Print emulations.
906         (General_options::parse_V): Likewise.
907         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
908         Add emulation parameter.  Change all callers.
909
910 2011-06-28  Ian Lance Taylor  <iant@google.com>
911
912         * target.h (class Target): Add osabi_ field.
913         (Target::osabi): New function.
914         (Target::set_osabi): New function.
915         (Target::Target): Initialize osabi_.
916         (Target::do_adjust_elf_header): Make pure virtual.
917         (Sized_target::do_adjust_elf_header): Declare.
918         * target.cc (Sized_target::do_adjust_elf_header): New function.
919         (class Sized_target): Instantiate all versions.
920         * freebsd.h (class Target_freebsd): Remove.
921         (Target_selector_freebsd::do_recognize): Call set_osabi on
922         Target.
923         (Target_selector_freebsd::do_recognize_by_name): Likewise.
924         (Target_selector_freebsd::set_osabi): Remove.
925         * i386.cc (class Target_i386): Inherit from Sized_target rather
926         than Target_freebsd.
927         * x86_64.cc (class Target_x86_64): Likewise.
928
929 2011-06-28  Ian Lance Taylor  <iant@google.com>
930
931         * target.h (Target::can_check_for_function_pointers): Rewrite.
932         Make non-virtual.
933         (Target::can_icf_inline_merge_sections): Likewise.
934         (Target::section_may_have_icf_unsafe_poineters): Likewise.
935         (Target::Target_info): Add can_icf_inline_merge_sections field.
936         (Target::do_can_check_for_function_pointers): New virtual
937         function.
938         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
939         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
940         from can_check_for_function_pointers, move in file.
941         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
942         section_may_have_icf_unsafe_poineters, move in file.
943         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
944         * i386.cc (Target_i386::do_can_check_for_function_pointers):
945         Rename from can_check_for_function_pointers, move in file.
946         (Target_i386::can_icf_inline_merge_sections): Remove.
947         (Target_i386::i386_info): Initialize
948         can_icf_inline_merge_sections.
949         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
950         Initialize can_icf_inline_merge_sections.
951         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
952         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
953         Rename from can_check_for_function_pointers, move in file.
954         (Target_x86_64::can_icf_inline_merge_sections): Remove.
955         (Target_x86_64::x86_64_info): Initialize
956         can_icf_inline_merge_sections.
957         * testsuite/testfile.cc (Target_test::test_target_info):
958         Likewise.
959         * icf.cc (get_section_contents): Correct formatting.
960
961 2011-06-27  Ian Lance Taylor  <iant@google.com>
962
963         * symtab.cc (Symbol::versioned_name): New function.
964         (Symbol_table::add_to_final_symtab): Use versioned_name when
965         appropriate.
966         (Symbol_table::sized_write_symbol): Likewise.
967         * symtab.h (class Symbol): Declare versioned_name.
968         * stringpool.h (class Stringpool_template): Add variant of add
969         which takes a std::basic_string.
970         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
971         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
972         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
973         (ver_test_12.o): New target.
974         * testsuite/Makefile.in: Rebuild.
975
976 2011-06-27  Doug Kwan  <dougkwan@google.com>
977
978         * arm.cc (Arm_relocate_functions::thm_jump8,
979         Arm_relocate_functions::thm_jump11): Use a wider signed
980         type to compute offset.
981         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
982         arm_thm_jump8.
983         * testsuite/Makefile.in: Regenerate.
984         * testsuite/arm_branch_in_range.sh: Check test results of
985         arm_thm_jump11 and arm_thm_jump8.
986         * testsuite/arm_thm_jump11.s: New test source file.
987         * testsuite/arm_thm_jump11.t: New linker script.
988         * testsuite/arm_thm_jump8.s: New test source file.
989         * testsuite/arm_thm_jump8.t: New linker script.
990
991 2011-06-24  Ian Lance Taylor  <iant@google.com>
992
993         * layout.cc: Include "object.h".
994         (ctors_sections_in_init_array): New static variable.
995         (Layout::is_ctors_in_init_array): New function.
996         (Layout::layout): Add entry to ctors_sections_in_init_array if
997         appropriate.
998         * layout.h (class Layout): Declare is_ctors_in_init_array.
999         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1000         is_ctors_reverse_view is set.
1001         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1002         all callers.  Set is_ctors_reverse_view field of View_size.
1003         (Sized_relobj_file::reverse_words): New function.
1004         * object.h (Sized_relobj_file::View_size): Add
1005         is_ctors_reverse_view field.
1006         (class Sized_relobj_file): Update declarations.
1007         * testsuite/initpri3.c: New test.
1008         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1009         initpri3b.
1010         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1011         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1012         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1013         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1014         * testsuite/Makefile.in: Rebuild.
1015
1016 2011-06-24  Cary Coutant  <ccoutant@google.com>
1017
1018         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1019         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1020         (debug_msg_cdebug.err): New targets.
1021         * testsuite/Makefile.in: Regenerate.
1022         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1023         Fix checks for link with shared library.
1024
1025 2011-06-24  Doug Kwan  <dougkwan@google.com>
1026
1027         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1028         skip empty text sections.
1029         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1030
1031 2011-06-22  Ian Lance Taylor  <iant@google.com>
1032
1033         PR gold/12910
1034         * options.h (class General_options): Add --ctors-in-init-array.
1035         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1036         friends as SHT_PROGBITS for merging sections.
1037         (Layout::layout): Remove special handling of .init_array and
1038         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1039         and .dtors if ctors_in_init_array.
1040         (Layout::make_output_section): Force correct section types for
1041         .init_array and friends.  Don't sort if doing relocatable link,
1042         Don't sort .ctors and .dtors if ctors_in_init_array.
1043         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1044         (Layout::output_section_name): Add relobj parameter.  Change all
1045         callers.  Handle .ctors. and .dtors. in code rather than table.
1046         Handle .ctors and .dtors if ctors_in_init_array.
1047         (Layout::match_file_name): New function, moved from output.cc.
1048         * layout.h (class Layout): Update declarations.
1049         * output.cc: Include "layout.h".
1050         (Input_section_sort_entry::get_priority): New function.
1051         (Input_section_sort_entry::match_file_name): Just call
1052         Layout::match_file_name.
1053         (Output_section::Input_section_sort_init_fini_compare::operator()):
1054         Handle .ctors and .dtors.  Sort by explicit priority rather than
1055         by name.
1056         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1057         * testsuite/initpri2.c: New test.
1058         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1059         (check_PROGRAMS): Add initpri2.
1060         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1061         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1062         * configure, testsuite/Makefile.in: Rebuild.
1063
1064 2011-06-19  Ian Lance Taylor  <iant@google.com>
1065
1066         PR gold/12880
1067         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1068         .interp section to a PT_INTERP segment even if we have seen a
1069         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1070         clause in a linker script.
1071         (Layout::finalize): Don't create a .interp section if we've
1072         already create a PT_INTERP segment.
1073         (Layout::create_interp): Always call choose_output_section (revert
1074         patch of 2011-06-17).  Don't create PT_INTERP segment.
1075         * script-sections.cc
1076         (Script_sections::create_note_and_tls_segments): Add a .interp
1077         section to a PT_INTERP segment even if we have seen a
1078         --dynamic-linker option.
1079
1080 2011-06-18  Ian Lance Taylor  <iant@google.com>
1081
1082         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1083         merely because a non-PT_LOAD segment has a dynamic reloc.
1084
1085 2011-06-18  Ian Lance Taylor  <iant@google.com>
1086
1087         * layout.cc (Layout::finish_dynamic_section): Don't create
1088         DT_FLAGS entry if not needed.
1089
1090 2011-06-18  Ian Lance Taylor  <iant@google.com>
1091
1092         PR gold/12745
1093         * layout.cc (Layout::layout_eh_frame): Correct handling of
1094         writable .eh_frame section.
1095
1096 2011-06-17  Ian Lance Taylor  <iant@google.com>
1097
1098         PR gold/12893
1099         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1100         symbol is redefined with the exact same object and value.
1101
1102 2011-06-17  Ian Lance Taylor  <iant@google.com>
1103
1104         PR gold/12880
1105         * layout.h (class Layout): Add interp_segment_ field.
1106         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1107         (Layout::attach_allocated_section_to_segment): If making shared
1108         library, put .interp section in PT_INTERP segment.
1109         (Layout::finalize): Also call create_interp if -dynamic-linker
1110         option was used.
1111         (Layout::create_interp): Assert that there is no PT_INTERP
1112         segment.  If not using a SECTIONS clause, use make_output_section.
1113         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1114         * script-sections.cc
1115         (Script_sections::create_note_and_tls_segments): If making shared
1116         library, put .interp section in PT_INTERP segment.
1117
1118 2011-06-17  Ian Lance Taylor  <iant@google.com>
1119
1120         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1121         when making a shared library.
1122
1123 2011-06-17  Ian Lance Taylor  <iant@google.com>
1124
1125         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1126         parameter.  Change all callers.  Don't issue warning about PC32
1127         against locally defined symbol.
1128
1129 2011-06-16  Ian Lance Taylor  <iant@google.com>
1130
1131         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1132         occurs in same object.
1133
1134 2011-06-14  Alan Modra  <amodra@gmail.com>
1135
1136         * po/POTFILES.in: Regenerate.
1137
1138 2011-06-09  Ian Lance Taylor  <iant@google.com>
1139
1140         * script-sections.cc
1141         (Orphan_output_section::set_section_addresses): For a relocatable
1142         link set address to 0.
1143
1144 2011-06-09  Cary Coutant  <ccoutant@google.com>
1145
1146         PR gold/12804
1147         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1148         used with --compress-debug-sections.
1149         * gold/object.cc (Sized_relobj_file::do_layout): Report
1150         uncompressed size of compressed input sections.
1151
1152 2011-06-08  Cary Coutant  <ccoutant@google.com>
1153
1154         PR gold/12804
1155         * testsuite/two_file_test_2_v1.cc: Change initialization of
1156         v2 to keep it in .data.
1157
1158 2011-06-07  Cary Coutant  <ccoutant@google.com>
1159
1160         * common.cc (Symbol_table::do_allocate_commons_list): Call
1161         gold_fallback.
1162         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1163         (Errors::fallback): New function.
1164         (gold_fallback): New function.
1165         * errors.h (Errors::fallback): New function.
1166         * gold.cc (gold_exit): Change status parameter to enum; adjust
1167         all callers.
1168         (queue_initial_tasks): Call gold_fallback.
1169         * gold.h: Include cstdlib.
1170         (Exit_status): New enum type.
1171         (gold_exit): Change status parameter to enum.
1172         (gold_fallback): New function.
1173         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1174         (Layout::create_symtab_sections): Likewise.
1175         (Layout::create_shdrs): Likewise.
1176         * main.cc (main): Adjust call to gold_exit.
1177         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1178         (Output_data_got::add_got_entry_pair): Likewise.
1179         (Output_section::add_input_section): Likewise.
1180         (Output_section::add_output_section_data): Likewise.
1181         (Output_segment::set_section_list_addresses): Likewise.
1182         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1183
1184 2011-06-07  Cary Coutant  <ccoutant@google.com>
1185
1186         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1187         for incremental links.
1188         * output.cc (Output_segment::set_section_list_addresses): Remove
1189         FIXME and test for TLS or BSS.
1190
1191 2011-06-07  Cary Coutant  <ccoutant@google.com>
1192
1193         * testsuite/Makefile.am: Add incremental_copy_test,
1194         incremental_common_test_1.
1195         * testsuite/Makefile.in: Regenerate.
1196         * testsuite/common_test_1_v1.c: New source file.
1197         * testsuite/common_test_1_v2.c: New source file.
1198         * testsuite/copy_test_v1.cc: New source file.
1199
1200 2011-06-07  Cary Coutant  <ccoutant@google.com>
1201
1202         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1203         update, allocate common from bss section's free list.
1204         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1205         linker-defined symbols.
1206         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1207         Skip GOT and PLT entries that are no longer referenced.
1208         (Output_section_incremental_inputs::write_info_blocks): Mark
1209         linker-defined symbols.
1210         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1211         * output.cc (Output_section::allocate): New function.
1212         * output.h (Output_section::allocate): New function.
1213         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1214         linker-defined symbols.
1215         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1216         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1217         (Symbol::init_base_output_data): Likewise.
1218         (Symbol::init_base_output_segment): Likewise.
1219         (Symbol::init_base_constant): Likewise.
1220         (Sized_symbol::init_output_data): Likewise.
1221         (Sized_symbol::init_output_segment): Likewise.
1222         (Sized_symbol::init_constant): Likewise.
1223         (Symbol_table::do_define_in_output_data): Likewise.
1224         (Symbol_table::do_define_in_output_segment): Likewise.
1225         (Symbol_table::do_define_as_constant): Likewise.
1226         * symtab.h (Symbol::is_predefined): New function.
1227         (Symbol::init_base_output_data): Add is_predefined parameter.
1228         (Symbol::init_base_output_segment): Likewise.
1229         (Symbol::init_base_constant): Likewise.
1230         (Symbol::is_predefined_): New data member.
1231         (Sized_symbol::init_output_data): Add is_predefined parameter.
1232         (Sized_symbol::init_output_segment): Likewise.
1233         (Sized_symbol::init_constant): Likewise.
1234         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1235
1236 2011-06-07  Cary Coutant  <ccoutant@google.com>
1237
1238         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1239         instead of emit_copy_reloc.
1240         (Copy_relocs::emit_copy_reloc): Refactor.
1241         (Copy_relocs::make_copy_reloc): New function.
1242         (Copy_relocs::add_copy_reloc): Remove.
1243         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1244         section.
1245         (Copy_relocs::make_copy_reloc): New function.
1246         (Copy_relocs::add_copy_reloc): Remove.
1247         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1248         unchanged input files.
1249         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1250         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1251         Reserve BSS space for COPY relocations.
1252         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1253         (Output_section_incremental_inputs::write_info_blocks): Record
1254         whether a symbol is copied from a shared object.
1255         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1256         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1257         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1258         (Incremental_input_entry_reader::get_output_symbol_index): Add
1259         is_copy parameter.
1260         (Incremental_binary::emit_copy_relocs): New function.
1261         (Incremental_binary::do_emit_copy_relocs): New function.
1262         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1263         new data member.
1264         (Sized_incremental_binary::add_copy_reloc): New function.
1265         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1266         (Sized_incremental_binary::Copy_reloc): New struct.
1267         (Sized_incremental_binary::Copy_relocs): New typedef.
1268         (Sized_incremental_binary::copy_relocs_): New data member.
1269         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1270         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1271         * target.h (Sized_target::emit_copy_reloc): New function.
1272         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1273
1274 2011-06-02  Cary Coutant  <ccoutant@google.com>
1275
1276         PR gold/12163
1277         * gold/archive.cc (Archive::Archive): Initialize new data member.
1278         (Archive::include_all_members): Return if archive has already been
1279         included.
1280         * gold/archive.h (Archive::include_all_members_): New data member.
1281
1282 2011-06-02  Nick Clifton  <nickc@redhat.com>
1283
1284         * dynobj.h: Fix spelling mistake in comment.
1285         * output.cc: Likewise.
1286
1287 2011-05-31  Doug Kwan  <dougkwan@google.com>
1288             Asier Llano
1289
1290         PR gold/12826
1291         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1292         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1293         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1294         redundant arm_exidx_test.so.
1295         * testsuite/Makefile.in: Regenerate.
1296         (check_SCRIPTS): Add pr12826.sh
1297         (check_DATA): Add pr12826.stdout
1298         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1299         * testsuite/pr12826.sh: New file.
1300         * testsuite/pr12826_1.s: Ditto.
1301         * testsuite/pr12826_1.s: Ditto.
1302
1303 2011-05-30  Ian Lance Taylor  <iant@google.com>
1304
1305         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1306         sections.
1307
1308 2011-05-29  Ian Lance Taylor  <iant@google.com>
1309
1310         PR gold/12804
1311         * testsuite/Makefile.am: Use different file name for two_file_test
1312         temporary file for each incremental test.
1313         * testsuite/Makefile.in: Rebuild.
1314
1315 2011-05-29  Ian Lance Taylor  <iant@google.com>
1316
1317         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1318         binary input file is empty.
1319
1320 2011-05-27  Ian Lance Taylor  <iant@google.com>
1321
1322         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1323         (ver_test_9.so): Likewise.
1324         * testsuite/Makefile.in: Rebuild.
1325
1326 2011-05-26 Cary Coutant  <ccoutant@google.com>
1327
1328         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1329         * incremental.cc (Incremental_inputs::report_input_section): Fix
1330         comment, indentation.
1331         (Incremental_inputs::report_comdat_group): New function.
1332         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1333         of data for incremental input file entry.
1334         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1335         group count, COMDAT group signatures.
1336         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1337         an unchanged input file.
1338         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1339         Initialize new data member.
1340         (Incremental_object_entry::add_comdat_group): New function.
1341         (Incremental_object_entry::get_comdat_group_count): New function.
1342         (Incremental_object_entry::get_comdat_signature_key): New function.
1343         (Incremental_object_entry::groups_): New data member.
1344         (Incremental_inputs::report_comdat_group): New function.
1345         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1346         data for incremental input file entry.
1347         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1348         (Incremental_input_entry_reader::get_input_section): Adjust size of
1349         data for incremental input file entry.
1350         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1351         (Incremental_input_entry_reader::get_comdat_group_signature): New
1352         function.
1353         * object.cc (Sized_relobj::include_section_group): Report kept
1354         COMDAT groups for incremental links.
1355
1356 2011-05-24  David Meyer  <pdox@google.com>
1357
1358         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1359         with name parameter.  Add found_name parameter.
1360         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1361         * dirsearch.h (class Dirsearch): Update declaration.
1362
1363 2011-05-24  Ian Lance Taylor  <iant@google.com>
1364
1365         * archive.cc (Library_base::should_include_member): Pull in object
1366         from archive if it defines the entry symbol.
1367         * parameters.cc (Parameters::entry): New function.
1368         * parameters.h (class Parameters): Declare entry.
1369         * output.h (class Output_file_header): Remove entry_ field.
1370         * output.cc (Output_file_header::Output_file_header): Remove entry
1371         parameter.  Change all callers.
1372         (Output_file_header::entry): Use parameters->entry.
1373         * gold.cc (queue_middle_tasks): Likewise.
1374         * plugin.cc (Plugin_hook::run): Likewise.
1375
1376 2011-05-24 Cary Coutant  <ccoutant@google.com>
1377
1378         * gold.cc (queue_initial_tasks): Pass incremental base filename
1379         to Output_file::open_base_file; don't print error message.
1380         * incremental-dump.cc (main): Adjust call to
1381         Output_file::open_for_modification.
1382         * incremental-dump.cc (main): Likewise.
1383         * incremental.cc (Incremental_inputs::report_command_line):
1384         Ignore --incremental-base option when comparing command lines.
1385         Ignore parameter when given as separate argument.
1386         * options.h (class General_options): Add --incremental-base.
1387         * output.cc (Output_file::Output_file):
1388         (Output_file::open_base_file): Add base_name and writable parameters;
1389         read base file into new file; print error message here.
1390         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1391         callers.
1392         * output.h (Output_file::open_for_modification): Rename to...
1393         (Output_file::open_base_file): ...this; add base_name and
1394         writable parameters; adjust all callers.
1395         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1396         callers.
1397         * testsuite/Makefile.am (incremental_test_4): Test
1398         --incremental-base.
1399         * testsuite/Makefile.in: Regenerate.
1400
1401 2011-05-24 Cary Coutant  <ccoutant@google.com>
1402
1403         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1404         incremental_test_4.
1405         * testsuite/Makefile.in: Regenerate.
1406         * testsuite/two_file_test_1_v1.cc: New test source file.
1407         * testsuite/two_file_test_1b_v1.cc: New test source file.
1408         * testsuite/two_file_test_2_v1.cc: New test source file.
1409
1410 2011-05-24 Cary Coutant  <ccoutant@google.com>
1411
1412         * dynobj.h (Dynobj::do_dynobj): New function.
1413         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1414         flag and soname for shared objects.
1415         * incremental.cc (Incremental_inputs::report_object): Make
1416         either Incremental_object_entry or Incremental_dynobj_entry; add
1417         soname to string table.
1418         (Incremental_inputs::report_input_section): Add assertion.
1419         (Output_section_incremental_inputs::set_final_data_size): Adjust
1420         type of input file entry for shared libraries; adjust size of
1421         shared library info entry.
1422         (Output_section_incremental_inputs::write_input_files): Write
1423         as_needed flag for shared libraries.
1424         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1425         of input file entry for shared libraries; write soname.
1426         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1427         soname from incremental info.
1428         * incremental.h (enum Incremental_input_flags): Add
1429         INCREMENTAL_INPUT_AS_NEEDED.
1430         (Incremental_input_entry::Incremental_input_entry): Initialize new
1431         data member.
1432         (Incremental_input_entry::set_as_needed): New function.
1433         (Incremental_input_entry::as_needed): New function.
1434         (Incremental_input_entry::do_dynobj_entry): New function.
1435         (Incremental_input_entry::as_needed_): New data member.
1436         (Incremental_object_entry::Incremental_object_entry): Don't check
1437         for shared library.
1438         (Incremental_object_entry::do_type): Likewise.
1439         (class Incremental_dynobj_entry): New class.
1440         (Incremental_input_entry_reader::as_needed): New function.
1441         (Incremental_input_entry_reader::get_soname): New function.
1442         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1443         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1444         size of shared library info entry.
1445         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1446         incremental link when adding DT_NEEDED entries.
1447         * object.h (Object::Object): Initialize new data member.
1448         (Object::dynobj): New function.
1449         (Object::set_as_needed): New function.
1450         (Object::as_needed): New function.
1451         (Object::do_dynobj): New function.
1452         (Object::as_needed_): New data member.
1453
1454 2011-05-24 Cary Coutant  <ccoutant@google.com>
1455
1456         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1457         info; adjust display of GOT entries.
1458         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1459         vector of input objects; remove file_status_.
1460         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1461         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1462         got_plt reader; call target hooks to reserve GOT entries.
1463         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1464         of input file info header and GOT info entry.
1465         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1466         relocation info.
1467         (Got_plt_view_info::got_descriptor): Remove.
1468         (Got_plt_view_info::sym_index): New data member.
1469         (Got_plt_view_info::input_index): New data member.
1470         (Local_got_offset_visitor::visit): Write input file index.
1471         (Global_got_offset_visitor::visit): Write 0 for input file index.
1472         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1473         with sym_index and input_index.
1474         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1475         incremental info GOT entry; replace got_descriptor with input_index.
1476         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1477         map from input file index to object.
1478         (Sized_relobj_incr::do_layout): Replace direct data member reference
1479         with accessor function.
1480         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1481         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1482         Adjust size of input file info header.
1483         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1484         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1485         (Incremental_input_entry_reader::get_input_section): Adjust size of
1486         input file info header.
1487         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1488         of incremental info GOT entry.
1489         (Incremental_got_plt_reader::get_got_desc): Remove.
1490         (Incremental_got_plt_reader::get_got_symndx): New function.
1491         (Incremental_got_plt_reader::get_got_input_index): New function.
1492         (Sized_incremental_binary::Sized_incremental_binary): Remove
1493         file_status_; add input_objects_.
1494         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1495         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1496         (Sized_incremental_binary::file_is_unchanged): Remove.
1497         (Sized_incremental_binary::set_input_object): New function.
1498         (Sized_incremental_binary::input_object): New function.
1499         (Sized_incremental_binary::file_status_): Remove.
1500         (Sized_incremental_binary::input_objects_): New data member.
1501         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1502         references.
1503         (Sized_relobj_incr::invalid_address): Move to base class.
1504         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1505         class.
1506         (Sized_relobj_incr::do_output_section_offset): Likewise.
1507         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1508         (Sized_relobj_incr::section_offsets_): Likewise.
1509         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1510         function.
1511         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1512         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1513         with accessor function.
1514         (Sized_relobj_file::do_layout): Likewise.
1515         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1516         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1517         (Sized_relobj_file::compute_final_local_value): Replace refs to
1518         section_offsets_ with accessor function.
1519         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1520         * object.h (Relobj::Relobj): Initialize new data members.
1521         (Relobj::add_dyn_reloc): New function.
1522         (Relobj::first_dyn_reloc): New function.
1523         (Relobj::dyn_reloc_count): New function.
1524         (Relobj::first_dyn_reloc_): New data member.
1525         (Relobj::dyn_reloc_count_): New data member.
1526         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1527         references.
1528         (Sized_relobj::Address): New typedef.
1529         (Sized_relobj::invalid_address): Move here from child class.
1530         (Sized_relobj::Sized_relobj): Initialize new data members.
1531         (Sized_relobj::sized_relobj): New function.
1532         (Sized_relobj::is_output_section_offset_invalid): Move here from
1533         child class.
1534         (Sized_relobj::get_output_section_offset): Likewise.
1535         (Sized_relobj::local_has_got_offset): Likewise.
1536         (Sized_relobj::local_got_offset): Likewise.
1537         (Sized_relobj::set_local_got_offset): Likewise.
1538         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1539         (Sized_relobj::clear_got_offsets): New function.
1540         (Sized_relobj::section_offsets): Move here from child class.
1541         (Sized_relobj::do_output_section_offset): Likewise.
1542         (Sized_relobj::do_set_section_offset): Likewise.
1543         (Sized_relobj::Local_got_offsets): Likewise.
1544         (Sized_relobj::local_got_offsets_): Likewise.
1545         (Sized_relobj::section_offsets_): Likewise.
1546         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1547         references.
1548         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1549         class.
1550         (Sized_relobj_file::sized_relobj): New function
1551         (Sized_relobj_file::local_has_got_offset): Move to base class.
1552         (Sized_relobj_file::local_got_offset): Likewise.
1553         (Sized_relobj_file::set_local_got_offset): Likewise.
1554         (Sized_relobj_file::get_output_section_offset): Likewise.
1555         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1556         (Sized_relobj_file::do_output_section_offset): Likewise.
1557         (Sized_relobj_file::do_set_section_offset): Likewise.
1558         (Sized_relobj_file::Local_got_offsets): Likewise.
1559         (Sized_relobj_file::local_got_offsets_): Likewise.
1560         (Sized_relobj_file::section_offsets_): Likewise.
1561         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1562         (all constructors).
1563         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1564         (Output_reloc::get_symbol_index): Likewise.
1565         (Output_reloc::local_section_offset): Likewise.
1566         (Output_reloc::get_address): Likewise.
1567         (Output_reloc::symbol_value): Likewise.
1568         (Output_data_got::reserve_slot): Move to class definition.
1569         (Output_data_got::reserve_local): New function.
1570         (Output_data_got::reserve_slot_for_global): Remove.
1571         (Output_data_got::reserve_global): New function.
1572         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1573         (all constructors, two instantiations).
1574         (Output_reloc::get_relobj): New function (two instantiations).
1575         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1576         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1577         (Output_data_reloc::add_global): Adjust type of relobj.
1578         (Output_data_reloc::add_global_relative): Likewise.
1579         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1580         (Output_data_reloc::add_local): Likewise.
1581         (Output_data_reloc::add_local_relative): Likewise.
1582         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1583         (Output_data_reloc::add_local_section): Likewise.
1584         (Output_data_reloc::add_output_section): Likewise.
1585         (Output_data_reloc::add_absolute): Likewise.
1586         (Output_data_reloc::add_target_specific): Likewise.
1587         (Output_data_got::reserve_slot): Move definition here.
1588         (Output_data_got::reserve_local): New function.
1589         (Output_data_got::reserve_global): New function.
1590         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1591         section_offsets_ with accessor function.
1592         (Sized_relobj_file::write_sections): Likewise.
1593         (Sized_relobj_file::do_relocate_sections): Likewise.
1594         * target.h (Sized_target::reserve_local_got_entry): New function.
1595         (Sized_target::reserve_global_got_entry): New function.
1596         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1597         (Target_x86_64::reserve_global_got_entry): New function.
1598         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1599
1600 2011-05-23 Cary Coutant  <ccoutant@google.com>
1601
1602         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1603         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1604         bit when checking got_type.
1605         * incremental.cc (Sized_incremental_binary::setup_readers):
1606         Store symbol table and string table locations; initialize bit vector
1607         of file status flags.
1608         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1609         unchanged files.
1610         (Sized_incremental_binary::do_process_got_plt): New function.
1611         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1612         (Output_section_incremental_inputs::set_final_data_size): Record
1613         file index for each input file.
1614         (Output_section_incremental_inputs::write_got_plt): Store file index
1615         instead of input entry offset for each GOT entry.
1616         * incremental.h
1617         (Incremental_input_entry::Incremental_input_entry): Initialize new
1618         data member.
1619         (Incremental_input_entry::set_offset): Store file index.
1620         (Incremental_input_entry::get_file_index): New function.
1621         (Incremental_input_entry::file_index_): New data member.
1622         (Incremental_binary::process_got_plt): New function.
1623         (Incremental_binary::do_process_got_plt): New function.
1624         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1625         data members.
1626         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1627         (Sized_incremental_binary::set_file_is_unchanged): New function.
1628         (Sized_incremental_binary::file_is_unchanged): New function.
1629         (Sized_incremental_binary::do_process_got_plt): New function.
1630         (Sized_incremental_binary::file_status_): New data member.
1631         (Sized_incremental_binary::main_symtab_loc_): New data member.
1632         (Sized_incremental_binary::main_strtab_loc_): New data member.
1633         * output.cc (Output_data_got::Got_entry::write): Add case
1634         RESERVED_CODE.
1635         (Output_data_got::add_global): Call add_got_entry.
1636         (Output_data_got::add_global_plt): Likewise.
1637         (Output_data_got::add_global_with_rel): Likewise.
1638         (Output_data_got::add_global_with_rela): Likewise.
1639         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1640         (Output_data_got::add_global_pair_with_rela): Likewise.
1641         (Output_data_got::add_local): Call add_got_entry.
1642         (Output_data_got::add_local_plt): Likewise.
1643         (Output_data_got::add_local_with_rel): Likewise.
1644         (Output_data_got::add_local_with_rela): Likewise.
1645         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1646         (Output_data_got::add_local_pair_with_rela): Likewise.
1647         (Output_data_got::reserve_slot): New function.
1648         (Output_data_got::reserve_slot_for_global): New function.
1649         (Output_data_got::add_got_entry): New function.
1650         (Output_data_got::add_got_entry_pair): New function.
1651         (Output_section::add_output_section_data): Edit FIXME.
1652         * output.h
1653         (Output_section_data_build::Output_section_data_build): New
1654         constructor with size parameter.
1655         (Output_data_space::Output_data_space): Likewise.
1656         (Output_data_got::Output_data_got): Initialize new data member; new
1657         constructor with size parameter.
1658         (Output_data_got::add_constant): Call add_got_entry.
1659         (Output_data_got::reserve_slot): New function.
1660         (Output_data_got::reserve_slot_for_global): New function.
1661         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1662         (Output_data_got::add_got_entry): New function.
1663         (Output_data_got::add_got_entry_pair): New function.
1664         (Output_data_got::free_list_): New data member.
1665         * target.h (Sized_target::init_got_plt_for_update): New function.
1666         (Sized_target::register_global_plt_entry): New function.
1667         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1668         Initialize new data member; call init; add constructor with PLT count.
1669         (Output_data_plt_x86_64::init): New function.
1670         (Output_data_plt_x86_64::add_relocation): New function.
1671         (Output_data_plt_x86_64::reserve_slot): New function.
1672         (Output_data_plt_x86_64::free_list_): New data member.
1673         (Target_x86_64::init_got_plt_for_update): New function.
1674         (Target_x86_64::register_global_plt_entry): New function.
1675         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1676         incremental updates.
1677         (Output_data_plt_x86_64::add_relocation): New function.
1678         * testsuite/object_unittest.cc (Object_test): Set default options.
1679
1680 2011-05-16  Ian Lance Taylor  <iant@google.com>
1681
1682         * options.h (class General_options): Make -i a synonym for -r.
1683
1684 2011-05-16  Ian Lance Taylor  <iant@google.com>
1685
1686         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1687
1688 2011-05-10 Cary Coutant  <ccoutant@google.com>
1689
1690         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1691         strip_all (-s).
1692
1693 2011-05-06  Ian Lance Taylor  <iant@google.com>
1694
1695         * layout.cc (Layout::layout): If the output section flags change,
1696         update the ordering.
1697
1698 2011-04-25 Cary Coutant  <ccoutant@google.com>
1699
1700         * incremental-dump.cc (dump_incremental_inputs): Print local
1701         symbol info for each input file.
1702         * incremental.cc
1703         (Output_section_incremental_inputs::set_final_data_size): Add local
1704         symbol info to input file entries in incremental info.
1705         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1706         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1707         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1708         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1709         implementation.
1710         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1711         (Sized_incr_relobj::do_relocate): Write the local symbols.
1712         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1713         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1714         Adjust size of input file header.
1715         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1716         (Incremental_inputs_reader::get_local_symbol_count): New function.
1717         (Incremental_inputs_reader::get_input_section): Adjust size of input
1718         file header.
1719         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1720         (Sized_incr_relobj::This): New typedef.
1721         (Sized_incr_relobj::sym_size): New const data member.
1722         (Sized_incr_relobj::Local_symbol): New struct.
1723         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1724         (Sized_incr_relobj::do_local_symbol_offset): New function.
1725         (Sized_incr_relobj::local_symbol_count_): New data member.
1726         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1727         (Sized_incr_relobj::local_symbol_index_): New data member.
1728         (Sized_incr_relobj::local_symbol_offset_): New data member.
1729         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1730         (Sized_incr_relobj::local_symbols_): New data member.
1731         * object.h (Relobj::output_local_symbol_count): New function.
1732         (Relobj::local_symbol_offset): New function.
1733         (Relobj::do_output_local_symbol_count): New function.
1734         (Relobj::do_local_symbol_offset): New function.
1735         (Sized_relobj::do_output_local_symbol_count): New function.
1736         (Sized_relobj::do_local_symbol_offset): New function.
1737
1738 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1739
1740         * descriptors.cc (set_close_on_exec): New function.
1741         (Descriptors::open): Use set_close_on_exec.
1742         * output.cc (S_ISLNK): Define if not defined.
1743
1744 2011-04-22 Cary Coutant  <ccoutant@google.com>
1745
1746         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1747         global symbol map.
1748         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1749         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1750         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1751         relocations.
1752         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1753         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1754         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1755         * incremental.h
1756         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1757         function.
1758         (Incremental_binary::apply_incremental_relocs): New function.
1759         (Incremental_binary::do_apply_incremental_relocs): New function.
1760         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1761         data member.
1762         (Sized_incremental_binary::add_global_symbol): New function.
1763         (Sized_incremental_binary::global_symbol): New function.
1764         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1765         (Sized_incremental_binary::symbol_map_): New data member.
1766         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1767         * target.h (Sized_target::apply_relocation): New function.
1768         * target-reloc.h (apply_relocation): New function.
1769         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1770
1771 2011-04-22  Doug Kwan  <dougkwan@google.com>
1772
1773         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1774         flag of a SHT_ARM_EXIDX section.
1775         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1776         * testsuite/Makefile.in: Regenerate.
1777         * testsuite/arm_exidx_test.s: New file.
1778         * testsuite/arm_exidx_test.sh: Same.
1779
1780 2011-04-20 Cary Coutant  <ccoutant@google.com>
1781
1782         PR gold/12689
1783         * archive.h (Incremental_archive_entry::Archive_member):
1784         Initialize arg_serial_ (second constructor).
1785
1786 2011-04-17  Ian Lance Taylor  <iant@google.com>
1787
1788         * object.cc (Relocate_info::location): Simplify location string.
1789         * errors.cc (Errors::error_at_location): Don't print program
1790         name.
1791         (Errors::warning_at_location): Likewise.
1792         (Errors::undefined_symbol): Likewise.
1793         * testsuite/debug_msg.sh: Update accordingly.
1794
1795 2011-04-14 Cary Coutant  <ccoutant@google.com>
1796
1797         * gold/layout.cc (Layout::symtab_section_offset): New function.
1798         * gold/layout.h (Layout::symtab_section_offset): New function.
1799         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1800
1801 2011-04-12  Ian Lance Taylor  <iant@google.com>
1802
1803         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1804         with MREMAP_MAYMOVE.
1805         * output.h (class Output_file): Add map_is_allocated_ field.
1806         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1807         not available, provide stubs.  If mremap is not available, #define
1808         it to gold_mremap.
1809         (MREMAP_MAYMOVE): Define if not defined.
1810         (Output_file::Output_file): Initialize map_is_allocated_.
1811         (Output_file::resize): Check map_is_allocated_.
1812         (Output_file::map_anonymous): If mmap fails, use malloc.
1813         (Output_file::unmap): Don't do anything for an anonymous map.
1814         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1815         is not available, provide stubs.
1816         (File_read::View::~View): Use free rather than delete[].
1817         (File_read::make_view): Use malloc rather than new[].  If mmap
1818         fails, use malloc.
1819         (File_read::find_or_make_view): Use malloc rather than new[].
1820         * gold.h: Remove HAVE_REMAP code.
1821         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1822         exists.  Rename mremap to gold_mremap.  If mmap is not available
1823         don't do anything.
1824         * configure, config.in: Rebuild.
1825
1826 2011-04-11  Ian Lance Taylor  <iant@google.com>
1827
1828         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1829         initialize local variable v.
1830
1831 2011-04-11  Cary Coutant  <ccoutant@google.com>
1832
1833         * archive.cc (Archive::include_member): Adjust call to
1834         report_object.
1835         (Add_archive_symbols::run): Track argument serial numbers.
1836         (Lib_group::include_member): Likewise.
1837         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1838         * archive.h (Incremental_archive_entry::Archive_member):
1839         Initialize arg_serial_.
1840         (Archive_member::arg_serial_): New data member.
1841         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1842         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1843         incremental link.
1844         (Sized_dynobj::do_for_all_local_got_entries): New function.
1845         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1846         function.
1847         * fileread.cc (get_mtime): New function.
1848         * fileread.h (get_mtime): New function.
1849         * gold.cc (queue_initial_tasks): Check for incremental update.
1850         (process_incremental_input): New function.
1851         (queue_middle_tasks): Don't force valid target for incremental
1852         update.
1853         * incremental-dump.cc (find_input_containing_global): Adjust
1854         size of symbol info entry.
1855         (dump_incremental_inputs): Dump argument serial number and
1856         in_system_directory flag; bias shndx by 1; print symbol names
1857         when dumping per-file symbol lists; use new symbol info readers.
1858         * incremental.cc
1859         (Output_section_incremental_inputs:update_data_size): New function.
1860         (Sized_incremental_binary::setup_readers): Setup input readers
1861         for each input file; build maps for files added from libraries
1862         and scripts.
1863         (Sized_incremental_binary::check_input_args): New function.
1864         (Sized_incremental_binary::do_check_inputs): Build map of argument
1865         serial numbers to input arguments.
1866         (Sized_incremental_binary::do_file_has_changed): Rename
1867         do_file_is_unchanged to this; compare file modification times.
1868         (Sized_incremental_binary::do_init_layout): New function.
1869         (Sized_incremental_binary::do_reserve_layout): New function.
1870         (Sized_incremental_binary::do_get_input_reader): Remove.
1871         (Sized_incremental_binary::get_symtab_view): New function.
1872         (Incremental_checker::can_incrementally_link_output_file): Remove.
1873         (Incremental_inputs::report_command_line): Exclude --debug options.
1874         (Incremental_inputs::report_archive_begin): Add parameter; track
1875         argument serial numbers; don't put input file entry for archive
1876         before archive members.
1877         (Incremental_inputs::report_archive_end): Put input file entry
1878         for archive after archive members.
1879         (Incremental_inputs::report_object): Add parameter; track argument
1880         serial numbers and in_system_directory flag.
1881         (Incremental_inputs::report_script): Add parameter; track argument
1882         serial numbers.
1883         (Output_section_incremental_inputs::set_final_data_size): Adjust
1884         size of symbol info entry; check for forwarding symbols.
1885         (Output_section_incremental_inputs::write_input_files): Write
1886         in_system_directory flag and argument serial number.
1887         (Output_section_incremental_inputs::write_info_blocks): Map section
1888         indices between incremental info and original input file; store
1889         input section index for each symbol.
1890         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1891         change operator() to visit().
1892         (class Global_got_offset_visitor): Likewise.
1893         (class Global_symbol_visitor_got_plt):
1894         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1895         classes.
1896         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1897         (Sized_incr_relobj::do_read_symbols): New function.
1898         (Sized_incr_relobj::do_layout): New function.
1899         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1900         (Sized_incr_relobj::do_add_symbols): New function.
1901         (Sized_incr_relobj::do_should_include_member): New function.
1902         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1903         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1904         (Sized_incr_relobj::do_section_size): New function.
1905         (Sized_incr_relobj::do_section_name): New function.
1906         (Sized_incr_relobj::do_section_contents): New function.
1907         (Sized_incr_relobj::do_section_flags): New function.
1908         (Sized_incr_relobj::do_section_entsize): New function.
1909         (Sized_incr_relobj::do_section_address): New function.
1910         (Sized_incr_relobj::do_section_type): New function.
1911         (Sized_incr_relobj::do_section_link): New function.
1912         (Sized_incr_relobj::do_section_info): New function.
1913         (Sized_incr_relobj::do_section_addralign): New function.
1914         (Sized_incr_relobj::do_initialize_xindex): New function.
1915         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1916         (Sized_incr_relobj::do_read_relocs): New function.
1917         (Sized_incr_relobj::do_gc_process_relocs): New function.
1918         (Sized_incr_relobj::do_scan_relocs): New function.
1919         (Sized_incr_relobj::do_count_local_symbols): New function.
1920         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1921         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1922         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1923         (Sized_incr_relobj::do_relocate): New function.
1924         (Sized_incr_relobj::do_set_section_offset): New function.
1925         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1926         (Sized_incr_dynobj::do_read_symbols): New function.
1927         (Sized_incr_dynobj::do_layout): New function.
1928         (Sized_incr_dynobj::do_add_symbols): New function.
1929         (Sized_incr_dynobj::do_should_include_member): New function.
1930         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1931         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1932         (Sized_incr_dynobj::do_section_size): New function.
1933         (Sized_incr_dynobj::do_section_name): New function.
1934         (Sized_incr_dynobj::do_section_contents): New function.
1935         (Sized_incr_dynobj::do_section_flags): New function.
1936         (Sized_incr_dynobj::do_section_entsize): New function.
1937         (Sized_incr_dynobj::do_section_address): New function.
1938         (Sized_incr_dynobj::do_section_type): New function.
1939         (Sized_incr_dynobj::do_section_link): New function.
1940         (Sized_incr_dynobj::do_section_info): New function.
1941         (Sized_incr_dynobj::do_section_addralign): New function.
1942         (Sized_incr_dynobj::do_initialize_xindex): New function.
1943         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1944         (make_sized_incremental_object): New function.
1945         (Incremental_library::copy_unused_symbols): New function.
1946         (Incremental_library::do_for_all_unused_symbols): New function.
1947         * incremental.h (enum Incremental_input_flags): New type.
1948         (class Incremental_checker): Remove.
1949         (Incremental_input_entry::Incremental_input_entry): Add argument
1950         serial number.
1951         (Incremental_input_entry::arg_serial): New function.
1952         (Incremental_input_entry::set_is_in_system_directory): New function.
1953         (Incremental_input_entry::is_in_system_directory): New function.
1954         (Incremental_input_entry::arg_serial_): New data member.
1955         (Incremental_input_entry::is_in_system_directory_): New data member.
1956         (class Script_info): Move here from script.h.
1957         (Script_info::Script_info): Add filename parameter.
1958         (Script_info::filename): New function.
1959         (Script_info::filename_): New data member.
1960         (Incremental_script_entry::Incremental_script_entry): Add argument
1961         serial number.
1962         (Incremental_object_entry::Incremental_object_entry): Likewise.
1963         (Incremental_object_entry::add_input_section): Build list of input
1964         sections with map to original shndx.
1965         (Incremental_object_entry::get_input_section_index): New function.
1966         (Incremental_object_entry::shndx_): New data member.
1967         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1968         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1969         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1970         serial number.
1971         (Incremental_inputs::report_archive_begin): Likewise.
1972         (Incremental_inputs::report_object): Likewise.
1973         (Incremental_inputs::report_script): Likewise.
1974         (class Incremental_global_symbol_reader): New class.
1975         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1976         and store flags and input file type.
1977         (Incremental_input_entry_reader::arg_serial): New function.
1978         (Incremental_input_entry_reader::type): Extract type from flags.
1979         (Incremental_input_entry_reader::is_in_system_directory): New function.
1980         (Incremental_input_entry_reader::get_input_section_count): Call
1981         accessor function for type.
1982         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1983         function for type; adjust size of global symbol entry.
1984         (Incremental_input_entry_reader::get_global_symbol_count): Call
1985         accessor function for type.
1986         (Incremental_input_entry_reader::get_object_count): Likewise.
1987         (Incremental_input_entry_reader::get_object_offset): Likewise.
1988         (Incremental_input_entry_reader::get_member_count): Likewise.
1989         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1990         (Incremental_input_entry_reader::get_member_offset): Likewise.
1991         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1992         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1993         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1994         (Incremental_input_entry_reader::get_global_symbol_reader): New
1995         function.
1996         (Incremental_input_entry_reader::get_output_symbol_index): New
1997         function.
1998         (Incremental_input_entry_reader::type_): Remove.
1999         (Incremental_input_entry_reader::flags_): New data member.
2000         (Incremental_inputs_reader::input_file_offset): New function.
2001         (Incremental_inputs_reader::input_file_index): New function.
2002         (Incremental_inputs_reader::input_file): Call input_file_offset.
2003         (Incremental_inputs_reader::input_file_at_offset): New function.
2004         (Incremental_relocs_reader::get_r_type): Reformat.
2005         (Incremental_relocs_reader::get_r_shndx): Reformat.
2006         (Incremental_relocs_reader::get_r_offset): Reformat.
2007         (Incremental_relocs_reader::data): New function.
2008         (Incremental_binary::Incremental_binary): Initialize new data members.
2009         (Incremental_binary::check_inputs): Add cmdline parameter.
2010         (Incremental_binary::file_is_unchanged): Remove.
2011         (Input_reader::arg_serial): New function.
2012         (Input_reader::get_unused_symbol_count): New function.
2013         (Input_reader::get_unused_symbol): New function.
2014         (Input_reader::do_arg_serial): New function.
2015         (Input_reader::do_get_unused_symbol_count): New function.
2016         (Input_reader::do_get_unused_symbol): New function.
2017         (Incremental_binary::input_file_count): New function.
2018         (Incremental_binary::get_input_reader): Change signature to use
2019         index instead of filename.
2020         (Incremental_binary::file_has_changed): New function.
2021         (Incremental_binary::get_input_argument): New function.
2022         (Incremental_binary::get_library): New function.
2023         (Incremental_binary::get_script_info): New function.
2024         (Incremental_binary::init_layout): New function.
2025         (Incremental_binary::reserve_layout): New function.
2026         (Incremental_binary::output_file): New function.
2027         (Incremental_binary::do_check_inputs): New function.
2028         (Incremental_binary::do_file_is_unchanged): Remove.
2029         (Incremental_binary::do_file_has_changed): New function.
2030         (Incremental_binary::do_init_layout): New function.
2031         (Incremental_binary::do_reserve_layout): New function.
2032         (Incremental_binary::do_input_file_count): New function.
2033         (Incremental_binary::do_get_input_reader): Change signature.
2034         (Incremental_binary::input_args_map_): New data member.
2035         (Incremental_binary::library_map_): New data member.
2036         (Incremental_binary::script_map_): New data member.
2037         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2038         new data members.
2039         (Sized_incremental_binary::output_section): New function.
2040         (Sized_incremental_binary::inputs_reader): Add const.
2041         (Sized_incremental_binary::symtab_reader): Add const.
2042         (Sized_incremental_binary::relocs_reader): Add const.
2043         (Sized_incremental_binary::got_plt_reader): Add const.
2044         (Sized_incremental_binary::get_symtab_view): New function.
2045         (Sized_incremental_binary::Inputs_reader): New typedef.
2046         (Sized_incremental_binary::Input_entry_reader): New typedef.
2047         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2048         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2049         (Sized_incremental_binary::do_file_has_changed): New function.
2050         (Sized_incremental_binary::do_init_layout): New function.
2051         (Sized_incremental_binary::do_reserve_layout): New function.
2052         (Sized_input_reader::Inputs_reader): Remove.
2053         (Sized_input_reader::Input_entry_reader): Remove.
2054         (Sized_input_reader::do_arg_serial): New function.
2055         (Sized_input_reader::do_get_unused_symbol_count): New function.
2056         (Sized_input_reader::do_get_unused_symbol): New function.
2057         (Sized_incremental_binary::do_input_file_count): New function.
2058         (Sized_incremental_binary::do_get_input_reader): Change signature;
2059         use index instead of filename.
2060         (Sized_incremental_binary::section_map_): New data member.
2061         (Sized_incremental_binary::input_entry_readers_): New data member.
2062         (class Sized_incr_relobj): New class.
2063         (class Sized_incr_dynobj): New class.
2064         (make_sized_incremental_object): New function.
2065         (class Incremental_library): New class.
2066         * layout.cc (Free_list::num_lists): New static data member.
2067         (Free_list::num_nodes): New static data member.
2068         (Free_list::num_removes): New static data member.
2069         (Free_list::num_remove_visits): New static data member.
2070         (Free_list::num_allocates): New static data member.
2071         (Free_list::num_allocate_visits): New static data member.
2072         (Free_list::init): New function.
2073         (Free_list::remove): New function.
2074         (Free_list::allocate): New function.
2075         (Free_list::dump): New function.
2076         (Free_list::print_stats): New function.
2077         (Layout_task_runner::run): Resize output file for incremental updates.
2078         (Layout::Layout): Initialize new data members.
2079         (Layout::set_incremental_base): New function.
2080         (Layout::init_fixed_output_section): New function.
2081         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2082         incremental updates.
2083         (Layout::create_gold_note): Do not create gold note section for
2084         incremental updates.
2085         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2086         for incremental updates.
2087         (Layout::set_section_offsets): For incremental updates, allocate space
2088         from free list.
2089         (Layout::create_symtab_sections): Layout with offsets relative to
2090         start of section; for incremental updates, allocate space from free
2091         list.
2092         (Layout::create_shdrs): For incremental updates, allocate space from
2093         free list.
2094         (Layout::finish_dynamic_section): For incremental updates, do not
2095         check --as-needed (fixed in subsequent patch).
2096         * layout.h (class Free_list): New class.
2097         (Layout::set_incremental_base): New function.
2098         (Layout::incremental_base): New function.
2099         (Layout::init_fixed_output_section): New function.
2100         (Layout::allocate): New function.
2101         (Layout::incremental_base_): New data member.
2102         (Layout::free_list_): New data member.
2103         * main.cc (main): Print Free_list statistics.
2104         * object.cc (Relobj::finalize_incremental_relocs): Add
2105         clear_counts parameter; clear counts only when clear_counts is set.
2106         (Sized_relobj::Sized_relobj): Initialize new base class.
2107         (Sized_relobj::do_layout): Don't report special sections.
2108         (Sized_relobj::do_for_all_local_got_entries): New function.
2109         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2110         symtab_off to all symbol table offsets.
2111         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2112         * object.h (class Got_offset_list): Move to top of file.
2113         (Object::Object): Allow case where input_file == NULL.
2114         (Object::~Object): Likewise.
2115         (Object::input_file): Assert that input_file != NULL.
2116         (Object::lock): Allow case where input_file == NULL.
2117         (Object::unlock): Likewise.
2118         (Object::is_locked): Likewise.
2119         (Object::token): Likewise.
2120         (Object::release): Likewise.
2121         (Object::is_incremental): New function.
2122         (Object::get_mtime): New function.
2123         (Object::for_all_local_got_entries): New function.
2124         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2125         (Object::set_is_in_system_directory): New function.
2126         (Object::is_in_system_directory): New function.
2127         (Object::do_is_incremental): New function.
2128         (Object::do_get_mtime): New function.
2129         (Object::do_for_all_local_got_entries): New function.
2130         (Object::is_in_system_directory_): New data member.
2131         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2132         (class Sized_relobj_base): New class.
2133         (class Sized_relobj): Derive from Sized_relobj_base.
2134         (class Sized_relobj::Symbols): Redeclare from base class.
2135         (class Sized_relobj::local_got_offset_list): Remove.
2136         (class Sized_relobj::Output_sections): Redeclare from base class.
2137         (class Sized_relobj::do_for_all_local_got_entries): New function.
2138         (class Sized_relobj::write_local_symbols): Add offset parameter.
2139         (class Sized_relobj::local_symbol_offset_): Update comment.
2140         (class Sized_relobj::local_dynsym_offset_): Update comment.
2141         * options.cc (Input_arguments::add_file): Remove const.
2142         * options.h (Input_file_argument::Input_file_argument):
2143         Initialize arg_serial_ (all constructors).
2144         (Input_file_argument::set_arg_serial): New function.
2145         (Input_file_argument::arg_serial): New function.
2146         (Input_file_argument::arg_serial_): New data member.
2147         (Input_arguments::Input_arguments): Initialize file_count_.
2148         (Input_arguments::add_file): Remove const.
2149         (Input_arguments::number_of_input_files): New function.
2150         (Input_arguments::file_count_): New data member.
2151         (Command_line::number_of_input_files): Call
2152         Input_arguments::number_of_input_files.
2153         * output.cc (Output_segment_headers::Output_segment_headers):
2154         Set current size.
2155         (Output_section::Input_section::current_data_size): New function.
2156         (Output_section::Output_section): Initialize new data members.
2157         (Output_section::add_input_section): Don't do merge sections for
2158         an incremental link; allocate space from free list for an
2159         incremental update.
2160         (Output_section::add_output_section_data): Allocate space from
2161         free list for an incremental update.
2162         (Output_section::update_data_size): New function.
2163         (Output_section::set_fixed_layout): New function.
2164         (Output_section::reserve): New function.
2165         (Output_segment::set_section_addresses): Remove const.
2166         (Output_segment::set_section_list_addresses): Remove const; allocate
2167         space from free list for an incremental update.
2168         (Output_segment::set_offset): Adjust size of RELRO segment for an
2169         incremental update.
2170         * output.h (Output_data::current_data_size): Move here from
2171         child classes.
2172         (Output_data::pre_finalize_data_size): New function.
2173         (Output_data::update_data_size): New function.
2174         (Output_section_headers::update_data_size): new function.
2175         (Output_section_data_build::current_data_size): Move to Output_data.
2176         (Output_data_strtab::update_data_size): New function.
2177         (Output_section::current_data_size): Move to Output_data.
2178         (Output_section::set_fixed_layout): New function.
2179         (Output_section::has_fixed_layout): New function.
2180         (Output_section::reserve): New function.
2181         (Output_section::update_data_size): New function.
2182         (Output_section::has_fixed_layout_): New data member.
2183         (Output_section::free_list_): New data member.
2184         (Output_segment::set_section_addresses): Remove const.
2185         (Output_segment::set_section_list_addresses): Remove const.
2186         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2187         New function.
2188         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2189         New function.
2190         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2191         parameter when calling Add_symbols constructor; store argument
2192         serial number for members of a lib group.
2193         (Add_symbols::locks): Allow case where token == NULL.
2194         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2195         (Read_member::~Read_member): New function.
2196         (Read_member::is_runnable): New function.
2197         (Read_member::locks): New function.
2198         (Read_member::run): New function.
2199         (Check_script::~Check_script): New function.
2200         (Check_script::is_runnable): New function.
2201         (Check_script::locks): New function.
2202         (Check_script::run): New function.
2203         (Check_library::~Check_library): New function.
2204         (Check_library::is_runnable): New function.
2205         (Check_library::locks): New function.
2206         (Check_library::run): New function.
2207         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2208         (Add_symbols::library_): New data member.
2209         (class Read_member): New class.
2210         (class Check_script): New class.
2211         (class Check_library): New class.
2212         * reloc.cc (Read_relocs::is_runnable): Allow case where
2213         token == NULL.
2214         (Read_relocs::locks): Likewise.
2215         (Scan_relocs::locks): Likewise.
2216         (Relocate_task::locks): Likewise.
2217         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2218         to clear counters.
2219         (Sized_relobj::incremental_relocs_scan): Fix comment.
2220         (Sized_relobj::do_relocate): Pass output file offset to
2221         write_local_symbols.
2222         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2223         from class declaration.
2224         * script.cc (read_input_script): Allocate Script_info; pass
2225         argument serial number to report_script.
2226         * script.h (class Script_info): Move to incremental.h.
2227         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2228         * symtab.h (Symbol_table::add_from_incrobj): New function.
2229         (Symbol_table::set_file_offset): New function.
2230
2231 2011-04-05  Cary Coutant  <ccoutant@google.com>
2232
2233         * incremental-dump.cc (dump_incremental_inputs): Change signature
2234         to take a Sized_incremental_binary; change caller.  Use readers
2235         in Sized_incremental_binary.
2236         * incremental.cc
2237         (Sized_incremental_binary::find_incremental_inputs_sections):
2238         Rename do_find_incremental_inputs_sections to this.
2239         (Sized_incremental_binary::setup_readers): New function.
2240         (Sized_incremental_binary::do_check_inputs): Check
2241         has_incremental_info_ flag; move setup code to setup_readers;
2242         use input readers.
2243         (Sized_incremental_binary::do_file_is_unchanged): New function.
2244         (Sized_incremental_binary::do_get_input_reader): New function.
2245         * incremental.h (class Incremental_binary): Move to end of file.
2246         (Incremental_binary::file_is_unchanged): New function.
2247         (Incremental_binary::do_file_is_unchanged): New function.
2248         (Incremental_binary::Input_reader): New class.
2249         (Incremental_binary::get_input_reader): New function.
2250         (class Sized_incremental_binary): Move to end of file.
2251         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2252         input section reader classes.
2253         (Sized_incremental_binary::has_incremental_info): New function.
2254         (Sized_incremental_binary::inputs_reader): New function.
2255         (Sized_incremental_binary::symtab_reader): New function.
2256         (Sized_incremental_binary::relocs_reader): New function.
2257         (Sized_incremental_binary::got_plt_reader): New function.
2258         (Sized_incremental_binary::do_file_is_unchanged): New function.
2259         (Sized_incremental_binary::Sized_input_reader): New class.
2260         (Sized_incremental_binary::get_input_reader): New function.
2261         (Sized_incremental_binary::find_incremental_inputs_sections):
2262         Rename do_find_incremental_inputs_sections to this.
2263         (Sized_incremental_binary::setup_readers): New function.
2264         (Sized_incremental_binary::has_incremental_info_): New data member.
2265         (Sized_incremental_binary::inputs_reader_): New data member.
2266         (Sized_incremental_binary::symtab_reader_): New data member.
2267         (Sized_incremental_binary::relocs_reader_): New data member.
2268         (Sized_incremental_binary::got_plt_reader_): New data member.
2269         (Sized_incremental_binary::current_input_file_): New data member.
2270
2271 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2272
2273         PR gold/12640
2274         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2275         violation.
2276
2277 2011-03-30  Cary Coutant  <ccoutant@google.com>
2278
2279         * archive.cc (Archive::include_member): Adjust call to report_object.
2280         (Add_archive_symbols::run): Add script_info to call to
2281         report_archive_begin.
2282         (Lib_group::include_member): Adjust call to report_object.
2283         (Add_lib_group_symbols::run): Adjust call to report_object.
2284         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2285         blocks.  Add object count for script input files.
2286         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2287         script_info parameter; change all callers.
2288         (Incremental_inputs::report_object): Add script_info parameter;
2289         change all callers.
2290         (Incremental_inputs::report_script): Store backpointer to
2291         incremental info entry.
2292         (Output_section_incremental_inputs::set_final_data_size): Record
2293         additional information for scripts.
2294         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2295         * incremental.h (Incremental_script_entry::add_object): New function.
2296         (Incremental_script_entry::get_object_count): New function.
2297         (Incremental_script_entry::get_object): New function.
2298         (Incremental_script_entry::objects_): New data member; adjust
2299         constructor.
2300         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2301         (Incremental_inputs::report_object): Add script_info parameter.
2302         (Incremental_inputs_reader::get_object_count): New function.
2303         (Incremental_inputs_reader::get_object_offset): New function.
2304         * options.cc (Input_arguments::add_file): Return reference to
2305         new input argument.
2306         * options.h (Input_argument::set_script_info): New function.
2307         (Input_argument::script_info): New function.
2308         (Input_argument::script_info_): New data member; adjust all
2309         constructors.
2310         (Input_file_group::add_file): Return reference to new input argument.
2311         (Input_file_lib::add_file): Likewise.
2312         (Input_arguments::add_file): Likewise.
2313         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2314         * script.cc (Parser_closure::Parser_closure): Add script_info
2315         parameter; adjust all callers.
2316         (Parser_closure::script_info): New function.
2317         (Parser_closure::script_info_): New data member.
2318         (read_input_script): Report scripts earlier to incremental info.
2319         (script_add_file): Set script_info in Input_argument.
2320         (script_add_library): Likewise.
2321         * script.h (Script_options::Script_info): Rewrite class.
2322
2323 2011-03-29  Cary Coutant  <ccoutant@google.com>
2324
2325         * archive.cc (Library_base::should_include_member): Move
2326         method here from class Archive.
2327         (Archive::Archive): Initialize base class.
2328         (Archive::should_include_member): Move to base class.
2329         (Archive::do_for_all_unused_symbols): New function.
2330         (Add_archive_symbols::run): Remove redundant access to
2331         incremental_inputs.
2332         (Lib_group::Lib_group): Initialize base class.
2333         (Lib_group::do_filename): New function.
2334         (Lib_group::include_member): Pass pointer to Lib_group to
2335         report_object.
2336         (Lib_group::do_for_all_unused_symbols): New function.
2337         (Add_lib_group_symbols::run): Report archive information for
2338         incremental links.
2339         * archive.h (class Library_base): New base class.
2340         (class Archive): Derive from Library_base.
2341         (Archive::filename): Move to base class.
2342         (Archive::set_incremental_info): Likewise.
2343         (Archive::incremental_info): Likewise.
2344         (Archive::Should_include): Likewise.
2345         (Archive::should_include_member): Likewise.
2346         (Archive::Armap_entry): Remove.
2347         (Archive::Unused_symbol_iterator): Remove.
2348         (Archive::unused_symbols_begin): Remove.
2349         (Archive::unused_symbols_end): Remove.
2350         (Archive::do_filename): New function.
2351         (Archive::do_get_mtime): New function.
2352         (Archive::do_for_all_unused_symbols): New function.
2353         (Archive::task_): Move to base class.
2354         (Archive::incremental_info_): Likewise.
2355         (class Lib_group): Derive from Library_base.
2356         (Lib_group::do_filename): New function.
2357         (Lib_group::do_get_mtime): New function.
2358         (Lib_group::do_for_all_unused_symbols): New function.
2359         (Lib_group::task_): Move to base class.
2360         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2361         function.
2362         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2363         function.
2364         * incremental.cc (Incremental_inputs::report_archive_begin):
2365         Use Library_base; call library's get_mtime; add incremental inputs
2366         entry before members.
2367         (class Unused_symbol_visitor): New class.
2368         (Incremental_inputs::report_archive_end): Use Library_base; use
2369         visitor class to record unused symbols; don't add incremental inputs
2370         entry after members.
2371         (Incremental_inputs::report_object): Use Library_base.
2372         * incremental.h
2373         (Incremental_archive_entry::Incremental_archive_entry): Remove
2374         unused Archive parameter.
2375         (Incremental_inputs::report_archive_begin): Use Library_base.
2376         (Incremental_inputs::report_archive_end): Likewise.
2377         (Incremental_inputs::report_object): Likewise.
2378         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2379         function.
2380         * object.h (Object::for_all_global_symbols): New function.
2381         (Object::do_for_all_global_symbols): New function.
2382         (Sized_relobj::do_for_all_global_symbols): New function.
2383         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2384         function.
2385         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2386         function.
2387
2388 2011-03-27  Ian Lance Taylor  <iant@google.com>
2389
2390         * archive.cc (Archive::interpret_header): Return -1 if something
2391         goes wrong.  Change callers accordingly.
2392
2393 2011-03-25  Cary Coutant  <ccoutant@google.com>
2394
2395         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2396         * testsuite/Makefile.in: Regenerate.
2397
2398 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2399
2400         * plugin.cc (get_view): New.
2401         (Plugin::load): Pass get_view to the plugin.
2402         (Plugin_manager::get_view): New.
2403
2404 2011-03-21  Ian Lance Taylor  <iant@google.com>
2405
2406         * testsuite/final_layout.sh: Rewrite to not use dc.
2407         * testsuite/relro_test.sh: Fail if dc is not present.
2408
2409 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2410
2411         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2412         Change == to -eq.
2413         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2414         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2415         Change == to -eq.
2416         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2417         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2418
2419 2011-03-14  Ian Lance Taylor  <iant@google.com>
2420
2421         * script-sections.cc (Sort_output_sections::script_compare):
2422         Rename from is_before, change return type.
2423         (Sort_output_sections::operator()): Adjust accordingly.
2424
2425 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2426
2427         PR gold/12572
2428         * testsuite/odr_violation2.cc: Add comment to make all error line
2429         numbers double digits.
2430         * testsuite/debug_msg.sh: Adjust expected errors.
2431
2432 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2433
2434         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2435         but mark earlier ones as non-canonical
2436         (offset_to_iterator): Update search target and example
2437         (do_addr2line): Return extra lines in a vector*
2438         (format_file_lineno): Extract from do_addr2line
2439         (one_addr2line): Add vector* out-param
2440         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2441         when a lineno entry appeared last for its instruction
2442         (Dwarf_line_info): Add vector* out-param
2443         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2444         * symtab.cc (Odr_violation_compare): Include the lineno in the
2445         comparison again.
2446         (linenos_from_loc): New. Combine the canonical line for an
2447         address with its other lines.
2448         (True_if_intersect): New. Helper functor to make
2449         std::set_intersection a query.
2450         (detect_odr_violations): Compare sets of lines instead of just
2451         one line for each function. This became less deterministic, but
2452         has fewer false positives.
2453         * symtab.h: Declarations.
2454         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2455         mix an optimized and non-optimized object in the same binary
2456         (odr_violation2.so): Same.
2457         * testsuite/Makefile.in: Regenerate from Makefile.am.
2458         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2459         * testsuite/debug_msg.sh: Update line numbers and add
2460         assertions.
2461         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2462         non-optimized context.
2463         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2464         isn't inlined, and use OdrDerived in an optimized context.
2465         * testsuite/odr_header1.h: Defines OdrDerived, where
2466         optimization will change the
2467         first-instruction-in-the-destructor's file and line number.
2468         * testsuite/odr_header2.h: Defines OdrBase.
2469
2470 2011-03-09  Ian Lance Taylor  <iant@google.com>
2471
2472         * fileread.cc (File_read::clear_views): Don't delete the whole
2473         file view.
2474
2475 2011-03-08  Ian Lance Taylor  <iant@google.com>
2476
2477         PR gold/12525
2478         * fileread.cc: #include <climits>.
2479         (GOLD_IOV_MAX): Define.
2480         (File_read::read_multiple): Limit number of entries by iov_max.
2481         * fileread.h (class File_read): Always set max_readv_entries to
2482         128.
2483
2484 2011-03-07  Ian Lance Taylor  <iant@google.com>
2485
2486         PR gold/12525
2487         * options.h (class General_options): Add -dy and -dn.
2488
2489 2011-03-02  Cary Coutant  <ccoutant@google.com>
2490
2491         * testsuite/script_test_9.t: Add TLS segment.
2492
2493 2011-03-02  Simon Baldwin  <simonb@google.com>
2494
2495         * configure.ac: Add check for gnu_indirect_function support in
2496         the toolchain building binutils.
2497         * configure: Rebuild.
2498
2499 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2500
2501         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2502         plugin only symbols.
2503         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2504         in plugin files as not needed in the symbol table.
2505
2506 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2507
2508         * output.cc (Output_section::add_input_section): Delay fill
2509         generation for section ordering.
2510
2511 2011-02-09  Ian Lance Taylor  <iant@google.com>
2512
2513         PR gold/12316
2514         * object.h (class Sized_relobj): Remove clear_local_symbols.
2515         * reloc.cc (Sized_relobj::do_relocate): Don't call
2516         clear_local_symbols.
2517
2518 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2519
2520         * plugin.cc (is_visible_from_outside): Return true for symbols
2521         in the -u option.
2522
2523 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2524
2525         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2526         filename.
2527
2528 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2529
2530         * icf.h (is_section_foldable_candidate): Change type of parameter
2531         to std::string.
2532         * icf.cc (Icf::find_identical_sections): Change type of local variable
2533         section_name to be std::string.
2534         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2535
2536 2011-01-25  Ian Lance Taylor  <iant@google.com>
2537
2538         * script.cc (script_add_extern): Rewrite to use
2539         add_symbol_reference.
2540
2541 2011-01-25  Doug Kwan  <dougkwan@google.com>
2542
2543         * icf.cc (get_section_contents): Always lock section's object.
2544
2545 2011-01-24  Ian Lance Taylor  <iant@google.com>
2546
2547         * options.h (class General_options): Accept
2548         --no-detect-odr-violations.
2549
2550 2011-01-24  Ian Lance Taylor  <iant@google.com>
2551
2552         * version.cc (version_string): Bump to 1.11.
2553
2554 2011-01-24  Ian Lance Taylor  <iant@google.com>
2555
2556         * plugin.cc (class Plugin_rescan): Define new class.
2557         (Plugin_manager::claim_file): Set any_claimed_.
2558         (Plugin_manager::save_archive): New function.
2559         (Plugin_manager::save_input_group): New function.
2560         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2561         necessary.
2562         (Plugin_manager::new_undefined_symbol): New function.
2563         (Plugin_manager::rescan): New function.
2564         (Plugin_manager::rescannable_defines): New function.
2565         (Plugin_manager::add_input_file): Set any_added_.
2566         * plugin.h (class Plugin_manager): define new fields rescannable_,
2567         undefined_symbols_, any_claimed_, and any_added_.  Declare
2568         Plugin_rescan as friend.  Declare new functions.
2569         (Plugin_manager::Rescannable): Define type.
2570         (Plugin_manager::Rescannable_list): Define type.
2571         (Plugin_manager::Undefined_symbol_list): Define type.
2572         (Plugin_manager::Plugin_manager): Initialize new fields.
2573         * archive.cc (Archive::defines_symbol): New function.
2574         (Add_archive_symbols::run): Pass archive to plugins if any.
2575         * archive.h (class Archive): Declare defines_symbol.
2576         * readsyms.cc (Input_group::~Input_group): New function.
2577         (Finish_group::run): Pass input_group to plugins if any.
2578         * readsyms.h (class Input_group): Declare destructor.
2579         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2580         any.
2581
2582 2011-01-10  Ian Lance Taylor  <iant@google.com>
2583
2584         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2585         section as relro.
2586         (Layout::set_segment_offsets): Reset increase_relro before calling
2587         set_section_addresses a second time.
2588
2589 2011-01-04  Cary Coutant  <ccoutant@google.com>
2590
2591         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2592         sections before NOBITS sections.
2593
2594 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2595
2596         * version.cc (print_version): Update copyright to 2011.
2597
2598 2010-12-23  Cary Coutant  <ccoutant@google.com>
2599
2600         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2601         of OS to this->add.  Add OD parameter to second form of the function.
2602
2603 2010-12-20  Ian Lance Taylor  <iant@google.com>
2604
2605         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2606         second of two consecutive entries with same offset.
2607
2608 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2609
2610         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2611         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2612         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2613         to avoid unneeded links against $(LDADD).
2614         * testsuite/Makefile.in: Regenerate.
2615
2616 2010-12-15  Ian Lance Taylor  <iant@google.com>
2617
2618         PR gold/12324
2619         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2620         for R_X86_64_32 and R_X86_64_PC32.
2621         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2622         ver_matching_def_pic.o.
2623         (ver_matching_def_pic.o): New target.
2624
2625 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2626
2627         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2628         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2629         Move definition before File_read::View member definitions.
2630         (File_read::View::~View): Initialize and hold lock before
2631         updating current_mapped_bytes.
2632
2633 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2634
2635         * dwarf_reader.cc: Remove outdated comment.
2636         * gold-threads.cc: Fix typo in error message.
2637         * archive.cc: Fix typos in comments.
2638         * archive.h: Likewise.
2639         * arm-reloc-property.cc: Likewise.
2640         * arm-reloc-property.h: Likewise.
2641         * arm-reloc.def: Likewise.
2642         * arm.cc: Likewise.
2643         * attributes.h: Likewise.
2644         * cref.cc: Likewise.
2645         * ehframe.cc: Likewise.
2646         * fileread.h: Likewise.
2647         * gold.h: Likewise.
2648         * i386.cc: Likewise.
2649         * icf.cc: Likewise.
2650         * incremental.h: Likewise.
2651         * int_encoding.cc: Likewise.
2652         * layout.h: Likewise.
2653         * main.cc: Likewise.
2654         * merge.h: Likewise.
2655         * object.cc: Likewise.
2656         * object.h: Likewise.
2657         * options.cc: Likewise.
2658         * readsyms.cc: Likewise.
2659         * reduced_debug_output.cc: Likewise.
2660         * reloc.cc: Likewise.
2661         * script-sections.cc: Likewise.
2662         * sparc.cc: Likewise.
2663         * symtab.h: Likewise.
2664         * target-reloc.h: Likewise.
2665         * target.cc: Likewise.
2666         * target.h: Likewise.
2667         * timer.cc: Likewise.
2668         * timer.h: Likewise.
2669         * x86_64.cc: Likewise.
2670
2671 2010-12-09  Cary Coutant  <ccoutant@google.com>
2672
2673         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2674         stack.
2675         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2676         parameter; change all callers.
2677         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2678         * options.h (warn_execstack): New option.
2679
2680 2010-12-07  Doug Kwan  <dougkwan@google.com>
2681
2682         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2683         like function call relocations.
2684
2685 2010-12-07  Ian Lance Taylor  <iant@google.com>
2686
2687         * archive.cc (Archive::get_elf_object_for_member): Permit
2688         punconfigured to be NULL.
2689         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2690         (Archive::include_member): Pass NULL to get_elf_object_for_member
2691         if we searched for the archive and this is the first included
2692         object.
2693
2694 2010-12-01  Ian Lance Taylor  <iant@google.com>
2695
2696         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2697         track_relocs_type_ field.
2698         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2699         Set track_relocs_type_.
2700         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2701         contents when using RELA relocs.
2702         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2703         reloc_map_.
2704         * reloc.cc (Track_relocs::next_addend): New function.
2705         * reloc.h (class Track_relocs): Declare next_addend.
2706
2707 2010-12-01  Ian Lance Taylor  <iant@google.com>
2708
2709         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2710         virtual destructor.
2711
2712 2010-12-01  Ian Lance Taylor  <iant@google.com>
2713
2714         * README: Update compilers known to work and fail.
2715
2716 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2717
2718         * configure.in: For --enable-gold, handle value `default' instead of
2719         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2720         not the default.
2721         * configure: Regenerate.
2722
2723 2010-11-18  Doug Kwan  <dougkwan@google.com>
2724
2725         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2726         and right_alignment to be zero.  Store result alignment only if it is
2727         greater than existing alignment.
2728
2729 2010-11-16  Cary Coutant  <ccoutant@google.com>
2730
2731         PR gold/12220
2732         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2733         Check for ".zdebug_line".
2734
2735 2010-11-16  Doug Kwan  <dougkwan@google.com>
2736             Cary Coutant  <ccoutant@google.com>
2737
2738         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2739         by reference; adjust all callers.
2740         * output.cc (Output_segment::set_section_addresses): Adjust references
2741         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2742         list is empty.
2743         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2744         end at page boundary.
2745
2746 2010-11-16  Cary Coutant  <ccoutant@google.com>
2747
2748         PR gold/12220
2749         * layout.cc (Layout::choose_output_section): Transform names of
2750         compressed sections even when using a script with a SECTIONS clause.
2751         (Layout::output_section_name): Remove code to transform
2752         compressed debug section names.
2753         * output.cc (Output_section::add_input_section): Use uncompressed
2754         section size when tracking input sections.
2755
2756 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2757
2758         * symtab.h (Symbol::NON_PIC_REF): Remove.
2759         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2760         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2761         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2762         (Symbol::use_plt_offset): Take a flags argument and pass it
2763         directly to needs_dynamic_reloc.  Restrict check for undefined
2764         weak symbols to function calls.
2765         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2766         (Target_arm::Scan::global): Use it.
2767         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2768         (Target_arm::Relocate::relocate): Likewise.
2769         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2770         parameter with an r_type parameter.  Use get_reference_flags
2771         to get the flags.
2772         (Target_arm::Relocate::relocate): Update accordingly.
2773         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2774         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2775         (Target_i386::Scan::global): Likewise.
2776         (Target_i386::Relocate::relocate): Likewise.
2777         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2778         parameter with an r_type parameter.  Use get_reference_flags
2779         to get the flags.
2780         (Target_i386::Relocate::relocate): Update accordingly.
2781         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2782         (Target_powerpc::Scan::global): Use it.
2783         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2784         (Target_powerpc::Relocate::relocate): Likewise.
2785         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2786         (Target_sparc::Scan::global): Use it.
2787         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2788         (Target_sparc::Relocate::relocate): Likewise.
2789         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2790         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2791         (Target_x86_64::Scan::global): Likewise.
2792         (Target_x86_64::Relocate::relocate): Likewise.
2793
2794 2010-11-08  Doug Kwan  <dougkwan@google.com>
2795             Cary Coutant  <ccoutant@google.com>
2796
2797         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2798         (Arm_exidx_merge_section::section_contents_): New data member.
2799         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2800         (Arm_input_section::~Arm_input_section): De-allocate memory.
2801         (Arm_input_section::original_contents_): New data member.       
2802         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2803         in parameters instead of calling Object::section_contents without
2804         locking.
2805         (Arm_output_section::group_section): New parameter TASK.  Pass it
2806         to callees that need locking objects.
2807         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2808         to lock EXIDX input sections.  Fix a formatting issue.  Call
2809         Arm_exidx_merged_section::build_contents to create merged section
2810         contents.
2811         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2812         to lock object of stub table owner.
2813         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2814         TEXT_SIZE to initialize data member TEXT_SIZE_.
2815         (Arm_exidx_input_section::addralign): Fix typo in comment.
2816         (Arm_exidx_input_section::text_size): New method.
2817         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2818         that require locking objects.  Lock objects before scanning for stubs
2819         and updating local symbols.
2820         (Arm_input_section<big_endian>::init): Copy contents of original
2821         input section.
2822         (Arm_input_section<big_endian>::do_write): Use saved contents of
2823         original input section instead of calling Object::section_contents
2824         without locking.
2825         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2826         size without calling Object::section_size().
2827         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2828         for size.  Allocate a buffer for merged EXIDX entries.
2829         (Arm_exidx_merged_section::build_contents): New method.
2830         (Arm_exidx_merged_section::do_write): Move merge section contents
2831         building code to Arm_exidx_merged_section::build_contetns.  Write
2832         out contetns in buffer instead of building it on the fly.
2833         (Arm_relobj::make_exidx_input_section): Also pass text section size
2834         to Arm_exidx_input_section constructor.
2835         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2836         (Arm_dynobj::do_read_symbols): Fix memory leak.
2837         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2838         * target.h: (class Task): Add forward declaration.
2839         (Target::relax): Add new parameter TASK and pass it to
2840         Target::do_relax().
2841         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2842
2843 2010-11-05  Cary Coutant  <ccoutant@google.com>
2844
2845         PR gold/10708
2846         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2847         object when reading from the file.
2848         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2849         second layout pass.
2850         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2851         when reading section contents.
2852         (get_section_contents): Likewise.
2853         (icf::find_identical_sections): Likewise.
2854         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2855         object when reading from the file.
2856         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2857         the object when doing deferred section layout.
2858
2859 2010-11-03  Nick Clifton  <nickc@redhat.com>
2860
2861         PR gold/12001
2862         * script.h (class Symbol_assignment: name): New member.  Returns
2863         the name of the symbol.
2864         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2865         Returns true if the given symbol name is on the list of
2866         assignments wating to be processed.
2867         * archive.cc (should_incldue_member): If the symbol is undefined,
2868         check to see if it is on the list of symbols pending assignment.
2869
2870 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2871
2872         * script-sections.cc (Script_sections::find_memory_region): Check
2873         for a NULL output section pointer.
2874
2875 2010-10-29  Doug Kwan  <dougkwan@google.com>
2876
2877         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2878         Output_section::add_relaxed_input_section.
2879         * output.cc (Output_section::add_relaxed_input_section): Add new
2880         arguments LAYOUT and NAME.  Set section order index.
2881         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2882         Copy section order index.
2883         * output.h (Output_section::add_relaxed_input_section): Add new
2884         arguments LAYOUT and NAME.
2885
2886 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2887
2888         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2889         NATIVE_OR_CROSS_LINKER.
2890         * testsuite/Makefile.in: Regenerate.
2891
2892 2010-10-20  Doug Kwan  <dougkwan@google.com>
2893
2894         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2895         without SHF_LINK_ORDER flags.
2896         * layout.cc (Layout::choose_output_section): Do not filter
2897         SHF_LINK_ORDER flag in a relocatable link.
2898
2899 2010-10-17  Cary Coutant  <ccoutant@google.com>
2900
2901         * output.h (Output_segment::set_section_addresses): Change function
2902         signature.  Update all callers.
2903         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2904         sections.
2905         (Output_segment::set_section_addresses): Align after last TLS
2906         section.  Add padding before last relro section instead of after.
2907
2908 2010-10-17  Doug Kwan  <dougkwan@google.com>
2909
2910         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2911         GOT output section to be writable.
2912
2913 2010-10-14  Cary Coutant  <ccoutant@google.com>
2914
2915         * debug.h (DEBUG_INCREMENTAL): New flag.
2916         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2917         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2918         mode.
2919         * incremental.cc (report_command_line): Ignore all forms of
2920         --incremental.
2921         * layout.cc (Layout::Layout): Check parameters for incremental link
2922         mode.
2923         * options.cc (General_options::parse_incremental): New function.
2924         (General_options::parse_no_incremental): New function.
2925         (General_options::parse_incremental_full): New function.
2926         (General_options::parse_incremental_update): New function.
2927         (General_options::incremental_mode_): New data member.
2928         (General_options::finalize): Check incremental_mode_.
2929         * options.h (General_options): Update help text for --incremental.
2930         Add --no-incremental, --incremental-full, --incremental-update.
2931         (General_options::Incremental_mode): New enum type.
2932         (General_options::incremental_mode): New function.
2933         (General_options::incremental_mode_): New data member.
2934         * parameters.cc (Parameters::incremental_mode_): New data member.
2935         (Parameters::set_options): Set incremental_mode_.
2936         (Parameters::set_incremental_full): New function.
2937         (Parameters::incremental): New function.
2938         (Parameters::incremental_update): New function.
2939         (set_parameters_incremental_full): New function.
2940         * parameters.h (Parameters::set_incremental_full): New function.
2941         (Parameters::incremental): New function.
2942         (Parameters::incremental_update): New function.
2943         (Parameters::incremental_mode_): New data member.
2944         (set_parameters_incremental_full): New function.
2945         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2946         incremental link mode.
2947         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2948         (Sized_relobj::do_relocate_sections): Likewise.
2949         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2950         option.
2951         * testsuite/Makefile.in: Regenerate.
2952         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2953
2954 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2955
2956         * script-sections.h (class Script_sections): Make
2957         Sections_elements typedef public.
2958         * script-sections.cc (class Sort_output_sections): Add elements_
2959         field.  Add constructor which sets it; change all callers.
2960         (Sort_output_sections::is_before): New function.
2961         (Sort_output_sections::operator()): Call is_before.
2962         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2963         conditional.
2964         * testsuite/script_test_10.sh: New test. Test script section
2965         order.
2966         * testsuite/script_test_10.t: Likewise.
2967         * testsuite/script_test_10.s: Likewise.
2968         * testsuite/Makefile.am: Wrap the cross linker tests and the
2969         common tests into NATIVE_OR_CROSS_LINKER.
2970         (check_SCRIPTS): Add script_test_10.sh.
2971         (check_DATA): Add script_test_10.stdout.
2972         (script_test_10.o, script_test_10): New targets.
2973         (script_test_10.stdout): New target.
2974         * configure, testsuite/Makefile.in: Regenerate.
2975
2976 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2977
2978         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2979         error for the deprecated relocations.
2980         (Target_arm::Scan::global): Likewise.
2981         (Target_arm::Relocate::relocate): Likewise.
2982
2983 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2984
2985         * fileread.cc (Input_file::find_file): Initialize *found_name
2986         and *namep when using the fallback search for case 4.
2987
2988 2010-10-11  Cary Coutant  <ccoutant@google.com>
2989
2990         * options.h (class General_options): Redefine -z lazy as an alias for
2991         the negation of -z now.
2992
2993 2010-10-11  Ian Lance Taylor  <iant@google.com>
2994
2995         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2996         binding.
2997
2998 2010-10-06  Nick Clifton  <nickc@redhat.com>
2999
3000         * script-sections.cc(class Memory_region): Remove
3001         current_lma_offset_ field.  Rename current_vma_offset_ to
3002         current_offset_.  Add last_section_ field.
3003         (Memory_region::get_current_vma_address): Rename to
3004         get_current_address.
3005         (Memory_region::get_current_lma_address): Delete.
3006         (Memory_region::increment_vma_offset): Rename to
3007         increment_offset.
3008         (Memory_region::increment_lma_offset): Delete.
3009         (Memory_region::attributes_compatible): New method.  Returns
3010         true if the provided section is compatible with the region.
3011         (Memory_region::get_last_section): New method.  Returns the last
3012         section to use the region.
3013         (Memory_region::set_last_section): New method.  Stores the last
3014         section to use the region.
3015         (Script_sections::block_in_region): New method.  Returns true if
3016         a block of memory is contained within a region.
3017         (Script_sections::find_memory_region): New method.  Locates a
3018         memory region to be used to set a VMA or LMA address.
3019         (Output_section_definition::set_section_addresses): Add code to
3020         check for addresses set by memory regions.
3021         (Output_segment::set_section_addresses): Remove memory region
3022         walking code.
3023         (Script_sections::create_segment): Add a warning if a header
3024         segment is created outside of any region.
3025         * script-sections.h (class Script_sections): Add prototypes for
3026         find_memory_region and block_in_region methods.
3027         * testsuite/memory_test.s: Use .long instead of .word.
3028         * testsuite/memory_test.t: Add some more output sections.
3029         * testsuite/memory_test.sh: Update expected output.
3030
3031 2010-10-02  Doug Kwan  <dougkwan@google.com>
3032
3033         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3034         defintion to symtab.h
3035         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3036         declaration to defintion.
3037
3038 2010-10-01  Nick Clifton  <nickc@redhat.com>
3039
3040         * expression.cc (eval): Replace dummy argument with NULL.
3041         (eval_maybe_dot): Check for a NULL result section pointer.
3042         (Symbol_expression::value): Likewise.
3043         (Dot_expression::value): Likewise.
3044         (BINARY_EXPRESSION): Likewise.
3045         (Max_expression::value): Likewise.
3046         (Min_expression::value): Likewise.
3047         (Absolute_expression::value): Likewise.
3048         (Addr_expression::value_from_output_section): Likewise.
3049         (Loaddddr_expression::value_from_output_section): Likewise.
3050         (Segment_start_expression::value): Likewise.
3051         * script-sections.cc
3052         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3053         argument with NULL.
3054         (Sections_elememt_dot_assignment::set_section_addresses):
3055         Likewise.
3056         (Output_data_expression::do_write_to_buffer): Likewise.
3057         (Output_section_definition::finalize_symbols): Likewise.
3058         (Output_section_definition::set_section_addresses): Likewise.
3059
3060 2010-09-30  Doug Kwan  <dougkwan@google.com>
3061
3062         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3063
3064 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3065
3066         * target.h (Target::can_icf_inline_merge_sections): New virtual
3067         function.
3068         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3069         virtual function.
3070         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3071         virtual function.
3072         * icf.cc (get_section_contents): Inline merge sections only when
3073         target allows it.
3074
3075 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3076
3077         * configure: Regenerate.
3078
3079 2010-09-17  Ian Lance Taylor  <iant@google.com>
3080
3081         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3082         * testsuite/Makefile.am (memory_test.o): New target.
3083         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3084         memory_test.t.
3085         * testsuite/Makefile.in: Rebuild.
3086
3087 2010-09-17  Doug Kwan  <dougkwan@google.com>
3088
3089         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3090         defintion if relocation uses GOT entries of the symbol.
3091         * testsuite/icf_safe_test.sh: Fix test.
3092         * testsuite/icf_safe_so_test.sh: Fix test.
3093
3094 2010-09-16  Cary Coutant  <ccoutant@google.com>
3095
3096         * script_sections.cc (class Memory_region): Remove "NULL" from
3097         vector initializations.
3098
3099 2010-09-15  Cary Coutant  <ccoutant@google.com>
3100
3101         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3102         Resolve forwarding symbols.
3103
3104 2010-09-15  Doug Kwan  <dougkwan@google.com>
3105
3106         * gold/testsuite/script_test_3.t: Add ARM special sections.
3107         * gold/testsuite/script_test_4.t: Same.
3108         * gold/testsuite/script_test_5.t: Same.
3109         * gold/testsuite/script_test_6.t: Same.
3110         * gold/testsuite/script_test_7.t: Same.
3111         * gold/testsuite/script_test_7.t: Same.
3112         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3113
3114 2010-09-14  Cary Coutant  <ccoutant@google.com>
3115
3116         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3117         (Target_x86_64::Relocate::relocate_tls): Replace check for
3118         saw_tls_block_reloc_ with test for executable section.
3119
3120 2010-09-12  Cary Coutant  <ccoutant@google.com>
3121
3122         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3123         position-independent executables to shared libraries need dynamic
3124         relocations.
3125         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3126         position-independent executables.
3127         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3128         * testsuite/Makefile.in: Regenerate.
3129
3130 2010-09-10  Nick Clifton  <nickc@redhat.com>
3131
3132         PR gold/11997
3133         * testsuite/memory_test.t: Discard any sections that are not
3134         needed.
3135
3136 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3137
3138         PR gold/11996
3139         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3140         "This::" to work around a bug in gcc 4.2.
3141
3142         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3143
3144 2010-09-09  Rafael Espindola  <espindola@google.com>
3145
3146         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3147         sections with different PF_X flags in the same segment.
3148         (Layout::find_first_load_seg): Search all segments to find the first
3149         one.
3150         * options.h (rosegment): New.
3151
3152 2010-09-08  Rafael Espindola  <espindola@google.com>
3153
3154         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3155
3156 2010-09-08  Doug Kwan  <dougkwan@google.com>
3157
3158         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3159         (Arm_relobj::do_relocate_sections): Add new parameter for output
3160         file to match the parent.
3161         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3162         of local symbols instead of input values.  Update code to track
3163         changes in gold::relocate_section.
3164         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3165         (Sized_relobj::compute_final_local_value_internal): New methods.
3166         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3167         body into private version of Sized_relobj::compute_final_local_value.
3168         Call the inline method.
3169         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3170         merged symbol value if there is one.
3171         (Symbol_value::has_output_value): New method defintiion.
3172         (Sized_relobj::Compute_final_local_value_status): New enum type.
3173         (Sized_relobj::compute_final_local_value): New methods.
3174         (Sized_relobj::compute_final_local_value_internal): New methods.
3175         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3176         and arm_cortex_a8.sh.
3177         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3178         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3179         New tests.
3180         * Makefile.in: Regenerate.
3181         * testsuite/arm_bl_out_of_range.s: Update test.
3182         * testsuite/thumb_bl_out_of_range.s: Ditto.
3183         * testsuite/thumb_blx_out_of_range.s: Ditto.
3184         * testsuite/arm_branch_out_of_range.sh: New file.
3185         * testsuite/arm_cortex_a8.sh: Ditto.
3186         * testsuite/arm_cortex_a8_b.s: Ditto.
3187         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3188         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3189         * testsuite/arm_cortex_a8_bl.s: Ditto.
3190         * testsuite/arm_cortex_a8_blx.s: Ditto.
3191         * testsuite/arm_cortex_a8_local.s: Ditto.
3192         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3193         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3194
3195 2010-09-08  Rafael Espindola  <espindola@google.com>
3196
3197         * Makefile.am (memory_test.stdout): Run readelf with -W.
3198         * Makefile.in: Regenerate.
3199         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3200         64 bit output.
3201
3202 2010-09-08  Rafael Espindola  <espindola@google.com>
3203
3204         * script-sections.cc (Script_sections::add_memory_region): Convert
3205         field precision to int.
3206         * script.cc (script_set_section_region, script_set_section_region):
3207         Convert field precision to int.
3208
3209 2010-09-08  Rafael Espindola  <espindola@google.com>
3210
3211         * arm.cc (do_finalize_sections): Create the __exidx_start and
3212         __exdix_end symbols even when the section is missing.
3213
3214 2010-09-08  Nick Clifton  <nickc@redhat.com>
3215
3216         * README: Remove claim that MEMORY is not supported.
3217         * expression.cc (script_exp_function_origin)
3218         (script_exp_function_length): Move from here to ...
3219         * script.cc: ... here.
3220         (script_set_section_region, script_add_memory)
3221         (script_parse_memory_attr, script_include_directive): New
3222         functions.
3223         * script-sections.cc
3224         (class Memory_region): New class.
3225         (class Output_section_definition): Add set_memory_region,
3226         set_section_vma, set_section_lma and get_section_name methods.
3227         (class Script_Sections): Add add_memory_region,
3228         find_memory_region, find_memory_region_origin,
3229         find_memory_region_length and set_memory_region methods.
3230         Have set_section_addresses method walk the list of set memory
3231         regions.
3232         Extend the print methos to display memory regions.
3233         * script-sections.h: Add prototypes for new methods.
3234         Add enum for MEMORY region attributes.
3235         * yyscript.y: Add support for parsing MEMORY regions.
3236         * script-c.h: Add prototypes for new functions.
3237         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3238         * testsuite/Makefile.in: Regenerate.
3239         * testsuite/memory_test.sh: New script.
3240         * testsuite/memory_test.s: New assembler source file.
3241         * testsuite/memory_test.t: New linker script.
3242
3243 2010-08-27  Doug Kwan  <dougkwan@google.com>
3244
3245         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3246         reference override an existing dynamic weak reference.
3247         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3248         * testsuite/Makefile.in: Regenerate.
3249         * testsuite/dyn_weak_ref.sh: New file.
3250         * testsuite/dyn_weak_ref_1.c: Ditto.
3251         * testsuite/dyn_weak_ref_2.c: Ditto.
3252
3253 2010-08-27  Ian Lance Taylor  <iant@google.com>
3254
3255         * incremental.h (class Incremental_input_entry): Add virtual
3256         destructor.
3257
3258 2010-08-27  Ian Lance Taylor  <iant@google.com>
3259
3260         * testsuite/start_lib_test_3.c: Mark t3 as used.
3261
3262 2010-08-27  Nick Clifton  <nickc@redhat.com>
3263
3264         * options.cc (version_script): Fix small typo in previous
3265         whitespace tidyup.
3266
3267 2010-08-25  Nick Clifton  <nickc@redhat.com>
3268
3269         * archive.cc: Formatting fixes: Remove whitespace between
3270         typename and following asterisk.  Remove whitespace between
3271         function name and opening parenthesis.
3272         * archive.h: Likewise.
3273         * arm.cc: Likewise.
3274         * attributes.cc: Likewise.
3275         * attributes.h: Likewise.
3276         * common.cc: Likewise.
3277         * copy-relocs.cc: Likewise.
3278         * dirsearch.h: Likewise.
3279         * dynobj.cc: Likewise.
3280         * ehframe.cc: Likewise.
3281         * ehframe.h: Likewise.
3282         * expression.cc: Likewise.
3283         * fileread.cc: Likewise.
3284         * fileread.h: Likewise.
3285         * gc.h: Likewise.
3286         * gold-threads.cc: Likewise.
3287         * gold.cc: Likewise.
3288         * i386.cc: Likewise.
3289         * icf.h: Likewise.
3290         * incremental-dump.cc: Likewise.
3291         * incremental.cc: Likewise.
3292         * layout.cc: Likewise.
3293         * layout.h: Likewise.
3294         * main.cc: Likewise.
3295         * merge.cc: Likewise.
3296         * merge.h: Likewise.
3297         * object.cc: Likewise.
3298         * object.h: Likewise.
3299         * options.cc: Likewise.
3300         * options.h: Likewise.
3301         * output.cc: Likewise.
3302         * output.h: Likewise.
3303         * plugin.cc: Likewise.
3304         * plugin.h: Likewise.
3305         * powerpc.cc: Likewise.
3306         * reloc.cc: Likewise.
3307         * script-c.h: Likewise.
3308         * script-sections.cc: Likewise.
3309         * script.cc: Likewise.
3310         * stringpool.cc: Likewise.
3311         * symtab.cc: Likewise.
3312         * symtab.h: Likewise.
3313         * target.cc: Likewise.
3314         * timer.cc: Likewise.
3315         * timer.h: Likewise.
3316         * version.cc: Likewise.
3317         * x86_64.cc: Likewise.
3318
3319 2010-08-24  Nick Clifton  <nickc@redhat.com>
3320
3321         PR 11899
3322         * layout.cc (segment_precedes): Sort segments by their physical
3323         addresses, if they have been set.
3324
3325 2010-08-23  Cary Coutant  <ccoutant@google.com>
3326
3327         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3328         symbols data.
3329         (Lib_group::include_member): Unlock object after deleting its
3330         symbols data.
3331         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3332         the bug fixed here.
3333
3334 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3335             Cary Coutant  <ccoutant@google.com>
3336
3337         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3338         constructor, and set_blocker.
3339         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3340         readsyms_blocker_.
3341         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3342         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3343         * testsuite/Makefile.am (start_lib_test): New test case.
3344         * testsuite/Makefile.in: Regenerate.
3345         * testsuite/start_lib_test_main.c: New file.
3346         * testsuite/start_lib_test_1.c: New file.
3347         * testsuite/start_lib_test_2.c: New file.
3348         * testsuite/start_lib_test_3.c: New file.
3349
3350 2010-08-19  Ian Lance Taylor  <iant@google.com>
3351
3352         * Makefile.in: Rebuild with automake 1.11.1.
3353         * aclocal.m4: Likewise.
3354         * testsuite/Makefile.in: Likewise.
3355
3356 2010-08-19  Ian Lance Taylor  <iant@google.com>
3357
3358         PR 10893
3359         * i386.cc (class Output_data_plt_i386): Update declarations.
3360         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3361         local_ifuncs_ fields.
3362         (Target_i386::do_plt_section_for_global): New function.
3363         (Target_i386::do_plt_section_for_local): New function.
3364         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3365         parameter; change all callers.  Initialize global_ifuncs_ and
3366         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3367         __rel_iplt_end.
3368         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3369         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3370         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3371         symbols.
3372         (Target_i386::make_plt_section): New function, broken out of
3373         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3374         (Target_i386::make_plt_entry): Call make_plt_section.
3375         (Target_i386::make_local_ifunc_plt_entry): New function.
3376         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3377         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3378         R_386_IRELATIVE to switch.
3379         (Target_i386::Scan::global): Likewise.
3380         (Target_i386::Relocate::relocate): Likewise.
3381         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3382         switch.
3383         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3384         (Target_x86_64::do_plt_section_for_global): New function.
3385         (Target_x86_64::do_plt_section_for_local): New function.
3386         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3387         parameter; change all callers.  If doing a static link define
3388         __rela_iplt_start and __rela_iplt_end.
3389         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3390         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3391         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3392         to point to .plt.
3393         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3394         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3395         switch.
3396         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3397         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3398         R_X86_64_IRELATIVE to switch.
3399         (Target_x86_64::Scan::global): Likewise.
3400         (Target_x86_64::Relocate::relocate): Likewise.
3401         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3402         switch.
3403         * target.h (class Target): Add plt_section_for_global and
3404         plt_section_for_local functions.  Add do_plt_section_for_global
3405         and do_plt_section_for_local virtual functions.
3406         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3407         clarifying comments.
3408         (Symbol::use_plt_offset): Handle IFUNC symbol.
3409         * object.cc (Sized_relobj::Sized_relobj): Initialize
3410         local_plt_offsets_.
3411         (Sized_relobj::local_has_plt_offset): New function.
3412         (Sized_relobj::local_plt_offset): New function.
3413         (Sized_relobj::set_local_plt_offset): New function.
3414         (Sized_relobj::do_count): Handle IFUNC symbol.
3415         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3416         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3417         is_ifunc_symbol functions.
3418         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3419         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3420         local_plt_offsets_ field.
3421         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3422         * output.h (class Output_section_data): Add non-const
3423         output_section function.
3424         (class Output_data_got): Update declarations.
3425         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3426         Add use_plt_offset parameter to global and local constructors.
3427         Change all callers.  Change local_sym_index_ field to 31 bits.
3428         Change GSYM_CODE and CONSTANT_CODE accordingly.
3429         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3430         doing a static link don't set sh_link field.
3431         (Output_data_got::Got_entry::write): Use PLT offset if
3432         appropriate.
3433         (Output_data_got::add_global_plt): New function.
3434         (Output_data_got::add_local_plt): New function.
3435         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3436         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3437         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3438         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3439         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3440         IFUNC conditional.
3441         * testsuite/ifunc-sel.h: New file.
3442         * testsuite/ifuncmain1.c: New file.
3443         * testsuite/ifuncmain1vis.c: New file.
3444         * testsuite/ifuncmod1.c: New file.
3445         * testsuite/ifuncdep2.c: New file.
3446         * testsuite/ifuncmain2.c: New file.
3447         * testsuite/ifuncmain3.c: New file.
3448         * testsuite/ifuncmod3.c: New file.
3449         * testsuite/ifuncmain4.c: New file.
3450         * testsuite/ifuncmain5.c: New file.
3451         * testsuite/ifuncmod5.c: New file.
3452         * testsuite/ifuncmain6pie.c: New file.
3453         * testsuite/ifuncmod6.c: New file.
3454         * testsuite/ifuncmain7.c: New file.
3455         * configure, testsuite/Makefile.in: Rebuild.
3456
3457 2010-08-18  Ian Lance Taylor  <iant@google.com>
3458
3459         * incremental.cc
3460         (Output_section_incremental_inputs::write_input_files): Add cast
3461         to avoid signed/unsigned comparison warning.
3462         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3463
3464 2010-08-12  Cary Coutant  <ccoutant@google.com>
3465
3466         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3467
3468 2010-08-13  Ian Lance Taylor  <iant@google.com>
3469
3470         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3471
3472 2010-08-12  Cary Coutant  <ccoutant@google.com>
3473             Doug Kwan  <dougkwan@google.com>
3474
3475         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3476         defintion overrides non-weak undef, remember that the original undef
3477         is not weak.
3478         * symtab.cc (Symbol_table::sized_write_global): For undef without
3479         an original weak binding, set binding to global in output.
3480         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3481         * testsuite/Makefile.in: Regenerate.
3482         * testsuite/strong_ref_weak_def.sh: New file.
3483         * testsuite/strong_ref_weak_def_1.c: Ditto.
3484         * testsuite/strong_ref_weak_def_2.c: Ditto.
3485
3486 2010-08-12  Cary Coutant  <ccoutant@google.com>
3487
3488         * testsuite/incremental_test.sh: Rewrite.
3489         * testsuite/incremental_test_1.c: Rewrite.
3490         * testsuite/incremental_test_2.c: Rewrite.
3491
3492 2010-08-12  Cary Coutant  <ccoutant@google.com>
3493
3494         * arm.cc (Target_arm::got_size): Add const.
3495         (Target_arm::got_entry_count): New function.
3496         (Target_arm::plt_entry_count): New function.
3497         (Target_arm::first_plt_entry_offset): New function.
3498         (Target_arm::plt_entry_size): New function.
3499         (Output_data_plt_arm::entry_count): New function.
3500         (Output_data_plt_arm::first_plt_entry_offset): New function.
3501         (Output_data_plt_arm::get_plt_entry_size): New function.
3502         * i386.cc (Target_i386::got_size): Add const.
3503         (Target_i386::got_entry_count): New function.
3504         (Target_i386::plt_entry_count): New function.
3505         (Target_i386::first_plt_entry_offset): New function.
3506         (Target_i386::plt_entry_size): New function.
3507         (Output_data_plt_i386::entry_count): New function.
3508         (Output_data_plt_i386::first_plt_entry_offset): New function.
3509         (Output_data_plt_i386::get_plt_entry_size): New function.
3510         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3511         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3512         * incremental.cc: Include target.h.
3513         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3514         parameter.  Adjust all callers.  Find incremental_got_plt section.
3515         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3516         section.
3517         (Output_section_incremental_inputs::set_final_data_size): Calculate
3518         size of incremental_got_plt section.
3519         (Output_section_incremental_inputs::do_write): Write the
3520         incremental_got_plt section.
3521         (Got_plt_view_info): New struct.
3522         (Local_got_offset_visitor): New class.
3523         (Global_got_offset_visitor): New class.
3524         (Global_symbol_visitor_got_plt): New class.
3525         (Output_section_incremental_inputs::write_got_plt): New function.
3526         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3527         Add parameter.  Adjust all callers.
3528         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3529         (Incremental_inputs::got_plt_section): New function.
3530         (Incremental_inputs::got_plt_section_): New data member.
3531         (Incremental_got_plt_reader): New class.
3532         * layout.cc (Layout::create_incremental_info_sections): Add the
3533         incremental_got_plt section.
3534         * object.h (Got_offset_list::get_list): New function.
3535         (Got offset_list::for_all_got_offsets): New function.
3536         (Sized_relobj::local_got_offset_list): New function.
3537         * powerpc.cc (Target_powerpc::got_size): Add const.
3538         (Target_powerpc::got_entry_count): New function.
3539         (Target_powerpc::plt_entry_count): New function.
3540         (Target_powerpc::first_plt_entry_offset): New function.
3541         (Target_powerpc::plt_entry_size): New function.
3542         (Output_data_plt_powerpc::entry_count): New function.
3543         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3544         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3545         * sparc.cc (Target_sparc::got_size): Add const.
3546         (Target_sparc::got_entry_count): New function.
3547         (Target_sparc::plt_entry_count): New function.
3548         (Target_sparc::first_plt_entry_offset): New function.
3549         (Target_sparc::plt_entry_size): New function.
3550         (Output_data_plt_sparc::entry_count): New function.
3551         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3552         (Output_data_plt_sparc::get_plt_entry_size): New function.
3553         * symtab.h (Symbol::got_offset_list): New function.
3554         (Symbol_table::for_all_symbols): New function.
3555         * target.h (Sized_target::got_entry_count): New function.
3556         (Sized_target::plt_entry_count): New function.
3557         (Sized_target::plt_entry_size): New function.
3558         * x86_64.cc (Target_x86_64::got_size): Add const.
3559         (Target_x86_64::got_entry_count): New function.
3560         (Target_x86_64::plt_entry_count): New function.
3561         (Target_x86_64::first_plt_entry_offset): New function.
3562         (Target_x86_64::plt_entry_size): New function.
3563         (Output_data_plt_x86_64::entry_count): New function.
3564         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3565         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3566
3567 2010-08-12  Cary Coutant  <ccoutant@google.com>
3568
3569         * archive.cc: Include incremental.h.
3570         (Archive::Archive): Initialize incremental_info_.
3571         (Archive::include_member): Record archive members in incremental info.
3572         (Add_archive_symbols::run): Record begin and end of an archive in
3573         incremental info.
3574         (Lib_group::include_member): Record objects in incremental info.
3575         * archive.h (Incremental_archive_entry): Forward declaration.
3576         (Archive::set_incremental_info): New member function.
3577         (Archive::incremental_info): New member function.
3578         (Archive::Unused_symbol_iterator): New class.
3579         (Archive::unused_symbols_begin): New member function.
3580         (Archive::unused_symbols_end): New member function.
3581         (Archive::incremental_info_): New data member.
3582         * incremental-dump.cc (find_input_containing_global): New function.
3583         (dump_incremental_inputs): Dump new incremental info sections.
3584         * incremental.cc: Include symtab.h.
3585         (Output_section_incremental_inputs): New class.
3586         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3587         new incremental info sections.
3588         (Sized_incremental_binary::do_check_inputs): Likewise.
3589         (Incremental_inputs::report_archive): Remove.
3590         (Incremental_inputs::report_archive_begin): New function.
3591         (Incremental_inputs::report_archive_end): New function.
3592         (Incremental_inputs::report_object): New function.
3593         (Incremental_inputs::finalize_inputs): Remove.
3594         (Incremental_inputs::report_input_section): New function.
3595         (Incremental_inputs::report_script): Rewrite.
3596         (Incremental_inputs::finalize): Do nothing but finalize string table.
3597         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3598         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3599         (Incremental_inputs::create_data_sections): New function.
3600         (Incremental_inputs::relocs_entsize): New function.
3601         (Output_section_incremental_inputs::set_final_data_size): New function.
3602         (Output_section_incremental_inputs::do_write): New function.
3603         (Output_section_incremental_inputs::write_header): New function.
3604         (Output_section_incremental_inputs::write_input_files): New function.
3605         (Output_section_incremental_inputs::write_info_blocks): New function.
3606         (Output_section_incremental_inputs::write_symtab): New function.
3607         * incremental.h (Incremental_script_entry): Forward declaration.
3608         (Incremental_object_entry): Forward declaration.
3609         (Incremental_archive_entry): Forward declaration.
3610         (Incremental_inputs): Forward declaration.
3611         (Incremental_inputs_header_data): Remove.
3612         (Incremental_inputs_header): Remove.
3613         (Incremental_inputs_header_write): Remove.
3614         (Incremental_inputs_entry_data): Remove.
3615         (Incremental_inputs_entry): Remove.
3616         (Incremental_inputs_entry_write): Remove.
3617         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3618         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3619         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3620         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3621         Likewise.
3622         (Incremental_input_entry): New class.
3623         (Incremental_script_entry): New class.
3624         (Incremental_object_entry): New class.
3625         (Incremental_archive_entry): New class.
3626         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3627         (Incremental_inputs::report_inputs): Remove.
3628         (Incremental_inputs::report_archive): Remove.
3629         (Incremental_inputs::report_archive_begin): New function.
3630         (Incremental_inputs::report_archive_end): New function.
3631         (Incremental_inputs::report_object): Change prototype.
3632         (Incremental_inputs::report_input_section): New function.
3633         (Incremental_inputs::report_script): Change prototype.
3634         (Incremental_inputs::get_reloc_count): New function.
3635         (Incremental_inputs::set_reloc_count): New function.
3636         (Incremental_inputs::create_data_sections): New function.
3637         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3638         (Incremental_inputs::inputs_section): New function.
3639         (Incremental_inputs::symtab_section): New function.
3640         (Incremental_inputs::relocs_section): New function.
3641         (Incremental_inputs::get_stringpool): Add const.
3642         (Incremental_inputs::command_line): Add const.
3643         (Incremental_inputs::inputs): Remove.
3644         (Incremental_inputs::command_line_key): New function.
3645         (Incremental_inputs::input_file_count): New function.
3646         (Incremental_inputs::input_files): New function.
3647         (Incremental_inputs::relocs_entsize): New function.
3648         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3649         (Incremental_inputs::finalize_inputs): Remove.
3650         (Incremental_inputs::Input_info): Remove.
3651         (Incremental_inputs::lock_): Remove.
3652         (Incremental_inputs::inputs_): Change type.
3653         (Incremental_inputs::inputs_map_): Remove.
3654         (Incremental_inputs::current_object_entry_): New data member.
3655         (Incremental_inputs::inputs_section_): New data member.
3656         (Incremental_inputs::symtab_section_): New data member.
3657         (Incremental_inputs::relocs_section_): New data member.
3658         (Incremental_inputs::reloc_count_): New data member.
3659         (Incremental_inputs_reader): New class.
3660         (Incremental_symtab_reader): New class.
3661         (Incremental_relocs_reader): New class.
3662         * layout.cc (Layout::finalize): Move finalization of incremental info
3663         and creation of incremental info sections to follow finalization of
3664         symbol table.  Set offsets for postprocessing sections.
3665         (Layout::create_incremental_info_sections): Call
3666         Incremental_inputs::create_data_sections.  Add incremental symtab
3667         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3668         sections to layout after input sections.
3669         * layout.h (struct Timespec): Forward declaration.
3670         (Layout::incremental_inputs): Add const.
3671         (Layout::create_incremental_info_sections): Add parameter.
3672         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3673         * object.cc: Include incremental.h.
3674         (Relobj::finalize_incremental_relocs): New function.
3675         (Sized_relobj::do_layout): Record input sections in incremental info.
3676         * object.h (Object::output_section): New function.
3677         (Object::output_section_offset): Moved from Relobj.
3678         (Object::get_incremental_reloc_base): New function.
3679         (Object::get_incremental_reloc_count): New function.
3680         (Object::do_output_section): New function.
3681         (Object::do_output_section_offset): Moved from Relobj.
3682         (Object::do_get_incremental_reloc_base): New function.
3683         (Object::do_get_incremental_reloc_count): New function.
3684         (Object::Object): Initialize new data members.
3685         (Relobj::output_section): Renamed do_output_section and moved to
3686         protected.
3687         (Relobj::output_section_offset): Moved to Object.
3688         (Relobj::do_get_incremental_reloc_base): New function.
3689         (Relobj::do_get_incremental_reloc_count): New function.
3690         (Relobj::allocate_incremental_reloc_counts): New function.
3691         (Relobj::count_incremental_reloc): New function.
3692         (Relobj::finalize_incremental_relocs): New function.
3693         (Relobj::next_incremental_reloc_index): New function.
3694         (Relobj::reloc_counts_): New data member.
3695         (Relobj::reloc_bases_): New data member.
3696         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3697         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3698         (Sized_relobj::incremental_relocs_scan): New function.
3699         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3700         (Sized_relobj::incremental_relocs_write): New function.
3701         (Sized_relobj::incremental_relocs_write_reltype): New function.
3702         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3703         incremental link.
3704         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3705         archives and object files elsewhere.
3706         (Add_symbols::run): Report object files here.
3707         (Finish_group::run): Report end of archive at end of group.
3708         * reloc.cc: Include layout.h, incremental.h.
3709         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3710         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3711         (Sized_relobj::incremental_relocs_scan): New function.
3712         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3713         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3714         (Sized_relobj::incremental_relocs_write): New function.
3715         (Sized_relobj::incremental_relocs_write_reltype): New function.
3716         * script.cc (read_input_script): Rewrite test for incremental link.
3717         Change call to Incremental_inputs::report_script.
3718         * symtab.h (Symbol_table::first_global_index): New function.
3719         (Symbol_table::output_count): New function.
3720
3721 2010-08-12  Doug Kwan  <dougkwan@google.com>
3722
3723         * arm.cc (Target_arm::merge_object_attributes): Check command line
3724         options --no-wchar-size-warning and --no-enum-size-warning.
3725         * options.h (General_options): Add ld-compatible options
3726         --no-enum-size-warning and --no-wchar-size-warning.
3727
3728 2010-08-04  Ian Lance Taylor  <iant@google.com>
3729
3730         * x86_64.cc (Target_x86_64::Scan::local): Use
3731         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3732         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3733         (Target_x86_64::Scan::global): Likewise.
3734         (Target_x86_64::Relocate::relocate): Likewise.
3735         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3736         Likewise.
3737
3738 2010-08-03  Cary Coutant  <ccoutant@google.com>
3739
3740         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3741         to reserve space in merged_strings vector. Keep total input size
3742         for stats.
3743         (Output_merge_string::do_print_merge_stats): Print total input size.
3744         * merge.h (Output_merge_string): Add input_size_ field.
3745         * stringpool.cc (Stringpool_template::string_length): Move
3746         implementations out of Stringpool_template class and place in
3747         stringpool.h.
3748         * stringpool.h (string_length): Move out of Stringpool_template.
3749
3750 2010-08-03  Ian Lance Taylor  <iant@google.com>
3751
3752         PR 11712
3753         * layout.cc (relaxation_loop_body): If address of load segment is
3754         set, adjust address to include headers if possible.
3755
3756 2010-08-03  Ian Lance Taylor  <iant@google.com>
3757
3758         * version.cc (version_string): Bump to 1.10.
3759
3760 2010-08-03  Ian Lance Taylor  <iant@google.com>
3761
3762         PR 11805
3763         * layout.h (enum Output_section_order): Define.
3764         (class Layout): Update declarations.
3765         * layout.cc (Layout::get_output_section): Add order parameter.
3766         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3767         is_first_non_relro parameters.  Change all callers.
3768         (Layout::choose_output_section): Likewise.
3769         (Layout::add_output_section_data): Likewise.
3770         (Layout::make_output_section): Likewise.  Set order.
3771         (Layout::default_section_order): New function.
3772         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3773         * output.cc (Output_section::Output_section): Initialize order_.
3774         Don't initialize deleted fields.
3775         (Output_segment::Output_segment): Don't initialize deleted
3776         fields.
3777         (Output_segment::add_output_section_to_load): New function
3778         replacing add_output_section.  Change all callers to call this or
3779         add_output_section_to_nonload.
3780         (Output_segment::add_output_section_to_nonload): New function.
3781         (Output_segment::remove_output_section): Rewrite.
3782         (Output_segment::add_initial_output_data): Likewise.
3783         (Output_segment::has_any_data_sections): Likewise.
3784         (Output_segment::is_first_section_relro): Likewise.
3785         (Output_segment::maximum_alignment): Likewise.
3786         (Output_segment::has_dynamic_reloc): New function replacing
3787         dynamic_reloc_count.  Change all callers.
3788         (Output_segment::has_dynamic_reloc_list): New function replacing
3789         dynamic_reloc_count_list.  Change all callers.
3790         (Output_segment::set_section_addresses): Rewrite.
3791         (Output_segment::set_offset): Rewrite.
3792         (Output_segment::find_first_and_last_list): Remove.
3793         (Output_segment::set_tls_offsets): Rewrite.
3794         (Output_segment::first_section_load_address): Likewise.
3795         (Output_segment::output_section_count): Likewise.
3796         (Output_segment::section_with_lowest_load_address): Likewise.
3797         (Output_segment::write_section_headers): Likewise.
3798         (Output_segment::print_sections_to_map): Likewise.
3799         * output.h (class Output_data): Remove dynamic_reloc_count_
3800         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3801         (Output_data::add_dynamic_reloc): Rewrite.
3802         (Output_data::has_dynamic_reloc): New function.
3803         (Output_data::dynamic_reloc_count): Remove.
3804         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3805         is_last_relro_, is_first_non_relro_, is_interp_,
3806         is_dynamic_linker_section_ fields.  Add order and set_order
3807         functions.  Remove is_relro_local, set_is_relro_local,
3808         is_last_relro, set_is_last_relro, is_first_non_relro,
3809         set_is_first_non_relro functions, is_interp, set_is_interp,
3810         is_dynamic_linker_section, and set_is_dynamic_linker_section
3811         functions.
3812         (class Output_segment): Change Output_data_list from std::list to
3813         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3814         output_bss_ fields.  Update declarations.
3815
3816 2010-08-02  Ian Lance Taylor  <iant@google.com>
3817
3818         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3819         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3820         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3821
3822 2010-08-02  Ian Lance Taylor  <iant@google.com>
3823
3824         PR 11855
3825         * script.cc (Script_options::Script_options): Initialize
3826         symbol_definitions_ and symbol_references_.
3827         (Script_options::add_symbol_assignment): Update
3828         symbol_definitions_ and symbol_references_.
3829         (Script_options::add_symbol_reference): New function.
3830         (script_symbol): New function.
3831         * script.h (class Script_options): Add symbol_definitions_ and
3832         symbol_references_ fields.
3833         (Script_options::referenced_const_iterator): New type.
3834         (Script_options::referenced_begin): New function.
3835         (Script_options::referenced_end): New function.
3836         (Script_options::is_referenced): New function.
3837         (Script_options::any_unreferenced): New function.
3838         * script-c.h (script_symbol): Declare.
3839         * yyscript.y (exp): Call script_symbol.
3840         * symtab.cc: Include "script.h".
3841         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3842         Change all callers.  Check symbols referenced by scripts.
3843         (Symbol_table::add_undefined_symbols_from_command_line): Add
3844         layout parameter.  Change all callers.
3845         (Symbol_table::do_add_undefined_symbols_from_command_line):
3846         Likewise.  Break out loop body.  Check symbols referenced by
3847         scripts.
3848         (Symbol_table::add_undefined_symbol_from_command_line): New
3849         function broken out of
3850         do_add_undefined_symbols_from_command_line.
3851         * symtab.h (class Symbol_table): Update declarations.
3852         * archive.cc: Include "layout.h".
3853         (Archive::should_include_member): Add layout parameter.  Change
3854         all callers.  Check for symbol mentioned in expression.
3855         * archive.h (class Archive): Update declaration.
3856         * object.cc (Sized_relobj::do_should_include_member): Add layout
3857         parameter.
3858         * object.h (Object::should_include_member): Add layout parameter.
3859         Change all callers.
3860         (Object::do_should_include_member): Add layout parameter.
3861         (class Sized_relobj): Update declaration.
3862         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3863         parameter.
3864         * dynobj.h (class Sized_dynobj): Update declaration.
3865         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3866         layout parameter.
3867         * plugin.h (class Sized_pluginobj): Update declaration.
3868
3869 2010-08-02  Ian Lance Taylor  <iant@google.com>
3870
3871         PR 11866
3872         * output.cc (Output_segment::set_offset): Search for the first and
3873         last sections rather than assuming that the list is in order.
3874         (Output_segment::find_first_and_last_list): New function.
3875         * output.h (class Output_segment): Update declarations.
3876         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3877         (relro_strip_test_SOURCES): New variable.
3878         (relro_strip_test_DEPENDENCIES): New variable.
3879         (relro_strip_test_LDFLAGS): New variable.
3880         (relro_strip_test_LDADD): New variable.
3881         (relro_strip_test.so): New target.
3882
3883 2010-08-02  Ian Lance Taylor  <iant@google.com>
3884
3885         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3886         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3887         (Target_i386::got_tlsdesc_section): New function.
3888         (Target_i386::got_section): Create space for GOT entries for
3889         TLSDESC relocations.
3890         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3891         R_386_TLS_GOTDESC.
3892         (Target_i386::Scan::global): Likewise.
3893         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3894         using TLSDESC GOT.
3895         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3896         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3897         (Target_x86_64::got_tlsdesc_section): New function.
3898         (Target_x86_64::got_section): Create space for GOT entries for
3899         TLSDESC relocations.
3900         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3901         R_386_TLS_GOTDESC.
3902         (Target_x86_64::Scan::global): Likewise.
3903         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3904         using TLSDESC GOT.
3905
3906 2010-08-02  Ian Lance Taylor  <iant@google.com>
3907
3908         * testsuite/final_layout.sh: Use dc to convert from hex to
3909         decimal.
3910
3911 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3912
3913         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3914         paramter to the call to gold::gc_process_relocs.
3915         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3916         paramter to the call to gold::gc_process_relocs.
3917         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3918         parameter to the call to gold::gc_process_relocs.
3919         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3920         template parameter to the call to gold::gc_process_relocs.
3921         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3922         paramter to the call to gold::gc_process_relocs.
3923         * gc.h (get_embedded_addend_size): New function.
3924         (gc_process_relocs): Save the size of the reloc for use by ICF.
3925         * icf.cc (get_section_contents): Get the addend from the text section
3926         for SHT_REL relocation sections.
3927         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3928         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3929         * int_encoding.h (read_from_pointer): New overloaded function.
3930         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3931         * testsuite/icf_sht_rel_addend_test.sh: New file.
3932         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3933         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3934
3935 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3936
3937         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3938         * Makefile.in: Regenerate.
3939         * testsuite/Makefile.in: Regenerate.
3940
3941 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3942
3943         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3944         * gold/testsuite/debug_msg.cc: Likewise.
3945         * gold/testsuite/odr_violation1.cc
3946         * gold/testsuite/odr_violation2.cc
3947
3948 2010-07-21  Cary Coutant  <ccoutant@google.com>
3949
3950         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3951         string, and length fields.
3952         (Output_merge_string::Merged_strings_list): New type.
3953         (Output_merge_string::Merged_strings_lists): New typedef.
3954         (Output_merge_string): Replace merged_strings_ with
3955         merged_strings_lists_.
3956         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3957         Merged_strings_list per input object and section.  Don't store pointer
3958         to the string.  Don't store length with each merged string entry.
3959         (Output_merge_string::finalize_merged_data): Loop over list of merged
3960         strings lists.  Recompute length of each merged string.
3961
3962 2010-07-15  Cary Coutant  <ccoutant@google.com>
3963
3964         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3965         here.
3966
3967 2010-07-14  Ian Lance Taylor  <iant@google.com>
3968
3969         * descriptors.cc (Descriptors::open): Report correct name in error
3970         message.
3971
3972 2010-07-13  Doug Kwan  <dougkwan@google.com>
3973
3974         * arm.cc (Arm_input_section::Arm_input_section): For a
3975         SHT_ARM_EXIDX section, always keeps the input sections.
3976         (Arm_input_section::set_exidx_section_link): New method.
3977         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3978         has_errors_ to false.
3979         (Arm_exidx_input_section::has_errors,
3980         Arm_exidx_input_section::set_has_errors): New methods.
3981         (Arm_exidx_input_section::has_errors_): New data member.
3982         (Arm_relobj::get_exidx_shndx_list): New method.
3983         (Arm_output_section::append_text_sections_to_list): Do not skip
3984         section without SHF_EXECINSTR.
3985         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3986         errors.
3987         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3988         section header.  Make error messages more verbose.  Check for
3989         a non-executable section linked to an EXIDX section.
3990         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3991         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3992         check that there is no deferred EXIDX section if we exit early.
3993         Instead of not making an EXIDX section in case of an error, make one
3994         and set the has_errors flag of it.
3995         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3996         in a relocatable link.
3997         (Target_arm::do_relax): Look for the EXIDX output section instead of
3998         assuming that it is called .ARM.exidx.
3999         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4000         section list.  Do not check for SHF_EXECINSTR section flags but
4001         skip any input section with errors.
4002         * output.cc (Output_section::Output_section): Initialize
4003         always_keeps_input_sections_ to false.
4004         (Output_section::add_input_section): Check for
4005         always_keeps_input_sections_.
4006         *  output.h (Output_section::always_keeps_input_sections,
4007         Output_section::set_always_keeps_input_sections): New methods.
4008         (Output_section::always_keeps_input_sections): New data member.
4009
4010 2010-07-13  Rafael Espindola  <espindola@google.com>
4011
4012         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4013         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4014
4015 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4016             Ian Lance Taylor  <iant@google.com>
4017
4018         * output.h (Output_section_lookup_maps::add_merge_section):
4019         Correct check of whether value was inserted.
4020         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4021         (Output_section_lookup_maps::add_relaxed_input_section):
4022         Likewise.
4023         * arm.cc (Target_arm::got_section): Remove used local os.
4024         * i386.cc (Target_i386::got_section): Likewise.
4025         * x86_64.cc (Target_x86_64::got_section): Likewise.
4026         * sparc.cc (Target_sparc::got_section): Likewise.
4027         (Target_sparc::relocate): Remove unused local have_got_offset.
4028         * powerpc.cc (Target_powerpc::relocate): Likewise.
4029
4030 2010-07-13  Ian Lance Taylor  <iant@google.com>
4031
4032         * compressed_output.cc (zlib_decompress): Fix signature in
4033         !HAVE_ZLIB_H case.
4034
4035         * archive.cc (Archive::include_member): Unlock an external member
4036         of a thin archive.  Don't bother to delete an object we know is
4037         NULL.
4038
4039 2010-07-12  Cary Coutant  <ccoutant@google.com>
4040
4041         * compressed_output.cc (zlib_decompress): New function.
4042         (get_uncompressed_size): New function.
4043         (decompress_input_section): New function.
4044         * compressed_output.h (get_uncompressed_size): New function.
4045         (decompress_input_section): New function.
4046         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4047         Handle compressed debug sections.
4048         * layout.cc (is_compressed_debug_section): New function.
4049         (Layout::output_section_name): Map compressed section names to
4050         canonical names.
4051         * layout.h (is_compressed_debug_section): New function.
4052         (is_debug_info_section): Recognize compressed debug sections.
4053         * merge.cc: Include compressed_output.h.
4054         (Output_merge_data::do_add_input_section): Handle compressed
4055         debug sections.
4056         (Output_merge_string::do_add_input_section): Handle compressed
4057         debug sections.
4058         * object.cc: Include compressed_output.h.
4059         (Sized_relobj::Sized_relobj): Initialize new data members.
4060         (build_compressed_section_map): New function.
4061         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4062         * object.h (Object::section_is_compressed): New method.
4063         (Object::do_section_is_compressed): New method.
4064         (Sized_relobj::Compressed_section_map): New type.
4065         (Sized_relobj::do_section_is_compressed): New method.
4066         (Sized_relobj::compressed_sections_): New data member.
4067         * output.cc (Output_section::add_input_section): Handle compressed
4068         debug sections.
4069         * reloc.cc: Include compressed_output.h.
4070         (Sized_relobj::write_sections): Handle compressed debug sections.
4071
4072 2010-07-08  Cary Coutant  <ccoutant@google.com>
4073
4074         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4075         weak when resolving to a dynamic def.
4076         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4077         for weak undef/dynamic def cases. Adjust callers.
4078         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4079         undef_binding_weak_.
4080         (Symbol_table::sized_write_globals): Adjust symbol binding.
4081         (Symbol_table::sized_write_symbol): Add binding parameter.
4082         * symtab.h (Symbol::set_undef_binding): New method.
4083         (Symbol::is_undef_binding_weak): New method.
4084         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4085         (Symbol_table::should_override): Add new parameter.
4086         (Symbol_table::sized_write_symbol): Add new parameter.
4087
4088         * testsuite/weak_undef_file1.cc: Add new test case.
4089         * testsuite/weak_undef_file2.cc: Fix header comment.
4090         * testsuite/weak_undef_test.cc: Add new test case.
4091
4092 2010-06-29  Doug Kwan  <dougkwan@google.com>
4093
4094         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4095         Initialize USE_SYMBOL_.
4096         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4097         definition.
4098         (Arm_reloc_property::uses_symbol_): New data member declaration.
4099         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4100         uses symbol value and symbol is undefined but not weakly undefined.
4101
4102 2010-06-28  Rafael Espindola  <espindola@google.com>
4103
4104         * plugin.cc (Plugin::load): Use dlerror.
4105
4106 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4107
4108         * symtab.cc (detect_odr_violations): When reporting an ODR
4109         violation, report an object where the symbol is defined.
4110
4111 2010-06-25  Doug Kwan  <dougkwan@google.com>
4112
4113         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4114         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4115         definition.
4116         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4117         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4118         target hook to detect function points.
4119         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4120         * icf.h (Icf::check_section_for_function_pointers): Change type of
4121         parameter SECTION_NAME to const reference to std::string.  Use
4122         target hook to determine if section may have unsafe pointers.
4123         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4124         method definition.
4125
4126 2010-06-21  Rafael Espindola  <espindola@google.com>
4127
4128         * fileread.cc (Input_file::find_fie): New
4129         (Input_file::open): Use Input_file::find_fie.
4130         * fileread.h (Input_file::find_fie): New
4131         * plugin.cc (set_extra_library_path): New.
4132         (Plugin::load): Add set_extra_library_path to the transfer vector.
4133         (Plugin_manager::set_extra_library_path): New.
4134         (Plugin_manager::add_input_file): Use the extra search path if set.
4135         (set_extra_library_path(): New.
4136         * plugin.h (Plugin_manager): Add set_extra_library_path and
4137         extra_search_path_.
4138
4139 2010-06-19  Cary Coutant  <ccoutant@google.com>
4140
4141         * layout.cc (gdb_sections): Add .debug_types.
4142         (lines_only_debug_sections): Likewise.
4143
4144 2010-06-18  Rafael Espindola  <espindola@google.com>
4145
4146         * plugin.cc (add_input_file,add_input_library)
4147         (Plugin_manager::add_input_file): Make filename arguments const.
4148         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4149         const.
4150
4151 2010-06-16  Doug Kwan  <dougkwan@google.com>
4152
4153         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4154         .ARM.attributes section if we have not merged any input
4155         attributes sections.
4156
4157 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4158
4159         * arm.cc: Allow combining objects with no EABI version
4160         information.
4161
4162 2010-06-15  Rafael Espindola  <espindola@google.com>
4163
4164         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4165
4166 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4167
4168         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4169         (struct iovec): Correct !HAVE_READV definition.
4170
4171 2010-06-10  Cary Coutant  <ccoutant@google.com>
4172
4173         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4174         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4175         reloc sections.
4176         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4177
4178         PR 11683
4179         * symtab.h (Symbol::is_placeholder): New member function.
4180         * target-reloc.h (relocate_section): Check for placeholder symbols.
4181
4182         * testsuite/Makefile.am (plugin_test_8): New test.
4183         (plugin_test_9): New test.
4184         * testsuite/Makefile.in: Regenerate.
4185
4186 2010-06-09  Nick Clifton  <nickc@redhat.com>
4187
4188         * yyscript.y (input_list_element): Allow strings prefixed with
4189         the '-' character.  Treat these as libraries.
4190         * script.cc (script_add_library): New function.  Adds a library
4191         specified by "-l<name>" found in an input script.
4192         * script-c.h: Add prototype for script_add_library.
4193
4194 2010-06-07  Doug Kwan  <dougkwan@google.com>
4195
4196         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4197         Restrict stub-group size to be within long conditional branch
4198         range when working around cortex-A8 erratum.
4199
4200 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4201
4202         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4203         #ifdef typo.
4204
4205 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4206
4207         PR gold/11658
4208         * output.cc
4209         (Output_section::Input_section_sort_entry::compare_section_ordering):
4210         Change to return non-zero correctly.
4211         (Output_section::Input_section_sort_section_order_index_compare
4212         ::operator()): Change to fix ambiguity in comparisons.
4213
4214 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4215
4216         * gold.h (is_wildcard_string): New function.
4217         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4218         (Layout::layout_eh_frame): Ditto.
4219         (Layout::find_section_order_index): New method.
4220         (Layout::read_layout_from_file): New method.
4221         * layout.h (Layout::find_section_order_index): New method.
4222         (Layout::read_layout_from_file): New method.
4223         (Layout::input_section_position_): New private member.
4224         (Layout::input_section_glob_): New private member.
4225         * main.cc (main): Call read_layout_from_file here.
4226         * options.h (--section-ordering-file): New option.
4227         * output.cc (Output_section::input_section_order_specified_): New
4228         member.
4229         (Output_section::Output_section): Initialize new member.
4230         (Output_section::add_input_section): Add new parameter.
4231         Keep input sections when --section-ordering-file is used.
4232         (Output_section::set_final_data_size): Sort input sections when
4233         section ordering file is specified.
4234         (Output_section::Input_section_sort_entry): Add new parameter.
4235         Check sorting type.
4236         (Output_section::Input_section_sort_entry::compare_section_ordering):
4237         New method.
4238         (Output_section::Input_section_sort_compare::operator()): Change to
4239         consider section_order_index.
4240         (Output_section::Input_section_sort_init_fini_compare::operator()):
4241         Change to consider section_order_index.
4242         (Output_section::Input_section_sort_section_order_index_compare
4243         ::operator()): New method.
4244         (Output_section::sort_attached_input_sections): Change to sort
4245         according to section order when specified.
4246         (Output_section::add_input_section<32, true>): Add new parameter.
4247         (Output_section::add_input_section<64, true>): Add new parameter.
4248         (Output_section::add_input_section<32, false>): Add new parameter.
4249         (Output_section::add_input_section<64, false>): Add new parameter.
4250         * output.h (Output_section::add_input_section): Add new parameter.
4251         (Output_section::input_section_order_specified): New
4252         method.
4253         (Output_section::set_input_section_order_specified): New method.
4254         (Input_section::Input_section): Initialize section_order_index_.
4255         (Input_section::section_order_index): New method.
4256         (Input_section::set_section_order_index): New method.
4257         (Input_section::section_order_index_): New member.
4258         (Input_section::Input_section_sort_section_order_index_compare): New
4259         struct.
4260         (Output_section::input_section_order_specified_): New member.
4261         * script-sections.cc (is_wildcard_string): Delete and move modified
4262         method to gold.h.
4263         (Output_section_element_input::Output_section_element_input): Modify
4264         call to is_wildcard_string.
4265         (Output_section_element_input::Input_section_pattern
4266         ::Input_section_pattern): Ditto.
4267         (Output_section_element_input::Output_section_element_input): Ditto.
4268         * testsuite/Makefile.am (final_layout): New test case.
4269         * testsuite/Makefile.in: Regenerate.
4270         * testsuite/final_layout.cc: New file.
4271         * testsuite/final_layout.sh: New file.
4272
4273 2010-06-01  Rafael Espindola  <espindola@google.com>
4274
4275         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4276
4277 2010-06-01  Rafael Espindola  <espindola@google.com>
4278
4279         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4280         visibility of symbols.
4281
4282 2010-05-27  Doug Kwan  <dougkwan@google.com>
4283
4284         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4285         from start of output section instead of address for a local symbol
4286         in a merged or relaxed section when doing a relocatable link.
4287
4288 2010-05-26  Rafael Espindola  <espindola@google.com>
4289
4290        PR 11604
4291         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4292         adding sections the garbage collector removed.
4293         * gold/testsuite/Makefile.am: Add test.
4294         * gold/testsuite/Makefile.in: Regenerate.
4295         * gold/testsuite/plugin_test_7.sh: New.
4296         * gold/testsuite/plugin_test_7_1.c: New.
4297         * gold/testsuite/plugin_test_7_2.c: New.
4298
4299 2010-05-26  Rafael Espindola  <espindola@google.com>
4300
4301         * script-sections.cc (Output_section_definition::set_section_addresses):
4302         Check for --section-start.
4303
4304 2010-05-26  Doug Kwan  <dougkwan@google.com>
4305
4306         * arm.cc (Arm_scan_relocatable_relocs): New class.
4307         (Target_arm::relocate_special_relocatable): New method.
4308         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4309         (Arm_relocate_functions::thumb_branch_common): Same.
4310         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4311         instead of Default_scan_relocatable_relocs.
4312         * target-reloc.h (relocate_for_relocatable): Let target handle
4313         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4314         * target.h (Sized_target::relocate_special_relocatable): New method.
4315
4316 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4317
4318         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4319
4320 2010-05-23  Doug Kwan  <dougkwan@google.com>
4321
4322         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4323         instead of a cast.
4324         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4325         with a direct branch, not a conditional branch, to a stub.
4326         * merge.cc (Output_merge_base::record_input_section): New method
4327         defintion.
4328         (Output_merge_data::do_add_input_section): Record input section if
4329         keeps-input-sections flag is set.
4330         (Output_merge_string::do_add_input_section): Ditto.
4331         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4332         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4333         INPUT_SECTIONS_.
4334         (Output_merge_base::keeps_input_sections,
4335         Output_merge_base::set_keeps_input_sections,
4336         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4337         method definitions.
4338         (Output_merge_base::Input_sections): New type declaration.
4339         (Output_merge_base::input_sections_begin,
4340         Output_merge_base::input_sections_end,
4341         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4342         (Output_merge_base::bool keeps_input_sections_,
4343         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4344         Output_merge_base::input_sections_): New data members.
4345         (Output_merge_data::do_set_keeps_input_sections): New method
4346         defintion.
4347         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4348         * output.cc (Output_section::Input_section::relobj): Move method
4349         defintion from class declaration to here and handle merge sections.
4350         (Output_section::Input_section::shndx): Ditto.
4351         (Output_section::Output_section): Remove initializations of removed
4352         data members and initialize new data member LOOKUP_MAPS_.
4353         (Output_section::add_input_section): Set keeps-input-sections flag
4354         for a newly created merge output section as appropriate.  Adjust code
4355         to use Output_section_lookup_maps class.
4356         (Output_section::add_relaxed_input_section): Adjst code for lookup
4357         maps code refactoring.
4358         (Output_section::add_merge_input_section): Add a new parameter
4359         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4360         class.  If adding input section to a newly created merge output
4361         section fails, remove the new merge section.
4362         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4363         Adjust code for use of the Output_section_lookup_maps class.
4364         (Output_section::find_merge_section): Ditto.
4365         (Output_section::build_lookup_maps): New method defintion.
4366         (Output_section::find_relaxed_input_section): Adjust code to use
4367         Output_section_lookup_maps class.
4368         (Output_section::get_input_sections): Export merge sections.  Adjust
4369         code to use Output_section_lookup_maps class.
4370         (Output_section:::add_script_input_section): Adjust code to use
4371         Output_section_lookup_maps class.  Update lookup maps for merge
4372         sections also.
4373         (Output_section::discard_states): Use Output_section_lookup_maps.
4374         (Output_section::restore_states): Same.
4375         * output.h (Merge_section_properties): Move class defintion out of
4376         Output_section.
4377         (Output_section_lookup_maps): New class.
4378         (Output_section::Input_section::is_merge_section): New method
4379         defintion.
4380         (Output_section::Input_section::relobj): Move defintion out of class
4381         defintion.  Declare method only.
4382         (Output_section::Input_section::shndx): Ditto.
4383         (Output_section::Input_section::output_merge_base): New method defintion.
4384         (Output_section::Input_section::u2_.pomb): New union field.
4385         (Output_section::Merge_section_by_properties_map,
4386         Output_section::Output_section_data_by_input_section_map,
4387         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4388         Remove types.
4389         (Output_section::add_merge_input_section): Add new parameter
4390         KEEPS_INPUT_SECTIONS.
4391         (Output_section::build_lookup_maps): New method declaration.
4392         (Output_section::merge_section_map_,
4393         Output_section::merge_section_by_properties_map_,
4394         Output_section::relaxed_input_section_map_,
4395         Output_section::is_relaxed_input_section_map_valid_): Remove data
4396         members.
4397         (Output_section::lookup_maps_): New data member.
4398
4399 2010-05-21  Doug Kwan  <dougkwan@google.com>
4400
4401         PR gold/11619
4402         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4403         avoid a compilation error.
4404
4405 2010-05-19  Rafael Espindola  <espindola@google.com>
4406
4407         * script-sections.cc (Output_section_definition::allocate_to_segment):
4408         Update the phdrs_list even when the output section is NULL.
4409         * testsuite/Makefile.am: Add test.
4410         * testsuite/Makefile.in: Regenerate.
4411         * testsuite/script_test_9.cc: New.
4412         * testsuite/script_test_9.sh: New.
4413         * testsuite/script_test_9.t: New.
4414
4415 2010-05-19  Doug Kwan  <dougkwan@google.com>
4416
4417         * arm.cc (Arm_input_section::original_size): New method.
4418         (Arm_input_section::do_addralign): Add a cast.
4419         (Arm_input_section::do_output_offset): Remove static cast.
4420         (Arm_input_section::original_addralign,
4421          Arm_input_section::original_size_): Change type to uint32_t.
4422         (Arm_input_section::init): Add safe casts for section alignment
4423         and size.
4424         (Arm_input_section::set_final_data_size): Do not set address and
4425         offset of stub table.
4426         (Arm_output_section::fix_exidx_coverage): Change use of of
4427         Output_section::Simple_input_section to that of
4428         Output_section::Input_section.
4429         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4430         except for the first pass.
4431         * output.cc (Output_section::get_input_sections): Change type of
4432         input_sections to std::list<Input_section>.
4433         (Output_section::add_script_input_section): Rename from
4434         Output_section::add_simple_input_section.  Change type of SIS
4435         parameter from Simple_input_section to Input_section.
4436         * output.h (Output_section::Simple_input_section): Remove class.
4437         (Output_section::Input_section): Change class visibility to public.
4438         (Output_section::Input_section::addralign): Use stored alignments
4439         for special input sections if set.
4440         (Output_section::Input_section::set_addralign): New method.
4441         (Output_section::get_input_sections): Change parameter type from
4442         list of Simple_input_section to list of Input_section.
4443         (Output_section::add_script_input_section): Rename from
4444         Output_section::add_simple_input_section. Change first parameter's
4445         type from Simple_input_section to Input_section and remove the
4446         second and third parameters.
4447         * script-sections.cc (Input_section::Input_section_list): Change
4448         type to list of Output_section::Input_section/
4449         (Input_section_info::Input_section_info): Change parameter type of
4450         INPUT_SECTION to Output_section::Input_section.
4451         (Input_section_info::input_section): Change return type.
4452         (Input_section_info::input_section_): Change type to
4453         Output_section::Input_section.
4454         (Output_section_element_input::set_section_addresses): Adjust code
4455         to use Output_section::Input_section instead of
4456         Output_section::Simple_input_section.  Adjust code for renaming
4457         of Output_section::add_simple_input_section.
4458         (Orphan_output_section::set_section_addresses): Ditto.
4459
4460 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4461
4462         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4463         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4464
4465 2010-05-18  Rafael Espindola  <espindola@google.com>
4466
4467         * options.cc (General_options::finalize): Handle -nostdlib.
4468         * options.h (nostdlib): New option.
4469         * script.cc (script_add_search_dir): Handle -nostdlib.
4470
4471 2010-05-12  Doug Kwan  <dougkwan@google.com>
4472
4473         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4474         attributes section only if there no attributes section after merging.
4475         (Target_arm::merge_object_attributes): Move value of
4476         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4477         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4478         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4479         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4480         and arm_attr_merge_7.stdout.
4481         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4482         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4483         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4484         arm_attr_merge_7b.o): New rules.
4485         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4486         arm_attr_merge_7
4487         * testsuite/Makefile.in: Regenerate.
4488         * testsuite/arm_attr_merge.sh: New file.
4489         * testsuite/arm_attr_merge_[67][ab].s: Same.
4490
4491 2010-05-05  Nick Clifton  <nickc@redhat.com>
4492
4493         * po/es.po: Updated Spanish translation.
4494
4495 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4496
4497         * Makefile.am (install-exec-local): Properly install gold as
4498         default cross linker.
4499         * Makefile.in: Regenerated.
4500
4501 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4502             Nick Clifton  <nickc@redhat.com>
4503
4504         * configure.ac (install_as_default): Define and set to false
4505         unless --enable-gold or --enable-gold=both/gold has been
4506         specified.
4507         * configure: Regenerate.
4508
4509         * Makefile.am (install-exec-local): Install the executable as
4510         'ld.gold'.  If install_as_default is true then also install it as
4511         'ld'.
4512         * Makefile.in: Regenerated.
4513
4514 2010-04-24  Ian Lance Taylor  <iant@google.com>
4515
4516         * layout.cc (Layout::layout_reloc): In relocatable link don't
4517         combine reloc sections for grouped sections.
4518
4519 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4520
4521         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4522         sections that are not ordinary to icf.
4523         * icf.cc (get_section_contents): Handle relocation pointing to section
4524         with no object or shndx information.
4525         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4526         * testsuite/Makefile.in: Regenerate.
4527         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4528         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4529
4530 2010-04-22  Ian Lance Taylor  <iant@google.com>
4531
4532         * expression.cc (Expression::Expression_eval_info): Add
4533         result_alignment_pointer field.
4534         (Expression::eval_with_dot): Add result_alignment_pointer
4535         parameter.  Change all callers.
4536         (Expression::eval_maybe_dot): Likewise.
4537         (class Binary_expression): Add alignment_pointer parameter to
4538         left_value and right_value.  Change all callers.
4539         (BINARY_EXPRESSION): Set result alignment.
4540         (class Trinary_expression): Add alignment_pointer parameter to
4541         arg2_value and arg3_value.  Change all callers.
4542         (Trinary_cond::value): Set result alignment.
4543         (Max_expression::value, Min_expression::value): Likewise.
4544         (Align_expression::value): Likewise.
4545         * script-sections.cc (class Sections_element): Add dot_alignment
4546         parameter to set_section_addresses virtual function.  Update
4547         instantiations.
4548         (class Output_section_element): Likewise.
4549         (Script_sections::create_segments): Add dot_alignment parameter.
4550         Change all callers.
4551         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4552         (Script_sections::set_phdrs_clause_addresses): Likewise.
4553         * script-sections.h: Update declarations.
4554         * script.h: Update declarations.
4555         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4556         min_p_align.
4557         * testsuite/script_test_3.t: Set large alignment.
4558         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4559         segment has expected alignment.
4560
4561 2010-04-22  Nick Clifton  <nickc@redhat.com>
4562
4563         * po/gold.pot: Updated by the Translation project.
4564         * po/vi.po: Updated Vietnamese translation.
4565
4566 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4567
4568         * testsuite/Makefile.am (check_PROGRAMS): Add
4569         icf_virtual_function_folding_test.
4570         * testsuite/Makefile.in: Regenerated.
4571
4572 2010-04-15  Andrew Haley  <aph@redhat.com>
4573
4574         * options.h (merge_exidx_entries): New option.
4575         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4576         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4577         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4578         (Target_arm::merge_exidx_entries): New function.
4579         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4580         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4581         to Arm_exidx_fixup constructor.
4582         Add new arg, merge_exidx_entries.
4583         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4584         Arm_output_section::fix_exidx_coverage.
4585
4586 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4587
4588         * icf.cc (get_section_contents): Check for preemptible functions.
4589         Ignore addend when appropriate.
4590         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4591         section folded.
4592         (add_from_relobj): Check for section folded.
4593         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4594         * symtab.h (should_add_dynsym_entry): Add new parameter.
4595         * target-reloc.h (scan_relocs): Check for section folded.
4596         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4597         Check reloc types for function pointers in shared objects.
4598         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4599         case.
4600         (icf_preemptible_functions_test): New test case.
4601         (icf_string_merge_test): New test case.
4602         * testsuite.Makefile.in: Regenerate.
4603         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4604         bar_glob.  Refactor code.
4605         * testsuite/icf_preemptible_functions_test.cc: New file.
4606         * testsuite/icf_preemptible_functions_test.sh: New file.
4607         * testsuite/icf_string_merge_test.cc: New file.
4608         * testsuite/icf_string_merge_test.sh: New file.
4609         * testsuite/icf_virtual_function_folding_test.cc: New file.
4610         * testsuite/icf_virtual_function_folding_test.sh: New file.
4611
4612 2010-04-14  Doug Kwan  <dougkwan@google.com>
4613
4614         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4615         for local symbol recounting if we remove a section due to ICF.
4616         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4617         there are no regular objects in input.
4618
4619 2010-04-13  Doug Kwan  <dougkwan@google.com>
4620
4621         * arm.cc (Arm_input_section::set_final_data_size): Compute
4622         accurate final data size instead of using current data size.
4623
4624 2010-04-09  Doug Kwan  <dougkwan@google.com>
4625
4626         * layout.cc (Layout::choose_output_section): Handle script section
4627         types.
4628         (Layout::make_output_section_for_script): Add section type parameter.
4629         Handle script section types.
4630         * layout.h (Layout::make_output_section_for_script): Add section
4631         type parameter.
4632         * output.cc (Output_section::Output_section): Initialize data member
4633         is_noload_.
4634         (Output_section::do_reset_address_and_file_offset): Do not set address
4635         to 0 if section is a NOLOAD section.
4636         * output.h (Output_section::is_noload): New method.
4637         (Output_section::set_is_noload): Ditto.
4638         (Output_section::is_noload_): New data member.
4639         * script-c.h (Script_section_type): New enum type.
4640         (struct Parser_output_section_header): Add new file section_type.
4641         * script-sections.cc (Sections_element::output_section_name): Add
4642         parameter for returning script section type.
4643         (Output_section_definition::output_section_name): Ditto.
4644         (Output_section_definition::section_type)P; New method.
4645         (Output_section_definiton::script_section_type_name): Ditto.
4646         (Output_section_definition::script_section_type_): New data member.
4647         (Output_section_definition::Output_section_definition): Initialize
4648         data member Output_section_definition::script_section_type_.
4649         (Output_section_definition::create_sections): Pass script section type
4650         to Layout::make_output_section_for_script.
4651         (Output_section_definition::output_section_name): Return script
4652         section type to caller.
4653         (Output_section_definition::set_section_address): Do not advance
4654         dot value and load address if section type is NOLOAD.  Set address
4655         of NOLOAD sections regardless of section flags.
4656         (Output_section_definition::print): Print section type if it is
4657         not SCRIPT_SECTION_TYPE_NONE.
4658         (Output_section_definition::section_type): New method.
4659         (Output_section_definition::script_section_type_name): Ditto.
4660         (Script_sections::output_section_name): Add new parameter
4661         PSECTION_TYPE for returning script section type.  Pass it to
4662         section elements.  Handle discard sections.
4663         (Sort_output_sections::operator()): Handle NOLOAD sections.
4664         * script-sections.h (Script_sections::Section_type): New enum type.
4665         (Script_sections::output_section_name): Add a new parameter for
4666         returning script section type.
4667         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4668         INFO and NOLOAD.
4669         * yyscript.y (union): Add new field SECTION_TYPE.
4670         (COPY, DSECT, INFO, NOLOAD): New tokens.
4671         (opt_address_and_section_type): Change type to output_section_header.
4672         (section_type): New non-terminal
4673         (section_header): Handle section type.
4674         (opt_address_and_section_type): Return section type value.
4675
4676 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4677
4678         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4679         * testsuite/plugin_common_test_2.c (foo): Likewise.
4680
4681 2010-04-08  Doug Kwan  <dougkwan@google.com>
4682
4683         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4684         Output_merge_data.
4685         * output.cc (Output_section::add_merge_input_section): Simplify
4686         code and return status of Output_merge_base::add_input_section.
4687         Update merge section map only if Output_merge_base::add_input_section
4688         returns true.
4689
4690 2010-04-07  Doug Kwan  <dougkwan@google.com>
4691
4692         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4693         if section is marked as containing instructions but has no mapping
4694         symbols.
4695         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4696         correct section index.
4697         (Arm_relobj::find_linked_text_section): Ditto.
4698
4699 2010-04-07  Cary Coutant  <ccoutant@google.com>
4700
4701         * archive.cc (include_member): Destroy Read_symbols_data object before
4702         releasing file.
4703         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4704         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4705         (Read_symbols_data::~Read_symbols_data) New destructor.
4706         (Section_relocs::Section_relocs) New constructor.
4707         (Section_relocs::~Section_relocs) New destructor.
4708         (Read_relocs_data::Read_relocs_data) New constructor.
4709         (Read_relocs_data::~Read_relocs_data) New destructor.
4710         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4711         pointers to NULL after deleting.
4712
4713 2010-04-07  Doug Kwan  <dougkwan@google.com>
4714
4715         * arm.cc: Replace "endianity" with "endianness" in comments.
4716         (Arm_exidx_cantunwind): Ditto.
4717         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4718         (Arm_relobj::merge_flags_and_attributes): New method.
4719         (Arm_relobj::merge_flags_and_attributes_): New data member.
4720         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4721         (Arm_relobj::scan_sections_for_stubs): Ditto.
4722         (Arm_relobj::do_read_symbols): Check to see if we really want to
4723         merge processor-specific flags and attributes.  Exit early if
4724         an object is empty except for section names and the undefined symbol.
4725         (Target_arm::do_finalize_sections): Move check for ELF format to
4726         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4727         attributes from a regular object only when we have determined that
4728         it is aapropriate.  Do not create an .ARM.attributes section in
4729         output if there is no regular input object.
4730         (Target_arm::merge_processor_specific_flags): Check
4731         --warn-mismatch before printing any error.
4732         (Target_arm::merge_object_attributes): Ditto.
4733         * gold.cc (queue_middle_tasks): Handle the case in which there is
4734         no regular object in input.
4735         * options.cc (General_options::parse_EB): New method.
4736         (General_options::parse_EL): Same.
4737         (General_options::General_options): Initialize endianness_.
4738         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4739         New options.
4740         (General_options::Endianness): New enum.
4741         (General_options::endianness): New method.
4742         (General_options::endianness_): New data member.
4743         * parameters.cc (Parameters::set_options): Check target endianness.
4744         (Parameters::set_target_once): Ditto.
4745         (Parameters::check_target_endianness): New method.
4746         (parameters_force_valid_target): If either -EL or -EB is specified,
4747         use it to define endianness of default target.
4748         * parameters.h (Parameters::check_target_endianness): New method
4749         declaration.
4750         * target.h (class Target): Change "endianity" to "endianness"
4751         in comments.
4752
4753 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4754
4755         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4756         * configure: Regenerate.
4757         * Makefile.in: Regenerate.
4758         * testsuite/Makefile.in: Regenerate.
4759
4760 2010-04-06  Cary Coutant  <ccoutant@google.com>
4761
4762         gcc PR lto/42757
4763         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4764         prevailing definitions of common symbols.
4765         * testsuite/plugin_test_6.sh: New test case.
4766         * testsuite/plugin_common_test_1.c: New test case.
4767         * testsuite/plugin_common_test_2.c: New test case.
4768         * testsuite/Makefile.am (plugin_test_6): New test case.
4769         * testsuite/Makefile.in: Regenerate.
4770
4771 2010-04-06  Nick Clifton  <nickc@redhat.com>
4772
4773         * po/vi.po: New Vietnamese translation.
4774
4775 2010-03-30  Doug Kwan  <dougkwan@google.com>
4776
4777         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4778
4779 2010-03-25  Doug Kwan  <dougkwan@google.com>
4780
4781         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4782         to avoid a conversion warning on a 32-bit host.
4783
4784 2010-03-24  Ian Lance Taylor  <iant@google.com>
4785
4786         * testsuite/script_test_3.t: Add a TLS segment.
4787         * testsuite/Makefile.am (check_PROGRAMS): Add
4788         tls_phdrs_script_test.
4789         (tls_phdrs_script_test_SOURCES): Define.
4790         (tls_phdrs_script_test_DEPENDENCIES): Define.
4791         (tls_phdrs_script_test_LDFLAGS): Define.
4792         (tls_phdrs_script_test_LDADD): Define.
4793         * testsuite/Makefile.in: Rebuild.
4794
4795 2010-03-23  Cary Coutant  <ccoutant@google.com>
4796
4797         * fileread.cc (find_or_make_view): Fix comment.
4798
4799 2010-03-23  Ian Lance Taylor  <iant@google.com>
4800
4801         * script-sections.cc (class Orphan_section_placement): Define
4802         PLACE_TLS and PLACE_TLS_BSS.
4803         (Orphan_section_placement::Orphan_section_placement): Initialize
4804         new places.
4805         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4806         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4807         (tls_script_test_SOURCES): Define.
4808         (tls_script_test_DEPENDENCIES): Define.
4809         (tls_script_test_LDFLAGS): Define.
4810         (tls_script_test_LDADD): Define.
4811         * testsuite/Makefile.in: Rebuild.
4812
4813 2010-03-22  Doug Kwan  <dougkwan@google.com>
4814
4815         * arm.cc (Arm_relocate_functions::abs8,
4816         Arm_relocate_functions::abs16): Use correct check for overflow
4817         specified in the ARM ELF specs.
4818         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4819         target of a BLX instruction specially.
4820         (Reloc_stub::stub_type_for_reloc): Ditto.
4821         (Relocate::relocate): Use symbolic names instead of numeric relocation
4822         codes to report error.
4823         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4824         workaround.
4825         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4826         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4827         thumb2_blx_out_of_range.stdout
4828         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4829         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4830         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4831         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4832         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4833         thumb2_blx_in_range, thumb2_blx_in_range.o,
4834         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4835         thumb2_blx_out_of_range.o): New rules.
4836         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4837         thumb2_blx_in_range and thumb2_blx_out_of_range.
4838         * testsuite/Makefile.in: Regenerate.
4839         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4840         * testsuite/thumb_blx_in_range.s: New file.
4841         * testsuite/thumb_blx_out_of_range.s: New file.
4842
4843 2010-03-22  Rafael Espindola  <espindola@google.com>
4844
4845         * archive.cc (Should_include): Move to archive.h.
4846         (should_include_member): Make it a member of Archive.
4847         (Lib_group): New.
4848         (Add_lib_group_symbols): New.
4849         * archive.h: Include options.h.
4850         (Archive_member): Moved from Archive.
4851         (Should_include): Moved from archive.cc.
4852         (Lib_group): New.
4853         (Add_lib_group_symbols): New.
4854         * dynobj.cc (do_should_include_member): New.
4855         * dynobj.h (do_should_include_member): New.
4856         * gold.cc (queue_initial_tasks): Update call to queue.
4857         * main.cc (main): Print lib group stats.
4858         * object.cc (do_should_include_member): New.
4859         * object.h: Include archive.h.
4860         (Object::should_include_member): New.
4861         (Object::do_should_include_member): New.
4862         (Sized_relobj::do_should_include_member): New.
4863         * options.cc (General_options::parse_start_lib): New.
4864         (General_options::parse_end_lib): New.
4865         (Input_arguments::add_file): Handle lib groups.
4866         (Input_arguments::start_group): Check we are not in a lib.
4867         (Input_arguments::start_lib): New.
4868         (Input_arguments::end_lib): New.
4869         * options.h (General_options): Add start_lib and end_lib.
4870         (Input_argument::lib_): New.
4871         (Input_argument::lib): New.
4872         (Input_argument::is_lib): New.
4873         (Input_file_lib): New.
4874         (Input_arguments::in_lib_): New.
4875         (Input_arguments::in_lib): New.
4876         (Input_arguments::start_lib): New.
4877         (Input_arguments::end_lib_): New.
4878         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4879         in unused members as preempted.
4880         (Sized_pluginobj::do_should_include_member): New.
4881         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4882         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4883         return the blocker.
4884         (Read_symbols::do_whole_lib_group): New.
4885         (Read_symbols::do_lib_group): New.
4886         (Read_symbols::do_read_symbols): Handle lib groups.
4887         (Read_symbols::get_name): Handle lib groups.
4888         * readsyms.h (Read_symbols): Add an archive member pointer.
4889         (Read_symbols::do_whole_lib_group): New.
4890         (Read_symbols::do_lib_group): New.
4891         (Read_symbols::member_): New.
4892         * script.cc (read_input_script): Update call to queue_soon.
4893
4894 2010-03-19  Doug Kwan  <dougkwan@google.com>
4895
4896         * arm.cc (Stub_table::Stub_table): Initialize new data members
4897         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4898         (Stub_table::add_reloc_stub): Assign stub offset and update
4899         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4900         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4901         New data members.
4902         (Stub_table::update_data_size_and_addralign): Use
4903         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4904         instead of going over all reloc stubs.
4905         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4906         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4907         Stringpool_template::offset_ to size of Stringpool_char.
4908         (Stringpool_template::new_key_offset): Remove code to initialize
4909         Stringpool_template::offset_.
4910         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4911         Stringpool_template::offset_ to zero.
4912
4913 2010-03-15  Doug Kwan  <dougkwan@google.com>
4914
4915         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4916         offset_.
4917         (Stringpool_template::new_key_offset): New method.
4918         (Stringpool_template::add_string): Assign offsets when adding new
4919         strings.
4920         (Stringpool_template::set_string_offsets): Do not set string offsets
4921         when not optimizing.
4922         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4923         member size_.
4924         (Chunked_vector::clear): Clear size_.
4925         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4926         (Chunked_vector::size): Return size_.
4927         (Chunked_vector::push_back): Use size_ to find insert position.
4928         (Chunked_vector::size_): New data member.
4929         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4930         (Stringpool_template::new_key_offset): New method declaration.
4931         (Stringpool_template::offset_): New data member.
4932
4933 2010-03-15   Rafael Espindola  <espindola@google.com>
4934
4935         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4936         Add_symbols' constructor.
4937         * readsyms.h (Add_symbols): Remove the input_group member.
4938
4939 2010-03-10  Ian Lance Taylor  <iant@google.com>
4940
4941         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4942         target to ask whether a reference to a symbol requires a stack
4943         split.
4944         * target.h (Target::is_call_to_non_split): New function.
4945         (Target::do_is_call_to_non_split): Declare virtual function.
4946         * target.cc: Include "symtab.h".
4947         (Target::do_is_call_to_non_split): New function.
4948         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4949
4950 2010-03-10  Cary Coutant  <ccoutant@google.com>
4951
4952         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4953         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4954         (File_read::open[2]): Add whole_file_view_ to list of views.
4955         (File_read::make_view): Remove test of whole_file_view_.
4956         (File_read::find_or_make_view): Create whole_file_view_ if
4957         necessary.
4958         (File_read::clear_views): Replace bool parameter with enum;
4959         adjust all callers.  Don't delete views with permanent data;
4960         do delete cached views and views from archives if
4961         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4962         if clearing the corresponding view.
4963         * fileread.h (File_read::Clear_views_mode): New enum.
4964         (File_read::View::is_permanent_view): New method.
4965         (File_read::clear_views): Replace bool parameter
4966         with enum; adjust all callers.
4967         * options.h (General_options): Change keep_files_mapped option;
4968         add map_whole_files.
4969         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4970         releasing the file.
4971         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4972         the file.
4973
4974 2010-03-10  David S. Miller  <davem@davemloft.net>
4975
4976         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4977
4978 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4979
4980         * icf.cc (get_section_contents): Add '@' marker after processing the
4981         merge reloc.
4982
4983 2010-03-08  Doug Kwan  <dougkwan@google.com>
4984
4985         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4986         due to a conversion warning.
4987         (Arm_relobj::update_output_local_symbol_count): Check for local
4988         symbol with unset output index.
4989
4990 2010-03-05  Ian Lance Taylor  <iant@google.com>
4991
4992         * options.h (class General_options): Add --spare-dynamic-tags.
4993         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4994         --spare-dynamic-tags.
4995
4996 2010-03-05  Ian Lance Taylor  <iant@google.com>
4997
4998         * incremental.cc: Include "libiberty.h".
4999
5000 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5001
5002         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5003         function, is_info_ member.
5004         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5005         (Versions::Versions): Update caller.
5006         (Versions::define_base_version): Likewise.
5007         (Versions::add_def): Likewise.
5008
5009 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5010
5011         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5012         (Scan::possible_function_pointer_reloc): New function.
5013         (Scan::local_reloc_may_be_function_pointer): Change to call
5014         possible_function_pointer_reloc.
5015         (Scan::global_reloc_may_be_function_pointer): Ditto.
5016         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5017         relocations in ".data.rel.ro._ZTV" section.
5018         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5019         * testsuite/icf_safe_so_test.cc: Ditto.
5020         * testsuite/icf_safe_test.cc: Ditto.
5021         * testsuite/icf_safe_test.sh: Ditto.
5022
5023 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5024             Ian Lance Taylor  <iant@google.com>
5025
5026         * target-reloc.h (relocate_section): Check the symbol table index
5027         for -1U before setting the local symbol index.
5028         (scan_relocatable_relocs): If copying the relocation, record that
5029         the local symbol is required.
5030         * object.h (Symbol_value::is_output_symtab_index_set): New
5031         function.
5032         (Symbol_value::may_be_discarded_from_output_symtab): New
5033         function.
5034         (Symbol_value::has_output_symtab_entry): New function.
5035         (Symbol_value::needs_output_symtab_entry): Remove.
5036         (Symbol_value::output_symtab_index): Make sure the symbol index is
5037         set.
5038         (Symbol_value::set_output_symtab_index): Make sure the symbol
5039         index is not set.  Make sure the new index is valid.
5040         (Symbol_value::set_must_have_output_symtab_entry): New function.
5041         (Symbol_value::has_output_dynsym_entry): New function.
5042         (Symbol_value::set_output_dynsym_index): Make sure the new index
5043         is valid.
5044         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5045         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5046         local symbol if permitted.
5047         (Sized_relobj::do_finalize_local_symbols): Call
5048         is_output_symtab_index_set rather than needs_output_symtab_entry.
5049         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5050         rather than needs_output_symtab_entry.  Call
5051         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5052         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5053         is_output_symtab_index_set rather than needs_output_symtab_entry.
5054         * testsuite/discard_locals_relocatable_test.c: New file.
5055         * testsuite/discard_locals_test.sh: Test -r.
5056         * testsuite/Makefile.am (check_DATA): Add
5057         discard_locals_relocatable_test1.syms,
5058         discard_local_relocatable_test2.syms.
5059         (MOSTLYCLEANFILES): Likewise.  Also add
5060         discard_locals_relocatable_test1.lout and
5061         discard_locals_relocatable_test2.out.
5062         (discard_locals_relocatable_test1.syms): New target.
5063         (discard_locals_relocatable_test.o): New target.
5064         (discard_locals_relocatable_test1.out): New target.
5065         (discard_locals_relocatable_test2.syms): New target.
5066         (discard_locals_relocatable_test2.out): New target.
5067         (various): Add missing ../ld-new dependencies.
5068         * testsuite/Makefile.in: Rebuild.
5069
5070 2010-03-03  Nick Clifton  <nickc@redhat.com>
5071
5072         * po/fi.po: New Finnish translation.
5073
5074 2010-03-01  Doug Kwan  <dougkwan@google.com>
5075
5076         * layout.cc (Layout::Layout): Force section types of .init_array*,
5077         .preinit_array* and .fini_array* sections.
5078         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5079         Fix check of return value of std::string::find.().
5080         (Output_section::Input_section_sort_compare::operator()): Remove
5081         comment about .init_array.
5082         (Output_section::Input_section_sort_init_fini_compare::operator()):
5083         New method.
5084         (Output_section::sort_attached_input_sections): Handle .init_array
5085         and .fini_array specially.
5086         * output.h (Output_section::Inut_section_sort_compare): Update
5087         comment.
5088         (Output_section::Input_section_sort_init_fini_compare): New struct.
5089
5090 2010-02-26  Doug Kwan  <dougkwan@google.com>
5091
5092         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5093         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5094         * testsuite/debug_msg.sh: Avoid matching source line number for
5095         use of global variable undef_int.
5096
5097 2010-02-26  Doug Kwan  <dougkwan@google.com>
5098
5099         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5100         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5101         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5102         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5103         * options.cc (General_options::General_options): Initialize member
5104         fix_v4bx_.
5105         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5106         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5107         and rm_no_fix_v4bx.stdout
5108         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5109         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5110         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5111         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5112         and arm_no_fix_v4bx.
5113         * Makefile.in: Regenerate.
5114         * testsuite/arm_fix_v4bx.s: New file.
5115         * testsuite/arm_fix_v4bx.sh: Ditto.
5116
5117 2010-02-24  Doug Kwan  <dougkwan@google.com>
5118
5119         * arm.cc (Target_arm::got_section): Make the .got section the first
5120         non RELRO section in the data segment.
5121         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5122         suffixes of section names.
5123
5124 2010-02-24  Doug Kwan  <dougkwan@google.com>
5125
5126         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5127         flags and attributes merging if an input file is a binary file.
5128         * fileread.cc (Input_file::open): Record format of original file.
5129         * fileread.h (Input_file::Format): New enum type.
5130         (Input_file::Input_file): Initialize data member format_.
5131         (Input_file::format): New method definition.
5132         (Input_file::format_):: New data member.
5133
5134 2010-02-24  Doug Kwan  <dougkwan@google.com>
5135
5136         * arm.cc (Arm_output_data_got): New class.
5137         (ARM_TCB_SIZE): New constant
5138         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5139         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5140         If user uses a script with a SECTIONS clause, issue only a warning
5141         for a misplaced EXIDX input section.  Otherwise, issue an error.
5142         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5143         garbage collection.
5144         (Target_arm::got_mode_index_entry): Handle static linking.
5145         (Target_arm::Scan::local): Ditto.
5146         (Target_arm::Scan::global): Ditto.
5147         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5148         all incorrectly implemented relocations.
5149         (Target_arm::fix_exidx_coverage): Pass layout to
5150         Arm_output_section::fix_exidx_coverage.
5151         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5152         from ".ARM.exidx." and ".ARM.extab.".
5153
5154 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5155
5156         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5157         section if it does not already exist.
5158         * attributes.cc (Attributes_section_data::Attributes_section_data):
5159         Don't crash if size is zero.
5160
5161 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5162             Ian Lance Taylor  <iant@google.com>
5163
5164         * gold.cc (queue_middle_tasks): If no input files were opened,
5165         exit.
5166         * workqueue.h (Task_function::Task_function): Assert that there is
5167         a blocker.
5168
5169 2010-02-22  Doug Kwan  <dougkwan@google.com>
5170
5171         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5172         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5173         types to avoid warnings due to different uint64_t implementations
5174         on different hosts.
5175
5176 2010-02-21  Doug Kwan  <dougkwan@google.com>
5177
5178         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5179         handling of the maximum backward branch offset.
5180         (Arm_relocate_functions::thumb_branch_common): Ditto.
5181         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5182         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5183         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5184         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5185         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5186         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5187         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5188         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5189         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5190         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5191         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5192         thumb2_bl_out_of_range.o): New rules.
5193         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5194         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5195         thumb2_bl_out_of_range
5196         * testsuite/Makefile.in: Regenerate.
5197         * testsuite/arm_bl_in_range.s: New file.
5198         * testsuite/arm_bl_out_of_range.s: Ditto.
5199         * testsuite/arm_branch_in_range.sh: Ditto.
5200         * testsuite/arm_branch_range.t: Ditto.
5201         * testsuite/thumb2_branch_range.t: Ditto.
5202         * testsuite/thumb_bl_in_range.s: Ditto.
5203         * testsuite/thumb_bl_out_of_range.s: Ditto.
5204         * testsuite/thumb_branch_range.t: Ditto.
5205
5206 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5207
5208         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5209         Add reloc offset information.
5210         * icf.cc (get_section_contents): Change iterators to point to the new
5211         vectors. Add reloc offset information to the contents.
5212         * icf.h (Icf::Sections_reachable_info): New typedef.
5213         (Icf::Sections_reachable_list): New typedef.
5214         (Icf::Offset_info): New typedef.
5215         (Icf::Reloc_info): New struct typedef.
5216         (Icf::Reloc_info_list): New typedef.
5217         (Icf::symbol_reloc_list): Delete method.
5218         (Icf::addend_reloc_list): Delete method.
5219         (Icf::section_reloc_list): Delete method.
5220         (Icf::reloc_info_list): New method.
5221         (Icf::reloc_info_list_): New member.
5222
5223 2010-02-19  Doug Kwan  <dougkwan@google.com>
5224
5225         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5226         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5227         * arm.cc (Arm_relocation_functions): New forward declaration.
5228         (Target_arm::Target_arm): Initialize new data members
5229         got_mod_index_offset_ and tls_base_symbol_defined_.
5230         (Target_arm::Relocate::relocate_tls): New method.
5231         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5232          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5233         New methods.
5234         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5235         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5236         (Target_arm::got_mod_index_offset_,
5237         Target_arm::tls_base_symbol_defined_): New data members.
5238         (Target_arm::Scan::local, Target::Scan::global,
5239         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5240         relocations.
5241
5242 2010-02-18  Doug Kwan  <dougkwan@google.com>
5243
5244         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5245         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5246         text section as a parameter becuase some broken tools may not set
5247         the link in section header.
5248         (Target_arm::has_got_section): New method.
5249         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5250         without any mapping symbol as data only.  Remove warning.
5251         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5252         link in its section header, try to discover the link by inspecting the
5253         REL31 relocation at the beginning of the section.
5254         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5255         in error message.
5256         (Target_arm::Scan::global): Treat any reference to the symbol
5257         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5258
5259 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5260
5261         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5262         (Scan::global_reloc_may_be_function_pointer): New function.
5263         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5264         (Scan::global_reloc_may_be_function_pointer): New function.
5265         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5266         (Scan::global_reloc_may_be_function_pointer): New function.
5267         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5268         (Scan::global_reloc_may_be_function_pointer): New function.
5269         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5270         (Scan::global_reloc_may_be_function_pointer): New function.
5271         (Scan::possible_function_pointer_reloc): New function.
5272         (Target_x86_64::can_check_for_function_pointers): New function.
5273         * gc.h (gc_process_relocs): Scan relocation types to determine if
5274         function pointers were taken for targets that support it.
5275         * icf.cc (Icf::find_identical_sections): Include functions for
5276         folding in safe ICF whose pointer is not taken.
5277         * icf.h (Secn_fptr_taken_set): New typedef.
5278         (fptr_section_id_): New member.
5279         (section_has_function_pointers): New function.
5280         (set_section_has_function_pointers): New function.
5281         (check_section_for_function_pointers): New function.
5282         * options.h: Fix comment for safe ICF option.
5283         * target.h (can_check_for_function_pointers): New function.
5284         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5285         Modify icf_safe_test for X86-64.
5286         * testsuite/Makefile.in: Regenerate.
5287         * testsuite/icf_safe_so_test.cc: New file.
5288         * testsuite/icf_safe_so_test.sh: New file.
5289         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5290         (main): Change to take pointer to function kept_func_3.
5291         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5292         folding is done correctly for X86-64.
5293
5294 2010-02-12  David S. Miller  <davem@davemloft.net>
5295
5296         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5297         is_symbolless parameter.
5298         (Output_reloc<SHT_REL>::is_symbolless): New.
5299         (Output_reloc<SHT_REL>::is_symbolless_): New.
5300         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5301         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5302         (Output_reloc<SHT_RELA>::is_symbolless): New.
5303         (Output_data_reloc::add_global): Handle is_symbolless.
5304         (Output_data_reloc::add_global_relative): Likewise.
5305         (Output_data_reloc::add_local): Likewise.
5306         (Output_data_reloc::add_local_relative): Likewise.
5307         (Output_data_reloc::add_symbolless_global_addend): New.
5308         (Output_data_reloc::add_symbolless_local_addend): New.
5309         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5310         is_symbolless.
5311         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5312         instead of ->is_relative_
5313         (Output_reloc::write): Likewise.
5314         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5315         (Output_reloc::write_rel): Simplify.
5316
5317         * sparc.cc (Target_sparc::Scan::local): Use
5318         ->add_symbolless_local_addend as needed.
5319         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5320         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5321         based upon relocation offset.
5322
5323 2010-02-11  Doug Kwan  <dougkwan@google.com>
5324
5325         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5326         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5327         beginning of function.
5328         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5329         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5330         parameter is_32bit in calls to should_apply_static_reloc.
5331         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5332         (check_DATA): Add arm_abs_global.stdout.
5333         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5334         arm_abs_global.stdout): New rules.
5335         (MOSTLLYCLEANFILES): Add arm_abs_global
5336         * Makefile.in: Regenerate.
5337         * testsuite/arm_abs_global.s: New file.
5338         * testsuite/arm_abs_global.sh: Ditto.
5339         * testsuite/arm_abs_lib.s: Ditto.
5340
5341 2010-02-11  Ian Lance Taylor  <iant@google.com>
5342
5343         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5344         Read_relocs task.
5345         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5346         Allocate_commons_task first.
5347         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5348         task, rather than symtab_lock_.
5349         (Gc_process_relocs::~Gc_process_relocs): New function.
5350         (Gc_process_relocs::is_runnable): Check this_blocker_.
5351         (Gc_process_relocs::locks): Use next_blocker_ rather than
5352         blocker_.
5353         (Scan_relocs::~Scan_relocs): New function.
5354         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5355         symtab_lock_.
5356         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5357         next_blocker_.
5358         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5359         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5360         constructor accordingly.
5361         (class Gc_process_relocs): Likewise.
5362         (class Scan_relocs): Likewise.
5363         * common.h (class Allocate_commons_task): Remove symtab_lock_
5364         field, and corresponding constructor parameter.
5365         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5366         symtab_lock_.
5367         (Allocate_commons_task::locks): Likewise.
5368
5369 2010-02-11  Ian Lance Taylor  <iant@google.com>
5370
5371         * gold-threads.h (class Once): Define.
5372         (class Initialize_lock): Rewrite as child of Once.
5373         * gold-threads.cc (class Once_initialize): Define.
5374         (once_pointer_control): New static variable.
5375         (once_pointer, once_arg): New static variables.
5376         (c_run_once): New static function.
5377         (Once::Once, Once::run_once, Once::internal_run): New functions.
5378         (class Initialize_lock_once): Remove.
5379         (initialize_lock_control): Remove.
5380         (initialize_lock_pointer): Remove.
5381         (initialize_lock_once): Remove.
5382         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5383         (Initialize_lock::initialize): Rewrite.
5384         (Initialize_lock::do_run_once): New function.
5385         * archive.cc (Archive::interpret_header): Only clear name if it is
5386         not already empty.
5387         * fileread.cc: Include "gold-threads.h"
5388         (file_counts_lock): New static variable.
5389         (file_counts_initialize_lock): Likewise.
5390         (File_read::release): Only increment counts when using --stats.
5391         Use a lock around the increment.
5392         * parameters.cc (class Set_parameters_target_once): Define.
5393         (set_parameters_target_once): New static variable.
5394         (Parameters::Parameters): Move here from parameters.h.
5395         (Parameters::set_target): Rewrite.
5396         (Parameters::set_target_once): New function.
5397         (Parameters::clear_target): Move here and rewrite.
5398         * parameters.h (class Parameters): Update declarations.  Add
5399         set_parameters_target_once_ field.
5400         (Parameters::Parameters): Move to parameters.cc.
5401         (Parameters::clear_target): Likewise.
5402         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5403         task.
5404         (Start_group::~Start_group): New function.
5405         (Start_group::is_runnable): New function.
5406         (Start_group::locks, Start_group::run): New functions.
5407         (Finish_group::run): Change saw_undefined to size_t.
5408         * readsyms.h (class Start_group): Define.
5409         (class Finish_group): Change saw_undefined_ field to size_t.
5410         (Finish_group::Finish_group): Remove saw_undefined and
5411         this_blocker parameters.  Change all callers.
5412         (Finish_group::set_saw_undefined): New function.
5413         (Finish_group::set_blocker): New function.
5414         * symtab.h (class Symbol_table): Change saw_undefined to return
5415         size_t.  Change saw_undefined_ field to size_t.
5416         * target-select.cc (Set_target_once::do_run_once): New function.
5417         (Target_selector::Target_selector): Initialize set_target_once_
5418         field.  Don't initialize lock_ and initialize_lock_ fields.
5419         (Target_selector::instantiate_target): Rewrite.
5420         (Target_selector::set_target): New function.
5421         * target-select.h (class Set_target_once): Define.
5422         (class Target_selector): Update declarations.  Make
5423         Set_target_once a friend.  Remove lock_ and initialize_lock_
5424         fields.  Add set_target_once_ field.
5425
5426 2010-02-10  Ian Lance Taylor  <iant@google.com>
5427
5428         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5429         queueing any tasks.
5430         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5431         (queue_middle_tasks): Add all blockers before queueing any tasks.
5432         (queue_final_tasks): Likewise.
5433         * token.h (Task_token::add_blockers): New function.
5434         * object.h (Input_objects::number_of_relobjs): New function.
5435
5436 2010-02-10  Ian Lance Taylor  <iant@google.com>
5437
5438         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5439         shared, not if not position independent.
5440         * x86_64.cc (Relocate::relocate_tls): Likewise.
5441         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5442         (tls_pie_pic_test): New target.
5443         * testsuite/Makefile.in: Rebuild.
5444
5445         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5446         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5447         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5448         * testsuite/Makefile.in: Rebuild.
5449
5450 2010-02-09  David S. Miller  <davem@davemloft.net>
5451
5452         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5453         R_SPARC_RELATIVE using ->add_local_relative().
5454         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5455
5456         * output.h (Output_data_dynamic::add_section_size): New method
5457         that takes two Output_data objects.
5458         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5459         entry param.  Handle it in initializers.
5460         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5461         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5462         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5463         arg.
5464         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5465         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5466         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5467         for dynrel_includes_plt.
5468         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5469         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5470         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5471         before .rela.plt
5472         (Target_sparc::do_finalize_sections): Update to pass true for
5473         dynrel_includes_plt.
5474         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5475         output before .rela.plt
5476         (Target_powerpc::do_finalize_sections): Update to pass true for
5477         dynrel_includes_plt when 32-bit.
5478
5479 2010-02-08  Doug Kwan  <dougkwan@google.com>
5480
5481         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5482         method.
5483         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5484         Arm_relobj::scan_section_for_cortex_a8_stubs,
5485         Arm_relobj::do_relocation_section): Instead of calling
5486         Output_section::output_address, use faster
5487         Arm_relobj::simple_input_section_output_address.
5488
5489 2010-02-08  David S. Miller  <davem@davemloft.net>
5490
5491         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5492         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5493         relocation helper function.
5494
5495         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5496         just like R_SPARC_GOT{10,13,22}.
5497         (Target_sparc::Scan::local): Likewise.
5498         (Target_sparc::Relocate:relocate): Likewise.
5499
5500 2010-02-06  Ian Lance Taylor  <iant@google.com>
5501
5502         * configure.ac: Rewrite targetobjs duplicate removal code to use
5503         only shell constructs.
5504         * configure: Rebuild.
5505
5506 2010-02-05  Doug Kwan  <dougkwan@google.com>
5507
5508         PR 11247
5509         * arm.cc (Arm_relobj::section_is_scannable): New method.
5510         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5511         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5512
5513 2010-02-04  Doug Kwan  <dougkwan@google.com>
5514
5515         PR 11247
5516         * arm-reloc-property.cc (cstdio): Include.
5517         * configure.ac (targetobjs): Remove duplicates.
5518         * configure: Regenerate.
5519         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5520         big and little endian version for a given address size.
5521
5522 2010-02-03  Doug Kwan  <dougkwan@google.com>
5523
5524         * arm-reloc-property.cc
5525         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5526         definition.
5527         * arm-reloc-property.h
5528         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5529         New method definition.
5530         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5531         declaration.
5532         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5533         overflow to N.
5534         (GOT_PREL): Change implemented to Y.
5535         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5536         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5537         (Arm_relocate_functions::movw_abs_nc): Remove method.
5538         (Arm_relocate_functions::movt_abs): Ditto.
5539         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5540         (Arm_relocate_functions::thm_movt_abs): Ditto.
5541         (Arm_relocate_functions::movw_rel_nc): Ditto.
5542         (Arm_relocate_functions::movw_rel): Ditto.
5543         (Arm_relocate_functions::movt_rel): Ditto.
5544         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5545         (Arm_relocate_functions:thm_movw_rel): Ditto.
5546         (Arm_relocate_functions:thm_movt_rel): Ditto.
5547         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5548         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5549         New method definitions.
5550         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5551         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5552         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5553         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5554         (Target_arm::Relocate::relocate): Check for non-static or
5555         unimplemented relocation code and exit early.  Change calls to
5556         Target_arm::reloc_uses_thumb_bit and
5557         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5558         instead.  Refactor code to handle similar relocations to increase
5559         code sharing.  Remove check for unsupported relocation code in switch
5560         statement.
5561         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5562         relocation property table to find out size.  Change error message to
5563         print out the name of a relocation code instead of the numeric value.
5564         (Target_arm::scan_reloc_for_stub): Use relocation property table
5565         instead of calling Target_arm::reloc_uses_thumb_bit().
5566
5567 2010-02-02  Doug Kwan  <dougkwan@google.com>
5568
5569         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5570         types of relaxed input section.
5571
5572 2010-02-02  Doug Kwan  <dougkwan@google.com>
5573
5574         * Makefile.am (HFILES): Add arm-reloc-property.h.
5575         (DEFFILES): New.
5576         (TARGETSOURCES): Add arm-reloc-property.cc
5577         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5578         (libgold_a_SOURCES): $(DEFFILES)
5579         * Makefile.in: Regenerate.
5580         * arm-reloc-property.cc: New file.
5581         * arm-reloc-property.h: New file.
5582         * arm-reloc.def: New file.
5583         * arm.cc: Update comments.
5584         (arm-reloc-property.h): New included header.
5585         (arm_reloc_property_table): New global variable.
5586         (Target_arm::do_select_as_default_target): New method definition.
5587         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5588         arm-reloc-property to targ_extra_obj.
5589         * parameters.cc (set_parameters_target): Call
5590         Target::select_as_default_target().
5591         * target.h (Target::select_as_default_target): New method definition.
5592         (Target::do_select_as_default_target): Same.
5593
5594 2010-02-01  Doug Kwan  <dougkwan@google.com>
5595
5596         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5597         first_output_text_section_.
5598         (Arm_exidx_fixup::first_output_text_section): New method definition.
5599         (Arm_exidx_fixup::first_output_text_section_): New data member.
5600         (Arm_exidx_fixup::process_exidx_section): Record the first text
5601         output section seen.
5602         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5603         and entsize in output section header.
5604
5605 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5606
5607         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5608         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5609         (Arm_relocate_functions::thm_alu11): New Method.
5610         (Arm_relocate_functions::thm_pc8): New Method.
5611         (Arm_relocate_functions::thm_pc12): New Method.
5612         (Target_arm::Scan::local): Handle the relocations.
5613         (Target_arm::Scan::global): Likewise.
5614         (Target_arm::Relocate::relocate): Likewise.
5615         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5616
5617 2010-01-29  Doug Kwan  <dougkwan@google.com>
5618
5619         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5620         of relocation types as ld.
5621
5622 2010-01-29  Doug Kwan  <dougkwan@google.com>
5623
5624         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5625         to public.
5626         (Arm_relocate_functions::thumb_branch_common): Ditto.
5627         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5628         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5629         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5630         Arm_relocate_functions::jump24): Remove.
5631         (Target_arm::Relocate::relocate): Adjust code to call
5632         Arm_relocation_functions::arm_branch_common and
5633         Arm_relocation_functions::thumb_branch_common instead of their removed
5634         wrappers.  Merge switch-cases together to reduce source code size.
5635
5636 2010-01-29  Doug Kwan  <dougkwan@google.com>
5637
5638         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5639         output_local_symbol_count_needs_update_.
5640         (Arm_relobj::output_local_symbol_count_needs_update,
5641          Arm_relobj::set_output_local_symbol_count_needs_update,
5642          Arm_relobj::update_output_local_symbol_count): New methods.
5643         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5644         member.
5645         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5646         of pointed function as in a R_ARM_PREL31 relocation.
5647         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5648         for output local symbol count updating.
5649         (Target_arm::do_relax): Update output local symbol counts in objects
5650         if necessary.
5651         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5652
5653 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5654
5655         * arm.cc: Added support for the ARM relocations:
5656         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5657         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5658         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5659         movw_prel_nc).
5660         (Arm_relocate_functions::movw_rel): New method.
5661         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5662         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5663         thm_movw_prel_nc).
5664         (Arm_relocate_functions::thm_movw_rel): New method.
5665         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5666         thm_movt_prel).
5667         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5668         relocations.
5669         (Target_arm::Scan::global): Likewise.
5670         (Target_arm::Relocate::relocate): Likewise.
5671         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5672         Likewise.
5673
5674 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5675
5676         * arm.cc: Added support for ARM group relocations.
5677         (Target_arm::reloc_needs_sym_origin): New method.
5678         (Arm_relocate_functions::calc_grp_kn): New method.
5679         (Arm_relocate_functions::calc_grp_residual): New method.
5680         (Arm_relocate_functions::calc_grp_gn): New method.
5681         (Arm_relocate_functions::arm_grp_alu): New Method.
5682         (Arm_relocate_functions::arm_grp_ldr): New Method.
5683         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5684         (Arm_relocate_functions::arm_grp_ldc): New Method.
5685         (Target_arm::Scan::local): Handle the ARM group relocations.
5686         (Target_arm::Scan::global): Likewise.
5687         (Target_arm::Relocate::relocate): Likewise.
5688         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5689         Likewise.
5690
5691 2010-01-26  Doug Kwan  <dougkwan@google.com>
5692
5693         * arm.cc (set): Include.
5694         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5695         pointer type.
5696         (Arm_output_section::Text_section_list): New type.
5697         (Arm_output_section::append_text_sections_to_list): New method.
5698         (Arm_output_section::fix_exidx_coverage): Ditto.
5699         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5700         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5701         Relobj::set_section_offset() instead of
5702         Sized_relobj::invalidate_section_offset().
5703         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5704         parameter for section headers. Ignore relocation sections for
5705         unallocated sections and EXIDX sections.
5706         (Target_arm::fix_exidx_coverage): New method.
5707         (Target_arm::output_section_address_less_than): New type.
5708         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5709         linked text section instead of the EXIDX section.
5710         (Arm_output_section::create_stub_group): Add an assertion to check
5711         that this is not an EXIDX output section.
5712         (Arm_output_section::append_text_sections_to_list): New method.
5713         (Arm_output_section::fix_exidx_coverage): Ditto.
5714         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5715         Arm_relobj::section_needs_reloc_stub_scanning.
5716         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5717         first pass.
5718         (Target_arm::fix_exidx_coverage): New method.
5719         * object.h (Relobj::set_output_section): New method.
5720         (Sized_relobj::invalidate_section_offset): Remove method.
5721         (Sized_relobj::do_invalidate_section_offset): Remove method.
5722         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5723
5724 2010-01-25  Doug Kwan  <dougkwan@google.com>
5725
5726         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5727         Fix warning due to signed and unsigned comparison on a 32-bit host.
5728
5729 2010-01-22  Doug Kwan  <dougkwan@google.com>
5730
5731         * arm.cc (Target_arm::do_relax): Record an output section for section
5732         offset adjustment it contains any stub table that has changed.
5733         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5734         offsets in an output section if necessary.
5735         * output.cc (Output_section::Output_section): Initialize
5736         section_offsets_need_adjustments_.
5737         (Output_section::add_input_section_for_script): Renamed to
5738         Output_section::add_simple_input_section.
5739         (Output_section::save_states): Add a comment.
5740         (Output_section::discard_states): New method defintion.
5741         (Output_section::adjust_section_offsets): Same.
5742         * output.h (Output_section::add_input_section_for_script): Renamed to
5743         Output_section::add_simple_input_section.
5744         (Output_section::discard_states): New method declaration.
5745         (Output_section::adjust_section_offsets): Same.
5746         (Output_section::section_offsets_need_adjustment,
5747         Output_section::set_section_offsets_need_adjustment): New method
5748         definitions.
5749         (Output_section::section_offsets_need_adjustment_): New data member.
5750         * script-sections.cc
5751         (Output_section_element_input::set_section_address): Adjust code for
5752         renaming of Output_section::add_input_section_for_script.
5753         (Orphan_output_section::set_section_address): Same.
5754
5755 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5756
5757         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5758         Fix_v4bx enum values .
5759         * gold/options.h (General_options): New option definitions.
5760         (General_options::fix_v4bx): New method.
5761         (General_options::Fix_v4bx): New enum.
5762         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5763         (General_options::parse_fix_v4bx_interworking): New method.
5764
5765 2010-01-22  Doug Kwan  <dougkwan@google.com>
5766
5767         * arm.cc (Arm_exidx_fixup): New class.
5768
5769 2010-01-21  Doug Kwan  <dougkwan@google.com>
5770
5771         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5772         classes.
5773         (Arm_exidx_section_offset_map): New type.
5774
5775 2010-01-21  Doug Kwan  <dougkwan@google.com>
5776
5777         * arm.cc (Arm_exidx_input_section): New class.
5778         (Arm_relobj::exidx_input_section_by_link,
5779         Arm_relobj::exidx_input_section_by_shndx,
5780         Arm_relobj::make_exidx_input_section): New methods.
5781         (read_arm_attributes_section): Remove.
5782         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5783         information about them.
5784         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5785         to here.
5786
5787 2010-01-20  Doug Kwan  <dougkwan@google.com>
5788
5789         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5790         Input_section_specifier to Section_id.
5791         (Target_arm::new_arm_input_section: Adjust code for change of key
5792         type.
5793         (Target_arm::find_arm_input_section): Ditto.
5794         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5795         (Section_id): Remove.
5796         (Garbage_collection::Section_id_hash): Remove.
5797         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5798         (Section_id): Remove.
5799         (Icf::Section_id_hash): Remove.
5800         * object.h (Section_id, Const_section_id, Section_id_hash,
5801         Const_section_id_hash): New type definitions.
5802         * output.cc (Output_section::add_relaxed_input_section): Change to
5803         use Const_section_id instead of Input_section_specifier as key type.
5804         (Output_section::add_merge_input_section): Ditto.
5805         (Output_section::build_relaxation_map): Change to use Section_id
5806         instead of Input_section_specifier as key type.
5807         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5808         Ditto.
5809         (Output_section::convert_input_sections_to_relaxed_sections): Change
5810         to use Const_section_id instead of Input_section_specifier as key type.
5811         (Output_section::find_merge_section): Ditto.
5812         (Output_section::find_relaxed_input_section): Ditto.
5813         * output.h (Input_section_specifier): Remove class.
5814         (Output_section::Output_section_data_by_input_section_map): Change
5815         key type to Const_section_id.
5816         (Output_section::Output_relaxed_input_section_by_input_section_map):
5817         Ditto.
5818         (Output_section::Relaxation_map): Change key type to Section_id.
5819
5820 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5821
5822         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5823         (class Arm_v4bx_stub): New class.
5824         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5825         (Stub_factory::make_arm_v4bx_stub): New method.
5826         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5827         (Stub_table::empty): Handle v4bx stubs.
5828         (Stub_table::add_arm_v4bx_stub): New method.
5829         (Stub_table::find_arm_v4bx_stub): New method.
5830         (Arm_relocate_functions::v4bx): New method.
5831         (Target_arm::fix_v4bx): New method.
5832         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5833         (Stub_table::relocate_stubs): Likewise.
5834         (Stub_table::do_write): Likewise.
5835         (Stub_table::update_data_size_and_addralign): Likewise.
5836         (Stub_table::finalize_stubs):  Likewise.
5837         (Target_arm::Scan::local): Likewise.
5838         (Target_arm::Scan::global): Likewise.
5839         (Target_arm::do_finalize_sections): Likewise.
5840         (Target_arm::Relocate::relocate): Likewise.
5841         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5842         Likewise.
5843         (Target_arm::scan_reloc_for_stub): Likewise.
5844         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5845
5846 2010-01-19  Ian Lance Taylor  <iant@google.com>
5847
5848         * output.cc (Output_section_headers::do_sized_write): Write large
5849         segment count to sh_info field.
5850         (Output_file_header::do_sized_write): For large segment count,
5851         write PN_XNUM to e_phnum field.
5852
5853 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5854
5855         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5856         (Arm_relocate_functions::thm_jump8): New function.
5857         (Arm_relocate_functions::thm_jump11): New function.
5858         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5859         R_ARM_THM_JUMP11.
5860         (Target_arm::Scan::global): Likewise.
5861         (Target_arm::Relocate::relocate): Likewise.
5862         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5863         Likewise.
5864
5865 2010-01-14  Doug Kwan  <dougkwan@google.com>
5866
5867         * arm.cc (map, utility): Include headers.
5868         (Target_arm::apply_cortex_a8_workaround): New method.
5869         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5870         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5871         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5872         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5873         the --[no-]fix-cortex-a8 command line options.
5874         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5875         (Target_arm::relocate_stub): Use addend in instruction template.
5876         * options.h (DEFINE_bool): Set the user-set flag.
5877         (General_options): Add --[no-]-fix-cortex options.
5878         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5879         : Update fast look-up map after conversion.
5880
5881 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5882
5883         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5884         in the first pass of do_layout.
5885
5886 2010-01-13  Doug Kwan  <dougkwan@google.com>
5887
5888         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5889         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5890         apparent compiler problem of not folding static constant integral
5891         data members of elfcpp::Elf_sizes<32>.
5892
5893 2010-01-13  Doug Kwan  <dougkwan@google.com>
5894
5895         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5896         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5897         Arm_relobj::scan_section_for_cortex_a8_erratum,
5898         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5899         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5900         sections to scan for relocation stubs into a new method
5901         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5902         relocation and Cortex-A8 stub scanning.
5903         (Target_arm::do_relax): Force stubs to be after stubbed sections
5904         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5905         the beginning of a new relaxation pass.  Update a comment.
5906         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5907
5908 2010-01-12  Ian Lance Taylor  <iant@google.com>
5909
5910         * target-reloc.h (visibility_error): New inline function.
5911         (relocate_section): Call visibility_error.
5912         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5913         (MOSTLYCLEANFILES): Likewise.
5914         (protected_4_pic.o, protected_3.err): New targets.
5915         * testsuite/protected_4.cc: New file.
5916
5917 2010-01-12  Doug Kwan  <dougkwan@google.com>
5918
5919         * arm.cc (Cortex_a8_reloc): New class.
5920         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5921         and cortex_a8_relocs_info_.
5922         (Target_arm::fix_cortex_a8): New method definition.
5923         (Target_arm::Cortex_a8_relocs_info): New type.
5924         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5925         New data member declarations.
5926         (Target_arm::scan_reloc_for_stub): Record information about
5927         relocations for THUMB branches that might be exempted from the
5928         Cortex-A8 workaround.
5929         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5930         at the beginning of a relaxation pass.
5931
5932 2010-01-12  Doug Kwan  <dougkwan@google.com>
5933
5934         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5935         (Arm_relobj::Mapping_symbol_position,
5936          Arm_reloj::Mapping_symbol_position_less,
5937          Arm_relobj::Mapping_symbols_info): New types.
5938         (Target_arm::is_mapping_symbol_name): New method definition.
5939         (Arm_relobj::do_count_local_symbols): Save information about mapping
5940         symbols.
5941
5942 2010-01-11  Doug Kwan  <dougkwan@google.com>
5943
5944         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5945         Arm_relocate_functions::thumb32_branch_upper,
5946         Arm_relocate_functions::thumb32_branch_lower,
5947         Arm_relocate_functions::thumb32_cond_branch_offset,
5948         Arm_relocate_functions::thumb32_cond_branch_upper,
5949         Arm_relocate_functions::thumb32_cond_branch_lower,
5950         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5951         branch offset encoding.
5952         (Arm_relocate_functions::thumb_branch_common): Use new branch
5953         offset encoding methods to avoid code duplication.
5954         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5955         (Stub_addend_reader::operator()): Use new branch encoding method
5956         to avoid code duplication.
5957
5958 2010-01-11  Doug Kwan  <dougkwan@google.com>
5959
5960         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5961         (Target_arm::do_finalize_sections): Define special EXIDX section
5962         symbols only if referenced.
5963         * gc.h (Garbage_collection::add_reference): New method.
5964         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5965         code duplication.
5966
5967 2010-01-11  Ian Lance Taylor  <iant@google.com>
5968
5969         * script.cc (Version_script_info::build_expression_list_lookup):
5970         Change complaing about duplicate wildcard match from error to
5971         warning.
5972
5973         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5974         of 2009-12-30.
5975         (Version_script_info::Version_script_info): Initialize globs_,
5976         default_version_, default_is_global_, and exact_.  Don't
5977         initialize globals_ or locals_.
5978         (Version_script_info::build_lookup_tables): Build local symbols
5979         first.
5980         (Version_script_info::unquote): New function.
5981         (Version_script_info::add_exact_match): New function.
5982         (Version_script_info::build_expression_list_lookup): Remove lookup
5983         parameter.  Add is_global parameter.  Change all callers.  Handle
5984         wildcard pattern specially.  Unquote pattern.  Call
5985         add_exact_match.
5986         (Version_script_info::get_name_to_match): New function.
5987         (Version_script_info::get_symbol_version): New function.
5988         (Version_script_info::get_symbol_version_helper): Remove.
5989         (Version_script_info::check_unmatched_names): Call unquote.
5990         * script.h (class Version_script_info): Change get_symbol_version
5991         to be non-inline and add is_global parameter; change all callers.
5992         Rewrite symbol_is_local.  Update declarations.  Define struct
5993         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5994         Remove globals_ and locals_ members.  Add exact_, globs_,
5995         default_version_, is_global_.
5996         (Version_script_info::Glob): Remove pattern, add expression and
5997         is_global.  Update constructor.  Change all callers.
5998         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5999         default version.
6000         (Versions::symbol_section_contents): If a symbol is undefined, or
6001         defined in a dynamic object, set the version index to
6002         VER_NDX_LOCAL.
6003         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6004         symbol_is_local.
6005         (Symbol_table::add_from_pluginobj): Likewise.
6006         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6007
6008 2010-01-11  Doug Kwan  <dougkwan@google.com>
6009
6010         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6011         (incremental_dump_LDADD): Add linking option for libintl.
6012         * Makefile.in: Regenerate.
6013
6014 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6015
6016         PR gold/11144
6017         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6018         instead of -Ds.
6019         * testsuite/Makefile.in: Regenerated.
6020
6021 2010-01-10  Doug Kwan  <dougkwan@google.com>
6022
6023         * options.h (DEFINE_var): Use parentheses around argument varname__
6024         in macro body to avoid any unintended subsequent substitutions.
6025
6026 2010-01-10  Ian Lance Taylor  <iant@google.com>
6027
6028         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6029         candidates before doing symbol resolution.
6030
6031         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6032         ODR candidates if only one is weak.
6033
6034 2010-01-08  Ian Lance Taylor  <iant@google.com>
6035
6036         * script.cc (Version_script_info::build_expression_list_lookup):
6037         Don't warn about ambiguous version, just record the ambiguity.
6038         (Version_script_info::get_symbol_version_helper): Give error if
6039         version is ambiguous.
6040
6041 2010-01-08  Doug Kwan  <dougkwan@google.com>
6042
6043         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6044           prev_data_size_ and prev_addralign_.  Remove initializer for
6045           deleted data member has_been_changed_.
6046           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6047           to determine if the table is empty.
6048           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6049           Remove.
6050           (Stub_table::add_reloc_stub): Define method in class definition
6051           instead of just declaring it there.
6052           (Stub_table::add_cortex_a8_stub): New method definition.
6053           (Stub_table::update_data_size_and_addralign): Ditto.
6054           (Stub_table::finalize_stubs): Ditto.
6055           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6056           (Stub_table::do_addralign_): Return address alignment in the
6057           (Stub_table::do_reset_address_and_file_offset): Define method in
6058           class definition instead of declaring it there.  Set current data
6059           size to be the data size of the previous pass.
6060           (Stub_table::set_final_data_size): Use current data size as the
6061           final data size.
6062           (Stub_table::relocate_stub): Change parameter type of stub from
6063           Reloc_stub pointer to Stub pointer.
6064           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6065           (Stub_table::Cortex_a8_stub_list): New typedef.
6066           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6067            Stub_table::prev_addralign_): New data member.
6068           (Arm_relobj::Arm_relobj): Initialize data member
6069           section_has_cortex_a8_workaround_.
6070           (Arm_relobj::section_has_cortex_a8_workaround,
6071            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6072            definitions.
6073           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6074           declarations.
6075           (Target_arm::relocate_stub): Change parameter type of stub from
6076           Reloc_stub pointer to Stub pointer.
6077           (Insn_template::size, Insn_template::alignment): Handle
6078           THUMB16_SPECIAL_TYPE.
6079           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6080            Stub_table::update_data_size_and_addralign,
6081            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6082           definitions.
6083           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6084           (Stub_table::do_write): Ditto.
6085           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6086
6087 2010-01-08  Ian Lance Taylor  <iant@google.com>
6088
6089         PR 11108
6090         * symtab.h (class Symbol): Remove fields is_target_special_ and
6091         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6092         (Symbol::is_defined_in_discarded_section): New function.
6093         (Symbol::set_is_defined_in_discarded_section): New function.
6094         (Symbol::has_plt_offset): Rewrite.
6095         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6096         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6097         Don't initialize is_target_special_ or has_plt_offset_.
6098         Initialize is_defined_in_discarded_section_.
6099         (Symbol_table::add_from_relobj): If appropriate, set
6100         is_defined_in_discarded_section.
6101         * resolve.cc (Symbol::override_base_with_special): Don't test
6102         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6103         * target-reloc.h (relocate_section): Do special handling for
6104         symbols defined in discarded sections for global symbols as well
6105         as local symbols.
6106
6107 2010-01-08  Ian Lance Taylor  <iant@google.com>
6108
6109         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6110         the SHT_SYMTAB case.
6111
6112 2010-01-08  Ian Lance Taylor  <iant@google.com>
6113
6114         * object.cc (Sized_relobj::do_layout): Don't get confused if
6115         layout_eh_frame returns NULL.
6116
6117 2010-01-08  Ian Lance Taylor  <iant@google.com>
6118
6119         PR 11084
6120         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6121         dynamic symbol table, use the normal symbol table.
6122         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6123         symbol table.
6124
6125 2010-01-08  Ian Lance Taylor  <iant@google.com>
6126
6127         PR 11072
6128         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6129         sections.
6130
6131 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6132
6133         * version.cc (print_version): Change to "Copyright 2010".
6134
6135 2010-01-08  Ian Lance Taylor  <iant@google.com>
6136
6137         PR 10287
6138         PR 11063
6139         * i386.cc (class Target_i386): Change return type of plt_section
6140         to be non-const.
6141         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6142         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6143         tls_desc_rel_ field.
6144         (Output_data_plt_i386::rel_tls_desc): New function.
6145         (Target_i386::rel_tls_desc_section): New function.
6146         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6147         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6148         R_386_TLS_DESC reloc in rel_tls_desc_section.
6149         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6150         Define struct Tlsdesc_info.
6151         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6152         (Target_x86_64::do_reloc_symbol_index): New function.
6153         (Target_x86_64::add_tlsdesc_info): New function.
6154         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6155         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6156         tlsdesc_rel_ field.
6157         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6158         all callers.
6159         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6160         (Target_x86_64::rela_tlsdesc_section): New function.
6161         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6162         handling.
6163         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6164         (Target_x86_64::do_reloc_addend): New function.
6165         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6166         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6167         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6168         (Output_reloc::type): New function.
6169         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6170         (Output_reloc::is_target_specific): New function.
6171         (Output_reloc::target_arg): New function.
6172         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6173         absolute relocs and target specific relocs.
6174         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6175         add_target_specific.
6176         (class Output_data_reloc) [SHT_RELA]: Likewise.
6177         * output.cc (Output_reloc::Output_reloc): Add four new versions
6178         for absolute relocs and target specific relocs.
6179         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6180         (Output_reloc::get_symbol_index): Likewise.
6181         (Output_reloc::local_section_offset): Check that local_sym_index_
6182         is not TARGET_CODE or 0.
6183         (Output_reloc::symbol_value): Likewise.
6184         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6185         reloc.
6186         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6187         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6188         functions.
6189         * layout.cc (add_target_dynamic_tags): Use output section for
6190         DT_PLTRELSZ and DT_JMPREL.
6191
6192 2010-01-07  Ian Lance Taylor  <iant@google.com>
6193
6194         PR 11061
6195         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6196         function.
6197         (class Output_data_reloc_generic): Define.
6198         (class Output_data_reloc_base): Change base class to
6199         Output_data_reloc_generic.  Change add() method to call
6200         bump_relative_reloc_count for a relative reloc.  Remove
6201         sort_relocs_ field.
6202         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6203         to sort_relocs().
6204         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6205         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6206         appropriate.
6207         * layout.h (class Layout): Update declaration.
6208
6209 2010-01-07  Ian Lance Taylor  <iant@google.com>
6210
6211         * output.h (class Output_data): Add const version of
6212         output_section and do_output_section.
6213         (class Output_section_data): Add const version of
6214         do_output_section.
6215         (class Output_section): Likewise.
6216         * layout.cc (Layout::add_target_dynamic_tags): New function.
6217         * layout.h (class Layout): Update declarations.
6218         * arm.cc (Target_arm::do_finalize_sections): Use
6219         add_target_dynamic_tags.
6220         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6221         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6222         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6223         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6224
6225 2010-01-07  Ian Lance Taylor  <iant@google.com>
6226
6227         PR 11042
6228         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6229         object as needed.
6230
6231 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6232             Ian Lance Taylor  <iant@google.com>
6233
6234         PR 11019
6235         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6236         Xindex::read_symtab_xindex.
6237
6238 2010-01-07  Doug Kwan  <dougkwan@google.com>
6239
6240         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6241         (Insn_template::thumb16_bcond_insn): New method declaration.
6242         (Insn_template): Fix spelling.
6243         (Stub::thumb16_special): New method declaration.
6244         (Stub::do_write): Define virtual method which was previously pure
6245         virtual.
6246         (Stub::do_thumb16_special): New method declaration.
6247         (Stub::do_fixed_endian_write): New template member.
6248         (Reloc_stub::do_write): Remove.
6249         (Reloc_stub::do_fixed_endian_write): Remove.
6250         (Cortex_a8_stub): New class definition.
6251         (Stub_factory::make_cortex_a8_stub): New method definition.
6252         (Stub_factory::Stub_factory): Add missing static storage class
6253         qualifier for elf32_arm_stub_a8_veneer_blx.
6254
6255 2010-01-07  Ian Lance Taylor  <iant@google.com>
6256
6257         PR 10980
6258         * options.h (class General_options): Add --warn-unresolved-symbols
6259         and --error-unresolved-symbols.
6260         * errors.cc (Errors::undefined_symbol): Implement
6261         --warn-unresolved-symbols.
6262
6263         * options.h (class General_options): Add -z text and -z textoff.
6264         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6265
6266 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6267
6268         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6269         (Garbage_collection::cident_sections): New function.
6270         (Garbage_collection::add_cident_section): New function.
6271         (Garbage_collection::cident_sections_): New member.
6272         (gc_process_relocs): Add references to sections whose names are C
6273         identifiers.
6274         * gold.h (cident_section_start_prefix): New constant.
6275         (cident_section_stop_prefix): New constant.
6276         (is_cident): New function.
6277         * layout.cc (Layout::define_section_symbols): Replace string constants
6278         with the newly defined constants.
6279         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6280         C identifiers.
6281         * testsuite/Makefile.am: Add gc_orphan_section_test.
6282         * testsuite/Makefile.in: Regenerate.
6283         * testsuite/gc_orphan_section_test.cc: New file.
6284         * testsuite/gc_orphan_section_test.sh: New file.
6285
6286 2010-01-06  Ian Lance Taylor  <iant@google.com>
6287
6288         PR 10980
6289         * options.h (class General_options): Add --warn-shared-textrel.
6290         * layout.cc (Layout::finish_dynamic_section): Implement
6291         --warn-shared-textrel.
6292
6293         PR 10980
6294         * options.h (class General_options): Add --warn-multiple-gp.
6295
6296 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6297
6298         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6299         $(THREADSLIB) and $(LIBDL).
6300         * Makefile.in: Rebuild.
6301
6302 2010-01-06  Ian Lance Taylor  <iant@google.com>
6303
6304         PR 10980
6305         * options.cc (General_options::parse_section_start): New function.
6306         (General_options::section_start): New function.
6307         (General_options::General_options): Initialize all members.
6308         * options.h: Include <map>
6309         (class General_options): Add --section-start.  Add section_starts_
6310         member.
6311         * layout.cc (Layout::attach_allocated_section_to_segment): If
6312         --section-start was used, set the address of the segment.  Remove
6313         local sort_sections.
6314         (Layout::relaxation_loop_body): If the address of the load segment
6315         has been set by --section-start, don't use it.
6316         * output.h (Output_segment::update_flags_for_output_section): New
6317         function.
6318         * output.cc (Output_segment::add_output_section): Call
6319         update_flags_for_output_section.
6320
6321 2010-01-05  Ian Lance Taylor  <iant@google.com>
6322
6323         PR 10980
6324         * options.h (class General_options): Add --undefined-version.
6325         * script.cc (struct Version_expression): Add was_matched_by_symbol
6326         field.
6327         (Version_script_info::matched_symbol): New function.
6328         (Version_script_info::get_symbol_version_helper): Call
6329         matched_symbol.
6330         (Version_script_info::check_unmatched_names): New function.
6331         * script.h (class Version_script_info): Update declarations.
6332         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6333
6334         * options.h (class General_options): Use DEFINE_bool_alias for
6335         allow_multiple_definition.
6336         * resolve.cc (Symbol_table::should_override): Don't test
6337         allow_multiple_definition.
6338
6339         PR 10980
6340         * options.h (class General_options): Add --cref.
6341         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6342         until after printing cref table.
6343         * cref.cc: Include "symtab.h".
6344         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6345         (Cref_table_compare::operator()): New function.
6346         (Cref_inputs::gather_cref): New function.
6347         (filecol): New static const.
6348         (Cref_inputs::print_cref): New function.
6349         (Cref::print_cref): New function.
6350         * cref.h: Include <cstdio>.
6351         (class Cref): Update declarations.
6352         * mapfile.h (Mapfile::file): New function.
6353         * object.h (class Object): Define Symbols.  Declare virtual
6354         do_get_global_symbols.
6355         (Object::get_global_symbols): New function.
6356         * object.cc (Input_objects::add_object): Pass object to cref_ if
6357         --cref.
6358         (Input_objects::archive_start): Likewise.
6359         (Input_objects::archive_stop): Likewise.
6360         (Input_objects::print_cref): New function.
6361         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6362         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6363         --cref.
6364         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6365         function.
6366         * plugin.h (class Sized_pluginobj): Update declarations.
6367
6368 2010-01-05  Ian Lance Taylor  <iant@google.com>
6369
6370         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6371         to is_default_version.  Rename insdef to insdefault.
6372         (Symbol_table::add_from_relobj): Rename def to is_default_version
6373         and local to is_forced_local.
6374         (Symbol_table::add_from_pluginobj): Likewise.
6375         (Symbol_table::add_from_dynobj): Likewise.
6376         (Symbol_table::define_special_symbol): Rename insdef to
6377         insdefault.
6378
6379 2010-01-04  Ian Lance Taylor  <iant@google.com>
6380
6381         PR 10980
6382         * options.h (class General_options): Add
6383         --allow-multiple-definition and -z muldefs.
6384         * resolve.cc (Symbol_table::should_override): Don't warn about a
6385         multiple symbol definition if --allow-multiple-definition or -z
6386         muldefs.
6387
6388         PR 10980
6389         * options.h (class General_options): Add --add-needed and
6390         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6391         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6392         error if --copy-dt-needed-entries aka --add-needed is used and
6393         would cause a change in behaviour.
6394
6395         PR 10980
6396         * options.h (class General_options): Add -G as a short version of
6397         --shared.  Add no-op options -assert, -g, and -i.
6398
6399 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6400
6401         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6402         check for .text or .gnu.linkonce.t sections.
6403         * icf.cc (Icf::find_identical_sections): Ditto.
6404         Change the detection for mangled function name within the section
6405         name.
6406         * icf.h (is_section_foldable_candidate): New function.
6407
6408 2009-12-30  Ian Lance Taylor  <iant@google.com>
6409
6410         PR 10980
6411         * options.h (class General_options): Permit two dashes with
6412         --retain-symbols-file.
6413
6414 2009-12-30  Ian Lance Taylor  <iant@google.com>
6415
6416         PR 10979
6417         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6418         don't put the file header and segment headers in the text
6419         segment.
6420
6421         PR 10979
6422         * common.cc (Sort_commons::operator()): Stabilize sort when both
6423         entries are NULL.
6424         (Symbol_table::do_allocate_commons_list): When allocating common
6425         symbols, skip a symbol which is no longer common.
6426         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6427         an object before checking its type.
6428         * testsuite/common_test_2.c: New file.
6429         * testsuite/common_test_3.c: New file.
6430         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6431         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6432         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6433         (common_test_2_pic.o, common_test_2.so): New targets.
6434         (common_test_3_pic.o, common_test_3.so): New targets.
6435         * testsuite/Makefile.in: Rebuild.
6436
6437         PR 10979
6438         * script.cc (read_input_script): If we see a new SECTIONS clause,
6439         and we have added an input section, give an error.
6440         * layout.h (class Layout): Add have_added_input_section function.
6441         Add have_added_input_section_ field.
6442         * layout.cc (Layout::Layout): Initialize
6443         have_added_input_section_.
6444         (Layout::layout): Set have_added_input_section_.
6445         (Layout::layout_eh_frame): Likewise.
6446
6447 2009-12-30  Ian Lance Taylor  <iant@google.com>
6448
6449         PR 10931
6450         * options.h (class General_options): Add --sort-common option.
6451         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6452         * common.cc (Sort_common): Add sort_order parameter to
6453         constructor.  Add sort_order_ field.
6454         (Sort_commons::operator): Check sort_order_.
6455         (Symbol_table::allocate_commons): Determine the sort order.
6456         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6457         Change all callers.
6458         (Symbol_table::do_allocate_commons_list): Likewise.
6459
6460 2009-12-30  Ian Lance Taylor  <iant@google.com>
6461
6462         PR 10916
6463         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6464         symbols from this object, don't change the visibility of an
6465         undefined symbol.
6466         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6467
6468 2009-12-30  Ian Lance Taylor  <iant@google.com>
6469
6470         PR 10861
6471         * script.h (class Version_script_info): Define Language enum.
6472         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6473         new fields globals_, locals_, and is_finalized_.
6474         * script.cc: Various formatting fixes.
6475         (class Parser_closure): Change language_stack_ from a vector of
6476         std::string to one of Version_script_info::Language.  Adjust all
6477         uses accordingly.
6478         (class Lazy_demangler): Remove.
6479         (struct Version_expression): Change language from std::string to
6480         Version_script_info::Language.
6481         (Version_script_info::Version_script_info): New function.
6482         (Version_script_info::~Version_script_info): Don't call clear.
6483         (Version_script_info::finalize): New function.
6484         (Version_script_info::build_lookup_tables): New function.
6485         (Version_script_info::build_expression_list_lookup): New
6486         function.
6487         (Version_script_info::get_symbol_version_helper): Rewrite to use
6488         lookup tables.
6489         (Version_script_info::print_expression_list): Adjust to use
6490         Version_script_info::Language.
6491         (script_push_lex_into_version_mode): Check that the version script
6492         has not been finalized.
6493         (version_script_push_lang): Change language string to
6494         Version_script_info::Language.
6495         * options.cc (Command_line::version_script): New function.
6496         * options.h (class General_options): Add finalize_dynamic_list
6497         function.  Change version_script from declaration to definition.
6498         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6499         * testsuite/version_script.map: Remove duplicate def of foo.
6500         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6501         version_script.map.
6502         * testsuite/Makefile.in: Rebuild.
6503
6504 2009-12-30  Ian Lance Taylor  <iant@google.com>
6505
6506         PR 10843
6507         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6508         if the input symbol index is 0, make the output symbol index 0.
6509
6510 2009-12-30  Ian Lance Taylor  <iant@google.com>
6511
6512         PR 10670
6513         * options.h (class General_options): Add -x/--discard-all.
6514         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6515         --discard-all.  If the local symbol needs a dynamic entry, check
6516         that before handling --discard-locals.
6517
6518 2009-12-30  Ian Lance Taylor  <iant@google.com>
6519
6520         PR 10450
6521         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6522         flags to PF_R.
6523         (Output_segment::add_output_section): Don't change the flags if
6524         the type is PT_TLS.
6525
6526         PR 10450
6527         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6528         GNU hash table if they need a dynamic value.  Otherwise, don't add
6529         them if they are defined in a dynamic object or are forced local.
6530
6531 2009-12-29  Ian Lance Taylor  <iant@google.com>
6532
6533         PR 10450
6534         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6535         .gnu.hash table for a 32-bit target.
6536
6537         PR 10450
6538         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6539         regular and a dynamic object only needs a dynamic symbol table
6540         entry if it is externally visible.
6541
6542         PR 10450
6543         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6544         constructor.  Add global_offset_table_ field.
6545         (Target_i386::got_section): Set global_offset_table_.
6546         (Target_i386::do_finalize_sections): Set global_offset_table_
6547         size.
6548         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6549         in constructor.  Add global_offset_table_ field.
6550         (Target_x86_64::got_section): Set global_offset_table_.
6551         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6552         size.
6553
6554         * layout.cc (Layout::Layout): Initialize increase_relro_.
6555         (Layout::get_output_section): Add is_relro, is_last_relro, and
6556         is_first_non_relro parameters.  Change all callers.
6557         (Layout::choose_output_section): Likewise.
6558         (Layout::add_output_section_data): Likewise.
6559         (Layout::make_output_section): Likewise.
6560         (Layout::set_segment_offsets): Clear increase_relro when using a
6561         linker script.
6562         * layout.h (class Layout): Add increase_relro method.  Add
6563         increase_relro_ field.  Update declarations.
6564         * output.cc (Output_section::Output_section): Initialize
6565         is_last_relro_ and is_first_non_relro_.
6566         (Output_segment::add_output_section): Group relro sections is
6567         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6568         (Output_segment::maximum_alignment): Remove relro handling.
6569         (Output_segment::set_section_addresses): Add increase_relro
6570         parameter.  Change all callers.  Add initial alignment to align
6571         relro sections on separate page.  Remove old relro handling.
6572         (Output_segment::set_section_list_addresses): Remove in_relro
6573         parameter.  Change all callers.
6574         (Output_segment::set_offset): Add increase parameter.  Change all
6575         callers.  Remove old relro handling.
6576         * output.h (class Output_section): Add new methods: is_last_relro,
6577         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6578         Add is_last_relro_ and is_first_non_relro_ fields.
6579         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6580         Create separate .got.plt section.  Call increase_relro.
6581         * x86_64.cc (Target_x86_64::got_section): Likewise.
6582         * testsuite/relro_script_test.t: Add .got.plt.
6583
6584         PR 10450
6585         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6586         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6587         (Layout::finalize): Call set_dynamic_symbol_size.
6588         (Layout::set_dynamic_symbol_size): New function.
6589         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6590         set_dynamic_symbol_size.
6591
6592         PR 10450
6593         * output.h (class Output_section): Add is_entsize_zero_ field.
6594         * output.cc (Output_section::Output_section): Initialize
6595         is_entsize_zero_.
6596         (Output_section::set_entsize): If two different entsizes are
6597         requested, force it to zero.
6598         (Output_section::add_input_section): Set flags for .debug_str
6599         before updating section flags.  Set entsize.
6600         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6601         and SHF_STRING if all input sections have those flags.
6602
6603 2009-12-29   Rafael Espindola  <espindola@google.com>
6604
6605         * main.cc (main): Fix the sys time reporting.
6606         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6607         reporting.
6608
6609 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6610
6611         * options.cc (General_options::parse_version): Allow -v to exit
6612         without an error if there is nothing to link.
6613
6614 2009-12-29  Ian Lance Taylor  <iant@google.com>
6615
6616         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6617         using a version of gcc before 4.1.
6618         * configure: Rebuild.
6619
6620 2009-12-28  Chris Demetriou  <cgd@google.com>
6621
6622         * attributes.cc (Output_attributes_section_data::do_write): Use
6623         std::vector::front rather than std::vector::data.
6624
6625 2009-12-28  Ian Lance Taylor  <iant@google.com>
6626
6627         * symtab.h (class Symbol_table): Add enum Defined.
6628         * resolve.cc (Symbol_table::should_override): Add defined
6629         parameter.  Change all callers.  Test whether object is NULL
6630         before calling a method on it.
6631         (Symbol_table::report_resolve_problem): Add defined parameter.
6632         Change all callers.
6633         (Symbol_table::should_override_with_special): Likewise.
6634         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6635         parameter.  Change all callers.
6636         (Symbol_table::do_define_in_output_data): Likewise.
6637         (Symbol_table::define_in_output_segment): Likewise.
6638         (Symbol_table::do_define_in_output_segment): Likewise.
6639         (Symbol_table::define_as_constant): Likewise.
6640         (Symbol_table::do_define_as_constant): Likewise.
6641         * script.h (class Symbol_assignment): Add is_defsym parameter to
6642         constructor; change all callers.
6643         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6644         parameter.  Change all callers.  Add is_defsym_ field.
6645         (class Parser_closure): Add parsing_defsym parameter to
6646         constructor; change all callers.  Add parsing_defsym accessor
6647         function.  Add parsing_defsym_ field.
6648
6649 2009-12-28  Ian Lance Taylor  <iant@google.com>
6650
6651         * gold.cc (queue_middle_tasks): Fix formatting.
6652         * object.cc (Relobj::is_section_name_included): Likewise.
6653
6654 2009-12-23  Ian Lance Taylor  <iant@google.com>
6655
6656         * i386.cc (Target_i386::do_calls_non_split): Recognize
6657         -fsplit-stack prologue for a function with a static chain.
6658         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6659         -fsplit-stack prologue when using %r11.
6660
6661 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6662
6663         * options.cc (General_options::parse_version): Make -v continue and do
6664         the link like GNU ld does.
6665
6666 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6667
6668         * Makefile.am (CCFILES): Add timer.cc.
6669         (HFILES): Add timer.h.
6670         * configure.ac: Check for sysconf and times.
6671         * main.cc: include timer.h.
6672         (main): Use Timer instead of get_run_time.
6673         * timer.cc: New.
6674         * timer.h: New.
6675         * workqueue.cc: include timer.h.
6676         (Workqueue::find_and_run_task):
6677         Report user, sys and wall time.
6678         * Makefile.in: Regenerate.
6679         * config.in: Regenerate.
6680         * configure: Regenerate.
6681
6682 2009-12-16  Doug Kwan  <dougkwan@google.com>
6683
6684         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6685         sections.
6686         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6687         relaxed input sections.
6688         * output.cc (Output_section::find_relaxed_input_section): Change
6689         return type to Output_relaxed_input_section pointer.  Adjust code
6690         for new type of relaxed_input_section_map_.
6691         * output.h (Output_section::find_relaxed_input_section): Change
6692         return type to Output_relaxed_input_section pointer.
6693         (Output_section::Output_relaxed_input_section_by_input_section_map):
6694         New type.
6695         (Output_section::relaxed_input_section_map_): Change type to
6696         Output_section::Output_relaxed_input_section_by_input_section_map.
6697         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6698         input section.
6699
6700 2009-12-15  Ian Lance Taylor  <iant@google.com>
6701
6702         * layout.cc (Layout::create_shstrtab): Only write out after input
6703         sections if we are compressing debug sections.
6704
6705 2009-12-15  Ian Lance Taylor  <iant@google.com>
6706
6707         * archive.cc (Archive::add_symbols): Only look up a symbol without
6708         a version if there is, in fact, a version.
6709
6710 2009-12-14  Ian Lance Taylor  <iant@google.com>
6711
6712         Revert -Wshadow changes, all changes from:
6713         2009-12-11  Doug Kwan  <dougkwan@google.com>
6714         2009-12-11  Nick Clifton  <nickc@redhat.com>
6715         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6716
6717 2009-12-11  Doug Kwan  <dougkwan@google.com>
6718
6719         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6720         due to -Wshadow.
6721         * attributes.cc (Object_attribute::size): Ditto.
6722         (Attributes_section_data::size): Ditto.
6723         (Attributes_section_data::Attributes_section_data): Ditto.
6724         (Output_attributes_section_data::do_write): Ditto.
6725         * attributes.h (Object_attribute::set_type): Ditto.
6726         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6727
6728 2009-12-11  Nick Clifton  <nickc@redhat.com>
6729
6730         * archive.cc: Fix shadowed variable warnings.
6731         * arm.cc: Likewise.
6732         * compressed_output.cc: Likewise.
6733         * compressed_output.h: Likewise.
6734         * configure: Likewise.
6735         * dwarf_reader.cc: Likewise.
6736         * dynobj.cc: Likewise.
6737         * dynobj.h: Likewise.
6738         * ehframe.cc: Likewise.
6739         * ehframe.h: Likewise.
6740         * errors.cc: Likewise.
6741         * expression.cc: Likewise.
6742         * fileread.cc: Likewise.
6743         * fileread.h: Likewise.
6744         * freebsd.h: Likewise.
6745         * i386.cc: Likewise.
6746         * icf.cc: Likewise.
6747         * incremental.h: Likewise.
6748         * layout.cc: Likewise.
6749         * layout.h: Likewise.
6750         * mapfile.cc: Likewise.
6751         * merge.cc: Likewise.
6752         * merge.h: Likewise.
6753         * object.cc: Likewise.
6754         * object.h: Likewise.
6755         * options.h: Likewise.
6756         * output.cc: Likewise.
6757         * output.h: Likewise.
6758         * parameters.cc: Likewise.
6759         * plugin.cc: Likewise.
6760         * powerpc.cc: Likewise.
6761         * reduced_debug_output.cc: Likewise.
6762         * reduced_debug_output.h: Likewise.
6763         * reloc.cc: Likewise.
6764         * reloc.h: Likewise.
6765         * resolve.cc: Likewise.
6766         * script-sections.cc: Likewise.
6767         * script.cc: Likewise.
6768         * script.h: Likewise.
6769         * sparc.cc: Likewise.
6770         * symtab.cc: Likewise.
6771         * symtab.h: Likewise.
6772         * target-select.cc: Likewise.
6773         * target-select.h: Likewise.
6774         * token.h: Likewise.
6775         * workqueue.cc: Likewise.
6776         * workqueue.h: Likewise.
6777         * x86_64.cc: Likewise.
6778
6779 2009-12-10  Doug Kwan  <dougkwan@google.com>
6780
6781         * arm.cc (attributes.h): New include.
6782         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6783         (Arm_relobj::~Arm_relobj): Delete object pointed by
6784         attributes_section_data_.
6785         (Arm_relobj::attributes_section_data): New method definition.
6786         (Arm_relobj::attributes_section_data_): New data member declaration.
6787         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6788         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6789         attributes_section_data_.
6790         (Arm_dynobj::attributes_section_data): New method definition.
6791         (Arm_dynobj::attributes_section_data_): New data member declaration.
6792         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6793         initialization value of may_use_blx_ to false.
6794         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6795         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6796         object attributes to compute results instead of hard-coding.
6797         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6798         Target_arm::get_secondary_compatible_arch,
6799         Target_arm::set_secondary_compatible_arch
6800         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6801         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6802         New method declarations.
6803         (Target_arm::get_aeabi_object_attribute): New method definition.
6804         (Target_arm::attributes_section_data_): New data member declaration.
6805         (read_arm_attributes_section): New template definition.
6806         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6807         (Arm_dynobj::do_read_symbols): Ditto.
6808         (Target_arm::do_finalize_sections): Merge attributes sections from
6809         input.  Check for BLX use after attributes section merging.
6810         Fix __exidx_start and __exidx_end visibility.  Create an
6811         .ARM.attributes section if necessary.
6812         (Target_arm::get_secondary_compatible_arch,
6813         Target_arm::set_secondary_compatible_arch,
6814         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6815         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6816         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6817         New method definitions.
6818
6819 2009-12-09  Ian Lance Taylor  <iant@google.com>
6820
6821         * plugin.cc (Plugin::load): Don't cast from void* to a function
6822         pointer.
6823
6824 2009-12-09  Ian Lance Taylor  <iant@google.com>
6825
6826         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6827         information fields.
6828
6829 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6830
6831         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6832         Replace two_file_shared_1.so with two_file_shared_2.so.
6833         * testsuite/Makefile.in: Regenerated.
6834
6835 2009-12-08  Doug Kwan  <dougkwan@google.com>
6836
6837         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6838         (HFILES): Add attributes.h and int_encoding.h.
6839         * Makefile.in: Regenerate.
6840         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6841         function definitions to int_encoding.cc
6842         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6843         prototypes to int_encoding.h
6844         * reduced_debug_output.cc (int_encoding.h): New include.
6845         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6846         function definitions to int_encoding.cc
6847         (insert_into_vector, read_from_pointer): Move template definitions to
6848         int_encoding.h
6849         * attributes.cc: New file.
6850         * attributes.h: New file.
6851         * int_encoding.cc: New file.
6852         * int_encoding.h: New file.
6853
6854 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6855
6856         PR gold/11055
6857         * incremental-dump.cc (dump_incremental_inputs): New.
6858         (main): Use dump_incremental_inputs.
6859
6860 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6861
6862         PR gold/10893
6863         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6864         checking elfcpp::STT_FUNC.
6865         (Target_i386::Relocate::relocate): Likewise.
6866         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6867
6868         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6869         symbols from shared libraries into normal FUNC symbols.
6870
6871         * symtab.h (Symbol): Add is_func and use it.
6872
6873 2009-12-05  Doug Kwan  <dougkwan@google.com>
6874
6875         * arm.cc (Target_arm::arm_info): Initialize new fields
6876         attributes_section and attributes_vendor.
6877         * i386.cc (Target_i386::i386_info): Same.
6878         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6879         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6880         fields attributes_section and attributes_vendor.
6881         * sparc.cc (Target_sparc::sparc_info): Same.
6882         * target.h (Target::attributes_section, Target::attributes_vendor,
6883         Target::is_attributes_section, Target::attribute_arg_type,
6884         Target::attributes_order): New method definitions.
6885         (Target::Target_info::attributes_section,
6886         Target::Target_info::attributes_vendor): New fields.
6887         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6888         virtual method definitions.
6889         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6890         attributes_section and attributes_vendor.
6891         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6892
6893 2009-12-05  Doug Kwan  <dougkwan@google.com>
6894
6895         * arm.cc: Update comments about interworking and stub generation.
6896         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6897         considered as non-PIC.
6898         (Arm_relocate_functions::base_abs): Fix formatting.
6899         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6900         of function to use GOT entry address instead of offset.
6901         (Target_arm::Scan::global): Issue an error if a symbol would need a
6902         PLT does not get one because it is untyped.  Remove code to create
6903         dynamic symbols for relative branches.
6904         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6905         takes unsigned integer instead of boolean.
6906
6907 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6908
6909         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6910         (two_file_test_LDADD): Likewise.
6911         (common_test_1_LDADD): Likewise.
6912         (exception_test_LDADD) Likewise.
6913         (weak_test_LDADD): Likewise.
6914         (many_sections_test_LDADD): Likewise.
6915         (initpri1_LDADD): Likewise.
6916         (script_test_1_LDADD): Likewise.
6917         (script_test_2_LDADD): Likewise.
6918         (justsyms_LDADD): Likewise.
6919         (binary_test_LDADD): Likewise.
6920         (large_LDADD): Likewise.
6921         * testsuite/Makefile.in: Regenerated.
6922
6923 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6924
6925         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6926         (Symbol_table::override_with_special): Likewise.
6927         (Symbol_table::add_from_object): Likewise.
6928
6929 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6930
6931         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6932         Don't set the data_offset twice.
6933
6934 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6935
6936         * testsuite/Makefile.in: Regenerate.
6937
6938 2009-12-03  Doug Kwan  <dougkwan@google.com>
6939
6940         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6941         (Target_arm::do_finalize_sections): Add parameter for symbol table
6942         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6943         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6944         parameter for symbol table pointer.
6945         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6946         an additional parameter for a pointer to symbol table.
6947         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6948         parameter for a symbol table pointer.
6949         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6950         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6951         Ditto.
6952         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6953         parameter for a symbol table pointer.
6954
6955 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6956
6957         * incremental.cc (Incremental_inputs_header)
6958         (Incremental_inputs_header_write, Incremental_inputs_entry)
6959         (Incremental_inputs_entry_write): Move ...
6960         * incremental.h (Incremental_inputs_header)
6961         (Incremental_inputs_header_write, Incremental_inputs_entry)
6962         (Incremental_inputs_entry_write): here.
6963
6964 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6965
6966         * incremental.cc (make_sized_incremental_binary): Set the target.
6967         Error if it is incompatible.
6968         * output.h (Output_file): Add filename method.
6969
6970 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6971
6972         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6973         from the get_* methods.
6974
6975 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6976
6977         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6978         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6979         Write 0 for the data_offset of scripts.
6980
6981 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6982
6983         * testsuite/Makefile.am: Add the incremental_test.sh test.
6984         * testsuite/incremental_test.sh: New.
6985         * testsuite/incremental_test_1.c: New.
6986         * testsuite/incremental_test_2.c: New.
6987
6988 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6989
6990        * incremental-dump.cc (main): Fix typos.
6991
6992 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6993
6994         PR gold/11025
6995         * incremental-dump.cc (main): Use llu to print 64 bit values.
6996
6997 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6998             H.J. Lu  <hongjiu.lu@intel.com>
6999
7000         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7001         $(LIBDL).
7002         (incremental_dump_LDADD): Likewise.
7003         * Makefile.in: Regenerated.
7004
7005 2009-11-25  Doug Kwan  <dougkwan@google.com>
7006
7007         Revert:
7008
7009         2009-11-25  Doug Kwan  <dougkwan@google.com>
7010
7011                 * arm.cc (Target_arm::Target_arm): Move method definition
7012                 outside of class definition.  Add code to handle
7013                 --target1-rel, --target1-abs and --target2= options.
7014                 (Target_arm::get_reloc_reloc_type): Change method to be
7015                 non-static and const.
7016                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7017                 New data member declaration.
7018                 (Target_arm::Scan::local, Target_arm::Scan::global,
7019                 Target_arm::Relocate::relocate,
7020                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7021                 Adjust call to Target_arm::get_real_reloc_type.
7022                 (Target_arm::get_real_reloc_type): Use command line options
7023                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7024                 * options.h (--target1-rel, --target1-abs, --target2): New
7025                 ARM-only options.
7026
7027 2009-11-25  Doug Kwan  <dougkwan@google.com>
7028
7029         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7030         class definition.  Add code to handle --target1-rel, --target1-abs
7031         and --target2= options.
7032         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7033         and const.
7034         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7035         member declaration.
7036         (Target_arm::Scan::local, Target_arm::Scan::global,
7037         Target_arm::Relocate::relocate,
7038         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7039         call to Target_arm::get_real_reloc_type.
7040         (Target_arm::get_real_reloc_type): Use command line options to
7041         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7042         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7043         options.
7044
7045 2009-11-25  Doug Kwan  <dougkwan@google.com>
7046
7047         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7048         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7049         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7050         formatting.
7051         (Arm_relocate_functions::thm_call): Replace body with a call to
7052         Arm_relocate_functions::thumb_branch_common.
7053         (Arm_relocate_functions::thm_jump24,
7054         Arm_relocate_functions::thm_xpc22): New method definitions.
7055         (Arm_relocate_functions::thumb_branch_common): New method definition.
7056         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7057         operator.
7058         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7059         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7060
7061 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7062
7063         * Makefile.am: Build incremental-dump
7064         * Makefile.in: Regenerate.
7065         * incremental-dump.cc: New.
7066         * incremental.cc (Incremental_inputs_header_data,
7067         Incremental_inputs_entry_data): Move to incremental.h
7068         * incremental.h: (Incremental_inputs_header_data,
7069         Incremental_inputs_entry_data): Move from incremental.cc
7070
7071 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7072
7073         * incremental.cc (Incremental_inputs_header,
7074         Incremental_inputs_header_write, Incremental_inputs_entry,
7075         Incremental_inputs_entry_write): Add a typedef with the data type.
7076
7077 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7078
7079         * incremental.cc (Incremental_inputs_header,
7080         Incremental_inputs_header_write, Incremental_inputs_entry,
7081         Incremental_inputs_entry_write): Update comment about which
7082         type has the filed descriptions.
7083
7084 2009-11-15  Doug Kwan  <dougkwan@google.com>
7085
7086         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7087         (Arm_relocate_functions::arm_branch_common): Change method defintion
7088         in class definition to a method declaration and update list of formal
7089         parameters.
7090         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7091         Arm_relocation_functions::jump24): Adjust call to
7092         Arm_relocate_functions::arm_branch_common.  Update list of formal
7093         parameters.
7094         (Arm_relocate_functions::xpc25): New method definition.
7095         (Arm_relocate_functions::arm_branch_common): Move method defintion
7096         out from class definition.  Use stubs for mode-switching and extending
7097         branch ranges.
7098         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7099         specially.  Change code to enable use of stubs in ARM branches.
7100
7101 2009-11-10  Doug Kwan  <dougkwan@google.com>
7102
7103         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7104         in method declaration.
7105         (Target_arm::relocate_stub): New method declaration.
7106         (Target_arm::default_target): Change to return a pointer instead of
7107         a const reference.
7108         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7109         Target_arm::default_target.
7110         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7111         method definition.
7112         (Target_arm::relocate_section): Adjust view.
7113         (Target_arm::relocate_stub): New method definition.
7114
7115 2009-11-10  Doug Kwan  <dougkwan@google.com>
7116
7117         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7118         a format warning.
7119         * incremental.cc (open_incremental_binary): Initialized local
7120         variables to avoid warnings.
7121         * object.cc (make_elf_object): Ditto.
7122         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7123         a format warning.
7124
7125 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7126
7127         PR gold/10930
7128         * testsuite/plugin_test.c: Include "config.h".
7129
7130 2009-11-09  Doug Kwan  <dougkwan@google.com>
7131
7132         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7133         (arm_symbol_value): Remove.
7134         (Arm_relocate_functions::arm_branch_common,
7135         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7136         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7137         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7138         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7139         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7140         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7141         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7142         Arm_relocate_functions::thm_mobw_abs_nc,
7143         Arm_relocate_functions::thm_mov_abs,
7144         Arm_relocate_functions::movw_prel_nc,
7145         Arm_relocate_functions::thm_movt_abs,
7146         Arm_relocate_functions::movt_prel,
7147         Arm_relocate_functions::thm_movw_prel_nc,
7148         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7149         (Target_arm::Relocate::relocate): Only decompose address into two
7150         parts if relocation type uses the thumb-bit and pass the actual
7151         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7152         calls to methods in Arm_relocate_functions for this change.
7153
7154 2009-11-08  Ian Lance Taylor  <iant@google.com>
7155
7156         PR 10925
7157         * reloc.cc: Instantiate
7158         Sized_relobj::initialize_input_to_output_maps and
7159         Sized_relobj:free_input_to_output_maps.
7160
7161 2009-11-06  Ian Lance Taylor  <iant@google.com>
7162
7163         PR 10876
7164         * defstd.cc (in_segment): Set only_if_ref true for "end".
7165
7166 2009-11-06  Doug Kwan  <dougkwan@google.com>
7167
7168         * arm.cc (class Reloc_stub): Correct a comment.
7169         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7170         (Target_arm::scan_section_for_stubs): New method declaration.
7171         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7172         Change methods from private to protected.
7173         (Target_arm::do_may_relax): New method definition.
7174         (Target_arm::do_relax, Target_arm::group_sections,
7175         Target_arm::scan_reloc_for_stub,
7176         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7177         (Target_arm::arm_input_section_map_): New data member declaration.
7178         (Target_arm::scan_reloc_for_stub,
7179         Target_arm::scan_reloc_section_for_stubs,
7180         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7181         Target_arm::do_relax): New method definitions.
7182
7183 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7184
7185         * configure.ac: Check for (struct stat)::st_mtim
7186         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7187         * config.in: Regenerate.
7188         * configure: Regenerate.
7189
7190 2009-11-05  Ian Lance Taylor  <iant@google.com>
7191
7192         PR 10910
7193         * output.cc (Output_segment::add_output_section): Add missing
7194         return statement.
7195
7196 2009-11-04  Ian Lance Taylor  <iant@google.com>
7197
7198         PR 10880
7199         * object.h (class Object): Add is_needed and set_is_needed
7200         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7201         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7202         defined in a dynamic object and referenced by a regular object,
7203         set is_needed for the dynamic object.
7204         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7205         if the file is marked with as_needed and it is not needed.
7206
7207 2009-11-04  Ian Lance Taylor  <iant@google.com>
7208
7209         PR 10887
7210         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7211         tags if data is discarded by linker script.
7212         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7213         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7214         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7215         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7216
7217 2009-11-04  Ian Lance Taylor  <iant@google.com>
7218
7219         * layout.cc (Layout::get_output_section): Add is_interp and
7220         is_dynamic_linker_section parameters.  Change all callers.
7221         (Layout::choose_output_section): Likewise.
7222         (Layout::make_output_section): Likewise.
7223         (Layout::add_output_section_data): Add is_dynamic_linker_section
7224         parameter.  Change all callers.
7225         * layout.h (class Layout): Update declarations.
7226         * output.h (class Output_section): Add is_interp, set_is_interp,
7227         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7228         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7229         generate_code_fills_at_write_ to a bitfield.
7230         * output.cc (Output_section::Output_sections): Initialize new
7231         fields.
7232         (Output_segment::add_output_section): Add do_sort parameter.
7233         Change all callers.
7234
7235 2009-11-03  Ian Lance Taylor  <iant@google.com>
7236
7237         PR 10860
7238         * options.h (class General_options): Add --warn-common.
7239         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7240         merging two common symbols.
7241         (Symbol_table::should_override): Handle --warn-common when merging
7242         a common symbol with a defined symbol.  Use report_resolve_problem
7243         for multiple definitions.
7244         (Symbol_table::report_resolve_problem): New function.
7245         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7246
7247 2009-11-03  Doug Kwan  <dougkwan@google.com>
7248
7249         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7250         stub_factory_.
7251         (Target_arm::stub_factory): New method definition.
7252         (Target_arm::new_arm_input_section,
7253         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7254         Target_arm::reloc_uses_thumb_bit): New method declarations.
7255         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7256         New type definitions.
7257         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7258         member declarations.
7259         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7260         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7261         New method definitions.
7262
7263 2009-11-03  Ian Lance Taylor  <iant@google.com>
7264
7265         * options.h (class General_options): Add --warn_constructors.
7266
7267 2009-11-03  Ian Lance Taylor  <iant@google.com>
7268
7269         PR 10893
7270         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7271         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7272
7273 2009-11-03  Ian Lance Taylor  <iant@google.com>
7274
7275         PR 10895
7276         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7277         --msgid-bugs-address.
7278         (install-pdf): New target.
7279         (install-data_yes): Look up one directory to find mkinstalldirs.
7280
7281 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7282
7283         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7284         tree.
7285
7286 2009-10-30  Doug Kwan  <dougkwan@google.com>
7287
7288         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7289
7290 2009-10-30  Doug Kwan  <dougkwan@google.com>
7291
7292         * arm.cc (Stub_addend_reader): New struct template definition
7293         and partial specializations.
7294         (Stub_addend_reader::operator()): New method definition for a
7295         partially specialized template.
7296
7297 2009-10-30  Doug Kwan  <dougkwan@google.com>
7298
7299         * arm.cc (Arm_relobj::processor_specific_flags): New method
7300         definition.
7301         (Arm_relobj::do_read_symbols): New method declaration.
7302         (Arm_relobj::processor_specific_flags_): New data member declaration.
7303         (Arm_dynobj): New class definition.
7304         (Target_arm::do_finalize_sections): Add input_objects parameter.
7305         (Target_arm::do_adjust_elf_header): New method declaration.
7306         (Target_arm::are_eabi_versions_compatible,
7307         (Target_arm::merge_processor_specific_flags): New method declaration.
7308         (Target_arm::do_make_elf_object): New overloaded method definitions
7309         and declaration.
7310         (Arm_relobj::do_read_symbols): New method definition.
7311         (Arm_dynobj::do_read_symbols): Ditto.
7312         (Target_arm::do_finalize_sections): Add input_objects parameters.
7313         Merge processor-specific flags from all input objects.
7314         (Target_arm::are_eabi_versions_compatible,
7315         Target_arm::merge_processor_specific_flags,
7316         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7317         New method definitions.
7318         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7319         Input_objects pointer type parameter.
7320         * layout.cc (Layout::finalize): Pass input objects to target's.
7321         finalize_sections function.
7322         * output.cc (Output_file_header::do_sized_write): Set ELF file
7323         header's processor-specific flags.
7324         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7325         Input_objects pointer type parameter.
7326         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7327         * target.h (Input_objects): New forward class declaration.
7328         (Target::processor_specific_flags,
7329         Target::are_processor_specific_flags_sect): New method definitions.
7330         (Target::finalize_sections): Add input_objects parameter.
7331         (Target::Target): Initialize processor_specific_flags_ and
7332         are_processor_specific_flags_set_.
7333         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7334         parameter.
7335         (Target::set_processor_specific_flags): New method definition.
7336         (Target::processor_specific_flags_,
7337         Target::are_processor_specific_flags_set_): New data member
7338         declarations.
7339         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7340         Input_objects pointer type parameter.
7341
7342 2009-10-30  Doug Kwan  <dougkwan@google.com>
7343
7344         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7345
7346 2009-10-28  Ian Lance Taylor  <iant@google.com>
7347
7348         * object.h (class Relobj): Drop options parameter from
7349         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7350         do_scan_relocs, do_relocate.  Change all callers.
7351         (class Sized_relobj): Drop options parameters from
7352         do_gc_process_relocs, do_scan_relocs, do_relocate,
7353         do_relocate_sections, relocate_sections, emit_relocs_scan,
7354         emit_relocs_scan_reltype.  Change all callers.
7355         (struct Relocate_info): Remove options field and all references to
7356         it.
7357         * reloc.h (class Read_relocs): Remove options constructor
7358         parameter and options_ field.  Change all callers.
7359         (class Gc_process_relocs, class Scan_relocs): Likewise.
7360         (class Relocate_task): Likewise.
7361         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7362         all callers.
7363         (scan_relocatable_relocs): Likewise.
7364         * target.h (class Sized_target): Remove options parameter from
7365         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7366         all callers.
7367         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7368         callers.
7369         * arm.cc: Update functions to remove options parameters.
7370         * i386.cc: Likewise.
7371         * powerpc.cc: Likewise.
7372         * sparc.cc: Likewise.
7373         * x86_64.cc: Likewise.
7374         * testsuite/testfile.cc: Likewise.
7375
7376 2009-10-28  Doug Kwan  <dougkwan@google.com>
7377
7378         * arm.cc (Arm_relobj): New class definition.
7379         (Arm_relobj::scan_sections_for_stubs,
7380         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7381         New method definitions.
7382
7383 2009-10-28  Cary Coutant  <ccoutant@google.com>
7384
7385         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7386         (Plugin::cleanup_done_): New member.
7387         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7388         (Plugin_manager::cleanup_done_): Remove.
7389         (Plugin_manager::add_input_file): Edit error message.
7390         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7391         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7392
7393 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7394
7395         * fileread.cc: (File_read::View::~View): Use the new
7396         data_ownership_ filed.
7397         (File_read::~File_read): Dispose the new whole_file_view_.
7398         (File_read::open): Mmap the whole file if needed.
7399         (File_read::open): Use whole_file_view_ instead of contents_.
7400         (File_read::find_view): Use whole_file_view_ if applicable.
7401         (File_read::do_read): Use whole_file_view_ instead of contents_.
7402         (File_read::make_view): Use whole_file_view_ instead of contents_,
7403         update File_read::View::View call.
7404         (File_read::find_or_make_view): Update File_read::View::View
7405         call.
7406         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7407         remove contents_
7408         (File_read::View::Data_ownership): New enum.
7409         (File_read::View::View): Replace bool mapped_ with Data_ownership
7410         argument.
7411         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7412         (File_read::View::data_ownership_): New field.
7413         (File_read::contents_): Remove (replaced by whole_file_view_).
7414         (File_read::whole_file_view_): New field.
7415         * options.h (class General_options): Add --keep-files-mapped.
7416
7417 2009-10-27  Cary Coutant  <ccoutant@google.com>
7418
7419         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7420         * testsuite/Makefile.am (plugin_test_5): New test case.
7421         * testsuite/Makefile.in: Regenerate.
7422
7423 2009-10-25  Doug Kwan  <dougkwan@google.com>
7424
7425         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7426         from private to protected to allow access by child class.
7427         (Sized_relobj::do_relocate_sections): New method declaration.
7428         (Sized_relobj::relocate_sections): Virtualize.
7429         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7430         Sized_relobj::relocate_sections.  Instantiate template explicitly
7431         for different target sizes and endianity.
7432
7433 2009-10-24  Doug Kwan  <dougkwan@google.com>
7434
7435         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7436         (Arm_input_section::as_arm_input_section): New method.
7437         (Arm_output_section): New class definition.
7438         (Arm_output_section::create_stub_group,
7439         Arm_output_section::group_sections): New method definitions.
7440
7441 2009-10-22  Doug Kwan  <dougkwan@google.com>
7442
7443         * arm.cc (Arm_input_section): New class definition.
7444         (Arm_input_section::init, Arm_input_section:do_write,
7445         Arm_input_section::set_final_data_size,
7446         Arm_input_section::do_reset_address_and_file_offset): New method
7447         definitions.
7448
7449 2009-10-21  Doug Kwan  <dougkwan@google.com>
7450
7451         * arm.cc (Stub_table, Arm_input_section): New forward class
7452         declarations.
7453         (Stub_table): New class defintion.
7454         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7455         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7456         New method definition.
7457
7458 2009-10-21  Doug Kwan  <dougkwan@google.com>
7459
7460         * arm.cc: Update copyright comments.
7461         (Target_arm): New forward class template declaration.
7462         (Arm_address): New type.
7463         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7464         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7465         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7466         constants.
7467         (Insn_template): Same.
7468         (DEF_STUBS): New macro.
7469         (Stub_type): New enum type.
7470         (Stub_template): New class definition.
7471         (Stub): Same.
7472         (Reloc_stub): Same.
7473         (Stub_factory): Same.
7474         (Target_arm::Target_arm): Initialize may_use_blx_ and
7475         should_force_pic_veneer_.
7476         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7477         Target_arm::should_force_pic_veneer,
7478         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7479         Target_arm::using_thumb_only, Target_arm:;default_target): New
7480         method defintions.
7481         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7482         New data member declarations.
7483         (Insn_template::size, Insn_template::alignment): New method defintions.
7484         (Stub_template::Stub_template): New method definition.
7485         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7486         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7487         (Stub_factory::Stub_factory): New method definition.
7488         * gold.h (string_hash): New template.
7489         * output.h (Input_section_specifier::hash_value): Use
7490         gold::string_hash.
7491         (Input_section_specifier::string_hash): Remove.
7492         * stringpool.cc (Stringpool_template::string_hash): Use
7493         gold::string_hash.
7494
7495 2009-10-20  Doug Kwan  <dougkwan@google.com>
7496
7497         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7498         symbols of relaxed input sections.
7499         * output.h (Output_section::find_relaxed_input_section): Make
7500         method public.
7501
7502 2009-10-16  Doug Kwan  <dougkwan@google.com>
7503
7504         * dynobj.cc (Versions::Versions): Initialize version_script_.
7505         Only insert base version symbol definition for a shared object
7506         if version script defines any version versions.
7507         (Versions::define_base_version): New method definition.
7508         (Versions::add_def): Check that base version is not needed.
7509         (Versions::add_need): Define base version lazily.
7510         * dynobj.h (Versions::define_base_version): New method declaration.
7511         (Versions::needs_base_version_): New data member declaration.
7512         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7513         (check_DATA): Add no_version_test.stdout.
7514         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7515         New make rules.
7516         * testsuite/Makefile.in: Regenerate.
7517         * testsuite/no_version_test.c: New file.
7518         * testsuite/no_version_test.sh: Ditto.
7519
7520 2009-10-16  Doug Kwan  <dougkwan@google.com>
7521
7522         * expression.cc (class Segment_start_expression): New class definition.
7523         (Segment_start_expression::value): New method definition.
7524         (script_exp_function_segment_start): Return a new
7525         Segment_start_expression.
7526         * gold/script-c.h (script_saw_segment_start_expression): New function
7527         prototype.
7528         * script-sections.cc (Script_sections::Script_sections): Initialize
7529         SAW_SEGMENT_START_EXPRESSION_ to false.
7530         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7531         and -Tbbs options to specify section addresses if given in
7532         command line and no SEGMENT_START expression is seen in a script.
7533         * script-sections.h (Script_sections::saw_segment_start_expression,
7534         Script_sections::set_saw_segment_start_expression): New method
7535         definition.
7536         (Script_sections::saw_segment_start_expression_): New data member
7537         declaration.
7538         * script.cc (script_saw_segment_start_expression): New function.
7539         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7540         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7541         script_test_7.sh and script_test_8.sh.
7542         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7543         script_test_8.stdout.
7544         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7545         (script_test_6, script_test_6.stdout, script_test_7,
7546         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7547         * Makefile.in: Regenerate.
7548         * testsuite/script_test_6.sh: New file.
7549         * testsuite/script_test_6.t: Same.
7550         * testsuite/script_test_7.sh: Same.
7551         * testsuite/script_test_7.t: Same.
7552         * testsuite/script_test_8.sh: Same.
7553
7554 2009-10-16  Doug Kwan  <dougkwan@google.com>
7555
7556         * output.cc (Output_segment::set_section_list_address): Cast
7557         expressions to unsigned long long type to avoid format warnings.
7558
7559 2009-10-15  Ian Lance Taylor  <iant@google.com>
7560
7561         * script.cc (Script_options::add_symbol_assignment): Always add a
7562         dot assignment to script_sections_.
7563         * script-sections.cc (Script_sections::add_dot_assignment):
7564         Initialize if necessary.
7565
7566         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7567         program headers with no load segment if there is a linker script.
7568
7569         * layout.cc (Layout::set_segment_offsets): Align the file offset
7570         to the segment aligment for -N or -n with no load segment.
7571         * output.cc (Output_segment::add_output_section): Don't crash if
7572         the first section is a TLS section.
7573         (Output_segment::set_section_list_addresses): Print an error
7574         message if the address moves backward in a linker script.
7575         * script-sections.cc
7576         (Output_section_element_input::set_section_addresses): Don't
7577         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7578         (Orphan_output_section::set_section_addresses): Likewise.
7579
7580 2009-10-15  Doug Kwan  <dougkwan@google.com>
7581
7582         * layout.cc (Layout::finish_dynamic_section): Generate tags
7583         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7584         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7585         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7586
7587 2009-10-14  Ian Lance Taylor  <iant@google.com>
7588
7589         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7590         fields.
7591         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7592         data_shdr fields of relinfo.
7593         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7594         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7595         R_386_TLS_LDO_32, adjust based on section flags.
7596         (Target_i386::Relocate::fix_up_ldo): Remove.
7597
7598 2009-10-13  Ian Lance Taylor  <iant@google.com>
7599
7600         Add support for -pie.
7601         * options.h (class General_options): Add -pie and
7602         --pic-executable.
7603         (General_options::output_is_position_independent): Test -pie.
7604         (General_options::output_is_executable): Return true if not shared
7605         and not relocatable.
7606         (General_options::output_is_pie): Remove.
7607         * options.cc (General_options::finalize): Reject incompatible uses
7608         of -pie.
7609         * gold.cc (queue_middle_tasks): A -pie link is not static.
7610         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7611         * symtab.cc (Symbol::final_value_is_known): Return false if
7612         output_is_position_independent.
7613         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7614         output_is_position_independent.
7615         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7616         output_is_position_independent.
7617         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7618         output_is_position_independent.
7619         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7620         two_file_pie_test.
7621         (basic_pie_test.o, basic_pie_test): New targets.
7622         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7623         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7624         (two_file_pie_test): New target.
7625         * testsuite/Makefile.in: Rebuild.
7626         * README: Remove note saying that -pie is not supported.
7627
7628 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7629
7630         * options.h (class General_options): Add -init and -fini.
7631         * layout.cc (Layout::finish_dynamic_section): Emit
7632         given init and fini functions.
7633
7634 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7635
7636         * gc.h (gc_process_relocs): Check if icf is enabled using new
7637         function.
7638         * gold.cc (queue_initial_tasks): Likewise.
7639         (queue_middle_tasks): Likewise.
7640         * object.cc (do_layout): Likewise.
7641         * symtab.cc (is_section_folded): Likewise.
7642         * main.cc (main): Likewise.
7643         * reloc.cc (Read_relocs::run): Likewise.
7644         (Sized_relobj::do_scan_relocs): Likewise.
7645         * icf.cc (is_function_ctor_or_dtor): New function.
7646         (Icf::find_identical_sections): Check if function is ctor or dtor when
7647         safe icf is chosen.
7648         * options.h (General_options::icf): Change option to be an enum.
7649         (Icf_status): New enum.
7650         (icf_enabled): New method.
7651         (icf_safe_folding): New method.
7652         (set_icf_status): New method.
7653         (icf_status_): New variable.
7654         * (options.cc) (General_options::finalize): Set icf_status_.
7655         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7656         icf_test and icf_keep_unique_test to use the --icf enum flag.
7657         * testsuite/icf_safe_test.sh: New file.
7658         * testsuite/icf_safe_test.cc: New file.
7659
7660 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7661
7662         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7663         includes to gc.h and icf.h.
7664         * arm.cc: Include gc.h.
7665         * gold.cc: Likewise.
7666         * i386.cc: Likewise.
7667         * powerpc.cc: Likewise.
7668         * sparc.cc: Likewise.
7669         * x86_64.cc: Likewise.
7670         * gc.h: Include icf.h.
7671
7672 2009-10-11  Ian Lance Taylor  <iant@google.com>
7673
7674         * plugin.cc: Include "gold.h" before other header files.
7675
7676 2009-10-10  Chris Demetriou  <cgd@google.com>
7677
7678         * options.h (Input_file_argument::Input_file_type): New enum.
7679         (Input_file_argument::is_lib_): Replace with...
7680         (Input_file_argument::type_): New member.
7681         (Input_file_argument::Input_file_argument): Take Input_file_type
7682         'type' rather than boolean 'is_lib' as second argument.
7683         (Input_file_argument::is_lib): Use type_.
7684         (Input_file_argument::is_searched_file): New function.
7685         (Input_file_argument::may_need_search): Handle is_searched_file.
7686         * options.cc (General_options::parse_library): Support -l:filename.
7687         (General_options::parse_just_symbols): Update for Input_file_argument
7688         changes.
7689         (Command_line::process): Likewise.
7690         * archive.cc (Archive::get_file_and_offset): Likewise.
7691         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7692         * script.cc (read_script_file, script_add_file): Likewise.
7693         * fileread.cc (Input_file::Input_file): Likewise.
7694         (Input_file::will_search_for): Handle is_searched_file.
7695         (Input_file::open): Likewise.
7696         * readsyms.cc (Read_symbols::get_name): Likewise.
7697         * testsuite/Makefile.am (searched_file_test): New test.
7698         * testsuite/Makefile.in: Regenerate.
7699         * testsuite/searched_file_test.cc: New file.
7700         * testsuite/searched_file_test_lib.cc: New file.
7701
7702 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7703             Ian Lance Taylor  <iant@google.com>
7704
7705         * descriptor.cc: Include <cstdio> and "binary-io.h".
7706         (Descriptors::open): Open the files in binary mode always.
7707         * script.cc (Lex::get_token): Treat \r as whitespace.
7708
7709 2009-10-09  Ian Lance Taylor  <iant@google.com>
7710
7711         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7712
7713 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7714             Ian Lance Taylor  <iant@google.com>
7715
7716         * configure.ac: Check for readv function also.
7717         * fileread.cc (readv): Define if not HAVE_READV.
7718         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7719         does not exist.
7720         * config.in: Regenerate.
7721         * configure: Regenerate.
7722
7723 2009-10-09  Doug Kwan  <dougkwan@google.com>
7724
7725         * layout.cc (Layout::make_output_section): Call target hook to make
7726         ordinary output section.
7727         (Layout::finalize): Adjust parameter list of call the
7728         Target::may_relax().
7729         * layout.h (class Layout::section_list): New method.
7730         * merge.h (Output_merge_base::entsize): Change visibility to public.
7731         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7732         New methods.
7733         (Output_merge_string::do_is_string): New method.
7734         * object.cc (Sized_relobj::do_setup): renamed from
7735         Sized_relobj::set_up.
7736         * object.h (Sized_relobj::adjust_shndx,
7737         Sized_relobj::initializ_input_to_output_maps,
7738         Sized_relobj::free_input_to_output_maps): Change visibilities to
7739         protected.
7740         (Sized_relobj::setup): Virtualize.
7741         (Sized_relobj::do_setup): New method declaration.
7742         (Sized_relobj::invalidate_section_offset,
7743         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7744         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7745         * options.cc (parse_int): New function.
7746         * options.h (parse_int): New declaration.
7747         (DEFINE_int): New macro.
7748         (stub_group_size): New option.
7749         * output.cc (Output_section::Output_section): Initialize memebers
7750         merge_section_map_, merge_section_by_properties_map_,
7751         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7752         (Output_section::add_input_section): Handled deferred code-fill
7753         generation and remove an old comment.
7754         (Output_section::add_relaxed_input_section): New method definition.
7755         (Output_section::add_merge_input_section): Use merge section by
7756         properties map to speed to search.  Update merge section maps
7757         as appropriate.
7758         (Output_section::build_relaxation_map): New method definition.
7759         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7760         Same.
7761         (Output_section::relax_input_section): Renamed to
7762         Output_section::convert_input_sections_to_relaxed_sections and change
7763         interface to take a vector of pointers to relaxed sections.
7764         (Output_section::find_merge_section,
7765         Output_section::find_relaxed_input_section): New method definitions.
7766         (Output_section::is_input_address_mapped,
7767         Output_section::output_offset, Output_section::output_address):
7768         Use output section data maps to speed up searching.
7769         (Output_section::find_starting_output_address): Add comments.
7770         (Output_section::do_write,
7771         Output_section::write_to_postprocessing_buffer): Do code-fill
7772         generation as appropriate.
7773         (Output_section::get_input_sections): Invalidate relaxed input section
7774         map.
7775         (Output_section::restore_states): Adjust type of checkpoint .
7776         Invalidate relaxed input section map.
7777         * output.h (Output_merge_base): New class declaration.
7778         (Input_section_specifier): New class defintion.
7779         (class Output_relaxed_input_section) Change base class to
7780         Output_section_data_build.
7781         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7782         base class initializer.
7783         (Output_section::add_relaxed_input_section): New method declaration.
7784         (Output_section::Input_section): Change visibility to protected.
7785         (Output_section::Input_section::relobj,
7786         Output_section::Input_section::shndx): Handle relaxed input sections.
7787         Output_section::input_sections) Change visibility to protected.  Also
7788         define overload to return a non-const pointer.
7789         (Output_section::Merge_section_properties): New class defintion.
7790         (Output_section::Merge_section_by_properties_map,
7791         Output_section::Output_section_data_by_input_section_map,
7792         Output_section::Relaxation_map): New types.
7793         (Output_section::relax_input_section): Rename method to
7794         Output_section::convert_input_sections_to_relaxed_sections and change
7795         interface to take a vector of relaxed section pointers.
7796         (Output_section::find_merge_section,
7797         Output_section::find_relaxed_input_section,
7798         Output_section::build_relaxation_map,
7799         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7800         New method declarations.
7801         (Output_section::merge_section_map_
7802         Output_section::merge_section_by_properties_map_,
7803         Output_section::relaxed_input_section_map_,
7804         Output_section::is_relaxed_input_section_map_valid_,
7805         Output_section::generate_code_fills_at_write_): New data members.
7806         * script-sections.cc
7807         (Output_section_element_input::set_section_addresses): Call
7808         current_data_size and addralign methods of relaxed input sections.
7809         (Orphan_output_section::set_section_addresses): Call current_data_size
7810         and addralign methods of relaxed input sections.
7811         * symtab.cc (Symbol_table::compute_final_value): Extract template
7812         from the body of Symbol_table::sized_finalize_symbol.
7813         (Symbol_table::sized_finalized_symbol): Call
7814         Symbol_table::compute_final_value.
7815         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7816         (Symbol_table::compute_final_value): New templated method declaration.
7817         * target.cc (Target::do_make_output_section): New method defintion.
7818         * target.h (Target::make_output_section): New method declaration.
7819         (Target::relax): Add more parameters for input objects, symbol table
7820         and layout.  Adjust call to do_relax.
7821         (Target::do_make_output_section): New method declaration.
7822         (Target::do_relax): Add parameters for input objects, symbol table
7823         and layout.
7824
7825 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7826
7827         * pread.c: Include stdio.h.
7828
7829 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7830
7831         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7832         defined.
7833
7834 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7835
7836         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7837         Change read_shndx type to unsigned int.
7838         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7839         int.
7840         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7841         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7842         Change read_shndx type to unsigned int.
7843         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7844         int.
7845         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7846         * layout.cc (Layout::create_symtab_sections): Cast the result of
7847         local_symcount * symsize to off_t in the gold_assert.
7848
7849 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7850
7851         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7852         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7853         R_ARM_BASE_ABS.
7854         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7855         (Arm_relocate_functions::thm_abs5): New function.
7856         (Arm_relocate_functions::abs12): New function.
7857         (Arm_relocate_functions::abs16): New function.
7858         (Arm_relocate_functions::base_abs): New function.
7859         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7860         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7861         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7862         R_ARM_BASE_ABS.
7863         (Scan::global): Likewise.
7864         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7865         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7866         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7867         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7868         R_ARM_BASE_ABS.
7869
7870 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7871
7872         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7873         (Arm_relocate_functions::movt_prel): New function.
7874         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7875         (Arm_relocate_functions::thm_movt_prel): New function.
7876         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7877         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7878         (Scan::global, Relocate::relocate): Likewise.
7879         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7880
7881 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7882
7883         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7884         Incremental_checker.
7885         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7886         unsigned int.
7887         (class Incremental_inputs_header): New class.
7888         (Incremental_inputs_header_writer): Edit comment.
7889         (Incremental_inputs_entry): New class.
7890         (Incremental_inputs_entry_writer): Edit comment.
7891         (Sized_incremental_binary::do_find_incremental_inputs_section):
7892         Add *strtab_shndx parameter, fill it.
7893         (Sized_incremental_binary::do_check_inputs): New method.
7894         (Incremental_checker::can_incrementally_link_output_file): Use
7895         Sized_incremental_binary::check_inputs.
7896         (Incremental_inputs::report_command_line): Save command line in
7897         command_line_.
7898         * incremental.h:
7899         (Incremental_binary::find_incremental_inputs_section): New
7900         method.
7901         (Incremental_binary::do_find_incremental_inputs_section): Add
7902         strtab_shndx parameter.
7903         (Incremental_binary::do_check_inputs): New pure virtual method.
7904         (Sized_incremental_binary::do_check_inputs): Declare.
7905         (Incremental_checker::Incremental_checker): Add incremental_inputs
7906         parameter, use it to initialize incremental_inputs_.
7907         (Incremental_checker::incremental_inputs_): New field.
7908         (Incremental_checker::command_line): New method.
7909         (Incremental_checker::inputs): New method.
7910         (Incremental_checker::command_line_): New field.
7911
7912 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7913
7914         * incremental.cc: Include <cstdarg> and "target-select.h".
7915         (vexplain_no_incremental): New function.
7916         (explain_no_incremental): New function.
7917         (Incremental_binary::error): New method.
7918         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7919         method.
7920         (make_sized_incremental_binary): New function.
7921         (open_incremental_binary): New function.
7922         (can_incrementally_link_file): Add checks if output is ELF and has
7923         inputs section.
7924         * incremental.h: Include "elfcpp_file.h" and "output.h".
7925         (Incremental_binary): New class.
7926         (Sized_incremental_binary): New class.
7927         (open_incremental_binary): Declare.
7928         * object.cc (is_elf_object): Use
7929         elfcpp::Elf_recognizer::is_elf_file.
7930         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7931         * output.h (Output_file::filesize): New method.
7932
7933 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7934
7935         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7936         New function.
7937         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7938         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7939         function.
7940         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7941         function.
7942         (Arm_relocate_functions::movw_abs_nc): New function.
7943         (Arm_relocate_functions::movt_abs): New function.
7944         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7945         (Arm_relocate_functions::thm_movt_abs): New function.
7946         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7947         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7948         (Scan::global): Likewise.
7949         (Relocate::relocate): Likewise.
7950         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7951
7952 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7953
7954         * arm.cc (Arm_relocate_functions::got_prel) New function.
7955         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7956         (Relocate::relocate): Likewise.
7957         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7958
7959 2009-10-06  Ian Lance Taylor  <iant@google.com>
7960
7961         * options.h (class General_options): Define
7962         split_stack_adjust_size parameter.
7963         * object.h (class Object): Add uses_split_stack_ and
7964         has_no_split_stack_ fields.  Add uses_split_stack and
7965         has_no_split_stack accessor functions.  Declare
7966         handle_split_stack_section.
7967         (class Reloc_symbol_changes): Define.
7968         (class Sized_relobj): Define Function_offsets.  Declare
7969         split_stack_adjust, split_stack_adjust_reltype, and
7970         find_functions.
7971         * object.cc (Object::handle_split_stack_section): New function.
7972         (Sized_relobj::do_layout): Call handle_split_stack_section.
7973         * dynobj.cc (Sized_dynobj::do_layout): Call
7974         handle_split_stack_section.
7975         * reloc.cc (Sized_relobj::relocate_sections): Call
7976         split_stack_adjust for executable sections in split_stack
7977         objects.  Pass reloc_map to relocate_section.
7978         (Sized_relobj::split_stack_adjust): New function.
7979         (Sized_relobj::split_stack_adjust_reltype): New function.
7980         (Sized_relobj::find_functions): New function.
7981         * target-reloc.h: Include "object.h".
7982         (relocate_section): Add reloc_symbol_changes parameter.  Change
7983         all callers.
7984         * target.h (class Target): Add calls_non_split method.  Declare
7985         do_calls_non_split virtual method.  Declare match_view and
7986         set_view_to_nop.
7987         * target.cc: Include "elfcpp.h".
7988         (Target::do_calls_non_split): New function.
7989         (Target::match_view): New function.
7990         (Target::set_view_to_nop): New function.
7991         * gold.cc (queue_middle_tasks): Give an error if mixing
7992         split-stack and non-split-stack objects with -r.
7993         * i386.cc (Target_i386::relocate_section): Add
7994         reloc_symbol_changes parameter.
7995         (Target_i386::do_calls_non_split): New function.
7996         * x86_64.cc (Target_x86_64::relocate_section): Add
7997         reloc_symbol_changes parameter.
7998         (Target_x86_64::do_calls_non_split): New function.
7999         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8000         parameter.
8001         * powerpc.cc (Target_powerpc::relocate_section): Add
8002         reloc_symbol_changes parameter.
8003         * sparc.cc (Target_sparc::relocate_section): Add
8004         reloc_symbol_changes parameter.
8005         * configure.ac: Call AM_CONDITIONAL for the default target.
8006         * configure: Rebuild.
8007         * testsuite/Makefile.am (TEST_AS): New variable.
8008         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8009         (check_DATA): Add split_i386 and split_x86_64 files.
8010         (SPLIT_DEFSYMS): Define.
8011         (split_i386_[1234n].o): New targets.
8012         (split_i386_[124]): New targets.
8013         (split_i386_[1234r].stdout): New targets.
8014         (split_x86_64_[1234n].o): New targets.
8015         (split_x86_64_[124]): New targets.
8016         (split_x86_64_[1234r].stdout): New targets.
8017         (MOSTLYCLEANFILES): Add new executables.
8018         * testsuite/split_i386.sh: New file.
8019         * testsuite/split_x86_64.sh: New file.
8020         * testsuite/split_i386_1.s: New file.
8021         * testsuite/split_i386_2.s: New file.
8022         * testsuite/split_i386_3.s: New file.
8023         * testsuite/split_i386_4.s: New file.
8024         * testsuite/split_i386_n.s: New file.
8025         * testsuite/split_x86_64_1.s: New file.
8026         * testsuite/split_x86_64_2.s: New file.
8027         * testsuite/split_x86_64_3.s: New file.
8028         * testsuite/split_x86_64_4.s: New file.
8029         * testsuite/split_x86_64_n.s: New file.
8030         * testsuite/testfile.cc (Target_test): Update relocation_section
8031         function.
8032         * testsuite/Makefile.in: Rebuild.
8033
8034 2009-10-06  Ian Lance Taylor  <iant@google.com>
8035
8036         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8037         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8038         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8039         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8040         the address on ldo_addrs_.
8041         (Target_i386::Relocate::fix_up_ldo): New function.
8042
8043 2009-10-06   Rafael Espindola  <espindola@google.com>
8044
8045         * plugin.cc (add_input_library): New.
8046         (Plugin::load): Add add_input_library to tv.
8047         (Plugin_manager::add_input_file): Add the is_lib argument.
8048         (add_input_file): Update call to Plugin_manager::add_input_file.
8049         (add_input_library): New.
8050         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8051
8052 2009-09-30  Doug Kwan  <dougkwan@google.com>
8053
8054         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8055         symbol and call Symbol::may_need_copy_reloc to determine if
8056         a copy reloc is needed.
8057         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8058         nocopyreloc is given in command line.
8059         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8060         given in command line.
8061         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8062         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8063         of the removed Target_i386::may_need_copy_reloc.
8064         * options.h (copyreloc): New option with default value false.
8065         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8066         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8067         instead of the removed Target_powerpc::may_need_copy_reloc.
8068         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8069         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8070         instead of the removed Target_sparc::may_need_copy_reloc.
8071         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8072         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8073         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8074         instead of the removed Target_x86_64::may_need_copy_reloc.
8075
8076 2009-09-30  Ian Lance Taylor  <iant@google.com>
8077
8078         * object.h (class Object): Remove target_ field, and target,
8079         sized_target, and set_target methods.
8080         (Object::sized_target): Remove.
8081         (class Sized_relobj): Update declarations.  Remove sized_target.
8082         * object.cc (Sized_relobj::setup): Remove target parameter.
8083         Change all callers.
8084         (Input_objects::add_object): Don't do anything with the target.
8085         (make_elf_sized_object): Add punconfigured parameter.  Change all
8086         callers.  Set or test parameter target.
8087         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8088         Change all callers.
8089         * parameters.cc (Parameters::set_target): Change parameter type to
8090         be non-const.
8091         (Parameters::default_target): Remove.
8092         (set_parameters_target): Change parameter type to be non-const.
8093         (parameters_force_valid_target): New function.
8094         (parameters_clear_target): New function.
8095         * parameters.h (class Parameters): Update declarations.  Remove
8096         default_target method.  Add sized_target and clear_target
8097         methods.  Change target_ to be non-const.
8098         (set_parameters_target): Update declaration.
8099         (parameters_force_valid_target): Declare.
8100         (parameters_clear_target): Declare.
8101         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8102         as NULL if we aren't searching.
8103         (Add_symbols::run): Don't check for compatible target.
8104         * fileread.cc (Input_file::open_binary): Call
8105         parameters_force_valid_target.
8106         * gold.cc (queue_middle_tasks): Likewise.
8107         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8108         set_target on object.
8109         * dynobj.h (class Sized_dynobj): Update declarations.
8110         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8111         make_elf_object returns NULL.
8112         (Archive::include_member): Don't check whether object target is
8113         compatible.
8114         * output.cc (Output_section::add_input_section): Get target from
8115         parameters.
8116         (Output_section::relax_input_section): Likewise.
8117         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8118         parameters.
8119         (Sized_relobj::do_scan_relocs): Likewise.
8120         (Sized_relobj::relocate_sections): Likewise.
8121         * resolve.cc (Symbol_table::resolve): Likewise.
8122         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8123         parameter.  Change all callers.
8124         (Symbol_table::add_from_object): Get target from parameters.
8125         (Symbol_table::add_from_relobj): Don't check object target.
8126         (Symbol_table::add_from_dynobj): Likewise.
8127         (Symbol_table::define_special_symbol): Get target from
8128         parameters.
8129         * symtab.h (class Symbol_table): Update declaration.
8130         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8131         parameter.  Change all callers.  Clear parameter target.
8132         (Binary_test): Test target here.
8133         * testsuite/object_unittest.cc (gold_testsuite): Remove
8134         target_test_pointer parameter.  Change all callers.
8135         (Object_test): Test target here.
8136
8137 2009-09-26  Ian Lance Taylor  <iant@google.com>
8138
8139         * testsuite/initpri1.c: Don't try to use constructor priorities if
8140         compiling with gcc before 4.3.
8141
8142 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8143
8144         * testsuite/retain_symbols_file_test.sh (check_present): Change
8145         output file name to retain_symbols_file_test.stdout.
8146         (check_absent): Likewise.
8147
8148 2009-09-18  Craig Silverstein  <csilvers@google.com>
8149
8150         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8151         * options.cc: Include <cerrno> and <fstream>.
8152         (General_options::finalize): Parse -retain-symbols-file tag.
8153         * options.h: New flag.
8154         (General_options): New method should_retain_symbol, new
8155         variable symbols_to_retain.
8156         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8157         should_retain_symbol map.
8158         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8159         * testsuite/Makefile.in: Regenerate.
8160         * testsuite/retain_symbols_file_test.sh: New file.
8161
8162 2009-09-18  Nick Clifton  <nickc@redhat.com>
8163
8164         * po/es.po: Updated Spanish translation.
8165
8166 2009-09-17  Doug Kwan  <dougkwan@google.com>
8167
8168         * debug.h (DEBUG_RELAXATION): New constant.
8169         (DEBUG_ALL): Add DEBUG_RELAXATION.
8170         (debug_string_to_enum): Add relaxation debug option.
8171         * layout.cc
8172         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8173         Layout::Relaxation_debug_check::read_sections,
8174         Layout::Relaxation_debug_check::read_sections): New method definitions.
8175         (Layout::Layout): Initialize data members
8176         record_output_section_data_from_scrips_,
8177         script_output_section_data_list_ and relaxation_debug_check_.
8178         (Layout::save_segments, Layout::restore_segments,
8179         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8180         Layout::relaxation_loop_body): New method definitions.
8181         (Layout::finalize): Support relaxation.  Move section layout code to
8182         Layout::relaxation_loop_body.
8183         (Layout::set_asection_address_from_script): Move code for orphan
8184         section placement out.
8185         (Layout::place_orphan_sections_in_script): New method definition.
8186         * layout.h (Output_segment_headers, Output_file_header):
8187         New forward class declarations.
8188         (Layout::~Layout): Define.
8189         (Layout::new_output_section_data_from_script): New method definition.
8190         (Layout::place_orphan_sections_in_script): New method declaration.
8191         (Layout::Segment_states): New type declaration.
8192         (Layout::save_segments, Layout::restore_segments,
8193         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8194         Layout::relaxation_loop_body): New method declarations.
8195         (Layout::Output_section_data_list): New type declaration.
8196         (Layout::Relaxation_debug_check): New class definition.
8197         (Layout::record_output_section_data_from_script_,
8198         Layout::script_output_section_data_list_, Layout::segment_states_,
8199         Layout::relaxation_debug_check_): New data members.
8200         * output.cc: (Output_section_headers::do_size): New method definition.
8201         (Output_section_headers::Output_section_headers): Move size
8202         computation to Output_section_headers::do_size.
8203         (Output_segment_headers::do_size): New method definition.
8204         (Output_file_header::Output_file_header): Move size computation to
8205         Output_file_header::do_size and call it.
8206         (Output_file_header::do_size): New method definition.
8207         (Output_data_group::Output_data_group): Adjust call to
8208         Output_section_data.
8209         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8210         (Output_symtab_xindex::do_write): Add array bound check.
8211         (Output_section::Input_section::print_to_mapfile): Handle
8212         RELAXED_INPUT_SECTION_CODE.
8213         (Output_section::Output_section): Initialize data member checkpoint_.
8214         (Output_section::~Output_section): Delete checkpoint object pointed
8215         by checkpoint_.
8216         (Output_section::add_input_section): Always add an Input_section if
8217         relaxing.
8218         (Output_section::add_merge_input_section): Add assert.
8219         (Output_section::relax_input_section): New method definition.
8220         (Output_section::set_final_data_size): Set load address to zero for
8221         an unallocated section.
8222         (Output_section::do_address_and_file_offset_have_reset_values):
8223         New method definition.
8224         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8225         Handle relaxed input section.
8226         (Output_section::sort_attached_input_sections): Checkpoint input
8227         section list lazily.
8228         (Output_section::get_input_sections): Change type of input_sections to
8229         list of Simple_input_section pointers.  Checkpoint input section list
8230         lazily.  Also handle relaxed input sections.
8231         (Output_section::add_input_section_for_script): Take a reference to
8232         a Simple_input_section object instead of Relobj pointer and section
8233         index as parameter.  Handle relaxed input sections.
8234         (Output_section::save_states, Output_section::restore_states): New
8235         method definitions.
8236         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8237         (Output_data::is_data_size_fixed): New method definition.
8238         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8239         if it is fixed.
8240         (Output_data::address_and_file_offset_have_reset_values): New method
8241         definition.
8242         (Output_data::do_address_and_file_offset_have_reset_values): New method
8243         definition.
8244         (Output_data::set_data_size): Check that data size is not fixed.
8245         (Output_data::fix_data_size): New method definition.
8246         (Output_data::is_data_size_fixed_): New data member.
8247         (Output_section_headers::set_final_data_size): New method definition.
8248         (Output_section_headers::do_size): New method declaration.
8249         (Output_segment_headers::set_final_data_size): New method definition.
8250         (Output_segment_headers::do_size): New method declaration.
8251         (Output_file_header::set_final_data_size)::New method definition.
8252         (Output_file_header::do_size)::New method declaration.
8253         (Output_section_data::Output_section_data): Add new parameter
8254         is_data_size_fixed and use it to fix data size.
8255         (Output_data_const::Output_data_const): Adjust call to base class
8256         constructor and fix data size.
8257         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8258         base class constructor and fix data size.
8259         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8260         base class constructor and fix data size.
8261         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8262         class constructor and fix data size.
8263         (Output_data_group::set_final_data_size): New method definition.
8264         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8265         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8266         class constructor and fix data size.
8267         (Output_relaxed_input_section): New class definition.
8268         (Output_section::Simple_input_section): New class definition.
8269         (Output_section::get_input_sections): Adjust parameter list.
8270         (Output_section::add_input_section_for_script): Same.
8271         (Output_section::save_states, Output_section::restore_states,
8272         Output_section::do_address_and_file_offset_have_reset_values,
8273         (Output_section::Input_section::Input_section): Handle
8274         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8275         Output_relaxed_input_section.
8276         (Output_section::Input_section::is_input_section,
8277         Output_section::Input_section::set_output_section): Handle relaxed
8278         input section.
8279         (Output_section::Input_section::is_relaxed_input_section,
8280         Output_section::Input_section::output_section_data,
8281         Output_section::Input_section::relaxed_input_section): New method
8282         definitions.
8283         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8284         value.
8285         (Output_section::Input_section::u1_): Update comments.
8286         (Output_section::Input_section::u2_): Add new union member poris.
8287         (Output_section::Checkpoint_output_section): New classs definition.
8288         (Output_section::relax_input_section): New method declaration.
8289         (Output_section::checkpoint_): New data member.
8290         (Output_segment): Update comments.
8291         (Output_segment::Output_segment): Un-privatize copy constructor.
8292         (Output_segment::operator=): Un-privatize.
8293         * script-sections.cc (Output_section_element::Input_section_list):
8294         Change element type to Output_section::Simple_input_section.
8295         (Output_section_element_dot_assignment::set_section_addresses):
8296         Register output section data for relaxation clean up.
8297         (Output_data_exression::Output_data_expression): Adjust call to base
8298         constructor to fix data size.
8299         (Output_section_element_data::set_section_addresses): Register
8300         Output_data_expression object for relaxation clean up.
8301         (struct Input_section_info): Replace Relobj pointer and section index
8302         pair with Output_section::Simple_input_section and Convert struct to a
8303         class.
8304         (Input_section_sorter::operator()): Adjust access to
8305         Input_section_info data member to use accessors.
8306         (Output_section_element_input::set_section_addresses): Use layout
8307         parameter.  Adjust code to use Output_section::Simple_input_section
8308         and Input_secction_info classes.  Register filler for relaxation
8309         clean up.
8310         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8311         and section index pair with Output_section::Simple_input_section
8312         class.  Adjust code accordingly.
8313         (Phdrs_element::release_segment): New method definition.
8314         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8315         segment list.
8316         (Script_sections::release_segments): New method definition.
8317         * gold/script-sections.h (Script_sections::release_segments): New
8318         method declaration.
8319         * gold/target.h (Target::may_relax, Target::relax,
8320         Target::do_may_relax, Target::do_relax): New method definitions.
8321
8322 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8323
8324         * arm.cc (has_signed_unsigned_overflow): New function.
8325         (Arm_relocate_functions::abs8): New function.
8326         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8327         (Target_arm::Scan::global): Likewise.
8328         (Target_arm::relocate::relocate): Likewise.
8329         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8330         Likewise.
8331
8332 2009-09-16  Cary Coutant  <ccoutant@google.com>
8333
8334         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8335         * testsuite/Makefile.in: Regenerate.
8336
8337 2009-09-11  Nick Clifton  <nickc@redhat.com>
8338
8339         * po/gold.pot: Updated by the Translation project.
8340
8341 2009-09-08  Cary Coutant  <ccoutant@google.com>
8342
8343         * output.cc (Output_file::open): Add execute permission to empty file.
8344         * testsuite/Makefile.am (permission_test): New test.
8345         * testsuite/Makefile.in: Regenerate.
8346
8347 2009-09-02  Ian Lance Taylor  <iant@google.com>
8348
8349         * output.cc (Output_file::resize): Call map_no_anonymous rather
8350         than map.
8351
8352 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8353
8354         * gold.cc: Include "incremental.h".
8355         (queue_initial_tasks): Call Incremental_checker methods.
8356         * incremental.cc: Include "output.h".
8357         (Incremental_checker::can_incrementally_link_output_file): New
8358         method.
8359         * incremental.h (Incremental_checker): New class.
8360
8361         * output.cc (Output_file::open_for_modification): New method.
8362         (Output_file::map_anonymous): Changed return type to bool.  Record
8363         map in base_ field.
8364         (Output_file::map_no_anonymous): New method, broken out of map.
8365         (Output_file::map): Use map_no_anonymous and map_anonymous.
8366         * output.h (class Output_file): Update declarations.
8367
8368 2009-08-24  Cary Coutant  <ccoutant@google.com>
8369
8370         * options.h (Command_line::Pre_options): New class.
8371         (Command_line::pre_options): New member.
8372         * options.cc (gold::options::ready_to_register): New variable.
8373         (One_option::register_option): Do nothing if not registering options.
8374         Assert if same short option registered twice.
8375         (General_options::General_options): Turn off option registration when
8376         done constructing.
8377         (Command_line::Pre_options::Pre_options): New constructor.
8378
8379 2009-08-24  Cary Coutant  <ccoutant@google.com>
8380
8381         * options.h (General_options::no_keep_memory): Remove incorrect
8382         short option.
8383
8384 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8385
8386         * Makefile.am (am__skiplex, am__skipyacc): New.
8387         * Makefile.in: Regenerate.
8388
8389 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8390
8391         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8392         (INCLUDES): ... this.
8393         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8394         (AM_CPPFLAGS): Renamed from ...
8395         (INCLUDE): ... this.
8396         * Makefile.in, testsuite/Makefile.in: Regenerate.
8397
8398         * Makefile.in: Regenerate.
8399         * aclocal.m4: Likewise.
8400         * config.in: Likewise.
8401         * configure: Likewise.
8402         * testsuite/Makefile.in: Likewise.
8403
8404         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8405         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8406         * Makefile.in: Regenerate.
8407         * testsuite/Makefile.in: Regenerate.
8408
8409 2009-08-19  Cary Coutant  <ccoutant@google.com>
8410
8411         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8412         symbols in shared libraries overridden by hidden or internal symbols
8413         in the main program.
8414
8415 2009-08-19  Chris Demetriou  <cgd@google.com>
8416
8417         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8418         checking source file names in error messages.
8419
8420 2009-08-18  Doug Kwan  <dougkwan@google.com>
8421
8422         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8423         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8424         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8425         an elfcpp::Ehdr as parameter.
8426         * object.cc (Object::set_target): Remove the version that looks up
8427         a target and sets it.
8428         (Sized_relobj::setup): Take a Target object instead of
8429         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8430         (make_elf_sized_object): Find target and ask target to
8431         make an ELF object.
8432         * object.h: (Object::set_target): Remove the version that looks up
8433         a target and sets it.
8434         (Sized_relobj::setup): Take a Target object instead of
8435         an elfcpp:Ehdr as parameter.
8436         * target.cc: Include dynobj.h.
8437         (Target::do_make_elf_object_implementation): New.
8438         (Target::do_make_elf_object): New.
8439         * target.h (Target::make_elf_object): New template declaration.
8440         (Target::do_make_elf_object): New method declarations.
8441         (Target::do_make_elf_object_implementation): New template declaration.
8442
8443 2009-08-14  Ian Lance Taylor  <iant@google.com>
8444
8445         * gold.h (FUNCTION_NAME): Define.
8446         (gold_unreachable): Use FUNCTION_NAME.
8447
8448 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8449
8450         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8451         symbol in the --keep-unique list is not found.
8452
8453 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8454
8455         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8456         been maked as --keep-unique.
8457         (Icf::unfold_section): New function.
8458         * icf.h (Icf::unfold_section): New function.
8459         * options.h (General_options::keep_unique): New option.
8460         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8461         * testsuite/Makefile.in: Regenerate.
8462         * testsuite/icf_keep_unique_test.sh: New file.
8463         * testsuite/icf_keep_unique_test.cc: New file.
8464
8465 2009-08-12  Cary Coutant  <ccoutant@google.com>
8466
8467         PR 10471
8468         * resolve.cc (Symbol_table::resolve): Check for references from
8469         dynamic objects to hidden and internal symbols.
8470         * testsuite/Makefile.am (hidden_test.sh): New test.
8471         * testsuite/Makefile.in: Regenerate.
8472         * testsuite/hidden_test.sh: New script.
8473         * testsuite/hidden_test_1.c: New test source.
8474         * testsuite/hidden_test_main.c: New test source.
8475
8476 2009-08-11  Doug Kwan  <dougkwan@google.com>
8477
8478         * arm.cc: Update comments.
8479         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8480         segment to locate the .ARM.exidx section if present.
8481
8482 2009-08-09  Doug Kwan  <dougkwan@google.com>
8483
8484         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8485         patch.
8486
8487 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8488         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8489         compiler warnings.
8490
8491 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8492
8493         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8494         valid tls_segment only for non-debug-section relocations.
8495         * testsuite/Makefile.am: Add gc_tls_test.
8496         * testsuite/Makefile.in: Regenerate.
8497         * testsuite/gc_tls_test.cc: New file.
8498         * testsuite/gc_tls_test.sh: New file.
8499
8500 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8501
8502         * icf.cc: New file.
8503         * icf.h: New file.
8504         * Makefile.am (CCFILES): Add icf.cc.
8505         (HFILES): Add icf.h
8506         * Makefile.in: Regenerate.
8507         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8508         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8509         section, symbol and addend information for the relocs.
8510         * gold.cc (queue_middle_tasks): Call identical code folding.
8511         * gold.h: Add defines for multimap.
8512         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8513         to the call of finalize_local_symbols.
8514         * main.cc (main): Create object of class Icf.
8515         * object.cc (Sized_relobj::do_layout): Allow this function to be
8516         called twice during icf.
8517         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8518         to sections marked as identical by icf.
8519         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8520         when available.
8521         (Sized_relobj::do_section_entsize): New function.
8522         * object.h (Object::section_entsize): New function.
8523         (Object::do_section_entsize): New pure virtual function.
8524         (Relobj::finalize_local_symbols): Add new parameter.
8525         (Relobj::do_section_entsize): New function.
8526         * options.h (General_options::icf): New option.
8527         (General_options::icf_iterations): New option.
8528         (General_options::print_icf_sections): New option.
8529         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8530         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8531         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8532         icf.
8533         * symtab.cc (Symbol_table::is_section_folded): New function.
8534         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8535         to sections marked as identical by icf.
8536         * symtab.h (Symbol_table::set_icf): New function.
8537         (Symbol_table::icf): New function.
8538         (Symbol_table::is_section_folded): New function.
8539         (Symbol_table::icf_): New data member.
8540         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8541         * testsuite/Makefile.am: Add commands to build icf_test.
8542         * testsuite/Makefile.in: Regenerate.
8543         * testsuite/icf_test.sh: New file.
8544         * testsuite/icf_test.cc: New file.
8545
8546 2009-07-24  Chris Demetriou  <cgd@google.com>
8547
8548         * layout.cc (is_compressible_debug_section): Fix incorrect
8549         comment about compressed section names.
8550
8551 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8552
8553         PR 10419
8554         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8555
8556 2009-07-16  Ian Lance Taylor  <iant@google.com>
8557
8558         PR 10400
8559         * layout.h: #include <map>.
8560         (class Kept_section): Change from struct to class.  Add accessors
8561         and setters.  Add section size to Comdat_group mapping.  Change
8562         Comdat_group to std::map.  Add is_comdat_ field.  Add
8563         linkonce_size field in union.
8564         (class Layout): Update declaration of find_or_add_kept_section.
8565         Don't declare find_kept_object.
8566         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8567         parameter.  Add object, shndx, is_comdat, and is_group_name
8568         parameters.  Change all callers.  Adjust for new Kept_section.
8569         (Layout::find_kept_object): Remove.
8570         * object.cc (Sized_relobj::include_section_group): Update use of
8571         Kept_section.  Rename secnum to shndx.  Only record
8572         Kept_comdat_section if sections are the same size.
8573         (Sized_relobj::include_linkonce_section): Update use of
8574         Kept_section.  Only record Kept_comdat_section if sections are the
8575         same size.  Set size of linkonce section.
8576         (Sized_relobj::map_to_kept_section): Update call to
8577         get_kept_comdat_section.
8578         * object.h (class Sized_relobj): Rename fields in
8579         Kept_comdat_section to drop trailing underscores; change object
8580         field to Relobj*.  Change Kept_comdat_section_table to store
8581         struct rather than pointer.
8582         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8583         Add kept_object and kept_shndx parameters.  Change all callers.
8584         (Sized_relobj::get_kept_comdat_section): Change return type to
8585         bool.  Add kept_object and kept_shndx parameters.  Change all
8586         callers.
8587         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8588         Layout::find_or_add_kept_section.
8589
8590 2009-07-09  Ian Lance Taylor  <iant@google.com>
8591
8592         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8593         Reserve space in the hash table.
8594
8595 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8596
8597         * fileread.cc (File_read::get_mtime): New method.
8598         * fileread.h (Timespec): New structure.
8599         (File_read::get_mtime): New method.
8600         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8601         Renamed from timestamp_nsec.
8602         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8603         Elf_Xword.
8604         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8605         timestamp_nsec.
8606         (Incremental_inputs::report_archive): Save mtime; style fix.
8607         (Incremental_inputs::report_obejct): Save mtime; style fix.
8608         (Incremental_inputs::report_script): Save mtime; style fix.
8609         (Incremental_inputs::finalize_inputs): Style fix.
8610         (Incremental_inputs::finalize): Style fix.
8611         (Incremental_inputs::create_input_section_data): Store inputs
8612         mtime.
8613         * incremental.h (Incremental_inputs::report_script): Add mtime
8614         argument.
8615         (Incremental_inputs::Input_info::Input_info): Intialize only one
8616         union member.
8617         (Incremental_inputs::Input_info::archive): Move to nameless
8618         union.
8619         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8620         (Incremental_inputs::Input_info::script): Move to nameless union.
8621         (Incremental_inputs::mtime): New field.
8622         * script.cc (read_input_script): Pass file mtime to
8623         Incremental_input.
8624         * script.h (Script_info::inputs): Style fix.
8625
8626 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8627
8628         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8629         instead of 32.
8630
8631 2009-06-24  Ian Lance Taylor  <iant@google.com>
8632
8633         PR 10156
8634         * layout.cc (Layout::choose_output_section): If we find an
8635         existing section, update the flags.
8636         (Layout::create_notes): New function, broken out of
8637         Layout::finalize.
8638         (Layout::finalize): Don't create note sections.
8639         (Layout::create_note): Don't crash if linker script discards
8640         section.
8641         (Layout::create_gold_note): Likewise.
8642         (Layout::create_build_id): Likewise.  Don't set
8643         after_input_sections on the section.
8644         (Layout::create_executable_stack_info): Remove target parameter.
8645         Change caller.
8646         * layout.h (class Layout): Declare create_notes.  Update
8647         declaration of create_executable_stack_info.
8648         * gold.cc (queue_middle_tasks): Call create_notes.
8649         * output.cc (Output_section::update_flags_for_input_section): Move
8650         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8651         invalid.
8652         * output.h (Output_data::mark_address_invalid): New function.
8653         (class Output_section): Only declare, not define,
8654         update_flags_for_input_section.  Remove set_flags.
8655
8656 2009-06-24  Ian Lance Taylor  <iant@google.com>
8657
8658         * script-sections.cc (Output_section_definition::
8659         set_section_addresses): Rename shadowing local load_address to
8660         laddr.
8661
8662 2009-06-24  Ian Lance Taylor  <iant@google.com>
8663
8664         PR 10244
8665         * reloc.cc (relocate_sections): Skip empty relocation sections.
8666
8667 2009-06-23  Ian Lance Taylor  <iant@google.com>
8668
8669         PR 10156
8670         * layout.cc (Layout::create_note): Use choose_output_section
8671         rather than make_output_section.
8672
8673 2009-06-23  Ian Lance Taylor  <iant@google.com>
8674
8675         PR 10237
8676         * options.cc (General_options::parse_V): Set printed_version_.
8677         (General_options::General_options): Initialize printed_version_.
8678         * options.h (class General_options): Add printed_version_ field.
8679         * gold.cc (queue_initial_tasks): If there are no input files,
8680         don't give a fatal error if we printed the version information.
8681         (queue_middle_tasks): If using -r with a shared object, give a
8682         fatal error rather than an ordinary error.
8683
8684 2009-06-23  Ian Lance Taylor  <iant@google.com>
8685
8686         PR 10219
8687         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8688         (Layout::make_output_section): Set have_stabstr_section_ if we see
8689         a .stab*str section.
8690         (Layout::finalize): Call link_stabs_sections.
8691         (Layout::link_stabs_sections): New file.
8692         * layout.h (class Layout): Add have_stabstr_section_ field.
8693         Declare link_stabs_sections.
8694
8695 2009-06-23  Doug Kwan  <dougkwan@google.com>
8696
8697         * Makefile.am (libgold_a_LIBADD): New.
8698         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8699         * Makefile.in: Regenerate.
8700         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8701         * configure: Regenerate.
8702         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8703         * fileread.cc: Include sys/state.h
8704         * gold.h: Declare memmem and strndup if found missing.
8705         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8706
8707 2009-06-23  Ian Lance Taylor  <iant@google.com>
8708
8709         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8710         * configure: Rebuild.
8711
8712 2009-06-23  Ian Lance Taylor  <iant@google.com>
8713
8714         PR 10147
8715         * object.cc (Object::section_contents): Don't try to get a view if
8716         the section has length zero.
8717         (Object::handle_gnu_warning_section): If the section is empty, use
8718         the name of the section as the warning.
8719
8720 2009-06-23  Ian Lance Taylor  <iant@google.com>
8721
8722         PR 10133
8723         * stringpool.h (class Stringpool_template): Add optimize_ field.
8724         (Stringpool_template::set_optimize): New function.
8725         * stringpool.cc (Stringpool_template::Stringpool_template):
8726         Initialize optimize_ field.
8727         (Stringpool_template::set_string_offsets): Test local optimize
8728         fild rather than parameter.
8729         * layout.cc (Layout::Layout): Call set_optimize on the section
8730         name stringpool.
8731
8732 2009-06-22  Ian Lance Taylor  <iant@google.com>
8733
8734         PR 10030
8735         * yyscript.y: Parse TARGET.
8736         * script.cc (script_set_target): New function.
8737         * script-c.h (script_set_target): Declare.
8738         * options.cc (General_options::string_to_object_format): Rename
8739         from string_to_object_format in anonymous namespace.  Change
8740         callers.
8741         * options.h (class General_options): Declare
8742         string_to_object_format.
8743
8744 2009-06-22  Ian Lance Taylor  <iant@google.com>
8745
8746         * script-sections.cc (Script_sections::create_segments): Don't put
8747         program headers in a PT_LOAD segment if -n or -N.
8748
8749 2009-06-22  Ian Lance Taylor  <iant@google.com>
8750
8751         PR 10141
8752         * options.h (class General_options): Add -z lazy and -z now.  Sort
8753         -z options into alphabetical order.
8754         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8755
8756 2009-06-21  Ian Lance Taylor  <iant@google.com>
8757
8758         * layout.cc (Layout::make_output_section): Call
8759         Target::new_output_section.
8760         (Layout::attach_allocated_section_to_segment): Put large section
8761         sections in a separate load segment with the large segment flag
8762         set.
8763         (Layout::segment_precedes): Sort large data segments after other
8764         load segments.
8765         (align_file_offset): New static function.
8766         (Layout::set_segment_offsets): Use align_file_offset.
8767         * output.h (class Output_section): Add is_small_section_ and
8768         is_large_section_ fields.
8769         (Output_section::is_small_section): New function.
8770         (Output_section::set_is_small_section):  New function.
8771         (Output_section::is_large_section): New function.
8772         (Output_section::set_is_large_section): New function.
8773         (Output_section::is_large_data_section): New function.
8774         (class Output_segment): Add is_large_data_segment_ field.
8775         (Output_segment::is_large_data_segment): New function.
8776         (Output_segment::set_is_large_data_segment): New function.
8777         * output.cc (Output_section::Output_section): Initialize new
8778         fields.
8779         (Output_segment::Output_segment): Likewise.
8780         (Output_segment::add_output_section): Add assertion that large
8781         data sections always go in large data segments.  Force small data
8782         sections to the end of the list of data sections.  Force small BSS
8783         sections to the start of the list of BSS sections.  For large BSS
8784         sections to the end of the list of BSS sections.
8785         * symtab.h (class Symbol): Declare is_common_shndx.
8786         (Symbol::is_defined): Check Symbol::is_common_shndx.
8787         (Symbol::is_common): Likewise.
8788         (class Symbol_table): Define enum Commons_section_type.  Update
8789         declarations.  Add small_commons_ and large_commons_ fields.
8790         * symtab.cc (Symbol::is_common_shndx): New function.
8791         (Symbol_table::Symbol_table): Initialize new fields.
8792         (Symbol_table::add_from_object): Put small and large common
8793         symbols in the right list.
8794         (Symbol_table::sized_finalized_symbol): Check
8795         Symbol::is_common_shndx.
8796         (Symbol_table::sized_write_globals): Likewise.
8797         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8798         common symbol lists.  Don't call do_allocate_commons_list if the
8799         list is empty.
8800         (Symbol_table::do_allocate_commons_list): Remove is_tls
8801         parameter.  Add comons_section_type parameter.  Change all
8802         callers.  Handle small and large common symbols.
8803         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8804         Symbol::is_common_shndx.
8805         * resolve.cc (symbol_to_bits): Likewise.
8806         * target.h (Target::small_common_shndx): New function.
8807         (Target::small_common_section_flags): New function.
8808         (Target::large_common_shndx): New function.
8809         (Target::large_common_section_flags): New function.
8810         (Target::new_output_section): New function.
8811         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8812         small_common_section_flags, and large_common_section_flags
8813         fields.
8814         (Target::do_new_output_section): New virtual function.
8815         * arm.cc (Target_arm::arm_info): Initialize new fields.
8816         * i386.cc (Target_i386::i386_info): Likewise.
8817         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8818         Likewise.
8819         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8820         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8821         (Target_x86_64::do_new_output_section): New function.
8822         * configure.ac: Define conditional MCMODEL_MEDIUM.
8823         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8824         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8825         (large_LDFLAGS): Define.
8826         * testsuite/large.c: New file.
8827         * testsuite/testfile.cc (Target_test::test_target_info):
8828         Initialize new fields.
8829         * configure, testsuite/Makefile.in: Rebuild.
8830
8831 2009-06-05  Doug Kwan  <dougkwan@google.com>
8832
8833         * Makefile.am (CCFILES): Add target.cc.
8834         * Makefile.in: Regenerate.
8835         * i386.cc (class Target_i386): Define new virtual method to
8836         override do_is_local_label_name in parent.
8837         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8838         local symbols if --discard-locals or -X is given.
8839         * options.h (class General_options): Declare new options
8840         '--discard-locals' and '-X' for discarding locals.
8841         * target.h (class Target): Define new methods is_local_label_name.
8842         Declare new virtual method do_is_local_label_name.
8843         * target.cc: New file.
8844         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8845         (check_SCRIPTS): Add discard_locals_test.sh.
8846         (check_DATA): Add discard_local_tests.syms.
8847         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8848         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8849         * testsuite/Makefile.in: Regenerate.
8850         * testsuite/discard_locals_test.c: New file.
8851         * testsuite/discard_locals_test.sh: Same.
8852
8853 2009-06-05  Doug Kwan  <dougkwan@google.com>
8854
8855         * object.cc (Sized_relobj::Sized_relobj): Initialize
8856         discarded_eh_frame_shndx_ to -1U.
8857         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8858         section.
8859         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8860         a discarded .eh_frame section.
8861         (Sized_relobj::do_finalize_local_symbols): Ditto.
8862         * object.h (class Sized_relobj): Declare new member
8863         discarded_eh_frame_shndx_.
8864         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8865         (local_labels_test.o, local_labels_test): New rules.
8866         * testsuite/Makefile.in: Regenerate.
8867
8868 2009-06-04  Doug Kwan  <dougkwan@google.com>
8869
8870         * layout.cc (Layout::section_name_mapping): Add mapping for
8871         special ARM sections.
8872
8873 2009-06-03  Doug Kwan  <dougkwan@google.com>
8874
8875         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8876         (utils::has_overflow): Same.
8877
8878 2009-06-03  Ian Lance Taylor  <iant@google.com>
8879
8880         * layout.cc (Layout::section_name_mapping): New array, replacing
8881         Layout::linkonce_mapping.
8882         (Layout::section_name_mapping_count): New variable, replacing
8883         Layout::linkonce_mapping_count.
8884         (Layout::linkonce_output_name): Remove.
8885         (Layout::output_section_name): Rewrite.
8886         * layout.h (class Layout): Rename Linkonce_mapping to
8887         Section_name_mapping, linkonce_mapping to section_name_mapping,
8888         linkonce_mapping_count to section_name_mapping_count.  Don't
8889         declare linkonce_output_name.
8890
8891 2009-06-03  Doug Kwan  <dougkwan@google.com>
8892
8893         * gold/arm.cc (namespace utils): New.
8894         (Target_arm::reloc_is_non_pic): Define new method.
8895         (class Arm_relocate_functions): New.
8896         (Target_arm::Relocate::relocate): Handle relocation types used by
8897         Android.
8898
8899 2009-06-03  Ian Lance Taylor  <iant@google.com>
8900
8901         * arm.cc (Target_arm::scan::global): Use || instead of |.
8902
8903 2009-06-02  Doug Kwan  <dougkwan@google.com>
8904
8905         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8906         issued_non_pic_error_.
8907         (class Target_arm::Scan): Declare new method check_non_pic.
8908         Define new method symbol_needs_plt_entry.
8909         Declare new data member issued_non_pic_error_.
8910         (class Target_arm::Relocate): Declare new method
8911         should_apply_static_reloc.
8912         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8913         (Target_arm::Scan::check_non_pic): Define new method.
8914         (Target_arm::Scan::local): Handle a small subset of reloc types used
8915         by Android.
8916         (Target_arm::Scan::local): Same.
8917         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8918
8919 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8920
8921         * incremental.cc (Incremental_inputs::report_command_line): Filter
8922         out --incremental-* options.
8923
8924 2009-05-29  Doug Kwan  <dougkwan@google.com>
8925
8926         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8927         template class.
8928         (class Target_arm): Update comment.
8929         (Target_arm::Target_arm): Initialize new data members GOT_,
8930         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8931         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8932         and Target_arm::rel_dyn_section.
8933         Declare new_enum Target_arm::Got_type.
8934         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8935         and DYNBSS_.
8936         Update commments for member do_dynsym_value.
8937         (Target_arm::got_size, Target_arm::plt_section,
8938         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8939         new methods inside class defintion.
8940         (Target_arm::got_section): Define new method.
8941         (Target_arm::rel_dyn_section): Same.
8942         (Output_data_plt_arm): New template class.
8943         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8944         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8945         (Output_data_plt_arm::add_entry): Same.
8946         (Output_data_plt_arm::first_plt_entry): Define new
8947         static data member for PLT instruction template.
8948         (Output_data_plt_arm::plt_entry): Same.
8949         (Output_data_plt_arm::do_write): Define new method.
8950         (Target_arm::make_plt_entry): Same.
8951         (Target_arm::do_finalize_sections): Same.
8952         (Target_arm::do_dynsym_value): Same.
8953
8954 2009-05-28  Doug Kwan  <dougkwan@google.com>
8955
8956         * Makefile.am (TARGETSOURCES): Add arm.cc.
8957         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8958         * Makefile.in: Regenerate.
8959         * arm.cc: New file.
8960         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8961
8962 2009-05-26  Doug Kwan  <dougkwan@google.com>
8963
8964         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8965         (General_options::check_excluded_libs): Strip off directories in
8966         archive name before matching like GNU ld does.
8967         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8968         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8969         (exclude_libs_test_LDFLAGS): Add linker option
8970         -Wl,--exclude-libs,libexclude_libs_test_3
8971         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8972         an explicit archive without using -l.
8973         (alt/libexclude_libs_test_3.a): New make rule.
8974         * testsuite/Makefile.in: Regenerate.
8975         * testsuite/exclude_libs_test.c : Declare lib3_default().
8976         (main): Call it.
8977         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8978         * exclude_libs_test_3.c: New file.
8979
8980 2009-05-26  Nick Clifton  <nickc@redhat.com>
8981
8982         * po/id.po: New Indonesian translation.
8983         * po/gold.pot: Updated template file.
8984
8985 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8986
8987         * testsuite/Makefile.am: Add -ffunction-sections to compile
8988         gc_comdat_test files.  Add -Wl,--gc-sections to build
8989         gc_comdat_test.
8990         * testsuite/Makefile.in: Regenerate.
8991         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8992
8993 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8994
8995         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8996         kept comdat section was garbage collected.
8997         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8998         * testsuite/Makefile.in: Regenerate.
8999         * testsuite/gc_comdat_test.sh: New file.
9000         * testsuite/gc_comdat_test_1.cc: New file.
9001         * testsuite/gc_comdat_test_2.cc: New file.
9002
9003 2009-05-19  Doug Kwan  <dougkwan@google.com>
9004
9005         * archive.cc (Archive::Archive): Move constructor from archive.h
9006         to here.  Initialize no_export_.
9007         (Archive::get_elf_object_for_member): Set no_export flag of object.
9008         * archive.h (Archive::Archive): Move constructor body to
9009         archive.cc.
9010         (Archive::no_export): New method.
9011         (Archive::no_export_): New field.
9012         * object.h (Object::Object): Initialize no_export_ to false.
9013         (Object::no_export, Object::set_no_export): New methods.
9014         (Object::no_export_): New field.
9015         * options.cc (General_options::parse_exclude_libs): New method.
9016         (General_options::check_excluded_libs) Same.
9017         * options.h (exclude_libs): New option.
9018         (General_options::check_excluded_libs): New method declaration.
9019         (General_options::excluded_libs_): New field.
9020         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9021         default or protected visibility if an object has no-export flag set.
9022         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9023         (check_SCRIPTS): Add exclude_libs_test.sh.
9024         (check_DATA): Add exclude_libs_test.syms.
9025         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9026         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9027         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9028         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9029         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9030         libexclude_libs_test_2.a): New rules.
9031         * testsuite/Makefile.in: Regenerate.
9032         * testsuite/exclude_libs_test.c: New file.
9033         * testsuite/exclude_libs_test.sh: Ditto.
9034         * testsuite/exclude_libs_test_1.c: Ditto.
9035         * testsuite/exclude_libs_test_2.c: Ditto.
9036
9037 2009-05-15  Ian Lance Taylor  <iant@google.com>
9038
9039         * configure.ac: Check for declarations for cases where libiberty.h
9040         checks HAVE_DECL_xxx.
9041         * configure, config.in: Rebuild.
9042
9043 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9044
9045         * gold.h (Incremental_argument_list): Remove (invalid) forward
9046         declaration.
9047         * incremental.cc (Incremental_inputs::report_achive): New method.
9048         (Incremental_inputs::report_object): New method.
9049         (Incremental_inputs::report_script): New method.
9050         (Incremental_inputs::finalize_inputs): New method.
9051         (Incremental_inputs::finalize): Call finalize_inputs().
9052         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9053         Create inputs entries.
9054         * incremental.h (Incremental_input_type): New enum.
9055         (Incremental_inputs::Incremental_input): Initialize new fields.
9056         (Incremental_inputs::report_inputs): New method.
9057         (Incremental_inputs::report_achive): New method.
9058         (Incremental_inputs::report_object): New method.
9059         (Incremental_inputs::report_script): New method.
9060         (Incremental_inputs::finalize_inputs): New method.
9061         (Incremental_inputs::Input_info): New struct.
9062         (Incremental_inputs::Input_info_map): New typedef.
9063         (Incremental_inputs::lock_): New field.
9064         (Incremental_inputs::Inputs_): New field.
9065         (Incremental_inputs::Inputs_map): New field.
9066         * main.cc (main): Call Incremental_input::report_inputs.
9067         * options.h (Input_argument_list): Typedef moved from
9068         Input_arguments.
9069         (Input_file_group::Files): Remove, use ::Input_argument_list.
9070         (Input_file_group::Input_argument_list): Remove, use
9071         ::Input_argument_list.
9072         * plugin.cc (Plugin_manager::add_input_file): Add error in
9073         incremental build.
9074         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9075         functions.
9076         * script.cc (read_input_script): Call
9077         Incremental_input::report_script.
9078         * script.h (Script_info): New class.
9079
9080 2009-04-27  Ian Lance Taylor  <iant@google.com>
9081
9082         * x86_64.cc (do_adjust_output_section): Set entsize to
9083         plt_entry_size.
9084
9085 2009-04-23  Elliott Hughes  <enh@google.com>
9086
9087         * output.cc (Output_file::close): After short writes, continue
9088         writing from the correct offset in the buffer being written.
9089
9090 2009-04-23  Chris Demetriou  <cgd@google.com>
9091
9092         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9093         * configure: Regenerate.
9094         * config.in: Regenerate.
9095         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9096         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9097
9098 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9099
9100         * incremental.cc (Incremental_inputs_header_data): Renamed from
9101         Incremental_input_header_data.
9102         (Incremental_inputs_header_data::data_size): New field.
9103         (Incremental_inputs_header_data::put_input_file_count): Renamed
9104         from input_file_count.
9105         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9106         from command_line_offset.
9107         (Incremental_inputs_header_data::put_reserved): Renamed from
9108         put_reserved.
9109         (Incremental_inputs_entry_data): Renamed from
9110         Incremental_input_entry_data.
9111         (Incremental_inputs_entry_data::data_size): New field.
9112         (Incremental_inputs::report_command_line): New method.
9113         (Incremental_inputs::finalize): New method.
9114         (Incremental_inputs::create_incremental_inputs_data): New method.
9115         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9116         * incremental.h: New file.
9117         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9118        (Layout::finalize): Create incremental inputs section in
9119         incremental builds.
9120        (Layout::create_incremental_info_sections): New method.
9121         * layout.h (Layout::incremental_inputs): New method.
9122        (Layout::create_incremental_info_sections): New method.
9123        (Layout::incremental_inputs_): New field.
9124         * main.cc (main): Notify Incremental_input of the command line.
9125
9126 2009-04-01  Ian Lance Taylor  <iant@google.com>
9127             Mikolaj Zalewski  <mikolajz@google.com>
9128
9129         * gold.h (reserve_unordered_map): Define, three versions, one for
9130         each version of Unordered_map.
9131         * layout.cc (Layout::Layout): Remove options parameter.  Add
9132         number_of_input_files parameter.  Don't initialize options_.
9133         Initialize number_of_input_files_ and resized_signatures_.  Move
9134         sections_are_attached_.
9135         (Layout::layout_group): Reserve space for group_signatures_.
9136         (Layout::find_or_add_kept_section): Change name parameter to be a
9137         reference.  Resize signatures_ map when it gets large enough.
9138         (Layout::layout_eh_frame): Use parameters->options() instead of
9139         this->options_.
9140         (Layout::make_output_section): Likewise.
9141         (Layout::attach_allocated_section_to_segment): Likewise.
9142         (Layout::finalize, Layout::create_executable_stack): Likewise.
9143         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9144         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9145         * layout.h (class Layout): Update declarations.  Remove options_
9146         field.  Add number_of_input_files_ and resized_signatures_
9147         fields.  Move sections_are_attached_ field.
9148         * main.cc (main): Pass number of input files to Layout
9149         constructor.  Don't pass options.
9150
9151 2009-03-30  Ian Lance Taylor  <iant@google.com>
9152
9153         * ffsll.c (ffsll): Correct implementation.
9154
9155 2009-03-27  Ian Lance Taylor  <iant@google.com>
9156
9157         * ffsll.c: New file.
9158         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9159         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9160         * ftruncate.c (ftruncate): Declare before definition.
9161         * mremap.c (mremap): Likewise.
9162         * pread.c (pread): Likewise.
9163         * configure, Makefile.in, config.in: Rebuild.
9164
9165         * mremap.c: New file.
9166         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9167         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9168         (mremap): Declare if HAVE_MREMAP is not defined.
9169         * configure, Makefile.in, config.in: Rebuild.
9170
9171 2009-03-27  Cary Coutant  <ccoutant@google.com>
9172
9173         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9174         position independent.
9175         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9176         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9177
9178 2009-03-24  Cary Coutant  <ccoutant@google.com>
9179
9180         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9181         an executable.
9182         (needs_dynamic_reloc): Likewise.
9183
9184 2009-03-24  Ian Lance Taylor  <iant@google.com>
9185
9186         * yyscript.y (file_cmd): Recognize EXTERN.
9187         (extern_name_list, extern_name_list_body): New nonterminals.
9188         * script.cc (script_add_extern): Define.
9189         * script-c.h (script_add_extern): Declare.
9190
9191 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9192
9193         * object.cc (is_elf_object): Define.
9194         * object.h (is_elf_object): Declare.
9195         * archive.cc (Archive::get_elf_object_for_member): Call
9196         is_elf_object.
9197         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9198
9199 2009-03-24  Elliott Hughes  <enh@google.com>
9200
9201         * output.cc (Output_file::map_anonymous): Define.
9202         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9203         try an anonymous one.  Report the size if the mmap fails.
9204         * output.h (class Output_file): Declare map_anonymous.
9205
9206 2009-03-24  Ian Lance Taylor  <iant@google.com>
9207
9208         * target-select.cc (instantiate_target): Don't acquire the lock if
9209         the instantiated_target_ field has already been set.
9210
9211 2009-03-23  Ian Lance Taylor  <iant@google.com>
9212
9213         * gold-threads.h (class Initialize_lock): Define.
9214         * gold-threads.cc (class Initialize_lock_once): Define.
9215         (initialize_lock_control): New static variable.
9216         (initialize_lock_pointer): New static variable.
9217         (initialize_lock_once): New static function.
9218         (Initialize_lock::Initialize_lock): Define.
9219         (Initialize_lock::initialize): Define.
9220         * target-select.h: Include "gold-threads.h".
9221         (class Target_selector): Add lock_ and initialize_lock_ fields.
9222         Don't define instantiate_target, just declare it.
9223         * target-select.cc (Target_selector::Target_selector): Initialize
9224         new fields.
9225         (Target_selector::instantiate_target): Define.
9226         * descriptors.h: Include "gold-threads.h".
9227         (class Descriptors): Add initialize_lock_ field.
9228         * descriptors.cc (Descriptors::Descriptors): Initialize new
9229         field.
9230         (Descriptors::open): Use initialize_lock_ field
9231         * errors.h (class Errors): Add initialize_lock_ field.
9232         * errors.cc (Errors::Errors): Initialize new field.
9233         (Errors::initialize_lock): Use initialize_lock_ field.
9234         * powerpc.cc (class Target_selector_powerpc): Remove
9235         instantiated_target_ field.  In do_recognize call
9236         instantiate_target rather than do_instantiate_target.  In
9237         do_instantiate_target just allocate a new target.
9238         * sparc.cc (class Target_selector_sparc): Likewise.
9239
9240         * freebsd.h: New file.
9241         * i386.cc: Include "freebsd.h".
9242         (Target_i386): Derive from Target_freebsd rather than
9243         Sized_target.
9244         (Target_selector_i386): Derive from Target_selector_freebsd rather
9245         than Target_selector.
9246         * x86_64.cc: Include "freebsd.h".
9247         (Target_x86_64): Derive from Target_freebsd rather than
9248         Sized_target.
9249         (Target_selector_x86_64): Derive from Target_selector_freebsd
9250         rather than Target_selector.
9251         * target.h (class Target): Add adjust_elf_header and
9252         do_adjust_elf_header.
9253         * output.cc (Output_file_header:: do_sized_write): Call target
9254         adjust_elf_header routine.
9255         * configure.tgt: Set targ_osabi.
9256         * configure.ac: Define GOLD_DEFAULT_OSABI.
9257         * parameters.cc (Parameters::default_target): Pass
9258         GOLD_DEFAULT_OSABI to select_target.
9259         * target-select.h (class Target_selector): Make instantiate_target
9260         protected rather than private.
9261         * Makefile.am (HFILES): Add freebsd.h.
9262         * configure, Makefile.in, config.in: Rebuild.
9263
9264         * merge.cc (do_add_input_section): Correct pend value.  Change
9265         message about last entry not being null terminated from error to
9266         warning.
9267
9268 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9269
9270         * incremental.cc: New file.
9271         * Makefile.am (CCFILES): Add incremental.cc.
9272         * Makefile.in: Rebuild.
9273
9274 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9275
9276         * layout.cc (Layout::output_section_name): Preserve names
9277         of '.note.' sections.
9278
9279 2009-03-19  Ian Lance Taylor  <iant@google.com>
9280
9281         * descriptors.cc (Descriptors::open): Check that the options are
9282         valid before using them.
9283
9284 2009-03-18  Ian Lance Taylor  <iant@google.com>
9285
9286         * script-sections.h: Include <list>.
9287         (class Script_sections): Change Sections_elements from std::vector
9288         to std::list.  Typedef public Elements_iterator.  Add
9289         orphan_section_placement_, data_segment_align_start_, and
9290         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9291         field.
9292         * script-sections.cc (class Orphan_section_placement): New class.
9293         (class Sections_element): Add virtual functions is_relro and
9294         orphan_section_init.  Remove virtual function place_orphan_here.
9295         (class Output_section_definition): Add is_relro and
9296         orphan_section_init.  Remove place_orphan_here.
9297         (class Orphan_output_section): Likewise.
9298         (Script_sections::Script_sections): Update for field changes.
9299         (Script_sections::data_segment_align): Set saw_data_segment_align_
9300         and data_segment_align_start_, not data_segment_align_index.
9301         (Script_sections::data_segment_relro_end): Check
9302         saw_data_segment_align_.  Use data_segment_align_start_ rather
9303         than data_segment_align_index_.
9304         (Script_sections::place_orphan): Rewrite to use
9305         Orphan_section_placement.
9306
9307 2009-03-17  Ian Lance Taylor  <iant@google.com>
9308
9309         * archive.cc (Archive::add_symbols): Check for a version attached
9310         to the symbol name in the archive map.
9311         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9312         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9313         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9314         (ver_test_11.a): New target.
9315         * testsuite/Makefile.in: Rebuild.
9316
9317         * configure.ac: Check for chsize and posix_fallocate.  Replace
9318         ftruncate.
9319         * ftruncate.c: New file, from gnulib.
9320         * output.cc (posix_fallocate): Define dummy version if not
9321         HAVE_POSIX_FALLOCATE.
9322         (Output_file::map): Call posix_fallocate rather than lseek and
9323         write.
9324         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9325         * configure, Makefile.in, config.in: Rebuild.
9326
9327 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9328
9329         * layout.h (Layout::create_note): Add section_name parameter.
9330         * layout.cc (Layout::create_note): Likewise.
9331         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9332
9333 2009-03-17  Ian Lance Taylor  <iant@google.com>
9334
9335         * descriptors.cc: Include "options.h".
9336         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9337         (Descriptors::open): Always use O_CLOEXEC when opening a new
9338         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9339         then set FD_CLOEXEC.
9340
9341         * sparc.cc (class Target_sparc): Add has_got_section.
9342         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9343         make sure we have a GOT section.
9344
9345         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9346         (Target_sparc::Scan::local): Likewise.
9347         (Target_sparc::Scan::global): Likewise.
9348         (Target_sparc::Relocate::relocate): Likewise.
9349         (Target_sparc::Relocate::relocate_tls): Likewise.
9350
9351         * symtab.cc (Symbol_table::define_default_version): New function,
9352         broken out of add_from_object.
9353         (Symbol_table::add_from_object): Call define_default_version.
9354         (Symbol_table::define_special_symbol): Add resolve_oldsym
9355         parameter.  Change all callers.  If the version for a symbol comes
9356         from a version script, resolve it with the symbol with the same
9357         name with no version.  Also add the symbol without a version if
9358         appropriate.
9359         (do_define_in_output_data): If resolving with oldsym, don't delete
9360         sym.
9361         (do_define_in_output_segment): Likewise.
9362         (do_define_as_constant): Likewise.
9363         * symtab.h (class Symbol_table): Update declarations.
9364
9365 2009-03-13  Ian Lance Taylor  <iant@google.com>
9366
9367         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9368         (Read_symbols::requeue): New function.
9369         (Read_symbols::do_read_symbols): If make_elf_object fails because
9370         the target type is not configured, and the file was searched for,
9371         issue a warning and retry with the next directory.
9372         (Add_symbols::run): If the file has an incompatible format, and
9373         it was searched for, requeue the Read_symbols task.  On error,
9374         release the object.
9375         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9376         dirindex parameter to constructor.  Change all callers.  Declare
9377         incompatible_warning and requeue.
9378         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9379         input_argument_ and input_group_ fields.  Add them to
9380         constructor.  Change all callers.
9381         (class Read_script): Add dirindex_ field.  Add it to constructor.
9382         Change all callers.
9383         * archive.cc (Archive::setup): Remove input_objects parameter.
9384         Change all callers.
9385         (Archive::get_file_and_offset): Likewise.
9386         (Archive::read_all_symbols): Likewise.
9387         (Archive::read_symbols): Likewise.
9388         (Archive::get_elf_object_for_member): Remove input_objects
9389         parameter.  Add punconfigured parameter.  Change all callers.
9390         (Archive::add_symbols): Change return type to bool.  Check return
9391         value of include_member.
9392         (Archive::include_all_members): Likewise.
9393         (Archive::include_member): Change return type to bool.  Return
9394         false if first included object has incompatible target.  Set
9395         included_member_ field.
9396         (Add_archive_symbols::run): If add_symbols returns false, requeue
9397         Read_symbols task.
9398         * archive.h (class Archive): Add included_member_ field.
9399         Initialize it in constructor.  Add input_file and searched_for
9400         methods.  Update declarations.
9401         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9402         input_argument_ fields.  Add them to constructor.  Change all
9403         callers.
9404         * script.cc: Include "target-select.h".
9405         (class Parser_closure): Add skip_on_incompatible_target_ and
9406         found_incompatible_target_ fields.  Add
9407         skip_on_incompatible_target parameter to constructor.  Change all
9408         callers.  Add methods skip_on_incompatible_target,
9409         clear_skip_on_incompatible_target, found_incompatible_target, and
9410         set_found_incompatible_target.
9411         (read_input_script): Add dirindex parameter.  Change all callers.
9412         If parser finds an incompatible target, requeue Read_symbols
9413         task.
9414         (script_set_symbol): Clear skip_on_incompatible_target in
9415         closure.
9416         (script_add_assertion, script_parse_option): Likewise.
9417         (script_start_sections, script_add_phdr): Likewise.
9418         (script_check_output_format): New function.
9419         * script.h (read_input_script): Update declaration.
9420         * script-c.h (script_check_output_format): Declare.
9421         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9422         (ignore_cmd): Remove OUTPUT_FORMAT.
9423         * fileread.cc (Input_file::Input_file): Add explicit this.
9424         (Input_file::will_search_for): New function.
9425         (Input_file::open): Add pindex parameter.  Change all callers.
9426         * fileread.h (class Input_file): Add input_file_argument method.
9427         Declare will_search_for.  Update declarations.
9428         * object.cc (make_elf_object): Add punconfigured parameter.
9429         Change all callers.
9430         * object.h (class Object): Make input_file public.  Add
9431         searched_for method.
9432         (make_elf_object): Update declaration.
9433         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9434         restart search.
9435         * dirsearch.h (class Dirsearch): Update declaration.
9436         * options.h (class General_options): Add --warn-search-mismatch.
9437         * parameters.cc (Parameters::is_compatible_target): New function.
9438         * parameters.h (class Parameters): Declare is_compatible_target.
9439         * workqueue.cc (Workqueue::add_blocker): New function.
9440         * workqueue.h (class Workqueue): Declare add_blocker.
9441
9442         * fileread.cc (Input_file::open): Remove options parameter.
9443         Change all callers.
9444         (Input_file::open_binary): Likewise.
9445         * script.cc (read_input_script): Likewise.
9446         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9447         options parameter from constructor.  Change all callers.
9448         (class Read_script): Likewise.
9449         * fileread.h (class Input_file): Update declarations.
9450         * script.h (read_input_script): Update declaration.
9451
9452 2009-03-10  Nick Clifton  <nickc@redhat.com>
9453
9454         * po/es.po: New Spanish translation.
9455
9456 2009-03-06  Cary Coutant  <ccoutant@google.com>
9457
9458         * options.cc (parse_short_option): Keep dash_z from registering itself.
9459
9460 2009-03-03  Ian Lance Taylor  <iant@google.com>
9461
9462         PR 9918
9463         * target-reloc.h (relocate_section): Pass output_section to
9464         relocate.
9465         * i386.cc (Target_i386::should_apply_static_reloc): Add
9466         output_section parameter.  Change all callers.
9467         (Target_i386::Relocate::relocate): Add output_section parameter.
9468         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9469         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9470         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9471         * testsuite/two_file_shared.sh: New script.
9472         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9473         (check_DATA): Add two_file_shared.dbg.
9474         (two_file_shared.dbg): New target.
9475         * testsuite/Makefile.in: Rebuild.
9476
9477 2009-03-01  Ian Lance Taylor  <iant@google.com>
9478
9479         * configure.ac: Check for byteswap.h.
9480         * configure: Rebuild.
9481         * config.in: Rebuild.
9482
9483 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9484
9485         * layout.cc (Layout::find_or_add_kept_section): New function.
9486         (Layout::add_comdat): Removed.
9487         * layout.h (struct Kept_section): Move out of class Layout.
9488         Remove trailing underscores from field names.  Add group_sections
9489         field.  Rename group_ field to is_group.  Change all uses.
9490         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9491         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9492         comdat_groups_ field.
9493         (Sized_relobj::include_section_group): Use
9494         find_or_add_kept_section and Kept_section::group_sections.
9495         (Sized_relobj::include_linkonce_section): Likewise.
9496         * object.cc (class Sized_relobj): Don't define Comdat_group or
9497         Comdat_group_table.  Remove find_comdat_group and
9498         add_comdat_group.  Remove comdat_groups_ field.
9499         * plugin.cc (include_comdat_group): Use
9500         Layout::find_or_add_kept_section.
9501
9502 2009-02-28  Ian Lance Taylor  <iant@google.com>
9503
9504         * README: --gc-sections and map files are now supported.  Document
9505         some build requirements.
9506
9507         PR 6992
9508         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9509         relocatable link set the value of the section symbol to zero.
9510         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9511         relocatable link don't include the section address in the local
9512         symbol value.
9513
9514 2009-02-27  Ian Lance Taylor  <iant@google.com>
9515
9516         PR 6811
9517         * options.h (class Search_directory): Add is_system_directory.
9518         (class General_options): Declare is_in_system_directory.
9519         * options.cc (get_relative_sysroot): Make static.
9520         (get_default_sysroot): Make static.
9521         (General_optoins::is_in_system_directory): New function.
9522         * fileread.cc (Input_file::is_in_system_directory): New function.
9523         * fileread.h (class Input_file): Declare is_in_system_directory.
9524         * object.h (class Object): Add is_in_system_directory.
9525         (class Input_objects): Remove system_library_directory_ field.
9526         * object.cc (Input_objects::add_object): Don't set
9527         system_library_directory_.
9528         (input_objects::found_in_system_library_directory): Remove.
9529         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9530         parameter.  Change all callers.
9531         (Symbol_table::sized_write_globals): Likewise.
9532         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9533         Call Object::is_in_system_directory.
9534         * symtab.h (class Symbol_table): Update declarations.
9535
9536         PR 5990
9537         * descriptors.h (Open_descriptor): Add is_on_stack field.
9538         * descriptors.cc (Descriptors::open): If the descriptor is on the
9539         top of the stack, remove it.  Initialize is_on_stack field.
9540         (Descriptors::release): Only add pod to stack if it is not on the
9541         stack already.
9542         (Descriptors::close_some_descriptor): Clear stack_next and
9543         is_on_stack fields.
9544
9545         PR 7091
9546         * output.cc (Output_section::find_starting_output_address): Rename
9547         from starting_output_address; add PADDR parameter; change return
9548         type.
9549         * output.h (class Output_section): Declare
9550         find_starting_output_address instead of starting_output_address.
9551         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9552         section symbol for which we can't find a merge section.
9553
9554         PR 9836
9555         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9556         hidden or internal, force the symbol to be local.
9557         * resolve.cc (Symbol::override_visibility): Define.
9558         (Symbol::override_base): Use override_visibility.
9559         (Symbol_table::resolve): Likewise.
9560         (Symbol::override_base_with_special): Likewise.
9561         (Symbol_table::override_with_special): If the visibility is hidden
9562         or internal, force the symbol to be local.
9563         * symtab.h (class Symbol): Add set_visibility and
9564         override_visibility.
9565         * testsuite/ver_test_1.sh: New file.
9566         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9567         (check_DATA): Add ver_test_1.syms.
9568         (ver_test_1.syms): New target.
9569         * testsuite/Makefile.in: Rebuild.
9570
9571 2009-02-25  Cary Coutant  <ccoutant@google.com>
9572
9573         * layout.cc (Layout::choose_output_section): Don't rename sections
9574         when using a linker script that has a SECTIONS clause.
9575         * Makefile.in: Regenerate.
9576
9577         * testsuite/Makefile.am (script_test_5.sh): New test case.
9578         * testsuite/Makefile.in: Regenerate.
9579         * testsuite/script_test_5.cc: New file.
9580         * testsuite/script_test_5.sh: New file.
9581         * testsuite/script_test_5.t: New file.
9582
9583 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9584
9585         * archive.cc (Archive::include_member): Update calls to add_symbols.
9586         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9587         the Layout argument.
9588         * dynobj.h (do_add_symbols): Add the Layout argument.
9589         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9590         Layout argument.
9591         * object.h (Object::add_symbols): Add the Layout argument.
9592         (Object::do_add_symbols): Add the Layout argument.
9593         (Sized_relobj::do_add_symbols): Add the Layout argument.
9594         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9595         Unify the two versions.
9596         (Add_plugin_symbols): Remove.
9597         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9598         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9599         (Add_plugin_symbols): Remove.
9600         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9601         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9602         (Add_symbols::run): Make it work with Pulginobj.
9603
9604 2009-02-06  Ian Lance Taylor  <iant@google.com>
9605
9606         * object.cc (Sized_relobj::do_layout): Make info message start
9607         with lower case letter.
9608
9609 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9610
9611         * binary.cc: Fix file comment.
9612
9613         * options.h (enum Incremental_disposition): Define.
9614         (class General_options): Add new options: --incremental,
9615         --incremental_changed, --incremental_unchanged,
9616         --incremental_unknown.  Add incremental_disposition_ and
9617         implicit_incremental_ fields.
9618         (General_options::incremental_disposition): New function.
9619         (class Position_dependent_options): Add incremental_disposition
9620         option.
9621         (Position_dependent_options::copy_from_options): Set incremental
9622         dispositions.
9623         * options.cc (General_options::parse_incremental_changed): New
9624         function.
9625         (General_options::parse_incremental_unchanged): New function.
9626         (General_options::parse_incremental_unknown): New function.
9627         (General_options::General_options): Initialize new fields
9628         incremental_disposition_ and implicit_incremental_.
9629         (General_options::finalize): Check for uasge of --incremental-*
9630         without --incremental.
9631
9632 2009-02-06  Chris Demetriou  <cgd@google.com>
9633
9634         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9635         pointer and to report location as the file name associated with
9636         the symbol.
9637         (gold_undefined_symbol_at_location): New function to replace the
9638         old gold_undefined_symbol functionality.
9639         * target-reloc.h (relocate_section): Update to use
9640         gold_undefined_symbol_at_location.
9641         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9642         Call gold_undefined_symbol function rather than gold_error.
9643         * errors.h (Errors::undefined_symbol): Take location as a
9644         string, rather than calculating it from a relocation.
9645         * errors.cc (Errors::fatal): Print "fatal error:" before the
9646         formatted message.
9647         (Errors::error, Errors::error_at_location): Print "error: "
9648         before the formatted message.
9649         (Errors::undefined_symbol): Take location as a string, rather
9650         than calculating it from a relocation.
9651         (gold_undefined_symbol_at_location): New function akin to
9652         old gold_undefined_symbol, calculates location from relocation.
9653         (gold_undefined_symbol): Change to take only a Symbol pointer
9654         and to report location as the file name associated with the symbol.
9655         * testsuite/debug_msg.sh: Update for changed error messages.
9656         * testsuite/undef_symbol.sh: Likewise.
9657
9658 2009-02-04  Duncan Sands  <baldrick@free.fr>
9659
9660         PR 9812
9661         * reduced_debug_output.h
9662         (Output_reduced_debug_abbrev_section::failed): Use format for
9663         gold_warning.
9664         (Output_reduced_debug_info_section::faild): Likewise.
9665
9666 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9667
9668         * script.cc (Lazy_demangler): New class.
9669         (Version_script_info::get_symbol_version_helper): Demangle a
9670         symbol only once.
9671
9672 2009-01-29  Cary Coutant  <ccoutant@google.com>
9673
9674         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9675         to __tls_get_addr.
9676         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9677
9678 2009-01-28  Ian Lance Taylor  <iant@google.com>
9679
9680         * version.cc (version_string): Bump to 1.9.
9681
9682         * gold.h: Include <cstring> and <stdint.h>.
9683         * version.cc: Include <cstdio>.
9684         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9685         warning.
9686         * reduced_debug_output.cc (insert_into_vector): Rename from
9687         Insert_into_vector; change all callers.  Use Swap_unaligned to
9688         avoid aliasing issue; remove union since it is unnecessary.
9689
9690 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9691
9692         * Makefile.am (CCFILES): Add gc.cc.
9693         (HFILES): Add gc.h.
9694         * Makefile.in: Regenerate.
9695         * gold.cc (Gc_runner): New class.
9696         (queue_initial_tasks): Call garbage collection related tasks
9697         when corresponding options are invoked.
9698         (queue_middle_gc_tasks): New function.
9699         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9700         processed early before laying out sections during garbage collection.
9701         * gold.h (queue_middle_gc_tasks): New function.
9702         (is_prefix_of): Move from "layout.cc".
9703         * i386.cc (Target_i386::gc_process_relocs): New function.
9704         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9705         * main.cc (main): Create object of class "Garbage_collection".
9706         * object.cc (Relobj::copy_symbols_data): New function.
9707         (Relobj::is_section_name_included): New function.
9708         (Sized_relobj::do_layout): Allow this function to be called twice
9709         during garbage collection and defer layout of section during the
9710         first call.
9711         * object.h (Relobj::get_symbols_data): New function.
9712         (Relobj::is_section_name_included): New function.
9713         (Relobj::copy_symbols_data): New function.
9714         (Relobj::set_symbols_data): New function.
9715         (Relobj::get_relocs_data): New function.
9716         (Relobj::set_relocs_data): New function.
9717         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9718         (Relobj::gc_process_relocs): New function.
9719         (Relobj::do_gc_process_relocs): New pure virtual function.
9720         (Relobj::sd_): New data member.
9721         (Sized_relobj::is_output_section_offset_invalid): New function.
9722         (Sized_relobj::do_gc_process_relocs): New function.
9723         * options.h (General_options::gc_sections): Modify to not be a no-op.
9724         (General_options::print_gc_sections): New option.
9725         * plugin.cc (Plugin_finish::run): Remove function call to
9726         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9727         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9728         * reloc.cc (Read_relocs::run): Add task to process relocs and
9729         determine unreferenced sections when doing garbage collection.
9730         (Gc_process_relocs): New class.
9731         (Sized_relobj::do_gc_process_relocs): New function.
9732         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9733         sections that are garbage collected.
9734         * reloc.h (Gc_process_relocs): New class.
9735         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9736         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9737         symbols whose corresponding sections are garbage collected.
9738         (Symbol_table::Symbol_table): Add new parameter for the garbage
9739         collection object.
9740         (Symbol_table::gc_mark_undef_symbols): New function.
9741         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9742         (Symbol_table::gc_mark_dyn_syms): New function.
9743         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9744         as garbage.
9745         (Symbol_table::add_from_object): Likewise.
9746         (Symbol_table::add_from_relobj): When building shared objects, do not
9747         treat externally visible symbols as garbage.
9748         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9749         table information for static and relocatable links.
9750         * symtab.h (Symbol_table::set_gc): New function.
9751         (Symbol_table::gc): New function.
9752         (Symbol_table::gc_mark_undef_symbols): New function.
9753         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9754         (Symbol_table::gc_mark_dyn_syms): New function.
9755         (Symbol_table::gc_): New data member.
9756         * target.h (Sized_target::gc_process_relocs): New pure virtual
9757         function.
9758         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9759         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9760
9761 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9762
9763         * options.h (General_options::gc_sections): Define as a no-op for now.
9764         (General_options::no_keep_memory): Ditto.
9765         (General_options::Bshareable): Define.
9766         * options.cc (General_options::finalize): Honor -Bshareable.
9767
9768 2009-01-20  Andreas Schwab  <schwab@suse.de>
9769
9770         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9771         read the value in the contents, since we don't use it.  Use the
9772         template endianness when writing.
9773         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9774
9775 2009-01-19  Andreas Schwab  <schwab@suse.de>
9776
9777         * configure.tgt (powerpc64-*): Fix targ_obj.
9778
9779 2009-01-15  Ian Lance Taylor  <iant@google.com>
9780
9781         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9782         local symbols when stripping all symbols.
9783
9784 2009-01-14  Cary Coutant  <ccoutant@google.com>
9785
9786         * output.cc (Output_reloc): Add explicit instantiations.
9787
9788 2009-01-14  Cary Coutant  <ccoutant@google.com>
9789
9790         * archive.cc (Archive::get_elf_object_for_member): Remove call
9791         to File_read::claim_for_plugin.
9792         * descriptors.cc (Descriptors::open): Remove reference to
9793         is_claimed.
9794         (Descriptors::claim_for_plugin): Remove.
9795         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9796         (Descriptors::is_claimed): Remove.
9797         (claim_descriptor_for_plugin): Remove.
9798         * fileread.cc (File_read::claim_for_plugin): Remove.
9799         * fileread.h (File_read::claim_for_plugin): Remove.
9800         (File_read::descriptor): Reopen descriptor if necessary.
9801         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9802         (Plugin_manager::all_symbols_read): Add task parameter. Change
9803         all callers.
9804         (Plugin_manager::get_input_file): New function.
9805         (Plugin_manager::release_input_file): New function.
9806         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9807         corresponding data member.
9808         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9809         and pass to base constructor. Change all callers.
9810         (get_input_file, release_input_file): New functions.
9811         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9812         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9813         (Plugin_manager::all_symbols_read): Add task parameter.
9814         (Plugin_manager::get_input_file): New function.
9815         (Plugin_manager::release_input_file): New function.
9816         (Plugin_manager::task_): New data member.
9817         (Pluginobj::Pluginobj): Add filesize parameter.
9818         (Pluginobj::filename): New function.
9819         (Pluginobj::descriptor): New function.
9820         (Pluginobj::filesize): New function.
9821         (Pluginobj::filesize_): New data member.
9822         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9823         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9824         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9825
9826         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9827         with archive libraries.
9828         * testsuite/Makefile.in: Regenerate.
9829         * testsuite/plugin_test.c (struct sym_info): New type.
9830         (get_input_file, release_input_file): New static variables.
9831         (onload): Capture new transfer vector entries.
9832         (claim_file_hook): Stop reading at end of file according to filesize.
9833         Factor out parsing of readelf output into separate function.
9834         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9835         APIs and get the source file name from the symbol table.  Convert
9836         source file name to corresponding object file name.  Print info
9837         message when adding new input files.
9838         (parse_readelf_line): New function.
9839         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9840         * testsuite/plugin_test_2.sh: Likewise.
9841         * testsuite/plugin_test_3.sh: Likewise.
9842         * testsuite/plugin_test_4.sh: New test case.
9843
9844 2009-01-07  Ian Lance Taylor  <iant@google.com>
9845
9846         * version.cc (version_string): Bump to 1.8.
9847
9848 2008-12-23  Cary Coutant  <ccoutant@google.com>
9849
9850         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9851         * plugin.cc (Plugin_manager::finish): Rename as
9852         layout_deferred_objects.  Move cleanup to separate function.
9853         (Plugin_manager::cleanup): New function.
9854         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9855         separately.
9856         * plugin.h (Plugin_manager::finish): Rename as
9857         layout_deferred_objects.
9858         (Plugin_manager::cleanup): New function.
9859         (Plugin_manager::cleanup_done): New field.
9860
9861 2008-12-23  Cary Coutant  <ccoutant@google.com>
9862
9863         * plugin.cc (is_visible_from_outside): New function.
9864         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9865         so we don't return "IR only" status for exported symbols or -r links.
9866
9867         * testsuite/Makefile.am (plugin_test_3): New test case.
9868         * testsuite/Makefile.in: Regenerate.
9869         * testsuite/plugin_test_3.sh: New file.
9870
9871 2008-12-22  Cary Coutant  <ccoutant@google.com>
9872
9873         * object.cc (Sized_relobj::layout_section): New function.
9874         (Sized_relobj::do_layout): Defer layout of input sections until after
9875         plugin has provided replacement files.
9876         (Sized_relobj::do_layout_deferred_sections): New function.
9877         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9878         (Relobj::layout_deferred_sections): New function.
9879         (Relobj::do_layout_deferred_sections): New function.
9880         (Sized_relobj::do_layout_deferred_sections): New function.
9881         (Sized_relobj::layout_section): New function.
9882         (Sized_relobj::Deferred_layout): New structure.
9883         (Sized_relobj::deferred_layout_): New field.
9884         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9885         Change all callers.  Layout deferred sections.
9886         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9887         references.
9888         (Plugin_hook::run): Move code from do_plugin_hook inline.
9889         (Plugin_hook::do_plugin_hook): Remove.
9890         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9891         (Plugin_manager::finish): Renamed, was cleanup.
9892         (Plugin_manager::should_defer_layout): New function.
9893         (Plugin_manager::add_deferred_layout_object): New function.
9894         (Plugin_manager::Deferred_layout_list): New type.
9895         (Plugin_manager::deferred_layout_objects_): New field.
9896         (Plugin_hook::do_plugin_hook): Remove.
9897
9898 2008-12-17  Ian Lance Taylor  <iant@google.com>
9899
9900         * options.h (class General_options): Add --no case for
9901         --export-dynamic.
9902
9903 2008-12-16  Cary Coutant  <ccoutant@google.com>
9904
9905         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9906         vector.
9907         (Plugin_manager::claim_file): Create plugin object even if
9908         plugin did not call the add_symbols callback.
9909         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9910         asking for more symbols than were added.
9911         * testsuite/Makefile.am (plugin_test_1): Add test case with
9912         no global symbols.
9913         (empty.syms): New target.
9914         * testsuite/Makefile.in: Regenerate.
9915         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9916         message. Don't call add_symbols if no globals.
9917         (all_symbols_read_hook): Don't provide replacement for empty
9918         claimed file.
9919
9920 2008-12-12  Ian Lance Taylor  <iant@google.com>
9921
9922         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9923         r_type == 0 for a local symbol with r_sym == 0.
9924         (scan_relocatable_relocs): Pass r_sym to
9925         local_non_section_strategy.
9926         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9927         r_sym parameter.
9928
9929         * configure.ac: Update test for TLS descriptors: they are
9930         supported as of glibc 2.9.
9931         * configure: Rebuild.
9932
9933 2008-12-11  Ian Lance Taylor  <iant@google.com>
9934
9935         PR 7091
9936         * target-reloc.h (Default_scan_relocatable_relocs): For each
9937         function, map r_type == 0 to RELOC_DISCARD.
9938
9939 2008-12-10  Cary Coutant  <ccoutant@google.com>
9940
9941         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9942         object to override a kept COMDAT group from a plugin object.
9943
9944 2008-12-09  Ian Lance Taylor  <iant@google.com>
9945
9946         PR 7088
9947         * yyscript.y (file_cmd): Handle INPUT.
9948
9949         * testsuite/initpri1.c: Change all declarations to be full
9950         prototypes by adding void, to avoid compiler warnings.
9951
9952 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9953
9954         * options.cc (General_options::parse_plugin_opt): New.
9955         (General_options::add_plugin): The argument now is just the filename.
9956         (General_options::add_plugin_option): New.
9957         * options.h (plugin_opt): New.
9958         (add_plugin): Change argument name.
9959         (add_plugin_option): New.
9960         * plugin.cc (Plugin::load): Don't parse the plugin option.
9961         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9962         (Plugin::add_option): New.
9963         (Plugin::args_): Change type.
9964         (Plugin::filename_): New.
9965         (Plugin_manager::add_plugin_option): New.
9966         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9967         * testsuite/Makefile.in: Regenerate.
9968
9969 2008-12-05  Cary Coutant  <ccoutant@google.com>
9970
9971         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9972         Handle --strip-lto-sections option.
9973         * options.h (strip_lto_sections): New option.
9974
9975 2008-12-01  Cary Coutant  <ccoutant@google.com>
9976
9977         * plugin.cc (ld_plugin_message): Change format parameter to const.
9978         Fix mismatch between new[] and delete.
9979
9980 2008-11-14  Cary Coutant  <ccoutant@google.com>
9981
9982         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9983         instead of -1U.
9984
9985 2008-11-05  Craig Silverstein  <csilvers@google.com>
9986
9987         * options.cc (General_options::parse_dynamic_list): New function.
9988         * options.h (General_options): New flags dynamic_list,
9989         dynamic_list_data, dynamic_list_cpp_new, and
9990         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9991         (General_options::in_dynamic_list): New function.
9992         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9993         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9994         (Lex::can_continue_name): Likewise.
9995         (yylex): Likewise.
9996         (read_script_file): New parameter script_options.
9997         (read_dynamic_list): New function.
9998         (Script_options::define_dynamic_list): New function.
9999         (dynamic_list_keyword_parsecodes): New variable.
10000         (dynamic_list_keywords): New variable.
10001         * script.h (Script_options::define_dynamic_list): New function
10002         prototype.
10003         (read_dynamic_list): New function prototype.
10004         * symtab.cc (strprefix): New macro.
10005         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10006         dynamic_list_data, dynamic_list_cpp_new, and
10007         dynamic_list_cpp_typeinfo.
10008         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10009         (dynamic_list_expr): New rule.
10010         (dynamic_list_nodes): Likewise.
10011         (dynamic_list_node): Likewise.
10012         * testsuite/Makefile.am (dynamic_list): New test.
10013         * testsuite/Makefile.in: Regenerated.
10014         * testsuite/dynamic_list.t: New file.
10015         * testsuite/dynamic_list.sh: New file.
10016
10017 2008-11-05  Craig Silverstein  <csilvers@google.com>
10018
10019         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10020         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10021         (t11_last): Likewise.
10022         * testsuite/ver_test_6.c (main): Likewise.
10023
10024 2008-10-07  Cary Coutant  <ccoutant@google.com>
10025
10026         * options.c (General_options::finalize): Add check for -static and
10027         -shared.
10028         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10029         is not empty.
10030
10031 2008-10-02  Cary Coutant  <ccoutant@google.com>
10032
10033         * plugin.cc (make_sized_plugin_object): Fix conditional
10034         compilation to work when not all targets are enabled.
10035
10036 2008-09-29  Cary Coutant  <ccoutant@google.com>
10037
10038         * archive.cc (Archive::get_file_and_offset): Use filename instead
10039         of name to get library path.
10040         (Archive::include_member): Unlock external member of a thin archive.
10041
10042         * testsuite/Makefile.am (TEST_AR): New variable.
10043         (thin_archive_test_1): New test.
10044         (thin_archive_test_2): New test.
10045         * testsuite/Makefile.in: Regenerate.
10046         * testsuite/thin_archive_main.cc: New file.
10047         * testsuite/thin_archive_test_1.cc: New file.
10048         * testsuite/thin_archive_test_2.cc: New file.
10049         * testsuite/thin_archive_test_3.cc: New file.
10050         * testsuite/thin_archive_test_4.cc: New file.
10051
10052 2008-09-29  Cary Coutant  <ccoutant@google.com>
10053
10054         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10055         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10056         instead of -1U.
10057         (Sized_relobj::do_finalize_local_symbols): Likewise.
10058         (Sized_relobj::map_to_kept_section): Likewise.
10059         * object.h (Sized_relobj::invalid_address): New constant.
10060         (Sized_relobj::do_output_section_offset): Check for invalid_address
10061         and return -1ULL.
10062         * output.cc (Output_reloc::local_section_offset): Use constant
10063         invalid_address instead of -1U.
10064         (Output_reloc::get_address): Likewise.
10065         (Output_section::output_address): Change -1U to -1ULL.
10066         * output.h (Output_reloc::invalid_address): New constant.
10067         * reloc.cc (Sized_relobj::write_sections): Use constant
10068         invalid_address instead of -1U.
10069         (Sized_relobj::relocate_sections): Likewise.
10070         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10071         values for merge sections.
10072         * target-reloc.h (relocate_for_relocatable): Use constant
10073         invalid_address instead of -1U.
10074
10075 2008-09-19  Cary Coutant  <ccoutant@google.com>
10076
10077         Add plugin functionality for link-time optimization (LTO).
10078         * configure.ac (plugins): Add --enable-plugins option.
10079         * configure: Regenerate.
10080         * config.in: Regenerate.
10081         * Makefile.am (LIBDL): New variable.
10082         (CCFILES): Add plugin.cc.
10083         (HFILES): Add plugin.h.
10084         (ldadd_var): Add LIBDL.
10085         * Makefile.in: Regenerate.
10086
10087         * archive.cc: Include "plugin.h".
10088         (Archive::setup): Don't preread archive symbols when using a plugin.
10089         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10090         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10091         files.
10092         (Archive::include_member): Add symbols from plugin objects.
10093         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10094         * descriptors.cc (Descriptors::open): Check for file descriptors
10095         abandoned by plugins.
10096         (Descriptors::claim_for_plugin): New function.
10097         * descriptors.h (Descriptors::claim_for_plugin): New function.
10098         (Open_descriptor::is_claimed): New field.
10099         (claim_descriptor_for_plugin): New function.
10100         * fileread.cc (File_read::claim_for_plugin): New function.
10101         * fileread.h (File_read::claim_for_plugin): New function.
10102         (File_read::descriptor): New function.
10103         * gold.cc: Include "plugin.h".
10104         (queue_initial_tasks): Add task to call plugin hooks for generating
10105         new object files.
10106         * main.cc: Include "plugin.h".
10107         (main): Load plugin libraries.
10108         * object.h (Pluginobj): Declare.
10109         (Object::pluginobj): New function.
10110         (Object::do_pluginobj): New function.
10111         (Object::set_target): New function.
10112         * options.cc: Include "plugin.h".
10113         (General_options::parse_plugin): New function.
10114         (General_options::General_options): Initialize plugins_ field.
10115         (General_options::add_plugin): New function.
10116         * options.h (Plugin_manager): Declare.
10117         (General_options): Add --plugin option.
10118         (General_options::has_plugins): New function.
10119         (General_options::plugins): New function.
10120         (General_options::add_plugin): New function.
10121         (General_options::plugins_): New field.
10122         * plugin.cc: New file.
10123         * plugin.h: New file.
10124         * readsyms.cc: Include "plugin.h".
10125         (Read_symbols::do_read_symbols): Check for archive before checking
10126         for ELF file.  Call plugin hooks to claim files.
10127         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10128         from a real object file; force override when processing replacement
10129         files.
10130         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10131         (Symbol::init_base_object): Likewise.
10132         (Symbol::init_base_output_data): Likewise.
10133         (Symbol::init_base_output_segment): Likewise.
10134         (Symbol::init_base_constant): Likewise.
10135         (Symbol::init_base_undefined): Likewise.
10136         (Symbol::output_section): Assert that object is not a plugin.
10137         (Symbol_table::add_from_pluginobj): New function.
10138         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10139         undefined.
10140         (Symbol_table::sized_write_globals): Likewise.
10141         (Symbol_table::add_from_pluginobj): Instantiate template.
10142         * symtab.h (Sized_pluginobj): Declare.
10143         (Symbol::in_real_elf): New function.
10144         (Symbol::set_in_real_elf): New function.
10145         (Symbol::in_real_elf_): New field.
10146         (Symbol_table::add_from_pluginobj): New function.
10147
10148         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10149         (LIBDL): New variable.
10150         (LDADD): Add LIBDL.
10151         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10152         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10153         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10154         (MOSTLYCLEANFILES): Likewise.
10155         * testsuite/Makefile.in: Regenerate.
10156         * testsuite/plugin_test.c: New file.
10157         * testsuite/plugin_test_1.sh: New file.
10158         * testsuite/plugin_test_2.sh: New file.
10159
10160 2008-09-16  Ian Lance Taylor  <iant@google.com>
10161
10162         * target-reloc.h (relocate_section): Check whether a symbol is
10163         defined by the ABI before reporting an undefined symbol error.
10164         * target.h (Target::is_defined_by_abi): Make parameter const.
10165         (Target::do_is_defined_by_abi): Likewise.
10166         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10167         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10168         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10169         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10170         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10171         * testsuite/Makefile.in: Rebuild.
10172
10173         * fileread.cc (make_view): Add casts to avoid warning.
10174
10175 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10176
10177         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10178         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10179
10180 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10181
10182         * options.h (General_options::output_is_executable): New.
10183         (General_options::output_is_pie): New.
10184         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10185         for shared libraries.
10186         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10187
10188 2008-09-11  Chris Demetriou  <cgd@google.com>
10189
10190         * options.h (origin): New -z option.
10191         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10192         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10193         in DT_FLAGS_1.
10194
10195 2008-09-05  Cary Coutant  <ccoutant@google.com>
10196
10197         * fileread.cc (File_read::make_view): Add check for attempt to map
10198         beyond end of file.
10199
10200 2008-09-05  Cary Coutant  <ccoutant@google.com>
10201
10202         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10203         explicit instantiations.
10204
10205 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10206
10207         PR gold/6858
10208         * options.cc (General_options::finalize): Allow undefined symbols
10209         in shlibs if linking -shared.
10210
10211         PR gold/6859
10212         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10213         symbols as not needing a dynsym entry.
10214
10215 2008-08-20  Craig Silverstein  <csilvers@google.com>
10216
10217         * fileread.cc (File_read::open): Do not lock the file unless it
10218         was successfully opened.
10219
10220 2008-08-14  Cary Coutant  <ccoutant@google.com>
10221
10222         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10223         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10224         * testsuite/tls_test.cc (struct int128): 128-bit struct
10225         for testing TLS relocs with non-zero addend.
10226         (v12): New TLS variable.
10227         (t12): New test.
10228         (t_last): Add check for v12.
10229         * testsuite/tls_test.h (t12): New function.
10230         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10231
10232 2008-08-13  Ian Lance Taylor  <iant@google.com>
10233
10234         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10235         set tls_segment_ or relro_segment_.
10236         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10237         when appropriate.
10238         * output.h (Output_section::clear_is_relro): New function.
10239         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10240         sections specially even when output_data_ is empty.
10241         (Output_segment::maximum_alignment): When first section is relro,
10242         only force alignment for PT_LOAD segments.
10243         * script.cc (script_data_segment_align): New function.
10244         (script_data_segment_relro_end): New function.
10245         * script-c.h (script_data_segment_align): Declare.
10246         (script_data_segment_relro_end): Declare.
10247         * script-sections.h (class Script_sections): Declare
10248         data_segment_align and data_segment_relro_end.  Add fields
10249         segment_align_index_ and saw_relro_end_.
10250         * script-sections.cc (class Sections_element): Add set_is_relro
10251         virtual function.  Add new bool* parameter to place_orphan_here.
10252         Add get_output_section virtual function.
10253         (class Output_section_definition): Add set_is_relro.  Add new
10254         bool* parameter to place_orphan_here.  Add get_output_section.
10255         Add is_relro_ field.
10256         (Output_section_definition::Output_section_definition): Initialize
10257         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10258         and is_relro_ fields.
10259         (Output_section_definition::place_orphan_here): Add is_relro
10260         parameter.
10261         (Output_section_definition::set_section_addresses): Set relro for
10262         output section.
10263         (Output_section_definition::alternate_constraint): Likewise.
10264         (class Orphan_output_section): Add new bool* parameter to
10265         place_orphan_here.  Add get_output_section.
10266         (Orphan_output_section::place_orphan_here): Add is_relro
10267         parameter.
10268         (Script_sections::Script_sections): Initialize
10269         data_segment_align_index_ and saw_relro_end_.
10270         (Script_sections::data_segment_align): New function.
10271         (Script_sections::data_segment_relro_end): New function.
10272         (Script_sections::place_orphan): Set or clear is_relro.
10273         (Script_sections::set_section_addresses): Force alignment of first
10274         TLS section.
10275         * yyscript.y (exp): Call script_data_segment_align and
10276         script_data_segment_relro_end.
10277         * testsuite/relro_script_test.t: New file.
10278         * testsuite/relro_test.cc (using_script): Declare.
10279         (t1, t2): Test using_script.
10280         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10281         (relro_script_test_SOURCES): Define.
10282         (relro_script_test_DEPENDENCIES): Define.
10283         (relro_script_test_LDFLAGS): Define.
10284         (relro_script_test_LDADD): Define.
10285         (relro_script_test.so): New target.
10286         * testsuite/Makefile.in: Rebuild.
10287
10288 2008-08-06  Cary Coutant <ccoutant@google.com>
10289
10290         * archive.cc (Archive::total_archives, Archive::total_members)
10291         (Archive::total_members_loaded): New variables.
10292         (Archive::setup): Add parameter.  Add option to preread
10293         archive symbols.
10294         (Archive::read_armap): Add counter.
10295         (Archive::get_file_and_offset): New function.
10296         (Archive::get_elf_object_for_member): New function.
10297         (Archive::read_all_symbols): New function.
10298         (Archive::read_symbols): New function.
10299         (Archive::add_symbols): Add counters.
10300         (Archive::include_all_members): Use armap to find members if it's
10301         already built.
10302         (Archive::include_member): Skip reading symbols if already read.
10303         Factored code into Archive::get_file_and_offset and
10304         Archive::get_elf_object_for_member.  Changed call to
10305         Mapfile::report_include_archive_member.
10306         (Archive::print_stats): New function.
10307         * archive.h: Declare Object and Read_symbols_data classes.
10308         (Archive::Archive): Add initializers for new members.
10309         (Archive::setup): Add parameter.
10310         (Archive::print_stats): New function.
10311         (Archive::total_archives, Archive::total_members)
10312         (Archive::total_members_loaded): New variables.
10313         (Archive::get_file_and_offset): New function.
10314         (Archive::get_elf_object_for_member): New function.
10315         (Archive::read_all_symbols): New function.
10316         (Archive::read_symbols): New function.
10317         (Archive::Archive_member): New class.
10318         (Archive::members_): New member.
10319         (Archive::num_members_): New member.
10320         * main.cc: Include archive.h.
10321         (main): Call Archive::print_stats.
10322         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10323         archive parameter; member_name is now the fully-decorated name.
10324         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10325         * options.h: (General_options): Add --preread-archive-symbols option.
10326         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10327         Archive::setup.
10328
10329 2008-08-04  Ian Lance Taylor  <iant@google.com>
10330
10331         * symtab.h (Symbol::use_plt_offset): New function.
10332         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10333         * powerpc.cc (Relocate::relocate): Likewise.
10334         * sparc.cc (Relocate::relocate): Likewise.
10335         * x86_64.cc (Relocate::relocate): Likewise.
10336         * testsuite/weak_plt.sh: New test.
10337         * testsuite/weak_plt_main.cc: New test.
10338         * testsuite/weak_plt_shared.cc: New test.
10339         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10340         (check_PROGRAMS): Add weak_plt.
10341         (check_DATA): Add weak_plt_shared.so.
10342         (weak_plt_main_pic.o, weak_plt): New targets.
10343         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10344         * testsuite/Makefile.in: Rebuild.
10345
10346         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10347         gcctestdir/ld.
10348         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10349         * testsuite/Makefile.in: Rebuild.
10350
10351 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10352
10353         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10354         * Makefile.in: Regenerate.
10355         * po/POTFILES.in: Regenerate.
10356
10357 2008-07-29  Ian Lance Taylor  <iant@google.com>
10358
10359         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10360         symbols before other symbols.
10361         * testsuite/script_test_2.cc (test_addr): Declare.
10362         (test_addr_alias): Declare.
10363         (main): Check that test_addr and test_addr_alias have the right
10364         values.
10365         * testsuite/script_test_2.t: Define test_addr_alias and
10366         test_addr.
10367
10368 2008-07-24  Ian Lance Taylor  <iant@google.com>
10369
10370         PR 5990
10371         * descriptors.cc: New file.
10372         * descriptors.h: New file.
10373         * gold-threads.h (class Hold_optional_lock): New class.
10374         * fileread.cc: Include "descriptors.h".
10375         (File_read::~File_read): Release descriptor rather than closing
10376         it.
10377         (File_read::open) [file]: Call open_descriptor rather than open.
10378         Set is_descriptor_opened_.
10379         (File_read::open) [memory]: Assert that descriptor is not open.
10380         (File_read::reopen_descriptor): New function.
10381         (File_read::release): Release descriptor.
10382         (File_read::do_read): Make non-const.  Reopen descriptor.
10383         (File_read::read): Make non-const.
10384         (File_read::make_view): Reopen descriptor.
10385         (File_read::do_readv): Likewise.
10386         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10387         Update declarations.
10388         * layout.cc: Include "descriptors.h".
10389         (Layout::create_build_id): Use open_descriptor rather than open.
10390         * output.cc: Include "descriptors.h".
10391         (Output_file::open): Use open_descriptor rather than open.
10392         * archive.cc (Archive::const_iterator): Change Archive to be
10393         non-const.
10394         (Archive::begin, Archive::end): Make non-const.
10395         (Archive::count_members): Likewise.
10396         * archive.h (class Archive): Update declarations.
10397         * object.h (Object::read): Make non-const.
10398         * Makefile.am (CCFILES): Add descriptors.cc.
10399         (HFILES): Add descriptors.h.
10400         * Makefile.in: Rebuild.
10401
10402         PR 6716
10403         * gold.h: Always include <clocale>.  Add Solaris workarounds
10404         following code in binutils/sysdep.h.
10405
10406         PR 6048
10407         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10408         this->eh_frame_hdr_ is NULL before using it.
10409
10410         * dynobj.cc (Versions::Versions): Update comment.
10411
10412         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10413         the base version name.
10414
10415         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10416         array size plus one.
10417         (Stringpool_template::set_string_offsets): Subtract one from key
10418         before using it as an array index.
10419         (Stringpool_template::get_offset_with_length): Likewise.
10420         (Stringpool_template::write_to_buffer): Likewise.
10421         * stringpool.h (Stringpool_template::get_offset_from_key):
10422         Likewise.
10423
10424 2008-07-23  Ian Lance Taylor  <iant@google.com>
10425
10426         PR 6658
10427         * object.h (Merged_symbol_value::value): Do our best to handle a
10428         negative addend.
10429
10430         PR 6647
10431         * script.cc (Version_script_info::get_versions): Don't add empty
10432         version tag to return value.
10433         (Version_script_info::get_symbol_version_helper): Change return
10434         type to bool.  Add pversion parameter.  Change all callers.
10435         (script_register_vers_node): Don't require a non-NULL tag.
10436         * script.h (class Version_script_info): Update declarations.
10437         (Version_script_info::get_symbol_version): Change return type to
10438         bool.  Add version parameter.  Change all callers.
10439         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10440         handling.  Handle an empty version from a version script.
10441         (Symbol_table::define_special_symbol): Likewise.
10442         * testsuite/ver_test_10.script: New file.
10443         * testsuite/ver_test_10.sh: New file.
10444         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10445         (check_DATA): Add ver_test_10.syms.
10446         (ver_test_10.syms, ver_test_10.so): New target.
10447         * testsuite/Makefile.in: Rebuild.
10448
10449 2008-07-23  Simon Baldwin  <simonb@google.com>
10450
10451         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10452         to zero for undefined symbols from dynamic libraries.
10453
10454 2008-07-23  Ian Lance Taylor  <iant@google.com>
10455
10456         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10457         Change all callers.
10458         * symtab.h (class Symbol_table): Update declaration.
10459         * testsuite/ver_test_9.cc: New file.
10460         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10461         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10462         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10463         (ver_test_9.so, ver_test_9.o): New targets.
10464         * testsuite/Makefile.in: Rebuild.
10465
10466 2008-07-22  Ian Lance Taylor  <iant@google.com>
10467
10468         * options.h (class General_options): Define --check-sections.
10469         * layout.cc (Layout::set_segment_offsets): Handle
10470         --check-sections.
10471
10472         * options.h (class General_options): Define -n/--nmagic and
10473         -N/--omagic.
10474         * options.cc (General_options::finalize): For -n/--nmagic or
10475         -N/--omagic, set -static.
10476         * layout.cc (Layout::attach_allocated_section_to_segment): If
10477         -N/--omagic, don't put read-only and read-write sections in
10478         different segments.
10479         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10480         finding a read-only segment.
10481         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10482         don't set the minimum segment alignment to the common page size,
10483         and don't set the file offset to the address modulo the page size.
10484         * script-sections.cc (Script_sections::create_segments): If
10485         -n/--omagic, don't put read-only and read-write sections in
10486         different segments.
10487
10488         * cref.cc: New file.
10489         * cref.h: New file.
10490         * options.h (class General_options): Add --print-symbol-counts.
10491         * main.cc (main): Issue defined symbol report if requested.
10492         * archive.cc (Archive::interpret_header): Make into a const member
10493         function.
10494         (Archive::add_symbols): Call Input_objects::archive_start and
10495         archive_stop.
10496         (Archive::const_iterator): Define new class.
10497         (Archive::begin, Archive::end): New functions.
10498         (Archive::include_all_members): Rewrite to use iterator.
10499         (Archive::count_members): New function.
10500         * archive.h (class Archive): Update declarations.
10501         (Archive::filename): New function.
10502         * object.cc: Include "cref.h".
10503         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10504         (Sized_relobj::do_get_global_symbol_counts): New function.
10505         (Input_objects::add_object): Add object to cross-referencer.
10506         (Input_objects::archive_start): New function.
10507         (Input_objects::archive_stop): New function.
10508         (Input_objects::print_symbol_counts): New function.
10509         * object.h: Declare Cref and Archive.
10510         (Object::get_global_symbol_counts): New function.
10511         (Object::do_get_global_symbol_counts): New pure virtual function.
10512         (class Sized_relobj): Add defined_count_ field.  Update
10513         declarations.
10514         (class Input_objects): Add cref_ field.  Update constructor.
10515         Update declarations.
10516         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10517         defined_count_.
10518         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10519         symbol counts.
10520         (Sized_dynobj::do_get_global_symbol_counts): New function.
10521         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10522         defined_count_.  Update declarations.  Define Symbols typedef.
10523         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10524         parameter.  Change all callers.
10525         (Symbol_table::add_from_dynobj): Add sympointers and defined
10526         parameters.  Change all callers.
10527         * symtab.h (class Symbol_table): Update declarations.
10528         * Makefile.am (CCFILES): Add cref.cc.
10529         (HFILES): Add cref.h.
10530         * Makefile.in: Rebuild.
10531
10532 2008-07-22  Simon Baldwin  <simonb@google.com>
10533
10534         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10535         to zero when writing undefined symbols.
10536
10537 2008-07-22  Ian Lance Taylor  <iant@google.com>
10538
10539         * output.cc (Output_section::add_input_section): Don't try to
10540         merge empty merge sections.
10541
10542 2008-07-21  Craig Silverstein  <csilvers@google.com>
10543
10544         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10545         Include symbol version in error message.
10546
10547 2008-07-20  Chris Demetriou  <cgd@google.com>
10548
10549         * configure.ac (gold_cv_c_random_seed): New configured variable.
10550         (RANDOM_SEED_CFLAGS): New substituted variable.
10551         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10552         * configure: Rebuild.
10553         * Makefile.in: Likewise.
10554         * testsuite/Makefile.in: Likewise.
10555
10556 2008-07-18  Ian Lance Taylor  <iant@google.com>
10557
10558         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10559         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10560         * testsuite/ver_test_main.cc (main): Call t4.
10561         (t4, t4_2a): Define.
10562         * testsuite/ver_test_2.cc (t4_2): Define.
10563         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10564         * testsuite/ver_test_4.cc (t4_2a): Define.
10565         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10566         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10567
10568 2008-07-17  Ian Lance Taylor  <iant@google.com>
10569
10570         * dynobj.cc (Versions::add_def): If we give an error about a
10571         missing version, go ahead and create the version anyhow.
10572
10573 2008-07-10  Ian Lance Taylor  <iant@google.com>
10574
10575         Handle output sections with more than 0x7fffffff bytes.
10576         * object.h (class Relobj): Change map_to_output_ to
10577         output_sections_, and just keep a section pointer.  Change all
10578         uses.  Move comdat group support to Sized_relobj.
10579         (Relobj::is_section_specially_mapped): Remove.
10580         (Relobj::output_section): Remove poff parameter.  Change all
10581         callers.
10582         (Relobj::output_section_offset): New function.
10583         (Relobj::set_section_offset): Rewrite.
10584         (Relobj::map_to_output): Remove.
10585         (Relobj::output_sections): New function.
10586         (Relobj::do_output_section_offset): New pure virtual function.
10587         (Relobj::do_set_section_offset): Likewise.
10588         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10589         group support from Relobj.  Update declarations.
10590         (Sized_relobj::get_output_section_offset): New function.
10591         (Sized_relobj::do_output_section_offset): New function.
10592         (Sized_relobj::do_set_section_offset): New function.
10593         * object.cc (Relobj::output_section_address): Remove.
10594         (Sized_relobj::Sized_relobj): Initialize new fields.
10595         (Sized_relobj::include_section_group): Cast find_kept_object to
10596         Sized_relobj.
10597         (Sized_relobj::include_linkonce_section): Likewise.
10598         (Sized_relobj::do_layout): Use separate arrays for output section
10599         and output offset.
10600         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10601         output_sections.
10602         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10603         output_sections and section_offsets.
10604         (Sized_relobj::write_local_symbols): Likewise.
10605         (map_to_kept_section): Compute output address directly.
10606         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10607         output_sections and section_offsets.
10608         (Sized_relobj::write_sections): Likewise.
10609         (Sized_relobj::relocate_sections): Likewise.
10610         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10611         * output.h (class Output_reloc): Update declarations.  Change
10612         u2_.relobj to Sized_relobj*.
10613         (class Output_data_reloc): Change add functions to use
10614         Sized_relobj*.
10615         * output.cc (Output_reloc::Output_reloc): Change relobj to
10616         Sized_relobj*.
10617         (Output_reloc::local_section_offset): Change return type to
10618         Elf_Addr.  Use get_output_section_offset.
10619         (Output_reloc::get_address): Likewise.
10620         (Output_section::is_input_address_mapped): Don't call
10621         is_section_specially_mapped.
10622         (Output_section::output_offset): Likewise.
10623         (Output_section::output_address): Likewise.
10624         (Output_section::starting_output_address): Likewise.
10625         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10626         parameter to Sized_relobj*.
10627         (Copy_relocs::need_copy_reloc): Likewise.
10628         (Copy_relocs::save): Likewise.
10629         * copy-relocs.h (class Copy_relocs): Update declarations.
10630         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10631         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10632         * target-reloc.h (relocate_for_relocatable): Change
10633         offset_in_output_section type to Elf_Addr.  Change code that uses
10634         it as well.
10635         * layout.cc (Layout::layout): Always set *off.
10636         * mapfile.cc (Mapfile::print_input_section): Use
10637         output_section_offset.
10638         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10639         Sized_relobj*.
10640         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10641         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10642         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10643
10644 2008-07-03  Ian Lance Taylor  <iant@google.com>
10645
10646         * layout.cc (Layout::include_section): Do not discard unrecognized
10647         SHT_STRTAB sections.
10648
10649 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10650
10651         * script.cc (Lex::can_continue_name): Make '?' allowable in
10652         version-script names.
10653         * testsuite/version_script.map: Change glob pattern to use '?'
10654
10655 2008-06-30  Manish Singh  <yosh@gimp.org>
10656
10657         PR 6585
10658         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10659         Correct typo.
10660
10661 2008-06-30  Ian Lance Taylor  <iant@google.com>
10662
10663         PR 6660
10664         PR 6682
10665         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10666         versions]: Don't try to read the value in the contents, since we
10667         don't use it.  Use the template endianness when writing.
10668
10669 2008-06-25  Cary Coutant  <ccoutant@google.com>
10670
10671         * fileread.cc (File_read::make_view): Assert on zero-length view.
10672         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10673         symbol table when there are no symbols to read.
10674
10675 2008-06-23  Craig Silverstein  <csilvers@google.com>
10676
10677         * version.cc (version_string): Bump to 1.7
10678
10679 2008-06-18  Craig Silverstein  <csilvers@google.com>
10680
10681         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10682         constant 0xFFFF to type Valtype.
10683         (Powerpc_relocate_functions::rel16_ha): Likewise.
10684
10685 2008-06-17  Ian Lance Taylor  <iant@google.com>
10686
10687         * output.h (Output_section::Input_section): Initialize p2align_ to
10688         zero for Output_section_data constructors.
10689         (Output_section::Input_section::addralign): If not an input
10690         section, return the alignment of the Output_section_data.
10691         * testsuite/copy_test.cc: New file.
10692         * testsuite/copy_test_1.cc: New file.
10693         * testsuite/copy_test_2.cc: New file.
10694         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10695         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10696         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10697         (copy_test_1_pic.o, copy_test_1.so): New targets.
10698         (copy_test_2_pic.o, copy_test_2.so): New targets.
10699         * testsuite/Makefile.in: Rebuild.
10700
10701         * script-sections.cc (Script_sections::place_orphan): Initialize
10702         local variable exact.
10703
10704 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10705
10706         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10707
10708 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10709             David S. Miller  <davem@davemloft.net>
10710
10711         * powerpc.cc: New file.
10712         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10713         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10714         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10715         * Makefile.in: Rebuild.
10716
10717 2008-06-09  Ian Lance Taylor  <iant@google.com>
10718
10719         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10720         <exception>.
10721         (throwing, orig_terminate): New static variables.
10722         (terminate_handler): New static function.
10723         (t2): Set terminate handler.
10724
10725 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10726
10727         PR 6584
10728         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10729         alignment.
10730
10731 2008-05-30  Cary Coutant  <ccoutant@google.com>
10732
10733         * archive.cc (Archive::include_all_members) Correct to step
10734         over symbol table and extended name table in thin archives.
10735
10736 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10737
10738         PR 6407
10739         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10740         calculation.
10741
10742 2008-05-28  Caleb Howe  <cshowe@google.com>
10743
10744         * reduced_debug_output.cc: New file.
10745         * reduced_debug_output.h: New file.
10746         * options.h (class General_options): Add --strip-debug-non-line.
10747         * options.cc (General_options::finalize): Add strip_debug_non_line
10748         to the strip heirarchy.
10749         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10750         fields.
10751         * layout.cc: Include "reduced_debug_output.h".
10752         (Layout::Layout): Initialize new fields.
10753         (line_only_debug_sections): New static array.
10754         (is_lines_only_debug_sections): New static inline function.
10755         (Layout::include_section): Handle --strip-debug-non-line.
10756         (Layout::make_output_section): If --strip-debug-non-line, build
10757         new output sections for .debug_abbrev and .debug_info.
10758         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10759         gold.  Warn about possible overflow.
10760         (read_signed_LEB_128): Likewise.
10761         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10762         (read_signed_LEB_128): Declare.
10763         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10764         (HFILES): Add reduced_debug_output.h.
10765         * Makefile.in: Rebuild.
10766
10767 2008-05-21  Ian Lance Taylor  <iant@google.com>
10768
10769         * mapfile.cc: New file.
10770         * mapfile.h: New file.
10771         * options.h (class General_options): Add -M/--print-map and -Map.
10772         * options.cc (General_options::finalize): Make -M equivalent to
10773         -Map -.
10774         * main.cc: Include <cstdio> and "mapfile.h".
10775         (main): Open mapfile if requested.
10776         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10777         constructor.  Change caller.
10778         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10779         (queue_middle_tasks): Likewise.
10780         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10781         declarations.
10782         * archive.cc: Include "mapfile.h".
10783         (Archive::add_symbols): Add mapfile parameter.  Change all
10784         callers.  Pass mapfile, symbol, and reason to include_member.
10785         (Archive::include_all_members): Add mapfile parameter.  Change all
10786         callers.
10787         (Archive::include_member): Add mapfile, sym, and why parameters.
10788         Change all callers.  Report inclusion to map file.
10789         * archive.h: Include "fileread.h".
10790         (class Archive): Update declarations.
10791         (Archive::file): New const method.
10792         (class Add_archive_symbols): Add mapfile_ field.  Update
10793         constructor.  Change all callers.
10794         * readsyms.h (class Read_symbols): Likewise.
10795         (class Finish_group): Likewise.
10796         (class Read_script): Likewise.
10797         * common.cc: Include "mapfile.h".
10798         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10799         all callers.
10800         (Symbol_table::do_allocate_commons): Likewise.
10801         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10802         symbol allocation to mapfile.
10803         * common.h (class Allocate_commons_task): Add mapfile_ field.
10804         Update constructor.  Change all callers.
10805         * symtab.h (class Symbol_table): Update declarations.
10806         * layout.cc: Include "mapfile.h".
10807         (Layout_task_runner::run): Print information to mapfile.
10808         (Layout::create_gold_note): Change Output_data_fixed_space to
10809         Output_data_zero_fill.
10810         (Layout::create_build_id): Likewise.
10811         (Layout::print_to_mapfile): New function.
10812         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10813         constructor.  Change caller.
10814         (class Layout): Declare print_to_mapfile.
10815         * output.cc (Output_section::Input_section::print_to_mapfile): New
10816         function.
10817         (Output_section::add_input_section): If producing a map, always
10818         add to input_sections_ list.
10819         (Output_section::do_print_to_mapfile): New function.
10820         (Output_segment::print_sections_to_mapfile): New function.
10821         (Output_segment::print_section_list_to_mapfile): New function.
10822         * output.h: Include "mapfile.h".
10823         (Output_data::print_to_mapfile): New function.
10824         (Output_data::do_print_to_mapfile): New virtual function.
10825         (Output_segment_headers::do_print_to_mapfile): New function.
10826         (Output_file_header::do_print_to_mapfile): New function.
10827         (Output_data_const::do_print_to_mapfile): New function.
10828         (class Output_data_const_buffer): Add map_name_ field.  Update
10829         constructor.  Change all callers.  Add do_print_to_mapfile
10830         function.
10831         (class Output_data_fixed_space): Likewise.
10832         (class Output_data_space): Likewise.
10833         (class Output_data_zero_fill): New class.
10834         (Output_data_strtab::do_print_to_mapfile): New function.
10835         (Output_data_reloc_base::do_print_to_mapfile): New function.
10836         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10837         (Output_data_group::do_print_to_mapfile): New function.
10838         (Output_data_got::do_print_to_mapfile): New function.
10839         (Output_data_dynamic::do_print_to_mapfile): New function.
10840         (Output_symtab_xindex::do_print_to_mapfile): New function.
10841         (class Output_section): Declare do_print_to_mapflie.  Declare
10842         print_to_mapfile in Input_section.
10843         (class Output_segment): Declare new functions.
10844         * object.h (Sized_relobj::symbol_count): New function.
10845         * script-sections.cc
10846         (Output_section_element_dot_assignment::set_section_addresses):
10847         Change Output_data_fixed_space to Output_data_zero_fill.
10848         (Output_data_expression::do_print_to_mapfile): New function.
10849         * script.cc (read_input_script): Add mapfile parameter.  Change
10850         all callers.
10851         * script.h (read_input_script): Update declaration.
10852         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10853         (Eh_frame::do_print_to_mapfile): New function.
10854         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10855         (Output_merge_string::do_print_to_mapfile): New function.
10856         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10857         function.
10858         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10859         function.
10860         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10861         function.
10862         * Makefile.am (CCFILES): Add mapfile.cc.
10863         (HFILES): Add mapfile.h.
10864         * Makefile.in: Rebuild.
10865
10866 2008-05-19  Ian Lance Taylor  <iant@google.com>
10867
10868         * options.h (class General_options): Add -z relro.
10869         * layout.cc (Layout::Layout): Initialize relro_segment_.
10870         (Layout::add_output_section_data): Return the output section.
10871         (Layout::make_output_section): Rcognize relro sections and mark
10872         them appropriately.
10873         (Layout::attach_allocated_section_to_segment): Put relro sections
10874         in a PT_GNU_RELRO segment.
10875         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10876         section as relro.
10877         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10878         PT_TLS segments.
10879         (Layout::linkonce_mapping): Map d.rel.ro.local to
10880         .data.rel.ro.local.
10881         (Layout::output_section_name): Us .data.rel.ro.local for any
10882         section which begins with that.
10883         * layout.h (class Layout): Update add_output_section_data
10884         declaration.  Add relro_segment_ field.
10885         * output.cc (Output_section::Output_section): Initialize is_relro_
10886         and is_relro_local_ fields.
10887         (Output_segment::add_output_section): Group relro sections.
10888         (Output_segment::is_first_section_relro): New function.
10889         (Output_segment::maximum_alignment): If there is a relro section,
10890         align the segment to the common page size.
10891         (Output_segment::set_section_addresses): Track whether we are
10892         looking at relro sections.  If the last section is a relro
10893         section, align to the common page size.
10894         (Output_segment::set_section_list_addresses): Add in_relro
10895         parameter.  Change all callers.  Align to the page size when
10896         moving from relro to non-relro section.
10897         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10898         segment.
10899         * output.h (class Output_section): Add is_relro_ and
10900         is_relro_local_ fields.
10901         (Output_section::is_relro): New function.
10902         (Output_section::set_is_relro): New function.
10903         (Output_section::is_relro_local): New function.
10904         (Output_section::set_is_relro_local): New function.
10905         (class Output_segment): Update declarations.
10906         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10907         * sparc.cc (Target_sparc::got_section): Likewise.
10908         * x86_64.cc (Target_x86_64::got_section): Likewise.
10909         * testsuite/relro_test_main.cc: New file.
10910         * testsuite/relro_test.cc: New file.
10911         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10912         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10913         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10914         (relro_test.so, relro_test_pic.o): New targets.
10915         * testsuite/Makefile.in: Rebuild.
10916
10917 2008-05-16  Ian Lance Taylor  <iant@google.com>
10918
10919         * output.cc (Output_segment::add_output_section): Remove front
10920         parameter.
10921         * output.h (class Output_segment): Remove
10922         add_initial_output_section and overloaded add_output_section.
10923         Update declaration of remaining add_output_section.
10924         * layout.cc (Layout::create_interp): Call add_output_section
10925         rather than add_initial_output_section.
10926         (Layout::finish_dynamic_section): Likewise.
10927
10928         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10929         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10930         know the dynamic type.
10931         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10932         field.  Initialize it in constructor.
10933         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10934         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10935         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10936         reloc.
10937
10938         * output.cc (Output_reloc::get_address): Change return type to
10939         Elf_Addr.
10940         * output.h (class Output_reloc): Update get_address declaration.
10941         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10942         for section addresses.
10943
10944 2008-05-09  Ian Lance Taylor  <iant@google.com>
10945
10946         PR 6493
10947         * gold.cc (gold_nomem): Use return value of write.
10948
10949 2008-05-08  Ian Lance Taylor  <iant@google.com>
10950
10951         * symtab.c (Symbol::init_base_output_data): Add version
10952         parameter.  Change all callers.
10953         (Symbol::init_base_output_segment): Likewise.
10954         (Symbol::init_base_constant): Likewise.
10955         (Symbol::init_base_undefined): Likewise.
10956         (Sized_symbol::init_output_data): Likewise.
10957         (Sized_symbol::init_output_segment): Likewise.
10958         (Sized_symbol::init_constant): Likewise.
10959         (Sized_symbol::init_undefined): Likewise.
10960         (Symbol_table::do_define_in_output_data): If the new symbol has a
10961         version, mark it as the default.
10962         (Symbol_table::do_define_in_output_segment): Likewise.
10963         (Symbol_table::do_define_as_constant): Likewise.
10964         * symtab.h (class Symbol): Update declarations.
10965         (class Sized_symbol): Likewise.
10966         * resolve.cc (Symbol::override_version): New function.
10967         (Symbol::override_base): Call override_version.
10968         (Symbol::override_base_with_special): Likewise.
10969         * testsuite/ver_script_8.script: New file.
10970         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10971         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10972         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10973         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10974
10975 2008-05-06  Ian Lance Taylor  <iant@google.com>
10976
10977         PR 6049
10978         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10979         functions.
10980         (class General_options): Remove existing --undefined, and add
10981         --no-undefined instead.  Add new --undefined as synonym for -u.
10982         * archive.cc (Archive::add_symbols): Check whether symbol was
10983         named with -u.
10984         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10985         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10986         all uses.  Add IS_UNDEFINED.  Update declarations to split
10987         different versions of init_base.  Declare init_base_undefined.
10988         (Symbol::is_defined): Handle IS_UNDEFINED.
10989         (Symbol::is_undefined): Likewise.
10990         (Symbol::is_weak_undefined): Call is_undefined.
10991         (Symbol::is_absolute): Handle IS_CONSTANT.
10992         (class Sized_symbol): Update declarations to split different
10993         versions of init.  Declare init_undefined.
10994         (class Symbol_table): Declare new functions.
10995         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10996         Change all callers.
10997         (Symbol::init_base_output_data): Likewise.
10998         (Symbol::init_base_output_segment): Likewise.
10999         (Symbol::init_base_constant): Likewise.
11000         (Symbol::init_base_undefined): New function.
11001         (Sized_symbol::init_object): Rename from init.  Change all
11002         callers.
11003         (Sized_symbol::init_output_data): Likewise.
11004         (Sized_symbol::init_output_segment): Likewise.
11005         (Sized_symbol::init_constant): Likewise.
11006         (Sized_symbol::init_undefined): New function.
11007         (Symbol_table::add_undefined_symbols_from_command_line): New
11008         function.
11009         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11010         function.
11011         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11012         (Symbol::output_section): Likewise.
11013         (Symbol::set_output_section): Likewise.
11014         (Symbol_table::sized_finalize_symbol): Likewise.
11015         (Symbol_table::sized_write_globals): Likewise.
11016         * resolve.cc (Symbol_table::should_override): Likewise.
11017         (Symbol::override_base_with_special): Likewise.
11018
11019         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11020         symbol, change it to have default visibility.
11021         * testsuite/protected_1.cc: New file.
11022         * testsuite/protected_2.cc: New file.
11023         * testsuite/protected_3.cc: New file.
11024         * testsuite/protected_main_1.cc: New file.
11025         * testsuite/protected_main_2.cc: New file.
11026         * testsuite/protected_main_3.cc: New file.
11027         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11028         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11029         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11030         (protected_1.so): New target.
11031         (protected_1_pic.o, protected_2_pic.o): New targets.
11032         (protected_3_pic.o): New target.
11033         (check_PROGRAMS): Add protected_2.
11034         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11035         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11036         * testsuite/Makefile.in: Rebuild.
11037
11038         * options.h (DEFINE_var): Add set_user_set_##varname__.
11039         (DEFINE_bool_alias): New macro.
11040         (class General_options): Define -Bstatic using DEFINE_bool_alias
11041         rather than DEFINE_special.  Add --undefined as an alias for -z
11042         defs.
11043         * options.cc (General_options::parse_Bstatic): Remove.
11044
11045         * options.h (class General_options): Add --fatal-warnings.
11046         * main.cc (main): Implement --fatal-warnings.
11047         * errors.h (Errors::warning_count): New function.
11048
11049         * options.h (class General_options): Add -Bsymbolic-functions.
11050         * symtab.h (Symbol::is_preemptible): Check for
11051         -Bsymbolic-functions.
11052
11053 2008-05-05  Ian Lance Taylor  <iant@google.com>
11054
11055         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11056         as noVARNAME rather than no-VARNAME.
11057         (class General_options): Add option -z combreloc.
11058         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11059         get_address.
11060         (Output_reloc::sort_before) [SHT_REL]: New function.
11061         (Output_reloc::sort_before) [SHT_RELA]: New function.
11062         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11063         Sort_relocs_comparison.
11064         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11065         parameter.  Change all callers.
11066         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11067         sort_relocs parameter.  Change all callers.
11068         * output.cc (Output_reloc::get_address): New function, broken out
11069         of write_rel.
11070         (Output_reloc::write_rel): Call it.
11071         (Output_reloc::compare): New function.
11072         (Output_data_reloc_base::do_write): Optionally sort relocs.
11073
11074         * configure.ac: If targ_extra_obj is set, link it in.
11075         * configure.tgt: Initialize all variables.
11076         (x86_64*): Set targ_extra_obj and targ_extra_size.
11077         * configure: Rebuild.
11078
11079         * object.cc (Sized_relobj::include_section_group): Adjust section
11080         indexes read from group data.  Build vector to pass to
11081         layout_group.
11082         * layout.cc (Layout::layout_group): Add flags and shndxes
11083         parameters.  Remove contents parameter.  Change caller.  Update
11084         explicit instantiations.
11085         * layout.h (class Layout): Update layout_group declaration.
11086         * output.cc (Output_data_group::Output_data_group): Add flags and
11087         input_shndxes parameters.  Remove contents parameter.  Change
11088         caller.
11089         (Output_data_group::do_write): Change input_sections_ to
11090         input_shndxes_.
11091         * output.h (class Output_data_group): Update constructor
11092         declaration.  Rename input_sections_ to input_shndxes_.
11093         * testsuite/many_sections_test.cc: Add template.
11094
11095 2008-04-30  Cary Coutant  <ccoutant@google.com>
11096
11097         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11098
11099         * layout.cc (Layout::include_section): Refactored check for debug
11100         info section.
11101         (Layout::add_comdat): Add new parameters.  Change type
11102         of signature parameter.  Add object and shndx to signatures table.
11103         (Layout::find_kept_object): New function.
11104         * layout.h: Include <cstring>.
11105         (Layout::is_debug_info_section): New function.
11106         (Layout::add_comdat): Add new parameters.
11107         (Layout::find_kept_object): New function.
11108         (Layout::Kept_section): New struct.
11109         (Layout::Signatures): Change type of map range.
11110         * object.cc (Relobj::output_section_address): New function.
11111         (Sized_relobj::include_section_group): Add new parameters.  Change
11112         calls to Layout::add_comdat.  Change to build table of kept comdat
11113         groups and table mapping discarded sections to kept sections.
11114         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11115         (Sized_relobj::do_layout): Change calls to include_section_group and
11116         include_linkonce_section.
11117         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11118         value to zero when section is discarded.
11119         (Sized_relobj::map_to_kept_section): New function.
11120         * object.h (Relobj::output_section_address): New function.
11121         (Relobj::Comdat_group): New type.
11122         (Relobj::find_comdat_group): New function.
11123         (Relobj::Comdat_group_table): New type.
11124         (Relobj::Kept_comdat_section): New type.
11125         (Relobj::Kept_comdat_section_table): New type.
11126         (Relobj::add_comdat_group): New function.
11127         (Relobj::set_kept_comdat_section): New function.
11128         (Relobj::get_kept_comdat_section): New function.
11129         (Relobj::comdat_groups_): New field.
11130         (Relobj::kept_comdat_sections_): New field.
11131         (Symbol_value::input_value): Update comment.
11132         (Sized_relobj::map_to_kept_section) New function.
11133         (Sized_relobj::include_linkonce_section): Add new parameter.
11134         * target-reloc.h (Comdat_behavior): New type.
11135         (get_comdat_behavior): New function.
11136         (relocate_section): Add code to map a discarded section to the
11137         corresponding kept section when applying a relocation.
11138
11139 2008-04-30  Craig Silverstein  <csilvers@google.com>
11140
11141         * dwarf_reader.cc (next_generation_count): New static var.
11142         (Addr2line_cache_entry): New struct.
11143         (addr2line_cache): New static var.
11144         (Dwarf_line_info::one_addr2line): Added caching.
11145         (Dwarf_line_info::clear_addr2line_cache): New function.
11146         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11147         cache-size parameter.
11148         (Dwarf_line_info::one_addr2line_cache): New function.
11149         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11150         new cache-size argument to one_addr2line(), and clear cache.
11151
11152 2008-04-28  Cary Coutant  <ccoutant@google.com>
11153
11154         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11155         R_386_PC8 relocations.
11156
11157 2008-04-23  Ian Lance Taylor  <iant@google.com>
11158
11159         * object.cc (Sized_relobj::include_section_group): Check for
11160         invalid section group.
11161
11162         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11163         header size.
11164
11165         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11166         than read for file header.
11167         * archive.cc (Archive::include_member): Likewise.
11168
11169 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11170
11171         * aclocal.m4: Regenerate.
11172         * configure: Regenerate.
11173
11174 2008-04-19  Ian Lance Taylor  <iant@google.com>
11175
11176         * version.cc (version_string): Bump to 1.6.
11177
11178         * testsuite/Makefile.am (many_sections_r_test): New target.
11179         (many_sections_r_test_SOURCES): Remove.
11180         (many_sections_r_test_DEPENDENCIES): Remove.
11181         (many_sections_r_test_LDFLAGS): Remove.
11182         (many_sections_r_test_LDADD): Remove.
11183
11184         * object.cc (Sized_relobj::do_add_symbols): Always pass
11185         local_symbol_count_ to add_from_relobj.
11186
11187         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11188         every thousand variables.
11189         * testsuite/Makefile.in: Rebuild.
11190
11191         * object.cc (Xindex::initialize_symtab_xindex): New function.
11192         (Xindex::read_symtab_xindex): New function.
11193         (Xindex::sym_xindex_to_shndx): New function.
11194         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11195         available.
11196         (Sized_relobj::do_initialize_xindex): New function.
11197         (Sized_relobj::do_read_symbols): Adjust section links.
11198         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11199         parameter.  Change all callers.
11200         (Sized_relobj::include_section_group): Adjust section links and
11201         symbol section indexes.
11202         (Sized_relobj::do_layout): Adjust section links.
11203         (Sized_relobj::do_count_local_symbols): Adjust section links and
11204         symbol section indexes.
11205         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11206         ordinary and special symbols.
11207         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11208         dynsym_xindex parameters.  Change all callers.  Adjust section
11209         links.  Use SHN_XINDEX when needed.
11210         (Sized_relobj::get_symbol_location_info): Adjust section links.
11211         Don't get fooled by special symbols.
11212         * object.h (class Xindex): Define.
11213         (class Object): Add xindex_ parameter.  Declare virtual functoin
11214         do_initialize_xindex.
11215         (Object::adjust_sym_shndx): New function.
11216         (Object::set_xindex): New protected function.
11217         (class Symbol_value): Add is_ordinary_shndx_ field.
11218         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11219         (Symbol_value::value): Assert ordinary section.
11220         (Symbol_value::initialize_input_to_output_map): Likewise.
11221         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11222         Change all callers.
11223         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11224         all callers.
11225         (class Sized_relobj): Update declarations.
11226         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11227         parameter.  Change all callers.
11228         (Sized_relobj::adjust_shndx): New function.
11229         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11230         field.
11231         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11232         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11233         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11234         (Sized_dynobj::read_dynsym_section): Adjust section links.
11235         (Sized_dynobj::read_dynamic): Likewise.
11236         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11237         section links.
11238         (Sized_dynobj::do_initialize_xindex): New function.
11239         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11240         do_initialize_xindex.
11241         (Sized_dynobj::adjust_shndx): New function.
11242         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11243         dynsym_xindex_ fields.
11244         (Layout::finalize): Add a call to set_section_indexes before
11245         creating the symtab sections.
11246         (Layout::set_section_indexes): Don't do anything if the section
11247         already has a section index.
11248         (Layout::create_symtab_sections): Add shnum parameter.  Change
11249         caller.  Create .symtab_shndx section if needed.
11250         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11251         caller.
11252         (Layout::allocated_output_section_count): New function.
11253         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11254         needed.
11255         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11256         fields.  Update declarations.
11257         (Layout::symtab_xindex): New function.
11258         (Layout::dynsym_xindex): New function.
11259         (class Write_symbols_task): Add layout_ field.
11260         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11261         Change caller.
11262         * output.cc (Output_section_headers::Output_section_headers): Add
11263         shstrtab_section parameter.  Change all callers.
11264         (Output_section_headers::do_sized_write): Store overflow values
11265         for section count and section string table section index in
11266         section header zero.
11267         (Output_file_header::do_sized_write): Check for overflow of
11268         section count and section string table section index.
11269         (Output_symtab_xindex::do_write): New function.
11270         (Output_symtab_xindex::endian_do_write): New function.
11271         * output.h (class Output_section_headers): Add shstrtab_section_.
11272         Update declarations.
11273         (class Output_symtab_xindex): Define.
11274         (Output_section::has_out_shndx): New function.
11275         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11276         field.
11277         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11278         Change all callers.
11279         (Sized_symbol::init): Likewise.
11280         (Symbol::output_section): Check for ordinary symbol.
11281         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11282         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11283         callers.
11284         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11285         Change all callers.  Simplify handling of symbols from sections
11286         not included in the link.
11287         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11288         distinction.
11289         (Weak_alias_sorter::operator()): Assert that symbols are
11290         ordinary.
11291         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11292         distinction.
11293         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11294         parameters.  Change all callers.
11295         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11296         symbol distinction.  Use SHN_XINDEX when needed.
11297         (Symbol_table::write_section_symbol): Add symtab_xindex
11298         parameter.  Change all callers.
11299         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11300         SHN_XINDEX when needed.
11301         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11302         declarations.
11303         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11304         (Symbol::is_defined): Check is_ordinary.
11305         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11306         (Symbol::is_absolute, Symbol::is_common): Likewise.
11307         (class Sized_symbol): Update declarations.
11308         (class Symbol_table): Update declarations.
11309         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11310         parameters.  Change all callers.
11311         (Sized_symbol::override): Likewise.
11312         (Symbol_table::override): Likewise.
11313         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11314         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11315         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11316         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11317         to be in an ordinary section.
11318         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11319         object and is_ordinary parameters.  Change all callers.
11320         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11321         Change all callers.  Don't add undefined or non-ordinary symbols
11322         to reloc_map_.
11323         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11324         Change all callers.
11325         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11326         declarations.
11327         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11328         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11329         (Sized_relobj::relocate_sections): Likewise.
11330         * target-reloc.h (scan_relocs): Adjust section symbol index.
11331         (scan_relocatable_relocs): Likewise.
11332         * i386.cc (Scan::local): Check for ordinary symbols.
11333         * sparc.cc (Scan::local): Likewise.
11334         * x86_64.cc (Scan::local): Likewise.
11335         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11336         to symbol_section_and_value.
11337         * testsuite/many_sections_test.cc: New file.
11338         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11339         (check_PROGRAMS): Add many_sections_test.
11340         (many_sections_test_SOURCES): Define.
11341         (many_sections_test_DEPENDENCIES): Define.
11342         (many_sections_test_LDFLAGS): Define.
11343         (BUILT_SOURCES): Add many_sections_define.h.
11344         (many_sections_define.h): New target.
11345         (BUILT_SOURCES): Add many_sections_check.h.
11346         (many_sections_check.h): New target.
11347         (check_PROGRAMS): Add many_sections_r_test.
11348         (many_sections_r_test_SOURCES): Define.
11349         (many_sections_r_test_DEPENDENCIES): Define.
11350         (many_sections_r_test_LDFLAGS): Define.
11351         (many_sections_r_test_LDADD): Define.
11352         (many_sections_r_test.o): New target.
11353         * testsuite/Makefile.in: Rebuild.
11354
11355 2008-04-17  Cary Coutant  <ccoutant@google.com>
11356
11357         * errors.cc (Errors::info): New function.
11358         (gold_info): New function.
11359         * errors.h (Errors::info): New function.
11360         * gold.h (gold_info): New function.
11361         * object.cc (Input_objects::add_object): Print trace output.
11362         * options.cc (options::parse_set): New function.
11363         (General_options::parse_wrap): Deleted.
11364         (General_options::General_options): Deleted initializer.
11365         * options.h (options::String_set): New typedef.
11366         (options::parse_set): New function.
11367         (DEFINE_set): New macro.
11368         (General_options::wrap): Changed to use DEFINE_set. Changed
11369         callers of any_wrap_symbols and is_wrap_symbol.
11370         (General_options::trace, General_options::trace_symbol):
11371         New options.
11372         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11373         (General_options::wrap_symbols_): Deleted.
11374         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11375
11376 2008-04-17  David S. Miller  <davem@davemloft.net>
11377
11378         * options.cc (General_options::parse_V): New function.
11379         * options.h: Add entries for -V and -Qy.
11380
11381 2008-04-17  Ian Lance Taylor  <iant@google.com>
11382
11383         * common.cc (Symbol_table::allocate_commons): Remove options
11384         parameter.  Change caller.
11385         (Symbol_table::do_allocate_commons): Remove options parameter.
11386         Change caller.  Just call do_allocate_commons_list twice.
11387         (Symbol_table::do_allocate_commons_list): New function, broken out
11388         of do_allocate_commons.
11389         * common.h (class Allocate_commons_task): Remove options_ field.
11390         Update constructor.
11391         * symtab.cc (Symbol_table::Symbol_table): Initialize
11392         tls_commons_.
11393         (Symbol_table::add_from_object): Put TLS common symbols on
11394         tls_commons_ list.
11395         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11396         which are IN_OUTPUT_DATA.
11397         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11398         allocate_commons and do_allocate_commons declarations.  Declare
11399         do_allocate_commons_list.
11400         * gold.cc (queue_middle_tasks): Update creation of
11401         Allocate_commons_task to not pass options.
11402         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11403         (TLS_TEST_C_FLAGS): New variable.
11404         (tls_test_c_pic.o): New target.
11405         (tls_test_shared.so): Link in tls_test_c_pic.o.
11406         (tls_test_c_pic_ie.o): New target.
11407         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11408         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11409         (tls_test_c.o): New target.
11410         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11411         (tls_pic_test_LDADD): Likewise.
11412         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11413         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11414         (tls_test_c_gnu2.o): New target.
11415         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11416         tls_test_c_gnu2.o.
11417         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11418         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11419         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11420         * testsuite/tls_test.cc: Include "config.h".
11421         (t_last): Call t11_last.
11422         * testsuite/tls_test.h (t11, t11_last): Declare.
11423         * testsuite/tls_test_c.c: New file.
11424         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11425         * configure.ac: Check for OpenMP support.
11426         * configure, config.in, Makefile.in: Rebuild.
11427         * testsuite/Makefile.in: Rebuild.
11428
11429 2008-04-16  Cary Coutant  <ccoutant@google.com>
11430
11431         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11432         (Target_i386::tls_base_symbol_defined_): New field.
11433         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11434         (Target_i386::Scan::global): Likewise.
11435         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11436         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11437         (Target_x86_64::tls_base_symbol_defined_): New field.
11438         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11439         (Target_x86_64::Scan::global): Likewise.
11440
11441 2008-04-16  Cary Coutant  <ccoutant@google.com>
11442
11443         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11444         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11445         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11446         building shared libraries.
11447         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11448         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11449         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11450         * testsuite/Makefile.in: Rebuild.
11451         * testsuite/weak_undef.h: New file.
11452         * testsuite/weak_undef_file1.cc: Add extra test cases.
11453         * testsuite/weak_undef_file2.cc: Likewise.
11454         * testsuite/weak_undef_test.cc: Likewise.
11455
11456 2008-04-16  David S. Miller  <davem@davemloft.net>
11457
11458         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11459         Add issued_non_pic_error_ field.  Declare check_non_pic.
11460         (Target_sparc::Scan::check_non_pic): New function.
11461         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11462         (Target_sparc::Scan::global): Likewise.
11463
11464         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11465         * configure: Rebuild.
11466
11467         * options.h (DEFINE_enable): New macro.
11468         (new_dtags): New enable option.
11469         (initfirst, interpose, loadfltr, nodefaultlib,
11470         nodelete, nodlopen, nodump): New -z options.
11471         * layout.cc (Layout:finish_dynamic_section): If new
11472         dtags enabled, emit DT_RUNPATH.  Also, emit a
11473         DT_FLAGS_1 containing any specified -z flags.
11474
11475 2008-04-16  Ian Lance Taylor  <iant@google.com>
11476
11477         * copy-relocs.cc: New file.
11478         * copy-relocs.h: New file.
11479         * reloc.cc: Remove Copy_relocs code.
11480         * reloc.h: Likewise.
11481         * reloc-types.h (struct Reloc_types) [both versions]: Add
11482         get_reloc_addend_noerror.
11483         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11484         variants of add_global which take an addend which must be zero.
11485         * i386.cc: Include "copy-relocs.h".
11486         (class Target_i386): Change type of copy_relocs_ to variable,
11487         update initializer.
11488         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11489         Change all callers.
11490         (Target_i386::do_finalize_sections): Change handling of
11491         copy_relocs_.
11492         * sparc.cc: Include "copy-relocs.h".
11493         (class Target_sparc): Change type of copy_relocs_ to variable,
11494         update initializer.
11495         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11496         Change all callers.
11497         (Target_sparc::do_finalize_sections): Change handling of
11498         copy_relocs_.
11499         * x86_64.cc: Include "copy-relocs.h".
11500         (class Target_x86_64): Change type of copy_relocs_ to variable,
11501         update initializer.
11502         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11503         class.  Change all callers.
11504         (Target_x86_64::do_finalize_sections): Change handling of
11505         copy_relocs_.
11506         * Makefile.am (CCFILES): Add copy-relocs.cc.
11507         (HFILES): Add copy-relocs.h.
11508
11509         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11510
11511         * testsuite/script_test_4.sh: Permit leading zeroes.
11512
11513 2008-04-15  Ian Lance Taylor  <iant@google.com>
11514
11515         * script-sections.cc (Script_sections::create_segments): Use
11516         header_size_adjustment even when there is enough room for the
11517         headers.
11518         * testsuite/script_test_4.sh: New file.
11519         * testsuite/script_test_4.t: New file.
11520         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11521         (check_DATA): Add script_test_4.stdout.
11522         (MOSTLYCLEANFILES): Likewise.
11523         (script_test_4): New target.
11524         (script_test_4.stdout): New target.
11525         * testsuite/Makefile.in: Rebuild.
11526
11527         * sparc.cc: Add definitions for Output_data_plt_sparc class
11528         constants.
11529
11530 2008-04-14  David S. Miller  <davem@davemloft.net>
11531
11532         * sparc.cc: New file.
11533         * Makefile.am (TARGETSOURCES): Add sparc.cc
11534         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11535         * configure.tgt: Document targ_extra_size and
11536         targ_extra_big_endian.  Add entries for sparc-* and
11537         sparc64-*.
11538         * configure.ac: Handle targ_extra_size and
11539         targ_extra_big_endian.
11540         * Makefile.in: Rebuild.
11541         * configure: Likewise.
11542         * po/POTFILES.in: Likewise.
11543         * po/gold.pot: Likewise.
11544
11545 2008-04-14  Ian Lance Taylor  <iant@google.com>
11546
11547         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11548         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11549         in the name/type/flags to section mapping.  Don't call
11550         allocate_output_section.
11551         (Layout::choose_output_section): Change parameter from adjust_name
11552         to is_input_section.  Don't permit input sections after sections
11553         are attached to segments.  Don't call allocate_output_section.
11554         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11555         not write_enable_output_section.
11556         (Layout::make_output_section): Don't push to
11557         unattached_section_list_ nor call attach_to_segment.  Call
11558         attach_section_to_segment if sections are attached.
11559         (Layout::attach_sections_to_segments): New function.
11560         (Layout::attach_section_to_segment): New function.
11561         (Layout::attach_allocated_section_to_segment): Rename from
11562         attach_to_segment.  Remove flags parameter.
11563         (Layout::allocate_output_section): Remove function.
11564         (Layout::write_enable_output_section): Remove function.
11565         * layout.h (class Layout): Update for above changes.  Add new
11566         field sections_are_attached_.
11567         * output.h (Output_section::update_flags_for_input_section): New
11568         function.
11569         * output.cc (Output_section::add_input_section): Call
11570         update_flags_for_input_section.
11571         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11572
11573 2008-04-11  Cary Coutant  <ccoutant@google.com>
11574
11575         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11576         thought unnecessary.
11577         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11578
11579 2008-04-11  Ian Lance Taylor  <iant@google.com>
11580
11581         * output.h (class Output_section_data): Remove inline definition
11582         of set_addralign.
11583         * output.cc (Output_section_data::set_addralign): New function.
11584
11585 2008-04-11  Cary Coutant  <ccoutant@google.com>
11586
11587         Add support for TLS descriptors for i386 and x86_64.
11588         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11589         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11590         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11591         GOT_TYPE_TLS_DESC.
11592         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11593         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11594         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11595         relocations.
11596         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11597         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11598         Fix problem with initial-exec relocations.
11599         (Target_i386::Relocate::relocate_tls): Likewise.
11600         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11601         relaxation.
11602         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11603         support for section-plus-offset dynamic table entries.
11604         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11605         (Output_data_dynamic::Dynamic_entry): Add support for
11606         section-plus-offset dynamic table entries.
11607         (Output_data_dynamic::Classification): Likewise.
11608         (Output_data_dynamic::classification_): Renamed offset_.
11609         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11610         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11611         (Target_x86_64::make_plt_section): New function.
11612         (Target_x86_64::reserve_tlsdesc_entries): New function.
11613         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11614         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11615         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11616         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11617         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11618         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11619         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11620         add extra PLT entry for TLS descriptors.
11621         (Output_data_plt_x86_64::got_): New field.
11622         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11623         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11624         fields.
11625         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11626         descriptors.
11627         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11628         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11629         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11630         R_386_TLS_DESC_CALL relocations.
11631         (Target_x86_64::Scan::global): Likewise.
11632         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11633         for TLS descriptors.
11634         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11635         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11636         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11637         GD-to-IE relaxation.
11638         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11639         and TLS_DESCRIPTORS.
11640         * Makefile.in: Rebuild.
11641         * configure: Rebuild.
11642         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11643         (tls_test_shared2.so): New target.
11644         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11645         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11646         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11647         (tls_shared_gd_to_ie_test_LDADD): New variable.
11648         (tls_shared_gnu2_gd_to_ie_test): New target.
11649         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11650         New targets.
11651         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11652         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11653         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11654         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11655         (tls_shared_gnu2_test): New target.
11656         (tls_test_gnu2_shared.so): New target.
11657         (tls_shared_gnu2_test_SOURCES): New variable.
11658         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11659         (tls_shared_gnu2_test_LDFLAGS): New variable.
11660         (tls_shared_gnu2_test_LDADD): New variable.
11661         * testsuite/Makefile.in: Rebuild.
11662         * testsuite/Makefile.
11663
11664 2008-04-11  Ian Lance Taylor  <iant@google.com>
11665
11666         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11667         justsyms.t.
11668         * testsuite/Makefile.in: Rebuild.
11669
11670         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11671         long.
11672         * testsuite/script_test_2.cc (main): Adjust test.
11673
11674 2008-04-11  David S. Miller  <davem@davemloft.net>
11675             Ian Lance Taylor  <iant@google.com>
11676
11677         * options.h (General_options): Add entries for '-Y' and
11678         '-relax'.
11679         * options.cc (General_options:finalize): If -Y was used, add those
11680         entries to the library path instead of the default "/lib" and
11681         "/usr/lib".
11682
11683 2008-04-11  David S. Miller  <davem@davemloft.net>
11684
11685         * testsuite/justsyms.t: Start at 0x100.
11686         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11687         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11688         long.
11689         * testsuite/script_test_2.cc: Adjust string and section length
11690         checks.
11691
11692 2008-04-09  Ian Lance Taylor  <iant@google.com>
11693
11694         PR gold/5996
11695         * script-sections.cc (Sections_element::allocate_to_segment): Add
11696         orphan parameter.
11697         (Output_section_definition::allocate_to_segment): Likewise.
11698         (Orphan_output_section::allocate_to_segment): Likewise.
11699         (Script_sections::attach_sections_using_phdrs_clause): Don't
11700         propagate non-PT_LOAD segments to orphan sections.
11701         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11702         readelf rather than objdump.
11703         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11704         .interp section and PT_INTERP segment are the same size.
11705         * testsuite/Makefile.in: Rebuild.
11706
11707         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11708         aliases for symbols defined in the same object.
11709         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11710         (weak_alias_test_SOURCES): New variable.
11711         (weak_alias_test_DEPENDENCIES): New variable.
11712         (weak_alias_test_LDFLAGS): New variable.
11713         (weak_alias_test_LDADD): New variable.
11714         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11715         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11716         (weak_alias_test_3.o): New target.
11717         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11718         * testsuite/weak_alias_test_main.cc: New file.
11719         * testsuite/weak_alias_test_1.cc: New file.
11720         * testsuite/weak_alias_test_2.cc: New file.
11721         * testsuite/weak_alias_test_3.cc: New file.
11722
11723 2008-04-08  Ian Lance Taylor  <iant@google.com>
11724
11725         * options.h (class General_options): Add --noinhibit-exec option.
11726         * main.cc (main): Check --noinhibit-exec.
11727
11728         * options.h (class General_options): Define --wrap as a special
11729         option.  Add wrap_symbols_ field.
11730         (General_options::any_wrap_symbols): New function.
11731         (General_options::is_wrap_symbol): New function.
11732         * options.cc (General_options::parse_wrap): New function.
11733         (General_options::General_options): Initialize wrap_symbols_.
11734         * symtab.cc (Symbol_table::wrap_symbol): New function.
11735         (Symbol_table::add_from_object): Handle --wrap.
11736         * symtab.h (class Symbol_table): Declare wrap_symbol.
11737         * target.h (Target::wrap_char): New function.
11738         (Target::Target_info): Add wrap_char field.
11739         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11740         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11741         * testsuite/testfile.cc (Target_test::test_target_info):
11742         Likewise.
11743
11744         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11745         there is one.
11746
11747         * layout.h (class Layout): Add added_eh_frame_data_ field.
11748         * layout.cc (Layout::Layout): Initialize new field.
11749         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11750         output section until we find a section we merged successfully.
11751         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11752         that the size be non-zero.
11753
11754         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11755         qualifier.
11756
11757 2008-04-08  Craig Silverstein  <csilvers@google.com>
11758
11759         * configure.ac: Export new conditional variable HAVE_ZLIB.
11760         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11761         on HAVE_ZLIB.
11762         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11763         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11764
11765 2008-04-07  Ian Lance Taylor  <iant@google.com>
11766
11767         * version.cc (version_string): Set to "1.5".
11768
11769         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11770         Add issued_non_pic_error_ field.  Declare check_non_pic.
11771         (Target_x86_64::Scan::check_non_pic): New function.
11772         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11773         (Target_x86_64::Scan::global): Likewise.
11774
11775         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11776         addend parameter.  Change caller.  Handle merge sections.
11777         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11778         Address to Addend.  Don't add in the result of
11779         local_section_offset, pass down the addend and use the returned
11780         value.
11781         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11782         Update declarations of local_section_offset and symbol_value.
11783         * testsuite/two_file_test_1.cc (t18): New function.
11784         * testsuite/two_file_test_2.cc (f18): New function.
11785         * testsuite/two_file_test_main.cc (main): Call t18.
11786         * testsuite/two_file_test.h (t18, f18): Declare.
11787
11788         * configure.ac: Don't test for objdump, c++filt, or readelf.
11789         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11790         conditionals.
11791         (TEST_READELF): New variable.
11792         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11793         (check_PROGRAMS): Add two_file_strip_test.
11794         (two_file_strip_test): New target.
11795         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11796         (two_file_same_shared_strip_test_SOURCES): New variable.
11797         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11798         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11799         (two_file_same_shared_strip_test_LDADD): New variable.
11800         (two_file_shared_strip.so): New target.
11801         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11802         (ver_test_5.syms, ver_test_7.syms): Likewise.
11803         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11804         (strip_test_3.stdout): Use TEST_OBJDUMP.
11805         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11806
11807 2008-04-04  Cary Coutant  <ccoutant@google.com>
11808
11809         * symtab.h (Symbol::is_weak_undefined): New function.
11810         (Symbol::is_strong_undefined): New function.
11811         (Symbol::is_absolute): New function.
11812         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11813         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11814         absolute symbols.
11815         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11816         (weak_undef_test): New target.
11817         * testsuite/Makefile.in: Rebuild.
11818         * testsuite/weak_undef_file1.cc: New file.
11819         * testsuite/weak_undef_file2.cc: New file.
11820         * testsuite/weak_undef_test.cc: New file.
11821
11822 2008-04-03  Craig Silverstein  <csilvers@google.com>
11823
11824         * compressed_output.h (class Output_compressed_section): Use
11825         unsigned buffer.
11826         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11827         add zlib header.
11828         (zlib_compressed_suffix): Removed.
11829         (Output_compressed_section::set_final_data_size): Use unsigned
11830         buffers.
11831         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11832         Fix linker invocation.
11833         (flagstest_o_specialfile_and_compress_debug_sections):
11834         Likewise.
11835         * testsuite/Makefile.in: Regenerated.
11836
11837 2008-04-02  David S. Miller  <davem@davemloft.net>
11838
11839         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11840         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11841
11842 2008-04-02  Craig Silverstein  <csilvers@google.com>
11843
11844         * TODO: New file.
11845
11846 2008-04-02  Ian Lance Taylor  <iant@google.com>
11847
11848         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11849         parameters.  Update for new key type to views_.  Change all
11850         callers.
11851         (File_read::read): Adjust for byteshift in returned view.
11852         (File_read::add_view): New function, broken out of
11853         find_and_make_view.
11854         (File_read::make_view): New function, broken out of
11855         find_and_make_view.
11856         (File_read::find_or_make_view): Add offset and aligned
11857         parameters.  Rewrite accordingly.  Change all callers.
11858         (File_read::get_view): Add offset and aligned parameters.  Adjust
11859         for byteshift in return value.
11860         (File_read::get_lasting_view): Likewise.
11861         * fileread.h (class File_read): Update declarations.
11862         (class File_read::View): Add byteshift_ field.  Add byteshift to
11863         constructor.  Add byteshift method.
11864         * archive.h (Archive::clear_uncached_views): New function.
11865         (Archive::get_view): Add aligned parameter.  Change all callers.
11866         * object.h (Object::get_view): Add aligned parameter.  Change all
11867         callers.
11868         (Object::get_lasting_view): Likewise.
11869
11870         * fileread.cc (File_read::release): Don't call clear_views if
11871         there are multiple objects.
11872         * fileread.h (File_read::clear_uncached_views): New function.
11873         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11874         on the archive.
11875
11876 2008-03-31  Cary Coutant  <ccoutant@google.com>
11877
11878         Add thin archive support.
11879         * archive.cc (Archive::armagt): New const.
11880         (Archive::setup): Remove task parameter and calls to unlock.
11881         (Archive::unlock_nested_archives): New function.
11882         (Archive::read_header): Add nested_off parameter. Change
11883         all callers.
11884         (Archive::interpret_header): Likewise.
11885         (Archive::include_all_members): Change to handle thin
11886         archives.
11887         (Archive::include_member): Likewise.
11888         * archive.h (Archive::Archive): Add new parameters and
11889         initializers.
11890         (Archive::armagt): New const.
11891         (Archive::setup): Remove task parameter.
11892         (Archive::unlock_nested_archives): New function.
11893         (Archive::read_header): Add nested_off parameter.
11894         (Archive::interpret_header): Likewise.
11895         (Archive::Nested_archive_table): New typedef.
11896         (Archive::is_thin_archive_): New field.
11897         (Archive::nested_archives_): New field.
11898         (Archive::options_): New field.
11899         (Archive::dirpath_): New field.
11900         (Archive::task_): New field.
11901         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11902         for thin archives.  Pass additional parameters to
11903         Archive::Archive.  Unlock the archive file after calling
11904         Archive::setup.
11905
11906 2008-03-29  Ian Lance Taylor  <iant@google.com>
11907
11908         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11909         version symbol to be local.
11910         * testsuite/ver_test_4.sh: New file.
11911         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11912         (check_DATA): Add ver_test_4.syms.
11913         (ver_test_4.syms): New target.
11914         * testsuite/Makefile.in: Rebuild.
11915
11916         * output.cc
11917         (Output_section::Input_section_sort_entry::has_priority): New
11918         function.
11919         (Output_section::Input_section_sort_entry::match_file_name): New
11920         function.
11921         (Output_section::Input_section_sort_entry::match_section_name):
11922         Remove.
11923         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11924         Remove.
11925         (Output_section::Input_section_sort_entry::match_section_file):
11926         Remove.
11927         (Output_section::Input_section_sort_compare::operator()): Rewrite
11928         using new Input_section_sort_entry functions.  Sort crtbegin and
11929         crtend first.  Sort sections with no priority before sections with
11930         a priority.
11931         * testsuite/initpri1.c (d3): Check j != 4.
11932         (cd5): New constructor/destructor function.
11933         (main): Check j != 2.
11934
11935         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11936         new symbol when resolving, don't call set_is_default.
11937         * testsuite/ver_test_7.cc: New file.
11938         * testsuite/ver_test_7.sh: New file.
11939         * testsuite/Makefile.am (ver_test_7.so): New target.
11940         (ver_test_7.o): New target.
11941         (check_SCRIPTS): Add ver_test_7.sh.
11942         (check_DATA): Add ver_test_7.syms.
11943         (ver_test_7.syms): New target.
11944
11945 2008-03-28  Ian Lance Taylor  <iant@google.com>
11946
11947         * layout.cc (Layout::layout): If we see an input section with a
11948         name that needs sorting, set the must_sort flag for the output
11949         section.
11950         (Layout::make_output_section): If the name of the output section
11951         indicates that it might require sorting, set the may_sort flag.
11952         * output.h (Output_section::may_sort_attached_input_sections): New
11953         function.
11954         (Output_section::set_may_sort_attached_input_sections): New
11955         function.
11956         (Output_section::must_sort_attached_input_sections): New
11957         function.
11958         (Output_section::set_must_sort_attached_input_sections): New
11959         function.
11960         (class Output_section): Declare Input_section_sort_entry.  Define
11961         Input_section_sort_compare.  Declare
11962         sort_attached_input_sections.  Add new fields:
11963         may_sort_attached_input_sections_,
11964         must_sort_attached_input_sections_,
11965         attached_input_sections_are_sorted_.
11966         * output.cc (Output_section::Output_section): Initialize new
11967         fields.
11968         (Output_section::add_input_section): Add an entry to
11969         input_sections_ if may_sort or must_sort are true.
11970         (Output_section::set_final_data_size): Call
11971         sort_attached_input_sections if necessary.
11972         (Output_section::Input_section_sort_entry): Define new class.
11973         (Output_section::Input_section_sort_compare::operator()): New
11974         function.
11975         (Output_section::sort_attached_input_sections): New function.
11976         * configure.ac: Check whether the compiler supports constructor
11977         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11978         * testsuite/initpri1.c: New file.
11979         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11980         CONSTRUCTOR_PRIORITY.
11981         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11982         (initpri1_LDFLAGS): New variable.
11983         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11984
11985 2008-03-27  Ian Lance Taylor  <iant@google.com>
11986
11987         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11988         * testsuite/common_test_1.c: New file.
11989         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11990         (common_test_1_SOURCES): New variable.
11991         (common_test_1_DEPENDENCIES): New variable.
11992         (common_test_1_LDFLAGS): New variable.
11993
11994         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11995         and commons_ correctly when NAME/VERSION does not override
11996         NAME/NULL.
11997         * testsuite/ver_test_6.c: New file.
11998         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11999         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12000         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12001
12002 2008-03-26  Ian Lance Taylor  <iant@google.com>
12003
12004         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12005         of an undefined symbol from a version script.
12006         * testsuite/Makefile.am (ver_test_5.so): New target.
12007         (ver_test_5.o): New target.
12008         (check_SCRIPTS): Add ver_test_5.sh.
12009         (check_DATA): Add ver_test_5.syms.
12010         (ver_test_5.syms): New target.
12011         * testsuite/ver_test_5.cc: New file.
12012         * testsuite/ver_test_5.script: New file.
12013         * testsuite/ver_test_5.sh: New file.
12014         * Makefile.in, testsuite/Makefile.in: Rebuild.
12015
12016         PR gold/5986
12017         Fix problems building gold with gcc 4.3.0.
12018         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12019         (gold_error_at_location, gold_warning_at_location): Use it.
12020         * configure.ac: Check whether we can compile and use a template
12021         function with a printf attribute.
12022         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12023         when jumping over bytes.
12024         * object.cc: Instantiate Object::read_section_data.
12025         * debug.h: Include <cstring>
12026         * dwarf_reader.cc: Include <algorithm>
12027         * main.cc: Include <cstring>.
12028         * options.cc: Include <cstring>.
12029         * output.cc: Include <cstring>.
12030         * script.cc: Include <cstring>.
12031         * script.h: Include <string>.
12032         * symtab.cc: Include <cstring> and <algorithm>.
12033         * target-select.cc: Include <cstring>.
12034         * version.cc: Include <string>.
12035         * testsuite/testmain.cc: Include <cstdlib>.
12036         * configure, config.in: Rebuild.
12037
12038 2008-03-25  Ian Lance Taylor  <iant@google.com>
12039
12040         * options.cc: Include "../bfd/bfdver.h".
12041         (options::help): Print bug reporting address.
12042
12043         * version.cc (print_version): Adjust output for current value of
12044         BFD_VERSION_STRING.
12045
12046         * NEWS: New file.
12047
12048         * options.cc (options::help): Print list of supported targets.
12049         * target-select.h: Include <vector>.
12050         (class Target_selector): Make machine_, size_, and is_big_endian_
12051         fields const.  Add bfd_name_ and instantiated_target_ fields.
12052         (Target_selector::Target_selector): Add bfd_name parameter.
12053         (Target_selector::recognize): Make non-virtual, call
12054         do_recognize.
12055         (Target_selector::recognize_by_name): Make non-virtual, call
12056         do_recognize_by_name.
12057         (Target_selector::supported_names): New function.
12058         (Target_selector::bfd_name): New function.
12059         (Target_selector::do_instantiate_target): New pure virtual
12060         function.
12061         (Target_selector::do_recognize): New virtual function.
12062         (Target_selector::do_recognize_by_name): New virtual function.
12063         (Target_selector::instantiate_target): New private function.
12064         (supported_target_names): Declare.
12065         * target-select.cc (Target_selector::Target_selector): Update for
12066         new parameter and fields.
12067         (select_target_by_name): Check that the name matches before
12068         calling recognize_by_name.
12069         (supported_target_names): New function.
12070         * i386.cc (class Target_selector_i386): Update Target_selector
12071         constructor call.  Remove recognize and recognize_by_name.  Add
12072         do_instantiate_target.
12073         * x86_64.cc (class Target_selector_x86_64): Likewise.
12074         * testsuite/testfile.cc (class Target_selector_test): Update for
12075         changes to Target_selector.
12076
12077         * README: Rewrite, with some notes on unsupported features.
12078
12079 2008-03-24  Cary Coutant  <ccoutant@google.com>
12080
12081         * i386.cc (Target_i386::Got_type): New enum declaration.
12082         (Target_i386::Scan::local): Updated callers of Output_data_got
12083         member functions.
12084         (Target_i386::Scan::global): Likewise.
12085         (Target_i386::Relocate::relocate): Likewise.
12086         (Target_i386::Relocate::relocate_tls): Likewise.
12087         * object.h (Got_offset_list): New class.
12088         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12089         (Sized_relobj::local_got_offset): Likewise.
12090         (Sized_relobj::set_local_got_offset): Likewise.
12091         (Sized_relobj::local_has_tls_got_offset): Removed.
12092         (Sized_relobj::local_tls_got_offset): Removed.
12093         (Sized_relobj::set_local_tls_got_offset): Removed.
12094         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12095         * output.cc (Output_data_got::add_global): Added got_type parameter.
12096         (Output_data_got::add_global_with_rel): Likewise.
12097         (Output_data_got::add_global_with_rela): Likewise.
12098         (Output_data_got::add_global_pair_with_rel): New function.
12099         (Output_data_got::add_global_pair_with_rela): New function.
12100         (Output_data_got::add_local): Added got_type parameter.
12101         (Output_data_got::add_local_with_rel): Likewise.
12102         (Output_data_got::add_local_with_rela): Likewise.
12103         (Output_data_got::add_local_pair_with_rel): New function.
12104         (Output_data_got::add_local_pair_with_rela): New function.
12105         (Output_data_got::add_global_tls): Removed.
12106         (Output_data_got::add_global_tls_with_rel): Removed.
12107         (Output_data_got::add_global_tls_with_rela): Removed.
12108         (Output_data_got::add_local_tls): Removed.
12109         (Output_data_got::add_local_tls_with_rel): Removed.
12110         (Output_data_got::add_local_tls_with_rela): Removed.
12111         * output.h (Output_data_got::add_global): Added got_type parameter.
12112         (Output_data_got::add_global_with_rel): Likewise.
12113         (Output_data_got::add_global_with_rela): Likewise.
12114         (Output_data_got::add_global_pair_with_rel): New function.
12115         (Output_data_got::add_global_pair_with_rela): New function.
12116         (Output_data_got::add_local): Added got_type parameter.
12117         (Output_data_got::add_local_with_rel): Likewise.
12118         (Output_data_got::add_local_with_rela): Likewise.
12119         (Output_data_got::add_local_pair_with_rel): New function.
12120         (Output_data_got::add_local_pair_with_rela): New function.
12121         (Output_data_got::add_global_tls): Removed.
12122         (Output_data_got::add_global_tls_with_rel): Removed.
12123         (Output_data_got::add_global_tls_with_rela): Removed.
12124         (Output_data_got::add_local_tls): Removed.
12125         (Output_data_got::add_local_tls_with_rel): Removed.
12126         (Output_data_got::add_local_tls_with_rela): Removed.
12127         * resolve.cc (Symbol::override_base_with_special): Removed
12128         reference to has_got_offset_ field.
12129         * symtab.cc (Symbol::init_fields): Replaced initialization
12130         of got_offset_ with got_offsets_.  Removed initialization
12131         of has_got_offset_
12132         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12133         (Symbol::got_offset): Likewise.
12134         (Symbol::set_got_offset): Likewise.
12135         (Symbol::has_tls_got_offset): Removed.
12136         (Symbol::tls_got_offset): Removed.
12137         (Symbol::set_tls_got_offset): Removed.
12138         (Symbol::got_offset_): Removed.
12139         (Symbol::tls_mod_got_offset_): Removed.
12140         (Symbol::tls_pair_got_offset_): Removed.
12141         (Symbol::got_offsets_): New field.
12142         (Symbol::has_got_offset): Removed.
12143         (Symbol::has_tls_mod_got_offset): Removed.
12144         (Symbol::has_tls_pair_got_offset): Removed.
12145         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12146         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12147         member functions.
12148         (Target_x86_64::Scan::global): Likewise.
12149         (Target_x86_64::Relocate::relocate): Likewise.
12150         (Target_x86_64::Relocate::relocate_tls): Likewise.
12151
12152 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12153
12154         * yyscript.y: Fix spelling error in comment.
12155
12156 2008-03-24  Ian Lance Taylor  <iant@google.com>
12157
12158         * options.h (class General_options): Define build_id option.
12159         * layout.h (class Layout): Declare write_build_id, create_note,
12160         create_build_id.  Add build_id_note_ member.
12161         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12162         "libiberty.h", "md5.h", "sha1.h".
12163         (Layout::Layout): Initialize eh_frame_data_,
12164         eh_frame_hdr_section_, and build_id_note_.
12165         (Layout::finalize): Call create_build_id.
12166         (Layout::create_note): New function, broken out of
12167         Layout::create_gold_note.
12168         (Layout::create_gold_note): Call create_note.
12169         (Layout::create_build_id): New function.
12170         (Layout::write_build_id): New function.
12171         (Close_task_runner::run): Call write_build_id.
12172
12173         * x86_64.cc: Correct license to GPLv3.
12174
12175 2008-03-23  Ian Lance Taylor  <iant@google.com>
12176
12177         * options.cc: Include "demangle.h".
12178         (parse_optional_string): New function.
12179         (parse_long_option): Handle takes_optional_argument.
12180         (parse_short_option): Update dash_z initializer.  Handle
12181         takes_optional_argument.
12182         (General_options::General_options): Initialize do_demangle_.
12183         (General_options::finalize): Set do_demangle_.  Handle demangling
12184         style.
12185         * options.h (parse_optional_string): Declare.
12186         (struct One_option): Add optional_arg field.  Update constructor.
12187         Update call constructor calls.  Add takes_optional_argument
12188         function.
12189         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12190         (DEFINE_optional_string): Define.
12191         (General_options::demangle): Change from DEFINE_bool to
12192         DEFINE_optional_string.
12193         (General_options::no_demangle): New function.
12194         (General_options::do_demangle): New function.
12195         (General_options::set_do_demangle): New function.
12196         (General_options::execstack_status_): Move definition to end of
12197         class definition.
12198         (General_options::static_): Likewise.
12199         (General_options::do_demangle_): New field.
12200         * object.cc (big_endian>::get_symbol_location_info): Call
12201         Options::do_demangle, not Options::demangle.
12202         * symtab.cc (demangle): Likewise.
12203
12204 2008-03-22  Ian Lance Taylor  <iant@google.com>
12205
12206         * gold.h: Include <cstddef> and <sys/types.h>
12207         * options.h: Include <cstring>.
12208
12209 2008-03-21  Ian Lance Taylor  <iant@google.com>
12210
12211         * Added source code to GNU binutils.