* symtab.cc (Symbol_table::define_special_symbol): Always
[external/binutils.git] / gold / ChangeLog
1 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2             Ian Lance Taylor  <iant@google.com>
3
4         * symtab.cc (Symbol_table::define_special_symbol): Always
5         canonicalize version string.
6
7 2011-09-26  Cary Coutant  <ccoutant@google.com>
8
9         * gold/gold.cc (queue_initial_tasks): Move option checks ...
10         * gold/options.cc (General_options::finalize): ... to here. Disable
11         some options; make others fatal.
12
13 2011-09-26  Cary Coutant  <ccoutant@google.com>
14
15         gcc PR lto/47247
16         * plugin.cc (get_symbols_v2): New function.
17         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
18         (is_referenced_from_outside): New function.
19         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
20         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
21         (get_symbols): Pass version parameter.
22         (get_symbols_v2): New function.
23         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
24         parameter.
25         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
26         (onload): Add LDPT_GET_SYMBOLS_V2.
27         (all_symbols_read_hook): Use get_symbols_v2; check for
28         LDPR_PREVAILING_DEF_IRONLY_EXP.
29         * testsuite/plugin_test_3.sh: Update expected results.
30
31 2011-09-23  Simon Baldwin  <simonb@google.com>
32
33         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
34         configuration options.
35         * configure: Regenerate.
36         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
37         * Makefile.in: Regenerate.
38         * testsuite/Makefile.in: Regenerate.
39
40 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
41
42         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
43
44 2011-09-19  Cary Coutant  <ccoutant@google.com>
45
46         * incremental.cc (can_incremental_update): Fix typo in comment.
47         * incremental.h (can_incremental_update): Likewise.
48
49 2011-09-18  Cary Coutant  <ccoutant@google.com>
50
51         * incremental.cc (can_incremental_update): New function.
52         * incremental.h (can_incremental_update): New function.
53         * layout.cc (Layout::init_fixed_output_section): Call it.
54         (Layout::make_output_section): Don't allow patch space in .eh_frame.
55         * object.cc (Sized_relobj_file::do_layout): Call
56         can_incremental_update.
57
58 2011-09-13  Cary Coutant  <ccoutant@google.com>
59
60         * configure.ac: Check for glibc support for gnu_indirect_function
61         support with static linking, setting automake conditional
62         IFUNC_STATIC.
63         * Makefile.in: Regenerate.
64         * configure: Regenerate.
65
66         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
67         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
68         for IFUNC_STATIC.
69         * testsuite/Makefile.in: Regenerate.
70
71 2011-09-13  Cary Coutant  <ccoutant@google.com>
72
73         * incremental.cc (Sized_relobj_incr::do_layout): Call
74         report_comdat_group for kept comdat sections.
75         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
76         * testsuite/Makefile.in: Regenerate.
77         * testsuite/incr_comdat_test_1.cc: New source file.
78         * testsuite/incr_comdat_test_2_v1.cc: New source file.
79         * testsuite/incr_comdat_test_2_v2.cc: New source file.
80         * testsuite/incr_comdat_test_2_v3.cc: New source file.
81
82 2011-09-13  Ian Lance Taylor  <iant@google.com>
83
84         * object.cc (Sized_relobj_file::do_layout): Remove unused local
85         variable external_symbols_offset.
86
87 2011-09-12  Ian Lance Taylor  <iant@google.com>
88
89         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
90         triggered if object has no symbols.
91
92 2011-09-09  David S. Miller  <davem@davemloft.net>
93
94         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
95         (Output_fill_debug_line::do_write): Likewise.
96
97 2011-08-29  Cary Coutant  <ccoutant@google.com>
98
99         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
100         casts to match formatting specs.
101         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
102
103 2011-08-26  Cary Coutant  <ccoutant@google.com>
104
105         * layout.cc (Free_list::allocate): Provide guarantee of minimum
106         remaining hole size when allocating.
107         (Layout::make_output_section): Set fill methods for debug sections.
108         * layout.h (Free_list::Free_list_node): Move from private to
109         public.
110         (Free_list::set_min_hole_size): New function.
111         (Free_list::begin, Free_list::end): New functions.
112         (Free_list::min_hole_): New data member.
113         * output.cc: Include dwarf.h.
114         (Output_fill_debug_info::do_minimum_hole_size): New function.
115         (Output_fill_debug_info::do_write): New function.
116         (Output_fill_debug_line::do_minimum_hole_size): New function.
117         (Output_fill_debug_line::do_write): New function.
118         (Output_section::Output_section): Initialize new data member.
119         (Output_section::set_final_data_size): Ensure patch space is larger
120         than minimum hole size.
121         (Output_section::do_write): Fill holes in debug sections.
122         * output.h (Output_fill): New class.
123         (Output_fill_debug_info): New class.
124         (Output_fill_debug_line): New class.
125         (Output_section::set_free_space_fill): New function.
126         (Output_section::free_space_fill_): New data member.
127         * testsuite/Makefile.am (incremental_test_3): Add
128         --incremental-patch option.
129         (incremental_test_4): Likewise.
130         (incremental_test_5): Likewise.
131         (incremental_test_6): Likewise.
132         (incremental_copy_test): Likewise.
133         (incremental_common_test_1): Likewise.
134         * testsuite/Makefile.in: Regenerate.
135
136 2011-08-26  Nick Clifton  <nickc@redhat.com>
137
138         * po/es.po: Updated Spanish translation.
139
140 2011-08-01  Cary Coutant  <ccoutant@google.com>
141
142         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
143         * gold/testsuite/Makefile.in: Regenerate.
144         * gold/testsuite/justsyms_exec.c: New source file.
145         * gold/testsuite/justsyms_lib.c: New source file.
146
147 2011-08-01  Cary Coutant  <ccoutant@google.com>
148
149         * layout.cc (Layout::set_segment_offsets): Don't realign text
150         segment if -Ttext was specified.
151         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
152         file type.
153         * object.h (Sized_relobj_file::e_type): New function.
154         (Sized_relobj_file::e_type_): New data member.
155         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
156         base address for ET_EXEC files.
157         * target.cc (Target::do_make_elf_object_implementation): Allow
158         ET_EXEC files with --just-symbols option.
159
160 2011-07-28  Cary Coutant  <ccoutant@google.com>
161
162         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
163         Add thread_number parameter.
164         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
165         * workqueue-threads.cc
166         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
167         current thread if its thread number is greater than desired thread
168         count.
169         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
170         Add thread_number parameter.
171         (Workqueue::should_cancel_thread): Likewise.
172         (Workqueue::find_runnable_or_wait): Pass thread_number to
173         should_cancel_thread.
174         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
175         parameter.
176
177 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
178
179         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
180         only after checking if it cannot be forced local.
181         * symtab.h (is_externally_visible): Check if the symbol is not forced
182         local.
183
184 2011-07-15  Ian Lance Taylor  <iant@google.com>
185
186         * options.h (class General_options): Add --print-output-format.
187         Move -EL next to -EB, for  better --help output.
188         * target-select.cc: Include <cstdio>, "options.h", and
189         "parameters.h".
190         (Target_selector::do_target_bfd_name): New function.
191         (print_output_format): New function.
192         * target-select.h (class Target_selector): Update declarations.
193         (Target_selector::target_bfd_name): New function.
194         (print_output_format): Declare.
195         * main.cc: Include "target-select.h".
196         (main): Handle --print-output-format.
197         * gold.cc: Include "target-select.h".
198         (queue_initial_tasks): Handle --print-output-format when there are
199         no input files.
200         * parameters.cc (parameters_force_valid_target): Give a better
201         error message if -EB/-EL does not match target.
202         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
203         function.
204
205 2011-07-15  Ian Lance Taylor  <iant@google.com>
206
207         * i386.cc (class Output_data_plt_i386): Add layout_ field.
208         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
209         (Output_data_plt_i386::do_write): Write address of .dynamic
210         section to first entry in .got.plt section.
211         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
212         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
213         Initialize layout_.
214         (Output_data_plt_x86_64::do_write): Write address of .dynamic
215         section to first entry in .got.plt section.
216         * layout.h (Layout::dynamic_section): New function.
217
218 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
219
220         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
221         to claim_file call.
222         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
223         input_section_position_, and input_section_glob_.
224         (read_layout_from_file): Call function section_ordering_specified.
225         * layout.h (is_section_ordering_specified): New function.
226         (section_ordering_specified): New function.
227         (section_ordering_specified_): New boolean member.
228         * main.cc(main): Call load_plugins after layout object is defined.
229         * output.cc (Output_section::add_input_section): Use
230         function section_ordering_specified to check if section ordering is
231         needed.
232         * output.cc (Output_section::add_relaxed_input_section): Use
233         function section_ordering_specified to check if section ordering is
234         needed.
235         (Output_section::update_section_layout): New function.
236         (Output_section::sort_attached_input_sections): Check if input section
237         must be reordered.
238         * output.h (Output_section::update_section_layout): New function.
239         * plugin.cc (get_section_count): New function.
240         (get_section_type): New function.
241         (get_section_name): New function.
242         (get_section_contents): New function.
243         (update_section_order): New function.
244         (allow_section_ordering): New function. 
245         (Plugin::load): Add the new interfaces to the transfer vector.
246         (Plugin_manager::load_plugins): New parameter.
247         (Plugin_manager::all_symbols_read): New parameter.
248         (Plugin_manager::claim_file): New parameter. Save the elf object for
249         unclaimed objects.
250         (Plugin_manager::get_elf_object): New function.
251         (Plugin_manager::get_view): Change to directly use the bool to check
252         if get_view is called from claim_file_hook.
253         * plugin.h (input_objects): New function
254         (Plugin__manager::load_plugins): New parameter.
255         (Plugin_manager::claim_file): New parameter.
256         (Plugin_manager::get_elf_object): New function.
257         (Plugin_manager::in_claim_file_handler): New function.
258         (Plugin_manager::in_claim_file_handler_): New member.
259         (layout): New function.
260         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
261         handler with an extra parameter. Make the elf object before calling
262         claim_file handler.
263         * testsuite/plugin_test.c (get_section_count): New function pointer.
264         (get_section_type): New function pointer.
265         (get_section_name): New function pointer.
266         (get_section_contents): New function pointer.
267         (update_section_order): New function pointer.
268         (allow_section_ordering): New function pointer.
269         (onload): Check if the new interfaces exist.
270
271 2011-07-13  Ian Lance Taylor  <iant@google.com>
272
273         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
274         relro section.
275         * x86_64.cc (Target_x86_64::got_section): Likewise.
276         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
277         (relro_now_test_SOURCES): New variable.
278         (relro_now_test_DEPENDENCIES): New variable.
279         (relro_now_test_LDFLAGS): New variable.
280         (relro_now_test_LDADD): New variable.
281         (relro_now_test.so): New target.
282         * testsuite/Makefile.in: Rebuild.
283
284 2011-07-12  Ian Lance Taylor  <iant@google.com>
285
286         PR gold/12980
287         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
288         GLOB_DAT relocation rather than a RELATIVE relocation for a
289         protected symbol when creating a shared library.
290         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
291         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
292         * testsuite/protected_main_1.cc (main): Test that protected
293         function has same address.
294
295 2011-07-11  Ian Lance Taylor  <iant@google.com>
296
297         PR gold/12979
298         * options.h (class General_options): Add -Bgroup.
299         * options.cc (General_options::finalize): If -Bgroup is set,
300         default to --unresolved-symbols=report-all.
301         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
302         * target-reloc.h (issue_undefined_symbol_error): Handle
303         --unresolved-symbols=report-all.
304
305 2011-07-08  Ian Lance Taylor  <iant@google.com>
306
307         PR gold/11985
308         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
309         if linker script discards key sections.
310         (Layout::create_dynamic_symtab): Likewise.
311         (Layout::assign_local_dynsym_offsets): Likewise.
312         (Layout::sized_create_version_sections): Likewise.
313         (Layout::create_interp): Likewise.
314         (Layout::finish_dynamic_section): Likewise.
315         (Layout::set_dynamic_symbol_size): Likewise.
316
317 2011-07-08  Ian Lance Taylor  <iant@google.com>
318
319         PR gold/12386
320         * options.h (class General_options): Add --unresolved-symbols.
321         * target-reloc.h (issue_undefined_symbol_error): Check
322         --unresolved-symbols.  Add comments.
323
324 2011-07-08  Ian Lance Taylor  <iant@google.com>
325
326         * testsuite/odr_violation2.cc (Ordering::operator()): Make
327         expression more complex.
328
329 2011-07-08  Ian Lance Taylor  <iant@google.com>
330
331         PR gold/11317
332         * target-reloc.h (issue_undefined_symbol_error): New inline
333         function, broken out of relocate_section.
334         (relocate_section): Call issue_undefined_symbol_error.
335         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
336         there is no TLS segment if we are about to issue an undefined
337         symbol error.
338         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
339
340 2011-07-08  Ian Lance Taylor  <iant@google.com>
341
342         PR gold/12279
343         * resolve.cc (Symbol_table::should_override): Add fromtype
344         parameter.  Change all callers.  Give error when linking together
345         TLS and non-TLS symbol.
346         (Symbol_table::should_override_with_special): Add fromtype
347         parameter.  Change all callers.
348         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
349         there is no TLS segment if we have reported some errors.
350         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
351
352 2011-07-08  Ian Lance Taylor  <iant@google.com>
353
354         PR gold/12372
355         * target.h (Target::plt_address_for_global): New function.
356         (Target::plt_address_for_local): New function.
357         (Target::plt_section_for_global): Remove.
358         (Target::plt_section_for_local): Remove.
359         (Target::do_plt_address_for_global): New virtual function.
360         (Target::do_plt_address_for_local): New virtual function.
361         (Target::do_plt_section_for_global): Remove.
362         (Target::do_plt_section_for_local): Remove.
363         (Target::register_global_plt_entry): Add Symbol_table and Layout
364         parameters.
365         * output.cc (Output_data_got::Got_entry::write): Use
366         plt_address_for_global and plt_address_for_local.
367         * layout.cc (Layout::add_target_dynamic_tags): Use size and
368         address of output section.
369         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
370         got_irelative_, and irelative_count_ fields.  Update
371         declarations.
372         (Output_data_plt_i386::has_irelative_section): New function.
373         (Output_data_plt_i386::entry_count): Add irelative_count_.
374         (Output_data_plt_i386::set_final_data_size): Likewise.
375         (class Target_i386): Add got_irelative_ and rel_irelative_
376         fields.  Update declarations.
377         (Target_i386::Target_i386): Initialize new fields.
378         (Target_i386::do_plt_address_for_global): New function replacing
379         do_plt_section_for_global.
380         (Target_i386::do_plt_address_for_local): New function replacing
381         do_plt_section_for_local.
382         (Target_i386::got_section): Create got_irelative_.
383         (Target_i386::rel_irelative_section): New function.
384         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
385         fields.  Don't define __rel_iplt_{start,end}.
386         (Output_data_plt_i386::add_entry): Add symtab and layout
387         parameters.  Change all callers.  Use different PLT and GOT for
388         IFUNC symbols.
389         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
390         layout parameters.  Change all callers.  Use different PLT and
391         GOT.
392         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
393         (Output_data_plt_i386::rel_irelative): New function.
394         (Output_data_plt_i386::address_for_global): New function.
395         (Output_data_plt_i386::address_for_local): New function.
396         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
397         IRELATIVE GOT when changing IFUNC GOT entries.
398         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
399         reloc.
400         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
401         if we didn't create an IRELATIVE GOT.
402         (Target_i386::Relocate::relocate): Use plt_address_for_global and
403         plt_address_for_local.
404         (Target_i386::do_dynsym_value): Use plt_address_for_global.
405         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
406         got_irelative_, and irelative_count_ fields.  Update
407         declarations.
408         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
409         Initialize new fields.  Remove symtab parameter.  Change all
410         callers.
411         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
412         irelative_count_.
413         (Output_data_plt_x86_64::has_irelative_section): New function.
414         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
415         (class Target_x86_64): Add got_irelative_ and rel_irelative_
416         fields.  Update declarations.
417         (Target_x86_64::Target_x86_64): Initialize new fields.
418         (Target_x86_64::do_plt_address_for_global): New function replacing
419         do_plt_section_for_global.
420         (Target_x86_64::do_plt_address_for_local): New function replacing
421         do_plt_section_for_local.
422         (Target_x86_64::got_section): Create got_irelative_.
423         (Target_x86_64::rela_irelative_section): New function.
424         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
425         all callers.  Don't create __rel_iplt_{start,end}.
426         (Output_data_plt_x86_64::add_entry): Add symtab and layout
427         parameters.  Change all callers.  Use different PLT and GOT for
428         IFUNC symbols.
429         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
430         layout parameters.  Change all callers.  Use different PLT and
431         GOT.
432         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
433         parameters.  Change all callers.  Use different PLT and GOT for
434         IFUNC symbols.
435         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
436         (Output_data_plt_x86_64::rela_irelative): New function.
437         (Output_data_plt_x86_64::address_for_global): New function.
438         (Output_data_plt_x86_64::address_for_local): New function.
439         (Output_data_plt_x86_64::set_final_data_size): Likewise.
440         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
441         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
442         (Target_x86_64::register_global_plt_entry): Add symtab and layout
443         parameters.
444         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
445         reloc.
446         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
447         symbols if we didn't create an IRELATIVE GOT.
448         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
449         plt_address_for_local.
450         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
451         * testsuite/ifuncvar1.c: New test file.
452         * testsuite/ifuncvar2.c: New test file.
453         * testsuite/ifuncvar3.c: New test file.
454         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
455         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
456         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
457         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
458         * testsuite/Makefile.in: Rebuild.
459
460 2011-07-07  Cary Coutant  <ccoutant@google.com>
461
462         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
463         (two_file_test_1_ndebug.o): Likewise.
464         (two_file_test_1b_ndebug.o): Likewise.
465         (two_file_test_2_ndebug.o): Likewise.
466         (two_file_test_main_ndebug.o): Likewise.
467         (incremental_test_2): Link with no-debug versions.
468
469 2011-07-06  Cary Coutant  <ccoutant@google.com>
470
471         * gold/incremental.cc
472         (Output_section_incremental_inputs::write_info_blocks): Check for
473         hidden and internal symbols.
474
475 2011-07-06  Cary Coutant  <ccoutant@google.com>
476
477         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
478         Check disposition for startup file.
479         (Incremental_inputs::report_command_line): Ignore
480         --incremental-startup-unchanged option.
481         * options.cc (General_options::parse_incremental_startup_unchanged):
482         New function.
483         (General_options::General_options): Initialize new data member.
484         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
485         (General_options): Add --incremental-startup-unchanged option.
486         (General_options::incremental_startup_disposition): New function.
487         (General_options::incremental_startup_disposition_): New data member.
488
489 2011-07-06  Cary Coutant  <ccoutant@google.com>
490
491         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
492         input file index to Script_info ctor.
493         (Sized_incremental_binary::do_file_has_changed): Find the
494         command-line argument for files named in scripts.
495         * incremental.h (Script_info::Script_info): New ctor
496         with input file index.
497         (Script_info::input_file_index): New function.
498         (Script_info::input_file_index_): New data member.
499         (Incremental_binary::get_library): Add const.
500         (Incremental_binary::get_script_info): Add const.
501         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
502         * testsuite/Makefile.am (incremental_test_5): New test case.
503         (incremental_test_6): New test case.
504         * testsuite/Makefile.in: Regenerate.
505
506 2011-07-06  Cary Coutant  <ccoutant@google.com>
507
508         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
509         debug output when command lines differ.
510
511 2011-07-06  Cary Coutant  <ccoutant@google.com>
512
513         * incremental.cc (Incremental_inputs::report_command_line): Ignore
514         --incremental-patch option.
515         * layout.cc (Free_list::allocate): Extend allocation beyond original
516         end if enabled.
517         (Layout::make_output_section): Mark sections that should get
518         patch space.
519         * options.cc (parse_percent): New function.
520         * options.h (parse_percent): New function.
521         (DEFINE_percent): New macro.
522         (General_options): Add --incremental-patch option.
523         * output.cc (Output_section::Output_section): Initialize new data
524         members.
525         (Output_section::add_input_section): Print section name when out
526         of patch space.
527         (Output_section::add_output_section_data): Likewise.
528         (Output_section::set_final_data_size): Add patch space when
529         doing --incremental-full.
530         (Output_section::do_reset_address_and_file_offset): Remove patch
531         space.
532         (Output_segment::set_section_list_addresses): Print debug output
533         only if --incremental-update.
534         * output.h (Output_section::set_is_patch_space_allowed): New function.
535         (Output_section::is_patch_space_allowed_): New data member.
536         (Output_section::patch_space_): New data member.
537         * parameters.cc (Parameters::incremental_full): New function.
538         * parameters.h (Parameters::incremental_full): New function
539         * testsuite/Makefile.am (incremental_test_2): Add test for
540         --incremental-patch option.
541         * testsuite/Makefile.in: Regenerate.
542         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
543         (t18): Remove function body.
544
545 2011-07-05  Doug Kwan  <dougkwan@google.com>
546
547         PR gold/12771
548         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
549         Arm_Address type for relocation result.
550         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
551         overflow check.
552         (Arm_relocate_functions::abs32): Use unaligned access.
553         (Arm_relocate_functions::rel32): Ditto.
554         (Arm_relocate_functions::prel31): Ditto.
555         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
556         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
557         static data relocations.
558         * testsuite/Makefile.in: Regnerate.
559         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
560
561 2011-07-05  Ian Lance Taylor  <iant@google.com>
562
563         PR gold/12392
564         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
565         symbols if necessary.
566         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
567
568 2011-07-05  Ian Lance Taylor  <iant@google.com>
569
570         PR gold/12952
571         * resolve.cc (Symbol::override_base_with_special): Simply override
572         version with special symbol version, ignoring previous version.
573
574 2011-07-05  Ian Lance Taylor  <iant@google.com>
575
576         * object.cc (Sized_relobj_file::include_section_group): Add
577         information to comment about signature location.
578
579 2011-07-02  Ian Lance Taylor  <iant@google.com>
580
581         PR gold/12957
582         * options.h (class General_options): Add -f and -F.
583         * options.cc (General_options::finalize): Fatal error if -f/-F
584         are used without -shared.
585         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
586
587 2011-07-02  Ian Lance Taylor  <iant@google.com>
588
589         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
590
591 2011-07-01  Ian Lance Taylor  <iant@google.com>
592
593         PR gold/12525
594         PR gold/12952
595         * resolve.cc (Symbol::override_base_with_special): Don't override
596         the version if the overriding symbol has a different name.
597         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
598         all callers.  If we give an error about an undefined version,
599         define the base version if necessary.
600         * dynobj.h (class Versions): Update declaration.
601         * testsuite/weak_alias_test_5.cc: New file.
602         * testsuite/weak_alias_test.script: New file.
603         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
604         and versioned_alias have the right value, and call t2.
605         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
606         weak_alias_test_5.so.
607         (weak_alias_test_LDADD): Likewise.
608         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
609         * testsuite/Makefile.in: Rebuild.
610
611 2011-07-01  Ian Lance Taylor  <iant@google.com>
612
613         PR gold/12525
614         * options.h (class General_options): Support -z notext.
615         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
616         -Wl,-z,notext.
617         (two_file_shared_nonpic.so): Likewise.
618         (two_file_shared_mixed.so): Likewise.
619         (two_file_shared_mixed_1.so): Likewise.
620         (weak_undef_lib_nonpic.so): Likewise.
621         (alt/weak_undef_lib_nonpic.so): Likewise.
622         (tls_test_shared_nonpic.so): Likewise.
623         * testsuite/Makefile.in: Rebuild.
624
625 2011-07-01  Ian Lance Taylor  <iant@google.com>
626
627         PR gold/12525
628         * configure.ac: Test whether static linking works, setting
629         the automake conditional HAVE_STATIC.
630         * testsuite/Makefile.am: Disable tests using -static if
631         HAVE_STATIC is not true.
632         * configure, testsuite/Makefile.in: Rebuild.
633
634 2011-07-01  Ian Lance Taylor  <iant@google.com>
635
636         PR gold/12525
637         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
638         Assert if we see DW_EH_PE_indirect.
639         * target.h (Target::ehframe_datarel_base): New function.
640         (Target::do_ehframe_datarel_base): New target function.
641         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
642         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
643         function.
644
645 2011-07-01  Ian Lance Taylor  <iant@google.com>
646
647         PR gold/12571
648         * options.h (class General_options): Add
649         --ld-generated-unwind-info.
650         * ehframe.cc (Fde::write): Add address parameter.  Change all
651         callers.  If associated with PLT, fill in address and size.
652         (Cie::set_output_offset): Only add merge mapping if there is an
653         object.
654         (Cie::write): Add address parameter.  Change all callers.
655         (Eh_frame::add_ehframe_for_plt): New function.
656         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
657         input_offset_ fields into union u_, with new plt field.
658         (Fde::Fde): Adjust for new union field.
659         (Fde::Fde) [Output_data version]: New constructor.
660         (Fde::add_mapping): Only add merge mapping if there is an object.
661         (class Cie): Update declarations.
662         (class Eh_frame): Declare add_ehframe_for_plt.
663         * layout.cc (Layout::layout_eh_frame): Break out code into
664         make_eh_frame_section, and call it.
665         (Layout::make_eh_frame_section): New function.
666         (Layout::add_eh_frame_for_plt): New function.
667         * layout.h (class Layout): Update declarations.
668         * merge.cc (Merge_map::add_mapping): Add assertion.
669         * i386.cc: Include "dwarf.h".
670         (class Output_data_plt_i386): Make first_plt_entry,
671         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
672         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
673         and plt_eh_frame_fde.
674         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
675         boundary.  Call add_eh_frame_for_plt if appropriate.
676         * x86_64.cc: Include "dwarf.h".
677         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
678         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
679         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
680         and plt_eh_frame_fde.
681         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
682         appropriate.
683
684 2011-06-29  Ian Lance Taylor  <iant@google.com>
685
686         PR gold/12629
687         * object.cc (Sized_relobj_file::layout_section): Change shdr
688         parameter to be const.
689         (Sized_relobj_file::layout_eh_frame_section): New function, broken
690         out of do_layout.
691         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
692         appropriate.  Call layout_eh_frame_section.
693         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
694         sections.
695         * object.h (class Sized_relobj_file): Update declarations.
696
697 2011-06-29  Ian Lance Taylor  <iant@google.com>
698
699         PR gold/12652
700         * script.cc (Token::integer_value): Accept trailing M/m/K/k
701         modifier.
702         (Lex::gather_token): Accept trailing M/m/K/k for integers.
703
704 2011-06-29  Ian Lance Taylor  <iant@google.com>
705
706         PR gold/12675
707         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
708         SHT_X86_64_UNWIND.
709         * layout.cc (Layout::layout_eh_frame): Likewise.
710
711 2011-06-29  Ian Lance Taylor  <iant@google.com>
712
713         PR gold/12695
714         * layout.cc (Layout::symtab_section_shndx): New function.
715         * layout.h (class Layout): Declare symtab_section_shndx.
716         * output.cc (Output_section::write_header): Call it.
717
718 2011-06-29  Ian Lance Taylor  <iant@google.com>
719
720         PR gold/12818
721         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
722         symbols which are not used in a relocation.
723
724 2011-06-28  Ian Lance Taylor  <iant@google.com>
725
726         PR gold/12898
727         * layout.cc (Layout::segment_precedes): Don't crash if a linker
728         script create indistinguishable segments.
729         (Layout::set_segment_offsets): Use stable_sort when sorting
730         segments.  Pass this to Compare_segments constructor.
731         * layout.h (class Layout): Make segment_precedes non-static.
732         (class Compare_segments): Change from struct to class.  Add
733         layout_ field.  Add constructor.
734         * script-sections.cc
735         (Script_sections::attach_sections_using_phdrs_clause): Rename
736         local orphan to is_orphan.  Don't report failure to put empty
737         section in segment.  On attachment failure, report name of
738         section, and attach to first PT_LOAD segment.
739
740 2011-06-28  Ian Lance Taylor  <iant@google.com>
741
742         PR gold/12934
743         * target-select.cc (Target_selector::Target_selector): Add
744         emulation parameter.  Change all callers.
745         (select_target_by_bfd_name): Rename from select_target_by_name.
746         Change all callers.
747         (select_target_by_emulation): New function.
748         (supported_emulation_names): New function.
749         * target-select.h (class Target_selector): Add emulation_ field.
750         Update declarations.
751         (Target_selector::recognize_by_bfd_name): Rename from
752         recognize_by_name.  Change all callers.
753         (Target_selector::supported_bfd_names): Rename from
754         supported_names.  Change all callers.
755         (Target_selector::recognize_by_emulation): New function.
756         (Target_selector::supported_emulations): New function.
757         (Target_selector::emulation): New function.
758         (Target_selector::do_recognize_by_bfd_name): Rename from
759         do_recognize_by_name.  Change all callers.
760         (Target_selector::do_supported_bfd_names): Rename from
761         do_supported_names.  Change all callers.
762         (Target_selector::do_recognize_by_emulation): New function.
763         (Target_selector::do_supported_emulations): New function.
764         (select_target_by_bfd_name): Change name in declaration.
765         (select_target_by_emulation): Declare.
766         (supported_emulation_names): Declare.
767         * parameters.cc (parameters_force_valid_target): Try to find
768         target based on emulation from -m option.
769         * options.h (class General_options): Change doc string for -m.
770         * options.cc (help): Print emulations.
771         (General_options::parse_V): Likewise.
772         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
773         Add emulation parameter.  Change all callers.
774
775 2011-06-28  Ian Lance Taylor  <iant@google.com>
776
777         * target.h (class Target): Add osabi_ field.
778         (Target::osabi): New function.
779         (Target::set_osabi): New function.
780         (Target::Target): Initialize osabi_.
781         (Target::do_adjust_elf_header): Make pure virtual.
782         (Sized_target::do_adjust_elf_header): Declare.
783         * target.cc (Sized_target::do_adjust_elf_header): New function.
784         (class Sized_target): Instantiate all versions.
785         * freebsd.h (class Target_freebsd): Remove.
786         (Target_selector_freebsd::do_recognize): Call set_osabi on
787         Target.
788         (Target_selector_freebsd::do_recognize_by_name): Likewise.
789         (Target_selector_freebsd::set_osabi): Remove.
790         * i386.cc (class Target_i386): Inherit from Sized_target rather
791         than Target_freebsd.
792         * x86_64.cc (class Target_x86_64): Likewise.
793
794 2011-06-28  Ian Lance Taylor  <iant@google.com>
795
796         * target.h (Target::can_check_for_function_pointers): Rewrite.
797         Make non-virtual.
798         (Target::can_icf_inline_merge_sections): Likewise.
799         (Target::section_may_have_icf_unsafe_poineters): Likewise.
800         (Target::Target_info): Add can_icf_inline_merge_sections field.
801         (Target::do_can_check_for_function_pointers): New virtual
802         function.
803         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
804         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
805         from can_check_for_function_pointers, move in file.
806         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
807         section_may_have_icf_unsafe_poineters, move in file.
808         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
809         * i386.cc (Target_i386::do_can_check_for_function_pointers):
810         Rename from can_check_for_function_pointers, move in file.
811         (Target_i386::can_icf_inline_merge_sections): Remove.
812         (Target_i386::i386_info): Initialize
813         can_icf_inline_merge_sections.
814         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
815         Initialize can_icf_inline_merge_sections.
816         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
817         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
818         Rename from can_check_for_function_pointers, move in file.
819         (Target_x86_64::can_icf_inline_merge_sections): Remove.
820         (Target_x86_64::x86_64_info): Initialize
821         can_icf_inline_merge_sections.
822         * testsuite/testfile.cc (Target_test::test_target_info):
823         Likewise.
824         * icf.cc (get_section_contents): Correct formatting.
825
826 2011-06-27  Ian Lance Taylor  <iant@google.com>
827
828         * symtab.cc (Symbol::versioned_name): New function.
829         (Symbol_table::add_to_final_symtab): Use versioned_name when
830         appropriate.
831         (Symbol_table::sized_write_symbol): Likewise.
832         * symtab.h (class Symbol): Declare versioned_name.
833         * stringpool.h (class Stringpool_template): Add variant of add
834         which takes a std::basic_string.
835         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
836         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
837         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
838         (ver_test_12.o): New target.
839         * testsuite/Makefile.in: Rebuild.
840
841 2011-06-27  Doug Kwan  <dougkwan@google.com>
842
843         * arm.cc (Arm_relocate_functions::thm_jump8,
844         Arm_relocate_functions::thm_jump11): Use a wider signed
845         type to compute offset.
846         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
847         arm_thm_jump8.
848         * testsuite/Makefile.in: Regenerate.
849         * testsuite/arm_branch_in_range.sh: Check test results of
850         arm_thm_jump11 and arm_thm_jump8.
851         * testsuite/arm_thm_jump11.s: New test source file.
852         * testsuite/arm_thm_jump11.t: New linker script.
853         * testsuite/arm_thm_jump8.s: New test source file.
854         * testsuite/arm_thm_jump8.t: New linker script.
855
856 2011-06-24  Ian Lance Taylor  <iant@google.com>
857
858         * layout.cc: Include "object.h".
859         (ctors_sections_in_init_array): New static variable.
860         (Layout::is_ctors_in_init_array): New function.
861         (Layout::layout): Add entry to ctors_sections_in_init_array if
862         appropriate.
863         * layout.h (class Layout): Declare is_ctors_in_init_array.
864         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
865         is_ctors_reverse_view is set.
866         (Sized_relobj_file::write_sections): Add layout parameter.  Change
867         all callers.  Set is_ctors_reverse_view field of View_size.
868         (Sized_relobj_file::reverse_words): New function.
869         * object.h (Sized_relobj_file::View_size): Add
870         is_ctors_reverse_view field.
871         (class Sized_relobj_file): Update declarations.
872         * testsuite/initpri3.c: New test.
873         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
874         initpri3b.
875         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
876         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
877         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
878         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
879         * testsuite/Makefile.in: Rebuild.
880
881 2011-06-24  Cary Coutant  <ccoutant@google.com>
882
883         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
884         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
885         (debug_msg_cdebug.err): New targets.
886         * testsuite/Makefile.in: Regenerate.
887         * testsuite/debug_msg.sh: Check output of link with compressed debug.
888         Fix checks for link with shared library.
889
890 2011-06-24  Doug Kwan  <dougkwan@google.com>
891
892         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
893         skip empty text sections.
894         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
895
896 2011-06-22  Ian Lance Taylor  <iant@google.com>
897
898         PR gold/12910
899         * options.h (class General_options): Add --ctors-in-init-array.
900         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
901         friends as SHT_PROGBITS for merging sections.
902         (Layout::layout): Remove special handling of .init_array and
903         friends.  Don't sort if doing relocatable link.  Sort for .ctors
904         and .dtors if ctors_in_init_array.
905         (Layout::make_output_section): Force correct section types for
906         .init_array and friends.  Don't sort if doing relocatable link,
907         Don't sort .ctors and .dtors if ctors_in_init_array.
908         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
909         (Layout::output_section_name): Add relobj parameter.  Change all
910         callers.  Handle .ctors. and .dtors. in code rather than table.
911         Handle .ctors and .dtors if ctors_in_init_array.
912         (Layout::match_file_name): New function, moved from output.cc.
913         * layout.h (class Layout): Update declarations.
914         * output.cc: Include "layout.h".
915         (Input_section_sort_entry::get_priority): New function.
916         (Input_section_sort_entry::match_file_name): Just call
917         Layout::match_file_name.
918         (Output_section::Input_section_sort_init_fini_compare::operator()):
919         Handle .ctors and .dtors.  Sort by explicit priority rather than
920         by name.
921         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
922         * testsuite/initpri2.c: New test.
923         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
924         (check_PROGRAMS): Add initpri2.
925         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
926         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
927         * configure, testsuite/Makefile.in: Rebuild.
928
929 2011-06-19  Ian Lance Taylor  <iant@google.com>
930
931         PR gold/12880
932         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
933         .interp section to a PT_INTERP segment even if we have seen a
934         --dynamic-linker option.  Don't do it if we have seen a PHDRS
935         clause in a linker script.
936         (Layout::finalize): Don't create a .interp section if we've
937         already create a PT_INTERP segment.
938         (Layout::create_interp): Always call choose_output_section (revert
939         patch of 2011-06-17).  Don't create PT_INTERP segment.
940         * script-sections.cc
941         (Script_sections::create_note_and_tls_segments): Add a .interp
942         section to a PT_INTERP segment even if we have seen a
943         --dynamic-linker option.
944
945 2011-06-18  Ian Lance Taylor  <iant@google.com>
946
947         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
948         merely because a non-PT_LOAD segment has a dynamic reloc.
949
950 2011-06-18  Ian Lance Taylor  <iant@google.com>
951
952         * layout.cc (Layout::finish_dynamic_section): Don't create
953         DT_FLAGS entry if not needed.
954
955 2011-06-18  Ian Lance Taylor  <iant@google.com>
956
957         PR gold/12745
958         * layout.cc (Layout::layout_eh_frame): Correct handling of
959         writable .eh_frame section.
960
961 2011-06-17  Ian Lance Taylor  <iant@google.com>
962
963         PR gold/12893
964         * resolve.cc (Symbol_table::resolve): Don't give an error if a
965         symbol is redefined with the exact same object and value.
966
967 2011-06-17  Ian Lance Taylor  <iant@google.com>
968
969         PR gold/12880
970         * layout.h (class Layout): Add interp_segment_ field.
971         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
972         (Layout::attach_allocated_section_to_segment): If making shared
973         library, put .interp section in PT_INTERP segment.
974         (Layout::finalize): Also call create_interp if -dynamic-linker
975         option was used.
976         (Layout::create_interp): Assert that there is no PT_INTERP
977         segment.  If not using a SECTIONS clause, use make_output_section.
978         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
979         * script-sections.cc
980         (Script_sections::create_note_and_tls_segments): If making shared
981         library, put .interp section in PT_INTERP segment.
982
983 2011-06-17  Ian Lance Taylor  <iant@google.com>
984
985         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
986         when making a shared library.
987
988 2011-06-17  Ian Lance Taylor  <iant@google.com>
989
990         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
991         parameter.  Change all callers.  Don't issue warning about PC32
992         against locally defined symbol.
993
994 2011-06-16  Ian Lance Taylor  <iant@google.com>
995
996         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
997         occurs in same object.
998
999 2011-06-14  Alan Modra  <amodra@gmail.com>
1000
1001         * po/POTFILES.in: Regenerate.
1002
1003 2011-06-09  Ian Lance Taylor  <iant@google.com>
1004
1005         * script-sections.cc
1006         (Orphan_output_section::set_section_addresses): For a relocatable
1007         link set address to 0.
1008
1009 2011-06-09  Cary Coutant  <ccoutant@google.com>
1010
1011         PR gold/12804
1012         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1013         used with --compress-debug-sections.
1014         * gold/object.cc (Sized_relobj_file::do_layout): Report
1015         uncompressed size of compressed input sections.
1016
1017 2011-06-08  Cary Coutant  <ccoutant@google.com>
1018
1019         PR gold/12804
1020         * testsuite/two_file_test_2_v1.cc: Change initialization of
1021         v2 to keep it in .data.
1022
1023 2011-06-07  Cary Coutant  <ccoutant@google.com>
1024
1025         * common.cc (Symbol_table::do_allocate_commons_list): Call
1026         gold_fallback.
1027         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1028         (Errors::fallback): New function.
1029         (gold_fallback): New function.
1030         * errors.h (Errors::fallback): New function.
1031         * gold.cc (gold_exit): Change status parameter to enum; adjust
1032         all callers.
1033         (queue_initial_tasks): Call gold_fallback.
1034         * gold.h: Include cstdlib.
1035         (Exit_status): New enum type.
1036         (gold_exit): Change status parameter to enum.
1037         (gold_fallback): New function.
1038         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1039         (Layout::create_symtab_sections): Likewise.
1040         (Layout::create_shdrs): Likewise.
1041         * main.cc (main): Adjust call to gold_exit.
1042         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1043         (Output_data_got::add_got_entry_pair): Likewise.
1044         (Output_section::add_input_section): Likewise.
1045         (Output_section::add_output_section_data): Likewise.
1046         (Output_segment::set_section_list_addresses): Likewise.
1047         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1048
1049 2011-06-07  Cary Coutant  <ccoutant@google.com>
1050
1051         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1052         for incremental links.
1053         * output.cc (Output_segment::set_section_list_addresses): Remove
1054         FIXME and test for TLS or BSS.
1055
1056 2011-06-07  Cary Coutant  <ccoutant@google.com>
1057
1058         * testsuite/Makefile.am: Add incremental_copy_test,
1059         incremental_common_test_1.
1060         * testsuite/Makefile.in: Regenerate.
1061         * testsuite/common_test_1_v1.c: New source file.
1062         * testsuite/common_test_1_v2.c: New source file.
1063         * testsuite/copy_test_v1.cc: New source file.
1064
1065 2011-06-07  Cary Coutant  <ccoutant@google.com>
1066
1067         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1068         update, allocate common from bss section's free list.
1069         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1070         linker-defined symbols.
1071         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1072         Skip GOT and PLT entries that are no longer referenced.
1073         (Output_section_incremental_inputs::write_info_blocks): Mark
1074         linker-defined symbols.
1075         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1076         * output.cc (Output_section::allocate): New function.
1077         * output.h (Output_section::allocate): New function.
1078         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1079         linker-defined symbols.
1080         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1081         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1082         (Symbol::init_base_output_data): Likewise.
1083         (Symbol::init_base_output_segment): Likewise.
1084         (Symbol::init_base_constant): Likewise.
1085         (Sized_symbol::init_output_data): Likewise.
1086         (Sized_symbol::init_output_segment): Likewise.
1087         (Sized_symbol::init_constant): Likewise.
1088         (Symbol_table::do_define_in_output_data): Likewise.
1089         (Symbol_table::do_define_in_output_segment): Likewise.
1090         (Symbol_table::do_define_as_constant): Likewise.
1091         * symtab.h (Symbol::is_predefined): New function.
1092         (Symbol::init_base_output_data): Add is_predefined parameter.
1093         (Symbol::init_base_output_segment): Likewise.
1094         (Symbol::init_base_constant): Likewise.
1095         (Symbol::is_predefined_): New data member.
1096         (Sized_symbol::init_output_data): Add is_predefined parameter.
1097         (Sized_symbol::init_output_segment): Likewise.
1098         (Sized_symbol::init_constant): Likewise.
1099         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1100
1101 2011-06-07  Cary Coutant  <ccoutant@google.com>
1102
1103         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1104         instead of emit_copy_reloc.
1105         (Copy_relocs::emit_copy_reloc): Refactor.
1106         (Copy_relocs::make_copy_reloc): New function.
1107         (Copy_relocs::add_copy_reloc): Remove.
1108         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1109         section.
1110         (Copy_relocs::make_copy_reloc): New function.
1111         (Copy_relocs::add_copy_reloc): Remove.
1112         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1113         unchanged input files.
1114         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1115         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1116         Reserve BSS space for COPY relocations.
1117         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1118         (Output_section_incremental_inputs::write_info_blocks): Record
1119         whether a symbol is copied from a shared object.
1120         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1121         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1122         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1123         (Incremental_input_entry_reader::get_output_symbol_index): Add
1124         is_copy parameter.
1125         (Incremental_binary::emit_copy_relocs): New function.
1126         (Incremental_binary::do_emit_copy_relocs): New function.
1127         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1128         new data member.
1129         (Sized_incremental_binary::add_copy_reloc): New function.
1130         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1131         (Sized_incremental_binary::Copy_reloc): New struct.
1132         (Sized_incremental_binary::Copy_relocs): New typedef.
1133         (Sized_incremental_binary::copy_relocs_): New data member.
1134         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1135         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1136         * target.h (Sized_target::emit_copy_reloc): New function.
1137         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1138
1139 2011-06-02  Cary Coutant  <ccoutant@google.com>
1140
1141         PR gold/12163
1142         * gold/archive.cc (Archive::Archive): Initialize new data member.
1143         (Archive::include_all_members): Return if archive has already been
1144         included.
1145         * gold/archive.h (Archive::include_all_members_): New data member.
1146
1147 2011-06-02  Nick Clifton  <nickc@redhat.com>
1148
1149         * dynobj.h: Fix spelling mistake in comment.
1150         * output.cc: Likewise.
1151
1152 2011-05-31  Doug Kwan  <dougkwan@google.com>
1153             Asier Llano
1154
1155         PR gold/12826
1156         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1157         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1158         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1159         redundant arm_exidx_test.so.
1160         * testsuite/Makefile.in: Regenerate.
1161         (check_SCRIPTS): Add pr12826.sh
1162         (check_DATA): Add pr12826.stdout
1163         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1164         * testsuite/pr12826.sh: New file.
1165         * testsuite/pr12826_1.s: Ditto.
1166         * testsuite/pr12826_1.s: Ditto.
1167
1168 2011-05-30  Ian Lance Taylor  <iant@google.com>
1169
1170         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1171         sections.
1172
1173 2011-05-29  Ian Lance Taylor  <iant@google.com>
1174
1175         PR gold/12804
1176         * testsuite/Makefile.am: Use different file name for two_file_test
1177         temporary file for each incremental test.
1178         * testsuite/Makefile.in: Rebuild.
1179
1180 2011-05-29  Ian Lance Taylor  <iant@google.com>
1181
1182         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1183         binary input file is empty.
1184
1185 2011-05-27  Ian Lance Taylor  <iant@google.com>
1186
1187         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1188         (ver_test_9.so): Likewise.
1189         * testsuite/Makefile.in: Rebuild.
1190
1191 2011-05-26 Cary Coutant  <ccoutant@google.com>
1192
1193         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1194         * incremental.cc (Incremental_inputs::report_input_section): Fix
1195         comment, indentation.
1196         (Incremental_inputs::report_comdat_group): New function.
1197         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1198         of data for incremental input file entry.
1199         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1200         group count, COMDAT group signatures.
1201         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1202         an unchanged input file.
1203         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1204         Initialize new data member.
1205         (Incremental_object_entry::add_comdat_group): New function.
1206         (Incremental_object_entry::get_comdat_group_count): New function.
1207         (Incremental_object_entry::get_comdat_signature_key): New function.
1208         (Incremental_object_entry::groups_): New data member.
1209         (Incremental_inputs::report_comdat_group): New function.
1210         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1211         data for incremental input file entry.
1212         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1213         (Incremental_input_entry_reader::get_input_section): Adjust size of
1214         data for incremental input file entry.
1215         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1216         (Incremental_input_entry_reader::get_comdat_group_signature): New
1217         function.
1218         * object.cc (Sized_relobj::include_section_group): Report kept
1219         COMDAT groups for incremental links.
1220
1221 2011-05-24  David Meyer  <pdox@google.com>
1222
1223         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1224         with name parameter.  Add found_name parameter.
1225         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1226         * dirsearch.h (class Dirsearch): Update declaration.
1227
1228 2011-05-24  Ian Lance Taylor  <iant@google.com>
1229
1230         * archive.cc (Library_base::should_include_member): Pull in object
1231         from archive if it defines the entry symbol.
1232         * parameters.cc (Parameters::entry): New function.
1233         * parameters.h (class Parameters): Declare entry.
1234         * output.h (class Output_file_header): Remove entry_ field.
1235         * output.cc (Output_file_header::Output_file_header): Remove entry
1236         parameter.  Change all callers.
1237         (Output_file_header::entry): Use parameters->entry.
1238         * gold.cc (queue_middle_tasks): Likewise.
1239         * plugin.cc (Plugin_hook::run): Likewise.
1240
1241 2011-05-24 Cary Coutant  <ccoutant@google.com>
1242
1243         * gold.cc (queue_initial_tasks): Pass incremental base filename
1244         to Output_file::open_base_file; don't print error message.
1245         * incremental-dump.cc (main): Adjust call to
1246         Output_file::open_for_modification.
1247         * incremental-dump.cc (main): Likewise.
1248         * incremental.cc (Incremental_inputs::report_command_line):
1249         Ignore --incremental-base option when comparing command lines.
1250         Ignore parameter when given as separate argument.
1251         * options.h (class General_options): Add --incremental-base.
1252         * output.cc (Output_file::Output_file):
1253         (Output_file::open_base_file): Add base_name and writable parameters;
1254         read base file into new file; print error message here.
1255         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1256         callers.
1257         * output.h (Output_file::open_for_modification): Rename to...
1258         (Output_file::open_base_file): ...this; add base_name and
1259         writable parameters; adjust all callers.
1260         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1261         callers.
1262         * testsuite/Makefile.am (incremental_test_4): Test
1263         --incremental-base.
1264         * testsuite/Makefile.in: Regenerate.
1265
1266 2011-05-24 Cary Coutant  <ccoutant@google.com>
1267
1268         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1269         incremental_test_4.
1270         * testsuite/Makefile.in: Regenerate.
1271         * testsuite/two_file_test_1_v1.cc: New test source file.
1272         * testsuite/two_file_test_1b_v1.cc: New test source file.
1273         * testsuite/two_file_test_2_v1.cc: New test source file.
1274
1275 2011-05-24 Cary Coutant  <ccoutant@google.com>
1276
1277         * dynobj.h (Dynobj::do_dynobj): New function.
1278         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1279         flag and soname for shared objects.
1280         * incremental.cc (Incremental_inputs::report_object): Make
1281         either Incremental_object_entry or Incremental_dynobj_entry; add
1282         soname to string table.
1283         (Incremental_inputs::report_input_section): Add assertion.
1284         (Output_section_incremental_inputs::set_final_data_size): Adjust
1285         type of input file entry for shared libraries; adjust size of
1286         shared library info entry.
1287         (Output_section_incremental_inputs::write_input_files): Write
1288         as_needed flag for shared libraries.
1289         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1290         of input file entry for shared libraries; write soname.
1291         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1292         soname from incremental info.
1293         * incremental.h (enum Incremental_input_flags): Add
1294         INCREMENTAL_INPUT_AS_NEEDED.
1295         (Incremental_input_entry::Incremental_input_entry): Initialize new
1296         data member.
1297         (Incremental_input_entry::set_as_needed): New function.
1298         (Incremental_input_entry::as_needed): New function.
1299         (Incremental_input_entry::do_dynobj_entry): New function.
1300         (Incremental_input_entry::as_needed_): New data member.
1301         (Incremental_object_entry::Incremental_object_entry): Don't check
1302         for shared library.
1303         (Incremental_object_entry::do_type): Likewise.
1304         (class Incremental_dynobj_entry): New class.
1305         (Incremental_input_entry_reader::as_needed): New function.
1306         (Incremental_input_entry_reader::get_soname): New function.
1307         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1308         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1309         size of shared library info entry.
1310         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1311         incremental link when adding DT_NEEDED entries.
1312         * object.h (Object::Object): Initialize new data member.
1313         (Object::dynobj): New function.
1314         (Object::set_as_needed): New function.
1315         (Object::as_needed): New function.
1316         (Object::do_dynobj): New function.
1317         (Object::as_needed_): New data member.
1318
1319 2011-05-24 Cary Coutant  <ccoutant@google.com>
1320
1321         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1322         info; adjust display of GOT entries.
1323         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1324         vector of input objects; remove file_status_.
1325         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1326         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1327         got_plt reader; call target hooks to reserve GOT entries.
1328         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1329         of input file info header and GOT info entry.
1330         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1331         relocation info.
1332         (Got_plt_view_info::got_descriptor): Remove.
1333         (Got_plt_view_info::sym_index): New data member.
1334         (Got_plt_view_info::input_index): New data member.
1335         (Local_got_offset_visitor::visit): Write input file index.
1336         (Global_got_offset_visitor::visit): Write 0 for input file index.
1337         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1338         with sym_index and input_index.
1339         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1340         incremental info GOT entry; replace got_descriptor with input_index.
1341         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1342         map from input file index to object.
1343         (Sized_relobj_incr::do_layout): Replace direct data member reference
1344         with accessor function.
1345         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1346         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1347         Adjust size of input file info header.
1348         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1349         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1350         (Incremental_input_entry_reader::get_input_section): Adjust size of
1351         input file info header.
1352         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1353         of incremental info GOT entry.
1354         (Incremental_got_plt_reader::get_got_desc): Remove.
1355         (Incremental_got_plt_reader::get_got_symndx): New function.
1356         (Incremental_got_plt_reader::get_got_input_index): New function.
1357         (Sized_incremental_binary::Sized_incremental_binary): Remove
1358         file_status_; add input_objects_.
1359         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1360         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1361         (Sized_incremental_binary::file_is_unchanged): Remove.
1362         (Sized_incremental_binary::set_input_object): New function.
1363         (Sized_incremental_binary::input_object): New function.
1364         (Sized_incremental_binary::file_status_): Remove.
1365         (Sized_incremental_binary::input_objects_): New data member.
1366         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1367         references.
1368         (Sized_relobj_incr::invalid_address): Move to base class.
1369         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1370         class.
1371         (Sized_relobj_incr::do_output_section_offset): Likewise.
1372         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1373         (Sized_relobj_incr::section_offsets_): Likewise.
1374         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1375         function.
1376         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1377         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1378         with accessor function.
1379         (Sized_relobj_file::do_layout): Likewise.
1380         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1381         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1382         (Sized_relobj_file::compute_final_local_value): Replace refs to
1383         section_offsets_ with accessor function.
1384         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1385         * object.h (Relobj::Relobj): Initialize new data members.
1386         (Relobj::add_dyn_reloc): New function.
1387         (Relobj::first_dyn_reloc): New function.
1388         (Relobj::dyn_reloc_count): New function.
1389         (Relobj::first_dyn_reloc_): New data member.
1390         (Relobj::dyn_reloc_count_): New data member.
1391         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1392         references.
1393         (Sized_relobj::Address): New typedef.
1394         (Sized_relobj::invalid_address): Move here from child class.
1395         (Sized_relobj::Sized_relobj): Initialize new data members.
1396         (Sized_relobj::sized_relobj): New function.
1397         (Sized_relobj::is_output_section_offset_invalid): Move here from
1398         child class.
1399         (Sized_relobj::get_output_section_offset): Likewise.
1400         (Sized_relobj::local_has_got_offset): Likewise.
1401         (Sized_relobj::local_got_offset): Likewise.
1402         (Sized_relobj::set_local_got_offset): Likewise.
1403         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1404         (Sized_relobj::clear_got_offsets): New function.
1405         (Sized_relobj::section_offsets): Move here from child class.
1406         (Sized_relobj::do_output_section_offset): Likewise.
1407         (Sized_relobj::do_set_section_offset): Likewise.
1408         (Sized_relobj::Local_got_offsets): Likewise.
1409         (Sized_relobj::local_got_offsets_): Likewise.
1410         (Sized_relobj::section_offsets_): Likewise.
1411         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1412         references.
1413         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1414         class.
1415         (Sized_relobj_file::sized_relobj): New function
1416         (Sized_relobj_file::local_has_got_offset): Move to base class.
1417         (Sized_relobj_file::local_got_offset): Likewise.
1418         (Sized_relobj_file::set_local_got_offset): Likewise.
1419         (Sized_relobj_file::get_output_section_offset): Likewise.
1420         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1421         (Sized_relobj_file::do_output_section_offset): Likewise.
1422         (Sized_relobj_file::do_set_section_offset): Likewise.
1423         (Sized_relobj_file::Local_got_offsets): Likewise.
1424         (Sized_relobj_file::local_got_offsets_): Likewise.
1425         (Sized_relobj_file::section_offsets_): Likewise.
1426         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1427         (all constructors).
1428         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1429         (Output_reloc::get_symbol_index): Likewise.
1430         (Output_reloc::local_section_offset): Likewise.
1431         (Output_reloc::get_address): Likewise.
1432         (Output_reloc::symbol_value): Likewise.
1433         (Output_data_got::reserve_slot): Move to class definition.
1434         (Output_data_got::reserve_local): New function.
1435         (Output_data_got::reserve_slot_for_global): Remove.
1436         (Output_data_got::reserve_global): New function.
1437         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1438         (all constructors, two instantiations).
1439         (Output_reloc::get_relobj): New function (two instantiations).
1440         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1441         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1442         (Output_data_reloc::add_global): Adjust type of relobj.
1443         (Output_data_reloc::add_global_relative): Likewise.
1444         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1445         (Output_data_reloc::add_local): Likewise.
1446         (Output_data_reloc::add_local_relative): Likewise.
1447         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1448         (Output_data_reloc::add_local_section): Likewise.
1449         (Output_data_reloc::add_output_section): Likewise.
1450         (Output_data_reloc::add_absolute): Likewise.
1451         (Output_data_reloc::add_target_specific): Likewise.
1452         (Output_data_got::reserve_slot): Move definition here.
1453         (Output_data_got::reserve_local): New function.
1454         (Output_data_got::reserve_global): New function.
1455         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1456         section_offsets_ with accessor function.
1457         (Sized_relobj_file::write_sections): Likewise.
1458         (Sized_relobj_file::do_relocate_sections): Likewise.
1459         * target.h (Sized_target::reserve_local_got_entry): New function.
1460         (Sized_target::reserve_global_got_entry): New function.
1461         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1462         (Target_x86_64::reserve_global_got_entry): New function.
1463         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1464
1465 2011-05-23 Cary Coutant  <ccoutant@google.com>
1466
1467         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1468         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1469         bit when checking got_type.
1470         * incremental.cc (Sized_incremental_binary::setup_readers):
1471         Store symbol table and string table locations; initialize bit vector
1472         of file status flags.
1473         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1474         unchanged files.
1475         (Sized_incremental_binary::do_process_got_plt): New function.
1476         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1477         (Output_section_incremental_inputs::set_final_data_size): Record
1478         file index for each input file.
1479         (Output_section_incremental_inputs::write_got_plt): Store file index
1480         instead of input entry offset for each GOT entry.
1481         * incremental.h
1482         (Incremental_input_entry::Incremental_input_entry): Initialize new
1483         data member.
1484         (Incremental_input_entry::set_offset): Store file index.
1485         (Incremental_input_entry::get_file_index): New function.
1486         (Incremental_input_entry::file_index_): New data member.
1487         (Incremental_binary::process_got_plt): New function.
1488         (Incremental_binary::do_process_got_plt): New function.
1489         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1490         data members.
1491         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1492         (Sized_incremental_binary::set_file_is_unchanged): New function.
1493         (Sized_incremental_binary::file_is_unchanged): New function.
1494         (Sized_incremental_binary::do_process_got_plt): New function.
1495         (Sized_incremental_binary::file_status_): New data member.
1496         (Sized_incremental_binary::main_symtab_loc_): New data member.
1497         (Sized_incremental_binary::main_strtab_loc_): New data member.
1498         * output.cc (Output_data_got::Got_entry::write): Add case
1499         RESERVED_CODE.
1500         (Output_data_got::add_global): Call add_got_entry.
1501         (Output_data_got::add_global_plt): Likewise.
1502         (Output_data_got::add_global_with_rel): Likewise.
1503         (Output_data_got::add_global_with_rela): Likewise.
1504         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1505         (Output_data_got::add_global_pair_with_rela): Likewise.
1506         (Output_data_got::add_local): Call add_got_entry.
1507         (Output_data_got::add_local_plt): Likewise.
1508         (Output_data_got::add_local_with_rel): Likewise.
1509         (Output_data_got::add_local_with_rela): Likewise.
1510         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1511         (Output_data_got::add_local_pair_with_rela): Likewise.
1512         (Output_data_got::reserve_slot): New function.
1513         (Output_data_got::reserve_slot_for_global): New function.
1514         (Output_data_got::add_got_entry): New function.
1515         (Output_data_got::add_got_entry_pair): New function.
1516         (Output_section::add_output_section_data): Edit FIXME.
1517         * output.h
1518         (Output_section_data_build::Output_section_data_build): New
1519         constructor with size parameter.
1520         (Output_data_space::Output_data_space): Likewise.
1521         (Output_data_got::Output_data_got): Initialize new data member; new
1522         constructor with size parameter.
1523         (Output_data_got::add_constant): Call add_got_entry.
1524         (Output_data_got::reserve_slot): New function.
1525         (Output_data_got::reserve_slot_for_global): New function.
1526         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1527         (Output_data_got::add_got_entry): New function.
1528         (Output_data_got::add_got_entry_pair): New function.
1529         (Output_data_got::free_list_): New data member.
1530         * target.h (Sized_target::init_got_plt_for_update): New function.
1531         (Sized_target::register_global_plt_entry): New function.
1532         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1533         Initialize new data member; call init; add constructor with PLT count.
1534         (Output_data_plt_x86_64::init): New function.
1535         (Output_data_plt_x86_64::add_relocation): New function.
1536         (Output_data_plt_x86_64::reserve_slot): New function.
1537         (Output_data_plt_x86_64::free_list_): New data member.
1538         (Target_x86_64::init_got_plt_for_update): New function.
1539         (Target_x86_64::register_global_plt_entry): New function.
1540         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1541         incremental updates.
1542         (Output_data_plt_x86_64::add_relocation): New function.
1543         * testsuite/object_unittest.cc (Object_test): Set default options.
1544
1545 2011-05-16  Ian Lance Taylor  <iant@google.com>
1546
1547         * options.h (class General_options): Make -i a synonym for -r.
1548
1549 2011-05-16  Ian Lance Taylor  <iant@google.com>
1550
1551         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1552
1553 2011-05-10 Cary Coutant  <ccoutant@google.com>
1554
1555         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1556         strip_all (-s).
1557
1558 2011-05-06  Ian Lance Taylor  <iant@google.com>
1559
1560         * layout.cc (Layout::layout): If the output section flags change,
1561         update the ordering.
1562
1563 2011-04-25 Cary Coutant  <ccoutant@google.com>
1564
1565         * incremental-dump.cc (dump_incremental_inputs): Print local
1566         symbol info for each input file.
1567         * incremental.cc
1568         (Output_section_incremental_inputs::set_final_data_size): Add local
1569         symbol info to input file entries in incremental info.
1570         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1571         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1572         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1573         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1574         implementation.
1575         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1576         (Sized_incr_relobj::do_relocate): Write the local symbols.
1577         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1578         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1579         Adjust size of input file header.
1580         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1581         (Incremental_inputs_reader::get_local_symbol_count): New function.
1582         (Incremental_inputs_reader::get_input_section): Adjust size of input
1583         file header.
1584         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1585         (Sized_incr_relobj::This): New typedef.
1586         (Sized_incr_relobj::sym_size): New const data member.
1587         (Sized_incr_relobj::Local_symbol): New struct.
1588         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1589         (Sized_incr_relobj::do_local_symbol_offset): New function.
1590         (Sized_incr_relobj::local_symbol_count_): New data member.
1591         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1592         (Sized_incr_relobj::local_symbol_index_): New data member.
1593         (Sized_incr_relobj::local_symbol_offset_): New data member.
1594         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1595         (Sized_incr_relobj::local_symbols_): New data member.
1596         * object.h (Relobj::output_local_symbol_count): New function.
1597         (Relobj::local_symbol_offset): New function.
1598         (Relobj::do_output_local_symbol_count): New function.
1599         (Relobj::do_local_symbol_offset): New function.
1600         (Sized_relobj::do_output_local_symbol_count): New function.
1601         (Sized_relobj::do_local_symbol_offset): New function.
1602
1603 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1604
1605         * descriptors.cc (set_close_on_exec): New function.
1606         (Descriptors::open): Use set_close_on_exec.
1607         * output.cc (S_ISLNK): Define if not defined.
1608
1609 2011-04-22 Cary Coutant  <ccoutant@google.com>
1610
1611         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1612         global symbol map.
1613         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1614         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1615         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1616         relocations.
1617         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1618         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1619         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1620         * incremental.h
1621         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1622         function.
1623         (Incremental_binary::apply_incremental_relocs): New function.
1624         (Incremental_binary::do_apply_incremental_relocs): New function.
1625         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1626         data member.
1627         (Sized_incremental_binary::add_global_symbol): New function.
1628         (Sized_incremental_binary::global_symbol): New function.
1629         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1630         (Sized_incremental_binary::symbol_map_): New data member.
1631         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1632         * target.h (Sized_target::apply_relocation): New function.
1633         * target-reloc.h (apply_relocation): New function.
1634         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1635
1636 2011-04-22  Doug Kwan  <dougkwan@google.com>
1637
1638         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1639         flag of a SHT_ARM_EXIDX section.
1640         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1641         * testsuite/Makefile.in: Regenerate.
1642         * testsuite/arm_exidx_test.s: New file.
1643         * testsuite/arm_exidx_test.sh: Same.
1644
1645 2011-04-20 Cary Coutant  <ccoutant@google.com>
1646
1647         PR gold/12689
1648         * archive.h (Incremental_archive_entry::Archive_member):
1649         Initialize arg_serial_ (second constructor).
1650
1651 2011-04-17  Ian Lance Taylor  <iant@google.com>
1652
1653         * object.cc (Relocate_info::location): Simplify location string.
1654         * errors.cc (Errors::error_at_location): Don't print program
1655         name.
1656         (Errors::warning_at_location): Likewise.
1657         (Errors::undefined_symbol): Likewise.
1658         * testsuite/debug_msg.sh: Update accordingly.
1659
1660 2011-04-14 Cary Coutant  <ccoutant@google.com>
1661
1662         * gold/layout.cc (Layout::symtab_section_offset): New function.
1663         * gold/layout.h (Layout::symtab_section_offset): New function.
1664         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1665
1666 2011-04-12  Ian Lance Taylor  <iant@google.com>
1667
1668         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1669         with MREMAP_MAYMOVE.
1670         * output.h (class Output_file): Add map_is_allocated_ field.
1671         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1672         not available, provide stubs.  If mremap is not available, #define
1673         it to gold_mremap.
1674         (MREMAP_MAYMOVE): Define if not defined.
1675         (Output_file::Output_file): Initialize map_is_allocated_.
1676         (Output_file::resize): Check map_is_allocated_.
1677         (Output_file::map_anonymous): If mmap fails, use malloc.
1678         (Output_file::unmap): Don't do anything for an anonymous map.
1679         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1680         is not available, provide stubs.
1681         (File_read::View::~View): Use free rather than delete[].
1682         (File_read::make_view): Use malloc rather than new[].  If mmap
1683         fails, use malloc.
1684         (File_read::find_or_make_view): Use malloc rather than new[].
1685         * gold.h: Remove HAVE_REMAP code.
1686         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1687         exists.  Rename mremap to gold_mremap.  If mmap is not available
1688         don't do anything.
1689         * configure, config.in: Rebuild.
1690
1691 2011-04-11  Ian Lance Taylor  <iant@google.com>
1692
1693         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1694         initialize local variable v.
1695
1696 2011-04-11  Cary Coutant  <ccoutant@google.com>
1697
1698         * archive.cc (Archive::include_member): Adjust call to
1699         report_object.
1700         (Add_archive_symbols::run): Track argument serial numbers.
1701         (Lib_group::include_member): Likewise.
1702         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1703         * archive.h (Incremental_archive_entry::Archive_member):
1704         Initialize arg_serial_.
1705         (Archive_member::arg_serial_): New data member.
1706         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1707         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1708         incremental link.
1709         (Sized_dynobj::do_for_all_local_got_entries): New function.
1710         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1711         function.
1712         * fileread.cc (get_mtime): New function.
1713         * fileread.h (get_mtime): New function.
1714         * gold.cc (queue_initial_tasks): Check for incremental update.
1715         (process_incremental_input): New function.
1716         (queue_middle_tasks): Don't force valid target for incremental
1717         update.
1718         * incremental-dump.cc (find_input_containing_global): Adjust
1719         size of symbol info entry.
1720         (dump_incremental_inputs): Dump argument serial number and
1721         in_system_directory flag; bias shndx by 1; print symbol names
1722         when dumping per-file symbol lists; use new symbol info readers.
1723         * incremental.cc
1724         (Output_section_incremental_inputs:update_data_size): New function.
1725         (Sized_incremental_binary::setup_readers): Setup input readers
1726         for each input file; build maps for files added from libraries
1727         and scripts.
1728         (Sized_incremental_binary::check_input_args): New function.
1729         (Sized_incremental_binary::do_check_inputs): Build map of argument
1730         serial numbers to input arguments.
1731         (Sized_incremental_binary::do_file_has_changed): Rename
1732         do_file_is_unchanged to this; compare file modification times.
1733         (Sized_incremental_binary::do_init_layout): New function.
1734         (Sized_incremental_binary::do_reserve_layout): New function.
1735         (Sized_incremental_binary::do_get_input_reader): Remove.
1736         (Sized_incremental_binary::get_symtab_view): New function.
1737         (Incremental_checker::can_incrementally_link_output_file): Remove.
1738         (Incremental_inputs::report_command_line): Exclude --debug options.
1739         (Incremental_inputs::report_archive_begin): Add parameter; track
1740         argument serial numbers; don't put input file entry for archive
1741         before archive members.
1742         (Incremental_inputs::report_archive_end): Put input file entry
1743         for archive after archive members.
1744         (Incremental_inputs::report_object): Add parameter; track argument
1745         serial numbers and in_system_directory flag.
1746         (Incremental_inputs::report_script): Add parameter; track argument
1747         serial numbers.
1748         (Output_section_incremental_inputs::set_final_data_size): Adjust
1749         size of symbol info entry; check for forwarding symbols.
1750         (Output_section_incremental_inputs::write_input_files): Write
1751         in_system_directory flag and argument serial number.
1752         (Output_section_incremental_inputs::write_info_blocks): Map section
1753         indices between incremental info and original input file; store
1754         input section index for each symbol.
1755         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1756         change operator() to visit().
1757         (class Global_got_offset_visitor): Likewise.
1758         (class Global_symbol_visitor_got_plt):
1759         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1760         classes.
1761         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1762         (Sized_incr_relobj::do_read_symbols): New function.
1763         (Sized_incr_relobj::do_layout): New function.
1764         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1765         (Sized_incr_relobj::do_add_symbols): New function.
1766         (Sized_incr_relobj::do_should_include_member): New function.
1767         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1768         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1769         (Sized_incr_relobj::do_section_size): New function.
1770         (Sized_incr_relobj::do_section_name): New function.
1771         (Sized_incr_relobj::do_section_contents): New function.
1772         (Sized_incr_relobj::do_section_flags): New function.
1773         (Sized_incr_relobj::do_section_entsize): New function.
1774         (Sized_incr_relobj::do_section_address): New function.
1775         (Sized_incr_relobj::do_section_type): New function.
1776         (Sized_incr_relobj::do_section_link): New function.
1777         (Sized_incr_relobj::do_section_info): New function.
1778         (Sized_incr_relobj::do_section_addralign): New function.
1779         (Sized_incr_relobj::do_initialize_xindex): New function.
1780         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1781         (Sized_incr_relobj::do_read_relocs): New function.
1782         (Sized_incr_relobj::do_gc_process_relocs): New function.
1783         (Sized_incr_relobj::do_scan_relocs): New function.
1784         (Sized_incr_relobj::do_count_local_symbols): New function.
1785         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1786         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1787         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1788         (Sized_incr_relobj::do_relocate): New function.
1789         (Sized_incr_relobj::do_set_section_offset): New function.
1790         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1791         (Sized_incr_dynobj::do_read_symbols): New function.
1792         (Sized_incr_dynobj::do_layout): New function.
1793         (Sized_incr_dynobj::do_add_symbols): New function.
1794         (Sized_incr_dynobj::do_should_include_member): New function.
1795         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1796         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1797         (Sized_incr_dynobj::do_section_size): New function.
1798         (Sized_incr_dynobj::do_section_name): New function.
1799         (Sized_incr_dynobj::do_section_contents): New function.
1800         (Sized_incr_dynobj::do_section_flags): New function.
1801         (Sized_incr_dynobj::do_section_entsize): New function.
1802         (Sized_incr_dynobj::do_section_address): New function.
1803         (Sized_incr_dynobj::do_section_type): New function.
1804         (Sized_incr_dynobj::do_section_link): New function.
1805         (Sized_incr_dynobj::do_section_info): New function.
1806         (Sized_incr_dynobj::do_section_addralign): New function.
1807         (Sized_incr_dynobj::do_initialize_xindex): New function.
1808         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1809         (make_sized_incremental_object): New function.
1810         (Incremental_library::copy_unused_symbols): New function.
1811         (Incremental_library::do_for_all_unused_symbols): New function.
1812         * incremental.h (enum Incremental_input_flags): New type.
1813         (class Incremental_checker): Remove.
1814         (Incremental_input_entry::Incremental_input_entry): Add argument
1815         serial number.
1816         (Incremental_input_entry::arg_serial): New function.
1817         (Incremental_input_entry::set_is_in_system_directory): New function.
1818         (Incremental_input_entry::is_in_system_directory): New function.
1819         (Incremental_input_entry::arg_serial_): New data member.
1820         (Incremental_input_entry::is_in_system_directory_): New data member.
1821         (class Script_info): Move here from script.h.
1822         (Script_info::Script_info): Add filename parameter.
1823         (Script_info::filename): New function.
1824         (Script_info::filename_): New data member.
1825         (Incremental_script_entry::Incremental_script_entry): Add argument
1826         serial number.
1827         (Incremental_object_entry::Incremental_object_entry): Likewise.
1828         (Incremental_object_entry::add_input_section): Build list of input
1829         sections with map to original shndx.
1830         (Incremental_object_entry::get_input_section_index): New function.
1831         (Incremental_object_entry::shndx_): New data member.
1832         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1833         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1834         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1835         serial number.
1836         (Incremental_inputs::report_archive_begin): Likewise.
1837         (Incremental_inputs::report_object): Likewise.
1838         (Incremental_inputs::report_script): Likewise.
1839         (class Incremental_global_symbol_reader): New class.
1840         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1841         and store flags and input file type.
1842         (Incremental_input_entry_reader::arg_serial): New function.
1843         (Incremental_input_entry_reader::type): Extract type from flags.
1844         (Incremental_input_entry_reader::is_in_system_directory): New function.
1845         (Incremental_input_entry_reader::get_input_section_count): Call
1846         accessor function for type.
1847         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1848         function for type; adjust size of global symbol entry.
1849         (Incremental_input_entry_reader::get_global_symbol_count): Call
1850         accessor function for type.
1851         (Incremental_input_entry_reader::get_object_count): Likewise.
1852         (Incremental_input_entry_reader::get_object_offset): Likewise.
1853         (Incremental_input_entry_reader::get_member_count): Likewise.
1854         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1855         (Incremental_input_entry_reader::get_member_offset): Likewise.
1856         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1857         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1858         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1859         (Incremental_input_entry_reader::get_global_symbol_reader): New
1860         function.
1861         (Incremental_input_entry_reader::get_output_symbol_index): New
1862         function.
1863         (Incremental_input_entry_reader::type_): Remove.
1864         (Incremental_input_entry_reader::flags_): New data member.
1865         (Incremental_inputs_reader::input_file_offset): New function.
1866         (Incremental_inputs_reader::input_file_index): New function.
1867         (Incremental_inputs_reader::input_file): Call input_file_offset.
1868         (Incremental_inputs_reader::input_file_at_offset): New function.
1869         (Incremental_relocs_reader::get_r_type): Reformat.
1870         (Incremental_relocs_reader::get_r_shndx): Reformat.
1871         (Incremental_relocs_reader::get_r_offset): Reformat.
1872         (Incremental_relocs_reader::data): New function.
1873         (Incremental_binary::Incremental_binary): Initialize new data members.
1874         (Incremental_binary::check_inputs): Add cmdline parameter.
1875         (Incremental_binary::file_is_unchanged): Remove.
1876         (Input_reader::arg_serial): New function.
1877         (Input_reader::get_unused_symbol_count): New function.
1878         (Input_reader::get_unused_symbol): New function.
1879         (Input_reader::do_arg_serial): New function.
1880         (Input_reader::do_get_unused_symbol_count): New function.
1881         (Input_reader::do_get_unused_symbol): New function.
1882         (Incremental_binary::input_file_count): New function.
1883         (Incremental_binary::get_input_reader): Change signature to use
1884         index instead of filename.
1885         (Incremental_binary::file_has_changed): New function.
1886         (Incremental_binary::get_input_argument): New function.
1887         (Incremental_binary::get_library): New function.
1888         (Incremental_binary::get_script_info): New function.
1889         (Incremental_binary::init_layout): New function.
1890         (Incremental_binary::reserve_layout): New function.
1891         (Incremental_binary::output_file): New function.
1892         (Incremental_binary::do_check_inputs): New function.
1893         (Incremental_binary::do_file_is_unchanged): Remove.
1894         (Incremental_binary::do_file_has_changed): New function.
1895         (Incremental_binary::do_init_layout): New function.
1896         (Incremental_binary::do_reserve_layout): New function.
1897         (Incremental_binary::do_input_file_count): New function.
1898         (Incremental_binary::do_get_input_reader): Change signature.
1899         (Incremental_binary::input_args_map_): New data member.
1900         (Incremental_binary::library_map_): New data member.
1901         (Incremental_binary::script_map_): New data member.
1902         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1903         new data members.
1904         (Sized_incremental_binary::output_section): New function.
1905         (Sized_incremental_binary::inputs_reader): Add const.
1906         (Sized_incremental_binary::symtab_reader): Add const.
1907         (Sized_incremental_binary::relocs_reader): Add const.
1908         (Sized_incremental_binary::got_plt_reader): Add const.
1909         (Sized_incremental_binary::get_symtab_view): New function.
1910         (Sized_incremental_binary::Inputs_reader): New typedef.
1911         (Sized_incremental_binary::Input_entry_reader): New typedef.
1912         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1913         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1914         (Sized_incremental_binary::do_file_has_changed): New function.
1915         (Sized_incremental_binary::do_init_layout): New function.
1916         (Sized_incremental_binary::do_reserve_layout): New function.
1917         (Sized_input_reader::Inputs_reader): Remove.
1918         (Sized_input_reader::Input_entry_reader): Remove.
1919         (Sized_input_reader::do_arg_serial): New function.
1920         (Sized_input_reader::do_get_unused_symbol_count): New function.
1921         (Sized_input_reader::do_get_unused_symbol): New function.
1922         (Sized_incremental_binary::do_input_file_count): New function.
1923         (Sized_incremental_binary::do_get_input_reader): Change signature;
1924         use index instead of filename.
1925         (Sized_incremental_binary::section_map_): New data member.
1926         (Sized_incremental_binary::input_entry_readers_): New data member.
1927         (class Sized_incr_relobj): New class.
1928         (class Sized_incr_dynobj): New class.
1929         (make_sized_incremental_object): New function.
1930         (class Incremental_library): New class.
1931         * layout.cc (Free_list::num_lists): New static data member.
1932         (Free_list::num_nodes): New static data member.
1933         (Free_list::num_removes): New static data member.
1934         (Free_list::num_remove_visits): New static data member.
1935         (Free_list::num_allocates): New static data member.
1936         (Free_list::num_allocate_visits): New static data member.
1937         (Free_list::init): New function.
1938         (Free_list::remove): New function.
1939         (Free_list::allocate): New function.
1940         (Free_list::dump): New function.
1941         (Free_list::print_stats): New function.
1942         (Layout_task_runner::run): Resize output file for incremental updates.
1943         (Layout::Layout): Initialize new data members.
1944         (Layout::set_incremental_base): New function.
1945         (Layout::init_fixed_output_section): New function.
1946         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1947         incremental updates.
1948         (Layout::create_gold_note): Do not create gold note section for
1949         incremental updates.
1950         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1951         for incremental updates.
1952         (Layout::set_section_offsets): For incremental updates, allocate space
1953         from free list.
1954         (Layout::create_symtab_sections): Layout with offsets relative to
1955         start of section; for incremental updates, allocate space from free
1956         list.
1957         (Layout::create_shdrs): For incremental updates, allocate space from
1958         free list.
1959         (Layout::finish_dynamic_section): For incremental updates, do not
1960         check --as-needed (fixed in subsequent patch).
1961         * layout.h (class Free_list): New class.
1962         (Layout::set_incremental_base): New function.
1963         (Layout::incremental_base): New function.
1964         (Layout::init_fixed_output_section): New function.
1965         (Layout::allocate): New function.
1966         (Layout::incremental_base_): New data member.
1967         (Layout::free_list_): New data member.
1968         * main.cc (main): Print Free_list statistics.
1969         * object.cc (Relobj::finalize_incremental_relocs): Add
1970         clear_counts parameter; clear counts only when clear_counts is set.
1971         (Sized_relobj::Sized_relobj): Initialize new base class.
1972         (Sized_relobj::do_layout): Don't report special sections.
1973         (Sized_relobj::do_for_all_local_got_entries): New function.
1974         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1975         symtab_off to all symbol table offsets.
1976         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1977         * object.h (class Got_offset_list): Move to top of file.
1978         (Object::Object): Allow case where input_file == NULL.
1979         (Object::~Object): Likewise.
1980         (Object::input_file): Assert that input_file != NULL.
1981         (Object::lock): Allow case where input_file == NULL.
1982         (Object::unlock): Likewise.
1983         (Object::is_locked): Likewise.
1984         (Object::token): Likewise.
1985         (Object::release): Likewise.
1986         (Object::is_incremental): New function.
1987         (Object::get_mtime): New function.
1988         (Object::for_all_local_got_entries): New function.
1989         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1990         (Object::set_is_in_system_directory): New function.
1991         (Object::is_in_system_directory): New function.
1992         (Object::do_is_incremental): New function.
1993         (Object::do_get_mtime): New function.
1994         (Object::do_for_all_local_got_entries): New function.
1995         (Object::is_in_system_directory_): New data member.
1996         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1997         (class Sized_relobj_base): New class.
1998         (class Sized_relobj): Derive from Sized_relobj_base.
1999         (class Sized_relobj::Symbols): Redeclare from base class.
2000         (class Sized_relobj::local_got_offset_list): Remove.
2001         (class Sized_relobj::Output_sections): Redeclare from base class.
2002         (class Sized_relobj::do_for_all_local_got_entries): New function.
2003         (class Sized_relobj::write_local_symbols): Add offset parameter.
2004         (class Sized_relobj::local_symbol_offset_): Update comment.
2005         (class Sized_relobj::local_dynsym_offset_): Update comment.
2006         * options.cc (Input_arguments::add_file): Remove const.
2007         * options.h (Input_file_argument::Input_file_argument):
2008         Initialize arg_serial_ (all constructors).
2009         (Input_file_argument::set_arg_serial): New function.
2010         (Input_file_argument::arg_serial): New function.
2011         (Input_file_argument::arg_serial_): New data member.
2012         (Input_arguments::Input_arguments): Initialize file_count_.
2013         (Input_arguments::add_file): Remove const.
2014         (Input_arguments::number_of_input_files): New function.
2015         (Input_arguments::file_count_): New data member.
2016         (Command_line::number_of_input_files): Call
2017         Input_arguments::number_of_input_files.
2018         * output.cc (Output_segment_headers::Output_segment_headers):
2019         Set current size.
2020         (Output_section::Input_section::current_data_size): New function.
2021         (Output_section::Output_section): Initialize new data members.
2022         (Output_section::add_input_section): Don't do merge sections for
2023         an incremental link; allocate space from free list for an
2024         incremental update.
2025         (Output_section::add_output_section_data): Allocate space from
2026         free list for an incremental update.
2027         (Output_section::update_data_size): New function.
2028         (Output_section::set_fixed_layout): New function.
2029         (Output_section::reserve): New function.
2030         (Output_segment::set_section_addresses): Remove const.
2031         (Output_segment::set_section_list_addresses): Remove const; allocate
2032         space from free list for an incremental update.
2033         (Output_segment::set_offset): Adjust size of RELRO segment for an
2034         incremental update.
2035         * output.h (Output_data::current_data_size): Move here from
2036         child classes.
2037         (Output_data::pre_finalize_data_size): New function.
2038         (Output_data::update_data_size): New function.
2039         (Output_section_headers::update_data_size): new function.
2040         (Output_section_data_build::current_data_size): Move to Output_data.
2041         (Output_data_strtab::update_data_size): New function.
2042         (Output_section::current_data_size): Move to Output_data.
2043         (Output_section::set_fixed_layout): New function.
2044         (Output_section::has_fixed_layout): New function.
2045         (Output_section::reserve): New function.
2046         (Output_section::update_data_size): New function.
2047         (Output_section::has_fixed_layout_): New data member.
2048         (Output_section::free_list_): New data member.
2049         (Output_segment::set_section_addresses): Remove const.
2050         (Output_segment::set_section_list_addresses): Remove const.
2051         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2052         New function.
2053         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2054         New function.
2055         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2056         parameter when calling Add_symbols constructor; store argument
2057         serial number for members of a lib group.
2058         (Add_symbols::locks): Allow case where token == NULL.
2059         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2060         (Read_member::~Read_member): New function.
2061         (Read_member::is_runnable): New function.
2062         (Read_member::locks): New function.
2063         (Read_member::run): New function.
2064         (Check_script::~Check_script): New function.
2065         (Check_script::is_runnable): New function.
2066         (Check_script::locks): New function.
2067         (Check_script::run): New function.
2068         (Check_library::~Check_library): New function.
2069         (Check_library::is_runnable): New function.
2070         (Check_library::locks): New function.
2071         (Check_library::run): New function.
2072         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2073         (Add_symbols::library_): New data member.
2074         (class Read_member): New class.
2075         (class Check_script): New class.
2076         (class Check_library): New class.
2077         * reloc.cc (Read_relocs::is_runnable): Allow case where
2078         token == NULL.
2079         (Read_relocs::locks): Likewise.
2080         (Scan_relocs::locks): Likewise.
2081         (Relocate_task::locks): Likewise.
2082         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2083         to clear counters.
2084         (Sized_relobj::incremental_relocs_scan): Fix comment.
2085         (Sized_relobj::do_relocate): Pass output file offset to
2086         write_local_symbols.
2087         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2088         from class declaration.
2089         * script.cc (read_input_script): Allocate Script_info; pass
2090         argument serial number to report_script.
2091         * script.h (class Script_info): Move to incremental.h.
2092         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2093         * symtab.h (Symbol_table::add_from_incrobj): New function.
2094         (Symbol_table::set_file_offset): New function.
2095
2096 2011-04-05  Cary Coutant  <ccoutant@google.com>
2097
2098         * incremental-dump.cc (dump_incremental_inputs): Change signature
2099         to take a Sized_incremental_binary; change caller.  Use readers
2100         in Sized_incremental_binary.
2101         * incremental.cc
2102         (Sized_incremental_binary::find_incremental_inputs_sections):
2103         Rename do_find_incremental_inputs_sections to this.
2104         (Sized_incremental_binary::setup_readers): New function.
2105         (Sized_incremental_binary::do_check_inputs): Check
2106         has_incremental_info_ flag; move setup code to setup_readers;
2107         use input readers.
2108         (Sized_incremental_binary::do_file_is_unchanged): New function.
2109         (Sized_incremental_binary::do_get_input_reader): New function.
2110         * incremental.h (class Incremental_binary): Move to end of file.
2111         (Incremental_binary::file_is_unchanged): New function.
2112         (Incremental_binary::do_file_is_unchanged): New function.
2113         (Incremental_binary::Input_reader): New class.
2114         (Incremental_binary::get_input_reader): New function.
2115         (class Sized_incremental_binary): Move to end of file.
2116         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2117         input section reader classes.
2118         (Sized_incremental_binary::has_incremental_info): New function.
2119         (Sized_incremental_binary::inputs_reader): New function.
2120         (Sized_incremental_binary::symtab_reader): New function.
2121         (Sized_incremental_binary::relocs_reader): New function.
2122         (Sized_incremental_binary::got_plt_reader): New function.
2123         (Sized_incremental_binary::do_file_is_unchanged): New function.
2124         (Sized_incremental_binary::Sized_input_reader): New class.
2125         (Sized_incremental_binary::get_input_reader): New function.
2126         (Sized_incremental_binary::find_incremental_inputs_sections):
2127         Rename do_find_incremental_inputs_sections to this.
2128         (Sized_incremental_binary::setup_readers): New function.
2129         (Sized_incremental_binary::has_incremental_info_): New data member.
2130         (Sized_incremental_binary::inputs_reader_): New data member.
2131         (Sized_incremental_binary::symtab_reader_): New data member.
2132         (Sized_incremental_binary::relocs_reader_): New data member.
2133         (Sized_incremental_binary::got_plt_reader_): New data member.
2134         (Sized_incremental_binary::current_input_file_): New data member.
2135
2136 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2137
2138         PR gold/12640
2139         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2140         violation.
2141
2142 2011-03-30  Cary Coutant  <ccoutant@google.com>
2143
2144         * archive.cc (Archive::include_member): Adjust call to report_object.
2145         (Add_archive_symbols::run): Add script_info to call to
2146         report_archive_begin.
2147         (Lib_group::include_member): Adjust call to report_object.
2148         (Add_lib_group_symbols::run): Adjust call to report_object.
2149         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2150         blocks.  Add object count for script input files.
2151         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2152         script_info parameter; change all callers.
2153         (Incremental_inputs::report_object): Add script_info parameter;
2154         change all callers.
2155         (Incremental_inputs::report_script): Store backpointer to
2156         incremental info entry.
2157         (Output_section_incremental_inputs::set_final_data_size): Record
2158         additional information for scripts.
2159         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2160         * incremental.h (Incremental_script_entry::add_object): New function.
2161         (Incremental_script_entry::get_object_count): New function.
2162         (Incremental_script_entry::get_object): New function.
2163         (Incremental_script_entry::objects_): New data member; adjust
2164         constructor.
2165         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2166         (Incremental_inputs::report_object): Add script_info parameter.
2167         (Incremental_inputs_reader::get_object_count): New function.
2168         (Incremental_inputs_reader::get_object_offset): New function.
2169         * options.cc (Input_arguments::add_file): Return reference to
2170         new input argument.
2171         * options.h (Input_argument::set_script_info): New function.
2172         (Input_argument::script_info): New function.
2173         (Input_argument::script_info_): New data member; adjust all
2174         constructors.
2175         (Input_file_group::add_file): Return reference to new input argument.
2176         (Input_file_lib::add_file): Likewise.
2177         (Input_arguments::add_file): Likewise.
2178         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2179         * script.cc (Parser_closure::Parser_closure): Add script_info
2180         parameter; adjust all callers.
2181         (Parser_closure::script_info): New function.
2182         (Parser_closure::script_info_): New data member.
2183         (read_input_script): Report scripts earlier to incremental info.
2184         (script_add_file): Set script_info in Input_argument.
2185         (script_add_library): Likewise.
2186         * script.h (Script_options::Script_info): Rewrite class.
2187
2188 2011-03-29  Cary Coutant  <ccoutant@google.com>
2189
2190         * archive.cc (Library_base::should_include_member): Move
2191         method here from class Archive.
2192         (Archive::Archive): Initialize base class.
2193         (Archive::should_include_member): Move to base class.
2194         (Archive::do_for_all_unused_symbols): New function.
2195         (Add_archive_symbols::run): Remove redundant access to
2196         incremental_inputs.
2197         (Lib_group::Lib_group): Initialize base class.
2198         (Lib_group::do_filename): New function.
2199         (Lib_group::include_member): Pass pointer to Lib_group to
2200         report_object.
2201         (Lib_group::do_for_all_unused_symbols): New function.
2202         (Add_lib_group_symbols::run): Report archive information for
2203         incremental links.
2204         * archive.h (class Library_base): New base class.
2205         (class Archive): Derive from Library_base.
2206         (Archive::filename): Move to base class.
2207         (Archive::set_incremental_info): Likewise.
2208         (Archive::incremental_info): Likewise.
2209         (Archive::Should_include): Likewise.
2210         (Archive::should_include_member): Likewise.
2211         (Archive::Armap_entry): Remove.
2212         (Archive::Unused_symbol_iterator): Remove.
2213         (Archive::unused_symbols_begin): Remove.
2214         (Archive::unused_symbols_end): Remove.
2215         (Archive::do_filename): New function.
2216         (Archive::do_get_mtime): New function.
2217         (Archive::do_for_all_unused_symbols): New function.
2218         (Archive::task_): Move to base class.
2219         (Archive::incremental_info_): Likewise.
2220         (class Lib_group): Derive from Library_base.
2221         (Lib_group::do_filename): New function.
2222         (Lib_group::do_get_mtime): New function.
2223         (Lib_group::do_for_all_unused_symbols): New function.
2224         (Lib_group::task_): Move to base class.
2225         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2226         function.
2227         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2228         function.
2229         * incremental.cc (Incremental_inputs::report_archive_begin):
2230         Use Library_base; call library's get_mtime; add incremental inputs
2231         entry before members.
2232         (class Unused_symbol_visitor): New class.
2233         (Incremental_inputs::report_archive_end): Use Library_base; use
2234         visitor class to record unused symbols; don't add incremental inputs
2235         entry after members.
2236         (Incremental_inputs::report_object): Use Library_base.
2237         * incremental.h
2238         (Incremental_archive_entry::Incremental_archive_entry): Remove
2239         unused Archive parameter.
2240         (Incremental_inputs::report_archive_begin): Use Library_base.
2241         (Incremental_inputs::report_archive_end): Likewise.
2242         (Incremental_inputs::report_object): Likewise.
2243         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2244         function.
2245         * object.h (Object::for_all_global_symbols): New function.
2246         (Object::do_for_all_global_symbols): New function.
2247         (Sized_relobj::do_for_all_global_symbols): New function.
2248         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2249         function.
2250         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2251         function.
2252
2253 2011-03-27  Ian Lance Taylor  <iant@google.com>
2254
2255         * archive.cc (Archive::interpret_header): Return -1 if something
2256         goes wrong.  Change callers accordingly.
2257
2258 2011-03-25  Cary Coutant  <ccoutant@google.com>
2259
2260         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2261         * testsuite/Makefile.in: Regenerate.
2262
2263 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2264
2265         * plugin.cc (get_view): New.
2266         (Plugin::load): Pass get_view to the plugin.
2267         (Plugin_manager::get_view): New.
2268
2269 2011-03-21  Ian Lance Taylor  <iant@google.com>
2270
2271         * testsuite/final_layout.sh: Rewrite to not use dc.
2272         * testsuite/relro_test.sh: Fail if dc is not present.
2273
2274 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2275
2276         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2277         Change == to -eq.
2278         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2279         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2280         Change == to -eq.
2281         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2282         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2283
2284 2011-03-14  Ian Lance Taylor  <iant@google.com>
2285
2286         * script-sections.cc (Sort_output_sections::script_compare):
2287         Rename from is_before, change return type.
2288         (Sort_output_sections::operator()): Adjust accordingly.
2289
2290 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2291
2292         PR gold/12572
2293         * testsuite/odr_violation2.cc: Add comment to make all error line
2294         numbers double digits.
2295         * testsuite/debug_msg.sh: Adjust expected errors.
2296
2297 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2298
2299         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2300         but mark earlier ones as non-canonical
2301         (offset_to_iterator): Update search target and example
2302         (do_addr2line): Return extra lines in a vector*
2303         (format_file_lineno): Extract from do_addr2line
2304         (one_addr2line): Add vector* out-param
2305         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2306         when a lineno entry appeared last for its instruction
2307         (Dwarf_line_info): Add vector* out-param
2308         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2309         * symtab.cc (Odr_violation_compare): Include the lineno in the
2310         comparison again.
2311         (linenos_from_loc): New. Combine the canonical line for an
2312         address with its other lines.
2313         (True_if_intersect): New. Helper functor to make
2314         std::set_intersection a query.
2315         (detect_odr_violations): Compare sets of lines instead of just
2316         one line for each function. This became less deterministic, but
2317         has fewer false positives.
2318         * symtab.h: Declarations.
2319         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2320         mix an optimized and non-optimized object in the same binary
2321         (odr_violation2.so): Same.
2322         * testsuite/Makefile.in: Regenerate from Makefile.am.
2323         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2324         * testsuite/debug_msg.sh: Update line numbers and add
2325         assertions.
2326         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2327         non-optimized context.
2328         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2329         isn't inlined, and use OdrDerived in an optimized context.
2330         * testsuite/odr_header1.h: Defines OdrDerived, where
2331         optimization will change the
2332         first-instruction-in-the-destructor's file and line number.
2333         * testsuite/odr_header2.h: Defines OdrBase.
2334
2335 2011-03-09  Ian Lance Taylor  <iant@google.com>
2336
2337         * fileread.cc (File_read::clear_views): Don't delete the whole
2338         file view.
2339
2340 2011-03-08  Ian Lance Taylor  <iant@google.com>
2341
2342         PR gold/12525
2343         * fileread.cc: #include <climits>.
2344         (GOLD_IOV_MAX): Define.
2345         (File_read::read_multiple): Limit number of entries by iov_max.
2346         * fileread.h (class File_read): Always set max_readv_entries to
2347         128.
2348
2349 2011-03-07  Ian Lance Taylor  <iant@google.com>
2350
2351         PR gold/12525
2352         * options.h (class General_options): Add -dy and -dn.
2353
2354 2011-03-02  Cary Coutant  <ccoutant@google.com>
2355
2356         * testsuite/script_test_9.t: Add TLS segment.
2357
2358 2011-03-02  Simon Baldwin  <simonb@google.com>
2359
2360         * configure.ac: Add check for gnu_indirect_function support in
2361         the toolchain building binutils.
2362         * configure: Rebuild.
2363
2364 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2365
2366         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2367         plugin only symbols.
2368         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2369         in plugin files as not needed in the symbol table.
2370
2371 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2372
2373         * output.cc (Output_section::add_input_section): Delay fill
2374         generation for section ordering.
2375
2376 2011-02-09  Ian Lance Taylor  <iant@google.com>
2377
2378         PR gold/12316
2379         * object.h (class Sized_relobj): Remove clear_local_symbols.
2380         * reloc.cc (Sized_relobj::do_relocate): Don't call
2381         clear_local_symbols.
2382
2383 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2384
2385         * plugin.cc (is_visible_from_outside): Return true for symbols
2386         in the -u option.
2387
2388 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2389
2390         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2391         filename.
2392
2393 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2394
2395         * icf.h (is_section_foldable_candidate): Change type of parameter
2396         to std::string.
2397         * icf.cc (Icf::find_identical_sections): Change type of local variable
2398         section_name to be std::string.
2399         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2400
2401 2011-01-25  Ian Lance Taylor  <iant@google.com>
2402
2403         * script.cc (script_add_extern): Rewrite to use
2404         add_symbol_reference.
2405
2406 2011-01-25  Doug Kwan  <dougkwan@google.com>
2407
2408         * icf.cc (get_section_contents): Always lock section's object.
2409
2410 2011-01-24  Ian Lance Taylor  <iant@google.com>
2411
2412         * options.h (class General_options): Accept
2413         --no-detect-odr-violations.
2414
2415 2011-01-24  Ian Lance Taylor  <iant@google.com>
2416
2417         * version.cc (version_string): Bump to 1.11.
2418
2419 2011-01-24  Ian Lance Taylor  <iant@google.com>
2420
2421         * plugin.cc (class Plugin_rescan): Define new class.
2422         (Plugin_manager::claim_file): Set any_claimed_.
2423         (Plugin_manager::save_archive): New function.
2424         (Plugin_manager::save_input_group): New function.
2425         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2426         necessary.
2427         (Plugin_manager::new_undefined_symbol): New function.
2428         (Plugin_manager::rescan): New function.
2429         (Plugin_manager::rescannable_defines): New function.
2430         (Plugin_manager::add_input_file): Set any_added_.
2431         * plugin.h (class Plugin_manager): define new fields rescannable_,
2432         undefined_symbols_, any_claimed_, and any_added_.  Declare
2433         Plugin_rescan as friend.  Declare new functions.
2434         (Plugin_manager::Rescannable): Define type.
2435         (Plugin_manager::Rescannable_list): Define type.
2436         (Plugin_manager::Undefined_symbol_list): Define type.
2437         (Plugin_manager::Plugin_manager): Initialize new fields.
2438         * archive.cc (Archive::defines_symbol): New function.
2439         (Add_archive_symbols::run): Pass archive to plugins if any.
2440         * archive.h (class Archive): Declare defines_symbol.
2441         * readsyms.cc (Input_group::~Input_group): New function.
2442         (Finish_group::run): Pass input_group to plugins if any.
2443         * readsyms.h (class Input_group): Declare destructor.
2444         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2445         any.
2446
2447 2011-01-10  Ian Lance Taylor  <iant@google.com>
2448
2449         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2450         section as relro.
2451         (Layout::set_segment_offsets): Reset increase_relro before calling
2452         set_section_addresses a second time.
2453
2454 2011-01-04  Cary Coutant  <ccoutant@google.com>
2455
2456         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2457         sections before NOBITS sections.
2458
2459 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2460
2461         * version.cc (print_version): Update copyright to 2011.
2462
2463 2010-12-23  Cary Coutant  <ccoutant@google.com>
2464
2465         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2466         of OS to this->add.  Add OD parameter to second form of the function.
2467
2468 2010-12-20  Ian Lance Taylor  <iant@google.com>
2469
2470         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2471         second of two consecutive entries with same offset.
2472
2473 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2474
2475         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2476         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2477         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2478         to avoid unneeded links against $(LDADD).
2479         * testsuite/Makefile.in: Regenerate.
2480
2481 2010-12-15  Ian Lance Taylor  <iant@google.com>
2482
2483         PR gold/12324
2484         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2485         for R_X86_64_32 and R_X86_64_PC32.
2486         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2487         ver_matching_def_pic.o.
2488         (ver_matching_def_pic.o): New target.
2489
2490 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2491
2492         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2493         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2494         Move definition before File_read::View member definitions.
2495         (File_read::View::~View): Initialize and hold lock before
2496         updating current_mapped_bytes.
2497
2498 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2499
2500         * dwarf_reader.cc: Remove outdated comment.
2501         * gold-threads.cc: Fix typo in error message.
2502         * archive.cc: Fix typos in comments.
2503         * archive.h: Likewise.
2504         * arm-reloc-property.cc: Likewise.
2505         * arm-reloc-property.h: Likewise.
2506         * arm-reloc.def: Likewise.
2507         * arm.cc: Likewise.
2508         * attributes.h: Likewise.
2509         * cref.cc: Likewise.
2510         * ehframe.cc: Likewise.
2511         * fileread.h: Likewise.
2512         * gold.h: Likewise.
2513         * i386.cc: Likewise.
2514         * icf.cc: Likewise.
2515         * incremental.h: Likewise.
2516         * int_encoding.cc: Likewise.
2517         * layout.h: Likewise.
2518         * main.cc: Likewise.
2519         * merge.h: Likewise.
2520         * object.cc: Likewise.
2521         * object.h: Likewise.
2522         * options.cc: Likewise.
2523         * readsyms.cc: Likewise.
2524         * reduced_debug_output.cc: Likewise.
2525         * reloc.cc: Likewise.
2526         * script-sections.cc: Likewise.
2527         * sparc.cc: Likewise.
2528         * symtab.h: Likewise.
2529         * target-reloc.h: Likewise.
2530         * target.cc: Likewise.
2531         * target.h: Likewise.
2532         * timer.cc: Likewise.
2533         * timer.h: Likewise.
2534         * x86_64.cc: Likewise.
2535
2536 2010-12-09  Cary Coutant  <ccoutant@google.com>
2537
2538         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2539         stack.
2540         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2541         parameter; change all callers.
2542         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2543         * options.h (warn_execstack): New option.
2544
2545 2010-12-07  Doug Kwan  <dougkwan@google.com>
2546
2547         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2548         like function call relocations.
2549
2550 2010-12-07  Ian Lance Taylor  <iant@google.com>
2551
2552         * archive.cc (Archive::get_elf_object_for_member): Permit
2553         punconfigured to be NULL.
2554         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2555         (Archive::include_member): Pass NULL to get_elf_object_for_member
2556         if we searched for the archive and this is the first included
2557         object.
2558
2559 2010-12-01  Ian Lance Taylor  <iant@google.com>
2560
2561         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2562         track_relocs_type_ field.
2563         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2564         Set track_relocs_type_.
2565         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2566         contents when using RELA relocs.
2567         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2568         reloc_map_.
2569         * reloc.cc (Track_relocs::next_addend): New function.
2570         * reloc.h (class Track_relocs): Declare next_addend.
2571
2572 2010-12-01  Ian Lance Taylor  <iant@google.com>
2573
2574         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2575         virtual destructor.
2576
2577 2010-12-01  Ian Lance Taylor  <iant@google.com>
2578
2579         * README: Update compilers known to work and fail.
2580
2581 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2582
2583         * configure.in: For --enable-gold, handle value `default' instead of
2584         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2585         not the default.
2586         * configure: Regenerate.
2587
2588 2010-11-18  Doug Kwan  <dougkwan@google.com>
2589
2590         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2591         and right_alignment to be zero.  Store result alignment only if it is
2592         greater than existing alignment.
2593
2594 2010-11-16  Cary Coutant  <ccoutant@google.com>
2595
2596         PR gold/12220
2597         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2598         Check for ".zdebug_line".
2599
2600 2010-11-16  Doug Kwan  <dougkwan@google.com>
2601             Cary Coutant  <ccoutant@google.com>
2602
2603         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2604         by reference; adjust all callers.
2605         * output.cc (Output_segment::set_section_addresses): Adjust references
2606         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2607         list is empty.
2608         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2609         end at page boundary.
2610
2611 2010-11-16  Cary Coutant  <ccoutant@google.com>
2612
2613         PR gold/12220
2614         * layout.cc (Layout::choose_output_section): Transform names of
2615         compressed sections even when using a script with a SECTIONS clause.
2616         (Layout::output_section_name): Remove code to transform
2617         compressed debug section names.
2618         * output.cc (Output_section::add_input_section): Use uncompressed
2619         section size when tracking input sections.
2620
2621 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2622
2623         * symtab.h (Symbol::NON_PIC_REF): Remove.
2624         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2625         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2626         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2627         (Symbol::use_plt_offset): Take a flags argument and pass it
2628         directly to needs_dynamic_reloc.  Restrict check for undefined
2629         weak symbols to function calls.
2630         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2631         (Target_arm::Scan::global): Use it.
2632         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2633         (Target_arm::Relocate::relocate): Likewise.
2634         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2635         parameter with an r_type parameter.  Use get_reference_flags
2636         to get the flags.
2637         (Target_arm::Relocate::relocate): Update accordingly.
2638         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2639         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2640         (Target_i386::Scan::global): Likewise.
2641         (Target_i386::Relocate::relocate): Likewise.
2642         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2643         parameter with an r_type parameter.  Use get_reference_flags
2644         to get the flags.
2645         (Target_i386::Relocate::relocate): Update accordingly.
2646         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2647         (Target_powerpc::Scan::global): Use it.
2648         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2649         (Target_powerpc::Relocate::relocate): Likewise.
2650         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2651         (Target_sparc::Scan::global): Use it.
2652         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2653         (Target_sparc::Relocate::relocate): Likewise.
2654         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2655         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2656         (Target_x86_64::Scan::global): Likewise.
2657         (Target_x86_64::Relocate::relocate): Likewise.
2658
2659 2010-11-08  Doug Kwan  <dougkwan@google.com>
2660             Cary Coutant  <ccoutant@google.com>
2661
2662         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2663         (Arm_exidx_merge_section::section_contents_): New data member.
2664         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2665         (Arm_input_section::~Arm_input_section): De-allocate memory.
2666         (Arm_input_section::original_contents_): New data member.       
2667         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2668         in parameters instead of calling Object::section_contents without
2669         locking.
2670         (Arm_output_section::group_section): New parameter TASK.  Pass it
2671         to callees that need locking objects.
2672         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2673         to lock EXIDX input sections.  Fix a formatting issue.  Call
2674         Arm_exidx_merged_section::build_contents to create merged section
2675         contents.
2676         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2677         to lock object of stub table owner.
2678         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2679         TEXT_SIZE to initialize data member TEXT_SIZE_.
2680         (Arm_exidx_input_section::addralign): Fix typo in comment.
2681         (Arm_exidx_input_section::text_size): New method.
2682         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2683         that require locking objects.  Lock objects before scanning for stubs
2684         and updating local symbols.
2685         (Arm_input_section<big_endian>::init): Copy contents of original
2686         input section.
2687         (Arm_input_section<big_endian>::do_write): Use saved contents of
2688         original input section instead of calling Object::section_contents
2689         without locking.
2690         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2691         size without calling Object::section_size().
2692         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2693         for size.  Allocate a buffer for merged EXIDX entries.
2694         (Arm_exidx_merged_section::build_contents): New method.
2695         (Arm_exidx_merged_section::do_write): Move merge section contents
2696         building code to Arm_exidx_merged_section::build_contetns.  Write
2697         out contetns in buffer instead of building it on the fly.
2698         (Arm_relobj::make_exidx_input_section): Also pass text section size
2699         to Arm_exidx_input_section constructor.
2700         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2701         (Arm_dynobj::do_read_symbols): Fix memory leak.
2702         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2703         * target.h: (class Task): Add forward declaration.
2704         (Target::relax): Add new parameter TASK and pass it to
2705         Target::do_relax().
2706         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2707
2708 2010-11-05  Cary Coutant  <ccoutant@google.com>
2709
2710         PR gold/10708
2711         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2712         object when reading from the file.
2713         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2714         second layout pass.
2715         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2716         when reading section contents.
2717         (get_section_contents): Likewise.
2718         (icf::find_identical_sections): Likewise.
2719         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2720         object when reading from the file.
2721         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2722         the object when doing deferred section layout.
2723
2724 2010-11-03  Nick Clifton  <nickc@redhat.com>
2725
2726         PR gold/12001
2727         * script.h (class Symbol_assignment: name): New member.  Returns
2728         the name of the symbol.
2729         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2730         Returns true if the given symbol name is on the list of
2731         assignments wating to be processed.
2732         * archive.cc (should_incldue_member): If the symbol is undefined,
2733         check to see if it is on the list of symbols pending assignment.
2734
2735 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2736
2737         * script-sections.cc (Script_sections::find_memory_region): Check
2738         for a NULL output section pointer.
2739
2740 2010-10-29  Doug Kwan  <dougkwan@google.com>
2741
2742         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2743         Output_section::add_relaxed_input_section.
2744         * output.cc (Output_section::add_relaxed_input_section): Add new
2745         arguments LAYOUT and NAME.  Set section order index.
2746         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2747         Copy section order index.
2748         * output.h (Output_section::add_relaxed_input_section): Add new
2749         arguments LAYOUT and NAME.
2750
2751 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2752
2753         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2754         NATIVE_OR_CROSS_LINKER.
2755         * testsuite/Makefile.in: Regenerate.
2756
2757 2010-10-20  Doug Kwan  <dougkwan@google.com>
2758
2759         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2760         without SHF_LINK_ORDER flags.
2761         * layout.cc (Layout::choose_output_section): Do not filter
2762         SHF_LINK_ORDER flag in a relocatable link.
2763
2764 2010-10-17  Cary Coutant  <ccoutant@google.com>
2765
2766         * output.h (Output_segment::set_section_addresses): Change function
2767         signature.  Update all callers.
2768         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2769         sections.
2770         (Output_segment::set_section_addresses): Align after last TLS
2771         section.  Add padding before last relro section instead of after.
2772
2773 2010-10-17  Doug Kwan  <dougkwan@google.com>
2774
2775         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2776         GOT output section to be writable.
2777
2778 2010-10-14  Cary Coutant  <ccoutant@google.com>
2779
2780         * debug.h (DEBUG_INCREMENTAL): New flag.
2781         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2782         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2783         mode.
2784         * incremental.cc (report_command_line): Ignore all forms of
2785         --incremental.
2786         * layout.cc (Layout::Layout): Check parameters for incremental link
2787         mode.
2788         * options.cc (General_options::parse_incremental): New function.
2789         (General_options::parse_no_incremental): New function.
2790         (General_options::parse_incremental_full): New function.
2791         (General_options::parse_incremental_update): New function.
2792         (General_options::incremental_mode_): New data member.
2793         (General_options::finalize): Check incremental_mode_.
2794         * options.h (General_options): Update help text for --incremental.
2795         Add --no-incremental, --incremental-full, --incremental-update.
2796         (General_options::Incremental_mode): New enum type.
2797         (General_options::incremental_mode): New function.
2798         (General_options::incremental_mode_): New data member.
2799         * parameters.cc (Parameters::incremental_mode_): New data member.
2800         (Parameters::set_options): Set incremental_mode_.
2801         (Parameters::set_incremental_full): New function.
2802         (Parameters::incremental): New function.
2803         (Parameters::incremental_update): New function.
2804         (set_parameters_incremental_full): New function.
2805         * parameters.h (Parameters::set_incremental_full): New function.
2806         (Parameters::incremental): New function.
2807         (Parameters::incremental_update): New function.
2808         (Parameters::incremental_mode_): New data member.
2809         (set_parameters_incremental_full): New function.
2810         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2811         incremental link mode.
2812         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2813         (Sized_relobj::do_relocate_sections): Likewise.
2814         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2815         option.
2816         * testsuite/Makefile.in: Regenerate.
2817         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2818
2819 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2820
2821         * script-sections.h (class Script_sections): Make
2822         Sections_elements typedef public.
2823         * script-sections.cc (class Sort_output_sections): Add elements_
2824         field.  Add constructor which sets it; change all callers.
2825         (Sort_output_sections::is_before): New function.
2826         (Sort_output_sections::operator()): Call is_before.
2827         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2828         conditional.
2829         * testsuite/script_test_10.sh: New test. Test script section
2830         order.
2831         * testsuite/script_test_10.t: Likewise.
2832         * testsuite/script_test_10.s: Likewise.
2833         * testsuite/Makefile.am: Wrap the cross linker tests and the
2834         common tests into NATIVE_OR_CROSS_LINKER.
2835         (check_SCRIPTS): Add script_test_10.sh.
2836         (check_DATA): Add script_test_10.stdout.
2837         (script_test_10.o, script_test_10): New targets.
2838         (script_test_10.stdout): New target.
2839         * configure, testsuite/Makefile.in: Regenerate.
2840
2841 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2842
2843         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2844         error for the deprecated relocations.
2845         (Target_arm::Scan::global): Likewise.
2846         (Target_arm::Relocate::relocate): Likewise.
2847
2848 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2849
2850         * fileread.cc (Input_file::find_file): Initialize *found_name
2851         and *namep when using the fallback search for case 4.
2852
2853 2010-10-11  Cary Coutant  <ccoutant@google.com>
2854
2855         * options.h (class General_options): Redefine -z lazy as an alias for
2856         the negation of -z now.
2857
2858 2010-10-11  Ian Lance Taylor  <iant@google.com>
2859
2860         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2861         binding.
2862
2863 2010-10-06  Nick Clifton  <nickc@redhat.com>
2864
2865         * script-sections.cc(class Memory_region): Remove
2866         current_lma_offset_ field.  Rename current_vma_offset_ to
2867         current_offset_.  Add last_section_ field.
2868         (Memory_region::get_current_vma_address): Rename to
2869         get_current_address.
2870         (Memory_region::get_current_lma_address): Delete.
2871         (Memory_region::increment_vma_offset): Rename to
2872         increment_offset.
2873         (Memory_region::increment_lma_offset): Delete.
2874         (Memory_region::attributes_compatible): New method.  Returns
2875         true if the provided section is compatible with the region.
2876         (Memory_region::get_last_section): New method.  Returns the last
2877         section to use the region.
2878         (Memory_region::set_last_section): New method.  Stores the last
2879         section to use the region.
2880         (Script_sections::block_in_region): New method.  Returns true if
2881         a block of memory is contained within a region.
2882         (Script_sections::find_memory_region): New method.  Locates a
2883         memory region to be used to set a VMA or LMA address.
2884         (Output_section_definition::set_section_addresses): Add code to
2885         check for addresses set by memory regions.
2886         (Output_segment::set_section_addresses): Remove memory region
2887         walking code.
2888         (Script_sections::create_segment): Add a warning if a header
2889         segment is created outside of any region.
2890         * script-sections.h (class Script_sections): Add prototypes for
2891         find_memory_region and block_in_region methods.
2892         * testsuite/memory_test.s: Use .long instead of .word.
2893         * testsuite/memory_test.t: Add some more output sections.
2894         * testsuite/memory_test.sh: Update expected output.
2895
2896 2010-10-02  Doug Kwan  <dougkwan@google.com>
2897
2898         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2899         defintion to symtab.h
2900         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2901         declaration to defintion.
2902
2903 2010-10-01  Nick Clifton  <nickc@redhat.com>
2904
2905         * expression.cc (eval): Replace dummy argument with NULL.
2906         (eval_maybe_dot): Check for a NULL result section pointer.
2907         (Symbol_expression::value): Likewise.
2908         (Dot_expression::value): Likewise.
2909         (BINARY_EXPRESSION): Likewise.
2910         (Max_expression::value): Likewise.
2911         (Min_expression::value): Likewise.
2912         (Absolute_expression::value): Likewise.
2913         (Addr_expression::value_from_output_section): Likewise.
2914         (Loaddddr_expression::value_from_output_section): Likewise.
2915         (Segment_start_expression::value): Likewise.
2916         * script-sections.cc
2917         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2918         argument with NULL.
2919         (Sections_elememt_dot_assignment::set_section_addresses):
2920         Likewise.
2921         (Output_data_expression::do_write_to_buffer): Likewise.
2922         (Output_section_definition::finalize_symbols): Likewise.
2923         (Output_section_definition::set_section_addresses): Likewise.
2924
2925 2010-09-30  Doug Kwan  <dougkwan@google.com>
2926
2927         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2928
2929 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2930
2931         * target.h (Target::can_icf_inline_merge_sections): New virtual
2932         function.
2933         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2934         virtual function.
2935         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2936         virtual function.
2937         * icf.cc (get_section_contents): Inline merge sections only when
2938         target allows it.
2939
2940 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2941
2942         * configure: Regenerate.
2943
2944 2010-09-17  Ian Lance Taylor  <iant@google.com>
2945
2946         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2947         * testsuite/Makefile.am (memory_test.o): New target.
2948         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2949         memory_test.t.
2950         * testsuite/Makefile.in: Rebuild.
2951
2952 2010-09-17  Doug Kwan  <dougkwan@google.com>
2953
2954         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2955         defintion if relocation uses GOT entries of the symbol.
2956         * testsuite/icf_safe_test.sh: Fix test.
2957         * testsuite/icf_safe_so_test.sh: Fix test.
2958
2959 2010-09-16  Cary Coutant  <ccoutant@google.com>
2960
2961         * script_sections.cc (class Memory_region): Remove "NULL" from
2962         vector initializations.
2963
2964 2010-09-15  Cary Coutant  <ccoutant@google.com>
2965
2966         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2967         Resolve forwarding symbols.
2968
2969 2010-09-15  Doug Kwan  <dougkwan@google.com>
2970
2971         * gold/testsuite/script_test_3.t: Add ARM special sections.
2972         * gold/testsuite/script_test_4.t: Same.
2973         * gold/testsuite/script_test_5.t: Same.
2974         * gold/testsuite/script_test_6.t: Same.
2975         * gold/testsuite/script_test_7.t: Same.
2976         * gold/testsuite/script_test_7.t: Same.
2977         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2978
2979 2010-09-14  Cary Coutant  <ccoutant@google.com>
2980
2981         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2982         (Target_x86_64::Relocate::relocate_tls): Replace check for
2983         saw_tls_block_reloc_ with test for executable section.
2984
2985 2010-09-12  Cary Coutant  <ccoutant@google.com>
2986
2987         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2988         position-independent executables to shared libraries need dynamic
2989         relocations.
2990         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2991         position-independent executables.
2992         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2993         * testsuite/Makefile.in: Regenerate.
2994
2995 2010-09-10  Nick Clifton  <nickc@redhat.com>
2996
2997         PR gold/11997
2998         * testsuite/memory_test.t: Discard any sections that are not
2999         needed.
3000
3001 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3002
3003         PR gold/11996
3004         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3005         "This::" to work around a bug in gcc 4.2.
3006
3007         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3008
3009 2010-09-09  Rafael Espindola  <espindola@google.com>
3010
3011         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3012         sections with different PF_X flags in the same segment.
3013         (Layout::find_first_load_seg): Search all segments to find the first
3014         one.
3015         * options.h (rosegment): New.
3016
3017 2010-09-08  Rafael Espindola  <espindola@google.com>
3018
3019         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3020
3021 2010-09-08  Doug Kwan  <dougkwan@google.com>
3022
3023         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3024         (Arm_relobj::do_relocate_sections): Add new parameter for output
3025         file to match the parent.
3026         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3027         of local symbols instead of input values.  Update code to track
3028         changes in gold::relocate_section.
3029         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3030         (Sized_relobj::compute_final_local_value_internal): New methods.
3031         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3032         body into private version of Sized_relobj::compute_final_local_value.
3033         Call the inline method.
3034         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3035         merged symbol value if there is one.
3036         (Symbol_value::has_output_value): New method defintiion.
3037         (Sized_relobj::Compute_final_local_value_status): New enum type.
3038         (Sized_relobj::compute_final_local_value): New methods.
3039         (Sized_relobj::compute_final_local_value_internal): New methods.
3040         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3041         and arm_cortex_a8.sh.
3042         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3043         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3044         New tests.
3045         * Makefile.in: Regenerate.
3046         * testsuite/arm_bl_out_of_range.s: Update test.
3047         * testsuite/thumb_bl_out_of_range.s: Ditto.
3048         * testsuite/thumb_blx_out_of_range.s: Ditto.
3049         * testsuite/arm_branch_out_of_range.sh: New file.
3050         * testsuite/arm_cortex_a8.sh: Ditto.
3051         * testsuite/arm_cortex_a8_b.s: Ditto.
3052         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3053         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3054         * testsuite/arm_cortex_a8_bl.s: Ditto.
3055         * testsuite/arm_cortex_a8_blx.s: Ditto.
3056         * testsuite/arm_cortex_a8_local.s: Ditto.
3057         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3058         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3059
3060 2010-09-08  Rafael Espindola  <espindola@google.com>
3061
3062         * Makefile.am (memory_test.stdout): Run readelf with -W.
3063         * Makefile.in: Regenerate.
3064         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3065         64 bit output.
3066
3067 2010-09-08  Rafael Espindola  <espindola@google.com>
3068
3069         * script-sections.cc (Script_sections::add_memory_region): Convert
3070         field precision to int.
3071         * script.cc (script_set_section_region, script_set_section_region):
3072         Convert field precision to int.
3073
3074 2010-09-08  Rafael Espindola  <espindola@google.com>
3075
3076         * arm.cc (do_finalize_sections): Create the __exidx_start and
3077         __exdix_end symbols even when the section is missing.
3078
3079 2010-09-08  Nick Clifton  <nickc@redhat.com>
3080
3081         * README: Remove claim that MEMORY is not supported.
3082         * expression.cc (script_exp_function_origin)
3083         (script_exp_function_length): Move from here to ...
3084         * script.cc: ... here.
3085         (script_set_section_region, script_add_memory)
3086         (script_parse_memory_attr, script_include_directive): New
3087         functions.
3088         * script-sections.cc
3089         (class Memory_region): New class.
3090         (class Output_section_definition): Add set_memory_region,
3091         set_section_vma, set_section_lma and get_section_name methods.
3092         (class Script_Sections): Add add_memory_region,
3093         find_memory_region, find_memory_region_origin,
3094         find_memory_region_length and set_memory_region methods.
3095         Have set_section_addresses method walk the list of set memory
3096         regions.
3097         Extend the print methos to display memory regions.
3098         * script-sections.h: Add prototypes for new methods.
3099         Add enum for MEMORY region attributes.
3100         * yyscript.y: Add support for parsing MEMORY regions.
3101         * script-c.h: Add prototypes for new functions.
3102         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3103         * testsuite/Makefile.in: Regenerate.
3104         * testsuite/memory_test.sh: New script.
3105         * testsuite/memory_test.s: New assembler source file.
3106         * testsuite/memory_test.t: New linker script.
3107
3108 2010-08-27  Doug Kwan  <dougkwan@google.com>
3109
3110         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3111         reference override an existing dynamic weak reference.
3112         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3113         * testsuite/Makefile.in: Regenerate.
3114         * testsuite/dyn_weak_ref.sh: New file.
3115         * testsuite/dyn_weak_ref_1.c: Ditto.
3116         * testsuite/dyn_weak_ref_2.c: Ditto.
3117
3118 2010-08-27  Ian Lance Taylor  <iant@google.com>
3119
3120         * incremental.h (class Incremental_input_entry): Add virtual
3121         destructor.
3122
3123 2010-08-27  Ian Lance Taylor  <iant@google.com>
3124
3125         * testsuite/start_lib_test_3.c: Mark t3 as used.
3126
3127 2010-08-27  Nick Clifton  <nickc@redhat.com>
3128
3129         * options.cc (version_script): Fix small typo in previous
3130         whitespace tidyup.
3131
3132 2010-08-25  Nick Clifton  <nickc@redhat.com>
3133
3134         * archive.cc: Formatting fixes: Remove whitespace between
3135         typename and following asterisk.  Remove whitespace between
3136         function name and opening parenthesis.
3137         * archive.h: Likewise.
3138         * arm.cc: Likewise.
3139         * attributes.cc: Likewise.
3140         * attributes.h: Likewise.
3141         * common.cc: Likewise.
3142         * copy-relocs.cc: Likewise.
3143         * dirsearch.h: Likewise.
3144         * dynobj.cc: Likewise.
3145         * ehframe.cc: Likewise.
3146         * ehframe.h: Likewise.
3147         * expression.cc: Likewise.
3148         * fileread.cc: Likewise.
3149         * fileread.h: Likewise.
3150         * gc.h: Likewise.
3151         * gold-threads.cc: Likewise.
3152         * gold.cc: Likewise.
3153         * i386.cc: Likewise.
3154         * icf.h: Likewise.
3155         * incremental-dump.cc: Likewise.
3156         * incremental.cc: Likewise.
3157         * layout.cc: Likewise.
3158         * layout.h: Likewise.
3159         * main.cc: Likewise.
3160         * merge.cc: Likewise.
3161         * merge.h: Likewise.
3162         * object.cc: Likewise.
3163         * object.h: Likewise.
3164         * options.cc: Likewise.
3165         * options.h: Likewise.
3166         * output.cc: Likewise.
3167         * output.h: Likewise.
3168         * plugin.cc: Likewise.
3169         * plugin.h: Likewise.
3170         * powerpc.cc: Likewise.
3171         * reloc.cc: Likewise.
3172         * script-c.h: Likewise.
3173         * script-sections.cc: Likewise.
3174         * script.cc: Likewise.
3175         * stringpool.cc: Likewise.
3176         * symtab.cc: Likewise.
3177         * symtab.h: Likewise.
3178         * target.cc: Likewise.
3179         * timer.cc: Likewise.
3180         * timer.h: Likewise.
3181         * version.cc: Likewise.
3182         * x86_64.cc: Likewise.
3183
3184 2010-08-24  Nick Clifton  <nickc@redhat.com>
3185
3186         PR 11899
3187         * layout.cc (segment_precedes): Sort segments by their physical
3188         addresses, if they have been set.
3189
3190 2010-08-23  Cary Coutant  <ccoutant@google.com>
3191
3192         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3193         symbols data.
3194         (Lib_group::include_member): Unlock object after deleting its
3195         symbols data.
3196         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3197         the bug fixed here.
3198
3199 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3200             Cary Coutant  <ccoutant@google.com>
3201
3202         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3203         constructor, and set_blocker.
3204         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3205         readsyms_blocker_.
3206         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3207         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3208         * testsuite/Makefile.am (start_lib_test): New test case.
3209         * testsuite/Makefile.in: Regenerate.
3210         * testsuite/start_lib_test_main.c: New file.
3211         * testsuite/start_lib_test_1.c: New file.
3212         * testsuite/start_lib_test_2.c: New file.
3213         * testsuite/start_lib_test_3.c: New file.
3214
3215 2010-08-19  Ian Lance Taylor  <iant@google.com>
3216
3217         * Makefile.in: Rebuild with automake 1.11.1.
3218         * aclocal.m4: Likewise.
3219         * testsuite/Makefile.in: Likewise.
3220
3221 2010-08-19  Ian Lance Taylor  <iant@google.com>
3222
3223         PR 10893
3224         * i386.cc (class Output_data_plt_i386): Update declarations.
3225         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3226         local_ifuncs_ fields.
3227         (Target_i386::do_plt_section_for_global): New function.
3228         (Target_i386::do_plt_section_for_local): New function.
3229         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3230         parameter; change all callers.  Initialize global_ifuncs_ and
3231         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3232         __rel_iplt_end.
3233         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3234         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3235         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3236         symbols.
3237         (Target_i386::make_plt_section): New function, broken out of
3238         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3239         (Target_i386::make_plt_entry): Call make_plt_section.
3240         (Target_i386::make_local_ifunc_plt_entry): New function.
3241         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3242         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3243         R_386_IRELATIVE to switch.
3244         (Target_i386::Scan::global): Likewise.
3245         (Target_i386::Relocate::relocate): Likewise.
3246         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3247         switch.
3248         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3249         (Target_x86_64::do_plt_section_for_global): New function.
3250         (Target_x86_64::do_plt_section_for_local): New function.
3251         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3252         parameter; change all callers.  If doing a static link define
3253         __rela_iplt_start and __rela_iplt_end.
3254         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3255         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3256         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3257         to point to .plt.
3258         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3259         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3260         switch.
3261         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3262         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3263         R_X86_64_IRELATIVE to switch.
3264         (Target_x86_64::Scan::global): Likewise.
3265         (Target_x86_64::Relocate::relocate): Likewise.
3266         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3267         switch.
3268         * target.h (class Target): Add plt_section_for_global and
3269         plt_section_for_local functions.  Add do_plt_section_for_global
3270         and do_plt_section_for_local virtual functions.
3271         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3272         clarifying comments.
3273         (Symbol::use_plt_offset): Handle IFUNC symbol.
3274         * object.cc (Sized_relobj::Sized_relobj): Initialize
3275         local_plt_offsets_.
3276         (Sized_relobj::local_has_plt_offset): New function.
3277         (Sized_relobj::local_plt_offset): New function.
3278         (Sized_relobj::set_local_plt_offset): New function.
3279         (Sized_relobj::do_count): Handle IFUNC symbol.
3280         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3281         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3282         is_ifunc_symbol functions.
3283         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3284         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3285         local_plt_offsets_ field.
3286         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3287         * output.h (class Output_section_data): Add non-const
3288         output_section function.
3289         (class Output_data_got): Update declarations.
3290         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3291         Add use_plt_offset parameter to global and local constructors.
3292         Change all callers.  Change local_sym_index_ field to 31 bits.
3293         Change GSYM_CODE and CONSTANT_CODE accordingly.
3294         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3295         doing a static link don't set sh_link field.
3296         (Output_data_got::Got_entry::write): Use PLT offset if
3297         appropriate.
3298         (Output_data_got::add_global_plt): New function.
3299         (Output_data_got::add_local_plt): New function.
3300         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3301         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3302         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3303         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3304         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3305         IFUNC conditional.
3306         * testsuite/ifunc-sel.h: New file.
3307         * testsuite/ifuncmain1.c: New file.
3308         * testsuite/ifuncmain1vis.c: New file.
3309         * testsuite/ifuncmod1.c: New file.
3310         * testsuite/ifuncdep2.c: New file.
3311         * testsuite/ifuncmain2.c: New file.
3312         * testsuite/ifuncmain3.c: New file.
3313         * testsuite/ifuncmod3.c: New file.
3314         * testsuite/ifuncmain4.c: New file.
3315         * testsuite/ifuncmain5.c: New file.
3316         * testsuite/ifuncmod5.c: New file.
3317         * testsuite/ifuncmain6pie.c: New file.
3318         * testsuite/ifuncmod6.c: New file.
3319         * testsuite/ifuncmain7.c: New file.
3320         * configure, testsuite/Makefile.in: Rebuild.
3321
3322 2010-08-18  Ian Lance Taylor  <iant@google.com>
3323
3324         * incremental.cc
3325         (Output_section_incremental_inputs::write_input_files): Add cast
3326         to avoid signed/unsigned comparison warning.
3327         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3328
3329 2010-08-12  Cary Coutant  <ccoutant@google.com>
3330
3331         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3332
3333 2010-08-13  Ian Lance Taylor  <iant@google.com>
3334
3335         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3336
3337 2010-08-12  Cary Coutant  <ccoutant@google.com>
3338             Doug Kwan  <dougkwan@google.com>
3339
3340         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3341         defintion overrides non-weak undef, remember that the original undef
3342         is not weak.
3343         * symtab.cc (Symbol_table::sized_write_global): For undef without
3344         an original weak binding, set binding to global in output.
3345         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3346         * testsuite/Makefile.in: Regenerate.
3347         * testsuite/strong_ref_weak_def.sh: New file.
3348         * testsuite/strong_ref_weak_def_1.c: Ditto.
3349         * testsuite/strong_ref_weak_def_2.c: Ditto.
3350
3351 2010-08-12  Cary Coutant  <ccoutant@google.com>
3352
3353         * testsuite/incremental_test.sh: Rewrite.
3354         * testsuite/incremental_test_1.c: Rewrite.
3355         * testsuite/incremental_test_2.c: Rewrite.
3356
3357 2010-08-12  Cary Coutant  <ccoutant@google.com>
3358
3359         * arm.cc (Target_arm::got_size): Add const.
3360         (Target_arm::got_entry_count): New function.
3361         (Target_arm::plt_entry_count): New function.
3362         (Target_arm::first_plt_entry_offset): New function.
3363         (Target_arm::plt_entry_size): New function.
3364         (Output_data_plt_arm::entry_count): New function.
3365         (Output_data_plt_arm::first_plt_entry_offset): New function.
3366         (Output_data_plt_arm::get_plt_entry_size): New function.
3367         * i386.cc (Target_i386::got_size): Add const.
3368         (Target_i386::got_entry_count): New function.
3369         (Target_i386::plt_entry_count): New function.
3370         (Target_i386::first_plt_entry_offset): New function.
3371         (Target_i386::plt_entry_size): New function.
3372         (Output_data_plt_i386::entry_count): New function.
3373         (Output_data_plt_i386::first_plt_entry_offset): New function.
3374         (Output_data_plt_i386::get_plt_entry_size): New function.
3375         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3376         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3377         * incremental.cc: Include target.h.
3378         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3379         parameter.  Adjust all callers.  Find incremental_got_plt section.
3380         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3381         section.
3382         (Output_section_incremental_inputs::set_final_data_size): Calculate
3383         size of incremental_got_plt section.
3384         (Output_section_incremental_inputs::do_write): Write the
3385         incremental_got_plt section.
3386         (Got_plt_view_info): New struct.
3387         (Local_got_offset_visitor): New class.
3388         (Global_got_offset_visitor): New class.
3389         (Global_symbol_visitor_got_plt): New class.
3390         (Output_section_incremental_inputs::write_got_plt): New function.
3391         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3392         Add parameter.  Adjust all callers.
3393         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3394         (Incremental_inputs::got_plt_section): New function.
3395         (Incremental_inputs::got_plt_section_): New data member.
3396         (Incremental_got_plt_reader): New class.
3397         * layout.cc (Layout::create_incremental_info_sections): Add the
3398         incremental_got_plt section.
3399         * object.h (Got_offset_list::get_list): New function.
3400         (Got offset_list::for_all_got_offsets): New function.
3401         (Sized_relobj::local_got_offset_list): New function.
3402         * powerpc.cc (Target_powerpc::got_size): Add const.
3403         (Target_powerpc::got_entry_count): New function.
3404         (Target_powerpc::plt_entry_count): New function.
3405         (Target_powerpc::first_plt_entry_offset): New function.
3406         (Target_powerpc::plt_entry_size): New function.
3407         (Output_data_plt_powerpc::entry_count): New function.
3408         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3409         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3410         * sparc.cc (Target_sparc::got_size): Add const.
3411         (Target_sparc::got_entry_count): New function.
3412         (Target_sparc::plt_entry_count): New function.
3413         (Target_sparc::first_plt_entry_offset): New function.
3414         (Target_sparc::plt_entry_size): New function.
3415         (Output_data_plt_sparc::entry_count): New function.
3416         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3417         (Output_data_plt_sparc::get_plt_entry_size): New function.
3418         * symtab.h (Symbol::got_offset_list): New function.
3419         (Symbol_table::for_all_symbols): New function.
3420         * target.h (Sized_target::got_entry_count): New function.
3421         (Sized_target::plt_entry_count): New function.
3422         (Sized_target::plt_entry_size): New function.
3423         * x86_64.cc (Target_x86_64::got_size): Add const.
3424         (Target_x86_64::got_entry_count): New function.
3425         (Target_x86_64::plt_entry_count): New function.
3426         (Target_x86_64::first_plt_entry_offset): New function.
3427         (Target_x86_64::plt_entry_size): New function.
3428         (Output_data_plt_x86_64::entry_count): New function.
3429         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3430         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3431
3432 2010-08-12  Cary Coutant  <ccoutant@google.com>
3433
3434         * archive.cc: Include incremental.h.
3435         (Archive::Archive): Initialize incremental_info_.
3436         (Archive::include_member): Record archive members in incremental info.
3437         (Add_archive_symbols::run): Record begin and end of an archive in
3438         incremental info.
3439         (Lib_group::include_member): Record objects in incremental info.
3440         * archive.h (Incremental_archive_entry): Forward declaration.
3441         (Archive::set_incremental_info): New member function.
3442         (Archive::incremental_info): New member function.
3443         (Archive::Unused_symbol_iterator): New class.
3444         (Archive::unused_symbols_begin): New member function.
3445         (Archive::unused_symbols_end): New member function.
3446         (Archive::incremental_info_): New data member.
3447         * incremental-dump.cc (find_input_containing_global): New function.
3448         (dump_incremental_inputs): Dump new incremental info sections.
3449         * incremental.cc: Include symtab.h.
3450         (Output_section_incremental_inputs): New class.
3451         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3452         new incremental info sections.
3453         (Sized_incremental_binary::do_check_inputs): Likewise.
3454         (Incremental_inputs::report_archive): Remove.
3455         (Incremental_inputs::report_archive_begin): New function.
3456         (Incremental_inputs::report_archive_end): New function.
3457         (Incremental_inputs::report_object): New function.
3458         (Incremental_inputs::finalize_inputs): Remove.
3459         (Incremental_inputs::report_input_section): New function.
3460         (Incremental_inputs::report_script): Rewrite.
3461         (Incremental_inputs::finalize): Do nothing but finalize string table.
3462         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3463         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3464         (Incremental_inputs::create_data_sections): New function.
3465         (Incremental_inputs::relocs_entsize): New function.
3466         (Output_section_incremental_inputs::set_final_data_size): New function.
3467         (Output_section_incremental_inputs::do_write): New function.
3468         (Output_section_incremental_inputs::write_header): New function.
3469         (Output_section_incremental_inputs::write_input_files): New function.
3470         (Output_section_incremental_inputs::write_info_blocks): New function.
3471         (Output_section_incremental_inputs::write_symtab): New function.
3472         * incremental.h (Incremental_script_entry): Forward declaration.
3473         (Incremental_object_entry): Forward declaration.
3474         (Incremental_archive_entry): Forward declaration.
3475         (Incremental_inputs): Forward declaration.
3476         (Incremental_inputs_header_data): Remove.
3477         (Incremental_inputs_header): Remove.
3478         (Incremental_inputs_header_write): Remove.
3479         (Incremental_inputs_entry_data): Remove.
3480         (Incremental_inputs_entry): Remove.
3481         (Incremental_inputs_entry_write): Remove.
3482         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3483         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3484         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3485         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3486         Likewise.
3487         (Incremental_input_entry): New class.
3488         (Incremental_script_entry): New class.
3489         (Incremental_object_entry): New class.
3490         (Incremental_archive_entry): New class.
3491         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3492         (Incremental_inputs::report_inputs): Remove.
3493         (Incremental_inputs::report_archive): Remove.
3494         (Incremental_inputs::report_archive_begin): New function.
3495         (Incremental_inputs::report_archive_end): New function.
3496         (Incremental_inputs::report_object): Change prototype.
3497         (Incremental_inputs::report_input_section): New function.
3498         (Incremental_inputs::report_script): Change prototype.
3499         (Incremental_inputs::get_reloc_count): New function.
3500         (Incremental_inputs::set_reloc_count): New function.
3501         (Incremental_inputs::create_data_sections): New function.
3502         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3503         (Incremental_inputs::inputs_section): New function.
3504         (Incremental_inputs::symtab_section): New function.
3505         (Incremental_inputs::relocs_section): New function.
3506         (Incremental_inputs::get_stringpool): Add const.
3507         (Incremental_inputs::command_line): Add const.
3508         (Incremental_inputs::inputs): Remove.
3509         (Incremental_inputs::command_line_key): New function.
3510         (Incremental_inputs::input_file_count): New function.
3511         (Incremental_inputs::input_files): New function.
3512         (Incremental_inputs::relocs_entsize): New function.
3513         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3514         (Incremental_inputs::finalize_inputs): Remove.
3515         (Incremental_inputs::Input_info): Remove.
3516         (Incremental_inputs::lock_): Remove.
3517         (Incremental_inputs::inputs_): Change type.
3518         (Incremental_inputs::inputs_map_): Remove.
3519         (Incremental_inputs::current_object_entry_): New data member.
3520         (Incremental_inputs::inputs_section_): New data member.
3521         (Incremental_inputs::symtab_section_): New data member.
3522         (Incremental_inputs::relocs_section_): New data member.
3523         (Incremental_inputs::reloc_count_): New data member.
3524         (Incremental_inputs_reader): New class.
3525         (Incremental_symtab_reader): New class.
3526         (Incremental_relocs_reader): New class.
3527         * layout.cc (Layout::finalize): Move finalization of incremental info
3528         and creation of incremental info sections to follow finalization of
3529         symbol table.  Set offsets for postprocessing sections.
3530         (Layout::create_incremental_info_sections): Call
3531         Incremental_inputs::create_data_sections.  Add incremental symtab
3532         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3533         sections to layout after input sections.
3534         * layout.h (struct Timespec): Forward declaration.
3535         (Layout::incremental_inputs): Add const.
3536         (Layout::create_incremental_info_sections): Add parameter.
3537         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3538         * object.cc: Include incremental.h.
3539         (Relobj::finalize_incremental_relocs): New function.
3540         (Sized_relobj::do_layout): Record input sections in incremental info.
3541         * object.h (Object::output_section): New function.
3542         (Object::output_section_offset): Moved from Relobj.
3543         (Object::get_incremental_reloc_base): New function.
3544         (Object::get_incremental_reloc_count): New function.
3545         (Object::do_output_section): New function.
3546         (Object::do_output_section_offset): Moved from Relobj.
3547         (Object::do_get_incremental_reloc_base): New function.
3548         (Object::do_get_incremental_reloc_count): New function.
3549         (Object::Object): Initialize new data members.
3550         (Relobj::output_section): Renamed do_output_section and moved to
3551         protected.
3552         (Relobj::output_section_offset): Moved to Object.
3553         (Relobj::do_get_incremental_reloc_base): New function.
3554         (Relobj::do_get_incremental_reloc_count): New function.
3555         (Relobj::allocate_incremental_reloc_counts): New function.
3556         (Relobj::count_incremental_reloc): New function.
3557         (Relobj::finalize_incremental_relocs): New function.
3558         (Relobj::next_incremental_reloc_index): New function.
3559         (Relobj::reloc_counts_): New data member.
3560         (Relobj::reloc_bases_): New data member.
3561         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3562         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3563         (Sized_relobj::incremental_relocs_scan): New function.
3564         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3565         (Sized_relobj::incremental_relocs_write): New function.
3566         (Sized_relobj::incremental_relocs_write_reltype): New function.
3567         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3568         incremental link.
3569         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3570         archives and object files elsewhere.
3571         (Add_symbols::run): Report object files here.
3572         (Finish_group::run): Report end of archive at end of group.
3573         * reloc.cc: Include layout.h, incremental.h.
3574         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3575         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3576         (Sized_relobj::incremental_relocs_scan): New function.
3577         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3578         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3579         (Sized_relobj::incremental_relocs_write): New function.
3580         (Sized_relobj::incremental_relocs_write_reltype): New function.
3581         * script.cc (read_input_script): Rewrite test for incremental link.
3582         Change call to Incremental_inputs::report_script.
3583         * symtab.h (Symbol_table::first_global_index): New function.
3584         (Symbol_table::output_count): New function.
3585
3586 2010-08-12  Doug Kwan  <dougkwan@google.com>
3587
3588         * arm.cc (Target_arm::merge_object_attributes): Check command line
3589         options --no-wchar-size-warning and --no-enum-size-warning.
3590         * options.h (General_options): Add ld-compatible options
3591         --no-enum-size-warning and --no-wchar-size-warning.
3592
3593 2010-08-04  Ian Lance Taylor  <iant@google.com>
3594
3595         * x86_64.cc (Target_x86_64::Scan::local): Use
3596         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3597         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3598         (Target_x86_64::Scan::global): Likewise.
3599         (Target_x86_64::Relocate::relocate): Likewise.
3600         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3601         Likewise.
3602
3603 2010-08-03  Cary Coutant  <ccoutant@google.com>
3604
3605         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3606         to reserve space in merged_strings vector. Keep total input size
3607         for stats.
3608         (Output_merge_string::do_print_merge_stats): Print total input size.
3609         * merge.h (Output_merge_string): Add input_size_ field.
3610         * stringpool.cc (Stringpool_template::string_length): Move
3611         implementations out of Stringpool_template class and place in
3612         stringpool.h.
3613         * stringpool.h (string_length): Move out of Stringpool_template.
3614
3615 2010-08-03  Ian Lance Taylor  <iant@google.com>
3616
3617         PR 11712
3618         * layout.cc (relaxation_loop_body): If address of load segment is
3619         set, adjust address to include headers if possible.
3620
3621 2010-08-03  Ian Lance Taylor  <iant@google.com>
3622
3623         * version.cc (version_string): Bump to 1.10.
3624
3625 2010-08-03  Ian Lance Taylor  <iant@google.com>
3626
3627         PR 11805
3628         * layout.h (enum Output_section_order): Define.
3629         (class Layout): Update declarations.
3630         * layout.cc (Layout::get_output_section): Add order parameter.
3631         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3632         is_first_non_relro parameters.  Change all callers.
3633         (Layout::choose_output_section): Likewise.
3634         (Layout::add_output_section_data): Likewise.
3635         (Layout::make_output_section): Likewise.  Set order.
3636         (Layout::default_section_order): New function.
3637         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3638         * output.cc (Output_section::Output_section): Initialize order_.
3639         Don't initialize deleted fields.
3640         (Output_segment::Output_segment): Don't initialize deleted
3641         fields.
3642         (Output_segment::add_output_section_to_load): New function
3643         replacing add_output_section.  Change all callers to call this or
3644         add_output_section_to_nonload.
3645         (Output_segment::add_output_section_to_nonload): New function.
3646         (Output_segment::remove_output_section): Rewrite.
3647         (Output_segment::add_initial_output_data): Likewise.
3648         (Output_segment::has_any_data_sections): Likewise.
3649         (Output_segment::is_first_section_relro): Likewise.
3650         (Output_segment::maximum_alignment): Likewise.
3651         (Output_segment::has_dynamic_reloc): New function replacing
3652         dynamic_reloc_count.  Change all callers.
3653         (Output_segment::has_dynamic_reloc_list): New function replacing
3654         dynamic_reloc_count_list.  Change all callers.
3655         (Output_segment::set_section_addresses): Rewrite.
3656         (Output_segment::set_offset): Rewrite.
3657         (Output_segment::find_first_and_last_list): Remove.
3658         (Output_segment::set_tls_offsets): Rewrite.
3659         (Output_segment::first_section_load_address): Likewise.
3660         (Output_segment::output_section_count): Likewise.
3661         (Output_segment::section_with_lowest_load_address): Likewise.
3662         (Output_segment::write_section_headers): Likewise.
3663         (Output_segment::print_sections_to_map): Likewise.
3664         * output.h (class Output_data): Remove dynamic_reloc_count_
3665         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3666         (Output_data::add_dynamic_reloc): Rewrite.
3667         (Output_data::has_dynamic_reloc): New function.
3668         (Output_data::dynamic_reloc_count): Remove.
3669         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3670         is_last_relro_, is_first_non_relro_, is_interp_,
3671         is_dynamic_linker_section_ fields.  Add order and set_order
3672         functions.  Remove is_relro_local, set_is_relro_local,
3673         is_last_relro, set_is_last_relro, is_first_non_relro,
3674         set_is_first_non_relro functions, is_interp, set_is_interp,
3675         is_dynamic_linker_section, and set_is_dynamic_linker_section
3676         functions.
3677         (class Output_segment): Change Output_data_list from std::list to
3678         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3679         output_bss_ fields.  Update declarations.
3680
3681 2010-08-02  Ian Lance Taylor  <iant@google.com>
3682
3683         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3684         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3685         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3686
3687 2010-08-02  Ian Lance Taylor  <iant@google.com>
3688
3689         PR 11855
3690         * script.cc (Script_options::Script_options): Initialize
3691         symbol_definitions_ and symbol_references_.
3692         (Script_options::add_symbol_assignment): Update
3693         symbol_definitions_ and symbol_references_.
3694         (Script_options::add_symbol_reference): New function.
3695         (script_symbol): New function.
3696         * script.h (class Script_options): Add symbol_definitions_ and
3697         symbol_references_ fields.
3698         (Script_options::referenced_const_iterator): New type.
3699         (Script_options::referenced_begin): New function.
3700         (Script_options::referenced_end): New function.
3701         (Script_options::is_referenced): New function.
3702         (Script_options::any_unreferenced): New function.
3703         * script-c.h (script_symbol): Declare.
3704         * yyscript.y (exp): Call script_symbol.
3705         * symtab.cc: Include "script.h".
3706         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3707         Change all callers.  Check symbols referenced by scripts.
3708         (Symbol_table::add_undefined_symbols_from_command_line): Add
3709         layout parameter.  Change all callers.
3710         (Symbol_table::do_add_undefined_symbols_from_command_line):
3711         Likewise.  Break out loop body.  Check symbols referenced by
3712         scripts.
3713         (Symbol_table::add_undefined_symbol_from_command_line): New
3714         function broken out of
3715         do_add_undefined_symbols_from_command_line.
3716         * symtab.h (class Symbol_table): Update declarations.
3717         * archive.cc: Include "layout.h".
3718         (Archive::should_include_member): Add layout parameter.  Change
3719         all callers.  Check for symbol mentioned in expression.
3720         * archive.h (class Archive): Update declaration.
3721         * object.cc (Sized_relobj::do_should_include_member): Add layout
3722         parameter.
3723         * object.h (Object::should_include_member): Add layout parameter.
3724         Change all callers.
3725         (Object::do_should_include_member): Add layout parameter.
3726         (class Sized_relobj): Update declaration.
3727         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3728         parameter.
3729         * dynobj.h (class Sized_dynobj): Update declaration.
3730         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3731         layout parameter.
3732         * plugin.h (class Sized_pluginobj): Update declaration.
3733
3734 2010-08-02  Ian Lance Taylor  <iant@google.com>
3735
3736         PR 11866
3737         * output.cc (Output_segment::set_offset): Search for the first and
3738         last sections rather than assuming that the list is in order.
3739         (Output_segment::find_first_and_last_list): New function.
3740         * output.h (class Output_segment): Update declarations.
3741         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3742         (relro_strip_test_SOURCES): New variable.
3743         (relro_strip_test_DEPENDENCIES): New variable.
3744         (relro_strip_test_LDFLAGS): New variable.
3745         (relro_strip_test_LDADD): New variable.
3746         (relro_strip_test.so): New target.
3747
3748 2010-08-02  Ian Lance Taylor  <iant@google.com>
3749
3750         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3751         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3752         (Target_i386::got_tlsdesc_section): New function.
3753         (Target_i386::got_section): Create space for GOT entries for
3754         TLSDESC relocations.
3755         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3756         R_386_TLS_GOTDESC.
3757         (Target_i386::Scan::global): Likewise.
3758         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3759         using TLSDESC GOT.
3760         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3761         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3762         (Target_x86_64::got_tlsdesc_section): New function.
3763         (Target_x86_64::got_section): Create space for GOT entries for
3764         TLSDESC relocations.
3765         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3766         R_386_TLS_GOTDESC.
3767         (Target_x86_64::Scan::global): Likewise.
3768         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3769         using TLSDESC GOT.
3770
3771 2010-08-02  Ian Lance Taylor  <iant@google.com>
3772
3773         * testsuite/final_layout.sh: Use dc to convert from hex to
3774         decimal.
3775
3776 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3777
3778         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3779         paramter to the call to gold::gc_process_relocs.
3780         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3781         paramter to the call to gold::gc_process_relocs.
3782         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3783         parameter to the call to gold::gc_process_relocs.
3784         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3785         template parameter to the call to gold::gc_process_relocs.
3786         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3787         paramter to the call to gold::gc_process_relocs.
3788         * gc.h (get_embedded_addend_size): New function.
3789         (gc_process_relocs): Save the size of the reloc for use by ICF.
3790         * icf.cc (get_section_contents): Get the addend from the text section
3791         for SHT_REL relocation sections.
3792         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3793         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3794         * int_encoding.h (read_from_pointer): New overloaded function.
3795         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3796         * testsuite/icf_sht_rel_addend_test.sh: New file.
3797         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3798         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3799
3800 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3801
3802         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3803         * Makefile.in: Regenerate.
3804         * testsuite/Makefile.in: Regenerate.
3805
3806 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3807
3808         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3809         * gold/testsuite/debug_msg.cc: Likewise.
3810         * gold/testsuite/odr_violation1.cc
3811         * gold/testsuite/odr_violation2.cc
3812
3813 2010-07-21  Cary Coutant  <ccoutant@google.com>
3814
3815         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3816         string, and length fields.
3817         (Output_merge_string::Merged_strings_list): New type.
3818         (Output_merge_string::Merged_strings_lists): New typedef.
3819         (Output_merge_string): Replace merged_strings_ with
3820         merged_strings_lists_.
3821         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3822         Merged_strings_list per input object and section.  Don't store pointer
3823         to the string.  Don't store length with each merged string entry.
3824         (Output_merge_string::finalize_merged_data): Loop over list of merged
3825         strings lists.  Recompute length of each merged string.
3826
3827 2010-07-15  Cary Coutant  <ccoutant@google.com>
3828
3829         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3830         here.
3831
3832 2010-07-14  Ian Lance Taylor  <iant@google.com>
3833
3834         * descriptors.cc (Descriptors::open): Report correct name in error
3835         message.
3836
3837 2010-07-13  Doug Kwan  <dougkwan@google.com>
3838
3839         * arm.cc (Arm_input_section::Arm_input_section): For a
3840         SHT_ARM_EXIDX section, always keeps the input sections.
3841         (Arm_input_section::set_exidx_section_link): New method.
3842         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3843         has_errors_ to false.
3844         (Arm_exidx_input_section::has_errors,
3845         Arm_exidx_input_section::set_has_errors): New methods.
3846         (Arm_exidx_input_section::has_errors_): New data member.
3847         (Arm_relobj::get_exidx_shndx_list): New method.
3848         (Arm_output_section::append_text_sections_to_list): Do not skip
3849         section without SHF_EXECINSTR.
3850         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3851         errors.
3852         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3853         section header.  Make error messages more verbose.  Check for
3854         a non-executable section linked to an EXIDX section.
3855         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3856         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3857         check that there is no deferred EXIDX section if we exit early.
3858         Instead of not making an EXIDX section in case of an error, make one
3859         and set the has_errors flag of it.
3860         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3861         in a relocatable link.
3862         (Target_arm::do_relax): Look for the EXIDX output section instead of
3863         assuming that it is called .ARM.exidx.
3864         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3865         section list.  Do not check for SHF_EXECINSTR section flags but
3866         skip any input section with errors.
3867         * output.cc (Output_section::Output_section): Initialize
3868         always_keeps_input_sections_ to false.
3869         (Output_section::add_input_section): Check for
3870         always_keeps_input_sections_.
3871         *  output.h (Output_section::always_keeps_input_sections,
3872         Output_section::set_always_keeps_input_sections): New methods.
3873         (Output_section::always_keeps_input_sections): New data member.
3874
3875 2010-07-13  Rafael Espindola  <espindola@google.com>
3876
3877         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3878         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3879
3880 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3881             Ian Lance Taylor  <iant@google.com>
3882
3883         * output.h (Output_section_lookup_maps::add_merge_section):
3884         Correct check of whether value was inserted.
3885         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3886         (Output_section_lookup_maps::add_relaxed_input_section):
3887         Likewise.
3888         * arm.cc (Target_arm::got_section): Remove used local os.
3889         * i386.cc (Target_i386::got_section): Likewise.
3890         * x86_64.cc (Target_x86_64::got_section): Likewise.
3891         * sparc.cc (Target_sparc::got_section): Likewise.
3892         (Target_sparc::relocate): Remove unused local have_got_offset.
3893         * powerpc.cc (Target_powerpc::relocate): Likewise.
3894
3895 2010-07-13  Ian Lance Taylor  <iant@google.com>
3896
3897         * compressed_output.cc (zlib_decompress): Fix signature in
3898         !HAVE_ZLIB_H case.
3899
3900         * archive.cc (Archive::include_member): Unlock an external member
3901         of a thin archive.  Don't bother to delete an object we know is
3902         NULL.
3903
3904 2010-07-12  Cary Coutant  <ccoutant@google.com>
3905
3906         * compressed_output.cc (zlib_decompress): New function.
3907         (get_uncompressed_size): New function.
3908         (decompress_input_section): New function.
3909         * compressed_output.h (get_uncompressed_size): New function.
3910         (decompress_input_section): New function.
3911         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3912         Handle compressed debug sections.
3913         * layout.cc (is_compressed_debug_section): New function.
3914         (Layout::output_section_name): Map compressed section names to
3915         canonical names.
3916         * layout.h (is_compressed_debug_section): New function.
3917         (is_debug_info_section): Recognize compressed debug sections.
3918         * merge.cc: Include compressed_output.h.
3919         (Output_merge_data::do_add_input_section): Handle compressed
3920         debug sections.
3921         (Output_merge_string::do_add_input_section): Handle compressed
3922         debug sections.
3923         * object.cc: Include compressed_output.h.
3924         (Sized_relobj::Sized_relobj): Initialize new data members.
3925         (build_compressed_section_map): New function.
3926         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3927         * object.h (Object::section_is_compressed): New method.
3928         (Object::do_section_is_compressed): New method.
3929         (Sized_relobj::Compressed_section_map): New type.
3930         (Sized_relobj::do_section_is_compressed): New method.
3931         (Sized_relobj::compressed_sections_): New data member.
3932         * output.cc (Output_section::add_input_section): Handle compressed
3933         debug sections.
3934         * reloc.cc: Include compressed_output.h.
3935         (Sized_relobj::write_sections): Handle compressed debug sections.
3936
3937 2010-07-08  Cary Coutant  <ccoutant@google.com>
3938
3939         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3940         weak when resolving to a dynamic def.
3941         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3942         for weak undef/dynamic def cases. Adjust callers.
3943         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3944         undef_binding_weak_.
3945         (Symbol_table::sized_write_globals): Adjust symbol binding.
3946         (Symbol_table::sized_write_symbol): Add binding parameter.
3947         * symtab.h (Symbol::set_undef_binding): New method.
3948         (Symbol::is_undef_binding_weak): New method.
3949         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3950         (Symbol_table::should_override): Add new parameter.
3951         (Symbol_table::sized_write_symbol): Add new parameter.
3952
3953         * testsuite/weak_undef_file1.cc: Add new test case.
3954         * testsuite/weak_undef_file2.cc: Fix header comment.
3955         * testsuite/weak_undef_test.cc: Add new test case.
3956
3957 2010-06-29  Doug Kwan  <dougkwan@google.com>
3958
3959         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3960         Initialize USE_SYMBOL_.
3961         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3962         definition.
3963         (Arm_reloc_property::uses_symbol_): New data member declaration.
3964         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3965         uses symbol value and symbol is undefined but not weakly undefined.
3966
3967 2010-06-28  Rafael Espindola  <espindola@google.com>
3968
3969         * plugin.cc (Plugin::load): Use dlerror.
3970
3971 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3972
3973         * symtab.cc (detect_odr_violations): When reporting an ODR
3974         violation, report an object where the symbol is defined.
3975
3976 2010-06-25  Doug Kwan  <dougkwan@google.com>
3977
3978         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3979         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3980         definition.
3981         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3982         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3983         target hook to detect function points.
3984         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3985         * icf.h (Icf::check_section_for_function_pointers): Change type of
3986         parameter SECTION_NAME to const reference to std::string.  Use
3987         target hook to determine if section may have unsafe pointers.
3988         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3989         method definition.
3990
3991 2010-06-21  Rafael Espindola  <espindola@google.com>
3992
3993         * fileread.cc (Input_file::find_fie): New
3994         (Input_file::open): Use Input_file::find_fie.
3995         * fileread.h (Input_file::find_fie): New
3996         * plugin.cc (set_extra_library_path): New.
3997         (Plugin::load): Add set_extra_library_path to the transfer vector.
3998         (Plugin_manager::set_extra_library_path): New.
3999         (Plugin_manager::add_input_file): Use the extra search path if set.
4000         (set_extra_library_path(): New.
4001         * plugin.h (Plugin_manager): Add set_extra_library_path and
4002         extra_search_path_.
4003
4004 2010-06-19  Cary Coutant  <ccoutant@google.com>
4005
4006         * layout.cc (gdb_sections): Add .debug_types.
4007         (lines_only_debug_sections): Likewise.
4008
4009 2010-06-18  Rafael Espindola  <espindola@google.com>
4010
4011         * plugin.cc (add_input_file,add_input_library)
4012         (Plugin_manager::add_input_file): Make filename arguments const.
4013         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4014         const.
4015
4016 2010-06-16  Doug Kwan  <dougkwan@google.com>
4017
4018         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4019         .ARM.attributes section if we have not merged any input
4020         attributes sections.
4021
4022 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4023
4024         * arm.cc: Allow combining objects with no EABI version
4025         information.
4026
4027 2010-06-15  Rafael Espindola  <espindola@google.com>
4028
4029         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4030
4031 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4032
4033         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4034         (struct iovec): Correct !HAVE_READV definition.
4035
4036 2010-06-10  Cary Coutant  <ccoutant@google.com>
4037
4038         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4039         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4040         reloc sections.
4041         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4042
4043         PR 11683
4044         * symtab.h (Symbol::is_placeholder): New member function.
4045         * target-reloc.h (relocate_section): Check for placeholder symbols.
4046
4047         * testsuite/Makefile.am (plugin_test_8): New test.
4048         (plugin_test_9): New test.
4049         * testsuite/Makefile.in: Regenerate.
4050
4051 2010-06-09  Nick Clifton  <nickc@redhat.com>
4052
4053         * yyscript.y (input_list_element): Allow strings prefixed with
4054         the '-' character.  Treat these as libraries.
4055         * script.cc (script_add_library): New function.  Adds a library
4056         specified by "-l<name>" found in an input script.
4057         * script-c.h: Add prototype for script_add_library.
4058
4059 2010-06-07  Doug Kwan  <dougkwan@google.com>
4060
4061         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4062         Restrict stub-group size to be within long conditional branch
4063         range when working around cortex-A8 erratum.
4064
4065 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4066
4067         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4068         #ifdef typo.
4069
4070 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4071
4072         PR gold/11658
4073         * output.cc
4074         (Output_section::Input_section_sort_entry::compare_section_ordering):
4075         Change to return non-zero correctly.
4076         (Output_section::Input_section_sort_section_order_index_compare
4077         ::operator()): Change to fix ambiguity in comparisons.
4078
4079 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4080
4081         * gold.h (is_wildcard_string): New function.
4082         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4083         (Layout::layout_eh_frame): Ditto.
4084         (Layout::find_section_order_index): New method.
4085         (Layout::read_layout_from_file): New method.
4086         * layout.h (Layout::find_section_order_index): New method.
4087         (Layout::read_layout_from_file): New method.
4088         (Layout::input_section_position_): New private member.
4089         (Layout::input_section_glob_): New private member.
4090         * main.cc (main): Call read_layout_from_file here.
4091         * options.h (--section-ordering-file): New option.
4092         * output.cc (Output_section::input_section_order_specified_): New
4093         member.
4094         (Output_section::Output_section): Initialize new member.
4095         (Output_section::add_input_section): Add new parameter.
4096         Keep input sections when --section-ordering-file is used.
4097         (Output_section::set_final_data_size): Sort input sections when
4098         section ordering file is specified.
4099         (Output_section::Input_section_sort_entry): Add new parameter.
4100         Check sorting type.
4101         (Output_section::Input_section_sort_entry::compare_section_ordering):
4102         New method.
4103         (Output_section::Input_section_sort_compare::operator()): Change to
4104         consider section_order_index.
4105         (Output_section::Input_section_sort_init_fini_compare::operator()):
4106         Change to consider section_order_index.
4107         (Output_section::Input_section_sort_section_order_index_compare
4108         ::operator()): New method.
4109         (Output_section::sort_attached_input_sections): Change to sort
4110         according to section order when specified.
4111         (Output_section::add_input_section<32, true>): Add new parameter.
4112         (Output_section::add_input_section<64, true>): Add new parameter.
4113         (Output_section::add_input_section<32, false>): Add new parameter.
4114         (Output_section::add_input_section<64, false>): Add new parameter.
4115         * output.h (Output_section::add_input_section): Add new parameter.
4116         (Output_section::input_section_order_specified): New
4117         method.
4118         (Output_section::set_input_section_order_specified): New method.
4119         (Input_section::Input_section): Initialize section_order_index_.
4120         (Input_section::section_order_index): New method.
4121         (Input_section::set_section_order_index): New method.
4122         (Input_section::section_order_index_): New member.
4123         (Input_section::Input_section_sort_section_order_index_compare): New
4124         struct.
4125         (Output_section::input_section_order_specified_): New member.
4126         * script-sections.cc (is_wildcard_string): Delete and move modified
4127         method to gold.h.
4128         (Output_section_element_input::Output_section_element_input): Modify
4129         call to is_wildcard_string.
4130         (Output_section_element_input::Input_section_pattern
4131         ::Input_section_pattern): Ditto.
4132         (Output_section_element_input::Output_section_element_input): Ditto.
4133         * testsuite/Makefile.am (final_layout): New test case.
4134         * testsuite/Makefile.in: Regenerate.
4135         * testsuite/final_layout.cc: New file.
4136         * testsuite/final_layout.sh: New file.
4137
4138 2010-06-01  Rafael Espindola  <espindola@google.com>
4139
4140         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4141
4142 2010-06-01  Rafael Espindola  <espindola@google.com>
4143
4144         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4145         visibility of symbols.
4146
4147 2010-05-27  Doug Kwan  <dougkwan@google.com>
4148
4149         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4150         from start of output section instead of address for a local symbol
4151         in a merged or relaxed section when doing a relocatable link.
4152
4153 2010-05-26  Rafael Espindola  <espindola@google.com>
4154
4155        PR 11604
4156         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4157         adding sections the garbage collector removed.
4158         * gold/testsuite/Makefile.am: Add test.
4159         * gold/testsuite/Makefile.in: Regenerate.
4160         * gold/testsuite/plugin_test_7.sh: New.
4161         * gold/testsuite/plugin_test_7_1.c: New.
4162         * gold/testsuite/plugin_test_7_2.c: New.
4163
4164 2010-05-26  Rafael Espindola  <espindola@google.com>
4165
4166         * script-sections.cc (Output_section_definition::set_section_addresses):
4167         Check for --section-start.
4168
4169 2010-05-26  Doug Kwan  <dougkwan@google.com>
4170
4171         * arm.cc (Arm_scan_relocatable_relocs): New class.
4172         (Target_arm::relocate_special_relocatable): New method.
4173         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4174         (Arm_relocate_functions::thumb_branch_common): Same.
4175         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4176         instead of Default_scan_relocatable_relocs.
4177         * target-reloc.h (relocate_for_relocatable): Let target handle
4178         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4179         * target.h (Sized_target::relocate_special_relocatable): New method.
4180
4181 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4182
4183         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4184
4185 2010-05-23  Doug Kwan  <dougkwan@google.com>
4186
4187         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4188         instead of a cast.
4189         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4190         with a direct branch, not a conditional branch, to a stub.
4191         * merge.cc (Output_merge_base::record_input_section): New method
4192         defintion.
4193         (Output_merge_data::do_add_input_section): Record input section if
4194         keeps-input-sections flag is set.
4195         (Output_merge_string::do_add_input_section): Ditto.
4196         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4197         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4198         INPUT_SECTIONS_.
4199         (Output_merge_base::keeps_input_sections,
4200         Output_merge_base::set_keeps_input_sections,
4201         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4202         method definitions.
4203         (Output_merge_base::Input_sections): New type declaration.
4204         (Output_merge_base::input_sections_begin,
4205         Output_merge_base::input_sections_end,
4206         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4207         (Output_merge_base::bool keeps_input_sections_,
4208         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4209         Output_merge_base::input_sections_): New data members.
4210         (Output_merge_data::do_set_keeps_input_sections): New method
4211         defintion.
4212         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4213         * output.cc (Output_section::Input_section::relobj): Move method
4214         defintion from class declaration to here and handle merge sections.
4215         (Output_section::Input_section::shndx): Ditto.
4216         (Output_section::Output_section): Remove initializations of removed
4217         data members and initialize new data member LOOKUP_MAPS_.
4218         (Output_section::add_input_section): Set keeps-input-sections flag
4219         for a newly created merge output section as appropriate.  Adjust code
4220         to use Output_section_lookup_maps class.
4221         (Output_section::add_relaxed_input_section): Adjst code for lookup
4222         maps code refactoring.
4223         (Output_section::add_merge_input_section): Add a new parameter
4224         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4225         class.  If adding input section to a newly created merge output
4226         section fails, remove the new merge section.
4227         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4228         Adjust code for use of the Output_section_lookup_maps class.
4229         (Output_section::find_merge_section): Ditto.
4230         (Output_section::build_lookup_maps): New method defintion.
4231         (Output_section::find_relaxed_input_section): Adjust code to use
4232         Output_section_lookup_maps class.
4233         (Output_section::get_input_sections): Export merge sections.  Adjust
4234         code to use Output_section_lookup_maps class.
4235         (Output_section:::add_script_input_section): Adjust code to use
4236         Output_section_lookup_maps class.  Update lookup maps for merge
4237         sections also.
4238         (Output_section::discard_states): Use Output_section_lookup_maps.
4239         (Output_section::restore_states): Same.
4240         * output.h (Merge_section_properties): Move class defintion out of
4241         Output_section.
4242         (Output_section_lookup_maps): New class.
4243         (Output_section::Input_section::is_merge_section): New method
4244         defintion.
4245         (Output_section::Input_section::relobj): Move defintion out of class
4246         defintion.  Declare method only.
4247         (Output_section::Input_section::shndx): Ditto.
4248         (Output_section::Input_section::output_merge_base): New method defintion.
4249         (Output_section::Input_section::u2_.pomb): New union field.
4250         (Output_section::Merge_section_by_properties_map,
4251         Output_section::Output_section_data_by_input_section_map,
4252         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4253         Remove types.
4254         (Output_section::add_merge_input_section): Add new parameter
4255         KEEPS_INPUT_SECTIONS.
4256         (Output_section::build_lookup_maps): New method declaration.
4257         (Output_section::merge_section_map_,
4258         Output_section::merge_section_by_properties_map_,
4259         Output_section::relaxed_input_section_map_,
4260         Output_section::is_relaxed_input_section_map_valid_): Remove data
4261         members.
4262         (Output_section::lookup_maps_): New data member.
4263
4264 2010-05-21  Doug Kwan  <dougkwan@google.com>
4265
4266         PR gold/11619
4267         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4268         avoid a compilation error.
4269
4270 2010-05-19  Rafael Espindola  <espindola@google.com>
4271
4272         * script-sections.cc (Output_section_definition::allocate_to_segment):
4273         Update the phdrs_list even when the output section is NULL.
4274         * testsuite/Makefile.am: Add test.
4275         * testsuite/Makefile.in: Regenerate.
4276         * testsuite/script_test_9.cc: New.
4277         * testsuite/script_test_9.sh: New.
4278         * testsuite/script_test_9.t: New.
4279
4280 2010-05-19  Doug Kwan  <dougkwan@google.com>
4281
4282         * arm.cc (Arm_input_section::original_size): New method.
4283         (Arm_input_section::do_addralign): Add a cast.
4284         (Arm_input_section::do_output_offset): Remove static cast.
4285         (Arm_input_section::original_addralign,
4286          Arm_input_section::original_size_): Change type to uint32_t.
4287         (Arm_input_section::init): Add safe casts for section alignment
4288         and size.
4289         (Arm_input_section::set_final_data_size): Do not set address and
4290         offset of stub table.
4291         (Arm_output_section::fix_exidx_coverage): Change use of of
4292         Output_section::Simple_input_section to that of
4293         Output_section::Input_section.
4294         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4295         except for the first pass.
4296         * output.cc (Output_section::get_input_sections): Change type of
4297         input_sections to std::list<Input_section>.
4298         (Output_section::add_script_input_section): Rename from
4299         Output_section::add_simple_input_section.  Change type of SIS
4300         parameter from Simple_input_section to Input_section.
4301         * output.h (Output_section::Simple_input_section): Remove class.
4302         (Output_section::Input_section): Change class visibility to public.
4303         (Output_section::Input_section::addralign): Use stored alignments
4304         for special input sections if set.
4305         (Output_section::Input_section::set_addralign): New method.
4306         (Output_section::get_input_sections): Change parameter type from
4307         list of Simple_input_section to list of Input_section.
4308         (Output_section::add_script_input_section): Rename from
4309         Output_section::add_simple_input_section. Change first parameter's
4310         type from Simple_input_section to Input_section and remove the
4311         second and third parameters.
4312         * script-sections.cc (Input_section::Input_section_list): Change
4313         type to list of Output_section::Input_section/
4314         (Input_section_info::Input_section_info): Change parameter type of
4315         INPUT_SECTION to Output_section::Input_section.
4316         (Input_section_info::input_section): Change return type.
4317         (Input_section_info::input_section_): Change type to
4318         Output_section::Input_section.
4319         (Output_section_element_input::set_section_addresses): Adjust code
4320         to use Output_section::Input_section instead of
4321         Output_section::Simple_input_section.  Adjust code for renaming
4322         of Output_section::add_simple_input_section.
4323         (Orphan_output_section::set_section_addresses): Ditto.
4324
4325 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4326
4327         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4328         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4329
4330 2010-05-18  Rafael Espindola  <espindola@google.com>
4331
4332         * options.cc (General_options::finalize): Handle -nostdlib.
4333         * options.h (nostdlib): New option.
4334         * script.cc (script_add_search_dir): Handle -nostdlib.
4335
4336 2010-05-12  Doug Kwan  <dougkwan@google.com>
4337
4338         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4339         attributes section only if there no attributes section after merging.
4340         (Target_arm::merge_object_attributes): Move value of
4341         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4342         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4343         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4344         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4345         and arm_attr_merge_7.stdout.
4346         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4347         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4348         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4349         arm_attr_merge_7b.o): New rules.
4350         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4351         arm_attr_merge_7
4352         * testsuite/Makefile.in: Regenerate.
4353         * testsuite/arm_attr_merge.sh: New file.
4354         * testsuite/arm_attr_merge_[67][ab].s: Same.
4355
4356 2010-05-05  Nick Clifton  <nickc@redhat.com>
4357
4358         * po/es.po: Updated Spanish translation.
4359
4360 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4361
4362         * Makefile.am (install-exec-local): Properly install gold as
4363         default cross linker.
4364         * Makefile.in: Regenerated.
4365
4366 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4367             Nick Clifton  <nickc@redhat.com>
4368
4369         * configure.ac (install_as_default): Define and set to false
4370         unless --enable-gold or --enable-gold=both/gold has been
4371         specified.
4372         * configure: Regenerate.
4373
4374         * Makefile.am (install-exec-local): Install the executable as
4375         'ld.gold'.  If install_as_default is true then also install it as
4376         'ld'.
4377         * Makefile.in: Regenerated.
4378
4379 2010-04-24  Ian Lance Taylor  <iant@google.com>
4380
4381         * layout.cc (Layout::layout_reloc): In relocatable link don't
4382         combine reloc sections for grouped sections.
4383
4384 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4385
4386         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4387         sections that are not ordinary to icf.
4388         * icf.cc (get_section_contents): Handle relocation pointing to section
4389         with no object or shndx information.
4390         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4391         * testsuite/Makefile.in: Regenerate.
4392         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4393         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4394
4395 2010-04-22  Ian Lance Taylor  <iant@google.com>
4396
4397         * expression.cc (Expression::Expression_eval_info): Add
4398         result_alignment_pointer field.
4399         (Expression::eval_with_dot): Add result_alignment_pointer
4400         parameter.  Change all callers.
4401         (Expression::eval_maybe_dot): Likewise.
4402         (class Binary_expression): Add alignment_pointer parameter to
4403         left_value and right_value.  Change all callers.
4404         (BINARY_EXPRESSION): Set result alignment.
4405         (class Trinary_expression): Add alignment_pointer parameter to
4406         arg2_value and arg3_value.  Change all callers.
4407         (Trinary_cond::value): Set result alignment.
4408         (Max_expression::value, Min_expression::value): Likewise.
4409         (Align_expression::value): Likewise.
4410         * script-sections.cc (class Sections_element): Add dot_alignment
4411         parameter to set_section_addresses virtual function.  Update
4412         instantiations.
4413         (class Output_section_element): Likewise.
4414         (Script_sections::create_segments): Add dot_alignment parameter.
4415         Change all callers.
4416         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4417         (Script_sections::set_phdrs_clause_addresses): Likewise.
4418         * script-sections.h: Update declarations.
4419         * script.h: Update declarations.
4420         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4421         min_p_align.
4422         * testsuite/script_test_3.t: Set large alignment.
4423         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4424         segment has expected alignment.
4425
4426 2010-04-22  Nick Clifton  <nickc@redhat.com>
4427
4428         * po/gold.pot: Updated by the Translation project.
4429         * po/vi.po: Updated Vietnamese translation.
4430
4431 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4432
4433         * testsuite/Makefile.am (check_PROGRAMS): Add
4434         icf_virtual_function_folding_test.
4435         * testsuite/Makefile.in: Regenerated.
4436
4437 2010-04-15  Andrew Haley  <aph@redhat.com>
4438
4439         * options.h (merge_exidx_entries): New option.
4440         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4441         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4442         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4443         (Target_arm::merge_exidx_entries): New function.
4444         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4445         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4446         to Arm_exidx_fixup constructor.
4447         Add new arg, merge_exidx_entries.
4448         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4449         Arm_output_section::fix_exidx_coverage.
4450
4451 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4452
4453         * icf.cc (get_section_contents): Check for preemptible functions.
4454         Ignore addend when appropriate.
4455         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4456         section folded.
4457         (add_from_relobj): Check for section folded.
4458         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4459         * symtab.h (should_add_dynsym_entry): Add new parameter.
4460         * target-reloc.h (scan_relocs): Check for section folded.
4461         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4462         Check reloc types for function pointers in shared objects.
4463         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4464         case.
4465         (icf_preemptible_functions_test): New test case.
4466         (icf_string_merge_test): New test case.
4467         * testsuite.Makefile.in: Regenerate.
4468         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4469         bar_glob.  Refactor code.
4470         * testsuite/icf_preemptible_functions_test.cc: New file.
4471         * testsuite/icf_preemptible_functions_test.sh: New file.
4472         * testsuite/icf_string_merge_test.cc: New file.
4473         * testsuite/icf_string_merge_test.sh: New file.
4474         * testsuite/icf_virtual_function_folding_test.cc: New file.
4475         * testsuite/icf_virtual_function_folding_test.sh: New file.
4476
4477 2010-04-14  Doug Kwan  <dougkwan@google.com>
4478
4479         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4480         for local symbol recounting if we remove a section due to ICF.
4481         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4482         there are no regular objects in input.
4483
4484 2010-04-13  Doug Kwan  <dougkwan@google.com>
4485
4486         * arm.cc (Arm_input_section::set_final_data_size): Compute
4487         accurate final data size instead of using current data size.
4488
4489 2010-04-09  Doug Kwan  <dougkwan@google.com>
4490
4491         * layout.cc (Layout::choose_output_section): Handle script section
4492         types.
4493         (Layout::make_output_section_for_script): Add section type parameter.
4494         Handle script section types.
4495         * layout.h (Layout::make_output_section_for_script): Add section
4496         type parameter.
4497         * output.cc (Output_section::Output_section): Initialize data member
4498         is_noload_.
4499         (Output_section::do_reset_address_and_file_offset): Do not set address
4500         to 0 if section is a NOLOAD section.
4501         * output.h (Output_section::is_noload): New method.
4502         (Output_section::set_is_noload): Ditto.
4503         (Output_section::is_noload_): New data member.
4504         * script-c.h (Script_section_type): New enum type.
4505         (struct Parser_output_section_header): Add new file section_type.
4506         * script-sections.cc (Sections_element::output_section_name): Add
4507         parameter for returning script section type.
4508         (Output_section_definition::output_section_name): Ditto.
4509         (Output_section_definition::section_type)P; New method.
4510         (Output_section_definiton::script_section_type_name): Ditto.
4511         (Output_section_definition::script_section_type_): New data member.
4512         (Output_section_definition::Output_section_definition): Initialize
4513         data member Output_section_definition::script_section_type_.
4514         (Output_section_definition::create_sections): Pass script section type
4515         to Layout::make_output_section_for_script.
4516         (Output_section_definition::output_section_name): Return script
4517         section type to caller.
4518         (Output_section_definition::set_section_address): Do not advance
4519         dot value and load address if section type is NOLOAD.  Set address
4520         of NOLOAD sections regardless of section flags.
4521         (Output_section_definition::print): Print section type if it is
4522         not SCRIPT_SECTION_TYPE_NONE.
4523         (Output_section_definition::section_type): New method.
4524         (Output_section_definition::script_section_type_name): Ditto.
4525         (Script_sections::output_section_name): Add new parameter
4526         PSECTION_TYPE for returning script section type.  Pass it to
4527         section elements.  Handle discard sections.
4528         (Sort_output_sections::operator()): Handle NOLOAD sections.
4529         * script-sections.h (Script_sections::Section_type): New enum type.
4530         (Script_sections::output_section_name): Add a new parameter for
4531         returning script section type.
4532         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4533         INFO and NOLOAD.
4534         * yyscript.y (union): Add new field SECTION_TYPE.
4535         (COPY, DSECT, INFO, NOLOAD): New tokens.
4536         (opt_address_and_section_type): Change type to output_section_header.
4537         (section_type): New non-terminal
4538         (section_header): Handle section type.
4539         (opt_address_and_section_type): Return section type value.
4540
4541 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4542
4543         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4544         * testsuite/plugin_common_test_2.c (foo): Likewise.
4545
4546 2010-04-08  Doug Kwan  <dougkwan@google.com>
4547
4548         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4549         Output_merge_data.
4550         * output.cc (Output_section::add_merge_input_section): Simplify
4551         code and return status of Output_merge_base::add_input_section.
4552         Update merge section map only if Output_merge_base::add_input_section
4553         returns true.
4554
4555 2010-04-07  Doug Kwan  <dougkwan@google.com>
4556
4557         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4558         if section is marked as containing instructions but has no mapping
4559         symbols.
4560         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4561         correct section index.
4562         (Arm_relobj::find_linked_text_section): Ditto.
4563
4564 2010-04-07  Cary Coutant  <ccoutant@google.com>
4565
4566         * archive.cc (include_member): Destroy Read_symbols_data object before
4567         releasing file.
4568         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4569         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4570         (Read_symbols_data::~Read_symbols_data) New destructor.
4571         (Section_relocs::Section_relocs) New constructor.
4572         (Section_relocs::~Section_relocs) New destructor.
4573         (Read_relocs_data::Read_relocs_data) New constructor.
4574         (Read_relocs_data::~Read_relocs_data) New destructor.
4575         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4576         pointers to NULL after deleting.
4577
4578 2010-04-07  Doug Kwan  <dougkwan@google.com>
4579
4580         * arm.cc: Replace "endianity" with "endianness" in comments.
4581         (Arm_exidx_cantunwind): Ditto.
4582         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4583         (Arm_relobj::merge_flags_and_attributes): New method.
4584         (Arm_relobj::merge_flags_and_attributes_): New data member.
4585         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4586         (Arm_relobj::scan_sections_for_stubs): Ditto.
4587         (Arm_relobj::do_read_symbols): Check to see if we really want to
4588         merge processor-specific flags and attributes.  Exit early if
4589         an object is empty except for section names and the undefined symbol.
4590         (Target_arm::do_finalize_sections): Move check for ELF format to
4591         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4592         attributes from a regular object only when we have determined that
4593         it is aapropriate.  Do not create an .ARM.attributes section in
4594         output if there is no regular input object.
4595         (Target_arm::merge_processor_specific_flags): Check
4596         --warn-mismatch before printing any error.
4597         (Target_arm::merge_object_attributes): Ditto.
4598         * gold.cc (queue_middle_tasks): Handle the case in which there is
4599         no regular object in input.
4600         * options.cc (General_options::parse_EB): New method.
4601         (General_options::parse_EL): Same.
4602         (General_options::General_options): Initialize endianness_.
4603         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4604         New options.
4605         (General_options::Endianness): New enum.
4606         (General_options::endianness): New method.
4607         (General_options::endianness_): New data member.
4608         * parameters.cc (Parameters::set_options): Check target endianness.
4609         (Parameters::set_target_once): Ditto.
4610         (Parameters::check_target_endianness): New method.
4611         (parameters_force_valid_target): If either -EL or -EB is specified,
4612         use it to define endianness of default target.
4613         * parameters.h (Parameters::check_target_endianness): New method
4614         declaration.
4615         * target.h (class Target): Change "endianity" to "endianness"
4616         in comments.
4617
4618 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4619
4620         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4621         * configure: Regenerate.
4622         * Makefile.in: Regenerate.
4623         * testsuite/Makefile.in: Regenerate.
4624
4625 2010-04-06  Cary Coutant  <ccoutant@google.com>
4626
4627         gcc PR lto/42757
4628         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4629         prevailing definitions of common symbols.
4630         * testsuite/plugin_test_6.sh: New test case.
4631         * testsuite/plugin_common_test_1.c: New test case.
4632         * testsuite/plugin_common_test_2.c: New test case.
4633         * testsuite/Makefile.am (plugin_test_6): New test case.
4634         * testsuite/Makefile.in: Regenerate.
4635
4636 2010-04-06  Nick Clifton  <nickc@redhat.com>
4637
4638         * po/vi.po: New Vietnamese translation.
4639
4640 2010-03-30  Doug Kwan  <dougkwan@google.com>
4641
4642         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4643
4644 2010-03-25  Doug Kwan  <dougkwan@google.com>
4645
4646         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4647         to avoid a conversion warning on a 32-bit host.
4648
4649 2010-03-24  Ian Lance Taylor  <iant@google.com>
4650
4651         * testsuite/script_test_3.t: Add a TLS segment.
4652         * testsuite/Makefile.am (check_PROGRAMS): Add
4653         tls_phdrs_script_test.
4654         (tls_phdrs_script_test_SOURCES): Define.
4655         (tls_phdrs_script_test_DEPENDENCIES): Define.
4656         (tls_phdrs_script_test_LDFLAGS): Define.
4657         (tls_phdrs_script_test_LDADD): Define.
4658         * testsuite/Makefile.in: Rebuild.
4659
4660 2010-03-23  Cary Coutant  <ccoutant@google.com>
4661
4662         * fileread.cc (find_or_make_view): Fix comment.
4663
4664 2010-03-23  Ian Lance Taylor  <iant@google.com>
4665
4666         * script-sections.cc (class Orphan_section_placement): Define
4667         PLACE_TLS and PLACE_TLS_BSS.
4668         (Orphan_section_placement::Orphan_section_placement): Initialize
4669         new places.
4670         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4671         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4672         (tls_script_test_SOURCES): Define.
4673         (tls_script_test_DEPENDENCIES): Define.
4674         (tls_script_test_LDFLAGS): Define.
4675         (tls_script_test_LDADD): Define.
4676         * testsuite/Makefile.in: Rebuild.
4677
4678 2010-03-22  Doug Kwan  <dougkwan@google.com>
4679
4680         * arm.cc (Arm_relocate_functions::abs8,
4681         Arm_relocate_functions::abs16): Use correct check for overflow
4682         specified in the ARM ELF specs.
4683         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4684         target of a BLX instruction specially.
4685         (Reloc_stub::stub_type_for_reloc): Ditto.
4686         (Relocate::relocate): Use symbolic names instead of numeric relocation
4687         codes to report error.
4688         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4689         workaround.
4690         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4691         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4692         thumb2_blx_out_of_range.stdout
4693         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4694         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4695         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4696         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4697         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4698         thumb2_blx_in_range, thumb2_blx_in_range.o,
4699         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4700         thumb2_blx_out_of_range.o): New rules.
4701         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4702         thumb2_blx_in_range and thumb2_blx_out_of_range.
4703         * testsuite/Makefile.in: Regenerate.
4704         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4705         * testsuite/thumb_blx_in_range.s: New file.
4706         * testsuite/thumb_blx_out_of_range.s: New file.
4707
4708 2010-03-22  Rafael Espindola  <espindola@google.com>
4709
4710         * archive.cc (Should_include): Move to archive.h.
4711         (should_include_member): Make it a member of Archive.
4712         (Lib_group): New.
4713         (Add_lib_group_symbols): New.
4714         * archive.h: Include options.h.
4715         (Archive_member): Moved from Archive.
4716         (Should_include): Moved from archive.cc.
4717         (Lib_group): New.
4718         (Add_lib_group_symbols): New.
4719         * dynobj.cc (do_should_include_member): New.
4720         * dynobj.h (do_should_include_member): New.
4721         * gold.cc (queue_initial_tasks): Update call to queue.
4722         * main.cc (main): Print lib group stats.
4723         * object.cc (do_should_include_member): New.
4724         * object.h: Include archive.h.
4725         (Object::should_include_member): New.
4726         (Object::do_should_include_member): New.
4727         (Sized_relobj::do_should_include_member): New.
4728         * options.cc (General_options::parse_start_lib): New.
4729         (General_options::parse_end_lib): New.
4730         (Input_arguments::add_file): Handle lib groups.
4731         (Input_arguments::start_group): Check we are not in a lib.
4732         (Input_arguments::start_lib): New.
4733         (Input_arguments::end_lib): New.
4734         * options.h (General_options): Add start_lib and end_lib.
4735         (Input_argument::lib_): New.
4736         (Input_argument::lib): New.
4737         (Input_argument::is_lib): New.
4738         (Input_file_lib): New.
4739         (Input_arguments::in_lib_): New.
4740         (Input_arguments::in_lib): New.
4741         (Input_arguments::start_lib): New.
4742         (Input_arguments::end_lib_): New.
4743         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4744         in unused members as preempted.
4745         (Sized_pluginobj::do_should_include_member): New.
4746         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4747         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4748         return the blocker.
4749         (Read_symbols::do_whole_lib_group): New.
4750         (Read_symbols::do_lib_group): New.
4751         (Read_symbols::do_read_symbols): Handle lib groups.
4752         (Read_symbols::get_name): Handle lib groups.
4753         * readsyms.h (Read_symbols): Add an archive member pointer.
4754         (Read_symbols::do_whole_lib_group): New.
4755         (Read_symbols::do_lib_group): New.
4756         (Read_symbols::member_): New.
4757         * script.cc (read_input_script): Update call to queue_soon.
4758
4759 2010-03-19  Doug Kwan  <dougkwan@google.com>
4760
4761         * arm.cc (Stub_table::Stub_table): Initialize new data members
4762         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4763         (Stub_table::add_reloc_stub): Assign stub offset and update
4764         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4765         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4766         New data members.
4767         (Stub_table::update_data_size_and_addralign): Use
4768         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4769         instead of going over all reloc stubs.
4770         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4771         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4772         Stringpool_template::offset_ to size of Stringpool_char.
4773         (Stringpool_template::new_key_offset): Remove code to initialize
4774         Stringpool_template::offset_.
4775         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4776         Stringpool_template::offset_ to zero.
4777
4778 2010-03-15  Doug Kwan  <dougkwan@google.com>
4779
4780         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4781         offset_.
4782         (Stringpool_template::new_key_offset): New method.
4783         (Stringpool_template::add_string): Assign offsets when adding new
4784         strings.
4785         (Stringpool_template::set_string_offsets): Do not set string offsets
4786         when not optimizing.
4787         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4788         member size_.
4789         (Chunked_vector::clear): Clear size_.
4790         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4791         (Chunked_vector::size): Return size_.
4792         (Chunked_vector::push_back): Use size_ to find insert position.
4793         (Chunked_vector::size_): New data member.
4794         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4795         (Stringpool_template::new_key_offset): New method declaration.
4796         (Stringpool_template::offset_): New data member.
4797
4798 2010-03-15   Rafael Espindola  <espindola@google.com>
4799
4800         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4801         Add_symbols' constructor.
4802         * readsyms.h (Add_symbols): Remove the input_group member.
4803
4804 2010-03-10  Ian Lance Taylor  <iant@google.com>
4805
4806         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4807         target to ask whether a reference to a symbol requires a stack
4808         split.
4809         * target.h (Target::is_call_to_non_split): New function.
4810         (Target::do_is_call_to_non_split): Declare virtual function.
4811         * target.cc: Include "symtab.h".
4812         (Target::do_is_call_to_non_split): New function.
4813         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4814
4815 2010-03-10  Cary Coutant  <ccoutant@google.com>
4816
4817         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4818         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4819         (File_read::open[2]): Add whole_file_view_ to list of views.
4820         (File_read::make_view): Remove test of whole_file_view_.
4821         (File_read::find_or_make_view): Create whole_file_view_ if
4822         necessary.
4823         (File_read::clear_views): Replace bool parameter with enum;
4824         adjust all callers.  Don't delete views with permanent data;
4825         do delete cached views and views from archives if
4826         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4827         if clearing the corresponding view.
4828         * fileread.h (File_read::Clear_views_mode): New enum.
4829         (File_read::View::is_permanent_view): New method.
4830         (File_read::clear_views): Replace bool parameter
4831         with enum; adjust all callers.
4832         * options.h (General_options): Change keep_files_mapped option;
4833         add map_whole_files.
4834         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4835         releasing the file.
4836         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4837         the file.
4838
4839 2010-03-10  David S. Miller  <davem@davemloft.net>
4840
4841         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4842
4843 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4844
4845         * icf.cc (get_section_contents): Add '@' marker after processing the
4846         merge reloc.
4847
4848 2010-03-08  Doug Kwan  <dougkwan@google.com>
4849
4850         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4851         due to a conversion warning.
4852         (Arm_relobj::update_output_local_symbol_count): Check for local
4853         symbol with unset output index.
4854
4855 2010-03-05  Ian Lance Taylor  <iant@google.com>
4856
4857         * options.h (class General_options): Add --spare-dynamic-tags.
4858         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4859         --spare-dynamic-tags.
4860
4861 2010-03-05  Ian Lance Taylor  <iant@google.com>
4862
4863         * incremental.cc: Include "libiberty.h".
4864
4865 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4866
4867         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4868         function, is_info_ member.
4869         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4870         (Versions::Versions): Update caller.
4871         (Versions::define_base_version): Likewise.
4872         (Versions::add_def): Likewise.
4873
4874 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4875
4876         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4877         (Scan::possible_function_pointer_reloc): New function.
4878         (Scan::local_reloc_may_be_function_pointer): Change to call
4879         possible_function_pointer_reloc.
4880         (Scan::global_reloc_may_be_function_pointer): Ditto.
4881         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4882         relocations in ".data.rel.ro._ZTV" section.
4883         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4884         * testsuite/icf_safe_so_test.cc: Ditto.
4885         * testsuite/icf_safe_test.cc: Ditto.
4886         * testsuite/icf_safe_test.sh: Ditto.
4887
4888 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4889             Ian Lance Taylor  <iant@google.com>
4890
4891         * target-reloc.h (relocate_section): Check the symbol table index
4892         for -1U before setting the local symbol index.
4893         (scan_relocatable_relocs): If copying the relocation, record that
4894         the local symbol is required.
4895         * object.h (Symbol_value::is_output_symtab_index_set): New
4896         function.
4897         (Symbol_value::may_be_discarded_from_output_symtab): New
4898         function.
4899         (Symbol_value::has_output_symtab_entry): New function.
4900         (Symbol_value::needs_output_symtab_entry): Remove.
4901         (Symbol_value::output_symtab_index): Make sure the symbol index is
4902         set.
4903         (Symbol_value::set_output_symtab_index): Make sure the symbol
4904         index is not set.  Make sure the new index is valid.
4905         (Symbol_value::set_must_have_output_symtab_entry): New function.
4906         (Symbol_value::has_output_dynsym_entry): New function.
4907         (Symbol_value::set_output_dynsym_index): Make sure the new index
4908         is valid.
4909         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4910         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4911         local symbol if permitted.
4912         (Sized_relobj::do_finalize_local_symbols): Call
4913         is_output_symtab_index_set rather than needs_output_symtab_entry.
4914         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4915         rather than needs_output_symtab_entry.  Call
4916         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4917         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4918         is_output_symtab_index_set rather than needs_output_symtab_entry.
4919         * testsuite/discard_locals_relocatable_test.c: New file.
4920         * testsuite/discard_locals_test.sh: Test -r.
4921         * testsuite/Makefile.am (check_DATA): Add
4922         discard_locals_relocatable_test1.syms,
4923         discard_local_relocatable_test2.syms.
4924         (MOSTLYCLEANFILES): Likewise.  Also add
4925         discard_locals_relocatable_test1.lout and
4926         discard_locals_relocatable_test2.out.
4927         (discard_locals_relocatable_test1.syms): New target.
4928         (discard_locals_relocatable_test.o): New target.
4929         (discard_locals_relocatable_test1.out): New target.
4930         (discard_locals_relocatable_test2.syms): New target.
4931         (discard_locals_relocatable_test2.out): New target.
4932         (various): Add missing ../ld-new dependencies.
4933         * testsuite/Makefile.in: Rebuild.
4934
4935 2010-03-03  Nick Clifton  <nickc@redhat.com>
4936
4937         * po/fi.po: New Finnish translation.
4938
4939 2010-03-01  Doug Kwan  <dougkwan@google.com>
4940
4941         * layout.cc (Layout::Layout): Force section types of .init_array*,
4942         .preinit_array* and .fini_array* sections.
4943         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4944         Fix check of return value of std::string::find.().
4945         (Output_section::Input_section_sort_compare::operator()): Remove
4946         comment about .init_array.
4947         (Output_section::Input_section_sort_init_fini_compare::operator()):
4948         New method.
4949         (Output_section::sort_attached_input_sections): Handle .init_array
4950         and .fini_array specially.
4951         * output.h (Output_section::Inut_section_sort_compare): Update
4952         comment.
4953         (Output_section::Input_section_sort_init_fini_compare): New struct.
4954
4955 2010-02-26  Doug Kwan  <dougkwan@google.com>
4956
4957         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4958         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4959         * testsuite/debug_msg.sh: Avoid matching source line number for
4960         use of global variable undef_int.
4961
4962 2010-02-26  Doug Kwan  <dougkwan@google.com>
4963
4964         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4965         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4966         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4967         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4968         * options.cc (General_options::General_options): Initialize member
4969         fix_v4bx_.
4970         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4971         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4972         and rm_no_fix_v4bx.stdout
4973         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4974         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4975         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4976         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4977         and arm_no_fix_v4bx.
4978         * Makefile.in: Regenerate.
4979         * testsuite/arm_fix_v4bx.s: New file.
4980         * testsuite/arm_fix_v4bx.sh: Ditto.
4981
4982 2010-02-24  Doug Kwan  <dougkwan@google.com>
4983
4984         * arm.cc (Target_arm::got_section): Make the .got section the first
4985         non RELRO section in the data segment.
4986         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4987         suffixes of section names.
4988
4989 2010-02-24  Doug Kwan  <dougkwan@google.com>
4990
4991         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4992         flags and attributes merging if an input file is a binary file.
4993         * fileread.cc (Input_file::open): Record format of original file.
4994         * fileread.h (Input_file::Format): New enum type.
4995         (Input_file::Input_file): Initialize data member format_.
4996         (Input_file::format): New method definition.
4997         (Input_file::format_):: New data member.
4998
4999 2010-02-24  Doug Kwan  <dougkwan@google.com>
5000
5001         * arm.cc (Arm_output_data_got): New class.
5002         (ARM_TCB_SIZE): New constant
5003         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5004         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5005         If user uses a script with a SECTIONS clause, issue only a warning
5006         for a misplaced EXIDX input section.  Otherwise, issue an error.
5007         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5008         garbage collection.
5009         (Target_arm::got_mode_index_entry): Handle static linking.
5010         (Target_arm::Scan::local): Ditto.
5011         (Target_arm::Scan::global): Ditto.
5012         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5013         all incorrectly implemented relocations.
5014         (Target_arm::fix_exidx_coverage): Pass layout to
5015         Arm_output_section::fix_exidx_coverage.
5016         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5017         from ".ARM.exidx." and ".ARM.extab.".
5018
5019 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5020
5021         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5022         section if it does not already exist.
5023         * attributes.cc (Attributes_section_data::Attributes_section_data):
5024         Don't crash if size is zero.
5025
5026 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5027             Ian Lance Taylor  <iant@google.com>
5028
5029         * gold.cc (queue_middle_tasks): If no input files were opened,
5030         exit.
5031         * workqueue.h (Task_function::Task_function): Assert that there is
5032         a blocker.
5033
5034 2010-02-22  Doug Kwan  <dougkwan@google.com>
5035
5036         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5037         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5038         types to avoid warnings due to different uint64_t implementations
5039         on different hosts.
5040
5041 2010-02-21  Doug Kwan  <dougkwan@google.com>
5042
5043         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5044         handling of the maximum backward branch offset.
5045         (Arm_relocate_functions::thumb_branch_common): Ditto.
5046         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5047         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5048         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5049         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5050         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5051         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5052         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5053         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5054         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5055         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5056         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5057         thumb2_bl_out_of_range.o): New rules.
5058         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5059         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5060         thumb2_bl_out_of_range
5061         * testsuite/Makefile.in: Regenerate.
5062         * testsuite/arm_bl_in_range.s: New file.
5063         * testsuite/arm_bl_out_of_range.s: Ditto.
5064         * testsuite/arm_branch_in_range.sh: Ditto.
5065         * testsuite/arm_branch_range.t: Ditto.
5066         * testsuite/thumb2_branch_range.t: Ditto.
5067         * testsuite/thumb_bl_in_range.s: Ditto.
5068         * testsuite/thumb_bl_out_of_range.s: Ditto.
5069         * testsuite/thumb_branch_range.t: Ditto.
5070
5071 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5072
5073         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5074         Add reloc offset information.
5075         * icf.cc (get_section_contents): Change iterators to point to the new
5076         vectors. Add reloc offset information to the contents.
5077         * icf.h (Icf::Sections_reachable_info): New typedef.
5078         (Icf::Sections_reachable_list): New typedef.
5079         (Icf::Offset_info): New typedef.
5080         (Icf::Reloc_info): New struct typedef.
5081         (Icf::Reloc_info_list): New typedef.
5082         (Icf::symbol_reloc_list): Delete method.
5083         (Icf::addend_reloc_list): Delete method.
5084         (Icf::section_reloc_list): Delete method.
5085         (Icf::reloc_info_list): New method.
5086         (Icf::reloc_info_list_): New member.
5087
5088 2010-02-19  Doug Kwan  <dougkwan@google.com>
5089
5090         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5091         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5092         * arm.cc (Arm_relocation_functions): New forward declaration.
5093         (Target_arm::Target_arm): Initialize new data members
5094         got_mod_index_offset_ and tls_base_symbol_defined_.
5095         (Target_arm::Relocate::relocate_tls): New method.
5096         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5097          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5098         New methods.
5099         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5100         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5101         (Target_arm::got_mod_index_offset_,
5102         Target_arm::tls_base_symbol_defined_): New data members.
5103         (Target_arm::Scan::local, Target::Scan::global,
5104         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5105         relocations.
5106
5107 2010-02-18  Doug Kwan  <dougkwan@google.com>
5108
5109         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5110         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5111         text section as a parameter becuase some broken tools may not set
5112         the link in section header.
5113         (Target_arm::has_got_section): New method.
5114         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5115         without any mapping symbol as data only.  Remove warning.
5116         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5117         link in its section header, try to discover the link by inspecting the
5118         REL31 relocation at the beginning of the section.
5119         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5120         in error message.
5121         (Target_arm::Scan::global): Treat any reference to the symbol
5122         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5123
5124 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5125
5126         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5127         (Scan::global_reloc_may_be_function_pointer): New function.
5128         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5129         (Scan::global_reloc_may_be_function_pointer): New function.
5130         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5131         (Scan::global_reloc_may_be_function_pointer): New function.
5132         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5133         (Scan::global_reloc_may_be_function_pointer): New function.
5134         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5135         (Scan::global_reloc_may_be_function_pointer): New function.
5136         (Scan::possible_function_pointer_reloc): New function.
5137         (Target_x86_64::can_check_for_function_pointers): New function.
5138         * gc.h (gc_process_relocs): Scan relocation types to determine if
5139         function pointers were taken for targets that support it.
5140         * icf.cc (Icf::find_identical_sections): Include functions for
5141         folding in safe ICF whose pointer is not taken.
5142         * icf.h (Secn_fptr_taken_set): New typedef.
5143         (fptr_section_id_): New member.
5144         (section_has_function_pointers): New function.
5145         (set_section_has_function_pointers): New function.
5146         (check_section_for_function_pointers): New function.
5147         * options.h: Fix comment for safe ICF option.
5148         * target.h (can_check_for_function_pointers): New function.
5149         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5150         Modify icf_safe_test for X86-64.
5151         * testsuite/Makefile.in: Regenerate.
5152         * testsuite/icf_safe_so_test.cc: New file.
5153         * testsuite/icf_safe_so_test.sh: New file.
5154         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5155         (main): Change to take pointer to function kept_func_3.
5156         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5157         folding is done correctly for X86-64.
5158
5159 2010-02-12  David S. Miller  <davem@davemloft.net>
5160
5161         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5162         is_symbolless parameter.
5163         (Output_reloc<SHT_REL>::is_symbolless): New.
5164         (Output_reloc<SHT_REL>::is_symbolless_): New.
5165         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5166         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5167         (Output_reloc<SHT_RELA>::is_symbolless): New.
5168         (Output_data_reloc::add_global): Handle is_symbolless.
5169         (Output_data_reloc::add_global_relative): Likewise.
5170         (Output_data_reloc::add_local): Likewise.
5171         (Output_data_reloc::add_local_relative): Likewise.
5172         (Output_data_reloc::add_symbolless_global_addend): New.
5173         (Output_data_reloc::add_symbolless_local_addend): New.
5174         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5175         is_symbolless.
5176         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5177         instead of ->is_relative_
5178         (Output_reloc::write): Likewise.
5179         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5180         (Output_reloc::write_rel): Simplify.
5181
5182         * sparc.cc (Target_sparc::Scan::local): Use
5183         ->add_symbolless_local_addend as needed.
5184         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5185         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5186         based upon relocation offset.
5187
5188 2010-02-11  Doug Kwan  <dougkwan@google.com>
5189
5190         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5191         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5192         beginning of function.
5193         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5194         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5195         parameter is_32bit in calls to should_apply_static_reloc.
5196         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5197         (check_DATA): Add arm_abs_global.stdout.
5198         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5199         arm_abs_global.stdout): New rules.
5200         (MOSTLLYCLEANFILES): Add arm_abs_global
5201         * Makefile.in: Regenerate.
5202         * testsuite/arm_abs_global.s: New file.
5203         * testsuite/arm_abs_global.sh: Ditto.
5204         * testsuite/arm_abs_lib.s: Ditto.
5205
5206 2010-02-11  Ian Lance Taylor  <iant@google.com>
5207
5208         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5209         Read_relocs task.
5210         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5211         Allocate_commons_task first.
5212         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5213         task, rather than symtab_lock_.
5214         (Gc_process_relocs::~Gc_process_relocs): New function.
5215         (Gc_process_relocs::is_runnable): Check this_blocker_.
5216         (Gc_process_relocs::locks): Use next_blocker_ rather than
5217         blocker_.
5218         (Scan_relocs::~Scan_relocs): New function.
5219         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5220         symtab_lock_.
5221         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5222         next_blocker_.
5223         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5224         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5225         constructor accordingly.
5226         (class Gc_process_relocs): Likewise.
5227         (class Scan_relocs): Likewise.
5228         * common.h (class Allocate_commons_task): Remove symtab_lock_
5229         field, and corresponding constructor parameter.
5230         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5231         symtab_lock_.
5232         (Allocate_commons_task::locks): Likewise.
5233
5234 2010-02-11  Ian Lance Taylor  <iant@google.com>
5235
5236         * gold-threads.h (class Once): Define.
5237         (class Initialize_lock): Rewrite as child of Once.
5238         * gold-threads.cc (class Once_initialize): Define.
5239         (once_pointer_control): New static variable.
5240         (once_pointer, once_arg): New static variables.
5241         (c_run_once): New static function.
5242         (Once::Once, Once::run_once, Once::internal_run): New functions.
5243         (class Initialize_lock_once): Remove.
5244         (initialize_lock_control): Remove.
5245         (initialize_lock_pointer): Remove.
5246         (initialize_lock_once): Remove.
5247         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5248         (Initialize_lock::initialize): Rewrite.
5249         (Initialize_lock::do_run_once): New function.
5250         * archive.cc (Archive::interpret_header): Only clear name if it is
5251         not already empty.
5252         * fileread.cc: Include "gold-threads.h"
5253         (file_counts_lock): New static variable.
5254         (file_counts_initialize_lock): Likewise.
5255         (File_read::release): Only increment counts when using --stats.
5256         Use a lock around the increment.
5257         * parameters.cc (class Set_parameters_target_once): Define.
5258         (set_parameters_target_once): New static variable.
5259         (Parameters::Parameters): Move here from parameters.h.
5260         (Parameters::set_target): Rewrite.
5261         (Parameters::set_target_once): New function.
5262         (Parameters::clear_target): Move here and rewrite.
5263         * parameters.h (class Parameters): Update declarations.  Add
5264         set_parameters_target_once_ field.
5265         (Parameters::Parameters): Move to parameters.cc.
5266         (Parameters::clear_target): Likewise.
5267         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5268         task.
5269         (Start_group::~Start_group): New function.
5270         (Start_group::is_runnable): New function.
5271         (Start_group::locks, Start_group::run): New functions.
5272         (Finish_group::run): Change saw_undefined to size_t.
5273         * readsyms.h (class Start_group): Define.
5274         (class Finish_group): Change saw_undefined_ field to size_t.
5275         (Finish_group::Finish_group): Remove saw_undefined and
5276         this_blocker parameters.  Change all callers.
5277         (Finish_group::set_saw_undefined): New function.
5278         (Finish_group::set_blocker): New function.
5279         * symtab.h (class Symbol_table): Change saw_undefined to return
5280         size_t.  Change saw_undefined_ field to size_t.
5281         * target-select.cc (Set_target_once::do_run_once): New function.
5282         (Target_selector::Target_selector): Initialize set_target_once_
5283         field.  Don't initialize lock_ and initialize_lock_ fields.
5284         (Target_selector::instantiate_target): Rewrite.
5285         (Target_selector::set_target): New function.
5286         * target-select.h (class Set_target_once): Define.
5287         (class Target_selector): Update declarations.  Make
5288         Set_target_once a friend.  Remove lock_ and initialize_lock_
5289         fields.  Add set_target_once_ field.
5290
5291 2010-02-10  Ian Lance Taylor  <iant@google.com>
5292
5293         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5294         queueing any tasks.
5295         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5296         (queue_middle_tasks): Add all blockers before queueing any tasks.
5297         (queue_final_tasks): Likewise.
5298         * token.h (Task_token::add_blockers): New function.
5299         * object.h (Input_objects::number_of_relobjs): New function.
5300
5301 2010-02-10  Ian Lance Taylor  <iant@google.com>
5302
5303         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5304         shared, not if not position independent.
5305         * x86_64.cc (Relocate::relocate_tls): Likewise.
5306         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5307         (tls_pie_pic_test): New target.
5308         * testsuite/Makefile.in: Rebuild.
5309
5310         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5311         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5312         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5313         * testsuite/Makefile.in: Rebuild.
5314
5315 2010-02-09  David S. Miller  <davem@davemloft.net>
5316
5317         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5318         R_SPARC_RELATIVE using ->add_local_relative().
5319         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5320
5321         * output.h (Output_data_dynamic::add_section_size): New method
5322         that takes two Output_data objects.
5323         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5324         entry param.  Handle it in initializers.
5325         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5326         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5327         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5328         arg.
5329         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5330         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5331         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5332         for dynrel_includes_plt.
5333         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5334         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5335         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5336         before .rela.plt
5337         (Target_sparc::do_finalize_sections): Update to pass true for
5338         dynrel_includes_plt.
5339         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5340         output before .rela.plt
5341         (Target_powerpc::do_finalize_sections): Update to pass true for
5342         dynrel_includes_plt when 32-bit.
5343
5344 2010-02-08  Doug Kwan  <dougkwan@google.com>
5345
5346         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5347         method.
5348         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5349         Arm_relobj::scan_section_for_cortex_a8_stubs,
5350         Arm_relobj::do_relocation_section): Instead of calling
5351         Output_section::output_address, use faster
5352         Arm_relobj::simple_input_section_output_address.
5353
5354 2010-02-08  David S. Miller  <davem@davemloft.net>
5355
5356         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5357         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5358         relocation helper function.
5359
5360         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5361         just like R_SPARC_GOT{10,13,22}.
5362         (Target_sparc::Scan::local): Likewise.
5363         (Target_sparc::Relocate:relocate): Likewise.
5364
5365 2010-02-06  Ian Lance Taylor  <iant@google.com>
5366
5367         * configure.ac: Rewrite targetobjs duplicate removal code to use
5368         only shell constructs.
5369         * configure: Rebuild.
5370
5371 2010-02-05  Doug Kwan  <dougkwan@google.com>
5372
5373         PR 11247
5374         * arm.cc (Arm_relobj::section_is_scannable): New method.
5375         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5376         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5377
5378 2010-02-04  Doug Kwan  <dougkwan@google.com>
5379
5380         PR 11247
5381         * arm-reloc-property.cc (cstdio): Include.
5382         * configure.ac (targetobjs): Remove duplicates.
5383         * configure: Regenerate.
5384         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5385         big and little endian version for a given address size.
5386
5387 2010-02-03  Doug Kwan  <dougkwan@google.com>
5388
5389         * arm-reloc-property.cc
5390         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5391         definition.
5392         * arm-reloc-property.h
5393         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5394         New method definition.
5395         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5396         declaration.
5397         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5398         overflow to N.
5399         (GOT_PREL): Change implemented to Y.
5400         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5401         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5402         (Arm_relocate_functions::movw_abs_nc): Remove method.
5403         (Arm_relocate_functions::movt_abs): Ditto.
5404         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5405         (Arm_relocate_functions::thm_movt_abs): Ditto.
5406         (Arm_relocate_functions::movw_rel_nc): Ditto.
5407         (Arm_relocate_functions::movw_rel): Ditto.
5408         (Arm_relocate_functions::movt_rel): Ditto.
5409         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5410         (Arm_relocate_functions:thm_movw_rel): Ditto.
5411         (Arm_relocate_functions:thm_movt_rel): Ditto.
5412         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5413         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5414         New method definitions.
5415         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5416         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5417         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5418         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5419         (Target_arm::Relocate::relocate): Check for non-static or
5420         unimplemented relocation code and exit early.  Change calls to
5421         Target_arm::reloc_uses_thumb_bit and
5422         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5423         instead.  Refactor code to handle similar relocations to increase
5424         code sharing.  Remove check for unsupported relocation code in switch
5425         statement.
5426         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5427         relocation property table to find out size.  Change error message to
5428         print out the name of a relocation code instead of the numeric value.
5429         (Target_arm::scan_reloc_for_stub): Use relocation property table
5430         instead of calling Target_arm::reloc_uses_thumb_bit().
5431
5432 2010-02-02  Doug Kwan  <dougkwan@google.com>
5433
5434         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5435         types of relaxed input section.
5436
5437 2010-02-02  Doug Kwan  <dougkwan@google.com>
5438
5439         * Makefile.am (HFILES): Add arm-reloc-property.h.
5440         (DEFFILES): New.
5441         (TARGETSOURCES): Add arm-reloc-property.cc
5442         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5443         (libgold_a_SOURCES): $(DEFFILES)
5444         * Makefile.in: Regenerate.
5445         * arm-reloc-property.cc: New file.
5446         * arm-reloc-property.h: New file.
5447         * arm-reloc.def: New file.
5448         * arm.cc: Update comments.
5449         (arm-reloc-property.h): New included header.
5450         (arm_reloc_property_table): New global variable.
5451         (Target_arm::do_select_as_default_target): New method definition.
5452         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5453         arm-reloc-property to targ_extra_obj.
5454         * parameters.cc (set_parameters_target): Call
5455         Target::select_as_default_target().
5456         * target.h (Target::select_as_default_target): New method definition.
5457         (Target::do_select_as_default_target): Same.
5458
5459 2010-02-01  Doug Kwan  <dougkwan@google.com>
5460
5461         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5462         first_output_text_section_.
5463         (Arm_exidx_fixup::first_output_text_section): New method definition.
5464         (Arm_exidx_fixup::first_output_text_section_): New data member.
5465         (Arm_exidx_fixup::process_exidx_section): Record the first text
5466         output section seen.
5467         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5468         and entsize in output section header.
5469
5470 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5471
5472         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5473         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5474         (Arm_relocate_functions::thm_alu11): New Method.
5475         (Arm_relocate_functions::thm_pc8): New Method.
5476         (Arm_relocate_functions::thm_pc12): New Method.
5477         (Target_arm::Scan::local): Handle the relocations.
5478         (Target_arm::Scan::global): Likewise.
5479         (Target_arm::Relocate::relocate): Likewise.
5480         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5481
5482 2010-01-29  Doug Kwan  <dougkwan@google.com>
5483
5484         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5485         of relocation types as ld.
5486
5487 2010-01-29  Doug Kwan  <dougkwan@google.com>
5488
5489         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5490         to public.
5491         (Arm_relocate_functions::thumb_branch_common): Ditto.
5492         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5493         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5494         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5495         Arm_relocate_functions::jump24): Remove.
5496         (Target_arm::Relocate::relocate): Adjust code to call
5497         Arm_relocation_functions::arm_branch_common and
5498         Arm_relocation_functions::thumb_branch_common instead of their removed
5499         wrappers.  Merge switch-cases together to reduce source code size.
5500
5501 2010-01-29  Doug Kwan  <dougkwan@google.com>
5502
5503         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5504         output_local_symbol_count_needs_update_.
5505         (Arm_relobj::output_local_symbol_count_needs_update,
5506          Arm_relobj::set_output_local_symbol_count_needs_update,
5507          Arm_relobj::update_output_local_symbol_count): New methods.
5508         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5509         member.
5510         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5511         of pointed function as in a R_ARM_PREL31 relocation.
5512         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5513         for output local symbol count updating.
5514         (Target_arm::do_relax): Update output local symbol counts in objects
5515         if necessary.
5516         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5517
5518 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5519
5520         * arm.cc: Added support for the ARM relocations:
5521         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5522         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5523         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5524         movw_prel_nc).
5525         (Arm_relocate_functions::movw_rel): New method.
5526         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5527         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5528         thm_movw_prel_nc).
5529         (Arm_relocate_functions::thm_movw_rel): New method.
5530         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5531         thm_movt_prel).
5532         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5533         relocations.
5534         (Target_arm::Scan::global): Likewise.
5535         (Target_arm::Relocate::relocate): Likewise.
5536         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5537         Likewise.
5538
5539 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5540
5541         * arm.cc: Added support for ARM group relocations.
5542         (Target_arm::reloc_needs_sym_origin): New method.
5543         (Arm_relocate_functions::calc_grp_kn): New method.
5544         (Arm_relocate_functions::calc_grp_residual): New method.
5545         (Arm_relocate_functions::calc_grp_gn): New method.
5546         (Arm_relocate_functions::arm_grp_alu): New Method.
5547         (Arm_relocate_functions::arm_grp_ldr): New Method.
5548         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5549         (Arm_relocate_functions::arm_grp_ldc): New Method.
5550         (Target_arm::Scan::local): Handle the ARM group relocations.
5551         (Target_arm::Scan::global): Likewise.
5552         (Target_arm::Relocate::relocate): Likewise.
5553         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5554         Likewise.
5555
5556 2010-01-26  Doug Kwan  <dougkwan@google.com>
5557
5558         * arm.cc (set): Include.
5559         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5560         pointer type.
5561         (Arm_output_section::Text_section_list): New type.
5562         (Arm_output_section::append_text_sections_to_list): New method.
5563         (Arm_output_section::fix_exidx_coverage): Ditto.
5564         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5565         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5566         Relobj::set_section_offset() instead of
5567         Sized_relobj::invalidate_section_offset().
5568         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5569         parameter for section headers. Ignore relocation sections for
5570         unallocated sections and EXIDX sections.
5571         (Target_arm::fix_exidx_coverage): New method.
5572         (Target_arm::output_section_address_less_than): New type.
5573         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5574         linked text section instead of the EXIDX section.
5575         (Arm_output_section::create_stub_group): Add an assertion to check
5576         that this is not an EXIDX output section.
5577         (Arm_output_section::append_text_sections_to_list): New method.
5578         (Arm_output_section::fix_exidx_coverage): Ditto.
5579         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5580         Arm_relobj::section_needs_reloc_stub_scanning.
5581         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5582         first pass.
5583         (Target_arm::fix_exidx_coverage): New method.
5584         * object.h (Relobj::set_output_section): New method.
5585         (Sized_relobj::invalidate_section_offset): Remove method.
5586         (Sized_relobj::do_invalidate_section_offset): Remove method.
5587         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5588
5589 2010-01-25  Doug Kwan  <dougkwan@google.com>
5590
5591         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5592         Fix warning due to signed and unsigned comparison on a 32-bit host.
5593
5594 2010-01-22  Doug Kwan  <dougkwan@google.com>
5595
5596         * arm.cc (Target_arm::do_relax): Record an output section for section
5597         offset adjustment it contains any stub table that has changed.
5598         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5599         offsets in an output section if necessary.
5600         * output.cc (Output_section::Output_section): Initialize
5601         section_offsets_need_adjustments_.
5602         (Output_section::add_input_section_for_script): Renamed to
5603         Output_section::add_simple_input_section.
5604         (Output_section::save_states): Add a comment.
5605         (Output_section::discard_states): New method defintion.
5606         (Output_section::adjust_section_offsets): Same.
5607         * output.h (Output_section::add_input_section_for_script): Renamed to
5608         Output_section::add_simple_input_section.
5609         (Output_section::discard_states): New method declaration.
5610         (Output_section::adjust_section_offsets): Same.
5611         (Output_section::section_offsets_need_adjustment,
5612         Output_section::set_section_offsets_need_adjustment): New method
5613         definitions.
5614         (Output_section::section_offsets_need_adjustment_): New data member.
5615         * script-sections.cc
5616         (Output_section_element_input::set_section_address): Adjust code for
5617         renaming of Output_section::add_input_section_for_script.
5618         (Orphan_output_section::set_section_address): Same.
5619
5620 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5621
5622         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5623         Fix_v4bx enum values .
5624         * gold/options.h (General_options): New option definitions.
5625         (General_options::fix_v4bx): New method.
5626         (General_options::Fix_v4bx): New enum.
5627         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5628         (General_options::parse_fix_v4bx_interworking): New method.
5629
5630 2010-01-22  Doug Kwan  <dougkwan@google.com>
5631
5632         * arm.cc (Arm_exidx_fixup): New class.
5633
5634 2010-01-21  Doug Kwan  <dougkwan@google.com>
5635
5636         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5637         classes.
5638         (Arm_exidx_section_offset_map): New type.
5639
5640 2010-01-21  Doug Kwan  <dougkwan@google.com>
5641
5642         * arm.cc (Arm_exidx_input_section): New class.
5643         (Arm_relobj::exidx_input_section_by_link,
5644         Arm_relobj::exidx_input_section_by_shndx,
5645         Arm_relobj::make_exidx_input_section): New methods.
5646         (read_arm_attributes_section): Remove.
5647         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5648         information about them.
5649         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5650         to here.
5651
5652 2010-01-20  Doug Kwan  <dougkwan@google.com>
5653
5654         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5655         Input_section_specifier to Section_id.
5656         (Target_arm::new_arm_input_section: Adjust code for change of key
5657         type.
5658         (Target_arm::find_arm_input_section): Ditto.
5659         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5660         (Section_id): Remove.
5661         (Garbage_collection::Section_id_hash): Remove.
5662         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5663         (Section_id): Remove.
5664         (Icf::Section_id_hash): Remove.
5665         * object.h (Section_id, Const_section_id, Section_id_hash,
5666         Const_section_id_hash): New type definitions.
5667         * output.cc (Output_section::add_relaxed_input_section): Change to
5668         use Const_section_id instead of Input_section_specifier as key type.
5669         (Output_section::add_merge_input_section): Ditto.
5670         (Output_section::build_relaxation_map): Change to use Section_id
5671         instead of Input_section_specifier as key type.
5672         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5673         Ditto.
5674         (Output_section::convert_input_sections_to_relaxed_sections): Change
5675         to use Const_section_id instead of Input_section_specifier as key type.
5676         (Output_section::find_merge_section): Ditto.
5677         (Output_section::find_relaxed_input_section): Ditto.
5678         * output.h (Input_section_specifier): Remove class.
5679         (Output_section::Output_section_data_by_input_section_map): Change
5680         key type to Const_section_id.
5681         (Output_section::Output_relaxed_input_section_by_input_section_map):
5682         Ditto.
5683         (Output_section::Relaxation_map): Change key type to Section_id.
5684
5685 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5686
5687         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5688         (class Arm_v4bx_stub): New class.
5689         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5690         (Stub_factory::make_arm_v4bx_stub): New method.
5691         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5692         (Stub_table::empty): Handle v4bx stubs.
5693         (Stub_table::add_arm_v4bx_stub): New method.
5694         (Stub_table::find_arm_v4bx_stub): New method.
5695         (Arm_relocate_functions::v4bx): New method.
5696         (Target_arm::fix_v4bx): New method.
5697         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5698         (Stub_table::relocate_stubs): Likewise.
5699         (Stub_table::do_write): Likewise.
5700         (Stub_table::update_data_size_and_addralign): Likewise.
5701         (Stub_table::finalize_stubs):  Likewise.
5702         (Target_arm::Scan::local): Likewise.
5703         (Target_arm::Scan::global): Likewise.
5704         (Target_arm::do_finalize_sections): Likewise.
5705         (Target_arm::Relocate::relocate): Likewise.
5706         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5707         Likewise.
5708         (Target_arm::scan_reloc_for_stub): Likewise.
5709         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5710
5711 2010-01-19  Ian Lance Taylor  <iant@google.com>
5712
5713         * output.cc (Output_section_headers::do_sized_write): Write large
5714         segment count to sh_info field.
5715         (Output_file_header::do_sized_write): For large segment count,
5716         write PN_XNUM to e_phnum field.
5717
5718 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5719
5720         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5721         (Arm_relocate_functions::thm_jump8): New function.
5722         (Arm_relocate_functions::thm_jump11): New function.
5723         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5724         R_ARM_THM_JUMP11.
5725         (Target_arm::Scan::global): Likewise.
5726         (Target_arm::Relocate::relocate): Likewise.
5727         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5728         Likewise.
5729
5730 2010-01-14  Doug Kwan  <dougkwan@google.com>
5731
5732         * arm.cc (map, utility): Include headers.
5733         (Target_arm::apply_cortex_a8_workaround): New method.
5734         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5735         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5736         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5737         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5738         the --[no-]fix-cortex-a8 command line options.
5739         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5740         (Target_arm::relocate_stub): Use addend in instruction template.
5741         * options.h (DEFINE_bool): Set the user-set flag.
5742         (General_options): Add --[no-]-fix-cortex options.
5743         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5744         : Update fast look-up map after conversion.
5745
5746 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5747
5748         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5749         in the first pass of do_layout.
5750
5751 2010-01-13  Doug Kwan  <dougkwan@google.com>
5752
5753         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5754         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5755         apparent compiler problem of not folding static constant integral
5756         data members of elfcpp::Elf_sizes<32>.
5757
5758 2010-01-13  Doug Kwan  <dougkwan@google.com>
5759
5760         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5761         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5762         Arm_relobj::scan_section_for_cortex_a8_erratum,
5763         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5764         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5765         sections to scan for relocation stubs into a new method
5766         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5767         relocation and Cortex-A8 stub scanning.
5768         (Target_arm::do_relax): Force stubs to be after stubbed sections
5769         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5770         the beginning of a new relaxation pass.  Update a comment.
5771         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5772
5773 2010-01-12  Ian Lance Taylor  <iant@google.com>
5774
5775         * target-reloc.h (visibility_error): New inline function.
5776         (relocate_section): Call visibility_error.
5777         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5778         (MOSTLYCLEANFILES): Likewise.
5779         (protected_4_pic.o, protected_3.err): New targets.
5780         * testsuite/protected_4.cc: New file.
5781
5782 2010-01-12  Doug Kwan  <dougkwan@google.com>
5783
5784         * arm.cc (Cortex_a8_reloc): New class.
5785         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5786         and cortex_a8_relocs_info_.
5787         (Target_arm::fix_cortex_a8): New method definition.
5788         (Target_arm::Cortex_a8_relocs_info): New type.
5789         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5790         New data member declarations.
5791         (Target_arm::scan_reloc_for_stub): Record information about
5792         relocations for THUMB branches that might be exempted from the
5793         Cortex-A8 workaround.
5794         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5795         at the beginning of a relaxation pass.
5796
5797 2010-01-12  Doug Kwan  <dougkwan@google.com>
5798
5799         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5800         (Arm_relobj::Mapping_symbol_position,
5801          Arm_reloj::Mapping_symbol_position_less,
5802          Arm_relobj::Mapping_symbols_info): New types.
5803         (Target_arm::is_mapping_symbol_name): New method definition.
5804         (Arm_relobj::do_count_local_symbols): Save information about mapping
5805         symbols.
5806
5807 2010-01-11  Doug Kwan  <dougkwan@google.com>
5808
5809         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5810         Arm_relocate_functions::thumb32_branch_upper,
5811         Arm_relocate_functions::thumb32_branch_lower,
5812         Arm_relocate_functions::thumb32_cond_branch_offset,
5813         Arm_relocate_functions::thumb32_cond_branch_upper,
5814         Arm_relocate_functions::thumb32_cond_branch_lower,
5815         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5816         branch offset encoding.
5817         (Arm_relocate_functions::thumb_branch_common): Use new branch
5818         offset encoding methods to avoid code duplication.
5819         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5820         (Stub_addend_reader::operator()): Use new branch encoding method
5821         to avoid code duplication.
5822
5823 2010-01-11  Doug Kwan  <dougkwan@google.com>
5824
5825         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5826         (Target_arm::do_finalize_sections): Define special EXIDX section
5827         symbols only if referenced.
5828         * gc.h (Garbage_collection::add_reference): New method.
5829         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5830         code duplication.
5831
5832 2010-01-11  Ian Lance Taylor  <iant@google.com>
5833
5834         * script.cc (Version_script_info::build_expression_list_lookup):
5835         Change complaing about duplicate wildcard match from error to
5836         warning.
5837
5838         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5839         of 2009-12-30.
5840         (Version_script_info::Version_script_info): Initialize globs_,
5841         default_version_, default_is_global_, and exact_.  Don't
5842         initialize globals_ or locals_.
5843         (Version_script_info::build_lookup_tables): Build local symbols
5844         first.
5845         (Version_script_info::unquote): New function.
5846         (Version_script_info::add_exact_match): New function.
5847         (Version_script_info::build_expression_list_lookup): Remove lookup
5848         parameter.  Add is_global parameter.  Change all callers.  Handle
5849         wildcard pattern specially.  Unquote pattern.  Call
5850         add_exact_match.
5851         (Version_script_info::get_name_to_match): New function.
5852         (Version_script_info::get_symbol_version): New function.
5853         (Version_script_info::get_symbol_version_helper): Remove.
5854         (Version_script_info::check_unmatched_names): Call unquote.
5855         * script.h (class Version_script_info): Change get_symbol_version
5856         to be non-inline and add is_global parameter; change all callers.
5857         Rewrite symbol_is_local.  Update declarations.  Define struct
5858         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5859         Remove globals_ and locals_ members.  Add exact_, globs_,
5860         default_version_, is_global_.
5861         (Version_script_info::Glob): Remove pattern, add expression and
5862         is_global.  Update constructor.  Change all callers.
5863         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5864         default version.
5865         (Versions::symbol_section_contents): If a symbol is undefined, or
5866         defined in a dynamic object, set the version index to
5867         VER_NDX_LOCAL.
5868         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5869         symbol_is_local.
5870         (Symbol_table::add_from_pluginobj): Likewise.
5871         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5872
5873 2010-01-11  Doug Kwan  <dougkwan@google.com>
5874
5875         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5876         (incremental_dump_LDADD): Add linking option for libintl.
5877         * Makefile.in: Regenerate.
5878
5879 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5880
5881         PR gold/11144
5882         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5883         instead of -Ds.
5884         * testsuite/Makefile.in: Regenerated.
5885
5886 2010-01-10  Doug Kwan  <dougkwan@google.com>
5887
5888         * options.h (DEFINE_var): Use parentheses around argument varname__
5889         in macro body to avoid any unintended subsequent substitutions.
5890
5891 2010-01-10  Ian Lance Taylor  <iant@google.com>
5892
5893         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5894         candidates before doing symbol resolution.
5895
5896         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5897         ODR candidates if only one is weak.
5898
5899 2010-01-08  Ian Lance Taylor  <iant@google.com>
5900
5901         * script.cc (Version_script_info::build_expression_list_lookup):
5902         Don't warn about ambiguous version, just record the ambiguity.
5903         (Version_script_info::get_symbol_version_helper): Give error if
5904         version is ambiguous.
5905
5906 2010-01-08  Doug Kwan  <dougkwan@google.com>
5907
5908         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5909           prev_data_size_ and prev_addralign_.  Remove initializer for
5910           deleted data member has_been_changed_.
5911           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5912           to determine if the table is empty.
5913           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5914           Remove.
5915           (Stub_table::add_reloc_stub): Define method in class definition
5916           instead of just declaring it there.
5917           (Stub_table::add_cortex_a8_stub): New method definition.
5918           (Stub_table::update_data_size_and_addralign): Ditto.
5919           (Stub_table::finalize_stubs): Ditto.
5920           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5921           (Stub_table::do_addralign_): Return address alignment in the
5922           (Stub_table::do_reset_address_and_file_offset): Define method in
5923           class definition instead of declaring it there.  Set current data
5924           size to be the data size of the previous pass.
5925           (Stub_table::set_final_data_size): Use current data size as the
5926           final data size.
5927           (Stub_table::relocate_stub): Change parameter type of stub from
5928           Reloc_stub pointer to Stub pointer.
5929           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5930           (Stub_table::Cortex_a8_stub_list): New typedef.
5931           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5932            Stub_table::prev_addralign_): New data member.
5933           (Arm_relobj::Arm_relobj): Initialize data member
5934           section_has_cortex_a8_workaround_.
5935           (Arm_relobj::section_has_cortex_a8_workaround,
5936            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5937            definitions.
5938           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5939           declarations.
5940           (Target_arm::relocate_stub): Change parameter type of stub from
5941           Reloc_stub pointer to Stub pointer.
5942           (Insn_template::size, Insn_template::alignment): Handle
5943           THUMB16_SPECIAL_TYPE.
5944           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5945            Stub_table::update_data_size_and_addralign,
5946            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5947           definitions.
5948           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5949           (Stub_table::do_write): Ditto.
5950           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5951
5952 2010-01-08  Ian Lance Taylor  <iant@google.com>
5953
5954         PR 11108
5955         * symtab.h (class Symbol): Remove fields is_target_special_ and
5956         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5957         (Symbol::is_defined_in_discarded_section): New function.
5958         (Symbol::set_is_defined_in_discarded_section): New function.
5959         (Symbol::has_plt_offset): Rewrite.
5960         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5961         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5962         Don't initialize is_target_special_ or has_plt_offset_.
5963         Initialize is_defined_in_discarded_section_.
5964         (Symbol_table::add_from_relobj): If appropriate, set
5965         is_defined_in_discarded_section.
5966         * resolve.cc (Symbol::override_base_with_special): Don't test
5967         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5968         * target-reloc.h (relocate_section): Do special handling for
5969         symbols defined in discarded sections for global symbols as well
5970         as local symbols.
5971
5972 2010-01-08  Ian Lance Taylor  <iant@google.com>
5973
5974         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5975         the SHT_SYMTAB case.
5976
5977 2010-01-08  Ian Lance Taylor  <iant@google.com>
5978
5979         * object.cc (Sized_relobj::do_layout): Don't get confused if
5980         layout_eh_frame returns NULL.
5981
5982 2010-01-08  Ian Lance Taylor  <iant@google.com>
5983
5984         PR 11084
5985         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5986         dynamic symbol table, use the normal symbol table.
5987         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5988         symbol table.
5989
5990 2010-01-08  Ian Lance Taylor  <iant@google.com>
5991
5992         PR 11072
5993         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5994         sections.
5995
5996 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5997
5998         * version.cc (print_version): Change to "Copyright 2010".
5999
6000 2010-01-08  Ian Lance Taylor  <iant@google.com>
6001
6002         PR 10287
6003         PR 11063
6004         * i386.cc (class Target_i386): Change return type of plt_section
6005         to be non-const.
6006         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6007         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6008         tls_desc_rel_ field.
6009         (Output_data_plt_i386::rel_tls_desc): New function.
6010         (Target_i386::rel_tls_desc_section): New function.
6011         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6012         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6013         R_386_TLS_DESC reloc in rel_tls_desc_section.
6014         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6015         Define struct Tlsdesc_info.
6016         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6017         (Target_x86_64::do_reloc_symbol_index): New function.
6018         (Target_x86_64::add_tlsdesc_info): New function.
6019         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6020         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6021         tlsdesc_rel_ field.
6022         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6023         all callers.
6024         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6025         (Target_x86_64::rela_tlsdesc_section): New function.
6026         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6027         handling.
6028         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6029         (Target_x86_64::do_reloc_addend): New function.
6030         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6031         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6032         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6033         (Output_reloc::type): New function.
6034         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6035         (Output_reloc::is_target_specific): New function.
6036         (Output_reloc::target_arg): New function.
6037         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6038         absolute relocs and target specific relocs.
6039         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6040         add_target_specific.
6041         (class Output_data_reloc) [SHT_RELA]: Likewise.
6042         * output.cc (Output_reloc::Output_reloc): Add four new versions
6043         for absolute relocs and target specific relocs.
6044         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6045         (Output_reloc::get_symbol_index): Likewise.
6046         (Output_reloc::local_section_offset): Check that local_sym_index_
6047         is not TARGET_CODE or 0.
6048         (Output_reloc::symbol_value): Likewise.
6049         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6050         reloc.
6051         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6052         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6053         functions.
6054         * layout.cc (add_target_dynamic_tags): Use output section for
6055         DT_PLTRELSZ and DT_JMPREL.
6056
6057 2010-01-07  Ian Lance Taylor  <iant@google.com>
6058
6059         PR 11061
6060         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6061         function.
6062         (class Output_data_reloc_generic): Define.
6063         (class Output_data_reloc_base): Change base class to
6064         Output_data_reloc_generic.  Change add() method to call
6065         bump_relative_reloc_count for a relative reloc.  Remove
6066         sort_relocs_ field.
6067         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6068         to sort_relocs().
6069         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6070         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6071         appropriate.
6072         * layout.h (class Layout): Update declaration.
6073
6074 2010-01-07  Ian Lance Taylor  <iant@google.com>
6075
6076         * output.h (class Output_data): Add const version of
6077         output_section and do_output_section.
6078         (class Output_section_data): Add const version of
6079         do_output_section.
6080         (class Output_section): Likewise.
6081         * layout.cc (Layout::add_target_dynamic_tags): New function.
6082         * layout.h (class Layout): Update declarations.
6083         * arm.cc (Target_arm::do_finalize_sections): Use
6084         add_target_dynamic_tags.
6085         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6086         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6087         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6088         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6089
6090 2010-01-07  Ian Lance Taylor  <iant@google.com>
6091
6092         PR 11042
6093         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6094         object as needed.
6095
6096 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6097             Ian Lance Taylor  <iant@google.com>
6098
6099         PR 11019
6100         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6101         Xindex::read_symtab_xindex.
6102
6103 2010-01-07  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6106         (Insn_template::thumb16_bcond_insn): New method declaration.
6107         (Insn_template): Fix spelling.
6108         (Stub::thumb16_special): New method declaration.
6109         (Stub::do_write): Define virtual method which was previously pure
6110         virtual.
6111         (Stub::do_thumb16_special): New method declaration.
6112         (Stub::do_fixed_endian_write): New template member.
6113         (Reloc_stub::do_write): Remove.
6114         (Reloc_stub::do_fixed_endian_write): Remove.
6115         (Cortex_a8_stub): New class definition.
6116         (Stub_factory::make_cortex_a8_stub): New method definition.
6117         (Stub_factory::Stub_factory): Add missing static storage class
6118         qualifier for elf32_arm_stub_a8_veneer_blx.
6119
6120 2010-01-07  Ian Lance Taylor  <iant@google.com>
6121
6122         PR 10980
6123         * options.h (class General_options): Add --warn-unresolved-symbols
6124         and --error-unresolved-symbols.
6125         * errors.cc (Errors::undefined_symbol): Implement
6126         --warn-unresolved-symbols.
6127
6128         * options.h (class General_options): Add -z text and -z textoff.
6129         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6130
6131 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6132
6133         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6134         (Garbage_collection::cident_sections): New function.
6135         (Garbage_collection::add_cident_section): New function.
6136         (Garbage_collection::cident_sections_): New member.
6137         (gc_process_relocs): Add references to sections whose names are C
6138         identifiers.
6139         * gold.h (cident_section_start_prefix): New constant.
6140         (cident_section_stop_prefix): New constant.
6141         (is_cident): New function.
6142         * layout.cc (Layout::define_section_symbols): Replace string constants
6143         with the newly defined constants.
6144         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6145         C identifiers.
6146         * testsuite/Makefile.am: Add gc_orphan_section_test.
6147         * testsuite/Makefile.in: Regenerate.
6148         * testsuite/gc_orphan_section_test.cc: New file.
6149         * testsuite/gc_orphan_section_test.sh: New file.
6150
6151 2010-01-06  Ian Lance Taylor  <iant@google.com>
6152
6153         PR 10980
6154         * options.h (class General_options): Add --warn-shared-textrel.
6155         * layout.cc (Layout::finish_dynamic_section): Implement
6156         --warn-shared-textrel.
6157
6158         PR 10980
6159         * options.h (class General_options): Add --warn-multiple-gp.
6160
6161 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6162
6163         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6164         $(THREADSLIB) and $(LIBDL).
6165         * Makefile.in: Rebuild.
6166
6167 2010-01-06  Ian Lance Taylor  <iant@google.com>
6168
6169         PR 10980
6170         * options.cc (General_options::parse_section_start): New function.
6171         (General_options::section_start): New function.
6172         (General_options::General_options): Initialize all members.
6173         * options.h: Include <map>
6174         (class General_options): Add --section-start.  Add section_starts_
6175         member.
6176         * layout.cc (Layout::attach_allocated_section_to_segment): If
6177         --section-start was used, set the address of the segment.  Remove
6178         local sort_sections.
6179         (Layout::relaxation_loop_body): If the address of the load segment
6180         has been set by --section-start, don't use it.
6181         * output.h (Output_segment::update_flags_for_output_section): New
6182         function.
6183         * output.cc (Output_segment::add_output_section): Call
6184         update_flags_for_output_section.
6185
6186 2010-01-05  Ian Lance Taylor  <iant@google.com>
6187
6188         PR 10980
6189         * options.h (class General_options): Add --undefined-version.
6190         * script.cc (struct Version_expression): Add was_matched_by_symbol
6191         field.
6192         (Version_script_info::matched_symbol): New function.
6193         (Version_script_info::get_symbol_version_helper): Call
6194         matched_symbol.
6195         (Version_script_info::check_unmatched_names): New function.
6196         * script.h (class Version_script_info): Update declarations.
6197         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6198
6199         * options.h (class General_options): Use DEFINE_bool_alias for
6200         allow_multiple_definition.
6201         * resolve.cc (Symbol_table::should_override): Don't test
6202         allow_multiple_definition.
6203
6204         PR 10980
6205         * options.h (class General_options): Add --cref.
6206         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6207         until after printing cref table.
6208         * cref.cc: Include "symtab.h".
6209         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6210         (Cref_table_compare::operator()): New function.
6211         (Cref_inputs::gather_cref): New function.
6212         (filecol): New static const.
6213         (Cref_inputs::print_cref): New function.
6214         (Cref::print_cref): New function.
6215         * cref.h: Include <cstdio>.
6216         (class Cref): Update declarations.
6217         * mapfile.h (Mapfile::file): New function.
6218         * object.h (class Object): Define Symbols.  Declare virtual
6219         do_get_global_symbols.
6220         (Object::get_global_symbols): New function.
6221         * object.cc (Input_objects::add_object): Pass object to cref_ if
6222         --cref.
6223         (Input_objects::archive_start): Likewise.
6224         (Input_objects::archive_stop): Likewise.
6225         (Input_objects::print_cref): New function.
6226         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6227         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6228         --cref.
6229         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6230         function.
6231         * plugin.h (class Sized_pluginobj): Update declarations.
6232
6233 2010-01-05  Ian Lance Taylor  <iant@google.com>
6234
6235         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6236         to is_default_version.  Rename insdef to insdefault.
6237         (Symbol_table::add_from_relobj): Rename def to is_default_version
6238         and local to is_forced_local.
6239         (Symbol_table::add_from_pluginobj): Likewise.
6240         (Symbol_table::add_from_dynobj): Likewise.
6241         (Symbol_table::define_special_symbol): Rename insdef to
6242         insdefault.
6243
6244 2010-01-04  Ian Lance Taylor  <iant@google.com>
6245
6246         PR 10980
6247         * options.h (class General_options): Add
6248         --allow-multiple-definition and -z muldefs.
6249         * resolve.cc (Symbol_table::should_override): Don't warn about a
6250         multiple symbol definition if --allow-multiple-definition or -z
6251         muldefs.
6252
6253         PR 10980
6254         * options.h (class General_options): Add --add-needed and
6255         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6256         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6257         error if --copy-dt-needed-entries aka --add-needed is used and
6258         would cause a change in behaviour.
6259
6260         PR 10980
6261         * options.h (class General_options): Add -G as a short version of
6262         --shared.  Add no-op options -assert, -g, and -i.
6263
6264 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6265
6266         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6267         check for .text or .gnu.linkonce.t sections.
6268         * icf.cc (Icf::find_identical_sections): Ditto.
6269         Change the detection for mangled function name within the section
6270         name.
6271         * icf.h (is_section_foldable_candidate): New function.
6272
6273 2009-12-30  Ian Lance Taylor  <iant@google.com>
6274
6275         PR 10980
6276         * options.h (class General_options): Permit two dashes with
6277         --retain-symbols-file.
6278
6279 2009-12-30  Ian Lance Taylor  <iant@google.com>
6280
6281         PR 10979
6282         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6283         don't put the file header and segment headers in the text
6284         segment.
6285
6286         PR 10979
6287         * common.cc (Sort_commons::operator()): Stabilize sort when both
6288         entries are NULL.
6289         (Symbol_table::do_allocate_commons_list): When allocating common
6290         symbols, skip a symbol which is no longer common.
6291         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6292         an object before checking its type.
6293         * testsuite/common_test_2.c: New file.
6294         * testsuite/common_test_3.c: New file.
6295         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6296         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6297         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6298         (common_test_2_pic.o, common_test_2.so): New targets.
6299         (common_test_3_pic.o, common_test_3.so): New targets.
6300         * testsuite/Makefile.in: Rebuild.
6301
6302         PR 10979
6303         * script.cc (read_input_script): If we see a new SECTIONS clause,
6304         and we have added an input section, give an error.
6305         * layout.h (class Layout): Add have_added_input_section function.
6306         Add have_added_input_section_ field.
6307         * layout.cc (Layout::Layout): Initialize
6308         have_added_input_section_.
6309         (Layout::layout): Set have_added_input_section_.
6310         (Layout::layout_eh_frame): Likewise.
6311
6312 2009-12-30  Ian Lance Taylor  <iant@google.com>
6313
6314         PR 10931
6315         * options.h (class General_options): Add --sort-common option.
6316         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6317         * common.cc (Sort_common): Add sort_order parameter to
6318         constructor.  Add sort_order_ field.
6319         (Sort_commons::operator): Check sort_order_.
6320         (Symbol_table::allocate_commons): Determine the sort order.
6321         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6322         Change all callers.
6323         (Symbol_table::do_allocate_commons_list): Likewise.
6324
6325 2009-12-30  Ian Lance Taylor  <iant@google.com>
6326
6327         PR 10916
6328         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6329         symbols from this object, don't change the visibility of an
6330         undefined symbol.
6331         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6332
6333 2009-12-30  Ian Lance Taylor  <iant@google.com>
6334
6335         PR 10861
6336         * script.h (class Version_script_info): Define Language enum.
6337         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6338         new fields globals_, locals_, and is_finalized_.
6339         * script.cc: Various formatting fixes.
6340         (class Parser_closure): Change language_stack_ from a vector of
6341         std::string to one of Version_script_info::Language.  Adjust all
6342         uses accordingly.
6343         (class Lazy_demangler): Remove.
6344         (struct Version_expression): Change language from std::string to
6345         Version_script_info::Language.
6346         (Version_script_info::Version_script_info): New function.
6347         (Version_script_info::~Version_script_info): Don't call clear.
6348         (Version_script_info::finalize): New function.
6349         (Version_script_info::build_lookup_tables): New function.
6350         (Version_script_info::build_expression_list_lookup): New
6351         function.
6352         (Version_script_info::get_symbol_version_helper): Rewrite to use
6353         lookup tables.
6354         (Version_script_info::print_expression_list): Adjust to use
6355         Version_script_info::Language.
6356         (script_push_lex_into_version_mode): Check that the version script
6357         has not been finalized.
6358         (version_script_push_lang): Change language string to
6359         Version_script_info::Language.
6360         * options.cc (Command_line::version_script): New function.
6361         * options.h (class General_options): Add finalize_dynamic_list
6362         function.  Change version_script from declaration to definition.
6363         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6364         * testsuite/version_script.map: Remove duplicate def of foo.
6365         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6366         version_script.map.
6367         * testsuite/Makefile.in: Rebuild.
6368
6369 2009-12-30  Ian Lance Taylor  <iant@google.com>
6370
6371         PR 10843
6372         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6373         if the input symbol index is 0, make the output symbol index 0.
6374
6375 2009-12-30  Ian Lance Taylor  <iant@google.com>
6376
6377         PR 10670
6378         * options.h (class General_options): Add -x/--discard-all.
6379         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6380         --discard-all.  If the local symbol needs a dynamic entry, check
6381         that before handling --discard-locals.
6382
6383 2009-12-30  Ian Lance Taylor  <iant@google.com>
6384
6385         PR 10450
6386         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6387         flags to PF_R.
6388         (Output_segment::add_output_section): Don't change the flags if
6389         the type is PT_TLS.
6390
6391         PR 10450
6392         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6393         GNU hash table if they need a dynamic value.  Otherwise, don't add
6394         them if they are defined in a dynamic object or are forced local.
6395
6396 2009-12-29  Ian Lance Taylor  <iant@google.com>
6397
6398         PR 10450
6399         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6400         .gnu.hash table for a 32-bit target.
6401
6402         PR 10450
6403         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6404         regular and a dynamic object only needs a dynamic symbol table
6405         entry if it is externally visible.
6406
6407         PR 10450
6408         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6409         constructor.  Add global_offset_table_ field.
6410         (Target_i386::got_section): Set global_offset_table_.
6411         (Target_i386::do_finalize_sections): Set global_offset_table_
6412         size.
6413         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6414         in constructor.  Add global_offset_table_ field.
6415         (Target_x86_64::got_section): Set global_offset_table_.
6416         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6417         size.
6418
6419         * layout.cc (Layout::Layout): Initialize increase_relro_.
6420         (Layout::get_output_section): Add is_relro, is_last_relro, and
6421         is_first_non_relro parameters.  Change all callers.
6422         (Layout::choose_output_section): Likewise.
6423         (Layout::add_output_section_data): Likewise.
6424         (Layout::make_output_section): Likewise.
6425         (Layout::set_segment_offsets): Clear increase_relro when using a
6426         linker script.
6427         * layout.h (class Layout): Add increase_relro method.  Add
6428         increase_relro_ field.  Update declarations.
6429         * output.cc (Output_section::Output_section): Initialize
6430         is_last_relro_ and is_first_non_relro_.
6431         (Output_segment::add_output_section): Group relro sections is
6432         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6433         (Output_segment::maximum_alignment): Remove relro handling.
6434         (Output_segment::set_section_addresses): Add increase_relro
6435         parameter.  Change all callers.  Add initial alignment to align
6436         relro sections on separate page.  Remove old relro handling.
6437         (Output_segment::set_section_list_addresses): Remove in_relro
6438         parameter.  Change all callers.
6439         (Output_segment::set_offset): Add increase parameter.  Change all
6440         callers.  Remove old relro handling.
6441         * output.h (class Output_section): Add new methods: is_last_relro,
6442         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6443         Add is_last_relro_ and is_first_non_relro_ fields.
6444         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6445         Create separate .got.plt section.  Call increase_relro.
6446         * x86_64.cc (Target_x86_64::got_section): Likewise.
6447         * testsuite/relro_script_test.t: Add .got.plt.
6448
6449         PR 10450
6450         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6451         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6452         (Layout::finalize): Call set_dynamic_symbol_size.
6453         (Layout::set_dynamic_symbol_size): New function.
6454         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6455         set_dynamic_symbol_size.
6456
6457         PR 10450
6458         * output.h (class Output_section): Add is_entsize_zero_ field.
6459         * output.cc (Output_section::Output_section): Initialize
6460         is_entsize_zero_.
6461         (Output_section::set_entsize): If two different entsizes are
6462         requested, force it to zero.
6463         (Output_section::add_input_section): Set flags for .debug_str
6464         before updating section flags.  Set entsize.
6465         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6466         and SHF_STRING if all input sections have those flags.
6467
6468 2009-12-29   Rafael Espindola  <espindola@google.com>
6469
6470         * main.cc (main): Fix the sys time reporting.
6471         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6472         reporting.
6473
6474 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6475
6476         * options.cc (General_options::parse_version): Allow -v to exit
6477         without an error if there is nothing to link.
6478
6479 2009-12-29  Ian Lance Taylor  <iant@google.com>
6480
6481         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6482         using a version of gcc before 4.1.
6483         * configure: Rebuild.
6484
6485 2009-12-28  Chris Demetriou  <cgd@google.com>
6486
6487         * attributes.cc (Output_attributes_section_data::do_write): Use
6488         std::vector::front rather than std::vector::data.
6489
6490 2009-12-28  Ian Lance Taylor  <iant@google.com>
6491
6492         * symtab.h (class Symbol_table): Add enum Defined.
6493         * resolve.cc (Symbol_table::should_override): Add defined
6494         parameter.  Change all callers.  Test whether object is NULL
6495         before calling a method on it.
6496         (Symbol_table::report_resolve_problem): Add defined parameter.
6497         Change all callers.
6498         (Symbol_table::should_override_with_special): Likewise.
6499         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6500         parameter.  Change all callers.
6501         (Symbol_table::do_define_in_output_data): Likewise.
6502         (Symbol_table::define_in_output_segment): Likewise.
6503         (Symbol_table::do_define_in_output_segment): Likewise.
6504         (Symbol_table::define_as_constant): Likewise.
6505         (Symbol_table::do_define_as_constant): Likewise.
6506         * script.h (class Symbol_assignment): Add is_defsym parameter to
6507         constructor; change all callers.
6508         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6509         parameter.  Change all callers.  Add is_defsym_ field.
6510         (class Parser_closure): Add parsing_defsym parameter to
6511         constructor; change all callers.  Add parsing_defsym accessor
6512         function.  Add parsing_defsym_ field.
6513
6514 2009-12-28  Ian Lance Taylor  <iant@google.com>
6515
6516         * gold.cc (queue_middle_tasks): Fix formatting.
6517         * object.cc (Relobj::is_section_name_included): Likewise.
6518
6519 2009-12-23  Ian Lance Taylor  <iant@google.com>
6520
6521         * i386.cc (Target_i386::do_calls_non_split): Recognize
6522         -fsplit-stack prologue for a function with a static chain.
6523         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6524         -fsplit-stack prologue when using %r11.
6525
6526 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6527
6528         * options.cc (General_options::parse_version): Make -v continue and do
6529         the link like GNU ld does.
6530
6531 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6532
6533         * Makefile.am (CCFILES): Add timer.cc.
6534         (HFILES): Add timer.h.
6535         * configure.ac: Check for sysconf and times.
6536         * main.cc: include timer.h.
6537         (main): Use Timer instead of get_run_time.
6538         * timer.cc: New.
6539         * timer.h: New.
6540         * workqueue.cc: include timer.h.
6541         (Workqueue::find_and_run_task):
6542         Report user, sys and wall time.
6543         * Makefile.in: Regenerate.
6544         * config.in: Regenerate.
6545         * configure: Regenerate.
6546
6547 2009-12-16  Doug Kwan  <dougkwan@google.com>
6548
6549         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6550         sections.
6551         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6552         relaxed input sections.
6553         * output.cc (Output_section::find_relaxed_input_section): Change
6554         return type to Output_relaxed_input_section pointer.  Adjust code
6555         for new type of relaxed_input_section_map_.
6556         * output.h (Output_section::find_relaxed_input_section): Change
6557         return type to Output_relaxed_input_section pointer.
6558         (Output_section::Output_relaxed_input_section_by_input_section_map):
6559         New type.
6560         (Output_section::relaxed_input_section_map_): Change type to
6561         Output_section::Output_relaxed_input_section_by_input_section_map.
6562         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6563         input section.
6564
6565 2009-12-15  Ian Lance Taylor  <iant@google.com>
6566
6567         * layout.cc (Layout::create_shstrtab): Only write out after input
6568         sections if we are compressing debug sections.
6569
6570 2009-12-15  Ian Lance Taylor  <iant@google.com>
6571
6572         * archive.cc (Archive::add_symbols): Only look up a symbol without
6573         a version if there is, in fact, a version.
6574
6575 2009-12-14  Ian Lance Taylor  <iant@google.com>
6576
6577         Revert -Wshadow changes, all changes from:
6578         2009-12-11  Doug Kwan  <dougkwan@google.com>
6579         2009-12-11  Nick Clifton  <nickc@redhat.com>
6580         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6581
6582 2009-12-11  Doug Kwan  <dougkwan@google.com>
6583
6584         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6585         due to -Wshadow.
6586         * attributes.cc (Object_attribute::size): Ditto.
6587         (Attributes_section_data::size): Ditto.
6588         (Attributes_section_data::Attributes_section_data): Ditto.
6589         (Output_attributes_section_data::do_write): Ditto.
6590         * attributes.h (Object_attribute::set_type): Ditto.
6591         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6592
6593 2009-12-11  Nick Clifton  <nickc@redhat.com>
6594
6595         * archive.cc: Fix shadowed variable warnings.
6596         * arm.cc: Likewise.
6597         * compressed_output.cc: Likewise.
6598         * compressed_output.h: Likewise.
6599         * configure: Likewise.
6600         * dwarf_reader.cc: Likewise.
6601         * dynobj.cc: Likewise.
6602         * dynobj.h: Likewise.
6603         * ehframe.cc: Likewise.
6604         * ehframe.h: Likewise.
6605         * errors.cc: Likewise.
6606         * expression.cc: Likewise.
6607         * fileread.cc: Likewise.
6608         * fileread.h: Likewise.
6609         * freebsd.h: Likewise.
6610         * i386.cc: Likewise.
6611         * icf.cc: Likewise.
6612         * incremental.h: Likewise.
6613         * layout.cc: Likewise.
6614         * layout.h: Likewise.
6615         * mapfile.cc: Likewise.
6616         * merge.cc: Likewise.
6617         * merge.h: Likewise.
6618         * object.cc: Likewise.
6619         * object.h: Likewise.
6620         * options.h: Likewise.
6621         * output.cc: Likewise.
6622         * output.h: Likewise.
6623         * parameters.cc: Likewise.
6624         * plugin.cc: Likewise.
6625         * powerpc.cc: Likewise.
6626         * reduced_debug_output.cc: Likewise.
6627         * reduced_debug_output.h: Likewise.
6628         * reloc.cc: Likewise.
6629         * reloc.h: Likewise.
6630         * resolve.cc: Likewise.
6631         * script-sections.cc: Likewise.
6632         * script.cc: Likewise.
6633         * script.h: Likewise.
6634         * sparc.cc: Likewise.
6635         * symtab.cc: Likewise.
6636         * symtab.h: Likewise.
6637         * target-select.cc: Likewise.
6638         * target-select.h: Likewise.
6639         * token.h: Likewise.
6640         * workqueue.cc: Likewise.
6641         * workqueue.h: Likewise.
6642         * x86_64.cc: Likewise.
6643
6644 2009-12-10  Doug Kwan  <dougkwan@google.com>
6645
6646         * arm.cc (attributes.h): New include.
6647         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6648         (Arm_relobj::~Arm_relobj): Delete object pointed by
6649         attributes_section_data_.
6650         (Arm_relobj::attributes_section_data): New method definition.
6651         (Arm_relobj::attributes_section_data_): New data member declaration.
6652         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6653         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6654         attributes_section_data_.
6655         (Arm_dynobj::attributes_section_data): New method definition.
6656         (Arm_dynobj::attributes_section_data_): New data member declaration.
6657         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6658         initialization value of may_use_blx_ to false.
6659         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6660         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6661         object attributes to compute results instead of hard-coding.
6662         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6663         Target_arm::get_secondary_compatible_arch,
6664         Target_arm::set_secondary_compatible_arch
6665         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6666         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6667         New method declarations.
6668         (Target_arm::get_aeabi_object_attribute): New method definition.
6669         (Target_arm::attributes_section_data_): New data member declaration.
6670         (read_arm_attributes_section): New template definition.
6671         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6672         (Arm_dynobj::do_read_symbols): Ditto.
6673         (Target_arm::do_finalize_sections): Merge attributes sections from
6674         input.  Check for BLX use after attributes section merging.
6675         Fix __exidx_start and __exidx_end visibility.  Create an
6676         .ARM.attributes section if necessary.
6677         (Target_arm::get_secondary_compatible_arch,
6678         Target_arm::set_secondary_compatible_arch,
6679         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6680         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6681         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6682         New method definitions.
6683
6684 2009-12-09  Ian Lance Taylor  <iant@google.com>
6685
6686         * plugin.cc (Plugin::load): Don't cast from void* to a function
6687         pointer.
6688
6689 2009-12-09  Ian Lance Taylor  <iant@google.com>
6690
6691         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6692         information fields.
6693
6694 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6695
6696         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6697         Replace two_file_shared_1.so with two_file_shared_2.so.
6698         * testsuite/Makefile.in: Regenerated.
6699
6700 2009-12-08  Doug Kwan  <dougkwan@google.com>
6701
6702         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6703         (HFILES): Add attributes.h and int_encoding.h.
6704         * Makefile.in: Regenerate.
6705         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6706         function definitions to int_encoding.cc
6707         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6708         prototypes to int_encoding.h
6709         * reduced_debug_output.cc (int_encoding.h): New include.
6710         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6711         function definitions to int_encoding.cc
6712         (insert_into_vector, read_from_pointer): Move template definitions to
6713         int_encoding.h
6714         * attributes.cc: New file.
6715         * attributes.h: New file.
6716         * int_encoding.cc: New file.
6717         * int_encoding.h: New file.
6718
6719 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6720
6721         PR gold/11055
6722         * incremental-dump.cc (dump_incremental_inputs): New.
6723         (main): Use dump_incremental_inputs.
6724
6725 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6726
6727         PR gold/10893
6728         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6729         checking elfcpp::STT_FUNC.
6730         (Target_i386::Relocate::relocate): Likewise.
6731         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6732
6733         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6734         symbols from shared libraries into normal FUNC symbols.
6735
6736         * symtab.h (Symbol): Add is_func and use it.
6737
6738 2009-12-05  Doug Kwan  <dougkwan@google.com>
6739
6740         * arm.cc (Target_arm::arm_info): Initialize new fields
6741         attributes_section and attributes_vendor.
6742         * i386.cc (Target_i386::i386_info): Same.
6743         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6744         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6745         fields attributes_section and attributes_vendor.
6746         * sparc.cc (Target_sparc::sparc_info): Same.
6747         * target.h (Target::attributes_section, Target::attributes_vendor,
6748         Target::is_attributes_section, Target::attribute_arg_type,
6749         Target::attributes_order): New method definitions.
6750         (Target::Target_info::attributes_section,
6751         Target::Target_info::attributes_vendor): New fields.
6752         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6753         virtual method definitions.
6754         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6755         attributes_section and attributes_vendor.
6756         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6757
6758 2009-12-05  Doug Kwan  <dougkwan@google.com>
6759
6760         * arm.cc: Update comments about interworking and stub generation.
6761         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6762         considered as non-PIC.
6763         (Arm_relocate_functions::base_abs): Fix formatting.
6764         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6765         of function to use GOT entry address instead of offset.
6766         (Target_arm::Scan::global): Issue an error if a symbol would need a
6767         PLT does not get one because it is untyped.  Remove code to create
6768         dynamic symbols for relative branches.
6769         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6770         takes unsigned integer instead of boolean.
6771
6772 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6773
6774         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6775         (two_file_test_LDADD): Likewise.
6776         (common_test_1_LDADD): Likewise.
6777         (exception_test_LDADD) Likewise.
6778         (weak_test_LDADD): Likewise.
6779         (many_sections_test_LDADD): Likewise.
6780         (initpri1_LDADD): Likewise.
6781         (script_test_1_LDADD): Likewise.
6782         (script_test_2_LDADD): Likewise.
6783         (justsyms_LDADD): Likewise.
6784         (binary_test_LDADD): Likewise.
6785         (large_LDADD): Likewise.
6786         * testsuite/Makefile.in: Regenerated.
6787
6788 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6789
6790         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6791         (Symbol_table::override_with_special): Likewise.
6792         (Symbol_table::add_from_object): Likewise.
6793
6794 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6795
6796         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6797         Don't set the data_offset twice.
6798
6799 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6800
6801         * testsuite/Makefile.in: Regenerate.
6802
6803 2009-12-03  Doug Kwan  <dougkwan@google.com>
6804
6805         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6806         (Target_arm::do_finalize_sections): Add parameter for symbol table
6807         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6808         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6809         parameter for symbol table pointer.
6810         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6811         an additional parameter for a pointer to symbol table.
6812         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6813         parameter for a symbol table pointer.
6814         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6815         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6816         Ditto.
6817         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6818         parameter for a symbol table pointer.
6819
6820 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6821
6822         * incremental.cc (Incremental_inputs_header)
6823         (Incremental_inputs_header_write, Incremental_inputs_entry)
6824         (Incremental_inputs_entry_write): Move ...
6825         * incremental.h (Incremental_inputs_header)
6826         (Incremental_inputs_header_write, Incremental_inputs_entry)
6827         (Incremental_inputs_entry_write): here.
6828
6829 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6830
6831         * incremental.cc (make_sized_incremental_binary): Set the target.
6832         Error if it is incompatible.
6833         * output.h (Output_file): Add filename method.
6834
6835 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6836
6837         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6838         from the get_* methods.
6839
6840 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6841
6842         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6843         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6844         Write 0 for the data_offset of scripts.
6845
6846 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6847
6848         * testsuite/Makefile.am: Add the incremental_test.sh test.
6849         * testsuite/incremental_test.sh: New.
6850         * testsuite/incremental_test_1.c: New.
6851         * testsuite/incremental_test_2.c: New.
6852
6853 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6854
6855        * incremental-dump.cc (main): Fix typos.
6856
6857 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6858
6859         PR gold/11025
6860         * incremental-dump.cc (main): Use llu to print 64 bit values.
6861
6862 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6863             H.J. Lu  <hongjiu.lu@intel.com>
6864
6865         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6866         $(LIBDL).
6867         (incremental_dump_LDADD): Likewise.
6868         * Makefile.in: Regenerated.
6869
6870 2009-11-25  Doug Kwan  <dougkwan@google.com>
6871
6872         Revert:
6873
6874         2009-11-25  Doug Kwan  <dougkwan@google.com>
6875
6876                 * arm.cc (Target_arm::Target_arm): Move method definition
6877                 outside of class definition.  Add code to handle
6878                 --target1-rel, --target1-abs and --target2= options.
6879                 (Target_arm::get_reloc_reloc_type): Change method to be
6880                 non-static and const.
6881                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6882                 New data member declaration.
6883                 (Target_arm::Scan::local, Target_arm::Scan::global,
6884                 Target_arm::Relocate::relocate,
6885                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6886                 Adjust call to Target_arm::get_real_reloc_type.
6887                 (Target_arm::get_real_reloc_type): Use command line options
6888                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6889                 * options.h (--target1-rel, --target1-abs, --target2): New
6890                 ARM-only options.
6891
6892 2009-11-25  Doug Kwan  <dougkwan@google.com>
6893
6894         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6895         class definition.  Add code to handle --target1-rel, --target1-abs
6896         and --target2= options.
6897         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6898         and const.
6899         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6900         member declaration.
6901         (Target_arm::Scan::local, Target_arm::Scan::global,
6902         Target_arm::Relocate::relocate,
6903         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6904         call to Target_arm::get_real_reloc_type.
6905         (Target_arm::get_real_reloc_type): Use command line options to
6906         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6907         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6908         options.
6909
6910 2009-11-25  Doug Kwan  <dougkwan@google.com>
6911
6912         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6913         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6914         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6915         formatting.
6916         (Arm_relocate_functions::thm_call): Replace body with a call to
6917         Arm_relocate_functions::thumb_branch_common.
6918         (Arm_relocate_functions::thm_jump24,
6919         Arm_relocate_functions::thm_xpc22): New method definitions.
6920         (Arm_relocate_functions::thumb_branch_common): New method definition.
6921         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6922         operator.
6923         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6924         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6925
6926 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6927
6928         * Makefile.am: Build incremental-dump
6929         * Makefile.in: Regenerate.
6930         * incremental-dump.cc: New.
6931         * incremental.cc (Incremental_inputs_header_data,
6932         Incremental_inputs_entry_data): Move to incremental.h
6933         * incremental.h: (Incremental_inputs_header_data,
6934         Incremental_inputs_entry_data): Move from incremental.cc
6935
6936 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6937
6938         * incremental.cc (Incremental_inputs_header,
6939         Incremental_inputs_header_write, Incremental_inputs_entry,
6940         Incremental_inputs_entry_write): Add a typedef with the data type.
6941
6942 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6943
6944         * incremental.cc (Incremental_inputs_header,
6945         Incremental_inputs_header_write, Incremental_inputs_entry,
6946         Incremental_inputs_entry_write): Update comment about which
6947         type has the filed descriptions.
6948
6949 2009-11-15  Doug Kwan  <dougkwan@google.com>
6950
6951         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6952         (Arm_relocate_functions::arm_branch_common): Change method defintion
6953         in class definition to a method declaration and update list of formal
6954         parameters.
6955         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6956         Arm_relocation_functions::jump24): Adjust call to
6957         Arm_relocate_functions::arm_branch_common.  Update list of formal
6958         parameters.
6959         (Arm_relocate_functions::xpc25): New method definition.
6960         (Arm_relocate_functions::arm_branch_common): Move method defintion
6961         out from class definition.  Use stubs for mode-switching and extending
6962         branch ranges.
6963         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6964         specially.  Change code to enable use of stubs in ARM branches.
6965
6966 2009-11-10  Doug Kwan  <dougkwan@google.com>
6967
6968         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6969         in method declaration.
6970         (Target_arm::relocate_stub): New method declaration.
6971         (Target_arm::default_target): Change to return a pointer instead of
6972         a const reference.
6973         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6974         Target_arm::default_target.
6975         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6976         method definition.
6977         (Target_arm::relocate_section): Adjust view.
6978         (Target_arm::relocate_stub): New method definition.
6979
6980 2009-11-10  Doug Kwan  <dougkwan@google.com>
6981
6982         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6983         a format warning.
6984         * incremental.cc (open_incremental_binary): Initialized local
6985         variables to avoid warnings.
6986         * object.cc (make_elf_object): Ditto.
6987         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6988         a format warning.
6989
6990 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6991
6992         PR gold/10930
6993         * testsuite/plugin_test.c: Include "config.h".
6994
6995 2009-11-09  Doug Kwan  <dougkwan@google.com>
6996
6997         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6998         (arm_symbol_value): Remove.
6999         (Arm_relocate_functions::arm_branch_common,
7000         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7001         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7002         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7003         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7004         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7005         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7006         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7007         Arm_relocate_functions::thm_mobw_abs_nc,
7008         Arm_relocate_functions::thm_mov_abs,
7009         Arm_relocate_functions::movw_prel_nc,
7010         Arm_relocate_functions::thm_movt_abs,
7011         Arm_relocate_functions::movt_prel,
7012         Arm_relocate_functions::thm_movw_prel_nc,
7013         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7014         (Target_arm::Relocate::relocate): Only decompose address into two
7015         parts if relocation type uses the thumb-bit and pass the actual
7016         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7017         calls to methods in Arm_relocate_functions for this change.
7018
7019 2009-11-08  Ian Lance Taylor  <iant@google.com>
7020
7021         PR 10925
7022         * reloc.cc: Instantiate
7023         Sized_relobj::initialize_input_to_output_maps and
7024         Sized_relobj:free_input_to_output_maps.
7025
7026 2009-11-06  Ian Lance Taylor  <iant@google.com>
7027
7028         PR 10876
7029         * defstd.cc (in_segment): Set only_if_ref true for "end".
7030
7031 2009-11-06  Doug Kwan  <dougkwan@google.com>
7032
7033         * arm.cc (class Reloc_stub): Correct a comment.
7034         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7035         (Target_arm::scan_section_for_stubs): New method declaration.
7036         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7037         Change methods from private to protected.
7038         (Target_arm::do_may_relax): New method definition.
7039         (Target_arm::do_relax, Target_arm::group_sections,
7040         Target_arm::scan_reloc_for_stub,
7041         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7042         (Target_arm::arm_input_section_map_): New data member declaration.
7043         (Target_arm::scan_reloc_for_stub,
7044         Target_arm::scan_reloc_section_for_stubs,
7045         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7046         Target_arm::do_relax): New method definitions.
7047
7048 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7049
7050         * configure.ac: Check for (struct stat)::st_mtim
7051         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7052         * config.in: Regenerate.
7053         * configure: Regenerate.
7054
7055 2009-11-05  Ian Lance Taylor  <iant@google.com>
7056
7057         PR 10910
7058         * output.cc (Output_segment::add_output_section): Add missing
7059         return statement.
7060
7061 2009-11-04  Ian Lance Taylor  <iant@google.com>
7062
7063         PR 10880
7064         * object.h (class Object): Add is_needed and set_is_needed
7065         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7066         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7067         defined in a dynamic object and referenced by a regular object,
7068         set is_needed for the dynamic object.
7069         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7070         if the file is marked with as_needed and it is not needed.
7071
7072 2009-11-04  Ian Lance Taylor  <iant@google.com>
7073
7074         PR 10887
7075         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7076         tags if data is discarded by linker script.
7077         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7078         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7079         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7080         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7081
7082 2009-11-04  Ian Lance Taylor  <iant@google.com>
7083
7084         * layout.cc (Layout::get_output_section): Add is_interp and
7085         is_dynamic_linker_section parameters.  Change all callers.
7086         (Layout::choose_output_section): Likewise.
7087         (Layout::make_output_section): Likewise.
7088         (Layout::add_output_section_data): Add is_dynamic_linker_section
7089         parameter.  Change all callers.
7090         * layout.h (class Layout): Update declarations.
7091         * output.h (class Output_section): Add is_interp, set_is_interp,
7092         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7093         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7094         generate_code_fills_at_write_ to a bitfield.
7095         * output.cc (Output_section::Output_sections): Initialize new
7096         fields.
7097         (Output_segment::add_output_section): Add do_sort parameter.
7098         Change all callers.
7099
7100 2009-11-03  Ian Lance Taylor  <iant@google.com>
7101
7102         PR 10860
7103         * options.h (class General_options): Add --warn-common.
7104         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7105         merging two common symbols.
7106         (Symbol_table::should_override): Handle --warn-common when merging
7107         a common symbol with a defined symbol.  Use report_resolve_problem
7108         for multiple definitions.
7109         (Symbol_table::report_resolve_problem): New function.
7110         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7111
7112 2009-11-03  Doug Kwan  <dougkwan@google.com>
7113
7114         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7115         stub_factory_.
7116         (Target_arm::stub_factory): New method definition.
7117         (Target_arm::new_arm_input_section,
7118         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7119         Target_arm::reloc_uses_thumb_bit): New method declarations.
7120         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7121         New type definitions.
7122         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7123         member declarations.
7124         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7125         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7126         New method definitions.
7127
7128 2009-11-03  Ian Lance Taylor  <iant@google.com>
7129
7130         * options.h (class General_options): Add --warn_constructors.
7131
7132 2009-11-03  Ian Lance Taylor  <iant@google.com>
7133
7134         PR 10893
7135         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7136         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7137
7138 2009-11-03  Ian Lance Taylor  <iant@google.com>
7139
7140         PR 10895
7141         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7142         --msgid-bugs-address.
7143         (install-pdf): New target.
7144         (install-data_yes): Look up one directory to find mkinstalldirs.
7145
7146 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7147
7148         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7149         tree.
7150
7151 2009-10-30  Doug Kwan  <dougkwan@google.com>
7152
7153         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7154
7155 2009-10-30  Doug Kwan  <dougkwan@google.com>
7156
7157         * arm.cc (Stub_addend_reader): New struct template definition
7158         and partial specializations.
7159         (Stub_addend_reader::operator()): New method definition for a
7160         partially specialized template.
7161
7162 2009-10-30  Doug Kwan  <dougkwan@google.com>
7163
7164         * arm.cc (Arm_relobj::processor_specific_flags): New method
7165         definition.
7166         (Arm_relobj::do_read_symbols): New method declaration.
7167         (Arm_relobj::processor_specific_flags_): New data member declaration.
7168         (Arm_dynobj): New class definition.
7169         (Target_arm::do_finalize_sections): Add input_objects parameter.
7170         (Target_arm::do_adjust_elf_header): New method declaration.
7171         (Target_arm::are_eabi_versions_compatible,
7172         (Target_arm::merge_processor_specific_flags): New method declaration.
7173         (Target_arm::do_make_elf_object): New overloaded method definitions
7174         and declaration.
7175         (Arm_relobj::do_read_symbols): New method definition.
7176         (Arm_dynobj::do_read_symbols): Ditto.
7177         (Target_arm::do_finalize_sections): Add input_objects parameters.
7178         Merge processor-specific flags from all input objects.
7179         (Target_arm::are_eabi_versions_compatible,
7180         Target_arm::merge_processor_specific_flags,
7181         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7182         New method definitions.
7183         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7184         Input_objects pointer type parameter.
7185         * layout.cc (Layout::finalize): Pass input objects to target's.
7186         finalize_sections function.
7187         * output.cc (Output_file_header::do_sized_write): Set ELF file
7188         header's processor-specific flags.
7189         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7190         Input_objects pointer type parameter.
7191         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7192         * target.h (Input_objects): New forward class declaration.
7193         (Target::processor_specific_flags,
7194         Target::are_processor_specific_flags_sect): New method definitions.
7195         (Target::finalize_sections): Add input_objects parameter.
7196         (Target::Target): Initialize processor_specific_flags_ and
7197         are_processor_specific_flags_set_.
7198         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7199         parameter.
7200         (Target::set_processor_specific_flags): New method definition.
7201         (Target::processor_specific_flags_,
7202         Target::are_processor_specific_flags_set_): New data member
7203         declarations.
7204         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7205         Input_objects pointer type parameter.
7206
7207 2009-10-30  Doug Kwan  <dougkwan@google.com>
7208
7209         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7210
7211 2009-10-28  Ian Lance Taylor  <iant@google.com>
7212
7213         * object.h (class Relobj): Drop options parameter from
7214         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7215         do_scan_relocs, do_relocate.  Change all callers.
7216         (class Sized_relobj): Drop options parameters from
7217         do_gc_process_relocs, do_scan_relocs, do_relocate,
7218         do_relocate_sections, relocate_sections, emit_relocs_scan,
7219         emit_relocs_scan_reltype.  Change all callers.
7220         (struct Relocate_info): Remove options field and all references to
7221         it.
7222         * reloc.h (class Read_relocs): Remove options constructor
7223         parameter and options_ field.  Change all callers.
7224         (class Gc_process_relocs, class Scan_relocs): Likewise.
7225         (class Relocate_task): Likewise.
7226         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7227         all callers.
7228         (scan_relocatable_relocs): Likewise.
7229         * target.h (class Sized_target): Remove options parameter from
7230         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7231         all callers.
7232         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7233         callers.
7234         * arm.cc: Update functions to remove options parameters.
7235         * i386.cc: Likewise.
7236         * powerpc.cc: Likewise.
7237         * sparc.cc: Likewise.
7238         * x86_64.cc: Likewise.
7239         * testsuite/testfile.cc: Likewise.
7240
7241 2009-10-28  Doug Kwan  <dougkwan@google.com>
7242
7243         * arm.cc (Arm_relobj): New class definition.
7244         (Arm_relobj::scan_sections_for_stubs,
7245         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7246         New method definitions.
7247
7248 2009-10-28  Cary Coutant  <ccoutant@google.com>
7249
7250         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7251         (Plugin::cleanup_done_): New member.
7252         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7253         (Plugin_manager::cleanup_done_): Remove.
7254         (Plugin_manager::add_input_file): Edit error message.
7255         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7256         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7257
7258 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7259
7260         * fileread.cc: (File_read::View::~View): Use the new
7261         data_ownership_ filed.
7262         (File_read::~File_read): Dispose the new whole_file_view_.
7263         (File_read::open): Mmap the whole file if needed.
7264         (File_read::open): Use whole_file_view_ instead of contents_.
7265         (File_read::find_view): Use whole_file_view_ if applicable.
7266         (File_read::do_read): Use whole_file_view_ instead of contents_.
7267         (File_read::make_view): Use whole_file_view_ instead of contents_,
7268         update File_read::View::View call.
7269         (File_read::find_or_make_view): Update File_read::View::View
7270         call.
7271         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7272         remove contents_
7273         (File_read::View::Data_ownership): New enum.
7274         (File_read::View::View): Replace bool mapped_ with Data_ownership
7275         argument.
7276         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7277         (File_read::View::data_ownership_): New field.
7278         (File_read::contents_): Remove (replaced by whole_file_view_).
7279         (File_read::whole_file_view_): New field.
7280         * options.h (class General_options): Add --keep-files-mapped.
7281
7282 2009-10-27  Cary Coutant  <ccoutant@google.com>
7283
7284         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7285         * testsuite/Makefile.am (plugin_test_5): New test case.
7286         * testsuite/Makefile.in: Regenerate.
7287
7288 2009-10-25  Doug Kwan  <dougkwan@google.com>
7289
7290         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7291         from private to protected to allow access by child class.
7292         (Sized_relobj::do_relocate_sections): New method declaration.
7293         (Sized_relobj::relocate_sections): Virtualize.
7294         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7295         Sized_relobj::relocate_sections.  Instantiate template explicitly
7296         for different target sizes and endianity.
7297
7298 2009-10-24  Doug Kwan  <dougkwan@google.com>
7299
7300         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7301         (Arm_input_section::as_arm_input_section): New method.
7302         (Arm_output_section): New class definition.
7303         (Arm_output_section::create_stub_group,
7304         Arm_output_section::group_sections): New method definitions.
7305
7306 2009-10-22  Doug Kwan  <dougkwan@google.com>
7307
7308         * arm.cc (Arm_input_section): New class definition.
7309         (Arm_input_section::init, Arm_input_section:do_write,
7310         Arm_input_section::set_final_data_size,
7311         Arm_input_section::do_reset_address_and_file_offset): New method
7312         definitions.
7313
7314 2009-10-21  Doug Kwan  <dougkwan@google.com>
7315
7316         * arm.cc (Stub_table, Arm_input_section): New forward class
7317         declarations.
7318         (Stub_table): New class defintion.
7319         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7320         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7321         New method definition.
7322
7323 2009-10-21  Doug Kwan  <dougkwan@google.com>
7324
7325         * arm.cc: Update copyright comments.
7326         (Target_arm): New forward class template declaration.
7327         (Arm_address): New type.
7328         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7329         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7330         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7331         constants.
7332         (Insn_template): Same.
7333         (DEF_STUBS): New macro.
7334         (Stub_type): New enum type.
7335         (Stub_template): New class definition.
7336         (Stub): Same.
7337         (Reloc_stub): Same.
7338         (Stub_factory): Same.
7339         (Target_arm::Target_arm): Initialize may_use_blx_ and
7340         should_force_pic_veneer_.
7341         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7342         Target_arm::should_force_pic_veneer,
7343         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7344         Target_arm::using_thumb_only, Target_arm:;default_target): New
7345         method defintions.
7346         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7347         New data member declarations.
7348         (Insn_template::size, Insn_template::alignment): New method defintions.
7349         (Stub_template::Stub_template): New method definition.
7350         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7351         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7352         (Stub_factory::Stub_factory): New method definition.
7353         * gold.h (string_hash): New template.
7354         * output.h (Input_section_specifier::hash_value): Use
7355         gold::string_hash.
7356         (Input_section_specifier::string_hash): Remove.
7357         * stringpool.cc (Stringpool_template::string_hash): Use
7358         gold::string_hash.
7359
7360 2009-10-20  Doug Kwan  <dougkwan@google.com>
7361
7362         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7363         symbols of relaxed input sections.
7364         * output.h (Output_section::find_relaxed_input_section): Make
7365         method public.
7366
7367 2009-10-16  Doug Kwan  <dougkwan@google.com>
7368
7369         * dynobj.cc (Versions::Versions): Initialize version_script_.
7370         Only insert base version symbol definition for a shared object
7371         if version script defines any version versions.
7372         (Versions::define_base_version): New method definition.
7373         (Versions::add_def): Check that base version is not needed.
7374         (Versions::add_need): Define base version lazily.
7375         * dynobj.h (Versions::define_base_version): New method declaration.
7376         (Versions::needs_base_version_): New data member declaration.
7377         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7378         (check_DATA): Add no_version_test.stdout.
7379         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7380         New make rules.
7381         * testsuite/Makefile.in: Regenerate.
7382         * testsuite/no_version_test.c: New file.
7383         * testsuite/no_version_test.sh: Ditto.
7384
7385 2009-10-16  Doug Kwan  <dougkwan@google.com>
7386
7387         * expression.cc (class Segment_start_expression): New class definition.
7388         (Segment_start_expression::value): New method definition.
7389         (script_exp_function_segment_start): Return a new
7390         Segment_start_expression.
7391         * gold/script-c.h (script_saw_segment_start_expression): New function
7392         prototype.
7393         * script-sections.cc (Script_sections::Script_sections): Initialize
7394         SAW_SEGMENT_START_EXPRESSION_ to false.
7395         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7396         and -Tbbs options to specify section addresses if given in
7397         command line and no SEGMENT_START expression is seen in a script.
7398         * script-sections.h (Script_sections::saw_segment_start_expression,
7399         Script_sections::set_saw_segment_start_expression): New method
7400         definition.
7401         (Script_sections::saw_segment_start_expression_): New data member
7402         declaration.
7403         * script.cc (script_saw_segment_start_expression): New function.
7404         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7405         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7406         script_test_7.sh and script_test_8.sh.
7407         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7408         script_test_8.stdout.
7409         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7410         (script_test_6, script_test_6.stdout, script_test_7,
7411         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7412         * Makefile.in: Regenerate.
7413         * testsuite/script_test_6.sh: New file.
7414         * testsuite/script_test_6.t: Same.
7415         * testsuite/script_test_7.sh: Same.
7416         * testsuite/script_test_7.t: Same.
7417         * testsuite/script_test_8.sh: Same.
7418
7419 2009-10-16  Doug Kwan  <dougkwan@google.com>
7420
7421         * output.cc (Output_segment::set_section_list_address): Cast
7422         expressions to unsigned long long type to avoid format warnings.
7423
7424 2009-10-15  Ian Lance Taylor  <iant@google.com>
7425
7426         * script.cc (Script_options::add_symbol_assignment): Always add a
7427         dot assignment to script_sections_.
7428         * script-sections.cc (Script_sections::add_dot_assignment):
7429         Initialize if necessary.
7430
7431         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7432         program headers with no load segment if there is a linker script.
7433
7434         * layout.cc (Layout::set_segment_offsets): Align the file offset
7435         to the segment aligment for -N or -n with no load segment.
7436         * output.cc (Output_segment::add_output_section): Don't crash if
7437         the first section is a TLS section.
7438         (Output_segment::set_section_list_addresses): Print an error
7439         message if the address moves backward in a linker script.
7440         * script-sections.cc
7441         (Output_section_element_input::set_section_addresses): Don't
7442         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7443         (Orphan_output_section::set_section_addresses): Likewise.
7444
7445 2009-10-15  Doug Kwan  <dougkwan@google.com>
7446
7447         * layout.cc (Layout::finish_dynamic_section): Generate tags
7448         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7449         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7450         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7451
7452 2009-10-14  Ian Lance Taylor  <iant@google.com>
7453
7454         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7455         fields.
7456         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7457         data_shdr fields of relinfo.
7458         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7459         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7460         R_386_TLS_LDO_32, adjust based on section flags.
7461         (Target_i386::Relocate::fix_up_ldo): Remove.
7462
7463 2009-10-13  Ian Lance Taylor  <iant@google.com>
7464
7465         Add support for -pie.
7466         * options.h (class General_options): Add -pie and
7467         --pic-executable.
7468         (General_options::output_is_position_independent): Test -pie.
7469         (General_options::output_is_executable): Return true if not shared
7470         and not relocatable.
7471         (General_options::output_is_pie): Remove.
7472         * options.cc (General_options::finalize): Reject incompatible uses
7473         of -pie.
7474         * gold.cc (queue_middle_tasks): A -pie link is not static.
7475         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7476         * symtab.cc (Symbol::final_value_is_known): Return false if
7477         output_is_position_independent.
7478         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7479         output_is_position_independent.
7480         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7481         output_is_position_independent.
7482         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7483         output_is_position_independent.
7484         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7485         two_file_pie_test.
7486         (basic_pie_test.o, basic_pie_test): New targets.
7487         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7488         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7489         (two_file_pie_test): New target.
7490         * testsuite/Makefile.in: Rebuild.
7491         * README: Remove note saying that -pie is not supported.
7492
7493 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7494
7495         * options.h (class General_options): Add -init and -fini.
7496         * layout.cc (Layout::finish_dynamic_section): Emit
7497         given init and fini functions.
7498
7499 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7500
7501         * gc.h (gc_process_relocs): Check if icf is enabled using new
7502         function.
7503         * gold.cc (queue_initial_tasks): Likewise.
7504         (queue_middle_tasks): Likewise.
7505         * object.cc (do_layout): Likewise.
7506         * symtab.cc (is_section_folded): Likewise.
7507         * main.cc (main): Likewise.
7508         * reloc.cc (Read_relocs::run): Likewise.
7509         (Sized_relobj::do_scan_relocs): Likewise.
7510         * icf.cc (is_function_ctor_or_dtor): New function.
7511         (Icf::find_identical_sections): Check if function is ctor or dtor when
7512         safe icf is chosen.
7513         * options.h (General_options::icf): Change option to be an enum.
7514         (Icf_status): New enum.
7515         (icf_enabled): New method.
7516         (icf_safe_folding): New method.
7517         (set_icf_status): New method.
7518         (icf_status_): New variable.
7519         * (options.cc) (General_options::finalize): Set icf_status_.
7520         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7521         icf_test and icf_keep_unique_test to use the --icf enum flag.
7522         * testsuite/icf_safe_test.sh: New file.
7523         * testsuite/icf_safe_test.cc: New file.
7524
7525 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7526
7527         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7528         includes to gc.h and icf.h.
7529         * arm.cc: Include gc.h.
7530         * gold.cc: Likewise.
7531         * i386.cc: Likewise.
7532         * powerpc.cc: Likewise.
7533         * sparc.cc: Likewise.
7534         * x86_64.cc: Likewise.
7535         * gc.h: Include icf.h.
7536
7537 2009-10-11  Ian Lance Taylor  <iant@google.com>
7538
7539         * plugin.cc: Include "gold.h" before other header files.
7540
7541 2009-10-10  Chris Demetriou  <cgd@google.com>
7542
7543         * options.h (Input_file_argument::Input_file_type): New enum.
7544         (Input_file_argument::is_lib_): Replace with...
7545         (Input_file_argument::type_): New member.
7546         (Input_file_argument::Input_file_argument): Take Input_file_type
7547         'type' rather than boolean 'is_lib' as second argument.
7548         (Input_file_argument::is_lib): Use type_.
7549         (Input_file_argument::is_searched_file): New function.
7550         (Input_file_argument::may_need_search): Handle is_searched_file.
7551         * options.cc (General_options::parse_library): Support -l:filename.
7552         (General_options::parse_just_symbols): Update for Input_file_argument
7553         changes.
7554         (Command_line::process): Likewise.
7555         * archive.cc (Archive::get_file_and_offset): Likewise.
7556         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7557         * script.cc (read_script_file, script_add_file): Likewise.
7558         * fileread.cc (Input_file::Input_file): Likewise.
7559         (Input_file::will_search_for): Handle is_searched_file.
7560         (Input_file::open): Likewise.
7561         * readsyms.cc (Read_symbols::get_name): Likewise.
7562         * testsuite/Makefile.am (searched_file_test): New test.
7563         * testsuite/Makefile.in: Regenerate.
7564         * testsuite/searched_file_test.cc: New file.
7565         * testsuite/searched_file_test_lib.cc: New file.
7566
7567 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7568             Ian Lance Taylor  <iant@google.com>
7569
7570         * descriptor.cc: Include <cstdio> and "binary-io.h".
7571         (Descriptors::open): Open the files in binary mode always.
7572         * script.cc (Lex::get_token): Treat \r as whitespace.
7573
7574 2009-10-09  Ian Lance Taylor  <iant@google.com>
7575
7576         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7577
7578 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7579             Ian Lance Taylor  <iant@google.com>
7580
7581         * configure.ac: Check for readv function also.
7582         * fileread.cc (readv): Define if not HAVE_READV.
7583         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7584         does not exist.
7585         * config.in: Regenerate.
7586         * configure: Regenerate.
7587
7588 2009-10-09  Doug Kwan  <dougkwan@google.com>
7589
7590         * layout.cc (Layout::make_output_section): Call target hook to make
7591         ordinary output section.
7592         (Layout::finalize): Adjust parameter list of call the
7593         Target::may_relax().
7594         * layout.h (class Layout::section_list): New method.
7595         * merge.h (Output_merge_base::entsize): Change visibility to public.
7596         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7597         New methods.
7598         (Output_merge_string::do_is_string): New method.
7599         * object.cc (Sized_relobj::do_setup): renamed from
7600         Sized_relobj::set_up.
7601         * object.h (Sized_relobj::adjust_shndx,
7602         Sized_relobj::initializ_input_to_output_maps,
7603         Sized_relobj::free_input_to_output_maps): Change visibilities to
7604         protected.
7605         (Sized_relobj::setup): Virtualize.
7606         (Sized_relobj::do_setup): New method declaration.
7607         (Sized_relobj::invalidate_section_offset,
7608         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7609         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7610         * options.cc (parse_int): New function.
7611         * options.h (parse_int): New declaration.
7612         (DEFINE_int): New macro.
7613         (stub_group_size): New option.
7614         * output.cc (Output_section::Output_section): Initialize memebers
7615         merge_section_map_, merge_section_by_properties_map_,
7616         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7617         (Output_section::add_input_section): Handled deferred code-fill
7618         generation and remove an old comment.
7619         (Output_section::add_relaxed_input_section): New method definition.
7620         (Output_section::add_merge_input_section): Use merge section by
7621         properties map to speed to search.  Update merge section maps
7622         as appropriate.
7623         (Output_section::build_relaxation_map): New method definition.
7624         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7625         Same.
7626         (Output_section::relax_input_section): Renamed to
7627         Output_section::convert_input_sections_to_relaxed_sections and change
7628         interface to take a vector of pointers to relaxed sections.
7629         (Output_section::find_merge_section,
7630         Output_section::find_relaxed_input_section): New method definitions.
7631         (Output_section::is_input_address_mapped,
7632         Output_section::output_offset, Output_section::output_address):
7633         Use output section data maps to speed up searching.
7634         (Output_section::find_starting_output_address): Add comments.
7635         (Output_section::do_write,
7636         Output_section::write_to_postprocessing_buffer): Do code-fill
7637         generation as appropriate.
7638         (Output_section::get_input_sections): Invalidate relaxed input section
7639         map.
7640         (Output_section::restore_states): Adjust type of checkpoint .
7641         Invalidate relaxed input section map.
7642         * output.h (Output_merge_base): New class declaration.
7643         (Input_section_specifier): New class defintion.
7644         (class Output_relaxed_input_section) Change base class to
7645         Output_section_data_build.
7646         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7647         base class initializer.
7648         (Output_section::add_relaxed_input_section): New method declaration.
7649         (Output_section::Input_section): Change visibility to protected.
7650         (Output_section::Input_section::relobj,
7651         Output_section::Input_section::shndx): Handle relaxed input sections.
7652         Output_section::input_sections) Change visibility to protected.  Also
7653         define overload to return a non-const pointer.
7654         (Output_section::Merge_section_properties): New class defintion.
7655         (Output_section::Merge_section_by_properties_map,
7656         Output_section::Output_section_data_by_input_section_map,
7657         Output_section::Relaxation_map): New types.
7658         (Output_section::relax_input_section): Rename method to
7659         Output_section::convert_input_sections_to_relaxed_sections and change
7660         interface to take a vector of relaxed section pointers.
7661         (Output_section::find_merge_section,
7662         Output_section::find_relaxed_input_section,
7663         Output_section::build_relaxation_map,
7664         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7665         New method declarations.
7666         (Output_section::merge_section_map_
7667         Output_section::merge_section_by_properties_map_,
7668         Output_section::relaxed_input_section_map_,
7669         Output_section::is_relaxed_input_section_map_valid_,
7670         Output_section::generate_code_fills_at_write_): New data members.
7671         * script-sections.cc
7672         (Output_section_element_input::set_section_addresses): Call
7673         current_data_size and addralign methods of relaxed input sections.
7674         (Orphan_output_section::set_section_addresses): Call current_data_size
7675         and addralign methods of relaxed input sections.
7676         * symtab.cc (Symbol_table::compute_final_value): Extract template
7677         from the body of Symbol_table::sized_finalize_symbol.
7678         (Symbol_table::sized_finalized_symbol): Call
7679         Symbol_table::compute_final_value.
7680         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7681         (Symbol_table::compute_final_value): New templated method declaration.
7682         * target.cc (Target::do_make_output_section): New method defintion.
7683         * target.h (Target::make_output_section): New method declaration.
7684         (Target::relax): Add more parameters for input objects, symbol table
7685         and layout.  Adjust call to do_relax.
7686         (Target::do_make_output_section): New method declaration.
7687         (Target::do_relax): Add parameters for input objects, symbol table
7688         and layout.
7689
7690 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7691
7692         * pread.c: Include stdio.h.
7693
7694 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7695
7696         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7697         defined.
7698
7699 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7700
7701         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7702         Change read_shndx type to unsigned int.
7703         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7704         int.
7705         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7706         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7707         Change read_shndx type to unsigned int.
7708         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7709         int.
7710         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7711         * layout.cc (Layout::create_symtab_sections): Cast the result of
7712         local_symcount * symsize to off_t in the gold_assert.
7713
7714 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7715
7716         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7717         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7718         R_ARM_BASE_ABS.
7719         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7720         (Arm_relocate_functions::thm_abs5): New function.
7721         (Arm_relocate_functions::abs12): New function.
7722         (Arm_relocate_functions::abs16): New function.
7723         (Arm_relocate_functions::base_abs): New function.
7724         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7725         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7726         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7727         R_ARM_BASE_ABS.
7728         (Scan::global): Likewise.
7729         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7730         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7731         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7732         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7733         R_ARM_BASE_ABS.
7734
7735 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7736
7737         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7738         (Arm_relocate_functions::movt_prel): New function.
7739         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7740         (Arm_relocate_functions::thm_movt_prel): New function.
7741         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7742         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7743         (Scan::global, Relocate::relocate): Likewise.
7744         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7745
7746 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7747
7748         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7749         Incremental_checker.
7750         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7751         unsigned int.
7752         (class Incremental_inputs_header): New class.
7753         (Incremental_inputs_header_writer): Edit comment.
7754         (Incremental_inputs_entry): New class.
7755         (Incremental_inputs_entry_writer): Edit comment.
7756         (Sized_incremental_binary::do_find_incremental_inputs_section):
7757         Add *strtab_shndx parameter, fill it.
7758         (Sized_incremental_binary::do_check_inputs): New method.
7759         (Incremental_checker::can_incrementally_link_output_file): Use
7760         Sized_incremental_binary::check_inputs.
7761         (Incremental_inputs::report_command_line): Save command line in
7762         command_line_.
7763         * incremental.h:
7764         (Incremental_binary::find_incremental_inputs_section): New
7765         method.
7766         (Incremental_binary::do_find_incremental_inputs_section): Add
7767         strtab_shndx parameter.
7768         (Incremental_binary::do_check_inputs): New pure virtual method.
7769         (Sized_incremental_binary::do_check_inputs): Declare.
7770         (Incremental_checker::Incremental_checker): Add incremental_inputs
7771         parameter, use it to initialize incremental_inputs_.
7772         (Incremental_checker::incremental_inputs_): New field.
7773         (Incremental_checker::command_line): New method.
7774         (Incremental_checker::inputs): New method.
7775         (Incremental_checker::command_line_): New field.
7776
7777 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7778
7779         * incremental.cc: Include <cstdarg> and "target-select.h".
7780         (vexplain_no_incremental): New function.
7781         (explain_no_incremental): New function.
7782         (Incremental_binary::error): New method.
7783         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7784         method.
7785         (make_sized_incremental_binary): New function.
7786         (open_incremental_binary): New function.
7787         (can_incrementally_link_file): Add checks if output is ELF and has
7788         inputs section.
7789         * incremental.h: Include "elfcpp_file.h" and "output.h".
7790         (Incremental_binary): New class.
7791         (Sized_incremental_binary): New class.
7792         (open_incremental_binary): Declare.
7793         * object.cc (is_elf_object): Use
7794         elfcpp::Elf_recognizer::is_elf_file.
7795         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7796         * output.h (Output_file::filesize): New method.
7797
7798 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7799
7800         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7801         New function.
7802         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7803         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7804         function.
7805         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7806         function.
7807         (Arm_relocate_functions::movw_abs_nc): New function.
7808         (Arm_relocate_functions::movt_abs): New function.
7809         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7810         (Arm_relocate_functions::thm_movt_abs): New function.
7811         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7812         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7813         (Scan::global): Likewise.
7814         (Relocate::relocate): Likewise.
7815         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7816
7817 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7818
7819         * arm.cc (Arm_relocate_functions::got_prel) New function.
7820         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7821         (Relocate::relocate): Likewise.
7822         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7823
7824 2009-10-06  Ian Lance Taylor  <iant@google.com>
7825
7826         * options.h (class General_options): Define
7827         split_stack_adjust_size parameter.
7828         * object.h (class Object): Add uses_split_stack_ and
7829         has_no_split_stack_ fields.  Add uses_split_stack and
7830         has_no_split_stack accessor functions.  Declare
7831         handle_split_stack_section.
7832         (class Reloc_symbol_changes): Define.
7833         (class Sized_relobj): Define Function_offsets.  Declare
7834         split_stack_adjust, split_stack_adjust_reltype, and
7835         find_functions.
7836         * object.cc (Object::handle_split_stack_section): New function.
7837         (Sized_relobj::do_layout): Call handle_split_stack_section.
7838         * dynobj.cc (Sized_dynobj::do_layout): Call
7839         handle_split_stack_section.
7840         * reloc.cc (Sized_relobj::relocate_sections): Call
7841         split_stack_adjust for executable sections in split_stack
7842         objects.  Pass reloc_map to relocate_section.
7843         (Sized_relobj::split_stack_adjust): New function.
7844         (Sized_relobj::split_stack_adjust_reltype): New function.
7845         (Sized_relobj::find_functions): New function.
7846         * target-reloc.h: Include "object.h".
7847         (relocate_section): Add reloc_symbol_changes parameter.  Change
7848         all callers.
7849         * target.h (class Target): Add calls_non_split method.  Declare
7850         do_calls_non_split virtual method.  Declare match_view and
7851         set_view_to_nop.
7852         * target.cc: Include "elfcpp.h".
7853         (Target::do_calls_non_split): New function.
7854         (Target::match_view): New function.
7855         (Target::set_view_to_nop): New function.
7856         * gold.cc (queue_middle_tasks): Give an error if mixing
7857         split-stack and non-split-stack objects with -r.
7858         * i386.cc (Target_i386::relocate_section): Add
7859         reloc_symbol_changes parameter.
7860         (Target_i386::do_calls_non_split): New function.
7861         * x86_64.cc (Target_x86_64::relocate_section): Add
7862         reloc_symbol_changes parameter.
7863         (Target_x86_64::do_calls_non_split): New function.
7864         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7865         parameter.
7866         * powerpc.cc (Target_powerpc::relocate_section): Add
7867         reloc_symbol_changes parameter.
7868         * sparc.cc (Target_sparc::relocate_section): Add
7869         reloc_symbol_changes parameter.
7870         * configure.ac: Call AM_CONDITIONAL for the default target.
7871         * configure: Rebuild.
7872         * testsuite/Makefile.am (TEST_AS): New variable.
7873         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7874         (check_DATA): Add split_i386 and split_x86_64 files.
7875         (SPLIT_DEFSYMS): Define.
7876         (split_i386_[1234n].o): New targets.
7877         (split_i386_[124]): New targets.
7878         (split_i386_[1234r].stdout): New targets.
7879         (split_x86_64_[1234n].o): New targets.
7880         (split_x86_64_[124]): New targets.
7881         (split_x86_64_[1234r].stdout): New targets.
7882         (MOSTLYCLEANFILES): Add new executables.
7883         * testsuite/split_i386.sh: New file.
7884         * testsuite/split_x86_64.sh: New file.
7885         * testsuite/split_i386_1.s: New file.
7886         * testsuite/split_i386_2.s: New file.
7887         * testsuite/split_i386_3.s: New file.
7888         * testsuite/split_i386_4.s: New file.
7889         * testsuite/split_i386_n.s: New file.
7890         * testsuite/split_x86_64_1.s: New file.
7891         * testsuite/split_x86_64_2.s: New file.
7892         * testsuite/split_x86_64_3.s: New file.
7893         * testsuite/split_x86_64_4.s: New file.
7894         * testsuite/split_x86_64_n.s: New file.
7895         * testsuite/testfile.cc (Target_test): Update relocation_section
7896         function.
7897         * testsuite/Makefile.in: Rebuild.
7898
7899 2009-10-06  Ian Lance Taylor  <iant@google.com>
7900
7901         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7902         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7903         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7904         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7905         the address on ldo_addrs_.
7906         (Target_i386::Relocate::fix_up_ldo): New function.
7907
7908 2009-10-06   Rafael Espindola  <espindola@google.com>
7909
7910         * plugin.cc (add_input_library): New.
7911         (Plugin::load): Add add_input_library to tv.
7912         (Plugin_manager::add_input_file): Add the is_lib argument.
7913         (add_input_file): Update call to Plugin_manager::add_input_file.
7914         (add_input_library): New.
7915         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7916
7917 2009-09-30  Doug Kwan  <dougkwan@google.com>
7918
7919         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7920         symbol and call Symbol::may_need_copy_reloc to determine if
7921         a copy reloc is needed.
7922         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7923         nocopyreloc is given in command line.
7924         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7925         given in command line.
7926         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7927         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7928         of the removed Target_i386::may_need_copy_reloc.
7929         * options.h (copyreloc): New option with default value false.
7930         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7931         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7932         instead of the removed Target_powerpc::may_need_copy_reloc.
7933         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7934         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7935         instead of the removed Target_sparc::may_need_copy_reloc.
7936         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7937         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7938         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7939         instead of the removed Target_x86_64::may_need_copy_reloc.
7940
7941 2009-09-30  Ian Lance Taylor  <iant@google.com>
7942
7943         * object.h (class Object): Remove target_ field, and target,
7944         sized_target, and set_target methods.
7945         (Object::sized_target): Remove.
7946         (class Sized_relobj): Update declarations.  Remove sized_target.
7947         * object.cc (Sized_relobj::setup): Remove target parameter.
7948         Change all callers.
7949         (Input_objects::add_object): Don't do anything with the target.
7950         (make_elf_sized_object): Add punconfigured parameter.  Change all
7951         callers.  Set or test parameter target.
7952         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7953         Change all callers.
7954         * parameters.cc (Parameters::set_target): Change parameter type to
7955         be non-const.
7956         (Parameters::default_target): Remove.
7957         (set_parameters_target): Change parameter type to be non-const.
7958         (parameters_force_valid_target): New function.
7959         (parameters_clear_target): New function.
7960         * parameters.h (class Parameters): Update declarations.  Remove
7961         default_target method.  Add sized_target and clear_target
7962         methods.  Change target_ to be non-const.
7963         (set_parameters_target): Update declaration.
7964         (parameters_force_valid_target): Declare.
7965         (parameters_clear_target): Declare.
7966         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7967         as NULL if we aren't searching.
7968         (Add_symbols::run): Don't check for compatible target.
7969         * fileread.cc (Input_file::open_binary): Call
7970         parameters_force_valid_target.
7971         * gold.cc (queue_middle_tasks): Likewise.
7972         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7973         set_target on object.
7974         * dynobj.h (class Sized_dynobj): Update declarations.
7975         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7976         make_elf_object returns NULL.
7977         (Archive::include_member): Don't check whether object target is
7978         compatible.
7979         * output.cc (Output_section::add_input_section): Get target from
7980         parameters.
7981         (Output_section::relax_input_section): Likewise.
7982         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7983         parameters.
7984         (Sized_relobj::do_scan_relocs): Likewise.
7985         (Sized_relobj::relocate_sections): Likewise.
7986         * resolve.cc (Symbol_table::resolve): Likewise.
7987         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7988         parameter.  Change all callers.
7989         (Symbol_table::add_from_object): Get target from parameters.
7990         (Symbol_table::add_from_relobj): Don't check object target.
7991         (Symbol_table::add_from_dynobj): Likewise.
7992         (Symbol_table::define_special_symbol): Get target from
7993         parameters.
7994         * symtab.h (class Symbol_table): Update declaration.
7995         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7996         parameter.  Change all callers.  Clear parameter target.
7997         (Binary_test): Test target here.
7998         * testsuite/object_unittest.cc (gold_testsuite): Remove
7999         target_test_pointer parameter.  Change all callers.
8000         (Object_test): Test target here.
8001
8002 2009-09-26  Ian Lance Taylor  <iant@google.com>
8003
8004         * testsuite/initpri1.c: Don't try to use constructor priorities if
8005         compiling with gcc before 4.3.
8006
8007 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8008
8009         * testsuite/retain_symbols_file_test.sh (check_present): Change
8010         output file name to retain_symbols_file_test.stdout.
8011         (check_absent): Likewise.
8012
8013 2009-09-18  Craig Silverstein  <csilvers@google.com>
8014
8015         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8016         * options.cc: Include <cerrno> and <fstream>.
8017         (General_options::finalize): Parse -retain-symbols-file tag.
8018         * options.h: New flag.
8019         (General_options): New method should_retain_symbol, new
8020         variable symbols_to_retain.
8021         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8022         should_retain_symbol map.
8023         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8024         * testsuite/Makefile.in: Regenerate.
8025         * testsuite/retain_symbols_file_test.sh: New file.
8026
8027 2009-09-18  Nick Clifton  <nickc@redhat.com>
8028
8029         * po/es.po: Updated Spanish translation.
8030
8031 2009-09-17  Doug Kwan  <dougkwan@google.com>
8032
8033         * debug.h (DEBUG_RELAXATION): New constant.
8034         (DEBUG_ALL): Add DEBUG_RELAXATION.
8035         (debug_string_to_enum): Add relaxation debug option.
8036         * layout.cc
8037         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8038         Layout::Relaxation_debug_check::read_sections,
8039         Layout::Relaxation_debug_check::read_sections): New method definitions.
8040         (Layout::Layout): Initialize data members
8041         record_output_section_data_from_scrips_,
8042         script_output_section_data_list_ and relaxation_debug_check_.
8043         (Layout::save_segments, Layout::restore_segments,
8044         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8045         Layout::relaxation_loop_body): New method definitions.
8046         (Layout::finalize): Support relaxation.  Move section layout code to
8047         Layout::relaxation_loop_body.
8048         (Layout::set_asection_address_from_script): Move code for orphan
8049         section placement out.
8050         (Layout::place_orphan_sections_in_script): New method definition.
8051         * layout.h (Output_segment_headers, Output_file_header):
8052         New forward class declarations.
8053         (Layout::~Layout): Define.
8054         (Layout::new_output_section_data_from_script): New method definition.
8055         (Layout::place_orphan_sections_in_script): New method declaration.
8056         (Layout::Segment_states): New type declaration.
8057         (Layout::save_segments, Layout::restore_segments,
8058         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8059         Layout::relaxation_loop_body): New method declarations.
8060         (Layout::Output_section_data_list): New type declaration.
8061         (Layout::Relaxation_debug_check): New class definition.
8062         (Layout::record_output_section_data_from_script_,
8063         Layout::script_output_section_data_list_, Layout::segment_states_,
8064         Layout::relaxation_debug_check_): New data members.
8065         * output.cc: (Output_section_headers::do_size): New method definition.
8066         (Output_section_headers::Output_section_headers): Move size
8067         computation to Output_section_headers::do_size.
8068         (Output_segment_headers::do_size): New method definition.
8069         (Output_file_header::Output_file_header): Move size computation to
8070         Output_file_header::do_size and call it.
8071         (Output_file_header::do_size): New method definition.
8072         (Output_data_group::Output_data_group): Adjust call to
8073         Output_section_data.
8074         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8075         (Output_symtab_xindex::do_write): Add array bound check.
8076         (Output_section::Input_section::print_to_mapfile): Handle
8077         RELAXED_INPUT_SECTION_CODE.
8078         (Output_section::Output_section): Initialize data member checkpoint_.
8079         (Output_section::~Output_section): Delete checkpoint object pointed
8080         by checkpoint_.
8081         (Output_section::add_input_section): Always add an Input_section if
8082         relaxing.
8083         (Output_section::add_merge_input_section): Add assert.
8084         (Output_section::relax_input_section): New method definition.
8085         (Output_section::set_final_data_size): Set load address to zero for
8086         an unallocated section.
8087         (Output_section::do_address_and_file_offset_have_reset_values):
8088         New method definition.
8089         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8090         Handle relaxed input section.
8091         (Output_section::sort_attached_input_sections): Checkpoint input
8092         section list lazily.
8093         (Output_section::get_input_sections): Change type of input_sections to
8094         list of Simple_input_section pointers.  Checkpoint input section list
8095         lazily.  Also handle relaxed input sections.
8096         (Output_section::add_input_section_for_script): Take a reference to
8097         a Simple_input_section object instead of Relobj pointer and section
8098         index as parameter.  Handle relaxed input sections.
8099         (Output_section::save_states, Output_section::restore_states): New
8100         method definitions.
8101         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8102         (Output_data::is_data_size_fixed): New method definition.
8103         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8104         if it is fixed.
8105         (Output_data::address_and_file_offset_have_reset_values): New method
8106         definition.
8107         (Output_data::do_address_and_file_offset_have_reset_values): New method
8108         definition.
8109         (Output_data::set_data_size): Check that data size is not fixed.
8110         (Output_data::fix_data_size): New method definition.
8111         (Output_data::is_data_size_fixed_): New data member.
8112         (Output_section_headers::set_final_data_size): New method definition.
8113         (Output_section_headers::do_size): New method declaration.
8114         (Output_segment_headers::set_final_data_size): New method definition.
8115         (Output_segment_headers::do_size): New method declaration.
8116         (Output_file_header::set_final_data_size)::New method definition.
8117         (Output_file_header::do_size)::New method declaration.
8118         (Output_section_data::Output_section_data): Add new parameter
8119         is_data_size_fixed and use it to fix data size.
8120         (Output_data_const::Output_data_const): Adjust call to base class
8121         constructor and fix data size.
8122         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8123         base class constructor and fix data size.
8124         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8125         base class constructor and fix data size.
8126         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8127         class constructor and fix data size.
8128         (Output_data_group::set_final_data_size): New method definition.
8129         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8130         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8131         class constructor and fix data size.
8132         (Output_relaxed_input_section): New class definition.
8133         (Output_section::Simple_input_section): New class definition.
8134         (Output_section::get_input_sections): Adjust parameter list.
8135         (Output_section::add_input_section_for_script): Same.
8136         (Output_section::save_states, Output_section::restore_states,
8137         Output_section::do_address_and_file_offset_have_reset_values,
8138         (Output_section::Input_section::Input_section): Handle
8139         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8140         Output_relaxed_input_section.
8141         (Output_section::Input_section::is_input_section,
8142         Output_section::Input_section::set_output_section): Handle relaxed
8143         input section.
8144         (Output_section::Input_section::is_relaxed_input_section,
8145         Output_section::Input_section::output_section_data,
8146         Output_section::Input_section::relaxed_input_section): New method
8147         definitions.
8148         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8149         value.
8150         (Output_section::Input_section::u1_): Update comments.
8151         (Output_section::Input_section::u2_): Add new union member poris.
8152         (Output_section::Checkpoint_output_section): New classs definition.
8153         (Output_section::relax_input_section): New method declaration.
8154         (Output_section::checkpoint_): New data member.
8155         (Output_segment): Update comments.
8156         (Output_segment::Output_segment): Un-privatize copy constructor.
8157         (Output_segment::operator=): Un-privatize.
8158         * script-sections.cc (Output_section_element::Input_section_list):
8159         Change element type to Output_section::Simple_input_section.
8160         (Output_section_element_dot_assignment::set_section_addresses):
8161         Register output section data for relaxation clean up.
8162         (Output_data_exression::Output_data_expression): Adjust call to base
8163         constructor to fix data size.
8164         (Output_section_element_data::set_section_addresses): Register
8165         Output_data_expression object for relaxation clean up.
8166         (struct Input_section_info): Replace Relobj pointer and section index
8167         pair with Output_section::Simple_input_section and Convert struct to a
8168         class.
8169         (Input_section_sorter::operator()): Adjust access to
8170         Input_section_info data member to use accessors.
8171         (Output_section_element_input::set_section_addresses): Use layout
8172         parameter.  Adjust code to use Output_section::Simple_input_section
8173         and Input_secction_info classes.  Register filler for relaxation
8174         clean up.
8175         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8176         and section index pair with Output_section::Simple_input_section
8177         class.  Adjust code accordingly.
8178         (Phdrs_element::release_segment): New method definition.
8179         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8180         segment list.
8181         (Script_sections::release_segments): New method definition.
8182         * gold/script-sections.h (Script_sections::release_segments): New
8183         method declaration.
8184         * gold/target.h (Target::may_relax, Target::relax,
8185         Target::do_may_relax, Target::do_relax): New method definitions.
8186
8187 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8188
8189         * arm.cc (has_signed_unsigned_overflow): New function.
8190         (Arm_relocate_functions::abs8): New function.
8191         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8192         (Target_arm::Scan::global): Likewise.
8193         (Target_arm::relocate::relocate): Likewise.
8194         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8195         Likewise.
8196
8197 2009-09-16  Cary Coutant  <ccoutant@google.com>
8198
8199         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8200         * testsuite/Makefile.in: Regenerate.
8201
8202 2009-09-11  Nick Clifton  <nickc@redhat.com>
8203
8204         * po/gold.pot: Updated by the Translation project.
8205
8206 2009-09-08  Cary Coutant  <ccoutant@google.com>
8207
8208         * output.cc (Output_file::open): Add execute permission to empty file.
8209         * testsuite/Makefile.am (permission_test): New test.
8210         * testsuite/Makefile.in: Regenerate.
8211
8212 2009-09-02  Ian Lance Taylor  <iant@google.com>
8213
8214         * output.cc (Output_file::resize): Call map_no_anonymous rather
8215         than map.
8216
8217 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8218
8219         * gold.cc: Include "incremental.h".
8220         (queue_initial_tasks): Call Incremental_checker methods.
8221         * incremental.cc: Include "output.h".
8222         (Incremental_checker::can_incrementally_link_output_file): New
8223         method.
8224         * incremental.h (Incremental_checker): New class.
8225
8226         * output.cc (Output_file::open_for_modification): New method.
8227         (Output_file::map_anonymous): Changed return type to bool.  Record
8228         map in base_ field.
8229         (Output_file::map_no_anonymous): New method, broken out of map.
8230         (Output_file::map): Use map_no_anonymous and map_anonymous.
8231         * output.h (class Output_file): Update declarations.
8232
8233 2009-08-24  Cary Coutant  <ccoutant@google.com>
8234
8235         * options.h (Command_line::Pre_options): New class.
8236         (Command_line::pre_options): New member.
8237         * options.cc (gold::options::ready_to_register): New variable.
8238         (One_option::register_option): Do nothing if not registering options.
8239         Assert if same short option registered twice.
8240         (General_options::General_options): Turn off option registration when
8241         done constructing.
8242         (Command_line::Pre_options::Pre_options): New constructor.
8243
8244 2009-08-24  Cary Coutant  <ccoutant@google.com>
8245
8246         * options.h (General_options::no_keep_memory): Remove incorrect
8247         short option.
8248
8249 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8250
8251         * Makefile.am (am__skiplex, am__skipyacc): New.
8252         * Makefile.in: Regenerate.
8253
8254 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8255
8256         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8257         (INCLUDES): ... this.
8258         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8259         (AM_CPPFLAGS): Renamed from ...
8260         (INCLUDE): ... this.
8261         * Makefile.in, testsuite/Makefile.in: Regenerate.
8262
8263         * Makefile.in: Regenerate.
8264         * aclocal.m4: Likewise.
8265         * config.in: Likewise.
8266         * configure: Likewise.
8267         * testsuite/Makefile.in: Likewise.
8268
8269         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8270         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8271         * Makefile.in: Regenerate.
8272         * testsuite/Makefile.in: Regenerate.
8273
8274 2009-08-19  Cary Coutant  <ccoutant@google.com>
8275
8276         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8277         symbols in shared libraries overridden by hidden or internal symbols
8278         in the main program.
8279
8280 2009-08-19  Chris Demetriou  <cgd@google.com>
8281
8282         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8283         checking source file names in error messages.
8284
8285 2009-08-18  Doug Kwan  <dougkwan@google.com>
8286
8287         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8288         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8289         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8290         an elfcpp::Ehdr as parameter.
8291         * object.cc (Object::set_target): Remove the version that looks up
8292         a target and sets it.
8293         (Sized_relobj::setup): Take a Target object instead of
8294         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8295         (make_elf_sized_object): Find target and ask target to
8296         make an ELF object.
8297         * object.h: (Object::set_target): Remove the version that looks up
8298         a target and sets it.
8299         (Sized_relobj::setup): Take a Target object instead of
8300         an elfcpp:Ehdr as parameter.
8301         * target.cc: Include dynobj.h.
8302         (Target::do_make_elf_object_implementation): New.
8303         (Target::do_make_elf_object): New.
8304         * target.h (Target::make_elf_object): New template declaration.
8305         (Target::do_make_elf_object): New method declarations.
8306         (Target::do_make_elf_object_implementation): New template declaration.
8307
8308 2009-08-14  Ian Lance Taylor  <iant@google.com>
8309
8310         * gold.h (FUNCTION_NAME): Define.
8311         (gold_unreachable): Use FUNCTION_NAME.
8312
8313 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8314
8315         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8316         symbol in the --keep-unique list is not found.
8317
8318 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8319
8320         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8321         been maked as --keep-unique.
8322         (Icf::unfold_section): New function.
8323         * icf.h (Icf::unfold_section): New function.
8324         * options.h (General_options::keep_unique): New option.
8325         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8326         * testsuite/Makefile.in: Regenerate.
8327         * testsuite/icf_keep_unique_test.sh: New file.
8328         * testsuite/icf_keep_unique_test.cc: New file.
8329
8330 2009-08-12  Cary Coutant  <ccoutant@google.com>
8331
8332         PR 10471
8333         * resolve.cc (Symbol_table::resolve): Check for references from
8334         dynamic objects to hidden and internal symbols.
8335         * testsuite/Makefile.am (hidden_test.sh): New test.
8336         * testsuite/Makefile.in: Regenerate.
8337         * testsuite/hidden_test.sh: New script.
8338         * testsuite/hidden_test_1.c: New test source.
8339         * testsuite/hidden_test_main.c: New test source.
8340
8341 2009-08-11  Doug Kwan  <dougkwan@google.com>
8342
8343         * arm.cc: Update comments.
8344         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8345         segment to locate the .ARM.exidx section if present.
8346
8347 2009-08-09  Doug Kwan  <dougkwan@google.com>
8348
8349         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8350         patch.
8351
8352 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8353         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8354         compiler warnings.
8355
8356 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8357
8358         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8359         valid tls_segment only for non-debug-section relocations.
8360         * testsuite/Makefile.am: Add gc_tls_test.
8361         * testsuite/Makefile.in: Regenerate.
8362         * testsuite/gc_tls_test.cc: New file.
8363         * testsuite/gc_tls_test.sh: New file.
8364
8365 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8366
8367         * icf.cc: New file.
8368         * icf.h: New file.
8369         * Makefile.am (CCFILES): Add icf.cc.
8370         (HFILES): Add icf.h
8371         * Makefile.in: Regenerate.
8372         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8373         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8374         section, symbol and addend information for the relocs.
8375         * gold.cc (queue_middle_tasks): Call identical code folding.
8376         * gold.h: Add defines for multimap.
8377         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8378         to the call of finalize_local_symbols.
8379         * main.cc (main): Create object of class Icf.
8380         * object.cc (Sized_relobj::do_layout): Allow this function to be
8381         called twice during icf.
8382         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8383         to sections marked as identical by icf.
8384         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8385         when available.
8386         (Sized_relobj::do_section_entsize): New function.
8387         * object.h (Object::section_entsize): New function.
8388         (Object::do_section_entsize): New pure virtual function.
8389         (Relobj::finalize_local_symbols): Add new parameter.
8390         (Relobj::do_section_entsize): New function.
8391         * options.h (General_options::icf): New option.
8392         (General_options::icf_iterations): New option.
8393         (General_options::print_icf_sections): New option.
8394         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8395         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8396         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8397         icf.
8398         * symtab.cc (Symbol_table::is_section_folded): New function.
8399         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8400         to sections marked as identical by icf.
8401         * symtab.h (Symbol_table::set_icf): New function.
8402         (Symbol_table::icf): New function.
8403         (Symbol_table::is_section_folded): New function.
8404         (Symbol_table::icf_): New data member.
8405         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8406         * testsuite/Makefile.am: Add commands to build icf_test.
8407         * testsuite/Makefile.in: Regenerate.
8408         * testsuite/icf_test.sh: New file.
8409         * testsuite/icf_test.cc: New file.
8410
8411 2009-07-24  Chris Demetriou  <cgd@google.com>
8412
8413         * layout.cc (is_compressible_debug_section): Fix incorrect
8414         comment about compressed section names.
8415
8416 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8417
8418         PR 10419
8419         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8420
8421 2009-07-16  Ian Lance Taylor  <iant@google.com>
8422
8423         PR 10400
8424         * layout.h: #include <map>.
8425         (class Kept_section): Change from struct to class.  Add accessors
8426         and setters.  Add section size to Comdat_group mapping.  Change
8427         Comdat_group to std::map.  Add is_comdat_ field.  Add
8428         linkonce_size field in union.
8429         (class Layout): Update declaration of find_or_add_kept_section.
8430         Don't declare find_kept_object.
8431         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8432         parameter.  Add object, shndx, is_comdat, and is_group_name
8433         parameters.  Change all callers.  Adjust for new Kept_section.
8434         (Layout::find_kept_object): Remove.
8435         * object.cc (Sized_relobj::include_section_group): Update use of
8436         Kept_section.  Rename secnum to shndx.  Only record
8437         Kept_comdat_section if sections are the same size.
8438         (Sized_relobj::include_linkonce_section): Update use of
8439         Kept_section.  Only record Kept_comdat_section if sections are the
8440         same size.  Set size of linkonce section.
8441         (Sized_relobj::map_to_kept_section): Update call to
8442         get_kept_comdat_section.
8443         * object.h (class Sized_relobj): Rename fields in
8444         Kept_comdat_section to drop trailing underscores; change object
8445         field to Relobj*.  Change Kept_comdat_section_table to store
8446         struct rather than pointer.
8447         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8448         Add kept_object and kept_shndx parameters.  Change all callers.
8449         (Sized_relobj::get_kept_comdat_section): Change return type to
8450         bool.  Add kept_object and kept_shndx parameters.  Change all
8451         callers.
8452         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8453         Layout::find_or_add_kept_section.
8454
8455 2009-07-09  Ian Lance Taylor  <iant@google.com>
8456
8457         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8458         Reserve space in the hash table.
8459
8460 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8461
8462         * fileread.cc (File_read::get_mtime): New method.
8463         * fileread.h (Timespec): New structure.
8464         (File_read::get_mtime): New method.
8465         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8466         Renamed from timestamp_nsec.
8467         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8468         Elf_Xword.
8469         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8470         timestamp_nsec.
8471         (Incremental_inputs::report_archive): Save mtime; style fix.
8472         (Incremental_inputs::report_obejct): Save mtime; style fix.
8473         (Incremental_inputs::report_script): Save mtime; style fix.
8474         (Incremental_inputs::finalize_inputs): Style fix.
8475         (Incremental_inputs::finalize): Style fix.
8476         (Incremental_inputs::create_input_section_data): Store inputs
8477         mtime.
8478         * incremental.h (Incremental_inputs::report_script): Add mtime
8479         argument.
8480         (Incremental_inputs::Input_info::Input_info): Intialize only one
8481         union member.
8482         (Incremental_inputs::Input_info::archive): Move to nameless
8483         union.
8484         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8485         (Incremental_inputs::Input_info::script): Move to nameless union.
8486         (Incremental_inputs::mtime): New field.
8487         * script.cc (read_input_script): Pass file mtime to
8488         Incremental_input.
8489         * script.h (Script_info::inputs): Style fix.
8490
8491 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8492
8493         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8494         instead of 32.
8495
8496 2009-06-24  Ian Lance Taylor  <iant@google.com>
8497
8498         PR 10156
8499         * layout.cc (Layout::choose_output_section): If we find an
8500         existing section, update the flags.
8501         (Layout::create_notes): New function, broken out of
8502         Layout::finalize.
8503         (Layout::finalize): Don't create note sections.
8504         (Layout::create_note): Don't crash if linker script discards
8505         section.
8506         (Layout::create_gold_note): Likewise.
8507         (Layout::create_build_id): Likewise.  Don't set
8508         after_input_sections on the section.
8509         (Layout::create_executable_stack_info): Remove target parameter.
8510         Change caller.
8511         * layout.h (class Layout): Declare create_notes.  Update
8512         declaration of create_executable_stack_info.
8513         * gold.cc (queue_middle_tasks): Call create_notes.
8514         * output.cc (Output_section::update_flags_for_input_section): Move
8515         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8516         invalid.
8517         * output.h (Output_data::mark_address_invalid): New function.
8518         (class Output_section): Only declare, not define,
8519         update_flags_for_input_section.  Remove set_flags.
8520
8521 2009-06-24  Ian Lance Taylor  <iant@google.com>
8522
8523         * script-sections.cc (Output_section_definition::
8524         set_section_addresses): Rename shadowing local load_address to
8525         laddr.
8526
8527 2009-06-24  Ian Lance Taylor  <iant@google.com>
8528
8529         PR 10244
8530         * reloc.cc (relocate_sections): Skip empty relocation sections.
8531
8532 2009-06-23  Ian Lance Taylor  <iant@google.com>
8533
8534         PR 10156
8535         * layout.cc (Layout::create_note): Use choose_output_section
8536         rather than make_output_section.
8537
8538 2009-06-23  Ian Lance Taylor  <iant@google.com>
8539
8540         PR 10237
8541         * options.cc (General_options::parse_V): Set printed_version_.
8542         (General_options::General_options): Initialize printed_version_.
8543         * options.h (class General_options): Add printed_version_ field.
8544         * gold.cc (queue_initial_tasks): If there are no input files,
8545         don't give a fatal error if we printed the version information.
8546         (queue_middle_tasks): If using -r with a shared object, give a
8547         fatal error rather than an ordinary error.
8548
8549 2009-06-23  Ian Lance Taylor  <iant@google.com>
8550
8551         PR 10219
8552         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8553         (Layout::make_output_section): Set have_stabstr_section_ if we see
8554         a .stab*str section.
8555         (Layout::finalize): Call link_stabs_sections.
8556         (Layout::link_stabs_sections): New file.
8557         * layout.h (class Layout): Add have_stabstr_section_ field.
8558         Declare link_stabs_sections.
8559
8560 2009-06-23  Doug Kwan  <dougkwan@google.com>
8561
8562         * Makefile.am (libgold_a_LIBADD): New.
8563         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8564         * Makefile.in: Regenerate.
8565         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8566         * configure: Regenerate.
8567         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8568         * fileread.cc: Include sys/state.h
8569         * gold.h: Declare memmem and strndup if found missing.
8570         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8571
8572 2009-06-23  Ian Lance Taylor  <iant@google.com>
8573
8574         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8575         * configure: Rebuild.
8576
8577 2009-06-23  Ian Lance Taylor  <iant@google.com>
8578
8579         PR 10147
8580         * object.cc (Object::section_contents): Don't try to get a view if
8581         the section has length zero.
8582         (Object::handle_gnu_warning_section): If the section is empty, use
8583         the name of the section as the warning.
8584
8585 2009-06-23  Ian Lance Taylor  <iant@google.com>
8586
8587         PR 10133
8588         * stringpool.h (class Stringpool_template): Add optimize_ field.
8589         (Stringpool_template::set_optimize): New function.
8590         * stringpool.cc (Stringpool_template::Stringpool_template):
8591         Initialize optimize_ field.
8592         (Stringpool_template::set_string_offsets): Test local optimize
8593         fild rather than parameter.
8594         * layout.cc (Layout::Layout): Call set_optimize on the section
8595         name stringpool.
8596
8597 2009-06-22  Ian Lance Taylor  <iant@google.com>
8598
8599         PR 10030
8600         * yyscript.y: Parse TARGET.
8601         * script.cc (script_set_target): New function.
8602         * script-c.h (script_set_target): Declare.
8603         * options.cc (General_options::string_to_object_format): Rename
8604         from string_to_object_format in anonymous namespace.  Change
8605         callers.
8606         * options.h (class General_options): Declare
8607         string_to_object_format.
8608
8609 2009-06-22  Ian Lance Taylor  <iant@google.com>
8610
8611         * script-sections.cc (Script_sections::create_segments): Don't put
8612         program headers in a PT_LOAD segment if -n or -N.
8613
8614 2009-06-22  Ian Lance Taylor  <iant@google.com>
8615
8616         PR 10141
8617         * options.h (class General_options): Add -z lazy and -z now.  Sort
8618         -z options into alphabetical order.
8619         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8620
8621 2009-06-21  Ian Lance Taylor  <iant@google.com>
8622
8623         * layout.cc (Layout::make_output_section): Call
8624         Target::new_output_section.
8625         (Layout::attach_allocated_section_to_segment): Put large section
8626         sections in a separate load segment with the large segment flag
8627         set.
8628         (Layout::segment_precedes): Sort large data segments after other
8629         load segments.
8630         (align_file_offset): New static function.
8631         (Layout::set_segment_offsets): Use align_file_offset.
8632         * output.h (class Output_section): Add is_small_section_ and
8633         is_large_section_ fields.
8634         (Output_section::is_small_section): New function.
8635         (Output_section::set_is_small_section):  New function.
8636         (Output_section::is_large_section): New function.
8637         (Output_section::set_is_large_section): New function.
8638         (Output_section::is_large_data_section): New function.
8639         (class Output_segment): Add is_large_data_segment_ field.
8640         (Output_segment::is_large_data_segment): New function.
8641         (Output_segment::set_is_large_data_segment): New function.
8642         * output.cc (Output_section::Output_section): Initialize new
8643         fields.
8644         (Output_segment::Output_segment): Likewise.
8645         (Output_segment::add_output_section): Add assertion that large
8646         data sections always go in large data segments.  Force small data
8647         sections to the end of the list of data sections.  Force small BSS
8648         sections to the start of the list of BSS sections.  For large BSS
8649         sections to the end of the list of BSS sections.
8650         * symtab.h (class Symbol): Declare is_common_shndx.
8651         (Symbol::is_defined): Check Symbol::is_common_shndx.
8652         (Symbol::is_common): Likewise.
8653         (class Symbol_table): Define enum Commons_section_type.  Update
8654         declarations.  Add small_commons_ and large_commons_ fields.
8655         * symtab.cc (Symbol::is_common_shndx): New function.
8656         (Symbol_table::Symbol_table): Initialize new fields.
8657         (Symbol_table::add_from_object): Put small and large common
8658         symbols in the right list.
8659         (Symbol_table::sized_finalized_symbol): Check
8660         Symbol::is_common_shndx.
8661         (Symbol_table::sized_write_globals): Likewise.
8662         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8663         common symbol lists.  Don't call do_allocate_commons_list if the
8664         list is empty.
8665         (Symbol_table::do_allocate_commons_list): Remove is_tls
8666         parameter.  Add comons_section_type parameter.  Change all
8667         callers.  Handle small and large common symbols.
8668         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8669         Symbol::is_common_shndx.
8670         * resolve.cc (symbol_to_bits): Likewise.
8671         * target.h (Target::small_common_shndx): New function.
8672         (Target::small_common_section_flags): New function.
8673         (Target::large_common_shndx): New function.
8674         (Target::large_common_section_flags): New function.
8675         (Target::new_output_section): New function.
8676         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8677         small_common_section_flags, and large_common_section_flags
8678         fields.
8679         (Target::do_new_output_section): New virtual function.
8680         * arm.cc (Target_arm::arm_info): Initialize new fields.
8681         * i386.cc (Target_i386::i386_info): Likewise.
8682         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8683         Likewise.
8684         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8685         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8686         (Target_x86_64::do_new_output_section): New function.
8687         * configure.ac: Define conditional MCMODEL_MEDIUM.
8688         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8689         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8690         (large_LDFLAGS): Define.
8691         * testsuite/large.c: New file.
8692         * testsuite/testfile.cc (Target_test::test_target_info):
8693         Initialize new fields.
8694         * configure, testsuite/Makefile.in: Rebuild.
8695
8696 2009-06-05  Doug Kwan  <dougkwan@google.com>
8697
8698         * Makefile.am (CCFILES): Add target.cc.
8699         * Makefile.in: Regenerate.
8700         * i386.cc (class Target_i386): Define new virtual method to
8701         override do_is_local_label_name in parent.
8702         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8703         local symbols if --discard-locals or -X is given.
8704         * options.h (class General_options): Declare new options
8705         '--discard-locals' and '-X' for discarding locals.
8706         * target.h (class Target): Define new methods is_local_label_name.
8707         Declare new virtual method do_is_local_label_name.
8708         * target.cc: New file.
8709         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8710         (check_SCRIPTS): Add discard_locals_test.sh.
8711         (check_DATA): Add discard_local_tests.syms.
8712         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8713         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8714         * testsuite/Makefile.in: Regenerate.
8715         * testsuite/discard_locals_test.c: New file.
8716         * testsuite/discard_locals_test.sh: Same.
8717
8718 2009-06-05  Doug Kwan  <dougkwan@google.com>
8719
8720         * object.cc (Sized_relobj::Sized_relobj): Initialize
8721         discarded_eh_frame_shndx_ to -1U.
8722         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8723         section.
8724         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8725         a discarded .eh_frame section.
8726         (Sized_relobj::do_finalize_local_symbols): Ditto.
8727         * object.h (class Sized_relobj): Declare new member
8728         discarded_eh_frame_shndx_.
8729         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8730         (local_labels_test.o, local_labels_test): New rules.
8731         * testsuite/Makefile.in: Regenerate.
8732
8733 2009-06-04  Doug Kwan  <dougkwan@google.com>
8734
8735         * layout.cc (Layout::section_name_mapping): Add mapping for
8736         special ARM sections.
8737
8738 2009-06-03  Doug Kwan  <dougkwan@google.com>
8739
8740         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8741         (utils::has_overflow): Same.
8742
8743 2009-06-03  Ian Lance Taylor  <iant@google.com>
8744
8745         * layout.cc (Layout::section_name_mapping): New array, replacing
8746         Layout::linkonce_mapping.
8747         (Layout::section_name_mapping_count): New variable, replacing
8748         Layout::linkonce_mapping_count.
8749         (Layout::linkonce_output_name): Remove.
8750         (Layout::output_section_name): Rewrite.
8751         * layout.h (class Layout): Rename Linkonce_mapping to
8752         Section_name_mapping, linkonce_mapping to section_name_mapping,
8753         linkonce_mapping_count to section_name_mapping_count.  Don't
8754         declare linkonce_output_name.
8755
8756 2009-06-03  Doug Kwan  <dougkwan@google.com>
8757
8758         * gold/arm.cc (namespace utils): New.
8759         (Target_arm::reloc_is_non_pic): Define new method.
8760         (class Arm_relocate_functions): New.
8761         (Target_arm::Relocate::relocate): Handle relocation types used by
8762         Android.
8763
8764 2009-06-03  Ian Lance Taylor  <iant@google.com>
8765
8766         * arm.cc (Target_arm::scan::global): Use || instead of |.
8767
8768 2009-06-02  Doug Kwan  <dougkwan@google.com>
8769
8770         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8771         issued_non_pic_error_.
8772         (class Target_arm::Scan): Declare new method check_non_pic.
8773         Define new method symbol_needs_plt_entry.
8774         Declare new data member issued_non_pic_error_.
8775         (class Target_arm::Relocate): Declare new method
8776         should_apply_static_reloc.
8777         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8778         (Target_arm::Scan::check_non_pic): Define new method.
8779         (Target_arm::Scan::local): Handle a small subset of reloc types used
8780         by Android.
8781         (Target_arm::Scan::local): Same.
8782         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8783
8784 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8785
8786         * incremental.cc (Incremental_inputs::report_command_line): Filter
8787         out --incremental-* options.
8788
8789 2009-05-29  Doug Kwan  <dougkwan@google.com>
8790
8791         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8792         template class.
8793         (class Target_arm): Update comment.
8794         (Target_arm::Target_arm): Initialize new data members GOT_,
8795         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8796         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8797         and Target_arm::rel_dyn_section.
8798         Declare new_enum Target_arm::Got_type.
8799         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8800         and DYNBSS_.
8801         Update commments for member do_dynsym_value.
8802         (Target_arm::got_size, Target_arm::plt_section,
8803         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8804         new methods inside class defintion.
8805         (Target_arm::got_section): Define new method.
8806         (Target_arm::rel_dyn_section): Same.
8807         (Output_data_plt_arm): New template class.
8808         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8809         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8810         (Output_data_plt_arm::add_entry): Same.
8811         (Output_data_plt_arm::first_plt_entry): Define new
8812         static data member for PLT instruction template.
8813         (Output_data_plt_arm::plt_entry): Same.
8814         (Output_data_plt_arm::do_write): Define new method.
8815         (Target_arm::make_plt_entry): Same.
8816         (Target_arm::do_finalize_sections): Same.
8817         (Target_arm::do_dynsym_value): Same.
8818
8819 2009-05-28  Doug Kwan  <dougkwan@google.com>
8820
8821         * Makefile.am (TARGETSOURCES): Add arm.cc.
8822         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8823         * Makefile.in: Regenerate.
8824         * arm.cc: New file.
8825         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8826
8827 2009-05-26  Doug Kwan  <dougkwan@google.com>
8828
8829         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8830         (General_options::check_excluded_libs): Strip off directories in
8831         archive name before matching like GNU ld does.
8832         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8833         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8834         (exclude_libs_test_LDFLAGS): Add linker option
8835         -Wl,--exclude-libs,libexclude_libs_test_3
8836         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8837         an explicit archive without using -l.
8838         (alt/libexclude_libs_test_3.a): New make rule.
8839         * testsuite/Makefile.in: Regenerate.
8840         * testsuite/exclude_libs_test.c : Declare lib3_default().
8841         (main): Call it.
8842         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8843         * exclude_libs_test_3.c: New file.
8844
8845 2009-05-26  Nick Clifton  <nickc@redhat.com>
8846
8847         * po/id.po: New Indonesian translation.
8848         * po/gold.pot: Updated template file.
8849
8850 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8851
8852         * testsuite/Makefile.am: Add -ffunction-sections to compile
8853         gc_comdat_test files.  Add -Wl,--gc-sections to build
8854         gc_comdat_test.
8855         * testsuite/Makefile.in: Regenerate.
8856         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8857
8858 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8859
8860         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8861         kept comdat section was garbage collected.
8862         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8863         * testsuite/Makefile.in: Regenerate.
8864         * testsuite/gc_comdat_test.sh: New file.
8865         * testsuite/gc_comdat_test_1.cc: New file.
8866         * testsuite/gc_comdat_test_2.cc: New file.
8867
8868 2009-05-19  Doug Kwan  <dougkwan@google.com>
8869
8870         * archive.cc (Archive::Archive): Move constructor from archive.h
8871         to here.  Initialize no_export_.
8872         (Archive::get_elf_object_for_member): Set no_export flag of object.
8873         * archive.h (Archive::Archive): Move constructor body to
8874         archive.cc.
8875         (Archive::no_export): New method.
8876         (Archive::no_export_): New field.
8877         * object.h (Object::Object): Initialize no_export_ to false.
8878         (Object::no_export, Object::set_no_export): New methods.
8879         (Object::no_export_): New field.
8880         * options.cc (General_options::parse_exclude_libs): New method.
8881         (General_options::check_excluded_libs) Same.
8882         * options.h (exclude_libs): New option.
8883         (General_options::check_excluded_libs): New method declaration.
8884         (General_options::excluded_libs_): New field.
8885         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8886         default or protected visibility if an object has no-export flag set.
8887         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8888         (check_SCRIPTS): Add exclude_libs_test.sh.
8889         (check_DATA): Add exclude_libs_test.syms.
8890         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8891         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8892         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8893         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8894         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8895         libexclude_libs_test_2.a): New rules.
8896         * testsuite/Makefile.in: Regenerate.
8897         * testsuite/exclude_libs_test.c: New file.
8898         * testsuite/exclude_libs_test.sh: Ditto.
8899         * testsuite/exclude_libs_test_1.c: Ditto.
8900         * testsuite/exclude_libs_test_2.c: Ditto.
8901
8902 2009-05-15  Ian Lance Taylor  <iant@google.com>
8903
8904         * configure.ac: Check for declarations for cases where libiberty.h
8905         checks HAVE_DECL_xxx.
8906         * configure, config.in: Rebuild.
8907
8908 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8909
8910         * gold.h (Incremental_argument_list): Remove (invalid) forward
8911         declaration.
8912         * incremental.cc (Incremental_inputs::report_achive): New method.
8913         (Incremental_inputs::report_object): New method.
8914         (Incremental_inputs::report_script): New method.
8915         (Incremental_inputs::finalize_inputs): New method.
8916         (Incremental_inputs::finalize): Call finalize_inputs().
8917         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8918         Create inputs entries.
8919         * incremental.h (Incremental_input_type): New enum.
8920         (Incremental_inputs::Incremental_input): Initialize new fields.
8921         (Incremental_inputs::report_inputs): New method.
8922         (Incremental_inputs::report_achive): New method.
8923         (Incremental_inputs::report_object): New method.
8924         (Incremental_inputs::report_script): New method.
8925         (Incremental_inputs::finalize_inputs): New method.
8926         (Incremental_inputs::Input_info): New struct.
8927         (Incremental_inputs::Input_info_map): New typedef.
8928         (Incremental_inputs::lock_): New field.
8929         (Incremental_inputs::Inputs_): New field.
8930         (Incremental_inputs::Inputs_map): New field.
8931         * main.cc (main): Call Incremental_input::report_inputs.
8932         * options.h (Input_argument_list): Typedef moved from
8933         Input_arguments.
8934         (Input_file_group::Files): Remove, use ::Input_argument_list.
8935         (Input_file_group::Input_argument_list): Remove, use
8936         ::Input_argument_list.
8937         * plugin.cc (Plugin_manager::add_input_file): Add error in
8938         incremental build.
8939         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8940         functions.
8941         * script.cc (read_input_script): Call
8942         Incremental_input::report_script.
8943         * script.h (Script_info): New class.
8944
8945 2009-04-27  Ian Lance Taylor  <iant@google.com>
8946
8947         * x86_64.cc (do_adjust_output_section): Set entsize to
8948         plt_entry_size.
8949
8950 2009-04-23  Elliott Hughes  <enh@google.com>
8951
8952         * output.cc (Output_file::close): After short writes, continue
8953         writing from the correct offset in the buffer being written.
8954
8955 2009-04-23  Chris Demetriou  <cgd@google.com>
8956
8957         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8958         * configure: Regenerate.
8959         * config.in: Regenerate.
8960         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8961         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8962
8963 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8964
8965         * incremental.cc (Incremental_inputs_header_data): Renamed from
8966         Incremental_input_header_data.
8967         (Incremental_inputs_header_data::data_size): New field.
8968         (Incremental_inputs_header_data::put_input_file_count): Renamed
8969         from input_file_count.
8970         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8971         from command_line_offset.
8972         (Incremental_inputs_header_data::put_reserved): Renamed from
8973         put_reserved.
8974         (Incremental_inputs_entry_data): Renamed from
8975         Incremental_input_entry_data.
8976         (Incremental_inputs_entry_data::data_size): New field.
8977         (Incremental_inputs::report_command_line): New method.
8978         (Incremental_inputs::finalize): New method.
8979         (Incremental_inputs::create_incremental_inputs_data): New method.
8980         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8981         * incremental.h: New file.
8982         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8983        (Layout::finalize): Create incremental inputs section in
8984         incremental builds.
8985        (Layout::create_incremental_info_sections): New method.
8986         * layout.h (Layout::incremental_inputs): New method.
8987        (Layout::create_incremental_info_sections): New method.
8988        (Layout::incremental_inputs_): New field.
8989         * main.cc (main): Notify Incremental_input of the command line.
8990
8991 2009-04-01  Ian Lance Taylor  <iant@google.com>
8992             Mikolaj Zalewski  <mikolajz@google.com>
8993
8994         * gold.h (reserve_unordered_map): Define, three versions, one for
8995         each version of Unordered_map.
8996         * layout.cc (Layout::Layout): Remove options parameter.  Add
8997         number_of_input_files parameter.  Don't initialize options_.
8998         Initialize number_of_input_files_ and resized_signatures_.  Move
8999         sections_are_attached_.
9000         (Layout::layout_group): Reserve space for group_signatures_.
9001         (Layout::find_or_add_kept_section): Change name parameter to be a
9002         reference.  Resize signatures_ map when it gets large enough.
9003         (Layout::layout_eh_frame): Use parameters->options() instead of
9004         this->options_.
9005         (Layout::make_output_section): Likewise.
9006         (Layout::attach_allocated_section_to_segment): Likewise.
9007         (Layout::finalize, Layout::create_executable_stack): Likewise.
9008         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9009         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9010         * layout.h (class Layout): Update declarations.  Remove options_
9011         field.  Add number_of_input_files_ and resized_signatures_
9012         fields.  Move sections_are_attached_ field.
9013         * main.cc (main): Pass number of input files to Layout
9014         constructor.  Don't pass options.
9015
9016 2009-03-30  Ian Lance Taylor  <iant@google.com>
9017
9018         * ffsll.c (ffsll): Correct implementation.
9019
9020 2009-03-27  Ian Lance Taylor  <iant@google.com>
9021
9022         * ffsll.c: New file.
9023         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9024         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9025         * ftruncate.c (ftruncate): Declare before definition.
9026         * mremap.c (mremap): Likewise.
9027         * pread.c (pread): Likewise.
9028         * configure, Makefile.in, config.in: Rebuild.
9029
9030         * mremap.c: New file.
9031         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9032         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9033         (mremap): Declare if HAVE_MREMAP is not defined.
9034         * configure, Makefile.in, config.in: Rebuild.
9035
9036 2009-03-27  Cary Coutant  <ccoutant@google.com>
9037
9038         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9039         position independent.
9040         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9041         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9042
9043 2009-03-24  Cary Coutant  <ccoutant@google.com>
9044
9045         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9046         an executable.
9047         (needs_dynamic_reloc): Likewise.
9048
9049 2009-03-24  Ian Lance Taylor  <iant@google.com>
9050
9051         * yyscript.y (file_cmd): Recognize EXTERN.
9052         (extern_name_list, extern_name_list_body): New nonterminals.
9053         * script.cc (script_add_extern): Define.
9054         * script-c.h (script_add_extern): Declare.
9055
9056 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9057
9058         * object.cc (is_elf_object): Define.
9059         * object.h (is_elf_object): Declare.
9060         * archive.cc (Archive::get_elf_object_for_member): Call
9061         is_elf_object.
9062         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9063
9064 2009-03-24  Elliott Hughes  <enh@google.com>
9065
9066         * output.cc (Output_file::map_anonymous): Define.
9067         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9068         try an anonymous one.  Report the size if the mmap fails.
9069         * output.h (class Output_file): Declare map_anonymous.
9070
9071 2009-03-24  Ian Lance Taylor  <iant@google.com>
9072
9073         * target-select.cc (instantiate_target): Don't acquire the lock if
9074         the instantiated_target_ field has already been set.
9075
9076 2009-03-23  Ian Lance Taylor  <iant@google.com>
9077
9078         * gold-threads.h (class Initialize_lock): Define.
9079         * gold-threads.cc (class Initialize_lock_once): Define.
9080         (initialize_lock_control): New static variable.
9081         (initialize_lock_pointer): New static variable.
9082         (initialize_lock_once): New static function.
9083         (Initialize_lock::Initialize_lock): Define.
9084         (Initialize_lock::initialize): Define.
9085         * target-select.h: Include "gold-threads.h".
9086         (class Target_selector): Add lock_ and initialize_lock_ fields.
9087         Don't define instantiate_target, just declare it.
9088         * target-select.cc (Target_selector::Target_selector): Initialize
9089         new fields.
9090         (Target_selector::instantiate_target): Define.
9091         * descriptors.h: Include "gold-threads.h".
9092         (class Descriptors): Add initialize_lock_ field.
9093         * descriptors.cc (Descriptors::Descriptors): Initialize new
9094         field.
9095         (Descriptors::open): Use initialize_lock_ field
9096         * errors.h (class Errors): Add initialize_lock_ field.
9097         * errors.cc (Errors::Errors): Initialize new field.
9098         (Errors::initialize_lock): Use initialize_lock_ field.
9099         * powerpc.cc (class Target_selector_powerpc): Remove
9100         instantiated_target_ field.  In do_recognize call
9101         instantiate_target rather than do_instantiate_target.  In
9102         do_instantiate_target just allocate a new target.
9103         * sparc.cc (class Target_selector_sparc): Likewise.
9104
9105         * freebsd.h: New file.
9106         * i386.cc: Include "freebsd.h".
9107         (Target_i386): Derive from Target_freebsd rather than
9108         Sized_target.
9109         (Target_selector_i386): Derive from Target_selector_freebsd rather
9110         than Target_selector.
9111         * x86_64.cc: Include "freebsd.h".
9112         (Target_x86_64): Derive from Target_freebsd rather than
9113         Sized_target.
9114         (Target_selector_x86_64): Derive from Target_selector_freebsd
9115         rather than Target_selector.
9116         * target.h (class Target): Add adjust_elf_header and
9117         do_adjust_elf_header.
9118         * output.cc (Output_file_header:: do_sized_write): Call target
9119         adjust_elf_header routine.
9120         * configure.tgt: Set targ_osabi.
9121         * configure.ac: Define GOLD_DEFAULT_OSABI.
9122         * parameters.cc (Parameters::default_target): Pass
9123         GOLD_DEFAULT_OSABI to select_target.
9124         * target-select.h (class Target_selector): Make instantiate_target
9125         protected rather than private.
9126         * Makefile.am (HFILES): Add freebsd.h.
9127         * configure, Makefile.in, config.in: Rebuild.
9128
9129         * merge.cc (do_add_input_section): Correct pend value.  Change
9130         message about last entry not being null terminated from error to
9131         warning.
9132
9133 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9134
9135         * incremental.cc: New file.
9136         * Makefile.am (CCFILES): Add incremental.cc.
9137         * Makefile.in: Rebuild.
9138
9139 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9140
9141         * layout.cc (Layout::output_section_name): Preserve names
9142         of '.note.' sections.
9143
9144 2009-03-19  Ian Lance Taylor  <iant@google.com>
9145
9146         * descriptors.cc (Descriptors::open): Check that the options are
9147         valid before using them.
9148
9149 2009-03-18  Ian Lance Taylor  <iant@google.com>
9150
9151         * script-sections.h: Include <list>.
9152         (class Script_sections): Change Sections_elements from std::vector
9153         to std::list.  Typedef public Elements_iterator.  Add
9154         orphan_section_placement_, data_segment_align_start_, and
9155         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9156         field.
9157         * script-sections.cc (class Orphan_section_placement): New class.
9158         (class Sections_element): Add virtual functions is_relro and
9159         orphan_section_init.  Remove virtual function place_orphan_here.
9160         (class Output_section_definition): Add is_relro and
9161         orphan_section_init.  Remove place_orphan_here.
9162         (class Orphan_output_section): Likewise.
9163         (Script_sections::Script_sections): Update for field changes.
9164         (Script_sections::data_segment_align): Set saw_data_segment_align_
9165         and data_segment_align_start_, not data_segment_align_index.
9166         (Script_sections::data_segment_relro_end): Check
9167         saw_data_segment_align_.  Use data_segment_align_start_ rather
9168         than data_segment_align_index_.
9169         (Script_sections::place_orphan): Rewrite to use
9170         Orphan_section_placement.
9171
9172 2009-03-17  Ian Lance Taylor  <iant@google.com>
9173
9174         * archive.cc (Archive::add_symbols): Check for a version attached
9175         to the symbol name in the archive map.
9176         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9177         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9178         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9179         (ver_test_11.a): New target.
9180         * testsuite/Makefile.in: Rebuild.
9181
9182         * configure.ac: Check for chsize and posix_fallocate.  Replace
9183         ftruncate.
9184         * ftruncate.c: New file, from gnulib.
9185         * output.cc (posix_fallocate): Define dummy version if not
9186         HAVE_POSIX_FALLOCATE.
9187         (Output_file::map): Call posix_fallocate rather than lseek and
9188         write.
9189         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9190         * configure, Makefile.in, config.in: Rebuild.
9191
9192 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9193
9194         * layout.h (Layout::create_note): Add section_name parameter.
9195         * layout.cc (Layout::create_note): Likewise.
9196         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9197
9198 2009-03-17  Ian Lance Taylor  <iant@google.com>
9199
9200         * descriptors.cc: Include "options.h".
9201         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9202         (Descriptors::open): Always use O_CLOEXEC when opening a new
9203         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9204         then set FD_CLOEXEC.
9205
9206         * sparc.cc (class Target_sparc): Add has_got_section.
9207         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9208         make sure we have a GOT section.
9209
9210         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9211         (Target_sparc::Scan::local): Likewise.
9212         (Target_sparc::Scan::global): Likewise.
9213         (Target_sparc::Relocate::relocate): Likewise.
9214         (Target_sparc::Relocate::relocate_tls): Likewise.
9215
9216         * symtab.cc (Symbol_table::define_default_version): New function,
9217         broken out of add_from_object.
9218         (Symbol_table::add_from_object): Call define_default_version.
9219         (Symbol_table::define_special_symbol): Add resolve_oldsym
9220         parameter.  Change all callers.  If the version for a symbol comes
9221         from a version script, resolve it with the symbol with the same
9222         name with no version.  Also add the symbol without a version if
9223         appropriate.
9224         (do_define_in_output_data): If resolving with oldsym, don't delete
9225         sym.
9226         (do_define_in_output_segment): Likewise.
9227         (do_define_as_constant): Likewise.
9228         * symtab.h (class Symbol_table): Update declarations.
9229
9230 2009-03-13  Ian Lance Taylor  <iant@google.com>
9231
9232         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9233         (Read_symbols::requeue): New function.
9234         (Read_symbols::do_read_symbols): If make_elf_object fails because
9235         the target type is not configured, and the file was searched for,
9236         issue a warning and retry with the next directory.
9237         (Add_symbols::run): If the file has an incompatible format, and
9238         it was searched for, requeue the Read_symbols task.  On error,
9239         release the object.
9240         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9241         dirindex parameter to constructor.  Change all callers.  Declare
9242         incompatible_warning and requeue.
9243         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9244         input_argument_ and input_group_ fields.  Add them to
9245         constructor.  Change all callers.
9246         (class Read_script): Add dirindex_ field.  Add it to constructor.
9247         Change all callers.
9248         * archive.cc (Archive::setup): Remove input_objects parameter.
9249         Change all callers.
9250         (Archive::get_file_and_offset): Likewise.
9251         (Archive::read_all_symbols): Likewise.
9252         (Archive::read_symbols): Likewise.
9253         (Archive::get_elf_object_for_member): Remove input_objects
9254         parameter.  Add punconfigured parameter.  Change all callers.
9255         (Archive::add_symbols): Change return type to bool.  Check return
9256         value of include_member.
9257         (Archive::include_all_members): Likewise.
9258         (Archive::include_member): Change return type to bool.  Return
9259         false if first included object has incompatible target.  Set
9260         included_member_ field.
9261         (Add_archive_symbols::run): If add_symbols returns false, requeue
9262         Read_symbols task.
9263         * archive.h (class Archive): Add included_member_ field.
9264         Initialize it in constructor.  Add input_file and searched_for
9265         methods.  Update declarations.
9266         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9267         input_argument_ fields.  Add them to constructor.  Change all
9268         callers.
9269         * script.cc: Include "target-select.h".
9270         (class Parser_closure): Add skip_on_incompatible_target_ and
9271         found_incompatible_target_ fields.  Add
9272         skip_on_incompatible_target parameter to constructor.  Change all
9273         callers.  Add methods skip_on_incompatible_target,
9274         clear_skip_on_incompatible_target, found_incompatible_target, and
9275         set_found_incompatible_target.
9276         (read_input_script): Add dirindex parameter.  Change all callers.
9277         If parser finds an incompatible target, requeue Read_symbols
9278         task.
9279         (script_set_symbol): Clear skip_on_incompatible_target in
9280         closure.
9281         (script_add_assertion, script_parse_option): Likewise.
9282         (script_start_sections, script_add_phdr): Likewise.
9283         (script_check_output_format): New function.
9284         * script.h (read_input_script): Update declaration.
9285         * script-c.h (script_check_output_format): Declare.
9286         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9287         (ignore_cmd): Remove OUTPUT_FORMAT.
9288         * fileread.cc (Input_file::Input_file): Add explicit this.
9289         (Input_file::will_search_for): New function.
9290         (Input_file::open): Add pindex parameter.  Change all callers.
9291         * fileread.h (class Input_file): Add input_file_argument method.
9292         Declare will_search_for.  Update declarations.
9293         * object.cc (make_elf_object): Add punconfigured parameter.
9294         Change all callers.
9295         * object.h (class Object): Make input_file public.  Add
9296         searched_for method.
9297         (make_elf_object): Update declaration.
9298         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9299         restart search.
9300         * dirsearch.h (class Dirsearch): Update declaration.
9301         * options.h (class General_options): Add --warn-search-mismatch.
9302         * parameters.cc (Parameters::is_compatible_target): New function.
9303         * parameters.h (class Parameters): Declare is_compatible_target.
9304         * workqueue.cc (Workqueue::add_blocker): New function.
9305         * workqueue.h (class Workqueue): Declare add_blocker.
9306
9307         * fileread.cc (Input_file::open): Remove options parameter.
9308         Change all callers.
9309         (Input_file::open_binary): Likewise.
9310         * script.cc (read_input_script): Likewise.
9311         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9312         options parameter from constructor.  Change all callers.
9313         (class Read_script): Likewise.
9314         * fileread.h (class Input_file): Update declarations.
9315         * script.h (read_input_script): Update declaration.
9316
9317 2009-03-10  Nick Clifton  <nickc@redhat.com>
9318
9319         * po/es.po: New Spanish translation.
9320
9321 2009-03-06  Cary Coutant  <ccoutant@google.com>
9322
9323         * options.cc (parse_short_option): Keep dash_z from registering itself.
9324
9325 2009-03-03  Ian Lance Taylor  <iant@google.com>
9326
9327         PR 9918
9328         * target-reloc.h (relocate_section): Pass output_section to
9329         relocate.
9330         * i386.cc (Target_i386::should_apply_static_reloc): Add
9331         output_section parameter.  Change all callers.
9332         (Target_i386::Relocate::relocate): Add output_section parameter.
9333         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9334         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9335         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9336         * testsuite/two_file_shared.sh: New script.
9337         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9338         (check_DATA): Add two_file_shared.dbg.
9339         (two_file_shared.dbg): New target.
9340         * testsuite/Makefile.in: Rebuild.
9341
9342 2009-03-01  Ian Lance Taylor  <iant@google.com>
9343
9344         * configure.ac: Check for byteswap.h.
9345         * configure: Rebuild.
9346         * config.in: Rebuild.
9347
9348 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9349
9350         * layout.cc (Layout::find_or_add_kept_section): New function.
9351         (Layout::add_comdat): Removed.
9352         * layout.h (struct Kept_section): Move out of class Layout.
9353         Remove trailing underscores from field names.  Add group_sections
9354         field.  Rename group_ field to is_group.  Change all uses.
9355         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9356         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9357         comdat_groups_ field.
9358         (Sized_relobj::include_section_group): Use
9359         find_or_add_kept_section and Kept_section::group_sections.
9360         (Sized_relobj::include_linkonce_section): Likewise.
9361         * object.cc (class Sized_relobj): Don't define Comdat_group or
9362         Comdat_group_table.  Remove find_comdat_group and
9363         add_comdat_group.  Remove comdat_groups_ field.
9364         * plugin.cc (include_comdat_group): Use
9365         Layout::find_or_add_kept_section.
9366
9367 2009-02-28  Ian Lance Taylor  <iant@google.com>
9368
9369         * README: --gc-sections and map files are now supported.  Document
9370         some build requirements.
9371
9372         PR 6992
9373         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9374         relocatable link set the value of the section symbol to zero.
9375         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9376         relocatable link don't include the section address in the local
9377         symbol value.
9378
9379 2009-02-27  Ian Lance Taylor  <iant@google.com>
9380
9381         PR 6811
9382         * options.h (class Search_directory): Add is_system_directory.
9383         (class General_options): Declare is_in_system_directory.
9384         * options.cc (get_relative_sysroot): Make static.
9385         (get_default_sysroot): Make static.
9386         (General_optoins::is_in_system_directory): New function.
9387         * fileread.cc (Input_file::is_in_system_directory): New function.
9388         * fileread.h (class Input_file): Declare is_in_system_directory.
9389         * object.h (class Object): Add is_in_system_directory.
9390         (class Input_objects): Remove system_library_directory_ field.
9391         * object.cc (Input_objects::add_object): Don't set
9392         system_library_directory_.
9393         (input_objects::found_in_system_library_directory): Remove.
9394         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9395         parameter.  Change all callers.
9396         (Symbol_table::sized_write_globals): Likewise.
9397         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9398         Call Object::is_in_system_directory.
9399         * symtab.h (class Symbol_table): Update declarations.
9400
9401         PR 5990
9402         * descriptors.h (Open_descriptor): Add is_on_stack field.
9403         * descriptors.cc (Descriptors::open): If the descriptor is on the
9404         top of the stack, remove it.  Initialize is_on_stack field.
9405         (Descriptors::release): Only add pod to stack if it is not on the
9406         stack already.
9407         (Descriptors::close_some_descriptor): Clear stack_next and
9408         is_on_stack fields.
9409
9410         PR 7091
9411         * output.cc (Output_section::find_starting_output_address): Rename
9412         from starting_output_address; add PADDR parameter; change return
9413         type.
9414         * output.h (class Output_section): Declare
9415         find_starting_output_address instead of starting_output_address.
9416         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9417         section symbol for which we can't find a merge section.
9418
9419         PR 9836
9420         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9421         hidden or internal, force the symbol to be local.
9422         * resolve.cc (Symbol::override_visibility): Define.
9423         (Symbol::override_base): Use override_visibility.
9424         (Symbol_table::resolve): Likewise.
9425         (Symbol::override_base_with_special): Likewise.
9426         (Symbol_table::override_with_special): If the visibility is hidden
9427         or internal, force the symbol to be local.
9428         * symtab.h (class Symbol): Add set_visibility and
9429         override_visibility.
9430         * testsuite/ver_test_1.sh: New file.
9431         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9432         (check_DATA): Add ver_test_1.syms.
9433         (ver_test_1.syms): New target.
9434         * testsuite/Makefile.in: Rebuild.
9435
9436 2009-02-25  Cary Coutant  <ccoutant@google.com>
9437
9438         * layout.cc (Layout::choose_output_section): Don't rename sections
9439         when using a linker script that has a SECTIONS clause.
9440         * Makefile.in: Regenerate.
9441
9442         * testsuite/Makefile.am (script_test_5.sh): New test case.
9443         * testsuite/Makefile.in: Regenerate.
9444         * testsuite/script_test_5.cc: New file.
9445         * testsuite/script_test_5.sh: New file.
9446         * testsuite/script_test_5.t: New file.
9447
9448 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9449
9450         * archive.cc (Archive::include_member): Update calls to add_symbols.
9451         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9452         the Layout argument.
9453         * dynobj.h (do_add_symbols): Add the Layout argument.
9454         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9455         Layout argument.
9456         * object.h (Object::add_symbols): Add the Layout argument.
9457         (Object::do_add_symbols): Add the Layout argument.
9458         (Sized_relobj::do_add_symbols): Add the Layout argument.
9459         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9460         Unify the two versions.
9461         (Add_plugin_symbols): Remove.
9462         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9463         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9464         (Add_plugin_symbols): Remove.
9465         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9466         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9467         (Add_symbols::run): Make it work with Pulginobj.
9468
9469 2009-02-06  Ian Lance Taylor  <iant@google.com>
9470
9471         * object.cc (Sized_relobj::do_layout): Make info message start
9472         with lower case letter.
9473
9474 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9475
9476         * binary.cc: Fix file comment.
9477
9478         * options.h (enum Incremental_disposition): Define.
9479         (class General_options): Add new options: --incremental,
9480         --incremental_changed, --incremental_unchanged,
9481         --incremental_unknown.  Add incremental_disposition_ and
9482         implicit_incremental_ fields.
9483         (General_options::incremental_disposition): New function.
9484         (class Position_dependent_options): Add incremental_disposition
9485         option.
9486         (Position_dependent_options::copy_from_options): Set incremental
9487         dispositions.
9488         * options.cc (General_options::parse_incremental_changed): New
9489         function.
9490         (General_options::parse_incremental_unchanged): New function.
9491         (General_options::parse_incremental_unknown): New function.
9492         (General_options::General_options): Initialize new fields
9493         incremental_disposition_ and implicit_incremental_.
9494         (General_options::finalize): Check for uasge of --incremental-*
9495         without --incremental.
9496
9497 2009-02-06  Chris Demetriou  <cgd@google.com>
9498
9499         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9500         pointer and to report location as the file name associated with
9501         the symbol.
9502         (gold_undefined_symbol_at_location): New function to replace the
9503         old gold_undefined_symbol functionality.
9504         * target-reloc.h (relocate_section): Update to use
9505         gold_undefined_symbol_at_location.
9506         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9507         Call gold_undefined_symbol function rather than gold_error.
9508         * errors.h (Errors::undefined_symbol): Take location as a
9509         string, rather than calculating it from a relocation.
9510         * errors.cc (Errors::fatal): Print "fatal error:" before the
9511         formatted message.
9512         (Errors::error, Errors::error_at_location): Print "error: "
9513         before the formatted message.
9514         (Errors::undefined_symbol): Take location as a string, rather
9515         than calculating it from a relocation.
9516         (gold_undefined_symbol_at_location): New function akin to
9517         old gold_undefined_symbol, calculates location from relocation.
9518         (gold_undefined_symbol): Change to take only a Symbol pointer
9519         and to report location as the file name associated with the symbol.
9520         * testsuite/debug_msg.sh: Update for changed error messages.
9521         * testsuite/undef_symbol.sh: Likewise.
9522
9523 2009-02-04  Duncan Sands  <baldrick@free.fr>
9524
9525         PR 9812
9526         * reduced_debug_output.h
9527         (Output_reduced_debug_abbrev_section::failed): Use format for
9528         gold_warning.
9529         (Output_reduced_debug_info_section::faild): Likewise.
9530
9531 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9532
9533         * script.cc (Lazy_demangler): New class.
9534         (Version_script_info::get_symbol_version_helper): Demangle a
9535         symbol only once.
9536
9537 2009-01-29  Cary Coutant  <ccoutant@google.com>
9538
9539         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9540         to __tls_get_addr.
9541         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9542
9543 2009-01-28  Ian Lance Taylor  <iant@google.com>
9544
9545         * version.cc (version_string): Bump to 1.9.
9546
9547         * gold.h: Include <cstring> and <stdint.h>.
9548         * version.cc: Include <cstdio>.
9549         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9550         warning.
9551         * reduced_debug_output.cc (insert_into_vector): Rename from
9552         Insert_into_vector; change all callers.  Use Swap_unaligned to
9553         avoid aliasing issue; remove union since it is unnecessary.
9554
9555 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9556
9557         * Makefile.am (CCFILES): Add gc.cc.
9558         (HFILES): Add gc.h.
9559         * Makefile.in: Regenerate.
9560         * gold.cc (Gc_runner): New class.
9561         (queue_initial_tasks): Call garbage collection related tasks
9562         when corresponding options are invoked.
9563         (queue_middle_gc_tasks): New function.
9564         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9565         processed early before laying out sections during garbage collection.
9566         * gold.h (queue_middle_gc_tasks): New function.
9567         (is_prefix_of): Move from "layout.cc".
9568         * i386.cc (Target_i386::gc_process_relocs): New function.
9569         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9570         * main.cc (main): Create object of class "Garbage_collection".
9571         * object.cc (Relobj::copy_symbols_data): New function.
9572         (Relobj::is_section_name_included): New function.
9573         (Sized_relobj::do_layout): Allow this function to be called twice
9574         during garbage collection and defer layout of section during the
9575         first call.
9576         * object.h (Relobj::get_symbols_data): New function.
9577         (Relobj::is_section_name_included): New function.
9578         (Relobj::copy_symbols_data): New function.
9579         (Relobj::set_symbols_data): New function.
9580         (Relobj::get_relocs_data): New function.
9581         (Relobj::set_relocs_data): New function.
9582         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9583         (Relobj::gc_process_relocs): New function.
9584         (Relobj::do_gc_process_relocs): New pure virtual function.
9585         (Relobj::sd_): New data member.
9586         (Sized_relobj::is_output_section_offset_invalid): New function.
9587         (Sized_relobj::do_gc_process_relocs): New function.
9588         * options.h (General_options::gc_sections): Modify to not be a no-op.
9589         (General_options::print_gc_sections): New option.
9590         * plugin.cc (Plugin_finish::run): Remove function call to
9591         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9592         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9593         * reloc.cc (Read_relocs::run): Add task to process relocs and
9594         determine unreferenced sections when doing garbage collection.
9595         (Gc_process_relocs): New class.
9596         (Sized_relobj::do_gc_process_relocs): New function.
9597         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9598         sections that are garbage collected.
9599         * reloc.h (Gc_process_relocs): New class.
9600         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9601         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9602         symbols whose corresponding sections are garbage collected.
9603         (Symbol_table::Symbol_table): Add new parameter for the garbage
9604         collection object.
9605         (Symbol_table::gc_mark_undef_symbols): New function.
9606         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9607         (Symbol_table::gc_mark_dyn_syms): New function.
9608         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9609         as garbage.
9610         (Symbol_table::add_from_object): Likewise.
9611         (Symbol_table::add_from_relobj): When building shared objects, do not
9612         treat externally visible symbols as garbage.
9613         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9614         table information for static and relocatable links.
9615         * symtab.h (Symbol_table::set_gc): New function.
9616         (Symbol_table::gc): New function.
9617         (Symbol_table::gc_mark_undef_symbols): New function.
9618         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9619         (Symbol_table::gc_mark_dyn_syms): New function.
9620         (Symbol_table::gc_): New data member.
9621         * target.h (Sized_target::gc_process_relocs): New pure virtual
9622         function.
9623         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9624         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9625
9626 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9627
9628         * options.h (General_options::gc_sections): Define as a no-op for now.
9629         (General_options::no_keep_memory): Ditto.
9630         (General_options::Bshareable): Define.
9631         * options.cc (General_options::finalize): Honor -Bshareable.
9632
9633 2009-01-20  Andreas Schwab  <schwab@suse.de>
9634
9635         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9636         read the value in the contents, since we don't use it.  Use the
9637         template endianness when writing.
9638         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9639
9640 2009-01-19  Andreas Schwab  <schwab@suse.de>
9641
9642         * configure.tgt (powerpc64-*): Fix targ_obj.
9643
9644 2009-01-15  Ian Lance Taylor  <iant@google.com>
9645
9646         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9647         local symbols when stripping all symbols.
9648
9649 2009-01-14  Cary Coutant  <ccoutant@google.com>
9650
9651         * output.cc (Output_reloc): Add explicit instantiations.
9652
9653 2009-01-14  Cary Coutant  <ccoutant@google.com>
9654
9655         * archive.cc (Archive::get_elf_object_for_member): Remove call
9656         to File_read::claim_for_plugin.
9657         * descriptors.cc (Descriptors::open): Remove reference to
9658         is_claimed.
9659         (Descriptors::claim_for_plugin): Remove.
9660         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9661         (Descriptors::is_claimed): Remove.
9662         (claim_descriptor_for_plugin): Remove.
9663         * fileread.cc (File_read::claim_for_plugin): Remove.
9664         * fileread.h (File_read::claim_for_plugin): Remove.
9665         (File_read::descriptor): Reopen descriptor if necessary.
9666         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9667         (Plugin_manager::all_symbols_read): Add task parameter. Change
9668         all callers.
9669         (Plugin_manager::get_input_file): New function.
9670         (Plugin_manager::release_input_file): New function.
9671         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9672         corresponding data member.
9673         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9674         and pass to base constructor. Change all callers.
9675         (get_input_file, release_input_file): New functions.
9676         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9677         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9678         (Plugin_manager::all_symbols_read): Add task parameter.
9679         (Plugin_manager::get_input_file): New function.
9680         (Plugin_manager::release_input_file): New function.
9681         (Plugin_manager::task_): New data member.
9682         (Pluginobj::Pluginobj): Add filesize parameter.
9683         (Pluginobj::filename): New function.
9684         (Pluginobj::descriptor): New function.
9685         (Pluginobj::filesize): New function.
9686         (Pluginobj::filesize_): New data member.
9687         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9688         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9689         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9690
9691         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9692         with archive libraries.
9693         * testsuite/Makefile.in: Regenerate.
9694         * testsuite/plugin_test.c (struct sym_info): New type.
9695         (get_input_file, release_input_file): New static variables.
9696         (onload): Capture new transfer vector entries.
9697         (claim_file_hook): Stop reading at end of file according to filesize.
9698         Factor out parsing of readelf output into separate function.
9699         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9700         APIs and get the source file name from the symbol table.  Convert
9701         source file name to corresponding object file name.  Print info
9702         message when adding new input files.
9703         (parse_readelf_line): New function.
9704         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9705         * testsuite/plugin_test_2.sh: Likewise.
9706         * testsuite/plugin_test_3.sh: Likewise.
9707         * testsuite/plugin_test_4.sh: New test case.
9708
9709 2009-01-07  Ian Lance Taylor  <iant@google.com>
9710
9711         * version.cc (version_string): Bump to 1.8.
9712
9713 2008-12-23  Cary Coutant  <ccoutant@google.com>
9714
9715         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9716         * plugin.cc (Plugin_manager::finish): Rename as
9717         layout_deferred_objects.  Move cleanup to separate function.
9718         (Plugin_manager::cleanup): New function.
9719         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9720         separately.
9721         * plugin.h (Plugin_manager::finish): Rename as
9722         layout_deferred_objects.
9723         (Plugin_manager::cleanup): New function.
9724         (Plugin_manager::cleanup_done): New field.
9725
9726 2008-12-23  Cary Coutant  <ccoutant@google.com>
9727
9728         * plugin.cc (is_visible_from_outside): New function.
9729         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9730         so we don't return "IR only" status for exported symbols or -r links.
9731
9732         * testsuite/Makefile.am (plugin_test_3): New test case.
9733         * testsuite/Makefile.in: Regenerate.
9734         * testsuite/plugin_test_3.sh: New file.
9735
9736 2008-12-22  Cary Coutant  <ccoutant@google.com>
9737
9738         * object.cc (Sized_relobj::layout_section): New function.
9739         (Sized_relobj::do_layout): Defer layout of input sections until after
9740         plugin has provided replacement files.
9741         (Sized_relobj::do_layout_deferred_sections): New function.
9742         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9743         (Relobj::layout_deferred_sections): New function.
9744         (Relobj::do_layout_deferred_sections): New function.
9745         (Sized_relobj::do_layout_deferred_sections): New function.
9746         (Sized_relobj::layout_section): New function.
9747         (Sized_relobj::Deferred_layout): New structure.
9748         (Sized_relobj::deferred_layout_): New field.
9749         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9750         Change all callers.  Layout deferred sections.
9751         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9752         references.
9753         (Plugin_hook::run): Move code from do_plugin_hook inline.
9754         (Plugin_hook::do_plugin_hook): Remove.
9755         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9756         (Plugin_manager::finish): Renamed, was cleanup.
9757         (Plugin_manager::should_defer_layout): New function.
9758         (Plugin_manager::add_deferred_layout_object): New function.
9759         (Plugin_manager::Deferred_layout_list): New type.
9760         (Plugin_manager::deferred_layout_objects_): New field.
9761         (Plugin_hook::do_plugin_hook): Remove.
9762
9763 2008-12-17  Ian Lance Taylor  <iant@google.com>
9764
9765         * options.h (class General_options): Add --no case for
9766         --export-dynamic.
9767
9768 2008-12-16  Cary Coutant  <ccoutant@google.com>
9769
9770         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9771         vector.
9772         (Plugin_manager::claim_file): Create plugin object even if
9773         plugin did not call the add_symbols callback.
9774         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9775         asking for more symbols than were added.
9776         * testsuite/Makefile.am (plugin_test_1): Add test case with
9777         no global symbols.
9778         (empty.syms): New target.
9779         * testsuite/Makefile.in: Regenerate.
9780         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9781         message. Don't call add_symbols if no globals.
9782         (all_symbols_read_hook): Don't provide replacement for empty
9783         claimed file.
9784
9785 2008-12-12  Ian Lance Taylor  <iant@google.com>
9786
9787         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9788         r_type == 0 for a local symbol with r_sym == 0.
9789         (scan_relocatable_relocs): Pass r_sym to
9790         local_non_section_strategy.
9791         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9792         r_sym parameter.
9793
9794         * configure.ac: Update test for TLS descriptors: they are
9795         supported as of glibc 2.9.
9796         * configure: Rebuild.
9797
9798 2008-12-11  Ian Lance Taylor  <iant@google.com>
9799
9800         PR 7091
9801         * target-reloc.h (Default_scan_relocatable_relocs): For each
9802         function, map r_type == 0 to RELOC_DISCARD.
9803
9804 2008-12-10  Cary Coutant  <ccoutant@google.com>
9805
9806         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9807         object to override a kept COMDAT group from a plugin object.
9808
9809 2008-12-09  Ian Lance Taylor  <iant@google.com>
9810
9811         PR 7088
9812         * yyscript.y (file_cmd): Handle INPUT.
9813
9814         * testsuite/initpri1.c: Change all declarations to be full
9815         prototypes by adding void, to avoid compiler warnings.
9816
9817 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9818
9819         * options.cc (General_options::parse_plugin_opt): New.
9820         (General_options::add_plugin): The argument now is just the filename.
9821         (General_options::add_plugin_option): New.
9822         * options.h (plugin_opt): New.
9823         (add_plugin): Change argument name.
9824         (add_plugin_option): New.
9825         * plugin.cc (Plugin::load): Don't parse the plugin option.
9826         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9827         (Plugin::add_option): New.
9828         (Plugin::args_): Change type.
9829         (Plugin::filename_): New.
9830         (Plugin_manager::add_plugin_option): New.
9831         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9832         * testsuite/Makefile.in: Regenerate.
9833
9834 2008-12-05  Cary Coutant  <ccoutant@google.com>
9835
9836         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9837         Handle --strip-lto-sections option.
9838         * options.h (strip_lto_sections): New option.
9839
9840 2008-12-01  Cary Coutant  <ccoutant@google.com>
9841
9842         * plugin.cc (ld_plugin_message): Change format parameter to const.
9843         Fix mismatch between new[] and delete.
9844
9845 2008-11-14  Cary Coutant  <ccoutant@google.com>
9846
9847         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9848         instead of -1U.
9849
9850 2008-11-05  Craig Silverstein  <csilvers@google.com>
9851
9852         * options.cc (General_options::parse_dynamic_list): New function.
9853         * options.h (General_options): New flags dynamic_list,
9854         dynamic_list_data, dynamic_list_cpp_new, and
9855         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9856         (General_options::in_dynamic_list): New function.
9857         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9858         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9859         (Lex::can_continue_name): Likewise.
9860         (yylex): Likewise.
9861         (read_script_file): New parameter script_options.
9862         (read_dynamic_list): New function.
9863         (Script_options::define_dynamic_list): New function.
9864         (dynamic_list_keyword_parsecodes): New variable.
9865         (dynamic_list_keywords): New variable.
9866         * script.h (Script_options::define_dynamic_list): New function
9867         prototype.
9868         (read_dynamic_list): New function prototype.
9869         * symtab.cc (strprefix): New macro.
9870         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9871         dynamic_list_data, dynamic_list_cpp_new, and
9872         dynamic_list_cpp_typeinfo.
9873         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9874         (dynamic_list_expr): New rule.
9875         (dynamic_list_nodes): Likewise.
9876         (dynamic_list_node): Likewise.
9877         * testsuite/Makefile.am (dynamic_list): New test.
9878         * testsuite/Makefile.in: Regenerated.
9879         * testsuite/dynamic_list.t: New file.
9880         * testsuite/dynamic_list.sh: New file.
9881
9882 2008-11-05  Craig Silverstein  <csilvers@google.com>
9883
9884         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9885         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9886         (t11_last): Likewise.
9887         * testsuite/ver_test_6.c (main): Likewise.
9888
9889 2008-10-07  Cary Coutant  <ccoutant@google.com>
9890
9891         * options.c (General_options::finalize): Add check for -static and
9892         -shared.
9893         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9894         is not empty.
9895
9896 2008-10-02  Cary Coutant  <ccoutant@google.com>
9897
9898         * plugin.cc (make_sized_plugin_object): Fix conditional
9899         compilation to work when not all targets are enabled.
9900
9901 2008-09-29  Cary Coutant  <ccoutant@google.com>
9902
9903         * archive.cc (Archive::get_file_and_offset): Use filename instead
9904         of name to get library path.
9905         (Archive::include_member): Unlock external member of a thin archive.
9906
9907         * testsuite/Makefile.am (TEST_AR): New variable.
9908         (thin_archive_test_1): New test.
9909         (thin_archive_test_2): New test.
9910         * testsuite/Makefile.in: Regenerate.
9911         * testsuite/thin_archive_main.cc: New file.
9912         * testsuite/thin_archive_test_1.cc: New file.
9913         * testsuite/thin_archive_test_2.cc: New file.
9914         * testsuite/thin_archive_test_3.cc: New file.
9915         * testsuite/thin_archive_test_4.cc: New file.
9916
9917 2008-09-29  Cary Coutant  <ccoutant@google.com>
9918
9919         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9920         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9921         instead of -1U.
9922         (Sized_relobj::do_finalize_local_symbols): Likewise.
9923         (Sized_relobj::map_to_kept_section): Likewise.
9924         * object.h (Sized_relobj::invalid_address): New constant.
9925         (Sized_relobj::do_output_section_offset): Check for invalid_address
9926         and return -1ULL.
9927         * output.cc (Output_reloc::local_section_offset): Use constant
9928         invalid_address instead of -1U.
9929         (Output_reloc::get_address): Likewise.
9930         (Output_section::output_address): Change -1U to -1ULL.
9931         * output.h (Output_reloc::invalid_address): New constant.
9932         * reloc.cc (Sized_relobj::write_sections): Use constant
9933         invalid_address instead of -1U.
9934         (Sized_relobj::relocate_sections): Likewise.
9935         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9936         values for merge sections.
9937         * target-reloc.h (relocate_for_relocatable): Use constant
9938         invalid_address instead of -1U.
9939
9940 2008-09-19  Cary Coutant  <ccoutant@google.com>
9941
9942         Add plugin functionality for link-time optimization (LTO).
9943         * configure.ac (plugins): Add --enable-plugins option.
9944         * configure: Regenerate.
9945         * config.in: Regenerate.
9946         * Makefile.am (LIBDL): New variable.
9947         (CCFILES): Add plugin.cc.
9948         (HFILES): Add plugin.h.
9949         (ldadd_var): Add LIBDL.
9950         * Makefile.in: Regenerate.
9951
9952         * archive.cc: Include "plugin.h".
9953         (Archive::setup): Don't preread archive symbols when using a plugin.
9954         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9955         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9956         files.
9957         (Archive::include_member): Add symbols from plugin objects.
9958         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9959         * descriptors.cc (Descriptors::open): Check for file descriptors
9960         abandoned by plugins.
9961         (Descriptors::claim_for_plugin): New function.
9962         * descriptors.h (Descriptors::claim_for_plugin): New function.
9963         (Open_descriptor::is_claimed): New field.
9964         (claim_descriptor_for_plugin): New function.
9965         * fileread.cc (File_read::claim_for_plugin): New function.
9966         * fileread.h (File_read::claim_for_plugin): New function.
9967         (File_read::descriptor): New function.
9968         * gold.cc: Include "plugin.h".
9969         (queue_initial_tasks): Add task to call plugin hooks for generating
9970         new object files.
9971         * main.cc: Include "plugin.h".
9972         (main): Load plugin libraries.
9973         * object.h (Pluginobj): Declare.
9974         (Object::pluginobj): New function.
9975         (Object::do_pluginobj): New function.
9976         (Object::set_target): New function.
9977         * options.cc: Include "plugin.h".
9978         (General_options::parse_plugin): New function.
9979         (General_options::General_options): Initialize plugins_ field.
9980         (General_options::add_plugin): New function.
9981         * options.h (Plugin_manager): Declare.
9982         (General_options): Add --plugin option.
9983         (General_options::has_plugins): New function.
9984         (General_options::plugins): New function.
9985         (General_options::add_plugin): New function.
9986         (General_options::plugins_): New field.
9987         * plugin.cc: New file.
9988         * plugin.h: New file.
9989         * readsyms.cc: Include "plugin.h".
9990         (Read_symbols::do_read_symbols): Check for archive before checking
9991         for ELF file.  Call plugin hooks to claim files.
9992         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9993         from a real object file; force override when processing replacement
9994         files.
9995         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9996         (Symbol::init_base_object): Likewise.
9997         (Symbol::init_base_output_data): Likewise.
9998         (Symbol::init_base_output_segment): Likewise.
9999         (Symbol::init_base_constant): Likewise.
10000         (Symbol::init_base_undefined): Likewise.
10001         (Symbol::output_section): Assert that object is not a plugin.
10002         (Symbol_table::add_from_pluginobj): New function.
10003         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10004         undefined.
10005         (Symbol_table::sized_write_globals): Likewise.
10006         (Symbol_table::add_from_pluginobj): Instantiate template.
10007         * symtab.h (Sized_pluginobj): Declare.
10008         (Symbol::in_real_elf): New function.
10009         (Symbol::set_in_real_elf): New function.
10010         (Symbol::in_real_elf_): New field.
10011         (Symbol_table::add_from_pluginobj): New function.
10012
10013         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10014         (LIBDL): New variable.
10015         (LDADD): Add LIBDL.
10016         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10017         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10018         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10019         (MOSTLYCLEANFILES): Likewise.
10020         * testsuite/Makefile.in: Regenerate.
10021         * testsuite/plugin_test.c: New file.
10022         * testsuite/plugin_test_1.sh: New file.
10023         * testsuite/plugin_test_2.sh: New file.
10024
10025 2008-09-16  Ian Lance Taylor  <iant@google.com>
10026
10027         * target-reloc.h (relocate_section): Check whether a symbol is
10028         defined by the ABI before reporting an undefined symbol error.
10029         * target.h (Target::is_defined_by_abi): Make parameter const.
10030         (Target::do_is_defined_by_abi): Likewise.
10031         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10032         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10033         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10034         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10035         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10036         * testsuite/Makefile.in: Rebuild.
10037
10038         * fileread.cc (make_view): Add casts to avoid warning.
10039
10040 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10041
10042         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10043         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10044
10045 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10046
10047         * options.h (General_options::output_is_executable): New.
10048         (General_options::output_is_pie): New.
10049         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10050         for shared libraries.
10051         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10052
10053 2008-09-11  Chris Demetriou  <cgd@google.com>
10054
10055         * options.h (origin): New -z option.
10056         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10057         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10058         in DT_FLAGS_1.
10059
10060 2008-09-05  Cary Coutant  <ccoutant@google.com>
10061
10062         * fileread.cc (File_read::make_view): Add check for attempt to map
10063         beyond end of file.
10064
10065 2008-09-05  Cary Coutant  <ccoutant@google.com>
10066
10067         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10068         explicit instantiations.
10069
10070 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10071
10072         PR gold/6858
10073         * options.cc (General_options::finalize): Allow undefined symbols
10074         in shlibs if linking -shared.
10075
10076         PR gold/6859
10077         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10078         symbols as not needing a dynsym entry.
10079
10080 2008-08-20  Craig Silverstein  <csilvers@google.com>
10081
10082         * fileread.cc (File_read::open): Do not lock the file unless it
10083         was successfully opened.
10084
10085 2008-08-14  Cary Coutant  <ccoutant@google.com>
10086
10087         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10088         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10089         * testsuite/tls_test.cc (struct int128): 128-bit struct
10090         for testing TLS relocs with non-zero addend.
10091         (v12): New TLS variable.
10092         (t12): New test.
10093         (t_last): Add check for v12.
10094         * testsuite/tls_test.h (t12): New function.
10095         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10096
10097 2008-08-13  Ian Lance Taylor  <iant@google.com>
10098
10099         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10100         set tls_segment_ or relro_segment_.
10101         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10102         when appropriate.
10103         * output.h (Output_section::clear_is_relro): New function.
10104         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10105         sections specially even when output_data_ is empty.
10106         (Output_segment::maximum_alignment): When first section is relro,
10107         only force alignment for PT_LOAD segments.
10108         * script.cc (script_data_segment_align): New function.
10109         (script_data_segment_relro_end): New function.
10110         * script-c.h (script_data_segment_align): Declare.
10111         (script_data_segment_relro_end): Declare.
10112         * script-sections.h (class Script_sections): Declare
10113         data_segment_align and data_segment_relro_end.  Add fields
10114         segment_align_index_ and saw_relro_end_.
10115         * script-sections.cc (class Sections_element): Add set_is_relro
10116         virtual function.  Add new bool* parameter to place_orphan_here.
10117         Add get_output_section virtual function.
10118         (class Output_section_definition): Add set_is_relro.  Add new
10119         bool* parameter to place_orphan_here.  Add get_output_section.
10120         Add is_relro_ field.
10121         (Output_section_definition::Output_section_definition): Initialize
10122         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10123         and is_relro_ fields.
10124         (Output_section_definition::place_orphan_here): Add is_relro
10125         parameter.
10126         (Output_section_definition::set_section_addresses): Set relro for
10127         output section.
10128         (Output_section_definition::alternate_constraint): Likewise.
10129         (class Orphan_output_section): Add new bool* parameter to
10130         place_orphan_here.  Add get_output_section.
10131         (Orphan_output_section::place_orphan_here): Add is_relro
10132         parameter.
10133         (Script_sections::Script_sections): Initialize
10134         data_segment_align_index_ and saw_relro_end_.
10135         (Script_sections::data_segment_align): New function.
10136         (Script_sections::data_segment_relro_end): New function.
10137         (Script_sections::place_orphan): Set or clear is_relro.
10138         (Script_sections::set_section_addresses): Force alignment of first
10139         TLS section.
10140         * yyscript.y (exp): Call script_data_segment_align and
10141         script_data_segment_relro_end.
10142         * testsuite/relro_script_test.t: New file.
10143         * testsuite/relro_test.cc (using_script): Declare.
10144         (t1, t2): Test using_script.
10145         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10146         (relro_script_test_SOURCES): Define.
10147         (relro_script_test_DEPENDENCIES): Define.
10148         (relro_script_test_LDFLAGS): Define.
10149         (relro_script_test_LDADD): Define.
10150         (relro_script_test.so): New target.
10151         * testsuite/Makefile.in: Rebuild.
10152
10153 2008-08-06  Cary Coutant <ccoutant@google.com>
10154
10155         * archive.cc (Archive::total_archives, Archive::total_members)
10156         (Archive::total_members_loaded): New variables.
10157         (Archive::setup): Add parameter.  Add option to preread
10158         archive symbols.
10159         (Archive::read_armap): Add counter.
10160         (Archive::get_file_and_offset): New function.
10161         (Archive::get_elf_object_for_member): New function.
10162         (Archive::read_all_symbols): New function.
10163         (Archive::read_symbols): New function.
10164         (Archive::add_symbols): Add counters.
10165         (Archive::include_all_members): Use armap to find members if it's
10166         already built.
10167         (Archive::include_member): Skip reading symbols if already read.
10168         Factored code into Archive::get_file_and_offset and
10169         Archive::get_elf_object_for_member.  Changed call to
10170         Mapfile::report_include_archive_member.
10171         (Archive::print_stats): New function.
10172         * archive.h: Declare Object and Read_symbols_data classes.
10173         (Archive::Archive): Add initializers for new members.
10174         (Archive::setup): Add parameter.
10175         (Archive::print_stats): New function.
10176         (Archive::total_archives, Archive::total_members)
10177         (Archive::total_members_loaded): New variables.
10178         (Archive::get_file_and_offset): New function.
10179         (Archive::get_elf_object_for_member): New function.
10180         (Archive::read_all_symbols): New function.
10181         (Archive::read_symbols): New function.
10182         (Archive::Archive_member): New class.
10183         (Archive::members_): New member.
10184         (Archive::num_members_): New member.
10185         * main.cc: Include archive.h.
10186         (main): Call Archive::print_stats.
10187         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10188         archive parameter; member_name is now the fully-decorated name.
10189         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10190         * options.h: (General_options): Add --preread-archive-symbols option.
10191         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10192         Archive::setup.
10193
10194 2008-08-04  Ian Lance Taylor  <iant@google.com>
10195
10196         * symtab.h (Symbol::use_plt_offset): New function.
10197         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10198         * powerpc.cc (Relocate::relocate): Likewise.
10199         * sparc.cc (Relocate::relocate): Likewise.
10200         * x86_64.cc (Relocate::relocate): Likewise.
10201         * testsuite/weak_plt.sh: New test.
10202         * testsuite/weak_plt_main.cc: New test.
10203         * testsuite/weak_plt_shared.cc: New test.
10204         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10205         (check_PROGRAMS): Add weak_plt.
10206         (check_DATA): Add weak_plt_shared.so.
10207         (weak_plt_main_pic.o, weak_plt): New targets.
10208         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10209         * testsuite/Makefile.in: Rebuild.
10210
10211         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10212         gcctestdir/ld.
10213         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10214         * testsuite/Makefile.in: Rebuild.
10215
10216 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10217
10218         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10219         * Makefile.in: Regenerate.
10220         * po/POTFILES.in: Regenerate.
10221
10222 2008-07-29  Ian Lance Taylor  <iant@google.com>
10223
10224         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10225         symbols before other symbols.
10226         * testsuite/script_test_2.cc (test_addr): Declare.
10227         (test_addr_alias): Declare.
10228         (main): Check that test_addr and test_addr_alias have the right
10229         values.
10230         * testsuite/script_test_2.t: Define test_addr_alias and
10231         test_addr.
10232
10233 2008-07-24  Ian Lance Taylor  <iant@google.com>
10234
10235         PR 5990
10236         * descriptors.cc: New file.
10237         * descriptors.h: New file.
10238         * gold-threads.h (class Hold_optional_lock): New class.
10239         * fileread.cc: Include "descriptors.h".
10240         (File_read::~File_read): Release descriptor rather than closing
10241         it.
10242         (File_read::open) [file]: Call open_descriptor rather than open.
10243         Set is_descriptor_opened_.
10244         (File_read::open) [memory]: Assert that descriptor is not open.
10245         (File_read::reopen_descriptor): New function.
10246         (File_read::release): Release descriptor.
10247         (File_read::do_read): Make non-const.  Reopen descriptor.
10248         (File_read::read): Make non-const.
10249         (File_read::make_view): Reopen descriptor.
10250         (File_read::do_readv): Likewise.
10251         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10252         Update declarations.
10253         * layout.cc: Include "descriptors.h".
10254         (Layout::create_build_id): Use open_descriptor rather than open.
10255         * output.cc: Include "descriptors.h".
10256         (Output_file::open): Use open_descriptor rather than open.
10257         * archive.cc (Archive::const_iterator): Change Archive to be
10258         non-const.
10259         (Archive::begin, Archive::end): Make non-const.
10260         (Archive::count_members): Likewise.
10261         * archive.h (class Archive): Update declarations.
10262         * object.h (Object::read): Make non-const.
10263         * Makefile.am (CCFILES): Add descriptors.cc.
10264         (HFILES): Add descriptors.h.
10265         * Makefile.in: Rebuild.
10266
10267         PR 6716
10268         * gold.h: Always include <clocale>.  Add Solaris workarounds
10269         following code in binutils/sysdep.h.
10270
10271         PR 6048
10272         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10273         this->eh_frame_hdr_ is NULL before using it.
10274
10275         * dynobj.cc (Versions::Versions): Update comment.
10276
10277         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10278         the base version name.
10279
10280         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10281         array size plus one.
10282         (Stringpool_template::set_string_offsets): Subtract one from key
10283         before using it as an array index.
10284         (Stringpool_template::get_offset_with_length): Likewise.
10285         (Stringpool_template::write_to_buffer): Likewise.
10286         * stringpool.h (Stringpool_template::get_offset_from_key):
10287         Likewise.
10288
10289 2008-07-23  Ian Lance Taylor  <iant@google.com>
10290
10291         PR 6658
10292         * object.h (Merged_symbol_value::value): Do our best to handle a
10293         negative addend.
10294
10295         PR 6647
10296         * script.cc (Version_script_info::get_versions): Don't add empty
10297         version tag to return value.
10298         (Version_script_info::get_symbol_version_helper): Change return
10299         type to bool.  Add pversion parameter.  Change all callers.
10300         (script_register_vers_node): Don't require a non-NULL tag.
10301         * script.h (class Version_script_info): Update declarations.
10302         (Version_script_info::get_symbol_version): Change return type to
10303         bool.  Add version parameter.  Change all callers.
10304         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10305         handling.  Handle an empty version from a version script.
10306         (Symbol_table::define_special_symbol): Likewise.
10307         * testsuite/ver_test_10.script: New file.
10308         * testsuite/ver_test_10.sh: New file.
10309         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10310         (check_DATA): Add ver_test_10.syms.
10311         (ver_test_10.syms, ver_test_10.so): New target.
10312         * testsuite/Makefile.in: Rebuild.
10313
10314 2008-07-23  Simon Baldwin  <simonb@google.com>
10315
10316         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10317         to zero for undefined symbols from dynamic libraries.
10318
10319 2008-07-23  Ian Lance Taylor  <iant@google.com>
10320
10321         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10322         Change all callers.
10323         * symtab.h (class Symbol_table): Update declaration.
10324         * testsuite/ver_test_9.cc: New file.
10325         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10326         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10327         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10328         (ver_test_9.so, ver_test_9.o): New targets.
10329         * testsuite/Makefile.in: Rebuild.
10330
10331 2008-07-22  Ian Lance Taylor  <iant@google.com>
10332
10333         * options.h (class General_options): Define --check-sections.
10334         * layout.cc (Layout::set_segment_offsets): Handle
10335         --check-sections.
10336
10337         * options.h (class General_options): Define -n/--nmagic and
10338         -N/--omagic.
10339         * options.cc (General_options::finalize): For -n/--nmagic or
10340         -N/--omagic, set -static.
10341         * layout.cc (Layout::attach_allocated_section_to_segment): If
10342         -N/--omagic, don't put read-only and read-write sections in
10343         different segments.
10344         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10345         finding a read-only segment.
10346         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10347         don't set the minimum segment alignment to the common page size,
10348         and don't set the file offset to the address modulo the page size.
10349         * script-sections.cc (Script_sections::create_segments): If
10350         -n/--omagic, don't put read-only and read-write sections in
10351         different segments.
10352
10353         * cref.cc: New file.
10354         * cref.h: New file.
10355         * options.h (class General_options): Add --print-symbol-counts.
10356         * main.cc (main): Issue defined symbol report if requested.
10357         * archive.cc (Archive::interpret_header): Make into a const member
10358         function.
10359         (Archive::add_symbols): Call Input_objects::archive_start and
10360         archive_stop.
10361         (Archive::const_iterator): Define new class.
10362         (Archive::begin, Archive::end): New functions.
10363         (Archive::include_all_members): Rewrite to use iterator.
10364         (Archive::count_members): New function.
10365         * archive.h (class Archive): Update declarations.
10366         (Archive::filename): New function.
10367         * object.cc: Include "cref.h".
10368         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10369         (Sized_relobj::do_get_global_symbol_counts): New function.
10370         (Input_objects::add_object): Add object to cross-referencer.
10371         (Input_objects::archive_start): New function.
10372         (Input_objects::archive_stop): New function.
10373         (Input_objects::print_symbol_counts): New function.
10374         * object.h: Declare Cref and Archive.
10375         (Object::get_global_symbol_counts): New function.
10376         (Object::do_get_global_symbol_counts): New pure virtual function.
10377         (class Sized_relobj): Add defined_count_ field.  Update
10378         declarations.
10379         (class Input_objects): Add cref_ field.  Update constructor.
10380         Update declarations.
10381         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10382         defined_count_.
10383         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10384         symbol counts.
10385         (Sized_dynobj::do_get_global_symbol_counts): New function.
10386         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10387         defined_count_.  Update declarations.  Define Symbols typedef.
10388         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10389         parameter.  Change all callers.
10390         (Symbol_table::add_from_dynobj): Add sympointers and defined
10391         parameters.  Change all callers.
10392         * symtab.h (class Symbol_table): Update declarations.
10393         * Makefile.am (CCFILES): Add cref.cc.
10394         (HFILES): Add cref.h.
10395         * Makefile.in: Rebuild.
10396
10397 2008-07-22  Simon Baldwin  <simonb@google.com>
10398
10399         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10400         to zero when writing undefined symbols.
10401
10402 2008-07-22  Ian Lance Taylor  <iant@google.com>
10403
10404         * output.cc (Output_section::add_input_section): Don't try to
10405         merge empty merge sections.
10406
10407 2008-07-21  Craig Silverstein  <csilvers@google.com>
10408
10409         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10410         Include symbol version in error message.
10411
10412 2008-07-20  Chris Demetriou  <cgd@google.com>
10413
10414         * configure.ac (gold_cv_c_random_seed): New configured variable.
10415         (RANDOM_SEED_CFLAGS): New substituted variable.
10416         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10417         * configure: Rebuild.
10418         * Makefile.in: Likewise.
10419         * testsuite/Makefile.in: Likewise.
10420
10421 2008-07-18  Ian Lance Taylor  <iant@google.com>
10422
10423         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10424         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10425         * testsuite/ver_test_main.cc (main): Call t4.
10426         (t4, t4_2a): Define.
10427         * testsuite/ver_test_2.cc (t4_2): Define.
10428         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10429         * testsuite/ver_test_4.cc (t4_2a): Define.
10430         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10431         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10432
10433 2008-07-17  Ian Lance Taylor  <iant@google.com>
10434
10435         * dynobj.cc (Versions::add_def): If we give an error about a
10436         missing version, go ahead and create the version anyhow.
10437
10438 2008-07-10  Ian Lance Taylor  <iant@google.com>
10439
10440         Handle output sections with more than 0x7fffffff bytes.
10441         * object.h (class Relobj): Change map_to_output_ to
10442         output_sections_, and just keep a section pointer.  Change all
10443         uses.  Move comdat group support to Sized_relobj.
10444         (Relobj::is_section_specially_mapped): Remove.
10445         (Relobj::output_section): Remove poff parameter.  Change all
10446         callers.
10447         (Relobj::output_section_offset): New function.
10448         (Relobj::set_section_offset): Rewrite.
10449         (Relobj::map_to_output): Remove.
10450         (Relobj::output_sections): New function.
10451         (Relobj::do_output_section_offset): New pure virtual function.
10452         (Relobj::do_set_section_offset): Likewise.
10453         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10454         group support from Relobj.  Update declarations.
10455         (Sized_relobj::get_output_section_offset): New function.
10456         (Sized_relobj::do_output_section_offset): New function.
10457         (Sized_relobj::do_set_section_offset): New function.
10458         * object.cc (Relobj::output_section_address): Remove.
10459         (Sized_relobj::Sized_relobj): Initialize new fields.
10460         (Sized_relobj::include_section_group): Cast find_kept_object to
10461         Sized_relobj.
10462         (Sized_relobj::include_linkonce_section): Likewise.
10463         (Sized_relobj::do_layout): Use separate arrays for output section
10464         and output offset.
10465         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10466         output_sections.
10467         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10468         output_sections and section_offsets.
10469         (Sized_relobj::write_local_symbols): Likewise.
10470         (map_to_kept_section): Compute output address directly.
10471         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10472         output_sections and section_offsets.
10473         (Sized_relobj::write_sections): Likewise.
10474         (Sized_relobj::relocate_sections): Likewise.
10475         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10476         * output.h (class Output_reloc): Update declarations.  Change
10477         u2_.relobj to Sized_relobj*.
10478         (class Output_data_reloc): Change add functions to use
10479         Sized_relobj*.
10480         * output.cc (Output_reloc::Output_reloc): Change relobj to
10481         Sized_relobj*.
10482         (Output_reloc::local_section_offset): Change return type to
10483         Elf_Addr.  Use get_output_section_offset.
10484         (Output_reloc::get_address): Likewise.
10485         (Output_section::is_input_address_mapped): Don't call
10486         is_section_specially_mapped.
10487         (Output_section::output_offset): Likewise.
10488         (Output_section::output_address): Likewise.
10489         (Output_section::starting_output_address): Likewise.
10490         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10491         parameter to Sized_relobj*.
10492         (Copy_relocs::need_copy_reloc): Likewise.
10493         (Copy_relocs::save): Likewise.
10494         * copy-relocs.h (class Copy_relocs): Update declarations.
10495         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10496         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10497         * target-reloc.h (relocate_for_relocatable): Change
10498         offset_in_output_section type to Elf_Addr.  Change code that uses
10499         it as well.
10500         * layout.cc (Layout::layout): Always set *off.
10501         * mapfile.cc (Mapfile::print_input_section): Use
10502         output_section_offset.
10503         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10504         Sized_relobj*.
10505         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10506         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10507         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10508
10509 2008-07-03  Ian Lance Taylor  <iant@google.com>
10510
10511         * layout.cc (Layout::include_section): Do not discard unrecognized
10512         SHT_STRTAB sections.
10513
10514 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10515
10516         * script.cc (Lex::can_continue_name): Make '?' allowable in
10517         version-script names.
10518         * testsuite/version_script.map: Change glob pattern to use '?'
10519
10520 2008-06-30  Manish Singh  <yosh@gimp.org>
10521
10522         PR 6585
10523         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10524         Correct typo.
10525
10526 2008-06-30  Ian Lance Taylor  <iant@google.com>
10527
10528         PR 6660
10529         PR 6682
10530         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10531         versions]: Don't try to read the value in the contents, since we
10532         don't use it.  Use the template endianness when writing.
10533
10534 2008-06-25  Cary Coutant  <ccoutant@google.com>
10535
10536         * fileread.cc (File_read::make_view): Assert on zero-length view.
10537         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10538         symbol table when there are no symbols to read.
10539
10540 2008-06-23  Craig Silverstein  <csilvers@google.com>
10541
10542         * version.cc (version_string): Bump to 1.7
10543
10544 2008-06-18  Craig Silverstein  <csilvers@google.com>
10545
10546         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10547         constant 0xFFFF to type Valtype.
10548         (Powerpc_relocate_functions::rel16_ha): Likewise.
10549
10550 2008-06-17  Ian Lance Taylor  <iant@google.com>
10551
10552         * output.h (Output_section::Input_section): Initialize p2align_ to
10553         zero for Output_section_data constructors.
10554         (Output_section::Input_section::addralign): If not an input
10555         section, return the alignment of the Output_section_data.
10556         * testsuite/copy_test.cc: New file.
10557         * testsuite/copy_test_1.cc: New file.
10558         * testsuite/copy_test_2.cc: New file.
10559         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10560         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10561         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10562         (copy_test_1_pic.o, copy_test_1.so): New targets.
10563         (copy_test_2_pic.o, copy_test_2.so): New targets.
10564         * testsuite/Makefile.in: Rebuild.
10565
10566         * script-sections.cc (Script_sections::place_orphan): Initialize
10567         local variable exact.
10568
10569 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10570
10571         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10572
10573 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10574             David S. Miller  <davem@davemloft.net>
10575
10576         * powerpc.cc: New file.
10577         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10578         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10579         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10580         * Makefile.in: Rebuild.
10581
10582 2008-06-09  Ian Lance Taylor  <iant@google.com>
10583
10584         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10585         <exception>.
10586         (throwing, orig_terminate): New static variables.
10587         (terminate_handler): New static function.
10588         (t2): Set terminate handler.
10589
10590 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10591
10592         PR 6584
10593         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10594         alignment.
10595
10596 2008-05-30  Cary Coutant  <ccoutant@google.com>
10597
10598         * archive.cc (Archive::include_all_members) Correct to step
10599         over symbol table and extended name table in thin archives.
10600
10601 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10602
10603         PR 6407
10604         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10605         calculation.
10606
10607 2008-05-28  Caleb Howe  <cshowe@google.com>
10608
10609         * reduced_debug_output.cc: New file.
10610         * reduced_debug_output.h: New file.
10611         * options.h (class General_options): Add --strip-debug-non-line.
10612         * options.cc (General_options::finalize): Add strip_debug_non_line
10613         to the strip heirarchy.
10614         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10615         fields.
10616         * layout.cc: Include "reduced_debug_output.h".
10617         (Layout::Layout): Initialize new fields.
10618         (line_only_debug_sections): New static array.
10619         (is_lines_only_debug_sections): New static inline function.
10620         (Layout::include_section): Handle --strip-debug-non-line.
10621         (Layout::make_output_section): If --strip-debug-non-line, build
10622         new output sections for .debug_abbrev and .debug_info.
10623         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10624         gold.  Warn about possible overflow.
10625         (read_signed_LEB_128): Likewise.
10626         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10627         (read_signed_LEB_128): Declare.
10628         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10629         (HFILES): Add reduced_debug_output.h.
10630         * Makefile.in: Rebuild.
10631
10632 2008-05-21  Ian Lance Taylor  <iant@google.com>
10633
10634         * mapfile.cc: New file.
10635         * mapfile.h: New file.
10636         * options.h (class General_options): Add -M/--print-map and -Map.
10637         * options.cc (General_options::finalize): Make -M equivalent to
10638         -Map -.
10639         * main.cc: Include <cstdio> and "mapfile.h".
10640         (main): Open mapfile if requested.
10641         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10642         constructor.  Change caller.
10643         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10644         (queue_middle_tasks): Likewise.
10645         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10646         declarations.
10647         * archive.cc: Include "mapfile.h".
10648         (Archive::add_symbols): Add mapfile parameter.  Change all
10649         callers.  Pass mapfile, symbol, and reason to include_member.
10650         (Archive::include_all_members): Add mapfile parameter.  Change all
10651         callers.
10652         (Archive::include_member): Add mapfile, sym, and why parameters.
10653         Change all callers.  Report inclusion to map file.
10654         * archive.h: Include "fileread.h".
10655         (class Archive): Update declarations.
10656         (Archive::file): New const method.
10657         (class Add_archive_symbols): Add mapfile_ field.  Update
10658         constructor.  Change all callers.
10659         * readsyms.h (class Read_symbols): Likewise.
10660         (class Finish_group): Likewise.
10661         (class Read_script): Likewise.
10662         * common.cc: Include "mapfile.h".
10663         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10664         all callers.
10665         (Symbol_table::do_allocate_commons): Likewise.
10666         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10667         symbol allocation to mapfile.
10668         * common.h (class Allocate_commons_task): Add mapfile_ field.
10669         Update constructor.  Change all callers.
10670         * symtab.h (class Symbol_table): Update declarations.
10671         * layout.cc: Include "mapfile.h".
10672         (Layout_task_runner::run): Print information to mapfile.
10673         (Layout::create_gold_note): Change Output_data_fixed_space to
10674         Output_data_zero_fill.
10675         (Layout::create_build_id): Likewise.
10676         (Layout::print_to_mapfile): New function.
10677         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10678         constructor.  Change caller.
10679         (class Layout): Declare print_to_mapfile.
10680         * output.cc (Output_section::Input_section::print_to_mapfile): New
10681         function.
10682         (Output_section::add_input_section): If producing a map, always
10683         add to input_sections_ list.
10684         (Output_section::do_print_to_mapfile): New function.
10685         (Output_segment::print_sections_to_mapfile): New function.
10686         (Output_segment::print_section_list_to_mapfile): New function.
10687         * output.h: Include "mapfile.h".
10688         (Output_data::print_to_mapfile): New function.
10689         (Output_data::do_print_to_mapfile): New virtual function.
10690         (Output_segment_headers::do_print_to_mapfile): New function.
10691         (Output_file_header::do_print_to_mapfile): New function.
10692         (Output_data_const::do_print_to_mapfile): New function.
10693         (class Output_data_const_buffer): Add map_name_ field.  Update
10694         constructor.  Change all callers.  Add do_print_to_mapfile
10695         function.
10696         (class Output_data_fixed_space): Likewise.
10697         (class Output_data_space): Likewise.
10698         (class Output_data_zero_fill): New class.
10699         (Output_data_strtab::do_print_to_mapfile): New function.
10700         (Output_data_reloc_base::do_print_to_mapfile): New function.
10701         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10702         (Output_data_group::do_print_to_mapfile): New function.
10703         (Output_data_got::do_print_to_mapfile): New function.
10704         (Output_data_dynamic::do_print_to_mapfile): New function.
10705         (Output_symtab_xindex::do_print_to_mapfile): New function.
10706         (class Output_section): Declare do_print_to_mapflie.  Declare
10707         print_to_mapfile in Input_section.
10708         (class Output_segment): Declare new functions.
10709         * object.h (Sized_relobj::symbol_count): New function.
10710         * script-sections.cc
10711         (Output_section_element_dot_assignment::set_section_addresses):
10712         Change Output_data_fixed_space to Output_data_zero_fill.
10713         (Output_data_expression::do_print_to_mapfile): New function.
10714         * script.cc (read_input_script): Add mapfile parameter.  Change
10715         all callers.
10716         * script.h (read_input_script): Update declaration.
10717         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10718         (Eh_frame::do_print_to_mapfile): New function.
10719         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10720         (Output_merge_string::do_print_to_mapfile): New function.
10721         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10722         function.
10723         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10724         function.
10725         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10726         function.
10727         * Makefile.am (CCFILES): Add mapfile.cc.
10728         (HFILES): Add mapfile.h.
10729         * Makefile.in: Rebuild.
10730
10731 2008-05-19  Ian Lance Taylor  <iant@google.com>
10732
10733         * options.h (class General_options): Add -z relro.
10734         * layout.cc (Layout::Layout): Initialize relro_segment_.
10735         (Layout::add_output_section_data): Return the output section.
10736         (Layout::make_output_section): Rcognize relro sections and mark
10737         them appropriately.
10738         (Layout::attach_allocated_section_to_segment): Put relro sections
10739         in a PT_GNU_RELRO segment.
10740         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10741         section as relro.
10742         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10743         PT_TLS segments.
10744         (Layout::linkonce_mapping): Map d.rel.ro.local to
10745         .data.rel.ro.local.
10746         (Layout::output_section_name): Us .data.rel.ro.local for any
10747         section which begins with that.
10748         * layout.h (class Layout): Update add_output_section_data
10749         declaration.  Add relro_segment_ field.
10750         * output.cc (Output_section::Output_section): Initialize is_relro_
10751         and is_relro_local_ fields.
10752         (Output_segment::add_output_section): Group relro sections.
10753         (Output_segment::is_first_section_relro): New function.
10754         (Output_segment::maximum_alignment): If there is a relro section,
10755         align the segment to the common page size.
10756         (Output_segment::set_section_addresses): Track whether we are
10757         looking at relro sections.  If the last section is a relro
10758         section, align to the common page size.
10759         (Output_segment::set_section_list_addresses): Add in_relro
10760         parameter.  Change all callers.  Align to the page size when
10761         moving from relro to non-relro section.
10762         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10763         segment.
10764         * output.h (class Output_section): Add is_relro_ and
10765         is_relro_local_ fields.
10766         (Output_section::is_relro): New function.
10767         (Output_section::set_is_relro): New function.
10768         (Output_section::is_relro_local): New function.
10769         (Output_section::set_is_relro_local): New function.
10770         (class Output_segment): Update declarations.
10771         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10772         * sparc.cc (Target_sparc::got_section): Likewise.
10773         * x86_64.cc (Target_x86_64::got_section): Likewise.
10774         * testsuite/relro_test_main.cc: New file.
10775         * testsuite/relro_test.cc: New file.
10776         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10777         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10778         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10779         (relro_test.so, relro_test_pic.o): New targets.
10780         * testsuite/Makefile.in: Rebuild.
10781
10782 2008-05-16  Ian Lance Taylor  <iant@google.com>
10783
10784         * output.cc (Output_segment::add_output_section): Remove front
10785         parameter.
10786         * output.h (class Output_segment): Remove
10787         add_initial_output_section and overloaded add_output_section.
10788         Update declaration of remaining add_output_section.
10789         * layout.cc (Layout::create_interp): Call add_output_section
10790         rather than add_initial_output_section.
10791         (Layout::finish_dynamic_section): Likewise.
10792
10793         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10794         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10795         know the dynamic type.
10796         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10797         field.  Initialize it in constructor.
10798         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10799         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10800         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10801         reloc.
10802
10803         * output.cc (Output_reloc::get_address): Change return type to
10804         Elf_Addr.
10805         * output.h (class Output_reloc): Update get_address declaration.
10806         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10807         for section addresses.
10808
10809 2008-05-09  Ian Lance Taylor  <iant@google.com>
10810
10811         PR 6493
10812         * gold.cc (gold_nomem): Use return value of write.
10813
10814 2008-05-08  Ian Lance Taylor  <iant@google.com>
10815
10816         * symtab.c (Symbol::init_base_output_data): Add version
10817         parameter.  Change all callers.
10818         (Symbol::init_base_output_segment): Likewise.
10819         (Symbol::init_base_constant): Likewise.
10820         (Symbol::init_base_undefined): Likewise.
10821         (Sized_symbol::init_output_data): Likewise.
10822         (Sized_symbol::init_output_segment): Likewise.
10823         (Sized_symbol::init_constant): Likewise.
10824         (Sized_symbol::init_undefined): Likewise.
10825         (Symbol_table::do_define_in_output_data): If the new symbol has a
10826         version, mark it as the default.
10827         (Symbol_table::do_define_in_output_segment): Likewise.
10828         (Symbol_table::do_define_as_constant): Likewise.
10829         * symtab.h (class Symbol): Update declarations.
10830         (class Sized_symbol): Likewise.
10831         * resolve.cc (Symbol::override_version): New function.
10832         (Symbol::override_base): Call override_version.
10833         (Symbol::override_base_with_special): Likewise.
10834         * testsuite/ver_script_8.script: New file.
10835         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10836         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10837         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10838         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10839
10840 2008-05-06  Ian Lance Taylor  <iant@google.com>
10841
10842         PR 6049
10843         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10844         functions.
10845         (class General_options): Remove existing --undefined, and add
10846         --no-undefined instead.  Add new --undefined as synonym for -u.
10847         * archive.cc (Archive::add_symbols): Check whether symbol was
10848         named with -u.
10849         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10850         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10851         all uses.  Add IS_UNDEFINED.  Update declarations to split
10852         different versions of init_base.  Declare init_base_undefined.
10853         (Symbol::is_defined): Handle IS_UNDEFINED.
10854         (Symbol::is_undefined): Likewise.
10855         (Symbol::is_weak_undefined): Call is_undefined.
10856         (Symbol::is_absolute): Handle IS_CONSTANT.
10857         (class Sized_symbol): Update declarations to split different
10858         versions of init.  Declare init_undefined.
10859         (class Symbol_table): Declare new functions.
10860         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10861         Change all callers.
10862         (Symbol::init_base_output_data): Likewise.
10863         (Symbol::init_base_output_segment): Likewise.
10864         (Symbol::init_base_constant): Likewise.
10865         (Symbol::init_base_undefined): New function.
10866         (Sized_symbol::init_object): Rename from init.  Change all
10867         callers.
10868         (Sized_symbol::init_output_data): Likewise.
10869         (Sized_symbol::init_output_segment): Likewise.
10870         (Sized_symbol::init_constant): Likewise.
10871         (Sized_symbol::init_undefined): New function.
10872         (Symbol_table::add_undefined_symbols_from_command_line): New
10873         function.
10874         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10875         function.
10876         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10877         (Symbol::output_section): Likewise.
10878         (Symbol::set_output_section): Likewise.
10879         (Symbol_table::sized_finalize_symbol): Likewise.
10880         (Symbol_table::sized_write_globals): Likewise.
10881         * resolve.cc (Symbol_table::should_override): Likewise.
10882         (Symbol::override_base_with_special): Likewise.
10883
10884         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10885         symbol, change it to have default visibility.
10886         * testsuite/protected_1.cc: New file.
10887         * testsuite/protected_2.cc: New file.
10888         * testsuite/protected_3.cc: New file.
10889         * testsuite/protected_main_1.cc: New file.
10890         * testsuite/protected_main_2.cc: New file.
10891         * testsuite/protected_main_3.cc: New file.
10892         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10893         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10894         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10895         (protected_1.so): New target.
10896         (protected_1_pic.o, protected_2_pic.o): New targets.
10897         (protected_3_pic.o): New target.
10898         (check_PROGRAMS): Add protected_2.
10899         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10900         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10901         * testsuite/Makefile.in: Rebuild.
10902
10903         * options.h (DEFINE_var): Add set_user_set_##varname__.
10904         (DEFINE_bool_alias): New macro.
10905         (class General_options): Define -Bstatic using DEFINE_bool_alias
10906         rather than DEFINE_special.  Add --undefined as an alias for -z
10907         defs.
10908         * options.cc (General_options::parse_Bstatic): Remove.
10909
10910         * options.h (class General_options): Add --fatal-warnings.
10911         * main.cc (main): Implement --fatal-warnings.
10912         * errors.h (Errors::warning_count): New function.
10913
10914         * options.h (class General_options): Add -Bsymbolic-functions.
10915         * symtab.h (Symbol::is_preemptible): Check for
10916         -Bsymbolic-functions.
10917
10918 2008-05-05  Ian Lance Taylor  <iant@google.com>
10919
10920         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10921         as noVARNAME rather than no-VARNAME.
10922         (class General_options): Add option -z combreloc.
10923         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10924         get_address.
10925         (Output_reloc::sort_before) [SHT_REL]: New function.
10926         (Output_reloc::sort_before) [SHT_RELA]: New function.
10927         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10928         Sort_relocs_comparison.
10929         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10930         parameter.  Change all callers.
10931         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10932         sort_relocs parameter.  Change all callers.
10933         * output.cc (Output_reloc::get_address): New function, broken out
10934         of write_rel.
10935         (Output_reloc::write_rel): Call it.
10936         (Output_reloc::compare): New function.
10937         (Output_data_reloc_base::do_write): Optionally sort relocs.
10938
10939         * configure.ac: If targ_extra_obj is set, link it in.
10940         * configure.tgt: Initialize all variables.
10941         (x86_64*): Set targ_extra_obj and targ_extra_size.
10942         * configure: Rebuild.
10943
10944         * object.cc (Sized_relobj::include_section_group): Adjust section
10945         indexes read from group data.  Build vector to pass to
10946         layout_group.
10947         * layout.cc (Layout::layout_group): Add flags and shndxes
10948         parameters.  Remove contents parameter.  Change caller.  Update
10949         explicit instantiations.
10950         * layout.h (class Layout): Update layout_group declaration.
10951         * output.cc (Output_data_group::Output_data_group): Add flags and
10952         input_shndxes parameters.  Remove contents parameter.  Change
10953         caller.
10954         (Output_data_group::do_write): Change input_sections_ to
10955         input_shndxes_.
10956         * output.h (class Output_data_group): Update constructor
10957         declaration.  Rename input_sections_ to input_shndxes_.
10958         * testsuite/many_sections_test.cc: Add template.
10959
10960 2008-04-30  Cary Coutant  <ccoutant@google.com>
10961
10962         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10963
10964         * layout.cc (Layout::include_section): Refactored check for debug
10965         info section.
10966         (Layout::add_comdat): Add new parameters.  Change type
10967         of signature parameter.  Add object and shndx to signatures table.
10968         (Layout::find_kept_object): New function.
10969         * layout.h: Include <cstring>.
10970         (Layout::is_debug_info_section): New function.
10971         (Layout::add_comdat): Add new parameters.
10972         (Layout::find_kept_object): New function.
10973         (Layout::Kept_section): New struct.
10974         (Layout::Signatures): Change type of map range.
10975         * object.cc (Relobj::output_section_address): New function.
10976         (Sized_relobj::include_section_group): Add new parameters.  Change
10977         calls to Layout::add_comdat.  Change to build table of kept comdat
10978         groups and table mapping discarded sections to kept sections.
10979         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10980         (Sized_relobj::do_layout): Change calls to include_section_group and
10981         include_linkonce_section.
10982         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10983         value to zero when section is discarded.
10984         (Sized_relobj::map_to_kept_section): New function.
10985         * object.h (Relobj::output_section_address): New function.
10986         (Relobj::Comdat_group): New type.
10987         (Relobj::find_comdat_group): New function.
10988         (Relobj::Comdat_group_table): New type.
10989         (Relobj::Kept_comdat_section): New type.
10990         (Relobj::Kept_comdat_section_table): New type.
10991         (Relobj::add_comdat_group): New function.
10992         (Relobj::set_kept_comdat_section): New function.
10993         (Relobj::get_kept_comdat_section): New function.
10994         (Relobj::comdat_groups_): New field.
10995         (Relobj::kept_comdat_sections_): New field.
10996         (Symbol_value::input_value): Update comment.
10997         (Sized_relobj::map_to_kept_section) New function.
10998         (Sized_relobj::include_linkonce_section): Add new parameter.
10999         * target-reloc.h (Comdat_behavior): New type.
11000         (get_comdat_behavior): New function.
11001         (relocate_section): Add code to map a discarded section to the
11002         corresponding kept section when applying a relocation.
11003
11004 2008-04-30  Craig Silverstein  <csilvers@google.com>
11005
11006         * dwarf_reader.cc (next_generation_count): New static var.
11007         (Addr2line_cache_entry): New struct.
11008         (addr2line_cache): New static var.
11009         (Dwarf_line_info::one_addr2line): Added caching.
11010         (Dwarf_line_info::clear_addr2line_cache): New function.
11011         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11012         cache-size parameter.
11013         (Dwarf_line_info::one_addr2line_cache): New function.
11014         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11015         new cache-size argument to one_addr2line(), and clear cache.
11016
11017 2008-04-28  Cary Coutant  <ccoutant@google.com>
11018
11019         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11020         R_386_PC8 relocations.
11021
11022 2008-04-23  Ian Lance Taylor  <iant@google.com>
11023
11024         * object.cc (Sized_relobj::include_section_group): Check for
11025         invalid section group.
11026
11027         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11028         header size.
11029
11030         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11031         than read for file header.
11032         * archive.cc (Archive::include_member): Likewise.
11033
11034 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11035
11036         * aclocal.m4: Regenerate.
11037         * configure: Regenerate.
11038
11039 2008-04-19  Ian Lance Taylor  <iant@google.com>
11040
11041         * version.cc (version_string): Bump to 1.6.
11042
11043         * testsuite/Makefile.am (many_sections_r_test): New target.
11044         (many_sections_r_test_SOURCES): Remove.
11045         (many_sections_r_test_DEPENDENCIES): Remove.
11046         (many_sections_r_test_LDFLAGS): Remove.
11047         (many_sections_r_test_LDADD): Remove.
11048
11049         * object.cc (Sized_relobj::do_add_symbols): Always pass
11050         local_symbol_count_ to add_from_relobj.
11051
11052         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11053         every thousand variables.
11054         * testsuite/Makefile.in: Rebuild.
11055
11056         * object.cc (Xindex::initialize_symtab_xindex): New function.
11057         (Xindex::read_symtab_xindex): New function.
11058         (Xindex::sym_xindex_to_shndx): New function.
11059         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11060         available.
11061         (Sized_relobj::do_initialize_xindex): New function.
11062         (Sized_relobj::do_read_symbols): Adjust section links.
11063         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11064         parameter.  Change all callers.
11065         (Sized_relobj::include_section_group): Adjust section links and
11066         symbol section indexes.
11067         (Sized_relobj::do_layout): Adjust section links.
11068         (Sized_relobj::do_count_local_symbols): Adjust section links and
11069         symbol section indexes.
11070         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11071         ordinary and special symbols.
11072         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11073         dynsym_xindex parameters.  Change all callers.  Adjust section
11074         links.  Use SHN_XINDEX when needed.
11075         (Sized_relobj::get_symbol_location_info): Adjust section links.
11076         Don't get fooled by special symbols.
11077         * object.h (class Xindex): Define.
11078         (class Object): Add xindex_ parameter.  Declare virtual functoin
11079         do_initialize_xindex.
11080         (Object::adjust_sym_shndx): New function.
11081         (Object::set_xindex): New protected function.
11082         (class Symbol_value): Add is_ordinary_shndx_ field.
11083         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11084         (Symbol_value::value): Assert ordinary section.
11085         (Symbol_value::initialize_input_to_output_map): Likewise.
11086         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11087         Change all callers.
11088         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11089         all callers.
11090         (class Sized_relobj): Update declarations.
11091         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11092         parameter.  Change all callers.
11093         (Sized_relobj::adjust_shndx): New function.
11094         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11095         field.
11096         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11097         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11098         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11099         (Sized_dynobj::read_dynsym_section): Adjust section links.
11100         (Sized_dynobj::read_dynamic): Likewise.
11101         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11102         section links.
11103         (Sized_dynobj::do_initialize_xindex): New function.
11104         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11105         do_initialize_xindex.
11106         (Sized_dynobj::adjust_shndx): New function.
11107         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11108         dynsym_xindex_ fields.
11109         (Layout::finalize): Add a call to set_section_indexes before
11110         creating the symtab sections.
11111         (Layout::set_section_indexes): Don't do anything if the section
11112         already has a section index.
11113         (Layout::create_symtab_sections): Add shnum parameter.  Change
11114         caller.  Create .symtab_shndx section if needed.
11115         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11116         caller.
11117         (Layout::allocated_output_section_count): New function.
11118         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11119         needed.
11120         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11121         fields.  Update declarations.
11122         (Layout::symtab_xindex): New function.
11123         (Layout::dynsym_xindex): New function.
11124         (class Write_symbols_task): Add layout_ field.
11125         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11126         Change caller.
11127         * output.cc (Output_section_headers::Output_section_headers): Add
11128         shstrtab_section parameter.  Change all callers.
11129         (Output_section_headers::do_sized_write): Store overflow values
11130         for section count and section string table section index in
11131         section header zero.
11132         (Output_file_header::do_sized_write): Check for overflow of
11133         section count and section string table section index.
11134         (Output_symtab_xindex::do_write): New function.
11135         (Output_symtab_xindex::endian_do_write): New function.
11136         * output.h (class Output_section_headers): Add shstrtab_section_.
11137         Update declarations.
11138         (class Output_symtab_xindex): Define.
11139         (Output_section::has_out_shndx): New function.
11140         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11141         field.
11142         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11143         Change all callers.
11144         (Sized_symbol::init): Likewise.
11145         (Symbol::output_section): Check for ordinary symbol.
11146         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11147         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11148         callers.
11149         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11150         Change all callers.  Simplify handling of symbols from sections
11151         not included in the link.
11152         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11153         distinction.
11154         (Weak_alias_sorter::operator()): Assert that symbols are
11155         ordinary.
11156         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11157         distinction.
11158         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11159         parameters.  Change all callers.
11160         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11161         symbol distinction.  Use SHN_XINDEX when needed.
11162         (Symbol_table::write_section_symbol): Add symtab_xindex
11163         parameter.  Change all callers.
11164         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11165         SHN_XINDEX when needed.
11166         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11167         declarations.
11168         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11169         (Symbol::is_defined): Check is_ordinary.
11170         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11171         (Symbol::is_absolute, Symbol::is_common): Likewise.
11172         (class Sized_symbol): Update declarations.
11173         (class Symbol_table): Update declarations.
11174         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11175         parameters.  Change all callers.
11176         (Sized_symbol::override): Likewise.
11177         (Symbol_table::override): Likewise.
11178         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11179         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11180         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11181         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11182         to be in an ordinary section.
11183         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11184         object and is_ordinary parameters.  Change all callers.
11185         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11186         Change all callers.  Don't add undefined or non-ordinary symbols
11187         to reloc_map_.
11188         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11189         Change all callers.
11190         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11191         declarations.
11192         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11193         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11194         (Sized_relobj::relocate_sections): Likewise.
11195         * target-reloc.h (scan_relocs): Adjust section symbol index.
11196         (scan_relocatable_relocs): Likewise.
11197         * i386.cc (Scan::local): Check for ordinary symbols.
11198         * sparc.cc (Scan::local): Likewise.
11199         * x86_64.cc (Scan::local): Likewise.
11200         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11201         to symbol_section_and_value.
11202         * testsuite/many_sections_test.cc: New file.
11203         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11204         (check_PROGRAMS): Add many_sections_test.
11205         (many_sections_test_SOURCES): Define.
11206         (many_sections_test_DEPENDENCIES): Define.
11207         (many_sections_test_LDFLAGS): Define.
11208         (BUILT_SOURCES): Add many_sections_define.h.
11209         (many_sections_define.h): New target.
11210         (BUILT_SOURCES): Add many_sections_check.h.
11211         (many_sections_check.h): New target.
11212         (check_PROGRAMS): Add many_sections_r_test.
11213         (many_sections_r_test_SOURCES): Define.
11214         (many_sections_r_test_DEPENDENCIES): Define.
11215         (many_sections_r_test_LDFLAGS): Define.
11216         (many_sections_r_test_LDADD): Define.
11217         (many_sections_r_test.o): New target.
11218         * testsuite/Makefile.in: Rebuild.
11219
11220 2008-04-17  Cary Coutant  <ccoutant@google.com>
11221
11222         * errors.cc (Errors::info): New function.
11223         (gold_info): New function.
11224         * errors.h (Errors::info): New function.
11225         * gold.h (gold_info): New function.
11226         * object.cc (Input_objects::add_object): Print trace output.
11227         * options.cc (options::parse_set): New function.
11228         (General_options::parse_wrap): Deleted.
11229         (General_options::General_options): Deleted initializer.
11230         * options.h (options::String_set): New typedef.
11231         (options::parse_set): New function.
11232         (DEFINE_set): New macro.
11233         (General_options::wrap): Changed to use DEFINE_set. Changed
11234         callers of any_wrap_symbols and is_wrap_symbol.
11235         (General_options::trace, General_options::trace_symbol):
11236         New options.
11237         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11238         (General_options::wrap_symbols_): Deleted.
11239         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11240
11241 2008-04-17  David S. Miller  <davem@davemloft.net>
11242
11243         * options.cc (General_options::parse_V): New function.
11244         * options.h: Add entries for -V and -Qy.
11245
11246 2008-04-17  Ian Lance Taylor  <iant@google.com>
11247
11248         * common.cc (Symbol_table::allocate_commons): Remove options
11249         parameter.  Change caller.
11250         (Symbol_table::do_allocate_commons): Remove options parameter.
11251         Change caller.  Just call do_allocate_commons_list twice.
11252         (Symbol_table::do_allocate_commons_list): New function, broken out
11253         of do_allocate_commons.
11254         * common.h (class Allocate_commons_task): Remove options_ field.
11255         Update constructor.
11256         * symtab.cc (Symbol_table::Symbol_table): Initialize
11257         tls_commons_.
11258         (Symbol_table::add_from_object): Put TLS common symbols on
11259         tls_commons_ list.
11260         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11261         which are IN_OUTPUT_DATA.
11262         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11263         allocate_commons and do_allocate_commons declarations.  Declare
11264         do_allocate_commons_list.
11265         * gold.cc (queue_middle_tasks): Update creation of
11266         Allocate_commons_task to not pass options.
11267         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11268         (TLS_TEST_C_FLAGS): New variable.
11269         (tls_test_c_pic.o): New target.
11270         (tls_test_shared.so): Link in tls_test_c_pic.o.
11271         (tls_test_c_pic_ie.o): New target.
11272         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11273         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11274         (tls_test_c.o): New target.
11275         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11276         (tls_pic_test_LDADD): Likewise.
11277         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11278         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11279         (tls_test_c_gnu2.o): New target.
11280         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11281         tls_test_c_gnu2.o.
11282         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11283         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11284         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11285         * testsuite/tls_test.cc: Include "config.h".
11286         (t_last): Call t11_last.
11287         * testsuite/tls_test.h (t11, t11_last): Declare.
11288         * testsuite/tls_test_c.c: New file.
11289         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11290         * configure.ac: Check for OpenMP support.
11291         * configure, config.in, Makefile.in: Rebuild.
11292         * testsuite/Makefile.in: Rebuild.
11293
11294 2008-04-16  Cary Coutant  <ccoutant@google.com>
11295
11296         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11297         (Target_i386::tls_base_symbol_defined_): New field.
11298         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11299         (Target_i386::Scan::global): Likewise.
11300         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11301         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11302         (Target_x86_64::tls_base_symbol_defined_): New field.
11303         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11304         (Target_x86_64::Scan::global): Likewise.
11305
11306 2008-04-16  Cary Coutant  <ccoutant@google.com>
11307
11308         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11309         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11310         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11311         building shared libraries.
11312         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11313         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11314         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11315         * testsuite/Makefile.in: Rebuild.
11316         * testsuite/weak_undef.h: New file.
11317         * testsuite/weak_undef_file1.cc: Add extra test cases.
11318         * testsuite/weak_undef_file2.cc: Likewise.
11319         * testsuite/weak_undef_test.cc: Likewise.
11320
11321 2008-04-16  David S. Miller  <davem@davemloft.net>
11322
11323         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11324         Add issued_non_pic_error_ field.  Declare check_non_pic.
11325         (Target_sparc::Scan::check_non_pic): New function.
11326         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11327         (Target_sparc::Scan::global): Likewise.
11328
11329         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11330         * configure: Rebuild.
11331
11332         * options.h (DEFINE_enable): New macro.
11333         (new_dtags): New enable option.
11334         (initfirst, interpose, loadfltr, nodefaultlib,
11335         nodelete, nodlopen, nodump): New -z options.
11336         * layout.cc (Layout:finish_dynamic_section): If new
11337         dtags enabled, emit DT_RUNPATH.  Also, emit a
11338         DT_FLAGS_1 containing any specified -z flags.
11339
11340 2008-04-16  Ian Lance Taylor  <iant@google.com>
11341
11342         * copy-relocs.cc: New file.
11343         * copy-relocs.h: New file.
11344         * reloc.cc: Remove Copy_relocs code.
11345         * reloc.h: Likewise.
11346         * reloc-types.h (struct Reloc_types) [both versions]: Add
11347         get_reloc_addend_noerror.
11348         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11349         variants of add_global which take an addend which must be zero.
11350         * i386.cc: Include "copy-relocs.h".
11351         (class Target_i386): Change type of copy_relocs_ to variable,
11352         update initializer.
11353         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11354         Change all callers.
11355         (Target_i386::do_finalize_sections): Change handling of
11356         copy_relocs_.
11357         * sparc.cc: Include "copy-relocs.h".
11358         (class Target_sparc): Change type of copy_relocs_ to variable,
11359         update initializer.
11360         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11361         Change all callers.
11362         (Target_sparc::do_finalize_sections): Change handling of
11363         copy_relocs_.
11364         * x86_64.cc: Include "copy-relocs.h".
11365         (class Target_x86_64): Change type of copy_relocs_ to variable,
11366         update initializer.
11367         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11368         class.  Change all callers.
11369         (Target_x86_64::do_finalize_sections): Change handling of
11370         copy_relocs_.
11371         * Makefile.am (CCFILES): Add copy-relocs.cc.
11372         (HFILES): Add copy-relocs.h.
11373
11374         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11375
11376         * testsuite/script_test_4.sh: Permit leading zeroes.
11377
11378 2008-04-15  Ian Lance Taylor  <iant@google.com>
11379
11380         * script-sections.cc (Script_sections::create_segments): Use
11381         header_size_adjustment even when there is enough room for the
11382         headers.
11383         * testsuite/script_test_4.sh: New file.
11384         * testsuite/script_test_4.t: New file.
11385         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11386         (check_DATA): Add script_test_4.stdout.
11387         (MOSTLYCLEANFILES): Likewise.
11388         (script_test_4): New target.
11389         (script_test_4.stdout): New target.
11390         * testsuite/Makefile.in: Rebuild.
11391
11392         * sparc.cc: Add definitions for Output_data_plt_sparc class
11393         constants.
11394
11395 2008-04-14  David S. Miller  <davem@davemloft.net>
11396
11397         * sparc.cc: New file.
11398         * Makefile.am (TARGETSOURCES): Add sparc.cc
11399         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11400         * configure.tgt: Document targ_extra_size and
11401         targ_extra_big_endian.  Add entries for sparc-* and
11402         sparc64-*.
11403         * configure.ac: Handle targ_extra_size and
11404         targ_extra_big_endian.
11405         * Makefile.in: Rebuild.
11406         * configure: Likewise.
11407         * po/POTFILES.in: Likewise.
11408         * po/gold.pot: Likewise.
11409
11410 2008-04-14  Ian Lance Taylor  <iant@google.com>
11411
11412         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11413         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11414         in the name/type/flags to section mapping.  Don't call
11415         allocate_output_section.
11416         (Layout::choose_output_section): Change parameter from adjust_name
11417         to is_input_section.  Don't permit input sections after sections
11418         are attached to segments.  Don't call allocate_output_section.
11419         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11420         not write_enable_output_section.
11421         (Layout::make_output_section): Don't push to
11422         unattached_section_list_ nor call attach_to_segment.  Call
11423         attach_section_to_segment if sections are attached.
11424         (Layout::attach_sections_to_segments): New function.
11425         (Layout::attach_section_to_segment): New function.
11426         (Layout::attach_allocated_section_to_segment): Rename from
11427         attach_to_segment.  Remove flags parameter.
11428         (Layout::allocate_output_section): Remove function.
11429         (Layout::write_enable_output_section): Remove function.
11430         * layout.h (class Layout): Update for above changes.  Add new
11431         field sections_are_attached_.
11432         * output.h (Output_section::update_flags_for_input_section): New
11433         function.
11434         * output.cc (Output_section::add_input_section): Call
11435         update_flags_for_input_section.
11436         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11437
11438 2008-04-11  Cary Coutant  <ccoutant@google.com>
11439
11440         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11441         thought unnecessary.
11442         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11443
11444 2008-04-11  Ian Lance Taylor  <iant@google.com>
11445
11446         * output.h (class Output_section_data): Remove inline definition
11447         of set_addralign.
11448         * output.cc (Output_section_data::set_addralign): New function.
11449
11450 2008-04-11  Cary Coutant  <ccoutant@google.com>
11451
11452         Add support for TLS descriptors for i386 and x86_64.
11453         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11454         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11455         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11456         GOT_TYPE_TLS_DESC.
11457         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11458         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11459         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11460         relocations.
11461         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11462         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11463         Fix problem with initial-exec relocations.
11464         (Target_i386::Relocate::relocate_tls): Likewise.
11465         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11466         relaxation.
11467         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11468         support for section-plus-offset dynamic table entries.
11469         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11470         (Output_data_dynamic::Dynamic_entry): Add support for
11471         section-plus-offset dynamic table entries.
11472         (Output_data_dynamic::Classification): Likewise.
11473         (Output_data_dynamic::classification_): Renamed offset_.
11474         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11475         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11476         (Target_x86_64::make_plt_section): New function.
11477         (Target_x86_64::reserve_tlsdesc_entries): New function.
11478         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11479         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11480         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11481         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11482         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11483         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11484         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11485         add extra PLT entry for TLS descriptors.
11486         (Output_data_plt_x86_64::got_): New field.
11487         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11488         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11489         fields.
11490         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11491         descriptors.
11492         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11493         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11494         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11495         R_386_TLS_DESC_CALL relocations.
11496         (Target_x86_64::Scan::global): Likewise.
11497         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11498         for TLS descriptors.
11499         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11500         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11501         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11502         GD-to-IE relaxation.
11503         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11504         and TLS_DESCRIPTORS.
11505         * Makefile.in: Rebuild.
11506         * configure: Rebuild.
11507         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11508         (tls_test_shared2.so): New target.
11509         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11510         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11511         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11512         (tls_shared_gd_to_ie_test_LDADD): New variable.
11513         (tls_shared_gnu2_gd_to_ie_test): New target.
11514         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11515         New targets.
11516         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11517         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11518         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11519         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11520         (tls_shared_gnu2_test): New target.
11521         (tls_test_gnu2_shared.so): New target.
11522         (tls_shared_gnu2_test_SOURCES): New variable.
11523         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11524         (tls_shared_gnu2_test_LDFLAGS): New variable.
11525         (tls_shared_gnu2_test_LDADD): New variable.
11526         * testsuite/Makefile.in: Rebuild.
11527         * testsuite/Makefile.
11528
11529 2008-04-11  Ian Lance Taylor  <iant@google.com>
11530
11531         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11532         justsyms.t.
11533         * testsuite/Makefile.in: Rebuild.
11534
11535         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11536         long.
11537         * testsuite/script_test_2.cc (main): Adjust test.
11538
11539 2008-04-11  David S. Miller  <davem@davemloft.net>
11540             Ian Lance Taylor  <iant@google.com>
11541
11542         * options.h (General_options): Add entries for '-Y' and
11543         '-relax'.
11544         * options.cc (General_options:finalize): If -Y was used, add those
11545         entries to the library path instead of the default "/lib" and
11546         "/usr/lib".
11547
11548 2008-04-11  David S. Miller  <davem@davemloft.net>
11549
11550         * testsuite/justsyms.t: Start at 0x100.
11551         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11552         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11553         long.
11554         * testsuite/script_test_2.cc: Adjust string and section length
11555         checks.
11556
11557 2008-04-09  Ian Lance Taylor  <iant@google.com>
11558
11559         PR gold/5996
11560         * script-sections.cc (Sections_element::allocate_to_segment): Add
11561         orphan parameter.
11562         (Output_section_definition::allocate_to_segment): Likewise.
11563         (Orphan_output_section::allocate_to_segment): Likewise.
11564         (Script_sections::attach_sections_using_phdrs_clause): Don't
11565         propagate non-PT_LOAD segments to orphan sections.
11566         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11567         readelf rather than objdump.
11568         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11569         .interp section and PT_INTERP segment are the same size.
11570         * testsuite/Makefile.in: Rebuild.
11571
11572         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11573         aliases for symbols defined in the same object.
11574         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11575         (weak_alias_test_SOURCES): New variable.
11576         (weak_alias_test_DEPENDENCIES): New variable.
11577         (weak_alias_test_LDFLAGS): New variable.
11578         (weak_alias_test_LDADD): New variable.
11579         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11580         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11581         (weak_alias_test_3.o): New target.
11582         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11583         * testsuite/weak_alias_test_main.cc: New file.
11584         * testsuite/weak_alias_test_1.cc: New file.
11585         * testsuite/weak_alias_test_2.cc: New file.
11586         * testsuite/weak_alias_test_3.cc: New file.
11587
11588 2008-04-08  Ian Lance Taylor  <iant@google.com>
11589
11590         * options.h (class General_options): Add --noinhibit-exec option.
11591         * main.cc (main): Check --noinhibit-exec.
11592
11593         * options.h (class General_options): Define --wrap as a special
11594         option.  Add wrap_symbols_ field.
11595         (General_options::any_wrap_symbols): New function.
11596         (General_options::is_wrap_symbol): New function.
11597         * options.cc (General_options::parse_wrap): New function.
11598         (General_options::General_options): Initialize wrap_symbols_.
11599         * symtab.cc (Symbol_table::wrap_symbol): New function.
11600         (Symbol_table::add_from_object): Handle --wrap.
11601         * symtab.h (class Symbol_table): Declare wrap_symbol.
11602         * target.h (Target::wrap_char): New function.
11603         (Target::Target_info): Add wrap_char field.
11604         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11605         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11606         * testsuite/testfile.cc (Target_test::test_target_info):
11607         Likewise.
11608
11609         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11610         there is one.
11611
11612         * layout.h (class Layout): Add added_eh_frame_data_ field.
11613         * layout.cc (Layout::Layout): Initialize new field.
11614         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11615         output section until we find a section we merged successfully.
11616         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11617         that the size be non-zero.
11618
11619         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11620         qualifier.
11621
11622 2008-04-08  Craig Silverstein  <csilvers@google.com>
11623
11624         * configure.ac: Export new conditional variable HAVE_ZLIB.
11625         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11626         on HAVE_ZLIB.
11627         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11628         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11629
11630 2008-04-07  Ian Lance Taylor  <iant@google.com>
11631
11632         * version.cc (version_string): Set to "1.5".
11633
11634         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11635         Add issued_non_pic_error_ field.  Declare check_non_pic.
11636         (Target_x86_64::Scan::check_non_pic): New function.
11637         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11638         (Target_x86_64::Scan::global): Likewise.
11639
11640         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11641         addend parameter.  Change caller.  Handle merge sections.
11642         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11643         Address to Addend.  Don't add in the result of
11644         local_section_offset, pass down the addend and use the returned
11645         value.
11646         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11647         Update declarations of local_section_offset and symbol_value.
11648         * testsuite/two_file_test_1.cc (t18): New function.
11649         * testsuite/two_file_test_2.cc (f18): New function.
11650         * testsuite/two_file_test_main.cc (main): Call t18.
11651         * testsuite/two_file_test.h (t18, f18): Declare.
11652
11653         * configure.ac: Don't test for objdump, c++filt, or readelf.
11654         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11655         conditionals.
11656         (TEST_READELF): New variable.
11657         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11658         (check_PROGRAMS): Add two_file_strip_test.
11659         (two_file_strip_test): New target.
11660         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11661         (two_file_same_shared_strip_test_SOURCES): New variable.
11662         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11663         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11664         (two_file_same_shared_strip_test_LDADD): New variable.
11665         (two_file_shared_strip.so): New target.
11666         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11667         (ver_test_5.syms, ver_test_7.syms): Likewise.
11668         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11669         (strip_test_3.stdout): Use TEST_OBJDUMP.
11670         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11671
11672 2008-04-04  Cary Coutant  <ccoutant@google.com>
11673
11674         * symtab.h (Symbol::is_weak_undefined): New function.
11675         (Symbol::is_strong_undefined): New function.
11676         (Symbol::is_absolute): New function.
11677         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11678         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11679         absolute symbols.
11680         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11681         (weak_undef_test): New target.
11682         * testsuite/Makefile.in: Rebuild.
11683         * testsuite/weak_undef_file1.cc: New file.
11684         * testsuite/weak_undef_file2.cc: New file.
11685         * testsuite/weak_undef_test.cc: New file.
11686
11687 2008-04-03  Craig Silverstein  <csilvers@google.com>
11688
11689         * compressed_output.h (class Output_compressed_section): Use
11690         unsigned buffer.
11691         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11692         add zlib header.
11693         (zlib_compressed_suffix): Removed.
11694         (Output_compressed_section::set_final_data_size): Use unsigned
11695         buffers.
11696         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11697         Fix linker invocation.
11698         (flagstest_o_specialfile_and_compress_debug_sections):
11699         Likewise.
11700         * testsuite/Makefile.in: Regenerated.
11701
11702 2008-04-02  David S. Miller  <davem@davemloft.net>
11703
11704         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11705         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11706
11707 2008-04-02  Craig Silverstein  <csilvers@google.com>
11708
11709         * TODO: New file.
11710
11711 2008-04-02  Ian Lance Taylor  <iant@google.com>
11712
11713         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11714         parameters.  Update for new key type to views_.  Change all
11715         callers.
11716         (File_read::read): Adjust for byteshift in returned view.
11717         (File_read::add_view): New function, broken out of
11718         find_and_make_view.
11719         (File_read::make_view): New function, broken out of
11720         find_and_make_view.
11721         (File_read::find_or_make_view): Add offset and aligned
11722         parameters.  Rewrite accordingly.  Change all callers.
11723         (File_read::get_view): Add offset and aligned parameters.  Adjust
11724         for byteshift in return value.
11725         (File_read::get_lasting_view): Likewise.
11726         * fileread.h (class File_read): Update declarations.
11727         (class File_read::View): Add byteshift_ field.  Add byteshift to
11728         constructor.  Add byteshift method.
11729         * archive.h (Archive::clear_uncached_views): New function.
11730         (Archive::get_view): Add aligned parameter.  Change all callers.
11731         * object.h (Object::get_view): Add aligned parameter.  Change all
11732         callers.
11733         (Object::get_lasting_view): Likewise.
11734
11735         * fileread.cc (File_read::release): Don't call clear_views if
11736         there are multiple objects.
11737         * fileread.h (File_read::clear_uncached_views): New function.
11738         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11739         on the archive.
11740
11741 2008-03-31  Cary Coutant  <ccoutant@google.com>
11742
11743         Add thin archive support.
11744         * archive.cc (Archive::armagt): New const.
11745         (Archive::setup): Remove task parameter and calls to unlock.
11746         (Archive::unlock_nested_archives): New function.
11747         (Archive::read_header): Add nested_off parameter. Change
11748         all callers.
11749         (Archive::interpret_header): Likewise.
11750         (Archive::include_all_members): Change to handle thin
11751         archives.
11752         (Archive::include_member): Likewise.
11753         * archive.h (Archive::Archive): Add new parameters and
11754         initializers.
11755         (Archive::armagt): New const.
11756         (Archive::setup): Remove task parameter.
11757         (Archive::unlock_nested_archives): New function.
11758         (Archive::read_header): Add nested_off parameter.
11759         (Archive::interpret_header): Likewise.
11760         (Archive::Nested_archive_table): New typedef.
11761         (Archive::is_thin_archive_): New field.
11762         (Archive::nested_archives_): New field.
11763         (Archive::options_): New field.
11764         (Archive::dirpath_): New field.
11765         (Archive::task_): New field.
11766         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11767         for thin archives.  Pass additional parameters to
11768         Archive::Archive.  Unlock the archive file after calling
11769         Archive::setup.
11770
11771 2008-03-29  Ian Lance Taylor  <iant@google.com>
11772
11773         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11774         version symbol to be local.
11775         * testsuite/ver_test_4.sh: New file.
11776         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11777         (check_DATA): Add ver_test_4.syms.
11778         (ver_test_4.syms): New target.
11779         * testsuite/Makefile.in: Rebuild.
11780
11781         * output.cc
11782         (Output_section::Input_section_sort_entry::has_priority): New
11783         function.
11784         (Output_section::Input_section_sort_entry::match_file_name): New
11785         function.
11786         (Output_section::Input_section_sort_entry::match_section_name):
11787         Remove.
11788         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11789         Remove.
11790         (Output_section::Input_section_sort_entry::match_section_file):
11791         Remove.
11792         (Output_section::Input_section_sort_compare::operator()): Rewrite
11793         using new Input_section_sort_entry functions.  Sort crtbegin and
11794         crtend first.  Sort sections with no priority before sections with
11795         a priority.
11796         * testsuite/initpri1.c (d3): Check j != 4.
11797         (cd5): New constructor/destructor function.
11798         (main): Check j != 2.
11799
11800         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11801         new symbol when resolving, don't call set_is_default.
11802         * testsuite/ver_test_7.cc: New file.
11803         * testsuite/ver_test_7.sh: New file.
11804         * testsuite/Makefile.am (ver_test_7.so): New target.
11805         (ver_test_7.o): New target.
11806         (check_SCRIPTS): Add ver_test_7.sh.
11807         (check_DATA): Add ver_test_7.syms.
11808         (ver_test_7.syms): New target.
11809
11810 2008-03-28  Ian Lance Taylor  <iant@google.com>
11811
11812         * layout.cc (Layout::layout): If we see an input section with a
11813         name that needs sorting, set the must_sort flag for the output
11814         section.
11815         (Layout::make_output_section): If the name of the output section
11816         indicates that it might require sorting, set the may_sort flag.
11817         * output.h (Output_section::may_sort_attached_input_sections): New
11818         function.
11819         (Output_section::set_may_sort_attached_input_sections): New
11820         function.
11821         (Output_section::must_sort_attached_input_sections): New
11822         function.
11823         (Output_section::set_must_sort_attached_input_sections): New
11824         function.
11825         (class Output_section): Declare Input_section_sort_entry.  Define
11826         Input_section_sort_compare.  Declare
11827         sort_attached_input_sections.  Add new fields:
11828         may_sort_attached_input_sections_,
11829         must_sort_attached_input_sections_,
11830         attached_input_sections_are_sorted_.
11831         * output.cc (Output_section::Output_section): Initialize new
11832         fields.
11833         (Output_section::add_input_section): Add an entry to
11834         input_sections_ if may_sort or must_sort are true.
11835         (Output_section::set_final_data_size): Call
11836         sort_attached_input_sections if necessary.
11837         (Output_section::Input_section_sort_entry): Define new class.
11838         (Output_section::Input_section_sort_compare::operator()): New
11839         function.
11840         (Output_section::sort_attached_input_sections): New function.
11841         * configure.ac: Check whether the compiler supports constructor
11842         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11843         * testsuite/initpri1.c: New file.
11844         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11845         CONSTRUCTOR_PRIORITY.
11846         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11847         (initpri1_LDFLAGS): New variable.
11848         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11849
11850 2008-03-27  Ian Lance Taylor  <iant@google.com>
11851
11852         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11853         * testsuite/common_test_1.c: New file.
11854         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11855         (common_test_1_SOURCES): New variable.
11856         (common_test_1_DEPENDENCIES): New variable.
11857         (common_test_1_LDFLAGS): New variable.
11858
11859         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11860         and commons_ correctly when NAME/VERSION does not override
11861         NAME/NULL.
11862         * testsuite/ver_test_6.c: New file.
11863         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11864         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11865         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11866
11867 2008-03-26  Ian Lance Taylor  <iant@google.com>
11868
11869         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11870         of an undefined symbol from a version script.
11871         * testsuite/Makefile.am (ver_test_5.so): New target.
11872         (ver_test_5.o): New target.
11873         (check_SCRIPTS): Add ver_test_5.sh.
11874         (check_DATA): Add ver_test_5.syms.
11875         (ver_test_5.syms): New target.
11876         * testsuite/ver_test_5.cc: New file.
11877         * testsuite/ver_test_5.script: New file.
11878         * testsuite/ver_test_5.sh: New file.
11879         * Makefile.in, testsuite/Makefile.in: Rebuild.
11880
11881         PR gold/5986
11882         Fix problems building gold with gcc 4.3.0.
11883         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11884         (gold_error_at_location, gold_warning_at_location): Use it.
11885         * configure.ac: Check whether we can compile and use a template
11886         function with a printf attribute.
11887         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11888         when jumping over bytes.
11889         * object.cc: Instantiate Object::read_section_data.
11890         * debug.h: Include <cstring>
11891         * dwarf_reader.cc: Include <algorithm>
11892         * main.cc: Include <cstring>.
11893         * options.cc: Include <cstring>.
11894         * output.cc: Include <cstring>.
11895         * script.cc: Include <cstring>.
11896         * script.h: Include <string>.
11897         * symtab.cc: Include <cstring> and <algorithm>.
11898         * target-select.cc: Include <cstring>.
11899         * version.cc: Include <string>.
11900         * testsuite/testmain.cc: Include <cstdlib>.
11901         * configure, config.in: Rebuild.
11902
11903 2008-03-25  Ian Lance Taylor  <iant@google.com>
11904
11905         * options.cc: Include "../bfd/bfdver.h".
11906         (options::help): Print bug reporting address.
11907
11908         * version.cc (print_version): Adjust output for current value of
11909         BFD_VERSION_STRING.
11910
11911         * NEWS: New file.
11912
11913         * options.cc (options::help): Print list of supported targets.
11914         * target-select.h: Include <vector>.
11915         (class Target_selector): Make machine_, size_, and is_big_endian_
11916         fields const.  Add bfd_name_ and instantiated_target_ fields.
11917         (Target_selector::Target_selector): Add bfd_name parameter.
11918         (Target_selector::recognize): Make non-virtual, call
11919         do_recognize.
11920         (Target_selector::recognize_by_name): Make non-virtual, call
11921         do_recognize_by_name.
11922         (Target_selector::supported_names): New function.
11923         (Target_selector::bfd_name): New function.
11924         (Target_selector::do_instantiate_target): New pure virtual
11925         function.
11926         (Target_selector::do_recognize): New virtual function.
11927         (Target_selector::do_recognize_by_name): New virtual function.
11928         (Target_selector::instantiate_target): New private function.
11929         (supported_target_names): Declare.
11930         * target-select.cc (Target_selector::Target_selector): Update for
11931         new parameter and fields.
11932         (select_target_by_name): Check that the name matches before
11933         calling recognize_by_name.
11934         (supported_target_names): New function.
11935         * i386.cc (class Target_selector_i386): Update Target_selector
11936         constructor call.  Remove recognize and recognize_by_name.  Add
11937         do_instantiate_target.
11938         * x86_64.cc (class Target_selector_x86_64): Likewise.
11939         * testsuite/testfile.cc (class Target_selector_test): Update for
11940         changes to Target_selector.
11941
11942         * README: Rewrite, with some notes on unsupported features.
11943
11944 2008-03-24  Cary Coutant  <ccoutant@google.com>
11945
11946         * i386.cc (Target_i386::Got_type): New enum declaration.
11947         (Target_i386::Scan::local): Updated callers of Output_data_got
11948         member functions.
11949         (Target_i386::Scan::global): Likewise.
11950         (Target_i386::Relocate::relocate): Likewise.
11951         (Target_i386::Relocate::relocate_tls): Likewise.
11952         * object.h (Got_offset_list): New class.
11953         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11954         (Sized_relobj::local_got_offset): Likewise.
11955         (Sized_relobj::set_local_got_offset): Likewise.
11956         (Sized_relobj::local_has_tls_got_offset): Removed.
11957         (Sized_relobj::local_tls_got_offset): Removed.
11958         (Sized_relobj::set_local_tls_got_offset): Removed.
11959         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11960         * output.cc (Output_data_got::add_global): Added got_type parameter.
11961         (Output_data_got::add_global_with_rel): Likewise.
11962         (Output_data_got::add_global_with_rela): Likewise.
11963         (Output_data_got::add_global_pair_with_rel): New function.
11964         (Output_data_got::add_global_pair_with_rela): New function.
11965         (Output_data_got::add_local): Added got_type parameter.
11966         (Output_data_got::add_local_with_rel): Likewise.
11967         (Output_data_got::add_local_with_rela): Likewise.
11968         (Output_data_got::add_local_pair_with_rel): New function.
11969         (Output_data_got::add_local_pair_with_rela): New function.
11970         (Output_data_got::add_global_tls): Removed.
11971         (Output_data_got::add_global_tls_with_rel): Removed.
11972         (Output_data_got::add_global_tls_with_rela): Removed.
11973         (Output_data_got::add_local_tls): Removed.
11974         (Output_data_got::add_local_tls_with_rel): Removed.
11975         (Output_data_got::add_local_tls_with_rela): Removed.
11976         * output.h (Output_data_got::add_global): Added got_type parameter.
11977         (Output_data_got::add_global_with_rel): Likewise.
11978         (Output_data_got::add_global_with_rela): Likewise.
11979         (Output_data_got::add_global_pair_with_rel): New function.
11980         (Output_data_got::add_global_pair_with_rela): New function.
11981         (Output_data_got::add_local): Added got_type parameter.
11982         (Output_data_got::add_local_with_rel): Likewise.
11983         (Output_data_got::add_local_with_rela): Likewise.
11984         (Output_data_got::add_local_pair_with_rel): New function.
11985         (Output_data_got::add_local_pair_with_rela): New function.
11986         (Output_data_got::add_global_tls): Removed.
11987         (Output_data_got::add_global_tls_with_rel): Removed.
11988         (Output_data_got::add_global_tls_with_rela): Removed.
11989         (Output_data_got::add_local_tls): Removed.
11990         (Output_data_got::add_local_tls_with_rel): Removed.
11991         (Output_data_got::add_local_tls_with_rela): Removed.
11992         * resolve.cc (Symbol::override_base_with_special): Removed
11993         reference to has_got_offset_ field.
11994         * symtab.cc (Symbol::init_fields): Replaced initialization
11995         of got_offset_ with got_offsets_.  Removed initialization
11996         of has_got_offset_
11997         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11998         (Symbol::got_offset): Likewise.
11999         (Symbol::set_got_offset): Likewise.
12000         (Symbol::has_tls_got_offset): Removed.
12001         (Symbol::tls_got_offset): Removed.
12002         (Symbol::set_tls_got_offset): Removed.
12003         (Symbol::got_offset_): Removed.
12004         (Symbol::tls_mod_got_offset_): Removed.
12005         (Symbol::tls_pair_got_offset_): Removed.
12006         (Symbol::got_offsets_): New field.
12007         (Symbol::has_got_offset): Removed.
12008         (Symbol::has_tls_mod_got_offset): Removed.
12009         (Symbol::has_tls_pair_got_offset): Removed.
12010         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12011         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12012         member functions.
12013         (Target_x86_64::Scan::global): Likewise.
12014         (Target_x86_64::Relocate::relocate): Likewise.
12015         (Target_x86_64::Relocate::relocate_tls): Likewise.
12016
12017 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12018
12019         * yyscript.y: Fix spelling error in comment.
12020
12021 2008-03-24  Ian Lance Taylor  <iant@google.com>
12022
12023         * options.h (class General_options): Define build_id option.
12024         * layout.h (class Layout): Declare write_build_id, create_note,
12025         create_build_id.  Add build_id_note_ member.
12026         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12027         "libiberty.h", "md5.h", "sha1.h".
12028         (Layout::Layout): Initialize eh_frame_data_,
12029         eh_frame_hdr_section_, and build_id_note_.
12030         (Layout::finalize): Call create_build_id.
12031         (Layout::create_note): New function, broken out of
12032         Layout::create_gold_note.
12033         (Layout::create_gold_note): Call create_note.
12034         (Layout::create_build_id): New function.
12035         (Layout::write_build_id): New function.
12036         (Close_task_runner::run): Call write_build_id.
12037
12038         * x86_64.cc: Correct license to GPLv3.
12039
12040 2008-03-23  Ian Lance Taylor  <iant@google.com>
12041
12042         * options.cc: Include "demangle.h".
12043         (parse_optional_string): New function.
12044         (parse_long_option): Handle takes_optional_argument.
12045         (parse_short_option): Update dash_z initializer.  Handle
12046         takes_optional_argument.
12047         (General_options::General_options): Initialize do_demangle_.
12048         (General_options::finalize): Set do_demangle_.  Handle demangling
12049         style.
12050         * options.h (parse_optional_string): Declare.
12051         (struct One_option): Add optional_arg field.  Update constructor.
12052         Update call constructor calls.  Add takes_optional_argument
12053         function.
12054         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12055         (DEFINE_optional_string): Define.
12056         (General_options::demangle): Change from DEFINE_bool to
12057         DEFINE_optional_string.
12058         (General_options::no_demangle): New function.
12059         (General_options::do_demangle): New function.
12060         (General_options::set_do_demangle): New function.
12061         (General_options::execstack_status_): Move definition to end of
12062         class definition.
12063         (General_options::static_): Likewise.
12064         (General_options::do_demangle_): New field.
12065         * object.cc (big_endian>::get_symbol_location_info): Call
12066         Options::do_demangle, not Options::demangle.
12067         * symtab.cc (demangle): Likewise.
12068
12069 2008-03-22  Ian Lance Taylor  <iant@google.com>
12070
12071         * gold.h: Include <cstddef> and <sys/types.h>
12072         * options.h: Include <cstring>.
12073
12074 2008-03-21  Ian Lance Taylor  <iant@google.com>
12075
12076         * Added source code to GNU binutils.