* incremental.cc (Sized_relobj_incr::do_layout): Call
[external/binutils.git] / gold / ChangeLog
1 2011-09-13  Cary Coutant  <ccoutant@google.com>
2
3         * incremental.cc (Sized_relobj_incr::do_layout): Call
4         report_comdat_group for kept comdat sections.
5         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
6         * testsuite/Makefile.in: Regenerate.
7         * testsuite/incr_comdat_test_1.cc: New source file.
8         * testsuite/incr_comdat_test_2_v1.cc: New source file.
9         * testsuite/incr_comdat_test_2_v2.cc: New source file.
10         * testsuite/incr_comdat_test_2_v3.cc: New source file.
11
12 2011-09-13  Ian Lance Taylor  <iant@google.com>
13
14         * object.cc (Sized_relobj_file::do_layout): Remove unused local
15         variable external_symbols_offset.
16
17 2011-09-12  Ian Lance Taylor  <iant@google.com>
18
19         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
20         triggered if object has no symbols.
21
22 2011-09-09  David S. Miller  <davem@davemloft.net>
23
24         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
25         (Output_fill_debug_line::do_write): Likewise.
26
27 2011-08-29  Cary Coutant  <ccoutant@google.com>
28
29         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
30         casts to match formatting specs.
31         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
32
33 2011-08-26  Cary Coutant  <ccoutant@google.com>
34
35         * layout.cc (Free_list::allocate): Provide guarantee of minimum
36         remaining hole size when allocating.
37         (Layout::make_output_section): Set fill methods for debug sections.
38         * layout.h (Free_list::Free_list_node): Move from private to
39         public.
40         (Free_list::set_min_hole_size): New function.
41         (Free_list::begin, Free_list::end): New functions.
42         (Free_list::min_hole_): New data member.
43         * output.cc: Include dwarf.h.
44         (Output_fill_debug_info::do_minimum_hole_size): New function.
45         (Output_fill_debug_info::do_write): New function.
46         (Output_fill_debug_line::do_minimum_hole_size): New function.
47         (Output_fill_debug_line::do_write): New function.
48         (Output_section::Output_section): Initialize new data member.
49         (Output_section::set_final_data_size): Ensure patch space is larger
50         than minimum hole size.
51         (Output_section::do_write): Fill holes in debug sections.
52         * output.h (Output_fill): New class.
53         (Output_fill_debug_info): New class.
54         (Output_fill_debug_line): New class.
55         (Output_section::set_free_space_fill): New function.
56         (Output_section::free_space_fill_): New data member.
57         * testsuite/Makefile.am (incremental_test_3): Add
58         --incremental-patch option.
59         (incremental_test_4): Likewise.
60         (incremental_test_5): Likewise.
61         (incremental_test_6): Likewise.
62         (incremental_copy_test): Likewise.
63         (incremental_common_test_1): Likewise.
64         * testsuite/Makefile.in: Regenerate.
65
66 2011-08-26  Nick Clifton  <nickc@redhat.com>
67
68         * po/es.po: Updated Spanish translation.
69
70 2011-08-01  Cary Coutant  <ccoutant@google.com>
71
72         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
73         * gold/testsuite/Makefile.in: Regenerate.
74         * gold/testsuite/justsyms_exec.c: New source file.
75         * gold/testsuite/justsyms_lib.c: New source file.
76
77 2011-08-01  Cary Coutant  <ccoutant@google.com>
78
79         * layout.cc (Layout::set_segment_offsets): Don't realign text
80         segment if -Ttext was specified.
81         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
82         file type.
83         * object.h (Sized_relobj_file::e_type): New function.
84         (Sized_relobj_file::e_type_): New data member.
85         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
86         base address for ET_EXEC files.
87         * target.cc (Target::do_make_elf_object_implementation): Allow
88         ET_EXEC files with --just-symbols option.
89
90 2011-07-28  Cary Coutant  <ccoutant@google.com>
91
92         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
93         Add thread_number parameter.
94         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
95         * workqueue-threads.cc
96         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
97         current thread if its thread number is greater than desired thread
98         count.
99         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
100         Add thread_number parameter.
101         (Workqueue::should_cancel_thread): Likewise.
102         (Workqueue::find_runnable_or_wait): Pass thread_number to
103         should_cancel_thread.
104         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
105         parameter.
106
107 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
108
109         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
110         only after checking if it cannot be forced local.
111         * symtab.h (is_externally_visible): Check if the symbol is not forced
112         local.
113
114 2011-07-15  Ian Lance Taylor  <iant@google.com>
115
116         * options.h (class General_options): Add --print-output-format.
117         Move -EL next to -EB, for  better --help output.
118         * target-select.cc: Include <cstdio>, "options.h", and
119         "parameters.h".
120         (Target_selector::do_target_bfd_name): New function.
121         (print_output_format): New function.
122         * target-select.h (class Target_selector): Update declarations.
123         (Target_selector::target_bfd_name): New function.
124         (print_output_format): Declare.
125         * main.cc: Include "target-select.h".
126         (main): Handle --print-output-format.
127         * gold.cc: Include "target-select.h".
128         (queue_initial_tasks): Handle --print-output-format when there are
129         no input files.
130         * parameters.cc (parameters_force_valid_target): Give a better
131         error message if -EB/-EL does not match target.
132         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
133         function.
134
135 2011-07-15  Ian Lance Taylor  <iant@google.com>
136
137         * i386.cc (class Output_data_plt_i386): Add layout_ field.
138         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
139         (Output_data_plt_i386::do_write): Write address of .dynamic
140         section to first entry in .got.plt section.
141         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
142         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
143         Initialize layout_.
144         (Output_data_plt_x86_64::do_write): Write address of .dynamic
145         section to first entry in .got.plt section.
146         * layout.h (Layout::dynamic_section): New function.
147
148 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
149
150         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
151         to claim_file call.
152         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
153         input_section_position_, and input_section_glob_.
154         (read_layout_from_file): Call function section_ordering_specified.
155         * layout.h (is_section_ordering_specified): New function.
156         (section_ordering_specified): New function.
157         (section_ordering_specified_): New boolean member.
158         * main.cc(main): Call load_plugins after layout object is defined.
159         * output.cc (Output_section::add_input_section): Use
160         function section_ordering_specified to check if section ordering is
161         needed.
162         * output.cc (Output_section::add_relaxed_input_section): Use
163         function section_ordering_specified to check if section ordering is
164         needed.
165         (Output_section::update_section_layout): New function.
166         (Output_section::sort_attached_input_sections): Check if input section
167         must be reordered.
168         * output.h (Output_section::update_section_layout): New function.
169         * plugin.cc (get_section_count): New function.
170         (get_section_type): New function.
171         (get_section_name): New function.
172         (get_section_contents): New function.
173         (update_section_order): New function.
174         (allow_section_ordering): New function. 
175         (Plugin::load): Add the new interfaces to the transfer vector.
176         (Plugin_manager::load_plugins): New parameter.
177         (Plugin_manager::all_symbols_read): New parameter.
178         (Plugin_manager::claim_file): New parameter. Save the elf object for
179         unclaimed objects.
180         (Plugin_manager::get_elf_object): New function.
181         (Plugin_manager::get_view): Change to directly use the bool to check
182         if get_view is called from claim_file_hook.
183         * plugin.h (input_objects): New function
184         (Plugin__manager::load_plugins): New parameter.
185         (Plugin_manager::claim_file): New parameter.
186         (Plugin_manager::get_elf_object): New function.
187         (Plugin_manager::in_claim_file_handler): New function.
188         (Plugin_manager::in_claim_file_handler_): New member.
189         (layout): New function.
190         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
191         handler with an extra parameter. Make the elf object before calling
192         claim_file handler.
193         * testsuite/plugin_test.c (get_section_count): New function pointer.
194         (get_section_type): New function pointer.
195         (get_section_name): New function pointer.
196         (get_section_contents): New function pointer.
197         (update_section_order): New function pointer.
198         (allow_section_ordering): New function pointer.
199         (onload): Check if the new interfaces exist.
200
201 2011-07-13  Ian Lance Taylor  <iant@google.com>
202
203         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
204         relro section.
205         * x86_64.cc (Target_x86_64::got_section): Likewise.
206         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
207         (relro_now_test_SOURCES): New variable.
208         (relro_now_test_DEPENDENCIES): New variable.
209         (relro_now_test_LDFLAGS): New variable.
210         (relro_now_test_LDADD): New variable.
211         (relro_now_test.so): New target.
212         * testsuite/Makefile.in: Rebuild.
213
214 2011-07-12  Ian Lance Taylor  <iant@google.com>
215
216         PR gold/12980
217         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
218         GLOB_DAT relocation rather than a RELATIVE relocation for a
219         protected symbol when creating a shared library.
220         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
221         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
222         * testsuite/protected_main_1.cc (main): Test that protected
223         function has same address.
224
225 2011-07-11  Ian Lance Taylor  <iant@google.com>
226
227         PR gold/12979
228         * options.h (class General_options): Add -Bgroup.
229         * options.cc (General_options::finalize): If -Bgroup is set,
230         default to --unresolved-symbols=report-all.
231         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
232         * target-reloc.h (issue_undefined_symbol_error): Handle
233         --unresolved-symbols=report-all.
234
235 2011-07-08  Ian Lance Taylor  <iant@google.com>
236
237         PR gold/11985
238         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
239         if linker script discards key sections.
240         (Layout::create_dynamic_symtab): Likewise.
241         (Layout::assign_local_dynsym_offsets): Likewise.
242         (Layout::sized_create_version_sections): Likewise.
243         (Layout::create_interp): Likewise.
244         (Layout::finish_dynamic_section): Likewise.
245         (Layout::set_dynamic_symbol_size): Likewise.
246
247 2011-07-08  Ian Lance Taylor  <iant@google.com>
248
249         PR gold/12386
250         * options.h (class General_options): Add --unresolved-symbols.
251         * target-reloc.h (issue_undefined_symbol_error): Check
252         --unresolved-symbols.  Add comments.
253
254 2011-07-08  Ian Lance Taylor  <iant@google.com>
255
256         * testsuite/odr_violation2.cc (Ordering::operator()): Make
257         expression more complex.
258
259 2011-07-08  Ian Lance Taylor  <iant@google.com>
260
261         PR gold/11317
262         * target-reloc.h (issue_undefined_symbol_error): New inline
263         function, broken out of relocate_section.
264         (relocate_section): Call issue_undefined_symbol_error.
265         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
266         there is no TLS segment if we are about to issue an undefined
267         symbol error.
268         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
269
270 2011-07-08  Ian Lance Taylor  <iant@google.com>
271
272         PR gold/12279
273         * resolve.cc (Symbol_table::should_override): Add fromtype
274         parameter.  Change all callers.  Give error when linking together
275         TLS and non-TLS symbol.
276         (Symbol_table::should_override_with_special): Add fromtype
277         parameter.  Change all callers.
278         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
279         there is no TLS segment if we have reported some errors.
280         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
281
282 2011-07-08  Ian Lance Taylor  <iant@google.com>
283
284         PR gold/12372
285         * target.h (Target::plt_address_for_global): New function.
286         (Target::plt_address_for_local): New function.
287         (Target::plt_section_for_global): Remove.
288         (Target::plt_section_for_local): Remove.
289         (Target::do_plt_address_for_global): New virtual function.
290         (Target::do_plt_address_for_local): New virtual function.
291         (Target::do_plt_section_for_global): Remove.
292         (Target::do_plt_section_for_local): Remove.
293         (Target::register_global_plt_entry): Add Symbol_table and Layout
294         parameters.
295         * output.cc (Output_data_got::Got_entry::write): Use
296         plt_address_for_global and plt_address_for_local.
297         * layout.cc (Layout::add_target_dynamic_tags): Use size and
298         address of output section.
299         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
300         got_irelative_, and irelative_count_ fields.  Update
301         declarations.
302         (Output_data_plt_i386::has_irelative_section): New function.
303         (Output_data_plt_i386::entry_count): Add irelative_count_.
304         (Output_data_plt_i386::set_final_data_size): Likewise.
305         (class Target_i386): Add got_irelative_ and rel_irelative_
306         fields.  Update declarations.
307         (Target_i386::Target_i386): Initialize new fields.
308         (Target_i386::do_plt_address_for_global): New function replacing
309         do_plt_section_for_global.
310         (Target_i386::do_plt_address_for_local): New function replacing
311         do_plt_section_for_local.
312         (Target_i386::got_section): Create got_irelative_.
313         (Target_i386::rel_irelative_section): New function.
314         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
315         fields.  Don't define __rel_iplt_{start,end}.
316         (Output_data_plt_i386::add_entry): Add symtab and layout
317         parameters.  Change all callers.  Use different PLT and GOT for
318         IFUNC symbols.
319         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
320         layout parameters.  Change all callers.  Use different PLT and
321         GOT.
322         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
323         (Output_data_plt_i386::rel_irelative): New function.
324         (Output_data_plt_i386::address_for_global): New function.
325         (Output_data_plt_i386::address_for_local): New function.
326         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
327         IRELATIVE GOT when changing IFUNC GOT entries.
328         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
329         reloc.
330         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
331         if we didn't create an IRELATIVE GOT.
332         (Target_i386::Relocate::relocate): Use plt_address_for_global and
333         plt_address_for_local.
334         (Target_i386::do_dynsym_value): Use plt_address_for_global.
335         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
336         got_irelative_, and irelative_count_ fields.  Update
337         declarations.
338         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
339         Initialize new fields.  Remove symtab parameter.  Change all
340         callers.
341         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
342         irelative_count_.
343         (Output_data_plt_x86_64::has_irelative_section): New function.
344         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
345         (class Target_x86_64): Add got_irelative_ and rel_irelative_
346         fields.  Update declarations.
347         (Target_x86_64::Target_x86_64): Initialize new fields.
348         (Target_x86_64::do_plt_address_for_global): New function replacing
349         do_plt_section_for_global.
350         (Target_x86_64::do_plt_address_for_local): New function replacing
351         do_plt_section_for_local.
352         (Target_x86_64::got_section): Create got_irelative_.
353         (Target_x86_64::rela_irelative_section): New function.
354         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
355         all callers.  Don't create __rel_iplt_{start,end}.
356         (Output_data_plt_x86_64::add_entry): Add symtab and layout
357         parameters.  Change all callers.  Use different PLT and GOT for
358         IFUNC symbols.
359         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
360         layout parameters.  Change all callers.  Use different PLT and
361         GOT.
362         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
363         parameters.  Change all callers.  Use different PLT and GOT for
364         IFUNC symbols.
365         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
366         (Output_data_plt_x86_64::rela_irelative): New function.
367         (Output_data_plt_x86_64::address_for_global): New function.
368         (Output_data_plt_x86_64::address_for_local): New function.
369         (Output_data_plt_x86_64::set_final_data_size): Likewise.
370         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
371         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
372         (Target_x86_64::register_global_plt_entry): Add symtab and layout
373         parameters.
374         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
375         reloc.
376         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
377         symbols if we didn't create an IRELATIVE GOT.
378         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
379         plt_address_for_local.
380         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
381         * testsuite/ifuncvar1.c: New test file.
382         * testsuite/ifuncvar2.c: New test file.
383         * testsuite/ifuncvar3.c: New test file.
384         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
385         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
386         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
387         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
388         * testsuite/Makefile.in: Rebuild.
389
390 2011-07-07  Cary Coutant  <ccoutant@google.com>
391
392         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
393         (two_file_test_1_ndebug.o): Likewise.
394         (two_file_test_1b_ndebug.o): Likewise.
395         (two_file_test_2_ndebug.o): Likewise.
396         (two_file_test_main_ndebug.o): Likewise.
397         (incremental_test_2): Link with no-debug versions.
398
399 2011-07-06  Cary Coutant  <ccoutant@google.com>
400
401         * gold/incremental.cc
402         (Output_section_incremental_inputs::write_info_blocks): Check for
403         hidden and internal symbols.
404
405 2011-07-06  Cary Coutant  <ccoutant@google.com>
406
407         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
408         Check disposition for startup file.
409         (Incremental_inputs::report_command_line): Ignore
410         --incremental-startup-unchanged option.
411         * options.cc (General_options::parse_incremental_startup_unchanged):
412         New function.
413         (General_options::General_options): Initialize new data member.
414         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
415         (General_options): Add --incremental-startup-unchanged option.
416         (General_options::incremental_startup_disposition): New function.
417         (General_options::incremental_startup_disposition_): New data member.
418
419 2011-07-06  Cary Coutant  <ccoutant@google.com>
420
421         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
422         input file index to Script_info ctor.
423         (Sized_incremental_binary::do_file_has_changed): Find the
424         command-line argument for files named in scripts.
425         * incremental.h (Script_info::Script_info): New ctor
426         with input file index.
427         (Script_info::input_file_index): New function.
428         (Script_info::input_file_index_): New data member.
429         (Incremental_binary::get_library): Add const.
430         (Incremental_binary::get_script_info): Add const.
431         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
432         * testsuite/Makefile.am (incremental_test_5): New test case.
433         (incremental_test_6): New test case.
434         * testsuite/Makefile.in: Regenerate.
435
436 2011-07-06  Cary Coutant  <ccoutant@google.com>
437
438         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
439         debug output when command lines differ.
440
441 2011-07-06  Cary Coutant  <ccoutant@google.com>
442
443         * incremental.cc (Incremental_inputs::report_command_line): Ignore
444         --incremental-patch option.
445         * layout.cc (Free_list::allocate): Extend allocation beyond original
446         end if enabled.
447         (Layout::make_output_section): Mark sections that should get
448         patch space.
449         * options.cc (parse_percent): New function.
450         * options.h (parse_percent): New function.
451         (DEFINE_percent): New macro.
452         (General_options): Add --incremental-patch option.
453         * output.cc (Output_section::Output_section): Initialize new data
454         members.
455         (Output_section::add_input_section): Print section name when out
456         of patch space.
457         (Output_section::add_output_section_data): Likewise.
458         (Output_section::set_final_data_size): Add patch space when
459         doing --incremental-full.
460         (Output_section::do_reset_address_and_file_offset): Remove patch
461         space.
462         (Output_segment::set_section_list_addresses): Print debug output
463         only if --incremental-update.
464         * output.h (Output_section::set_is_patch_space_allowed): New function.
465         (Output_section::is_patch_space_allowed_): New data member.
466         (Output_section::patch_space_): New data member.
467         * parameters.cc (Parameters::incremental_full): New function.
468         * parameters.h (Parameters::incremental_full): New function
469         * testsuite/Makefile.am (incremental_test_2): Add test for
470         --incremental-patch option.
471         * testsuite/Makefile.in: Regenerate.
472         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
473         (t18): Remove function body.
474
475 2011-07-05  Doug Kwan  <dougkwan@google.com>
476
477         PR gold/12771
478         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
479         Arm_Address type for relocation result.
480         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
481         overflow check.
482         (Arm_relocate_functions::abs32): Use unaligned access.
483         (Arm_relocate_functions::rel32): Ditto.
484         (Arm_relocate_functions::prel31): Ditto.
485         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
486         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
487         static data relocations.
488         * testsuite/Makefile.in: Regnerate.
489         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
490
491 2011-07-05  Ian Lance Taylor  <iant@google.com>
492
493         PR gold/12392
494         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
495         symbols if necessary.
496         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
497
498 2011-07-05  Ian Lance Taylor  <iant@google.com>
499
500         PR gold/12952
501         * resolve.cc (Symbol::override_base_with_special): Simply override
502         version with special symbol version, ignoring previous version.
503
504 2011-07-05  Ian Lance Taylor  <iant@google.com>
505
506         * object.cc (Sized_relobj_file::include_section_group): Add
507         information to comment about signature location.
508
509 2011-07-02  Ian Lance Taylor  <iant@google.com>
510
511         PR gold/12957
512         * options.h (class General_options): Add -f and -F.
513         * options.cc (General_options::finalize): Fatal error if -f/-F
514         are used without -shared.
515         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
516
517 2011-07-02  Ian Lance Taylor  <iant@google.com>
518
519         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
520
521 2011-07-01  Ian Lance Taylor  <iant@google.com>
522
523         PR gold/12525
524         PR gold/12952
525         * resolve.cc (Symbol::override_base_with_special): Don't override
526         the version if the overriding symbol has a different name.
527         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
528         all callers.  If we give an error about an undefined version,
529         define the base version if necessary.
530         * dynobj.h (class Versions): Update declaration.
531         * testsuite/weak_alias_test_5.cc: New file.
532         * testsuite/weak_alias_test.script: New file.
533         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
534         and versioned_alias have the right value, and call t2.
535         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
536         weak_alias_test_5.so.
537         (weak_alias_test_LDADD): Likewise.
538         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
539         * testsuite/Makefile.in: Rebuild.
540
541 2011-07-01  Ian Lance Taylor  <iant@google.com>
542
543         PR gold/12525
544         * options.h (class General_options): Support -z notext.
545         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
546         -Wl,-z,notext.
547         (two_file_shared_nonpic.so): Likewise.
548         (two_file_shared_mixed.so): Likewise.
549         (two_file_shared_mixed_1.so): Likewise.
550         (weak_undef_lib_nonpic.so): Likewise.
551         (alt/weak_undef_lib_nonpic.so): Likewise.
552         (tls_test_shared_nonpic.so): Likewise.
553         * testsuite/Makefile.in: Rebuild.
554
555 2011-07-01  Ian Lance Taylor  <iant@google.com>
556
557         PR gold/12525
558         * configure.ac: Test whether static linking works, setting
559         the automake conditional HAVE_STATIC.
560         * testsuite/Makefile.am: Disable tests using -static if
561         HAVE_STATIC is not true.
562         * configure, testsuite/Makefile.in: Rebuild.
563
564 2011-07-01  Ian Lance Taylor  <iant@google.com>
565
566         PR gold/12525
567         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
568         Assert if we see DW_EH_PE_indirect.
569         * target.h (Target::ehframe_datarel_base): New function.
570         (Target::do_ehframe_datarel_base): New target function.
571         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
572         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
573         function.
574
575 2011-07-01  Ian Lance Taylor  <iant@google.com>
576
577         PR gold/12571
578         * options.h (class General_options): Add
579         --ld-generated-unwind-info.
580         * ehframe.cc (Fde::write): Add address parameter.  Change all
581         callers.  If associated with PLT, fill in address and size.
582         (Cie::set_output_offset): Only add merge mapping if there is an
583         object.
584         (Cie::write): Add address parameter.  Change all callers.
585         (Eh_frame::add_ehframe_for_plt): New function.
586         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
587         input_offset_ fields into union u_, with new plt field.
588         (Fde::Fde): Adjust for new union field.
589         (Fde::Fde) [Output_data version]: New constructor.
590         (Fde::add_mapping): Only add merge mapping if there is an object.
591         (class Cie): Update declarations.
592         (class Eh_frame): Declare add_ehframe_for_plt.
593         * layout.cc (Layout::layout_eh_frame): Break out code into
594         make_eh_frame_section, and call it.
595         (Layout::make_eh_frame_section): New function.
596         (Layout::add_eh_frame_for_plt): New function.
597         * layout.h (class Layout): Update declarations.
598         * merge.cc (Merge_map::add_mapping): Add assertion.
599         * i386.cc: Include "dwarf.h".
600         (class Output_data_plt_i386): Make first_plt_entry,
601         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
602         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
603         and plt_eh_frame_fde.
604         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
605         boundary.  Call add_eh_frame_for_plt if appropriate.
606         * x86_64.cc: Include "dwarf.h".
607         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
608         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
609         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
610         and plt_eh_frame_fde.
611         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
612         appropriate.
613
614 2011-06-29  Ian Lance Taylor  <iant@google.com>
615
616         PR gold/12629
617         * object.cc (Sized_relobj_file::layout_section): Change shdr
618         parameter to be const.
619         (Sized_relobj_file::layout_eh_frame_section): New function, broken
620         out of do_layout.
621         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
622         appropriate.  Call layout_eh_frame_section.
623         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
624         sections.
625         * object.h (class Sized_relobj_file): Update declarations.
626
627 2011-06-29  Ian Lance Taylor  <iant@google.com>
628
629         PR gold/12652
630         * script.cc (Token::integer_value): Accept trailing M/m/K/k
631         modifier.
632         (Lex::gather_token): Accept trailing M/m/K/k for integers.
633
634 2011-06-29  Ian Lance Taylor  <iant@google.com>
635
636         PR gold/12675
637         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
638         SHT_X86_64_UNWIND.
639         * layout.cc (Layout::layout_eh_frame): Likewise.
640
641 2011-06-29  Ian Lance Taylor  <iant@google.com>
642
643         PR gold/12695
644         * layout.cc (Layout::symtab_section_shndx): New function.
645         * layout.h (class Layout): Declare symtab_section_shndx.
646         * output.cc (Output_section::write_header): Call it.
647
648 2011-06-29  Ian Lance Taylor  <iant@google.com>
649
650         PR gold/12818
651         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
652         symbols which are not used in a relocation.
653
654 2011-06-28  Ian Lance Taylor  <iant@google.com>
655
656         PR gold/12898
657         * layout.cc (Layout::segment_precedes): Don't crash if a linker
658         script create indistinguishable segments.
659         (Layout::set_segment_offsets): Use stable_sort when sorting
660         segments.  Pass this to Compare_segments constructor.
661         * layout.h (class Layout): Make segment_precedes non-static.
662         (class Compare_segments): Change from struct to class.  Add
663         layout_ field.  Add constructor.
664         * script-sections.cc
665         (Script_sections::attach_sections_using_phdrs_clause): Rename
666         local orphan to is_orphan.  Don't report failure to put empty
667         section in segment.  On attachment failure, report name of
668         section, and attach to first PT_LOAD segment.
669
670 2011-06-28  Ian Lance Taylor  <iant@google.com>
671
672         PR gold/12934
673         * target-select.cc (Target_selector::Target_selector): Add
674         emulation parameter.  Change all callers.
675         (select_target_by_bfd_name): Rename from select_target_by_name.
676         Change all callers.
677         (select_target_by_emulation): New function.
678         (supported_emulation_names): New function.
679         * target-select.h (class Target_selector): Add emulation_ field.
680         Update declarations.
681         (Target_selector::recognize_by_bfd_name): Rename from
682         recognize_by_name.  Change all callers.
683         (Target_selector::supported_bfd_names): Rename from
684         supported_names.  Change all callers.
685         (Target_selector::recognize_by_emulation): New function.
686         (Target_selector::supported_emulations): New function.
687         (Target_selector::emulation): New function.
688         (Target_selector::do_recognize_by_bfd_name): Rename from
689         do_recognize_by_name.  Change all callers.
690         (Target_selector::do_supported_bfd_names): Rename from
691         do_supported_names.  Change all callers.
692         (Target_selector::do_recognize_by_emulation): New function.
693         (Target_selector::do_supported_emulations): New function.
694         (select_target_by_bfd_name): Change name in declaration.
695         (select_target_by_emulation): Declare.
696         (supported_emulation_names): Declare.
697         * parameters.cc (parameters_force_valid_target): Try to find
698         target based on emulation from -m option.
699         * options.h (class General_options): Change doc string for -m.
700         * options.cc (help): Print emulations.
701         (General_options::parse_V): Likewise.
702         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
703         Add emulation parameter.  Change all callers.
704
705 2011-06-28  Ian Lance Taylor  <iant@google.com>
706
707         * target.h (class Target): Add osabi_ field.
708         (Target::osabi): New function.
709         (Target::set_osabi): New function.
710         (Target::Target): Initialize osabi_.
711         (Target::do_adjust_elf_header): Make pure virtual.
712         (Sized_target::do_adjust_elf_header): Declare.
713         * target.cc (Sized_target::do_adjust_elf_header): New function.
714         (class Sized_target): Instantiate all versions.
715         * freebsd.h (class Target_freebsd): Remove.
716         (Target_selector_freebsd::do_recognize): Call set_osabi on
717         Target.
718         (Target_selector_freebsd::do_recognize_by_name): Likewise.
719         (Target_selector_freebsd::set_osabi): Remove.
720         * i386.cc (class Target_i386): Inherit from Sized_target rather
721         than Target_freebsd.
722         * x86_64.cc (class Target_x86_64): Likewise.
723
724 2011-06-28  Ian Lance Taylor  <iant@google.com>
725
726         * target.h (Target::can_check_for_function_pointers): Rewrite.
727         Make non-virtual.
728         (Target::can_icf_inline_merge_sections): Likewise.
729         (Target::section_may_have_icf_unsafe_poineters): Likewise.
730         (Target::Target_info): Add can_icf_inline_merge_sections field.
731         (Target::do_can_check_for_function_pointers): New virtual
732         function.
733         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
734         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
735         from can_check_for_function_pointers, move in file.
736         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
737         section_may_have_icf_unsafe_poineters, move in file.
738         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
739         * i386.cc (Target_i386::do_can_check_for_function_pointers):
740         Rename from can_check_for_function_pointers, move in file.
741         (Target_i386::can_icf_inline_merge_sections): Remove.
742         (Target_i386::i386_info): Initialize
743         can_icf_inline_merge_sections.
744         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
745         Initialize can_icf_inline_merge_sections.
746         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
747         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
748         Rename from can_check_for_function_pointers, move in file.
749         (Target_x86_64::can_icf_inline_merge_sections): Remove.
750         (Target_x86_64::x86_64_info): Initialize
751         can_icf_inline_merge_sections.
752         * testsuite/testfile.cc (Target_test::test_target_info):
753         Likewise.
754         * icf.cc (get_section_contents): Correct formatting.
755
756 2011-06-27  Ian Lance Taylor  <iant@google.com>
757
758         * symtab.cc (Symbol::versioned_name): New function.
759         (Symbol_table::add_to_final_symtab): Use versioned_name when
760         appropriate.
761         (Symbol_table::sized_write_symbol): Likewise.
762         * symtab.h (class Symbol): Declare versioned_name.
763         * stringpool.h (class Stringpool_template): Add variant of add
764         which takes a std::basic_string.
765         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
766         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
767         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
768         (ver_test_12.o): New target.
769         * testsuite/Makefile.in: Rebuild.
770
771 2011-06-27  Doug Kwan  <dougkwan@google.com>
772
773         * arm.cc (Arm_relocate_functions::thm_jump8,
774         Arm_relocate_functions::thm_jump11): Use a wider signed
775         type to compute offset.
776         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
777         arm_thm_jump8.
778         * testsuite/Makefile.in: Regenerate.
779         * testsuite/arm_branch_in_range.sh: Check test results of
780         arm_thm_jump11 and arm_thm_jump8.
781         * testsuite/arm_thm_jump11.s: New test source file.
782         * testsuite/arm_thm_jump11.t: New linker script.
783         * testsuite/arm_thm_jump8.s: New test source file.
784         * testsuite/arm_thm_jump8.t: New linker script.
785
786 2011-06-24  Ian Lance Taylor  <iant@google.com>
787
788         * layout.cc: Include "object.h".
789         (ctors_sections_in_init_array): New static variable.
790         (Layout::is_ctors_in_init_array): New function.
791         (Layout::layout): Add entry to ctors_sections_in_init_array if
792         appropriate.
793         * layout.h (class Layout): Declare is_ctors_in_init_array.
794         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
795         is_ctors_reverse_view is set.
796         (Sized_relobj_file::write_sections): Add layout parameter.  Change
797         all callers.  Set is_ctors_reverse_view field of View_size.
798         (Sized_relobj_file::reverse_words): New function.
799         * object.h (Sized_relobj_file::View_size): Add
800         is_ctors_reverse_view field.
801         (class Sized_relobj_file): Update declarations.
802         * testsuite/initpri3.c: New test.
803         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
804         initpri3b.
805         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
806         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
807         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
808         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
809         * testsuite/Makefile.in: Rebuild.
810
811 2011-06-24  Cary Coutant  <ccoutant@google.com>
812
813         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
814         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
815         (debug_msg_cdebug.err): New targets.
816         * testsuite/Makefile.in: Regenerate.
817         * testsuite/debug_msg.sh: Check output of link with compressed debug.
818         Fix checks for link with shared library.
819
820 2011-06-24  Doug Kwan  <dougkwan@google.com>
821
822         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
823         skip empty text sections.
824         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
825
826 2011-06-22  Ian Lance Taylor  <iant@google.com>
827
828         PR gold/12910
829         * options.h (class General_options): Add --ctors-in-init-array.
830         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
831         friends as SHT_PROGBITS for merging sections.
832         (Layout::layout): Remove special handling of .init_array and
833         friends.  Don't sort if doing relocatable link.  Sort for .ctors
834         and .dtors if ctors_in_init_array.
835         (Layout::make_output_section): Force correct section types for
836         .init_array and friends.  Don't sort if doing relocatable link,
837         Don't sort .ctors and .dtors if ctors_in_init_array.
838         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
839         (Layout::output_section_name): Add relobj parameter.  Change all
840         callers.  Handle .ctors. and .dtors. in code rather than table.
841         Handle .ctors and .dtors if ctors_in_init_array.
842         (Layout::match_file_name): New function, moved from output.cc.
843         * layout.h (class Layout): Update declarations.
844         * output.cc: Include "layout.h".
845         (Input_section_sort_entry::get_priority): New function.
846         (Input_section_sort_entry::match_file_name): Just call
847         Layout::match_file_name.
848         (Output_section::Input_section_sort_init_fini_compare::operator()):
849         Handle .ctors and .dtors.  Sort by explicit priority rather than
850         by name.
851         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
852         * testsuite/initpri2.c: New test.
853         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
854         (check_PROGRAMS): Add initpri2.
855         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
856         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
857         * configure, testsuite/Makefile.in: Rebuild.
858
859 2011-06-19  Ian Lance Taylor  <iant@google.com>
860
861         PR gold/12880
862         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
863         .interp section to a PT_INTERP segment even if we have seen a
864         --dynamic-linker option.  Don't do it if we have seen a PHDRS
865         clause in a linker script.
866         (Layout::finalize): Don't create a .interp section if we've
867         already create a PT_INTERP segment.
868         (Layout::create_interp): Always call choose_output_section (revert
869         patch of 2011-06-17).  Don't create PT_INTERP segment.
870         * script-sections.cc
871         (Script_sections::create_note_and_tls_segments): Add a .interp
872         section to a PT_INTERP segment even if we have seen a
873         --dynamic-linker option.
874
875 2011-06-18  Ian Lance Taylor  <iant@google.com>
876
877         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
878         merely because a non-PT_LOAD segment has a dynamic reloc.
879
880 2011-06-18  Ian Lance Taylor  <iant@google.com>
881
882         * layout.cc (Layout::finish_dynamic_section): Don't create
883         DT_FLAGS entry if not needed.
884
885 2011-06-18  Ian Lance Taylor  <iant@google.com>
886
887         PR gold/12745
888         * layout.cc (Layout::layout_eh_frame): Correct handling of
889         writable .eh_frame section.
890
891 2011-06-17  Ian Lance Taylor  <iant@google.com>
892
893         PR gold/12893
894         * resolve.cc (Symbol_table::resolve): Don't give an error if a
895         symbol is redefined with the exact same object and value.
896
897 2011-06-17  Ian Lance Taylor  <iant@google.com>
898
899         PR gold/12880
900         * layout.h (class Layout): Add interp_segment_ field.
901         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
902         (Layout::attach_allocated_section_to_segment): If making shared
903         library, put .interp section in PT_INTERP segment.
904         (Layout::finalize): Also call create_interp if -dynamic-linker
905         option was used.
906         (Layout::create_interp): Assert that there is no PT_INTERP
907         segment.  If not using a SECTIONS clause, use make_output_section.
908         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
909         * script-sections.cc
910         (Script_sections::create_note_and_tls_segments): If making shared
911         library, put .interp section in PT_INTERP segment.
912
913 2011-06-17  Ian Lance Taylor  <iant@google.com>
914
915         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
916         when making a shared library.
917
918 2011-06-17  Ian Lance Taylor  <iant@google.com>
919
920         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
921         parameter.  Change all callers.  Don't issue warning about PC32
922         against locally defined symbol.
923
924 2011-06-16  Ian Lance Taylor  <iant@google.com>
925
926         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
927         occurs in same object.
928
929 2011-06-14  Alan Modra  <amodra@gmail.com>
930
931         * po/POTFILES.in: Regenerate.
932
933 2011-06-09  Ian Lance Taylor  <iant@google.com>
934
935         * script-sections.cc
936         (Orphan_output_section::set_section_addresses): For a relocatable
937         link set address to 0.
938
939 2011-06-09  Cary Coutant  <ccoutant@google.com>
940
941         PR gold/12804
942         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
943         used with --compress-debug-sections.
944         * gold/object.cc (Sized_relobj_file::do_layout): Report
945         uncompressed size of compressed input sections.
946
947 2011-06-08  Cary Coutant  <ccoutant@google.com>
948
949         PR gold/12804
950         * testsuite/two_file_test_2_v1.cc: Change initialization of
951         v2 to keep it in .data.
952
953 2011-06-07  Cary Coutant  <ccoutant@google.com>
954
955         * common.cc (Symbol_table::do_allocate_commons_list): Call
956         gold_fallback.
957         * errors.cc (Errors::fatal): Adjust call to gold_exit.
958         (Errors::fallback): New function.
959         (gold_fallback): New function.
960         * errors.h (Errors::fallback): New function.
961         * gold.cc (gold_exit): Change status parameter to enum; adjust
962         all callers.
963         (queue_initial_tasks): Call gold_fallback.
964         * gold.h: Include cstdlib.
965         (Exit_status): New enum type.
966         (gold_exit): Change status parameter to enum.
967         (gold_fallback): New function.
968         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
969         (Layout::create_symtab_sections): Likewise.
970         (Layout::create_shdrs): Likewise.
971         * main.cc (main): Adjust call to gold_exit.
972         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
973         (Output_data_got::add_got_entry_pair): Likewise.
974         (Output_section::add_input_section): Likewise.
975         (Output_section::add_output_section_data): Likewise.
976         (Output_segment::set_section_list_addresses): Likewise.
977         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
978
979 2011-06-07  Cary Coutant  <ccoutant@google.com>
980
981         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
982         for incremental links.
983         * output.cc (Output_segment::set_section_list_addresses): Remove
984         FIXME and test for TLS or BSS.
985
986 2011-06-07  Cary Coutant  <ccoutant@google.com>
987
988         * testsuite/Makefile.am: Add incremental_copy_test,
989         incremental_common_test_1.
990         * testsuite/Makefile.in: Regenerate.
991         * testsuite/common_test_1_v1.c: New source file.
992         * testsuite/common_test_1_v2.c: New source file.
993         * testsuite/copy_test_v1.cc: New source file.
994
995 2011-06-07  Cary Coutant  <ccoutant@google.com>
996
997         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
998         update, allocate common from bss section's free list.
999         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1000         linker-defined symbols.
1001         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1002         Skip GOT and PLT entries that are no longer referenced.
1003         (Output_section_incremental_inputs::write_info_blocks): Mark
1004         linker-defined symbols.
1005         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1006         * output.cc (Output_section::allocate): New function.
1007         * output.h (Output_section::allocate): New function.
1008         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1009         linker-defined symbols.
1010         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1011         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1012         (Symbol::init_base_output_data): Likewise.
1013         (Symbol::init_base_output_segment): Likewise.
1014         (Symbol::init_base_constant): Likewise.
1015         (Sized_symbol::init_output_data): Likewise.
1016         (Sized_symbol::init_output_segment): Likewise.
1017         (Sized_symbol::init_constant): Likewise.
1018         (Symbol_table::do_define_in_output_data): Likewise.
1019         (Symbol_table::do_define_in_output_segment): Likewise.
1020         (Symbol_table::do_define_as_constant): Likewise.
1021         * symtab.h (Symbol::is_predefined): New function.
1022         (Symbol::init_base_output_data): Add is_predefined parameter.
1023         (Symbol::init_base_output_segment): Likewise.
1024         (Symbol::init_base_constant): Likewise.
1025         (Symbol::is_predefined_): New data member.
1026         (Sized_symbol::init_output_data): Add is_predefined parameter.
1027         (Sized_symbol::init_output_segment): Likewise.
1028         (Sized_symbol::init_constant): Likewise.
1029         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1030
1031 2011-06-07  Cary Coutant  <ccoutant@google.com>
1032
1033         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1034         instead of emit_copy_reloc.
1035         (Copy_relocs::emit_copy_reloc): Refactor.
1036         (Copy_relocs::make_copy_reloc): New function.
1037         (Copy_relocs::add_copy_reloc): Remove.
1038         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1039         section.
1040         (Copy_relocs::make_copy_reloc): New function.
1041         (Copy_relocs::add_copy_reloc): Remove.
1042         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1043         unchanged input files.
1044         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1045         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1046         Reserve BSS space for COPY relocations.
1047         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1048         (Output_section_incremental_inputs::write_info_blocks): Record
1049         whether a symbol is copied from a shared object.
1050         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1051         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1052         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1053         (Incremental_input_entry_reader::get_output_symbol_index): Add
1054         is_copy parameter.
1055         (Incremental_binary::emit_copy_relocs): New function.
1056         (Incremental_binary::do_emit_copy_relocs): New function.
1057         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1058         new data member.
1059         (Sized_incremental_binary::add_copy_reloc): New function.
1060         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1061         (Sized_incremental_binary::Copy_reloc): New struct.
1062         (Sized_incremental_binary::Copy_relocs): New typedef.
1063         (Sized_incremental_binary::copy_relocs_): New data member.
1064         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1065         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1066         * target.h (Sized_target::emit_copy_reloc): New function.
1067         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1068
1069 2011-06-02  Cary Coutant  <ccoutant@google.com>
1070
1071         PR gold/12163
1072         * gold/archive.cc (Archive::Archive): Initialize new data member.
1073         (Archive::include_all_members): Return if archive has already been
1074         included.
1075         * gold/archive.h (Archive::include_all_members_): New data member.
1076
1077 2011-06-02  Nick Clifton  <nickc@redhat.com>
1078
1079         * dynobj.h: Fix spelling mistake in comment.
1080         * output.cc: Likewise.
1081
1082 2011-05-31  Doug Kwan  <dougkwan@google.com>
1083             Asier Llano
1084
1085         PR gold/12826
1086         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1087         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1088         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1089         redundant arm_exidx_test.so.
1090         * testsuite/Makefile.in: Regenerate.
1091         (check_SCRIPTS): Add pr12826.sh
1092         (check_DATA): Add pr12826.stdout
1093         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1094         * testsuite/pr12826.sh: New file.
1095         * testsuite/pr12826_1.s: Ditto.
1096         * testsuite/pr12826_1.s: Ditto.
1097
1098 2011-05-30  Ian Lance Taylor  <iant@google.com>
1099
1100         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1101         sections.
1102
1103 2011-05-29  Ian Lance Taylor  <iant@google.com>
1104
1105         PR gold/12804
1106         * testsuite/Makefile.am: Use different file name for two_file_test
1107         temporary file for each incremental test.
1108         * testsuite/Makefile.in: Rebuild.
1109
1110 2011-05-29  Ian Lance Taylor  <iant@google.com>
1111
1112         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1113         binary input file is empty.
1114
1115 2011-05-27  Ian Lance Taylor  <iant@google.com>
1116
1117         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1118         (ver_test_9.so): Likewise.
1119         * testsuite/Makefile.in: Rebuild.
1120
1121 2011-05-26 Cary Coutant  <ccoutant@google.com>
1122
1123         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1124         * incremental.cc (Incremental_inputs::report_input_section): Fix
1125         comment, indentation.
1126         (Incremental_inputs::report_comdat_group): New function.
1127         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1128         of data for incremental input file entry.
1129         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1130         group count, COMDAT group signatures.
1131         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1132         an unchanged input file.
1133         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1134         Initialize new data member.
1135         (Incremental_object_entry::add_comdat_group): New function.
1136         (Incremental_object_entry::get_comdat_group_count): New function.
1137         (Incremental_object_entry::get_comdat_signature_key): New function.
1138         (Incremental_object_entry::groups_): New data member.
1139         (Incremental_inputs::report_comdat_group): New function.
1140         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1141         data for incremental input file entry.
1142         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1143         (Incremental_input_entry_reader::get_input_section): Adjust size of
1144         data for incremental input file entry.
1145         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1146         (Incremental_input_entry_reader::get_comdat_group_signature): New
1147         function.
1148         * object.cc (Sized_relobj::include_section_group): Report kept
1149         COMDAT groups for incremental links.
1150
1151 2011-05-24  David Meyer  <pdox@google.com>
1152
1153         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1154         with name parameter.  Add found_name parameter.
1155         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1156         * dirsearch.h (class Dirsearch): Update declaration.
1157
1158 2011-05-24  Ian Lance Taylor  <iant@google.com>
1159
1160         * archive.cc (Library_base::should_include_member): Pull in object
1161         from archive if it defines the entry symbol.
1162         * parameters.cc (Parameters::entry): New function.
1163         * parameters.h (class Parameters): Declare entry.
1164         * output.h (class Output_file_header): Remove entry_ field.
1165         * output.cc (Output_file_header::Output_file_header): Remove entry
1166         parameter.  Change all callers.
1167         (Output_file_header::entry): Use parameters->entry.
1168         * gold.cc (queue_middle_tasks): Likewise.
1169         * plugin.cc (Plugin_hook::run): Likewise.
1170
1171 2011-05-24 Cary Coutant  <ccoutant@google.com>
1172
1173         * gold.cc (queue_initial_tasks): Pass incremental base filename
1174         to Output_file::open_base_file; don't print error message.
1175         * incremental-dump.cc (main): Adjust call to
1176         Output_file::open_for_modification.
1177         * incremental-dump.cc (main): Likewise.
1178         * incremental.cc (Incremental_inputs::report_command_line):
1179         Ignore --incremental-base option when comparing command lines.
1180         Ignore parameter when given as separate argument.
1181         * options.h (class General_options): Add --incremental-base.
1182         * output.cc (Output_file::Output_file):
1183         (Output_file::open_base_file): Add base_name and writable parameters;
1184         read base file into new file; print error message here.
1185         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1186         callers.
1187         * output.h (Output_file::open_for_modification): Rename to...
1188         (Output_file::open_base_file): ...this; add base_name and
1189         writable parameters; adjust all callers.
1190         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1191         callers.
1192         * testsuite/Makefile.am (incremental_test_4): Test
1193         --incremental-base.
1194         * testsuite/Makefile.in: Regenerate.
1195
1196 2011-05-24 Cary Coutant  <ccoutant@google.com>
1197
1198         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1199         incremental_test_4.
1200         * testsuite/Makefile.in: Regenerate.
1201         * testsuite/two_file_test_1_v1.cc: New test source file.
1202         * testsuite/two_file_test_1b_v1.cc: New test source file.
1203         * testsuite/two_file_test_2_v1.cc: New test source file.
1204
1205 2011-05-24 Cary Coutant  <ccoutant@google.com>
1206
1207         * dynobj.h (Dynobj::do_dynobj): New function.
1208         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1209         flag and soname for shared objects.
1210         * incremental.cc (Incremental_inputs::report_object): Make
1211         either Incremental_object_entry or Incremental_dynobj_entry; add
1212         soname to string table.
1213         (Incremental_inputs::report_input_section): Add assertion.
1214         (Output_section_incremental_inputs::set_final_data_size): Adjust
1215         type of input file entry for shared libraries; adjust size of
1216         shared library info entry.
1217         (Output_section_incremental_inputs::write_input_files): Write
1218         as_needed flag for shared libraries.
1219         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1220         of input file entry for shared libraries; write soname.
1221         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1222         soname from incremental info.
1223         * incremental.h (enum Incremental_input_flags): Add
1224         INCREMENTAL_INPUT_AS_NEEDED.
1225         (Incremental_input_entry::Incremental_input_entry): Initialize new
1226         data member.
1227         (Incremental_input_entry::set_as_needed): New function.
1228         (Incremental_input_entry::as_needed): New function.
1229         (Incremental_input_entry::do_dynobj_entry): New function.
1230         (Incremental_input_entry::as_needed_): New data member.
1231         (Incremental_object_entry::Incremental_object_entry): Don't check
1232         for shared library.
1233         (Incremental_object_entry::do_type): Likewise.
1234         (class Incremental_dynobj_entry): New class.
1235         (Incremental_input_entry_reader::as_needed): New function.
1236         (Incremental_input_entry_reader::get_soname): New function.
1237         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1238         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1239         size of shared library info entry.
1240         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1241         incremental link when adding DT_NEEDED entries.
1242         * object.h (Object::Object): Initialize new data member.
1243         (Object::dynobj): New function.
1244         (Object::set_as_needed): New function.
1245         (Object::as_needed): New function.
1246         (Object::do_dynobj): New function.
1247         (Object::as_needed_): New data member.
1248
1249 2011-05-24 Cary Coutant  <ccoutant@google.com>
1250
1251         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1252         info; adjust display of GOT entries.
1253         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1254         vector of input objects; remove file_status_.
1255         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1256         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1257         got_plt reader; call target hooks to reserve GOT entries.
1258         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1259         of input file info header and GOT info entry.
1260         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1261         relocation info.
1262         (Got_plt_view_info::got_descriptor): Remove.
1263         (Got_plt_view_info::sym_index): New data member.
1264         (Got_plt_view_info::input_index): New data member.
1265         (Local_got_offset_visitor::visit): Write input file index.
1266         (Global_got_offset_visitor::visit): Write 0 for input file index.
1267         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1268         with sym_index and input_index.
1269         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1270         incremental info GOT entry; replace got_descriptor with input_index.
1271         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1272         map from input file index to object.
1273         (Sized_relobj_incr::do_layout): Replace direct data member reference
1274         with accessor function.
1275         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1276         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1277         Adjust size of input file info header.
1278         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1279         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1280         (Incremental_input_entry_reader::get_input_section): Adjust size of
1281         input file info header.
1282         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1283         of incremental info GOT entry.
1284         (Incremental_got_plt_reader::get_got_desc): Remove.
1285         (Incremental_got_plt_reader::get_got_symndx): New function.
1286         (Incremental_got_plt_reader::get_got_input_index): New function.
1287         (Sized_incremental_binary::Sized_incremental_binary): Remove
1288         file_status_; add input_objects_.
1289         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1290         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1291         (Sized_incremental_binary::file_is_unchanged): Remove.
1292         (Sized_incremental_binary::set_input_object): New function.
1293         (Sized_incremental_binary::input_object): New function.
1294         (Sized_incremental_binary::file_status_): Remove.
1295         (Sized_incremental_binary::input_objects_): New data member.
1296         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1297         references.
1298         (Sized_relobj_incr::invalid_address): Move to base class.
1299         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1300         class.
1301         (Sized_relobj_incr::do_output_section_offset): Likewise.
1302         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1303         (Sized_relobj_incr::section_offsets_): Likewise.
1304         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1305         function.
1306         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1307         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1308         with accessor function.
1309         (Sized_relobj_file::do_layout): Likewise.
1310         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1311         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1312         (Sized_relobj_file::compute_final_local_value): Replace refs to
1313         section_offsets_ with accessor function.
1314         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1315         * object.h (Relobj::Relobj): Initialize new data members.
1316         (Relobj::add_dyn_reloc): New function.
1317         (Relobj::first_dyn_reloc): New function.
1318         (Relobj::dyn_reloc_count): New function.
1319         (Relobj::first_dyn_reloc_): New data member.
1320         (Relobj::dyn_reloc_count_): New data member.
1321         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1322         references.
1323         (Sized_relobj::Address): New typedef.
1324         (Sized_relobj::invalid_address): Move here from child class.
1325         (Sized_relobj::Sized_relobj): Initialize new data members.
1326         (Sized_relobj::sized_relobj): New function.
1327         (Sized_relobj::is_output_section_offset_invalid): Move here from
1328         child class.
1329         (Sized_relobj::get_output_section_offset): Likewise.
1330         (Sized_relobj::local_has_got_offset): Likewise.
1331         (Sized_relobj::local_got_offset): Likewise.
1332         (Sized_relobj::set_local_got_offset): Likewise.
1333         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1334         (Sized_relobj::clear_got_offsets): New function.
1335         (Sized_relobj::section_offsets): Move here from child class.
1336         (Sized_relobj::do_output_section_offset): Likewise.
1337         (Sized_relobj::do_set_section_offset): Likewise.
1338         (Sized_relobj::Local_got_offsets): Likewise.
1339         (Sized_relobj::local_got_offsets_): Likewise.
1340         (Sized_relobj::section_offsets_): Likewise.
1341         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1342         references.
1343         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1344         class.
1345         (Sized_relobj_file::sized_relobj): New function
1346         (Sized_relobj_file::local_has_got_offset): Move to base class.
1347         (Sized_relobj_file::local_got_offset): Likewise.
1348         (Sized_relobj_file::set_local_got_offset): Likewise.
1349         (Sized_relobj_file::get_output_section_offset): Likewise.
1350         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1351         (Sized_relobj_file::do_output_section_offset): Likewise.
1352         (Sized_relobj_file::do_set_section_offset): Likewise.
1353         (Sized_relobj_file::Local_got_offsets): Likewise.
1354         (Sized_relobj_file::local_got_offsets_): Likewise.
1355         (Sized_relobj_file::section_offsets_): Likewise.
1356         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1357         (all constructors).
1358         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1359         (Output_reloc::get_symbol_index): Likewise.
1360         (Output_reloc::local_section_offset): Likewise.
1361         (Output_reloc::get_address): Likewise.
1362         (Output_reloc::symbol_value): Likewise.
1363         (Output_data_got::reserve_slot): Move to class definition.
1364         (Output_data_got::reserve_local): New function.
1365         (Output_data_got::reserve_slot_for_global): Remove.
1366         (Output_data_got::reserve_global): New function.
1367         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1368         (all constructors, two instantiations).
1369         (Output_reloc::get_relobj): New function (two instantiations).
1370         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1371         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1372         (Output_data_reloc::add_global): Adjust type of relobj.
1373         (Output_data_reloc::add_global_relative): Likewise.
1374         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1375         (Output_data_reloc::add_local): Likewise.
1376         (Output_data_reloc::add_local_relative): Likewise.
1377         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1378         (Output_data_reloc::add_local_section): Likewise.
1379         (Output_data_reloc::add_output_section): Likewise.
1380         (Output_data_reloc::add_absolute): Likewise.
1381         (Output_data_reloc::add_target_specific): Likewise.
1382         (Output_data_got::reserve_slot): Move definition here.
1383         (Output_data_got::reserve_local): New function.
1384         (Output_data_got::reserve_global): New function.
1385         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1386         section_offsets_ with accessor function.
1387         (Sized_relobj_file::write_sections): Likewise.
1388         (Sized_relobj_file::do_relocate_sections): Likewise.
1389         * target.h (Sized_target::reserve_local_got_entry): New function.
1390         (Sized_target::reserve_global_got_entry): New function.
1391         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1392         (Target_x86_64::reserve_global_got_entry): New function.
1393         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1394
1395 2011-05-23 Cary Coutant  <ccoutant@google.com>
1396
1397         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1398         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1399         bit when checking got_type.
1400         * incremental.cc (Sized_incremental_binary::setup_readers):
1401         Store symbol table and string table locations; initialize bit vector
1402         of file status flags.
1403         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1404         unchanged files.
1405         (Sized_incremental_binary::do_process_got_plt): New function.
1406         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1407         (Output_section_incremental_inputs::set_final_data_size): Record
1408         file index for each input file.
1409         (Output_section_incremental_inputs::write_got_plt): Store file index
1410         instead of input entry offset for each GOT entry.
1411         * incremental.h
1412         (Incremental_input_entry::Incremental_input_entry): Initialize new
1413         data member.
1414         (Incremental_input_entry::set_offset): Store file index.
1415         (Incremental_input_entry::get_file_index): New function.
1416         (Incremental_input_entry::file_index_): New data member.
1417         (Incremental_binary::process_got_plt): New function.
1418         (Incremental_binary::do_process_got_plt): New function.
1419         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1420         data members.
1421         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1422         (Sized_incremental_binary::set_file_is_unchanged): New function.
1423         (Sized_incremental_binary::file_is_unchanged): New function.
1424         (Sized_incremental_binary::do_process_got_plt): New function.
1425         (Sized_incremental_binary::file_status_): New data member.
1426         (Sized_incremental_binary::main_symtab_loc_): New data member.
1427         (Sized_incremental_binary::main_strtab_loc_): New data member.
1428         * output.cc (Output_data_got::Got_entry::write): Add case
1429         RESERVED_CODE.
1430         (Output_data_got::add_global): Call add_got_entry.
1431         (Output_data_got::add_global_plt): Likewise.
1432         (Output_data_got::add_global_with_rel): Likewise.
1433         (Output_data_got::add_global_with_rela): Likewise.
1434         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1435         (Output_data_got::add_global_pair_with_rela): Likewise.
1436         (Output_data_got::add_local): Call add_got_entry.
1437         (Output_data_got::add_local_plt): Likewise.
1438         (Output_data_got::add_local_with_rel): Likewise.
1439         (Output_data_got::add_local_with_rela): Likewise.
1440         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1441         (Output_data_got::add_local_pair_with_rela): Likewise.
1442         (Output_data_got::reserve_slot): New function.
1443         (Output_data_got::reserve_slot_for_global): New function.
1444         (Output_data_got::add_got_entry): New function.
1445         (Output_data_got::add_got_entry_pair): New function.
1446         (Output_section::add_output_section_data): Edit FIXME.
1447         * output.h
1448         (Output_section_data_build::Output_section_data_build): New
1449         constructor with size parameter.
1450         (Output_data_space::Output_data_space): Likewise.
1451         (Output_data_got::Output_data_got): Initialize new data member; new
1452         constructor with size parameter.
1453         (Output_data_got::add_constant): Call add_got_entry.
1454         (Output_data_got::reserve_slot): New function.
1455         (Output_data_got::reserve_slot_for_global): New function.
1456         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1457         (Output_data_got::add_got_entry): New function.
1458         (Output_data_got::add_got_entry_pair): New function.
1459         (Output_data_got::free_list_): New data member.
1460         * target.h (Sized_target::init_got_plt_for_update): New function.
1461         (Sized_target::register_global_plt_entry): New function.
1462         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1463         Initialize new data member; call init; add constructor with PLT count.
1464         (Output_data_plt_x86_64::init): New function.
1465         (Output_data_plt_x86_64::add_relocation): New function.
1466         (Output_data_plt_x86_64::reserve_slot): New function.
1467         (Output_data_plt_x86_64::free_list_): New data member.
1468         (Target_x86_64::init_got_plt_for_update): New function.
1469         (Target_x86_64::register_global_plt_entry): New function.
1470         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1471         incremental updates.
1472         (Output_data_plt_x86_64::add_relocation): New function.
1473         * testsuite/object_unittest.cc (Object_test): Set default options.
1474
1475 2011-05-16  Ian Lance Taylor  <iant@google.com>
1476
1477         * options.h (class General_options): Make -i a synonym for -r.
1478
1479 2011-05-16  Ian Lance Taylor  <iant@google.com>
1480
1481         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1482
1483 2011-05-10 Cary Coutant  <ccoutant@google.com>
1484
1485         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1486         strip_all (-s).
1487
1488 2011-05-06  Ian Lance Taylor  <iant@google.com>
1489
1490         * layout.cc (Layout::layout): If the output section flags change,
1491         update the ordering.
1492
1493 2011-04-25 Cary Coutant  <ccoutant@google.com>
1494
1495         * incremental-dump.cc (dump_incremental_inputs): Print local
1496         symbol info for each input file.
1497         * incremental.cc
1498         (Output_section_incremental_inputs::set_final_data_size): Add local
1499         symbol info to input file entries in incremental info.
1500         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1501         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1502         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1503         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1504         implementation.
1505         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1506         (Sized_incr_relobj::do_relocate): Write the local symbols.
1507         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1508         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1509         Adjust size of input file header.
1510         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1511         (Incremental_inputs_reader::get_local_symbol_count): New function.
1512         (Incremental_inputs_reader::get_input_section): Adjust size of input
1513         file header.
1514         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1515         (Sized_incr_relobj::This): New typedef.
1516         (Sized_incr_relobj::sym_size): New const data member.
1517         (Sized_incr_relobj::Local_symbol): New struct.
1518         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1519         (Sized_incr_relobj::do_local_symbol_offset): New function.
1520         (Sized_incr_relobj::local_symbol_count_): New data member.
1521         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1522         (Sized_incr_relobj::local_symbol_index_): New data member.
1523         (Sized_incr_relobj::local_symbol_offset_): New data member.
1524         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1525         (Sized_incr_relobj::local_symbols_): New data member.
1526         * object.h (Relobj::output_local_symbol_count): New function.
1527         (Relobj::local_symbol_offset): New function.
1528         (Relobj::do_output_local_symbol_count): New function.
1529         (Relobj::do_local_symbol_offset): New function.
1530         (Sized_relobj::do_output_local_symbol_count): New function.
1531         (Sized_relobj::do_local_symbol_offset): New function.
1532
1533 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1534
1535         * descriptors.cc (set_close_on_exec): New function.
1536         (Descriptors::open): Use set_close_on_exec.
1537         * output.cc (S_ISLNK): Define if not defined.
1538
1539 2011-04-22 Cary Coutant  <ccoutant@google.com>
1540
1541         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1542         global symbol map.
1543         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1544         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1545         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1546         relocations.
1547         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1548         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1549         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1550         * incremental.h
1551         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1552         function.
1553         (Incremental_binary::apply_incremental_relocs): New function.
1554         (Incremental_binary::do_apply_incremental_relocs): New function.
1555         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1556         data member.
1557         (Sized_incremental_binary::add_global_symbol): New function.
1558         (Sized_incremental_binary::global_symbol): New function.
1559         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1560         (Sized_incremental_binary::symbol_map_): New data member.
1561         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1562         * target.h (Sized_target::apply_relocation): New function.
1563         * target-reloc.h (apply_relocation): New function.
1564         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1565
1566 2011-04-22  Doug Kwan  <dougkwan@google.com>
1567
1568         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1569         flag of a SHT_ARM_EXIDX section.
1570         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1571         * testsuite/Makefile.in: Regenerate.
1572         * testsuite/arm_exidx_test.s: New file.
1573         * testsuite/arm_exidx_test.sh: Same.
1574
1575 2011-04-20 Cary Coutant  <ccoutant@google.com>
1576
1577         PR gold/12689
1578         * archive.h (Incremental_archive_entry::Archive_member):
1579         Initialize arg_serial_ (second constructor).
1580
1581 2011-04-17  Ian Lance Taylor  <iant@google.com>
1582
1583         * object.cc (Relocate_info::location): Simplify location string.
1584         * errors.cc (Errors::error_at_location): Don't print program
1585         name.
1586         (Errors::warning_at_location): Likewise.
1587         (Errors::undefined_symbol): Likewise.
1588         * testsuite/debug_msg.sh: Update accordingly.
1589
1590 2011-04-14 Cary Coutant  <ccoutant@google.com>
1591
1592         * gold/layout.cc (Layout::symtab_section_offset): New function.
1593         * gold/layout.h (Layout::symtab_section_offset): New function.
1594         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1595
1596 2011-04-12  Ian Lance Taylor  <iant@google.com>
1597
1598         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1599         with MREMAP_MAYMOVE.
1600         * output.h (class Output_file): Add map_is_allocated_ field.
1601         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1602         not available, provide stubs.  If mremap is not available, #define
1603         it to gold_mremap.
1604         (MREMAP_MAYMOVE): Define if not defined.
1605         (Output_file::Output_file): Initialize map_is_allocated_.
1606         (Output_file::resize): Check map_is_allocated_.
1607         (Output_file::map_anonymous): If mmap fails, use malloc.
1608         (Output_file::unmap): Don't do anything for an anonymous map.
1609         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1610         is not available, provide stubs.
1611         (File_read::View::~View): Use free rather than delete[].
1612         (File_read::make_view): Use malloc rather than new[].  If mmap
1613         fails, use malloc.
1614         (File_read::find_or_make_view): Use malloc rather than new[].
1615         * gold.h: Remove HAVE_REMAP code.
1616         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1617         exists.  Rename mremap to gold_mremap.  If mmap is not available
1618         don't do anything.
1619         * configure, config.in: Rebuild.
1620
1621 2011-04-11  Ian Lance Taylor  <iant@google.com>
1622
1623         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1624         initialize local variable v.
1625
1626 2011-04-11  Cary Coutant  <ccoutant@google.com>
1627
1628         * archive.cc (Archive::include_member): Adjust call to
1629         report_object.
1630         (Add_archive_symbols::run): Track argument serial numbers.
1631         (Lib_group::include_member): Likewise.
1632         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1633         * archive.h (Incremental_archive_entry::Archive_member):
1634         Initialize arg_serial_.
1635         (Archive_member::arg_serial_): New data member.
1636         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1637         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1638         incremental link.
1639         (Sized_dynobj::do_for_all_local_got_entries): New function.
1640         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1641         function.
1642         * fileread.cc (get_mtime): New function.
1643         * fileread.h (get_mtime): New function.
1644         * gold.cc (queue_initial_tasks): Check for incremental update.
1645         (process_incremental_input): New function.
1646         (queue_middle_tasks): Don't force valid target for incremental
1647         update.
1648         * incremental-dump.cc (find_input_containing_global): Adjust
1649         size of symbol info entry.
1650         (dump_incremental_inputs): Dump argument serial number and
1651         in_system_directory flag; bias shndx by 1; print symbol names
1652         when dumping per-file symbol lists; use new symbol info readers.
1653         * incremental.cc
1654         (Output_section_incremental_inputs:update_data_size): New function.
1655         (Sized_incremental_binary::setup_readers): Setup input readers
1656         for each input file; build maps for files added from libraries
1657         and scripts.
1658         (Sized_incremental_binary::check_input_args): New function.
1659         (Sized_incremental_binary::do_check_inputs): Build map of argument
1660         serial numbers to input arguments.
1661         (Sized_incremental_binary::do_file_has_changed): Rename
1662         do_file_is_unchanged to this; compare file modification times.
1663         (Sized_incremental_binary::do_init_layout): New function.
1664         (Sized_incremental_binary::do_reserve_layout): New function.
1665         (Sized_incremental_binary::do_get_input_reader): Remove.
1666         (Sized_incremental_binary::get_symtab_view): New function.
1667         (Incremental_checker::can_incrementally_link_output_file): Remove.
1668         (Incremental_inputs::report_command_line): Exclude --debug options.
1669         (Incremental_inputs::report_archive_begin): Add parameter; track
1670         argument serial numbers; don't put input file entry for archive
1671         before archive members.
1672         (Incremental_inputs::report_archive_end): Put input file entry
1673         for archive after archive members.
1674         (Incremental_inputs::report_object): Add parameter; track argument
1675         serial numbers and in_system_directory flag.
1676         (Incremental_inputs::report_script): Add parameter; track argument
1677         serial numbers.
1678         (Output_section_incremental_inputs::set_final_data_size): Adjust
1679         size of symbol info entry; check for forwarding symbols.
1680         (Output_section_incremental_inputs::write_input_files): Write
1681         in_system_directory flag and argument serial number.
1682         (Output_section_incremental_inputs::write_info_blocks): Map section
1683         indices between incremental info and original input file; store
1684         input section index for each symbol.
1685         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1686         change operator() to visit().
1687         (class Global_got_offset_visitor): Likewise.
1688         (class Global_symbol_visitor_got_plt):
1689         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1690         classes.
1691         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1692         (Sized_incr_relobj::do_read_symbols): New function.
1693         (Sized_incr_relobj::do_layout): New function.
1694         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1695         (Sized_incr_relobj::do_add_symbols): New function.
1696         (Sized_incr_relobj::do_should_include_member): New function.
1697         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1698         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1699         (Sized_incr_relobj::do_section_size): New function.
1700         (Sized_incr_relobj::do_section_name): New function.
1701         (Sized_incr_relobj::do_section_contents): New function.
1702         (Sized_incr_relobj::do_section_flags): New function.
1703         (Sized_incr_relobj::do_section_entsize): New function.
1704         (Sized_incr_relobj::do_section_address): New function.
1705         (Sized_incr_relobj::do_section_type): New function.
1706         (Sized_incr_relobj::do_section_link): New function.
1707         (Sized_incr_relobj::do_section_info): New function.
1708         (Sized_incr_relobj::do_section_addralign): New function.
1709         (Sized_incr_relobj::do_initialize_xindex): New function.
1710         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1711         (Sized_incr_relobj::do_read_relocs): New function.
1712         (Sized_incr_relobj::do_gc_process_relocs): New function.
1713         (Sized_incr_relobj::do_scan_relocs): New function.
1714         (Sized_incr_relobj::do_count_local_symbols): New function.
1715         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1716         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1717         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1718         (Sized_incr_relobj::do_relocate): New function.
1719         (Sized_incr_relobj::do_set_section_offset): New function.
1720         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1721         (Sized_incr_dynobj::do_read_symbols): New function.
1722         (Sized_incr_dynobj::do_layout): New function.
1723         (Sized_incr_dynobj::do_add_symbols): New function.
1724         (Sized_incr_dynobj::do_should_include_member): New function.
1725         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1726         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1727         (Sized_incr_dynobj::do_section_size): New function.
1728         (Sized_incr_dynobj::do_section_name): New function.
1729         (Sized_incr_dynobj::do_section_contents): New function.
1730         (Sized_incr_dynobj::do_section_flags): New function.
1731         (Sized_incr_dynobj::do_section_entsize): New function.
1732         (Sized_incr_dynobj::do_section_address): New function.
1733         (Sized_incr_dynobj::do_section_type): New function.
1734         (Sized_incr_dynobj::do_section_link): New function.
1735         (Sized_incr_dynobj::do_section_info): New function.
1736         (Sized_incr_dynobj::do_section_addralign): New function.
1737         (Sized_incr_dynobj::do_initialize_xindex): New function.
1738         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1739         (make_sized_incremental_object): New function.
1740         (Incremental_library::copy_unused_symbols): New function.
1741         (Incremental_library::do_for_all_unused_symbols): New function.
1742         * incremental.h (enum Incremental_input_flags): New type.
1743         (class Incremental_checker): Remove.
1744         (Incremental_input_entry::Incremental_input_entry): Add argument
1745         serial number.
1746         (Incremental_input_entry::arg_serial): New function.
1747         (Incremental_input_entry::set_is_in_system_directory): New function.
1748         (Incremental_input_entry::is_in_system_directory): New function.
1749         (Incremental_input_entry::arg_serial_): New data member.
1750         (Incremental_input_entry::is_in_system_directory_): New data member.
1751         (class Script_info): Move here from script.h.
1752         (Script_info::Script_info): Add filename parameter.
1753         (Script_info::filename): New function.
1754         (Script_info::filename_): New data member.
1755         (Incremental_script_entry::Incremental_script_entry): Add argument
1756         serial number.
1757         (Incremental_object_entry::Incremental_object_entry): Likewise.
1758         (Incremental_object_entry::add_input_section): Build list of input
1759         sections with map to original shndx.
1760         (Incremental_object_entry::get_input_section_index): New function.
1761         (Incremental_object_entry::shndx_): New data member.
1762         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1763         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1764         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1765         serial number.
1766         (Incremental_inputs::report_archive_begin): Likewise.
1767         (Incremental_inputs::report_object): Likewise.
1768         (Incremental_inputs::report_script): Likewise.
1769         (class Incremental_global_symbol_reader): New class.
1770         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1771         and store flags and input file type.
1772         (Incremental_input_entry_reader::arg_serial): New function.
1773         (Incremental_input_entry_reader::type): Extract type from flags.
1774         (Incremental_input_entry_reader::is_in_system_directory): New function.
1775         (Incremental_input_entry_reader::get_input_section_count): Call
1776         accessor function for type.
1777         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1778         function for type; adjust size of global symbol entry.
1779         (Incremental_input_entry_reader::get_global_symbol_count): Call
1780         accessor function for type.
1781         (Incremental_input_entry_reader::get_object_count): Likewise.
1782         (Incremental_input_entry_reader::get_object_offset): Likewise.
1783         (Incremental_input_entry_reader::get_member_count): Likewise.
1784         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1785         (Incremental_input_entry_reader::get_member_offset): Likewise.
1786         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1787         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1788         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1789         (Incremental_input_entry_reader::get_global_symbol_reader): New
1790         function.
1791         (Incremental_input_entry_reader::get_output_symbol_index): New
1792         function.
1793         (Incremental_input_entry_reader::type_): Remove.
1794         (Incremental_input_entry_reader::flags_): New data member.
1795         (Incremental_inputs_reader::input_file_offset): New function.
1796         (Incremental_inputs_reader::input_file_index): New function.
1797         (Incremental_inputs_reader::input_file): Call input_file_offset.
1798         (Incremental_inputs_reader::input_file_at_offset): New function.
1799         (Incremental_relocs_reader::get_r_type): Reformat.
1800         (Incremental_relocs_reader::get_r_shndx): Reformat.
1801         (Incremental_relocs_reader::get_r_offset): Reformat.
1802         (Incremental_relocs_reader::data): New function.
1803         (Incremental_binary::Incremental_binary): Initialize new data members.
1804         (Incremental_binary::check_inputs): Add cmdline parameter.
1805         (Incremental_binary::file_is_unchanged): Remove.
1806         (Input_reader::arg_serial): New function.
1807         (Input_reader::get_unused_symbol_count): New function.
1808         (Input_reader::get_unused_symbol): New function.
1809         (Input_reader::do_arg_serial): New function.
1810         (Input_reader::do_get_unused_symbol_count): New function.
1811         (Input_reader::do_get_unused_symbol): New function.
1812         (Incremental_binary::input_file_count): New function.
1813         (Incremental_binary::get_input_reader): Change signature to use
1814         index instead of filename.
1815         (Incremental_binary::file_has_changed): New function.
1816         (Incremental_binary::get_input_argument): New function.
1817         (Incremental_binary::get_library): New function.
1818         (Incremental_binary::get_script_info): New function.
1819         (Incremental_binary::init_layout): New function.
1820         (Incremental_binary::reserve_layout): New function.
1821         (Incremental_binary::output_file): New function.
1822         (Incremental_binary::do_check_inputs): New function.
1823         (Incremental_binary::do_file_is_unchanged): Remove.
1824         (Incremental_binary::do_file_has_changed): New function.
1825         (Incremental_binary::do_init_layout): New function.
1826         (Incremental_binary::do_reserve_layout): New function.
1827         (Incremental_binary::do_input_file_count): New function.
1828         (Incremental_binary::do_get_input_reader): Change signature.
1829         (Incremental_binary::input_args_map_): New data member.
1830         (Incremental_binary::library_map_): New data member.
1831         (Incremental_binary::script_map_): New data member.
1832         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1833         new data members.
1834         (Sized_incremental_binary::output_section): New function.
1835         (Sized_incremental_binary::inputs_reader): Add const.
1836         (Sized_incremental_binary::symtab_reader): Add const.
1837         (Sized_incremental_binary::relocs_reader): Add const.
1838         (Sized_incremental_binary::got_plt_reader): Add const.
1839         (Sized_incremental_binary::get_symtab_view): New function.
1840         (Sized_incremental_binary::Inputs_reader): New typedef.
1841         (Sized_incremental_binary::Input_entry_reader): New typedef.
1842         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1843         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1844         (Sized_incremental_binary::do_file_has_changed): New function.
1845         (Sized_incremental_binary::do_init_layout): New function.
1846         (Sized_incremental_binary::do_reserve_layout): New function.
1847         (Sized_input_reader::Inputs_reader): Remove.
1848         (Sized_input_reader::Input_entry_reader): Remove.
1849         (Sized_input_reader::do_arg_serial): New function.
1850         (Sized_input_reader::do_get_unused_symbol_count): New function.
1851         (Sized_input_reader::do_get_unused_symbol): New function.
1852         (Sized_incremental_binary::do_input_file_count): New function.
1853         (Sized_incremental_binary::do_get_input_reader): Change signature;
1854         use index instead of filename.
1855         (Sized_incremental_binary::section_map_): New data member.
1856         (Sized_incremental_binary::input_entry_readers_): New data member.
1857         (class Sized_incr_relobj): New class.
1858         (class Sized_incr_dynobj): New class.
1859         (make_sized_incremental_object): New function.
1860         (class Incremental_library): New class.
1861         * layout.cc (Free_list::num_lists): New static data member.
1862         (Free_list::num_nodes): New static data member.
1863         (Free_list::num_removes): New static data member.
1864         (Free_list::num_remove_visits): New static data member.
1865         (Free_list::num_allocates): New static data member.
1866         (Free_list::num_allocate_visits): New static data member.
1867         (Free_list::init): New function.
1868         (Free_list::remove): New function.
1869         (Free_list::allocate): New function.
1870         (Free_list::dump): New function.
1871         (Free_list::print_stats): New function.
1872         (Layout_task_runner::run): Resize output file for incremental updates.
1873         (Layout::Layout): Initialize new data members.
1874         (Layout::set_incremental_base): New function.
1875         (Layout::init_fixed_output_section): New function.
1876         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1877         incremental updates.
1878         (Layout::create_gold_note): Do not create gold note section for
1879         incremental updates.
1880         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1881         for incremental updates.
1882         (Layout::set_section_offsets): For incremental updates, allocate space
1883         from free list.
1884         (Layout::create_symtab_sections): Layout with offsets relative to
1885         start of section; for incremental updates, allocate space from free
1886         list.
1887         (Layout::create_shdrs): For incremental updates, allocate space from
1888         free list.
1889         (Layout::finish_dynamic_section): For incremental updates, do not
1890         check --as-needed (fixed in subsequent patch).
1891         * layout.h (class Free_list): New class.
1892         (Layout::set_incremental_base): New function.
1893         (Layout::incremental_base): New function.
1894         (Layout::init_fixed_output_section): New function.
1895         (Layout::allocate): New function.
1896         (Layout::incremental_base_): New data member.
1897         (Layout::free_list_): New data member.
1898         * main.cc (main): Print Free_list statistics.
1899         * object.cc (Relobj::finalize_incremental_relocs): Add
1900         clear_counts parameter; clear counts only when clear_counts is set.
1901         (Sized_relobj::Sized_relobj): Initialize new base class.
1902         (Sized_relobj::do_layout): Don't report special sections.
1903         (Sized_relobj::do_for_all_local_got_entries): New function.
1904         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1905         symtab_off to all symbol table offsets.
1906         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1907         * object.h (class Got_offset_list): Move to top of file.
1908         (Object::Object): Allow case where input_file == NULL.
1909         (Object::~Object): Likewise.
1910         (Object::input_file): Assert that input_file != NULL.
1911         (Object::lock): Allow case where input_file == NULL.
1912         (Object::unlock): Likewise.
1913         (Object::is_locked): Likewise.
1914         (Object::token): Likewise.
1915         (Object::release): Likewise.
1916         (Object::is_incremental): New function.
1917         (Object::get_mtime): New function.
1918         (Object::for_all_local_got_entries): New function.
1919         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1920         (Object::set_is_in_system_directory): New function.
1921         (Object::is_in_system_directory): New function.
1922         (Object::do_is_incremental): New function.
1923         (Object::do_get_mtime): New function.
1924         (Object::do_for_all_local_got_entries): New function.
1925         (Object::is_in_system_directory_): New data member.
1926         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1927         (class Sized_relobj_base): New class.
1928         (class Sized_relobj): Derive from Sized_relobj_base.
1929         (class Sized_relobj::Symbols): Redeclare from base class.
1930         (class Sized_relobj::local_got_offset_list): Remove.
1931         (class Sized_relobj::Output_sections): Redeclare from base class.
1932         (class Sized_relobj::do_for_all_local_got_entries): New function.
1933         (class Sized_relobj::write_local_symbols): Add offset parameter.
1934         (class Sized_relobj::local_symbol_offset_): Update comment.
1935         (class Sized_relobj::local_dynsym_offset_): Update comment.
1936         * options.cc (Input_arguments::add_file): Remove const.
1937         * options.h (Input_file_argument::Input_file_argument):
1938         Initialize arg_serial_ (all constructors).
1939         (Input_file_argument::set_arg_serial): New function.
1940         (Input_file_argument::arg_serial): New function.
1941         (Input_file_argument::arg_serial_): New data member.
1942         (Input_arguments::Input_arguments): Initialize file_count_.
1943         (Input_arguments::add_file): Remove const.
1944         (Input_arguments::number_of_input_files): New function.
1945         (Input_arguments::file_count_): New data member.
1946         (Command_line::number_of_input_files): Call
1947         Input_arguments::number_of_input_files.
1948         * output.cc (Output_segment_headers::Output_segment_headers):
1949         Set current size.
1950         (Output_section::Input_section::current_data_size): New function.
1951         (Output_section::Output_section): Initialize new data members.
1952         (Output_section::add_input_section): Don't do merge sections for
1953         an incremental link; allocate space from free list for an
1954         incremental update.
1955         (Output_section::add_output_section_data): Allocate space from
1956         free list for an incremental update.
1957         (Output_section::update_data_size): New function.
1958         (Output_section::set_fixed_layout): New function.
1959         (Output_section::reserve): New function.
1960         (Output_segment::set_section_addresses): Remove const.
1961         (Output_segment::set_section_list_addresses): Remove const; allocate
1962         space from free list for an incremental update.
1963         (Output_segment::set_offset): Adjust size of RELRO segment for an
1964         incremental update.
1965         * output.h (Output_data::current_data_size): Move here from
1966         child classes.
1967         (Output_data::pre_finalize_data_size): New function.
1968         (Output_data::update_data_size): New function.
1969         (Output_section_headers::update_data_size): new function.
1970         (Output_section_data_build::current_data_size): Move to Output_data.
1971         (Output_data_strtab::update_data_size): New function.
1972         (Output_section::current_data_size): Move to Output_data.
1973         (Output_section::set_fixed_layout): New function.
1974         (Output_section::has_fixed_layout): New function.
1975         (Output_section::reserve): New function.
1976         (Output_section::update_data_size): New function.
1977         (Output_section::has_fixed_layout_): New data member.
1978         (Output_section::free_list_): New data member.
1979         (Output_segment::set_section_addresses): Remove const.
1980         (Output_segment::set_section_list_addresses): Remove const.
1981         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1982         New function.
1983         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1984         New function.
1985         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1986         parameter when calling Add_symbols constructor; store argument
1987         serial number for members of a lib group.
1988         (Add_symbols::locks): Allow case where token == NULL.
1989         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1990         (Read_member::~Read_member): New function.
1991         (Read_member::is_runnable): New function.
1992         (Read_member::locks): New function.
1993         (Read_member::run): New function.
1994         (Check_script::~Check_script): New function.
1995         (Check_script::is_runnable): New function.
1996         (Check_script::locks): New function.
1997         (Check_script::run): New function.
1998         (Check_library::~Check_library): New function.
1999         (Check_library::is_runnable): New function.
2000         (Check_library::locks): New function.
2001         (Check_library::run): New function.
2002         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2003         (Add_symbols::library_): New data member.
2004         (class Read_member): New class.
2005         (class Check_script): New class.
2006         (class Check_library): New class.
2007         * reloc.cc (Read_relocs::is_runnable): Allow case where
2008         token == NULL.
2009         (Read_relocs::locks): Likewise.
2010         (Scan_relocs::locks): Likewise.
2011         (Relocate_task::locks): Likewise.
2012         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2013         to clear counters.
2014         (Sized_relobj::incremental_relocs_scan): Fix comment.
2015         (Sized_relobj::do_relocate): Pass output file offset to
2016         write_local_symbols.
2017         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2018         from class declaration.
2019         * script.cc (read_input_script): Allocate Script_info; pass
2020         argument serial number to report_script.
2021         * script.h (class Script_info): Move to incremental.h.
2022         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2023         * symtab.h (Symbol_table::add_from_incrobj): New function.
2024         (Symbol_table::set_file_offset): New function.
2025
2026 2011-04-05  Cary Coutant  <ccoutant@google.com>
2027
2028         * incremental-dump.cc (dump_incremental_inputs): Change signature
2029         to take a Sized_incremental_binary; change caller.  Use readers
2030         in Sized_incremental_binary.
2031         * incremental.cc
2032         (Sized_incremental_binary::find_incremental_inputs_sections):
2033         Rename do_find_incremental_inputs_sections to this.
2034         (Sized_incremental_binary::setup_readers): New function.
2035         (Sized_incremental_binary::do_check_inputs): Check
2036         has_incremental_info_ flag; move setup code to setup_readers;
2037         use input readers.
2038         (Sized_incremental_binary::do_file_is_unchanged): New function.
2039         (Sized_incremental_binary::do_get_input_reader): New function.
2040         * incremental.h (class Incremental_binary): Move to end of file.
2041         (Incremental_binary::file_is_unchanged): New function.
2042         (Incremental_binary::do_file_is_unchanged): New function.
2043         (Incremental_binary::Input_reader): New class.
2044         (Incremental_binary::get_input_reader): New function.
2045         (class Sized_incremental_binary): Move to end of file.
2046         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2047         input section reader classes.
2048         (Sized_incremental_binary::has_incremental_info): New function.
2049         (Sized_incremental_binary::inputs_reader): New function.
2050         (Sized_incremental_binary::symtab_reader): New function.
2051         (Sized_incremental_binary::relocs_reader): New function.
2052         (Sized_incremental_binary::got_plt_reader): New function.
2053         (Sized_incremental_binary::do_file_is_unchanged): New function.
2054         (Sized_incremental_binary::Sized_input_reader): New class.
2055         (Sized_incremental_binary::get_input_reader): New function.
2056         (Sized_incremental_binary::find_incremental_inputs_sections):
2057         Rename do_find_incremental_inputs_sections to this.
2058         (Sized_incremental_binary::setup_readers): New function.
2059         (Sized_incremental_binary::has_incremental_info_): New data member.
2060         (Sized_incremental_binary::inputs_reader_): New data member.
2061         (Sized_incremental_binary::symtab_reader_): New data member.
2062         (Sized_incremental_binary::relocs_reader_): New data member.
2063         (Sized_incremental_binary::got_plt_reader_): New data member.
2064         (Sized_incremental_binary::current_input_file_): New data member.
2065
2066 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2067
2068         PR gold/12640
2069         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2070         violation.
2071
2072 2011-03-30  Cary Coutant  <ccoutant@google.com>
2073
2074         * archive.cc (Archive::include_member): Adjust call to report_object.
2075         (Add_archive_symbols::run): Add script_info to call to
2076         report_archive_begin.
2077         (Lib_group::include_member): Adjust call to report_object.
2078         (Add_lib_group_symbols::run): Adjust call to report_object.
2079         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2080         blocks.  Add object count for script input files.
2081         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2082         script_info parameter; change all callers.
2083         (Incremental_inputs::report_object): Add script_info parameter;
2084         change all callers.
2085         (Incremental_inputs::report_script): Store backpointer to
2086         incremental info entry.
2087         (Output_section_incremental_inputs::set_final_data_size): Record
2088         additional information for scripts.
2089         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2090         * incremental.h (Incremental_script_entry::add_object): New function.
2091         (Incremental_script_entry::get_object_count): New function.
2092         (Incremental_script_entry::get_object): New function.
2093         (Incremental_script_entry::objects_): New data member; adjust
2094         constructor.
2095         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2096         (Incremental_inputs::report_object): Add script_info parameter.
2097         (Incremental_inputs_reader::get_object_count): New function.
2098         (Incremental_inputs_reader::get_object_offset): New function.
2099         * options.cc (Input_arguments::add_file): Return reference to
2100         new input argument.
2101         * options.h (Input_argument::set_script_info): New function.
2102         (Input_argument::script_info): New function.
2103         (Input_argument::script_info_): New data member; adjust all
2104         constructors.
2105         (Input_file_group::add_file): Return reference to new input argument.
2106         (Input_file_lib::add_file): Likewise.
2107         (Input_arguments::add_file): Likewise.
2108         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2109         * script.cc (Parser_closure::Parser_closure): Add script_info
2110         parameter; adjust all callers.
2111         (Parser_closure::script_info): New function.
2112         (Parser_closure::script_info_): New data member.
2113         (read_input_script): Report scripts earlier to incremental info.
2114         (script_add_file): Set script_info in Input_argument.
2115         (script_add_library): Likewise.
2116         * script.h (Script_options::Script_info): Rewrite class.
2117
2118 2011-03-29  Cary Coutant  <ccoutant@google.com>
2119
2120         * archive.cc (Library_base::should_include_member): Move
2121         method here from class Archive.
2122         (Archive::Archive): Initialize base class.
2123         (Archive::should_include_member): Move to base class.
2124         (Archive::do_for_all_unused_symbols): New function.
2125         (Add_archive_symbols::run): Remove redundant access to
2126         incremental_inputs.
2127         (Lib_group::Lib_group): Initialize base class.
2128         (Lib_group::do_filename): New function.
2129         (Lib_group::include_member): Pass pointer to Lib_group to
2130         report_object.
2131         (Lib_group::do_for_all_unused_symbols): New function.
2132         (Add_lib_group_symbols::run): Report archive information for
2133         incremental links.
2134         * archive.h (class Library_base): New base class.
2135         (class Archive): Derive from Library_base.
2136         (Archive::filename): Move to base class.
2137         (Archive::set_incremental_info): Likewise.
2138         (Archive::incremental_info): Likewise.
2139         (Archive::Should_include): Likewise.
2140         (Archive::should_include_member): Likewise.
2141         (Archive::Armap_entry): Remove.
2142         (Archive::Unused_symbol_iterator): Remove.
2143         (Archive::unused_symbols_begin): Remove.
2144         (Archive::unused_symbols_end): Remove.
2145         (Archive::do_filename): New function.
2146         (Archive::do_get_mtime): New function.
2147         (Archive::do_for_all_unused_symbols): New function.
2148         (Archive::task_): Move to base class.
2149         (Archive::incremental_info_): Likewise.
2150         (class Lib_group): Derive from Library_base.
2151         (Lib_group::do_filename): New function.
2152         (Lib_group::do_get_mtime): New function.
2153         (Lib_group::do_for_all_unused_symbols): New function.
2154         (Lib_group::task_): Move to base class.
2155         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2156         function.
2157         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2158         function.
2159         * incremental.cc (Incremental_inputs::report_archive_begin):
2160         Use Library_base; call library's get_mtime; add incremental inputs
2161         entry before members.
2162         (class Unused_symbol_visitor): New class.
2163         (Incremental_inputs::report_archive_end): Use Library_base; use
2164         visitor class to record unused symbols; don't add incremental inputs
2165         entry after members.
2166         (Incremental_inputs::report_object): Use Library_base.
2167         * incremental.h
2168         (Incremental_archive_entry::Incremental_archive_entry): Remove
2169         unused Archive parameter.
2170         (Incremental_inputs::report_archive_begin): Use Library_base.
2171         (Incremental_inputs::report_archive_end): Likewise.
2172         (Incremental_inputs::report_object): Likewise.
2173         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2174         function.
2175         * object.h (Object::for_all_global_symbols): New function.
2176         (Object::do_for_all_global_symbols): New function.
2177         (Sized_relobj::do_for_all_global_symbols): New function.
2178         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2179         function.
2180         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2181         function.
2182
2183 2011-03-27  Ian Lance Taylor  <iant@google.com>
2184
2185         * archive.cc (Archive::interpret_header): Return -1 if something
2186         goes wrong.  Change callers accordingly.
2187
2188 2011-03-25  Cary Coutant  <ccoutant@google.com>
2189
2190         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2191         * testsuite/Makefile.in: Regenerate.
2192
2193 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2194
2195         * plugin.cc (get_view): New.
2196         (Plugin::load): Pass get_view to the plugin.
2197         (Plugin_manager::get_view): New.
2198
2199 2011-03-21  Ian Lance Taylor  <iant@google.com>
2200
2201         * testsuite/final_layout.sh: Rewrite to not use dc.
2202         * testsuite/relro_test.sh: Fail if dc is not present.
2203
2204 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2205
2206         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2207         Change == to -eq.
2208         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2209         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2210         Change == to -eq.
2211         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2212         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2213
2214 2011-03-14  Ian Lance Taylor  <iant@google.com>
2215
2216         * script-sections.cc (Sort_output_sections::script_compare):
2217         Rename from is_before, change return type.
2218         (Sort_output_sections::operator()): Adjust accordingly.
2219
2220 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2221
2222         PR gold/12572
2223         * testsuite/odr_violation2.cc: Add comment to make all error line
2224         numbers double digits.
2225         * testsuite/debug_msg.sh: Adjust expected errors.
2226
2227 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2228
2229         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2230         but mark earlier ones as non-canonical
2231         (offset_to_iterator): Update search target and example
2232         (do_addr2line): Return extra lines in a vector*
2233         (format_file_lineno): Extract from do_addr2line
2234         (one_addr2line): Add vector* out-param
2235         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2236         when a lineno entry appeared last for its instruction
2237         (Dwarf_line_info): Add vector* out-param
2238         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2239         * symtab.cc (Odr_violation_compare): Include the lineno in the
2240         comparison again.
2241         (linenos_from_loc): New. Combine the canonical line for an
2242         address with its other lines.
2243         (True_if_intersect): New. Helper functor to make
2244         std::set_intersection a query.
2245         (detect_odr_violations): Compare sets of lines instead of just
2246         one line for each function. This became less deterministic, but
2247         has fewer false positives.
2248         * symtab.h: Declarations.
2249         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2250         mix an optimized and non-optimized object in the same binary
2251         (odr_violation2.so): Same.
2252         * testsuite/Makefile.in: Regenerate from Makefile.am.
2253         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2254         * testsuite/debug_msg.sh: Update line numbers and add
2255         assertions.
2256         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2257         non-optimized context.
2258         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2259         isn't inlined, and use OdrDerived in an optimized context.
2260         * testsuite/odr_header1.h: Defines OdrDerived, where
2261         optimization will change the
2262         first-instruction-in-the-destructor's file and line number.
2263         * testsuite/odr_header2.h: Defines OdrBase.
2264
2265 2011-03-09  Ian Lance Taylor  <iant@google.com>
2266
2267         * fileread.cc (File_read::clear_views): Don't delete the whole
2268         file view.
2269
2270 2011-03-08  Ian Lance Taylor  <iant@google.com>
2271
2272         PR gold/12525
2273         * fileread.cc: #include <climits>.
2274         (GOLD_IOV_MAX): Define.
2275         (File_read::read_multiple): Limit number of entries by iov_max.
2276         * fileread.h (class File_read): Always set max_readv_entries to
2277         128.
2278
2279 2011-03-07  Ian Lance Taylor  <iant@google.com>
2280
2281         PR gold/12525
2282         * options.h (class General_options): Add -dy and -dn.
2283
2284 2011-03-02  Cary Coutant  <ccoutant@google.com>
2285
2286         * testsuite/script_test_9.t: Add TLS segment.
2287
2288 2011-03-02  Simon Baldwin  <simonb@google.com>
2289
2290         * configure.ac: Add check for gnu_indirect_function support in
2291         the toolchain building binutils.
2292         * configure: Rebuild.
2293
2294 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2295
2296         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2297         plugin only symbols.
2298         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2299         in plugin files as not needed in the symbol table.
2300
2301 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2302
2303         * output.cc (Output_section::add_input_section): Delay fill
2304         generation for section ordering.
2305
2306 2011-02-09  Ian Lance Taylor  <iant@google.com>
2307
2308         PR gold/12316
2309         * object.h (class Sized_relobj): Remove clear_local_symbols.
2310         * reloc.cc (Sized_relobj::do_relocate): Don't call
2311         clear_local_symbols.
2312
2313 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2314
2315         * plugin.cc (is_visible_from_outside): Return true for symbols
2316         in the -u option.
2317
2318 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2319
2320         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2321         filename.
2322
2323 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2324
2325         * icf.h (is_section_foldable_candidate): Change type of parameter
2326         to std::string.
2327         * icf.cc (Icf::find_identical_sections): Change type of local variable
2328         section_name to be std::string.
2329         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2330
2331 2011-01-25  Ian Lance Taylor  <iant@google.com>
2332
2333         * script.cc (script_add_extern): Rewrite to use
2334         add_symbol_reference.
2335
2336 2011-01-25  Doug Kwan  <dougkwan@google.com>
2337
2338         * icf.cc (get_section_contents): Always lock section's object.
2339
2340 2011-01-24  Ian Lance Taylor  <iant@google.com>
2341
2342         * options.h (class General_options): Accept
2343         --no-detect-odr-violations.
2344
2345 2011-01-24  Ian Lance Taylor  <iant@google.com>
2346
2347         * version.cc (version_string): Bump to 1.11.
2348
2349 2011-01-24  Ian Lance Taylor  <iant@google.com>
2350
2351         * plugin.cc (class Plugin_rescan): Define new class.
2352         (Plugin_manager::claim_file): Set any_claimed_.
2353         (Plugin_manager::save_archive): New function.
2354         (Plugin_manager::save_input_group): New function.
2355         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2356         necessary.
2357         (Plugin_manager::new_undefined_symbol): New function.
2358         (Plugin_manager::rescan): New function.
2359         (Plugin_manager::rescannable_defines): New function.
2360         (Plugin_manager::add_input_file): Set any_added_.
2361         * plugin.h (class Plugin_manager): define new fields rescannable_,
2362         undefined_symbols_, any_claimed_, and any_added_.  Declare
2363         Plugin_rescan as friend.  Declare new functions.
2364         (Plugin_manager::Rescannable): Define type.
2365         (Plugin_manager::Rescannable_list): Define type.
2366         (Plugin_manager::Undefined_symbol_list): Define type.
2367         (Plugin_manager::Plugin_manager): Initialize new fields.
2368         * archive.cc (Archive::defines_symbol): New function.
2369         (Add_archive_symbols::run): Pass archive to plugins if any.
2370         * archive.h (class Archive): Declare defines_symbol.
2371         * readsyms.cc (Input_group::~Input_group): New function.
2372         (Finish_group::run): Pass input_group to plugins if any.
2373         * readsyms.h (class Input_group): Declare destructor.
2374         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2375         any.
2376
2377 2011-01-10  Ian Lance Taylor  <iant@google.com>
2378
2379         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2380         section as relro.
2381         (Layout::set_segment_offsets): Reset increase_relro before calling
2382         set_section_addresses a second time.
2383
2384 2011-01-04  Cary Coutant  <ccoutant@google.com>
2385
2386         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2387         sections before NOBITS sections.
2388
2389 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2390
2391         * version.cc (print_version): Update copyright to 2011.
2392
2393 2010-12-23  Cary Coutant  <ccoutant@google.com>
2394
2395         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2396         of OS to this->add.  Add OD parameter to second form of the function.
2397
2398 2010-12-20  Ian Lance Taylor  <iant@google.com>
2399
2400         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2401         second of two consecutive entries with same offset.
2402
2403 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2404
2405         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2406         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2407         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2408         to avoid unneeded links against $(LDADD).
2409         * testsuite/Makefile.in: Regenerate.
2410
2411 2010-12-15  Ian Lance Taylor  <iant@google.com>
2412
2413         PR gold/12324
2414         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2415         for R_X86_64_32 and R_X86_64_PC32.
2416         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2417         ver_matching_def_pic.o.
2418         (ver_matching_def_pic.o): New target.
2419
2420 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2421
2422         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2423         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2424         Move definition before File_read::View member definitions.
2425         (File_read::View::~View): Initialize and hold lock before
2426         updating current_mapped_bytes.
2427
2428 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2429
2430         * dwarf_reader.cc: Remove outdated comment.
2431         * gold-threads.cc: Fix typo in error message.
2432         * archive.cc: Fix typos in comments.
2433         * archive.h: Likewise.
2434         * arm-reloc-property.cc: Likewise.
2435         * arm-reloc-property.h: Likewise.
2436         * arm-reloc.def: Likewise.
2437         * arm.cc: Likewise.
2438         * attributes.h: Likewise.
2439         * cref.cc: Likewise.
2440         * ehframe.cc: Likewise.
2441         * fileread.h: Likewise.
2442         * gold.h: Likewise.
2443         * i386.cc: Likewise.
2444         * icf.cc: Likewise.
2445         * incremental.h: Likewise.
2446         * int_encoding.cc: Likewise.
2447         * layout.h: Likewise.
2448         * main.cc: Likewise.
2449         * merge.h: Likewise.
2450         * object.cc: Likewise.
2451         * object.h: Likewise.
2452         * options.cc: Likewise.
2453         * readsyms.cc: Likewise.
2454         * reduced_debug_output.cc: Likewise.
2455         * reloc.cc: Likewise.
2456         * script-sections.cc: Likewise.
2457         * sparc.cc: Likewise.
2458         * symtab.h: Likewise.
2459         * target-reloc.h: Likewise.
2460         * target.cc: Likewise.
2461         * target.h: Likewise.
2462         * timer.cc: Likewise.
2463         * timer.h: Likewise.
2464         * x86_64.cc: Likewise.
2465
2466 2010-12-09  Cary Coutant  <ccoutant@google.com>
2467
2468         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2469         stack.
2470         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2471         parameter; change all callers.
2472         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2473         * options.h (warn_execstack): New option.
2474
2475 2010-12-07  Doug Kwan  <dougkwan@google.com>
2476
2477         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2478         like function call relocations.
2479
2480 2010-12-07  Ian Lance Taylor  <iant@google.com>
2481
2482         * archive.cc (Archive::get_elf_object_for_member): Permit
2483         punconfigured to be NULL.
2484         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2485         (Archive::include_member): Pass NULL to get_elf_object_for_member
2486         if we searched for the archive and this is the first included
2487         object.
2488
2489 2010-12-01  Ian Lance Taylor  <iant@google.com>
2490
2491         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2492         track_relocs_type_ field.
2493         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2494         Set track_relocs_type_.
2495         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2496         contents when using RELA relocs.
2497         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2498         reloc_map_.
2499         * reloc.cc (Track_relocs::next_addend): New function.
2500         * reloc.h (class Track_relocs): Declare next_addend.
2501
2502 2010-12-01  Ian Lance Taylor  <iant@google.com>
2503
2504         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2505         virtual destructor.
2506
2507 2010-12-01  Ian Lance Taylor  <iant@google.com>
2508
2509         * README: Update compilers known to work and fail.
2510
2511 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2512
2513         * configure.in: For --enable-gold, handle value `default' instead of
2514         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2515         not the default.
2516         * configure: Regenerate.
2517
2518 2010-11-18  Doug Kwan  <dougkwan@google.com>
2519
2520         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2521         and right_alignment to be zero.  Store result alignment only if it is
2522         greater than existing alignment.
2523
2524 2010-11-16  Cary Coutant  <ccoutant@google.com>
2525
2526         PR gold/12220
2527         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2528         Check for ".zdebug_line".
2529
2530 2010-11-16  Doug Kwan  <dougkwan@google.com>
2531             Cary Coutant  <ccoutant@google.com>
2532
2533         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2534         by reference; adjust all callers.
2535         * output.cc (Output_segment::set_section_addresses): Adjust references
2536         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2537         list is empty.
2538         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2539         end at page boundary.
2540
2541 2010-11-16  Cary Coutant  <ccoutant@google.com>
2542
2543         PR gold/12220
2544         * layout.cc (Layout::choose_output_section): Transform names of
2545         compressed sections even when using a script with a SECTIONS clause.
2546         (Layout::output_section_name): Remove code to transform
2547         compressed debug section names.
2548         * output.cc (Output_section::add_input_section): Use uncompressed
2549         section size when tracking input sections.
2550
2551 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2552
2553         * symtab.h (Symbol::NON_PIC_REF): Remove.
2554         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2555         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2556         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2557         (Symbol::use_plt_offset): Take a flags argument and pass it
2558         directly to needs_dynamic_reloc.  Restrict check for undefined
2559         weak symbols to function calls.
2560         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2561         (Target_arm::Scan::global): Use it.
2562         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2563         (Target_arm::Relocate::relocate): Likewise.
2564         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2565         parameter with an r_type parameter.  Use get_reference_flags
2566         to get the flags.
2567         (Target_arm::Relocate::relocate): Update accordingly.
2568         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2569         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2570         (Target_i386::Scan::global): Likewise.
2571         (Target_i386::Relocate::relocate): Likewise.
2572         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2573         parameter with an r_type parameter.  Use get_reference_flags
2574         to get the flags.
2575         (Target_i386::Relocate::relocate): Update accordingly.
2576         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2577         (Target_powerpc::Scan::global): Use it.
2578         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2579         (Target_powerpc::Relocate::relocate): Likewise.
2580         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2581         (Target_sparc::Scan::global): Use it.
2582         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2583         (Target_sparc::Relocate::relocate): Likewise.
2584         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2585         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2586         (Target_x86_64::Scan::global): Likewise.
2587         (Target_x86_64::Relocate::relocate): Likewise.
2588
2589 2010-11-08  Doug Kwan  <dougkwan@google.com>
2590             Cary Coutant  <ccoutant@google.com>
2591
2592         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2593         (Arm_exidx_merge_section::section_contents_): New data member.
2594         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2595         (Arm_input_section::~Arm_input_section): De-allocate memory.
2596         (Arm_input_section::original_contents_): New data member.       
2597         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2598         in parameters instead of calling Object::section_contents without
2599         locking.
2600         (Arm_output_section::group_section): New parameter TASK.  Pass it
2601         to callees that need locking objects.
2602         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2603         to lock EXIDX input sections.  Fix a formatting issue.  Call
2604         Arm_exidx_merged_section::build_contents to create merged section
2605         contents.
2606         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2607         to lock object of stub table owner.
2608         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2609         TEXT_SIZE to initialize data member TEXT_SIZE_.
2610         (Arm_exidx_input_section::addralign): Fix typo in comment.
2611         (Arm_exidx_input_section::text_size): New method.
2612         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2613         that require locking objects.  Lock objects before scanning for stubs
2614         and updating local symbols.
2615         (Arm_input_section<big_endian>::init): Copy contents of original
2616         input section.
2617         (Arm_input_section<big_endian>::do_write): Use saved contents of
2618         original input section instead of calling Object::section_contents
2619         without locking.
2620         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2621         size without calling Object::section_size().
2622         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2623         for size.  Allocate a buffer for merged EXIDX entries.
2624         (Arm_exidx_merged_section::build_contents): New method.
2625         (Arm_exidx_merged_section::do_write): Move merge section contents
2626         building code to Arm_exidx_merged_section::build_contetns.  Write
2627         out contetns in buffer instead of building it on the fly.
2628         (Arm_relobj::make_exidx_input_section): Also pass text section size
2629         to Arm_exidx_input_section constructor.
2630         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2631         (Arm_dynobj::do_read_symbols): Fix memory leak.
2632         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2633         * target.h: (class Task): Add forward declaration.
2634         (Target::relax): Add new parameter TASK and pass it to
2635         Target::do_relax().
2636         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2637
2638 2010-11-05  Cary Coutant  <ccoutant@google.com>
2639
2640         PR gold/10708
2641         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2642         object when reading from the file.
2643         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2644         second layout pass.
2645         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2646         when reading section contents.
2647         (get_section_contents): Likewise.
2648         (icf::find_identical_sections): Likewise.
2649         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2650         object when reading from the file.
2651         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2652         the object when doing deferred section layout.
2653
2654 2010-11-03  Nick Clifton  <nickc@redhat.com>
2655
2656         PR gold/12001
2657         * script.h (class Symbol_assignment: name): New member.  Returns
2658         the name of the symbol.
2659         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2660         Returns true if the given symbol name is on the list of
2661         assignments wating to be processed.
2662         * archive.cc (should_incldue_member): If the symbol is undefined,
2663         check to see if it is on the list of symbols pending assignment.
2664
2665 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2666
2667         * script-sections.cc (Script_sections::find_memory_region): Check
2668         for a NULL output section pointer.
2669
2670 2010-10-29  Doug Kwan  <dougkwan@google.com>
2671
2672         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2673         Output_section::add_relaxed_input_section.
2674         * output.cc (Output_section::add_relaxed_input_section): Add new
2675         arguments LAYOUT and NAME.  Set section order index.
2676         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2677         Copy section order index.
2678         * output.h (Output_section::add_relaxed_input_section): Add new
2679         arguments LAYOUT and NAME.
2680
2681 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2682
2683         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2684         NATIVE_OR_CROSS_LINKER.
2685         * testsuite/Makefile.in: Regenerate.
2686
2687 2010-10-20  Doug Kwan  <dougkwan@google.com>
2688
2689         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2690         without SHF_LINK_ORDER flags.
2691         * layout.cc (Layout::choose_output_section): Do not filter
2692         SHF_LINK_ORDER flag in a relocatable link.
2693
2694 2010-10-17  Cary Coutant  <ccoutant@google.com>
2695
2696         * output.h (Output_segment::set_section_addresses): Change function
2697         signature.  Update all callers.
2698         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2699         sections.
2700         (Output_segment::set_section_addresses): Align after last TLS
2701         section.  Add padding before last relro section instead of after.
2702
2703 2010-10-17  Doug Kwan  <dougkwan@google.com>
2704
2705         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2706         GOT output section to be writable.
2707
2708 2010-10-14  Cary Coutant  <ccoutant@google.com>
2709
2710         * debug.h (DEBUG_INCREMENTAL): New flag.
2711         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2712         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2713         mode.
2714         * incremental.cc (report_command_line): Ignore all forms of
2715         --incremental.
2716         * layout.cc (Layout::Layout): Check parameters for incremental link
2717         mode.
2718         * options.cc (General_options::parse_incremental): New function.
2719         (General_options::parse_no_incremental): New function.
2720         (General_options::parse_incremental_full): New function.
2721         (General_options::parse_incremental_update): New function.
2722         (General_options::incremental_mode_): New data member.
2723         (General_options::finalize): Check incremental_mode_.
2724         * options.h (General_options): Update help text for --incremental.
2725         Add --no-incremental, --incremental-full, --incremental-update.
2726         (General_options::Incremental_mode): New enum type.
2727         (General_options::incremental_mode): New function.
2728         (General_options::incremental_mode_): New data member.
2729         * parameters.cc (Parameters::incremental_mode_): New data member.
2730         (Parameters::set_options): Set incremental_mode_.
2731         (Parameters::set_incremental_full): New function.
2732         (Parameters::incremental): New function.
2733         (Parameters::incremental_update): New function.
2734         (set_parameters_incremental_full): New function.
2735         * parameters.h (Parameters::set_incremental_full): New function.
2736         (Parameters::incremental): New function.
2737         (Parameters::incremental_update): New function.
2738         (Parameters::incremental_mode_): New data member.
2739         (set_parameters_incremental_full): New function.
2740         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2741         incremental link mode.
2742         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2743         (Sized_relobj::do_relocate_sections): Likewise.
2744         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2745         option.
2746         * testsuite/Makefile.in: Regenerate.
2747         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2748
2749 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2750
2751         * script-sections.h (class Script_sections): Make
2752         Sections_elements typedef public.
2753         * script-sections.cc (class Sort_output_sections): Add elements_
2754         field.  Add constructor which sets it; change all callers.
2755         (Sort_output_sections::is_before): New function.
2756         (Sort_output_sections::operator()): Call is_before.
2757         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2758         conditional.
2759         * testsuite/script_test_10.sh: New test. Test script section
2760         order.
2761         * testsuite/script_test_10.t: Likewise.
2762         * testsuite/script_test_10.s: Likewise.
2763         * testsuite/Makefile.am: Wrap the cross linker tests and the
2764         common tests into NATIVE_OR_CROSS_LINKER.
2765         (check_SCRIPTS): Add script_test_10.sh.
2766         (check_DATA): Add script_test_10.stdout.
2767         (script_test_10.o, script_test_10): New targets.
2768         (script_test_10.stdout): New target.
2769         * configure, testsuite/Makefile.in: Regenerate.
2770
2771 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2772
2773         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2774         error for the deprecated relocations.
2775         (Target_arm::Scan::global): Likewise.
2776         (Target_arm::Relocate::relocate): Likewise.
2777
2778 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2779
2780         * fileread.cc (Input_file::find_file): Initialize *found_name
2781         and *namep when using the fallback search for case 4.
2782
2783 2010-10-11  Cary Coutant  <ccoutant@google.com>
2784
2785         * options.h (class General_options): Redefine -z lazy as an alias for
2786         the negation of -z now.
2787
2788 2010-10-11  Ian Lance Taylor  <iant@google.com>
2789
2790         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2791         binding.
2792
2793 2010-10-06  Nick Clifton  <nickc@redhat.com>
2794
2795         * script-sections.cc(class Memory_region): Remove
2796         current_lma_offset_ field.  Rename current_vma_offset_ to
2797         current_offset_.  Add last_section_ field.
2798         (Memory_region::get_current_vma_address): Rename to
2799         get_current_address.
2800         (Memory_region::get_current_lma_address): Delete.
2801         (Memory_region::increment_vma_offset): Rename to
2802         increment_offset.
2803         (Memory_region::increment_lma_offset): Delete.
2804         (Memory_region::attributes_compatible): New method.  Returns
2805         true if the provided section is compatible with the region.
2806         (Memory_region::get_last_section): New method.  Returns the last
2807         section to use the region.
2808         (Memory_region::set_last_section): New method.  Stores the last
2809         section to use the region.
2810         (Script_sections::block_in_region): New method.  Returns true if
2811         a block of memory is contained within a region.
2812         (Script_sections::find_memory_region): New method.  Locates a
2813         memory region to be used to set a VMA or LMA address.
2814         (Output_section_definition::set_section_addresses): Add code to
2815         check for addresses set by memory regions.
2816         (Output_segment::set_section_addresses): Remove memory region
2817         walking code.
2818         (Script_sections::create_segment): Add a warning if a header
2819         segment is created outside of any region.
2820         * script-sections.h (class Script_sections): Add prototypes for
2821         find_memory_region and block_in_region methods.
2822         * testsuite/memory_test.s: Use .long instead of .word.
2823         * testsuite/memory_test.t: Add some more output sections.
2824         * testsuite/memory_test.sh: Update expected output.
2825
2826 2010-10-02  Doug Kwan  <dougkwan@google.com>
2827
2828         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2829         defintion to symtab.h
2830         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2831         declaration to defintion.
2832
2833 2010-10-01  Nick Clifton  <nickc@redhat.com>
2834
2835         * expression.cc (eval): Replace dummy argument with NULL.
2836         (eval_maybe_dot): Check for a NULL result section pointer.
2837         (Symbol_expression::value): Likewise.
2838         (Dot_expression::value): Likewise.
2839         (BINARY_EXPRESSION): Likewise.
2840         (Max_expression::value): Likewise.
2841         (Min_expression::value): Likewise.
2842         (Absolute_expression::value): Likewise.
2843         (Addr_expression::value_from_output_section): Likewise.
2844         (Loaddddr_expression::value_from_output_section): Likewise.
2845         (Segment_start_expression::value): Likewise.
2846         * script-sections.cc
2847         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2848         argument with NULL.
2849         (Sections_elememt_dot_assignment::set_section_addresses):
2850         Likewise.
2851         (Output_data_expression::do_write_to_buffer): Likewise.
2852         (Output_section_definition::finalize_symbols): Likewise.
2853         (Output_section_definition::set_section_addresses): Likewise.
2854
2855 2010-09-30  Doug Kwan  <dougkwan@google.com>
2856
2857         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2858
2859 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2860
2861         * target.h (Target::can_icf_inline_merge_sections): New virtual
2862         function.
2863         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2864         virtual function.
2865         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2866         virtual function.
2867         * icf.cc (get_section_contents): Inline merge sections only when
2868         target allows it.
2869
2870 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2871
2872         * configure: Regenerate.
2873
2874 2010-09-17  Ian Lance Taylor  <iant@google.com>
2875
2876         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2877         * testsuite/Makefile.am (memory_test.o): New target.
2878         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2879         memory_test.t.
2880         * testsuite/Makefile.in: Rebuild.
2881
2882 2010-09-17  Doug Kwan  <dougkwan@google.com>
2883
2884         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2885         defintion if relocation uses GOT entries of the symbol.
2886         * testsuite/icf_safe_test.sh: Fix test.
2887         * testsuite/icf_safe_so_test.sh: Fix test.
2888
2889 2010-09-16  Cary Coutant  <ccoutant@google.com>
2890
2891         * script_sections.cc (class Memory_region): Remove "NULL" from
2892         vector initializations.
2893
2894 2010-09-15  Cary Coutant  <ccoutant@google.com>
2895
2896         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2897         Resolve forwarding symbols.
2898
2899 2010-09-15  Doug Kwan  <dougkwan@google.com>
2900
2901         * gold/testsuite/script_test_3.t: Add ARM special sections.
2902         * gold/testsuite/script_test_4.t: Same.
2903         * gold/testsuite/script_test_5.t: Same.
2904         * gold/testsuite/script_test_6.t: Same.
2905         * gold/testsuite/script_test_7.t: Same.
2906         * gold/testsuite/script_test_7.t: Same.
2907         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2908
2909 2010-09-14  Cary Coutant  <ccoutant@google.com>
2910
2911         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2912         (Target_x86_64::Relocate::relocate_tls): Replace check for
2913         saw_tls_block_reloc_ with test for executable section.
2914
2915 2010-09-12  Cary Coutant  <ccoutant@google.com>
2916
2917         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2918         position-independent executables to shared libraries need dynamic
2919         relocations.
2920         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2921         position-independent executables.
2922         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2923         * testsuite/Makefile.in: Regenerate.
2924
2925 2010-09-10  Nick Clifton  <nickc@redhat.com>
2926
2927         PR gold/11997
2928         * testsuite/memory_test.t: Discard any sections that are not
2929         needed.
2930
2931 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2932
2933         PR gold/11996
2934         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2935         "This::" to work around a bug in gcc 4.2.
2936
2937         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2938
2939 2010-09-09  Rafael Espindola  <espindola@google.com>
2940
2941         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2942         sections with different PF_X flags in the same segment.
2943         (Layout::find_first_load_seg): Search all segments to find the first
2944         one.
2945         * options.h (rosegment): New.
2946
2947 2010-09-08  Rafael Espindola  <espindola@google.com>
2948
2949         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2950
2951 2010-09-08  Doug Kwan  <dougkwan@google.com>
2952
2953         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2954         (Arm_relobj::do_relocate_sections): Add new parameter for output
2955         file to match the parent.
2956         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2957         of local symbols instead of input values.  Update code to track
2958         changes in gold::relocate_section.
2959         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2960         (Sized_relobj::compute_final_local_value_internal): New methods.
2961         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2962         body into private version of Sized_relobj::compute_final_local_value.
2963         Call the inline method.
2964         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2965         merged symbol value if there is one.
2966         (Symbol_value::has_output_value): New method defintiion.
2967         (Sized_relobj::Compute_final_local_value_status): New enum type.
2968         (Sized_relobj::compute_final_local_value): New methods.
2969         (Sized_relobj::compute_final_local_value_internal): New methods.
2970         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2971         and arm_cortex_a8.sh.
2972         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2973         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2974         New tests.
2975         * Makefile.in: Regenerate.
2976         * testsuite/arm_bl_out_of_range.s: Update test.
2977         * testsuite/thumb_bl_out_of_range.s: Ditto.
2978         * testsuite/thumb_blx_out_of_range.s: Ditto.
2979         * testsuite/arm_branch_out_of_range.sh: New file.
2980         * testsuite/arm_cortex_a8.sh: Ditto.
2981         * testsuite/arm_cortex_a8_b.s: Ditto.
2982         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2983         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2984         * testsuite/arm_cortex_a8_bl.s: Ditto.
2985         * testsuite/arm_cortex_a8_blx.s: Ditto.
2986         * testsuite/arm_cortex_a8_local.s: Ditto.
2987         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2988         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2989
2990 2010-09-08  Rafael Espindola  <espindola@google.com>
2991
2992         * Makefile.am (memory_test.stdout): Run readelf with -W.
2993         * Makefile.in: Regenerate.
2994         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2995         64 bit output.
2996
2997 2010-09-08  Rafael Espindola  <espindola@google.com>
2998
2999         * script-sections.cc (Script_sections::add_memory_region): Convert
3000         field precision to int.
3001         * script.cc (script_set_section_region, script_set_section_region):
3002         Convert field precision to int.
3003
3004 2010-09-08  Rafael Espindola  <espindola@google.com>
3005
3006         * arm.cc (do_finalize_sections): Create the __exidx_start and
3007         __exdix_end symbols even when the section is missing.
3008
3009 2010-09-08  Nick Clifton  <nickc@redhat.com>
3010
3011         * README: Remove claim that MEMORY is not supported.
3012         * expression.cc (script_exp_function_origin)
3013         (script_exp_function_length): Move from here to ...
3014         * script.cc: ... here.
3015         (script_set_section_region, script_add_memory)
3016         (script_parse_memory_attr, script_include_directive): New
3017         functions.
3018         * script-sections.cc
3019         (class Memory_region): New class.
3020         (class Output_section_definition): Add set_memory_region,
3021         set_section_vma, set_section_lma and get_section_name methods.
3022         (class Script_Sections): Add add_memory_region,
3023         find_memory_region, find_memory_region_origin,
3024         find_memory_region_length and set_memory_region methods.
3025         Have set_section_addresses method walk the list of set memory
3026         regions.
3027         Extend the print methos to display memory regions.
3028         * script-sections.h: Add prototypes for new methods.
3029         Add enum for MEMORY region attributes.
3030         * yyscript.y: Add support for parsing MEMORY regions.
3031         * script-c.h: Add prototypes for new functions.
3032         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3033         * testsuite/Makefile.in: Regenerate.
3034         * testsuite/memory_test.sh: New script.
3035         * testsuite/memory_test.s: New assembler source file.
3036         * testsuite/memory_test.t: New linker script.
3037
3038 2010-08-27  Doug Kwan  <dougkwan@google.com>
3039
3040         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3041         reference override an existing dynamic weak reference.
3042         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3043         * testsuite/Makefile.in: Regenerate.
3044         * testsuite/dyn_weak_ref.sh: New file.
3045         * testsuite/dyn_weak_ref_1.c: Ditto.
3046         * testsuite/dyn_weak_ref_2.c: Ditto.
3047
3048 2010-08-27  Ian Lance Taylor  <iant@google.com>
3049
3050         * incremental.h (class Incremental_input_entry): Add virtual
3051         destructor.
3052
3053 2010-08-27  Ian Lance Taylor  <iant@google.com>
3054
3055         * testsuite/start_lib_test_3.c: Mark t3 as used.
3056
3057 2010-08-27  Nick Clifton  <nickc@redhat.com>
3058
3059         * options.cc (version_script): Fix small typo in previous
3060         whitespace tidyup.
3061
3062 2010-08-25  Nick Clifton  <nickc@redhat.com>
3063
3064         * archive.cc: Formatting fixes: Remove whitespace between
3065         typename and following asterisk.  Remove whitespace between
3066         function name and opening parenthesis.
3067         * archive.h: Likewise.
3068         * arm.cc: Likewise.
3069         * attributes.cc: Likewise.
3070         * attributes.h: Likewise.
3071         * common.cc: Likewise.
3072         * copy-relocs.cc: Likewise.
3073         * dirsearch.h: Likewise.
3074         * dynobj.cc: Likewise.
3075         * ehframe.cc: Likewise.
3076         * ehframe.h: Likewise.
3077         * expression.cc: Likewise.
3078         * fileread.cc: Likewise.
3079         * fileread.h: Likewise.
3080         * gc.h: Likewise.
3081         * gold-threads.cc: Likewise.
3082         * gold.cc: Likewise.
3083         * i386.cc: Likewise.
3084         * icf.h: Likewise.
3085         * incremental-dump.cc: Likewise.
3086         * incremental.cc: Likewise.
3087         * layout.cc: Likewise.
3088         * layout.h: Likewise.
3089         * main.cc: Likewise.
3090         * merge.cc: Likewise.
3091         * merge.h: Likewise.
3092         * object.cc: Likewise.
3093         * object.h: Likewise.
3094         * options.cc: Likewise.
3095         * options.h: Likewise.
3096         * output.cc: Likewise.
3097         * output.h: Likewise.
3098         * plugin.cc: Likewise.
3099         * plugin.h: Likewise.
3100         * powerpc.cc: Likewise.
3101         * reloc.cc: Likewise.
3102         * script-c.h: Likewise.
3103         * script-sections.cc: Likewise.
3104         * script.cc: Likewise.
3105         * stringpool.cc: Likewise.
3106         * symtab.cc: Likewise.
3107         * symtab.h: Likewise.
3108         * target.cc: Likewise.
3109         * timer.cc: Likewise.
3110         * timer.h: Likewise.
3111         * version.cc: Likewise.
3112         * x86_64.cc: Likewise.
3113
3114 2010-08-24  Nick Clifton  <nickc@redhat.com>
3115
3116         PR 11899
3117         * layout.cc (segment_precedes): Sort segments by their physical
3118         addresses, if they have been set.
3119
3120 2010-08-23  Cary Coutant  <ccoutant@google.com>
3121
3122         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3123         symbols data.
3124         (Lib_group::include_member): Unlock object after deleting its
3125         symbols data.
3126         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3127         the bug fixed here.
3128
3129 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3130             Cary Coutant  <ccoutant@google.com>
3131
3132         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3133         constructor, and set_blocker.
3134         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3135         readsyms_blocker_.
3136         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3137         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3138         * testsuite/Makefile.am (start_lib_test): New test case.
3139         * testsuite/Makefile.in: Regenerate.
3140         * testsuite/start_lib_test_main.c: New file.
3141         * testsuite/start_lib_test_1.c: New file.
3142         * testsuite/start_lib_test_2.c: New file.
3143         * testsuite/start_lib_test_3.c: New file.
3144
3145 2010-08-19  Ian Lance Taylor  <iant@google.com>
3146
3147         * Makefile.in: Rebuild with automake 1.11.1.
3148         * aclocal.m4: Likewise.
3149         * testsuite/Makefile.in: Likewise.
3150
3151 2010-08-19  Ian Lance Taylor  <iant@google.com>
3152
3153         PR 10893
3154         * i386.cc (class Output_data_plt_i386): Update declarations.
3155         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3156         local_ifuncs_ fields.
3157         (Target_i386::do_plt_section_for_global): New function.
3158         (Target_i386::do_plt_section_for_local): New function.
3159         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3160         parameter; change all callers.  Initialize global_ifuncs_ and
3161         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3162         __rel_iplt_end.
3163         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3164         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3165         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3166         symbols.
3167         (Target_i386::make_plt_section): New function, broken out of
3168         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3169         (Target_i386::make_plt_entry): Call make_plt_section.
3170         (Target_i386::make_local_ifunc_plt_entry): New function.
3171         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3172         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3173         R_386_IRELATIVE to switch.
3174         (Target_i386::Scan::global): Likewise.
3175         (Target_i386::Relocate::relocate): Likewise.
3176         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3177         switch.
3178         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3179         (Target_x86_64::do_plt_section_for_global): New function.
3180         (Target_x86_64::do_plt_section_for_local): New function.
3181         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3182         parameter; change all callers.  If doing a static link define
3183         __rela_iplt_start and __rela_iplt_end.
3184         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3185         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3186         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3187         to point to .plt.
3188         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3189         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3190         switch.
3191         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3192         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3193         R_X86_64_IRELATIVE to switch.
3194         (Target_x86_64::Scan::global): Likewise.
3195         (Target_x86_64::Relocate::relocate): Likewise.
3196         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3197         switch.
3198         * target.h (class Target): Add plt_section_for_global and
3199         plt_section_for_local functions.  Add do_plt_section_for_global
3200         and do_plt_section_for_local virtual functions.
3201         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3202         clarifying comments.
3203         (Symbol::use_plt_offset): Handle IFUNC symbol.
3204         * object.cc (Sized_relobj::Sized_relobj): Initialize
3205         local_plt_offsets_.
3206         (Sized_relobj::local_has_plt_offset): New function.
3207         (Sized_relobj::local_plt_offset): New function.
3208         (Sized_relobj::set_local_plt_offset): New function.
3209         (Sized_relobj::do_count): Handle IFUNC symbol.
3210         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3211         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3212         is_ifunc_symbol functions.
3213         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3214         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3215         local_plt_offsets_ field.
3216         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3217         * output.h (class Output_section_data): Add non-const
3218         output_section function.
3219         (class Output_data_got): Update declarations.
3220         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3221         Add use_plt_offset parameter to global and local constructors.
3222         Change all callers.  Change local_sym_index_ field to 31 bits.
3223         Change GSYM_CODE and CONSTANT_CODE accordingly.
3224         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3225         doing a static link don't set sh_link field.
3226         (Output_data_got::Got_entry::write): Use PLT offset if
3227         appropriate.
3228         (Output_data_got::add_global_plt): New function.
3229         (Output_data_got::add_local_plt): New function.
3230         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3231         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3232         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3233         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3234         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3235         IFUNC conditional.
3236         * testsuite/ifunc-sel.h: New file.
3237         * testsuite/ifuncmain1.c: New file.
3238         * testsuite/ifuncmain1vis.c: New file.
3239         * testsuite/ifuncmod1.c: New file.
3240         * testsuite/ifuncdep2.c: New file.
3241         * testsuite/ifuncmain2.c: New file.
3242         * testsuite/ifuncmain3.c: New file.
3243         * testsuite/ifuncmod3.c: New file.
3244         * testsuite/ifuncmain4.c: New file.
3245         * testsuite/ifuncmain5.c: New file.
3246         * testsuite/ifuncmod5.c: New file.
3247         * testsuite/ifuncmain6pie.c: New file.
3248         * testsuite/ifuncmod6.c: New file.
3249         * testsuite/ifuncmain7.c: New file.
3250         * configure, testsuite/Makefile.in: Rebuild.
3251
3252 2010-08-18  Ian Lance Taylor  <iant@google.com>
3253
3254         * incremental.cc
3255         (Output_section_incremental_inputs::write_input_files): Add cast
3256         to avoid signed/unsigned comparison warning.
3257         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3258
3259 2010-08-12  Cary Coutant  <ccoutant@google.com>
3260
3261         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3262
3263 2010-08-13  Ian Lance Taylor  <iant@google.com>
3264
3265         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3266
3267 2010-08-12  Cary Coutant  <ccoutant@google.com>
3268             Doug Kwan  <dougkwan@google.com>
3269
3270         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3271         defintion overrides non-weak undef, remember that the original undef
3272         is not weak.
3273         * symtab.cc (Symbol_table::sized_write_global): For undef without
3274         an original weak binding, set binding to global in output.
3275         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3276         * testsuite/Makefile.in: Regenerate.
3277         * testsuite/strong_ref_weak_def.sh: New file.
3278         * testsuite/strong_ref_weak_def_1.c: Ditto.
3279         * testsuite/strong_ref_weak_def_2.c: Ditto.
3280
3281 2010-08-12  Cary Coutant  <ccoutant@google.com>
3282
3283         * testsuite/incremental_test.sh: Rewrite.
3284         * testsuite/incremental_test_1.c: Rewrite.
3285         * testsuite/incremental_test_2.c: Rewrite.
3286
3287 2010-08-12  Cary Coutant  <ccoutant@google.com>
3288
3289         * arm.cc (Target_arm::got_size): Add const.
3290         (Target_arm::got_entry_count): New function.
3291         (Target_arm::plt_entry_count): New function.
3292         (Target_arm::first_plt_entry_offset): New function.
3293         (Target_arm::plt_entry_size): New function.
3294         (Output_data_plt_arm::entry_count): New function.
3295         (Output_data_plt_arm::first_plt_entry_offset): New function.
3296         (Output_data_plt_arm::get_plt_entry_size): New function.
3297         * i386.cc (Target_i386::got_size): Add const.
3298         (Target_i386::got_entry_count): New function.
3299         (Target_i386::plt_entry_count): New function.
3300         (Target_i386::first_plt_entry_offset): New function.
3301         (Target_i386::plt_entry_size): New function.
3302         (Output_data_plt_i386::entry_count): New function.
3303         (Output_data_plt_i386::first_plt_entry_offset): New function.
3304         (Output_data_plt_i386::get_plt_entry_size): New function.
3305         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3306         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3307         * incremental.cc: Include target.h.
3308         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3309         parameter.  Adjust all callers.  Find incremental_got_plt section.
3310         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3311         section.
3312         (Output_section_incremental_inputs::set_final_data_size): Calculate
3313         size of incremental_got_plt section.
3314         (Output_section_incremental_inputs::do_write): Write the
3315         incremental_got_plt section.
3316         (Got_plt_view_info): New struct.
3317         (Local_got_offset_visitor): New class.
3318         (Global_got_offset_visitor): New class.
3319         (Global_symbol_visitor_got_plt): New class.
3320         (Output_section_incremental_inputs::write_got_plt): New function.
3321         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3322         Add parameter.  Adjust all callers.
3323         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3324         (Incremental_inputs::got_plt_section): New function.
3325         (Incremental_inputs::got_plt_section_): New data member.
3326         (Incremental_got_plt_reader): New class.
3327         * layout.cc (Layout::create_incremental_info_sections): Add the
3328         incremental_got_plt section.
3329         * object.h (Got_offset_list::get_list): New function.
3330         (Got offset_list::for_all_got_offsets): New function.
3331         (Sized_relobj::local_got_offset_list): New function.
3332         * powerpc.cc (Target_powerpc::got_size): Add const.
3333         (Target_powerpc::got_entry_count): New function.
3334         (Target_powerpc::plt_entry_count): New function.
3335         (Target_powerpc::first_plt_entry_offset): New function.
3336         (Target_powerpc::plt_entry_size): New function.
3337         (Output_data_plt_powerpc::entry_count): New function.
3338         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3339         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3340         * sparc.cc (Target_sparc::got_size): Add const.
3341         (Target_sparc::got_entry_count): New function.
3342         (Target_sparc::plt_entry_count): New function.
3343         (Target_sparc::first_plt_entry_offset): New function.
3344         (Target_sparc::plt_entry_size): New function.
3345         (Output_data_plt_sparc::entry_count): New function.
3346         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3347         (Output_data_plt_sparc::get_plt_entry_size): New function.
3348         * symtab.h (Symbol::got_offset_list): New function.
3349         (Symbol_table::for_all_symbols): New function.
3350         * target.h (Sized_target::got_entry_count): New function.
3351         (Sized_target::plt_entry_count): New function.
3352         (Sized_target::plt_entry_size): New function.
3353         * x86_64.cc (Target_x86_64::got_size): Add const.
3354         (Target_x86_64::got_entry_count): New function.
3355         (Target_x86_64::plt_entry_count): New function.
3356         (Target_x86_64::first_plt_entry_offset): New function.
3357         (Target_x86_64::plt_entry_size): New function.
3358         (Output_data_plt_x86_64::entry_count): New function.
3359         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3360         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3361
3362 2010-08-12  Cary Coutant  <ccoutant@google.com>
3363
3364         * archive.cc: Include incremental.h.
3365         (Archive::Archive): Initialize incremental_info_.
3366         (Archive::include_member): Record archive members in incremental info.
3367         (Add_archive_symbols::run): Record begin and end of an archive in
3368         incremental info.
3369         (Lib_group::include_member): Record objects in incremental info.
3370         * archive.h (Incremental_archive_entry): Forward declaration.
3371         (Archive::set_incremental_info): New member function.
3372         (Archive::incremental_info): New member function.
3373         (Archive::Unused_symbol_iterator): New class.
3374         (Archive::unused_symbols_begin): New member function.
3375         (Archive::unused_symbols_end): New member function.
3376         (Archive::incremental_info_): New data member.
3377         * incremental-dump.cc (find_input_containing_global): New function.
3378         (dump_incremental_inputs): Dump new incremental info sections.
3379         * incremental.cc: Include symtab.h.
3380         (Output_section_incremental_inputs): New class.
3381         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3382         new incremental info sections.
3383         (Sized_incremental_binary::do_check_inputs): Likewise.
3384         (Incremental_inputs::report_archive): Remove.
3385         (Incremental_inputs::report_archive_begin): New function.
3386         (Incremental_inputs::report_archive_end): New function.
3387         (Incremental_inputs::report_object): New function.
3388         (Incremental_inputs::finalize_inputs): Remove.
3389         (Incremental_inputs::report_input_section): New function.
3390         (Incremental_inputs::report_script): Rewrite.
3391         (Incremental_inputs::finalize): Do nothing but finalize string table.
3392         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3393         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3394         (Incremental_inputs::create_data_sections): New function.
3395         (Incremental_inputs::relocs_entsize): New function.
3396         (Output_section_incremental_inputs::set_final_data_size): New function.
3397         (Output_section_incremental_inputs::do_write): New function.
3398         (Output_section_incremental_inputs::write_header): New function.
3399         (Output_section_incremental_inputs::write_input_files): New function.
3400         (Output_section_incremental_inputs::write_info_blocks): New function.
3401         (Output_section_incremental_inputs::write_symtab): New function.
3402         * incremental.h (Incremental_script_entry): Forward declaration.
3403         (Incremental_object_entry): Forward declaration.
3404         (Incremental_archive_entry): Forward declaration.
3405         (Incremental_inputs): Forward declaration.
3406         (Incremental_inputs_header_data): Remove.
3407         (Incremental_inputs_header): Remove.
3408         (Incremental_inputs_header_write): Remove.
3409         (Incremental_inputs_entry_data): Remove.
3410         (Incremental_inputs_entry): Remove.
3411         (Incremental_inputs_entry_write): Remove.
3412         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3413         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3414         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3415         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3416         Likewise.
3417         (Incremental_input_entry): New class.
3418         (Incremental_script_entry): New class.
3419         (Incremental_object_entry): New class.
3420         (Incremental_archive_entry): New class.
3421         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3422         (Incremental_inputs::report_inputs): Remove.
3423         (Incremental_inputs::report_archive): Remove.
3424         (Incremental_inputs::report_archive_begin): New function.
3425         (Incremental_inputs::report_archive_end): New function.
3426         (Incremental_inputs::report_object): Change prototype.
3427         (Incremental_inputs::report_input_section): New function.
3428         (Incremental_inputs::report_script): Change prototype.
3429         (Incremental_inputs::get_reloc_count): New function.
3430         (Incremental_inputs::set_reloc_count): New function.
3431         (Incremental_inputs::create_data_sections): New function.
3432         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3433         (Incremental_inputs::inputs_section): New function.
3434         (Incremental_inputs::symtab_section): New function.
3435         (Incremental_inputs::relocs_section): New function.
3436         (Incremental_inputs::get_stringpool): Add const.
3437         (Incremental_inputs::command_line): Add const.
3438         (Incremental_inputs::inputs): Remove.
3439         (Incremental_inputs::command_line_key): New function.
3440         (Incremental_inputs::input_file_count): New function.
3441         (Incremental_inputs::input_files): New function.
3442         (Incremental_inputs::relocs_entsize): New function.
3443         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3444         (Incremental_inputs::finalize_inputs): Remove.
3445         (Incremental_inputs::Input_info): Remove.
3446         (Incremental_inputs::lock_): Remove.
3447         (Incremental_inputs::inputs_): Change type.
3448         (Incremental_inputs::inputs_map_): Remove.
3449         (Incremental_inputs::current_object_entry_): New data member.
3450         (Incremental_inputs::inputs_section_): New data member.
3451         (Incremental_inputs::symtab_section_): New data member.
3452         (Incremental_inputs::relocs_section_): New data member.
3453         (Incremental_inputs::reloc_count_): New data member.
3454         (Incremental_inputs_reader): New class.
3455         (Incremental_symtab_reader): New class.
3456         (Incremental_relocs_reader): New class.
3457         * layout.cc (Layout::finalize): Move finalization of incremental info
3458         and creation of incremental info sections to follow finalization of
3459         symbol table.  Set offsets for postprocessing sections.
3460         (Layout::create_incremental_info_sections): Call
3461         Incremental_inputs::create_data_sections.  Add incremental symtab
3462         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3463         sections to layout after input sections.
3464         * layout.h (struct Timespec): Forward declaration.
3465         (Layout::incremental_inputs): Add const.
3466         (Layout::create_incremental_info_sections): Add parameter.
3467         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3468         * object.cc: Include incremental.h.
3469         (Relobj::finalize_incremental_relocs): New function.
3470         (Sized_relobj::do_layout): Record input sections in incremental info.
3471         * object.h (Object::output_section): New function.
3472         (Object::output_section_offset): Moved from Relobj.
3473         (Object::get_incremental_reloc_base): New function.
3474         (Object::get_incremental_reloc_count): New function.
3475         (Object::do_output_section): New function.
3476         (Object::do_output_section_offset): Moved from Relobj.
3477         (Object::do_get_incremental_reloc_base): New function.
3478         (Object::do_get_incremental_reloc_count): New function.
3479         (Object::Object): Initialize new data members.
3480         (Relobj::output_section): Renamed do_output_section and moved to
3481         protected.
3482         (Relobj::output_section_offset): Moved to Object.
3483         (Relobj::do_get_incremental_reloc_base): New function.
3484         (Relobj::do_get_incremental_reloc_count): New function.
3485         (Relobj::allocate_incremental_reloc_counts): New function.
3486         (Relobj::count_incremental_reloc): New function.
3487         (Relobj::finalize_incremental_relocs): New function.
3488         (Relobj::next_incremental_reloc_index): New function.
3489         (Relobj::reloc_counts_): New data member.
3490         (Relobj::reloc_bases_): New data member.
3491         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3492         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3493         (Sized_relobj::incremental_relocs_scan): New function.
3494         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3495         (Sized_relobj::incremental_relocs_write): New function.
3496         (Sized_relobj::incremental_relocs_write_reltype): New function.
3497         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3498         incremental link.
3499         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3500         archives and object files elsewhere.
3501         (Add_symbols::run): Report object files here.
3502         (Finish_group::run): Report end of archive at end of group.
3503         * reloc.cc: Include layout.h, incremental.h.
3504         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3505         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3506         (Sized_relobj::incremental_relocs_scan): New function.
3507         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3508         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3509         (Sized_relobj::incremental_relocs_write): New function.
3510         (Sized_relobj::incremental_relocs_write_reltype): New function.
3511         * script.cc (read_input_script): Rewrite test for incremental link.
3512         Change call to Incremental_inputs::report_script.
3513         * symtab.h (Symbol_table::first_global_index): New function.
3514         (Symbol_table::output_count): New function.
3515
3516 2010-08-12  Doug Kwan  <dougkwan@google.com>
3517
3518         * arm.cc (Target_arm::merge_object_attributes): Check command line
3519         options --no-wchar-size-warning and --no-enum-size-warning.
3520         * options.h (General_options): Add ld-compatible options
3521         --no-enum-size-warning and --no-wchar-size-warning.
3522
3523 2010-08-04  Ian Lance Taylor  <iant@google.com>
3524
3525         * x86_64.cc (Target_x86_64::Scan::local): Use
3526         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3527         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3528         (Target_x86_64::Scan::global): Likewise.
3529         (Target_x86_64::Relocate::relocate): Likewise.
3530         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3531         Likewise.
3532
3533 2010-08-03  Cary Coutant  <ccoutant@google.com>
3534
3535         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3536         to reserve space in merged_strings vector. Keep total input size
3537         for stats.
3538         (Output_merge_string::do_print_merge_stats): Print total input size.
3539         * merge.h (Output_merge_string): Add input_size_ field.
3540         * stringpool.cc (Stringpool_template::string_length): Move
3541         implementations out of Stringpool_template class and place in
3542         stringpool.h.
3543         * stringpool.h (string_length): Move out of Stringpool_template.
3544
3545 2010-08-03  Ian Lance Taylor  <iant@google.com>
3546
3547         PR 11712
3548         * layout.cc (relaxation_loop_body): If address of load segment is
3549         set, adjust address to include headers if possible.
3550
3551 2010-08-03  Ian Lance Taylor  <iant@google.com>
3552
3553         * version.cc (version_string): Bump to 1.10.
3554
3555 2010-08-03  Ian Lance Taylor  <iant@google.com>
3556
3557         PR 11805
3558         * layout.h (enum Output_section_order): Define.
3559         (class Layout): Update declarations.
3560         * layout.cc (Layout::get_output_section): Add order parameter.
3561         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3562         is_first_non_relro parameters.  Change all callers.
3563         (Layout::choose_output_section): Likewise.
3564         (Layout::add_output_section_data): Likewise.
3565         (Layout::make_output_section): Likewise.  Set order.
3566         (Layout::default_section_order): New function.
3567         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3568         * output.cc (Output_section::Output_section): Initialize order_.
3569         Don't initialize deleted fields.
3570         (Output_segment::Output_segment): Don't initialize deleted
3571         fields.
3572         (Output_segment::add_output_section_to_load): New function
3573         replacing add_output_section.  Change all callers to call this or
3574         add_output_section_to_nonload.
3575         (Output_segment::add_output_section_to_nonload): New function.
3576         (Output_segment::remove_output_section): Rewrite.
3577         (Output_segment::add_initial_output_data): Likewise.
3578         (Output_segment::has_any_data_sections): Likewise.
3579         (Output_segment::is_first_section_relro): Likewise.
3580         (Output_segment::maximum_alignment): Likewise.
3581         (Output_segment::has_dynamic_reloc): New function replacing
3582         dynamic_reloc_count.  Change all callers.
3583         (Output_segment::has_dynamic_reloc_list): New function replacing
3584         dynamic_reloc_count_list.  Change all callers.
3585         (Output_segment::set_section_addresses): Rewrite.
3586         (Output_segment::set_offset): Rewrite.
3587         (Output_segment::find_first_and_last_list): Remove.
3588         (Output_segment::set_tls_offsets): Rewrite.
3589         (Output_segment::first_section_load_address): Likewise.
3590         (Output_segment::output_section_count): Likewise.
3591         (Output_segment::section_with_lowest_load_address): Likewise.
3592         (Output_segment::write_section_headers): Likewise.
3593         (Output_segment::print_sections_to_map): Likewise.
3594         * output.h (class Output_data): Remove dynamic_reloc_count_
3595         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3596         (Output_data::add_dynamic_reloc): Rewrite.
3597         (Output_data::has_dynamic_reloc): New function.
3598         (Output_data::dynamic_reloc_count): Remove.
3599         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3600         is_last_relro_, is_first_non_relro_, is_interp_,
3601         is_dynamic_linker_section_ fields.  Add order and set_order
3602         functions.  Remove is_relro_local, set_is_relro_local,
3603         is_last_relro, set_is_last_relro, is_first_non_relro,
3604         set_is_first_non_relro functions, is_interp, set_is_interp,
3605         is_dynamic_linker_section, and set_is_dynamic_linker_section
3606         functions.
3607         (class Output_segment): Change Output_data_list from std::list to
3608         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3609         output_bss_ fields.  Update declarations.
3610
3611 2010-08-02  Ian Lance Taylor  <iant@google.com>
3612
3613         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3614         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3615         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3616
3617 2010-08-02  Ian Lance Taylor  <iant@google.com>
3618
3619         PR 11855
3620         * script.cc (Script_options::Script_options): Initialize
3621         symbol_definitions_ and symbol_references_.
3622         (Script_options::add_symbol_assignment): Update
3623         symbol_definitions_ and symbol_references_.
3624         (Script_options::add_symbol_reference): New function.
3625         (script_symbol): New function.
3626         * script.h (class Script_options): Add symbol_definitions_ and
3627         symbol_references_ fields.
3628         (Script_options::referenced_const_iterator): New type.
3629         (Script_options::referenced_begin): New function.
3630         (Script_options::referenced_end): New function.
3631         (Script_options::is_referenced): New function.
3632         (Script_options::any_unreferenced): New function.
3633         * script-c.h (script_symbol): Declare.
3634         * yyscript.y (exp): Call script_symbol.
3635         * symtab.cc: Include "script.h".
3636         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3637         Change all callers.  Check symbols referenced by scripts.
3638         (Symbol_table::add_undefined_symbols_from_command_line): Add
3639         layout parameter.  Change all callers.
3640         (Symbol_table::do_add_undefined_symbols_from_command_line):
3641         Likewise.  Break out loop body.  Check symbols referenced by
3642         scripts.
3643         (Symbol_table::add_undefined_symbol_from_command_line): New
3644         function broken out of
3645         do_add_undefined_symbols_from_command_line.
3646         * symtab.h (class Symbol_table): Update declarations.
3647         * archive.cc: Include "layout.h".
3648         (Archive::should_include_member): Add layout parameter.  Change
3649         all callers.  Check for symbol mentioned in expression.
3650         * archive.h (class Archive): Update declaration.
3651         * object.cc (Sized_relobj::do_should_include_member): Add layout
3652         parameter.
3653         * object.h (Object::should_include_member): Add layout parameter.
3654         Change all callers.
3655         (Object::do_should_include_member): Add layout parameter.
3656         (class Sized_relobj): Update declaration.
3657         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3658         parameter.
3659         * dynobj.h (class Sized_dynobj): Update declaration.
3660         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3661         layout parameter.
3662         * plugin.h (class Sized_pluginobj): Update declaration.
3663
3664 2010-08-02  Ian Lance Taylor  <iant@google.com>
3665
3666         PR 11866
3667         * output.cc (Output_segment::set_offset): Search for the first and
3668         last sections rather than assuming that the list is in order.
3669         (Output_segment::find_first_and_last_list): New function.
3670         * output.h (class Output_segment): Update declarations.
3671         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3672         (relro_strip_test_SOURCES): New variable.
3673         (relro_strip_test_DEPENDENCIES): New variable.
3674         (relro_strip_test_LDFLAGS): New variable.
3675         (relro_strip_test_LDADD): New variable.
3676         (relro_strip_test.so): New target.
3677
3678 2010-08-02  Ian Lance Taylor  <iant@google.com>
3679
3680         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3681         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3682         (Target_i386::got_tlsdesc_section): New function.
3683         (Target_i386::got_section): Create space for GOT entries for
3684         TLSDESC relocations.
3685         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3686         R_386_TLS_GOTDESC.
3687         (Target_i386::Scan::global): Likewise.
3688         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3689         using TLSDESC GOT.
3690         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3691         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3692         (Target_x86_64::got_tlsdesc_section): New function.
3693         (Target_x86_64::got_section): Create space for GOT entries for
3694         TLSDESC relocations.
3695         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3696         R_386_TLS_GOTDESC.
3697         (Target_x86_64::Scan::global): Likewise.
3698         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3699         using TLSDESC GOT.
3700
3701 2010-08-02  Ian Lance Taylor  <iant@google.com>
3702
3703         * testsuite/final_layout.sh: Use dc to convert from hex to
3704         decimal.
3705
3706 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3707
3708         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3709         paramter to the call to gold::gc_process_relocs.
3710         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3711         paramter to the call to gold::gc_process_relocs.
3712         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3713         parameter to the call to gold::gc_process_relocs.
3714         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3715         template parameter to the call to gold::gc_process_relocs.
3716         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3717         paramter to the call to gold::gc_process_relocs.
3718         * gc.h (get_embedded_addend_size): New function.
3719         (gc_process_relocs): Save the size of the reloc for use by ICF.
3720         * icf.cc (get_section_contents): Get the addend from the text section
3721         for SHT_REL relocation sections.
3722         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3723         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3724         * int_encoding.h (read_from_pointer): New overloaded function.
3725         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3726         * testsuite/icf_sht_rel_addend_test.sh: New file.
3727         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3728         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3729
3730 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3731
3732         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3733         * Makefile.in: Regenerate.
3734         * testsuite/Makefile.in: Regenerate.
3735
3736 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3737
3738         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3739         * gold/testsuite/debug_msg.cc: Likewise.
3740         * gold/testsuite/odr_violation1.cc
3741         * gold/testsuite/odr_violation2.cc
3742
3743 2010-07-21  Cary Coutant  <ccoutant@google.com>
3744
3745         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3746         string, and length fields.
3747         (Output_merge_string::Merged_strings_list): New type.
3748         (Output_merge_string::Merged_strings_lists): New typedef.
3749         (Output_merge_string): Replace merged_strings_ with
3750         merged_strings_lists_.
3751         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3752         Merged_strings_list per input object and section.  Don't store pointer
3753         to the string.  Don't store length with each merged string entry.
3754         (Output_merge_string::finalize_merged_data): Loop over list of merged
3755         strings lists.  Recompute length of each merged string.
3756
3757 2010-07-15  Cary Coutant  <ccoutant@google.com>
3758
3759         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3760         here.
3761
3762 2010-07-14  Ian Lance Taylor  <iant@google.com>
3763
3764         * descriptors.cc (Descriptors::open): Report correct name in error
3765         message.
3766
3767 2010-07-13  Doug Kwan  <dougkwan@google.com>
3768
3769         * arm.cc (Arm_input_section::Arm_input_section): For a
3770         SHT_ARM_EXIDX section, always keeps the input sections.
3771         (Arm_input_section::set_exidx_section_link): New method.
3772         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3773         has_errors_ to false.
3774         (Arm_exidx_input_section::has_errors,
3775         Arm_exidx_input_section::set_has_errors): New methods.
3776         (Arm_exidx_input_section::has_errors_): New data member.
3777         (Arm_relobj::get_exidx_shndx_list): New method.
3778         (Arm_output_section::append_text_sections_to_list): Do not skip
3779         section without SHF_EXECINSTR.
3780         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3781         errors.
3782         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3783         section header.  Make error messages more verbose.  Check for
3784         a non-executable section linked to an EXIDX section.
3785         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3786         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3787         check that there is no deferred EXIDX section if we exit early.
3788         Instead of not making an EXIDX section in case of an error, make one
3789         and set the has_errors flag of it.
3790         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3791         in a relocatable link.
3792         (Target_arm::do_relax): Look for the EXIDX output section instead of
3793         assuming that it is called .ARM.exidx.
3794         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3795         section list.  Do not check for SHF_EXECINSTR section flags but
3796         skip any input section with errors.
3797         * output.cc (Output_section::Output_section): Initialize
3798         always_keeps_input_sections_ to false.
3799         (Output_section::add_input_section): Check for
3800         always_keeps_input_sections_.
3801         *  output.h (Output_section::always_keeps_input_sections,
3802         Output_section::set_always_keeps_input_sections): New methods.
3803         (Output_section::always_keeps_input_sections): New data member.
3804
3805 2010-07-13  Rafael Espindola  <espindola@google.com>
3806
3807         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3808         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3809
3810 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3811             Ian Lance Taylor  <iant@google.com>
3812
3813         * output.h (Output_section_lookup_maps::add_merge_section):
3814         Correct check of whether value was inserted.
3815         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3816         (Output_section_lookup_maps::add_relaxed_input_section):
3817         Likewise.
3818         * arm.cc (Target_arm::got_section): Remove used local os.
3819         * i386.cc (Target_i386::got_section): Likewise.
3820         * x86_64.cc (Target_x86_64::got_section): Likewise.
3821         * sparc.cc (Target_sparc::got_section): Likewise.
3822         (Target_sparc::relocate): Remove unused local have_got_offset.
3823         * powerpc.cc (Target_powerpc::relocate): Likewise.
3824
3825 2010-07-13  Ian Lance Taylor  <iant@google.com>
3826
3827         * compressed_output.cc (zlib_decompress): Fix signature in
3828         !HAVE_ZLIB_H case.
3829
3830         * archive.cc (Archive::include_member): Unlock an external member
3831         of a thin archive.  Don't bother to delete an object we know is
3832         NULL.
3833
3834 2010-07-12  Cary Coutant  <ccoutant@google.com>
3835
3836         * compressed_output.cc (zlib_decompress): New function.
3837         (get_uncompressed_size): New function.
3838         (decompress_input_section): New function.
3839         * compressed_output.h (get_uncompressed_size): New function.
3840         (decompress_input_section): New function.
3841         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3842         Handle compressed debug sections.
3843         * layout.cc (is_compressed_debug_section): New function.
3844         (Layout::output_section_name): Map compressed section names to
3845         canonical names.
3846         * layout.h (is_compressed_debug_section): New function.
3847         (is_debug_info_section): Recognize compressed debug sections.
3848         * merge.cc: Include compressed_output.h.
3849         (Output_merge_data::do_add_input_section): Handle compressed
3850         debug sections.
3851         (Output_merge_string::do_add_input_section): Handle compressed
3852         debug sections.
3853         * object.cc: Include compressed_output.h.
3854         (Sized_relobj::Sized_relobj): Initialize new data members.
3855         (build_compressed_section_map): New function.
3856         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3857         * object.h (Object::section_is_compressed): New method.
3858         (Object::do_section_is_compressed): New method.
3859         (Sized_relobj::Compressed_section_map): New type.
3860         (Sized_relobj::do_section_is_compressed): New method.
3861         (Sized_relobj::compressed_sections_): New data member.
3862         * output.cc (Output_section::add_input_section): Handle compressed
3863         debug sections.
3864         * reloc.cc: Include compressed_output.h.
3865         (Sized_relobj::write_sections): Handle compressed debug sections.
3866
3867 2010-07-08  Cary Coutant  <ccoutant@google.com>
3868
3869         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3870         weak when resolving to a dynamic def.
3871         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3872         for weak undef/dynamic def cases. Adjust callers.
3873         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3874         undef_binding_weak_.
3875         (Symbol_table::sized_write_globals): Adjust symbol binding.
3876         (Symbol_table::sized_write_symbol): Add binding parameter.
3877         * symtab.h (Symbol::set_undef_binding): New method.
3878         (Symbol::is_undef_binding_weak): New method.
3879         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3880         (Symbol_table::should_override): Add new parameter.
3881         (Symbol_table::sized_write_symbol): Add new parameter.
3882
3883         * testsuite/weak_undef_file1.cc: Add new test case.
3884         * testsuite/weak_undef_file2.cc: Fix header comment.
3885         * testsuite/weak_undef_test.cc: Add new test case.
3886
3887 2010-06-29  Doug Kwan  <dougkwan@google.com>
3888
3889         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3890         Initialize USE_SYMBOL_.
3891         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3892         definition.
3893         (Arm_reloc_property::uses_symbol_): New data member declaration.
3894         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3895         uses symbol value and symbol is undefined but not weakly undefined.
3896
3897 2010-06-28  Rafael Espindola  <espindola@google.com>
3898
3899         * plugin.cc (Plugin::load): Use dlerror.
3900
3901 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3902
3903         * symtab.cc (detect_odr_violations): When reporting an ODR
3904         violation, report an object where the symbol is defined.
3905
3906 2010-06-25  Doug Kwan  <dougkwan@google.com>
3907
3908         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3909         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3910         definition.
3911         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3912         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3913         target hook to detect function points.
3914         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3915         * icf.h (Icf::check_section_for_function_pointers): Change type of
3916         parameter SECTION_NAME to const reference to std::string.  Use
3917         target hook to determine if section may have unsafe pointers.
3918         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3919         method definition.
3920
3921 2010-06-21  Rafael Espindola  <espindola@google.com>
3922
3923         * fileread.cc (Input_file::find_fie): New
3924         (Input_file::open): Use Input_file::find_fie.
3925         * fileread.h (Input_file::find_fie): New
3926         * plugin.cc (set_extra_library_path): New.
3927         (Plugin::load): Add set_extra_library_path to the transfer vector.
3928         (Plugin_manager::set_extra_library_path): New.
3929         (Plugin_manager::add_input_file): Use the extra search path if set.
3930         (set_extra_library_path(): New.
3931         * plugin.h (Plugin_manager): Add set_extra_library_path and
3932         extra_search_path_.
3933
3934 2010-06-19  Cary Coutant  <ccoutant@google.com>
3935
3936         * layout.cc (gdb_sections): Add .debug_types.
3937         (lines_only_debug_sections): Likewise.
3938
3939 2010-06-18  Rafael Espindola  <espindola@google.com>
3940
3941         * plugin.cc (add_input_file,add_input_library)
3942         (Plugin_manager::add_input_file): Make filename arguments const.
3943         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3944         const.
3945
3946 2010-06-16  Doug Kwan  <dougkwan@google.com>
3947
3948         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3949         .ARM.attributes section if we have not merged any input
3950         attributes sections.
3951
3952 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3953
3954         * arm.cc: Allow combining objects with no EABI version
3955         information.
3956
3957 2010-06-15  Rafael Espindola  <espindola@google.com>
3958
3959         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3960
3961 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3962
3963         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3964         (struct iovec): Correct !HAVE_READV definition.
3965
3966 2010-06-10  Cary Coutant  <ccoutant@google.com>
3967
3968         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3969         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3970         reloc sections.
3971         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3972
3973         PR 11683
3974         * symtab.h (Symbol::is_placeholder): New member function.
3975         * target-reloc.h (relocate_section): Check for placeholder symbols.
3976
3977         * testsuite/Makefile.am (plugin_test_8): New test.
3978         (plugin_test_9): New test.
3979         * testsuite/Makefile.in: Regenerate.
3980
3981 2010-06-09  Nick Clifton  <nickc@redhat.com>
3982
3983         * yyscript.y (input_list_element): Allow strings prefixed with
3984         the '-' character.  Treat these as libraries.
3985         * script.cc (script_add_library): New function.  Adds a library
3986         specified by "-l<name>" found in an input script.
3987         * script-c.h: Add prototype for script_add_library.
3988
3989 2010-06-07  Doug Kwan  <dougkwan@google.com>
3990
3991         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3992         Restrict stub-group size to be within long conditional branch
3993         range when working around cortex-A8 erratum.
3994
3995 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3996
3997         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3998         #ifdef typo.
3999
4000 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4001
4002         PR gold/11658
4003         * output.cc
4004         (Output_section::Input_section_sort_entry::compare_section_ordering):
4005         Change to return non-zero correctly.
4006         (Output_section::Input_section_sort_section_order_index_compare
4007         ::operator()): Change to fix ambiguity in comparisons.
4008
4009 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4010
4011         * gold.h (is_wildcard_string): New function.
4012         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4013         (Layout::layout_eh_frame): Ditto.
4014         (Layout::find_section_order_index): New method.
4015         (Layout::read_layout_from_file): New method.
4016         * layout.h (Layout::find_section_order_index): New method.
4017         (Layout::read_layout_from_file): New method.
4018         (Layout::input_section_position_): New private member.
4019         (Layout::input_section_glob_): New private member.
4020         * main.cc (main): Call read_layout_from_file here.
4021         * options.h (--section-ordering-file): New option.
4022         * output.cc (Output_section::input_section_order_specified_): New
4023         member.
4024         (Output_section::Output_section): Initialize new member.
4025         (Output_section::add_input_section): Add new parameter.
4026         Keep input sections when --section-ordering-file is used.
4027         (Output_section::set_final_data_size): Sort input sections when
4028         section ordering file is specified.
4029         (Output_section::Input_section_sort_entry): Add new parameter.
4030         Check sorting type.
4031         (Output_section::Input_section_sort_entry::compare_section_ordering):
4032         New method.
4033         (Output_section::Input_section_sort_compare::operator()): Change to
4034         consider section_order_index.
4035         (Output_section::Input_section_sort_init_fini_compare::operator()):
4036         Change to consider section_order_index.
4037         (Output_section::Input_section_sort_section_order_index_compare
4038         ::operator()): New method.
4039         (Output_section::sort_attached_input_sections): Change to sort
4040         according to section order when specified.
4041         (Output_section::add_input_section<32, true>): Add new parameter.
4042         (Output_section::add_input_section<64, true>): Add new parameter.
4043         (Output_section::add_input_section<32, false>): Add new parameter.
4044         (Output_section::add_input_section<64, false>): Add new parameter.
4045         * output.h (Output_section::add_input_section): Add new parameter.
4046         (Output_section::input_section_order_specified): New
4047         method.
4048         (Output_section::set_input_section_order_specified): New method.
4049         (Input_section::Input_section): Initialize section_order_index_.
4050         (Input_section::section_order_index): New method.
4051         (Input_section::set_section_order_index): New method.
4052         (Input_section::section_order_index_): New member.
4053         (Input_section::Input_section_sort_section_order_index_compare): New
4054         struct.
4055         (Output_section::input_section_order_specified_): New member.
4056         * script-sections.cc (is_wildcard_string): Delete and move modified
4057         method to gold.h.
4058         (Output_section_element_input::Output_section_element_input): Modify
4059         call to is_wildcard_string.
4060         (Output_section_element_input::Input_section_pattern
4061         ::Input_section_pattern): Ditto.
4062         (Output_section_element_input::Output_section_element_input): Ditto.
4063         * testsuite/Makefile.am (final_layout): New test case.
4064         * testsuite/Makefile.in: Regenerate.
4065         * testsuite/final_layout.cc: New file.
4066         * testsuite/final_layout.sh: New file.
4067
4068 2010-06-01  Rafael Espindola  <espindola@google.com>
4069
4070         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4071
4072 2010-06-01  Rafael Espindola  <espindola@google.com>
4073
4074         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4075         visibility of symbols.
4076
4077 2010-05-27  Doug Kwan  <dougkwan@google.com>
4078
4079         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4080         from start of output section instead of address for a local symbol
4081         in a merged or relaxed section when doing a relocatable link.
4082
4083 2010-05-26  Rafael Espindola  <espindola@google.com>
4084
4085        PR 11604
4086         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4087         adding sections the garbage collector removed.
4088         * gold/testsuite/Makefile.am: Add test.
4089         * gold/testsuite/Makefile.in: Regenerate.
4090         * gold/testsuite/plugin_test_7.sh: New.
4091         * gold/testsuite/plugin_test_7_1.c: New.
4092         * gold/testsuite/plugin_test_7_2.c: New.
4093
4094 2010-05-26  Rafael Espindola  <espindola@google.com>
4095
4096         * script-sections.cc (Output_section_definition::set_section_addresses):
4097         Check for --section-start.
4098
4099 2010-05-26  Doug Kwan  <dougkwan@google.com>
4100
4101         * arm.cc (Arm_scan_relocatable_relocs): New class.
4102         (Target_arm::relocate_special_relocatable): New method.
4103         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4104         (Arm_relocate_functions::thumb_branch_common): Same.
4105         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4106         instead of Default_scan_relocatable_relocs.
4107         * target-reloc.h (relocate_for_relocatable): Let target handle
4108         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4109         * target.h (Sized_target::relocate_special_relocatable): New method.
4110
4111 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4112
4113         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4114
4115 2010-05-23  Doug Kwan  <dougkwan@google.com>
4116
4117         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4118         instead of a cast.
4119         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4120         with a direct branch, not a conditional branch, to a stub.
4121         * merge.cc (Output_merge_base::record_input_section): New method
4122         defintion.
4123         (Output_merge_data::do_add_input_section): Record input section if
4124         keeps-input-sections flag is set.
4125         (Output_merge_string::do_add_input_section): Ditto.
4126         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4127         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4128         INPUT_SECTIONS_.
4129         (Output_merge_base::keeps_input_sections,
4130         Output_merge_base::set_keeps_input_sections,
4131         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4132         method definitions.
4133         (Output_merge_base::Input_sections): New type declaration.
4134         (Output_merge_base::input_sections_begin,
4135         Output_merge_base::input_sections_end,
4136         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4137         (Output_merge_base::bool keeps_input_sections_,
4138         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4139         Output_merge_base::input_sections_): New data members.
4140         (Output_merge_data::do_set_keeps_input_sections): New method
4141         defintion.
4142         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4143         * output.cc (Output_section::Input_section::relobj): Move method
4144         defintion from class declaration to here and handle merge sections.
4145         (Output_section::Input_section::shndx): Ditto.
4146         (Output_section::Output_section): Remove initializations of removed
4147         data members and initialize new data member LOOKUP_MAPS_.
4148         (Output_section::add_input_section): Set keeps-input-sections flag
4149         for a newly created merge output section as appropriate.  Adjust code
4150         to use Output_section_lookup_maps class.
4151         (Output_section::add_relaxed_input_section): Adjst code for lookup
4152         maps code refactoring.
4153         (Output_section::add_merge_input_section): Add a new parameter
4154         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4155         class.  If adding input section to a newly created merge output
4156         section fails, remove the new merge section.
4157         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4158         Adjust code for use of the Output_section_lookup_maps class.
4159         (Output_section::find_merge_section): Ditto.
4160         (Output_section::build_lookup_maps): New method defintion.
4161         (Output_section::find_relaxed_input_section): Adjust code to use
4162         Output_section_lookup_maps class.
4163         (Output_section::get_input_sections): Export merge sections.  Adjust
4164         code to use Output_section_lookup_maps class.
4165         (Output_section:::add_script_input_section): Adjust code to use
4166         Output_section_lookup_maps class.  Update lookup maps for merge
4167         sections also.
4168         (Output_section::discard_states): Use Output_section_lookup_maps.
4169         (Output_section::restore_states): Same.
4170         * output.h (Merge_section_properties): Move class defintion out of
4171         Output_section.
4172         (Output_section_lookup_maps): New class.
4173         (Output_section::Input_section::is_merge_section): New method
4174         defintion.
4175         (Output_section::Input_section::relobj): Move defintion out of class
4176         defintion.  Declare method only.
4177         (Output_section::Input_section::shndx): Ditto.
4178         (Output_section::Input_section::output_merge_base): New method defintion.
4179         (Output_section::Input_section::u2_.pomb): New union field.
4180         (Output_section::Merge_section_by_properties_map,
4181         Output_section::Output_section_data_by_input_section_map,
4182         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4183         Remove types.
4184         (Output_section::add_merge_input_section): Add new parameter
4185         KEEPS_INPUT_SECTIONS.
4186         (Output_section::build_lookup_maps): New method declaration.
4187         (Output_section::merge_section_map_,
4188         Output_section::merge_section_by_properties_map_,
4189         Output_section::relaxed_input_section_map_,
4190         Output_section::is_relaxed_input_section_map_valid_): Remove data
4191         members.
4192         (Output_section::lookup_maps_): New data member.
4193
4194 2010-05-21  Doug Kwan  <dougkwan@google.com>
4195
4196         PR gold/11619
4197         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4198         avoid a compilation error.
4199
4200 2010-05-19  Rafael Espindola  <espindola@google.com>
4201
4202         * script-sections.cc (Output_section_definition::allocate_to_segment):
4203         Update the phdrs_list even when the output section is NULL.
4204         * testsuite/Makefile.am: Add test.
4205         * testsuite/Makefile.in: Regenerate.
4206         * testsuite/script_test_9.cc: New.
4207         * testsuite/script_test_9.sh: New.
4208         * testsuite/script_test_9.t: New.
4209
4210 2010-05-19  Doug Kwan  <dougkwan@google.com>
4211
4212         * arm.cc (Arm_input_section::original_size): New method.
4213         (Arm_input_section::do_addralign): Add a cast.
4214         (Arm_input_section::do_output_offset): Remove static cast.
4215         (Arm_input_section::original_addralign,
4216          Arm_input_section::original_size_): Change type to uint32_t.
4217         (Arm_input_section::init): Add safe casts for section alignment
4218         and size.
4219         (Arm_input_section::set_final_data_size): Do not set address and
4220         offset of stub table.
4221         (Arm_output_section::fix_exidx_coverage): Change use of of
4222         Output_section::Simple_input_section to that of
4223         Output_section::Input_section.
4224         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4225         except for the first pass.
4226         * output.cc (Output_section::get_input_sections): Change type of
4227         input_sections to std::list<Input_section>.
4228         (Output_section::add_script_input_section): Rename from
4229         Output_section::add_simple_input_section.  Change type of SIS
4230         parameter from Simple_input_section to Input_section.
4231         * output.h (Output_section::Simple_input_section): Remove class.
4232         (Output_section::Input_section): Change class visibility to public.
4233         (Output_section::Input_section::addralign): Use stored alignments
4234         for special input sections if set.
4235         (Output_section::Input_section::set_addralign): New method.
4236         (Output_section::get_input_sections): Change parameter type from
4237         list of Simple_input_section to list of Input_section.
4238         (Output_section::add_script_input_section): Rename from
4239         Output_section::add_simple_input_section. Change first parameter's
4240         type from Simple_input_section to Input_section and remove the
4241         second and third parameters.
4242         * script-sections.cc (Input_section::Input_section_list): Change
4243         type to list of Output_section::Input_section/
4244         (Input_section_info::Input_section_info): Change parameter type of
4245         INPUT_SECTION to Output_section::Input_section.
4246         (Input_section_info::input_section): Change return type.
4247         (Input_section_info::input_section_): Change type to
4248         Output_section::Input_section.
4249         (Output_section_element_input::set_section_addresses): Adjust code
4250         to use Output_section::Input_section instead of
4251         Output_section::Simple_input_section.  Adjust code for renaming
4252         of Output_section::add_simple_input_section.
4253         (Orphan_output_section::set_section_addresses): Ditto.
4254
4255 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4256
4257         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4258         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4259
4260 2010-05-18  Rafael Espindola  <espindola@google.com>
4261
4262         * options.cc (General_options::finalize): Handle -nostdlib.
4263         * options.h (nostdlib): New option.
4264         * script.cc (script_add_search_dir): Handle -nostdlib.
4265
4266 2010-05-12  Doug Kwan  <dougkwan@google.com>
4267
4268         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4269         attributes section only if there no attributes section after merging.
4270         (Target_arm::merge_object_attributes): Move value of
4271         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4272         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4273         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4274         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4275         and arm_attr_merge_7.stdout.
4276         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4277         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4278         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4279         arm_attr_merge_7b.o): New rules.
4280         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4281         arm_attr_merge_7
4282         * testsuite/Makefile.in: Regenerate.
4283         * testsuite/arm_attr_merge.sh: New file.
4284         * testsuite/arm_attr_merge_[67][ab].s: Same.
4285
4286 2010-05-05  Nick Clifton  <nickc@redhat.com>
4287
4288         * po/es.po: Updated Spanish translation.
4289
4290 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4291
4292         * Makefile.am (install-exec-local): Properly install gold as
4293         default cross linker.
4294         * Makefile.in: Regenerated.
4295
4296 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4297             Nick Clifton  <nickc@redhat.com>
4298
4299         * configure.ac (install_as_default): Define and set to false
4300         unless --enable-gold or --enable-gold=both/gold has been
4301         specified.
4302         * configure: Regenerate.
4303
4304         * Makefile.am (install-exec-local): Install the executable as
4305         'ld.gold'.  If install_as_default is true then also install it as
4306         'ld'.
4307         * Makefile.in: Regenerated.
4308
4309 2010-04-24  Ian Lance Taylor  <iant@google.com>
4310
4311         * layout.cc (Layout::layout_reloc): In relocatable link don't
4312         combine reloc sections for grouped sections.
4313
4314 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4315
4316         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4317         sections that are not ordinary to icf.
4318         * icf.cc (get_section_contents): Handle relocation pointing to section
4319         with no object or shndx information.
4320         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4321         * testsuite/Makefile.in: Regenerate.
4322         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4323         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4324
4325 2010-04-22  Ian Lance Taylor  <iant@google.com>
4326
4327         * expression.cc (Expression::Expression_eval_info): Add
4328         result_alignment_pointer field.
4329         (Expression::eval_with_dot): Add result_alignment_pointer
4330         parameter.  Change all callers.
4331         (Expression::eval_maybe_dot): Likewise.
4332         (class Binary_expression): Add alignment_pointer parameter to
4333         left_value and right_value.  Change all callers.
4334         (BINARY_EXPRESSION): Set result alignment.
4335         (class Trinary_expression): Add alignment_pointer parameter to
4336         arg2_value and arg3_value.  Change all callers.
4337         (Trinary_cond::value): Set result alignment.
4338         (Max_expression::value, Min_expression::value): Likewise.
4339         (Align_expression::value): Likewise.
4340         * script-sections.cc (class Sections_element): Add dot_alignment
4341         parameter to set_section_addresses virtual function.  Update
4342         instantiations.
4343         (class Output_section_element): Likewise.
4344         (Script_sections::create_segments): Add dot_alignment parameter.
4345         Change all callers.
4346         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4347         (Script_sections::set_phdrs_clause_addresses): Likewise.
4348         * script-sections.h: Update declarations.
4349         * script.h: Update declarations.
4350         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4351         min_p_align.
4352         * testsuite/script_test_3.t: Set large alignment.
4353         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4354         segment has expected alignment.
4355
4356 2010-04-22  Nick Clifton  <nickc@redhat.com>
4357
4358         * po/gold.pot: Updated by the Translation project.
4359         * po/vi.po: Updated Vietnamese translation.
4360
4361 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4362
4363         * testsuite/Makefile.am (check_PROGRAMS): Add
4364         icf_virtual_function_folding_test.
4365         * testsuite/Makefile.in: Regenerated.
4366
4367 2010-04-15  Andrew Haley  <aph@redhat.com>
4368
4369         * options.h (merge_exidx_entries): New option.
4370         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4371         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4372         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4373         (Target_arm::merge_exidx_entries): New function.
4374         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4375         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4376         to Arm_exidx_fixup constructor.
4377         Add new arg, merge_exidx_entries.
4378         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4379         Arm_output_section::fix_exidx_coverage.
4380
4381 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4382
4383         * icf.cc (get_section_contents): Check for preemptible functions.
4384         Ignore addend when appropriate.
4385         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4386         section folded.
4387         (add_from_relobj): Check for section folded.
4388         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4389         * symtab.h (should_add_dynsym_entry): Add new parameter.
4390         * target-reloc.h (scan_relocs): Check for section folded.
4391         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4392         Check reloc types for function pointers in shared objects.
4393         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4394         case.
4395         (icf_preemptible_functions_test): New test case.
4396         (icf_string_merge_test): New test case.
4397         * testsuite.Makefile.in: Regenerate.
4398         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4399         bar_glob.  Refactor code.
4400         * testsuite/icf_preemptible_functions_test.cc: New file.
4401         * testsuite/icf_preemptible_functions_test.sh: New file.
4402         * testsuite/icf_string_merge_test.cc: New file.
4403         * testsuite/icf_string_merge_test.sh: New file.
4404         * testsuite/icf_virtual_function_folding_test.cc: New file.
4405         * testsuite/icf_virtual_function_folding_test.sh: New file.
4406
4407 2010-04-14  Doug Kwan  <dougkwan@google.com>
4408
4409         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4410         for local symbol recounting if we remove a section due to ICF.
4411         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4412         there are no regular objects in input.
4413
4414 2010-04-13  Doug Kwan  <dougkwan@google.com>
4415
4416         * arm.cc (Arm_input_section::set_final_data_size): Compute
4417         accurate final data size instead of using current data size.
4418
4419 2010-04-09  Doug Kwan  <dougkwan@google.com>
4420
4421         * layout.cc (Layout::choose_output_section): Handle script section
4422         types.
4423         (Layout::make_output_section_for_script): Add section type parameter.
4424         Handle script section types.
4425         * layout.h (Layout::make_output_section_for_script): Add section
4426         type parameter.
4427         * output.cc (Output_section::Output_section): Initialize data member
4428         is_noload_.
4429         (Output_section::do_reset_address_and_file_offset): Do not set address
4430         to 0 if section is a NOLOAD section.
4431         * output.h (Output_section::is_noload): New method.
4432         (Output_section::set_is_noload): Ditto.
4433         (Output_section::is_noload_): New data member.
4434         * script-c.h (Script_section_type): New enum type.
4435         (struct Parser_output_section_header): Add new file section_type.
4436         * script-sections.cc (Sections_element::output_section_name): Add
4437         parameter for returning script section type.
4438         (Output_section_definition::output_section_name): Ditto.
4439         (Output_section_definition::section_type)P; New method.
4440         (Output_section_definiton::script_section_type_name): Ditto.
4441         (Output_section_definition::script_section_type_): New data member.
4442         (Output_section_definition::Output_section_definition): Initialize
4443         data member Output_section_definition::script_section_type_.
4444         (Output_section_definition::create_sections): Pass script section type
4445         to Layout::make_output_section_for_script.
4446         (Output_section_definition::output_section_name): Return script
4447         section type to caller.
4448         (Output_section_definition::set_section_address): Do not advance
4449         dot value and load address if section type is NOLOAD.  Set address
4450         of NOLOAD sections regardless of section flags.
4451         (Output_section_definition::print): Print section type if it is
4452         not SCRIPT_SECTION_TYPE_NONE.
4453         (Output_section_definition::section_type): New method.
4454         (Output_section_definition::script_section_type_name): Ditto.
4455         (Script_sections::output_section_name): Add new parameter
4456         PSECTION_TYPE for returning script section type.  Pass it to
4457         section elements.  Handle discard sections.
4458         (Sort_output_sections::operator()): Handle NOLOAD sections.
4459         * script-sections.h (Script_sections::Section_type): New enum type.
4460         (Script_sections::output_section_name): Add a new parameter for
4461         returning script section type.
4462         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4463         INFO and NOLOAD.
4464         * yyscript.y (union): Add new field SECTION_TYPE.
4465         (COPY, DSECT, INFO, NOLOAD): New tokens.
4466         (opt_address_and_section_type): Change type to output_section_header.
4467         (section_type): New non-terminal
4468         (section_header): Handle section type.
4469         (opt_address_and_section_type): Return section type value.
4470
4471 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4472
4473         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4474         * testsuite/plugin_common_test_2.c (foo): Likewise.
4475
4476 2010-04-08  Doug Kwan  <dougkwan@google.com>
4477
4478         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4479         Output_merge_data.
4480         * output.cc (Output_section::add_merge_input_section): Simplify
4481         code and return status of Output_merge_base::add_input_section.
4482         Update merge section map only if Output_merge_base::add_input_section
4483         returns true.
4484
4485 2010-04-07  Doug Kwan  <dougkwan@google.com>
4486
4487         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4488         if section is marked as containing instructions but has no mapping
4489         symbols.
4490         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4491         correct section index.
4492         (Arm_relobj::find_linked_text_section): Ditto.
4493
4494 2010-04-07  Cary Coutant  <ccoutant@google.com>
4495
4496         * archive.cc (include_member): Destroy Read_symbols_data object before
4497         releasing file.
4498         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4499         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4500         (Read_symbols_data::~Read_symbols_data) New destructor.
4501         (Section_relocs::Section_relocs) New constructor.
4502         (Section_relocs::~Section_relocs) New destructor.
4503         (Read_relocs_data::Read_relocs_data) New constructor.
4504         (Read_relocs_data::~Read_relocs_data) New destructor.
4505         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4506         pointers to NULL after deleting.
4507
4508 2010-04-07  Doug Kwan  <dougkwan@google.com>
4509
4510         * arm.cc: Replace "endianity" with "endianness" in comments.
4511         (Arm_exidx_cantunwind): Ditto.
4512         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4513         (Arm_relobj::merge_flags_and_attributes): New method.
4514         (Arm_relobj::merge_flags_and_attributes_): New data member.
4515         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4516         (Arm_relobj::scan_sections_for_stubs): Ditto.
4517         (Arm_relobj::do_read_symbols): Check to see if we really want to
4518         merge processor-specific flags and attributes.  Exit early if
4519         an object is empty except for section names and the undefined symbol.
4520         (Target_arm::do_finalize_sections): Move check for ELF format to
4521         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4522         attributes from a regular object only when we have determined that
4523         it is aapropriate.  Do not create an .ARM.attributes section in
4524         output if there is no regular input object.
4525         (Target_arm::merge_processor_specific_flags): Check
4526         --warn-mismatch before printing any error.
4527         (Target_arm::merge_object_attributes): Ditto.
4528         * gold.cc (queue_middle_tasks): Handle the case in which there is
4529         no regular object in input.
4530         * options.cc (General_options::parse_EB): New method.
4531         (General_options::parse_EL): Same.
4532         (General_options::General_options): Initialize endianness_.
4533         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4534         New options.
4535         (General_options::Endianness): New enum.
4536         (General_options::endianness): New method.
4537         (General_options::endianness_): New data member.
4538         * parameters.cc (Parameters::set_options): Check target endianness.
4539         (Parameters::set_target_once): Ditto.
4540         (Parameters::check_target_endianness): New method.
4541         (parameters_force_valid_target): If either -EL or -EB is specified,
4542         use it to define endianness of default target.
4543         * parameters.h (Parameters::check_target_endianness): New method
4544         declaration.
4545         * target.h (class Target): Change "endianity" to "endianness"
4546         in comments.
4547
4548 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4549
4550         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4551         * configure: Regenerate.
4552         * Makefile.in: Regenerate.
4553         * testsuite/Makefile.in: Regenerate.
4554
4555 2010-04-06  Cary Coutant  <ccoutant@google.com>
4556
4557         gcc PR lto/42757
4558         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4559         prevailing definitions of common symbols.
4560         * testsuite/plugin_test_6.sh: New test case.
4561         * testsuite/plugin_common_test_1.c: New test case.
4562         * testsuite/plugin_common_test_2.c: New test case.
4563         * testsuite/Makefile.am (plugin_test_6): New test case.
4564         * testsuite/Makefile.in: Regenerate.
4565
4566 2010-04-06  Nick Clifton  <nickc@redhat.com>
4567
4568         * po/vi.po: New Vietnamese translation.
4569
4570 2010-03-30  Doug Kwan  <dougkwan@google.com>
4571
4572         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4573
4574 2010-03-25  Doug Kwan  <dougkwan@google.com>
4575
4576         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4577         to avoid a conversion warning on a 32-bit host.
4578
4579 2010-03-24  Ian Lance Taylor  <iant@google.com>
4580
4581         * testsuite/script_test_3.t: Add a TLS segment.
4582         * testsuite/Makefile.am (check_PROGRAMS): Add
4583         tls_phdrs_script_test.
4584         (tls_phdrs_script_test_SOURCES): Define.
4585         (tls_phdrs_script_test_DEPENDENCIES): Define.
4586         (tls_phdrs_script_test_LDFLAGS): Define.
4587         (tls_phdrs_script_test_LDADD): Define.
4588         * testsuite/Makefile.in: Rebuild.
4589
4590 2010-03-23  Cary Coutant  <ccoutant@google.com>
4591
4592         * fileread.cc (find_or_make_view): Fix comment.
4593
4594 2010-03-23  Ian Lance Taylor  <iant@google.com>
4595
4596         * script-sections.cc (class Orphan_section_placement): Define
4597         PLACE_TLS and PLACE_TLS_BSS.
4598         (Orphan_section_placement::Orphan_section_placement): Initialize
4599         new places.
4600         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4601         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4602         (tls_script_test_SOURCES): Define.
4603         (tls_script_test_DEPENDENCIES): Define.
4604         (tls_script_test_LDFLAGS): Define.
4605         (tls_script_test_LDADD): Define.
4606         * testsuite/Makefile.in: Rebuild.
4607
4608 2010-03-22  Doug Kwan  <dougkwan@google.com>
4609
4610         * arm.cc (Arm_relocate_functions::abs8,
4611         Arm_relocate_functions::abs16): Use correct check for overflow
4612         specified in the ARM ELF specs.
4613         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4614         target of a BLX instruction specially.
4615         (Reloc_stub::stub_type_for_reloc): Ditto.
4616         (Relocate::relocate): Use symbolic names instead of numeric relocation
4617         codes to report error.
4618         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4619         workaround.
4620         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4621         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4622         thumb2_blx_out_of_range.stdout
4623         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4624         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4625         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4626         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4627         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4628         thumb2_blx_in_range, thumb2_blx_in_range.o,
4629         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4630         thumb2_blx_out_of_range.o): New rules.
4631         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4632         thumb2_blx_in_range and thumb2_blx_out_of_range.
4633         * testsuite/Makefile.in: Regenerate.
4634         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4635         * testsuite/thumb_blx_in_range.s: New file.
4636         * testsuite/thumb_blx_out_of_range.s: New file.
4637
4638 2010-03-22  Rafael Espindola  <espindola@google.com>
4639
4640         * archive.cc (Should_include): Move to archive.h.
4641         (should_include_member): Make it a member of Archive.
4642         (Lib_group): New.
4643         (Add_lib_group_symbols): New.
4644         * archive.h: Include options.h.
4645         (Archive_member): Moved from Archive.
4646         (Should_include): Moved from archive.cc.
4647         (Lib_group): New.
4648         (Add_lib_group_symbols): New.
4649         * dynobj.cc (do_should_include_member): New.
4650         * dynobj.h (do_should_include_member): New.
4651         * gold.cc (queue_initial_tasks): Update call to queue.
4652         * main.cc (main): Print lib group stats.
4653         * object.cc (do_should_include_member): New.
4654         * object.h: Include archive.h.
4655         (Object::should_include_member): New.
4656         (Object::do_should_include_member): New.
4657         (Sized_relobj::do_should_include_member): New.
4658         * options.cc (General_options::parse_start_lib): New.
4659         (General_options::parse_end_lib): New.
4660         (Input_arguments::add_file): Handle lib groups.
4661         (Input_arguments::start_group): Check we are not in a lib.
4662         (Input_arguments::start_lib): New.
4663         (Input_arguments::end_lib): New.
4664         * options.h (General_options): Add start_lib and end_lib.
4665         (Input_argument::lib_): New.
4666         (Input_argument::lib): New.
4667         (Input_argument::is_lib): New.
4668         (Input_file_lib): New.
4669         (Input_arguments::in_lib_): New.
4670         (Input_arguments::in_lib): New.
4671         (Input_arguments::start_lib): New.
4672         (Input_arguments::end_lib_): New.
4673         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4674         in unused members as preempted.
4675         (Sized_pluginobj::do_should_include_member): New.
4676         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4677         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4678         return the blocker.
4679         (Read_symbols::do_whole_lib_group): New.
4680         (Read_symbols::do_lib_group): New.
4681         (Read_symbols::do_read_symbols): Handle lib groups.
4682         (Read_symbols::get_name): Handle lib groups.
4683         * readsyms.h (Read_symbols): Add an archive member pointer.
4684         (Read_symbols::do_whole_lib_group): New.
4685         (Read_symbols::do_lib_group): New.
4686         (Read_symbols::member_): New.
4687         * script.cc (read_input_script): Update call to queue_soon.
4688
4689 2010-03-19  Doug Kwan  <dougkwan@google.com>
4690
4691         * arm.cc (Stub_table::Stub_table): Initialize new data members
4692         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4693         (Stub_table::add_reloc_stub): Assign stub offset and update
4694         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4695         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4696         New data members.
4697         (Stub_table::update_data_size_and_addralign): Use
4698         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4699         instead of going over all reloc stubs.
4700         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4701         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4702         Stringpool_template::offset_ to size of Stringpool_char.
4703         (Stringpool_template::new_key_offset): Remove code to initialize
4704         Stringpool_template::offset_.
4705         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4706         Stringpool_template::offset_ to zero.
4707
4708 2010-03-15  Doug Kwan  <dougkwan@google.com>
4709
4710         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4711         offset_.
4712         (Stringpool_template::new_key_offset): New method.
4713         (Stringpool_template::add_string): Assign offsets when adding new
4714         strings.
4715         (Stringpool_template::set_string_offsets): Do not set string offsets
4716         when not optimizing.
4717         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4718         member size_.
4719         (Chunked_vector::clear): Clear size_.
4720         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4721         (Chunked_vector::size): Return size_.
4722         (Chunked_vector::push_back): Use size_ to find insert position.
4723         (Chunked_vector::size_): New data member.
4724         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4725         (Stringpool_template::new_key_offset): New method declaration.
4726         (Stringpool_template::offset_): New data member.
4727
4728 2010-03-15   Rafael Espindola  <espindola@google.com>
4729
4730         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4731         Add_symbols' constructor.
4732         * readsyms.h (Add_symbols): Remove the input_group member.
4733
4734 2010-03-10  Ian Lance Taylor  <iant@google.com>
4735
4736         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4737         target to ask whether a reference to a symbol requires a stack
4738         split.
4739         * target.h (Target::is_call_to_non_split): New function.
4740         (Target::do_is_call_to_non_split): Declare virtual function.
4741         * target.cc: Include "symtab.h".
4742         (Target::do_is_call_to_non_split): New function.
4743         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4744
4745 2010-03-10  Cary Coutant  <ccoutant@google.com>
4746
4747         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4748         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4749         (File_read::open[2]): Add whole_file_view_ to list of views.
4750         (File_read::make_view): Remove test of whole_file_view_.
4751         (File_read::find_or_make_view): Create whole_file_view_ if
4752         necessary.
4753         (File_read::clear_views): Replace bool parameter with enum;
4754         adjust all callers.  Don't delete views with permanent data;
4755         do delete cached views and views from archives if
4756         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4757         if clearing the corresponding view.
4758         * fileread.h (File_read::Clear_views_mode): New enum.
4759         (File_read::View::is_permanent_view): New method.
4760         (File_read::clear_views): Replace bool parameter
4761         with enum; adjust all callers.
4762         * options.h (General_options): Change keep_files_mapped option;
4763         add map_whole_files.
4764         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4765         releasing the file.
4766         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4767         the file.
4768
4769 2010-03-10  David S. Miller  <davem@davemloft.net>
4770
4771         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4772
4773 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4774
4775         * icf.cc (get_section_contents): Add '@' marker after processing the
4776         merge reloc.
4777
4778 2010-03-08  Doug Kwan  <dougkwan@google.com>
4779
4780         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4781         due to a conversion warning.
4782         (Arm_relobj::update_output_local_symbol_count): Check for local
4783         symbol with unset output index.
4784
4785 2010-03-05  Ian Lance Taylor  <iant@google.com>
4786
4787         * options.h (class General_options): Add --spare-dynamic-tags.
4788         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4789         --spare-dynamic-tags.
4790
4791 2010-03-05  Ian Lance Taylor  <iant@google.com>
4792
4793         * incremental.cc: Include "libiberty.h".
4794
4795 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4796
4797         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4798         function, is_info_ member.
4799         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4800         (Versions::Versions): Update caller.
4801         (Versions::define_base_version): Likewise.
4802         (Versions::add_def): Likewise.
4803
4804 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4805
4806         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4807         (Scan::possible_function_pointer_reloc): New function.
4808         (Scan::local_reloc_may_be_function_pointer): Change to call
4809         possible_function_pointer_reloc.
4810         (Scan::global_reloc_may_be_function_pointer): Ditto.
4811         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4812         relocations in ".data.rel.ro._ZTV" section.
4813         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4814         * testsuite/icf_safe_so_test.cc: Ditto.
4815         * testsuite/icf_safe_test.cc: Ditto.
4816         * testsuite/icf_safe_test.sh: Ditto.
4817
4818 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4819             Ian Lance Taylor  <iant@google.com>
4820
4821         * target-reloc.h (relocate_section): Check the symbol table index
4822         for -1U before setting the local symbol index.
4823         (scan_relocatable_relocs): If copying the relocation, record that
4824         the local symbol is required.
4825         * object.h (Symbol_value::is_output_symtab_index_set): New
4826         function.
4827         (Symbol_value::may_be_discarded_from_output_symtab): New
4828         function.
4829         (Symbol_value::has_output_symtab_entry): New function.
4830         (Symbol_value::needs_output_symtab_entry): Remove.
4831         (Symbol_value::output_symtab_index): Make sure the symbol index is
4832         set.
4833         (Symbol_value::set_output_symtab_index): Make sure the symbol
4834         index is not set.  Make sure the new index is valid.
4835         (Symbol_value::set_must_have_output_symtab_entry): New function.
4836         (Symbol_value::has_output_dynsym_entry): New function.
4837         (Symbol_value::set_output_dynsym_index): Make sure the new index
4838         is valid.
4839         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4840         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4841         local symbol if permitted.
4842         (Sized_relobj::do_finalize_local_symbols): Call
4843         is_output_symtab_index_set rather than needs_output_symtab_entry.
4844         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4845         rather than needs_output_symtab_entry.  Call
4846         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4847         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4848         is_output_symtab_index_set rather than needs_output_symtab_entry.
4849         * testsuite/discard_locals_relocatable_test.c: New file.
4850         * testsuite/discard_locals_test.sh: Test -r.
4851         * testsuite/Makefile.am (check_DATA): Add
4852         discard_locals_relocatable_test1.syms,
4853         discard_local_relocatable_test2.syms.
4854         (MOSTLYCLEANFILES): Likewise.  Also add
4855         discard_locals_relocatable_test1.lout and
4856         discard_locals_relocatable_test2.out.
4857         (discard_locals_relocatable_test1.syms): New target.
4858         (discard_locals_relocatable_test.o): New target.
4859         (discard_locals_relocatable_test1.out): New target.
4860         (discard_locals_relocatable_test2.syms): New target.
4861         (discard_locals_relocatable_test2.out): New target.
4862         (various): Add missing ../ld-new dependencies.
4863         * testsuite/Makefile.in: Rebuild.
4864
4865 2010-03-03  Nick Clifton  <nickc@redhat.com>
4866
4867         * po/fi.po: New Finnish translation.
4868
4869 2010-03-01  Doug Kwan  <dougkwan@google.com>
4870
4871         * layout.cc (Layout::Layout): Force section types of .init_array*,
4872         .preinit_array* and .fini_array* sections.
4873         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4874         Fix check of return value of std::string::find.().
4875         (Output_section::Input_section_sort_compare::operator()): Remove
4876         comment about .init_array.
4877         (Output_section::Input_section_sort_init_fini_compare::operator()):
4878         New method.
4879         (Output_section::sort_attached_input_sections): Handle .init_array
4880         and .fini_array specially.
4881         * output.h (Output_section::Inut_section_sort_compare): Update
4882         comment.
4883         (Output_section::Input_section_sort_init_fini_compare): New struct.
4884
4885 2010-02-26  Doug Kwan  <dougkwan@google.com>
4886
4887         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4888         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4889         * testsuite/debug_msg.sh: Avoid matching source line number for
4890         use of global variable undef_int.
4891
4892 2010-02-26  Doug Kwan  <dougkwan@google.com>
4893
4894         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4895         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4896         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4897         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4898         * options.cc (General_options::General_options): Initialize member
4899         fix_v4bx_.
4900         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4901         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4902         and rm_no_fix_v4bx.stdout
4903         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4904         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4905         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4906         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4907         and arm_no_fix_v4bx.
4908         * Makefile.in: Regenerate.
4909         * testsuite/arm_fix_v4bx.s: New file.
4910         * testsuite/arm_fix_v4bx.sh: Ditto.
4911
4912 2010-02-24  Doug Kwan  <dougkwan@google.com>
4913
4914         * arm.cc (Target_arm::got_section): Make the .got section the first
4915         non RELRO section in the data segment.
4916         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4917         suffixes of section names.
4918
4919 2010-02-24  Doug Kwan  <dougkwan@google.com>
4920
4921         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4922         flags and attributes merging if an input file is a binary file.
4923         * fileread.cc (Input_file::open): Record format of original file.
4924         * fileread.h (Input_file::Format): New enum type.
4925         (Input_file::Input_file): Initialize data member format_.
4926         (Input_file::format): New method definition.
4927         (Input_file::format_):: New data member.
4928
4929 2010-02-24  Doug Kwan  <dougkwan@google.com>
4930
4931         * arm.cc (Arm_output_data_got): New class.
4932         (ARM_TCB_SIZE): New constant
4933         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4934         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4935         If user uses a script with a SECTIONS clause, issue only a warning
4936         for a misplaced EXIDX input section.  Otherwise, issue an error.
4937         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4938         garbage collection.
4939         (Target_arm::got_mode_index_entry): Handle static linking.
4940         (Target_arm::Scan::local): Ditto.
4941         (Target_arm::Scan::global): Ditto.
4942         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4943         all incorrectly implemented relocations.
4944         (Target_arm::fix_exidx_coverage): Pass layout to
4945         Arm_output_section::fix_exidx_coverage.
4946         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4947         from ".ARM.exidx." and ".ARM.extab.".
4948
4949 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4950
4951         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4952         section if it does not already exist.
4953         * attributes.cc (Attributes_section_data::Attributes_section_data):
4954         Don't crash if size is zero.
4955
4956 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4957             Ian Lance Taylor  <iant@google.com>
4958
4959         * gold.cc (queue_middle_tasks): If no input files were opened,
4960         exit.
4961         * workqueue.h (Task_function::Task_function): Assert that there is
4962         a blocker.
4963
4964 2010-02-22  Doug Kwan  <dougkwan@google.com>
4965
4966         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4967         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4968         types to avoid warnings due to different uint64_t implementations
4969         on different hosts.
4970
4971 2010-02-21  Doug Kwan  <dougkwan@google.com>
4972
4973         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4974         handling of the maximum backward branch offset.
4975         (Arm_relocate_functions::thumb_branch_common): Ditto.
4976         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4977         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4978         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4979         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4980         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4981         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4982         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4983         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4984         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4985         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4986         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4987         thumb2_bl_out_of_range.o): New rules.
4988         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4989         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4990         thumb2_bl_out_of_range
4991         * testsuite/Makefile.in: Regenerate.
4992         * testsuite/arm_bl_in_range.s: New file.
4993         * testsuite/arm_bl_out_of_range.s: Ditto.
4994         * testsuite/arm_branch_in_range.sh: Ditto.
4995         * testsuite/arm_branch_range.t: Ditto.
4996         * testsuite/thumb2_branch_range.t: Ditto.
4997         * testsuite/thumb_bl_in_range.s: Ditto.
4998         * testsuite/thumb_bl_out_of_range.s: Ditto.
4999         * testsuite/thumb_branch_range.t: Ditto.
5000
5001 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5002
5003         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5004         Add reloc offset information.
5005         * icf.cc (get_section_contents): Change iterators to point to the new
5006         vectors. Add reloc offset information to the contents.
5007         * icf.h (Icf::Sections_reachable_info): New typedef.
5008         (Icf::Sections_reachable_list): New typedef.
5009         (Icf::Offset_info): New typedef.
5010         (Icf::Reloc_info): New struct typedef.
5011         (Icf::Reloc_info_list): New typedef.
5012         (Icf::symbol_reloc_list): Delete method.
5013         (Icf::addend_reloc_list): Delete method.
5014         (Icf::section_reloc_list): Delete method.
5015         (Icf::reloc_info_list): New method.
5016         (Icf::reloc_info_list_): New member.
5017
5018 2010-02-19  Doug Kwan  <dougkwan@google.com>
5019
5020         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5021         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5022         * arm.cc (Arm_relocation_functions): New forward declaration.
5023         (Target_arm::Target_arm): Initialize new data members
5024         got_mod_index_offset_ and tls_base_symbol_defined_.
5025         (Target_arm::Relocate::relocate_tls): New method.
5026         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5027          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5028         New methods.
5029         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5030         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5031         (Target_arm::got_mod_index_offset_,
5032         Target_arm::tls_base_symbol_defined_): New data members.
5033         (Target_arm::Scan::local, Target::Scan::global,
5034         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5035         relocations.
5036
5037 2010-02-18  Doug Kwan  <dougkwan@google.com>
5038
5039         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5040         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5041         text section as a parameter becuase some broken tools may not set
5042         the link in section header.
5043         (Target_arm::has_got_section): New method.
5044         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5045         without any mapping symbol as data only.  Remove warning.
5046         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5047         link in its section header, try to discover the link by inspecting the
5048         REL31 relocation at the beginning of the section.
5049         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5050         in error message.
5051         (Target_arm::Scan::global): Treat any reference to the symbol
5052         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5053
5054 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5055
5056         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5057         (Scan::global_reloc_may_be_function_pointer): New function.
5058         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5059         (Scan::global_reloc_may_be_function_pointer): New function.
5060         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5061         (Scan::global_reloc_may_be_function_pointer): New function.
5062         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5063         (Scan::global_reloc_may_be_function_pointer): New function.
5064         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5065         (Scan::global_reloc_may_be_function_pointer): New function.
5066         (Scan::possible_function_pointer_reloc): New function.
5067         (Target_x86_64::can_check_for_function_pointers): New function.
5068         * gc.h (gc_process_relocs): Scan relocation types to determine if
5069         function pointers were taken for targets that support it.
5070         * icf.cc (Icf::find_identical_sections): Include functions for
5071         folding in safe ICF whose pointer is not taken.
5072         * icf.h (Secn_fptr_taken_set): New typedef.
5073         (fptr_section_id_): New member.
5074         (section_has_function_pointers): New function.
5075         (set_section_has_function_pointers): New function.
5076         (check_section_for_function_pointers): New function.
5077         * options.h: Fix comment for safe ICF option.
5078         * target.h (can_check_for_function_pointers): New function.
5079         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5080         Modify icf_safe_test for X86-64.
5081         * testsuite/Makefile.in: Regenerate.
5082         * testsuite/icf_safe_so_test.cc: New file.
5083         * testsuite/icf_safe_so_test.sh: New file.
5084         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5085         (main): Change to take pointer to function kept_func_3.
5086         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5087         folding is done correctly for X86-64.
5088
5089 2010-02-12  David S. Miller  <davem@davemloft.net>
5090
5091         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5092         is_symbolless parameter.
5093         (Output_reloc<SHT_REL>::is_symbolless): New.
5094         (Output_reloc<SHT_REL>::is_symbolless_): New.
5095         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5096         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5097         (Output_reloc<SHT_RELA>::is_symbolless): New.
5098         (Output_data_reloc::add_global): Handle is_symbolless.
5099         (Output_data_reloc::add_global_relative): Likewise.
5100         (Output_data_reloc::add_local): Likewise.
5101         (Output_data_reloc::add_local_relative): Likewise.
5102         (Output_data_reloc::add_symbolless_global_addend): New.
5103         (Output_data_reloc::add_symbolless_local_addend): New.
5104         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5105         is_symbolless.
5106         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5107         instead of ->is_relative_
5108         (Output_reloc::write): Likewise.
5109         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5110         (Output_reloc::write_rel): Simplify.
5111
5112         * sparc.cc (Target_sparc::Scan::local): Use
5113         ->add_symbolless_local_addend as needed.
5114         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5115         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5116         based upon relocation offset.
5117
5118 2010-02-11  Doug Kwan  <dougkwan@google.com>
5119
5120         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5121         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5122         beginning of function.
5123         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5124         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5125         parameter is_32bit in calls to should_apply_static_reloc.
5126         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5127         (check_DATA): Add arm_abs_global.stdout.
5128         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5129         arm_abs_global.stdout): New rules.
5130         (MOSTLLYCLEANFILES): Add arm_abs_global
5131         * Makefile.in: Regenerate.
5132         * testsuite/arm_abs_global.s: New file.
5133         * testsuite/arm_abs_global.sh: Ditto.
5134         * testsuite/arm_abs_lib.s: Ditto.
5135
5136 2010-02-11  Ian Lance Taylor  <iant@google.com>
5137
5138         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5139         Read_relocs task.
5140         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5141         Allocate_commons_task first.
5142         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5143         task, rather than symtab_lock_.
5144         (Gc_process_relocs::~Gc_process_relocs): New function.
5145         (Gc_process_relocs::is_runnable): Check this_blocker_.
5146         (Gc_process_relocs::locks): Use next_blocker_ rather than
5147         blocker_.
5148         (Scan_relocs::~Scan_relocs): New function.
5149         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5150         symtab_lock_.
5151         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5152         next_blocker_.
5153         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5154         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5155         constructor accordingly.
5156         (class Gc_process_relocs): Likewise.
5157         (class Scan_relocs): Likewise.
5158         * common.h (class Allocate_commons_task): Remove symtab_lock_
5159         field, and corresponding constructor parameter.
5160         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5161         symtab_lock_.
5162         (Allocate_commons_task::locks): Likewise.
5163
5164 2010-02-11  Ian Lance Taylor  <iant@google.com>
5165
5166         * gold-threads.h (class Once): Define.
5167         (class Initialize_lock): Rewrite as child of Once.
5168         * gold-threads.cc (class Once_initialize): Define.
5169         (once_pointer_control): New static variable.
5170         (once_pointer, once_arg): New static variables.
5171         (c_run_once): New static function.
5172         (Once::Once, Once::run_once, Once::internal_run): New functions.
5173         (class Initialize_lock_once): Remove.
5174         (initialize_lock_control): Remove.
5175         (initialize_lock_pointer): Remove.
5176         (initialize_lock_once): Remove.
5177         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5178         (Initialize_lock::initialize): Rewrite.
5179         (Initialize_lock::do_run_once): New function.
5180         * archive.cc (Archive::interpret_header): Only clear name if it is
5181         not already empty.
5182         * fileread.cc: Include "gold-threads.h"
5183         (file_counts_lock): New static variable.
5184         (file_counts_initialize_lock): Likewise.
5185         (File_read::release): Only increment counts when using --stats.
5186         Use a lock around the increment.
5187         * parameters.cc (class Set_parameters_target_once): Define.
5188         (set_parameters_target_once): New static variable.
5189         (Parameters::Parameters): Move here from parameters.h.
5190         (Parameters::set_target): Rewrite.
5191         (Parameters::set_target_once): New function.
5192         (Parameters::clear_target): Move here and rewrite.
5193         * parameters.h (class Parameters): Update declarations.  Add
5194         set_parameters_target_once_ field.
5195         (Parameters::Parameters): Move to parameters.cc.
5196         (Parameters::clear_target): Likewise.
5197         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5198         task.
5199         (Start_group::~Start_group): New function.
5200         (Start_group::is_runnable): New function.
5201         (Start_group::locks, Start_group::run): New functions.
5202         (Finish_group::run): Change saw_undefined to size_t.
5203         * readsyms.h (class Start_group): Define.
5204         (class Finish_group): Change saw_undefined_ field to size_t.
5205         (Finish_group::Finish_group): Remove saw_undefined and
5206         this_blocker parameters.  Change all callers.
5207         (Finish_group::set_saw_undefined): New function.
5208         (Finish_group::set_blocker): New function.
5209         * symtab.h (class Symbol_table): Change saw_undefined to return
5210         size_t.  Change saw_undefined_ field to size_t.
5211         * target-select.cc (Set_target_once::do_run_once): New function.
5212         (Target_selector::Target_selector): Initialize set_target_once_
5213         field.  Don't initialize lock_ and initialize_lock_ fields.
5214         (Target_selector::instantiate_target): Rewrite.
5215         (Target_selector::set_target): New function.
5216         * target-select.h (class Set_target_once): Define.
5217         (class Target_selector): Update declarations.  Make
5218         Set_target_once a friend.  Remove lock_ and initialize_lock_
5219         fields.  Add set_target_once_ field.
5220
5221 2010-02-10  Ian Lance Taylor  <iant@google.com>
5222
5223         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5224         queueing any tasks.
5225         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5226         (queue_middle_tasks): Add all blockers before queueing any tasks.
5227         (queue_final_tasks): Likewise.
5228         * token.h (Task_token::add_blockers): New function.
5229         * object.h (Input_objects::number_of_relobjs): New function.
5230
5231 2010-02-10  Ian Lance Taylor  <iant@google.com>
5232
5233         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5234         shared, not if not position independent.
5235         * x86_64.cc (Relocate::relocate_tls): Likewise.
5236         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5237         (tls_pie_pic_test): New target.
5238         * testsuite/Makefile.in: Rebuild.
5239
5240         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5241         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5242         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5243         * testsuite/Makefile.in: Rebuild.
5244
5245 2010-02-09  David S. Miller  <davem@davemloft.net>
5246
5247         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5248         R_SPARC_RELATIVE using ->add_local_relative().
5249         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5250
5251         * output.h (Output_data_dynamic::add_section_size): New method
5252         that takes two Output_data objects.
5253         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5254         entry param.  Handle it in initializers.
5255         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5256         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5257         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5258         arg.
5259         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5260         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5261         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5262         for dynrel_includes_plt.
5263         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5264         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5265         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5266         before .rela.plt
5267         (Target_sparc::do_finalize_sections): Update to pass true for
5268         dynrel_includes_plt.
5269         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5270         output before .rela.plt
5271         (Target_powerpc::do_finalize_sections): Update to pass true for
5272         dynrel_includes_plt when 32-bit.
5273
5274 2010-02-08  Doug Kwan  <dougkwan@google.com>
5275
5276         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5277         method.
5278         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5279         Arm_relobj::scan_section_for_cortex_a8_stubs,
5280         Arm_relobj::do_relocation_section): Instead of calling
5281         Output_section::output_address, use faster
5282         Arm_relobj::simple_input_section_output_address.
5283
5284 2010-02-08  David S. Miller  <davem@davemloft.net>
5285
5286         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5287         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5288         relocation helper function.
5289
5290         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5291         just like R_SPARC_GOT{10,13,22}.
5292         (Target_sparc::Scan::local): Likewise.
5293         (Target_sparc::Relocate:relocate): Likewise.
5294
5295 2010-02-06  Ian Lance Taylor  <iant@google.com>
5296
5297         * configure.ac: Rewrite targetobjs duplicate removal code to use
5298         only shell constructs.
5299         * configure: Rebuild.
5300
5301 2010-02-05  Doug Kwan  <dougkwan@google.com>
5302
5303         PR 11247
5304         * arm.cc (Arm_relobj::section_is_scannable): New method.
5305         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5306         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5307
5308 2010-02-04  Doug Kwan  <dougkwan@google.com>
5309
5310         PR 11247
5311         * arm-reloc-property.cc (cstdio): Include.
5312         * configure.ac (targetobjs): Remove duplicates.
5313         * configure: Regenerate.
5314         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5315         big and little endian version for a given address size.
5316
5317 2010-02-03  Doug Kwan  <dougkwan@google.com>
5318
5319         * arm-reloc-property.cc
5320         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5321         definition.
5322         * arm-reloc-property.h
5323         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5324         New method definition.
5325         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5326         declaration.
5327         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5328         overflow to N.
5329         (GOT_PREL): Change implemented to Y.
5330         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5331         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5332         (Arm_relocate_functions::movw_abs_nc): Remove method.
5333         (Arm_relocate_functions::movt_abs): Ditto.
5334         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5335         (Arm_relocate_functions::thm_movt_abs): Ditto.
5336         (Arm_relocate_functions::movw_rel_nc): Ditto.
5337         (Arm_relocate_functions::movw_rel): Ditto.
5338         (Arm_relocate_functions::movt_rel): Ditto.
5339         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5340         (Arm_relocate_functions:thm_movw_rel): Ditto.
5341         (Arm_relocate_functions:thm_movt_rel): Ditto.
5342         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5343         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5344         New method definitions.
5345         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5346         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5347         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5348         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5349         (Target_arm::Relocate::relocate): Check for non-static or
5350         unimplemented relocation code and exit early.  Change calls to
5351         Target_arm::reloc_uses_thumb_bit and
5352         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5353         instead.  Refactor code to handle similar relocations to increase
5354         code sharing.  Remove check for unsupported relocation code in switch
5355         statement.
5356         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5357         relocation property table to find out size.  Change error message to
5358         print out the name of a relocation code instead of the numeric value.
5359         (Target_arm::scan_reloc_for_stub): Use relocation property table
5360         instead of calling Target_arm::reloc_uses_thumb_bit().
5361
5362 2010-02-02  Doug Kwan  <dougkwan@google.com>
5363
5364         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5365         types of relaxed input section.
5366
5367 2010-02-02  Doug Kwan  <dougkwan@google.com>
5368
5369         * Makefile.am (HFILES): Add arm-reloc-property.h.
5370         (DEFFILES): New.
5371         (TARGETSOURCES): Add arm-reloc-property.cc
5372         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5373         (libgold_a_SOURCES): $(DEFFILES)
5374         * Makefile.in: Regenerate.
5375         * arm-reloc-property.cc: New file.
5376         * arm-reloc-property.h: New file.
5377         * arm-reloc.def: New file.
5378         * arm.cc: Update comments.
5379         (arm-reloc-property.h): New included header.
5380         (arm_reloc_property_table): New global variable.
5381         (Target_arm::do_select_as_default_target): New method definition.
5382         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5383         arm-reloc-property to targ_extra_obj.
5384         * parameters.cc (set_parameters_target): Call
5385         Target::select_as_default_target().
5386         * target.h (Target::select_as_default_target): New method definition.
5387         (Target::do_select_as_default_target): Same.
5388
5389 2010-02-01  Doug Kwan  <dougkwan@google.com>
5390
5391         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5392         first_output_text_section_.
5393         (Arm_exidx_fixup::first_output_text_section): New method definition.
5394         (Arm_exidx_fixup::first_output_text_section_): New data member.
5395         (Arm_exidx_fixup::process_exidx_section): Record the first text
5396         output section seen.
5397         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5398         and entsize in output section header.
5399
5400 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5401
5402         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5403         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5404         (Arm_relocate_functions::thm_alu11): New Method.
5405         (Arm_relocate_functions::thm_pc8): New Method.
5406         (Arm_relocate_functions::thm_pc12): New Method.
5407         (Target_arm::Scan::local): Handle the relocations.
5408         (Target_arm::Scan::global): Likewise.
5409         (Target_arm::Relocate::relocate): Likewise.
5410         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5411
5412 2010-01-29  Doug Kwan  <dougkwan@google.com>
5413
5414         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5415         of relocation types as ld.
5416
5417 2010-01-29  Doug Kwan  <dougkwan@google.com>
5418
5419         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5420         to public.
5421         (Arm_relocate_functions::thumb_branch_common): Ditto.
5422         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5423         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5424         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5425         Arm_relocate_functions::jump24): Remove.
5426         (Target_arm::Relocate::relocate): Adjust code to call
5427         Arm_relocation_functions::arm_branch_common and
5428         Arm_relocation_functions::thumb_branch_common instead of their removed
5429         wrappers.  Merge switch-cases together to reduce source code size.
5430
5431 2010-01-29  Doug Kwan  <dougkwan@google.com>
5432
5433         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5434         output_local_symbol_count_needs_update_.
5435         (Arm_relobj::output_local_symbol_count_needs_update,
5436          Arm_relobj::set_output_local_symbol_count_needs_update,
5437          Arm_relobj::update_output_local_symbol_count): New methods.
5438         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5439         member.
5440         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5441         of pointed function as in a R_ARM_PREL31 relocation.
5442         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5443         for output local symbol count updating.
5444         (Target_arm::do_relax): Update output local symbol counts in objects
5445         if necessary.
5446         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5447
5448 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5449
5450         * arm.cc: Added support for the ARM relocations:
5451         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5452         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5453         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5454         movw_prel_nc).
5455         (Arm_relocate_functions::movw_rel): New method.
5456         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5457         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5458         thm_movw_prel_nc).
5459         (Arm_relocate_functions::thm_movw_rel): New method.
5460         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5461         thm_movt_prel).
5462         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5463         relocations.
5464         (Target_arm::Scan::global): Likewise.
5465         (Target_arm::Relocate::relocate): Likewise.
5466         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5467         Likewise.
5468
5469 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5470
5471         * arm.cc: Added support for ARM group relocations.
5472         (Target_arm::reloc_needs_sym_origin): New method.
5473         (Arm_relocate_functions::calc_grp_kn): New method.
5474         (Arm_relocate_functions::calc_grp_residual): New method.
5475         (Arm_relocate_functions::calc_grp_gn): New method.
5476         (Arm_relocate_functions::arm_grp_alu): New Method.
5477         (Arm_relocate_functions::arm_grp_ldr): New Method.
5478         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5479         (Arm_relocate_functions::arm_grp_ldc): New Method.
5480         (Target_arm::Scan::local): Handle the ARM group relocations.
5481         (Target_arm::Scan::global): Likewise.
5482         (Target_arm::Relocate::relocate): Likewise.
5483         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5484         Likewise.
5485
5486 2010-01-26  Doug Kwan  <dougkwan@google.com>
5487
5488         * arm.cc (set): Include.
5489         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5490         pointer type.
5491         (Arm_output_section::Text_section_list): New type.
5492         (Arm_output_section::append_text_sections_to_list): New method.
5493         (Arm_output_section::fix_exidx_coverage): Ditto.
5494         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5495         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5496         Relobj::set_section_offset() instead of
5497         Sized_relobj::invalidate_section_offset().
5498         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5499         parameter for section headers. Ignore relocation sections for
5500         unallocated sections and EXIDX sections.
5501         (Target_arm::fix_exidx_coverage): New method.
5502         (Target_arm::output_section_address_less_than): New type.
5503         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5504         linked text section instead of the EXIDX section.
5505         (Arm_output_section::create_stub_group): Add an assertion to check
5506         that this is not an EXIDX output section.
5507         (Arm_output_section::append_text_sections_to_list): New method.
5508         (Arm_output_section::fix_exidx_coverage): Ditto.
5509         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5510         Arm_relobj::section_needs_reloc_stub_scanning.
5511         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5512         first pass.
5513         (Target_arm::fix_exidx_coverage): New method.
5514         * object.h (Relobj::set_output_section): New method.
5515         (Sized_relobj::invalidate_section_offset): Remove method.
5516         (Sized_relobj::do_invalidate_section_offset): Remove method.
5517         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5518
5519 2010-01-25  Doug Kwan  <dougkwan@google.com>
5520
5521         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5522         Fix warning due to signed and unsigned comparison on a 32-bit host.
5523
5524 2010-01-22  Doug Kwan  <dougkwan@google.com>
5525
5526         * arm.cc (Target_arm::do_relax): Record an output section for section
5527         offset adjustment it contains any stub table that has changed.
5528         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5529         offsets in an output section if necessary.
5530         * output.cc (Output_section::Output_section): Initialize
5531         section_offsets_need_adjustments_.
5532         (Output_section::add_input_section_for_script): Renamed to
5533         Output_section::add_simple_input_section.
5534         (Output_section::save_states): Add a comment.
5535         (Output_section::discard_states): New method defintion.
5536         (Output_section::adjust_section_offsets): Same.
5537         * output.h (Output_section::add_input_section_for_script): Renamed to
5538         Output_section::add_simple_input_section.
5539         (Output_section::discard_states): New method declaration.
5540         (Output_section::adjust_section_offsets): Same.
5541         (Output_section::section_offsets_need_adjustment,
5542         Output_section::set_section_offsets_need_adjustment): New method
5543         definitions.
5544         (Output_section::section_offsets_need_adjustment_): New data member.
5545         * script-sections.cc
5546         (Output_section_element_input::set_section_address): Adjust code for
5547         renaming of Output_section::add_input_section_for_script.
5548         (Orphan_output_section::set_section_address): Same.
5549
5550 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5551
5552         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5553         Fix_v4bx enum values .
5554         * gold/options.h (General_options): New option definitions.
5555         (General_options::fix_v4bx): New method.
5556         (General_options::Fix_v4bx): New enum.
5557         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5558         (General_options::parse_fix_v4bx_interworking): New method.
5559
5560 2010-01-22  Doug Kwan  <dougkwan@google.com>
5561
5562         * arm.cc (Arm_exidx_fixup): New class.
5563
5564 2010-01-21  Doug Kwan  <dougkwan@google.com>
5565
5566         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5567         classes.
5568         (Arm_exidx_section_offset_map): New type.
5569
5570 2010-01-21  Doug Kwan  <dougkwan@google.com>
5571
5572         * arm.cc (Arm_exidx_input_section): New class.
5573         (Arm_relobj::exidx_input_section_by_link,
5574         Arm_relobj::exidx_input_section_by_shndx,
5575         Arm_relobj::make_exidx_input_section): New methods.
5576         (read_arm_attributes_section): Remove.
5577         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5578         information about them.
5579         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5580         to here.
5581
5582 2010-01-20  Doug Kwan  <dougkwan@google.com>
5583
5584         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5585         Input_section_specifier to Section_id.
5586         (Target_arm::new_arm_input_section: Adjust code for change of key
5587         type.
5588         (Target_arm::find_arm_input_section): Ditto.
5589         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5590         (Section_id): Remove.
5591         (Garbage_collection::Section_id_hash): Remove.
5592         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5593         (Section_id): Remove.
5594         (Icf::Section_id_hash): Remove.
5595         * object.h (Section_id, Const_section_id, Section_id_hash,
5596         Const_section_id_hash): New type definitions.
5597         * output.cc (Output_section::add_relaxed_input_section): Change to
5598         use Const_section_id instead of Input_section_specifier as key type.
5599         (Output_section::add_merge_input_section): Ditto.
5600         (Output_section::build_relaxation_map): Change to use Section_id
5601         instead of Input_section_specifier as key type.
5602         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5603         Ditto.
5604         (Output_section::convert_input_sections_to_relaxed_sections): Change
5605         to use Const_section_id instead of Input_section_specifier as key type.
5606         (Output_section::find_merge_section): Ditto.
5607         (Output_section::find_relaxed_input_section): Ditto.
5608         * output.h (Input_section_specifier): Remove class.
5609         (Output_section::Output_section_data_by_input_section_map): Change
5610         key type to Const_section_id.
5611         (Output_section::Output_relaxed_input_section_by_input_section_map):
5612         Ditto.
5613         (Output_section::Relaxation_map): Change key type to Section_id.
5614
5615 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5616
5617         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5618         (class Arm_v4bx_stub): New class.
5619         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5620         (Stub_factory::make_arm_v4bx_stub): New method.
5621         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5622         (Stub_table::empty): Handle v4bx stubs.
5623         (Stub_table::add_arm_v4bx_stub): New method.
5624         (Stub_table::find_arm_v4bx_stub): New method.
5625         (Arm_relocate_functions::v4bx): New method.
5626         (Target_arm::fix_v4bx): New method.
5627         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5628         (Stub_table::relocate_stubs): Likewise.
5629         (Stub_table::do_write): Likewise.
5630         (Stub_table::update_data_size_and_addralign): Likewise.
5631         (Stub_table::finalize_stubs):  Likewise.
5632         (Target_arm::Scan::local): Likewise.
5633         (Target_arm::Scan::global): Likewise.
5634         (Target_arm::do_finalize_sections): Likewise.
5635         (Target_arm::Relocate::relocate): Likewise.
5636         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5637         Likewise.
5638         (Target_arm::scan_reloc_for_stub): Likewise.
5639         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5640
5641 2010-01-19  Ian Lance Taylor  <iant@google.com>
5642
5643         * output.cc (Output_section_headers::do_sized_write): Write large
5644         segment count to sh_info field.
5645         (Output_file_header::do_sized_write): For large segment count,
5646         write PN_XNUM to e_phnum field.
5647
5648 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5649
5650         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5651         (Arm_relocate_functions::thm_jump8): New function.
5652         (Arm_relocate_functions::thm_jump11): New function.
5653         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5654         R_ARM_THM_JUMP11.
5655         (Target_arm::Scan::global): Likewise.
5656         (Target_arm::Relocate::relocate): Likewise.
5657         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5658         Likewise.
5659
5660 2010-01-14  Doug Kwan  <dougkwan@google.com>
5661
5662         * arm.cc (map, utility): Include headers.
5663         (Target_arm::apply_cortex_a8_workaround): New method.
5664         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5665         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5666         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5667         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5668         the --[no-]fix-cortex-a8 command line options.
5669         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5670         (Target_arm::relocate_stub): Use addend in instruction template.
5671         * options.h (DEFINE_bool): Set the user-set flag.
5672         (General_options): Add --[no-]-fix-cortex options.
5673         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5674         : Update fast look-up map after conversion.
5675
5676 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5677
5678         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5679         in the first pass of do_layout.
5680
5681 2010-01-13  Doug Kwan  <dougkwan@google.com>
5682
5683         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5684         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5685         apparent compiler problem of not folding static constant integral
5686         data members of elfcpp::Elf_sizes<32>.
5687
5688 2010-01-13  Doug Kwan  <dougkwan@google.com>
5689
5690         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5691         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5692         Arm_relobj::scan_section_for_cortex_a8_erratum,
5693         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5694         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5695         sections to scan for relocation stubs into a new method
5696         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5697         relocation and Cortex-A8 stub scanning.
5698         (Target_arm::do_relax): Force stubs to be after stubbed sections
5699         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5700         the beginning of a new relaxation pass.  Update a comment.
5701         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5702
5703 2010-01-12  Ian Lance Taylor  <iant@google.com>
5704
5705         * target-reloc.h (visibility_error): New inline function.
5706         (relocate_section): Call visibility_error.
5707         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5708         (MOSTLYCLEANFILES): Likewise.
5709         (protected_4_pic.o, protected_3.err): New targets.
5710         * testsuite/protected_4.cc: New file.
5711
5712 2010-01-12  Doug Kwan  <dougkwan@google.com>
5713
5714         * arm.cc (Cortex_a8_reloc): New class.
5715         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5716         and cortex_a8_relocs_info_.
5717         (Target_arm::fix_cortex_a8): New method definition.
5718         (Target_arm::Cortex_a8_relocs_info): New type.
5719         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5720         New data member declarations.
5721         (Target_arm::scan_reloc_for_stub): Record information about
5722         relocations for THUMB branches that might be exempted from the
5723         Cortex-A8 workaround.
5724         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5725         at the beginning of a relaxation pass.
5726
5727 2010-01-12  Doug Kwan  <dougkwan@google.com>
5728
5729         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5730         (Arm_relobj::Mapping_symbol_position,
5731          Arm_reloj::Mapping_symbol_position_less,
5732          Arm_relobj::Mapping_symbols_info): New types.
5733         (Target_arm::is_mapping_symbol_name): New method definition.
5734         (Arm_relobj::do_count_local_symbols): Save information about mapping
5735         symbols.
5736
5737 2010-01-11  Doug Kwan  <dougkwan@google.com>
5738
5739         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5740         Arm_relocate_functions::thumb32_branch_upper,
5741         Arm_relocate_functions::thumb32_branch_lower,
5742         Arm_relocate_functions::thumb32_cond_branch_offset,
5743         Arm_relocate_functions::thumb32_cond_branch_upper,
5744         Arm_relocate_functions::thumb32_cond_branch_lower,
5745         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5746         branch offset encoding.
5747         (Arm_relocate_functions::thumb_branch_common): Use new branch
5748         offset encoding methods to avoid code duplication.
5749         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5750         (Stub_addend_reader::operator()): Use new branch encoding method
5751         to avoid code duplication.
5752
5753 2010-01-11  Doug Kwan  <dougkwan@google.com>
5754
5755         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5756         (Target_arm::do_finalize_sections): Define special EXIDX section
5757         symbols only if referenced.
5758         * gc.h (Garbage_collection::add_reference): New method.
5759         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5760         code duplication.
5761
5762 2010-01-11  Ian Lance Taylor  <iant@google.com>
5763
5764         * script.cc (Version_script_info::build_expression_list_lookup):
5765         Change complaing about duplicate wildcard match from error to
5766         warning.
5767
5768         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5769         of 2009-12-30.
5770         (Version_script_info::Version_script_info): Initialize globs_,
5771         default_version_, default_is_global_, and exact_.  Don't
5772         initialize globals_ or locals_.
5773         (Version_script_info::build_lookup_tables): Build local symbols
5774         first.
5775         (Version_script_info::unquote): New function.
5776         (Version_script_info::add_exact_match): New function.
5777         (Version_script_info::build_expression_list_lookup): Remove lookup
5778         parameter.  Add is_global parameter.  Change all callers.  Handle
5779         wildcard pattern specially.  Unquote pattern.  Call
5780         add_exact_match.
5781         (Version_script_info::get_name_to_match): New function.
5782         (Version_script_info::get_symbol_version): New function.
5783         (Version_script_info::get_symbol_version_helper): Remove.
5784         (Version_script_info::check_unmatched_names): Call unquote.
5785         * script.h (class Version_script_info): Change get_symbol_version
5786         to be non-inline and add is_global parameter; change all callers.
5787         Rewrite symbol_is_local.  Update declarations.  Define struct
5788         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5789         Remove globals_ and locals_ members.  Add exact_, globs_,
5790         default_version_, is_global_.
5791         (Version_script_info::Glob): Remove pattern, add expression and
5792         is_global.  Update constructor.  Change all callers.
5793         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5794         default version.
5795         (Versions::symbol_section_contents): If a symbol is undefined, or
5796         defined in a dynamic object, set the version index to
5797         VER_NDX_LOCAL.
5798         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5799         symbol_is_local.
5800         (Symbol_table::add_from_pluginobj): Likewise.
5801         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5802
5803 2010-01-11  Doug Kwan  <dougkwan@google.com>
5804
5805         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5806         (incremental_dump_LDADD): Add linking option for libintl.
5807         * Makefile.in: Regenerate.
5808
5809 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5810
5811         PR gold/11144
5812         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5813         instead of -Ds.
5814         * testsuite/Makefile.in: Regenerated.
5815
5816 2010-01-10  Doug Kwan  <dougkwan@google.com>
5817
5818         * options.h (DEFINE_var): Use parentheses around argument varname__
5819         in macro body to avoid any unintended subsequent substitutions.
5820
5821 2010-01-10  Ian Lance Taylor  <iant@google.com>
5822
5823         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5824         candidates before doing symbol resolution.
5825
5826         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5827         ODR candidates if only one is weak.
5828
5829 2010-01-08  Ian Lance Taylor  <iant@google.com>
5830
5831         * script.cc (Version_script_info::build_expression_list_lookup):
5832         Don't warn about ambiguous version, just record the ambiguity.
5833         (Version_script_info::get_symbol_version_helper): Give error if
5834         version is ambiguous.
5835
5836 2010-01-08  Doug Kwan  <dougkwan@google.com>
5837
5838         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5839           prev_data_size_ and prev_addralign_.  Remove initializer for
5840           deleted data member has_been_changed_.
5841           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5842           to determine if the table is empty.
5843           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5844           Remove.
5845           (Stub_table::add_reloc_stub): Define method in class definition
5846           instead of just declaring it there.
5847           (Stub_table::add_cortex_a8_stub): New method definition.
5848           (Stub_table::update_data_size_and_addralign): Ditto.
5849           (Stub_table::finalize_stubs): Ditto.
5850           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5851           (Stub_table::do_addralign_): Return address alignment in the
5852           (Stub_table::do_reset_address_and_file_offset): Define method in
5853           class definition instead of declaring it there.  Set current data
5854           size to be the data size of the previous pass.
5855           (Stub_table::set_final_data_size): Use current data size as the
5856           final data size.
5857           (Stub_table::relocate_stub): Change parameter type of stub from
5858           Reloc_stub pointer to Stub pointer.
5859           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5860           (Stub_table::Cortex_a8_stub_list): New typedef.
5861           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5862            Stub_table::prev_addralign_): New data member.
5863           (Arm_relobj::Arm_relobj): Initialize data member
5864           section_has_cortex_a8_workaround_.
5865           (Arm_relobj::section_has_cortex_a8_workaround,
5866            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5867            definitions.
5868           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5869           declarations.
5870           (Target_arm::relocate_stub): Change parameter type of stub from
5871           Reloc_stub pointer to Stub pointer.
5872           (Insn_template::size, Insn_template::alignment): Handle
5873           THUMB16_SPECIAL_TYPE.
5874           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5875            Stub_table::update_data_size_and_addralign,
5876            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5877           definitions.
5878           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5879           (Stub_table::do_write): Ditto.
5880           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5881
5882 2010-01-08  Ian Lance Taylor  <iant@google.com>
5883
5884         PR 11108
5885         * symtab.h (class Symbol): Remove fields is_target_special_ and
5886         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5887         (Symbol::is_defined_in_discarded_section): New function.
5888         (Symbol::set_is_defined_in_discarded_section): New function.
5889         (Symbol::has_plt_offset): Rewrite.
5890         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5891         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5892         Don't initialize is_target_special_ or has_plt_offset_.
5893         Initialize is_defined_in_discarded_section_.
5894         (Symbol_table::add_from_relobj): If appropriate, set
5895         is_defined_in_discarded_section.
5896         * resolve.cc (Symbol::override_base_with_special): Don't test
5897         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5898         * target-reloc.h (relocate_section): Do special handling for
5899         symbols defined in discarded sections for global symbols as well
5900         as local symbols.
5901
5902 2010-01-08  Ian Lance Taylor  <iant@google.com>
5903
5904         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5905         the SHT_SYMTAB case.
5906
5907 2010-01-08  Ian Lance Taylor  <iant@google.com>
5908
5909         * object.cc (Sized_relobj::do_layout): Don't get confused if
5910         layout_eh_frame returns NULL.
5911
5912 2010-01-08  Ian Lance Taylor  <iant@google.com>
5913
5914         PR 11084
5915         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5916         dynamic symbol table, use the normal symbol table.
5917         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5918         symbol table.
5919
5920 2010-01-08  Ian Lance Taylor  <iant@google.com>
5921
5922         PR 11072
5923         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5924         sections.
5925
5926 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5927
5928         * version.cc (print_version): Change to "Copyright 2010".
5929
5930 2010-01-08  Ian Lance Taylor  <iant@google.com>
5931
5932         PR 10287
5933         PR 11063
5934         * i386.cc (class Target_i386): Change return type of plt_section
5935         to be non-const.
5936         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5937         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5938         tls_desc_rel_ field.
5939         (Output_data_plt_i386::rel_tls_desc): New function.
5940         (Target_i386::rel_tls_desc_section): New function.
5941         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5942         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5943         R_386_TLS_DESC reloc in rel_tls_desc_section.
5944         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5945         Define struct Tlsdesc_info.
5946         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5947         (Target_x86_64::do_reloc_symbol_index): New function.
5948         (Target_x86_64::add_tlsdesc_info): New function.
5949         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5950         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5951         tlsdesc_rel_ field.
5952         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5953         all callers.
5954         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5955         (Target_x86_64::rela_tlsdesc_section): New function.
5956         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5957         handling.
5958         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5959         (Target_x86_64::do_reloc_addend): New function.
5960         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5961         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5962         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5963         (Output_reloc::type): New function.
5964         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5965         (Output_reloc::is_target_specific): New function.
5966         (Output_reloc::target_arg): New function.
5967         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5968         absolute relocs and target specific relocs.
5969         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5970         add_target_specific.
5971         (class Output_data_reloc) [SHT_RELA]: Likewise.
5972         * output.cc (Output_reloc::Output_reloc): Add four new versions
5973         for absolute relocs and target specific relocs.
5974         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5975         (Output_reloc::get_symbol_index): Likewise.
5976         (Output_reloc::local_section_offset): Check that local_sym_index_
5977         is not TARGET_CODE or 0.
5978         (Output_reloc::symbol_value): Likewise.
5979         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5980         reloc.
5981         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5982         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5983         functions.
5984         * layout.cc (add_target_dynamic_tags): Use output section for
5985         DT_PLTRELSZ and DT_JMPREL.
5986
5987 2010-01-07  Ian Lance Taylor  <iant@google.com>
5988
5989         PR 11061
5990         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5991         function.
5992         (class Output_data_reloc_generic): Define.
5993         (class Output_data_reloc_base): Change base class to
5994         Output_data_reloc_generic.  Change add() method to call
5995         bump_relative_reloc_count for a relative reloc.  Remove
5996         sort_relocs_ field.
5997         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5998         to sort_relocs().
5999         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6000         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6001         appropriate.
6002         * layout.h (class Layout): Update declaration.
6003
6004 2010-01-07  Ian Lance Taylor  <iant@google.com>
6005
6006         * output.h (class Output_data): Add const version of
6007         output_section and do_output_section.
6008         (class Output_section_data): Add const version of
6009         do_output_section.
6010         (class Output_section): Likewise.
6011         * layout.cc (Layout::add_target_dynamic_tags): New function.
6012         * layout.h (class Layout): Update declarations.
6013         * arm.cc (Target_arm::do_finalize_sections): Use
6014         add_target_dynamic_tags.
6015         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6016         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6017         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6018         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6019
6020 2010-01-07  Ian Lance Taylor  <iant@google.com>
6021
6022         PR 11042
6023         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6024         object as needed.
6025
6026 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6027             Ian Lance Taylor  <iant@google.com>
6028
6029         PR 11019
6030         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6031         Xindex::read_symtab_xindex.
6032
6033 2010-01-07  Doug Kwan  <dougkwan@google.com>
6034
6035         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6036         (Insn_template::thumb16_bcond_insn): New method declaration.
6037         (Insn_template): Fix spelling.
6038         (Stub::thumb16_special): New method declaration.
6039         (Stub::do_write): Define virtual method which was previously pure
6040         virtual.
6041         (Stub::do_thumb16_special): New method declaration.
6042         (Stub::do_fixed_endian_write): New template member.
6043         (Reloc_stub::do_write): Remove.
6044         (Reloc_stub::do_fixed_endian_write): Remove.
6045         (Cortex_a8_stub): New class definition.
6046         (Stub_factory::make_cortex_a8_stub): New method definition.
6047         (Stub_factory::Stub_factory): Add missing static storage class
6048         qualifier for elf32_arm_stub_a8_veneer_blx.
6049
6050 2010-01-07  Ian Lance Taylor  <iant@google.com>
6051
6052         PR 10980
6053         * options.h (class General_options): Add --warn-unresolved-symbols
6054         and --error-unresolved-symbols.
6055         * errors.cc (Errors::undefined_symbol): Implement
6056         --warn-unresolved-symbols.
6057
6058         * options.h (class General_options): Add -z text and -z textoff.
6059         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6060
6061 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6062
6063         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6064         (Garbage_collection::cident_sections): New function.
6065         (Garbage_collection::add_cident_section): New function.
6066         (Garbage_collection::cident_sections_): New member.
6067         (gc_process_relocs): Add references to sections whose names are C
6068         identifiers.
6069         * gold.h (cident_section_start_prefix): New constant.
6070         (cident_section_stop_prefix): New constant.
6071         (is_cident): New function.
6072         * layout.cc (Layout::define_section_symbols): Replace string constants
6073         with the newly defined constants.
6074         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6075         C identifiers.
6076         * testsuite/Makefile.am: Add gc_orphan_section_test.
6077         * testsuite/Makefile.in: Regenerate.
6078         * testsuite/gc_orphan_section_test.cc: New file.
6079         * testsuite/gc_orphan_section_test.sh: New file.
6080
6081 2010-01-06  Ian Lance Taylor  <iant@google.com>
6082
6083         PR 10980
6084         * options.h (class General_options): Add --warn-shared-textrel.
6085         * layout.cc (Layout::finish_dynamic_section): Implement
6086         --warn-shared-textrel.
6087
6088         PR 10980
6089         * options.h (class General_options): Add --warn-multiple-gp.
6090
6091 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6092
6093         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6094         $(THREADSLIB) and $(LIBDL).
6095         * Makefile.in: Rebuild.
6096
6097 2010-01-06  Ian Lance Taylor  <iant@google.com>
6098
6099         PR 10980
6100         * options.cc (General_options::parse_section_start): New function.
6101         (General_options::section_start): New function.
6102         (General_options::General_options): Initialize all members.
6103         * options.h: Include <map>
6104         (class General_options): Add --section-start.  Add section_starts_
6105         member.
6106         * layout.cc (Layout::attach_allocated_section_to_segment): If
6107         --section-start was used, set the address of the segment.  Remove
6108         local sort_sections.
6109         (Layout::relaxation_loop_body): If the address of the load segment
6110         has been set by --section-start, don't use it.
6111         * output.h (Output_segment::update_flags_for_output_section): New
6112         function.
6113         * output.cc (Output_segment::add_output_section): Call
6114         update_flags_for_output_section.
6115
6116 2010-01-05  Ian Lance Taylor  <iant@google.com>
6117
6118         PR 10980
6119         * options.h (class General_options): Add --undefined-version.
6120         * script.cc (struct Version_expression): Add was_matched_by_symbol
6121         field.
6122         (Version_script_info::matched_symbol): New function.
6123         (Version_script_info::get_symbol_version_helper): Call
6124         matched_symbol.
6125         (Version_script_info::check_unmatched_names): New function.
6126         * script.h (class Version_script_info): Update declarations.
6127         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6128
6129         * options.h (class General_options): Use DEFINE_bool_alias for
6130         allow_multiple_definition.
6131         * resolve.cc (Symbol_table::should_override): Don't test
6132         allow_multiple_definition.
6133
6134         PR 10980
6135         * options.h (class General_options): Add --cref.
6136         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6137         until after printing cref table.
6138         * cref.cc: Include "symtab.h".
6139         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6140         (Cref_table_compare::operator()): New function.
6141         (Cref_inputs::gather_cref): New function.
6142         (filecol): New static const.
6143         (Cref_inputs::print_cref): New function.
6144         (Cref::print_cref): New function.
6145         * cref.h: Include <cstdio>.
6146         (class Cref): Update declarations.
6147         * mapfile.h (Mapfile::file): New function.
6148         * object.h (class Object): Define Symbols.  Declare virtual
6149         do_get_global_symbols.
6150         (Object::get_global_symbols): New function.
6151         * object.cc (Input_objects::add_object): Pass object to cref_ if
6152         --cref.
6153         (Input_objects::archive_start): Likewise.
6154         (Input_objects::archive_stop): Likewise.
6155         (Input_objects::print_cref): New function.
6156         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6157         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6158         --cref.
6159         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6160         function.
6161         * plugin.h (class Sized_pluginobj): Update declarations.
6162
6163 2010-01-05  Ian Lance Taylor  <iant@google.com>
6164
6165         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6166         to is_default_version.  Rename insdef to insdefault.
6167         (Symbol_table::add_from_relobj): Rename def to is_default_version
6168         and local to is_forced_local.
6169         (Symbol_table::add_from_pluginobj): Likewise.
6170         (Symbol_table::add_from_dynobj): Likewise.
6171         (Symbol_table::define_special_symbol): Rename insdef to
6172         insdefault.
6173
6174 2010-01-04  Ian Lance Taylor  <iant@google.com>
6175
6176         PR 10980
6177         * options.h (class General_options): Add
6178         --allow-multiple-definition and -z muldefs.
6179         * resolve.cc (Symbol_table::should_override): Don't warn about a
6180         multiple symbol definition if --allow-multiple-definition or -z
6181         muldefs.
6182
6183         PR 10980
6184         * options.h (class General_options): Add --add-needed and
6185         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6186         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6187         error if --copy-dt-needed-entries aka --add-needed is used and
6188         would cause a change in behaviour.
6189
6190         PR 10980
6191         * options.h (class General_options): Add -G as a short version of
6192         --shared.  Add no-op options -assert, -g, and -i.
6193
6194 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6195
6196         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6197         check for .text or .gnu.linkonce.t sections.
6198         * icf.cc (Icf::find_identical_sections): Ditto.
6199         Change the detection for mangled function name within the section
6200         name.
6201         * icf.h (is_section_foldable_candidate): New function.
6202
6203 2009-12-30  Ian Lance Taylor  <iant@google.com>
6204
6205         PR 10980
6206         * options.h (class General_options): Permit two dashes with
6207         --retain-symbols-file.
6208
6209 2009-12-30  Ian Lance Taylor  <iant@google.com>
6210
6211         PR 10979
6212         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6213         don't put the file header and segment headers in the text
6214         segment.
6215
6216         PR 10979
6217         * common.cc (Sort_commons::operator()): Stabilize sort when both
6218         entries are NULL.
6219         (Symbol_table::do_allocate_commons_list): When allocating common
6220         symbols, skip a symbol which is no longer common.
6221         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6222         an object before checking its type.
6223         * testsuite/common_test_2.c: New file.
6224         * testsuite/common_test_3.c: New file.
6225         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6226         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6227         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6228         (common_test_2_pic.o, common_test_2.so): New targets.
6229         (common_test_3_pic.o, common_test_3.so): New targets.
6230         * testsuite/Makefile.in: Rebuild.
6231
6232         PR 10979
6233         * script.cc (read_input_script): If we see a new SECTIONS clause,
6234         and we have added an input section, give an error.
6235         * layout.h (class Layout): Add have_added_input_section function.
6236         Add have_added_input_section_ field.
6237         * layout.cc (Layout::Layout): Initialize
6238         have_added_input_section_.
6239         (Layout::layout): Set have_added_input_section_.
6240         (Layout::layout_eh_frame): Likewise.
6241
6242 2009-12-30  Ian Lance Taylor  <iant@google.com>
6243
6244         PR 10931
6245         * options.h (class General_options): Add --sort-common option.
6246         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6247         * common.cc (Sort_common): Add sort_order parameter to
6248         constructor.  Add sort_order_ field.
6249         (Sort_commons::operator): Check sort_order_.
6250         (Symbol_table::allocate_commons): Determine the sort order.
6251         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6252         Change all callers.
6253         (Symbol_table::do_allocate_commons_list): Likewise.
6254
6255 2009-12-30  Ian Lance Taylor  <iant@google.com>
6256
6257         PR 10916
6258         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6259         symbols from this object, don't change the visibility of an
6260         undefined symbol.
6261         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6262
6263 2009-12-30  Ian Lance Taylor  <iant@google.com>
6264
6265         PR 10861
6266         * script.h (class Version_script_info): Define Language enum.
6267         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6268         new fields globals_, locals_, and is_finalized_.
6269         * script.cc: Various formatting fixes.
6270         (class Parser_closure): Change language_stack_ from a vector of
6271         std::string to one of Version_script_info::Language.  Adjust all
6272         uses accordingly.
6273         (class Lazy_demangler): Remove.
6274         (struct Version_expression): Change language from std::string to
6275         Version_script_info::Language.
6276         (Version_script_info::Version_script_info): New function.
6277         (Version_script_info::~Version_script_info): Don't call clear.
6278         (Version_script_info::finalize): New function.
6279         (Version_script_info::build_lookup_tables): New function.
6280         (Version_script_info::build_expression_list_lookup): New
6281         function.
6282         (Version_script_info::get_symbol_version_helper): Rewrite to use
6283         lookup tables.
6284         (Version_script_info::print_expression_list): Adjust to use
6285         Version_script_info::Language.
6286         (script_push_lex_into_version_mode): Check that the version script
6287         has not been finalized.
6288         (version_script_push_lang): Change language string to
6289         Version_script_info::Language.
6290         * options.cc (Command_line::version_script): New function.
6291         * options.h (class General_options): Add finalize_dynamic_list
6292         function.  Change version_script from declaration to definition.
6293         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6294         * testsuite/version_script.map: Remove duplicate def of foo.
6295         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6296         version_script.map.
6297         * testsuite/Makefile.in: Rebuild.
6298
6299 2009-12-30  Ian Lance Taylor  <iant@google.com>
6300
6301         PR 10843
6302         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6303         if the input symbol index is 0, make the output symbol index 0.
6304
6305 2009-12-30  Ian Lance Taylor  <iant@google.com>
6306
6307         PR 10670
6308         * options.h (class General_options): Add -x/--discard-all.
6309         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6310         --discard-all.  If the local symbol needs a dynamic entry, check
6311         that before handling --discard-locals.
6312
6313 2009-12-30  Ian Lance Taylor  <iant@google.com>
6314
6315         PR 10450
6316         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6317         flags to PF_R.
6318         (Output_segment::add_output_section): Don't change the flags if
6319         the type is PT_TLS.
6320
6321         PR 10450
6322         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6323         GNU hash table if they need a dynamic value.  Otherwise, don't add
6324         them if they are defined in a dynamic object or are forced local.
6325
6326 2009-12-29  Ian Lance Taylor  <iant@google.com>
6327
6328         PR 10450
6329         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6330         .gnu.hash table for a 32-bit target.
6331
6332         PR 10450
6333         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6334         regular and a dynamic object only needs a dynamic symbol table
6335         entry if it is externally visible.
6336
6337         PR 10450
6338         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6339         constructor.  Add global_offset_table_ field.
6340         (Target_i386::got_section): Set global_offset_table_.
6341         (Target_i386::do_finalize_sections): Set global_offset_table_
6342         size.
6343         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6344         in constructor.  Add global_offset_table_ field.
6345         (Target_x86_64::got_section): Set global_offset_table_.
6346         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6347         size.
6348
6349         * layout.cc (Layout::Layout): Initialize increase_relro_.
6350         (Layout::get_output_section): Add is_relro, is_last_relro, and
6351         is_first_non_relro parameters.  Change all callers.
6352         (Layout::choose_output_section): Likewise.
6353         (Layout::add_output_section_data): Likewise.
6354         (Layout::make_output_section): Likewise.
6355         (Layout::set_segment_offsets): Clear increase_relro when using a
6356         linker script.
6357         * layout.h (class Layout): Add increase_relro method.  Add
6358         increase_relro_ field.  Update declarations.
6359         * output.cc (Output_section::Output_section): Initialize
6360         is_last_relro_ and is_first_non_relro_.
6361         (Output_segment::add_output_section): Group relro sections is
6362         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6363         (Output_segment::maximum_alignment): Remove relro handling.
6364         (Output_segment::set_section_addresses): Add increase_relro
6365         parameter.  Change all callers.  Add initial alignment to align
6366         relro sections on separate page.  Remove old relro handling.
6367         (Output_segment::set_section_list_addresses): Remove in_relro
6368         parameter.  Change all callers.
6369         (Output_segment::set_offset): Add increase parameter.  Change all
6370         callers.  Remove old relro handling.
6371         * output.h (class Output_section): Add new methods: is_last_relro,
6372         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6373         Add is_last_relro_ and is_first_non_relro_ fields.
6374         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6375         Create separate .got.plt section.  Call increase_relro.
6376         * x86_64.cc (Target_x86_64::got_section): Likewise.
6377         * testsuite/relro_script_test.t: Add .got.plt.
6378
6379         PR 10450
6380         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6381         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6382         (Layout::finalize): Call set_dynamic_symbol_size.
6383         (Layout::set_dynamic_symbol_size): New function.
6384         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6385         set_dynamic_symbol_size.
6386
6387         PR 10450
6388         * output.h (class Output_section): Add is_entsize_zero_ field.
6389         * output.cc (Output_section::Output_section): Initialize
6390         is_entsize_zero_.
6391         (Output_section::set_entsize): If two different entsizes are
6392         requested, force it to zero.
6393         (Output_section::add_input_section): Set flags for .debug_str
6394         before updating section flags.  Set entsize.
6395         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6396         and SHF_STRING if all input sections have those flags.
6397
6398 2009-12-29   Rafael Espindola  <espindola@google.com>
6399
6400         * main.cc (main): Fix the sys time reporting.
6401         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6402         reporting.
6403
6404 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6405
6406         * options.cc (General_options::parse_version): Allow -v to exit
6407         without an error if there is nothing to link.
6408
6409 2009-12-29  Ian Lance Taylor  <iant@google.com>
6410
6411         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6412         using a version of gcc before 4.1.
6413         * configure: Rebuild.
6414
6415 2009-12-28  Chris Demetriou  <cgd@google.com>
6416
6417         * attributes.cc (Output_attributes_section_data::do_write): Use
6418         std::vector::front rather than std::vector::data.
6419
6420 2009-12-28  Ian Lance Taylor  <iant@google.com>
6421
6422         * symtab.h (class Symbol_table): Add enum Defined.
6423         * resolve.cc (Symbol_table::should_override): Add defined
6424         parameter.  Change all callers.  Test whether object is NULL
6425         before calling a method on it.
6426         (Symbol_table::report_resolve_problem): Add defined parameter.
6427         Change all callers.
6428         (Symbol_table::should_override_with_special): Likewise.
6429         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6430         parameter.  Change all callers.
6431         (Symbol_table::do_define_in_output_data): Likewise.
6432         (Symbol_table::define_in_output_segment): Likewise.
6433         (Symbol_table::do_define_in_output_segment): Likewise.
6434         (Symbol_table::define_as_constant): Likewise.
6435         (Symbol_table::do_define_as_constant): Likewise.
6436         * script.h (class Symbol_assignment): Add is_defsym parameter to
6437         constructor; change all callers.
6438         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6439         parameter.  Change all callers.  Add is_defsym_ field.
6440         (class Parser_closure): Add parsing_defsym parameter to
6441         constructor; change all callers.  Add parsing_defsym accessor
6442         function.  Add parsing_defsym_ field.
6443
6444 2009-12-28  Ian Lance Taylor  <iant@google.com>
6445
6446         * gold.cc (queue_middle_tasks): Fix formatting.
6447         * object.cc (Relobj::is_section_name_included): Likewise.
6448
6449 2009-12-23  Ian Lance Taylor  <iant@google.com>
6450
6451         * i386.cc (Target_i386::do_calls_non_split): Recognize
6452         -fsplit-stack prologue for a function with a static chain.
6453         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6454         -fsplit-stack prologue when using %r11.
6455
6456 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6457
6458         * options.cc (General_options::parse_version): Make -v continue and do
6459         the link like GNU ld does.
6460
6461 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6462
6463         * Makefile.am (CCFILES): Add timer.cc.
6464         (HFILES): Add timer.h.
6465         * configure.ac: Check for sysconf and times.
6466         * main.cc: include timer.h.
6467         (main): Use Timer instead of get_run_time.
6468         * timer.cc: New.
6469         * timer.h: New.
6470         * workqueue.cc: include timer.h.
6471         (Workqueue::find_and_run_task):
6472         Report user, sys and wall time.
6473         * Makefile.in: Regenerate.
6474         * config.in: Regenerate.
6475         * configure: Regenerate.
6476
6477 2009-12-16  Doug Kwan  <dougkwan@google.com>
6478
6479         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6480         sections.
6481         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6482         relaxed input sections.
6483         * output.cc (Output_section::find_relaxed_input_section): Change
6484         return type to Output_relaxed_input_section pointer.  Adjust code
6485         for new type of relaxed_input_section_map_.
6486         * output.h (Output_section::find_relaxed_input_section): Change
6487         return type to Output_relaxed_input_section pointer.
6488         (Output_section::Output_relaxed_input_section_by_input_section_map):
6489         New type.
6490         (Output_section::relaxed_input_section_map_): Change type to
6491         Output_section::Output_relaxed_input_section_by_input_section_map.
6492         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6493         input section.
6494
6495 2009-12-15  Ian Lance Taylor  <iant@google.com>
6496
6497         * layout.cc (Layout::create_shstrtab): Only write out after input
6498         sections if we are compressing debug sections.
6499
6500 2009-12-15  Ian Lance Taylor  <iant@google.com>
6501
6502         * archive.cc (Archive::add_symbols): Only look up a symbol without
6503         a version if there is, in fact, a version.
6504
6505 2009-12-14  Ian Lance Taylor  <iant@google.com>
6506
6507         Revert -Wshadow changes, all changes from:
6508         2009-12-11  Doug Kwan  <dougkwan@google.com>
6509         2009-12-11  Nick Clifton  <nickc@redhat.com>
6510         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6511
6512 2009-12-11  Doug Kwan  <dougkwan@google.com>
6513
6514         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6515         due to -Wshadow.
6516         * attributes.cc (Object_attribute::size): Ditto.
6517         (Attributes_section_data::size): Ditto.
6518         (Attributes_section_data::Attributes_section_data): Ditto.
6519         (Output_attributes_section_data::do_write): Ditto.
6520         * attributes.h (Object_attribute::set_type): Ditto.
6521         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6522
6523 2009-12-11  Nick Clifton  <nickc@redhat.com>
6524
6525         * archive.cc: Fix shadowed variable warnings.
6526         * arm.cc: Likewise.
6527         * compressed_output.cc: Likewise.
6528         * compressed_output.h: Likewise.
6529         * configure: Likewise.
6530         * dwarf_reader.cc: Likewise.
6531         * dynobj.cc: Likewise.
6532         * dynobj.h: Likewise.
6533         * ehframe.cc: Likewise.
6534         * ehframe.h: Likewise.
6535         * errors.cc: Likewise.
6536         * expression.cc: Likewise.
6537         * fileread.cc: Likewise.
6538         * fileread.h: Likewise.
6539         * freebsd.h: Likewise.
6540         * i386.cc: Likewise.
6541         * icf.cc: Likewise.
6542         * incremental.h: Likewise.
6543         * layout.cc: Likewise.
6544         * layout.h: Likewise.
6545         * mapfile.cc: Likewise.
6546         * merge.cc: Likewise.
6547         * merge.h: Likewise.
6548         * object.cc: Likewise.
6549         * object.h: Likewise.
6550         * options.h: Likewise.
6551         * output.cc: Likewise.
6552         * output.h: Likewise.
6553         * parameters.cc: Likewise.
6554         * plugin.cc: Likewise.
6555         * powerpc.cc: Likewise.
6556         * reduced_debug_output.cc: Likewise.
6557         * reduced_debug_output.h: Likewise.
6558         * reloc.cc: Likewise.
6559         * reloc.h: Likewise.
6560         * resolve.cc: Likewise.
6561         * script-sections.cc: Likewise.
6562         * script.cc: Likewise.
6563         * script.h: Likewise.
6564         * sparc.cc: Likewise.
6565         * symtab.cc: Likewise.
6566         * symtab.h: Likewise.
6567         * target-select.cc: Likewise.
6568         * target-select.h: Likewise.
6569         * token.h: Likewise.
6570         * workqueue.cc: Likewise.
6571         * workqueue.h: Likewise.
6572         * x86_64.cc: Likewise.
6573
6574 2009-12-10  Doug Kwan  <dougkwan@google.com>
6575
6576         * arm.cc (attributes.h): New include.
6577         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6578         (Arm_relobj::~Arm_relobj): Delete object pointed by
6579         attributes_section_data_.
6580         (Arm_relobj::attributes_section_data): New method definition.
6581         (Arm_relobj::attributes_section_data_): New data member declaration.
6582         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6583         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6584         attributes_section_data_.
6585         (Arm_dynobj::attributes_section_data): New method definition.
6586         (Arm_dynobj::attributes_section_data_): New data member declaration.
6587         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6588         initialization value of may_use_blx_ to false.
6589         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6590         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6591         object attributes to compute results instead of hard-coding.
6592         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6593         Target_arm::get_secondary_compatible_arch,
6594         Target_arm::set_secondary_compatible_arch
6595         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6596         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6597         New method declarations.
6598         (Target_arm::get_aeabi_object_attribute): New method definition.
6599         (Target_arm::attributes_section_data_): New data member declaration.
6600         (read_arm_attributes_section): New template definition.
6601         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6602         (Arm_dynobj::do_read_symbols): Ditto.
6603         (Target_arm::do_finalize_sections): Merge attributes sections from
6604         input.  Check for BLX use after attributes section merging.
6605         Fix __exidx_start and __exidx_end visibility.  Create an
6606         .ARM.attributes section if necessary.
6607         (Target_arm::get_secondary_compatible_arch,
6608         Target_arm::set_secondary_compatible_arch,
6609         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6610         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6611         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6612         New method definitions.
6613
6614 2009-12-09  Ian Lance Taylor  <iant@google.com>
6615
6616         * plugin.cc (Plugin::load): Don't cast from void* to a function
6617         pointer.
6618
6619 2009-12-09  Ian Lance Taylor  <iant@google.com>
6620
6621         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6622         information fields.
6623
6624 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6625
6626         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6627         Replace two_file_shared_1.so with two_file_shared_2.so.
6628         * testsuite/Makefile.in: Regenerated.
6629
6630 2009-12-08  Doug Kwan  <dougkwan@google.com>
6631
6632         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6633         (HFILES): Add attributes.h and int_encoding.h.
6634         * Makefile.in: Regenerate.
6635         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6636         function definitions to int_encoding.cc
6637         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6638         prototypes to int_encoding.h
6639         * reduced_debug_output.cc (int_encoding.h): New include.
6640         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6641         function definitions to int_encoding.cc
6642         (insert_into_vector, read_from_pointer): Move template definitions to
6643         int_encoding.h
6644         * attributes.cc: New file.
6645         * attributes.h: New file.
6646         * int_encoding.cc: New file.
6647         * int_encoding.h: New file.
6648
6649 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6650
6651         PR gold/11055
6652         * incremental-dump.cc (dump_incremental_inputs): New.
6653         (main): Use dump_incremental_inputs.
6654
6655 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6656
6657         PR gold/10893
6658         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6659         checking elfcpp::STT_FUNC.
6660         (Target_i386::Relocate::relocate): Likewise.
6661         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6662
6663         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6664         symbols from shared libraries into normal FUNC symbols.
6665
6666         * symtab.h (Symbol): Add is_func and use it.
6667
6668 2009-12-05  Doug Kwan  <dougkwan@google.com>
6669
6670         * arm.cc (Target_arm::arm_info): Initialize new fields
6671         attributes_section and attributes_vendor.
6672         * i386.cc (Target_i386::i386_info): Same.
6673         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6674         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6675         fields attributes_section and attributes_vendor.
6676         * sparc.cc (Target_sparc::sparc_info): Same.
6677         * target.h (Target::attributes_section, Target::attributes_vendor,
6678         Target::is_attributes_section, Target::attribute_arg_type,
6679         Target::attributes_order): New method definitions.
6680         (Target::Target_info::attributes_section,
6681         Target::Target_info::attributes_vendor): New fields.
6682         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6683         virtual method definitions.
6684         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6685         attributes_section and attributes_vendor.
6686         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6687
6688 2009-12-05  Doug Kwan  <dougkwan@google.com>
6689
6690         * arm.cc: Update comments about interworking and stub generation.
6691         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6692         considered as non-PIC.
6693         (Arm_relocate_functions::base_abs): Fix formatting.
6694         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6695         of function to use GOT entry address instead of offset.
6696         (Target_arm::Scan::global): Issue an error if a symbol would need a
6697         PLT does not get one because it is untyped.  Remove code to create
6698         dynamic symbols for relative branches.
6699         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6700         takes unsigned integer instead of boolean.
6701
6702 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6703
6704         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6705         (two_file_test_LDADD): Likewise.
6706         (common_test_1_LDADD): Likewise.
6707         (exception_test_LDADD) Likewise.
6708         (weak_test_LDADD): Likewise.
6709         (many_sections_test_LDADD): Likewise.
6710         (initpri1_LDADD): Likewise.
6711         (script_test_1_LDADD): Likewise.
6712         (script_test_2_LDADD): Likewise.
6713         (justsyms_LDADD): Likewise.
6714         (binary_test_LDADD): Likewise.
6715         (large_LDADD): Likewise.
6716         * testsuite/Makefile.in: Regenerated.
6717
6718 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6719
6720         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6721         (Symbol_table::override_with_special): Likewise.
6722         (Symbol_table::add_from_object): Likewise.
6723
6724 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6725
6726         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6727         Don't set the data_offset twice.
6728
6729 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6730
6731         * testsuite/Makefile.in: Regenerate.
6732
6733 2009-12-03  Doug Kwan  <dougkwan@google.com>
6734
6735         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6736         (Target_arm::do_finalize_sections): Add parameter for symbol table
6737         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6738         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6739         parameter for symbol table pointer.
6740         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6741         an additional parameter for a pointer to symbol table.
6742         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6743         parameter for a symbol table pointer.
6744         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6745         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6746         Ditto.
6747         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6748         parameter for a symbol table pointer.
6749
6750 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6751
6752         * incremental.cc (Incremental_inputs_header)
6753         (Incremental_inputs_header_write, Incremental_inputs_entry)
6754         (Incremental_inputs_entry_write): Move ...
6755         * incremental.h (Incremental_inputs_header)
6756         (Incremental_inputs_header_write, Incremental_inputs_entry)
6757         (Incremental_inputs_entry_write): here.
6758
6759 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6760
6761         * incremental.cc (make_sized_incremental_binary): Set the target.
6762         Error if it is incompatible.
6763         * output.h (Output_file): Add filename method.
6764
6765 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6766
6767         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6768         from the get_* methods.
6769
6770 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6771
6772         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6773         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6774         Write 0 for the data_offset of scripts.
6775
6776 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6777
6778         * testsuite/Makefile.am: Add the incremental_test.sh test.
6779         * testsuite/incremental_test.sh: New.
6780         * testsuite/incremental_test_1.c: New.
6781         * testsuite/incremental_test_2.c: New.
6782
6783 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6784
6785        * incremental-dump.cc (main): Fix typos.
6786
6787 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6788
6789         PR gold/11025
6790         * incremental-dump.cc (main): Use llu to print 64 bit values.
6791
6792 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6793             H.J. Lu  <hongjiu.lu@intel.com>
6794
6795         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6796         $(LIBDL).
6797         (incremental_dump_LDADD): Likewise.
6798         * Makefile.in: Regenerated.
6799
6800 2009-11-25  Doug Kwan  <dougkwan@google.com>
6801
6802         Revert:
6803
6804         2009-11-25  Doug Kwan  <dougkwan@google.com>
6805
6806                 * arm.cc (Target_arm::Target_arm): Move method definition
6807                 outside of class definition.  Add code to handle
6808                 --target1-rel, --target1-abs and --target2= options.
6809                 (Target_arm::get_reloc_reloc_type): Change method to be
6810                 non-static and const.
6811                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6812                 New data member declaration.
6813                 (Target_arm::Scan::local, Target_arm::Scan::global,
6814                 Target_arm::Relocate::relocate,
6815                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6816                 Adjust call to Target_arm::get_real_reloc_type.
6817                 (Target_arm::get_real_reloc_type): Use command line options
6818                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6819                 * options.h (--target1-rel, --target1-abs, --target2): New
6820                 ARM-only options.
6821
6822 2009-11-25  Doug Kwan  <dougkwan@google.com>
6823
6824         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6825         class definition.  Add code to handle --target1-rel, --target1-abs
6826         and --target2= options.
6827         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6828         and const.
6829         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6830         member declaration.
6831         (Target_arm::Scan::local, Target_arm::Scan::global,
6832         Target_arm::Relocate::relocate,
6833         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6834         call to Target_arm::get_real_reloc_type.
6835         (Target_arm::get_real_reloc_type): Use command line options to
6836         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6837         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6838         options.
6839
6840 2009-11-25  Doug Kwan  <dougkwan@google.com>
6841
6842         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6843         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6844         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6845         formatting.
6846         (Arm_relocate_functions::thm_call): Replace body with a call to
6847         Arm_relocate_functions::thumb_branch_common.
6848         (Arm_relocate_functions::thm_jump24,
6849         Arm_relocate_functions::thm_xpc22): New method definitions.
6850         (Arm_relocate_functions::thumb_branch_common): New method definition.
6851         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6852         operator.
6853         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6854         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6855
6856 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6857
6858         * Makefile.am: Build incremental-dump
6859         * Makefile.in: Regenerate.
6860         * incremental-dump.cc: New.
6861         * incremental.cc (Incremental_inputs_header_data,
6862         Incremental_inputs_entry_data): Move to incremental.h
6863         * incremental.h: (Incremental_inputs_header_data,
6864         Incremental_inputs_entry_data): Move from incremental.cc
6865
6866 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6867
6868         * incremental.cc (Incremental_inputs_header,
6869         Incremental_inputs_header_write, Incremental_inputs_entry,
6870         Incremental_inputs_entry_write): Add a typedef with the data type.
6871
6872 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6873
6874         * incremental.cc (Incremental_inputs_header,
6875         Incremental_inputs_header_write, Incremental_inputs_entry,
6876         Incremental_inputs_entry_write): Update comment about which
6877         type has the filed descriptions.
6878
6879 2009-11-15  Doug Kwan  <dougkwan@google.com>
6880
6881         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6882         (Arm_relocate_functions::arm_branch_common): Change method defintion
6883         in class definition to a method declaration and update list of formal
6884         parameters.
6885         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6886         Arm_relocation_functions::jump24): Adjust call to
6887         Arm_relocate_functions::arm_branch_common.  Update list of formal
6888         parameters.
6889         (Arm_relocate_functions::xpc25): New method definition.
6890         (Arm_relocate_functions::arm_branch_common): Move method defintion
6891         out from class definition.  Use stubs for mode-switching and extending
6892         branch ranges.
6893         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6894         specially.  Change code to enable use of stubs in ARM branches.
6895
6896 2009-11-10  Doug Kwan  <dougkwan@google.com>
6897
6898         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6899         in method declaration.
6900         (Target_arm::relocate_stub): New method declaration.
6901         (Target_arm::default_target): Change to return a pointer instead of
6902         a const reference.
6903         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6904         Target_arm::default_target.
6905         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6906         method definition.
6907         (Target_arm::relocate_section): Adjust view.
6908         (Target_arm::relocate_stub): New method definition.
6909
6910 2009-11-10  Doug Kwan  <dougkwan@google.com>
6911
6912         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6913         a format warning.
6914         * incremental.cc (open_incremental_binary): Initialized local
6915         variables to avoid warnings.
6916         * object.cc (make_elf_object): Ditto.
6917         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6918         a format warning.
6919
6920 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6921
6922         PR gold/10930
6923         * testsuite/plugin_test.c: Include "config.h".
6924
6925 2009-11-09  Doug Kwan  <dougkwan@google.com>
6926
6927         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6928         (arm_symbol_value): Remove.
6929         (Arm_relocate_functions::arm_branch_common,
6930         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6931         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6932         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6933         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6934         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6935         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6936         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6937         Arm_relocate_functions::thm_mobw_abs_nc,
6938         Arm_relocate_functions::thm_mov_abs,
6939         Arm_relocate_functions::movw_prel_nc,
6940         Arm_relocate_functions::thm_movt_abs,
6941         Arm_relocate_functions::movt_prel,
6942         Arm_relocate_functions::thm_movw_prel_nc,
6943         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6944         (Target_arm::Relocate::relocate): Only decompose address into two
6945         parts if relocation type uses the thumb-bit and pass the actual
6946         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6947         calls to methods in Arm_relocate_functions for this change.
6948
6949 2009-11-08  Ian Lance Taylor  <iant@google.com>
6950
6951         PR 10925
6952         * reloc.cc: Instantiate
6953         Sized_relobj::initialize_input_to_output_maps and
6954         Sized_relobj:free_input_to_output_maps.
6955
6956 2009-11-06  Ian Lance Taylor  <iant@google.com>
6957
6958         PR 10876
6959         * defstd.cc (in_segment): Set only_if_ref true for "end".
6960
6961 2009-11-06  Doug Kwan  <dougkwan@google.com>
6962
6963         * arm.cc (class Reloc_stub): Correct a comment.
6964         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6965         (Target_arm::scan_section_for_stubs): New method declaration.
6966         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6967         Change methods from private to protected.
6968         (Target_arm::do_may_relax): New method definition.
6969         (Target_arm::do_relax, Target_arm::group_sections,
6970         Target_arm::scan_reloc_for_stub,
6971         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6972         (Target_arm::arm_input_section_map_): New data member declaration.
6973         (Target_arm::scan_reloc_for_stub,
6974         Target_arm::scan_reloc_section_for_stubs,
6975         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6976         Target_arm::do_relax): New method definitions.
6977
6978 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6979
6980         * configure.ac: Check for (struct stat)::st_mtim
6981         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6982         * config.in: Regenerate.
6983         * configure: Regenerate.
6984
6985 2009-11-05  Ian Lance Taylor  <iant@google.com>
6986
6987         PR 10910
6988         * output.cc (Output_segment::add_output_section): Add missing
6989         return statement.
6990
6991 2009-11-04  Ian Lance Taylor  <iant@google.com>
6992
6993         PR 10880
6994         * object.h (class Object): Add is_needed and set_is_needed
6995         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6996         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6997         defined in a dynamic object and referenced by a regular object,
6998         set is_needed for the dynamic object.
6999         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7000         if the file is marked with as_needed and it is not needed.
7001
7002 2009-11-04  Ian Lance Taylor  <iant@google.com>
7003
7004         PR 10887
7005         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7006         tags if data is discarded by linker script.
7007         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7008         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7009         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7010         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7011
7012 2009-11-04  Ian Lance Taylor  <iant@google.com>
7013
7014         * layout.cc (Layout::get_output_section): Add is_interp and
7015         is_dynamic_linker_section parameters.  Change all callers.
7016         (Layout::choose_output_section): Likewise.
7017         (Layout::make_output_section): Likewise.
7018         (Layout::add_output_section_data): Add is_dynamic_linker_section
7019         parameter.  Change all callers.
7020         * layout.h (class Layout): Update declarations.
7021         * output.h (class Output_section): Add is_interp, set_is_interp,
7022         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7023         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7024         generate_code_fills_at_write_ to a bitfield.
7025         * output.cc (Output_section::Output_sections): Initialize new
7026         fields.
7027         (Output_segment::add_output_section): Add do_sort parameter.
7028         Change all callers.
7029
7030 2009-11-03  Ian Lance Taylor  <iant@google.com>
7031
7032         PR 10860
7033         * options.h (class General_options): Add --warn-common.
7034         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7035         merging two common symbols.
7036         (Symbol_table::should_override): Handle --warn-common when merging
7037         a common symbol with a defined symbol.  Use report_resolve_problem
7038         for multiple definitions.
7039         (Symbol_table::report_resolve_problem): New function.
7040         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7041
7042 2009-11-03  Doug Kwan  <dougkwan@google.com>
7043
7044         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7045         stub_factory_.
7046         (Target_arm::stub_factory): New method definition.
7047         (Target_arm::new_arm_input_section,
7048         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7049         Target_arm::reloc_uses_thumb_bit): New method declarations.
7050         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7051         New type definitions.
7052         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7053         member declarations.
7054         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7055         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7056         New method definitions.
7057
7058 2009-11-03  Ian Lance Taylor  <iant@google.com>
7059
7060         * options.h (class General_options): Add --warn_constructors.
7061
7062 2009-11-03  Ian Lance Taylor  <iant@google.com>
7063
7064         PR 10893
7065         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7066         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7067
7068 2009-11-03  Ian Lance Taylor  <iant@google.com>
7069
7070         PR 10895
7071         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7072         --msgid-bugs-address.
7073         (install-pdf): New target.
7074         (install-data_yes): Look up one directory to find mkinstalldirs.
7075
7076 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7077
7078         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7079         tree.
7080
7081 2009-10-30  Doug Kwan  <dougkwan@google.com>
7082
7083         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7084
7085 2009-10-30  Doug Kwan  <dougkwan@google.com>
7086
7087         * arm.cc (Stub_addend_reader): New struct template definition
7088         and partial specializations.
7089         (Stub_addend_reader::operator()): New method definition for a
7090         partially specialized template.
7091
7092 2009-10-30  Doug Kwan  <dougkwan@google.com>
7093
7094         * arm.cc (Arm_relobj::processor_specific_flags): New method
7095         definition.
7096         (Arm_relobj::do_read_symbols): New method declaration.
7097         (Arm_relobj::processor_specific_flags_): New data member declaration.
7098         (Arm_dynobj): New class definition.
7099         (Target_arm::do_finalize_sections): Add input_objects parameter.
7100         (Target_arm::do_adjust_elf_header): New method declaration.
7101         (Target_arm::are_eabi_versions_compatible,
7102         (Target_arm::merge_processor_specific_flags): New method declaration.
7103         (Target_arm::do_make_elf_object): New overloaded method definitions
7104         and declaration.
7105         (Arm_relobj::do_read_symbols): New method definition.
7106         (Arm_dynobj::do_read_symbols): Ditto.
7107         (Target_arm::do_finalize_sections): Add input_objects parameters.
7108         Merge processor-specific flags from all input objects.
7109         (Target_arm::are_eabi_versions_compatible,
7110         Target_arm::merge_processor_specific_flags,
7111         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7112         New method definitions.
7113         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7114         Input_objects pointer type parameter.
7115         * layout.cc (Layout::finalize): Pass input objects to target's.
7116         finalize_sections function.
7117         * output.cc (Output_file_header::do_sized_write): Set ELF file
7118         header's processor-specific flags.
7119         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7120         Input_objects pointer type parameter.
7121         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7122         * target.h (Input_objects): New forward class declaration.
7123         (Target::processor_specific_flags,
7124         Target::are_processor_specific_flags_sect): New method definitions.
7125         (Target::finalize_sections): Add input_objects parameter.
7126         (Target::Target): Initialize processor_specific_flags_ and
7127         are_processor_specific_flags_set_.
7128         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7129         parameter.
7130         (Target::set_processor_specific_flags): New method definition.
7131         (Target::processor_specific_flags_,
7132         Target::are_processor_specific_flags_set_): New data member
7133         declarations.
7134         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7135         Input_objects pointer type parameter.
7136
7137 2009-10-30  Doug Kwan  <dougkwan@google.com>
7138
7139         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7140
7141 2009-10-28  Ian Lance Taylor  <iant@google.com>
7142
7143         * object.h (class Relobj): Drop options parameter from
7144         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7145         do_scan_relocs, do_relocate.  Change all callers.
7146         (class Sized_relobj): Drop options parameters from
7147         do_gc_process_relocs, do_scan_relocs, do_relocate,
7148         do_relocate_sections, relocate_sections, emit_relocs_scan,
7149         emit_relocs_scan_reltype.  Change all callers.
7150         (struct Relocate_info): Remove options field and all references to
7151         it.
7152         * reloc.h (class Read_relocs): Remove options constructor
7153         parameter and options_ field.  Change all callers.
7154         (class Gc_process_relocs, class Scan_relocs): Likewise.
7155         (class Relocate_task): Likewise.
7156         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7157         all callers.
7158         (scan_relocatable_relocs): Likewise.
7159         * target.h (class Sized_target): Remove options parameter from
7160         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7161         all callers.
7162         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7163         callers.
7164         * arm.cc: Update functions to remove options parameters.
7165         * i386.cc: Likewise.
7166         * powerpc.cc: Likewise.
7167         * sparc.cc: Likewise.
7168         * x86_64.cc: Likewise.
7169         * testsuite/testfile.cc: Likewise.
7170
7171 2009-10-28  Doug Kwan  <dougkwan@google.com>
7172
7173         * arm.cc (Arm_relobj): New class definition.
7174         (Arm_relobj::scan_sections_for_stubs,
7175         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7176         New method definitions.
7177
7178 2009-10-28  Cary Coutant  <ccoutant@google.com>
7179
7180         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7181         (Plugin::cleanup_done_): New member.
7182         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7183         (Plugin_manager::cleanup_done_): Remove.
7184         (Plugin_manager::add_input_file): Edit error message.
7185         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7186         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7187
7188 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7189
7190         * fileread.cc: (File_read::View::~View): Use the new
7191         data_ownership_ filed.
7192         (File_read::~File_read): Dispose the new whole_file_view_.
7193         (File_read::open): Mmap the whole file if needed.
7194         (File_read::open): Use whole_file_view_ instead of contents_.
7195         (File_read::find_view): Use whole_file_view_ if applicable.
7196         (File_read::do_read): Use whole_file_view_ instead of contents_.
7197         (File_read::make_view): Use whole_file_view_ instead of contents_,
7198         update File_read::View::View call.
7199         (File_read::find_or_make_view): Update File_read::View::View
7200         call.
7201         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7202         remove contents_
7203         (File_read::View::Data_ownership): New enum.
7204         (File_read::View::View): Replace bool mapped_ with Data_ownership
7205         argument.
7206         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7207         (File_read::View::data_ownership_): New field.
7208         (File_read::contents_): Remove (replaced by whole_file_view_).
7209         (File_read::whole_file_view_): New field.
7210         * options.h (class General_options): Add --keep-files-mapped.
7211
7212 2009-10-27  Cary Coutant  <ccoutant@google.com>
7213
7214         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7215         * testsuite/Makefile.am (plugin_test_5): New test case.
7216         * testsuite/Makefile.in: Regenerate.
7217
7218 2009-10-25  Doug Kwan  <dougkwan@google.com>
7219
7220         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7221         from private to protected to allow access by child class.
7222         (Sized_relobj::do_relocate_sections): New method declaration.
7223         (Sized_relobj::relocate_sections): Virtualize.
7224         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7225         Sized_relobj::relocate_sections.  Instantiate template explicitly
7226         for different target sizes and endianity.
7227
7228 2009-10-24  Doug Kwan  <dougkwan@google.com>
7229
7230         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7231         (Arm_input_section::as_arm_input_section): New method.
7232         (Arm_output_section): New class definition.
7233         (Arm_output_section::create_stub_group,
7234         Arm_output_section::group_sections): New method definitions.
7235
7236 2009-10-22  Doug Kwan  <dougkwan@google.com>
7237
7238         * arm.cc (Arm_input_section): New class definition.
7239         (Arm_input_section::init, Arm_input_section:do_write,
7240         Arm_input_section::set_final_data_size,
7241         Arm_input_section::do_reset_address_and_file_offset): New method
7242         definitions.
7243
7244 2009-10-21  Doug Kwan  <dougkwan@google.com>
7245
7246         * arm.cc (Stub_table, Arm_input_section): New forward class
7247         declarations.
7248         (Stub_table): New class defintion.
7249         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7250         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7251         New method definition.
7252
7253 2009-10-21  Doug Kwan  <dougkwan@google.com>
7254
7255         * arm.cc: Update copyright comments.
7256         (Target_arm): New forward class template declaration.
7257         (Arm_address): New type.
7258         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7259         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7260         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7261         constants.
7262         (Insn_template): Same.
7263         (DEF_STUBS): New macro.
7264         (Stub_type): New enum type.
7265         (Stub_template): New class definition.
7266         (Stub): Same.
7267         (Reloc_stub): Same.
7268         (Stub_factory): Same.
7269         (Target_arm::Target_arm): Initialize may_use_blx_ and
7270         should_force_pic_veneer_.
7271         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7272         Target_arm::should_force_pic_veneer,
7273         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7274         Target_arm::using_thumb_only, Target_arm:;default_target): New
7275         method defintions.
7276         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7277         New data member declarations.
7278         (Insn_template::size, Insn_template::alignment): New method defintions.
7279         (Stub_template::Stub_template): New method definition.
7280         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7281         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7282         (Stub_factory::Stub_factory): New method definition.
7283         * gold.h (string_hash): New template.
7284         * output.h (Input_section_specifier::hash_value): Use
7285         gold::string_hash.
7286         (Input_section_specifier::string_hash): Remove.
7287         * stringpool.cc (Stringpool_template::string_hash): Use
7288         gold::string_hash.
7289
7290 2009-10-20  Doug Kwan  <dougkwan@google.com>
7291
7292         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7293         symbols of relaxed input sections.
7294         * output.h (Output_section::find_relaxed_input_section): Make
7295         method public.
7296
7297 2009-10-16  Doug Kwan  <dougkwan@google.com>
7298
7299         * dynobj.cc (Versions::Versions): Initialize version_script_.
7300         Only insert base version symbol definition for a shared object
7301         if version script defines any version versions.
7302         (Versions::define_base_version): New method definition.
7303         (Versions::add_def): Check that base version is not needed.
7304         (Versions::add_need): Define base version lazily.
7305         * dynobj.h (Versions::define_base_version): New method declaration.
7306         (Versions::needs_base_version_): New data member declaration.
7307         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7308         (check_DATA): Add no_version_test.stdout.
7309         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7310         New make rules.
7311         * testsuite/Makefile.in: Regenerate.
7312         * testsuite/no_version_test.c: New file.
7313         * testsuite/no_version_test.sh: Ditto.
7314
7315 2009-10-16  Doug Kwan  <dougkwan@google.com>
7316
7317         * expression.cc (class Segment_start_expression): New class definition.
7318         (Segment_start_expression::value): New method definition.
7319         (script_exp_function_segment_start): Return a new
7320         Segment_start_expression.
7321         * gold/script-c.h (script_saw_segment_start_expression): New function
7322         prototype.
7323         * script-sections.cc (Script_sections::Script_sections): Initialize
7324         SAW_SEGMENT_START_EXPRESSION_ to false.
7325         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7326         and -Tbbs options to specify section addresses if given in
7327         command line and no SEGMENT_START expression is seen in a script.
7328         * script-sections.h (Script_sections::saw_segment_start_expression,
7329         Script_sections::set_saw_segment_start_expression): New method
7330         definition.
7331         (Script_sections::saw_segment_start_expression_): New data member
7332         declaration.
7333         * script.cc (script_saw_segment_start_expression): New function.
7334         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7335         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7336         script_test_7.sh and script_test_8.sh.
7337         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7338         script_test_8.stdout.
7339         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7340         (script_test_6, script_test_6.stdout, script_test_7,
7341         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7342         * Makefile.in: Regenerate.
7343         * testsuite/script_test_6.sh: New file.
7344         * testsuite/script_test_6.t: Same.
7345         * testsuite/script_test_7.sh: Same.
7346         * testsuite/script_test_7.t: Same.
7347         * testsuite/script_test_8.sh: Same.
7348
7349 2009-10-16  Doug Kwan  <dougkwan@google.com>
7350
7351         * output.cc (Output_segment::set_section_list_address): Cast
7352         expressions to unsigned long long type to avoid format warnings.
7353
7354 2009-10-15  Ian Lance Taylor  <iant@google.com>
7355
7356         * script.cc (Script_options::add_symbol_assignment): Always add a
7357         dot assignment to script_sections_.
7358         * script-sections.cc (Script_sections::add_dot_assignment):
7359         Initialize if necessary.
7360
7361         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7362         program headers with no load segment if there is a linker script.
7363
7364         * layout.cc (Layout::set_segment_offsets): Align the file offset
7365         to the segment aligment for -N or -n with no load segment.
7366         * output.cc (Output_segment::add_output_section): Don't crash if
7367         the first section is a TLS section.
7368         (Output_segment::set_section_list_addresses): Print an error
7369         message if the address moves backward in a linker script.
7370         * script-sections.cc
7371         (Output_section_element_input::set_section_addresses): Don't
7372         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7373         (Orphan_output_section::set_section_addresses): Likewise.
7374
7375 2009-10-15  Doug Kwan  <dougkwan@google.com>
7376
7377         * layout.cc (Layout::finish_dynamic_section): Generate tags
7378         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7379         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7380         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7381
7382 2009-10-14  Ian Lance Taylor  <iant@google.com>
7383
7384         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7385         fields.
7386         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7387         data_shdr fields of relinfo.
7388         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7389         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7390         R_386_TLS_LDO_32, adjust based on section flags.
7391         (Target_i386::Relocate::fix_up_ldo): Remove.
7392
7393 2009-10-13  Ian Lance Taylor  <iant@google.com>
7394
7395         Add support for -pie.
7396         * options.h (class General_options): Add -pie and
7397         --pic-executable.
7398         (General_options::output_is_position_independent): Test -pie.
7399         (General_options::output_is_executable): Return true if not shared
7400         and not relocatable.
7401         (General_options::output_is_pie): Remove.
7402         * options.cc (General_options::finalize): Reject incompatible uses
7403         of -pie.
7404         * gold.cc (queue_middle_tasks): A -pie link is not static.
7405         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7406         * symtab.cc (Symbol::final_value_is_known): Return false if
7407         output_is_position_independent.
7408         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7409         output_is_position_independent.
7410         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7411         output_is_position_independent.
7412         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7413         output_is_position_independent.
7414         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7415         two_file_pie_test.
7416         (basic_pie_test.o, basic_pie_test): New targets.
7417         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7418         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7419         (two_file_pie_test): New target.
7420         * testsuite/Makefile.in: Rebuild.
7421         * README: Remove note saying that -pie is not supported.
7422
7423 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7424
7425         * options.h (class General_options): Add -init and -fini.
7426         * layout.cc (Layout::finish_dynamic_section): Emit
7427         given init and fini functions.
7428
7429 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7430
7431         * gc.h (gc_process_relocs): Check if icf is enabled using new
7432         function.
7433         * gold.cc (queue_initial_tasks): Likewise.
7434         (queue_middle_tasks): Likewise.
7435         * object.cc (do_layout): Likewise.
7436         * symtab.cc (is_section_folded): Likewise.
7437         * main.cc (main): Likewise.
7438         * reloc.cc (Read_relocs::run): Likewise.
7439         (Sized_relobj::do_scan_relocs): Likewise.
7440         * icf.cc (is_function_ctor_or_dtor): New function.
7441         (Icf::find_identical_sections): Check if function is ctor or dtor when
7442         safe icf is chosen.
7443         * options.h (General_options::icf): Change option to be an enum.
7444         (Icf_status): New enum.
7445         (icf_enabled): New method.
7446         (icf_safe_folding): New method.
7447         (set_icf_status): New method.
7448         (icf_status_): New variable.
7449         * (options.cc) (General_options::finalize): Set icf_status_.
7450         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7451         icf_test and icf_keep_unique_test to use the --icf enum flag.
7452         * testsuite/icf_safe_test.sh: New file.
7453         * testsuite/icf_safe_test.cc: New file.
7454
7455 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7456
7457         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7458         includes to gc.h and icf.h.
7459         * arm.cc: Include gc.h.
7460         * gold.cc: Likewise.
7461         * i386.cc: Likewise.
7462         * powerpc.cc: Likewise.
7463         * sparc.cc: Likewise.
7464         * x86_64.cc: Likewise.
7465         * gc.h: Include icf.h.
7466
7467 2009-10-11  Ian Lance Taylor  <iant@google.com>
7468
7469         * plugin.cc: Include "gold.h" before other header files.
7470
7471 2009-10-10  Chris Demetriou  <cgd@google.com>
7472
7473         * options.h (Input_file_argument::Input_file_type): New enum.
7474         (Input_file_argument::is_lib_): Replace with...
7475         (Input_file_argument::type_): New member.
7476         (Input_file_argument::Input_file_argument): Take Input_file_type
7477         'type' rather than boolean 'is_lib' as second argument.
7478         (Input_file_argument::is_lib): Use type_.
7479         (Input_file_argument::is_searched_file): New function.
7480         (Input_file_argument::may_need_search): Handle is_searched_file.
7481         * options.cc (General_options::parse_library): Support -l:filename.
7482         (General_options::parse_just_symbols): Update for Input_file_argument
7483         changes.
7484         (Command_line::process): Likewise.
7485         * archive.cc (Archive::get_file_and_offset): Likewise.
7486         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7487         * script.cc (read_script_file, script_add_file): Likewise.
7488         * fileread.cc (Input_file::Input_file): Likewise.
7489         (Input_file::will_search_for): Handle is_searched_file.
7490         (Input_file::open): Likewise.
7491         * readsyms.cc (Read_symbols::get_name): Likewise.
7492         * testsuite/Makefile.am (searched_file_test): New test.
7493         * testsuite/Makefile.in: Regenerate.
7494         * testsuite/searched_file_test.cc: New file.
7495         * testsuite/searched_file_test_lib.cc: New file.
7496
7497 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7498             Ian Lance Taylor  <iant@google.com>
7499
7500         * descriptor.cc: Include <cstdio> and "binary-io.h".
7501         (Descriptors::open): Open the files in binary mode always.
7502         * script.cc (Lex::get_token): Treat \r as whitespace.
7503
7504 2009-10-09  Ian Lance Taylor  <iant@google.com>
7505
7506         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7507
7508 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7509             Ian Lance Taylor  <iant@google.com>
7510
7511         * configure.ac: Check for readv function also.
7512         * fileread.cc (readv): Define if not HAVE_READV.
7513         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7514         does not exist.
7515         * config.in: Regenerate.
7516         * configure: Regenerate.
7517
7518 2009-10-09  Doug Kwan  <dougkwan@google.com>
7519
7520         * layout.cc (Layout::make_output_section): Call target hook to make
7521         ordinary output section.
7522         (Layout::finalize): Adjust parameter list of call the
7523         Target::may_relax().
7524         * layout.h (class Layout::section_list): New method.
7525         * merge.h (Output_merge_base::entsize): Change visibility to public.
7526         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7527         New methods.
7528         (Output_merge_string::do_is_string): New method.
7529         * object.cc (Sized_relobj::do_setup): renamed from
7530         Sized_relobj::set_up.
7531         * object.h (Sized_relobj::adjust_shndx,
7532         Sized_relobj::initializ_input_to_output_maps,
7533         Sized_relobj::free_input_to_output_maps): Change visibilities to
7534         protected.
7535         (Sized_relobj::setup): Virtualize.
7536         (Sized_relobj::do_setup): New method declaration.
7537         (Sized_relobj::invalidate_section_offset,
7538         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7539         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7540         * options.cc (parse_int): New function.
7541         * options.h (parse_int): New declaration.
7542         (DEFINE_int): New macro.
7543         (stub_group_size): New option.
7544         * output.cc (Output_section::Output_section): Initialize memebers
7545         merge_section_map_, merge_section_by_properties_map_,
7546         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7547         (Output_section::add_input_section): Handled deferred code-fill
7548         generation and remove an old comment.
7549         (Output_section::add_relaxed_input_section): New method definition.
7550         (Output_section::add_merge_input_section): Use merge section by
7551         properties map to speed to search.  Update merge section maps
7552         as appropriate.
7553         (Output_section::build_relaxation_map): New method definition.
7554         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7555         Same.
7556         (Output_section::relax_input_section): Renamed to
7557         Output_section::convert_input_sections_to_relaxed_sections and change
7558         interface to take a vector of pointers to relaxed sections.
7559         (Output_section::find_merge_section,
7560         Output_section::find_relaxed_input_section): New method definitions.
7561         (Output_section::is_input_address_mapped,
7562         Output_section::output_offset, Output_section::output_address):
7563         Use output section data maps to speed up searching.
7564         (Output_section::find_starting_output_address): Add comments.
7565         (Output_section::do_write,
7566         Output_section::write_to_postprocessing_buffer): Do code-fill
7567         generation as appropriate.
7568         (Output_section::get_input_sections): Invalidate relaxed input section
7569         map.
7570         (Output_section::restore_states): Adjust type of checkpoint .
7571         Invalidate relaxed input section map.
7572         * output.h (Output_merge_base): New class declaration.
7573         (Input_section_specifier): New class defintion.
7574         (class Output_relaxed_input_section) Change base class to
7575         Output_section_data_build.
7576         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7577         base class initializer.
7578         (Output_section::add_relaxed_input_section): New method declaration.
7579         (Output_section::Input_section): Change visibility to protected.
7580         (Output_section::Input_section::relobj,
7581         Output_section::Input_section::shndx): Handle relaxed input sections.
7582         Output_section::input_sections) Change visibility to protected.  Also
7583         define overload to return a non-const pointer.
7584         (Output_section::Merge_section_properties): New class defintion.
7585         (Output_section::Merge_section_by_properties_map,
7586         Output_section::Output_section_data_by_input_section_map,
7587         Output_section::Relaxation_map): New types.
7588         (Output_section::relax_input_section): Rename method to
7589         Output_section::convert_input_sections_to_relaxed_sections and change
7590         interface to take a vector of relaxed section pointers.
7591         (Output_section::find_merge_section,
7592         Output_section::find_relaxed_input_section,
7593         Output_section::build_relaxation_map,
7594         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7595         New method declarations.
7596         (Output_section::merge_section_map_
7597         Output_section::merge_section_by_properties_map_,
7598         Output_section::relaxed_input_section_map_,
7599         Output_section::is_relaxed_input_section_map_valid_,
7600         Output_section::generate_code_fills_at_write_): New data members.
7601         * script-sections.cc
7602         (Output_section_element_input::set_section_addresses): Call
7603         current_data_size and addralign methods of relaxed input sections.
7604         (Orphan_output_section::set_section_addresses): Call current_data_size
7605         and addralign methods of relaxed input sections.
7606         * symtab.cc (Symbol_table::compute_final_value): Extract template
7607         from the body of Symbol_table::sized_finalize_symbol.
7608         (Symbol_table::sized_finalized_symbol): Call
7609         Symbol_table::compute_final_value.
7610         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7611         (Symbol_table::compute_final_value): New templated method declaration.
7612         * target.cc (Target::do_make_output_section): New method defintion.
7613         * target.h (Target::make_output_section): New method declaration.
7614         (Target::relax): Add more parameters for input objects, symbol table
7615         and layout.  Adjust call to do_relax.
7616         (Target::do_make_output_section): New method declaration.
7617         (Target::do_relax): Add parameters for input objects, symbol table
7618         and layout.
7619
7620 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7621
7622         * pread.c: Include stdio.h.
7623
7624 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7625
7626         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7627         defined.
7628
7629 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7630
7631         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7632         Change read_shndx type to unsigned int.
7633         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7634         int.
7635         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7636         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7637         Change read_shndx type to unsigned int.
7638         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7639         int.
7640         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7641         * layout.cc (Layout::create_symtab_sections): Cast the result of
7642         local_symcount * symsize to off_t in the gold_assert.
7643
7644 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7645
7646         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7647         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7648         R_ARM_BASE_ABS.
7649         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7650         (Arm_relocate_functions::thm_abs5): New function.
7651         (Arm_relocate_functions::abs12): New function.
7652         (Arm_relocate_functions::abs16): New function.
7653         (Arm_relocate_functions::base_abs): New function.
7654         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7655         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7656         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7657         R_ARM_BASE_ABS.
7658         (Scan::global): Likewise.
7659         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7660         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7661         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7662         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7663         R_ARM_BASE_ABS.
7664
7665 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7666
7667         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7668         (Arm_relocate_functions::movt_prel): New function.
7669         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7670         (Arm_relocate_functions::thm_movt_prel): New function.
7671         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7672         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7673         (Scan::global, Relocate::relocate): Likewise.
7674         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7675
7676 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7677
7678         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7679         Incremental_checker.
7680         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7681         unsigned int.
7682         (class Incremental_inputs_header): New class.
7683         (Incremental_inputs_header_writer): Edit comment.
7684         (Incremental_inputs_entry): New class.
7685         (Incremental_inputs_entry_writer): Edit comment.
7686         (Sized_incremental_binary::do_find_incremental_inputs_section):
7687         Add *strtab_shndx parameter, fill it.
7688         (Sized_incremental_binary::do_check_inputs): New method.
7689         (Incremental_checker::can_incrementally_link_output_file): Use
7690         Sized_incremental_binary::check_inputs.
7691         (Incremental_inputs::report_command_line): Save command line in
7692         command_line_.
7693         * incremental.h:
7694         (Incremental_binary::find_incremental_inputs_section): New
7695         method.
7696         (Incremental_binary::do_find_incremental_inputs_section): Add
7697         strtab_shndx parameter.
7698         (Incremental_binary::do_check_inputs): New pure virtual method.
7699         (Sized_incremental_binary::do_check_inputs): Declare.
7700         (Incremental_checker::Incremental_checker): Add incremental_inputs
7701         parameter, use it to initialize incremental_inputs_.
7702         (Incremental_checker::incremental_inputs_): New field.
7703         (Incremental_checker::command_line): New method.
7704         (Incremental_checker::inputs): New method.
7705         (Incremental_checker::command_line_): New field.
7706
7707 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7708
7709         * incremental.cc: Include <cstdarg> and "target-select.h".
7710         (vexplain_no_incremental): New function.
7711         (explain_no_incremental): New function.
7712         (Incremental_binary::error): New method.
7713         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7714         method.
7715         (make_sized_incremental_binary): New function.
7716         (open_incremental_binary): New function.
7717         (can_incrementally_link_file): Add checks if output is ELF and has
7718         inputs section.
7719         * incremental.h: Include "elfcpp_file.h" and "output.h".
7720         (Incremental_binary): New class.
7721         (Sized_incremental_binary): New class.
7722         (open_incremental_binary): Declare.
7723         * object.cc (is_elf_object): Use
7724         elfcpp::Elf_recognizer::is_elf_file.
7725         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7726         * output.h (Output_file::filesize): New method.
7727
7728 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7729
7730         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7731         New function.
7732         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7733         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7734         function.
7735         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7736         function.
7737         (Arm_relocate_functions::movw_abs_nc): New function.
7738         (Arm_relocate_functions::movt_abs): New function.
7739         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7740         (Arm_relocate_functions::thm_movt_abs): New function.
7741         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7742         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7743         (Scan::global): Likewise.
7744         (Relocate::relocate): Likewise.
7745         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7746
7747 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7748
7749         * arm.cc (Arm_relocate_functions::got_prel) New function.
7750         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7751         (Relocate::relocate): Likewise.
7752         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7753
7754 2009-10-06  Ian Lance Taylor  <iant@google.com>
7755
7756         * options.h (class General_options): Define
7757         split_stack_adjust_size parameter.
7758         * object.h (class Object): Add uses_split_stack_ and
7759         has_no_split_stack_ fields.  Add uses_split_stack and
7760         has_no_split_stack accessor functions.  Declare
7761         handle_split_stack_section.
7762         (class Reloc_symbol_changes): Define.
7763         (class Sized_relobj): Define Function_offsets.  Declare
7764         split_stack_adjust, split_stack_adjust_reltype, and
7765         find_functions.
7766         * object.cc (Object::handle_split_stack_section): New function.
7767         (Sized_relobj::do_layout): Call handle_split_stack_section.
7768         * dynobj.cc (Sized_dynobj::do_layout): Call
7769         handle_split_stack_section.
7770         * reloc.cc (Sized_relobj::relocate_sections): Call
7771         split_stack_adjust for executable sections in split_stack
7772         objects.  Pass reloc_map to relocate_section.
7773         (Sized_relobj::split_stack_adjust): New function.
7774         (Sized_relobj::split_stack_adjust_reltype): New function.
7775         (Sized_relobj::find_functions): New function.
7776         * target-reloc.h: Include "object.h".
7777         (relocate_section): Add reloc_symbol_changes parameter.  Change
7778         all callers.
7779         * target.h (class Target): Add calls_non_split method.  Declare
7780         do_calls_non_split virtual method.  Declare match_view and
7781         set_view_to_nop.
7782         * target.cc: Include "elfcpp.h".
7783         (Target::do_calls_non_split): New function.
7784         (Target::match_view): New function.
7785         (Target::set_view_to_nop): New function.
7786         * gold.cc (queue_middle_tasks): Give an error if mixing
7787         split-stack and non-split-stack objects with -r.
7788         * i386.cc (Target_i386::relocate_section): Add
7789         reloc_symbol_changes parameter.
7790         (Target_i386::do_calls_non_split): New function.
7791         * x86_64.cc (Target_x86_64::relocate_section): Add
7792         reloc_symbol_changes parameter.
7793         (Target_x86_64::do_calls_non_split): New function.
7794         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7795         parameter.
7796         * powerpc.cc (Target_powerpc::relocate_section): Add
7797         reloc_symbol_changes parameter.
7798         * sparc.cc (Target_sparc::relocate_section): Add
7799         reloc_symbol_changes parameter.
7800         * configure.ac: Call AM_CONDITIONAL for the default target.
7801         * configure: Rebuild.
7802         * testsuite/Makefile.am (TEST_AS): New variable.
7803         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7804         (check_DATA): Add split_i386 and split_x86_64 files.
7805         (SPLIT_DEFSYMS): Define.
7806         (split_i386_[1234n].o): New targets.
7807         (split_i386_[124]): New targets.
7808         (split_i386_[1234r].stdout): New targets.
7809         (split_x86_64_[1234n].o): New targets.
7810         (split_x86_64_[124]): New targets.
7811         (split_x86_64_[1234r].stdout): New targets.
7812         (MOSTLYCLEANFILES): Add new executables.
7813         * testsuite/split_i386.sh: New file.
7814         * testsuite/split_x86_64.sh: New file.
7815         * testsuite/split_i386_1.s: New file.
7816         * testsuite/split_i386_2.s: New file.
7817         * testsuite/split_i386_3.s: New file.
7818         * testsuite/split_i386_4.s: New file.
7819         * testsuite/split_i386_n.s: New file.
7820         * testsuite/split_x86_64_1.s: New file.
7821         * testsuite/split_x86_64_2.s: New file.
7822         * testsuite/split_x86_64_3.s: New file.
7823         * testsuite/split_x86_64_4.s: New file.
7824         * testsuite/split_x86_64_n.s: New file.
7825         * testsuite/testfile.cc (Target_test): Update relocation_section
7826         function.
7827         * testsuite/Makefile.in: Rebuild.
7828
7829 2009-10-06  Ian Lance Taylor  <iant@google.com>
7830
7831         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7832         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7833         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7834         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7835         the address on ldo_addrs_.
7836         (Target_i386::Relocate::fix_up_ldo): New function.
7837
7838 2009-10-06   Rafael Espindola  <espindola@google.com>
7839
7840         * plugin.cc (add_input_library): New.
7841         (Plugin::load): Add add_input_library to tv.
7842         (Plugin_manager::add_input_file): Add the is_lib argument.
7843         (add_input_file): Update call to Plugin_manager::add_input_file.
7844         (add_input_library): New.
7845         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7846
7847 2009-09-30  Doug Kwan  <dougkwan@google.com>
7848
7849         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7850         symbol and call Symbol::may_need_copy_reloc to determine if
7851         a copy reloc is needed.
7852         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7853         nocopyreloc is given in command line.
7854         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7855         given in command line.
7856         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7857         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7858         of the removed Target_i386::may_need_copy_reloc.
7859         * options.h (copyreloc): New option with default value false.
7860         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7861         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7862         instead of the removed Target_powerpc::may_need_copy_reloc.
7863         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7864         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7865         instead of the removed Target_sparc::may_need_copy_reloc.
7866         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7867         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7868         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7869         instead of the removed Target_x86_64::may_need_copy_reloc.
7870
7871 2009-09-30  Ian Lance Taylor  <iant@google.com>
7872
7873         * object.h (class Object): Remove target_ field, and target,
7874         sized_target, and set_target methods.
7875         (Object::sized_target): Remove.
7876         (class Sized_relobj): Update declarations.  Remove sized_target.
7877         * object.cc (Sized_relobj::setup): Remove target parameter.
7878         Change all callers.
7879         (Input_objects::add_object): Don't do anything with the target.
7880         (make_elf_sized_object): Add punconfigured parameter.  Change all
7881         callers.  Set or test parameter target.
7882         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7883         Change all callers.
7884         * parameters.cc (Parameters::set_target): Change parameter type to
7885         be non-const.
7886         (Parameters::default_target): Remove.
7887         (set_parameters_target): Change parameter type to be non-const.
7888         (parameters_force_valid_target): New function.
7889         (parameters_clear_target): New function.
7890         * parameters.h (class Parameters): Update declarations.  Remove
7891         default_target method.  Add sized_target and clear_target
7892         methods.  Change target_ to be non-const.
7893         (set_parameters_target): Update declaration.
7894         (parameters_force_valid_target): Declare.
7895         (parameters_clear_target): Declare.
7896         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7897         as NULL if we aren't searching.
7898         (Add_symbols::run): Don't check for compatible target.
7899         * fileread.cc (Input_file::open_binary): Call
7900         parameters_force_valid_target.
7901         * gold.cc (queue_middle_tasks): Likewise.
7902         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7903         set_target on object.
7904         * dynobj.h (class Sized_dynobj): Update declarations.
7905         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7906         make_elf_object returns NULL.
7907         (Archive::include_member): Don't check whether object target is
7908         compatible.
7909         * output.cc (Output_section::add_input_section): Get target from
7910         parameters.
7911         (Output_section::relax_input_section): Likewise.
7912         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7913         parameters.
7914         (Sized_relobj::do_scan_relocs): Likewise.
7915         (Sized_relobj::relocate_sections): Likewise.
7916         * resolve.cc (Symbol_table::resolve): Likewise.
7917         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7918         parameter.  Change all callers.
7919         (Symbol_table::add_from_object): Get target from parameters.
7920         (Symbol_table::add_from_relobj): Don't check object target.
7921         (Symbol_table::add_from_dynobj): Likewise.
7922         (Symbol_table::define_special_symbol): Get target from
7923         parameters.
7924         * symtab.h (class Symbol_table): Update declaration.
7925         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7926         parameter.  Change all callers.  Clear parameter target.
7927         (Binary_test): Test target here.
7928         * testsuite/object_unittest.cc (gold_testsuite): Remove
7929         target_test_pointer parameter.  Change all callers.
7930         (Object_test): Test target here.
7931
7932 2009-09-26  Ian Lance Taylor  <iant@google.com>
7933
7934         * testsuite/initpri1.c: Don't try to use constructor priorities if
7935         compiling with gcc before 4.3.
7936
7937 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7938
7939         * testsuite/retain_symbols_file_test.sh (check_present): Change
7940         output file name to retain_symbols_file_test.stdout.
7941         (check_absent): Likewise.
7942
7943 2009-09-18  Craig Silverstein  <csilvers@google.com>
7944
7945         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7946         * options.cc: Include <cerrno> and <fstream>.
7947         (General_options::finalize): Parse -retain-symbols-file tag.
7948         * options.h: New flag.
7949         (General_options): New method should_retain_symbol, new
7950         variable symbols_to_retain.
7951         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7952         should_retain_symbol map.
7953         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7954         * testsuite/Makefile.in: Regenerate.
7955         * testsuite/retain_symbols_file_test.sh: New file.
7956
7957 2009-09-18  Nick Clifton  <nickc@redhat.com>
7958
7959         * po/es.po: Updated Spanish translation.
7960
7961 2009-09-17  Doug Kwan  <dougkwan@google.com>
7962
7963         * debug.h (DEBUG_RELAXATION): New constant.
7964         (DEBUG_ALL): Add DEBUG_RELAXATION.
7965         (debug_string_to_enum): Add relaxation debug option.
7966         * layout.cc
7967         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7968         Layout::Relaxation_debug_check::read_sections,
7969         Layout::Relaxation_debug_check::read_sections): New method definitions.
7970         (Layout::Layout): Initialize data members
7971         record_output_section_data_from_scrips_,
7972         script_output_section_data_list_ and relaxation_debug_check_.
7973         (Layout::save_segments, Layout::restore_segments,
7974         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7975         Layout::relaxation_loop_body): New method definitions.
7976         (Layout::finalize): Support relaxation.  Move section layout code to
7977         Layout::relaxation_loop_body.
7978         (Layout::set_asection_address_from_script): Move code for orphan
7979         section placement out.
7980         (Layout::place_orphan_sections_in_script): New method definition.
7981         * layout.h (Output_segment_headers, Output_file_header):
7982         New forward class declarations.
7983         (Layout::~Layout): Define.
7984         (Layout::new_output_section_data_from_script): New method definition.
7985         (Layout::place_orphan_sections_in_script): New method declaration.
7986         (Layout::Segment_states): New type declaration.
7987         (Layout::save_segments, Layout::restore_segments,
7988         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7989         Layout::relaxation_loop_body): New method declarations.
7990         (Layout::Output_section_data_list): New type declaration.
7991         (Layout::Relaxation_debug_check): New class definition.
7992         (Layout::record_output_section_data_from_script_,
7993         Layout::script_output_section_data_list_, Layout::segment_states_,
7994         Layout::relaxation_debug_check_): New data members.
7995         * output.cc: (Output_section_headers::do_size): New method definition.
7996         (Output_section_headers::Output_section_headers): Move size
7997         computation to Output_section_headers::do_size.
7998         (Output_segment_headers::do_size): New method definition.
7999         (Output_file_header::Output_file_header): Move size computation to
8000         Output_file_header::do_size and call it.
8001         (Output_file_header::do_size): New method definition.
8002         (Output_data_group::Output_data_group): Adjust call to
8003         Output_section_data.
8004         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8005         (Output_symtab_xindex::do_write): Add array bound check.
8006         (Output_section::Input_section::print_to_mapfile): Handle
8007         RELAXED_INPUT_SECTION_CODE.
8008         (Output_section::Output_section): Initialize data member checkpoint_.
8009         (Output_section::~Output_section): Delete checkpoint object pointed
8010         by checkpoint_.
8011         (Output_section::add_input_section): Always add an Input_section if
8012         relaxing.
8013         (Output_section::add_merge_input_section): Add assert.
8014         (Output_section::relax_input_section): New method definition.
8015         (Output_section::set_final_data_size): Set load address to zero for
8016         an unallocated section.
8017         (Output_section::do_address_and_file_offset_have_reset_values):
8018         New method definition.
8019         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8020         Handle relaxed input section.
8021         (Output_section::sort_attached_input_sections): Checkpoint input
8022         section list lazily.
8023         (Output_section::get_input_sections): Change type of input_sections to
8024         list of Simple_input_section pointers.  Checkpoint input section list
8025         lazily.  Also handle relaxed input sections.
8026         (Output_section::add_input_section_for_script): Take a reference to
8027         a Simple_input_section object instead of Relobj pointer and section
8028         index as parameter.  Handle relaxed input sections.
8029         (Output_section::save_states, Output_section::restore_states): New
8030         method definitions.
8031         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8032         (Output_data::is_data_size_fixed): New method definition.
8033         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8034         if it is fixed.
8035         (Output_data::address_and_file_offset_have_reset_values): New method
8036         definition.
8037         (Output_data::do_address_and_file_offset_have_reset_values): New method
8038         definition.
8039         (Output_data::set_data_size): Check that data size is not fixed.
8040         (Output_data::fix_data_size): New method definition.
8041         (Output_data::is_data_size_fixed_): New data member.
8042         (Output_section_headers::set_final_data_size): New method definition.
8043         (Output_section_headers::do_size): New method declaration.
8044         (Output_segment_headers::set_final_data_size): New method definition.
8045         (Output_segment_headers::do_size): New method declaration.
8046         (Output_file_header::set_final_data_size)::New method definition.
8047         (Output_file_header::do_size)::New method declaration.
8048         (Output_section_data::Output_section_data): Add new parameter
8049         is_data_size_fixed and use it to fix data size.
8050         (Output_data_const::Output_data_const): Adjust call to base class
8051         constructor and fix data size.
8052         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8053         base class constructor and fix data size.
8054         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8055         base class constructor and fix data size.
8056         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8057         class constructor and fix data size.
8058         (Output_data_group::set_final_data_size): New method definition.
8059         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8060         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8061         class constructor and fix data size.
8062         (Output_relaxed_input_section): New class definition.
8063         (Output_section::Simple_input_section): New class definition.
8064         (Output_section::get_input_sections): Adjust parameter list.
8065         (Output_section::add_input_section_for_script): Same.
8066         (Output_section::save_states, Output_section::restore_states,
8067         Output_section::do_address_and_file_offset_have_reset_values,
8068         (Output_section::Input_section::Input_section): Handle
8069         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8070         Output_relaxed_input_section.
8071         (Output_section::Input_section::is_input_section,
8072         Output_section::Input_section::set_output_section): Handle relaxed
8073         input section.
8074         (Output_section::Input_section::is_relaxed_input_section,
8075         Output_section::Input_section::output_section_data,
8076         Output_section::Input_section::relaxed_input_section): New method
8077         definitions.
8078         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8079         value.
8080         (Output_section::Input_section::u1_): Update comments.
8081         (Output_section::Input_section::u2_): Add new union member poris.
8082         (Output_section::Checkpoint_output_section): New classs definition.
8083         (Output_section::relax_input_section): New method declaration.
8084         (Output_section::checkpoint_): New data member.
8085         (Output_segment): Update comments.
8086         (Output_segment::Output_segment): Un-privatize copy constructor.
8087         (Output_segment::operator=): Un-privatize.
8088         * script-sections.cc (Output_section_element::Input_section_list):
8089         Change element type to Output_section::Simple_input_section.
8090         (Output_section_element_dot_assignment::set_section_addresses):
8091         Register output section data for relaxation clean up.
8092         (Output_data_exression::Output_data_expression): Adjust call to base
8093         constructor to fix data size.
8094         (Output_section_element_data::set_section_addresses): Register
8095         Output_data_expression object for relaxation clean up.
8096         (struct Input_section_info): Replace Relobj pointer and section index
8097         pair with Output_section::Simple_input_section and Convert struct to a
8098         class.
8099         (Input_section_sorter::operator()): Adjust access to
8100         Input_section_info data member to use accessors.
8101         (Output_section_element_input::set_section_addresses): Use layout
8102         parameter.  Adjust code to use Output_section::Simple_input_section
8103         and Input_secction_info classes.  Register filler for relaxation
8104         clean up.
8105         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8106         and section index pair with Output_section::Simple_input_section
8107         class.  Adjust code accordingly.
8108         (Phdrs_element::release_segment): New method definition.
8109         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8110         segment list.
8111         (Script_sections::release_segments): New method definition.
8112         * gold/script-sections.h (Script_sections::release_segments): New
8113         method declaration.
8114         * gold/target.h (Target::may_relax, Target::relax,
8115         Target::do_may_relax, Target::do_relax): New method definitions.
8116
8117 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8118
8119         * arm.cc (has_signed_unsigned_overflow): New function.
8120         (Arm_relocate_functions::abs8): New function.
8121         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8122         (Target_arm::Scan::global): Likewise.
8123         (Target_arm::relocate::relocate): Likewise.
8124         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8125         Likewise.
8126
8127 2009-09-16  Cary Coutant  <ccoutant@google.com>
8128
8129         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8130         * testsuite/Makefile.in: Regenerate.
8131
8132 2009-09-11  Nick Clifton  <nickc@redhat.com>
8133
8134         * po/gold.pot: Updated by the Translation project.
8135
8136 2009-09-08  Cary Coutant  <ccoutant@google.com>
8137
8138         * output.cc (Output_file::open): Add execute permission to empty file.
8139         * testsuite/Makefile.am (permission_test): New test.
8140         * testsuite/Makefile.in: Regenerate.
8141
8142 2009-09-02  Ian Lance Taylor  <iant@google.com>
8143
8144         * output.cc (Output_file::resize): Call map_no_anonymous rather
8145         than map.
8146
8147 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8148
8149         * gold.cc: Include "incremental.h".
8150         (queue_initial_tasks): Call Incremental_checker methods.
8151         * incremental.cc: Include "output.h".
8152         (Incremental_checker::can_incrementally_link_output_file): New
8153         method.
8154         * incremental.h (Incremental_checker): New class.
8155
8156         * output.cc (Output_file::open_for_modification): New method.
8157         (Output_file::map_anonymous): Changed return type to bool.  Record
8158         map in base_ field.
8159         (Output_file::map_no_anonymous): New method, broken out of map.
8160         (Output_file::map): Use map_no_anonymous and map_anonymous.
8161         * output.h (class Output_file): Update declarations.
8162
8163 2009-08-24  Cary Coutant  <ccoutant@google.com>
8164
8165         * options.h (Command_line::Pre_options): New class.
8166         (Command_line::pre_options): New member.
8167         * options.cc (gold::options::ready_to_register): New variable.
8168         (One_option::register_option): Do nothing if not registering options.
8169         Assert if same short option registered twice.
8170         (General_options::General_options): Turn off option registration when
8171         done constructing.
8172         (Command_line::Pre_options::Pre_options): New constructor.
8173
8174 2009-08-24  Cary Coutant  <ccoutant@google.com>
8175
8176         * options.h (General_options::no_keep_memory): Remove incorrect
8177         short option.
8178
8179 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8180
8181         * Makefile.am (am__skiplex, am__skipyacc): New.
8182         * Makefile.in: Regenerate.
8183
8184 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8185
8186         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8187         (INCLUDES): ... this.
8188         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8189         (AM_CPPFLAGS): Renamed from ...
8190         (INCLUDE): ... this.
8191         * Makefile.in, testsuite/Makefile.in: Regenerate.
8192
8193         * Makefile.in: Regenerate.
8194         * aclocal.m4: Likewise.
8195         * config.in: Likewise.
8196         * configure: Likewise.
8197         * testsuite/Makefile.in: Likewise.
8198
8199         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8200         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8201         * Makefile.in: Regenerate.
8202         * testsuite/Makefile.in: Regenerate.
8203
8204 2009-08-19  Cary Coutant  <ccoutant@google.com>
8205
8206         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8207         symbols in shared libraries overridden by hidden or internal symbols
8208         in the main program.
8209
8210 2009-08-19  Chris Demetriou  <cgd@google.com>
8211
8212         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8213         checking source file names in error messages.
8214
8215 2009-08-18  Doug Kwan  <dougkwan@google.com>
8216
8217         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8218         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8219         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8220         an elfcpp::Ehdr as parameter.
8221         * object.cc (Object::set_target): Remove the version that looks up
8222         a target and sets it.
8223         (Sized_relobj::setup): Take a Target object instead of
8224         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8225         (make_elf_sized_object): Find target and ask target to
8226         make an ELF object.
8227         * object.h: (Object::set_target): Remove the version that looks up
8228         a target and sets it.
8229         (Sized_relobj::setup): Take a Target object instead of
8230         an elfcpp:Ehdr as parameter.
8231         * target.cc: Include dynobj.h.
8232         (Target::do_make_elf_object_implementation): New.
8233         (Target::do_make_elf_object): New.
8234         * target.h (Target::make_elf_object): New template declaration.
8235         (Target::do_make_elf_object): New method declarations.
8236         (Target::do_make_elf_object_implementation): New template declaration.
8237
8238 2009-08-14  Ian Lance Taylor  <iant@google.com>
8239
8240         * gold.h (FUNCTION_NAME): Define.
8241         (gold_unreachable): Use FUNCTION_NAME.
8242
8243 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8244
8245         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8246         symbol in the --keep-unique list is not found.
8247
8248 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8249
8250         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8251         been maked as --keep-unique.
8252         (Icf::unfold_section): New function.
8253         * icf.h (Icf::unfold_section): New function.
8254         * options.h (General_options::keep_unique): New option.
8255         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8256         * testsuite/Makefile.in: Regenerate.
8257         * testsuite/icf_keep_unique_test.sh: New file.
8258         * testsuite/icf_keep_unique_test.cc: New file.
8259
8260 2009-08-12  Cary Coutant  <ccoutant@google.com>
8261
8262         PR 10471
8263         * resolve.cc (Symbol_table::resolve): Check for references from
8264         dynamic objects to hidden and internal symbols.
8265         * testsuite/Makefile.am (hidden_test.sh): New test.
8266         * testsuite/Makefile.in: Regenerate.
8267         * testsuite/hidden_test.sh: New script.
8268         * testsuite/hidden_test_1.c: New test source.
8269         * testsuite/hidden_test_main.c: New test source.
8270
8271 2009-08-11  Doug Kwan  <dougkwan@google.com>
8272
8273         * arm.cc: Update comments.
8274         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8275         segment to locate the .ARM.exidx section if present.
8276
8277 2009-08-09  Doug Kwan  <dougkwan@google.com>
8278
8279         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8280         patch.
8281
8282 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8283         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8284         compiler warnings.
8285
8286 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8287
8288         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8289         valid tls_segment only for non-debug-section relocations.
8290         * testsuite/Makefile.am: Add gc_tls_test.
8291         * testsuite/Makefile.in: Regenerate.
8292         * testsuite/gc_tls_test.cc: New file.
8293         * testsuite/gc_tls_test.sh: New file.
8294
8295 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8296
8297         * icf.cc: New file.
8298         * icf.h: New file.
8299         * Makefile.am (CCFILES): Add icf.cc.
8300         (HFILES): Add icf.h
8301         * Makefile.in: Regenerate.
8302         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8303         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8304         section, symbol and addend information for the relocs.
8305         * gold.cc (queue_middle_tasks): Call identical code folding.
8306         * gold.h: Add defines for multimap.
8307         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8308         to the call of finalize_local_symbols.
8309         * main.cc (main): Create object of class Icf.
8310         * object.cc (Sized_relobj::do_layout): Allow this function to be
8311         called twice during icf.
8312         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8313         to sections marked as identical by icf.
8314         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8315         when available.
8316         (Sized_relobj::do_section_entsize): New function.
8317         * object.h (Object::section_entsize): New function.
8318         (Object::do_section_entsize): New pure virtual function.
8319         (Relobj::finalize_local_symbols): Add new parameter.
8320         (Relobj::do_section_entsize): New function.
8321         * options.h (General_options::icf): New option.
8322         (General_options::icf_iterations): New option.
8323         (General_options::print_icf_sections): New option.
8324         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8325         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8326         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8327         icf.
8328         * symtab.cc (Symbol_table::is_section_folded): New function.
8329         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8330         to sections marked as identical by icf.
8331         * symtab.h (Symbol_table::set_icf): New function.
8332         (Symbol_table::icf): New function.
8333         (Symbol_table::is_section_folded): New function.
8334         (Symbol_table::icf_): New data member.
8335         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8336         * testsuite/Makefile.am: Add commands to build icf_test.
8337         * testsuite/Makefile.in: Regenerate.
8338         * testsuite/icf_test.sh: New file.
8339         * testsuite/icf_test.cc: New file.
8340
8341 2009-07-24  Chris Demetriou  <cgd@google.com>
8342
8343         * layout.cc (is_compressible_debug_section): Fix incorrect
8344         comment about compressed section names.
8345
8346 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8347
8348         PR 10419
8349         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8350
8351 2009-07-16  Ian Lance Taylor  <iant@google.com>
8352
8353         PR 10400
8354         * layout.h: #include <map>.
8355         (class Kept_section): Change from struct to class.  Add accessors
8356         and setters.  Add section size to Comdat_group mapping.  Change
8357         Comdat_group to std::map.  Add is_comdat_ field.  Add
8358         linkonce_size field in union.
8359         (class Layout): Update declaration of find_or_add_kept_section.
8360         Don't declare find_kept_object.
8361         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8362         parameter.  Add object, shndx, is_comdat, and is_group_name
8363         parameters.  Change all callers.  Adjust for new Kept_section.
8364         (Layout::find_kept_object): Remove.
8365         * object.cc (Sized_relobj::include_section_group): Update use of
8366         Kept_section.  Rename secnum to shndx.  Only record
8367         Kept_comdat_section if sections are the same size.
8368         (Sized_relobj::include_linkonce_section): Update use of
8369         Kept_section.  Only record Kept_comdat_section if sections are the
8370         same size.  Set size of linkonce section.
8371         (Sized_relobj::map_to_kept_section): Update call to
8372         get_kept_comdat_section.
8373         * object.h (class Sized_relobj): Rename fields in
8374         Kept_comdat_section to drop trailing underscores; change object
8375         field to Relobj*.  Change Kept_comdat_section_table to store
8376         struct rather than pointer.
8377         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8378         Add kept_object and kept_shndx parameters.  Change all callers.
8379         (Sized_relobj::get_kept_comdat_section): Change return type to
8380         bool.  Add kept_object and kept_shndx parameters.  Change all
8381         callers.
8382         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8383         Layout::find_or_add_kept_section.
8384
8385 2009-07-09  Ian Lance Taylor  <iant@google.com>
8386
8387         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8388         Reserve space in the hash table.
8389
8390 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8391
8392         * fileread.cc (File_read::get_mtime): New method.
8393         * fileread.h (Timespec): New structure.
8394         (File_read::get_mtime): New method.
8395         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8396         Renamed from timestamp_nsec.
8397         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8398         Elf_Xword.
8399         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8400         timestamp_nsec.
8401         (Incremental_inputs::report_archive): Save mtime; style fix.
8402         (Incremental_inputs::report_obejct): Save mtime; style fix.
8403         (Incremental_inputs::report_script): Save mtime; style fix.
8404         (Incremental_inputs::finalize_inputs): Style fix.
8405         (Incremental_inputs::finalize): Style fix.
8406         (Incremental_inputs::create_input_section_data): Store inputs
8407         mtime.
8408         * incremental.h (Incremental_inputs::report_script): Add mtime
8409         argument.
8410         (Incremental_inputs::Input_info::Input_info): Intialize only one
8411         union member.
8412         (Incremental_inputs::Input_info::archive): Move to nameless
8413         union.
8414         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8415         (Incremental_inputs::Input_info::script): Move to nameless union.
8416         (Incremental_inputs::mtime): New field.
8417         * script.cc (read_input_script): Pass file mtime to
8418         Incremental_input.
8419         * script.h (Script_info::inputs): Style fix.
8420
8421 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8422
8423         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8424         instead of 32.
8425
8426 2009-06-24  Ian Lance Taylor  <iant@google.com>
8427
8428         PR 10156
8429         * layout.cc (Layout::choose_output_section): If we find an
8430         existing section, update the flags.
8431         (Layout::create_notes): New function, broken out of
8432         Layout::finalize.
8433         (Layout::finalize): Don't create note sections.
8434         (Layout::create_note): Don't crash if linker script discards
8435         section.
8436         (Layout::create_gold_note): Likewise.
8437         (Layout::create_build_id): Likewise.  Don't set
8438         after_input_sections on the section.
8439         (Layout::create_executable_stack_info): Remove target parameter.
8440         Change caller.
8441         * layout.h (class Layout): Declare create_notes.  Update
8442         declaration of create_executable_stack_info.
8443         * gold.cc (queue_middle_tasks): Call create_notes.
8444         * output.cc (Output_section::update_flags_for_input_section): Move
8445         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8446         invalid.
8447         * output.h (Output_data::mark_address_invalid): New function.
8448         (class Output_section): Only declare, not define,
8449         update_flags_for_input_section.  Remove set_flags.
8450
8451 2009-06-24  Ian Lance Taylor  <iant@google.com>
8452
8453         * script-sections.cc (Output_section_definition::
8454         set_section_addresses): Rename shadowing local load_address to
8455         laddr.
8456
8457 2009-06-24  Ian Lance Taylor  <iant@google.com>
8458
8459         PR 10244
8460         * reloc.cc (relocate_sections): Skip empty relocation sections.
8461
8462 2009-06-23  Ian Lance Taylor  <iant@google.com>
8463
8464         PR 10156
8465         * layout.cc (Layout::create_note): Use choose_output_section
8466         rather than make_output_section.
8467
8468 2009-06-23  Ian Lance Taylor  <iant@google.com>
8469
8470         PR 10237
8471         * options.cc (General_options::parse_V): Set printed_version_.
8472         (General_options::General_options): Initialize printed_version_.
8473         * options.h (class General_options): Add printed_version_ field.
8474         * gold.cc (queue_initial_tasks): If there are no input files,
8475         don't give a fatal error if we printed the version information.
8476         (queue_middle_tasks): If using -r with a shared object, give a
8477         fatal error rather than an ordinary error.
8478
8479 2009-06-23  Ian Lance Taylor  <iant@google.com>
8480
8481         PR 10219
8482         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8483         (Layout::make_output_section): Set have_stabstr_section_ if we see
8484         a .stab*str section.
8485         (Layout::finalize): Call link_stabs_sections.
8486         (Layout::link_stabs_sections): New file.
8487         * layout.h (class Layout): Add have_stabstr_section_ field.
8488         Declare link_stabs_sections.
8489
8490 2009-06-23  Doug Kwan  <dougkwan@google.com>
8491
8492         * Makefile.am (libgold_a_LIBADD): New.
8493         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8494         * Makefile.in: Regenerate.
8495         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8496         * configure: Regenerate.
8497         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8498         * fileread.cc: Include sys/state.h
8499         * gold.h: Declare memmem and strndup if found missing.
8500         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8501
8502 2009-06-23  Ian Lance Taylor  <iant@google.com>
8503
8504         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8505         * configure: Rebuild.
8506
8507 2009-06-23  Ian Lance Taylor  <iant@google.com>
8508
8509         PR 10147
8510         * object.cc (Object::section_contents): Don't try to get a view if
8511         the section has length zero.
8512         (Object::handle_gnu_warning_section): If the section is empty, use
8513         the name of the section as the warning.
8514
8515 2009-06-23  Ian Lance Taylor  <iant@google.com>
8516
8517         PR 10133
8518         * stringpool.h (class Stringpool_template): Add optimize_ field.
8519         (Stringpool_template::set_optimize): New function.
8520         * stringpool.cc (Stringpool_template::Stringpool_template):
8521         Initialize optimize_ field.
8522         (Stringpool_template::set_string_offsets): Test local optimize
8523         fild rather than parameter.
8524         * layout.cc (Layout::Layout): Call set_optimize on the section
8525         name stringpool.
8526
8527 2009-06-22  Ian Lance Taylor  <iant@google.com>
8528
8529         PR 10030
8530         * yyscript.y: Parse TARGET.
8531         * script.cc (script_set_target): New function.
8532         * script-c.h (script_set_target): Declare.
8533         * options.cc (General_options::string_to_object_format): Rename
8534         from string_to_object_format in anonymous namespace.  Change
8535         callers.
8536         * options.h (class General_options): Declare
8537         string_to_object_format.
8538
8539 2009-06-22  Ian Lance Taylor  <iant@google.com>
8540
8541         * script-sections.cc (Script_sections::create_segments): Don't put
8542         program headers in a PT_LOAD segment if -n or -N.
8543
8544 2009-06-22  Ian Lance Taylor  <iant@google.com>
8545
8546         PR 10141
8547         * options.h (class General_options): Add -z lazy and -z now.  Sort
8548         -z options into alphabetical order.
8549         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8550
8551 2009-06-21  Ian Lance Taylor  <iant@google.com>
8552
8553         * layout.cc (Layout::make_output_section): Call
8554         Target::new_output_section.
8555         (Layout::attach_allocated_section_to_segment): Put large section
8556         sections in a separate load segment with the large segment flag
8557         set.
8558         (Layout::segment_precedes): Sort large data segments after other
8559         load segments.
8560         (align_file_offset): New static function.
8561         (Layout::set_segment_offsets): Use align_file_offset.
8562         * output.h (class Output_section): Add is_small_section_ and
8563         is_large_section_ fields.
8564         (Output_section::is_small_section): New function.
8565         (Output_section::set_is_small_section):  New function.
8566         (Output_section::is_large_section): New function.
8567         (Output_section::set_is_large_section): New function.
8568         (Output_section::is_large_data_section): New function.
8569         (class Output_segment): Add is_large_data_segment_ field.
8570         (Output_segment::is_large_data_segment): New function.
8571         (Output_segment::set_is_large_data_segment): New function.
8572         * output.cc (Output_section::Output_section): Initialize new
8573         fields.
8574         (Output_segment::Output_segment): Likewise.
8575         (Output_segment::add_output_section): Add assertion that large
8576         data sections always go in large data segments.  Force small data
8577         sections to the end of the list of data sections.  Force small BSS
8578         sections to the start of the list of BSS sections.  For large BSS
8579         sections to the end of the list of BSS sections.
8580         * symtab.h (class Symbol): Declare is_common_shndx.
8581         (Symbol::is_defined): Check Symbol::is_common_shndx.
8582         (Symbol::is_common): Likewise.
8583         (class Symbol_table): Define enum Commons_section_type.  Update
8584         declarations.  Add small_commons_ and large_commons_ fields.
8585         * symtab.cc (Symbol::is_common_shndx): New function.
8586         (Symbol_table::Symbol_table): Initialize new fields.
8587         (Symbol_table::add_from_object): Put small and large common
8588         symbols in the right list.
8589         (Symbol_table::sized_finalized_symbol): Check
8590         Symbol::is_common_shndx.
8591         (Symbol_table::sized_write_globals): Likewise.
8592         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8593         common symbol lists.  Don't call do_allocate_commons_list if the
8594         list is empty.
8595         (Symbol_table::do_allocate_commons_list): Remove is_tls
8596         parameter.  Add comons_section_type parameter.  Change all
8597         callers.  Handle small and large common symbols.
8598         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8599         Symbol::is_common_shndx.
8600         * resolve.cc (symbol_to_bits): Likewise.
8601         * target.h (Target::small_common_shndx): New function.
8602         (Target::small_common_section_flags): New function.
8603         (Target::large_common_shndx): New function.
8604         (Target::large_common_section_flags): New function.
8605         (Target::new_output_section): New function.
8606         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8607         small_common_section_flags, and large_common_section_flags
8608         fields.
8609         (Target::do_new_output_section): New virtual function.
8610         * arm.cc (Target_arm::arm_info): Initialize new fields.
8611         * i386.cc (Target_i386::i386_info): Likewise.
8612         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8613         Likewise.
8614         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8615         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8616         (Target_x86_64::do_new_output_section): New function.
8617         * configure.ac: Define conditional MCMODEL_MEDIUM.
8618         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8619         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8620         (large_LDFLAGS): Define.
8621         * testsuite/large.c: New file.
8622         * testsuite/testfile.cc (Target_test::test_target_info):
8623         Initialize new fields.
8624         * configure, testsuite/Makefile.in: Rebuild.
8625
8626 2009-06-05  Doug Kwan  <dougkwan@google.com>
8627
8628         * Makefile.am (CCFILES): Add target.cc.
8629         * Makefile.in: Regenerate.
8630         * i386.cc (class Target_i386): Define new virtual method to
8631         override do_is_local_label_name in parent.
8632         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8633         local symbols if --discard-locals or -X is given.
8634         * options.h (class General_options): Declare new options
8635         '--discard-locals' and '-X' for discarding locals.
8636         * target.h (class Target): Define new methods is_local_label_name.
8637         Declare new virtual method do_is_local_label_name.
8638         * target.cc: New file.
8639         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8640         (check_SCRIPTS): Add discard_locals_test.sh.
8641         (check_DATA): Add discard_local_tests.syms.
8642         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8643         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8644         * testsuite/Makefile.in: Regenerate.
8645         * testsuite/discard_locals_test.c: New file.
8646         * testsuite/discard_locals_test.sh: Same.
8647
8648 2009-06-05  Doug Kwan  <dougkwan@google.com>
8649
8650         * object.cc (Sized_relobj::Sized_relobj): Initialize
8651         discarded_eh_frame_shndx_ to -1U.
8652         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8653         section.
8654         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8655         a discarded .eh_frame section.
8656         (Sized_relobj::do_finalize_local_symbols): Ditto.
8657         * object.h (class Sized_relobj): Declare new member
8658         discarded_eh_frame_shndx_.
8659         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8660         (local_labels_test.o, local_labels_test): New rules.
8661         * testsuite/Makefile.in: Regenerate.
8662
8663 2009-06-04  Doug Kwan  <dougkwan@google.com>
8664
8665         * layout.cc (Layout::section_name_mapping): Add mapping for
8666         special ARM sections.
8667
8668 2009-06-03  Doug Kwan  <dougkwan@google.com>
8669
8670         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8671         (utils::has_overflow): Same.
8672
8673 2009-06-03  Ian Lance Taylor  <iant@google.com>
8674
8675         * layout.cc (Layout::section_name_mapping): New array, replacing
8676         Layout::linkonce_mapping.
8677         (Layout::section_name_mapping_count): New variable, replacing
8678         Layout::linkonce_mapping_count.
8679         (Layout::linkonce_output_name): Remove.
8680         (Layout::output_section_name): Rewrite.
8681         * layout.h (class Layout): Rename Linkonce_mapping to
8682         Section_name_mapping, linkonce_mapping to section_name_mapping,
8683         linkonce_mapping_count to section_name_mapping_count.  Don't
8684         declare linkonce_output_name.
8685
8686 2009-06-03  Doug Kwan  <dougkwan@google.com>
8687
8688         * gold/arm.cc (namespace utils): New.
8689         (Target_arm::reloc_is_non_pic): Define new method.
8690         (class Arm_relocate_functions): New.
8691         (Target_arm::Relocate::relocate): Handle relocation types used by
8692         Android.
8693
8694 2009-06-03  Ian Lance Taylor  <iant@google.com>
8695
8696         * arm.cc (Target_arm::scan::global): Use || instead of |.
8697
8698 2009-06-02  Doug Kwan  <dougkwan@google.com>
8699
8700         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8701         issued_non_pic_error_.
8702         (class Target_arm::Scan): Declare new method check_non_pic.
8703         Define new method symbol_needs_plt_entry.
8704         Declare new data member issued_non_pic_error_.
8705         (class Target_arm::Relocate): Declare new method
8706         should_apply_static_reloc.
8707         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8708         (Target_arm::Scan::check_non_pic): Define new method.
8709         (Target_arm::Scan::local): Handle a small subset of reloc types used
8710         by Android.
8711         (Target_arm::Scan::local): Same.
8712         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8713
8714 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8715
8716         * incremental.cc (Incremental_inputs::report_command_line): Filter
8717         out --incremental-* options.
8718
8719 2009-05-29  Doug Kwan  <dougkwan@google.com>
8720
8721         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8722         template class.
8723         (class Target_arm): Update comment.
8724         (Target_arm::Target_arm): Initialize new data members GOT_,
8725         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8726         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8727         and Target_arm::rel_dyn_section.
8728         Declare new_enum Target_arm::Got_type.
8729         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8730         and DYNBSS_.
8731         Update commments for member do_dynsym_value.
8732         (Target_arm::got_size, Target_arm::plt_section,
8733         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8734         new methods inside class defintion.
8735         (Target_arm::got_section): Define new method.
8736         (Target_arm::rel_dyn_section): Same.
8737         (Output_data_plt_arm): New template class.
8738         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8739         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8740         (Output_data_plt_arm::add_entry): Same.
8741         (Output_data_plt_arm::first_plt_entry): Define new
8742         static data member for PLT instruction template.
8743         (Output_data_plt_arm::plt_entry): Same.
8744         (Output_data_plt_arm::do_write): Define new method.
8745         (Target_arm::make_plt_entry): Same.
8746         (Target_arm::do_finalize_sections): Same.
8747         (Target_arm::do_dynsym_value): Same.
8748
8749 2009-05-28  Doug Kwan  <dougkwan@google.com>
8750
8751         * Makefile.am (TARGETSOURCES): Add arm.cc.
8752         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8753         * Makefile.in: Regenerate.
8754         * arm.cc: New file.
8755         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8756
8757 2009-05-26  Doug Kwan  <dougkwan@google.com>
8758
8759         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8760         (General_options::check_excluded_libs): Strip off directories in
8761         archive name before matching like GNU ld does.
8762         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8763         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8764         (exclude_libs_test_LDFLAGS): Add linker option
8765         -Wl,--exclude-libs,libexclude_libs_test_3
8766         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8767         an explicit archive without using -l.
8768         (alt/libexclude_libs_test_3.a): New make rule.
8769         * testsuite/Makefile.in: Regenerate.
8770         * testsuite/exclude_libs_test.c : Declare lib3_default().
8771         (main): Call it.
8772         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8773         * exclude_libs_test_3.c: New file.
8774
8775 2009-05-26  Nick Clifton  <nickc@redhat.com>
8776
8777         * po/id.po: New Indonesian translation.
8778         * po/gold.pot: Updated template file.
8779
8780 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8781
8782         * testsuite/Makefile.am: Add -ffunction-sections to compile
8783         gc_comdat_test files.  Add -Wl,--gc-sections to build
8784         gc_comdat_test.
8785         * testsuite/Makefile.in: Regenerate.
8786         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8787
8788 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8789
8790         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8791         kept comdat section was garbage collected.
8792         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8793         * testsuite/Makefile.in: Regenerate.
8794         * testsuite/gc_comdat_test.sh: New file.
8795         * testsuite/gc_comdat_test_1.cc: New file.
8796         * testsuite/gc_comdat_test_2.cc: New file.
8797
8798 2009-05-19  Doug Kwan  <dougkwan@google.com>
8799
8800         * archive.cc (Archive::Archive): Move constructor from archive.h
8801         to here.  Initialize no_export_.
8802         (Archive::get_elf_object_for_member): Set no_export flag of object.
8803         * archive.h (Archive::Archive): Move constructor body to
8804         archive.cc.
8805         (Archive::no_export): New method.
8806         (Archive::no_export_): New field.
8807         * object.h (Object::Object): Initialize no_export_ to false.
8808         (Object::no_export, Object::set_no_export): New methods.
8809         (Object::no_export_): New field.
8810         * options.cc (General_options::parse_exclude_libs): New method.
8811         (General_options::check_excluded_libs) Same.
8812         * options.h (exclude_libs): New option.
8813         (General_options::check_excluded_libs): New method declaration.
8814         (General_options::excluded_libs_): New field.
8815         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8816         default or protected visibility if an object has no-export flag set.
8817         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8818         (check_SCRIPTS): Add exclude_libs_test.sh.
8819         (check_DATA): Add exclude_libs_test.syms.
8820         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8821         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8822         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8823         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8824         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8825         libexclude_libs_test_2.a): New rules.
8826         * testsuite/Makefile.in: Regenerate.
8827         * testsuite/exclude_libs_test.c: New file.
8828         * testsuite/exclude_libs_test.sh: Ditto.
8829         * testsuite/exclude_libs_test_1.c: Ditto.
8830         * testsuite/exclude_libs_test_2.c: Ditto.
8831
8832 2009-05-15  Ian Lance Taylor  <iant@google.com>
8833
8834         * configure.ac: Check for declarations for cases where libiberty.h
8835         checks HAVE_DECL_xxx.
8836         * configure, config.in: Rebuild.
8837
8838 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8839
8840         * gold.h (Incremental_argument_list): Remove (invalid) forward
8841         declaration.
8842         * incremental.cc (Incremental_inputs::report_achive): New method.
8843         (Incremental_inputs::report_object): New method.
8844         (Incremental_inputs::report_script): New method.
8845         (Incremental_inputs::finalize_inputs): New method.
8846         (Incremental_inputs::finalize): Call finalize_inputs().
8847         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8848         Create inputs entries.
8849         * incremental.h (Incremental_input_type): New enum.
8850         (Incremental_inputs::Incremental_input): Initialize new fields.
8851         (Incremental_inputs::report_inputs): New method.
8852         (Incremental_inputs::report_achive): New method.
8853         (Incremental_inputs::report_object): New method.
8854         (Incremental_inputs::report_script): New method.
8855         (Incremental_inputs::finalize_inputs): New method.
8856         (Incremental_inputs::Input_info): New struct.
8857         (Incremental_inputs::Input_info_map): New typedef.
8858         (Incremental_inputs::lock_): New field.
8859         (Incremental_inputs::Inputs_): New field.
8860         (Incremental_inputs::Inputs_map): New field.
8861         * main.cc (main): Call Incremental_input::report_inputs.
8862         * options.h (Input_argument_list): Typedef moved from
8863         Input_arguments.
8864         (Input_file_group::Files): Remove, use ::Input_argument_list.
8865         (Input_file_group::Input_argument_list): Remove, use
8866         ::Input_argument_list.
8867         * plugin.cc (Plugin_manager::add_input_file): Add error in
8868         incremental build.
8869         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8870         functions.
8871         * script.cc (read_input_script): Call
8872         Incremental_input::report_script.
8873         * script.h (Script_info): New class.
8874
8875 2009-04-27  Ian Lance Taylor  <iant@google.com>
8876
8877         * x86_64.cc (do_adjust_output_section): Set entsize to
8878         plt_entry_size.
8879
8880 2009-04-23  Elliott Hughes  <enh@google.com>
8881
8882         * output.cc (Output_file::close): After short writes, continue
8883         writing from the correct offset in the buffer being written.
8884
8885 2009-04-23  Chris Demetriou  <cgd@google.com>
8886
8887         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8888         * configure: Regenerate.
8889         * config.in: Regenerate.
8890         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8891         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8892
8893 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8894
8895         * incremental.cc (Incremental_inputs_header_data): Renamed from
8896         Incremental_input_header_data.
8897         (Incremental_inputs_header_data::data_size): New field.
8898         (Incremental_inputs_header_data::put_input_file_count): Renamed
8899         from input_file_count.
8900         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8901         from command_line_offset.
8902         (Incremental_inputs_header_data::put_reserved): Renamed from
8903         put_reserved.
8904         (Incremental_inputs_entry_data): Renamed from
8905         Incremental_input_entry_data.
8906         (Incremental_inputs_entry_data::data_size): New field.
8907         (Incremental_inputs::report_command_line): New method.
8908         (Incremental_inputs::finalize): New method.
8909         (Incremental_inputs::create_incremental_inputs_data): New method.
8910         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8911         * incremental.h: New file.
8912         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8913        (Layout::finalize): Create incremental inputs section in
8914         incremental builds.
8915        (Layout::create_incremental_info_sections): New method.
8916         * layout.h (Layout::incremental_inputs): New method.
8917        (Layout::create_incremental_info_sections): New method.
8918        (Layout::incremental_inputs_): New field.
8919         * main.cc (main): Notify Incremental_input of the command line.
8920
8921 2009-04-01  Ian Lance Taylor  <iant@google.com>
8922             Mikolaj Zalewski  <mikolajz@google.com>
8923
8924         * gold.h (reserve_unordered_map): Define, three versions, one for
8925         each version of Unordered_map.
8926         * layout.cc (Layout::Layout): Remove options parameter.  Add
8927         number_of_input_files parameter.  Don't initialize options_.
8928         Initialize number_of_input_files_ and resized_signatures_.  Move
8929         sections_are_attached_.
8930         (Layout::layout_group): Reserve space for group_signatures_.
8931         (Layout::find_or_add_kept_section): Change name parameter to be a
8932         reference.  Resize signatures_ map when it gets large enough.
8933         (Layout::layout_eh_frame): Use parameters->options() instead of
8934         this->options_.
8935         (Layout::make_output_section): Likewise.
8936         (Layout::attach_allocated_section_to_segment): Likewise.
8937         (Layout::finalize, Layout::create_executable_stack): Likewise.
8938         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8939         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8940         * layout.h (class Layout): Update declarations.  Remove options_
8941         field.  Add number_of_input_files_ and resized_signatures_
8942         fields.  Move sections_are_attached_ field.
8943         * main.cc (main): Pass number of input files to Layout
8944         constructor.  Don't pass options.
8945
8946 2009-03-30  Ian Lance Taylor  <iant@google.com>
8947
8948         * ffsll.c (ffsll): Correct implementation.
8949
8950 2009-03-27  Ian Lance Taylor  <iant@google.com>
8951
8952         * ffsll.c: New file.
8953         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8954         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8955         * ftruncate.c (ftruncate): Declare before definition.
8956         * mremap.c (mremap): Likewise.
8957         * pread.c (pread): Likewise.
8958         * configure, Makefile.in, config.in: Rebuild.
8959
8960         * mremap.c: New file.
8961         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8962         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8963         (mremap): Declare if HAVE_MREMAP is not defined.
8964         * configure, Makefile.in, config.in: Rebuild.
8965
8966 2009-03-27  Cary Coutant  <ccoutant@google.com>
8967
8968         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8969         position independent.
8970         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8971         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8972
8973 2009-03-24  Cary Coutant  <ccoutant@google.com>
8974
8975         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8976         an executable.
8977         (needs_dynamic_reloc): Likewise.
8978
8979 2009-03-24  Ian Lance Taylor  <iant@google.com>
8980
8981         * yyscript.y (file_cmd): Recognize EXTERN.
8982         (extern_name_list, extern_name_list_body): New nonterminals.
8983         * script.cc (script_add_extern): Define.
8984         * script-c.h (script_add_extern): Declare.
8985
8986 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8987
8988         * object.cc (is_elf_object): Define.
8989         * object.h (is_elf_object): Declare.
8990         * archive.cc (Archive::get_elf_object_for_member): Call
8991         is_elf_object.
8992         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8993
8994 2009-03-24  Elliott Hughes  <enh@google.com>
8995
8996         * output.cc (Output_file::map_anonymous): Define.
8997         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8998         try an anonymous one.  Report the size if the mmap fails.
8999         * output.h (class Output_file): Declare map_anonymous.
9000
9001 2009-03-24  Ian Lance Taylor  <iant@google.com>
9002
9003         * target-select.cc (instantiate_target): Don't acquire the lock if
9004         the instantiated_target_ field has already been set.
9005
9006 2009-03-23  Ian Lance Taylor  <iant@google.com>
9007
9008         * gold-threads.h (class Initialize_lock): Define.
9009         * gold-threads.cc (class Initialize_lock_once): Define.
9010         (initialize_lock_control): New static variable.
9011         (initialize_lock_pointer): New static variable.
9012         (initialize_lock_once): New static function.
9013         (Initialize_lock::Initialize_lock): Define.
9014         (Initialize_lock::initialize): Define.
9015         * target-select.h: Include "gold-threads.h".
9016         (class Target_selector): Add lock_ and initialize_lock_ fields.
9017         Don't define instantiate_target, just declare it.
9018         * target-select.cc (Target_selector::Target_selector): Initialize
9019         new fields.
9020         (Target_selector::instantiate_target): Define.
9021         * descriptors.h: Include "gold-threads.h".
9022         (class Descriptors): Add initialize_lock_ field.
9023         * descriptors.cc (Descriptors::Descriptors): Initialize new
9024         field.
9025         (Descriptors::open): Use initialize_lock_ field
9026         * errors.h (class Errors): Add initialize_lock_ field.
9027         * errors.cc (Errors::Errors): Initialize new field.
9028         (Errors::initialize_lock): Use initialize_lock_ field.
9029         * powerpc.cc (class Target_selector_powerpc): Remove
9030         instantiated_target_ field.  In do_recognize call
9031         instantiate_target rather than do_instantiate_target.  In
9032         do_instantiate_target just allocate a new target.
9033         * sparc.cc (class Target_selector_sparc): Likewise.
9034
9035         * freebsd.h: New file.
9036         * i386.cc: Include "freebsd.h".
9037         (Target_i386): Derive from Target_freebsd rather than
9038         Sized_target.
9039         (Target_selector_i386): Derive from Target_selector_freebsd rather
9040         than Target_selector.
9041         * x86_64.cc: Include "freebsd.h".
9042         (Target_x86_64): Derive from Target_freebsd rather than
9043         Sized_target.
9044         (Target_selector_x86_64): Derive from Target_selector_freebsd
9045         rather than Target_selector.
9046         * target.h (class Target): Add adjust_elf_header and
9047         do_adjust_elf_header.
9048         * output.cc (Output_file_header:: do_sized_write): Call target
9049         adjust_elf_header routine.
9050         * configure.tgt: Set targ_osabi.
9051         * configure.ac: Define GOLD_DEFAULT_OSABI.
9052         * parameters.cc (Parameters::default_target): Pass
9053         GOLD_DEFAULT_OSABI to select_target.
9054         * target-select.h (class Target_selector): Make instantiate_target
9055         protected rather than private.
9056         * Makefile.am (HFILES): Add freebsd.h.
9057         * configure, Makefile.in, config.in: Rebuild.
9058
9059         * merge.cc (do_add_input_section): Correct pend value.  Change
9060         message about last entry not being null terminated from error to
9061         warning.
9062
9063 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9064
9065         * incremental.cc: New file.
9066         * Makefile.am (CCFILES): Add incremental.cc.
9067         * Makefile.in: Rebuild.
9068
9069 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9070
9071         * layout.cc (Layout::output_section_name): Preserve names
9072         of '.note.' sections.
9073
9074 2009-03-19  Ian Lance Taylor  <iant@google.com>
9075
9076         * descriptors.cc (Descriptors::open): Check that the options are
9077         valid before using them.
9078
9079 2009-03-18  Ian Lance Taylor  <iant@google.com>
9080
9081         * script-sections.h: Include <list>.
9082         (class Script_sections): Change Sections_elements from std::vector
9083         to std::list.  Typedef public Elements_iterator.  Add
9084         orphan_section_placement_, data_segment_align_start_, and
9085         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9086         field.
9087         * script-sections.cc (class Orphan_section_placement): New class.
9088         (class Sections_element): Add virtual functions is_relro and
9089         orphan_section_init.  Remove virtual function place_orphan_here.
9090         (class Output_section_definition): Add is_relro and
9091         orphan_section_init.  Remove place_orphan_here.
9092         (class Orphan_output_section): Likewise.
9093         (Script_sections::Script_sections): Update for field changes.
9094         (Script_sections::data_segment_align): Set saw_data_segment_align_
9095         and data_segment_align_start_, not data_segment_align_index.
9096         (Script_sections::data_segment_relro_end): Check
9097         saw_data_segment_align_.  Use data_segment_align_start_ rather
9098         than data_segment_align_index_.
9099         (Script_sections::place_orphan): Rewrite to use
9100         Orphan_section_placement.
9101
9102 2009-03-17  Ian Lance Taylor  <iant@google.com>
9103
9104         * archive.cc (Archive::add_symbols): Check for a version attached
9105         to the symbol name in the archive map.
9106         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9107         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9108         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9109         (ver_test_11.a): New target.
9110         * testsuite/Makefile.in: Rebuild.
9111
9112         * configure.ac: Check for chsize and posix_fallocate.  Replace
9113         ftruncate.
9114         * ftruncate.c: New file, from gnulib.
9115         * output.cc (posix_fallocate): Define dummy version if not
9116         HAVE_POSIX_FALLOCATE.
9117         (Output_file::map): Call posix_fallocate rather than lseek and
9118         write.
9119         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9120         * configure, Makefile.in, config.in: Rebuild.
9121
9122 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9123
9124         * layout.h (Layout::create_note): Add section_name parameter.
9125         * layout.cc (Layout::create_note): Likewise.
9126         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9127
9128 2009-03-17  Ian Lance Taylor  <iant@google.com>
9129
9130         * descriptors.cc: Include "options.h".
9131         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9132         (Descriptors::open): Always use O_CLOEXEC when opening a new
9133         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9134         then set FD_CLOEXEC.
9135
9136         * sparc.cc (class Target_sparc): Add has_got_section.
9137         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9138         make sure we have a GOT section.
9139
9140         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9141         (Target_sparc::Scan::local): Likewise.
9142         (Target_sparc::Scan::global): Likewise.
9143         (Target_sparc::Relocate::relocate): Likewise.
9144         (Target_sparc::Relocate::relocate_tls): Likewise.
9145
9146         * symtab.cc (Symbol_table::define_default_version): New function,
9147         broken out of add_from_object.
9148         (Symbol_table::add_from_object): Call define_default_version.
9149         (Symbol_table::define_special_symbol): Add resolve_oldsym
9150         parameter.  Change all callers.  If the version for a symbol comes
9151         from a version script, resolve it with the symbol with the same
9152         name with no version.  Also add the symbol without a version if
9153         appropriate.
9154         (do_define_in_output_data): If resolving with oldsym, don't delete
9155         sym.
9156         (do_define_in_output_segment): Likewise.
9157         (do_define_as_constant): Likewise.
9158         * symtab.h (class Symbol_table): Update declarations.
9159
9160 2009-03-13  Ian Lance Taylor  <iant@google.com>
9161
9162         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9163         (Read_symbols::requeue): New function.
9164         (Read_symbols::do_read_symbols): If make_elf_object fails because
9165         the target type is not configured, and the file was searched for,
9166         issue a warning and retry with the next directory.
9167         (Add_symbols::run): If the file has an incompatible format, and
9168         it was searched for, requeue the Read_symbols task.  On error,
9169         release the object.
9170         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9171         dirindex parameter to constructor.  Change all callers.  Declare
9172         incompatible_warning and requeue.
9173         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9174         input_argument_ and input_group_ fields.  Add them to
9175         constructor.  Change all callers.
9176         (class Read_script): Add dirindex_ field.  Add it to constructor.
9177         Change all callers.
9178         * archive.cc (Archive::setup): Remove input_objects parameter.
9179         Change all callers.
9180         (Archive::get_file_and_offset): Likewise.
9181         (Archive::read_all_symbols): Likewise.
9182         (Archive::read_symbols): Likewise.
9183         (Archive::get_elf_object_for_member): Remove input_objects
9184         parameter.  Add punconfigured parameter.  Change all callers.
9185         (Archive::add_symbols): Change return type to bool.  Check return
9186         value of include_member.
9187         (Archive::include_all_members): Likewise.
9188         (Archive::include_member): Change return type to bool.  Return
9189         false if first included object has incompatible target.  Set
9190         included_member_ field.
9191         (Add_archive_symbols::run): If add_symbols returns false, requeue
9192         Read_symbols task.
9193         * archive.h (class Archive): Add included_member_ field.
9194         Initialize it in constructor.  Add input_file and searched_for
9195         methods.  Update declarations.
9196         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9197         input_argument_ fields.  Add them to constructor.  Change all
9198         callers.
9199         * script.cc: Include "target-select.h".
9200         (class Parser_closure): Add skip_on_incompatible_target_ and
9201         found_incompatible_target_ fields.  Add
9202         skip_on_incompatible_target parameter to constructor.  Change all
9203         callers.  Add methods skip_on_incompatible_target,
9204         clear_skip_on_incompatible_target, found_incompatible_target, and
9205         set_found_incompatible_target.
9206         (read_input_script): Add dirindex parameter.  Change all callers.
9207         If parser finds an incompatible target, requeue Read_symbols
9208         task.
9209         (script_set_symbol): Clear skip_on_incompatible_target in
9210         closure.
9211         (script_add_assertion, script_parse_option): Likewise.
9212         (script_start_sections, script_add_phdr): Likewise.
9213         (script_check_output_format): New function.
9214         * script.h (read_input_script): Update declaration.
9215         * script-c.h (script_check_output_format): Declare.
9216         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9217         (ignore_cmd): Remove OUTPUT_FORMAT.
9218         * fileread.cc (Input_file::Input_file): Add explicit this.
9219         (Input_file::will_search_for): New function.
9220         (Input_file::open): Add pindex parameter.  Change all callers.
9221         * fileread.h (class Input_file): Add input_file_argument method.
9222         Declare will_search_for.  Update declarations.
9223         * object.cc (make_elf_object): Add punconfigured parameter.
9224         Change all callers.
9225         * object.h (class Object): Make input_file public.  Add
9226         searched_for method.
9227         (make_elf_object): Update declaration.
9228         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9229         restart search.
9230         * dirsearch.h (class Dirsearch): Update declaration.
9231         * options.h (class General_options): Add --warn-search-mismatch.
9232         * parameters.cc (Parameters::is_compatible_target): New function.
9233         * parameters.h (class Parameters): Declare is_compatible_target.
9234         * workqueue.cc (Workqueue::add_blocker): New function.
9235         * workqueue.h (class Workqueue): Declare add_blocker.
9236
9237         * fileread.cc (Input_file::open): Remove options parameter.
9238         Change all callers.
9239         (Input_file::open_binary): Likewise.
9240         * script.cc (read_input_script): Likewise.
9241         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9242         options parameter from constructor.  Change all callers.
9243         (class Read_script): Likewise.
9244         * fileread.h (class Input_file): Update declarations.
9245         * script.h (read_input_script): Update declaration.
9246
9247 2009-03-10  Nick Clifton  <nickc@redhat.com>
9248
9249         * po/es.po: New Spanish translation.
9250
9251 2009-03-06  Cary Coutant  <ccoutant@google.com>
9252
9253         * options.cc (parse_short_option): Keep dash_z from registering itself.
9254
9255 2009-03-03  Ian Lance Taylor  <iant@google.com>
9256
9257         PR 9918
9258         * target-reloc.h (relocate_section): Pass output_section to
9259         relocate.
9260         * i386.cc (Target_i386::should_apply_static_reloc): Add
9261         output_section parameter.  Change all callers.
9262         (Target_i386::Relocate::relocate): Add output_section parameter.
9263         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9264         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9265         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9266         * testsuite/two_file_shared.sh: New script.
9267         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9268         (check_DATA): Add two_file_shared.dbg.
9269         (two_file_shared.dbg): New target.
9270         * testsuite/Makefile.in: Rebuild.
9271
9272 2009-03-01  Ian Lance Taylor  <iant@google.com>
9273
9274         * configure.ac: Check for byteswap.h.
9275         * configure: Rebuild.
9276         * config.in: Rebuild.
9277
9278 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9279
9280         * layout.cc (Layout::find_or_add_kept_section): New function.
9281         (Layout::add_comdat): Removed.
9282         * layout.h (struct Kept_section): Move out of class Layout.
9283         Remove trailing underscores from field names.  Add group_sections
9284         field.  Rename group_ field to is_group.  Change all uses.
9285         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9286         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9287         comdat_groups_ field.
9288         (Sized_relobj::include_section_group): Use
9289         find_or_add_kept_section and Kept_section::group_sections.
9290         (Sized_relobj::include_linkonce_section): Likewise.
9291         * object.cc (class Sized_relobj): Don't define Comdat_group or
9292         Comdat_group_table.  Remove find_comdat_group and
9293         add_comdat_group.  Remove comdat_groups_ field.
9294         * plugin.cc (include_comdat_group): Use
9295         Layout::find_or_add_kept_section.
9296
9297 2009-02-28  Ian Lance Taylor  <iant@google.com>
9298
9299         * README: --gc-sections and map files are now supported.  Document
9300         some build requirements.
9301
9302         PR 6992
9303         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9304         relocatable link set the value of the section symbol to zero.
9305         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9306         relocatable link don't include the section address in the local
9307         symbol value.
9308
9309 2009-02-27  Ian Lance Taylor  <iant@google.com>
9310
9311         PR 6811
9312         * options.h (class Search_directory): Add is_system_directory.
9313         (class General_options): Declare is_in_system_directory.
9314         * options.cc (get_relative_sysroot): Make static.
9315         (get_default_sysroot): Make static.
9316         (General_optoins::is_in_system_directory): New function.
9317         * fileread.cc (Input_file::is_in_system_directory): New function.
9318         * fileread.h (class Input_file): Declare is_in_system_directory.
9319         * object.h (class Object): Add is_in_system_directory.
9320         (class Input_objects): Remove system_library_directory_ field.
9321         * object.cc (Input_objects::add_object): Don't set
9322         system_library_directory_.
9323         (input_objects::found_in_system_library_directory): Remove.
9324         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9325         parameter.  Change all callers.
9326         (Symbol_table::sized_write_globals): Likewise.
9327         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9328         Call Object::is_in_system_directory.
9329         * symtab.h (class Symbol_table): Update declarations.
9330
9331         PR 5990
9332         * descriptors.h (Open_descriptor): Add is_on_stack field.
9333         * descriptors.cc (Descriptors::open): If the descriptor is on the
9334         top of the stack, remove it.  Initialize is_on_stack field.
9335         (Descriptors::release): Only add pod to stack if it is not on the
9336         stack already.
9337         (Descriptors::close_some_descriptor): Clear stack_next and
9338         is_on_stack fields.
9339
9340         PR 7091
9341         * output.cc (Output_section::find_starting_output_address): Rename
9342         from starting_output_address; add PADDR parameter; change return
9343         type.
9344         * output.h (class Output_section): Declare
9345         find_starting_output_address instead of starting_output_address.
9346         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9347         section symbol for which we can't find a merge section.
9348
9349         PR 9836
9350         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9351         hidden or internal, force the symbol to be local.
9352         * resolve.cc (Symbol::override_visibility): Define.
9353         (Symbol::override_base): Use override_visibility.
9354         (Symbol_table::resolve): Likewise.
9355         (Symbol::override_base_with_special): Likewise.
9356         (Symbol_table::override_with_special): If the visibility is hidden
9357         or internal, force the symbol to be local.
9358         * symtab.h (class Symbol): Add set_visibility and
9359         override_visibility.
9360         * testsuite/ver_test_1.sh: New file.
9361         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9362         (check_DATA): Add ver_test_1.syms.
9363         (ver_test_1.syms): New target.
9364         * testsuite/Makefile.in: Rebuild.
9365
9366 2009-02-25  Cary Coutant  <ccoutant@google.com>
9367
9368         * layout.cc (Layout::choose_output_section): Don't rename sections
9369         when using a linker script that has a SECTIONS clause.
9370         * Makefile.in: Regenerate.
9371
9372         * testsuite/Makefile.am (script_test_5.sh): New test case.
9373         * testsuite/Makefile.in: Regenerate.
9374         * testsuite/script_test_5.cc: New file.
9375         * testsuite/script_test_5.sh: New file.
9376         * testsuite/script_test_5.t: New file.
9377
9378 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9379
9380         * archive.cc (Archive::include_member): Update calls to add_symbols.
9381         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9382         the Layout argument.
9383         * dynobj.h (do_add_symbols): Add the Layout argument.
9384         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9385         Layout argument.
9386         * object.h (Object::add_symbols): Add the Layout argument.
9387         (Object::do_add_symbols): Add the Layout argument.
9388         (Sized_relobj::do_add_symbols): Add the Layout argument.
9389         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9390         Unify the two versions.
9391         (Add_plugin_symbols): Remove.
9392         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9393         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9394         (Add_plugin_symbols): Remove.
9395         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9396         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9397         (Add_symbols::run): Make it work with Pulginobj.
9398
9399 2009-02-06  Ian Lance Taylor  <iant@google.com>
9400
9401         * object.cc (Sized_relobj::do_layout): Make info message start
9402         with lower case letter.
9403
9404 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9405
9406         * binary.cc: Fix file comment.
9407
9408         * options.h (enum Incremental_disposition): Define.
9409         (class General_options): Add new options: --incremental,
9410         --incremental_changed, --incremental_unchanged,
9411         --incremental_unknown.  Add incremental_disposition_ and
9412         implicit_incremental_ fields.
9413         (General_options::incremental_disposition): New function.
9414         (class Position_dependent_options): Add incremental_disposition
9415         option.
9416         (Position_dependent_options::copy_from_options): Set incremental
9417         dispositions.
9418         * options.cc (General_options::parse_incremental_changed): New
9419         function.
9420         (General_options::parse_incremental_unchanged): New function.
9421         (General_options::parse_incremental_unknown): New function.
9422         (General_options::General_options): Initialize new fields
9423         incremental_disposition_ and implicit_incremental_.
9424         (General_options::finalize): Check for uasge of --incremental-*
9425         without --incremental.
9426
9427 2009-02-06  Chris Demetriou  <cgd@google.com>
9428
9429         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9430         pointer and to report location as the file name associated with
9431         the symbol.
9432         (gold_undefined_symbol_at_location): New function to replace the
9433         old gold_undefined_symbol functionality.
9434         * target-reloc.h (relocate_section): Update to use
9435         gold_undefined_symbol_at_location.
9436         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9437         Call gold_undefined_symbol function rather than gold_error.
9438         * errors.h (Errors::undefined_symbol): Take location as a
9439         string, rather than calculating it from a relocation.
9440         * errors.cc (Errors::fatal): Print "fatal error:" before the
9441         formatted message.
9442         (Errors::error, Errors::error_at_location): Print "error: "
9443         before the formatted message.
9444         (Errors::undefined_symbol): Take location as a string, rather
9445         than calculating it from a relocation.
9446         (gold_undefined_symbol_at_location): New function akin to
9447         old gold_undefined_symbol, calculates location from relocation.
9448         (gold_undefined_symbol): Change to take only a Symbol pointer
9449         and to report location as the file name associated with the symbol.
9450         * testsuite/debug_msg.sh: Update for changed error messages.
9451         * testsuite/undef_symbol.sh: Likewise.
9452
9453 2009-02-04  Duncan Sands  <baldrick@free.fr>
9454
9455         PR 9812
9456         * reduced_debug_output.h
9457         (Output_reduced_debug_abbrev_section::failed): Use format for
9458         gold_warning.
9459         (Output_reduced_debug_info_section::faild): Likewise.
9460
9461 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9462
9463         * script.cc (Lazy_demangler): New class.
9464         (Version_script_info::get_symbol_version_helper): Demangle a
9465         symbol only once.
9466
9467 2009-01-29  Cary Coutant  <ccoutant@google.com>
9468
9469         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9470         to __tls_get_addr.
9471         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9472
9473 2009-01-28  Ian Lance Taylor  <iant@google.com>
9474
9475         * version.cc (version_string): Bump to 1.9.
9476
9477         * gold.h: Include <cstring> and <stdint.h>.
9478         * version.cc: Include <cstdio>.
9479         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9480         warning.
9481         * reduced_debug_output.cc (insert_into_vector): Rename from
9482         Insert_into_vector; change all callers.  Use Swap_unaligned to
9483         avoid aliasing issue; remove union since it is unnecessary.
9484
9485 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9486
9487         * Makefile.am (CCFILES): Add gc.cc.
9488         (HFILES): Add gc.h.
9489         * Makefile.in: Regenerate.
9490         * gold.cc (Gc_runner): New class.
9491         (queue_initial_tasks): Call garbage collection related tasks
9492         when corresponding options are invoked.
9493         (queue_middle_gc_tasks): New function.
9494         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9495         processed early before laying out sections during garbage collection.
9496         * gold.h (queue_middle_gc_tasks): New function.
9497         (is_prefix_of): Move from "layout.cc".
9498         * i386.cc (Target_i386::gc_process_relocs): New function.
9499         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9500         * main.cc (main): Create object of class "Garbage_collection".
9501         * object.cc (Relobj::copy_symbols_data): New function.
9502         (Relobj::is_section_name_included): New function.
9503         (Sized_relobj::do_layout): Allow this function to be called twice
9504         during garbage collection and defer layout of section during the
9505         first call.
9506         * object.h (Relobj::get_symbols_data): New function.
9507         (Relobj::is_section_name_included): New function.
9508         (Relobj::copy_symbols_data): New function.
9509         (Relobj::set_symbols_data): New function.
9510         (Relobj::get_relocs_data): New function.
9511         (Relobj::set_relocs_data): New function.
9512         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9513         (Relobj::gc_process_relocs): New function.
9514         (Relobj::do_gc_process_relocs): New pure virtual function.
9515         (Relobj::sd_): New data member.
9516         (Sized_relobj::is_output_section_offset_invalid): New function.
9517         (Sized_relobj::do_gc_process_relocs): New function.
9518         * options.h (General_options::gc_sections): Modify to not be a no-op.
9519         (General_options::print_gc_sections): New option.
9520         * plugin.cc (Plugin_finish::run): Remove function call to
9521         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9522         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9523         * reloc.cc (Read_relocs::run): Add task to process relocs and
9524         determine unreferenced sections when doing garbage collection.
9525         (Gc_process_relocs): New class.
9526         (Sized_relobj::do_gc_process_relocs): New function.
9527         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9528         sections that are garbage collected.
9529         * reloc.h (Gc_process_relocs): New class.
9530         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9531         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9532         symbols whose corresponding sections are garbage collected.
9533         (Symbol_table::Symbol_table): Add new parameter for the garbage
9534         collection object.
9535         (Symbol_table::gc_mark_undef_symbols): New function.
9536         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9537         (Symbol_table::gc_mark_dyn_syms): New function.
9538         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9539         as garbage.
9540         (Symbol_table::add_from_object): Likewise.
9541         (Symbol_table::add_from_relobj): When building shared objects, do not
9542         treat externally visible symbols as garbage.
9543         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9544         table information for static and relocatable links.
9545         * symtab.h (Symbol_table::set_gc): New function.
9546         (Symbol_table::gc): New function.
9547         (Symbol_table::gc_mark_undef_symbols): New function.
9548         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9549         (Symbol_table::gc_mark_dyn_syms): New function.
9550         (Symbol_table::gc_): New data member.
9551         * target.h (Sized_target::gc_process_relocs): New pure virtual
9552         function.
9553         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9554         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9555
9556 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9557
9558         * options.h (General_options::gc_sections): Define as a no-op for now.
9559         (General_options::no_keep_memory): Ditto.
9560         (General_options::Bshareable): Define.
9561         * options.cc (General_options::finalize): Honor -Bshareable.
9562
9563 2009-01-20  Andreas Schwab  <schwab@suse.de>
9564
9565         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9566         read the value in the contents, since we don't use it.  Use the
9567         template endianness when writing.
9568         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9569
9570 2009-01-19  Andreas Schwab  <schwab@suse.de>
9571
9572         * configure.tgt (powerpc64-*): Fix targ_obj.
9573
9574 2009-01-15  Ian Lance Taylor  <iant@google.com>
9575
9576         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9577         local symbols when stripping all symbols.
9578
9579 2009-01-14  Cary Coutant  <ccoutant@google.com>
9580
9581         * output.cc (Output_reloc): Add explicit instantiations.
9582
9583 2009-01-14  Cary Coutant  <ccoutant@google.com>
9584
9585         * archive.cc (Archive::get_elf_object_for_member): Remove call
9586         to File_read::claim_for_plugin.
9587         * descriptors.cc (Descriptors::open): Remove reference to
9588         is_claimed.
9589         (Descriptors::claim_for_plugin): Remove.
9590         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9591         (Descriptors::is_claimed): Remove.
9592         (claim_descriptor_for_plugin): Remove.
9593         * fileread.cc (File_read::claim_for_plugin): Remove.
9594         * fileread.h (File_read::claim_for_plugin): Remove.
9595         (File_read::descriptor): Reopen descriptor if necessary.
9596         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9597         (Plugin_manager::all_symbols_read): Add task parameter. Change
9598         all callers.
9599         (Plugin_manager::get_input_file): New function.
9600         (Plugin_manager::release_input_file): New function.
9601         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9602         corresponding data member.
9603         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9604         and pass to base constructor. Change all callers.
9605         (get_input_file, release_input_file): New functions.
9606         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9607         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9608         (Plugin_manager::all_symbols_read): Add task parameter.
9609         (Plugin_manager::get_input_file): New function.
9610         (Plugin_manager::release_input_file): New function.
9611         (Plugin_manager::task_): New data member.
9612         (Pluginobj::Pluginobj): Add filesize parameter.
9613         (Pluginobj::filename): New function.
9614         (Pluginobj::descriptor): New function.
9615         (Pluginobj::filesize): New function.
9616         (Pluginobj::filesize_): New data member.
9617         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9618         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9619         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9620
9621         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9622         with archive libraries.
9623         * testsuite/Makefile.in: Regenerate.
9624         * testsuite/plugin_test.c (struct sym_info): New type.
9625         (get_input_file, release_input_file): New static variables.
9626         (onload): Capture new transfer vector entries.
9627         (claim_file_hook): Stop reading at end of file according to filesize.
9628         Factor out parsing of readelf output into separate function.
9629         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9630         APIs and get the source file name from the symbol table.  Convert
9631         source file name to corresponding object file name.  Print info
9632         message when adding new input files.
9633         (parse_readelf_line): New function.
9634         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9635         * testsuite/plugin_test_2.sh: Likewise.
9636         * testsuite/plugin_test_3.sh: Likewise.
9637         * testsuite/plugin_test_4.sh: New test case.
9638
9639 2009-01-07  Ian Lance Taylor  <iant@google.com>
9640
9641         * version.cc (version_string): Bump to 1.8.
9642
9643 2008-12-23  Cary Coutant  <ccoutant@google.com>
9644
9645         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9646         * plugin.cc (Plugin_manager::finish): Rename as
9647         layout_deferred_objects.  Move cleanup to separate function.
9648         (Plugin_manager::cleanup): New function.
9649         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9650         separately.
9651         * plugin.h (Plugin_manager::finish): Rename as
9652         layout_deferred_objects.
9653         (Plugin_manager::cleanup): New function.
9654         (Plugin_manager::cleanup_done): New field.
9655
9656 2008-12-23  Cary Coutant  <ccoutant@google.com>
9657
9658         * plugin.cc (is_visible_from_outside): New function.
9659         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9660         so we don't return "IR only" status for exported symbols or -r links.
9661
9662         * testsuite/Makefile.am (plugin_test_3): New test case.
9663         * testsuite/Makefile.in: Regenerate.
9664         * testsuite/plugin_test_3.sh: New file.
9665
9666 2008-12-22  Cary Coutant  <ccoutant@google.com>
9667
9668         * object.cc (Sized_relobj::layout_section): New function.
9669         (Sized_relobj::do_layout): Defer layout of input sections until after
9670         plugin has provided replacement files.
9671         (Sized_relobj::do_layout_deferred_sections): New function.
9672         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9673         (Relobj::layout_deferred_sections): New function.
9674         (Relobj::do_layout_deferred_sections): New function.
9675         (Sized_relobj::do_layout_deferred_sections): New function.
9676         (Sized_relobj::layout_section): New function.
9677         (Sized_relobj::Deferred_layout): New structure.
9678         (Sized_relobj::deferred_layout_): New field.
9679         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9680         Change all callers.  Layout deferred sections.
9681         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9682         references.
9683         (Plugin_hook::run): Move code from do_plugin_hook inline.
9684         (Plugin_hook::do_plugin_hook): Remove.
9685         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9686         (Plugin_manager::finish): Renamed, was cleanup.
9687         (Plugin_manager::should_defer_layout): New function.
9688         (Plugin_manager::add_deferred_layout_object): New function.
9689         (Plugin_manager::Deferred_layout_list): New type.
9690         (Plugin_manager::deferred_layout_objects_): New field.
9691         (Plugin_hook::do_plugin_hook): Remove.
9692
9693 2008-12-17  Ian Lance Taylor  <iant@google.com>
9694
9695         * options.h (class General_options): Add --no case for
9696         --export-dynamic.
9697
9698 2008-12-16  Cary Coutant  <ccoutant@google.com>
9699
9700         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9701         vector.
9702         (Plugin_manager::claim_file): Create plugin object even if
9703         plugin did not call the add_symbols callback.
9704         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9705         asking for more symbols than were added.
9706         * testsuite/Makefile.am (plugin_test_1): Add test case with
9707         no global symbols.
9708         (empty.syms): New target.
9709         * testsuite/Makefile.in: Regenerate.
9710         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9711         message. Don't call add_symbols if no globals.
9712         (all_symbols_read_hook): Don't provide replacement for empty
9713         claimed file.
9714
9715 2008-12-12  Ian Lance Taylor  <iant@google.com>
9716
9717         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9718         r_type == 0 for a local symbol with r_sym == 0.
9719         (scan_relocatable_relocs): Pass r_sym to
9720         local_non_section_strategy.
9721         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9722         r_sym parameter.
9723
9724         * configure.ac: Update test for TLS descriptors: they are
9725         supported as of glibc 2.9.
9726         * configure: Rebuild.
9727
9728 2008-12-11  Ian Lance Taylor  <iant@google.com>
9729
9730         PR 7091
9731         * target-reloc.h (Default_scan_relocatable_relocs): For each
9732         function, map r_type == 0 to RELOC_DISCARD.
9733
9734 2008-12-10  Cary Coutant  <ccoutant@google.com>
9735
9736         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9737         object to override a kept COMDAT group from a plugin object.
9738
9739 2008-12-09  Ian Lance Taylor  <iant@google.com>
9740
9741         PR 7088
9742         * yyscript.y (file_cmd): Handle INPUT.
9743
9744         * testsuite/initpri1.c: Change all declarations to be full
9745         prototypes by adding void, to avoid compiler warnings.
9746
9747 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9748
9749         * options.cc (General_options::parse_plugin_opt): New.
9750         (General_options::add_plugin): The argument now is just the filename.
9751         (General_options::add_plugin_option): New.
9752         * options.h (plugin_opt): New.
9753         (add_plugin): Change argument name.
9754         (add_plugin_option): New.
9755         * plugin.cc (Plugin::load): Don't parse the plugin option.
9756         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9757         (Plugin::add_option): New.
9758         (Plugin::args_): Change type.
9759         (Plugin::filename_): New.
9760         (Plugin_manager::add_plugin_option): New.
9761         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9762         * testsuite/Makefile.in: Regenerate.
9763
9764 2008-12-05  Cary Coutant  <ccoutant@google.com>
9765
9766         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9767         Handle --strip-lto-sections option.
9768         * options.h (strip_lto_sections): New option.
9769
9770 2008-12-01  Cary Coutant  <ccoutant@google.com>
9771
9772         * plugin.cc (ld_plugin_message): Change format parameter to const.
9773         Fix mismatch between new[] and delete.
9774
9775 2008-11-14  Cary Coutant  <ccoutant@google.com>
9776
9777         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9778         instead of -1U.
9779
9780 2008-11-05  Craig Silverstein  <csilvers@google.com>
9781
9782         * options.cc (General_options::parse_dynamic_list): New function.
9783         * options.h (General_options): New flags dynamic_list,
9784         dynamic_list_data, dynamic_list_cpp_new, and
9785         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9786         (General_options::in_dynamic_list): New function.
9787         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9788         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9789         (Lex::can_continue_name): Likewise.
9790         (yylex): Likewise.
9791         (read_script_file): New parameter script_options.
9792         (read_dynamic_list): New function.
9793         (Script_options::define_dynamic_list): New function.
9794         (dynamic_list_keyword_parsecodes): New variable.
9795         (dynamic_list_keywords): New variable.
9796         * script.h (Script_options::define_dynamic_list): New function
9797         prototype.
9798         (read_dynamic_list): New function prototype.
9799         * symtab.cc (strprefix): New macro.
9800         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9801         dynamic_list_data, dynamic_list_cpp_new, and
9802         dynamic_list_cpp_typeinfo.
9803         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9804         (dynamic_list_expr): New rule.
9805         (dynamic_list_nodes): Likewise.
9806         (dynamic_list_node): Likewise.
9807         * testsuite/Makefile.am (dynamic_list): New test.
9808         * testsuite/Makefile.in: Regenerated.
9809         * testsuite/dynamic_list.t: New file.
9810         * testsuite/dynamic_list.sh: New file.
9811
9812 2008-11-05  Craig Silverstein  <csilvers@google.com>
9813
9814         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9815         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9816         (t11_last): Likewise.
9817         * testsuite/ver_test_6.c (main): Likewise.
9818
9819 2008-10-07  Cary Coutant  <ccoutant@google.com>
9820
9821         * options.c (General_options::finalize): Add check for -static and
9822         -shared.
9823         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9824         is not empty.
9825
9826 2008-10-02  Cary Coutant  <ccoutant@google.com>
9827
9828         * plugin.cc (make_sized_plugin_object): Fix conditional
9829         compilation to work when not all targets are enabled.
9830
9831 2008-09-29  Cary Coutant  <ccoutant@google.com>
9832
9833         * archive.cc (Archive::get_file_and_offset): Use filename instead
9834         of name to get library path.
9835         (Archive::include_member): Unlock external member of a thin archive.
9836
9837         * testsuite/Makefile.am (TEST_AR): New variable.
9838         (thin_archive_test_1): New test.
9839         (thin_archive_test_2): New test.
9840         * testsuite/Makefile.in: Regenerate.
9841         * testsuite/thin_archive_main.cc: New file.
9842         * testsuite/thin_archive_test_1.cc: New file.
9843         * testsuite/thin_archive_test_2.cc: New file.
9844         * testsuite/thin_archive_test_3.cc: New file.
9845         * testsuite/thin_archive_test_4.cc: New file.
9846
9847 2008-09-29  Cary Coutant  <ccoutant@google.com>
9848
9849         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9850         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9851         instead of -1U.
9852         (Sized_relobj::do_finalize_local_symbols): Likewise.
9853         (Sized_relobj::map_to_kept_section): Likewise.
9854         * object.h (Sized_relobj::invalid_address): New constant.
9855         (Sized_relobj::do_output_section_offset): Check for invalid_address
9856         and return -1ULL.
9857         * output.cc (Output_reloc::local_section_offset): Use constant
9858         invalid_address instead of -1U.
9859         (Output_reloc::get_address): Likewise.
9860         (Output_section::output_address): Change -1U to -1ULL.
9861         * output.h (Output_reloc::invalid_address): New constant.
9862         * reloc.cc (Sized_relobj::write_sections): Use constant
9863         invalid_address instead of -1U.
9864         (Sized_relobj::relocate_sections): Likewise.
9865         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9866         values for merge sections.
9867         * target-reloc.h (relocate_for_relocatable): Use constant
9868         invalid_address instead of -1U.
9869
9870 2008-09-19  Cary Coutant  <ccoutant@google.com>
9871
9872         Add plugin functionality for link-time optimization (LTO).
9873         * configure.ac (plugins): Add --enable-plugins option.
9874         * configure: Regenerate.
9875         * config.in: Regenerate.
9876         * Makefile.am (LIBDL): New variable.
9877         (CCFILES): Add plugin.cc.
9878         (HFILES): Add plugin.h.
9879         (ldadd_var): Add LIBDL.
9880         * Makefile.in: Regenerate.
9881
9882         * archive.cc: Include "plugin.h".
9883         (Archive::setup): Don't preread archive symbols when using a plugin.
9884         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9885         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9886         files.
9887         (Archive::include_member): Add symbols from plugin objects.
9888         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9889         * descriptors.cc (Descriptors::open): Check for file descriptors
9890         abandoned by plugins.
9891         (Descriptors::claim_for_plugin): New function.
9892         * descriptors.h (Descriptors::claim_for_plugin): New function.
9893         (Open_descriptor::is_claimed): New field.
9894         (claim_descriptor_for_plugin): New function.
9895         * fileread.cc (File_read::claim_for_plugin): New function.
9896         * fileread.h (File_read::claim_for_plugin): New function.
9897         (File_read::descriptor): New function.
9898         * gold.cc: Include "plugin.h".
9899         (queue_initial_tasks): Add task to call plugin hooks for generating
9900         new object files.
9901         * main.cc: Include "plugin.h".
9902         (main): Load plugin libraries.
9903         * object.h (Pluginobj): Declare.
9904         (Object::pluginobj): New function.
9905         (Object::do_pluginobj): New function.
9906         (Object::set_target): New function.
9907         * options.cc: Include "plugin.h".
9908         (General_options::parse_plugin): New function.
9909         (General_options::General_options): Initialize plugins_ field.
9910         (General_options::add_plugin): New function.
9911         * options.h (Plugin_manager): Declare.
9912         (General_options): Add --plugin option.
9913         (General_options::has_plugins): New function.
9914         (General_options::plugins): New function.
9915         (General_options::add_plugin): New function.
9916         (General_options::plugins_): New field.
9917         * plugin.cc: New file.
9918         * plugin.h: New file.
9919         * readsyms.cc: Include "plugin.h".
9920         (Read_symbols::do_read_symbols): Check for archive before checking
9921         for ELF file.  Call plugin hooks to claim files.
9922         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9923         from a real object file; force override when processing replacement
9924         files.
9925         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9926         (Symbol::init_base_object): Likewise.
9927         (Symbol::init_base_output_data): Likewise.
9928         (Symbol::init_base_output_segment): Likewise.
9929         (Symbol::init_base_constant): Likewise.
9930         (Symbol::init_base_undefined): Likewise.
9931         (Symbol::output_section): Assert that object is not a plugin.
9932         (Symbol_table::add_from_pluginobj): New function.
9933         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9934         undefined.
9935         (Symbol_table::sized_write_globals): Likewise.
9936         (Symbol_table::add_from_pluginobj): Instantiate template.
9937         * symtab.h (Sized_pluginobj): Declare.
9938         (Symbol::in_real_elf): New function.
9939         (Symbol::set_in_real_elf): New function.
9940         (Symbol::in_real_elf_): New field.
9941         (Symbol_table::add_from_pluginobj): New function.
9942
9943         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9944         (LIBDL): New variable.
9945         (LDADD): Add LIBDL.
9946         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9947         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9948         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9949         (MOSTLYCLEANFILES): Likewise.
9950         * testsuite/Makefile.in: Regenerate.
9951         * testsuite/plugin_test.c: New file.
9952         * testsuite/plugin_test_1.sh: New file.
9953         * testsuite/plugin_test_2.sh: New file.
9954
9955 2008-09-16  Ian Lance Taylor  <iant@google.com>
9956
9957         * target-reloc.h (relocate_section): Check whether a symbol is
9958         defined by the ABI before reporting an undefined symbol error.
9959         * target.h (Target::is_defined_by_abi): Make parameter const.
9960         (Target::do_is_defined_by_abi): Likewise.
9961         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9962         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9963         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9964         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9965         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9966         * testsuite/Makefile.in: Rebuild.
9967
9968         * fileread.cc (make_view): Add casts to avoid warning.
9969
9970 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9971
9972         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9973         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9974
9975 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9976
9977         * options.h (General_options::output_is_executable): New.
9978         (General_options::output_is_pie): New.
9979         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9980         for shared libraries.
9981         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9982
9983 2008-09-11  Chris Demetriou  <cgd@google.com>
9984
9985         * options.h (origin): New -z option.
9986         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9987         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9988         in DT_FLAGS_1.
9989
9990 2008-09-05  Cary Coutant  <ccoutant@google.com>
9991
9992         * fileread.cc (File_read::make_view): Add check for attempt to map
9993         beyond end of file.
9994
9995 2008-09-05  Cary Coutant  <ccoutant@google.com>
9996
9997         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9998         explicit instantiations.
9999
10000 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10001
10002         PR gold/6858
10003         * options.cc (General_options::finalize): Allow undefined symbols
10004         in shlibs if linking -shared.
10005
10006         PR gold/6859
10007         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10008         symbols as not needing a dynsym entry.
10009
10010 2008-08-20  Craig Silverstein  <csilvers@google.com>
10011
10012         * fileread.cc (File_read::open): Do not lock the file unless it
10013         was successfully opened.
10014
10015 2008-08-14  Cary Coutant  <ccoutant@google.com>
10016
10017         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10018         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10019         * testsuite/tls_test.cc (struct int128): 128-bit struct
10020         for testing TLS relocs with non-zero addend.
10021         (v12): New TLS variable.
10022         (t12): New test.
10023         (t_last): Add check for v12.
10024         * testsuite/tls_test.h (t12): New function.
10025         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10026
10027 2008-08-13  Ian Lance Taylor  <iant@google.com>
10028
10029         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10030         set tls_segment_ or relro_segment_.
10031         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10032         when appropriate.
10033         * output.h (Output_section::clear_is_relro): New function.
10034         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10035         sections specially even when output_data_ is empty.
10036         (Output_segment::maximum_alignment): When first section is relro,
10037         only force alignment for PT_LOAD segments.
10038         * script.cc (script_data_segment_align): New function.
10039         (script_data_segment_relro_end): New function.
10040         * script-c.h (script_data_segment_align): Declare.
10041         (script_data_segment_relro_end): Declare.
10042         * script-sections.h (class Script_sections): Declare
10043         data_segment_align and data_segment_relro_end.  Add fields
10044         segment_align_index_ and saw_relro_end_.
10045         * script-sections.cc (class Sections_element): Add set_is_relro
10046         virtual function.  Add new bool* parameter to place_orphan_here.
10047         Add get_output_section virtual function.
10048         (class Output_section_definition): Add set_is_relro.  Add new
10049         bool* parameter to place_orphan_here.  Add get_output_section.
10050         Add is_relro_ field.
10051         (Output_section_definition::Output_section_definition): Initialize
10052         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10053         and is_relro_ fields.
10054         (Output_section_definition::place_orphan_here): Add is_relro
10055         parameter.
10056         (Output_section_definition::set_section_addresses): Set relro for
10057         output section.
10058         (Output_section_definition::alternate_constraint): Likewise.
10059         (class Orphan_output_section): Add new bool* parameter to
10060         place_orphan_here.  Add get_output_section.
10061         (Orphan_output_section::place_orphan_here): Add is_relro
10062         parameter.
10063         (Script_sections::Script_sections): Initialize
10064         data_segment_align_index_ and saw_relro_end_.
10065         (Script_sections::data_segment_align): New function.
10066         (Script_sections::data_segment_relro_end): New function.
10067         (Script_sections::place_orphan): Set or clear is_relro.
10068         (Script_sections::set_section_addresses): Force alignment of first
10069         TLS section.
10070         * yyscript.y (exp): Call script_data_segment_align and
10071         script_data_segment_relro_end.
10072         * testsuite/relro_script_test.t: New file.
10073         * testsuite/relro_test.cc (using_script): Declare.
10074         (t1, t2): Test using_script.
10075         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10076         (relro_script_test_SOURCES): Define.
10077         (relro_script_test_DEPENDENCIES): Define.
10078         (relro_script_test_LDFLAGS): Define.
10079         (relro_script_test_LDADD): Define.
10080         (relro_script_test.so): New target.
10081         * testsuite/Makefile.in: Rebuild.
10082
10083 2008-08-06  Cary Coutant <ccoutant@google.com>
10084
10085         * archive.cc (Archive::total_archives, Archive::total_members)
10086         (Archive::total_members_loaded): New variables.
10087         (Archive::setup): Add parameter.  Add option to preread
10088         archive symbols.
10089         (Archive::read_armap): Add counter.
10090         (Archive::get_file_and_offset): New function.
10091         (Archive::get_elf_object_for_member): New function.
10092         (Archive::read_all_symbols): New function.
10093         (Archive::read_symbols): New function.
10094         (Archive::add_symbols): Add counters.
10095         (Archive::include_all_members): Use armap to find members if it's
10096         already built.
10097         (Archive::include_member): Skip reading symbols if already read.
10098         Factored code into Archive::get_file_and_offset and
10099         Archive::get_elf_object_for_member.  Changed call to
10100         Mapfile::report_include_archive_member.
10101         (Archive::print_stats): New function.
10102         * archive.h: Declare Object and Read_symbols_data classes.
10103         (Archive::Archive): Add initializers for new members.
10104         (Archive::setup): Add parameter.
10105         (Archive::print_stats): New function.
10106         (Archive::total_archives, Archive::total_members)
10107         (Archive::total_members_loaded): New variables.
10108         (Archive::get_file_and_offset): New function.
10109         (Archive::get_elf_object_for_member): New function.
10110         (Archive::read_all_symbols): New function.
10111         (Archive::read_symbols): New function.
10112         (Archive::Archive_member): New class.
10113         (Archive::members_): New member.
10114         (Archive::num_members_): New member.
10115         * main.cc: Include archive.h.
10116         (main): Call Archive::print_stats.
10117         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10118         archive parameter; member_name is now the fully-decorated name.
10119         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10120         * options.h: (General_options): Add --preread-archive-symbols option.
10121         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10122         Archive::setup.
10123
10124 2008-08-04  Ian Lance Taylor  <iant@google.com>
10125
10126         * symtab.h (Symbol::use_plt_offset): New function.
10127         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10128         * powerpc.cc (Relocate::relocate): Likewise.
10129         * sparc.cc (Relocate::relocate): Likewise.
10130         * x86_64.cc (Relocate::relocate): Likewise.
10131         * testsuite/weak_plt.sh: New test.
10132         * testsuite/weak_plt_main.cc: New test.
10133         * testsuite/weak_plt_shared.cc: New test.
10134         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10135         (check_PROGRAMS): Add weak_plt.
10136         (check_DATA): Add weak_plt_shared.so.
10137         (weak_plt_main_pic.o, weak_plt): New targets.
10138         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10139         * testsuite/Makefile.in: Rebuild.
10140
10141         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10142         gcctestdir/ld.
10143         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10144         * testsuite/Makefile.in: Rebuild.
10145
10146 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10147
10148         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10149         * Makefile.in: Regenerate.
10150         * po/POTFILES.in: Regenerate.
10151
10152 2008-07-29  Ian Lance Taylor  <iant@google.com>
10153
10154         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10155         symbols before other symbols.
10156         * testsuite/script_test_2.cc (test_addr): Declare.
10157         (test_addr_alias): Declare.
10158         (main): Check that test_addr and test_addr_alias have the right
10159         values.
10160         * testsuite/script_test_2.t: Define test_addr_alias and
10161         test_addr.
10162
10163 2008-07-24  Ian Lance Taylor  <iant@google.com>
10164
10165         PR 5990
10166         * descriptors.cc: New file.
10167         * descriptors.h: New file.
10168         * gold-threads.h (class Hold_optional_lock): New class.
10169         * fileread.cc: Include "descriptors.h".
10170         (File_read::~File_read): Release descriptor rather than closing
10171         it.
10172         (File_read::open) [file]: Call open_descriptor rather than open.
10173         Set is_descriptor_opened_.
10174         (File_read::open) [memory]: Assert that descriptor is not open.
10175         (File_read::reopen_descriptor): New function.
10176         (File_read::release): Release descriptor.
10177         (File_read::do_read): Make non-const.  Reopen descriptor.
10178         (File_read::read): Make non-const.
10179         (File_read::make_view): Reopen descriptor.
10180         (File_read::do_readv): Likewise.
10181         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10182         Update declarations.
10183         * layout.cc: Include "descriptors.h".
10184         (Layout::create_build_id): Use open_descriptor rather than open.
10185         * output.cc: Include "descriptors.h".
10186         (Output_file::open): Use open_descriptor rather than open.
10187         * archive.cc (Archive::const_iterator): Change Archive to be
10188         non-const.
10189         (Archive::begin, Archive::end): Make non-const.
10190         (Archive::count_members): Likewise.
10191         * archive.h (class Archive): Update declarations.
10192         * object.h (Object::read): Make non-const.
10193         * Makefile.am (CCFILES): Add descriptors.cc.
10194         (HFILES): Add descriptors.h.
10195         * Makefile.in: Rebuild.
10196
10197         PR 6716
10198         * gold.h: Always include <clocale>.  Add Solaris workarounds
10199         following code in binutils/sysdep.h.
10200
10201         PR 6048
10202         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10203         this->eh_frame_hdr_ is NULL before using it.
10204
10205         * dynobj.cc (Versions::Versions): Update comment.
10206
10207         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10208         the base version name.
10209
10210         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10211         array size plus one.
10212         (Stringpool_template::set_string_offsets): Subtract one from key
10213         before using it as an array index.
10214         (Stringpool_template::get_offset_with_length): Likewise.
10215         (Stringpool_template::write_to_buffer): Likewise.
10216         * stringpool.h (Stringpool_template::get_offset_from_key):
10217         Likewise.
10218
10219 2008-07-23  Ian Lance Taylor  <iant@google.com>
10220
10221         PR 6658
10222         * object.h (Merged_symbol_value::value): Do our best to handle a
10223         negative addend.
10224
10225         PR 6647
10226         * script.cc (Version_script_info::get_versions): Don't add empty
10227         version tag to return value.
10228         (Version_script_info::get_symbol_version_helper): Change return
10229         type to bool.  Add pversion parameter.  Change all callers.
10230         (script_register_vers_node): Don't require a non-NULL tag.
10231         * script.h (class Version_script_info): Update declarations.
10232         (Version_script_info::get_symbol_version): Change return type to
10233         bool.  Add version parameter.  Change all callers.
10234         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10235         handling.  Handle an empty version from a version script.
10236         (Symbol_table::define_special_symbol): Likewise.
10237         * testsuite/ver_test_10.script: New file.
10238         * testsuite/ver_test_10.sh: New file.
10239         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10240         (check_DATA): Add ver_test_10.syms.
10241         (ver_test_10.syms, ver_test_10.so): New target.
10242         * testsuite/Makefile.in: Rebuild.
10243
10244 2008-07-23  Simon Baldwin  <simonb@google.com>
10245
10246         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10247         to zero for undefined symbols from dynamic libraries.
10248
10249 2008-07-23  Ian Lance Taylor  <iant@google.com>
10250
10251         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10252         Change all callers.
10253         * symtab.h (class Symbol_table): Update declaration.
10254         * testsuite/ver_test_9.cc: New file.
10255         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10256         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10257         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10258         (ver_test_9.so, ver_test_9.o): New targets.
10259         * testsuite/Makefile.in: Rebuild.
10260
10261 2008-07-22  Ian Lance Taylor  <iant@google.com>
10262
10263         * options.h (class General_options): Define --check-sections.
10264         * layout.cc (Layout::set_segment_offsets): Handle
10265         --check-sections.
10266
10267         * options.h (class General_options): Define -n/--nmagic and
10268         -N/--omagic.
10269         * options.cc (General_options::finalize): For -n/--nmagic or
10270         -N/--omagic, set -static.
10271         * layout.cc (Layout::attach_allocated_section_to_segment): If
10272         -N/--omagic, don't put read-only and read-write sections in
10273         different segments.
10274         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10275         finding a read-only segment.
10276         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10277         don't set the minimum segment alignment to the common page size,
10278         and don't set the file offset to the address modulo the page size.
10279         * script-sections.cc (Script_sections::create_segments): If
10280         -n/--omagic, don't put read-only and read-write sections in
10281         different segments.
10282
10283         * cref.cc: New file.
10284         * cref.h: New file.
10285         * options.h (class General_options): Add --print-symbol-counts.
10286         * main.cc (main): Issue defined symbol report if requested.
10287         * archive.cc (Archive::interpret_header): Make into a const member
10288         function.
10289         (Archive::add_symbols): Call Input_objects::archive_start and
10290         archive_stop.
10291         (Archive::const_iterator): Define new class.
10292         (Archive::begin, Archive::end): New functions.
10293         (Archive::include_all_members): Rewrite to use iterator.
10294         (Archive::count_members): New function.
10295         * archive.h (class Archive): Update declarations.
10296         (Archive::filename): New function.
10297         * object.cc: Include "cref.h".
10298         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10299         (Sized_relobj::do_get_global_symbol_counts): New function.
10300         (Input_objects::add_object): Add object to cross-referencer.
10301         (Input_objects::archive_start): New function.
10302         (Input_objects::archive_stop): New function.
10303         (Input_objects::print_symbol_counts): New function.
10304         * object.h: Declare Cref and Archive.
10305         (Object::get_global_symbol_counts): New function.
10306         (Object::do_get_global_symbol_counts): New pure virtual function.
10307         (class Sized_relobj): Add defined_count_ field.  Update
10308         declarations.
10309         (class Input_objects): Add cref_ field.  Update constructor.
10310         Update declarations.
10311         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10312         defined_count_.
10313         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10314         symbol counts.
10315         (Sized_dynobj::do_get_global_symbol_counts): New function.
10316         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10317         defined_count_.  Update declarations.  Define Symbols typedef.
10318         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10319         parameter.  Change all callers.
10320         (Symbol_table::add_from_dynobj): Add sympointers and defined
10321         parameters.  Change all callers.
10322         * symtab.h (class Symbol_table): Update declarations.
10323         * Makefile.am (CCFILES): Add cref.cc.
10324         (HFILES): Add cref.h.
10325         * Makefile.in: Rebuild.
10326
10327 2008-07-22  Simon Baldwin  <simonb@google.com>
10328
10329         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10330         to zero when writing undefined symbols.
10331
10332 2008-07-22  Ian Lance Taylor  <iant@google.com>
10333
10334         * output.cc (Output_section::add_input_section): Don't try to
10335         merge empty merge sections.
10336
10337 2008-07-21  Craig Silverstein  <csilvers@google.com>
10338
10339         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10340         Include symbol version in error message.
10341
10342 2008-07-20  Chris Demetriou  <cgd@google.com>
10343
10344         * configure.ac (gold_cv_c_random_seed): New configured variable.
10345         (RANDOM_SEED_CFLAGS): New substituted variable.
10346         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10347         * configure: Rebuild.
10348         * Makefile.in: Likewise.
10349         * testsuite/Makefile.in: Likewise.
10350
10351 2008-07-18  Ian Lance Taylor  <iant@google.com>
10352
10353         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10354         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10355         * testsuite/ver_test_main.cc (main): Call t4.
10356         (t4, t4_2a): Define.
10357         * testsuite/ver_test_2.cc (t4_2): Define.
10358         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10359         * testsuite/ver_test_4.cc (t4_2a): Define.
10360         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10361         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10362
10363 2008-07-17  Ian Lance Taylor  <iant@google.com>
10364
10365         * dynobj.cc (Versions::add_def): If we give an error about a
10366         missing version, go ahead and create the version anyhow.
10367
10368 2008-07-10  Ian Lance Taylor  <iant@google.com>
10369
10370         Handle output sections with more than 0x7fffffff bytes.
10371         * object.h (class Relobj): Change map_to_output_ to
10372         output_sections_, and just keep a section pointer.  Change all
10373         uses.  Move comdat group support to Sized_relobj.
10374         (Relobj::is_section_specially_mapped): Remove.
10375         (Relobj::output_section): Remove poff parameter.  Change all
10376         callers.
10377         (Relobj::output_section_offset): New function.
10378         (Relobj::set_section_offset): Rewrite.
10379         (Relobj::map_to_output): Remove.
10380         (Relobj::output_sections): New function.
10381         (Relobj::do_output_section_offset): New pure virtual function.
10382         (Relobj::do_set_section_offset): Likewise.
10383         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10384         group support from Relobj.  Update declarations.
10385         (Sized_relobj::get_output_section_offset): New function.
10386         (Sized_relobj::do_output_section_offset): New function.
10387         (Sized_relobj::do_set_section_offset): New function.
10388         * object.cc (Relobj::output_section_address): Remove.
10389         (Sized_relobj::Sized_relobj): Initialize new fields.
10390         (Sized_relobj::include_section_group): Cast find_kept_object to
10391         Sized_relobj.
10392         (Sized_relobj::include_linkonce_section): Likewise.
10393         (Sized_relobj::do_layout): Use separate arrays for output section
10394         and output offset.
10395         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10396         output_sections.
10397         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10398         output_sections and section_offsets.
10399         (Sized_relobj::write_local_symbols): Likewise.
10400         (map_to_kept_section): Compute output address directly.
10401         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10402         output_sections and section_offsets.
10403         (Sized_relobj::write_sections): Likewise.
10404         (Sized_relobj::relocate_sections): Likewise.
10405         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10406         * output.h (class Output_reloc): Update declarations.  Change
10407         u2_.relobj to Sized_relobj*.
10408         (class Output_data_reloc): Change add functions to use
10409         Sized_relobj*.
10410         * output.cc (Output_reloc::Output_reloc): Change relobj to
10411         Sized_relobj*.
10412         (Output_reloc::local_section_offset): Change return type to
10413         Elf_Addr.  Use get_output_section_offset.
10414         (Output_reloc::get_address): Likewise.
10415         (Output_section::is_input_address_mapped): Don't call
10416         is_section_specially_mapped.
10417         (Output_section::output_offset): Likewise.
10418         (Output_section::output_address): Likewise.
10419         (Output_section::starting_output_address): Likewise.
10420         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10421         parameter to Sized_relobj*.
10422         (Copy_relocs::need_copy_reloc): Likewise.
10423         (Copy_relocs::save): Likewise.
10424         * copy-relocs.h (class Copy_relocs): Update declarations.
10425         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10426         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10427         * target-reloc.h (relocate_for_relocatable): Change
10428         offset_in_output_section type to Elf_Addr.  Change code that uses
10429         it as well.
10430         * layout.cc (Layout::layout): Always set *off.
10431         * mapfile.cc (Mapfile::print_input_section): Use
10432         output_section_offset.
10433         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10434         Sized_relobj*.
10435         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10436         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10437         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10438
10439 2008-07-03  Ian Lance Taylor  <iant@google.com>
10440
10441         * layout.cc (Layout::include_section): Do not discard unrecognized
10442         SHT_STRTAB sections.
10443
10444 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10445
10446         * script.cc (Lex::can_continue_name): Make '?' allowable in
10447         version-script names.
10448         * testsuite/version_script.map: Change glob pattern to use '?'
10449
10450 2008-06-30  Manish Singh  <yosh@gimp.org>
10451
10452         PR 6585
10453         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10454         Correct typo.
10455
10456 2008-06-30  Ian Lance Taylor  <iant@google.com>
10457
10458         PR 6660
10459         PR 6682
10460         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10461         versions]: Don't try to read the value in the contents, since we
10462         don't use it.  Use the template endianness when writing.
10463
10464 2008-06-25  Cary Coutant  <ccoutant@google.com>
10465
10466         * fileread.cc (File_read::make_view): Assert on zero-length view.
10467         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10468         symbol table when there are no symbols to read.
10469
10470 2008-06-23  Craig Silverstein  <csilvers@google.com>
10471
10472         * version.cc (version_string): Bump to 1.7
10473
10474 2008-06-18  Craig Silverstein  <csilvers@google.com>
10475
10476         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10477         constant 0xFFFF to type Valtype.
10478         (Powerpc_relocate_functions::rel16_ha): Likewise.
10479
10480 2008-06-17  Ian Lance Taylor  <iant@google.com>
10481
10482         * output.h (Output_section::Input_section): Initialize p2align_ to
10483         zero for Output_section_data constructors.
10484         (Output_section::Input_section::addralign): If not an input
10485         section, return the alignment of the Output_section_data.
10486         * testsuite/copy_test.cc: New file.
10487         * testsuite/copy_test_1.cc: New file.
10488         * testsuite/copy_test_2.cc: New file.
10489         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10490         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10491         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10492         (copy_test_1_pic.o, copy_test_1.so): New targets.
10493         (copy_test_2_pic.o, copy_test_2.so): New targets.
10494         * testsuite/Makefile.in: Rebuild.
10495
10496         * script-sections.cc (Script_sections::place_orphan): Initialize
10497         local variable exact.
10498
10499 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10500
10501         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10502
10503 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10504             David S. Miller  <davem@davemloft.net>
10505
10506         * powerpc.cc: New file.
10507         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10508         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10509         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10510         * Makefile.in: Rebuild.
10511
10512 2008-06-09  Ian Lance Taylor  <iant@google.com>
10513
10514         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10515         <exception>.
10516         (throwing, orig_terminate): New static variables.
10517         (terminate_handler): New static function.
10518         (t2): Set terminate handler.
10519
10520 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10521
10522         PR 6584
10523         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10524         alignment.
10525
10526 2008-05-30  Cary Coutant  <ccoutant@google.com>
10527
10528         * archive.cc (Archive::include_all_members) Correct to step
10529         over symbol table and extended name table in thin archives.
10530
10531 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10532
10533         PR 6407
10534         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10535         calculation.
10536
10537 2008-05-28  Caleb Howe  <cshowe@google.com>
10538
10539         * reduced_debug_output.cc: New file.
10540         * reduced_debug_output.h: New file.
10541         * options.h (class General_options): Add --strip-debug-non-line.
10542         * options.cc (General_options::finalize): Add strip_debug_non_line
10543         to the strip heirarchy.
10544         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10545         fields.
10546         * layout.cc: Include "reduced_debug_output.h".
10547         (Layout::Layout): Initialize new fields.
10548         (line_only_debug_sections): New static array.
10549         (is_lines_only_debug_sections): New static inline function.
10550         (Layout::include_section): Handle --strip-debug-non-line.
10551         (Layout::make_output_section): If --strip-debug-non-line, build
10552         new output sections for .debug_abbrev and .debug_info.
10553         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10554         gold.  Warn about possible overflow.
10555         (read_signed_LEB_128): Likewise.
10556         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10557         (read_signed_LEB_128): Declare.
10558         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10559         (HFILES): Add reduced_debug_output.h.
10560         * Makefile.in: Rebuild.
10561
10562 2008-05-21  Ian Lance Taylor  <iant@google.com>
10563
10564         * mapfile.cc: New file.
10565         * mapfile.h: New file.
10566         * options.h (class General_options): Add -M/--print-map and -Map.
10567         * options.cc (General_options::finalize): Make -M equivalent to
10568         -Map -.
10569         * main.cc: Include <cstdio> and "mapfile.h".
10570         (main): Open mapfile if requested.
10571         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10572         constructor.  Change caller.
10573         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10574         (queue_middle_tasks): Likewise.
10575         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10576         declarations.
10577         * archive.cc: Include "mapfile.h".
10578         (Archive::add_symbols): Add mapfile parameter.  Change all
10579         callers.  Pass mapfile, symbol, and reason to include_member.
10580         (Archive::include_all_members): Add mapfile parameter.  Change all
10581         callers.
10582         (Archive::include_member): Add mapfile, sym, and why parameters.
10583         Change all callers.  Report inclusion to map file.
10584         * archive.h: Include "fileread.h".
10585         (class Archive): Update declarations.
10586         (Archive::file): New const method.
10587         (class Add_archive_symbols): Add mapfile_ field.  Update
10588         constructor.  Change all callers.
10589         * readsyms.h (class Read_symbols): Likewise.
10590         (class Finish_group): Likewise.
10591         (class Read_script): Likewise.
10592         * common.cc: Include "mapfile.h".
10593         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10594         all callers.
10595         (Symbol_table::do_allocate_commons): Likewise.
10596         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10597         symbol allocation to mapfile.
10598         * common.h (class Allocate_commons_task): Add mapfile_ field.
10599         Update constructor.  Change all callers.
10600         * symtab.h (class Symbol_table): Update declarations.
10601         * layout.cc: Include "mapfile.h".
10602         (Layout_task_runner::run): Print information to mapfile.
10603         (Layout::create_gold_note): Change Output_data_fixed_space to
10604         Output_data_zero_fill.
10605         (Layout::create_build_id): Likewise.
10606         (Layout::print_to_mapfile): New function.
10607         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10608         constructor.  Change caller.
10609         (class Layout): Declare print_to_mapfile.
10610         * output.cc (Output_section::Input_section::print_to_mapfile): New
10611         function.
10612         (Output_section::add_input_section): If producing a map, always
10613         add to input_sections_ list.
10614         (Output_section::do_print_to_mapfile): New function.
10615         (Output_segment::print_sections_to_mapfile): New function.
10616         (Output_segment::print_section_list_to_mapfile): New function.
10617         * output.h: Include "mapfile.h".
10618         (Output_data::print_to_mapfile): New function.
10619         (Output_data::do_print_to_mapfile): New virtual function.
10620         (Output_segment_headers::do_print_to_mapfile): New function.
10621         (Output_file_header::do_print_to_mapfile): New function.
10622         (Output_data_const::do_print_to_mapfile): New function.
10623         (class Output_data_const_buffer): Add map_name_ field.  Update
10624         constructor.  Change all callers.  Add do_print_to_mapfile
10625         function.
10626         (class Output_data_fixed_space): Likewise.
10627         (class Output_data_space): Likewise.
10628         (class Output_data_zero_fill): New class.
10629         (Output_data_strtab::do_print_to_mapfile): New function.
10630         (Output_data_reloc_base::do_print_to_mapfile): New function.
10631         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10632         (Output_data_group::do_print_to_mapfile): New function.
10633         (Output_data_got::do_print_to_mapfile): New function.
10634         (Output_data_dynamic::do_print_to_mapfile): New function.
10635         (Output_symtab_xindex::do_print_to_mapfile): New function.
10636         (class Output_section): Declare do_print_to_mapflie.  Declare
10637         print_to_mapfile in Input_section.
10638         (class Output_segment): Declare new functions.
10639         * object.h (Sized_relobj::symbol_count): New function.
10640         * script-sections.cc
10641         (Output_section_element_dot_assignment::set_section_addresses):
10642         Change Output_data_fixed_space to Output_data_zero_fill.
10643         (Output_data_expression::do_print_to_mapfile): New function.
10644         * script.cc (read_input_script): Add mapfile parameter.  Change
10645         all callers.
10646         * script.h (read_input_script): Update declaration.
10647         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10648         (Eh_frame::do_print_to_mapfile): New function.
10649         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10650         (Output_merge_string::do_print_to_mapfile): New function.
10651         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10652         function.
10653         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10654         function.
10655         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10656         function.
10657         * Makefile.am (CCFILES): Add mapfile.cc.
10658         (HFILES): Add mapfile.h.
10659         * Makefile.in: Rebuild.
10660
10661 2008-05-19  Ian Lance Taylor  <iant@google.com>
10662
10663         * options.h (class General_options): Add -z relro.
10664         * layout.cc (Layout::Layout): Initialize relro_segment_.
10665         (Layout::add_output_section_data): Return the output section.
10666         (Layout::make_output_section): Rcognize relro sections and mark
10667         them appropriately.
10668         (Layout::attach_allocated_section_to_segment): Put relro sections
10669         in a PT_GNU_RELRO segment.
10670         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10671         section as relro.
10672         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10673         PT_TLS segments.
10674         (Layout::linkonce_mapping): Map d.rel.ro.local to
10675         .data.rel.ro.local.
10676         (Layout::output_section_name): Us .data.rel.ro.local for any
10677         section which begins with that.
10678         * layout.h (class Layout): Update add_output_section_data
10679         declaration.  Add relro_segment_ field.
10680         * output.cc (Output_section::Output_section): Initialize is_relro_
10681         and is_relro_local_ fields.
10682         (Output_segment::add_output_section): Group relro sections.
10683         (Output_segment::is_first_section_relro): New function.
10684         (Output_segment::maximum_alignment): If there is a relro section,
10685         align the segment to the common page size.
10686         (Output_segment::set_section_addresses): Track whether we are
10687         looking at relro sections.  If the last section is a relro
10688         section, align to the common page size.
10689         (Output_segment::set_section_list_addresses): Add in_relro
10690         parameter.  Change all callers.  Align to the page size when
10691         moving from relro to non-relro section.
10692         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10693         segment.
10694         * output.h (class Output_section): Add is_relro_ and
10695         is_relro_local_ fields.
10696         (Output_section::is_relro): New function.
10697         (Output_section::set_is_relro): New function.
10698         (Output_section::is_relro_local): New function.
10699         (Output_section::set_is_relro_local): New function.
10700         (class Output_segment): Update declarations.
10701         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10702         * sparc.cc (Target_sparc::got_section): Likewise.
10703         * x86_64.cc (Target_x86_64::got_section): Likewise.
10704         * testsuite/relro_test_main.cc: New file.
10705         * testsuite/relro_test.cc: New file.
10706         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10707         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10708         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10709         (relro_test.so, relro_test_pic.o): New targets.
10710         * testsuite/Makefile.in: Rebuild.
10711
10712 2008-05-16  Ian Lance Taylor  <iant@google.com>
10713
10714         * output.cc (Output_segment::add_output_section): Remove front
10715         parameter.
10716         * output.h (class Output_segment): Remove
10717         add_initial_output_section and overloaded add_output_section.
10718         Update declaration of remaining add_output_section.
10719         * layout.cc (Layout::create_interp): Call add_output_section
10720         rather than add_initial_output_section.
10721         (Layout::finish_dynamic_section): Likewise.
10722
10723         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10724         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10725         know the dynamic type.
10726         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10727         field.  Initialize it in constructor.
10728         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10729         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10730         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10731         reloc.
10732
10733         * output.cc (Output_reloc::get_address): Change return type to
10734         Elf_Addr.
10735         * output.h (class Output_reloc): Update get_address declaration.
10736         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10737         for section addresses.
10738
10739 2008-05-09  Ian Lance Taylor  <iant@google.com>
10740
10741         PR 6493
10742         * gold.cc (gold_nomem): Use return value of write.
10743
10744 2008-05-08  Ian Lance Taylor  <iant@google.com>
10745
10746         * symtab.c (Symbol::init_base_output_data): Add version
10747         parameter.  Change all callers.
10748         (Symbol::init_base_output_segment): Likewise.
10749         (Symbol::init_base_constant): Likewise.
10750         (Symbol::init_base_undefined): Likewise.
10751         (Sized_symbol::init_output_data): Likewise.
10752         (Sized_symbol::init_output_segment): Likewise.
10753         (Sized_symbol::init_constant): Likewise.
10754         (Sized_symbol::init_undefined): Likewise.
10755         (Symbol_table::do_define_in_output_data): If the new symbol has a
10756         version, mark it as the default.
10757         (Symbol_table::do_define_in_output_segment): Likewise.
10758         (Symbol_table::do_define_as_constant): Likewise.
10759         * symtab.h (class Symbol): Update declarations.
10760         (class Sized_symbol): Likewise.
10761         * resolve.cc (Symbol::override_version): New function.
10762         (Symbol::override_base): Call override_version.
10763         (Symbol::override_base_with_special): Likewise.
10764         * testsuite/ver_script_8.script: New file.
10765         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10766         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10767         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10768         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10769
10770 2008-05-06  Ian Lance Taylor  <iant@google.com>
10771
10772         PR 6049
10773         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10774         functions.
10775         (class General_options): Remove existing --undefined, and add
10776         --no-undefined instead.  Add new --undefined as synonym for -u.
10777         * archive.cc (Archive::add_symbols): Check whether symbol was
10778         named with -u.
10779         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10780         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10781         all uses.  Add IS_UNDEFINED.  Update declarations to split
10782         different versions of init_base.  Declare init_base_undefined.
10783         (Symbol::is_defined): Handle IS_UNDEFINED.
10784         (Symbol::is_undefined): Likewise.
10785         (Symbol::is_weak_undefined): Call is_undefined.
10786         (Symbol::is_absolute): Handle IS_CONSTANT.
10787         (class Sized_symbol): Update declarations to split different
10788         versions of init.  Declare init_undefined.
10789         (class Symbol_table): Declare new functions.
10790         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10791         Change all callers.
10792         (Symbol::init_base_output_data): Likewise.
10793         (Symbol::init_base_output_segment): Likewise.
10794         (Symbol::init_base_constant): Likewise.
10795         (Symbol::init_base_undefined): New function.
10796         (Sized_symbol::init_object): Rename from init.  Change all
10797         callers.
10798         (Sized_symbol::init_output_data): Likewise.
10799         (Sized_symbol::init_output_segment): Likewise.
10800         (Sized_symbol::init_constant): Likewise.
10801         (Sized_symbol::init_undefined): New function.
10802         (Symbol_table::add_undefined_symbols_from_command_line): New
10803         function.
10804         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10805         function.
10806         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10807         (Symbol::output_section): Likewise.
10808         (Symbol::set_output_section): Likewise.
10809         (Symbol_table::sized_finalize_symbol): Likewise.
10810         (Symbol_table::sized_write_globals): Likewise.
10811         * resolve.cc (Symbol_table::should_override): Likewise.
10812         (Symbol::override_base_with_special): Likewise.
10813
10814         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10815         symbol, change it to have default visibility.
10816         * testsuite/protected_1.cc: New file.
10817         * testsuite/protected_2.cc: New file.
10818         * testsuite/protected_3.cc: New file.
10819         * testsuite/protected_main_1.cc: New file.
10820         * testsuite/protected_main_2.cc: New file.
10821         * testsuite/protected_main_3.cc: New file.
10822         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10823         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10824         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10825         (protected_1.so): New target.
10826         (protected_1_pic.o, protected_2_pic.o): New targets.
10827         (protected_3_pic.o): New target.
10828         (check_PROGRAMS): Add protected_2.
10829         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10830         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10831         * testsuite/Makefile.in: Rebuild.
10832
10833         * options.h (DEFINE_var): Add set_user_set_##varname__.
10834         (DEFINE_bool_alias): New macro.
10835         (class General_options): Define -Bstatic using DEFINE_bool_alias
10836         rather than DEFINE_special.  Add --undefined as an alias for -z
10837         defs.
10838         * options.cc (General_options::parse_Bstatic): Remove.
10839
10840         * options.h (class General_options): Add --fatal-warnings.
10841         * main.cc (main): Implement --fatal-warnings.
10842         * errors.h (Errors::warning_count): New function.
10843
10844         * options.h (class General_options): Add -Bsymbolic-functions.
10845         * symtab.h (Symbol::is_preemptible): Check for
10846         -Bsymbolic-functions.
10847
10848 2008-05-05  Ian Lance Taylor  <iant@google.com>
10849
10850         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10851         as noVARNAME rather than no-VARNAME.
10852         (class General_options): Add option -z combreloc.
10853         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10854         get_address.
10855         (Output_reloc::sort_before) [SHT_REL]: New function.
10856         (Output_reloc::sort_before) [SHT_RELA]: New function.
10857         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10858         Sort_relocs_comparison.
10859         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10860         parameter.  Change all callers.
10861         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10862         sort_relocs parameter.  Change all callers.
10863         * output.cc (Output_reloc::get_address): New function, broken out
10864         of write_rel.
10865         (Output_reloc::write_rel): Call it.
10866         (Output_reloc::compare): New function.
10867         (Output_data_reloc_base::do_write): Optionally sort relocs.
10868
10869         * configure.ac: If targ_extra_obj is set, link it in.
10870         * configure.tgt: Initialize all variables.
10871         (x86_64*): Set targ_extra_obj and targ_extra_size.
10872         * configure: Rebuild.
10873
10874         * object.cc (Sized_relobj::include_section_group): Adjust section
10875         indexes read from group data.  Build vector to pass to
10876         layout_group.
10877         * layout.cc (Layout::layout_group): Add flags and shndxes
10878         parameters.  Remove contents parameter.  Change caller.  Update
10879         explicit instantiations.
10880         * layout.h (class Layout): Update layout_group declaration.
10881         * output.cc (Output_data_group::Output_data_group): Add flags and
10882         input_shndxes parameters.  Remove contents parameter.  Change
10883         caller.
10884         (Output_data_group::do_write): Change input_sections_ to
10885         input_shndxes_.
10886         * output.h (class Output_data_group): Update constructor
10887         declaration.  Rename input_sections_ to input_shndxes_.
10888         * testsuite/many_sections_test.cc: Add template.
10889
10890 2008-04-30  Cary Coutant  <ccoutant@google.com>
10891
10892         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10893
10894         * layout.cc (Layout::include_section): Refactored check for debug
10895         info section.
10896         (Layout::add_comdat): Add new parameters.  Change type
10897         of signature parameter.  Add object and shndx to signatures table.
10898         (Layout::find_kept_object): New function.
10899         * layout.h: Include <cstring>.
10900         (Layout::is_debug_info_section): New function.
10901         (Layout::add_comdat): Add new parameters.
10902         (Layout::find_kept_object): New function.
10903         (Layout::Kept_section): New struct.
10904         (Layout::Signatures): Change type of map range.
10905         * object.cc (Relobj::output_section_address): New function.
10906         (Sized_relobj::include_section_group): Add new parameters.  Change
10907         calls to Layout::add_comdat.  Change to build table of kept comdat
10908         groups and table mapping discarded sections to kept sections.
10909         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10910         (Sized_relobj::do_layout): Change calls to include_section_group and
10911         include_linkonce_section.
10912         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10913         value to zero when section is discarded.
10914         (Sized_relobj::map_to_kept_section): New function.
10915         * object.h (Relobj::output_section_address): New function.
10916         (Relobj::Comdat_group): New type.
10917         (Relobj::find_comdat_group): New function.
10918         (Relobj::Comdat_group_table): New type.
10919         (Relobj::Kept_comdat_section): New type.
10920         (Relobj::Kept_comdat_section_table): New type.
10921         (Relobj::add_comdat_group): New function.
10922         (Relobj::set_kept_comdat_section): New function.
10923         (Relobj::get_kept_comdat_section): New function.
10924         (Relobj::comdat_groups_): New field.
10925         (Relobj::kept_comdat_sections_): New field.
10926         (Symbol_value::input_value): Update comment.
10927         (Sized_relobj::map_to_kept_section) New function.
10928         (Sized_relobj::include_linkonce_section): Add new parameter.
10929         * target-reloc.h (Comdat_behavior): New type.
10930         (get_comdat_behavior): New function.
10931         (relocate_section): Add code to map a discarded section to the
10932         corresponding kept section when applying a relocation.
10933
10934 2008-04-30  Craig Silverstein  <csilvers@google.com>
10935
10936         * dwarf_reader.cc (next_generation_count): New static var.
10937         (Addr2line_cache_entry): New struct.
10938         (addr2line_cache): New static var.
10939         (Dwarf_line_info::one_addr2line): Added caching.
10940         (Dwarf_line_info::clear_addr2line_cache): New function.
10941         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10942         cache-size parameter.
10943         (Dwarf_line_info::one_addr2line_cache): New function.
10944         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10945         new cache-size argument to one_addr2line(), and clear cache.
10946
10947 2008-04-28  Cary Coutant  <ccoutant@google.com>
10948
10949         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10950         R_386_PC8 relocations.
10951
10952 2008-04-23  Ian Lance Taylor  <iant@google.com>
10953
10954         * object.cc (Sized_relobj::include_section_group): Check for
10955         invalid section group.
10956
10957         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10958         header size.
10959
10960         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10961         than read for file header.
10962         * archive.cc (Archive::include_member): Likewise.
10963
10964 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10965
10966         * aclocal.m4: Regenerate.
10967         * configure: Regenerate.
10968
10969 2008-04-19  Ian Lance Taylor  <iant@google.com>
10970
10971         * version.cc (version_string): Bump to 1.6.
10972
10973         * testsuite/Makefile.am (many_sections_r_test): New target.
10974         (many_sections_r_test_SOURCES): Remove.
10975         (many_sections_r_test_DEPENDENCIES): Remove.
10976         (many_sections_r_test_LDFLAGS): Remove.
10977         (many_sections_r_test_LDADD): Remove.
10978
10979         * object.cc (Sized_relobj::do_add_symbols): Always pass
10980         local_symbol_count_ to add_from_relobj.
10981
10982         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10983         every thousand variables.
10984         * testsuite/Makefile.in: Rebuild.
10985
10986         * object.cc (Xindex::initialize_symtab_xindex): New function.
10987         (Xindex::read_symtab_xindex): New function.
10988         (Xindex::sym_xindex_to_shndx): New function.
10989         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10990         available.
10991         (Sized_relobj::do_initialize_xindex): New function.
10992         (Sized_relobj::do_read_symbols): Adjust section links.
10993         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10994         parameter.  Change all callers.
10995         (Sized_relobj::include_section_group): Adjust section links and
10996         symbol section indexes.
10997         (Sized_relobj::do_layout): Adjust section links.
10998         (Sized_relobj::do_count_local_symbols): Adjust section links and
10999         symbol section indexes.
11000         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11001         ordinary and special symbols.
11002         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11003         dynsym_xindex parameters.  Change all callers.  Adjust section
11004         links.  Use SHN_XINDEX when needed.
11005         (Sized_relobj::get_symbol_location_info): Adjust section links.
11006         Don't get fooled by special symbols.
11007         * object.h (class Xindex): Define.
11008         (class Object): Add xindex_ parameter.  Declare virtual functoin
11009         do_initialize_xindex.
11010         (Object::adjust_sym_shndx): New function.
11011         (Object::set_xindex): New protected function.
11012         (class Symbol_value): Add is_ordinary_shndx_ field.
11013         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11014         (Symbol_value::value): Assert ordinary section.
11015         (Symbol_value::initialize_input_to_output_map): Likewise.
11016         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11017         Change all callers.
11018         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11019         all callers.
11020         (class Sized_relobj): Update declarations.
11021         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11022         parameter.  Change all callers.
11023         (Sized_relobj::adjust_shndx): New function.
11024         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11025         field.
11026         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11027         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11028         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11029         (Sized_dynobj::read_dynsym_section): Adjust section links.
11030         (Sized_dynobj::read_dynamic): Likewise.
11031         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11032         section links.
11033         (Sized_dynobj::do_initialize_xindex): New function.
11034         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11035         do_initialize_xindex.
11036         (Sized_dynobj::adjust_shndx): New function.
11037         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11038         dynsym_xindex_ fields.
11039         (Layout::finalize): Add a call to set_section_indexes before
11040         creating the symtab sections.
11041         (Layout::set_section_indexes): Don't do anything if the section
11042         already has a section index.
11043         (Layout::create_symtab_sections): Add shnum parameter.  Change
11044         caller.  Create .symtab_shndx section if needed.
11045         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11046         caller.
11047         (Layout::allocated_output_section_count): New function.
11048         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11049         needed.
11050         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11051         fields.  Update declarations.
11052         (Layout::symtab_xindex): New function.
11053         (Layout::dynsym_xindex): New function.
11054         (class Write_symbols_task): Add layout_ field.
11055         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11056         Change caller.
11057         * output.cc (Output_section_headers::Output_section_headers): Add
11058         shstrtab_section parameter.  Change all callers.
11059         (Output_section_headers::do_sized_write): Store overflow values
11060         for section count and section string table section index in
11061         section header zero.
11062         (Output_file_header::do_sized_write): Check for overflow of
11063         section count and section string table section index.
11064         (Output_symtab_xindex::do_write): New function.
11065         (Output_symtab_xindex::endian_do_write): New function.
11066         * output.h (class Output_section_headers): Add shstrtab_section_.
11067         Update declarations.
11068         (class Output_symtab_xindex): Define.
11069         (Output_section::has_out_shndx): New function.
11070         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11071         field.
11072         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11073         Change all callers.
11074         (Sized_symbol::init): Likewise.
11075         (Symbol::output_section): Check for ordinary symbol.
11076         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11077         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11078         callers.
11079         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11080         Change all callers.  Simplify handling of symbols from sections
11081         not included in the link.
11082         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11083         distinction.
11084         (Weak_alias_sorter::operator()): Assert that symbols are
11085         ordinary.
11086         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11087         distinction.
11088         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11089         parameters.  Change all callers.
11090         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11091         symbol distinction.  Use SHN_XINDEX when needed.
11092         (Symbol_table::write_section_symbol): Add symtab_xindex
11093         parameter.  Change all callers.
11094         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11095         SHN_XINDEX when needed.
11096         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11097         declarations.
11098         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11099         (Symbol::is_defined): Check is_ordinary.
11100         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11101         (Symbol::is_absolute, Symbol::is_common): Likewise.
11102         (class Sized_symbol): Update declarations.
11103         (class Symbol_table): Update declarations.
11104         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11105         parameters.  Change all callers.
11106         (Sized_symbol::override): Likewise.
11107         (Symbol_table::override): Likewise.
11108         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11109         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11110         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11111         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11112         to be in an ordinary section.
11113         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11114         object and is_ordinary parameters.  Change all callers.
11115         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11116         Change all callers.  Don't add undefined or non-ordinary symbols
11117         to reloc_map_.
11118         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11119         Change all callers.
11120         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11121         declarations.
11122         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11123         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11124         (Sized_relobj::relocate_sections): Likewise.
11125         * target-reloc.h (scan_relocs): Adjust section symbol index.
11126         (scan_relocatable_relocs): Likewise.
11127         * i386.cc (Scan::local): Check for ordinary symbols.
11128         * sparc.cc (Scan::local): Likewise.
11129         * x86_64.cc (Scan::local): Likewise.
11130         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11131         to symbol_section_and_value.
11132         * testsuite/many_sections_test.cc: New file.
11133         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11134         (check_PROGRAMS): Add many_sections_test.
11135         (many_sections_test_SOURCES): Define.
11136         (many_sections_test_DEPENDENCIES): Define.
11137         (many_sections_test_LDFLAGS): Define.
11138         (BUILT_SOURCES): Add many_sections_define.h.
11139         (many_sections_define.h): New target.
11140         (BUILT_SOURCES): Add many_sections_check.h.
11141         (many_sections_check.h): New target.
11142         (check_PROGRAMS): Add many_sections_r_test.
11143         (many_sections_r_test_SOURCES): Define.
11144         (many_sections_r_test_DEPENDENCIES): Define.
11145         (many_sections_r_test_LDFLAGS): Define.
11146         (many_sections_r_test_LDADD): Define.
11147         (many_sections_r_test.o): New target.
11148         * testsuite/Makefile.in: Rebuild.
11149
11150 2008-04-17  Cary Coutant  <ccoutant@google.com>
11151
11152         * errors.cc (Errors::info): New function.
11153         (gold_info): New function.
11154         * errors.h (Errors::info): New function.
11155         * gold.h (gold_info): New function.
11156         * object.cc (Input_objects::add_object): Print trace output.
11157         * options.cc (options::parse_set): New function.
11158         (General_options::parse_wrap): Deleted.
11159         (General_options::General_options): Deleted initializer.
11160         * options.h (options::String_set): New typedef.
11161         (options::parse_set): New function.
11162         (DEFINE_set): New macro.
11163         (General_options::wrap): Changed to use DEFINE_set. Changed
11164         callers of any_wrap_symbols and is_wrap_symbol.
11165         (General_options::trace, General_options::trace_symbol):
11166         New options.
11167         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11168         (General_options::wrap_symbols_): Deleted.
11169         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11170
11171 2008-04-17  David S. Miller  <davem@davemloft.net>
11172
11173         * options.cc (General_options::parse_V): New function.
11174         * options.h: Add entries for -V and -Qy.
11175
11176 2008-04-17  Ian Lance Taylor  <iant@google.com>
11177
11178         * common.cc (Symbol_table::allocate_commons): Remove options
11179         parameter.  Change caller.
11180         (Symbol_table::do_allocate_commons): Remove options parameter.
11181         Change caller.  Just call do_allocate_commons_list twice.
11182         (Symbol_table::do_allocate_commons_list): New function, broken out
11183         of do_allocate_commons.
11184         * common.h (class Allocate_commons_task): Remove options_ field.
11185         Update constructor.
11186         * symtab.cc (Symbol_table::Symbol_table): Initialize
11187         tls_commons_.
11188         (Symbol_table::add_from_object): Put TLS common symbols on
11189         tls_commons_ list.
11190         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11191         which are IN_OUTPUT_DATA.
11192         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11193         allocate_commons and do_allocate_commons declarations.  Declare
11194         do_allocate_commons_list.
11195         * gold.cc (queue_middle_tasks): Update creation of
11196         Allocate_commons_task to not pass options.
11197         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11198         (TLS_TEST_C_FLAGS): New variable.
11199         (tls_test_c_pic.o): New target.
11200         (tls_test_shared.so): Link in tls_test_c_pic.o.
11201         (tls_test_c_pic_ie.o): New target.
11202         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11203         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11204         (tls_test_c.o): New target.
11205         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11206         (tls_pic_test_LDADD): Likewise.
11207         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11208         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11209         (tls_test_c_gnu2.o): New target.
11210         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11211         tls_test_c_gnu2.o.
11212         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11213         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11214         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11215         * testsuite/tls_test.cc: Include "config.h".
11216         (t_last): Call t11_last.
11217         * testsuite/tls_test.h (t11, t11_last): Declare.
11218         * testsuite/tls_test_c.c: New file.
11219         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11220         * configure.ac: Check for OpenMP support.
11221         * configure, config.in, Makefile.in: Rebuild.
11222         * testsuite/Makefile.in: Rebuild.
11223
11224 2008-04-16  Cary Coutant  <ccoutant@google.com>
11225
11226         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11227         (Target_i386::tls_base_symbol_defined_): New field.
11228         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11229         (Target_i386::Scan::global): Likewise.
11230         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11231         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11232         (Target_x86_64::tls_base_symbol_defined_): New field.
11233         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11234         (Target_x86_64::Scan::global): Likewise.
11235
11236 2008-04-16  Cary Coutant  <ccoutant@google.com>
11237
11238         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11239         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11240         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11241         building shared libraries.
11242         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11243         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11244         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11245         * testsuite/Makefile.in: Rebuild.
11246         * testsuite/weak_undef.h: New file.
11247         * testsuite/weak_undef_file1.cc: Add extra test cases.
11248         * testsuite/weak_undef_file2.cc: Likewise.
11249         * testsuite/weak_undef_test.cc: Likewise.
11250
11251 2008-04-16  David S. Miller  <davem@davemloft.net>
11252
11253         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11254         Add issued_non_pic_error_ field.  Declare check_non_pic.
11255         (Target_sparc::Scan::check_non_pic): New function.
11256         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11257         (Target_sparc::Scan::global): Likewise.
11258
11259         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11260         * configure: Rebuild.
11261
11262         * options.h (DEFINE_enable): New macro.
11263         (new_dtags): New enable option.
11264         (initfirst, interpose, loadfltr, nodefaultlib,
11265         nodelete, nodlopen, nodump): New -z options.
11266         * layout.cc (Layout:finish_dynamic_section): If new
11267         dtags enabled, emit DT_RUNPATH.  Also, emit a
11268         DT_FLAGS_1 containing any specified -z flags.
11269
11270 2008-04-16  Ian Lance Taylor  <iant@google.com>
11271
11272         * copy-relocs.cc: New file.
11273         * copy-relocs.h: New file.
11274         * reloc.cc: Remove Copy_relocs code.
11275         * reloc.h: Likewise.
11276         * reloc-types.h (struct Reloc_types) [both versions]: Add
11277         get_reloc_addend_noerror.
11278         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11279         variants of add_global which take an addend which must be zero.
11280         * i386.cc: Include "copy-relocs.h".
11281         (class Target_i386): Change type of copy_relocs_ to variable,
11282         update initializer.
11283         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11284         Change all callers.
11285         (Target_i386::do_finalize_sections): Change handling of
11286         copy_relocs_.
11287         * sparc.cc: Include "copy-relocs.h".
11288         (class Target_sparc): Change type of copy_relocs_ to variable,
11289         update initializer.
11290         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11291         Change all callers.
11292         (Target_sparc::do_finalize_sections): Change handling of
11293         copy_relocs_.
11294         * x86_64.cc: Include "copy-relocs.h".
11295         (class Target_x86_64): Change type of copy_relocs_ to variable,
11296         update initializer.
11297         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11298         class.  Change all callers.
11299         (Target_x86_64::do_finalize_sections): Change handling of
11300         copy_relocs_.
11301         * Makefile.am (CCFILES): Add copy-relocs.cc.
11302         (HFILES): Add copy-relocs.h.
11303
11304         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11305
11306         * testsuite/script_test_4.sh: Permit leading zeroes.
11307
11308 2008-04-15  Ian Lance Taylor  <iant@google.com>
11309
11310         * script-sections.cc (Script_sections::create_segments): Use
11311         header_size_adjustment even when there is enough room for the
11312         headers.
11313         * testsuite/script_test_4.sh: New file.
11314         * testsuite/script_test_4.t: New file.
11315         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11316         (check_DATA): Add script_test_4.stdout.
11317         (MOSTLYCLEANFILES): Likewise.
11318         (script_test_4): New target.
11319         (script_test_4.stdout): New target.
11320         * testsuite/Makefile.in: Rebuild.
11321
11322         * sparc.cc: Add definitions for Output_data_plt_sparc class
11323         constants.
11324
11325 2008-04-14  David S. Miller  <davem@davemloft.net>
11326
11327         * sparc.cc: New file.
11328         * Makefile.am (TARGETSOURCES): Add sparc.cc
11329         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11330         * configure.tgt: Document targ_extra_size and
11331         targ_extra_big_endian.  Add entries for sparc-* and
11332         sparc64-*.
11333         * configure.ac: Handle targ_extra_size and
11334         targ_extra_big_endian.
11335         * Makefile.in: Rebuild.
11336         * configure: Likewise.
11337         * po/POTFILES.in: Likewise.
11338         * po/gold.pot: Likewise.
11339
11340 2008-04-14  Ian Lance Taylor  <iant@google.com>
11341
11342         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11343         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11344         in the name/type/flags to section mapping.  Don't call
11345         allocate_output_section.
11346         (Layout::choose_output_section): Change parameter from adjust_name
11347         to is_input_section.  Don't permit input sections after sections
11348         are attached to segments.  Don't call allocate_output_section.
11349         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11350         not write_enable_output_section.
11351         (Layout::make_output_section): Don't push to
11352         unattached_section_list_ nor call attach_to_segment.  Call
11353         attach_section_to_segment if sections are attached.
11354         (Layout::attach_sections_to_segments): New function.
11355         (Layout::attach_section_to_segment): New function.
11356         (Layout::attach_allocated_section_to_segment): Rename from
11357         attach_to_segment.  Remove flags parameter.
11358         (Layout::allocate_output_section): Remove function.
11359         (Layout::write_enable_output_section): Remove function.
11360         * layout.h (class Layout): Update for above changes.  Add new
11361         field sections_are_attached_.
11362         * output.h (Output_section::update_flags_for_input_section): New
11363         function.
11364         * output.cc (Output_section::add_input_section): Call
11365         update_flags_for_input_section.
11366         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11367
11368 2008-04-11  Cary Coutant  <ccoutant@google.com>
11369
11370         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11371         thought unnecessary.
11372         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11373
11374 2008-04-11  Ian Lance Taylor  <iant@google.com>
11375
11376         * output.h (class Output_section_data): Remove inline definition
11377         of set_addralign.
11378         * output.cc (Output_section_data::set_addralign): New function.
11379
11380 2008-04-11  Cary Coutant  <ccoutant@google.com>
11381
11382         Add support for TLS descriptors for i386 and x86_64.
11383         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11384         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11385         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11386         GOT_TYPE_TLS_DESC.
11387         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11388         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11389         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11390         relocations.
11391         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11392         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11393         Fix problem with initial-exec relocations.
11394         (Target_i386::Relocate::relocate_tls): Likewise.
11395         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11396         relaxation.
11397         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11398         support for section-plus-offset dynamic table entries.
11399         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11400         (Output_data_dynamic::Dynamic_entry): Add support for
11401         section-plus-offset dynamic table entries.
11402         (Output_data_dynamic::Classification): Likewise.
11403         (Output_data_dynamic::classification_): Renamed offset_.
11404         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11405         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11406         (Target_x86_64::make_plt_section): New function.
11407         (Target_x86_64::reserve_tlsdesc_entries): New function.
11408         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11409         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11410         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11411         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11412         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11413         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11414         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11415         add extra PLT entry for TLS descriptors.
11416         (Output_data_plt_x86_64::got_): New field.
11417         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11418         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11419         fields.
11420         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11421         descriptors.
11422         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11423         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11424         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11425         R_386_TLS_DESC_CALL relocations.
11426         (Target_x86_64::Scan::global): Likewise.
11427         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11428         for TLS descriptors.
11429         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11430         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11431         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11432         GD-to-IE relaxation.
11433         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11434         and TLS_DESCRIPTORS.
11435         * Makefile.in: Rebuild.
11436         * configure: Rebuild.
11437         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11438         (tls_test_shared2.so): New target.
11439         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11440         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11441         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11442         (tls_shared_gd_to_ie_test_LDADD): New variable.
11443         (tls_shared_gnu2_gd_to_ie_test): New target.
11444         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11445         New targets.
11446         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11447         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11448         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11449         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11450         (tls_shared_gnu2_test): New target.
11451         (tls_test_gnu2_shared.so): New target.
11452         (tls_shared_gnu2_test_SOURCES): New variable.
11453         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11454         (tls_shared_gnu2_test_LDFLAGS): New variable.
11455         (tls_shared_gnu2_test_LDADD): New variable.
11456         * testsuite/Makefile.in: Rebuild.
11457         * testsuite/Makefile.
11458
11459 2008-04-11  Ian Lance Taylor  <iant@google.com>
11460
11461         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11462         justsyms.t.
11463         * testsuite/Makefile.in: Rebuild.
11464
11465         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11466         long.
11467         * testsuite/script_test_2.cc (main): Adjust test.
11468
11469 2008-04-11  David S. Miller  <davem@davemloft.net>
11470             Ian Lance Taylor  <iant@google.com>
11471
11472         * options.h (General_options): Add entries for '-Y' and
11473         '-relax'.
11474         * options.cc (General_options:finalize): If -Y was used, add those
11475         entries to the library path instead of the default "/lib" and
11476         "/usr/lib".
11477
11478 2008-04-11  David S. Miller  <davem@davemloft.net>
11479
11480         * testsuite/justsyms.t: Start at 0x100.
11481         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11482         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11483         long.
11484         * testsuite/script_test_2.cc: Adjust string and section length
11485         checks.
11486
11487 2008-04-09  Ian Lance Taylor  <iant@google.com>
11488
11489         PR gold/5996
11490         * script-sections.cc (Sections_element::allocate_to_segment): Add
11491         orphan parameter.
11492         (Output_section_definition::allocate_to_segment): Likewise.
11493         (Orphan_output_section::allocate_to_segment): Likewise.
11494         (Script_sections::attach_sections_using_phdrs_clause): Don't
11495         propagate non-PT_LOAD segments to orphan sections.
11496         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11497         readelf rather than objdump.
11498         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11499         .interp section and PT_INTERP segment are the same size.
11500         * testsuite/Makefile.in: Rebuild.
11501
11502         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11503         aliases for symbols defined in the same object.
11504         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11505         (weak_alias_test_SOURCES): New variable.
11506         (weak_alias_test_DEPENDENCIES): New variable.
11507         (weak_alias_test_LDFLAGS): New variable.
11508         (weak_alias_test_LDADD): New variable.
11509         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11510         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11511         (weak_alias_test_3.o): New target.
11512         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11513         * testsuite/weak_alias_test_main.cc: New file.
11514         * testsuite/weak_alias_test_1.cc: New file.
11515         * testsuite/weak_alias_test_2.cc: New file.
11516         * testsuite/weak_alias_test_3.cc: New file.
11517
11518 2008-04-08  Ian Lance Taylor  <iant@google.com>
11519
11520         * options.h (class General_options): Add --noinhibit-exec option.
11521         * main.cc (main): Check --noinhibit-exec.
11522
11523         * options.h (class General_options): Define --wrap as a special
11524         option.  Add wrap_symbols_ field.
11525         (General_options::any_wrap_symbols): New function.
11526         (General_options::is_wrap_symbol): New function.
11527         * options.cc (General_options::parse_wrap): New function.
11528         (General_options::General_options): Initialize wrap_symbols_.
11529         * symtab.cc (Symbol_table::wrap_symbol): New function.
11530         (Symbol_table::add_from_object): Handle --wrap.
11531         * symtab.h (class Symbol_table): Declare wrap_symbol.
11532         * target.h (Target::wrap_char): New function.
11533         (Target::Target_info): Add wrap_char field.
11534         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11535         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11536         * testsuite/testfile.cc (Target_test::test_target_info):
11537         Likewise.
11538
11539         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11540         there is one.
11541
11542         * layout.h (class Layout): Add added_eh_frame_data_ field.
11543         * layout.cc (Layout::Layout): Initialize new field.
11544         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11545         output section until we find a section we merged successfully.
11546         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11547         that the size be non-zero.
11548
11549         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11550         qualifier.
11551
11552 2008-04-08  Craig Silverstein  <csilvers@google.com>
11553
11554         * configure.ac: Export new conditional variable HAVE_ZLIB.
11555         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11556         on HAVE_ZLIB.
11557         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11558         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11559
11560 2008-04-07  Ian Lance Taylor  <iant@google.com>
11561
11562         * version.cc (version_string): Set to "1.5".
11563
11564         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11565         Add issued_non_pic_error_ field.  Declare check_non_pic.
11566         (Target_x86_64::Scan::check_non_pic): New function.
11567         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11568         (Target_x86_64::Scan::global): Likewise.
11569
11570         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11571         addend parameter.  Change caller.  Handle merge sections.
11572         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11573         Address to Addend.  Don't add in the result of
11574         local_section_offset, pass down the addend and use the returned
11575         value.
11576         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11577         Update declarations of local_section_offset and symbol_value.
11578         * testsuite/two_file_test_1.cc (t18): New function.
11579         * testsuite/two_file_test_2.cc (f18): New function.
11580         * testsuite/two_file_test_main.cc (main): Call t18.
11581         * testsuite/two_file_test.h (t18, f18): Declare.
11582
11583         * configure.ac: Don't test for objdump, c++filt, or readelf.
11584         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11585         conditionals.
11586         (TEST_READELF): New variable.
11587         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11588         (check_PROGRAMS): Add two_file_strip_test.
11589         (two_file_strip_test): New target.
11590         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11591         (two_file_same_shared_strip_test_SOURCES): New variable.
11592         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11593         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11594         (two_file_same_shared_strip_test_LDADD): New variable.
11595         (two_file_shared_strip.so): New target.
11596         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11597         (ver_test_5.syms, ver_test_7.syms): Likewise.
11598         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11599         (strip_test_3.stdout): Use TEST_OBJDUMP.
11600         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11601
11602 2008-04-04  Cary Coutant  <ccoutant@google.com>
11603
11604         * symtab.h (Symbol::is_weak_undefined): New function.
11605         (Symbol::is_strong_undefined): New function.
11606         (Symbol::is_absolute): New function.
11607         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11608         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11609         absolute symbols.
11610         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11611         (weak_undef_test): New target.
11612         * testsuite/Makefile.in: Rebuild.
11613         * testsuite/weak_undef_file1.cc: New file.
11614         * testsuite/weak_undef_file2.cc: New file.
11615         * testsuite/weak_undef_test.cc: New file.
11616
11617 2008-04-03  Craig Silverstein  <csilvers@google.com>
11618
11619         * compressed_output.h (class Output_compressed_section): Use
11620         unsigned buffer.
11621         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11622         add zlib header.
11623         (zlib_compressed_suffix): Removed.
11624         (Output_compressed_section::set_final_data_size): Use unsigned
11625         buffers.
11626         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11627         Fix linker invocation.
11628         (flagstest_o_specialfile_and_compress_debug_sections):
11629         Likewise.
11630         * testsuite/Makefile.in: Regenerated.
11631
11632 2008-04-02  David S. Miller  <davem@davemloft.net>
11633
11634         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11635         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11636
11637 2008-04-02  Craig Silverstein  <csilvers@google.com>
11638
11639         * TODO: New file.
11640
11641 2008-04-02  Ian Lance Taylor  <iant@google.com>
11642
11643         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11644         parameters.  Update for new key type to views_.  Change all
11645         callers.
11646         (File_read::read): Adjust for byteshift in returned view.
11647         (File_read::add_view): New function, broken out of
11648         find_and_make_view.
11649         (File_read::make_view): New function, broken out of
11650         find_and_make_view.
11651         (File_read::find_or_make_view): Add offset and aligned
11652         parameters.  Rewrite accordingly.  Change all callers.
11653         (File_read::get_view): Add offset and aligned parameters.  Adjust
11654         for byteshift in return value.
11655         (File_read::get_lasting_view): Likewise.
11656         * fileread.h (class File_read): Update declarations.
11657         (class File_read::View): Add byteshift_ field.  Add byteshift to
11658         constructor.  Add byteshift method.
11659         * archive.h (Archive::clear_uncached_views): New function.
11660         (Archive::get_view): Add aligned parameter.  Change all callers.
11661         * object.h (Object::get_view): Add aligned parameter.  Change all
11662         callers.
11663         (Object::get_lasting_view): Likewise.
11664
11665         * fileread.cc (File_read::release): Don't call clear_views if
11666         there are multiple objects.
11667         * fileread.h (File_read::clear_uncached_views): New function.
11668         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11669         on the archive.
11670
11671 2008-03-31  Cary Coutant  <ccoutant@google.com>
11672
11673         Add thin archive support.
11674         * archive.cc (Archive::armagt): New const.
11675         (Archive::setup): Remove task parameter and calls to unlock.
11676         (Archive::unlock_nested_archives): New function.
11677         (Archive::read_header): Add nested_off parameter. Change
11678         all callers.
11679         (Archive::interpret_header): Likewise.
11680         (Archive::include_all_members): Change to handle thin
11681         archives.
11682         (Archive::include_member): Likewise.
11683         * archive.h (Archive::Archive): Add new parameters and
11684         initializers.
11685         (Archive::armagt): New const.
11686         (Archive::setup): Remove task parameter.
11687         (Archive::unlock_nested_archives): New function.
11688         (Archive::read_header): Add nested_off parameter.
11689         (Archive::interpret_header): Likewise.
11690         (Archive::Nested_archive_table): New typedef.
11691         (Archive::is_thin_archive_): New field.
11692         (Archive::nested_archives_): New field.
11693         (Archive::options_): New field.
11694         (Archive::dirpath_): New field.
11695         (Archive::task_): New field.
11696         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11697         for thin archives.  Pass additional parameters to
11698         Archive::Archive.  Unlock the archive file after calling
11699         Archive::setup.
11700
11701 2008-03-29  Ian Lance Taylor  <iant@google.com>
11702
11703         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11704         version symbol to be local.
11705         * testsuite/ver_test_4.sh: New file.
11706         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11707         (check_DATA): Add ver_test_4.syms.
11708         (ver_test_4.syms): New target.
11709         * testsuite/Makefile.in: Rebuild.
11710
11711         * output.cc
11712         (Output_section::Input_section_sort_entry::has_priority): New
11713         function.
11714         (Output_section::Input_section_sort_entry::match_file_name): New
11715         function.
11716         (Output_section::Input_section_sort_entry::match_section_name):
11717         Remove.
11718         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11719         Remove.
11720         (Output_section::Input_section_sort_entry::match_section_file):
11721         Remove.
11722         (Output_section::Input_section_sort_compare::operator()): Rewrite
11723         using new Input_section_sort_entry functions.  Sort crtbegin and
11724         crtend first.  Sort sections with no priority before sections with
11725         a priority.
11726         * testsuite/initpri1.c (d3): Check j != 4.
11727         (cd5): New constructor/destructor function.
11728         (main): Check j != 2.
11729
11730         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11731         new symbol when resolving, don't call set_is_default.
11732         * testsuite/ver_test_7.cc: New file.
11733         * testsuite/ver_test_7.sh: New file.
11734         * testsuite/Makefile.am (ver_test_7.so): New target.
11735         (ver_test_7.o): New target.
11736         (check_SCRIPTS): Add ver_test_7.sh.
11737         (check_DATA): Add ver_test_7.syms.
11738         (ver_test_7.syms): New target.
11739
11740 2008-03-28  Ian Lance Taylor  <iant@google.com>
11741
11742         * layout.cc (Layout::layout): If we see an input section with a
11743         name that needs sorting, set the must_sort flag for the output
11744         section.
11745         (Layout::make_output_section): If the name of the output section
11746         indicates that it might require sorting, set the may_sort flag.
11747         * output.h (Output_section::may_sort_attached_input_sections): New
11748         function.
11749         (Output_section::set_may_sort_attached_input_sections): New
11750         function.
11751         (Output_section::must_sort_attached_input_sections): New
11752         function.
11753         (Output_section::set_must_sort_attached_input_sections): New
11754         function.
11755         (class Output_section): Declare Input_section_sort_entry.  Define
11756         Input_section_sort_compare.  Declare
11757         sort_attached_input_sections.  Add new fields:
11758         may_sort_attached_input_sections_,
11759         must_sort_attached_input_sections_,
11760         attached_input_sections_are_sorted_.
11761         * output.cc (Output_section::Output_section): Initialize new
11762         fields.
11763         (Output_section::add_input_section): Add an entry to
11764         input_sections_ if may_sort or must_sort are true.
11765         (Output_section::set_final_data_size): Call
11766         sort_attached_input_sections if necessary.
11767         (Output_section::Input_section_sort_entry): Define new class.
11768         (Output_section::Input_section_sort_compare::operator()): New
11769         function.
11770         (Output_section::sort_attached_input_sections): New function.
11771         * configure.ac: Check whether the compiler supports constructor
11772         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11773         * testsuite/initpri1.c: New file.
11774         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11775         CONSTRUCTOR_PRIORITY.
11776         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11777         (initpri1_LDFLAGS): New variable.
11778         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11779
11780 2008-03-27  Ian Lance Taylor  <iant@google.com>
11781
11782         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11783         * testsuite/common_test_1.c: New file.
11784         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11785         (common_test_1_SOURCES): New variable.
11786         (common_test_1_DEPENDENCIES): New variable.
11787         (common_test_1_LDFLAGS): New variable.
11788
11789         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11790         and commons_ correctly when NAME/VERSION does not override
11791         NAME/NULL.
11792         * testsuite/ver_test_6.c: New file.
11793         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11794         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11795         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11796
11797 2008-03-26  Ian Lance Taylor  <iant@google.com>
11798
11799         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11800         of an undefined symbol from a version script.
11801         * testsuite/Makefile.am (ver_test_5.so): New target.
11802         (ver_test_5.o): New target.
11803         (check_SCRIPTS): Add ver_test_5.sh.
11804         (check_DATA): Add ver_test_5.syms.
11805         (ver_test_5.syms): New target.
11806         * testsuite/ver_test_5.cc: New file.
11807         * testsuite/ver_test_5.script: New file.
11808         * testsuite/ver_test_5.sh: New file.
11809         * Makefile.in, testsuite/Makefile.in: Rebuild.
11810
11811         PR gold/5986
11812         Fix problems building gold with gcc 4.3.0.
11813         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11814         (gold_error_at_location, gold_warning_at_location): Use it.
11815         * configure.ac: Check whether we can compile and use a template
11816         function with a printf attribute.
11817         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11818         when jumping over bytes.
11819         * object.cc: Instantiate Object::read_section_data.
11820         * debug.h: Include <cstring>
11821         * dwarf_reader.cc: Include <algorithm>
11822         * main.cc: Include <cstring>.
11823         * options.cc: Include <cstring>.
11824         * output.cc: Include <cstring>.
11825         * script.cc: Include <cstring>.
11826         * script.h: Include <string>.
11827         * symtab.cc: Include <cstring> and <algorithm>.
11828         * target-select.cc: Include <cstring>.
11829         * version.cc: Include <string>.
11830         * testsuite/testmain.cc: Include <cstdlib>.
11831         * configure, config.in: Rebuild.
11832
11833 2008-03-25  Ian Lance Taylor  <iant@google.com>
11834
11835         * options.cc: Include "../bfd/bfdver.h".
11836         (options::help): Print bug reporting address.
11837
11838         * version.cc (print_version): Adjust output for current value of
11839         BFD_VERSION_STRING.
11840
11841         * NEWS: New file.
11842
11843         * options.cc (options::help): Print list of supported targets.
11844         * target-select.h: Include <vector>.
11845         (class Target_selector): Make machine_, size_, and is_big_endian_
11846         fields const.  Add bfd_name_ and instantiated_target_ fields.
11847         (Target_selector::Target_selector): Add bfd_name parameter.
11848         (Target_selector::recognize): Make non-virtual, call
11849         do_recognize.
11850         (Target_selector::recognize_by_name): Make non-virtual, call
11851         do_recognize_by_name.
11852         (Target_selector::supported_names): New function.
11853         (Target_selector::bfd_name): New function.
11854         (Target_selector::do_instantiate_target): New pure virtual
11855         function.
11856         (Target_selector::do_recognize): New virtual function.
11857         (Target_selector::do_recognize_by_name): New virtual function.
11858         (Target_selector::instantiate_target): New private function.
11859         (supported_target_names): Declare.
11860         * target-select.cc (Target_selector::Target_selector): Update for
11861         new parameter and fields.
11862         (select_target_by_name): Check that the name matches before
11863         calling recognize_by_name.
11864         (supported_target_names): New function.
11865         * i386.cc (class Target_selector_i386): Update Target_selector
11866         constructor call.  Remove recognize and recognize_by_name.  Add
11867         do_instantiate_target.
11868         * x86_64.cc (class Target_selector_x86_64): Likewise.
11869         * testsuite/testfile.cc (class Target_selector_test): Update for
11870         changes to Target_selector.
11871
11872         * README: Rewrite, with some notes on unsupported features.
11873
11874 2008-03-24  Cary Coutant  <ccoutant@google.com>
11875
11876         * i386.cc (Target_i386::Got_type): New enum declaration.
11877         (Target_i386::Scan::local): Updated callers of Output_data_got
11878         member functions.
11879         (Target_i386::Scan::global): Likewise.
11880         (Target_i386::Relocate::relocate): Likewise.
11881         (Target_i386::Relocate::relocate_tls): Likewise.
11882         * object.h (Got_offset_list): New class.
11883         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11884         (Sized_relobj::local_got_offset): Likewise.
11885         (Sized_relobj::set_local_got_offset): Likewise.
11886         (Sized_relobj::local_has_tls_got_offset): Removed.
11887         (Sized_relobj::local_tls_got_offset): Removed.
11888         (Sized_relobj::set_local_tls_got_offset): Removed.
11889         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11890         * output.cc (Output_data_got::add_global): Added got_type parameter.
11891         (Output_data_got::add_global_with_rel): Likewise.
11892         (Output_data_got::add_global_with_rela): Likewise.
11893         (Output_data_got::add_global_pair_with_rel): New function.
11894         (Output_data_got::add_global_pair_with_rela): New function.
11895         (Output_data_got::add_local): Added got_type parameter.
11896         (Output_data_got::add_local_with_rel): Likewise.
11897         (Output_data_got::add_local_with_rela): Likewise.
11898         (Output_data_got::add_local_pair_with_rel): New function.
11899         (Output_data_got::add_local_pair_with_rela): New function.
11900         (Output_data_got::add_global_tls): Removed.
11901         (Output_data_got::add_global_tls_with_rel): Removed.
11902         (Output_data_got::add_global_tls_with_rela): Removed.
11903         (Output_data_got::add_local_tls): Removed.
11904         (Output_data_got::add_local_tls_with_rel): Removed.
11905         (Output_data_got::add_local_tls_with_rela): Removed.
11906         * output.h (Output_data_got::add_global): Added got_type parameter.
11907         (Output_data_got::add_global_with_rel): Likewise.
11908         (Output_data_got::add_global_with_rela): Likewise.
11909         (Output_data_got::add_global_pair_with_rel): New function.
11910         (Output_data_got::add_global_pair_with_rela): New function.
11911         (Output_data_got::add_local): Added got_type parameter.
11912         (Output_data_got::add_local_with_rel): Likewise.
11913         (Output_data_got::add_local_with_rela): Likewise.
11914         (Output_data_got::add_local_pair_with_rel): New function.
11915         (Output_data_got::add_local_pair_with_rela): New function.
11916         (Output_data_got::add_global_tls): Removed.
11917         (Output_data_got::add_global_tls_with_rel): Removed.
11918         (Output_data_got::add_global_tls_with_rela): Removed.
11919         (Output_data_got::add_local_tls): Removed.
11920         (Output_data_got::add_local_tls_with_rel): Removed.
11921         (Output_data_got::add_local_tls_with_rela): Removed.
11922         * resolve.cc (Symbol::override_base_with_special): Removed
11923         reference to has_got_offset_ field.
11924         * symtab.cc (Symbol::init_fields): Replaced initialization
11925         of got_offset_ with got_offsets_.  Removed initialization
11926         of has_got_offset_
11927         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11928         (Symbol::got_offset): Likewise.
11929         (Symbol::set_got_offset): Likewise.
11930         (Symbol::has_tls_got_offset): Removed.
11931         (Symbol::tls_got_offset): Removed.
11932         (Symbol::set_tls_got_offset): Removed.
11933         (Symbol::got_offset_): Removed.
11934         (Symbol::tls_mod_got_offset_): Removed.
11935         (Symbol::tls_pair_got_offset_): Removed.
11936         (Symbol::got_offsets_): New field.
11937         (Symbol::has_got_offset): Removed.
11938         (Symbol::has_tls_mod_got_offset): Removed.
11939         (Symbol::has_tls_pair_got_offset): Removed.
11940         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11941         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11942         member functions.
11943         (Target_x86_64::Scan::global): Likewise.
11944         (Target_x86_64::Relocate::relocate): Likewise.
11945         (Target_x86_64::Relocate::relocate_tls): Likewise.
11946
11947 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11948
11949         * yyscript.y: Fix spelling error in comment.
11950
11951 2008-03-24  Ian Lance Taylor  <iant@google.com>
11952
11953         * options.h (class General_options): Define build_id option.
11954         * layout.h (class Layout): Declare write_build_id, create_note,
11955         create_build_id.  Add build_id_note_ member.
11956         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11957         "libiberty.h", "md5.h", "sha1.h".
11958         (Layout::Layout): Initialize eh_frame_data_,
11959         eh_frame_hdr_section_, and build_id_note_.
11960         (Layout::finalize): Call create_build_id.
11961         (Layout::create_note): New function, broken out of
11962         Layout::create_gold_note.
11963         (Layout::create_gold_note): Call create_note.
11964         (Layout::create_build_id): New function.
11965         (Layout::write_build_id): New function.
11966         (Close_task_runner::run): Call write_build_id.
11967
11968         * x86_64.cc: Correct license to GPLv3.
11969
11970 2008-03-23  Ian Lance Taylor  <iant@google.com>
11971
11972         * options.cc: Include "demangle.h".
11973         (parse_optional_string): New function.
11974         (parse_long_option): Handle takes_optional_argument.
11975         (parse_short_option): Update dash_z initializer.  Handle
11976         takes_optional_argument.
11977         (General_options::General_options): Initialize do_demangle_.
11978         (General_options::finalize): Set do_demangle_.  Handle demangling
11979         style.
11980         * options.h (parse_optional_string): Declare.
11981         (struct One_option): Add optional_arg field.  Update constructor.
11982         Update call constructor calls.  Add takes_optional_argument
11983         function.
11984         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11985         (DEFINE_optional_string): Define.
11986         (General_options::demangle): Change from DEFINE_bool to
11987         DEFINE_optional_string.
11988         (General_options::no_demangle): New function.
11989         (General_options::do_demangle): New function.
11990         (General_options::set_do_demangle): New function.
11991         (General_options::execstack_status_): Move definition to end of
11992         class definition.
11993         (General_options::static_): Likewise.
11994         (General_options::do_demangle_): New field.
11995         * object.cc (big_endian>::get_symbol_location_info): Call
11996         Options::do_demangle, not Options::demangle.
11997         * symtab.cc (demangle): Likewise.
11998
11999 2008-03-22  Ian Lance Taylor  <iant@google.com>
12000
12001         * gold.h: Include <cstddef> and <sys/types.h>
12002         * options.h: Include <cstring>.
12003
12004 2008-03-21  Ian Lance Taylor  <iant@google.com>
12005
12006         * Added source code to GNU binutils.