98346b64674534fab1590ee89ce5d7d1ab6dbdbe
[platform/upstream/binutils.git] / gold / ChangeLog
1 2011-07-15  Ian Lance Taylor  <iant@google.com>
2
3         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5         (Output_data_plt_i386::do_write): Write address of .dynamic
6         section to first entry in .got.plt section.
7         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
8         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
9         Initialize layout_.
10         (Output_data_plt_x86_64::do_write): Write address of .dynamic
11         section to first entry in .got.plt section.
12         * layout.h (Layout::dynamic_section): New function.
13
14 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
15
16         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
17         to claim_file call.
18         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
19         input_section_position_, and input_section_glob_.
20         (read_layout_from_file): Call function section_ordering_specified.
21         * layout.h (is_section_ordering_specified): New function.
22         (section_ordering_specified): New function.
23         (section_ordering_specified_): New boolean member.
24         * main.cc(main): Call load_plugins after layout object is defined.
25         * output.cc (Output_section::add_input_section): Use
26         function section_ordering_specified to check if section ordering is
27         needed.
28         * output.cc (Output_section::add_relaxed_input_section): Use
29         function section_ordering_specified to check if section ordering is
30         needed.
31         (Output_section::update_section_layout): New function.
32         (Output_section::sort_attached_input_sections): Check if input section
33         must be reordered.
34         * output.h (Output_section::update_section_layout): New function.
35         * plugin.cc (get_section_count): New function.
36         (get_section_type): New function.
37         (get_section_name): New function.
38         (get_section_contents): New function.
39         (update_section_order): New function.
40         (allow_section_ordering): New function. 
41         (Plugin::load): Add the new interfaces to the transfer vector.
42         (Plugin_manager::load_plugins): New parameter.
43         (Plugin_manager::all_symbols_read): New parameter.
44         (Plugin_manager::claim_file): New parameter. Save the elf object for
45         unclaimed objects.
46         (Plugin_manager::get_elf_object): New function.
47         (Plugin_manager::get_view): Change to directly use the bool to check
48         if get_view is called from claim_file_hook.
49         * plugin.h (input_objects): New function
50         (Plugin__manager::load_plugins): New parameter.
51         (Plugin_manager::claim_file): New parameter.
52         (Plugin_manager::get_elf_object): New function.
53         (Plugin_manager::in_claim_file_handler): New function.
54         (Plugin_manager::in_claim_file_handler_): New member.
55         (layout): New function.
56         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
57         handler with an extra parameter. Make the elf object before calling
58         claim_file handler.
59         * testsuite/plugin_test.c (get_section_count): New function pointer.
60         (get_section_type): New function pointer.
61         (get_section_name): New function pointer.
62         (get_section_contents): New function pointer.
63         (update_section_order): New function pointer.
64         (allow_section_ordering): New function pointer.
65         (onload): Check if the new interfaces exist.
66
67 2011-07-13  Ian Lance Taylor  <iant@google.com>
68
69         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
70         relro section.
71         * x86_64.cc (Target_x86_64::got_section): Likewise.
72         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
73         (relro_now_test_SOURCES): New variable.
74         (relro_now_test_DEPENDENCIES): New variable.
75         (relro_now_test_LDFLAGS): New variable.
76         (relro_now_test_LDADD): New variable.
77         (relro_now_test.so): New target.
78         * testsuite/Makefile.in: Rebuild.
79
80 2011-07-12  Ian Lance Taylor  <iant@google.com>
81
82         PR gold/12980
83         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
84         GLOB_DAT relocation rather than a RELATIVE relocation for a
85         protected symbol when creating a shared library.
86         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
87         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
88         * testsuite/protected_main_1.cc (main): Test that protected
89         function has same address.
90
91 2011-07-11  Ian Lance Taylor  <iant@google.com>
92
93         PR gold/12979
94         * options.h (class General_options): Add -Bgroup.
95         * options.cc (General_options::finalize): If -Bgroup is set,
96         default to --unresolved-symbols=report-all.
97         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
98         * target-reloc.h (issue_undefined_symbol_error): Handle
99         --unresolved-symbols=report-all.
100
101 2011-07-08  Ian Lance Taylor  <iant@google.com>
102
103         PR gold/11985
104         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
105         if linker script discards key sections.
106         (Layout::create_dynamic_symtab): Likewise.
107         (Layout::assign_local_dynsym_offsets): Likewise.
108         (Layout::sized_create_version_sections): Likewise.
109         (Layout::create_interp): Likewise.
110         (Layout::finish_dynamic_section): Likewise.
111         (Layout::set_dynamic_symbol_size): Likewise.
112
113 2011-07-08  Ian Lance Taylor  <iant@google.com>
114
115         PR gold/12386
116         * options.h (class General_options): Add --unresolved-symbols.
117         * target-reloc.h (issue_undefined_symbol_error): Check
118         --unresolved-symbols.  Add comments.
119
120 2011-07-08  Ian Lance Taylor  <iant@google.com>
121
122         * testsuite/odr_violation2.cc (Ordering::operator()): Make
123         expression more complex.
124
125 2011-07-08  Ian Lance Taylor  <iant@google.com>
126
127         PR gold/11317
128         * target-reloc.h (issue_undefined_symbol_error): New inline
129         function, broken out of relocate_section.
130         (relocate_section): Call issue_undefined_symbol_error.
131         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
132         there is no TLS segment if we are about to issue an undefined
133         symbol error.
134         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
135
136 2011-07-08  Ian Lance Taylor  <iant@google.com>
137
138         PR gold/12279
139         * resolve.cc (Symbol_table::should_override): Add fromtype
140         parameter.  Change all callers.  Give error when linking together
141         TLS and non-TLS symbol.
142         (Symbol_table::should_override_with_special): Add fromtype
143         parameter.  Change all callers.
144         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
145         there is no TLS segment if we have reported some errors.
146         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
147
148 2011-07-08  Ian Lance Taylor  <iant@google.com>
149
150         PR gold/12372
151         * target.h (Target::plt_address_for_global): New function.
152         (Target::plt_address_for_local): New function.
153         (Target::plt_section_for_global): Remove.
154         (Target::plt_section_for_local): Remove.
155         (Target::do_plt_address_for_global): New virtual function.
156         (Target::do_plt_address_for_local): New virtual function.
157         (Target::do_plt_section_for_global): Remove.
158         (Target::do_plt_section_for_local): Remove.
159         (Target::register_global_plt_entry): Add Symbol_table and Layout
160         parameters.
161         * output.cc (Output_data_got::Got_entry::write): Use
162         plt_address_for_global and plt_address_for_local.
163         * layout.cc (Layout::add_target_dynamic_tags): Use size and
164         address of output section.
165         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
166         got_irelative_, and irelative_count_ fields.  Update
167         declarations.
168         (Output_data_plt_i386::has_irelative_section): New function.
169         (Output_data_plt_i386::entry_count): Add irelative_count_.
170         (Output_data_plt_i386::set_final_data_size): Likewise.
171         (class Target_i386): Add got_irelative_ and rel_irelative_
172         fields.  Update declarations.
173         (Target_i386::Target_i386): Initialize new fields.
174         (Target_i386::do_plt_address_for_global): New function replacing
175         do_plt_section_for_global.
176         (Target_i386::do_plt_address_for_local): New function replacing
177         do_plt_section_for_local.
178         (Target_i386::got_section): Create got_irelative_.
179         (Target_i386::rel_irelative_section): New function.
180         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
181         fields.  Don't define __rel_iplt_{start,end}.
182         (Output_data_plt_i386::add_entry): Add symtab and layout
183         parameters.  Change all callers.  Use different PLT and GOT for
184         IFUNC symbols.
185         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
186         layout parameters.  Change all callers.  Use different PLT and
187         GOT.
188         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
189         (Output_data_plt_i386::rel_irelative): New function.
190         (Output_data_plt_i386::address_for_global): New function.
191         (Output_data_plt_i386::address_for_local): New function.
192         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
193         IRELATIVE GOT when changing IFUNC GOT entries.
194         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
195         reloc.
196         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
197         if we didn't create an IRELATIVE GOT.
198         (Target_i386::Relocate::relocate): Use plt_address_for_global and
199         plt_address_for_local.
200         (Target_i386::do_dynsym_value): Use plt_address_for_global.
201         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
202         got_irelative_, and irelative_count_ fields.  Update
203         declarations.
204         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
205         Initialize new fields.  Remove symtab parameter.  Change all
206         callers.
207         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
208         irelative_count_.
209         (Output_data_plt_x86_64::has_irelative_section): New function.
210         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
211         (class Target_x86_64): Add got_irelative_ and rel_irelative_
212         fields.  Update declarations.
213         (Target_x86_64::Target_x86_64): Initialize new fields.
214         (Target_x86_64::do_plt_address_for_global): New function replacing
215         do_plt_section_for_global.
216         (Target_x86_64::do_plt_address_for_local): New function replacing
217         do_plt_section_for_local.
218         (Target_x86_64::got_section): Create got_irelative_.
219         (Target_x86_64::rela_irelative_section): New function.
220         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
221         all callers.  Don't create __rel_iplt_{start,end}.
222         (Output_data_plt_x86_64::add_entry): Add symtab and layout
223         parameters.  Change all callers.  Use different PLT and GOT for
224         IFUNC symbols.
225         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
226         layout parameters.  Change all callers.  Use different PLT and
227         GOT.
228         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
229         parameters.  Change all callers.  Use different PLT and GOT for
230         IFUNC symbols.
231         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
232         (Output_data_plt_x86_64::rela_irelative): New function.
233         (Output_data_plt_x86_64::address_for_global): New function.
234         (Output_data_plt_x86_64::address_for_local): New function.
235         (Output_data_plt_x86_64::set_final_data_size): Likewise.
236         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
237         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
238         (Target_x86_64::register_global_plt_entry): Add symtab and layout
239         parameters.
240         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
241         reloc.
242         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
243         symbols if we didn't create an IRELATIVE GOT.
244         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
245         plt_address_for_local.
246         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
247         * testsuite/ifuncvar1.c: New test file.
248         * testsuite/ifuncvar2.c: New test file.
249         * testsuite/ifuncvar3.c: New test file.
250         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
251         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
252         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
253         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
254         * testsuite/Makefile.in: Rebuild.
255
256 2011-07-07  Cary Coutant  <ccoutant@google.com>
257
258         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
259         (two_file_test_1_ndebug.o): Likewise.
260         (two_file_test_1b_ndebug.o): Likewise.
261         (two_file_test_2_ndebug.o): Likewise.
262         (two_file_test_main_ndebug.o): Likewise.
263         (incremental_test_2): Link with no-debug versions.
264
265 2011-07-06  Cary Coutant  <ccoutant@google.com>
266
267         * gold/incremental.cc
268         (Output_section_incremental_inputs::write_info_blocks): Check for
269         hidden and internal symbols.
270
271 2011-07-06  Cary Coutant  <ccoutant@google.com>
272
273         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
274         Check disposition for startup file.
275         (Incremental_inputs::report_command_line): Ignore
276         --incremental-startup-unchanged option.
277         * options.cc (General_options::parse_incremental_startup_unchanged):
278         New function.
279         (General_options::General_options): Initialize new data member.
280         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
281         (General_options): Add --incremental-startup-unchanged option.
282         (General_options::incremental_startup_disposition): New function.
283         (General_options::incremental_startup_disposition_): New data member.
284
285 2011-07-06  Cary Coutant  <ccoutant@google.com>
286
287         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
288         input file index to Script_info ctor.
289         (Sized_incremental_binary::do_file_has_changed): Find the
290         command-line argument for files named in scripts.
291         * incremental.h (Script_info::Script_info): New ctor
292         with input file index.
293         (Script_info::input_file_index): New function.
294         (Script_info::input_file_index_): New data member.
295         (Incremental_binary::get_library): Add const.
296         (Incremental_binary::get_script_info): Add const.
297         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
298         * testsuite/Makefile.am (incremental_test_5): New test case.
299         (incremental_test_6): New test case.
300         * testsuite/Makefile.in: Regenerate.
301
302 2011-07-06  Cary Coutant  <ccoutant@google.com>
303
304         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
305         debug output when command lines differ.
306
307 2011-07-06  Cary Coutant  <ccoutant@google.com>
308
309         * incremental.cc (Incremental_inputs::report_command_line): Ignore
310         --incremental-patch option.
311         * layout.cc (Free_list::allocate): Extend allocation beyond original
312         end if enabled.
313         (Layout::make_output_section): Mark sections that should get
314         patch space.
315         * options.cc (parse_percent): New function.
316         * options.h (parse_percent): New function.
317         (DEFINE_percent): New macro.
318         (General_options): Add --incremental-patch option.
319         * output.cc (Output_section::Output_section): Initialize new data
320         members.
321         (Output_section::add_input_section): Print section name when out
322         of patch space.
323         (Output_section::add_output_section_data): Likewise.
324         (Output_section::set_final_data_size): Add patch space when
325         doing --incremental-full.
326         (Output_section::do_reset_address_and_file_offset): Remove patch
327         space.
328         (Output_segment::set_section_list_addresses): Print debug output
329         only if --incremental-update.
330         * output.h (Output_section::set_is_patch_space_allowed): New function.
331         (Output_section::is_patch_space_allowed_): New data member.
332         (Output_section::patch_space_): New data member.
333         * parameters.cc (Parameters::incremental_full): New function.
334         * parameters.h (Parameters::incremental_full): New function
335         * testsuite/Makefile.am (incremental_test_2): Add test for
336         --incremental-patch option.
337         * testsuite/Makefile.in: Regenerate.
338         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
339         (t18): Remove function body.
340
341 2011-07-05  Doug Kwan  <dougkwan@google.com>
342
343         PR gold/12771
344         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
345         Arm_Address type for relocation result.
346         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
347         overflow check.
348         (Arm_relocate_functions::abs32): Use unaligned access.
349         (Arm_relocate_functions::rel32): Ditto.
350         (Arm_relocate_functions::prel31): Ditto.
351         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
352         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
353         static data relocations.
354         * testsuite/Makefile.in: Regnerate.
355         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
356
357 2011-07-05  Ian Lance Taylor  <iant@google.com>
358
359         PR gold/12392
360         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
361         symbols if necessary.
362         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
363
364 2011-07-05  Ian Lance Taylor  <iant@google.com>
365
366         PR gold/12952
367         * resolve.cc (Symbol::override_base_with_special): Simply override
368         version with special symbol version, ignoring previous version.
369
370 2011-07-05  Ian Lance Taylor  <iant@google.com>
371
372         * object.cc (Sized_relobj_file::include_section_group): Add
373         information to comment about signature location.
374
375 2011-07-02  Ian Lance Taylor  <iant@google.com>
376
377         PR gold/12957
378         * options.h (class General_options): Add -f and -F.
379         * options.cc (General_options::finalize): Fatal error if -f/-F
380         are used without -shared.
381         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
382
383 2011-07-02  Ian Lance Taylor  <iant@google.com>
384
385         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
386
387 2011-07-01  Ian Lance Taylor  <iant@google.com>
388
389         PR gold/12525
390         PR gold/12952
391         * resolve.cc (Symbol::override_base_with_special): Don't override
392         the version if the overriding symbol has a different name.
393         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
394         all callers.  If we give an error about an undefined version,
395         define the base version if necessary.
396         * dynobj.h (class Versions): Update declaration.
397         * testsuite/weak_alias_test_5.cc: New file.
398         * testsuite/weak_alias_test.script: New file.
399         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
400         and versioned_alias have the right value, and call t2.
401         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
402         weak_alias_test_5.so.
403         (weak_alias_test_LDADD): Likewise.
404         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
405         * testsuite/Makefile.in: Rebuild.
406
407 2011-07-01  Ian Lance Taylor  <iant@google.com>
408
409         PR gold/12525
410         * options.h (class General_options): Support -z notext.
411         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
412         -Wl,-z,notext.
413         (two_file_shared_nonpic.so): Likewise.
414         (two_file_shared_mixed.so): Likewise.
415         (two_file_shared_mixed_1.so): Likewise.
416         (weak_undef_lib_nonpic.so): Likewise.
417         (alt/weak_undef_lib_nonpic.so): Likewise.
418         (tls_test_shared_nonpic.so): Likewise.
419         * testsuite/Makefile.in: Rebuild.
420
421 2011-07-01  Ian Lance Taylor  <iant@google.com>
422
423         PR gold/12525
424         * configure.ac: Test whether static linking works, setting
425         the automake conditional HAVE_STATIC.
426         * testsuite/Makefile.am: Disable tests using -static if
427         HAVE_STATIC is not true.
428         * configure, testsuite/Makefile.in: Rebuild.
429
430 2011-07-01  Ian Lance Taylor  <iant@google.com>
431
432         PR gold/12525
433         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
434         Assert if we see DW_EH_PE_indirect.
435         * target.h (Target::ehframe_datarel_base): New function.
436         (Target::do_ehframe_datarel_base): New target function.
437         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
438         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
439         function.
440
441 2011-07-01  Ian Lance Taylor  <iant@google.com>
442
443         PR gold/12571
444         * options.h (class General_options): Add
445         --ld-generated-unwind-info.
446         * ehframe.cc (Fde::write): Add address parameter.  Change all
447         callers.  If associated with PLT, fill in address and size.
448         (Cie::set_output_offset): Only add merge mapping if there is an
449         object.
450         (Cie::write): Add address parameter.  Change all callers.
451         (Eh_frame::add_ehframe_for_plt): New function.
452         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
453         input_offset_ fields into union u_, with new plt field.
454         (Fde::Fde): Adjust for new union field.
455         (Fde::Fde) [Output_data version]: New constructor.
456         (Fde::add_mapping): Only add merge mapping if there is an object.
457         (class Cie): Update declarations.
458         (class Eh_frame): Declare add_ehframe_for_plt.
459         * layout.cc (Layout::layout_eh_frame): Break out code into
460         make_eh_frame_section, and call it.
461         (Layout::make_eh_frame_section): New function.
462         (Layout::add_eh_frame_for_plt): New function.
463         * layout.h (class Layout): Update declarations.
464         * merge.cc (Merge_map::add_mapping): Add assertion.
465         * i386.cc: Include "dwarf.h".
466         (class Output_data_plt_i386): Make first_plt_entry,
467         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
468         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
469         and plt_eh_frame_fde.
470         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
471         boundary.  Call add_eh_frame_for_plt if appropriate.
472         * x86_64.cc: Include "dwarf.h".
473         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
474         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
475         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
476         and plt_eh_frame_fde.
477         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
478         appropriate.
479
480 2011-06-29  Ian Lance Taylor  <iant@google.com>
481
482         PR gold/12629
483         * object.cc (Sized_relobj_file::layout_section): Change shdr
484         parameter to be const.
485         (Sized_relobj_file::layout_eh_frame_section): New function, broken
486         out of do_layout.
487         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
488         appropriate.  Call layout_eh_frame_section.
489         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
490         sections.
491         * object.h (class Sized_relobj_file): Update declarations.
492
493 2011-06-29  Ian Lance Taylor  <iant@google.com>
494
495         PR gold/12652
496         * script.cc (Token::integer_value): Accept trailing M/m/K/k
497         modifier.
498         (Lex::gather_token): Accept trailing M/m/K/k for integers.
499
500 2011-06-29  Ian Lance Taylor  <iant@google.com>
501
502         PR gold/12675
503         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
504         SHT_X86_64_UNWIND.
505         * layout.cc (Layout::layout_eh_frame): Likewise.
506
507 2011-06-29  Ian Lance Taylor  <iant@google.com>
508
509         PR gold/12695
510         * layout.cc (Layout::symtab_section_shndx): New function.
511         * layout.h (class Layout): Declare symtab_section_shndx.
512         * output.cc (Output_section::write_header): Call it.
513
514 2011-06-29  Ian Lance Taylor  <iant@google.com>
515
516         PR gold/12818
517         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
518         symbols which are not used in a relocation.
519
520 2011-06-28  Ian Lance Taylor  <iant@google.com>
521
522         PR gold/12898
523         * layout.cc (Layout::segment_precedes): Don't crash if a linker
524         script create indistinguishable segments.
525         (Layout::set_segment_offsets): Use stable_sort when sorting
526         segments.  Pass this to Compare_segments constructor.
527         * layout.h (class Layout): Make segment_precedes non-static.
528         (class Compare_segments): Change from struct to class.  Add
529         layout_ field.  Add constructor.
530         * script-sections.cc
531         (Script_sections::attach_sections_using_phdrs_clause): Rename
532         local orphan to is_orphan.  Don't report failure to put empty
533         section in segment.  On attachment failure, report name of
534         section, and attach to first PT_LOAD segment.
535
536 2011-06-28  Ian Lance Taylor  <iant@google.com>
537
538         PR gold/12934
539         * target-select.cc (Target_selector::Target_selector): Add
540         emulation parameter.  Change all callers.
541         (select_target_by_bfd_name): Rename from select_target_by_name.
542         Change all callers.
543         (select_target_by_emulation): New function.
544         (supported_emulation_names): New function.
545         * target-select.h (class Target_selector): Add emulation_ field.
546         Update declarations.
547         (Target_selector::recognize_by_bfd_name): Rename from
548         recognize_by_name.  Change all callers.
549         (Target_selector::supported_bfd_names): Rename from
550         supported_names.  Change all callers.
551         (Target_selector::recognize_by_emulation): New function.
552         (Target_selector::supported_emulations): New function.
553         (Target_selector::emulation): New function.
554         (Target_selector::do_recognize_by_bfd_name): Rename from
555         do_recognize_by_name.  Change all callers.
556         (Target_selector::do_supported_bfd_names): Rename from
557         do_supported_names.  Change all callers.
558         (Target_selector::do_recognize_by_emulation): New function.
559         (Target_selector::do_supported_emulations): New function.
560         (select_target_by_bfd_name): Change name in declaration.
561         (select_target_by_emulation): Declare.
562         (supported_emulation_names): Declare.
563         * parameters.cc (parameters_force_valid_target): Try to find
564         target based on emulation from -m option.
565         * options.h (class General_options): Change doc string for -m.
566         * options.cc (help): Print emulations.
567         (General_options::parse_V): Likewise.
568         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
569         Add emulation parameter.  Change all callers.
570
571 2011-06-28  Ian Lance Taylor  <iant@google.com>
572
573         * target.h (class Target): Add osabi_ field.
574         (Target::osabi): New function.
575         (Target::set_osabi): New function.
576         (Target::Target): Initialize osabi_.
577         (Target::do_adjust_elf_header): Make pure virtual.
578         (Sized_target::do_adjust_elf_header): Declare.
579         * target.cc (Sized_target::do_adjust_elf_header): New function.
580         (class Sized_target): Instantiate all versions.
581         * freebsd.h (class Target_freebsd): Remove.
582         (Target_selector_freebsd::do_recognize): Call set_osabi on
583         Target.
584         (Target_selector_freebsd::do_recognize_by_name): Likewise.
585         (Target_selector_freebsd::set_osabi): Remove.
586         * i386.cc (class Target_i386): Inherit from Sized_target rather
587         than Target_freebsd.
588         * x86_64.cc (class Target_x86_64): Likewise.
589
590 2011-06-28  Ian Lance Taylor  <iant@google.com>
591
592         * target.h (Target::can_check_for_function_pointers): Rewrite.
593         Make non-virtual.
594         (Target::can_icf_inline_merge_sections): Likewise.
595         (Target::section_may_have_icf_unsafe_poineters): Likewise.
596         (Target::Target_info): Add can_icf_inline_merge_sections field.
597         (Target::do_can_check_for_function_pointers): New virtual
598         function.
599         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
600         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
601         from can_check_for_function_pointers, move in file.
602         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
603         section_may_have_icf_unsafe_poineters, move in file.
604         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
605         * i386.cc (Target_i386::do_can_check_for_function_pointers):
606         Rename from can_check_for_function_pointers, move in file.
607         (Target_i386::can_icf_inline_merge_sections): Remove.
608         (Target_i386::i386_info): Initialize
609         can_icf_inline_merge_sections.
610         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
611         Initialize can_icf_inline_merge_sections.
612         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
613         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
614         Rename from can_check_for_function_pointers, move in file.
615         (Target_x86_64::can_icf_inline_merge_sections): Remove.
616         (Target_x86_64::x86_64_info): Initialize
617         can_icf_inline_merge_sections.
618         * testsuite/testfile.cc (Target_test::test_target_info):
619         Likewise.
620         * icf.cc (get_section_contents): Correct formatting.
621
622 2011-06-27  Ian Lance Taylor  <iant@google.com>
623
624         * symtab.cc (Symbol::versioned_name): New function.
625         (Symbol_table::add_to_final_symtab): Use versioned_name when
626         appropriate.
627         (Symbol_table::sized_write_symbol): Likewise.
628         * symtab.h (class Symbol): Declare versioned_name.
629         * stringpool.h (class Stringpool_template): Add variant of add
630         which takes a std::basic_string.
631         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
632         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
633         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
634         (ver_test_12.o): New target.
635         * testsuite/Makefile.in: Rebuild.
636
637 2011-06-27  Doug Kwan  <dougkwan@google.com>
638
639         * arm.cc (Arm_relocate_functions::thm_jump8,
640         Arm_relocate_functions::thm_jump11): Use a wider signed
641         type to compute offset.
642         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
643         arm_thm_jump8.
644         * testsuite/Makefile.in: Regenerate.
645         * testsuite/arm_branch_in_range.sh: Check test results of
646         arm_thm_jump11 and arm_thm_jump8.
647         * testsuite/arm_thm_jump11.s: New test source file.
648         * testsuite/arm_thm_jump11.t: New linker script.
649         * testsuite/arm_thm_jump8.s: New test source file.
650         * testsuite/arm_thm_jump8.t: New linker script.
651
652 2011-06-24  Ian Lance Taylor  <iant@google.com>
653
654         * layout.cc: Include "object.h".
655         (ctors_sections_in_init_array): New static variable.
656         (Layout::is_ctors_in_init_array): New function.
657         (Layout::layout): Add entry to ctors_sections_in_init_array if
658         appropriate.
659         * layout.h (class Layout): Declare is_ctors_in_init_array.
660         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
661         is_ctors_reverse_view is set.
662         (Sized_relobj_file::write_sections): Add layout parameter.  Change
663         all callers.  Set is_ctors_reverse_view field of View_size.
664         (Sized_relobj_file::reverse_words): New function.
665         * object.h (Sized_relobj_file::View_size): Add
666         is_ctors_reverse_view field.
667         (class Sized_relobj_file): Update declarations.
668         * testsuite/initpri3.c: New test.
669         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
670         initpri3b.
671         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
672         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
673         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
674         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
675         * testsuite/Makefile.in: Rebuild.
676
677 2011-06-24  Cary Coutant  <ccoutant@google.com>
678
679         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
680         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
681         (debug_msg_cdebug.err): New targets.
682         * testsuite/Makefile.in: Regenerate.
683         * testsuite/debug_msg.sh: Check output of link with compressed debug.
684         Fix checks for link with shared library.
685
686 2011-06-24  Doug Kwan  <dougkwan@google.com>
687
688         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
689         skip empty text sections.
690         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
691
692 2011-06-22  Ian Lance Taylor  <iant@google.com>
693
694         PR gold/12910
695         * options.h (class General_options): Add --ctors-in-init-array.
696         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
697         friends as SHT_PROGBITS for merging sections.
698         (Layout::layout): Remove special handling of .init_array and
699         friends.  Don't sort if doing relocatable link.  Sort for .ctors
700         and .dtors if ctors_in_init_array.
701         (Layout::make_output_section): Force correct section types for
702         .init_array and friends.  Don't sort if doing relocatable link,
703         Don't sort .ctors and .dtors if ctors_in_init_array.
704         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
705         (Layout::output_section_name): Add relobj parameter.  Change all
706         callers.  Handle .ctors. and .dtors. in code rather than table.
707         Handle .ctors and .dtors if ctors_in_init_array.
708         (Layout::match_file_name): New function, moved from output.cc.
709         * layout.h (class Layout): Update declarations.
710         * output.cc: Include "layout.h".
711         (Input_section_sort_entry::get_priority): New function.
712         (Input_section_sort_entry::match_file_name): Just call
713         Layout::match_file_name.
714         (Output_section::Input_section_sort_init_fini_compare::operator()):
715         Handle .ctors and .dtors.  Sort by explicit priority rather than
716         by name.
717         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
718         * testsuite/initpri2.c: New test.
719         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
720         (check_PROGRAMS): Add initpri2.
721         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
722         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
723         * configure, testsuite/Makefile.in: Rebuild.
724
725 2011-06-19  Ian Lance Taylor  <iant@google.com>
726
727         PR gold/12880
728         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
729         .interp section to a PT_INTERP segment even if we have seen a
730         --dynamic-linker option.  Don't do it if we have seen a PHDRS
731         clause in a linker script.
732         (Layout::finalize): Don't create a .interp section if we've
733         already create a PT_INTERP segment.
734         (Layout::create_interp): Always call choose_output_section (revert
735         patch of 2011-06-17).  Don't create PT_INTERP segment.
736         * script-sections.cc
737         (Script_sections::create_note_and_tls_segments): Add a .interp
738         section to a PT_INTERP segment even if we have seen a
739         --dynamic-linker option.
740
741 2011-06-18  Ian Lance Taylor  <iant@google.com>
742
743         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
744         merely because a non-PT_LOAD segment has a dynamic reloc.
745
746 2011-06-18  Ian Lance Taylor  <iant@google.com>
747
748         * layout.cc (Layout::finish_dynamic_section): Don't create
749         DT_FLAGS entry if not needed.
750
751 2011-06-18  Ian Lance Taylor  <iant@google.com>
752
753         PR gold/12745
754         * layout.cc (Layout::layout_eh_frame): Correct handling of
755         writable .eh_frame section.
756
757 2011-06-17  Ian Lance Taylor  <iant@google.com>
758
759         PR gold/12893
760         * resolve.cc (Symbol_table::resolve): Don't give an error if a
761         symbol is redefined with the exact same object and value.
762
763 2011-06-17  Ian Lance Taylor  <iant@google.com>
764
765         PR gold/12880
766         * layout.h (class Layout): Add interp_segment_ field.
767         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
768         (Layout::attach_allocated_section_to_segment): If making shared
769         library, put .interp section in PT_INTERP segment.
770         (Layout::finalize): Also call create_interp if -dynamic-linker
771         option was used.
772         (Layout::create_interp): Assert that there is no PT_INTERP
773         segment.  If not using a SECTIONS clause, use make_output_section.
774         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
775         * script-sections.cc
776         (Script_sections::create_note_and_tls_segments): If making shared
777         library, put .interp section in PT_INTERP segment.
778
779 2011-06-17  Ian Lance Taylor  <iant@google.com>
780
781         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
782         when making a shared library.
783
784 2011-06-17  Ian Lance Taylor  <iant@google.com>
785
786         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
787         parameter.  Change all callers.  Don't issue warning about PC32
788         against locally defined symbol.
789
790 2011-06-16  Ian Lance Taylor  <iant@google.com>
791
792         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
793         occurs in same object.
794
795 2011-06-14  Alan Modra  <amodra@gmail.com>
796
797         * po/POTFILES.in: Regenerate.
798
799 2011-06-09  Ian Lance Taylor  <iant@google.com>
800
801         * script-sections.cc
802         (Orphan_output_section::set_section_addresses): For a relocatable
803         link set address to 0.
804
805 2011-06-09  Cary Coutant  <ccoutant@google.com>
806
807         PR gold/12804
808         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
809         used with --compress-debug-sections.
810         * gold/object.cc (Sized_relobj_file::do_layout): Report
811         uncompressed size of compressed input sections.
812
813 2011-06-08  Cary Coutant  <ccoutant@google.com>
814
815         PR gold/12804
816         * testsuite/two_file_test_2_v1.cc: Change initialization of
817         v2 to keep it in .data.
818
819 2011-06-07  Cary Coutant  <ccoutant@google.com>
820
821         * common.cc (Symbol_table::do_allocate_commons_list): Call
822         gold_fallback.
823         * errors.cc (Errors::fatal): Adjust call to gold_exit.
824         (Errors::fallback): New function.
825         (gold_fallback): New function.
826         * errors.h (Errors::fallback): New function.
827         * gold.cc (gold_exit): Change status parameter to enum; adjust
828         all callers.
829         (queue_initial_tasks): Call gold_fallback.
830         * gold.h: Include cstdlib.
831         (Exit_status): New enum type.
832         (gold_exit): Change status parameter to enum.
833         (gold_fallback): New function.
834         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
835         (Layout::create_symtab_sections): Likewise.
836         (Layout::create_shdrs): Likewise.
837         * main.cc (main): Adjust call to gold_exit.
838         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
839         (Output_data_got::add_got_entry_pair): Likewise.
840         (Output_section::add_input_section): Likewise.
841         (Output_section::add_output_section_data): Likewise.
842         (Output_segment::set_section_list_addresses): Likewise.
843         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
844
845 2011-06-07  Cary Coutant  <ccoutant@google.com>
846
847         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
848         for incremental links.
849         * output.cc (Output_segment::set_section_list_addresses): Remove
850         FIXME and test for TLS or BSS.
851
852 2011-06-07  Cary Coutant  <ccoutant@google.com>
853
854         * testsuite/Makefile.am: Add incremental_copy_test,
855         incremental_common_test_1.
856         * testsuite/Makefile.in: Regenerate.
857         * testsuite/common_test_1_v1.c: New source file.
858         * testsuite/common_test_1_v2.c: New source file.
859         * testsuite/copy_test_v1.cc: New source file.
860
861 2011-06-07  Cary Coutant  <ccoutant@google.com>
862
863         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
864         update, allocate common from bss section's free list.
865         * incremental-dump.cc (dump_incremental_inputs): Print flag for
866         linker-defined symbols.
867         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
868         Skip GOT and PLT entries that are no longer referenced.
869         (Output_section_incremental_inputs::write_info_blocks): Mark
870         linker-defined symbols.
871         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
872         * output.cc (Output_section::allocate): New function.
873         * output.h (Output_section::allocate): New function.
874         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
875         linker-defined symbols.
876         (Symbol::override_base_with_special): Copy is_predefined_ flag.
877         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
878         (Symbol::init_base_output_data): Likewise.
879         (Symbol::init_base_output_segment): Likewise.
880         (Symbol::init_base_constant): Likewise.
881         (Sized_symbol::init_output_data): Likewise.
882         (Sized_symbol::init_output_segment): Likewise.
883         (Sized_symbol::init_constant): Likewise.
884         (Symbol_table::do_define_in_output_data): Likewise.
885         (Symbol_table::do_define_in_output_segment): Likewise.
886         (Symbol_table::do_define_as_constant): Likewise.
887         * symtab.h (Symbol::is_predefined): New function.
888         (Symbol::init_base_output_data): Add is_predefined parameter.
889         (Symbol::init_base_output_segment): Likewise.
890         (Symbol::init_base_constant): Likewise.
891         (Symbol::is_predefined_): New data member.
892         (Sized_symbol::init_output_data): Add is_predefined parameter.
893         (Sized_symbol::init_output_segment): Likewise.
894         (Sized_symbol::init_constant): Likewise.
895         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
896
897 2011-06-07  Cary Coutant  <ccoutant@google.com>
898
899         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
900         instead of emit_copy_reloc.
901         (Copy_relocs::emit_copy_reloc): Refactor.
902         (Copy_relocs::make_copy_reloc): New function.
903         (Copy_relocs::add_copy_reloc): Remove.
904         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
905         section.
906         (Copy_relocs::make_copy_reloc): New function.
907         (Copy_relocs::add_copy_reloc): Remove.
908         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
909         unchanged input files.
910         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
911         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
912         Reserve BSS space for COPY relocations.
913         (Sized_incremental_binary::do_emit_copy_relocs): New function.
914         (Output_section_incremental_inputs::write_info_blocks): Record
915         whether a symbol is copied from a shared object.
916         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
917         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
918         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
919         (Incremental_input_entry_reader::get_output_symbol_index): Add
920         is_copy parameter.
921         (Incremental_binary::emit_copy_relocs): New function.
922         (Incremental_binary::do_emit_copy_relocs): New function.
923         (Sized_incremental_binary::Sized_incremental_binary): Initialize
924         new data member.
925         (Sized_incremental_binary::add_copy_reloc): New function.
926         (Sized_incremental_binary::do_emit_copy_relocs): New function.
927         (Sized_incremental_binary::Copy_reloc): New struct.
928         (Sized_incremental_binary::Copy_relocs): New typedef.
929         (Sized_incremental_binary::copy_relocs_): New data member.
930         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
931         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
932         * target.h (Sized_target::emit_copy_reloc): New function.
933         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
934
935 2011-06-02  Cary Coutant  <ccoutant@google.com>
936
937         PR gold/12163
938         * gold/archive.cc (Archive::Archive): Initialize new data member.
939         (Archive::include_all_members): Return if archive has already been
940         included.
941         * gold/archive.h (Archive::include_all_members_): New data member.
942
943 2011-06-02  Nick Clifton  <nickc@redhat.com>
944
945         * dynobj.h: Fix spelling mistake in comment.
946         * output.cc: Likewise.
947
948 2011-05-31  Doug Kwan  <dougkwan@google.com>
949             Asier Llano
950
951         PR gold/12826
952         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
953         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
954         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
955         redundant arm_exidx_test.so.
956         * testsuite/Makefile.in: Regenerate.
957         (check_SCRIPTS): Add pr12826.sh
958         (check_DATA): Add pr12826.stdout
959         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
960         * testsuite/pr12826.sh: New file.
961         * testsuite/pr12826_1.s: Ditto.
962         * testsuite/pr12826_1.s: Ditto.
963
964 2011-05-30  Ian Lance Taylor  <iant@google.com>
965
966         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
967         sections.
968
969 2011-05-29  Ian Lance Taylor  <iant@google.com>
970
971         PR gold/12804
972         * testsuite/Makefile.am: Use different file name for two_file_test
973         temporary file for each incremental test.
974         * testsuite/Makefile.in: Rebuild.
975
976 2011-05-29  Ian Lance Taylor  <iant@google.com>
977
978         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
979         binary input file is empty.
980
981 2011-05-27  Ian Lance Taylor  <iant@google.com>
982
983         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
984         (ver_test_9.so): Likewise.
985         * testsuite/Makefile.in: Rebuild.
986
987 2011-05-26 Cary Coutant  <ccoutant@google.com>
988
989         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
990         * incremental.cc (Incremental_inputs::report_input_section): Fix
991         comment, indentation.
992         (Incremental_inputs::report_comdat_group): New function.
993         (Output_section_incremental_inputs::set_final_data_size): Adjust size
994         of data for incremental input file entry.
995         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
996         group count, COMDAT group signatures.
997         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
998         an unchanged input file.
999         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1000         Initialize new data member.
1001         (Incremental_object_entry::add_comdat_group): New function.
1002         (Incremental_object_entry::get_comdat_group_count): New function.
1003         (Incremental_object_entry::get_comdat_signature_key): New function.
1004         (Incremental_object_entry::groups_): New data member.
1005         (Incremental_inputs::report_comdat_group): New function.
1006         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1007         data for incremental input file entry.
1008         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1009         (Incremental_input_entry_reader::get_input_section): Adjust size of
1010         data for incremental input file entry.
1011         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1012         (Incremental_input_entry_reader::get_comdat_group_signature): New
1013         function.
1014         * object.cc (Sized_relobj::include_section_group): Report kept
1015         COMDAT groups for incremental links.
1016
1017 2011-05-24  David Meyer  <pdox@google.com>
1018
1019         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1020         with name parameter.  Add found_name parameter.
1021         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1022         * dirsearch.h (class Dirsearch): Update declaration.
1023
1024 2011-05-24  Ian Lance Taylor  <iant@google.com>
1025
1026         * archive.cc (Library_base::should_include_member): Pull in object
1027         from archive if it defines the entry symbol.
1028         * parameters.cc (Parameters::entry): New function.
1029         * parameters.h (class Parameters): Declare entry.
1030         * output.h (class Output_file_header): Remove entry_ field.
1031         * output.cc (Output_file_header::Output_file_header): Remove entry
1032         parameter.  Change all callers.
1033         (Output_file_header::entry): Use parameters->entry.
1034         * gold.cc (queue_middle_tasks): Likewise.
1035         * plugin.cc (Plugin_hook::run): Likewise.
1036
1037 2011-05-24 Cary Coutant  <ccoutant@google.com>
1038
1039         * gold.cc (queue_initial_tasks): Pass incremental base filename
1040         to Output_file::open_base_file; don't print error message.
1041         * incremental-dump.cc (main): Adjust call to
1042         Output_file::open_for_modification.
1043         * incremental-dump.cc (main): Likewise.
1044         * incremental.cc (Incremental_inputs::report_command_line):
1045         Ignore --incremental-base option when comparing command lines.
1046         Ignore parameter when given as separate argument.
1047         * options.h (class General_options): Add --incremental-base.
1048         * output.cc (Output_file::Output_file):
1049         (Output_file::open_base_file): Add base_name and writable parameters;
1050         read base file into new file; print error message here.
1051         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1052         callers.
1053         * output.h (Output_file::open_for_modification): Rename to...
1054         (Output_file::open_base_file): ...this; add base_name and
1055         writable parameters; adjust all callers.
1056         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1057         callers.
1058         * testsuite/Makefile.am (incremental_test_4): Test
1059         --incremental-base.
1060         * testsuite/Makefile.in: Regenerate.
1061
1062 2011-05-24 Cary Coutant  <ccoutant@google.com>
1063
1064         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1065         incremental_test_4.
1066         * testsuite/Makefile.in: Regenerate.
1067         * testsuite/two_file_test_1_v1.cc: New test source file.
1068         * testsuite/two_file_test_1b_v1.cc: New test source file.
1069         * testsuite/two_file_test_2_v1.cc: New test source file.
1070
1071 2011-05-24 Cary Coutant  <ccoutant@google.com>
1072
1073         * dynobj.h (Dynobj::do_dynobj): New function.
1074         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1075         flag and soname for shared objects.
1076         * incremental.cc (Incremental_inputs::report_object): Make
1077         either Incremental_object_entry or Incremental_dynobj_entry; add
1078         soname to string table.
1079         (Incremental_inputs::report_input_section): Add assertion.
1080         (Output_section_incremental_inputs::set_final_data_size): Adjust
1081         type of input file entry for shared libraries; adjust size of
1082         shared library info entry.
1083         (Output_section_incremental_inputs::write_input_files): Write
1084         as_needed flag for shared libraries.
1085         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1086         of input file entry for shared libraries; write soname.
1087         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1088         soname from incremental info.
1089         * incremental.h (enum Incremental_input_flags): Add
1090         INCREMENTAL_INPUT_AS_NEEDED.
1091         (Incremental_input_entry::Incremental_input_entry): Initialize new
1092         data member.
1093         (Incremental_input_entry::set_as_needed): New function.
1094         (Incremental_input_entry::as_needed): New function.
1095         (Incremental_input_entry::do_dynobj_entry): New function.
1096         (Incremental_input_entry::as_needed_): New data member.
1097         (Incremental_object_entry::Incremental_object_entry): Don't check
1098         for shared library.
1099         (Incremental_object_entry::do_type): Likewise.
1100         (class Incremental_dynobj_entry): New class.
1101         (Incremental_input_entry_reader::as_needed): New function.
1102         (Incremental_input_entry_reader::get_soname): New function.
1103         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1104         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1105         size of shared library info entry.
1106         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1107         incremental link when adding DT_NEEDED entries.
1108         * object.h (Object::Object): Initialize new data member.
1109         (Object::dynobj): New function.
1110         (Object::set_as_needed): New function.
1111         (Object::as_needed): New function.
1112         (Object::do_dynobj): New function.
1113         (Object::as_needed_): New data member.
1114
1115 2011-05-24 Cary Coutant  <ccoutant@google.com>
1116
1117         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1118         info; adjust display of GOT entries.
1119         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1120         vector of input objects; remove file_status_.
1121         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1122         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1123         got_plt reader; call target hooks to reserve GOT entries.
1124         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1125         of input file info header and GOT info entry.
1126         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1127         relocation info.
1128         (Got_plt_view_info::got_descriptor): Remove.
1129         (Got_plt_view_info::sym_index): New data member.
1130         (Got_plt_view_info::input_index): New data member.
1131         (Local_got_offset_visitor::visit): Write input file index.
1132         (Global_got_offset_visitor::visit): Write 0 for input file index.
1133         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1134         with sym_index and input_index.
1135         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1136         incremental info GOT entry; replace got_descriptor with input_index.
1137         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1138         map from input file index to object.
1139         (Sized_relobj_incr::do_layout): Replace direct data member reference
1140         with accessor function.
1141         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1142         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1143         Adjust size of input file info header.
1144         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1145         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1146         (Incremental_input_entry_reader::get_input_section): Adjust size of
1147         input file info header.
1148         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1149         of incremental info GOT entry.
1150         (Incremental_got_plt_reader::get_got_desc): Remove.
1151         (Incremental_got_plt_reader::get_got_symndx): New function.
1152         (Incremental_got_plt_reader::get_got_input_index): New function.
1153         (Sized_incremental_binary::Sized_incremental_binary): Remove
1154         file_status_; add input_objects_.
1155         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1156         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1157         (Sized_incremental_binary::file_is_unchanged): Remove.
1158         (Sized_incremental_binary::set_input_object): New function.
1159         (Sized_incremental_binary::input_object): New function.
1160         (Sized_incremental_binary::file_status_): Remove.
1161         (Sized_incremental_binary::input_objects_): New data member.
1162         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1163         references.
1164         (Sized_relobj_incr::invalid_address): Move to base class.
1165         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1166         class.
1167         (Sized_relobj_incr::do_output_section_offset): Likewise.
1168         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1169         (Sized_relobj_incr::section_offsets_): Likewise.
1170         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1171         function.
1172         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1173         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1174         with accessor function.
1175         (Sized_relobj_file::do_layout): Likewise.
1176         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1177         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1178         (Sized_relobj_file::compute_final_local_value): Replace refs to
1179         section_offsets_ with accessor function.
1180         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1181         * object.h (Relobj::Relobj): Initialize new data members.
1182         (Relobj::add_dyn_reloc): New function.
1183         (Relobj::first_dyn_reloc): New function.
1184         (Relobj::dyn_reloc_count): New function.
1185         (Relobj::first_dyn_reloc_): New data member.
1186         (Relobj::dyn_reloc_count_): New data member.
1187         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1188         references.
1189         (Sized_relobj::Address): New typedef.
1190         (Sized_relobj::invalid_address): Move here from child class.
1191         (Sized_relobj::Sized_relobj): Initialize new data members.
1192         (Sized_relobj::sized_relobj): New function.
1193         (Sized_relobj::is_output_section_offset_invalid): Move here from
1194         child class.
1195         (Sized_relobj::get_output_section_offset): Likewise.
1196         (Sized_relobj::local_has_got_offset): Likewise.
1197         (Sized_relobj::local_got_offset): Likewise.
1198         (Sized_relobj::set_local_got_offset): Likewise.
1199         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1200         (Sized_relobj::clear_got_offsets): New function.
1201         (Sized_relobj::section_offsets): Move here from child class.
1202         (Sized_relobj::do_output_section_offset): Likewise.
1203         (Sized_relobj::do_set_section_offset): Likewise.
1204         (Sized_relobj::Local_got_offsets): Likewise.
1205         (Sized_relobj::local_got_offsets_): Likewise.
1206         (Sized_relobj::section_offsets_): Likewise.
1207         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1208         references.
1209         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1210         class.
1211         (Sized_relobj_file::sized_relobj): New function
1212         (Sized_relobj_file::local_has_got_offset): Move to base class.
1213         (Sized_relobj_file::local_got_offset): Likewise.
1214         (Sized_relobj_file::set_local_got_offset): Likewise.
1215         (Sized_relobj_file::get_output_section_offset): Likewise.
1216         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1217         (Sized_relobj_file::do_output_section_offset): Likewise.
1218         (Sized_relobj_file::do_set_section_offset): Likewise.
1219         (Sized_relobj_file::Local_got_offsets): Likewise.
1220         (Sized_relobj_file::local_got_offsets_): Likewise.
1221         (Sized_relobj_file::section_offsets_): Likewise.
1222         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1223         (all constructors).
1224         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1225         (Output_reloc::get_symbol_index): Likewise.
1226         (Output_reloc::local_section_offset): Likewise.
1227         (Output_reloc::get_address): Likewise.
1228         (Output_reloc::symbol_value): Likewise.
1229         (Output_data_got::reserve_slot): Move to class definition.
1230         (Output_data_got::reserve_local): New function.
1231         (Output_data_got::reserve_slot_for_global): Remove.
1232         (Output_data_got::reserve_global): New function.
1233         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1234         (all constructors, two instantiations).
1235         (Output_reloc::get_relobj): New function (two instantiations).
1236         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1237         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1238         (Output_data_reloc::add_global): Adjust type of relobj.
1239         (Output_data_reloc::add_global_relative): Likewise.
1240         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1241         (Output_data_reloc::add_local): Likewise.
1242         (Output_data_reloc::add_local_relative): Likewise.
1243         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1244         (Output_data_reloc::add_local_section): Likewise.
1245         (Output_data_reloc::add_output_section): Likewise.
1246         (Output_data_reloc::add_absolute): Likewise.
1247         (Output_data_reloc::add_target_specific): Likewise.
1248         (Output_data_got::reserve_slot): Move definition here.
1249         (Output_data_got::reserve_local): New function.
1250         (Output_data_got::reserve_global): New function.
1251         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1252         section_offsets_ with accessor function.
1253         (Sized_relobj_file::write_sections): Likewise.
1254         (Sized_relobj_file::do_relocate_sections): Likewise.
1255         * target.h (Sized_target::reserve_local_got_entry): New function.
1256         (Sized_target::reserve_global_got_entry): New function.
1257         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1258         (Target_x86_64::reserve_global_got_entry): New function.
1259         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1260
1261 2011-05-23 Cary Coutant  <ccoutant@google.com>
1262
1263         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1264         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1265         bit when checking got_type.
1266         * incremental.cc (Sized_incremental_binary::setup_readers):
1267         Store symbol table and string table locations; initialize bit vector
1268         of file status flags.
1269         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1270         unchanged files.
1271         (Sized_incremental_binary::do_process_got_plt): New function.
1272         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1273         (Output_section_incremental_inputs::set_final_data_size): Record
1274         file index for each input file.
1275         (Output_section_incremental_inputs::write_got_plt): Store file index
1276         instead of input entry offset for each GOT entry.
1277         * incremental.h
1278         (Incremental_input_entry::Incremental_input_entry): Initialize new
1279         data member.
1280         (Incremental_input_entry::set_offset): Store file index.
1281         (Incremental_input_entry::get_file_index): New function.
1282         (Incremental_input_entry::file_index_): New data member.
1283         (Incremental_binary::process_got_plt): New function.
1284         (Incremental_binary::do_process_got_plt): New function.
1285         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1286         data members.
1287         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1288         (Sized_incremental_binary::set_file_is_unchanged): New function.
1289         (Sized_incremental_binary::file_is_unchanged): New function.
1290         (Sized_incremental_binary::do_process_got_plt): New function.
1291         (Sized_incremental_binary::file_status_): New data member.
1292         (Sized_incremental_binary::main_symtab_loc_): New data member.
1293         (Sized_incremental_binary::main_strtab_loc_): New data member.
1294         * output.cc (Output_data_got::Got_entry::write): Add case
1295         RESERVED_CODE.
1296         (Output_data_got::add_global): Call add_got_entry.
1297         (Output_data_got::add_global_plt): Likewise.
1298         (Output_data_got::add_global_with_rel): Likewise.
1299         (Output_data_got::add_global_with_rela): Likewise.
1300         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1301         (Output_data_got::add_global_pair_with_rela): Likewise.
1302         (Output_data_got::add_local): Call add_got_entry.
1303         (Output_data_got::add_local_plt): Likewise.
1304         (Output_data_got::add_local_with_rel): Likewise.
1305         (Output_data_got::add_local_with_rela): Likewise.
1306         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1307         (Output_data_got::add_local_pair_with_rela): Likewise.
1308         (Output_data_got::reserve_slot): New function.
1309         (Output_data_got::reserve_slot_for_global): New function.
1310         (Output_data_got::add_got_entry): New function.
1311         (Output_data_got::add_got_entry_pair): New function.
1312         (Output_section::add_output_section_data): Edit FIXME.
1313         * output.h
1314         (Output_section_data_build::Output_section_data_build): New
1315         constructor with size parameter.
1316         (Output_data_space::Output_data_space): Likewise.
1317         (Output_data_got::Output_data_got): Initialize new data member; new
1318         constructor with size parameter.
1319         (Output_data_got::add_constant): Call add_got_entry.
1320         (Output_data_got::reserve_slot): New function.
1321         (Output_data_got::reserve_slot_for_global): New function.
1322         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1323         (Output_data_got::add_got_entry): New function.
1324         (Output_data_got::add_got_entry_pair): New function.
1325         (Output_data_got::free_list_): New data member.
1326         * target.h (Sized_target::init_got_plt_for_update): New function.
1327         (Sized_target::register_global_plt_entry): New function.
1328         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1329         Initialize new data member; call init; add constructor with PLT count.
1330         (Output_data_plt_x86_64::init): New function.
1331         (Output_data_plt_x86_64::add_relocation): New function.
1332         (Output_data_plt_x86_64::reserve_slot): New function.
1333         (Output_data_plt_x86_64::free_list_): New data member.
1334         (Target_x86_64::init_got_plt_for_update): New function.
1335         (Target_x86_64::register_global_plt_entry): New function.
1336         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1337         incremental updates.
1338         (Output_data_plt_x86_64::add_relocation): New function.
1339         * testsuite/object_unittest.cc (Object_test): Set default options.
1340
1341 2011-05-16  Ian Lance Taylor  <iant@google.com>
1342
1343         * options.h (class General_options): Make -i a synonym for -r.
1344
1345 2011-05-16  Ian Lance Taylor  <iant@google.com>
1346
1347         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1348
1349 2011-05-10 Cary Coutant  <ccoutant@google.com>
1350
1351         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1352         strip_all (-s).
1353
1354 2011-05-06  Ian Lance Taylor  <iant@google.com>
1355
1356         * layout.cc (Layout::layout): If the output section flags change,
1357         update the ordering.
1358
1359 2011-04-25 Cary Coutant  <ccoutant@google.com>
1360
1361         * incremental-dump.cc (dump_incremental_inputs): Print local
1362         symbol info for each input file.
1363         * incremental.cc
1364         (Output_section_incremental_inputs::set_final_data_size): Add local
1365         symbol info to input file entries in incremental info.
1366         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1367         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1368         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1369         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1370         implementation.
1371         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1372         (Sized_incr_relobj::do_relocate): Write the local symbols.
1373         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1374         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1375         Adjust size of input file header.
1376         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1377         (Incremental_inputs_reader::get_local_symbol_count): New function.
1378         (Incremental_inputs_reader::get_input_section): Adjust size of input
1379         file header.
1380         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1381         (Sized_incr_relobj::This): New typedef.
1382         (Sized_incr_relobj::sym_size): New const data member.
1383         (Sized_incr_relobj::Local_symbol): New struct.
1384         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1385         (Sized_incr_relobj::do_local_symbol_offset): New function.
1386         (Sized_incr_relobj::local_symbol_count_): New data member.
1387         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1388         (Sized_incr_relobj::local_symbol_index_): New data member.
1389         (Sized_incr_relobj::local_symbol_offset_): New data member.
1390         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1391         (Sized_incr_relobj::local_symbols_): New data member.
1392         * object.h (Relobj::output_local_symbol_count): New function.
1393         (Relobj::local_symbol_offset): New function.
1394         (Relobj::do_output_local_symbol_count): New function.
1395         (Relobj::do_local_symbol_offset): New function.
1396         (Sized_relobj::do_output_local_symbol_count): New function.
1397         (Sized_relobj::do_local_symbol_offset): New function.
1398
1399 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1400
1401         * descriptors.cc (set_close_on_exec): New function.
1402         (Descriptors::open): Use set_close_on_exec.
1403         * output.cc (S_ISLNK): Define if not defined.
1404
1405 2011-04-22 Cary Coutant  <ccoutant@google.com>
1406
1407         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1408         global symbol map.
1409         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1410         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1411         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1412         relocations.
1413         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1414         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1415         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1416         * incremental.h
1417         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1418         function.
1419         (Incremental_binary::apply_incremental_relocs): New function.
1420         (Incremental_binary::do_apply_incremental_relocs): New function.
1421         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1422         data member.
1423         (Sized_incremental_binary::add_global_symbol): New function.
1424         (Sized_incremental_binary::global_symbol): New function.
1425         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1426         (Sized_incremental_binary::symbol_map_): New data member.
1427         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1428         * target.h (Sized_target::apply_relocation): New function.
1429         * target-reloc.h (apply_relocation): New function.
1430         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1431
1432 2011-04-22  Doug Kwan  <dougkwan@google.com>
1433
1434         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1435         flag of a SHT_ARM_EXIDX section.
1436         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1437         * testsuite/Makefile.in: Regenerate.
1438         * testsuite/arm_exidx_test.s: New file.
1439         * testsuite/arm_exidx_test.sh: Same.
1440
1441 2011-04-20 Cary Coutant  <ccoutant@google.com>
1442
1443         PR gold/12689
1444         * archive.h (Incremental_archive_entry::Archive_member):
1445         Initialize arg_serial_ (second constructor).
1446
1447 2011-04-17  Ian Lance Taylor  <iant@google.com>
1448
1449         * object.cc (Relocate_info::location): Simplify location string.
1450         * errors.cc (Errors::error_at_location): Don't print program
1451         name.
1452         (Errors::warning_at_location): Likewise.
1453         (Errors::undefined_symbol): Likewise.
1454         * testsuite/debug_msg.sh: Update accordingly.
1455
1456 2011-04-14 Cary Coutant  <ccoutant@google.com>
1457
1458         * gold/layout.cc (Layout::symtab_section_offset): New function.
1459         * gold/layout.h (Layout::symtab_section_offset): New function.
1460         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1461
1462 2011-04-12  Ian Lance Taylor  <iant@google.com>
1463
1464         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1465         with MREMAP_MAYMOVE.
1466         * output.h (class Output_file): Add map_is_allocated_ field.
1467         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1468         not available, provide stubs.  If mremap is not available, #define
1469         it to gold_mremap.
1470         (MREMAP_MAYMOVE): Define if not defined.
1471         (Output_file::Output_file): Initialize map_is_allocated_.
1472         (Output_file::resize): Check map_is_allocated_.
1473         (Output_file::map_anonymous): If mmap fails, use malloc.
1474         (Output_file::unmap): Don't do anything for an anonymous map.
1475         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1476         is not available, provide stubs.
1477         (File_read::View::~View): Use free rather than delete[].
1478         (File_read::make_view): Use malloc rather than new[].  If mmap
1479         fails, use malloc.
1480         (File_read::find_or_make_view): Use malloc rather than new[].
1481         * gold.h: Remove HAVE_REMAP code.
1482         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1483         exists.  Rename mremap to gold_mremap.  If mmap is not available
1484         don't do anything.
1485         * configure, config.in: Rebuild.
1486
1487 2011-04-11  Ian Lance Taylor  <iant@google.com>
1488
1489         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1490         initialize local variable v.
1491
1492 2011-04-11  Cary Coutant  <ccoutant@google.com>
1493
1494         * archive.cc (Archive::include_member): Adjust call to
1495         report_object.
1496         (Add_archive_symbols::run): Track argument serial numbers.
1497         (Lib_group::include_member): Likewise.
1498         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1499         * archive.h (Incremental_archive_entry::Archive_member):
1500         Initialize arg_serial_.
1501         (Archive_member::arg_serial_): New data member.
1502         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1503         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1504         incremental link.
1505         (Sized_dynobj::do_for_all_local_got_entries): New function.
1506         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1507         function.
1508         * fileread.cc (get_mtime): New function.
1509         * fileread.h (get_mtime): New function.
1510         * gold.cc (queue_initial_tasks): Check for incremental update.
1511         (process_incremental_input): New function.
1512         (queue_middle_tasks): Don't force valid target for incremental
1513         update.
1514         * incremental-dump.cc (find_input_containing_global): Adjust
1515         size of symbol info entry.
1516         (dump_incremental_inputs): Dump argument serial number and
1517         in_system_directory flag; bias shndx by 1; print symbol names
1518         when dumping per-file symbol lists; use new symbol info readers.
1519         * incremental.cc
1520         (Output_section_incremental_inputs:update_data_size): New function.
1521         (Sized_incremental_binary::setup_readers): Setup input readers
1522         for each input file; build maps for files added from libraries
1523         and scripts.
1524         (Sized_incremental_binary::check_input_args): New function.
1525         (Sized_incremental_binary::do_check_inputs): Build map of argument
1526         serial numbers to input arguments.
1527         (Sized_incremental_binary::do_file_has_changed): Rename
1528         do_file_is_unchanged to this; compare file modification times.
1529         (Sized_incremental_binary::do_init_layout): New function.
1530         (Sized_incremental_binary::do_reserve_layout): New function.
1531         (Sized_incremental_binary::do_get_input_reader): Remove.
1532         (Sized_incremental_binary::get_symtab_view): New function.
1533         (Incremental_checker::can_incrementally_link_output_file): Remove.
1534         (Incremental_inputs::report_command_line): Exclude --debug options.
1535         (Incremental_inputs::report_archive_begin): Add parameter; track
1536         argument serial numbers; don't put input file entry for archive
1537         before archive members.
1538         (Incremental_inputs::report_archive_end): Put input file entry
1539         for archive after archive members.
1540         (Incremental_inputs::report_object): Add parameter; track argument
1541         serial numbers and in_system_directory flag.
1542         (Incremental_inputs::report_script): Add parameter; track argument
1543         serial numbers.
1544         (Output_section_incremental_inputs::set_final_data_size): Adjust
1545         size of symbol info entry; check for forwarding symbols.
1546         (Output_section_incremental_inputs::write_input_files): Write
1547         in_system_directory flag and argument serial number.
1548         (Output_section_incremental_inputs::write_info_blocks): Map section
1549         indices between incremental info and original input file; store
1550         input section index for each symbol.
1551         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1552         change operator() to visit().
1553         (class Global_got_offset_visitor): Likewise.
1554         (class Global_symbol_visitor_got_plt):
1555         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1556         classes.
1557         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1558         (Sized_incr_relobj::do_read_symbols): New function.
1559         (Sized_incr_relobj::do_layout): New function.
1560         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1561         (Sized_incr_relobj::do_add_symbols): New function.
1562         (Sized_incr_relobj::do_should_include_member): New function.
1563         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1564         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1565         (Sized_incr_relobj::do_section_size): New function.
1566         (Sized_incr_relobj::do_section_name): New function.
1567         (Sized_incr_relobj::do_section_contents): New function.
1568         (Sized_incr_relobj::do_section_flags): New function.
1569         (Sized_incr_relobj::do_section_entsize): New function.
1570         (Sized_incr_relobj::do_section_address): New function.
1571         (Sized_incr_relobj::do_section_type): New function.
1572         (Sized_incr_relobj::do_section_link): New function.
1573         (Sized_incr_relobj::do_section_info): New function.
1574         (Sized_incr_relobj::do_section_addralign): New function.
1575         (Sized_incr_relobj::do_initialize_xindex): New function.
1576         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1577         (Sized_incr_relobj::do_read_relocs): New function.
1578         (Sized_incr_relobj::do_gc_process_relocs): New function.
1579         (Sized_incr_relobj::do_scan_relocs): New function.
1580         (Sized_incr_relobj::do_count_local_symbols): New function.
1581         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1582         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1583         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1584         (Sized_incr_relobj::do_relocate): New function.
1585         (Sized_incr_relobj::do_set_section_offset): New function.
1586         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1587         (Sized_incr_dynobj::do_read_symbols): New function.
1588         (Sized_incr_dynobj::do_layout): New function.
1589         (Sized_incr_dynobj::do_add_symbols): New function.
1590         (Sized_incr_dynobj::do_should_include_member): New function.
1591         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1592         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1593         (Sized_incr_dynobj::do_section_size): New function.
1594         (Sized_incr_dynobj::do_section_name): New function.
1595         (Sized_incr_dynobj::do_section_contents): New function.
1596         (Sized_incr_dynobj::do_section_flags): New function.
1597         (Sized_incr_dynobj::do_section_entsize): New function.
1598         (Sized_incr_dynobj::do_section_address): New function.
1599         (Sized_incr_dynobj::do_section_type): New function.
1600         (Sized_incr_dynobj::do_section_link): New function.
1601         (Sized_incr_dynobj::do_section_info): New function.
1602         (Sized_incr_dynobj::do_section_addralign): New function.
1603         (Sized_incr_dynobj::do_initialize_xindex): New function.
1604         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1605         (make_sized_incremental_object): New function.
1606         (Incremental_library::copy_unused_symbols): New function.
1607         (Incremental_library::do_for_all_unused_symbols): New function.
1608         * incremental.h (enum Incremental_input_flags): New type.
1609         (class Incremental_checker): Remove.
1610         (Incremental_input_entry::Incremental_input_entry): Add argument
1611         serial number.
1612         (Incremental_input_entry::arg_serial): New function.
1613         (Incremental_input_entry::set_is_in_system_directory): New function.
1614         (Incremental_input_entry::is_in_system_directory): New function.
1615         (Incremental_input_entry::arg_serial_): New data member.
1616         (Incremental_input_entry::is_in_system_directory_): New data member.
1617         (class Script_info): Move here from script.h.
1618         (Script_info::Script_info): Add filename parameter.
1619         (Script_info::filename): New function.
1620         (Script_info::filename_): New data member.
1621         (Incremental_script_entry::Incremental_script_entry): Add argument
1622         serial number.
1623         (Incremental_object_entry::Incremental_object_entry): Likewise.
1624         (Incremental_object_entry::add_input_section): Build list of input
1625         sections with map to original shndx.
1626         (Incremental_object_entry::get_input_section_index): New function.
1627         (Incremental_object_entry::shndx_): New data member.
1628         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1629         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1630         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1631         serial number.
1632         (Incremental_inputs::report_archive_begin): Likewise.
1633         (Incremental_inputs::report_object): Likewise.
1634         (Incremental_inputs::report_script): Likewise.
1635         (class Incremental_global_symbol_reader): New class.
1636         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1637         and store flags and input file type.
1638         (Incremental_input_entry_reader::arg_serial): New function.
1639         (Incremental_input_entry_reader::type): Extract type from flags.
1640         (Incremental_input_entry_reader::is_in_system_directory): New function.
1641         (Incremental_input_entry_reader::get_input_section_count): Call
1642         accessor function for type.
1643         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1644         function for type; adjust size of global symbol entry.
1645         (Incremental_input_entry_reader::get_global_symbol_count): Call
1646         accessor function for type.
1647         (Incremental_input_entry_reader::get_object_count): Likewise.
1648         (Incremental_input_entry_reader::get_object_offset): Likewise.
1649         (Incremental_input_entry_reader::get_member_count): Likewise.
1650         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1651         (Incremental_input_entry_reader::get_member_offset): Likewise.
1652         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1653         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1654         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1655         (Incremental_input_entry_reader::get_global_symbol_reader): New
1656         function.
1657         (Incremental_input_entry_reader::get_output_symbol_index): New
1658         function.
1659         (Incremental_input_entry_reader::type_): Remove.
1660         (Incremental_input_entry_reader::flags_): New data member.
1661         (Incremental_inputs_reader::input_file_offset): New function.
1662         (Incremental_inputs_reader::input_file_index): New function.
1663         (Incremental_inputs_reader::input_file): Call input_file_offset.
1664         (Incremental_inputs_reader::input_file_at_offset): New function.
1665         (Incremental_relocs_reader::get_r_type): Reformat.
1666         (Incremental_relocs_reader::get_r_shndx): Reformat.
1667         (Incremental_relocs_reader::get_r_offset): Reformat.
1668         (Incremental_relocs_reader::data): New function.
1669         (Incremental_binary::Incremental_binary): Initialize new data members.
1670         (Incremental_binary::check_inputs): Add cmdline parameter.
1671         (Incremental_binary::file_is_unchanged): Remove.
1672         (Input_reader::arg_serial): New function.
1673         (Input_reader::get_unused_symbol_count): New function.
1674         (Input_reader::get_unused_symbol): New function.
1675         (Input_reader::do_arg_serial): New function.
1676         (Input_reader::do_get_unused_symbol_count): New function.
1677         (Input_reader::do_get_unused_symbol): New function.
1678         (Incremental_binary::input_file_count): New function.
1679         (Incremental_binary::get_input_reader): Change signature to use
1680         index instead of filename.
1681         (Incremental_binary::file_has_changed): New function.
1682         (Incremental_binary::get_input_argument): New function.
1683         (Incremental_binary::get_library): New function.
1684         (Incremental_binary::get_script_info): New function.
1685         (Incremental_binary::init_layout): New function.
1686         (Incremental_binary::reserve_layout): New function.
1687         (Incremental_binary::output_file): New function.
1688         (Incremental_binary::do_check_inputs): New function.
1689         (Incremental_binary::do_file_is_unchanged): Remove.
1690         (Incremental_binary::do_file_has_changed): New function.
1691         (Incremental_binary::do_init_layout): New function.
1692         (Incremental_binary::do_reserve_layout): New function.
1693         (Incremental_binary::do_input_file_count): New function.
1694         (Incremental_binary::do_get_input_reader): Change signature.
1695         (Incremental_binary::input_args_map_): New data member.
1696         (Incremental_binary::library_map_): New data member.
1697         (Incremental_binary::script_map_): New data member.
1698         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1699         new data members.
1700         (Sized_incremental_binary::output_section): New function.
1701         (Sized_incremental_binary::inputs_reader): Add const.
1702         (Sized_incremental_binary::symtab_reader): Add const.
1703         (Sized_incremental_binary::relocs_reader): Add const.
1704         (Sized_incremental_binary::got_plt_reader): Add const.
1705         (Sized_incremental_binary::get_symtab_view): New function.
1706         (Sized_incremental_binary::Inputs_reader): New typedef.
1707         (Sized_incremental_binary::Input_entry_reader): New typedef.
1708         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1709         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1710         (Sized_incremental_binary::do_file_has_changed): New function.
1711         (Sized_incremental_binary::do_init_layout): New function.
1712         (Sized_incremental_binary::do_reserve_layout): New function.
1713         (Sized_input_reader::Inputs_reader): Remove.
1714         (Sized_input_reader::Input_entry_reader): Remove.
1715         (Sized_input_reader::do_arg_serial): New function.
1716         (Sized_input_reader::do_get_unused_symbol_count): New function.
1717         (Sized_input_reader::do_get_unused_symbol): New function.
1718         (Sized_incremental_binary::do_input_file_count): New function.
1719         (Sized_incremental_binary::do_get_input_reader): Change signature;
1720         use index instead of filename.
1721         (Sized_incremental_binary::section_map_): New data member.
1722         (Sized_incremental_binary::input_entry_readers_): New data member.
1723         (class Sized_incr_relobj): New class.
1724         (class Sized_incr_dynobj): New class.
1725         (make_sized_incremental_object): New function.
1726         (class Incremental_library): New class.
1727         * layout.cc (Free_list::num_lists): New static data member.
1728         (Free_list::num_nodes): New static data member.
1729         (Free_list::num_removes): New static data member.
1730         (Free_list::num_remove_visits): New static data member.
1731         (Free_list::num_allocates): New static data member.
1732         (Free_list::num_allocate_visits): New static data member.
1733         (Free_list::init): New function.
1734         (Free_list::remove): New function.
1735         (Free_list::allocate): New function.
1736         (Free_list::dump): New function.
1737         (Free_list::print_stats): New function.
1738         (Layout_task_runner::run): Resize output file for incremental updates.
1739         (Layout::Layout): Initialize new data members.
1740         (Layout::set_incremental_base): New function.
1741         (Layout::init_fixed_output_section): New function.
1742         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1743         incremental updates.
1744         (Layout::create_gold_note): Do not create gold note section for
1745         incremental updates.
1746         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1747         for incremental updates.
1748         (Layout::set_section_offsets): For incremental updates, allocate space
1749         from free list.
1750         (Layout::create_symtab_sections): Layout with offsets relative to
1751         start of section; for incremental updates, allocate space from free
1752         list.
1753         (Layout::create_shdrs): For incremental updates, allocate space from
1754         free list.
1755         (Layout::finish_dynamic_section): For incremental updates, do not
1756         check --as-needed (fixed in subsequent patch).
1757         * layout.h (class Free_list): New class.
1758         (Layout::set_incremental_base): New function.
1759         (Layout::incremental_base): New function.
1760         (Layout::init_fixed_output_section): New function.
1761         (Layout::allocate): New function.
1762         (Layout::incremental_base_): New data member.
1763         (Layout::free_list_): New data member.
1764         * main.cc (main): Print Free_list statistics.
1765         * object.cc (Relobj::finalize_incremental_relocs): Add
1766         clear_counts parameter; clear counts only when clear_counts is set.
1767         (Sized_relobj::Sized_relobj): Initialize new base class.
1768         (Sized_relobj::do_layout): Don't report special sections.
1769         (Sized_relobj::do_for_all_local_got_entries): New function.
1770         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1771         symtab_off to all symbol table offsets.
1772         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1773         * object.h (class Got_offset_list): Move to top of file.
1774         (Object::Object): Allow case where input_file == NULL.
1775         (Object::~Object): Likewise.
1776         (Object::input_file): Assert that input_file != NULL.
1777         (Object::lock): Allow case where input_file == NULL.
1778         (Object::unlock): Likewise.
1779         (Object::is_locked): Likewise.
1780         (Object::token): Likewise.
1781         (Object::release): Likewise.
1782         (Object::is_incremental): New function.
1783         (Object::get_mtime): New function.
1784         (Object::for_all_local_got_entries): New function.
1785         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1786         (Object::set_is_in_system_directory): New function.
1787         (Object::is_in_system_directory): New function.
1788         (Object::do_is_incremental): New function.
1789         (Object::do_get_mtime): New function.
1790         (Object::do_for_all_local_got_entries): New function.
1791         (Object::is_in_system_directory_): New data member.
1792         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1793         (class Sized_relobj_base): New class.
1794         (class Sized_relobj): Derive from Sized_relobj_base.
1795         (class Sized_relobj::Symbols): Redeclare from base class.
1796         (class Sized_relobj::local_got_offset_list): Remove.
1797         (class Sized_relobj::Output_sections): Redeclare from base class.
1798         (class Sized_relobj::do_for_all_local_got_entries): New function.
1799         (class Sized_relobj::write_local_symbols): Add offset parameter.
1800         (class Sized_relobj::local_symbol_offset_): Update comment.
1801         (class Sized_relobj::local_dynsym_offset_): Update comment.
1802         * options.cc (Input_arguments::add_file): Remove const.
1803         * options.h (Input_file_argument::Input_file_argument):
1804         Initialize arg_serial_ (all constructors).
1805         (Input_file_argument::set_arg_serial): New function.
1806         (Input_file_argument::arg_serial): New function.
1807         (Input_file_argument::arg_serial_): New data member.
1808         (Input_arguments::Input_arguments): Initialize file_count_.
1809         (Input_arguments::add_file): Remove const.
1810         (Input_arguments::number_of_input_files): New function.
1811         (Input_arguments::file_count_): New data member.
1812         (Command_line::number_of_input_files): Call
1813         Input_arguments::number_of_input_files.
1814         * output.cc (Output_segment_headers::Output_segment_headers):
1815         Set current size.
1816         (Output_section::Input_section::current_data_size): New function.
1817         (Output_section::Output_section): Initialize new data members.
1818         (Output_section::add_input_section): Don't do merge sections for
1819         an incremental link; allocate space from free list for an
1820         incremental update.
1821         (Output_section::add_output_section_data): Allocate space from
1822         free list for an incremental update.
1823         (Output_section::update_data_size): New function.
1824         (Output_section::set_fixed_layout): New function.
1825         (Output_section::reserve): New function.
1826         (Output_segment::set_section_addresses): Remove const.
1827         (Output_segment::set_section_list_addresses): Remove const; allocate
1828         space from free list for an incremental update.
1829         (Output_segment::set_offset): Adjust size of RELRO segment for an
1830         incremental update.
1831         * output.h (Output_data::current_data_size): Move here from
1832         child classes.
1833         (Output_data::pre_finalize_data_size): New function.
1834         (Output_data::update_data_size): New function.
1835         (Output_section_headers::update_data_size): new function.
1836         (Output_section_data_build::current_data_size): Move to Output_data.
1837         (Output_data_strtab::update_data_size): New function.
1838         (Output_section::current_data_size): Move to Output_data.
1839         (Output_section::set_fixed_layout): New function.
1840         (Output_section::has_fixed_layout): New function.
1841         (Output_section::reserve): New function.
1842         (Output_section::update_data_size): New function.
1843         (Output_section::has_fixed_layout_): New data member.
1844         (Output_section::free_list_): New data member.
1845         (Output_segment::set_section_addresses): Remove const.
1846         (Output_segment::set_section_list_addresses): Remove const.
1847         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1848         New function.
1849         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1850         New function.
1851         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1852         parameter when calling Add_symbols constructor; store argument
1853         serial number for members of a lib group.
1854         (Add_symbols::locks): Allow case where token == NULL.
1855         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1856         (Read_member::~Read_member): New function.
1857         (Read_member::is_runnable): New function.
1858         (Read_member::locks): New function.
1859         (Read_member::run): New function.
1860         (Check_script::~Check_script): New function.
1861         (Check_script::is_runnable): New function.
1862         (Check_script::locks): New function.
1863         (Check_script::run): New function.
1864         (Check_library::~Check_library): New function.
1865         (Check_library::is_runnable): New function.
1866         (Check_library::locks): New function.
1867         (Check_library::run): New function.
1868         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1869         (Add_symbols::library_): New data member.
1870         (class Read_member): New class.
1871         (class Check_script): New class.
1872         (class Check_library): New class.
1873         * reloc.cc (Read_relocs::is_runnable): Allow case where
1874         token == NULL.
1875         (Read_relocs::locks): Likewise.
1876         (Scan_relocs::locks): Likewise.
1877         (Relocate_task::locks): Likewise.
1878         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1879         to clear counters.
1880         (Sized_relobj::incremental_relocs_scan): Fix comment.
1881         (Sized_relobj::do_relocate): Pass output file offset to
1882         write_local_symbols.
1883         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1884         from class declaration.
1885         * script.cc (read_input_script): Allocate Script_info; pass
1886         argument serial number to report_script.
1887         * script.h (class Script_info): Move to incremental.h.
1888         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1889         * symtab.h (Symbol_table::add_from_incrobj): New function.
1890         (Symbol_table::set_file_offset): New function.
1891
1892 2011-04-05  Cary Coutant  <ccoutant@google.com>
1893
1894         * incremental-dump.cc (dump_incremental_inputs): Change signature
1895         to take a Sized_incremental_binary; change caller.  Use readers
1896         in Sized_incremental_binary.
1897         * incremental.cc
1898         (Sized_incremental_binary::find_incremental_inputs_sections):
1899         Rename do_find_incremental_inputs_sections to this.
1900         (Sized_incremental_binary::setup_readers): New function.
1901         (Sized_incremental_binary::do_check_inputs): Check
1902         has_incremental_info_ flag; move setup code to setup_readers;
1903         use input readers.
1904         (Sized_incremental_binary::do_file_is_unchanged): New function.
1905         (Sized_incremental_binary::do_get_input_reader): New function.
1906         * incremental.h (class Incremental_binary): Move to end of file.
1907         (Incremental_binary::file_is_unchanged): New function.
1908         (Incremental_binary::do_file_is_unchanged): New function.
1909         (Incremental_binary::Input_reader): New class.
1910         (Incremental_binary::get_input_reader): New function.
1911         (class Sized_incremental_binary): Move to end of file.
1912         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1913         input section reader classes.
1914         (Sized_incremental_binary::has_incremental_info): New function.
1915         (Sized_incremental_binary::inputs_reader): New function.
1916         (Sized_incremental_binary::symtab_reader): New function.
1917         (Sized_incremental_binary::relocs_reader): New function.
1918         (Sized_incremental_binary::got_plt_reader): New function.
1919         (Sized_incremental_binary::do_file_is_unchanged): New function.
1920         (Sized_incremental_binary::Sized_input_reader): New class.
1921         (Sized_incremental_binary::get_input_reader): New function.
1922         (Sized_incremental_binary::find_incremental_inputs_sections):
1923         Rename do_find_incremental_inputs_sections to this.
1924         (Sized_incremental_binary::setup_readers): New function.
1925         (Sized_incremental_binary::has_incremental_info_): New data member.
1926         (Sized_incremental_binary::inputs_reader_): New data member.
1927         (Sized_incremental_binary::symtab_reader_): New data member.
1928         (Sized_incremental_binary::relocs_reader_): New data member.
1929         (Sized_incremental_binary::got_plt_reader_): New data member.
1930         (Sized_incremental_binary::current_input_file_): New data member.
1931
1932 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1933
1934         PR gold/12640
1935         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1936         violation.
1937
1938 2011-03-30  Cary Coutant  <ccoutant@google.com>
1939
1940         * archive.cc (Archive::include_member): Adjust call to report_object.
1941         (Add_archive_symbols::run): Add script_info to call to
1942         report_archive_begin.
1943         (Lib_group::include_member): Adjust call to report_object.
1944         (Add_lib_group_symbols::run): Adjust call to report_object.
1945         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1946         blocks.  Add object count for script input files.
1947         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1948         script_info parameter; change all callers.
1949         (Incremental_inputs::report_object): Add script_info parameter;
1950         change all callers.
1951         (Incremental_inputs::report_script): Store backpointer to
1952         incremental info entry.
1953         (Output_section_incremental_inputs::set_final_data_size): Record
1954         additional information for scripts.
1955         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1956         * incremental.h (Incremental_script_entry::add_object): New function.
1957         (Incremental_script_entry::get_object_count): New function.
1958         (Incremental_script_entry::get_object): New function.
1959         (Incremental_script_entry::objects_): New data member; adjust
1960         constructor.
1961         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1962         (Incremental_inputs::report_object): Add script_info parameter.
1963         (Incremental_inputs_reader::get_object_count): New function.
1964         (Incremental_inputs_reader::get_object_offset): New function.
1965         * options.cc (Input_arguments::add_file): Return reference to
1966         new input argument.
1967         * options.h (Input_argument::set_script_info): New function.
1968         (Input_argument::script_info): New function.
1969         (Input_argument::script_info_): New data member; adjust all
1970         constructors.
1971         (Input_file_group::add_file): Return reference to new input argument.
1972         (Input_file_lib::add_file): Likewise.
1973         (Input_arguments::add_file): Likewise.
1974         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1975         * script.cc (Parser_closure::Parser_closure): Add script_info
1976         parameter; adjust all callers.
1977         (Parser_closure::script_info): New function.
1978         (Parser_closure::script_info_): New data member.
1979         (read_input_script): Report scripts earlier to incremental info.
1980         (script_add_file): Set script_info in Input_argument.
1981         (script_add_library): Likewise.
1982         * script.h (Script_options::Script_info): Rewrite class.
1983
1984 2011-03-29  Cary Coutant  <ccoutant@google.com>
1985
1986         * archive.cc (Library_base::should_include_member): Move
1987         method here from class Archive.
1988         (Archive::Archive): Initialize base class.
1989         (Archive::should_include_member): Move to base class.
1990         (Archive::do_for_all_unused_symbols): New function.
1991         (Add_archive_symbols::run): Remove redundant access to
1992         incremental_inputs.
1993         (Lib_group::Lib_group): Initialize base class.
1994         (Lib_group::do_filename): New function.
1995         (Lib_group::include_member): Pass pointer to Lib_group to
1996         report_object.
1997         (Lib_group::do_for_all_unused_symbols): New function.
1998         (Add_lib_group_symbols::run): Report archive information for
1999         incremental links.
2000         * archive.h (class Library_base): New base class.
2001         (class Archive): Derive from Library_base.
2002         (Archive::filename): Move to base class.
2003         (Archive::set_incremental_info): Likewise.
2004         (Archive::incremental_info): Likewise.
2005         (Archive::Should_include): Likewise.
2006         (Archive::should_include_member): Likewise.
2007         (Archive::Armap_entry): Remove.
2008         (Archive::Unused_symbol_iterator): Remove.
2009         (Archive::unused_symbols_begin): Remove.
2010         (Archive::unused_symbols_end): Remove.
2011         (Archive::do_filename): New function.
2012         (Archive::do_get_mtime): New function.
2013         (Archive::do_for_all_unused_symbols): New function.
2014         (Archive::task_): Move to base class.
2015         (Archive::incremental_info_): Likewise.
2016         (class Lib_group): Derive from Library_base.
2017         (Lib_group::do_filename): New function.
2018         (Lib_group::do_get_mtime): New function.
2019         (Lib_group::do_for_all_unused_symbols): New function.
2020         (Lib_group::task_): Move to base class.
2021         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2022         function.
2023         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2024         function.
2025         * incremental.cc (Incremental_inputs::report_archive_begin):
2026         Use Library_base; call library's get_mtime; add incremental inputs
2027         entry before members.
2028         (class Unused_symbol_visitor): New class.
2029         (Incremental_inputs::report_archive_end): Use Library_base; use
2030         visitor class to record unused symbols; don't add incremental inputs
2031         entry after members.
2032         (Incremental_inputs::report_object): Use Library_base.
2033         * incremental.h
2034         (Incremental_archive_entry::Incremental_archive_entry): Remove
2035         unused Archive parameter.
2036         (Incremental_inputs::report_archive_begin): Use Library_base.
2037         (Incremental_inputs::report_archive_end): Likewise.
2038         (Incremental_inputs::report_object): Likewise.
2039         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2040         function.
2041         * object.h (Object::for_all_global_symbols): New function.
2042         (Object::do_for_all_global_symbols): New function.
2043         (Sized_relobj::do_for_all_global_symbols): New function.
2044         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2045         function.
2046         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2047         function.
2048
2049 2011-03-27  Ian Lance Taylor  <iant@google.com>
2050
2051         * archive.cc (Archive::interpret_header): Return -1 if something
2052         goes wrong.  Change callers accordingly.
2053
2054 2011-03-25  Cary Coutant  <ccoutant@google.com>
2055
2056         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2057         * testsuite/Makefile.in: Regenerate.
2058
2059 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2060
2061         * plugin.cc (get_view): New.
2062         (Plugin::load): Pass get_view to the plugin.
2063         (Plugin_manager::get_view): New.
2064
2065 2011-03-21  Ian Lance Taylor  <iant@google.com>
2066
2067         * testsuite/final_layout.sh: Rewrite to not use dc.
2068         * testsuite/relro_test.sh: Fail if dc is not present.
2069
2070 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2071
2072         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2073         Change == to -eq.
2074         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2075         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2076         Change == to -eq.
2077         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2078         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2079
2080 2011-03-14  Ian Lance Taylor  <iant@google.com>
2081
2082         * script-sections.cc (Sort_output_sections::script_compare):
2083         Rename from is_before, change return type.
2084         (Sort_output_sections::operator()): Adjust accordingly.
2085
2086 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2087
2088         PR gold/12572
2089         * testsuite/odr_violation2.cc: Add comment to make all error line
2090         numbers double digits.
2091         * testsuite/debug_msg.sh: Adjust expected errors.
2092
2093 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2094
2095         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2096         but mark earlier ones as non-canonical
2097         (offset_to_iterator): Update search target and example
2098         (do_addr2line): Return extra lines in a vector*
2099         (format_file_lineno): Extract from do_addr2line
2100         (one_addr2line): Add vector* out-param
2101         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2102         when a lineno entry appeared last for its instruction
2103         (Dwarf_line_info): Add vector* out-param
2104         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2105         * symtab.cc (Odr_violation_compare): Include the lineno in the
2106         comparison again.
2107         (linenos_from_loc): New. Combine the canonical line for an
2108         address with its other lines.
2109         (True_if_intersect): New. Helper functor to make
2110         std::set_intersection a query.
2111         (detect_odr_violations): Compare sets of lines instead of just
2112         one line for each function. This became less deterministic, but
2113         has fewer false positives.
2114         * symtab.h: Declarations.
2115         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2116         mix an optimized and non-optimized object in the same binary
2117         (odr_violation2.so): Same.
2118         * testsuite/Makefile.in: Regenerate from Makefile.am.
2119         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2120         * testsuite/debug_msg.sh: Update line numbers and add
2121         assertions.
2122         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2123         non-optimized context.
2124         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2125         isn't inlined, and use OdrDerived in an optimized context.
2126         * testsuite/odr_header1.h: Defines OdrDerived, where
2127         optimization will change the
2128         first-instruction-in-the-destructor's file and line number.
2129         * testsuite/odr_header2.h: Defines OdrBase.
2130
2131 2011-03-09  Ian Lance Taylor  <iant@google.com>
2132
2133         * fileread.cc (File_read::clear_views): Don't delete the whole
2134         file view.
2135
2136 2011-03-08  Ian Lance Taylor  <iant@google.com>
2137
2138         PR gold/12525
2139         * fileread.cc: #include <climits>.
2140         (GOLD_IOV_MAX): Define.
2141         (File_read::read_multiple): Limit number of entries by iov_max.
2142         * fileread.h (class File_read): Always set max_readv_entries to
2143         128.
2144
2145 2011-03-07  Ian Lance Taylor  <iant@google.com>
2146
2147         PR gold/12525
2148         * options.h (class General_options): Add -dy and -dn.
2149
2150 2011-03-02  Cary Coutant  <ccoutant@google.com>
2151
2152         * testsuite/script_test_9.t: Add TLS segment.
2153
2154 2011-03-02  Simon Baldwin  <simonb@google.com>
2155
2156         * configure.ac: Add check for gnu_indirect_function support in
2157         the toolchain building binutils.
2158         * configure: Rebuild.
2159
2160 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2161
2162         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2163         plugin only symbols.
2164         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2165         in plugin files as not needed in the symbol table.
2166
2167 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2168
2169         * output.cc (Output_section::add_input_section): Delay fill
2170         generation for section ordering.
2171
2172 2011-02-09  Ian Lance Taylor  <iant@google.com>
2173
2174         PR gold/12316
2175         * object.h (class Sized_relobj): Remove clear_local_symbols.
2176         * reloc.cc (Sized_relobj::do_relocate): Don't call
2177         clear_local_symbols.
2178
2179 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2180
2181         * plugin.cc (is_visible_from_outside): Return true for symbols
2182         in the -u option.
2183
2184 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2185
2186         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2187         filename.
2188
2189 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2190
2191         * icf.h (is_section_foldable_candidate): Change type of parameter
2192         to std::string.
2193         * icf.cc (Icf::find_identical_sections): Change type of local variable
2194         section_name to be std::string.
2195         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2196
2197 2011-01-25  Ian Lance Taylor  <iant@google.com>
2198
2199         * script.cc (script_add_extern): Rewrite to use
2200         add_symbol_reference.
2201
2202 2011-01-25  Doug Kwan  <dougkwan@google.com>
2203
2204         * icf.cc (get_section_contents): Always lock section's object.
2205
2206 2011-01-24  Ian Lance Taylor  <iant@google.com>
2207
2208         * options.h (class General_options): Accept
2209         --no-detect-odr-violations.
2210
2211 2011-01-24  Ian Lance Taylor  <iant@google.com>
2212
2213         * version.cc (version_string): Bump to 1.11.
2214
2215 2011-01-24  Ian Lance Taylor  <iant@google.com>
2216
2217         * plugin.cc (class Plugin_rescan): Define new class.
2218         (Plugin_manager::claim_file): Set any_claimed_.
2219         (Plugin_manager::save_archive): New function.
2220         (Plugin_manager::save_input_group): New function.
2221         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2222         necessary.
2223         (Plugin_manager::new_undefined_symbol): New function.
2224         (Plugin_manager::rescan): New function.
2225         (Plugin_manager::rescannable_defines): New function.
2226         (Plugin_manager::add_input_file): Set any_added_.
2227         * plugin.h (class Plugin_manager): define new fields rescannable_,
2228         undefined_symbols_, any_claimed_, and any_added_.  Declare
2229         Plugin_rescan as friend.  Declare new functions.
2230         (Plugin_manager::Rescannable): Define type.
2231         (Plugin_manager::Rescannable_list): Define type.
2232         (Plugin_manager::Undefined_symbol_list): Define type.
2233         (Plugin_manager::Plugin_manager): Initialize new fields.
2234         * archive.cc (Archive::defines_symbol): New function.
2235         (Add_archive_symbols::run): Pass archive to plugins if any.
2236         * archive.h (class Archive): Declare defines_symbol.
2237         * readsyms.cc (Input_group::~Input_group): New function.
2238         (Finish_group::run): Pass input_group to plugins if any.
2239         * readsyms.h (class Input_group): Declare destructor.
2240         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2241         any.
2242
2243 2011-01-10  Ian Lance Taylor  <iant@google.com>
2244
2245         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2246         section as relro.
2247         (Layout::set_segment_offsets): Reset increase_relro before calling
2248         set_section_addresses a second time.
2249
2250 2011-01-04  Cary Coutant  <ccoutant@google.com>
2251
2252         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2253         sections before NOBITS sections.
2254
2255 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2256
2257         * version.cc (print_version): Update copyright to 2011.
2258
2259 2010-12-23  Cary Coutant  <ccoutant@google.com>
2260
2261         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2262         of OS to this->add.  Add OD parameter to second form of the function.
2263
2264 2010-12-20  Ian Lance Taylor  <iant@google.com>
2265
2266         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2267         second of two consecutive entries with same offset.
2268
2269 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2270
2271         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2272         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2273         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2274         to avoid unneeded links against $(LDADD).
2275         * testsuite/Makefile.in: Regenerate.
2276
2277 2010-12-15  Ian Lance Taylor  <iant@google.com>
2278
2279         PR gold/12324
2280         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2281         for R_X86_64_32 and R_X86_64_PC32.
2282         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2283         ver_matching_def_pic.o.
2284         (ver_matching_def_pic.o): New target.
2285
2286 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2287
2288         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2289         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2290         Move definition before File_read::View member definitions.
2291         (File_read::View::~View): Initialize and hold lock before
2292         updating current_mapped_bytes.
2293
2294 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2295
2296         * dwarf_reader.cc: Remove outdated comment.
2297         * gold-threads.cc: Fix typo in error message.
2298         * archive.cc: Fix typos in comments.
2299         * archive.h: Likewise.
2300         * arm-reloc-property.cc: Likewise.
2301         * arm-reloc-property.h: Likewise.
2302         * arm-reloc.def: Likewise.
2303         * arm.cc: Likewise.
2304         * attributes.h: Likewise.
2305         * cref.cc: Likewise.
2306         * ehframe.cc: Likewise.
2307         * fileread.h: Likewise.
2308         * gold.h: Likewise.
2309         * i386.cc: Likewise.
2310         * icf.cc: Likewise.
2311         * incremental.h: Likewise.
2312         * int_encoding.cc: Likewise.
2313         * layout.h: Likewise.
2314         * main.cc: Likewise.
2315         * merge.h: Likewise.
2316         * object.cc: Likewise.
2317         * object.h: Likewise.
2318         * options.cc: Likewise.
2319         * readsyms.cc: Likewise.
2320         * reduced_debug_output.cc: Likewise.
2321         * reloc.cc: Likewise.
2322         * script-sections.cc: Likewise.
2323         * sparc.cc: Likewise.
2324         * symtab.h: Likewise.
2325         * target-reloc.h: Likewise.
2326         * target.cc: Likewise.
2327         * target.h: Likewise.
2328         * timer.cc: Likewise.
2329         * timer.h: Likewise.
2330         * x86_64.cc: Likewise.
2331
2332 2010-12-09  Cary Coutant  <ccoutant@google.com>
2333
2334         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2335         stack.
2336         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2337         parameter; change all callers.
2338         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2339         * options.h (warn_execstack): New option.
2340
2341 2010-12-07  Doug Kwan  <dougkwan@google.com>
2342
2343         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2344         like function call relocations.
2345
2346 2010-12-07  Ian Lance Taylor  <iant@google.com>
2347
2348         * archive.cc (Archive::get_elf_object_for_member): Permit
2349         punconfigured to be NULL.
2350         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2351         (Archive::include_member): Pass NULL to get_elf_object_for_member
2352         if we searched for the archive and this is the first included
2353         object.
2354
2355 2010-12-01  Ian Lance Taylor  <iant@google.com>
2356
2357         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2358         track_relocs_type_ field.
2359         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2360         Set track_relocs_type_.
2361         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2362         contents when using RELA relocs.
2363         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2364         reloc_map_.
2365         * reloc.cc (Track_relocs::next_addend): New function.
2366         * reloc.h (class Track_relocs): Declare next_addend.
2367
2368 2010-12-01  Ian Lance Taylor  <iant@google.com>
2369
2370         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2371         virtual destructor.
2372
2373 2010-12-01  Ian Lance Taylor  <iant@google.com>
2374
2375         * README: Update compilers known to work and fail.
2376
2377 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2378
2379         * configure.in: For --enable-gold, handle value `default' instead of
2380         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2381         not the default.
2382         * configure: Regenerate.
2383
2384 2010-11-18  Doug Kwan  <dougkwan@google.com>
2385
2386         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2387         and right_alignment to be zero.  Store result alignment only if it is
2388         greater than existing alignment.
2389
2390 2010-11-16  Cary Coutant  <ccoutant@google.com>
2391
2392         PR gold/12220
2393         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2394         Check for ".zdebug_line".
2395
2396 2010-11-16  Doug Kwan  <dougkwan@google.com>
2397             Cary Coutant  <ccoutant@google.com>
2398
2399         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2400         by reference; adjust all callers.
2401         * output.cc (Output_segment::set_section_addresses): Adjust references
2402         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2403         list is empty.
2404         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2405         end at page boundary.
2406
2407 2010-11-16  Cary Coutant  <ccoutant@google.com>
2408
2409         PR gold/12220
2410         * layout.cc (Layout::choose_output_section): Transform names of
2411         compressed sections even when using a script with a SECTIONS clause.
2412         (Layout::output_section_name): Remove code to transform
2413         compressed debug section names.
2414         * output.cc (Output_section::add_input_section): Use uncompressed
2415         section size when tracking input sections.
2416
2417 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2418
2419         * symtab.h (Symbol::NON_PIC_REF): Remove.
2420         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2421         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2422         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2423         (Symbol::use_plt_offset): Take a flags argument and pass it
2424         directly to needs_dynamic_reloc.  Restrict check for undefined
2425         weak symbols to function calls.
2426         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2427         (Target_arm::Scan::global): Use it.
2428         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2429         (Target_arm::Relocate::relocate): Likewise.
2430         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2431         parameter with an r_type parameter.  Use get_reference_flags
2432         to get the flags.
2433         (Target_arm::Relocate::relocate): Update accordingly.
2434         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2435         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2436         (Target_i386::Scan::global): Likewise.
2437         (Target_i386::Relocate::relocate): Likewise.
2438         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2439         parameter with an r_type parameter.  Use get_reference_flags
2440         to get the flags.
2441         (Target_i386::Relocate::relocate): Update accordingly.
2442         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2443         (Target_powerpc::Scan::global): Use it.
2444         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2445         (Target_powerpc::Relocate::relocate): Likewise.
2446         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2447         (Target_sparc::Scan::global): Use it.
2448         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2449         (Target_sparc::Relocate::relocate): Likewise.
2450         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2451         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2452         (Target_x86_64::Scan::global): Likewise.
2453         (Target_x86_64::Relocate::relocate): Likewise.
2454
2455 2010-11-08  Doug Kwan  <dougkwan@google.com>
2456             Cary Coutant  <ccoutant@google.com>
2457
2458         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2459         (Arm_exidx_merge_section::section_contents_): New data member.
2460         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2461         (Arm_input_section::~Arm_input_section): De-allocate memory.
2462         (Arm_input_section::original_contents_): New data member.       
2463         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2464         in parameters instead of calling Object::section_contents without
2465         locking.
2466         (Arm_output_section::group_section): New parameter TASK.  Pass it
2467         to callees that need locking objects.
2468         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2469         to lock EXIDX input sections.  Fix a formatting issue.  Call
2470         Arm_exidx_merged_section::build_contents to create merged section
2471         contents.
2472         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2473         to lock object of stub table owner.
2474         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2475         TEXT_SIZE to initialize data member TEXT_SIZE_.
2476         (Arm_exidx_input_section::addralign): Fix typo in comment.
2477         (Arm_exidx_input_section::text_size): New method.
2478         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2479         that require locking objects.  Lock objects before scanning for stubs
2480         and updating local symbols.
2481         (Arm_input_section<big_endian>::init): Copy contents of original
2482         input section.
2483         (Arm_input_section<big_endian>::do_write): Use saved contents of
2484         original input section instead of calling Object::section_contents
2485         without locking.
2486         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2487         size without calling Object::section_size().
2488         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2489         for size.  Allocate a buffer for merged EXIDX entries.
2490         (Arm_exidx_merged_section::build_contents): New method.
2491         (Arm_exidx_merged_section::do_write): Move merge section contents
2492         building code to Arm_exidx_merged_section::build_contetns.  Write
2493         out contetns in buffer instead of building it on the fly.
2494         (Arm_relobj::make_exidx_input_section): Also pass text section size
2495         to Arm_exidx_input_section constructor.
2496         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2497         (Arm_dynobj::do_read_symbols): Fix memory leak.
2498         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2499         * target.h: (class Task): Add forward declaration.
2500         (Target::relax): Add new parameter TASK and pass it to
2501         Target::do_relax().
2502         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2503
2504 2010-11-05  Cary Coutant  <ccoutant@google.com>
2505
2506         PR gold/10708
2507         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2508         object when reading from the file.
2509         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2510         second layout pass.
2511         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2512         when reading section contents.
2513         (get_section_contents): Likewise.
2514         (icf::find_identical_sections): Likewise.
2515         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2516         object when reading from the file.
2517         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2518         the object when doing deferred section layout.
2519
2520 2010-11-03  Nick Clifton  <nickc@redhat.com>
2521
2522         PR gold/12001
2523         * script.h (class Symbol_assignment: name): New member.  Returns
2524         the name of the symbol.
2525         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2526         Returns true if the given symbol name is on the list of
2527         assignments wating to be processed.
2528         * archive.cc (should_incldue_member): If the symbol is undefined,
2529         check to see if it is on the list of symbols pending assignment.
2530
2531 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2532
2533         * script-sections.cc (Script_sections::find_memory_region): Check
2534         for a NULL output section pointer.
2535
2536 2010-10-29  Doug Kwan  <dougkwan@google.com>
2537
2538         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2539         Output_section::add_relaxed_input_section.
2540         * output.cc (Output_section::add_relaxed_input_section): Add new
2541         arguments LAYOUT and NAME.  Set section order index.
2542         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2543         Copy section order index.
2544         * output.h (Output_section::add_relaxed_input_section): Add new
2545         arguments LAYOUT and NAME.
2546
2547 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2548
2549         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2550         NATIVE_OR_CROSS_LINKER.
2551         * testsuite/Makefile.in: Regenerate.
2552
2553 2010-10-20  Doug Kwan  <dougkwan@google.com>
2554
2555         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2556         without SHF_LINK_ORDER flags.
2557         * layout.cc (Layout::choose_output_section): Do not filter
2558         SHF_LINK_ORDER flag in a relocatable link.
2559
2560 2010-10-17  Cary Coutant  <ccoutant@google.com>
2561
2562         * output.h (Output_segment::set_section_addresses): Change function
2563         signature.  Update all callers.
2564         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2565         sections.
2566         (Output_segment::set_section_addresses): Align after last TLS
2567         section.  Add padding before last relro section instead of after.
2568
2569 2010-10-17  Doug Kwan  <dougkwan@google.com>
2570
2571         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2572         GOT output section to be writable.
2573
2574 2010-10-14  Cary Coutant  <ccoutant@google.com>
2575
2576         * debug.h (DEBUG_INCREMENTAL): New flag.
2577         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2578         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2579         mode.
2580         * incremental.cc (report_command_line): Ignore all forms of
2581         --incremental.
2582         * layout.cc (Layout::Layout): Check parameters for incremental link
2583         mode.
2584         * options.cc (General_options::parse_incremental): New function.
2585         (General_options::parse_no_incremental): New function.
2586         (General_options::parse_incremental_full): New function.
2587         (General_options::parse_incremental_update): New function.
2588         (General_options::incremental_mode_): New data member.
2589         (General_options::finalize): Check incremental_mode_.
2590         * options.h (General_options): Update help text for --incremental.
2591         Add --no-incremental, --incremental-full, --incremental-update.
2592         (General_options::Incremental_mode): New enum type.
2593         (General_options::incremental_mode): New function.
2594         (General_options::incremental_mode_): New data member.
2595         * parameters.cc (Parameters::incremental_mode_): New data member.
2596         (Parameters::set_options): Set incremental_mode_.
2597         (Parameters::set_incremental_full): New function.
2598         (Parameters::incremental): New function.
2599         (Parameters::incremental_update): New function.
2600         (set_parameters_incremental_full): New function.
2601         * parameters.h (Parameters::set_incremental_full): New function.
2602         (Parameters::incremental): New function.
2603         (Parameters::incremental_update): New function.
2604         (Parameters::incremental_mode_): New data member.
2605         (set_parameters_incremental_full): New function.
2606         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2607         incremental link mode.
2608         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2609         (Sized_relobj::do_relocate_sections): Likewise.
2610         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2611         option.
2612         * testsuite/Makefile.in: Regenerate.
2613         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2614
2615 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2616
2617         * script-sections.h (class Script_sections): Make
2618         Sections_elements typedef public.
2619         * script-sections.cc (class Sort_output_sections): Add elements_
2620         field.  Add constructor which sets it; change all callers.
2621         (Sort_output_sections::is_before): New function.
2622         (Sort_output_sections::operator()): Call is_before.
2623         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2624         conditional.
2625         * testsuite/script_test_10.sh: New test. Test script section
2626         order.
2627         * testsuite/script_test_10.t: Likewise.
2628         * testsuite/script_test_10.s: Likewise.
2629         * testsuite/Makefile.am: Wrap the cross linker tests and the
2630         common tests into NATIVE_OR_CROSS_LINKER.
2631         (check_SCRIPTS): Add script_test_10.sh.
2632         (check_DATA): Add script_test_10.stdout.
2633         (script_test_10.o, script_test_10): New targets.
2634         (script_test_10.stdout): New target.
2635         * configure, testsuite/Makefile.in: Regenerate.
2636
2637 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2638
2639         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2640         error for the deprecated relocations.
2641         (Target_arm::Scan::global): Likewise.
2642         (Target_arm::Relocate::relocate): Likewise.
2643
2644 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2645
2646         * fileread.cc (Input_file::find_file): Initialize *found_name
2647         and *namep when using the fallback search for case 4.
2648
2649 2010-10-11  Cary Coutant  <ccoutant@google.com>
2650
2651         * options.h (class General_options): Redefine -z lazy as an alias for
2652         the negation of -z now.
2653
2654 2010-10-11  Ian Lance Taylor  <iant@google.com>
2655
2656         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2657         binding.
2658
2659 2010-10-06  Nick Clifton  <nickc@redhat.com>
2660
2661         * script-sections.cc(class Memory_region): Remove
2662         current_lma_offset_ field.  Rename current_vma_offset_ to
2663         current_offset_.  Add last_section_ field.
2664         (Memory_region::get_current_vma_address): Rename to
2665         get_current_address.
2666         (Memory_region::get_current_lma_address): Delete.
2667         (Memory_region::increment_vma_offset): Rename to
2668         increment_offset.
2669         (Memory_region::increment_lma_offset): Delete.
2670         (Memory_region::attributes_compatible): New method.  Returns
2671         true if the provided section is compatible with the region.
2672         (Memory_region::get_last_section): New method.  Returns the last
2673         section to use the region.
2674         (Memory_region::set_last_section): New method.  Stores the last
2675         section to use the region.
2676         (Script_sections::block_in_region): New method.  Returns true if
2677         a block of memory is contained within a region.
2678         (Script_sections::find_memory_region): New method.  Locates a
2679         memory region to be used to set a VMA or LMA address.
2680         (Output_section_definition::set_section_addresses): Add code to
2681         check for addresses set by memory regions.
2682         (Output_segment::set_section_addresses): Remove memory region
2683         walking code.
2684         (Script_sections::create_segment): Add a warning if a header
2685         segment is created outside of any region.
2686         * script-sections.h (class Script_sections): Add prototypes for
2687         find_memory_region and block_in_region methods.
2688         * testsuite/memory_test.s: Use .long instead of .word.
2689         * testsuite/memory_test.t: Add some more output sections.
2690         * testsuite/memory_test.sh: Update expected output.
2691
2692 2010-10-02  Doug Kwan  <dougkwan@google.com>
2693
2694         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2695         defintion to symtab.h
2696         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2697         declaration to defintion.
2698
2699 2010-10-01  Nick Clifton  <nickc@redhat.com>
2700
2701         * expression.cc (eval): Replace dummy argument with NULL.
2702         (eval_maybe_dot): Check for a NULL result section pointer.
2703         (Symbol_expression::value): Likewise.
2704         (Dot_expression::value): Likewise.
2705         (BINARY_EXPRESSION): Likewise.
2706         (Max_expression::value): Likewise.
2707         (Min_expression::value): Likewise.
2708         (Absolute_expression::value): Likewise.
2709         (Addr_expression::value_from_output_section): Likewise.
2710         (Loaddddr_expression::value_from_output_section): Likewise.
2711         (Segment_start_expression::value): Likewise.
2712         * script-sections.cc
2713         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2714         argument with NULL.
2715         (Sections_elememt_dot_assignment::set_section_addresses):
2716         Likewise.
2717         (Output_data_expression::do_write_to_buffer): Likewise.
2718         (Output_section_definition::finalize_symbols): Likewise.
2719         (Output_section_definition::set_section_addresses): Likewise.
2720
2721 2010-09-30  Doug Kwan  <dougkwan@google.com>
2722
2723         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2724
2725 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2726
2727         * target.h (Target::can_icf_inline_merge_sections): New virtual
2728         function.
2729         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2730         virtual function.
2731         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2732         virtual function.
2733         * icf.cc (get_section_contents): Inline merge sections only when
2734         target allows it.
2735
2736 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2737
2738         * configure: Regenerate.
2739
2740 2010-09-17  Ian Lance Taylor  <iant@google.com>
2741
2742         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2743         * testsuite/Makefile.am (memory_test.o): New target.
2744         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2745         memory_test.t.
2746         * testsuite/Makefile.in: Rebuild.
2747
2748 2010-09-17  Doug Kwan  <dougkwan@google.com>
2749
2750         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2751         defintion if relocation uses GOT entries of the symbol.
2752         * testsuite/icf_safe_test.sh: Fix test.
2753         * testsuite/icf_safe_so_test.sh: Fix test.
2754
2755 2010-09-16  Cary Coutant  <ccoutant@google.com>
2756
2757         * script_sections.cc (class Memory_region): Remove "NULL" from
2758         vector initializations.
2759
2760 2010-09-15  Cary Coutant  <ccoutant@google.com>
2761
2762         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2763         Resolve forwarding symbols.
2764
2765 2010-09-15  Doug Kwan  <dougkwan@google.com>
2766
2767         * gold/testsuite/script_test_3.t: Add ARM special sections.
2768         * gold/testsuite/script_test_4.t: Same.
2769         * gold/testsuite/script_test_5.t: Same.
2770         * gold/testsuite/script_test_6.t: Same.
2771         * gold/testsuite/script_test_7.t: Same.
2772         * gold/testsuite/script_test_7.t: Same.
2773         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2774
2775 2010-09-14  Cary Coutant  <ccoutant@google.com>
2776
2777         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2778         (Target_x86_64::Relocate::relocate_tls): Replace check for
2779         saw_tls_block_reloc_ with test for executable section.
2780
2781 2010-09-12  Cary Coutant  <ccoutant@google.com>
2782
2783         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2784         position-independent executables to shared libraries need dynamic
2785         relocations.
2786         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2787         position-independent executables.
2788         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2789         * testsuite/Makefile.in: Regenerate.
2790
2791 2010-09-10  Nick Clifton  <nickc@redhat.com>
2792
2793         PR gold/11997
2794         * testsuite/memory_test.t: Discard any sections that are not
2795         needed.
2796
2797 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2798
2799         PR gold/11996
2800         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2801         "This::" to work around a bug in gcc 4.2.
2802
2803         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2804
2805 2010-09-09  Rafael Espindola  <espindola@google.com>
2806
2807         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2808         sections with different PF_X flags in the same segment.
2809         (Layout::find_first_load_seg): Search all segments to find the first
2810         one.
2811         * options.h (rosegment): New.
2812
2813 2010-09-08  Rafael Espindola  <espindola@google.com>
2814
2815         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2816
2817 2010-09-08  Doug Kwan  <dougkwan@google.com>
2818
2819         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2820         (Arm_relobj::do_relocate_sections): Add new parameter for output
2821         file to match the parent.
2822         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2823         of local symbols instead of input values.  Update code to track
2824         changes in gold::relocate_section.
2825         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2826         (Sized_relobj::compute_final_local_value_internal): New methods.
2827         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2828         body into private version of Sized_relobj::compute_final_local_value.
2829         Call the inline method.
2830         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2831         merged symbol value if there is one.
2832         (Symbol_value::has_output_value): New method defintiion.
2833         (Sized_relobj::Compute_final_local_value_status): New enum type.
2834         (Sized_relobj::compute_final_local_value): New methods.
2835         (Sized_relobj::compute_final_local_value_internal): New methods.
2836         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2837         and arm_cortex_a8.sh.
2838         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2839         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2840         New tests.
2841         * Makefile.in: Regenerate.
2842         * testsuite/arm_bl_out_of_range.s: Update test.
2843         * testsuite/thumb_bl_out_of_range.s: Ditto.
2844         * testsuite/thumb_blx_out_of_range.s: Ditto.
2845         * testsuite/arm_branch_out_of_range.sh: New file.
2846         * testsuite/arm_cortex_a8.sh: Ditto.
2847         * testsuite/arm_cortex_a8_b.s: Ditto.
2848         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2849         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2850         * testsuite/arm_cortex_a8_bl.s: Ditto.
2851         * testsuite/arm_cortex_a8_blx.s: Ditto.
2852         * testsuite/arm_cortex_a8_local.s: Ditto.
2853         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2854         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2855
2856 2010-09-08  Rafael Espindola  <espindola@google.com>
2857
2858         * Makefile.am (memory_test.stdout): Run readelf with -W.
2859         * Makefile.in: Regenerate.
2860         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2861         64 bit output.
2862
2863 2010-09-08  Rafael Espindola  <espindola@google.com>
2864
2865         * script-sections.cc (Script_sections::add_memory_region): Convert
2866         field precision to int.
2867         * script.cc (script_set_section_region, script_set_section_region):
2868         Convert field precision to int.
2869
2870 2010-09-08  Rafael Espindola  <espindola@google.com>
2871
2872         * arm.cc (do_finalize_sections): Create the __exidx_start and
2873         __exdix_end symbols even when the section is missing.
2874
2875 2010-09-08  Nick Clifton  <nickc@redhat.com>
2876
2877         * README: Remove claim that MEMORY is not supported.
2878         * expression.cc (script_exp_function_origin)
2879         (script_exp_function_length): Move from here to ...
2880         * script.cc: ... here.
2881         (script_set_section_region, script_add_memory)
2882         (script_parse_memory_attr, script_include_directive): New
2883         functions.
2884         * script-sections.cc
2885         (class Memory_region): New class.
2886         (class Output_section_definition): Add set_memory_region,
2887         set_section_vma, set_section_lma and get_section_name methods.
2888         (class Script_Sections): Add add_memory_region,
2889         find_memory_region, find_memory_region_origin,
2890         find_memory_region_length and set_memory_region methods.
2891         Have set_section_addresses method walk the list of set memory
2892         regions.
2893         Extend the print methos to display memory regions.
2894         * script-sections.h: Add prototypes for new methods.
2895         Add enum for MEMORY region attributes.
2896         * yyscript.y: Add support for parsing MEMORY regions.
2897         * script-c.h: Add prototypes for new functions.
2898         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2899         * testsuite/Makefile.in: Regenerate.
2900         * testsuite/memory_test.sh: New script.
2901         * testsuite/memory_test.s: New assembler source file.
2902         * testsuite/memory_test.t: New linker script.
2903
2904 2010-08-27  Doug Kwan  <dougkwan@google.com>
2905
2906         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2907         reference override an existing dynamic weak reference.
2908         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2909         * testsuite/Makefile.in: Regenerate.
2910         * testsuite/dyn_weak_ref.sh: New file.
2911         * testsuite/dyn_weak_ref_1.c: Ditto.
2912         * testsuite/dyn_weak_ref_2.c: Ditto.
2913
2914 2010-08-27  Ian Lance Taylor  <iant@google.com>
2915
2916         * incremental.h (class Incremental_input_entry): Add virtual
2917         destructor.
2918
2919 2010-08-27  Ian Lance Taylor  <iant@google.com>
2920
2921         * testsuite/start_lib_test_3.c: Mark t3 as used.
2922
2923 2010-08-27  Nick Clifton  <nickc@redhat.com>
2924
2925         * options.cc (version_script): Fix small typo in previous
2926         whitespace tidyup.
2927
2928 2010-08-25  Nick Clifton  <nickc@redhat.com>
2929
2930         * archive.cc: Formatting fixes: Remove whitespace between
2931         typename and following asterisk.  Remove whitespace between
2932         function name and opening parenthesis.
2933         * archive.h: Likewise.
2934         * arm.cc: Likewise.
2935         * attributes.cc: Likewise.
2936         * attributes.h: Likewise.
2937         * common.cc: Likewise.
2938         * copy-relocs.cc: Likewise.
2939         * dirsearch.h: Likewise.
2940         * dynobj.cc: Likewise.
2941         * ehframe.cc: Likewise.
2942         * ehframe.h: Likewise.
2943         * expression.cc: Likewise.
2944         * fileread.cc: Likewise.
2945         * fileread.h: Likewise.
2946         * gc.h: Likewise.
2947         * gold-threads.cc: Likewise.
2948         * gold.cc: Likewise.
2949         * i386.cc: Likewise.
2950         * icf.h: Likewise.
2951         * incremental-dump.cc: Likewise.
2952         * incremental.cc: Likewise.
2953         * layout.cc: Likewise.
2954         * layout.h: Likewise.
2955         * main.cc: Likewise.
2956         * merge.cc: Likewise.
2957         * merge.h: Likewise.
2958         * object.cc: Likewise.
2959         * object.h: Likewise.
2960         * options.cc: Likewise.
2961         * options.h: Likewise.
2962         * output.cc: Likewise.
2963         * output.h: Likewise.
2964         * plugin.cc: Likewise.
2965         * plugin.h: Likewise.
2966         * powerpc.cc: Likewise.
2967         * reloc.cc: Likewise.
2968         * script-c.h: Likewise.
2969         * script-sections.cc: Likewise.
2970         * script.cc: Likewise.
2971         * stringpool.cc: Likewise.
2972         * symtab.cc: Likewise.
2973         * symtab.h: Likewise.
2974         * target.cc: Likewise.
2975         * timer.cc: Likewise.
2976         * timer.h: Likewise.
2977         * version.cc: Likewise.
2978         * x86_64.cc: Likewise.
2979
2980 2010-08-24  Nick Clifton  <nickc@redhat.com>
2981
2982         PR 11899
2983         * layout.cc (segment_precedes): Sort segments by their physical
2984         addresses, if they have been set.
2985
2986 2010-08-23  Cary Coutant  <ccoutant@google.com>
2987
2988         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2989         symbols data.
2990         (Lib_group::include_member): Unlock object after deleting its
2991         symbols data.
2992         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2993         the bug fixed here.
2994
2995 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2996             Cary Coutant  <ccoutant@google.com>
2997
2998         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2999         constructor, and set_blocker.
3000         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3001         readsyms_blocker_.
3002         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3003         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3004         * testsuite/Makefile.am (start_lib_test): New test case.
3005         * testsuite/Makefile.in: Regenerate.
3006         * testsuite/start_lib_test_main.c: New file.
3007         * testsuite/start_lib_test_1.c: New file.
3008         * testsuite/start_lib_test_2.c: New file.
3009         * testsuite/start_lib_test_3.c: New file.
3010
3011 2010-08-19  Ian Lance Taylor  <iant@google.com>
3012
3013         * Makefile.in: Rebuild with automake 1.11.1.
3014         * aclocal.m4: Likewise.
3015         * testsuite/Makefile.in: Likewise.
3016
3017 2010-08-19  Ian Lance Taylor  <iant@google.com>
3018
3019         PR 10893
3020         * i386.cc (class Output_data_plt_i386): Update declarations.
3021         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3022         local_ifuncs_ fields.
3023         (Target_i386::do_plt_section_for_global): New function.
3024         (Target_i386::do_plt_section_for_local): New function.
3025         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3026         parameter; change all callers.  Initialize global_ifuncs_ and
3027         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3028         __rel_iplt_end.
3029         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3030         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3031         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3032         symbols.
3033         (Target_i386::make_plt_section): New function, broken out of
3034         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3035         (Target_i386::make_plt_entry): Call make_plt_section.
3036         (Target_i386::make_local_ifunc_plt_entry): New function.
3037         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3038         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3039         R_386_IRELATIVE to switch.
3040         (Target_i386::Scan::global): Likewise.
3041         (Target_i386::Relocate::relocate): Likewise.
3042         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3043         switch.
3044         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3045         (Target_x86_64::do_plt_section_for_global): New function.
3046         (Target_x86_64::do_plt_section_for_local): New function.
3047         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3048         parameter; change all callers.  If doing a static link define
3049         __rela_iplt_start and __rela_iplt_end.
3050         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3051         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3052         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3053         to point to .plt.
3054         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3055         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3056         switch.
3057         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3058         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3059         R_X86_64_IRELATIVE to switch.
3060         (Target_x86_64::Scan::global): Likewise.
3061         (Target_x86_64::Relocate::relocate): Likewise.
3062         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3063         switch.
3064         * target.h (class Target): Add plt_section_for_global and
3065         plt_section_for_local functions.  Add do_plt_section_for_global
3066         and do_plt_section_for_local virtual functions.
3067         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3068         clarifying comments.
3069         (Symbol::use_plt_offset): Handle IFUNC symbol.
3070         * object.cc (Sized_relobj::Sized_relobj): Initialize
3071         local_plt_offsets_.
3072         (Sized_relobj::local_has_plt_offset): New function.
3073         (Sized_relobj::local_plt_offset): New function.
3074         (Sized_relobj::set_local_plt_offset): New function.
3075         (Sized_relobj::do_count): Handle IFUNC symbol.
3076         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3077         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3078         is_ifunc_symbol functions.
3079         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3080         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3081         local_plt_offsets_ field.
3082         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3083         * output.h (class Output_section_data): Add non-const
3084         output_section function.
3085         (class Output_data_got): Update declarations.
3086         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3087         Add use_plt_offset parameter to global and local constructors.
3088         Change all callers.  Change local_sym_index_ field to 31 bits.
3089         Change GSYM_CODE and CONSTANT_CODE accordingly.
3090         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3091         doing a static link don't set sh_link field.
3092         (Output_data_got::Got_entry::write): Use PLT offset if
3093         appropriate.
3094         (Output_data_got::add_global_plt): New function.
3095         (Output_data_got::add_local_plt): New function.
3096         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3097         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3098         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3099         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3100         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3101         IFUNC conditional.
3102         * testsuite/ifunc-sel.h: New file.
3103         * testsuite/ifuncmain1.c: New file.
3104         * testsuite/ifuncmain1vis.c: New file.
3105         * testsuite/ifuncmod1.c: New file.
3106         * testsuite/ifuncdep2.c: New file.
3107         * testsuite/ifuncmain2.c: New file.
3108         * testsuite/ifuncmain3.c: New file.
3109         * testsuite/ifuncmod3.c: New file.
3110         * testsuite/ifuncmain4.c: New file.
3111         * testsuite/ifuncmain5.c: New file.
3112         * testsuite/ifuncmod5.c: New file.
3113         * testsuite/ifuncmain6pie.c: New file.
3114         * testsuite/ifuncmod6.c: New file.
3115         * testsuite/ifuncmain7.c: New file.
3116         * configure, testsuite/Makefile.in: Rebuild.
3117
3118 2010-08-18  Ian Lance Taylor  <iant@google.com>
3119
3120         * incremental.cc
3121         (Output_section_incremental_inputs::write_input_files): Add cast
3122         to avoid signed/unsigned comparison warning.
3123         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3124
3125 2010-08-12  Cary Coutant  <ccoutant@google.com>
3126
3127         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3128
3129 2010-08-13  Ian Lance Taylor  <iant@google.com>
3130
3131         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3132
3133 2010-08-12  Cary Coutant  <ccoutant@google.com>
3134             Doug Kwan  <dougkwan@google.com>
3135
3136         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3137         defintion overrides non-weak undef, remember that the original undef
3138         is not weak.
3139         * symtab.cc (Symbol_table::sized_write_global): For undef without
3140         an original weak binding, set binding to global in output.
3141         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3142         * testsuite/Makefile.in: Regenerate.
3143         * testsuite/strong_ref_weak_def.sh: New file.
3144         * testsuite/strong_ref_weak_def_1.c: Ditto.
3145         * testsuite/strong_ref_weak_def_2.c: Ditto.
3146
3147 2010-08-12  Cary Coutant  <ccoutant@google.com>
3148
3149         * testsuite/incremental_test.sh: Rewrite.
3150         * testsuite/incremental_test_1.c: Rewrite.
3151         * testsuite/incremental_test_2.c: Rewrite.
3152
3153 2010-08-12  Cary Coutant  <ccoutant@google.com>
3154
3155         * arm.cc (Target_arm::got_size): Add const.
3156         (Target_arm::got_entry_count): New function.
3157         (Target_arm::plt_entry_count): New function.
3158         (Target_arm::first_plt_entry_offset): New function.
3159         (Target_arm::plt_entry_size): New function.
3160         (Output_data_plt_arm::entry_count): New function.
3161         (Output_data_plt_arm::first_plt_entry_offset): New function.
3162         (Output_data_plt_arm::get_plt_entry_size): New function.
3163         * i386.cc (Target_i386::got_size): Add const.
3164         (Target_i386::got_entry_count): New function.
3165         (Target_i386::plt_entry_count): New function.
3166         (Target_i386::first_plt_entry_offset): New function.
3167         (Target_i386::plt_entry_size): New function.
3168         (Output_data_plt_i386::entry_count): New function.
3169         (Output_data_plt_i386::first_plt_entry_offset): New function.
3170         (Output_data_plt_i386::get_plt_entry_size): New function.
3171         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3172         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3173         * incremental.cc: Include target.h.
3174         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3175         parameter.  Adjust all callers.  Find incremental_got_plt section.
3176         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3177         section.
3178         (Output_section_incremental_inputs::set_final_data_size): Calculate
3179         size of incremental_got_plt section.
3180         (Output_section_incremental_inputs::do_write): Write the
3181         incremental_got_plt section.
3182         (Got_plt_view_info): New struct.
3183         (Local_got_offset_visitor): New class.
3184         (Global_got_offset_visitor): New class.
3185         (Global_symbol_visitor_got_plt): New class.
3186         (Output_section_incremental_inputs::write_got_plt): New function.
3187         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3188         Add parameter.  Adjust all callers.
3189         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3190         (Incremental_inputs::got_plt_section): New function.
3191         (Incremental_inputs::got_plt_section_): New data member.
3192         (Incremental_got_plt_reader): New class.
3193         * layout.cc (Layout::create_incremental_info_sections): Add the
3194         incremental_got_plt section.
3195         * object.h (Got_offset_list::get_list): New function.
3196         (Got offset_list::for_all_got_offsets): New function.
3197         (Sized_relobj::local_got_offset_list): New function.
3198         * powerpc.cc (Target_powerpc::got_size): Add const.
3199         (Target_powerpc::got_entry_count): New function.
3200         (Target_powerpc::plt_entry_count): New function.
3201         (Target_powerpc::first_plt_entry_offset): New function.
3202         (Target_powerpc::plt_entry_size): New function.
3203         (Output_data_plt_powerpc::entry_count): New function.
3204         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3205         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3206         * sparc.cc (Target_sparc::got_size): Add const.
3207         (Target_sparc::got_entry_count): New function.
3208         (Target_sparc::plt_entry_count): New function.
3209         (Target_sparc::first_plt_entry_offset): New function.
3210         (Target_sparc::plt_entry_size): New function.
3211         (Output_data_plt_sparc::entry_count): New function.
3212         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3213         (Output_data_plt_sparc::get_plt_entry_size): New function.
3214         * symtab.h (Symbol::got_offset_list): New function.
3215         (Symbol_table::for_all_symbols): New function.
3216         * target.h (Sized_target::got_entry_count): New function.
3217         (Sized_target::plt_entry_count): New function.
3218         (Sized_target::plt_entry_size): New function.
3219         * x86_64.cc (Target_x86_64::got_size): Add const.
3220         (Target_x86_64::got_entry_count): New function.
3221         (Target_x86_64::plt_entry_count): New function.
3222         (Target_x86_64::first_plt_entry_offset): New function.
3223         (Target_x86_64::plt_entry_size): New function.
3224         (Output_data_plt_x86_64::entry_count): New function.
3225         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3226         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3227
3228 2010-08-12  Cary Coutant  <ccoutant@google.com>
3229
3230         * archive.cc: Include incremental.h.
3231         (Archive::Archive): Initialize incremental_info_.
3232         (Archive::include_member): Record archive members in incremental info.
3233         (Add_archive_symbols::run): Record begin and end of an archive in
3234         incremental info.
3235         (Lib_group::include_member): Record objects in incremental info.
3236         * archive.h (Incremental_archive_entry): Forward declaration.
3237         (Archive::set_incremental_info): New member function.
3238         (Archive::incremental_info): New member function.
3239         (Archive::Unused_symbol_iterator): New class.
3240         (Archive::unused_symbols_begin): New member function.
3241         (Archive::unused_symbols_end): New member function.
3242         (Archive::incremental_info_): New data member.
3243         * incremental-dump.cc (find_input_containing_global): New function.
3244         (dump_incremental_inputs): Dump new incremental info sections.
3245         * incremental.cc: Include symtab.h.
3246         (Output_section_incremental_inputs): New class.
3247         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3248         new incremental info sections.
3249         (Sized_incremental_binary::do_check_inputs): Likewise.
3250         (Incremental_inputs::report_archive): Remove.
3251         (Incremental_inputs::report_archive_begin): New function.
3252         (Incremental_inputs::report_archive_end): New function.
3253         (Incremental_inputs::report_object): New function.
3254         (Incremental_inputs::finalize_inputs): Remove.
3255         (Incremental_inputs::report_input_section): New function.
3256         (Incremental_inputs::report_script): Rewrite.
3257         (Incremental_inputs::finalize): Do nothing but finalize string table.
3258         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3259         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3260         (Incremental_inputs::create_data_sections): New function.
3261         (Incremental_inputs::relocs_entsize): New function.
3262         (Output_section_incremental_inputs::set_final_data_size): New function.
3263         (Output_section_incremental_inputs::do_write): New function.
3264         (Output_section_incremental_inputs::write_header): New function.
3265         (Output_section_incremental_inputs::write_input_files): New function.
3266         (Output_section_incremental_inputs::write_info_blocks): New function.
3267         (Output_section_incremental_inputs::write_symtab): New function.
3268         * incremental.h (Incremental_script_entry): Forward declaration.
3269         (Incremental_object_entry): Forward declaration.
3270         (Incremental_archive_entry): Forward declaration.
3271         (Incremental_inputs): Forward declaration.
3272         (Incremental_inputs_header_data): Remove.
3273         (Incremental_inputs_header): Remove.
3274         (Incremental_inputs_header_write): Remove.
3275         (Incremental_inputs_entry_data): Remove.
3276         (Incremental_inputs_entry): Remove.
3277         (Incremental_inputs_entry_write): Remove.
3278         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3279         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3280         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3281         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3282         Likewise.
3283         (Incremental_input_entry): New class.
3284         (Incremental_script_entry): New class.
3285         (Incremental_object_entry): New class.
3286         (Incremental_archive_entry): New class.
3287         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3288         (Incremental_inputs::report_inputs): Remove.
3289         (Incremental_inputs::report_archive): Remove.
3290         (Incremental_inputs::report_archive_begin): New function.
3291         (Incremental_inputs::report_archive_end): New function.
3292         (Incremental_inputs::report_object): Change prototype.
3293         (Incremental_inputs::report_input_section): New function.
3294         (Incremental_inputs::report_script): Change prototype.
3295         (Incremental_inputs::get_reloc_count): New function.
3296         (Incremental_inputs::set_reloc_count): New function.
3297         (Incremental_inputs::create_data_sections): New function.
3298         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3299         (Incremental_inputs::inputs_section): New function.
3300         (Incremental_inputs::symtab_section): New function.
3301         (Incremental_inputs::relocs_section): New function.
3302         (Incremental_inputs::get_stringpool): Add const.
3303         (Incremental_inputs::command_line): Add const.
3304         (Incremental_inputs::inputs): Remove.
3305         (Incremental_inputs::command_line_key): New function.
3306         (Incremental_inputs::input_file_count): New function.
3307         (Incremental_inputs::input_files): New function.
3308         (Incremental_inputs::relocs_entsize): New function.
3309         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3310         (Incremental_inputs::finalize_inputs): Remove.
3311         (Incremental_inputs::Input_info): Remove.
3312         (Incremental_inputs::lock_): Remove.
3313         (Incremental_inputs::inputs_): Change type.
3314         (Incremental_inputs::inputs_map_): Remove.
3315         (Incremental_inputs::current_object_entry_): New data member.
3316         (Incremental_inputs::inputs_section_): New data member.
3317         (Incremental_inputs::symtab_section_): New data member.
3318         (Incremental_inputs::relocs_section_): New data member.
3319         (Incremental_inputs::reloc_count_): New data member.
3320         (Incremental_inputs_reader): New class.
3321         (Incremental_symtab_reader): New class.
3322         (Incremental_relocs_reader): New class.
3323         * layout.cc (Layout::finalize): Move finalization of incremental info
3324         and creation of incremental info sections to follow finalization of
3325         symbol table.  Set offsets for postprocessing sections.
3326         (Layout::create_incremental_info_sections): Call
3327         Incremental_inputs::create_data_sections.  Add incremental symtab
3328         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3329         sections to layout after input sections.
3330         * layout.h (struct Timespec): Forward declaration.
3331         (Layout::incremental_inputs): Add const.
3332         (Layout::create_incremental_info_sections): Add parameter.
3333         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3334         * object.cc: Include incremental.h.
3335         (Relobj::finalize_incremental_relocs): New function.
3336         (Sized_relobj::do_layout): Record input sections in incremental info.
3337         * object.h (Object::output_section): New function.
3338         (Object::output_section_offset): Moved from Relobj.
3339         (Object::get_incremental_reloc_base): New function.
3340         (Object::get_incremental_reloc_count): New function.
3341         (Object::do_output_section): New function.
3342         (Object::do_output_section_offset): Moved from Relobj.
3343         (Object::do_get_incremental_reloc_base): New function.
3344         (Object::do_get_incremental_reloc_count): New function.
3345         (Object::Object): Initialize new data members.
3346         (Relobj::output_section): Renamed do_output_section and moved to
3347         protected.
3348         (Relobj::output_section_offset): Moved to Object.
3349         (Relobj::do_get_incremental_reloc_base): New function.
3350         (Relobj::do_get_incremental_reloc_count): New function.
3351         (Relobj::allocate_incremental_reloc_counts): New function.
3352         (Relobj::count_incremental_reloc): New function.
3353         (Relobj::finalize_incremental_relocs): New function.
3354         (Relobj::next_incremental_reloc_index): New function.
3355         (Relobj::reloc_counts_): New data member.
3356         (Relobj::reloc_bases_): New data member.
3357         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3358         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3359         (Sized_relobj::incremental_relocs_scan): New function.
3360         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3361         (Sized_relobj::incremental_relocs_write): New function.
3362         (Sized_relobj::incremental_relocs_write_reltype): New function.
3363         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3364         incremental link.
3365         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3366         archives and object files elsewhere.
3367         (Add_symbols::run): Report object files here.
3368         (Finish_group::run): Report end of archive at end of group.
3369         * reloc.cc: Include layout.h, incremental.h.
3370         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3371         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3372         (Sized_relobj::incremental_relocs_scan): New function.
3373         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3374         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3375         (Sized_relobj::incremental_relocs_write): New function.
3376         (Sized_relobj::incremental_relocs_write_reltype): New function.
3377         * script.cc (read_input_script): Rewrite test for incremental link.
3378         Change call to Incremental_inputs::report_script.
3379         * symtab.h (Symbol_table::first_global_index): New function.
3380         (Symbol_table::output_count): New function.
3381
3382 2010-08-12  Doug Kwan  <dougkwan@google.com>
3383
3384         * arm.cc (Target_arm::merge_object_attributes): Check command line
3385         options --no-wchar-size-warning and --no-enum-size-warning.
3386         * options.h (General_options): Add ld-compatible options
3387         --no-enum-size-warning and --no-wchar-size-warning.
3388
3389 2010-08-04  Ian Lance Taylor  <iant@google.com>
3390
3391         * x86_64.cc (Target_x86_64::Scan::local): Use
3392         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3393         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3394         (Target_x86_64::Scan::global): Likewise.
3395         (Target_x86_64::Relocate::relocate): Likewise.
3396         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3397         Likewise.
3398
3399 2010-08-03  Cary Coutant  <ccoutant@google.com>
3400
3401         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3402         to reserve space in merged_strings vector. Keep total input size
3403         for stats.
3404         (Output_merge_string::do_print_merge_stats): Print total input size.
3405         * merge.h (Output_merge_string): Add input_size_ field.
3406         * stringpool.cc (Stringpool_template::string_length): Move
3407         implementations out of Stringpool_template class and place in
3408         stringpool.h.
3409         * stringpool.h (string_length): Move out of Stringpool_template.
3410
3411 2010-08-03  Ian Lance Taylor  <iant@google.com>
3412
3413         PR 11712
3414         * layout.cc (relaxation_loop_body): If address of load segment is
3415         set, adjust address to include headers if possible.
3416
3417 2010-08-03  Ian Lance Taylor  <iant@google.com>
3418
3419         * version.cc (version_string): Bump to 1.10.
3420
3421 2010-08-03  Ian Lance Taylor  <iant@google.com>
3422
3423         PR 11805
3424         * layout.h (enum Output_section_order): Define.
3425         (class Layout): Update declarations.
3426         * layout.cc (Layout::get_output_section): Add order parameter.
3427         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3428         is_first_non_relro parameters.  Change all callers.
3429         (Layout::choose_output_section): Likewise.
3430         (Layout::add_output_section_data): Likewise.
3431         (Layout::make_output_section): Likewise.  Set order.
3432         (Layout::default_section_order): New function.
3433         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3434         * output.cc (Output_section::Output_section): Initialize order_.
3435         Don't initialize deleted fields.
3436         (Output_segment::Output_segment): Don't initialize deleted
3437         fields.
3438         (Output_segment::add_output_section_to_load): New function
3439         replacing add_output_section.  Change all callers to call this or
3440         add_output_section_to_nonload.
3441         (Output_segment::add_output_section_to_nonload): New function.
3442         (Output_segment::remove_output_section): Rewrite.
3443         (Output_segment::add_initial_output_data): Likewise.
3444         (Output_segment::has_any_data_sections): Likewise.
3445         (Output_segment::is_first_section_relro): Likewise.
3446         (Output_segment::maximum_alignment): Likewise.
3447         (Output_segment::has_dynamic_reloc): New function replacing
3448         dynamic_reloc_count.  Change all callers.
3449         (Output_segment::has_dynamic_reloc_list): New function replacing
3450         dynamic_reloc_count_list.  Change all callers.
3451         (Output_segment::set_section_addresses): Rewrite.
3452         (Output_segment::set_offset): Rewrite.
3453         (Output_segment::find_first_and_last_list): Remove.
3454         (Output_segment::set_tls_offsets): Rewrite.
3455         (Output_segment::first_section_load_address): Likewise.
3456         (Output_segment::output_section_count): Likewise.
3457         (Output_segment::section_with_lowest_load_address): Likewise.
3458         (Output_segment::write_section_headers): Likewise.
3459         (Output_segment::print_sections_to_map): Likewise.
3460         * output.h (class Output_data): Remove dynamic_reloc_count_
3461         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3462         (Output_data::add_dynamic_reloc): Rewrite.
3463         (Output_data::has_dynamic_reloc): New function.
3464         (Output_data::dynamic_reloc_count): Remove.
3465         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3466         is_last_relro_, is_first_non_relro_, is_interp_,
3467         is_dynamic_linker_section_ fields.  Add order and set_order
3468         functions.  Remove is_relro_local, set_is_relro_local,
3469         is_last_relro, set_is_last_relro, is_first_non_relro,
3470         set_is_first_non_relro functions, is_interp, set_is_interp,
3471         is_dynamic_linker_section, and set_is_dynamic_linker_section
3472         functions.
3473         (class Output_segment): Change Output_data_list from std::list to
3474         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3475         output_bss_ fields.  Update declarations.
3476
3477 2010-08-02  Ian Lance Taylor  <iant@google.com>
3478
3479         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3480         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3481         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3482
3483 2010-08-02  Ian Lance Taylor  <iant@google.com>
3484
3485         PR 11855
3486         * script.cc (Script_options::Script_options): Initialize
3487         symbol_definitions_ and symbol_references_.
3488         (Script_options::add_symbol_assignment): Update
3489         symbol_definitions_ and symbol_references_.
3490         (Script_options::add_symbol_reference): New function.
3491         (script_symbol): New function.
3492         * script.h (class Script_options): Add symbol_definitions_ and
3493         symbol_references_ fields.
3494         (Script_options::referenced_const_iterator): New type.
3495         (Script_options::referenced_begin): New function.
3496         (Script_options::referenced_end): New function.
3497         (Script_options::is_referenced): New function.
3498         (Script_options::any_unreferenced): New function.
3499         * script-c.h (script_symbol): Declare.
3500         * yyscript.y (exp): Call script_symbol.
3501         * symtab.cc: Include "script.h".
3502         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3503         Change all callers.  Check symbols referenced by scripts.
3504         (Symbol_table::add_undefined_symbols_from_command_line): Add
3505         layout parameter.  Change all callers.
3506         (Symbol_table::do_add_undefined_symbols_from_command_line):
3507         Likewise.  Break out loop body.  Check symbols referenced by
3508         scripts.
3509         (Symbol_table::add_undefined_symbol_from_command_line): New
3510         function broken out of
3511         do_add_undefined_symbols_from_command_line.
3512         * symtab.h (class Symbol_table): Update declarations.
3513         * archive.cc: Include "layout.h".
3514         (Archive::should_include_member): Add layout parameter.  Change
3515         all callers.  Check for symbol mentioned in expression.
3516         * archive.h (class Archive): Update declaration.
3517         * object.cc (Sized_relobj::do_should_include_member): Add layout
3518         parameter.
3519         * object.h (Object::should_include_member): Add layout parameter.
3520         Change all callers.
3521         (Object::do_should_include_member): Add layout parameter.
3522         (class Sized_relobj): Update declaration.
3523         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3524         parameter.
3525         * dynobj.h (class Sized_dynobj): Update declaration.
3526         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3527         layout parameter.
3528         * plugin.h (class Sized_pluginobj): Update declaration.
3529
3530 2010-08-02  Ian Lance Taylor  <iant@google.com>
3531
3532         PR 11866
3533         * output.cc (Output_segment::set_offset): Search for the first and
3534         last sections rather than assuming that the list is in order.
3535         (Output_segment::find_first_and_last_list): New function.
3536         * output.h (class Output_segment): Update declarations.
3537         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3538         (relro_strip_test_SOURCES): New variable.
3539         (relro_strip_test_DEPENDENCIES): New variable.
3540         (relro_strip_test_LDFLAGS): New variable.
3541         (relro_strip_test_LDADD): New variable.
3542         (relro_strip_test.so): New target.
3543
3544 2010-08-02  Ian Lance Taylor  <iant@google.com>
3545
3546         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3547         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3548         (Target_i386::got_tlsdesc_section): New function.
3549         (Target_i386::got_section): Create space for GOT entries for
3550         TLSDESC relocations.
3551         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3552         R_386_TLS_GOTDESC.
3553         (Target_i386::Scan::global): Likewise.
3554         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3555         using TLSDESC GOT.
3556         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3557         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3558         (Target_x86_64::got_tlsdesc_section): New function.
3559         (Target_x86_64::got_section): Create space for GOT entries for
3560         TLSDESC relocations.
3561         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3562         R_386_TLS_GOTDESC.
3563         (Target_x86_64::Scan::global): Likewise.
3564         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3565         using TLSDESC GOT.
3566
3567 2010-08-02  Ian Lance Taylor  <iant@google.com>
3568
3569         * testsuite/final_layout.sh: Use dc to convert from hex to
3570         decimal.
3571
3572 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3573
3574         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3575         paramter to the call to gold::gc_process_relocs.
3576         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3577         paramter to the call to gold::gc_process_relocs.
3578         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3579         parameter to the call to gold::gc_process_relocs.
3580         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3581         template parameter to the call to gold::gc_process_relocs.
3582         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3583         paramter to the call to gold::gc_process_relocs.
3584         * gc.h (get_embedded_addend_size): New function.
3585         (gc_process_relocs): Save the size of the reloc for use by ICF.
3586         * icf.cc (get_section_contents): Get the addend from the text section
3587         for SHT_REL relocation sections.
3588         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3589         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3590         * int_encoding.h (read_from_pointer): New overloaded function.
3591         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3592         * testsuite/icf_sht_rel_addend_test.sh: New file.
3593         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3594         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3595
3596 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3597
3598         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3599         * Makefile.in: Regenerate.
3600         * testsuite/Makefile.in: Regenerate.
3601
3602 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3603
3604         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3605         * gold/testsuite/debug_msg.cc: Likewise.
3606         * gold/testsuite/odr_violation1.cc
3607         * gold/testsuite/odr_violation2.cc
3608
3609 2010-07-21  Cary Coutant  <ccoutant@google.com>
3610
3611         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3612         string, and length fields.
3613         (Output_merge_string::Merged_strings_list): New type.
3614         (Output_merge_string::Merged_strings_lists): New typedef.
3615         (Output_merge_string): Replace merged_strings_ with
3616         merged_strings_lists_.
3617         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3618         Merged_strings_list per input object and section.  Don't store pointer
3619         to the string.  Don't store length with each merged string entry.
3620         (Output_merge_string::finalize_merged_data): Loop over list of merged
3621         strings lists.  Recompute length of each merged string.
3622
3623 2010-07-15  Cary Coutant  <ccoutant@google.com>
3624
3625         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3626         here.
3627
3628 2010-07-14  Ian Lance Taylor  <iant@google.com>
3629
3630         * descriptors.cc (Descriptors::open): Report correct name in error
3631         message.
3632
3633 2010-07-13  Doug Kwan  <dougkwan@google.com>
3634
3635         * arm.cc (Arm_input_section::Arm_input_section): For a
3636         SHT_ARM_EXIDX section, always keeps the input sections.
3637         (Arm_input_section::set_exidx_section_link): New method.
3638         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3639         has_errors_ to false.
3640         (Arm_exidx_input_section::has_errors,
3641         Arm_exidx_input_section::set_has_errors): New methods.
3642         (Arm_exidx_input_section::has_errors_): New data member.
3643         (Arm_relobj::get_exidx_shndx_list): New method.
3644         (Arm_output_section::append_text_sections_to_list): Do not skip
3645         section without SHF_EXECINSTR.
3646         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3647         errors.
3648         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3649         section header.  Make error messages more verbose.  Check for
3650         a non-executable section linked to an EXIDX section.
3651         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3652         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3653         check that there is no deferred EXIDX section if we exit early.
3654         Instead of not making an EXIDX section in case of an error, make one
3655         and set the has_errors flag of it.
3656         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3657         in a relocatable link.
3658         (Target_arm::do_relax): Look for the EXIDX output section instead of
3659         assuming that it is called .ARM.exidx.
3660         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3661         section list.  Do not check for SHF_EXECINSTR section flags but
3662         skip any input section with errors.
3663         * output.cc (Output_section::Output_section): Initialize
3664         always_keeps_input_sections_ to false.
3665         (Output_section::add_input_section): Check for
3666         always_keeps_input_sections_.
3667         *  output.h (Output_section::always_keeps_input_sections,
3668         Output_section::set_always_keeps_input_sections): New methods.
3669         (Output_section::always_keeps_input_sections): New data member.
3670
3671 2010-07-13  Rafael Espindola  <espindola@google.com>
3672
3673         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3674         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3675
3676 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3677             Ian Lance Taylor  <iant@google.com>
3678
3679         * output.h (Output_section_lookup_maps::add_merge_section):
3680         Correct check of whether value was inserted.
3681         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3682         (Output_section_lookup_maps::add_relaxed_input_section):
3683         Likewise.
3684         * arm.cc (Target_arm::got_section): Remove used local os.
3685         * i386.cc (Target_i386::got_section): Likewise.
3686         * x86_64.cc (Target_x86_64::got_section): Likewise.
3687         * sparc.cc (Target_sparc::got_section): Likewise.
3688         (Target_sparc::relocate): Remove unused local have_got_offset.
3689         * powerpc.cc (Target_powerpc::relocate): Likewise.
3690
3691 2010-07-13  Ian Lance Taylor  <iant@google.com>
3692
3693         * compressed_output.cc (zlib_decompress): Fix signature in
3694         !HAVE_ZLIB_H case.
3695
3696         * archive.cc (Archive::include_member): Unlock an external member
3697         of a thin archive.  Don't bother to delete an object we know is
3698         NULL.
3699
3700 2010-07-12  Cary Coutant  <ccoutant@google.com>
3701
3702         * compressed_output.cc (zlib_decompress): New function.
3703         (get_uncompressed_size): New function.
3704         (decompress_input_section): New function.
3705         * compressed_output.h (get_uncompressed_size): New function.
3706         (decompress_input_section): New function.
3707         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3708         Handle compressed debug sections.
3709         * layout.cc (is_compressed_debug_section): New function.
3710         (Layout::output_section_name): Map compressed section names to
3711         canonical names.
3712         * layout.h (is_compressed_debug_section): New function.
3713         (is_debug_info_section): Recognize compressed debug sections.
3714         * merge.cc: Include compressed_output.h.
3715         (Output_merge_data::do_add_input_section): Handle compressed
3716         debug sections.
3717         (Output_merge_string::do_add_input_section): Handle compressed
3718         debug sections.
3719         * object.cc: Include compressed_output.h.
3720         (Sized_relobj::Sized_relobj): Initialize new data members.
3721         (build_compressed_section_map): New function.
3722         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3723         * object.h (Object::section_is_compressed): New method.
3724         (Object::do_section_is_compressed): New method.
3725         (Sized_relobj::Compressed_section_map): New type.
3726         (Sized_relobj::do_section_is_compressed): New method.
3727         (Sized_relobj::compressed_sections_): New data member.
3728         * output.cc (Output_section::add_input_section): Handle compressed
3729         debug sections.
3730         * reloc.cc: Include compressed_output.h.
3731         (Sized_relobj::write_sections): Handle compressed debug sections.
3732
3733 2010-07-08  Cary Coutant  <ccoutant@google.com>
3734
3735         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3736         weak when resolving to a dynamic def.
3737         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3738         for weak undef/dynamic def cases. Adjust callers.
3739         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3740         undef_binding_weak_.
3741         (Symbol_table::sized_write_globals): Adjust symbol binding.
3742         (Symbol_table::sized_write_symbol): Add binding parameter.
3743         * symtab.h (Symbol::set_undef_binding): New method.
3744         (Symbol::is_undef_binding_weak): New method.
3745         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3746         (Symbol_table::should_override): Add new parameter.
3747         (Symbol_table::sized_write_symbol): Add new parameter.
3748
3749         * testsuite/weak_undef_file1.cc: Add new test case.
3750         * testsuite/weak_undef_file2.cc: Fix header comment.
3751         * testsuite/weak_undef_test.cc: Add new test case.
3752
3753 2010-06-29  Doug Kwan  <dougkwan@google.com>
3754
3755         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3756         Initialize USE_SYMBOL_.
3757         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3758         definition.
3759         (Arm_reloc_property::uses_symbol_): New data member declaration.
3760         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3761         uses symbol value and symbol is undefined but not weakly undefined.
3762
3763 2010-06-28  Rafael Espindola  <espindola@google.com>
3764
3765         * plugin.cc (Plugin::load): Use dlerror.
3766
3767 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3768
3769         * symtab.cc (detect_odr_violations): When reporting an ODR
3770         violation, report an object where the symbol is defined.
3771
3772 2010-06-25  Doug Kwan  <dougkwan@google.com>
3773
3774         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3775         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3776         definition.
3777         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3778         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3779         target hook to detect function points.
3780         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3781         * icf.h (Icf::check_section_for_function_pointers): Change type of
3782         parameter SECTION_NAME to const reference to std::string.  Use
3783         target hook to determine if section may have unsafe pointers.
3784         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3785         method definition.
3786
3787 2010-06-21  Rafael Espindola  <espindola@google.com>
3788
3789         * fileread.cc (Input_file::find_fie): New
3790         (Input_file::open): Use Input_file::find_fie.
3791         * fileread.h (Input_file::find_fie): New
3792         * plugin.cc (set_extra_library_path): New.
3793         (Plugin::load): Add set_extra_library_path to the transfer vector.
3794         (Plugin_manager::set_extra_library_path): New.
3795         (Plugin_manager::add_input_file): Use the extra search path if set.
3796         (set_extra_library_path(): New.
3797         * plugin.h (Plugin_manager): Add set_extra_library_path and
3798         extra_search_path_.
3799
3800 2010-06-19  Cary Coutant  <ccoutant@google.com>
3801
3802         * layout.cc (gdb_sections): Add .debug_types.
3803         (lines_only_debug_sections): Likewise.
3804
3805 2010-06-18  Rafael Espindola  <espindola@google.com>
3806
3807         * plugin.cc (add_input_file,add_input_library)
3808         (Plugin_manager::add_input_file): Make filename arguments const.
3809         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3810         const.
3811
3812 2010-06-16  Doug Kwan  <dougkwan@google.com>
3813
3814         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3815         .ARM.attributes section if we have not merged any input
3816         attributes sections.
3817
3818 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3819
3820         * arm.cc: Allow combining objects with no EABI version
3821         information.
3822
3823 2010-06-15  Rafael Espindola  <espindola@google.com>
3824
3825         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3826
3827 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3828
3829         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3830         (struct iovec): Correct !HAVE_READV definition.
3831
3832 2010-06-10  Cary Coutant  <ccoutant@google.com>
3833
3834         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3835         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3836         reloc sections.
3837         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3838
3839         PR 11683
3840         * symtab.h (Symbol::is_placeholder): New member function.
3841         * target-reloc.h (relocate_section): Check for placeholder symbols.
3842
3843         * testsuite/Makefile.am (plugin_test_8): New test.
3844         (plugin_test_9): New test.
3845         * testsuite/Makefile.in: Regenerate.
3846
3847 2010-06-09  Nick Clifton  <nickc@redhat.com>
3848
3849         * yyscript.y (input_list_element): Allow strings prefixed with
3850         the '-' character.  Treat these as libraries.
3851         * script.cc (script_add_library): New function.  Adds a library
3852         specified by "-l<name>" found in an input script.
3853         * script-c.h: Add prototype for script_add_library.
3854
3855 2010-06-07  Doug Kwan  <dougkwan@google.com>
3856
3857         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3858         Restrict stub-group size to be within long conditional branch
3859         range when working around cortex-A8 erratum.
3860
3861 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3862
3863         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3864         #ifdef typo.
3865
3866 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3867
3868         PR gold/11658
3869         * output.cc
3870         (Output_section::Input_section_sort_entry::compare_section_ordering):
3871         Change to return non-zero correctly.
3872         (Output_section::Input_section_sort_section_order_index_compare
3873         ::operator()): Change to fix ambiguity in comparisons.
3874
3875 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3876
3877         * gold.h (is_wildcard_string): New function.
3878         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3879         (Layout::layout_eh_frame): Ditto.
3880         (Layout::find_section_order_index): New method.
3881         (Layout::read_layout_from_file): New method.
3882         * layout.h (Layout::find_section_order_index): New method.
3883         (Layout::read_layout_from_file): New method.
3884         (Layout::input_section_position_): New private member.
3885         (Layout::input_section_glob_): New private member.
3886         * main.cc (main): Call read_layout_from_file here.
3887         * options.h (--section-ordering-file): New option.
3888         * output.cc (Output_section::input_section_order_specified_): New
3889         member.
3890         (Output_section::Output_section): Initialize new member.
3891         (Output_section::add_input_section): Add new parameter.
3892         Keep input sections when --section-ordering-file is used.
3893         (Output_section::set_final_data_size): Sort input sections when
3894         section ordering file is specified.
3895         (Output_section::Input_section_sort_entry): Add new parameter.
3896         Check sorting type.
3897         (Output_section::Input_section_sort_entry::compare_section_ordering):
3898         New method.
3899         (Output_section::Input_section_sort_compare::operator()): Change to
3900         consider section_order_index.
3901         (Output_section::Input_section_sort_init_fini_compare::operator()):
3902         Change to consider section_order_index.
3903         (Output_section::Input_section_sort_section_order_index_compare
3904         ::operator()): New method.
3905         (Output_section::sort_attached_input_sections): Change to sort
3906         according to section order when specified.
3907         (Output_section::add_input_section<32, true>): Add new parameter.
3908         (Output_section::add_input_section<64, true>): Add new parameter.
3909         (Output_section::add_input_section<32, false>): Add new parameter.
3910         (Output_section::add_input_section<64, false>): Add new parameter.
3911         * output.h (Output_section::add_input_section): Add new parameter.
3912         (Output_section::input_section_order_specified): New
3913         method.
3914         (Output_section::set_input_section_order_specified): New method.
3915         (Input_section::Input_section): Initialize section_order_index_.
3916         (Input_section::section_order_index): New method.
3917         (Input_section::set_section_order_index): New method.
3918         (Input_section::section_order_index_): New member.
3919         (Input_section::Input_section_sort_section_order_index_compare): New
3920         struct.
3921         (Output_section::input_section_order_specified_): New member.
3922         * script-sections.cc (is_wildcard_string): Delete and move modified
3923         method to gold.h.
3924         (Output_section_element_input::Output_section_element_input): Modify
3925         call to is_wildcard_string.
3926         (Output_section_element_input::Input_section_pattern
3927         ::Input_section_pattern): Ditto.
3928         (Output_section_element_input::Output_section_element_input): Ditto.
3929         * testsuite/Makefile.am (final_layout): New test case.
3930         * testsuite/Makefile.in: Regenerate.
3931         * testsuite/final_layout.cc: New file.
3932         * testsuite/final_layout.sh: New file.
3933
3934 2010-06-01  Rafael Espindola  <espindola@google.com>
3935
3936         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3937
3938 2010-06-01  Rafael Espindola  <espindola@google.com>
3939
3940         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3941         visibility of symbols.
3942
3943 2010-05-27  Doug Kwan  <dougkwan@google.com>
3944
3945         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3946         from start of output section instead of address for a local symbol
3947         in a merged or relaxed section when doing a relocatable link.
3948
3949 2010-05-26  Rafael Espindola  <espindola@google.com>
3950
3951        PR 11604
3952         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3953         adding sections the garbage collector removed.
3954         * gold/testsuite/Makefile.am: Add test.
3955         * gold/testsuite/Makefile.in: Regenerate.
3956         * gold/testsuite/plugin_test_7.sh: New.
3957         * gold/testsuite/plugin_test_7_1.c: New.
3958         * gold/testsuite/plugin_test_7_2.c: New.
3959
3960 2010-05-26  Rafael Espindola  <espindola@google.com>
3961
3962         * script-sections.cc (Output_section_definition::set_section_addresses):
3963         Check for --section-start.
3964
3965 2010-05-26  Doug Kwan  <dougkwan@google.com>
3966
3967         * arm.cc (Arm_scan_relocatable_relocs): New class.
3968         (Target_arm::relocate_special_relocatable): New method.
3969         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3970         (Arm_relocate_functions::thumb_branch_common): Same.
3971         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3972         instead of Default_scan_relocatable_relocs.
3973         * target-reloc.h (relocate_for_relocatable): Let target handle
3974         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3975         * target.h (Sized_target::relocate_special_relocatable): New method.
3976
3977 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3978
3979         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3980
3981 2010-05-23  Doug Kwan  <dougkwan@google.com>
3982
3983         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3984         instead of a cast.
3985         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3986         with a direct branch, not a conditional branch, to a stub.
3987         * merge.cc (Output_merge_base::record_input_section): New method
3988         defintion.
3989         (Output_merge_data::do_add_input_section): Record input section if
3990         keeps-input-sections flag is set.
3991         (Output_merge_string::do_add_input_section): Ditto.
3992         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3993         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3994         INPUT_SECTIONS_.
3995         (Output_merge_base::keeps_input_sections,
3996         Output_merge_base::set_keeps_input_sections,
3997         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3998         method definitions.
3999         (Output_merge_base::Input_sections): New type declaration.
4000         (Output_merge_base::input_sections_begin,
4001         Output_merge_base::input_sections_end,
4002         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4003         (Output_merge_base::bool keeps_input_sections_,
4004         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4005         Output_merge_base::input_sections_): New data members.
4006         (Output_merge_data::do_set_keeps_input_sections): New method
4007         defintion.
4008         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4009         * output.cc (Output_section::Input_section::relobj): Move method
4010         defintion from class declaration to here and handle merge sections.
4011         (Output_section::Input_section::shndx): Ditto.
4012         (Output_section::Output_section): Remove initializations of removed
4013         data members and initialize new data member LOOKUP_MAPS_.
4014         (Output_section::add_input_section): Set keeps-input-sections flag
4015         for a newly created merge output section as appropriate.  Adjust code
4016         to use Output_section_lookup_maps class.
4017         (Output_section::add_relaxed_input_section): Adjst code for lookup
4018         maps code refactoring.
4019         (Output_section::add_merge_input_section): Add a new parameter
4020         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4021         class.  If adding input section to a newly created merge output
4022         section fails, remove the new merge section.
4023         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4024         Adjust code for use of the Output_section_lookup_maps class.
4025         (Output_section::find_merge_section): Ditto.
4026         (Output_section::build_lookup_maps): New method defintion.
4027         (Output_section::find_relaxed_input_section): Adjust code to use
4028         Output_section_lookup_maps class.
4029         (Output_section::get_input_sections): Export merge sections.  Adjust
4030         code to use Output_section_lookup_maps class.
4031         (Output_section:::add_script_input_section): Adjust code to use
4032         Output_section_lookup_maps class.  Update lookup maps for merge
4033         sections also.
4034         (Output_section::discard_states): Use Output_section_lookup_maps.
4035         (Output_section::restore_states): Same.
4036         * output.h (Merge_section_properties): Move class defintion out of
4037         Output_section.
4038         (Output_section_lookup_maps): New class.
4039         (Output_section::Input_section::is_merge_section): New method
4040         defintion.
4041         (Output_section::Input_section::relobj): Move defintion out of class
4042         defintion.  Declare method only.
4043         (Output_section::Input_section::shndx): Ditto.
4044         (Output_section::Input_section::output_merge_base): New method defintion.
4045         (Output_section::Input_section::u2_.pomb): New union field.
4046         (Output_section::Merge_section_by_properties_map,
4047         Output_section::Output_section_data_by_input_section_map,
4048         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4049         Remove types.
4050         (Output_section::add_merge_input_section): Add new parameter
4051         KEEPS_INPUT_SECTIONS.
4052         (Output_section::build_lookup_maps): New method declaration.
4053         (Output_section::merge_section_map_,
4054         Output_section::merge_section_by_properties_map_,
4055         Output_section::relaxed_input_section_map_,
4056         Output_section::is_relaxed_input_section_map_valid_): Remove data
4057         members.
4058         (Output_section::lookup_maps_): New data member.
4059
4060 2010-05-21  Doug Kwan  <dougkwan@google.com>
4061
4062         PR gold/11619
4063         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4064         avoid a compilation error.
4065
4066 2010-05-19  Rafael Espindola  <espindola@google.com>
4067
4068         * script-sections.cc (Output_section_definition::allocate_to_segment):
4069         Update the phdrs_list even when the output section is NULL.
4070         * testsuite/Makefile.am: Add test.
4071         * testsuite/Makefile.in: Regenerate.
4072         * testsuite/script_test_9.cc: New.
4073         * testsuite/script_test_9.sh: New.
4074         * testsuite/script_test_9.t: New.
4075
4076 2010-05-19  Doug Kwan  <dougkwan@google.com>
4077
4078         * arm.cc (Arm_input_section::original_size): New method.
4079         (Arm_input_section::do_addralign): Add a cast.
4080         (Arm_input_section::do_output_offset): Remove static cast.
4081         (Arm_input_section::original_addralign,
4082          Arm_input_section::original_size_): Change type to uint32_t.
4083         (Arm_input_section::init): Add safe casts for section alignment
4084         and size.
4085         (Arm_input_section::set_final_data_size): Do not set address and
4086         offset of stub table.
4087         (Arm_output_section::fix_exidx_coverage): Change use of of
4088         Output_section::Simple_input_section to that of
4089         Output_section::Input_section.
4090         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4091         except for the first pass.
4092         * output.cc (Output_section::get_input_sections): Change type of
4093         input_sections to std::list<Input_section>.
4094         (Output_section::add_script_input_section): Rename from
4095         Output_section::add_simple_input_section.  Change type of SIS
4096         parameter from Simple_input_section to Input_section.
4097         * output.h (Output_section::Simple_input_section): Remove class.
4098         (Output_section::Input_section): Change class visibility to public.
4099         (Output_section::Input_section::addralign): Use stored alignments
4100         for special input sections if set.
4101         (Output_section::Input_section::set_addralign): New method.
4102         (Output_section::get_input_sections): Change parameter type from
4103         list of Simple_input_section to list of Input_section.
4104         (Output_section::add_script_input_section): Rename from
4105         Output_section::add_simple_input_section. Change first parameter's
4106         type from Simple_input_section to Input_section and remove the
4107         second and third parameters.
4108         * script-sections.cc (Input_section::Input_section_list): Change
4109         type to list of Output_section::Input_section/
4110         (Input_section_info::Input_section_info): Change parameter type of
4111         INPUT_SECTION to Output_section::Input_section.
4112         (Input_section_info::input_section): Change return type.
4113         (Input_section_info::input_section_): Change type to
4114         Output_section::Input_section.
4115         (Output_section_element_input::set_section_addresses): Adjust code
4116         to use Output_section::Input_section instead of
4117         Output_section::Simple_input_section.  Adjust code for renaming
4118         of Output_section::add_simple_input_section.
4119         (Orphan_output_section::set_section_addresses): Ditto.
4120
4121 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4122
4123         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4124         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4125
4126 2010-05-18  Rafael Espindola  <espindola@google.com>
4127
4128         * options.cc (General_options::finalize): Handle -nostdlib.
4129         * options.h (nostdlib): New option.
4130         * script.cc (script_add_search_dir): Handle -nostdlib.
4131
4132 2010-05-12  Doug Kwan  <dougkwan@google.com>
4133
4134         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4135         attributes section only if there no attributes section after merging.
4136         (Target_arm::merge_object_attributes): Move value of
4137         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4138         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4139         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4140         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4141         and arm_attr_merge_7.stdout.
4142         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4143         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4144         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4145         arm_attr_merge_7b.o): New rules.
4146         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4147         arm_attr_merge_7
4148         * testsuite/Makefile.in: Regenerate.
4149         * testsuite/arm_attr_merge.sh: New file.
4150         * testsuite/arm_attr_merge_[67][ab].s: Same.
4151
4152 2010-05-05  Nick Clifton  <nickc@redhat.com>
4153
4154         * po/es.po: Updated Spanish translation.
4155
4156 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4157
4158         * Makefile.am (install-exec-local): Properly install gold as
4159         default cross linker.
4160         * Makefile.in: Regenerated.
4161
4162 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4163             Nick Clifton  <nickc@redhat.com>
4164
4165         * configure.ac (install_as_default): Define and set to false
4166         unless --enable-gold or --enable-gold=both/gold has been
4167         specified.
4168         * configure: Regenerate.
4169
4170         * Makefile.am (install-exec-local): Install the executable as
4171         'ld.gold'.  If install_as_default is true then also install it as
4172         'ld'.
4173         * Makefile.in: Regenerated.
4174
4175 2010-04-24  Ian Lance Taylor  <iant@google.com>
4176
4177         * layout.cc (Layout::layout_reloc): In relocatable link don't
4178         combine reloc sections for grouped sections.
4179
4180 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4181
4182         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4183         sections that are not ordinary to icf.
4184         * icf.cc (get_section_contents): Handle relocation pointing to section
4185         with no object or shndx information.
4186         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4187         * testsuite/Makefile.in: Regenerate.
4188         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4189         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4190
4191 2010-04-22  Ian Lance Taylor  <iant@google.com>
4192
4193         * expression.cc (Expression::Expression_eval_info): Add
4194         result_alignment_pointer field.
4195         (Expression::eval_with_dot): Add result_alignment_pointer
4196         parameter.  Change all callers.
4197         (Expression::eval_maybe_dot): Likewise.
4198         (class Binary_expression): Add alignment_pointer parameter to
4199         left_value and right_value.  Change all callers.
4200         (BINARY_EXPRESSION): Set result alignment.
4201         (class Trinary_expression): Add alignment_pointer parameter to
4202         arg2_value and arg3_value.  Change all callers.
4203         (Trinary_cond::value): Set result alignment.
4204         (Max_expression::value, Min_expression::value): Likewise.
4205         (Align_expression::value): Likewise.
4206         * script-sections.cc (class Sections_element): Add dot_alignment
4207         parameter to set_section_addresses virtual function.  Update
4208         instantiations.
4209         (class Output_section_element): Likewise.
4210         (Script_sections::create_segments): Add dot_alignment parameter.
4211         Change all callers.
4212         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4213         (Script_sections::set_phdrs_clause_addresses): Likewise.
4214         * script-sections.h: Update declarations.
4215         * script.h: Update declarations.
4216         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4217         min_p_align.
4218         * testsuite/script_test_3.t: Set large alignment.
4219         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4220         segment has expected alignment.
4221
4222 2010-04-22  Nick Clifton  <nickc@redhat.com>
4223
4224         * po/gold.pot: Updated by the Translation project.
4225         * po/vi.po: Updated Vietnamese translation.
4226
4227 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4228
4229         * testsuite/Makefile.am (check_PROGRAMS): Add
4230         icf_virtual_function_folding_test.
4231         * testsuite/Makefile.in: Regenerated.
4232
4233 2010-04-15  Andrew Haley  <aph@redhat.com>
4234
4235         * options.h (merge_exidx_entries): New option.
4236         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4237         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4238         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4239         (Target_arm::merge_exidx_entries): New function.
4240         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4241         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4242         to Arm_exidx_fixup constructor.
4243         Add new arg, merge_exidx_entries.
4244         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4245         Arm_output_section::fix_exidx_coverage.
4246
4247 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4248
4249         * icf.cc (get_section_contents): Check for preemptible functions.
4250         Ignore addend when appropriate.
4251         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4252         section folded.
4253         (add_from_relobj): Check for section folded.
4254         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4255         * symtab.h (should_add_dynsym_entry): Add new parameter.
4256         * target-reloc.h (scan_relocs): Check for section folded.
4257         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4258         Check reloc types for function pointers in shared objects.
4259         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4260         case.
4261         (icf_preemptible_functions_test): New test case.
4262         (icf_string_merge_test): New test case.
4263         * testsuite.Makefile.in: Regenerate.
4264         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4265         bar_glob.  Refactor code.
4266         * testsuite/icf_preemptible_functions_test.cc: New file.
4267         * testsuite/icf_preemptible_functions_test.sh: New file.
4268         * testsuite/icf_string_merge_test.cc: New file.
4269         * testsuite/icf_string_merge_test.sh: New file.
4270         * testsuite/icf_virtual_function_folding_test.cc: New file.
4271         * testsuite/icf_virtual_function_folding_test.sh: New file.
4272
4273 2010-04-14  Doug Kwan  <dougkwan@google.com>
4274
4275         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4276         for local symbol recounting if we remove a section due to ICF.
4277         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4278         there are no regular objects in input.
4279
4280 2010-04-13  Doug Kwan  <dougkwan@google.com>
4281
4282         * arm.cc (Arm_input_section::set_final_data_size): Compute
4283         accurate final data size instead of using current data size.
4284
4285 2010-04-09  Doug Kwan  <dougkwan@google.com>
4286
4287         * layout.cc (Layout::choose_output_section): Handle script section
4288         types.
4289         (Layout::make_output_section_for_script): Add section type parameter.
4290         Handle script section types.
4291         * layout.h (Layout::make_output_section_for_script): Add section
4292         type parameter.
4293         * output.cc (Output_section::Output_section): Initialize data member
4294         is_noload_.
4295         (Output_section::do_reset_address_and_file_offset): Do not set address
4296         to 0 if section is a NOLOAD section.
4297         * output.h (Output_section::is_noload): New method.
4298         (Output_section::set_is_noload): Ditto.
4299         (Output_section::is_noload_): New data member.
4300         * script-c.h (Script_section_type): New enum type.
4301         (struct Parser_output_section_header): Add new file section_type.
4302         * script-sections.cc (Sections_element::output_section_name): Add
4303         parameter for returning script section type.
4304         (Output_section_definition::output_section_name): Ditto.
4305         (Output_section_definition::section_type)P; New method.
4306         (Output_section_definiton::script_section_type_name): Ditto.
4307         (Output_section_definition::script_section_type_): New data member.
4308         (Output_section_definition::Output_section_definition): Initialize
4309         data member Output_section_definition::script_section_type_.
4310         (Output_section_definition::create_sections): Pass script section type
4311         to Layout::make_output_section_for_script.
4312         (Output_section_definition::output_section_name): Return script
4313         section type to caller.
4314         (Output_section_definition::set_section_address): Do not advance
4315         dot value and load address if section type is NOLOAD.  Set address
4316         of NOLOAD sections regardless of section flags.
4317         (Output_section_definition::print): Print section type if it is
4318         not SCRIPT_SECTION_TYPE_NONE.
4319         (Output_section_definition::section_type): New method.
4320         (Output_section_definition::script_section_type_name): Ditto.
4321         (Script_sections::output_section_name): Add new parameter
4322         PSECTION_TYPE for returning script section type.  Pass it to
4323         section elements.  Handle discard sections.
4324         (Sort_output_sections::operator()): Handle NOLOAD sections.
4325         * script-sections.h (Script_sections::Section_type): New enum type.
4326         (Script_sections::output_section_name): Add a new parameter for
4327         returning script section type.
4328         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4329         INFO and NOLOAD.
4330         * yyscript.y (union): Add new field SECTION_TYPE.
4331         (COPY, DSECT, INFO, NOLOAD): New tokens.
4332         (opt_address_and_section_type): Change type to output_section_header.
4333         (section_type): New non-terminal
4334         (section_header): Handle section type.
4335         (opt_address_and_section_type): Return section type value.
4336
4337 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4338
4339         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4340         * testsuite/plugin_common_test_2.c (foo): Likewise.
4341
4342 2010-04-08  Doug Kwan  <dougkwan@google.com>
4343
4344         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4345         Output_merge_data.
4346         * output.cc (Output_section::add_merge_input_section): Simplify
4347         code and return status of Output_merge_base::add_input_section.
4348         Update merge section map only if Output_merge_base::add_input_section
4349         returns true.
4350
4351 2010-04-07  Doug Kwan  <dougkwan@google.com>
4352
4353         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4354         if section is marked as containing instructions but has no mapping
4355         symbols.
4356         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4357         correct section index.
4358         (Arm_relobj::find_linked_text_section): Ditto.
4359
4360 2010-04-07  Cary Coutant  <ccoutant@google.com>
4361
4362         * archive.cc (include_member): Destroy Read_symbols_data object before
4363         releasing file.
4364         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4365         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4366         (Read_symbols_data::~Read_symbols_data) New destructor.
4367         (Section_relocs::Section_relocs) New constructor.
4368         (Section_relocs::~Section_relocs) New destructor.
4369         (Read_relocs_data::Read_relocs_data) New constructor.
4370         (Read_relocs_data::~Read_relocs_data) New destructor.
4371         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4372         pointers to NULL after deleting.
4373
4374 2010-04-07  Doug Kwan  <dougkwan@google.com>
4375
4376         * arm.cc: Replace "endianity" with "endianness" in comments.
4377         (Arm_exidx_cantunwind): Ditto.
4378         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4379         (Arm_relobj::merge_flags_and_attributes): New method.
4380         (Arm_relobj::merge_flags_and_attributes_): New data member.
4381         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4382         (Arm_relobj::scan_sections_for_stubs): Ditto.
4383         (Arm_relobj::do_read_symbols): Check to see if we really want to
4384         merge processor-specific flags and attributes.  Exit early if
4385         an object is empty except for section names and the undefined symbol.
4386         (Target_arm::do_finalize_sections): Move check for ELF format to
4387         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4388         attributes from a regular object only when we have determined that
4389         it is aapropriate.  Do not create an .ARM.attributes section in
4390         output if there is no regular input object.
4391         (Target_arm::merge_processor_specific_flags): Check
4392         --warn-mismatch before printing any error.
4393         (Target_arm::merge_object_attributes): Ditto.
4394         * gold.cc (queue_middle_tasks): Handle the case in which there is
4395         no regular object in input.
4396         * options.cc (General_options::parse_EB): New method.
4397         (General_options::parse_EL): Same.
4398         (General_options::General_options): Initialize endianness_.
4399         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4400         New options.
4401         (General_options::Endianness): New enum.
4402         (General_options::endianness): New method.
4403         (General_options::endianness_): New data member.
4404         * parameters.cc (Parameters::set_options): Check target endianness.
4405         (Parameters::set_target_once): Ditto.
4406         (Parameters::check_target_endianness): New method.
4407         (parameters_force_valid_target): If either -EL or -EB is specified,
4408         use it to define endianness of default target.
4409         * parameters.h (Parameters::check_target_endianness): New method
4410         declaration.
4411         * target.h (class Target): Change "endianity" to "endianness"
4412         in comments.
4413
4414 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4415
4416         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4417         * configure: Regenerate.
4418         * Makefile.in: Regenerate.
4419         * testsuite/Makefile.in: Regenerate.
4420
4421 2010-04-06  Cary Coutant  <ccoutant@google.com>
4422
4423         gcc PR lto/42757
4424         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4425         prevailing definitions of common symbols.
4426         * testsuite/plugin_test_6.sh: New test case.
4427         * testsuite/plugin_common_test_1.c: New test case.
4428         * testsuite/plugin_common_test_2.c: New test case.
4429         * testsuite/Makefile.am (plugin_test_6): New test case.
4430         * testsuite/Makefile.in: Regenerate.
4431
4432 2010-04-06  Nick Clifton  <nickc@redhat.com>
4433
4434         * po/vi.po: New Vietnamese translation.
4435
4436 2010-03-30  Doug Kwan  <dougkwan@google.com>
4437
4438         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4439
4440 2010-03-25  Doug Kwan  <dougkwan@google.com>
4441
4442         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4443         to avoid a conversion warning on a 32-bit host.
4444
4445 2010-03-24  Ian Lance Taylor  <iant@google.com>
4446
4447         * testsuite/script_test_3.t: Add a TLS segment.
4448         * testsuite/Makefile.am (check_PROGRAMS): Add
4449         tls_phdrs_script_test.
4450         (tls_phdrs_script_test_SOURCES): Define.
4451         (tls_phdrs_script_test_DEPENDENCIES): Define.
4452         (tls_phdrs_script_test_LDFLAGS): Define.
4453         (tls_phdrs_script_test_LDADD): Define.
4454         * testsuite/Makefile.in: Rebuild.
4455
4456 2010-03-23  Cary Coutant  <ccoutant@google.com>
4457
4458         * fileread.cc (find_or_make_view): Fix comment.
4459
4460 2010-03-23  Ian Lance Taylor  <iant@google.com>
4461
4462         * script-sections.cc (class Orphan_section_placement): Define
4463         PLACE_TLS and PLACE_TLS_BSS.
4464         (Orphan_section_placement::Orphan_section_placement): Initialize
4465         new places.
4466         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4467         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4468         (tls_script_test_SOURCES): Define.
4469         (tls_script_test_DEPENDENCIES): Define.
4470         (tls_script_test_LDFLAGS): Define.
4471         (tls_script_test_LDADD): Define.
4472         * testsuite/Makefile.in: Rebuild.
4473
4474 2010-03-22  Doug Kwan  <dougkwan@google.com>
4475
4476         * arm.cc (Arm_relocate_functions::abs8,
4477         Arm_relocate_functions::abs16): Use correct check for overflow
4478         specified in the ARM ELF specs.
4479         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4480         target of a BLX instruction specially.
4481         (Reloc_stub::stub_type_for_reloc): Ditto.
4482         (Relocate::relocate): Use symbolic names instead of numeric relocation
4483         codes to report error.
4484         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4485         workaround.
4486         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4487         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4488         thumb2_blx_out_of_range.stdout
4489         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4490         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4491         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4492         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4493         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4494         thumb2_blx_in_range, thumb2_blx_in_range.o,
4495         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4496         thumb2_blx_out_of_range.o): New rules.
4497         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4498         thumb2_blx_in_range and thumb2_blx_out_of_range.
4499         * testsuite/Makefile.in: Regenerate.
4500         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4501         * testsuite/thumb_blx_in_range.s: New file.
4502         * testsuite/thumb_blx_out_of_range.s: New file.
4503
4504 2010-03-22  Rafael Espindola  <espindola@google.com>
4505
4506         * archive.cc (Should_include): Move to archive.h.
4507         (should_include_member): Make it a member of Archive.
4508         (Lib_group): New.
4509         (Add_lib_group_symbols): New.
4510         * archive.h: Include options.h.
4511         (Archive_member): Moved from Archive.
4512         (Should_include): Moved from archive.cc.
4513         (Lib_group): New.
4514         (Add_lib_group_symbols): New.
4515         * dynobj.cc (do_should_include_member): New.
4516         * dynobj.h (do_should_include_member): New.
4517         * gold.cc (queue_initial_tasks): Update call to queue.
4518         * main.cc (main): Print lib group stats.
4519         * object.cc (do_should_include_member): New.
4520         * object.h: Include archive.h.
4521         (Object::should_include_member): New.
4522         (Object::do_should_include_member): New.
4523         (Sized_relobj::do_should_include_member): New.
4524         * options.cc (General_options::parse_start_lib): New.
4525         (General_options::parse_end_lib): New.
4526         (Input_arguments::add_file): Handle lib groups.
4527         (Input_arguments::start_group): Check we are not in a lib.
4528         (Input_arguments::start_lib): New.
4529         (Input_arguments::end_lib): New.
4530         * options.h (General_options): Add start_lib and end_lib.
4531         (Input_argument::lib_): New.
4532         (Input_argument::lib): New.
4533         (Input_argument::is_lib): New.
4534         (Input_file_lib): New.
4535         (Input_arguments::in_lib_): New.
4536         (Input_arguments::in_lib): New.
4537         (Input_arguments::start_lib): New.
4538         (Input_arguments::end_lib_): New.
4539         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4540         in unused members as preempted.
4541         (Sized_pluginobj::do_should_include_member): New.
4542         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4543         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4544         return the blocker.
4545         (Read_symbols::do_whole_lib_group): New.
4546         (Read_symbols::do_lib_group): New.
4547         (Read_symbols::do_read_symbols): Handle lib groups.
4548         (Read_symbols::get_name): Handle lib groups.
4549         * readsyms.h (Read_symbols): Add an archive member pointer.
4550         (Read_symbols::do_whole_lib_group): New.
4551         (Read_symbols::do_lib_group): New.
4552         (Read_symbols::member_): New.
4553         * script.cc (read_input_script): Update call to queue_soon.
4554
4555 2010-03-19  Doug Kwan  <dougkwan@google.com>
4556
4557         * arm.cc (Stub_table::Stub_table): Initialize new data members
4558         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4559         (Stub_table::add_reloc_stub): Assign stub offset and update
4560         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4561         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4562         New data members.
4563         (Stub_table::update_data_size_and_addralign): Use
4564         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4565         instead of going over all reloc stubs.
4566         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4567         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4568         Stringpool_template::offset_ to size of Stringpool_char.
4569         (Stringpool_template::new_key_offset): Remove code to initialize
4570         Stringpool_template::offset_.
4571         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4572         Stringpool_template::offset_ to zero.
4573
4574 2010-03-15  Doug Kwan  <dougkwan@google.com>
4575
4576         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4577         offset_.
4578         (Stringpool_template::new_key_offset): New method.
4579         (Stringpool_template::add_string): Assign offsets when adding new
4580         strings.
4581         (Stringpool_template::set_string_offsets): Do not set string offsets
4582         when not optimizing.
4583         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4584         member size_.
4585         (Chunked_vector::clear): Clear size_.
4586         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4587         (Chunked_vector::size): Return size_.
4588         (Chunked_vector::push_back): Use size_ to find insert position.
4589         (Chunked_vector::size_): New data member.
4590         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4591         (Stringpool_template::new_key_offset): New method declaration.
4592         (Stringpool_template::offset_): New data member.
4593
4594 2010-03-15   Rafael Espindola  <espindola@google.com>
4595
4596         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4597         Add_symbols' constructor.
4598         * readsyms.h (Add_symbols): Remove the input_group member.
4599
4600 2010-03-10  Ian Lance Taylor  <iant@google.com>
4601
4602         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4603         target to ask whether a reference to a symbol requires a stack
4604         split.
4605         * target.h (Target::is_call_to_non_split): New function.
4606         (Target::do_is_call_to_non_split): Declare virtual function.
4607         * target.cc: Include "symtab.h".
4608         (Target::do_is_call_to_non_split): New function.
4609         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4610
4611 2010-03-10  Cary Coutant  <ccoutant@google.com>
4612
4613         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4614         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4615         (File_read::open[2]): Add whole_file_view_ to list of views.
4616         (File_read::make_view): Remove test of whole_file_view_.
4617         (File_read::find_or_make_view): Create whole_file_view_ if
4618         necessary.
4619         (File_read::clear_views): Replace bool parameter with enum;
4620         adjust all callers.  Don't delete views with permanent data;
4621         do delete cached views and views from archives if
4622         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4623         if clearing the corresponding view.
4624         * fileread.h (File_read::Clear_views_mode): New enum.
4625         (File_read::View::is_permanent_view): New method.
4626         (File_read::clear_views): Replace bool parameter
4627         with enum; adjust all callers.
4628         * options.h (General_options): Change keep_files_mapped option;
4629         add map_whole_files.
4630         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4631         releasing the file.
4632         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4633         the file.
4634
4635 2010-03-10  David S. Miller  <davem@davemloft.net>
4636
4637         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4638
4639 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4640
4641         * icf.cc (get_section_contents): Add '@' marker after processing the
4642         merge reloc.
4643
4644 2010-03-08  Doug Kwan  <dougkwan@google.com>
4645
4646         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4647         due to a conversion warning.
4648         (Arm_relobj::update_output_local_symbol_count): Check for local
4649         symbol with unset output index.
4650
4651 2010-03-05  Ian Lance Taylor  <iant@google.com>
4652
4653         * options.h (class General_options): Add --spare-dynamic-tags.
4654         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4655         --spare-dynamic-tags.
4656
4657 2010-03-05  Ian Lance Taylor  <iant@google.com>
4658
4659         * incremental.cc: Include "libiberty.h".
4660
4661 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4662
4663         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4664         function, is_info_ member.
4665         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4666         (Versions::Versions): Update caller.
4667         (Versions::define_base_version): Likewise.
4668         (Versions::add_def): Likewise.
4669
4670 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4671
4672         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4673         (Scan::possible_function_pointer_reloc): New function.
4674         (Scan::local_reloc_may_be_function_pointer): Change to call
4675         possible_function_pointer_reloc.
4676         (Scan::global_reloc_may_be_function_pointer): Ditto.
4677         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4678         relocations in ".data.rel.ro._ZTV" section.
4679         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4680         * testsuite/icf_safe_so_test.cc: Ditto.
4681         * testsuite/icf_safe_test.cc: Ditto.
4682         * testsuite/icf_safe_test.sh: Ditto.
4683
4684 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4685             Ian Lance Taylor  <iant@google.com>
4686
4687         * target-reloc.h (relocate_section): Check the symbol table index
4688         for -1U before setting the local symbol index.
4689         (scan_relocatable_relocs): If copying the relocation, record that
4690         the local symbol is required.
4691         * object.h (Symbol_value::is_output_symtab_index_set): New
4692         function.
4693         (Symbol_value::may_be_discarded_from_output_symtab): New
4694         function.
4695         (Symbol_value::has_output_symtab_entry): New function.
4696         (Symbol_value::needs_output_symtab_entry): Remove.
4697         (Symbol_value::output_symtab_index): Make sure the symbol index is
4698         set.
4699         (Symbol_value::set_output_symtab_index): Make sure the symbol
4700         index is not set.  Make sure the new index is valid.
4701         (Symbol_value::set_must_have_output_symtab_entry): New function.
4702         (Symbol_value::has_output_dynsym_entry): New function.
4703         (Symbol_value::set_output_dynsym_index): Make sure the new index
4704         is valid.
4705         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4706         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4707         local symbol if permitted.
4708         (Sized_relobj::do_finalize_local_symbols): Call
4709         is_output_symtab_index_set rather than needs_output_symtab_entry.
4710         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4711         rather than needs_output_symtab_entry.  Call
4712         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4713         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4714         is_output_symtab_index_set rather than needs_output_symtab_entry.
4715         * testsuite/discard_locals_relocatable_test.c: New file.
4716         * testsuite/discard_locals_test.sh: Test -r.
4717         * testsuite/Makefile.am (check_DATA): Add
4718         discard_locals_relocatable_test1.syms,
4719         discard_local_relocatable_test2.syms.
4720         (MOSTLYCLEANFILES): Likewise.  Also add
4721         discard_locals_relocatable_test1.lout and
4722         discard_locals_relocatable_test2.out.
4723         (discard_locals_relocatable_test1.syms): New target.
4724         (discard_locals_relocatable_test.o): New target.
4725         (discard_locals_relocatable_test1.out): New target.
4726         (discard_locals_relocatable_test2.syms): New target.
4727         (discard_locals_relocatable_test2.out): New target.
4728         (various): Add missing ../ld-new dependencies.
4729         * testsuite/Makefile.in: Rebuild.
4730
4731 2010-03-03  Nick Clifton  <nickc@redhat.com>
4732
4733         * po/fi.po: New Finnish translation.
4734
4735 2010-03-01  Doug Kwan  <dougkwan@google.com>
4736
4737         * layout.cc (Layout::Layout): Force section types of .init_array*,
4738         .preinit_array* and .fini_array* sections.
4739         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4740         Fix check of return value of std::string::find.().
4741         (Output_section::Input_section_sort_compare::operator()): Remove
4742         comment about .init_array.
4743         (Output_section::Input_section_sort_init_fini_compare::operator()):
4744         New method.
4745         (Output_section::sort_attached_input_sections): Handle .init_array
4746         and .fini_array specially.
4747         * output.h (Output_section::Inut_section_sort_compare): Update
4748         comment.
4749         (Output_section::Input_section_sort_init_fini_compare): New struct.
4750
4751 2010-02-26  Doug Kwan  <dougkwan@google.com>
4752
4753         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4754         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4755         * testsuite/debug_msg.sh: Avoid matching source line number for
4756         use of global variable undef_int.
4757
4758 2010-02-26  Doug Kwan  <dougkwan@google.com>
4759
4760         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4761         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4762         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4763         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4764         * options.cc (General_options::General_options): Initialize member
4765         fix_v4bx_.
4766         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4767         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4768         and rm_no_fix_v4bx.stdout
4769         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4770         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4771         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4772         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4773         and arm_no_fix_v4bx.
4774         * Makefile.in: Regenerate.
4775         * testsuite/arm_fix_v4bx.s: New file.
4776         * testsuite/arm_fix_v4bx.sh: Ditto.
4777
4778 2010-02-24  Doug Kwan  <dougkwan@google.com>
4779
4780         * arm.cc (Target_arm::got_section): Make the .got section the first
4781         non RELRO section in the data segment.
4782         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4783         suffixes of section names.
4784
4785 2010-02-24  Doug Kwan  <dougkwan@google.com>
4786
4787         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4788         flags and attributes merging if an input file is a binary file.
4789         * fileread.cc (Input_file::open): Record format of original file.
4790         * fileread.h (Input_file::Format): New enum type.
4791         (Input_file::Input_file): Initialize data member format_.
4792         (Input_file::format): New method definition.
4793         (Input_file::format_):: New data member.
4794
4795 2010-02-24  Doug Kwan  <dougkwan@google.com>
4796
4797         * arm.cc (Arm_output_data_got): New class.
4798         (ARM_TCB_SIZE): New constant
4799         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4800         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4801         If user uses a script with a SECTIONS clause, issue only a warning
4802         for a misplaced EXIDX input section.  Otherwise, issue an error.
4803         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4804         garbage collection.
4805         (Target_arm::got_mode_index_entry): Handle static linking.
4806         (Target_arm::Scan::local): Ditto.
4807         (Target_arm::Scan::global): Ditto.
4808         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4809         all incorrectly implemented relocations.
4810         (Target_arm::fix_exidx_coverage): Pass layout to
4811         Arm_output_section::fix_exidx_coverage.
4812         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4813         from ".ARM.exidx." and ".ARM.extab.".
4814
4815 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4816
4817         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4818         section if it does not already exist.
4819         * attributes.cc (Attributes_section_data::Attributes_section_data):
4820         Don't crash if size is zero.
4821
4822 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4823             Ian Lance Taylor  <iant@google.com>
4824
4825         * gold.cc (queue_middle_tasks): If no input files were opened,
4826         exit.
4827         * workqueue.h (Task_function::Task_function): Assert that there is
4828         a blocker.
4829
4830 2010-02-22  Doug Kwan  <dougkwan@google.com>
4831
4832         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4833         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4834         types to avoid warnings due to different uint64_t implementations
4835         on different hosts.
4836
4837 2010-02-21  Doug Kwan  <dougkwan@google.com>
4838
4839         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4840         handling of the maximum backward branch offset.
4841         (Arm_relocate_functions::thumb_branch_common): Ditto.
4842         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4843         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4844         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4845         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4846         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4847         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4848         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4849         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4850         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4851         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4852         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4853         thumb2_bl_out_of_range.o): New rules.
4854         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4855         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4856         thumb2_bl_out_of_range
4857         * testsuite/Makefile.in: Regenerate.
4858         * testsuite/arm_bl_in_range.s: New file.
4859         * testsuite/arm_bl_out_of_range.s: Ditto.
4860         * testsuite/arm_branch_in_range.sh: Ditto.
4861         * testsuite/arm_branch_range.t: Ditto.
4862         * testsuite/thumb2_branch_range.t: Ditto.
4863         * testsuite/thumb_bl_in_range.s: Ditto.
4864         * testsuite/thumb_bl_out_of_range.s: Ditto.
4865         * testsuite/thumb_branch_range.t: Ditto.
4866
4867 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4868
4869         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4870         Add reloc offset information.
4871         * icf.cc (get_section_contents): Change iterators to point to the new
4872         vectors. Add reloc offset information to the contents.
4873         * icf.h (Icf::Sections_reachable_info): New typedef.
4874         (Icf::Sections_reachable_list): New typedef.
4875         (Icf::Offset_info): New typedef.
4876         (Icf::Reloc_info): New struct typedef.
4877         (Icf::Reloc_info_list): New typedef.
4878         (Icf::symbol_reloc_list): Delete method.
4879         (Icf::addend_reloc_list): Delete method.
4880         (Icf::section_reloc_list): Delete method.
4881         (Icf::reloc_info_list): New method.
4882         (Icf::reloc_info_list_): New member.
4883
4884 2010-02-19  Doug Kwan  <dougkwan@google.com>
4885
4886         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4887         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4888         * arm.cc (Arm_relocation_functions): New forward declaration.
4889         (Target_arm::Target_arm): Initialize new data members
4890         got_mod_index_offset_ and tls_base_symbol_defined_.
4891         (Target_arm::Relocate::relocate_tls): New method.
4892         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4893          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4894         New methods.
4895         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4896         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4897         (Target_arm::got_mod_index_offset_,
4898         Target_arm::tls_base_symbol_defined_): New data members.
4899         (Target_arm::Scan::local, Target::Scan::global,
4900         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4901         relocations.
4902
4903 2010-02-18  Doug Kwan  <dougkwan@google.com>
4904
4905         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4906         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4907         text section as a parameter becuase some broken tools may not set
4908         the link in section header.
4909         (Target_arm::has_got_section): New method.
4910         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4911         without any mapping symbol as data only.  Remove warning.
4912         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4913         link in its section header, try to discover the link by inspecting the
4914         REL31 relocation at the beginning of the section.
4915         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4916         in error message.
4917         (Target_arm::Scan::global): Treat any reference to the symbol
4918         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4919
4920 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4921
4922         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4923         (Scan::global_reloc_may_be_function_pointer): New function.
4924         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4925         (Scan::global_reloc_may_be_function_pointer): New function.
4926         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4927         (Scan::global_reloc_may_be_function_pointer): New function.
4928         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4929         (Scan::global_reloc_may_be_function_pointer): New function.
4930         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4931         (Scan::global_reloc_may_be_function_pointer): New function.
4932         (Scan::possible_function_pointer_reloc): New function.
4933         (Target_x86_64::can_check_for_function_pointers): New function.
4934         * gc.h (gc_process_relocs): Scan relocation types to determine if
4935         function pointers were taken for targets that support it.
4936         * icf.cc (Icf::find_identical_sections): Include functions for
4937         folding in safe ICF whose pointer is not taken.
4938         * icf.h (Secn_fptr_taken_set): New typedef.
4939         (fptr_section_id_): New member.
4940         (section_has_function_pointers): New function.
4941         (set_section_has_function_pointers): New function.
4942         (check_section_for_function_pointers): New function.
4943         * options.h: Fix comment for safe ICF option.
4944         * target.h (can_check_for_function_pointers): New function.
4945         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4946         Modify icf_safe_test for X86-64.
4947         * testsuite/Makefile.in: Regenerate.
4948         * testsuite/icf_safe_so_test.cc: New file.
4949         * testsuite/icf_safe_so_test.sh: New file.
4950         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4951         (main): Change to take pointer to function kept_func_3.
4952         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4953         folding is done correctly for X86-64.
4954
4955 2010-02-12  David S. Miller  <davem@davemloft.net>
4956
4957         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4958         is_symbolless parameter.
4959         (Output_reloc<SHT_REL>::is_symbolless): New.
4960         (Output_reloc<SHT_REL>::is_symbolless_): New.
4961         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4962         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4963         (Output_reloc<SHT_RELA>::is_symbolless): New.
4964         (Output_data_reloc::add_global): Handle is_symbolless.
4965         (Output_data_reloc::add_global_relative): Likewise.
4966         (Output_data_reloc::add_local): Likewise.
4967         (Output_data_reloc::add_local_relative): Likewise.
4968         (Output_data_reloc::add_symbolless_global_addend): New.
4969         (Output_data_reloc::add_symbolless_local_addend): New.
4970         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4971         is_symbolless.
4972         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4973         instead of ->is_relative_
4974         (Output_reloc::write): Likewise.
4975         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4976         (Output_reloc::write_rel): Simplify.
4977
4978         * sparc.cc (Target_sparc::Scan::local): Use
4979         ->add_symbolless_local_addend as needed.
4980         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4981         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4982         based upon relocation offset.
4983
4984 2010-02-11  Doug Kwan  <dougkwan@google.com>
4985
4986         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4987         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4988         beginning of function.
4989         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4990         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4991         parameter is_32bit in calls to should_apply_static_reloc.
4992         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4993         (check_DATA): Add arm_abs_global.stdout.
4994         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4995         arm_abs_global.stdout): New rules.
4996         (MOSTLLYCLEANFILES): Add arm_abs_global
4997         * Makefile.in: Regenerate.
4998         * testsuite/arm_abs_global.s: New file.
4999         * testsuite/arm_abs_global.sh: Ditto.
5000         * testsuite/arm_abs_lib.s: Ditto.
5001
5002 2010-02-11  Ian Lance Taylor  <iant@google.com>
5003
5004         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5005         Read_relocs task.
5006         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5007         Allocate_commons_task first.
5008         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5009         task, rather than symtab_lock_.
5010         (Gc_process_relocs::~Gc_process_relocs): New function.
5011         (Gc_process_relocs::is_runnable): Check this_blocker_.
5012         (Gc_process_relocs::locks): Use next_blocker_ rather than
5013         blocker_.
5014         (Scan_relocs::~Scan_relocs): New function.
5015         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5016         symtab_lock_.
5017         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5018         next_blocker_.
5019         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5020         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5021         constructor accordingly.
5022         (class Gc_process_relocs): Likewise.
5023         (class Scan_relocs): Likewise.
5024         * common.h (class Allocate_commons_task): Remove symtab_lock_
5025         field, and corresponding constructor parameter.
5026         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5027         symtab_lock_.
5028         (Allocate_commons_task::locks): Likewise.
5029
5030 2010-02-11  Ian Lance Taylor  <iant@google.com>
5031
5032         * gold-threads.h (class Once): Define.
5033         (class Initialize_lock): Rewrite as child of Once.
5034         * gold-threads.cc (class Once_initialize): Define.
5035         (once_pointer_control): New static variable.
5036         (once_pointer, once_arg): New static variables.
5037         (c_run_once): New static function.
5038         (Once::Once, Once::run_once, Once::internal_run): New functions.
5039         (class Initialize_lock_once): Remove.
5040         (initialize_lock_control): Remove.
5041         (initialize_lock_pointer): Remove.
5042         (initialize_lock_once): Remove.
5043         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5044         (Initialize_lock::initialize): Rewrite.
5045         (Initialize_lock::do_run_once): New function.
5046         * archive.cc (Archive::interpret_header): Only clear name if it is
5047         not already empty.
5048         * fileread.cc: Include "gold-threads.h"
5049         (file_counts_lock): New static variable.
5050         (file_counts_initialize_lock): Likewise.
5051         (File_read::release): Only increment counts when using --stats.
5052         Use a lock around the increment.
5053         * parameters.cc (class Set_parameters_target_once): Define.
5054         (set_parameters_target_once): New static variable.
5055         (Parameters::Parameters): Move here from parameters.h.
5056         (Parameters::set_target): Rewrite.
5057         (Parameters::set_target_once): New function.
5058         (Parameters::clear_target): Move here and rewrite.
5059         * parameters.h (class Parameters): Update declarations.  Add
5060         set_parameters_target_once_ field.
5061         (Parameters::Parameters): Move to parameters.cc.
5062         (Parameters::clear_target): Likewise.
5063         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5064         task.
5065         (Start_group::~Start_group): New function.
5066         (Start_group::is_runnable): New function.
5067         (Start_group::locks, Start_group::run): New functions.
5068         (Finish_group::run): Change saw_undefined to size_t.
5069         * readsyms.h (class Start_group): Define.
5070         (class Finish_group): Change saw_undefined_ field to size_t.
5071         (Finish_group::Finish_group): Remove saw_undefined and
5072         this_blocker parameters.  Change all callers.
5073         (Finish_group::set_saw_undefined): New function.
5074         (Finish_group::set_blocker): New function.
5075         * symtab.h (class Symbol_table): Change saw_undefined to return
5076         size_t.  Change saw_undefined_ field to size_t.
5077         * target-select.cc (Set_target_once::do_run_once): New function.
5078         (Target_selector::Target_selector): Initialize set_target_once_
5079         field.  Don't initialize lock_ and initialize_lock_ fields.
5080         (Target_selector::instantiate_target): Rewrite.
5081         (Target_selector::set_target): New function.
5082         * target-select.h (class Set_target_once): Define.
5083         (class Target_selector): Update declarations.  Make
5084         Set_target_once a friend.  Remove lock_ and initialize_lock_
5085         fields.  Add set_target_once_ field.
5086
5087 2010-02-10  Ian Lance Taylor  <iant@google.com>
5088
5089         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5090         queueing any tasks.
5091         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5092         (queue_middle_tasks): Add all blockers before queueing any tasks.
5093         (queue_final_tasks): Likewise.
5094         * token.h (Task_token::add_blockers): New function.
5095         * object.h (Input_objects::number_of_relobjs): New function.
5096
5097 2010-02-10  Ian Lance Taylor  <iant@google.com>
5098
5099         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5100         shared, not if not position independent.
5101         * x86_64.cc (Relocate::relocate_tls): Likewise.
5102         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5103         (tls_pie_pic_test): New target.
5104         * testsuite/Makefile.in: Rebuild.
5105
5106         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5107         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5108         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5109         * testsuite/Makefile.in: Rebuild.
5110
5111 2010-02-09  David S. Miller  <davem@davemloft.net>
5112
5113         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5114         R_SPARC_RELATIVE using ->add_local_relative().
5115         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5116
5117         * output.h (Output_data_dynamic::add_section_size): New method
5118         that takes two Output_data objects.
5119         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5120         entry param.  Handle it in initializers.
5121         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5122         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5123         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5124         arg.
5125         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5126         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5127         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5128         for dynrel_includes_plt.
5129         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5130         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5131         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5132         before .rela.plt
5133         (Target_sparc::do_finalize_sections): Update to pass true for
5134         dynrel_includes_plt.
5135         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5136         output before .rela.plt
5137         (Target_powerpc::do_finalize_sections): Update to pass true for
5138         dynrel_includes_plt when 32-bit.
5139
5140 2010-02-08  Doug Kwan  <dougkwan@google.com>
5141
5142         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5143         method.
5144         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5145         Arm_relobj::scan_section_for_cortex_a8_stubs,
5146         Arm_relobj::do_relocation_section): Instead of calling
5147         Output_section::output_address, use faster
5148         Arm_relobj::simple_input_section_output_address.
5149
5150 2010-02-08  David S. Miller  <davem@davemloft.net>
5151
5152         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5153         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5154         relocation helper function.
5155
5156         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5157         just like R_SPARC_GOT{10,13,22}.
5158         (Target_sparc::Scan::local): Likewise.
5159         (Target_sparc::Relocate:relocate): Likewise.
5160
5161 2010-02-06  Ian Lance Taylor  <iant@google.com>
5162
5163         * configure.ac: Rewrite targetobjs duplicate removal code to use
5164         only shell constructs.
5165         * configure: Rebuild.
5166
5167 2010-02-05  Doug Kwan  <dougkwan@google.com>
5168
5169         PR 11247
5170         * arm.cc (Arm_relobj::section_is_scannable): New method.
5171         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5172         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5173
5174 2010-02-04  Doug Kwan  <dougkwan@google.com>
5175
5176         PR 11247
5177         * arm-reloc-property.cc (cstdio): Include.
5178         * configure.ac (targetobjs): Remove duplicates.
5179         * configure: Regenerate.
5180         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5181         big and little endian version for a given address size.
5182
5183 2010-02-03  Doug Kwan  <dougkwan@google.com>
5184
5185         * arm-reloc-property.cc
5186         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5187         definition.
5188         * arm-reloc-property.h
5189         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5190         New method definition.
5191         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5192         declaration.
5193         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5194         overflow to N.
5195         (GOT_PREL): Change implemented to Y.
5196         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5197         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5198         (Arm_relocate_functions::movw_abs_nc): Remove method.
5199         (Arm_relocate_functions::movt_abs): Ditto.
5200         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5201         (Arm_relocate_functions::thm_movt_abs): Ditto.
5202         (Arm_relocate_functions::movw_rel_nc): Ditto.
5203         (Arm_relocate_functions::movw_rel): Ditto.
5204         (Arm_relocate_functions::movt_rel): Ditto.
5205         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5206         (Arm_relocate_functions:thm_movw_rel): Ditto.
5207         (Arm_relocate_functions:thm_movt_rel): Ditto.
5208         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5209         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5210         New method definitions.
5211         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5212         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5213         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5214         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5215         (Target_arm::Relocate::relocate): Check for non-static or
5216         unimplemented relocation code and exit early.  Change calls to
5217         Target_arm::reloc_uses_thumb_bit and
5218         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5219         instead.  Refactor code to handle similar relocations to increase
5220         code sharing.  Remove check for unsupported relocation code in switch
5221         statement.
5222         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5223         relocation property table to find out size.  Change error message to
5224         print out the name of a relocation code instead of the numeric value.
5225         (Target_arm::scan_reloc_for_stub): Use relocation property table
5226         instead of calling Target_arm::reloc_uses_thumb_bit().
5227
5228 2010-02-02  Doug Kwan  <dougkwan@google.com>
5229
5230         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5231         types of relaxed input section.
5232
5233 2010-02-02  Doug Kwan  <dougkwan@google.com>
5234
5235         * Makefile.am (HFILES): Add arm-reloc-property.h.
5236         (DEFFILES): New.
5237         (TARGETSOURCES): Add arm-reloc-property.cc
5238         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5239         (libgold_a_SOURCES): $(DEFFILES)
5240         * Makefile.in: Regenerate.
5241         * arm-reloc-property.cc: New file.
5242         * arm-reloc-property.h: New file.
5243         * arm-reloc.def: New file.
5244         * arm.cc: Update comments.
5245         (arm-reloc-property.h): New included header.
5246         (arm_reloc_property_table): New global variable.
5247         (Target_arm::do_select_as_default_target): New method definition.
5248         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5249         arm-reloc-property to targ_extra_obj.
5250         * parameters.cc (set_parameters_target): Call
5251         Target::select_as_default_target().
5252         * target.h (Target::select_as_default_target): New method definition.
5253         (Target::do_select_as_default_target): Same.
5254
5255 2010-02-01  Doug Kwan  <dougkwan@google.com>
5256
5257         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5258         first_output_text_section_.
5259         (Arm_exidx_fixup::first_output_text_section): New method definition.
5260         (Arm_exidx_fixup::first_output_text_section_): New data member.
5261         (Arm_exidx_fixup::process_exidx_section): Record the first text
5262         output section seen.
5263         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5264         and entsize in output section header.
5265
5266 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5267
5268         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5269         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5270         (Arm_relocate_functions::thm_alu11): New Method.
5271         (Arm_relocate_functions::thm_pc8): New Method.
5272         (Arm_relocate_functions::thm_pc12): New Method.
5273         (Target_arm::Scan::local): Handle the relocations.
5274         (Target_arm::Scan::global): Likewise.
5275         (Target_arm::Relocate::relocate): Likewise.
5276         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5277
5278 2010-01-29  Doug Kwan  <dougkwan@google.com>
5279
5280         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5281         of relocation types as ld.
5282
5283 2010-01-29  Doug Kwan  <dougkwan@google.com>
5284
5285         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5286         to public.
5287         (Arm_relocate_functions::thumb_branch_common): Ditto.
5288         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5289         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5290         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5291         Arm_relocate_functions::jump24): Remove.
5292         (Target_arm::Relocate::relocate): Adjust code to call
5293         Arm_relocation_functions::arm_branch_common and
5294         Arm_relocation_functions::thumb_branch_common instead of their removed
5295         wrappers.  Merge switch-cases together to reduce source code size.
5296
5297 2010-01-29  Doug Kwan  <dougkwan@google.com>
5298
5299         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5300         output_local_symbol_count_needs_update_.
5301         (Arm_relobj::output_local_symbol_count_needs_update,
5302          Arm_relobj::set_output_local_symbol_count_needs_update,
5303          Arm_relobj::update_output_local_symbol_count): New methods.
5304         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5305         member.
5306         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5307         of pointed function as in a R_ARM_PREL31 relocation.
5308         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5309         for output local symbol count updating.
5310         (Target_arm::do_relax): Update output local symbol counts in objects
5311         if necessary.
5312         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5313
5314 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5315
5316         * arm.cc: Added support for the ARM relocations:
5317         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5318         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5319         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5320         movw_prel_nc).
5321         (Arm_relocate_functions::movw_rel): New method.
5322         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5323         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5324         thm_movw_prel_nc).
5325         (Arm_relocate_functions::thm_movw_rel): New method.
5326         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5327         thm_movt_prel).
5328         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5329         relocations.
5330         (Target_arm::Scan::global): Likewise.
5331         (Target_arm::Relocate::relocate): Likewise.
5332         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5333         Likewise.
5334
5335 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5336
5337         * arm.cc: Added support for ARM group relocations.
5338         (Target_arm::reloc_needs_sym_origin): New method.
5339         (Arm_relocate_functions::calc_grp_kn): New method.
5340         (Arm_relocate_functions::calc_grp_residual): New method.
5341         (Arm_relocate_functions::calc_grp_gn): New method.
5342         (Arm_relocate_functions::arm_grp_alu): New Method.
5343         (Arm_relocate_functions::arm_grp_ldr): New Method.
5344         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5345         (Arm_relocate_functions::arm_grp_ldc): New Method.
5346         (Target_arm::Scan::local): Handle the ARM group relocations.
5347         (Target_arm::Scan::global): Likewise.
5348         (Target_arm::Relocate::relocate): Likewise.
5349         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5350         Likewise.
5351
5352 2010-01-26  Doug Kwan  <dougkwan@google.com>
5353
5354         * arm.cc (set): Include.
5355         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5356         pointer type.
5357         (Arm_output_section::Text_section_list): New type.
5358         (Arm_output_section::append_text_sections_to_list): New method.
5359         (Arm_output_section::fix_exidx_coverage): Ditto.
5360         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5361         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5362         Relobj::set_section_offset() instead of
5363         Sized_relobj::invalidate_section_offset().
5364         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5365         parameter for section headers. Ignore relocation sections for
5366         unallocated sections and EXIDX sections.
5367         (Target_arm::fix_exidx_coverage): New method.
5368         (Target_arm::output_section_address_less_than): New type.
5369         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5370         linked text section instead of the EXIDX section.
5371         (Arm_output_section::create_stub_group): Add an assertion to check
5372         that this is not an EXIDX output section.
5373         (Arm_output_section::append_text_sections_to_list): New method.
5374         (Arm_output_section::fix_exidx_coverage): Ditto.
5375         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5376         Arm_relobj::section_needs_reloc_stub_scanning.
5377         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5378         first pass.
5379         (Target_arm::fix_exidx_coverage): New method.
5380         * object.h (Relobj::set_output_section): New method.
5381         (Sized_relobj::invalidate_section_offset): Remove method.
5382         (Sized_relobj::do_invalidate_section_offset): Remove method.
5383         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5384
5385 2010-01-25  Doug Kwan  <dougkwan@google.com>
5386
5387         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5388         Fix warning due to signed and unsigned comparison on a 32-bit host.
5389
5390 2010-01-22  Doug Kwan  <dougkwan@google.com>
5391
5392         * arm.cc (Target_arm::do_relax): Record an output section for section
5393         offset adjustment it contains any stub table that has changed.
5394         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5395         offsets in an output section if necessary.
5396         * output.cc (Output_section::Output_section): Initialize
5397         section_offsets_need_adjustments_.
5398         (Output_section::add_input_section_for_script): Renamed to
5399         Output_section::add_simple_input_section.
5400         (Output_section::save_states): Add a comment.
5401         (Output_section::discard_states): New method defintion.
5402         (Output_section::adjust_section_offsets): Same.
5403         * output.h (Output_section::add_input_section_for_script): Renamed to
5404         Output_section::add_simple_input_section.
5405         (Output_section::discard_states): New method declaration.
5406         (Output_section::adjust_section_offsets): Same.
5407         (Output_section::section_offsets_need_adjustment,
5408         Output_section::set_section_offsets_need_adjustment): New method
5409         definitions.
5410         (Output_section::section_offsets_need_adjustment_): New data member.
5411         * script-sections.cc
5412         (Output_section_element_input::set_section_address): Adjust code for
5413         renaming of Output_section::add_input_section_for_script.
5414         (Orphan_output_section::set_section_address): Same.
5415
5416 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5417
5418         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5419         Fix_v4bx enum values .
5420         * gold/options.h (General_options): New option definitions.
5421         (General_options::fix_v4bx): New method.
5422         (General_options::Fix_v4bx): New enum.
5423         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5424         (General_options::parse_fix_v4bx_interworking): New method.
5425
5426 2010-01-22  Doug Kwan  <dougkwan@google.com>
5427
5428         * arm.cc (Arm_exidx_fixup): New class.
5429
5430 2010-01-21  Doug Kwan  <dougkwan@google.com>
5431
5432         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5433         classes.
5434         (Arm_exidx_section_offset_map): New type.
5435
5436 2010-01-21  Doug Kwan  <dougkwan@google.com>
5437
5438         * arm.cc (Arm_exidx_input_section): New class.
5439         (Arm_relobj::exidx_input_section_by_link,
5440         Arm_relobj::exidx_input_section_by_shndx,
5441         Arm_relobj::make_exidx_input_section): New methods.
5442         (read_arm_attributes_section): Remove.
5443         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5444         information about them.
5445         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5446         to here.
5447
5448 2010-01-20  Doug Kwan  <dougkwan@google.com>
5449
5450         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5451         Input_section_specifier to Section_id.
5452         (Target_arm::new_arm_input_section: Adjust code for change of key
5453         type.
5454         (Target_arm::find_arm_input_section): Ditto.
5455         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5456         (Section_id): Remove.
5457         (Garbage_collection::Section_id_hash): Remove.
5458         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5459         (Section_id): Remove.
5460         (Icf::Section_id_hash): Remove.
5461         * object.h (Section_id, Const_section_id, Section_id_hash,
5462         Const_section_id_hash): New type definitions.
5463         * output.cc (Output_section::add_relaxed_input_section): Change to
5464         use Const_section_id instead of Input_section_specifier as key type.
5465         (Output_section::add_merge_input_section): Ditto.
5466         (Output_section::build_relaxation_map): Change to use Section_id
5467         instead of Input_section_specifier as key type.
5468         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5469         Ditto.
5470         (Output_section::convert_input_sections_to_relaxed_sections): Change
5471         to use Const_section_id instead of Input_section_specifier as key type.
5472         (Output_section::find_merge_section): Ditto.
5473         (Output_section::find_relaxed_input_section): Ditto.
5474         * output.h (Input_section_specifier): Remove class.
5475         (Output_section::Output_section_data_by_input_section_map): Change
5476         key type to Const_section_id.
5477         (Output_section::Output_relaxed_input_section_by_input_section_map):
5478         Ditto.
5479         (Output_section::Relaxation_map): Change key type to Section_id.
5480
5481 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5482
5483         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5484         (class Arm_v4bx_stub): New class.
5485         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5486         (Stub_factory::make_arm_v4bx_stub): New method.
5487         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5488         (Stub_table::empty): Handle v4bx stubs.
5489         (Stub_table::add_arm_v4bx_stub): New method.
5490         (Stub_table::find_arm_v4bx_stub): New method.
5491         (Arm_relocate_functions::v4bx): New method.
5492         (Target_arm::fix_v4bx): New method.
5493         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5494         (Stub_table::relocate_stubs): Likewise.
5495         (Stub_table::do_write): Likewise.
5496         (Stub_table::update_data_size_and_addralign): Likewise.
5497         (Stub_table::finalize_stubs):  Likewise.
5498         (Target_arm::Scan::local): Likewise.
5499         (Target_arm::Scan::global): Likewise.
5500         (Target_arm::do_finalize_sections): Likewise.
5501         (Target_arm::Relocate::relocate): Likewise.
5502         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5503         Likewise.
5504         (Target_arm::scan_reloc_for_stub): Likewise.
5505         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5506
5507 2010-01-19  Ian Lance Taylor  <iant@google.com>
5508
5509         * output.cc (Output_section_headers::do_sized_write): Write large
5510         segment count to sh_info field.
5511         (Output_file_header::do_sized_write): For large segment count,
5512         write PN_XNUM to e_phnum field.
5513
5514 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5515
5516         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5517         (Arm_relocate_functions::thm_jump8): New function.
5518         (Arm_relocate_functions::thm_jump11): New function.
5519         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5520         R_ARM_THM_JUMP11.
5521         (Target_arm::Scan::global): Likewise.
5522         (Target_arm::Relocate::relocate): Likewise.
5523         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5524         Likewise.
5525
5526 2010-01-14  Doug Kwan  <dougkwan@google.com>
5527
5528         * arm.cc (map, utility): Include headers.
5529         (Target_arm::apply_cortex_a8_workaround): New method.
5530         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5531         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5532         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5533         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5534         the --[no-]fix-cortex-a8 command line options.
5535         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5536         (Target_arm::relocate_stub): Use addend in instruction template.
5537         * options.h (DEFINE_bool): Set the user-set flag.
5538         (General_options): Add --[no-]-fix-cortex options.
5539         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5540         : Update fast look-up map after conversion.
5541
5542 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5543
5544         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5545         in the first pass of do_layout.
5546
5547 2010-01-13  Doug Kwan  <dougkwan@google.com>
5548
5549         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5550         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5551         apparent compiler problem of not folding static constant integral
5552         data members of elfcpp::Elf_sizes<32>.
5553
5554 2010-01-13  Doug Kwan  <dougkwan@google.com>
5555
5556         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5557         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5558         Arm_relobj::scan_section_for_cortex_a8_erratum,
5559         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5560         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5561         sections to scan for relocation stubs into a new method
5562         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5563         relocation and Cortex-A8 stub scanning.
5564         (Target_arm::do_relax): Force stubs to be after stubbed sections
5565         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5566         the beginning of a new relaxation pass.  Update a comment.
5567         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5568
5569 2010-01-12  Ian Lance Taylor  <iant@google.com>
5570
5571         * target-reloc.h (visibility_error): New inline function.
5572         (relocate_section): Call visibility_error.
5573         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5574         (MOSTLYCLEANFILES): Likewise.
5575         (protected_4_pic.o, protected_3.err): New targets.
5576         * testsuite/protected_4.cc: New file.
5577
5578 2010-01-12  Doug Kwan  <dougkwan@google.com>
5579
5580         * arm.cc (Cortex_a8_reloc): New class.
5581         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5582         and cortex_a8_relocs_info_.
5583         (Target_arm::fix_cortex_a8): New method definition.
5584         (Target_arm::Cortex_a8_relocs_info): New type.
5585         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5586         New data member declarations.
5587         (Target_arm::scan_reloc_for_stub): Record information about
5588         relocations for THUMB branches that might be exempted from the
5589         Cortex-A8 workaround.
5590         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5591         at the beginning of a relaxation pass.
5592
5593 2010-01-12  Doug Kwan  <dougkwan@google.com>
5594
5595         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5596         (Arm_relobj::Mapping_symbol_position,
5597          Arm_reloj::Mapping_symbol_position_less,
5598          Arm_relobj::Mapping_symbols_info): New types.
5599         (Target_arm::is_mapping_symbol_name): New method definition.
5600         (Arm_relobj::do_count_local_symbols): Save information about mapping
5601         symbols.
5602
5603 2010-01-11  Doug Kwan  <dougkwan@google.com>
5604
5605         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5606         Arm_relocate_functions::thumb32_branch_upper,
5607         Arm_relocate_functions::thumb32_branch_lower,
5608         Arm_relocate_functions::thumb32_cond_branch_offset,
5609         Arm_relocate_functions::thumb32_cond_branch_upper,
5610         Arm_relocate_functions::thumb32_cond_branch_lower,
5611         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5612         branch offset encoding.
5613         (Arm_relocate_functions::thumb_branch_common): Use new branch
5614         offset encoding methods to avoid code duplication.
5615         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5616         (Stub_addend_reader::operator()): Use new branch encoding method
5617         to avoid code duplication.
5618
5619 2010-01-11  Doug Kwan  <dougkwan@google.com>
5620
5621         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5622         (Target_arm::do_finalize_sections): Define special EXIDX section
5623         symbols only if referenced.
5624         * gc.h (Garbage_collection::add_reference): New method.
5625         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5626         code duplication.
5627
5628 2010-01-11  Ian Lance Taylor  <iant@google.com>
5629
5630         * script.cc (Version_script_info::build_expression_list_lookup):
5631         Change complaing about duplicate wildcard match from error to
5632         warning.
5633
5634         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5635         of 2009-12-30.
5636         (Version_script_info::Version_script_info): Initialize globs_,
5637         default_version_, default_is_global_, and exact_.  Don't
5638         initialize globals_ or locals_.
5639         (Version_script_info::build_lookup_tables): Build local symbols
5640         first.
5641         (Version_script_info::unquote): New function.
5642         (Version_script_info::add_exact_match): New function.
5643         (Version_script_info::build_expression_list_lookup): Remove lookup
5644         parameter.  Add is_global parameter.  Change all callers.  Handle
5645         wildcard pattern specially.  Unquote pattern.  Call
5646         add_exact_match.
5647         (Version_script_info::get_name_to_match): New function.
5648         (Version_script_info::get_symbol_version): New function.
5649         (Version_script_info::get_symbol_version_helper): Remove.
5650         (Version_script_info::check_unmatched_names): Call unquote.
5651         * script.h (class Version_script_info): Change get_symbol_version
5652         to be non-inline and add is_global parameter; change all callers.
5653         Rewrite symbol_is_local.  Update declarations.  Define struct
5654         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5655         Remove globals_ and locals_ members.  Add exact_, globs_,
5656         default_version_, is_global_.
5657         (Version_script_info::Glob): Remove pattern, add expression and
5658         is_global.  Update constructor.  Change all callers.
5659         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5660         default version.
5661         (Versions::symbol_section_contents): If a symbol is undefined, or
5662         defined in a dynamic object, set the version index to
5663         VER_NDX_LOCAL.
5664         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5665         symbol_is_local.
5666         (Symbol_table::add_from_pluginobj): Likewise.
5667         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5668
5669 2010-01-11  Doug Kwan  <dougkwan@google.com>
5670
5671         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5672         (incremental_dump_LDADD): Add linking option for libintl.
5673         * Makefile.in: Regenerate.
5674
5675 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5676
5677         PR gold/11144
5678         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5679         instead of -Ds.
5680         * testsuite/Makefile.in: Regenerated.
5681
5682 2010-01-10  Doug Kwan  <dougkwan@google.com>
5683
5684         * options.h (DEFINE_var): Use parentheses around argument varname__
5685         in macro body to avoid any unintended subsequent substitutions.
5686
5687 2010-01-10  Ian Lance Taylor  <iant@google.com>
5688
5689         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5690         candidates before doing symbol resolution.
5691
5692         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5693         ODR candidates if only one is weak.
5694
5695 2010-01-08  Ian Lance Taylor  <iant@google.com>
5696
5697         * script.cc (Version_script_info::build_expression_list_lookup):
5698         Don't warn about ambiguous version, just record the ambiguity.
5699         (Version_script_info::get_symbol_version_helper): Give error if
5700         version is ambiguous.
5701
5702 2010-01-08  Doug Kwan  <dougkwan@google.com>
5703
5704         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5705           prev_data_size_ and prev_addralign_.  Remove initializer for
5706           deleted data member has_been_changed_.
5707           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5708           to determine if the table is empty.
5709           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5710           Remove.
5711           (Stub_table::add_reloc_stub): Define method in class definition
5712           instead of just declaring it there.
5713           (Stub_table::add_cortex_a8_stub): New method definition.
5714           (Stub_table::update_data_size_and_addralign): Ditto.
5715           (Stub_table::finalize_stubs): Ditto.
5716           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5717           (Stub_table::do_addralign_): Return address alignment in the
5718           (Stub_table::do_reset_address_and_file_offset): Define method in
5719           class definition instead of declaring it there.  Set current data
5720           size to be the data size of the previous pass.
5721           (Stub_table::set_final_data_size): Use current data size as the
5722           final data size.
5723           (Stub_table::relocate_stub): Change parameter type of stub from
5724           Reloc_stub pointer to Stub pointer.
5725           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5726           (Stub_table::Cortex_a8_stub_list): New typedef.
5727           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5728            Stub_table::prev_addralign_): New data member.
5729           (Arm_relobj::Arm_relobj): Initialize data member
5730           section_has_cortex_a8_workaround_.
5731           (Arm_relobj::section_has_cortex_a8_workaround,
5732            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5733            definitions.
5734           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5735           declarations.
5736           (Target_arm::relocate_stub): Change parameter type of stub from
5737           Reloc_stub pointer to Stub pointer.
5738           (Insn_template::size, Insn_template::alignment): Handle
5739           THUMB16_SPECIAL_TYPE.
5740           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5741            Stub_table::update_data_size_and_addralign,
5742            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5743           definitions.
5744           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5745           (Stub_table::do_write): Ditto.
5746           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5747
5748 2010-01-08  Ian Lance Taylor  <iant@google.com>
5749
5750         PR 11108
5751         * symtab.h (class Symbol): Remove fields is_target_special_ and
5752         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5753         (Symbol::is_defined_in_discarded_section): New function.
5754         (Symbol::set_is_defined_in_discarded_section): New function.
5755         (Symbol::has_plt_offset): Rewrite.
5756         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5757         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5758         Don't initialize is_target_special_ or has_plt_offset_.
5759         Initialize is_defined_in_discarded_section_.
5760         (Symbol_table::add_from_relobj): If appropriate, set
5761         is_defined_in_discarded_section.
5762         * resolve.cc (Symbol::override_base_with_special): Don't test
5763         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5764         * target-reloc.h (relocate_section): Do special handling for
5765         symbols defined in discarded sections for global symbols as well
5766         as local symbols.
5767
5768 2010-01-08  Ian Lance Taylor  <iant@google.com>
5769
5770         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5771         the SHT_SYMTAB case.
5772
5773 2010-01-08  Ian Lance Taylor  <iant@google.com>
5774
5775         * object.cc (Sized_relobj::do_layout): Don't get confused if
5776         layout_eh_frame returns NULL.
5777
5778 2010-01-08  Ian Lance Taylor  <iant@google.com>
5779
5780         PR 11084
5781         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5782         dynamic symbol table, use the normal symbol table.
5783         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5784         symbol table.
5785
5786 2010-01-08  Ian Lance Taylor  <iant@google.com>
5787
5788         PR 11072
5789         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5790         sections.
5791
5792 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5793
5794         * version.cc (print_version): Change to "Copyright 2010".
5795
5796 2010-01-08  Ian Lance Taylor  <iant@google.com>
5797
5798         PR 10287
5799         PR 11063
5800         * i386.cc (class Target_i386): Change return type of plt_section
5801         to be non-const.
5802         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5803         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5804         tls_desc_rel_ field.
5805         (Output_data_plt_i386::rel_tls_desc): New function.
5806         (Target_i386::rel_tls_desc_section): New function.
5807         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5808         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5809         R_386_TLS_DESC reloc in rel_tls_desc_section.
5810         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5811         Define struct Tlsdesc_info.
5812         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5813         (Target_x86_64::do_reloc_symbol_index): New function.
5814         (Target_x86_64::add_tlsdesc_info): New function.
5815         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5816         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5817         tlsdesc_rel_ field.
5818         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5819         all callers.
5820         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5821         (Target_x86_64::rela_tlsdesc_section): New function.
5822         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5823         handling.
5824         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5825         (Target_x86_64::do_reloc_addend): New function.
5826         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5827         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5828         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5829         (Output_reloc::type): New function.
5830         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5831         (Output_reloc::is_target_specific): New function.
5832         (Output_reloc::target_arg): New function.
5833         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5834         absolute relocs and target specific relocs.
5835         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5836         add_target_specific.
5837         (class Output_data_reloc) [SHT_RELA]: Likewise.
5838         * output.cc (Output_reloc::Output_reloc): Add four new versions
5839         for absolute relocs and target specific relocs.
5840         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5841         (Output_reloc::get_symbol_index): Likewise.
5842         (Output_reloc::local_section_offset): Check that local_sym_index_
5843         is not TARGET_CODE or 0.
5844         (Output_reloc::symbol_value): Likewise.
5845         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5846         reloc.
5847         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5848         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5849         functions.
5850         * layout.cc (add_target_dynamic_tags): Use output section for
5851         DT_PLTRELSZ and DT_JMPREL.
5852
5853 2010-01-07  Ian Lance Taylor  <iant@google.com>
5854
5855         PR 11061
5856         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5857         function.
5858         (class Output_data_reloc_generic): Define.
5859         (class Output_data_reloc_base): Change base class to
5860         Output_data_reloc_generic.  Change add() method to call
5861         bump_relative_reloc_count for a relative reloc.  Remove
5862         sort_relocs_ field.
5863         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5864         to sort_relocs().
5865         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5866         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5867         appropriate.
5868         * layout.h (class Layout): Update declaration.
5869
5870 2010-01-07  Ian Lance Taylor  <iant@google.com>
5871
5872         * output.h (class Output_data): Add const version of
5873         output_section and do_output_section.
5874         (class Output_section_data): Add const version of
5875         do_output_section.
5876         (class Output_section): Likewise.
5877         * layout.cc (Layout::add_target_dynamic_tags): New function.
5878         * layout.h (class Layout): Update declarations.
5879         * arm.cc (Target_arm::do_finalize_sections): Use
5880         add_target_dynamic_tags.
5881         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5882         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5883         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5884         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5885
5886 2010-01-07  Ian Lance Taylor  <iant@google.com>
5887
5888         PR 11042
5889         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5890         object as needed.
5891
5892 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5893             Ian Lance Taylor  <iant@google.com>
5894
5895         PR 11019
5896         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5897         Xindex::read_symtab_xindex.
5898
5899 2010-01-07  Doug Kwan  <dougkwan@google.com>
5900
5901         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5902         (Insn_template::thumb16_bcond_insn): New method declaration.
5903         (Insn_template): Fix spelling.
5904         (Stub::thumb16_special): New method declaration.
5905         (Stub::do_write): Define virtual method which was previously pure
5906         virtual.
5907         (Stub::do_thumb16_special): New method declaration.
5908         (Stub::do_fixed_endian_write): New template member.
5909         (Reloc_stub::do_write): Remove.
5910         (Reloc_stub::do_fixed_endian_write): Remove.
5911         (Cortex_a8_stub): New class definition.
5912         (Stub_factory::make_cortex_a8_stub): New method definition.
5913         (Stub_factory::Stub_factory): Add missing static storage class
5914         qualifier for elf32_arm_stub_a8_veneer_blx.
5915
5916 2010-01-07  Ian Lance Taylor  <iant@google.com>
5917
5918         PR 10980
5919         * options.h (class General_options): Add --warn-unresolved-symbols
5920         and --error-unresolved-symbols.
5921         * errors.cc (Errors::undefined_symbol): Implement
5922         --warn-unresolved-symbols.
5923
5924         * options.h (class General_options): Add -z text and -z textoff.
5925         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5926
5927 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5928
5929         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5930         (Garbage_collection::cident_sections): New function.
5931         (Garbage_collection::add_cident_section): New function.
5932         (Garbage_collection::cident_sections_): New member.
5933         (gc_process_relocs): Add references to sections whose names are C
5934         identifiers.
5935         * gold.h (cident_section_start_prefix): New constant.
5936         (cident_section_stop_prefix): New constant.
5937         (is_cident): New function.
5938         * layout.cc (Layout::define_section_symbols): Replace string constants
5939         with the newly defined constants.
5940         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5941         C identifiers.
5942         * testsuite/Makefile.am: Add gc_orphan_section_test.
5943         * testsuite/Makefile.in: Regenerate.
5944         * testsuite/gc_orphan_section_test.cc: New file.
5945         * testsuite/gc_orphan_section_test.sh: New file.
5946
5947 2010-01-06  Ian Lance Taylor  <iant@google.com>
5948
5949         PR 10980
5950         * options.h (class General_options): Add --warn-shared-textrel.
5951         * layout.cc (Layout::finish_dynamic_section): Implement
5952         --warn-shared-textrel.
5953
5954         PR 10980
5955         * options.h (class General_options): Add --warn-multiple-gp.
5956
5957 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5958
5959         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5960         $(THREADSLIB) and $(LIBDL).
5961         * Makefile.in: Rebuild.
5962
5963 2010-01-06  Ian Lance Taylor  <iant@google.com>
5964
5965         PR 10980
5966         * options.cc (General_options::parse_section_start): New function.
5967         (General_options::section_start): New function.
5968         (General_options::General_options): Initialize all members.
5969         * options.h: Include <map>
5970         (class General_options): Add --section-start.  Add section_starts_
5971         member.
5972         * layout.cc (Layout::attach_allocated_section_to_segment): If
5973         --section-start was used, set the address of the segment.  Remove
5974         local sort_sections.
5975         (Layout::relaxation_loop_body): If the address of the load segment
5976         has been set by --section-start, don't use it.
5977         * output.h (Output_segment::update_flags_for_output_section): New
5978         function.
5979         * output.cc (Output_segment::add_output_section): Call
5980         update_flags_for_output_section.
5981
5982 2010-01-05  Ian Lance Taylor  <iant@google.com>
5983
5984         PR 10980
5985         * options.h (class General_options): Add --undefined-version.
5986         * script.cc (struct Version_expression): Add was_matched_by_symbol
5987         field.
5988         (Version_script_info::matched_symbol): New function.
5989         (Version_script_info::get_symbol_version_helper): Call
5990         matched_symbol.
5991         (Version_script_info::check_unmatched_names): New function.
5992         * script.h (class Version_script_info): Update declarations.
5993         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5994
5995         * options.h (class General_options): Use DEFINE_bool_alias for
5996         allow_multiple_definition.
5997         * resolve.cc (Symbol_table::should_override): Don't test
5998         allow_multiple_definition.
5999
6000         PR 10980
6001         * options.h (class General_options): Add --cref.
6002         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6003         until after printing cref table.
6004         * cref.cc: Include "symtab.h".
6005         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6006         (Cref_table_compare::operator()): New function.
6007         (Cref_inputs::gather_cref): New function.
6008         (filecol): New static const.
6009         (Cref_inputs::print_cref): New function.
6010         (Cref::print_cref): New function.
6011         * cref.h: Include <cstdio>.
6012         (class Cref): Update declarations.
6013         * mapfile.h (Mapfile::file): New function.
6014         * object.h (class Object): Define Symbols.  Declare virtual
6015         do_get_global_symbols.
6016         (Object::get_global_symbols): New function.
6017         * object.cc (Input_objects::add_object): Pass object to cref_ if
6018         --cref.
6019         (Input_objects::archive_start): Likewise.
6020         (Input_objects::archive_stop): Likewise.
6021         (Input_objects::print_cref): New function.
6022         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6023         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6024         --cref.
6025         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6026         function.
6027         * plugin.h (class Sized_pluginobj): Update declarations.
6028
6029 2010-01-05  Ian Lance Taylor  <iant@google.com>
6030
6031         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6032         to is_default_version.  Rename insdef to insdefault.
6033         (Symbol_table::add_from_relobj): Rename def to is_default_version
6034         and local to is_forced_local.
6035         (Symbol_table::add_from_pluginobj): Likewise.
6036         (Symbol_table::add_from_dynobj): Likewise.
6037         (Symbol_table::define_special_symbol): Rename insdef to
6038         insdefault.
6039
6040 2010-01-04  Ian Lance Taylor  <iant@google.com>
6041
6042         PR 10980
6043         * options.h (class General_options): Add
6044         --allow-multiple-definition and -z muldefs.
6045         * resolve.cc (Symbol_table::should_override): Don't warn about a
6046         multiple symbol definition if --allow-multiple-definition or -z
6047         muldefs.
6048
6049         PR 10980
6050         * options.h (class General_options): Add --add-needed and
6051         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6052         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6053         error if --copy-dt-needed-entries aka --add-needed is used and
6054         would cause a change in behaviour.
6055
6056         PR 10980
6057         * options.h (class General_options): Add -G as a short version of
6058         --shared.  Add no-op options -assert, -g, and -i.
6059
6060 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6061
6062         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6063         check for .text or .gnu.linkonce.t sections.
6064         * icf.cc (Icf::find_identical_sections): Ditto.
6065         Change the detection for mangled function name within the section
6066         name.
6067         * icf.h (is_section_foldable_candidate): New function.
6068
6069 2009-12-30  Ian Lance Taylor  <iant@google.com>
6070
6071         PR 10980
6072         * options.h (class General_options): Permit two dashes with
6073         --retain-symbols-file.
6074
6075 2009-12-30  Ian Lance Taylor  <iant@google.com>
6076
6077         PR 10979
6078         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6079         don't put the file header and segment headers in the text
6080         segment.
6081
6082         PR 10979
6083         * common.cc (Sort_commons::operator()): Stabilize sort when both
6084         entries are NULL.
6085         (Symbol_table::do_allocate_commons_list): When allocating common
6086         symbols, skip a symbol which is no longer common.
6087         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6088         an object before checking its type.
6089         * testsuite/common_test_2.c: New file.
6090         * testsuite/common_test_3.c: New file.
6091         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6092         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6093         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6094         (common_test_2_pic.o, common_test_2.so): New targets.
6095         (common_test_3_pic.o, common_test_3.so): New targets.
6096         * testsuite/Makefile.in: Rebuild.
6097
6098         PR 10979
6099         * script.cc (read_input_script): If we see a new SECTIONS clause,
6100         and we have added an input section, give an error.
6101         * layout.h (class Layout): Add have_added_input_section function.
6102         Add have_added_input_section_ field.
6103         * layout.cc (Layout::Layout): Initialize
6104         have_added_input_section_.
6105         (Layout::layout): Set have_added_input_section_.
6106         (Layout::layout_eh_frame): Likewise.
6107
6108 2009-12-30  Ian Lance Taylor  <iant@google.com>
6109
6110         PR 10931
6111         * options.h (class General_options): Add --sort-common option.
6112         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6113         * common.cc (Sort_common): Add sort_order parameter to
6114         constructor.  Add sort_order_ field.
6115         (Sort_commons::operator): Check sort_order_.
6116         (Symbol_table::allocate_commons): Determine the sort order.
6117         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6118         Change all callers.
6119         (Symbol_table::do_allocate_commons_list): Likewise.
6120
6121 2009-12-30  Ian Lance Taylor  <iant@google.com>
6122
6123         PR 10916
6124         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6125         symbols from this object, don't change the visibility of an
6126         undefined symbol.
6127         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6128
6129 2009-12-30  Ian Lance Taylor  <iant@google.com>
6130
6131         PR 10861
6132         * script.h (class Version_script_info): Define Language enum.
6133         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6134         new fields globals_, locals_, and is_finalized_.
6135         * script.cc: Various formatting fixes.
6136         (class Parser_closure): Change language_stack_ from a vector of
6137         std::string to one of Version_script_info::Language.  Adjust all
6138         uses accordingly.
6139         (class Lazy_demangler): Remove.
6140         (struct Version_expression): Change language from std::string to
6141         Version_script_info::Language.
6142         (Version_script_info::Version_script_info): New function.
6143         (Version_script_info::~Version_script_info): Don't call clear.
6144         (Version_script_info::finalize): New function.
6145         (Version_script_info::build_lookup_tables): New function.
6146         (Version_script_info::build_expression_list_lookup): New
6147         function.
6148         (Version_script_info::get_symbol_version_helper): Rewrite to use
6149         lookup tables.
6150         (Version_script_info::print_expression_list): Adjust to use
6151         Version_script_info::Language.
6152         (script_push_lex_into_version_mode): Check that the version script
6153         has not been finalized.
6154         (version_script_push_lang): Change language string to
6155         Version_script_info::Language.
6156         * options.cc (Command_line::version_script): New function.
6157         * options.h (class General_options): Add finalize_dynamic_list
6158         function.  Change version_script from declaration to definition.
6159         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6160         * testsuite/version_script.map: Remove duplicate def of foo.
6161         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6162         version_script.map.
6163         * testsuite/Makefile.in: Rebuild.
6164
6165 2009-12-30  Ian Lance Taylor  <iant@google.com>
6166
6167         PR 10843
6168         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6169         if the input symbol index is 0, make the output symbol index 0.
6170
6171 2009-12-30  Ian Lance Taylor  <iant@google.com>
6172
6173         PR 10670
6174         * options.h (class General_options): Add -x/--discard-all.
6175         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6176         --discard-all.  If the local symbol needs a dynamic entry, check
6177         that before handling --discard-locals.
6178
6179 2009-12-30  Ian Lance Taylor  <iant@google.com>
6180
6181         PR 10450
6182         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6183         flags to PF_R.
6184         (Output_segment::add_output_section): Don't change the flags if
6185         the type is PT_TLS.
6186
6187         PR 10450
6188         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6189         GNU hash table if they need a dynamic value.  Otherwise, don't add
6190         them if they are defined in a dynamic object or are forced local.
6191
6192 2009-12-29  Ian Lance Taylor  <iant@google.com>
6193
6194         PR 10450
6195         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6196         .gnu.hash table for a 32-bit target.
6197
6198         PR 10450
6199         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6200         regular and a dynamic object only needs a dynamic symbol table
6201         entry if it is externally visible.
6202
6203         PR 10450
6204         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6205         constructor.  Add global_offset_table_ field.
6206         (Target_i386::got_section): Set global_offset_table_.
6207         (Target_i386::do_finalize_sections): Set global_offset_table_
6208         size.
6209         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6210         in constructor.  Add global_offset_table_ field.
6211         (Target_x86_64::got_section): Set global_offset_table_.
6212         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6213         size.
6214
6215         * layout.cc (Layout::Layout): Initialize increase_relro_.
6216         (Layout::get_output_section): Add is_relro, is_last_relro, and
6217         is_first_non_relro parameters.  Change all callers.
6218         (Layout::choose_output_section): Likewise.
6219         (Layout::add_output_section_data): Likewise.
6220         (Layout::make_output_section): Likewise.
6221         (Layout::set_segment_offsets): Clear increase_relro when using a
6222         linker script.
6223         * layout.h (class Layout): Add increase_relro method.  Add
6224         increase_relro_ field.  Update declarations.
6225         * output.cc (Output_section::Output_section): Initialize
6226         is_last_relro_ and is_first_non_relro_.
6227         (Output_segment::add_output_section): Group relro sections is
6228         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6229         (Output_segment::maximum_alignment): Remove relro handling.
6230         (Output_segment::set_section_addresses): Add increase_relro
6231         parameter.  Change all callers.  Add initial alignment to align
6232         relro sections on separate page.  Remove old relro handling.
6233         (Output_segment::set_section_list_addresses): Remove in_relro
6234         parameter.  Change all callers.
6235         (Output_segment::set_offset): Add increase parameter.  Change all
6236         callers.  Remove old relro handling.
6237         * output.h (class Output_section): Add new methods: is_last_relro,
6238         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6239         Add is_last_relro_ and is_first_non_relro_ fields.
6240         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6241         Create separate .got.plt section.  Call increase_relro.
6242         * x86_64.cc (Target_x86_64::got_section): Likewise.
6243         * testsuite/relro_script_test.t: Add .got.plt.
6244
6245         PR 10450
6246         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6247         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6248         (Layout::finalize): Call set_dynamic_symbol_size.
6249         (Layout::set_dynamic_symbol_size): New function.
6250         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6251         set_dynamic_symbol_size.
6252
6253         PR 10450
6254         * output.h (class Output_section): Add is_entsize_zero_ field.
6255         * output.cc (Output_section::Output_section): Initialize
6256         is_entsize_zero_.
6257         (Output_section::set_entsize): If two different entsizes are
6258         requested, force it to zero.
6259         (Output_section::add_input_section): Set flags for .debug_str
6260         before updating section flags.  Set entsize.
6261         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6262         and SHF_STRING if all input sections have those flags.
6263
6264 2009-12-29   Rafael Espindola  <espindola@google.com>
6265
6266         * main.cc (main): Fix the sys time reporting.
6267         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6268         reporting.
6269
6270 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6271
6272         * options.cc (General_options::parse_version): Allow -v to exit
6273         without an error if there is nothing to link.
6274
6275 2009-12-29  Ian Lance Taylor  <iant@google.com>
6276
6277         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6278         using a version of gcc before 4.1.
6279         * configure: Rebuild.
6280
6281 2009-12-28  Chris Demetriou  <cgd@google.com>
6282
6283         * attributes.cc (Output_attributes_section_data::do_write): Use
6284         std::vector::front rather than std::vector::data.
6285
6286 2009-12-28  Ian Lance Taylor  <iant@google.com>
6287
6288         * symtab.h (class Symbol_table): Add enum Defined.
6289         * resolve.cc (Symbol_table::should_override): Add defined
6290         parameter.  Change all callers.  Test whether object is NULL
6291         before calling a method on it.
6292         (Symbol_table::report_resolve_problem): Add defined parameter.
6293         Change all callers.
6294         (Symbol_table::should_override_with_special): Likewise.
6295         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6296         parameter.  Change all callers.
6297         (Symbol_table::do_define_in_output_data): Likewise.
6298         (Symbol_table::define_in_output_segment): Likewise.
6299         (Symbol_table::do_define_in_output_segment): Likewise.
6300         (Symbol_table::define_as_constant): Likewise.
6301         (Symbol_table::do_define_as_constant): Likewise.
6302         * script.h (class Symbol_assignment): Add is_defsym parameter to
6303         constructor; change all callers.
6304         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6305         parameter.  Change all callers.  Add is_defsym_ field.
6306         (class Parser_closure): Add parsing_defsym parameter to
6307         constructor; change all callers.  Add parsing_defsym accessor
6308         function.  Add parsing_defsym_ field.
6309
6310 2009-12-28  Ian Lance Taylor  <iant@google.com>
6311
6312         * gold.cc (queue_middle_tasks): Fix formatting.
6313         * object.cc (Relobj::is_section_name_included): Likewise.
6314
6315 2009-12-23  Ian Lance Taylor  <iant@google.com>
6316
6317         * i386.cc (Target_i386::do_calls_non_split): Recognize
6318         -fsplit-stack prologue for a function with a static chain.
6319         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6320         -fsplit-stack prologue when using %r11.
6321
6322 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6323
6324         * options.cc (General_options::parse_version): Make -v continue and do
6325         the link like GNU ld does.
6326
6327 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6328
6329         * Makefile.am (CCFILES): Add timer.cc.
6330         (HFILES): Add timer.h.
6331         * configure.ac: Check for sysconf and times.
6332         * main.cc: include timer.h.
6333         (main): Use Timer instead of get_run_time.
6334         * timer.cc: New.
6335         * timer.h: New.
6336         * workqueue.cc: include timer.h.
6337         (Workqueue::find_and_run_task):
6338         Report user, sys and wall time.
6339         * Makefile.in: Regenerate.
6340         * config.in: Regenerate.
6341         * configure: Regenerate.
6342
6343 2009-12-16  Doug Kwan  <dougkwan@google.com>
6344
6345         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6346         sections.
6347         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6348         relaxed input sections.
6349         * output.cc (Output_section::find_relaxed_input_section): Change
6350         return type to Output_relaxed_input_section pointer.  Adjust code
6351         for new type of relaxed_input_section_map_.
6352         * output.h (Output_section::find_relaxed_input_section): Change
6353         return type to Output_relaxed_input_section pointer.
6354         (Output_section::Output_relaxed_input_section_by_input_section_map):
6355         New type.
6356         (Output_section::relaxed_input_section_map_): Change type to
6357         Output_section::Output_relaxed_input_section_by_input_section_map.
6358         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6359         input section.
6360
6361 2009-12-15  Ian Lance Taylor  <iant@google.com>
6362
6363         * layout.cc (Layout::create_shstrtab): Only write out after input
6364         sections if we are compressing debug sections.
6365
6366 2009-12-15  Ian Lance Taylor  <iant@google.com>
6367
6368         * archive.cc (Archive::add_symbols): Only look up a symbol without
6369         a version if there is, in fact, a version.
6370
6371 2009-12-14  Ian Lance Taylor  <iant@google.com>
6372
6373         Revert -Wshadow changes, all changes from:
6374         2009-12-11  Doug Kwan  <dougkwan@google.com>
6375         2009-12-11  Nick Clifton  <nickc@redhat.com>
6376         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6377
6378 2009-12-11  Doug Kwan  <dougkwan@google.com>
6379
6380         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6381         due to -Wshadow.
6382         * attributes.cc (Object_attribute::size): Ditto.
6383         (Attributes_section_data::size): Ditto.
6384         (Attributes_section_data::Attributes_section_data): Ditto.
6385         (Output_attributes_section_data::do_write): Ditto.
6386         * attributes.h (Object_attribute::set_type): Ditto.
6387         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6388
6389 2009-12-11  Nick Clifton  <nickc@redhat.com>
6390
6391         * archive.cc: Fix shadowed variable warnings.
6392         * arm.cc: Likewise.
6393         * compressed_output.cc: Likewise.
6394         * compressed_output.h: Likewise.
6395         * configure: Likewise.
6396         * dwarf_reader.cc: Likewise.
6397         * dynobj.cc: Likewise.
6398         * dynobj.h: Likewise.
6399         * ehframe.cc: Likewise.
6400         * ehframe.h: Likewise.
6401         * errors.cc: Likewise.
6402         * expression.cc: Likewise.
6403         * fileread.cc: Likewise.
6404         * fileread.h: Likewise.
6405         * freebsd.h: Likewise.
6406         * i386.cc: Likewise.
6407         * icf.cc: Likewise.
6408         * incremental.h: Likewise.
6409         * layout.cc: Likewise.
6410         * layout.h: Likewise.
6411         * mapfile.cc: Likewise.
6412         * merge.cc: Likewise.
6413         * merge.h: Likewise.
6414         * object.cc: Likewise.
6415         * object.h: Likewise.
6416         * options.h: Likewise.
6417         * output.cc: Likewise.
6418         * output.h: Likewise.
6419         * parameters.cc: Likewise.
6420         * plugin.cc: Likewise.
6421         * powerpc.cc: Likewise.
6422         * reduced_debug_output.cc: Likewise.
6423         * reduced_debug_output.h: Likewise.
6424         * reloc.cc: Likewise.
6425         * reloc.h: Likewise.
6426         * resolve.cc: Likewise.
6427         * script-sections.cc: Likewise.
6428         * script.cc: Likewise.
6429         * script.h: Likewise.
6430         * sparc.cc: Likewise.
6431         * symtab.cc: Likewise.
6432         * symtab.h: Likewise.
6433         * target-select.cc: Likewise.
6434         * target-select.h: Likewise.
6435         * token.h: Likewise.
6436         * workqueue.cc: Likewise.
6437         * workqueue.h: Likewise.
6438         * x86_64.cc: Likewise.
6439
6440 2009-12-10  Doug Kwan  <dougkwan@google.com>
6441
6442         * arm.cc (attributes.h): New include.
6443         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6444         (Arm_relobj::~Arm_relobj): Delete object pointed by
6445         attributes_section_data_.
6446         (Arm_relobj::attributes_section_data): New method definition.
6447         (Arm_relobj::attributes_section_data_): New data member declaration.
6448         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6449         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6450         attributes_section_data_.
6451         (Arm_dynobj::attributes_section_data): New method definition.
6452         (Arm_dynobj::attributes_section_data_): New data member declaration.
6453         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6454         initialization value of may_use_blx_ to false.
6455         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6456         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6457         object attributes to compute results instead of hard-coding.
6458         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6459         Target_arm::get_secondary_compatible_arch,
6460         Target_arm::set_secondary_compatible_arch
6461         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6462         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6463         New method declarations.
6464         (Target_arm::get_aeabi_object_attribute): New method definition.
6465         (Target_arm::attributes_section_data_): New data member declaration.
6466         (read_arm_attributes_section): New template definition.
6467         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6468         (Arm_dynobj::do_read_symbols): Ditto.
6469         (Target_arm::do_finalize_sections): Merge attributes sections from
6470         input.  Check for BLX use after attributes section merging.
6471         Fix __exidx_start and __exidx_end visibility.  Create an
6472         .ARM.attributes section if necessary.
6473         (Target_arm::get_secondary_compatible_arch,
6474         Target_arm::set_secondary_compatible_arch,
6475         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6476         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6477         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6478         New method definitions.
6479
6480 2009-12-09  Ian Lance Taylor  <iant@google.com>
6481
6482         * plugin.cc (Plugin::load): Don't cast from void* to a function
6483         pointer.
6484
6485 2009-12-09  Ian Lance Taylor  <iant@google.com>
6486
6487         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6488         information fields.
6489
6490 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6491
6492         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6493         Replace two_file_shared_1.so with two_file_shared_2.so.
6494         * testsuite/Makefile.in: Regenerated.
6495
6496 2009-12-08  Doug Kwan  <dougkwan@google.com>
6497
6498         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6499         (HFILES): Add attributes.h and int_encoding.h.
6500         * Makefile.in: Regenerate.
6501         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6502         function definitions to int_encoding.cc
6503         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6504         prototypes to int_encoding.h
6505         * reduced_debug_output.cc (int_encoding.h): New include.
6506         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6507         function definitions to int_encoding.cc
6508         (insert_into_vector, read_from_pointer): Move template definitions to
6509         int_encoding.h
6510         * attributes.cc: New file.
6511         * attributes.h: New file.
6512         * int_encoding.cc: New file.
6513         * int_encoding.h: New file.
6514
6515 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6516
6517         PR gold/11055
6518         * incremental-dump.cc (dump_incremental_inputs): New.
6519         (main): Use dump_incremental_inputs.
6520
6521 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6522
6523         PR gold/10893
6524         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6525         checking elfcpp::STT_FUNC.
6526         (Target_i386::Relocate::relocate): Likewise.
6527         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6528
6529         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6530         symbols from shared libraries into normal FUNC symbols.
6531
6532         * symtab.h (Symbol): Add is_func and use it.
6533
6534 2009-12-05  Doug Kwan  <dougkwan@google.com>
6535
6536         * arm.cc (Target_arm::arm_info): Initialize new fields
6537         attributes_section and attributes_vendor.
6538         * i386.cc (Target_i386::i386_info): Same.
6539         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6540         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6541         fields attributes_section and attributes_vendor.
6542         * sparc.cc (Target_sparc::sparc_info): Same.
6543         * target.h (Target::attributes_section, Target::attributes_vendor,
6544         Target::is_attributes_section, Target::attribute_arg_type,
6545         Target::attributes_order): New method definitions.
6546         (Target::Target_info::attributes_section,
6547         Target::Target_info::attributes_vendor): New fields.
6548         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6549         virtual method definitions.
6550         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6551         attributes_section and attributes_vendor.
6552         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6553
6554 2009-12-05  Doug Kwan  <dougkwan@google.com>
6555
6556         * arm.cc: Update comments about interworking and stub generation.
6557         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6558         considered as non-PIC.
6559         (Arm_relocate_functions::base_abs): Fix formatting.
6560         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6561         of function to use GOT entry address instead of offset.
6562         (Target_arm::Scan::global): Issue an error if a symbol would need a
6563         PLT does not get one because it is untyped.  Remove code to create
6564         dynamic symbols for relative branches.
6565         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6566         takes unsigned integer instead of boolean.
6567
6568 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6569
6570         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6571         (two_file_test_LDADD): Likewise.
6572         (common_test_1_LDADD): Likewise.
6573         (exception_test_LDADD) Likewise.
6574         (weak_test_LDADD): Likewise.
6575         (many_sections_test_LDADD): Likewise.
6576         (initpri1_LDADD): Likewise.
6577         (script_test_1_LDADD): Likewise.
6578         (script_test_2_LDADD): Likewise.
6579         (justsyms_LDADD): Likewise.
6580         (binary_test_LDADD): Likewise.
6581         (large_LDADD): Likewise.
6582         * testsuite/Makefile.in: Regenerated.
6583
6584 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6585
6586         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6587         (Symbol_table::override_with_special): Likewise.
6588         (Symbol_table::add_from_object): Likewise.
6589
6590 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6591
6592         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6593         Don't set the data_offset twice.
6594
6595 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6596
6597         * testsuite/Makefile.in: Regenerate.
6598
6599 2009-12-03  Doug Kwan  <dougkwan@google.com>
6600
6601         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6602         (Target_arm::do_finalize_sections): Add parameter for symbol table
6603         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6604         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6605         parameter for symbol table pointer.
6606         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6607         an additional parameter for a pointer to symbol table.
6608         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6609         parameter for a symbol table pointer.
6610         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6611         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6612         Ditto.
6613         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6614         parameter for a symbol table pointer.
6615
6616 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6617
6618         * incremental.cc (Incremental_inputs_header)
6619         (Incremental_inputs_header_write, Incremental_inputs_entry)
6620         (Incremental_inputs_entry_write): Move ...
6621         * incremental.h (Incremental_inputs_header)
6622         (Incremental_inputs_header_write, Incremental_inputs_entry)
6623         (Incremental_inputs_entry_write): here.
6624
6625 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6626
6627         * incremental.cc (make_sized_incremental_binary): Set the target.
6628         Error if it is incompatible.
6629         * output.h (Output_file): Add filename method.
6630
6631 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6632
6633         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6634         from the get_* methods.
6635
6636 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6637
6638         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6639         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6640         Write 0 for the data_offset of scripts.
6641
6642 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6643
6644         * testsuite/Makefile.am: Add the incremental_test.sh test.
6645         * testsuite/incremental_test.sh: New.
6646         * testsuite/incremental_test_1.c: New.
6647         * testsuite/incremental_test_2.c: New.
6648
6649 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6650
6651        * incremental-dump.cc (main): Fix typos.
6652
6653 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6654
6655         PR gold/11025
6656         * incremental-dump.cc (main): Use llu to print 64 bit values.
6657
6658 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6659             H.J. Lu  <hongjiu.lu@intel.com>
6660
6661         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6662         $(LIBDL).
6663         (incremental_dump_LDADD): Likewise.
6664         * Makefile.in: Regenerated.
6665
6666 2009-11-25  Doug Kwan  <dougkwan@google.com>
6667
6668         Revert:
6669
6670         2009-11-25  Doug Kwan  <dougkwan@google.com>
6671
6672                 * arm.cc (Target_arm::Target_arm): Move method definition
6673                 outside of class definition.  Add code to handle
6674                 --target1-rel, --target1-abs and --target2= options.
6675                 (Target_arm::get_reloc_reloc_type): Change method to be
6676                 non-static and const.
6677                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6678                 New data member declaration.
6679                 (Target_arm::Scan::local, Target_arm::Scan::global,
6680                 Target_arm::Relocate::relocate,
6681                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6682                 Adjust call to Target_arm::get_real_reloc_type.
6683                 (Target_arm::get_real_reloc_type): Use command line options
6684                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6685                 * options.h (--target1-rel, --target1-abs, --target2): New
6686                 ARM-only options.
6687
6688 2009-11-25  Doug Kwan  <dougkwan@google.com>
6689
6690         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6691         class definition.  Add code to handle --target1-rel, --target1-abs
6692         and --target2= options.
6693         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6694         and const.
6695         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6696         member declaration.
6697         (Target_arm::Scan::local, Target_arm::Scan::global,
6698         Target_arm::Relocate::relocate,
6699         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6700         call to Target_arm::get_real_reloc_type.
6701         (Target_arm::get_real_reloc_type): Use command line options to
6702         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6703         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6704         options.
6705
6706 2009-11-25  Doug Kwan  <dougkwan@google.com>
6707
6708         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6709         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6710         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6711         formatting.
6712         (Arm_relocate_functions::thm_call): Replace body with a call to
6713         Arm_relocate_functions::thumb_branch_common.
6714         (Arm_relocate_functions::thm_jump24,
6715         Arm_relocate_functions::thm_xpc22): New method definitions.
6716         (Arm_relocate_functions::thumb_branch_common): New method definition.
6717         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6718         operator.
6719         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6720         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6721
6722 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6723
6724         * Makefile.am: Build incremental-dump
6725         * Makefile.in: Regenerate.
6726         * incremental-dump.cc: New.
6727         * incremental.cc (Incremental_inputs_header_data,
6728         Incremental_inputs_entry_data): Move to incremental.h
6729         * incremental.h: (Incremental_inputs_header_data,
6730         Incremental_inputs_entry_data): Move from incremental.cc
6731
6732 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6733
6734         * incremental.cc (Incremental_inputs_header,
6735         Incremental_inputs_header_write, Incremental_inputs_entry,
6736         Incremental_inputs_entry_write): Add a typedef with the data type.
6737
6738 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6739
6740         * incremental.cc (Incremental_inputs_header,
6741         Incremental_inputs_header_write, Incremental_inputs_entry,
6742         Incremental_inputs_entry_write): Update comment about which
6743         type has the filed descriptions.
6744
6745 2009-11-15  Doug Kwan  <dougkwan@google.com>
6746
6747         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6748         (Arm_relocate_functions::arm_branch_common): Change method defintion
6749         in class definition to a method declaration and update list of formal
6750         parameters.
6751         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6752         Arm_relocation_functions::jump24): Adjust call to
6753         Arm_relocate_functions::arm_branch_common.  Update list of formal
6754         parameters.
6755         (Arm_relocate_functions::xpc25): New method definition.
6756         (Arm_relocate_functions::arm_branch_common): Move method defintion
6757         out from class definition.  Use stubs for mode-switching and extending
6758         branch ranges.
6759         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6760         specially.  Change code to enable use of stubs in ARM branches.
6761
6762 2009-11-10  Doug Kwan  <dougkwan@google.com>
6763
6764         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6765         in method declaration.
6766         (Target_arm::relocate_stub): New method declaration.
6767         (Target_arm::default_target): Change to return a pointer instead of
6768         a const reference.
6769         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6770         Target_arm::default_target.
6771         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6772         method definition.
6773         (Target_arm::relocate_section): Adjust view.
6774         (Target_arm::relocate_stub): New method definition.
6775
6776 2009-11-10  Doug Kwan  <dougkwan@google.com>
6777
6778         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6779         a format warning.
6780         * incremental.cc (open_incremental_binary): Initialized local
6781         variables to avoid warnings.
6782         * object.cc (make_elf_object): Ditto.
6783         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6784         a format warning.
6785
6786 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6787
6788         PR gold/10930
6789         * testsuite/plugin_test.c: Include "config.h".
6790
6791 2009-11-09  Doug Kwan  <dougkwan@google.com>
6792
6793         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6794         (arm_symbol_value): Remove.
6795         (Arm_relocate_functions::arm_branch_common,
6796         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6797         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6798         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6799         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6800         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6801         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6802         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6803         Arm_relocate_functions::thm_mobw_abs_nc,
6804         Arm_relocate_functions::thm_mov_abs,
6805         Arm_relocate_functions::movw_prel_nc,
6806         Arm_relocate_functions::thm_movt_abs,
6807         Arm_relocate_functions::movt_prel,
6808         Arm_relocate_functions::thm_movw_prel_nc,
6809         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6810         (Target_arm::Relocate::relocate): Only decompose address into two
6811         parts if relocation type uses the thumb-bit and pass the actual
6812         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6813         calls to methods in Arm_relocate_functions for this change.
6814
6815 2009-11-08  Ian Lance Taylor  <iant@google.com>
6816
6817         PR 10925
6818         * reloc.cc: Instantiate
6819         Sized_relobj::initialize_input_to_output_maps and
6820         Sized_relobj:free_input_to_output_maps.
6821
6822 2009-11-06  Ian Lance Taylor  <iant@google.com>
6823
6824         PR 10876
6825         * defstd.cc (in_segment): Set only_if_ref true for "end".
6826
6827 2009-11-06  Doug Kwan  <dougkwan@google.com>
6828
6829         * arm.cc (class Reloc_stub): Correct a comment.
6830         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6831         (Target_arm::scan_section_for_stubs): New method declaration.
6832         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6833         Change methods from private to protected.
6834         (Target_arm::do_may_relax): New method definition.
6835         (Target_arm::do_relax, Target_arm::group_sections,
6836         Target_arm::scan_reloc_for_stub,
6837         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6838         (Target_arm::arm_input_section_map_): New data member declaration.
6839         (Target_arm::scan_reloc_for_stub,
6840         Target_arm::scan_reloc_section_for_stubs,
6841         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6842         Target_arm::do_relax): New method definitions.
6843
6844 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6845
6846         * configure.ac: Check for (struct stat)::st_mtim
6847         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6848         * config.in: Regenerate.
6849         * configure: Regenerate.
6850
6851 2009-11-05  Ian Lance Taylor  <iant@google.com>
6852
6853         PR 10910
6854         * output.cc (Output_segment::add_output_section): Add missing
6855         return statement.
6856
6857 2009-11-04  Ian Lance Taylor  <iant@google.com>
6858
6859         PR 10880
6860         * object.h (class Object): Add is_needed and set_is_needed
6861         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6862         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6863         defined in a dynamic object and referenced by a regular object,
6864         set is_needed for the dynamic object.
6865         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6866         if the file is marked with as_needed and it is not needed.
6867
6868 2009-11-04  Ian Lance Taylor  <iant@google.com>
6869
6870         PR 10887
6871         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6872         tags if data is discarded by linker script.
6873         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6874         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6875         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6876         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6877
6878 2009-11-04  Ian Lance Taylor  <iant@google.com>
6879
6880         * layout.cc (Layout::get_output_section): Add is_interp and
6881         is_dynamic_linker_section parameters.  Change all callers.
6882         (Layout::choose_output_section): Likewise.
6883         (Layout::make_output_section): Likewise.
6884         (Layout::add_output_section_data): Add is_dynamic_linker_section
6885         parameter.  Change all callers.
6886         * layout.h (class Layout): Update declarations.
6887         * output.h (class Output_section): Add is_interp, set_is_interp,
6888         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6889         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6890         generate_code_fills_at_write_ to a bitfield.
6891         * output.cc (Output_section::Output_sections): Initialize new
6892         fields.
6893         (Output_segment::add_output_section): Add do_sort parameter.
6894         Change all callers.
6895
6896 2009-11-03  Ian Lance Taylor  <iant@google.com>
6897
6898         PR 10860
6899         * options.h (class General_options): Add --warn-common.
6900         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6901         merging two common symbols.
6902         (Symbol_table::should_override): Handle --warn-common when merging
6903         a common symbol with a defined symbol.  Use report_resolve_problem
6904         for multiple definitions.
6905         (Symbol_table::report_resolve_problem): New function.
6906         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6907
6908 2009-11-03  Doug Kwan  <dougkwan@google.com>
6909
6910         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6911         stub_factory_.
6912         (Target_arm::stub_factory): New method definition.
6913         (Target_arm::new_arm_input_section,
6914         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6915         Target_arm::reloc_uses_thumb_bit): New method declarations.
6916         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6917         New type definitions.
6918         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6919         member declarations.
6920         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6921         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6922         New method definitions.
6923
6924 2009-11-03  Ian Lance Taylor  <iant@google.com>
6925
6926         * options.h (class General_options): Add --warn_constructors.
6927
6928 2009-11-03  Ian Lance Taylor  <iant@google.com>
6929
6930         PR 10893
6931         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6932         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6933
6934 2009-11-03  Ian Lance Taylor  <iant@google.com>
6935
6936         PR 10895
6937         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6938         --msgid-bugs-address.
6939         (install-pdf): New target.
6940         (install-data_yes): Look up one directory to find mkinstalldirs.
6941
6942 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6943
6944         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6945         tree.
6946
6947 2009-10-30  Doug Kwan  <dougkwan@google.com>
6948
6949         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6950
6951 2009-10-30  Doug Kwan  <dougkwan@google.com>
6952
6953         * arm.cc (Stub_addend_reader): New struct template definition
6954         and partial specializations.
6955         (Stub_addend_reader::operator()): New method definition for a
6956         partially specialized template.
6957
6958 2009-10-30  Doug Kwan  <dougkwan@google.com>
6959
6960         * arm.cc (Arm_relobj::processor_specific_flags): New method
6961         definition.
6962         (Arm_relobj::do_read_symbols): New method declaration.
6963         (Arm_relobj::processor_specific_flags_): New data member declaration.
6964         (Arm_dynobj): New class definition.
6965         (Target_arm::do_finalize_sections): Add input_objects parameter.
6966         (Target_arm::do_adjust_elf_header): New method declaration.
6967         (Target_arm::are_eabi_versions_compatible,
6968         (Target_arm::merge_processor_specific_flags): New method declaration.
6969         (Target_arm::do_make_elf_object): New overloaded method definitions
6970         and declaration.
6971         (Arm_relobj::do_read_symbols): New method definition.
6972         (Arm_dynobj::do_read_symbols): Ditto.
6973         (Target_arm::do_finalize_sections): Add input_objects parameters.
6974         Merge processor-specific flags from all input objects.
6975         (Target_arm::are_eabi_versions_compatible,
6976         Target_arm::merge_processor_specific_flags,
6977         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6978         New method definitions.
6979         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6980         Input_objects pointer type parameter.
6981         * layout.cc (Layout::finalize): Pass input objects to target's.
6982         finalize_sections function.
6983         * output.cc (Output_file_header::do_sized_write): Set ELF file
6984         header's processor-specific flags.
6985         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6986         Input_objects pointer type parameter.
6987         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6988         * target.h (Input_objects): New forward class declaration.
6989         (Target::processor_specific_flags,
6990         Target::are_processor_specific_flags_sect): New method definitions.
6991         (Target::finalize_sections): Add input_objects parameter.
6992         (Target::Target): Initialize processor_specific_flags_ and
6993         are_processor_specific_flags_set_.
6994         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6995         parameter.
6996         (Target::set_processor_specific_flags): New method definition.
6997         (Target::processor_specific_flags_,
6998         Target::are_processor_specific_flags_set_): New data member
6999         declarations.
7000         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7001         Input_objects pointer type parameter.
7002
7003 2009-10-30  Doug Kwan  <dougkwan@google.com>
7004
7005         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7006
7007 2009-10-28  Ian Lance Taylor  <iant@google.com>
7008
7009         * object.h (class Relobj): Drop options parameter from
7010         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7011         do_scan_relocs, do_relocate.  Change all callers.
7012         (class Sized_relobj): Drop options parameters from
7013         do_gc_process_relocs, do_scan_relocs, do_relocate,
7014         do_relocate_sections, relocate_sections, emit_relocs_scan,
7015         emit_relocs_scan_reltype.  Change all callers.
7016         (struct Relocate_info): Remove options field and all references to
7017         it.
7018         * reloc.h (class Read_relocs): Remove options constructor
7019         parameter and options_ field.  Change all callers.
7020         (class Gc_process_relocs, class Scan_relocs): Likewise.
7021         (class Relocate_task): Likewise.
7022         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7023         all callers.
7024         (scan_relocatable_relocs): Likewise.
7025         * target.h (class Sized_target): Remove options parameter from
7026         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7027         all callers.
7028         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7029         callers.
7030         * arm.cc: Update functions to remove options parameters.
7031         * i386.cc: Likewise.
7032         * powerpc.cc: Likewise.
7033         * sparc.cc: Likewise.
7034         * x86_64.cc: Likewise.
7035         * testsuite/testfile.cc: Likewise.
7036
7037 2009-10-28  Doug Kwan  <dougkwan@google.com>
7038
7039         * arm.cc (Arm_relobj): New class definition.
7040         (Arm_relobj::scan_sections_for_stubs,
7041         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7042         New method definitions.
7043
7044 2009-10-28  Cary Coutant  <ccoutant@google.com>
7045
7046         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7047         (Plugin::cleanup_done_): New member.
7048         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7049         (Plugin_manager::cleanup_done_): Remove.
7050         (Plugin_manager::add_input_file): Edit error message.
7051         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7052         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7053
7054 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7055
7056         * fileread.cc: (File_read::View::~View): Use the new
7057         data_ownership_ filed.
7058         (File_read::~File_read): Dispose the new whole_file_view_.
7059         (File_read::open): Mmap the whole file if needed.
7060         (File_read::open): Use whole_file_view_ instead of contents_.
7061         (File_read::find_view): Use whole_file_view_ if applicable.
7062         (File_read::do_read): Use whole_file_view_ instead of contents_.
7063         (File_read::make_view): Use whole_file_view_ instead of contents_,
7064         update File_read::View::View call.
7065         (File_read::find_or_make_view): Update File_read::View::View
7066         call.
7067         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7068         remove contents_
7069         (File_read::View::Data_ownership): New enum.
7070         (File_read::View::View): Replace bool mapped_ with Data_ownership
7071         argument.
7072         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7073         (File_read::View::data_ownership_): New field.
7074         (File_read::contents_): Remove (replaced by whole_file_view_).
7075         (File_read::whole_file_view_): New field.
7076         * options.h (class General_options): Add --keep-files-mapped.
7077
7078 2009-10-27  Cary Coutant  <ccoutant@google.com>
7079
7080         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7081         * testsuite/Makefile.am (plugin_test_5): New test case.
7082         * testsuite/Makefile.in: Regenerate.
7083
7084 2009-10-25  Doug Kwan  <dougkwan@google.com>
7085
7086         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7087         from private to protected to allow access by child class.
7088         (Sized_relobj::do_relocate_sections): New method declaration.
7089         (Sized_relobj::relocate_sections): Virtualize.
7090         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7091         Sized_relobj::relocate_sections.  Instantiate template explicitly
7092         for different target sizes and endianity.
7093
7094 2009-10-24  Doug Kwan  <dougkwan@google.com>
7095
7096         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7097         (Arm_input_section::as_arm_input_section): New method.
7098         (Arm_output_section): New class definition.
7099         (Arm_output_section::create_stub_group,
7100         Arm_output_section::group_sections): New method definitions.
7101
7102 2009-10-22  Doug Kwan  <dougkwan@google.com>
7103
7104         * arm.cc (Arm_input_section): New class definition.
7105         (Arm_input_section::init, Arm_input_section:do_write,
7106         Arm_input_section::set_final_data_size,
7107         Arm_input_section::do_reset_address_and_file_offset): New method
7108         definitions.
7109
7110 2009-10-21  Doug Kwan  <dougkwan@google.com>
7111
7112         * arm.cc (Stub_table, Arm_input_section): New forward class
7113         declarations.
7114         (Stub_table): New class defintion.
7115         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7116         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7117         New method definition.
7118
7119 2009-10-21  Doug Kwan  <dougkwan@google.com>
7120
7121         * arm.cc: Update copyright comments.
7122         (Target_arm): New forward class template declaration.
7123         (Arm_address): New type.
7124         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7125         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7126         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7127         constants.
7128         (Insn_template): Same.
7129         (DEF_STUBS): New macro.
7130         (Stub_type): New enum type.
7131         (Stub_template): New class definition.
7132         (Stub): Same.
7133         (Reloc_stub): Same.
7134         (Stub_factory): Same.
7135         (Target_arm::Target_arm): Initialize may_use_blx_ and
7136         should_force_pic_veneer_.
7137         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7138         Target_arm::should_force_pic_veneer,
7139         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7140         Target_arm::using_thumb_only, Target_arm:;default_target): New
7141         method defintions.
7142         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7143         New data member declarations.
7144         (Insn_template::size, Insn_template::alignment): New method defintions.
7145         (Stub_template::Stub_template): New method definition.
7146         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7147         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7148         (Stub_factory::Stub_factory): New method definition.
7149         * gold.h (string_hash): New template.
7150         * output.h (Input_section_specifier::hash_value): Use
7151         gold::string_hash.
7152         (Input_section_specifier::string_hash): Remove.
7153         * stringpool.cc (Stringpool_template::string_hash): Use
7154         gold::string_hash.
7155
7156 2009-10-20  Doug Kwan  <dougkwan@google.com>
7157
7158         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7159         symbols of relaxed input sections.
7160         * output.h (Output_section::find_relaxed_input_section): Make
7161         method public.
7162
7163 2009-10-16  Doug Kwan  <dougkwan@google.com>
7164
7165         * dynobj.cc (Versions::Versions): Initialize version_script_.
7166         Only insert base version symbol definition for a shared object
7167         if version script defines any version versions.
7168         (Versions::define_base_version): New method definition.
7169         (Versions::add_def): Check that base version is not needed.
7170         (Versions::add_need): Define base version lazily.
7171         * dynobj.h (Versions::define_base_version): New method declaration.
7172         (Versions::needs_base_version_): New data member declaration.
7173         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7174         (check_DATA): Add no_version_test.stdout.
7175         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7176         New make rules.
7177         * testsuite/Makefile.in: Regenerate.
7178         * testsuite/no_version_test.c: New file.
7179         * testsuite/no_version_test.sh: Ditto.
7180
7181 2009-10-16  Doug Kwan  <dougkwan@google.com>
7182
7183         * expression.cc (class Segment_start_expression): New class definition.
7184         (Segment_start_expression::value): New method definition.
7185         (script_exp_function_segment_start): Return a new
7186         Segment_start_expression.
7187         * gold/script-c.h (script_saw_segment_start_expression): New function
7188         prototype.
7189         * script-sections.cc (Script_sections::Script_sections): Initialize
7190         SAW_SEGMENT_START_EXPRESSION_ to false.
7191         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7192         and -Tbbs options to specify section addresses if given in
7193         command line and no SEGMENT_START expression is seen in a script.
7194         * script-sections.h (Script_sections::saw_segment_start_expression,
7195         Script_sections::set_saw_segment_start_expression): New method
7196         definition.
7197         (Script_sections::saw_segment_start_expression_): New data member
7198         declaration.
7199         * script.cc (script_saw_segment_start_expression): New function.
7200         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7201         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7202         script_test_7.sh and script_test_8.sh.
7203         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7204         script_test_8.stdout.
7205         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7206         (script_test_6, script_test_6.stdout, script_test_7,
7207         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7208         * Makefile.in: Regenerate.
7209         * testsuite/script_test_6.sh: New file.
7210         * testsuite/script_test_6.t: Same.
7211         * testsuite/script_test_7.sh: Same.
7212         * testsuite/script_test_7.t: Same.
7213         * testsuite/script_test_8.sh: Same.
7214
7215 2009-10-16  Doug Kwan  <dougkwan@google.com>
7216
7217         * output.cc (Output_segment::set_section_list_address): Cast
7218         expressions to unsigned long long type to avoid format warnings.
7219
7220 2009-10-15  Ian Lance Taylor  <iant@google.com>
7221
7222         * script.cc (Script_options::add_symbol_assignment): Always add a
7223         dot assignment to script_sections_.
7224         * script-sections.cc (Script_sections::add_dot_assignment):
7225         Initialize if necessary.
7226
7227         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7228         program headers with no load segment if there is a linker script.
7229
7230         * layout.cc (Layout::set_segment_offsets): Align the file offset
7231         to the segment aligment for -N or -n with no load segment.
7232         * output.cc (Output_segment::add_output_section): Don't crash if
7233         the first section is a TLS section.
7234         (Output_segment::set_section_list_addresses): Print an error
7235         message if the address moves backward in a linker script.
7236         * script-sections.cc
7237         (Output_section_element_input::set_section_addresses): Don't
7238         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7239         (Orphan_output_section::set_section_addresses): Likewise.
7240
7241 2009-10-15  Doug Kwan  <dougkwan@google.com>
7242
7243         * layout.cc (Layout::finish_dynamic_section): Generate tags
7244         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7245         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7246         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7247
7248 2009-10-14  Ian Lance Taylor  <iant@google.com>
7249
7250         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7251         fields.
7252         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7253         data_shdr fields of relinfo.
7254         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7255         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7256         R_386_TLS_LDO_32, adjust based on section flags.
7257         (Target_i386::Relocate::fix_up_ldo): Remove.
7258
7259 2009-10-13  Ian Lance Taylor  <iant@google.com>
7260
7261         Add support for -pie.
7262         * options.h (class General_options): Add -pie and
7263         --pic-executable.
7264         (General_options::output_is_position_independent): Test -pie.
7265         (General_options::output_is_executable): Return true if not shared
7266         and not relocatable.
7267         (General_options::output_is_pie): Remove.
7268         * options.cc (General_options::finalize): Reject incompatible uses
7269         of -pie.
7270         * gold.cc (queue_middle_tasks): A -pie link is not static.
7271         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7272         * symtab.cc (Symbol::final_value_is_known): Return false if
7273         output_is_position_independent.
7274         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7275         output_is_position_independent.
7276         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7277         output_is_position_independent.
7278         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7279         output_is_position_independent.
7280         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7281         two_file_pie_test.
7282         (basic_pie_test.o, basic_pie_test): New targets.
7283         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7284         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7285         (two_file_pie_test): New target.
7286         * testsuite/Makefile.in: Rebuild.
7287         * README: Remove note saying that -pie is not supported.
7288
7289 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7290
7291         * options.h (class General_options): Add -init and -fini.
7292         * layout.cc (Layout::finish_dynamic_section): Emit
7293         given init and fini functions.
7294
7295 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7296
7297         * gc.h (gc_process_relocs): Check if icf is enabled using new
7298         function.
7299         * gold.cc (queue_initial_tasks): Likewise.
7300         (queue_middle_tasks): Likewise.
7301         * object.cc (do_layout): Likewise.
7302         * symtab.cc (is_section_folded): Likewise.
7303         * main.cc (main): Likewise.
7304         * reloc.cc (Read_relocs::run): Likewise.
7305         (Sized_relobj::do_scan_relocs): Likewise.
7306         * icf.cc (is_function_ctor_or_dtor): New function.
7307         (Icf::find_identical_sections): Check if function is ctor or dtor when
7308         safe icf is chosen.
7309         * options.h (General_options::icf): Change option to be an enum.
7310         (Icf_status): New enum.
7311         (icf_enabled): New method.
7312         (icf_safe_folding): New method.
7313         (set_icf_status): New method.
7314         (icf_status_): New variable.
7315         * (options.cc) (General_options::finalize): Set icf_status_.
7316         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7317         icf_test and icf_keep_unique_test to use the --icf enum flag.
7318         * testsuite/icf_safe_test.sh: New file.
7319         * testsuite/icf_safe_test.cc: New file.
7320
7321 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7322
7323         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7324         includes to gc.h and icf.h.
7325         * arm.cc: Include gc.h.
7326         * gold.cc: Likewise.
7327         * i386.cc: Likewise.
7328         * powerpc.cc: Likewise.
7329         * sparc.cc: Likewise.
7330         * x86_64.cc: Likewise.
7331         * gc.h: Include icf.h.
7332
7333 2009-10-11  Ian Lance Taylor  <iant@google.com>
7334
7335         * plugin.cc: Include "gold.h" before other header files.
7336
7337 2009-10-10  Chris Demetriou  <cgd@google.com>
7338
7339         * options.h (Input_file_argument::Input_file_type): New enum.
7340         (Input_file_argument::is_lib_): Replace with...
7341         (Input_file_argument::type_): New member.
7342         (Input_file_argument::Input_file_argument): Take Input_file_type
7343         'type' rather than boolean 'is_lib' as second argument.
7344         (Input_file_argument::is_lib): Use type_.
7345         (Input_file_argument::is_searched_file): New function.
7346         (Input_file_argument::may_need_search): Handle is_searched_file.
7347         * options.cc (General_options::parse_library): Support -l:filename.
7348         (General_options::parse_just_symbols): Update for Input_file_argument
7349         changes.
7350         (Command_line::process): Likewise.
7351         * archive.cc (Archive::get_file_and_offset): Likewise.
7352         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7353         * script.cc (read_script_file, script_add_file): Likewise.
7354         * fileread.cc (Input_file::Input_file): Likewise.
7355         (Input_file::will_search_for): Handle is_searched_file.
7356         (Input_file::open): Likewise.
7357         * readsyms.cc (Read_symbols::get_name): Likewise.
7358         * testsuite/Makefile.am (searched_file_test): New test.
7359         * testsuite/Makefile.in: Regenerate.
7360         * testsuite/searched_file_test.cc: New file.
7361         * testsuite/searched_file_test_lib.cc: New file.
7362
7363 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7364             Ian Lance Taylor  <iant@google.com>
7365
7366         * descriptor.cc: Include <cstdio> and "binary-io.h".
7367         (Descriptors::open): Open the files in binary mode always.
7368         * script.cc (Lex::get_token): Treat \r as whitespace.
7369
7370 2009-10-09  Ian Lance Taylor  <iant@google.com>
7371
7372         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7373
7374 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7375             Ian Lance Taylor  <iant@google.com>
7376
7377         * configure.ac: Check for readv function also.
7378         * fileread.cc (readv): Define if not HAVE_READV.
7379         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7380         does not exist.
7381         * config.in: Regenerate.
7382         * configure: Regenerate.
7383
7384 2009-10-09  Doug Kwan  <dougkwan@google.com>
7385
7386         * layout.cc (Layout::make_output_section): Call target hook to make
7387         ordinary output section.
7388         (Layout::finalize): Adjust parameter list of call the
7389         Target::may_relax().
7390         * layout.h (class Layout::section_list): New method.
7391         * merge.h (Output_merge_base::entsize): Change visibility to public.
7392         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7393         New methods.
7394         (Output_merge_string::do_is_string): New method.
7395         * object.cc (Sized_relobj::do_setup): renamed from
7396         Sized_relobj::set_up.
7397         * object.h (Sized_relobj::adjust_shndx,
7398         Sized_relobj::initializ_input_to_output_maps,
7399         Sized_relobj::free_input_to_output_maps): Change visibilities to
7400         protected.
7401         (Sized_relobj::setup): Virtualize.
7402         (Sized_relobj::do_setup): New method declaration.
7403         (Sized_relobj::invalidate_section_offset,
7404         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7405         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7406         * options.cc (parse_int): New function.
7407         * options.h (parse_int): New declaration.
7408         (DEFINE_int): New macro.
7409         (stub_group_size): New option.
7410         * output.cc (Output_section::Output_section): Initialize memebers
7411         merge_section_map_, merge_section_by_properties_map_,
7412         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7413         (Output_section::add_input_section): Handled deferred code-fill
7414         generation and remove an old comment.
7415         (Output_section::add_relaxed_input_section): New method definition.
7416         (Output_section::add_merge_input_section): Use merge section by
7417         properties map to speed to search.  Update merge section maps
7418         as appropriate.
7419         (Output_section::build_relaxation_map): New method definition.
7420         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7421         Same.
7422         (Output_section::relax_input_section): Renamed to
7423         Output_section::convert_input_sections_to_relaxed_sections and change
7424         interface to take a vector of pointers to relaxed sections.
7425         (Output_section::find_merge_section,
7426         Output_section::find_relaxed_input_section): New method definitions.
7427         (Output_section::is_input_address_mapped,
7428         Output_section::output_offset, Output_section::output_address):
7429         Use output section data maps to speed up searching.
7430         (Output_section::find_starting_output_address): Add comments.
7431         (Output_section::do_write,
7432         Output_section::write_to_postprocessing_buffer): Do code-fill
7433         generation as appropriate.
7434         (Output_section::get_input_sections): Invalidate relaxed input section
7435         map.
7436         (Output_section::restore_states): Adjust type of checkpoint .
7437         Invalidate relaxed input section map.
7438         * output.h (Output_merge_base): New class declaration.
7439         (Input_section_specifier): New class defintion.
7440         (class Output_relaxed_input_section) Change base class to
7441         Output_section_data_build.
7442         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7443         base class initializer.
7444         (Output_section::add_relaxed_input_section): New method declaration.
7445         (Output_section::Input_section): Change visibility to protected.
7446         (Output_section::Input_section::relobj,
7447         Output_section::Input_section::shndx): Handle relaxed input sections.
7448         Output_section::input_sections) Change visibility to protected.  Also
7449         define overload to return a non-const pointer.
7450         (Output_section::Merge_section_properties): New class defintion.
7451         (Output_section::Merge_section_by_properties_map,
7452         Output_section::Output_section_data_by_input_section_map,
7453         Output_section::Relaxation_map): New types.
7454         (Output_section::relax_input_section): Rename method to
7455         Output_section::convert_input_sections_to_relaxed_sections and change
7456         interface to take a vector of relaxed section pointers.
7457         (Output_section::find_merge_section,
7458         Output_section::find_relaxed_input_section,
7459         Output_section::build_relaxation_map,
7460         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7461         New method declarations.
7462         (Output_section::merge_section_map_
7463         Output_section::merge_section_by_properties_map_,
7464         Output_section::relaxed_input_section_map_,
7465         Output_section::is_relaxed_input_section_map_valid_,
7466         Output_section::generate_code_fills_at_write_): New data members.
7467         * script-sections.cc
7468         (Output_section_element_input::set_section_addresses): Call
7469         current_data_size and addralign methods of relaxed input sections.
7470         (Orphan_output_section::set_section_addresses): Call current_data_size
7471         and addralign methods of relaxed input sections.
7472         * symtab.cc (Symbol_table::compute_final_value): Extract template
7473         from the body of Symbol_table::sized_finalize_symbol.
7474         (Symbol_table::sized_finalized_symbol): Call
7475         Symbol_table::compute_final_value.
7476         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7477         (Symbol_table::compute_final_value): New templated method declaration.
7478         * target.cc (Target::do_make_output_section): New method defintion.
7479         * target.h (Target::make_output_section): New method declaration.
7480         (Target::relax): Add more parameters for input objects, symbol table
7481         and layout.  Adjust call to do_relax.
7482         (Target::do_make_output_section): New method declaration.
7483         (Target::do_relax): Add parameters for input objects, symbol table
7484         and layout.
7485
7486 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7487
7488         * pread.c: Include stdio.h.
7489
7490 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7491
7492         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7493         defined.
7494
7495 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7496
7497         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7498         Change read_shndx type to unsigned int.
7499         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7500         int.
7501         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7502         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7503         Change read_shndx type to unsigned int.
7504         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7505         int.
7506         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7507         * layout.cc (Layout::create_symtab_sections): Cast the result of
7508         local_symcount * symsize to off_t in the gold_assert.
7509
7510 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7511
7512         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7513         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7514         R_ARM_BASE_ABS.
7515         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7516         (Arm_relocate_functions::thm_abs5): New function.
7517         (Arm_relocate_functions::abs12): New function.
7518         (Arm_relocate_functions::abs16): New function.
7519         (Arm_relocate_functions::base_abs): New function.
7520         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7521         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7522         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7523         R_ARM_BASE_ABS.
7524         (Scan::global): Likewise.
7525         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7526         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7527         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7528         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7529         R_ARM_BASE_ABS.
7530
7531 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7532
7533         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7534         (Arm_relocate_functions::movt_prel): New function.
7535         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7536         (Arm_relocate_functions::thm_movt_prel): New function.
7537         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7538         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7539         (Scan::global, Relocate::relocate): Likewise.
7540         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7541
7542 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7543
7544         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7545         Incremental_checker.
7546         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7547         unsigned int.
7548         (class Incremental_inputs_header): New class.
7549         (Incremental_inputs_header_writer): Edit comment.
7550         (Incremental_inputs_entry): New class.
7551         (Incremental_inputs_entry_writer): Edit comment.
7552         (Sized_incremental_binary::do_find_incremental_inputs_section):
7553         Add *strtab_shndx parameter, fill it.
7554         (Sized_incremental_binary::do_check_inputs): New method.
7555         (Incremental_checker::can_incrementally_link_output_file): Use
7556         Sized_incremental_binary::check_inputs.
7557         (Incremental_inputs::report_command_line): Save command line in
7558         command_line_.
7559         * incremental.h:
7560         (Incremental_binary::find_incremental_inputs_section): New
7561         method.
7562         (Incremental_binary::do_find_incremental_inputs_section): Add
7563         strtab_shndx parameter.
7564         (Incremental_binary::do_check_inputs): New pure virtual method.
7565         (Sized_incremental_binary::do_check_inputs): Declare.
7566         (Incremental_checker::Incremental_checker): Add incremental_inputs
7567         parameter, use it to initialize incremental_inputs_.
7568         (Incremental_checker::incremental_inputs_): New field.
7569         (Incremental_checker::command_line): New method.
7570         (Incremental_checker::inputs): New method.
7571         (Incremental_checker::command_line_): New field.
7572
7573 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7574
7575         * incremental.cc: Include <cstdarg> and "target-select.h".
7576         (vexplain_no_incremental): New function.
7577         (explain_no_incremental): New function.
7578         (Incremental_binary::error): New method.
7579         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7580         method.
7581         (make_sized_incremental_binary): New function.
7582         (open_incremental_binary): New function.
7583         (can_incrementally_link_file): Add checks if output is ELF and has
7584         inputs section.
7585         * incremental.h: Include "elfcpp_file.h" and "output.h".
7586         (Incremental_binary): New class.
7587         (Sized_incremental_binary): New class.
7588         (open_incremental_binary): Declare.
7589         * object.cc (is_elf_object): Use
7590         elfcpp::Elf_recognizer::is_elf_file.
7591         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7592         * output.h (Output_file::filesize): New method.
7593
7594 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7595
7596         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7597         New function.
7598         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7599         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7600         function.
7601         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7602         function.
7603         (Arm_relocate_functions::movw_abs_nc): New function.
7604         (Arm_relocate_functions::movt_abs): New function.
7605         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7606         (Arm_relocate_functions::thm_movt_abs): New function.
7607         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7608         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7609         (Scan::global): Likewise.
7610         (Relocate::relocate): Likewise.
7611         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7612
7613 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7614
7615         * arm.cc (Arm_relocate_functions::got_prel) New function.
7616         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7617         (Relocate::relocate): Likewise.
7618         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7619
7620 2009-10-06  Ian Lance Taylor  <iant@google.com>
7621
7622         * options.h (class General_options): Define
7623         split_stack_adjust_size parameter.
7624         * object.h (class Object): Add uses_split_stack_ and
7625         has_no_split_stack_ fields.  Add uses_split_stack and
7626         has_no_split_stack accessor functions.  Declare
7627         handle_split_stack_section.
7628         (class Reloc_symbol_changes): Define.
7629         (class Sized_relobj): Define Function_offsets.  Declare
7630         split_stack_adjust, split_stack_adjust_reltype, and
7631         find_functions.
7632         * object.cc (Object::handle_split_stack_section): New function.
7633         (Sized_relobj::do_layout): Call handle_split_stack_section.
7634         * dynobj.cc (Sized_dynobj::do_layout): Call
7635         handle_split_stack_section.
7636         * reloc.cc (Sized_relobj::relocate_sections): Call
7637         split_stack_adjust for executable sections in split_stack
7638         objects.  Pass reloc_map to relocate_section.
7639         (Sized_relobj::split_stack_adjust): New function.
7640         (Sized_relobj::split_stack_adjust_reltype): New function.
7641         (Sized_relobj::find_functions): New function.
7642         * target-reloc.h: Include "object.h".
7643         (relocate_section): Add reloc_symbol_changes parameter.  Change
7644         all callers.
7645         * target.h (class Target): Add calls_non_split method.  Declare
7646         do_calls_non_split virtual method.  Declare match_view and
7647         set_view_to_nop.
7648         * target.cc: Include "elfcpp.h".
7649         (Target::do_calls_non_split): New function.
7650         (Target::match_view): New function.
7651         (Target::set_view_to_nop): New function.
7652         * gold.cc (queue_middle_tasks): Give an error if mixing
7653         split-stack and non-split-stack objects with -r.
7654         * i386.cc (Target_i386::relocate_section): Add
7655         reloc_symbol_changes parameter.
7656         (Target_i386::do_calls_non_split): New function.
7657         * x86_64.cc (Target_x86_64::relocate_section): Add
7658         reloc_symbol_changes parameter.
7659         (Target_x86_64::do_calls_non_split): New function.
7660         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7661         parameter.
7662         * powerpc.cc (Target_powerpc::relocate_section): Add
7663         reloc_symbol_changes parameter.
7664         * sparc.cc (Target_sparc::relocate_section): Add
7665         reloc_symbol_changes parameter.
7666         * configure.ac: Call AM_CONDITIONAL for the default target.
7667         * configure: Rebuild.
7668         * testsuite/Makefile.am (TEST_AS): New variable.
7669         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7670         (check_DATA): Add split_i386 and split_x86_64 files.
7671         (SPLIT_DEFSYMS): Define.
7672         (split_i386_[1234n].o): New targets.
7673         (split_i386_[124]): New targets.
7674         (split_i386_[1234r].stdout): New targets.
7675         (split_x86_64_[1234n].o): New targets.
7676         (split_x86_64_[124]): New targets.
7677         (split_x86_64_[1234r].stdout): New targets.
7678         (MOSTLYCLEANFILES): Add new executables.
7679         * testsuite/split_i386.sh: New file.
7680         * testsuite/split_x86_64.sh: New file.
7681         * testsuite/split_i386_1.s: New file.
7682         * testsuite/split_i386_2.s: New file.
7683         * testsuite/split_i386_3.s: New file.
7684         * testsuite/split_i386_4.s: New file.
7685         * testsuite/split_i386_n.s: New file.
7686         * testsuite/split_x86_64_1.s: New file.
7687         * testsuite/split_x86_64_2.s: New file.
7688         * testsuite/split_x86_64_3.s: New file.
7689         * testsuite/split_x86_64_4.s: New file.
7690         * testsuite/split_x86_64_n.s: New file.
7691         * testsuite/testfile.cc (Target_test): Update relocation_section
7692         function.
7693         * testsuite/Makefile.in: Rebuild.
7694
7695 2009-10-06  Ian Lance Taylor  <iant@google.com>
7696
7697         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7698         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7699         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7700         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7701         the address on ldo_addrs_.
7702         (Target_i386::Relocate::fix_up_ldo): New function.
7703
7704 2009-10-06   Rafael Espindola  <espindola@google.com>
7705
7706         * plugin.cc (add_input_library): New.
7707         (Plugin::load): Add add_input_library to tv.
7708         (Plugin_manager::add_input_file): Add the is_lib argument.
7709         (add_input_file): Update call to Plugin_manager::add_input_file.
7710         (add_input_library): New.
7711         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7712
7713 2009-09-30  Doug Kwan  <dougkwan@google.com>
7714
7715         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7716         symbol and call Symbol::may_need_copy_reloc to determine if
7717         a copy reloc is needed.
7718         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7719         nocopyreloc is given in command line.
7720         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7721         given in command line.
7722         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7723         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7724         of the removed Target_i386::may_need_copy_reloc.
7725         * options.h (copyreloc): New option with default value false.
7726         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7727         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7728         instead of the removed Target_powerpc::may_need_copy_reloc.
7729         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7730         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7731         instead of the removed Target_sparc::may_need_copy_reloc.
7732         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7733         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7734         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7735         instead of the removed Target_x86_64::may_need_copy_reloc.
7736
7737 2009-09-30  Ian Lance Taylor  <iant@google.com>
7738
7739         * object.h (class Object): Remove target_ field, and target,
7740         sized_target, and set_target methods.
7741         (Object::sized_target): Remove.
7742         (class Sized_relobj): Update declarations.  Remove sized_target.
7743         * object.cc (Sized_relobj::setup): Remove target parameter.
7744         Change all callers.
7745         (Input_objects::add_object): Don't do anything with the target.
7746         (make_elf_sized_object): Add punconfigured parameter.  Change all
7747         callers.  Set or test parameter target.
7748         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7749         Change all callers.
7750         * parameters.cc (Parameters::set_target): Change parameter type to
7751         be non-const.
7752         (Parameters::default_target): Remove.
7753         (set_parameters_target): Change parameter type to be non-const.
7754         (parameters_force_valid_target): New function.
7755         (parameters_clear_target): New function.
7756         * parameters.h (class Parameters): Update declarations.  Remove
7757         default_target method.  Add sized_target and clear_target
7758         methods.  Change target_ to be non-const.
7759         (set_parameters_target): Update declaration.
7760         (parameters_force_valid_target): Declare.
7761         (parameters_clear_target): Declare.
7762         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7763         as NULL if we aren't searching.
7764         (Add_symbols::run): Don't check for compatible target.
7765         * fileread.cc (Input_file::open_binary): Call
7766         parameters_force_valid_target.
7767         * gold.cc (queue_middle_tasks): Likewise.
7768         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7769         set_target on object.
7770         * dynobj.h (class Sized_dynobj): Update declarations.
7771         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7772         make_elf_object returns NULL.
7773         (Archive::include_member): Don't check whether object target is
7774         compatible.
7775         * output.cc (Output_section::add_input_section): Get target from
7776         parameters.
7777         (Output_section::relax_input_section): Likewise.
7778         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7779         parameters.
7780         (Sized_relobj::do_scan_relocs): Likewise.
7781         (Sized_relobj::relocate_sections): Likewise.
7782         * resolve.cc (Symbol_table::resolve): Likewise.
7783         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7784         parameter.  Change all callers.
7785         (Symbol_table::add_from_object): Get target from parameters.
7786         (Symbol_table::add_from_relobj): Don't check object target.
7787         (Symbol_table::add_from_dynobj): Likewise.
7788         (Symbol_table::define_special_symbol): Get target from
7789         parameters.
7790         * symtab.h (class Symbol_table): Update declaration.
7791         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7792         parameter.  Change all callers.  Clear parameter target.
7793         (Binary_test): Test target here.
7794         * testsuite/object_unittest.cc (gold_testsuite): Remove
7795         target_test_pointer parameter.  Change all callers.
7796         (Object_test): Test target here.
7797
7798 2009-09-26  Ian Lance Taylor  <iant@google.com>
7799
7800         * testsuite/initpri1.c: Don't try to use constructor priorities if
7801         compiling with gcc before 4.3.
7802
7803 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7804
7805         * testsuite/retain_symbols_file_test.sh (check_present): Change
7806         output file name to retain_symbols_file_test.stdout.
7807         (check_absent): Likewise.
7808
7809 2009-09-18  Craig Silverstein  <csilvers@google.com>
7810
7811         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7812         * options.cc: Include <cerrno> and <fstream>.
7813         (General_options::finalize): Parse -retain-symbols-file tag.
7814         * options.h: New flag.
7815         (General_options): New method should_retain_symbol, new
7816         variable symbols_to_retain.
7817         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7818         should_retain_symbol map.
7819         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7820         * testsuite/Makefile.in: Regenerate.
7821         * testsuite/retain_symbols_file_test.sh: New file.
7822
7823 2009-09-18  Nick Clifton  <nickc@redhat.com>
7824
7825         * po/es.po: Updated Spanish translation.
7826
7827 2009-09-17  Doug Kwan  <dougkwan@google.com>
7828
7829         * debug.h (DEBUG_RELAXATION): New constant.
7830         (DEBUG_ALL): Add DEBUG_RELAXATION.
7831         (debug_string_to_enum): Add relaxation debug option.
7832         * layout.cc
7833         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7834         Layout::Relaxation_debug_check::read_sections,
7835         Layout::Relaxation_debug_check::read_sections): New method definitions.
7836         (Layout::Layout): Initialize data members
7837         record_output_section_data_from_scrips_,
7838         script_output_section_data_list_ and relaxation_debug_check_.
7839         (Layout::save_segments, Layout::restore_segments,
7840         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7841         Layout::relaxation_loop_body): New method definitions.
7842         (Layout::finalize): Support relaxation.  Move section layout code to
7843         Layout::relaxation_loop_body.
7844         (Layout::set_asection_address_from_script): Move code for orphan
7845         section placement out.
7846         (Layout::place_orphan_sections_in_script): New method definition.
7847         * layout.h (Output_segment_headers, Output_file_header):
7848         New forward class declarations.
7849         (Layout::~Layout): Define.
7850         (Layout::new_output_section_data_from_script): New method definition.
7851         (Layout::place_orphan_sections_in_script): New method declaration.
7852         (Layout::Segment_states): New type declaration.
7853         (Layout::save_segments, Layout::restore_segments,
7854         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7855         Layout::relaxation_loop_body): New method declarations.
7856         (Layout::Output_section_data_list): New type declaration.
7857         (Layout::Relaxation_debug_check): New class definition.
7858         (Layout::record_output_section_data_from_script_,
7859         Layout::script_output_section_data_list_, Layout::segment_states_,
7860         Layout::relaxation_debug_check_): New data members.
7861         * output.cc: (Output_section_headers::do_size): New method definition.
7862         (Output_section_headers::Output_section_headers): Move size
7863         computation to Output_section_headers::do_size.
7864         (Output_segment_headers::do_size): New method definition.
7865         (Output_file_header::Output_file_header): Move size computation to
7866         Output_file_header::do_size and call it.
7867         (Output_file_header::do_size): New method definition.
7868         (Output_data_group::Output_data_group): Adjust call to
7869         Output_section_data.
7870         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7871         (Output_symtab_xindex::do_write): Add array bound check.
7872         (Output_section::Input_section::print_to_mapfile): Handle
7873         RELAXED_INPUT_SECTION_CODE.
7874         (Output_section::Output_section): Initialize data member checkpoint_.
7875         (Output_section::~Output_section): Delete checkpoint object pointed
7876         by checkpoint_.
7877         (Output_section::add_input_section): Always add an Input_section if
7878         relaxing.
7879         (Output_section::add_merge_input_section): Add assert.
7880         (Output_section::relax_input_section): New method definition.
7881         (Output_section::set_final_data_size): Set load address to zero for
7882         an unallocated section.
7883         (Output_section::do_address_and_file_offset_have_reset_values):
7884         New method definition.
7885         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7886         Handle relaxed input section.
7887         (Output_section::sort_attached_input_sections): Checkpoint input
7888         section list lazily.
7889         (Output_section::get_input_sections): Change type of input_sections to
7890         list of Simple_input_section pointers.  Checkpoint input section list
7891         lazily.  Also handle relaxed input sections.
7892         (Output_section::add_input_section_for_script): Take a reference to
7893         a Simple_input_section object instead of Relobj pointer and section
7894         index as parameter.  Handle relaxed input sections.
7895         (Output_section::save_states, Output_section::restore_states): New
7896         method definitions.
7897         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7898         (Output_data::is_data_size_fixed): New method definition.
7899         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7900         if it is fixed.
7901         (Output_data::address_and_file_offset_have_reset_values): New method
7902         definition.
7903         (Output_data::do_address_and_file_offset_have_reset_values): New method
7904         definition.
7905         (Output_data::set_data_size): Check that data size is not fixed.
7906         (Output_data::fix_data_size): New method definition.
7907         (Output_data::is_data_size_fixed_): New data member.
7908         (Output_section_headers::set_final_data_size): New method definition.
7909         (Output_section_headers::do_size): New method declaration.
7910         (Output_segment_headers::set_final_data_size): New method definition.
7911         (Output_segment_headers::do_size): New method declaration.
7912         (Output_file_header::set_final_data_size)::New method definition.
7913         (Output_file_header::do_size)::New method declaration.
7914         (Output_section_data::Output_section_data): Add new parameter
7915         is_data_size_fixed and use it to fix data size.
7916         (Output_data_const::Output_data_const): Adjust call to base class
7917         constructor and fix data size.
7918         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7919         base class constructor and fix data size.
7920         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7921         base class constructor and fix data size.
7922         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7923         class constructor and fix data size.
7924         (Output_data_group::set_final_data_size): New method definition.
7925         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7926         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7927         class constructor and fix data size.
7928         (Output_relaxed_input_section): New class definition.
7929         (Output_section::Simple_input_section): New class definition.
7930         (Output_section::get_input_sections): Adjust parameter list.
7931         (Output_section::add_input_section_for_script): Same.
7932         (Output_section::save_states, Output_section::restore_states,
7933         Output_section::do_address_and_file_offset_have_reset_values,
7934         (Output_section::Input_section::Input_section): Handle
7935         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7936         Output_relaxed_input_section.
7937         (Output_section::Input_section::is_input_section,
7938         Output_section::Input_section::set_output_section): Handle relaxed
7939         input section.
7940         (Output_section::Input_section::is_relaxed_input_section,
7941         Output_section::Input_section::output_section_data,
7942         Output_section::Input_section::relaxed_input_section): New method
7943         definitions.
7944         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7945         value.
7946         (Output_section::Input_section::u1_): Update comments.
7947         (Output_section::Input_section::u2_): Add new union member poris.
7948         (Output_section::Checkpoint_output_section): New classs definition.
7949         (Output_section::relax_input_section): New method declaration.
7950         (Output_section::checkpoint_): New data member.
7951         (Output_segment): Update comments.
7952         (Output_segment::Output_segment): Un-privatize copy constructor.
7953         (Output_segment::operator=): Un-privatize.
7954         * script-sections.cc (Output_section_element::Input_section_list):
7955         Change element type to Output_section::Simple_input_section.
7956         (Output_section_element_dot_assignment::set_section_addresses):
7957         Register output section data for relaxation clean up.
7958         (Output_data_exression::Output_data_expression): Adjust call to base
7959         constructor to fix data size.
7960         (Output_section_element_data::set_section_addresses): Register
7961         Output_data_expression object for relaxation clean up.
7962         (struct Input_section_info): Replace Relobj pointer and section index
7963         pair with Output_section::Simple_input_section and Convert struct to a
7964         class.
7965         (Input_section_sorter::operator()): Adjust access to
7966         Input_section_info data member to use accessors.
7967         (Output_section_element_input::set_section_addresses): Use layout
7968         parameter.  Adjust code to use Output_section::Simple_input_section
7969         and Input_secction_info classes.  Register filler for relaxation
7970         clean up.
7971         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7972         and section index pair with Output_section::Simple_input_section
7973         class.  Adjust code accordingly.
7974         (Phdrs_element::release_segment): New method definition.
7975         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7976         segment list.
7977         (Script_sections::release_segments): New method definition.
7978         * gold/script-sections.h (Script_sections::release_segments): New
7979         method declaration.
7980         * gold/target.h (Target::may_relax, Target::relax,
7981         Target::do_may_relax, Target::do_relax): New method definitions.
7982
7983 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7984
7985         * arm.cc (has_signed_unsigned_overflow): New function.
7986         (Arm_relocate_functions::abs8): New function.
7987         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7988         (Target_arm::Scan::global): Likewise.
7989         (Target_arm::relocate::relocate): Likewise.
7990         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7991         Likewise.
7992
7993 2009-09-16  Cary Coutant  <ccoutant@google.com>
7994
7995         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7996         * testsuite/Makefile.in: Regenerate.
7997
7998 2009-09-11  Nick Clifton  <nickc@redhat.com>
7999
8000         * po/gold.pot: Updated by the Translation project.
8001
8002 2009-09-08  Cary Coutant  <ccoutant@google.com>
8003
8004         * output.cc (Output_file::open): Add execute permission to empty file.
8005         * testsuite/Makefile.am (permission_test): New test.
8006         * testsuite/Makefile.in: Regenerate.
8007
8008 2009-09-02  Ian Lance Taylor  <iant@google.com>
8009
8010         * output.cc (Output_file::resize): Call map_no_anonymous rather
8011         than map.
8012
8013 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8014
8015         * gold.cc: Include "incremental.h".
8016         (queue_initial_tasks): Call Incremental_checker methods.
8017         * incremental.cc: Include "output.h".
8018         (Incremental_checker::can_incrementally_link_output_file): New
8019         method.
8020         * incremental.h (Incremental_checker): New class.
8021
8022         * output.cc (Output_file::open_for_modification): New method.
8023         (Output_file::map_anonymous): Changed return type to bool.  Record
8024         map in base_ field.
8025         (Output_file::map_no_anonymous): New method, broken out of map.
8026         (Output_file::map): Use map_no_anonymous and map_anonymous.
8027         * output.h (class Output_file): Update declarations.
8028
8029 2009-08-24  Cary Coutant  <ccoutant@google.com>
8030
8031         * options.h (Command_line::Pre_options): New class.
8032         (Command_line::pre_options): New member.
8033         * options.cc (gold::options::ready_to_register): New variable.
8034         (One_option::register_option): Do nothing if not registering options.
8035         Assert if same short option registered twice.
8036         (General_options::General_options): Turn off option registration when
8037         done constructing.
8038         (Command_line::Pre_options::Pre_options): New constructor.
8039
8040 2009-08-24  Cary Coutant  <ccoutant@google.com>
8041
8042         * options.h (General_options::no_keep_memory): Remove incorrect
8043         short option.
8044
8045 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8046
8047         * Makefile.am (am__skiplex, am__skipyacc): New.
8048         * Makefile.in: Regenerate.
8049
8050 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8051
8052         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8053         (INCLUDES): ... this.
8054         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8055         (AM_CPPFLAGS): Renamed from ...
8056         (INCLUDE): ... this.
8057         * Makefile.in, testsuite/Makefile.in: Regenerate.
8058
8059         * Makefile.in: Regenerate.
8060         * aclocal.m4: Likewise.
8061         * config.in: Likewise.
8062         * configure: Likewise.
8063         * testsuite/Makefile.in: Likewise.
8064
8065         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8066         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8067         * Makefile.in: Regenerate.
8068         * testsuite/Makefile.in: Regenerate.
8069
8070 2009-08-19  Cary Coutant  <ccoutant@google.com>
8071
8072         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8073         symbols in shared libraries overridden by hidden or internal symbols
8074         in the main program.
8075
8076 2009-08-19  Chris Demetriou  <cgd@google.com>
8077
8078         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8079         checking source file names in error messages.
8080
8081 2009-08-18  Doug Kwan  <dougkwan@google.com>
8082
8083         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8084         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8085         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8086         an elfcpp::Ehdr as parameter.
8087         * object.cc (Object::set_target): Remove the version that looks up
8088         a target and sets it.
8089         (Sized_relobj::setup): Take a Target object instead of
8090         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8091         (make_elf_sized_object): Find target and ask target to
8092         make an ELF object.
8093         * object.h: (Object::set_target): Remove the version that looks up
8094         a target and sets it.
8095         (Sized_relobj::setup): Take a Target object instead of
8096         an elfcpp:Ehdr as parameter.
8097         * target.cc: Include dynobj.h.
8098         (Target::do_make_elf_object_implementation): New.
8099         (Target::do_make_elf_object): New.
8100         * target.h (Target::make_elf_object): New template declaration.
8101         (Target::do_make_elf_object): New method declarations.
8102         (Target::do_make_elf_object_implementation): New template declaration.
8103
8104 2009-08-14  Ian Lance Taylor  <iant@google.com>
8105
8106         * gold.h (FUNCTION_NAME): Define.
8107         (gold_unreachable): Use FUNCTION_NAME.
8108
8109 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8110
8111         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8112         symbol in the --keep-unique list is not found.
8113
8114 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8115
8116         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8117         been maked as --keep-unique.
8118         (Icf::unfold_section): New function.
8119         * icf.h (Icf::unfold_section): New function.
8120         * options.h (General_options::keep_unique): New option.
8121         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8122         * testsuite/Makefile.in: Regenerate.
8123         * testsuite/icf_keep_unique_test.sh: New file.
8124         * testsuite/icf_keep_unique_test.cc: New file.
8125
8126 2009-08-12  Cary Coutant  <ccoutant@google.com>
8127
8128         PR 10471
8129         * resolve.cc (Symbol_table::resolve): Check for references from
8130         dynamic objects to hidden and internal symbols.
8131         * testsuite/Makefile.am (hidden_test.sh): New test.
8132         * testsuite/Makefile.in: Regenerate.
8133         * testsuite/hidden_test.sh: New script.
8134         * testsuite/hidden_test_1.c: New test source.
8135         * testsuite/hidden_test_main.c: New test source.
8136
8137 2009-08-11  Doug Kwan  <dougkwan@google.com>
8138
8139         * arm.cc: Update comments.
8140         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8141         segment to locate the .ARM.exidx section if present.
8142
8143 2009-08-09  Doug Kwan  <dougkwan@google.com>
8144
8145         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8146         patch.
8147
8148 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8149         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8150         compiler warnings.
8151
8152 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8153
8154         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8155         valid tls_segment only for non-debug-section relocations.
8156         * testsuite/Makefile.am: Add gc_tls_test.
8157         * testsuite/Makefile.in: Regenerate.
8158         * testsuite/gc_tls_test.cc: New file.
8159         * testsuite/gc_tls_test.sh: New file.
8160
8161 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8162
8163         * icf.cc: New file.
8164         * icf.h: New file.
8165         * Makefile.am (CCFILES): Add icf.cc.
8166         (HFILES): Add icf.h
8167         * Makefile.in: Regenerate.
8168         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8169         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8170         section, symbol and addend information for the relocs.
8171         * gold.cc (queue_middle_tasks): Call identical code folding.
8172         * gold.h: Add defines for multimap.
8173         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8174         to the call of finalize_local_symbols.
8175         * main.cc (main): Create object of class Icf.
8176         * object.cc (Sized_relobj::do_layout): Allow this function to be
8177         called twice during icf.
8178         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8179         to sections marked as identical by icf.
8180         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8181         when available.
8182         (Sized_relobj::do_section_entsize): New function.
8183         * object.h (Object::section_entsize): New function.
8184         (Object::do_section_entsize): New pure virtual function.
8185         (Relobj::finalize_local_symbols): Add new parameter.
8186         (Relobj::do_section_entsize): New function.
8187         * options.h (General_options::icf): New option.
8188         (General_options::icf_iterations): New option.
8189         (General_options::print_icf_sections): New option.
8190         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8191         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8192         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8193         icf.
8194         * symtab.cc (Symbol_table::is_section_folded): New function.
8195         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8196         to sections marked as identical by icf.
8197         * symtab.h (Symbol_table::set_icf): New function.
8198         (Symbol_table::icf): New function.
8199         (Symbol_table::is_section_folded): New function.
8200         (Symbol_table::icf_): New data member.
8201         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8202         * testsuite/Makefile.am: Add commands to build icf_test.
8203         * testsuite/Makefile.in: Regenerate.
8204         * testsuite/icf_test.sh: New file.
8205         * testsuite/icf_test.cc: New file.
8206
8207 2009-07-24  Chris Demetriou  <cgd@google.com>
8208
8209         * layout.cc (is_compressible_debug_section): Fix incorrect
8210         comment about compressed section names.
8211
8212 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8213
8214         PR 10419
8215         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8216
8217 2009-07-16  Ian Lance Taylor  <iant@google.com>
8218
8219         PR 10400
8220         * layout.h: #include <map>.
8221         (class Kept_section): Change from struct to class.  Add accessors
8222         and setters.  Add section size to Comdat_group mapping.  Change
8223         Comdat_group to std::map.  Add is_comdat_ field.  Add
8224         linkonce_size field in union.
8225         (class Layout): Update declaration of find_or_add_kept_section.
8226         Don't declare find_kept_object.
8227         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8228         parameter.  Add object, shndx, is_comdat, and is_group_name
8229         parameters.  Change all callers.  Adjust for new Kept_section.
8230         (Layout::find_kept_object): Remove.
8231         * object.cc (Sized_relobj::include_section_group): Update use of
8232         Kept_section.  Rename secnum to shndx.  Only record
8233         Kept_comdat_section if sections are the same size.
8234         (Sized_relobj::include_linkonce_section): Update use of
8235         Kept_section.  Only record Kept_comdat_section if sections are the
8236         same size.  Set size of linkonce section.
8237         (Sized_relobj::map_to_kept_section): Update call to
8238         get_kept_comdat_section.
8239         * object.h (class Sized_relobj): Rename fields in
8240         Kept_comdat_section to drop trailing underscores; change object
8241         field to Relobj*.  Change Kept_comdat_section_table to store
8242         struct rather than pointer.
8243         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8244         Add kept_object and kept_shndx parameters.  Change all callers.
8245         (Sized_relobj::get_kept_comdat_section): Change return type to
8246         bool.  Add kept_object and kept_shndx parameters.  Change all
8247         callers.
8248         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8249         Layout::find_or_add_kept_section.
8250
8251 2009-07-09  Ian Lance Taylor  <iant@google.com>
8252
8253         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8254         Reserve space in the hash table.
8255
8256 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8257
8258         * fileread.cc (File_read::get_mtime): New method.
8259         * fileread.h (Timespec): New structure.
8260         (File_read::get_mtime): New method.
8261         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8262         Renamed from timestamp_nsec.
8263         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8264         Elf_Xword.
8265         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8266         timestamp_nsec.
8267         (Incremental_inputs::report_archive): Save mtime; style fix.
8268         (Incremental_inputs::report_obejct): Save mtime; style fix.
8269         (Incremental_inputs::report_script): Save mtime; style fix.
8270         (Incremental_inputs::finalize_inputs): Style fix.
8271         (Incremental_inputs::finalize): Style fix.
8272         (Incremental_inputs::create_input_section_data): Store inputs
8273         mtime.
8274         * incremental.h (Incremental_inputs::report_script): Add mtime
8275         argument.
8276         (Incremental_inputs::Input_info::Input_info): Intialize only one
8277         union member.
8278         (Incremental_inputs::Input_info::archive): Move to nameless
8279         union.
8280         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8281         (Incremental_inputs::Input_info::script): Move to nameless union.
8282         (Incremental_inputs::mtime): New field.
8283         * script.cc (read_input_script): Pass file mtime to
8284         Incremental_input.
8285         * script.h (Script_info::inputs): Style fix.
8286
8287 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8288
8289         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8290         instead of 32.
8291
8292 2009-06-24  Ian Lance Taylor  <iant@google.com>
8293
8294         PR 10156
8295         * layout.cc (Layout::choose_output_section): If we find an
8296         existing section, update the flags.
8297         (Layout::create_notes): New function, broken out of
8298         Layout::finalize.
8299         (Layout::finalize): Don't create note sections.
8300         (Layout::create_note): Don't crash if linker script discards
8301         section.
8302         (Layout::create_gold_note): Likewise.
8303         (Layout::create_build_id): Likewise.  Don't set
8304         after_input_sections on the section.
8305         (Layout::create_executable_stack_info): Remove target parameter.
8306         Change caller.
8307         * layout.h (class Layout): Declare create_notes.  Update
8308         declaration of create_executable_stack_info.
8309         * gold.cc (queue_middle_tasks): Call create_notes.
8310         * output.cc (Output_section::update_flags_for_input_section): Move
8311         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8312         invalid.
8313         * output.h (Output_data::mark_address_invalid): New function.
8314         (class Output_section): Only declare, not define,
8315         update_flags_for_input_section.  Remove set_flags.
8316
8317 2009-06-24  Ian Lance Taylor  <iant@google.com>
8318
8319         * script-sections.cc (Output_section_definition::
8320         set_section_addresses): Rename shadowing local load_address to
8321         laddr.
8322
8323 2009-06-24  Ian Lance Taylor  <iant@google.com>
8324
8325         PR 10244
8326         * reloc.cc (relocate_sections): Skip empty relocation sections.
8327
8328 2009-06-23  Ian Lance Taylor  <iant@google.com>
8329
8330         PR 10156
8331         * layout.cc (Layout::create_note): Use choose_output_section
8332         rather than make_output_section.
8333
8334 2009-06-23  Ian Lance Taylor  <iant@google.com>
8335
8336         PR 10237
8337         * options.cc (General_options::parse_V): Set printed_version_.
8338         (General_options::General_options): Initialize printed_version_.
8339         * options.h (class General_options): Add printed_version_ field.
8340         * gold.cc (queue_initial_tasks): If there are no input files,
8341         don't give a fatal error if we printed the version information.
8342         (queue_middle_tasks): If using -r with a shared object, give a
8343         fatal error rather than an ordinary error.
8344
8345 2009-06-23  Ian Lance Taylor  <iant@google.com>
8346
8347         PR 10219
8348         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8349         (Layout::make_output_section): Set have_stabstr_section_ if we see
8350         a .stab*str section.
8351         (Layout::finalize): Call link_stabs_sections.
8352         (Layout::link_stabs_sections): New file.
8353         * layout.h (class Layout): Add have_stabstr_section_ field.
8354         Declare link_stabs_sections.
8355
8356 2009-06-23  Doug Kwan  <dougkwan@google.com>
8357
8358         * Makefile.am (libgold_a_LIBADD): New.
8359         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8360         * Makefile.in: Regenerate.
8361         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8362         * configure: Regenerate.
8363         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8364         * fileread.cc: Include sys/state.h
8365         * gold.h: Declare memmem and strndup if found missing.
8366         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8367
8368 2009-06-23  Ian Lance Taylor  <iant@google.com>
8369
8370         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8371         * configure: Rebuild.
8372
8373 2009-06-23  Ian Lance Taylor  <iant@google.com>
8374
8375         PR 10147
8376         * object.cc (Object::section_contents): Don't try to get a view if
8377         the section has length zero.
8378         (Object::handle_gnu_warning_section): If the section is empty, use
8379         the name of the section as the warning.
8380
8381 2009-06-23  Ian Lance Taylor  <iant@google.com>
8382
8383         PR 10133
8384         * stringpool.h (class Stringpool_template): Add optimize_ field.
8385         (Stringpool_template::set_optimize): New function.
8386         * stringpool.cc (Stringpool_template::Stringpool_template):
8387         Initialize optimize_ field.
8388         (Stringpool_template::set_string_offsets): Test local optimize
8389         fild rather than parameter.
8390         * layout.cc (Layout::Layout): Call set_optimize on the section
8391         name stringpool.
8392
8393 2009-06-22  Ian Lance Taylor  <iant@google.com>
8394
8395         PR 10030
8396         * yyscript.y: Parse TARGET.
8397         * script.cc (script_set_target): New function.
8398         * script-c.h (script_set_target): Declare.
8399         * options.cc (General_options::string_to_object_format): Rename
8400         from string_to_object_format in anonymous namespace.  Change
8401         callers.
8402         * options.h (class General_options): Declare
8403         string_to_object_format.
8404
8405 2009-06-22  Ian Lance Taylor  <iant@google.com>
8406
8407         * script-sections.cc (Script_sections::create_segments): Don't put
8408         program headers in a PT_LOAD segment if -n or -N.
8409
8410 2009-06-22  Ian Lance Taylor  <iant@google.com>
8411
8412         PR 10141
8413         * options.h (class General_options): Add -z lazy and -z now.  Sort
8414         -z options into alphabetical order.
8415         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8416
8417 2009-06-21  Ian Lance Taylor  <iant@google.com>
8418
8419         * layout.cc (Layout::make_output_section): Call
8420         Target::new_output_section.
8421         (Layout::attach_allocated_section_to_segment): Put large section
8422         sections in a separate load segment with the large segment flag
8423         set.
8424         (Layout::segment_precedes): Sort large data segments after other
8425         load segments.
8426         (align_file_offset): New static function.
8427         (Layout::set_segment_offsets): Use align_file_offset.
8428         * output.h (class Output_section): Add is_small_section_ and
8429         is_large_section_ fields.
8430         (Output_section::is_small_section): New function.
8431         (Output_section::set_is_small_section):  New function.
8432         (Output_section::is_large_section): New function.
8433         (Output_section::set_is_large_section): New function.
8434         (Output_section::is_large_data_section): New function.
8435         (class Output_segment): Add is_large_data_segment_ field.
8436         (Output_segment::is_large_data_segment): New function.
8437         (Output_segment::set_is_large_data_segment): New function.
8438         * output.cc (Output_section::Output_section): Initialize new
8439         fields.
8440         (Output_segment::Output_segment): Likewise.
8441         (Output_segment::add_output_section): Add assertion that large
8442         data sections always go in large data segments.  Force small data
8443         sections to the end of the list of data sections.  Force small BSS
8444         sections to the start of the list of BSS sections.  For large BSS
8445         sections to the end of the list of BSS sections.
8446         * symtab.h (class Symbol): Declare is_common_shndx.
8447         (Symbol::is_defined): Check Symbol::is_common_shndx.
8448         (Symbol::is_common): Likewise.
8449         (class Symbol_table): Define enum Commons_section_type.  Update
8450         declarations.  Add small_commons_ and large_commons_ fields.
8451         * symtab.cc (Symbol::is_common_shndx): New function.
8452         (Symbol_table::Symbol_table): Initialize new fields.
8453         (Symbol_table::add_from_object): Put small and large common
8454         symbols in the right list.
8455         (Symbol_table::sized_finalized_symbol): Check
8456         Symbol::is_common_shndx.
8457         (Symbol_table::sized_write_globals): Likewise.
8458         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8459         common symbol lists.  Don't call do_allocate_commons_list if the
8460         list is empty.
8461         (Symbol_table::do_allocate_commons_list): Remove is_tls
8462         parameter.  Add comons_section_type parameter.  Change all
8463         callers.  Handle small and large common symbols.
8464         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8465         Symbol::is_common_shndx.
8466         * resolve.cc (symbol_to_bits): Likewise.
8467         * target.h (Target::small_common_shndx): New function.
8468         (Target::small_common_section_flags): New function.
8469         (Target::large_common_shndx): New function.
8470         (Target::large_common_section_flags): New function.
8471         (Target::new_output_section): New function.
8472         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8473         small_common_section_flags, and large_common_section_flags
8474         fields.
8475         (Target::do_new_output_section): New virtual function.
8476         * arm.cc (Target_arm::arm_info): Initialize new fields.
8477         * i386.cc (Target_i386::i386_info): Likewise.
8478         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8479         Likewise.
8480         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8481         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8482         (Target_x86_64::do_new_output_section): New function.
8483         * configure.ac: Define conditional MCMODEL_MEDIUM.
8484         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8485         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8486         (large_LDFLAGS): Define.
8487         * testsuite/large.c: New file.
8488         * testsuite/testfile.cc (Target_test::test_target_info):
8489         Initialize new fields.
8490         * configure, testsuite/Makefile.in: Rebuild.
8491
8492 2009-06-05  Doug Kwan  <dougkwan@google.com>
8493
8494         * Makefile.am (CCFILES): Add target.cc.
8495         * Makefile.in: Regenerate.
8496         * i386.cc (class Target_i386): Define new virtual method to
8497         override do_is_local_label_name in parent.
8498         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8499         local symbols if --discard-locals or -X is given.
8500         * options.h (class General_options): Declare new options
8501         '--discard-locals' and '-X' for discarding locals.
8502         * target.h (class Target): Define new methods is_local_label_name.
8503         Declare new virtual method do_is_local_label_name.
8504         * target.cc: New file.
8505         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8506         (check_SCRIPTS): Add discard_locals_test.sh.
8507         (check_DATA): Add discard_local_tests.syms.
8508         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8509         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8510         * testsuite/Makefile.in: Regenerate.
8511         * testsuite/discard_locals_test.c: New file.
8512         * testsuite/discard_locals_test.sh: Same.
8513
8514 2009-06-05  Doug Kwan  <dougkwan@google.com>
8515
8516         * object.cc (Sized_relobj::Sized_relobj): Initialize
8517         discarded_eh_frame_shndx_ to -1U.
8518         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8519         section.
8520         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8521         a discarded .eh_frame section.
8522         (Sized_relobj::do_finalize_local_symbols): Ditto.
8523         * object.h (class Sized_relobj): Declare new member
8524         discarded_eh_frame_shndx_.
8525         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8526         (local_labels_test.o, local_labels_test): New rules.
8527         * testsuite/Makefile.in: Regenerate.
8528
8529 2009-06-04  Doug Kwan  <dougkwan@google.com>
8530
8531         * layout.cc (Layout::section_name_mapping): Add mapping for
8532         special ARM sections.
8533
8534 2009-06-03  Doug Kwan  <dougkwan@google.com>
8535
8536         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8537         (utils::has_overflow): Same.
8538
8539 2009-06-03  Ian Lance Taylor  <iant@google.com>
8540
8541         * layout.cc (Layout::section_name_mapping): New array, replacing
8542         Layout::linkonce_mapping.
8543         (Layout::section_name_mapping_count): New variable, replacing
8544         Layout::linkonce_mapping_count.
8545         (Layout::linkonce_output_name): Remove.
8546         (Layout::output_section_name): Rewrite.
8547         * layout.h (class Layout): Rename Linkonce_mapping to
8548         Section_name_mapping, linkonce_mapping to section_name_mapping,
8549         linkonce_mapping_count to section_name_mapping_count.  Don't
8550         declare linkonce_output_name.
8551
8552 2009-06-03  Doug Kwan  <dougkwan@google.com>
8553
8554         * gold/arm.cc (namespace utils): New.
8555         (Target_arm::reloc_is_non_pic): Define new method.
8556         (class Arm_relocate_functions): New.
8557         (Target_arm::Relocate::relocate): Handle relocation types used by
8558         Android.
8559
8560 2009-06-03  Ian Lance Taylor  <iant@google.com>
8561
8562         * arm.cc (Target_arm::scan::global): Use || instead of |.
8563
8564 2009-06-02  Doug Kwan  <dougkwan@google.com>
8565
8566         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8567         issued_non_pic_error_.
8568         (class Target_arm::Scan): Declare new method check_non_pic.
8569         Define new method symbol_needs_plt_entry.
8570         Declare new data member issued_non_pic_error_.
8571         (class Target_arm::Relocate): Declare new method
8572         should_apply_static_reloc.
8573         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8574         (Target_arm::Scan::check_non_pic): Define new method.
8575         (Target_arm::Scan::local): Handle a small subset of reloc types used
8576         by Android.
8577         (Target_arm::Scan::local): Same.
8578         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8579
8580 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8581
8582         * incremental.cc (Incremental_inputs::report_command_line): Filter
8583         out --incremental-* options.
8584
8585 2009-05-29  Doug Kwan  <dougkwan@google.com>
8586
8587         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8588         template class.
8589         (class Target_arm): Update comment.
8590         (Target_arm::Target_arm): Initialize new data members GOT_,
8591         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8592         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8593         and Target_arm::rel_dyn_section.
8594         Declare new_enum Target_arm::Got_type.
8595         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8596         and DYNBSS_.
8597         Update commments for member do_dynsym_value.
8598         (Target_arm::got_size, Target_arm::plt_section,
8599         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8600         new methods inside class defintion.
8601         (Target_arm::got_section): Define new method.
8602         (Target_arm::rel_dyn_section): Same.
8603         (Output_data_plt_arm): New template class.
8604         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8605         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8606         (Output_data_plt_arm::add_entry): Same.
8607         (Output_data_plt_arm::first_plt_entry): Define new
8608         static data member for PLT instruction template.
8609         (Output_data_plt_arm::plt_entry): Same.
8610         (Output_data_plt_arm::do_write): Define new method.
8611         (Target_arm::make_plt_entry): Same.
8612         (Target_arm::do_finalize_sections): Same.
8613         (Target_arm::do_dynsym_value): Same.
8614
8615 2009-05-28  Doug Kwan  <dougkwan@google.com>
8616
8617         * Makefile.am (TARGETSOURCES): Add arm.cc.
8618         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8619         * Makefile.in: Regenerate.
8620         * arm.cc: New file.
8621         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8622
8623 2009-05-26  Doug Kwan  <dougkwan@google.com>
8624
8625         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8626         (General_options::check_excluded_libs): Strip off directories in
8627         archive name before matching like GNU ld does.
8628         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8629         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8630         (exclude_libs_test_LDFLAGS): Add linker option
8631         -Wl,--exclude-libs,libexclude_libs_test_3
8632         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8633         an explicit archive without using -l.
8634         (alt/libexclude_libs_test_3.a): New make rule.
8635         * testsuite/Makefile.in: Regenerate.
8636         * testsuite/exclude_libs_test.c : Declare lib3_default().
8637         (main): Call it.
8638         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8639         * exclude_libs_test_3.c: New file.
8640
8641 2009-05-26  Nick Clifton  <nickc@redhat.com>
8642
8643         * po/id.po: New Indonesian translation.
8644         * po/gold.pot: Updated template file.
8645
8646 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8647
8648         * testsuite/Makefile.am: Add -ffunction-sections to compile
8649         gc_comdat_test files.  Add -Wl,--gc-sections to build
8650         gc_comdat_test.
8651         * testsuite/Makefile.in: Regenerate.
8652         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8653
8654 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8655
8656         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8657         kept comdat section was garbage collected.
8658         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8659         * testsuite/Makefile.in: Regenerate.
8660         * testsuite/gc_comdat_test.sh: New file.
8661         * testsuite/gc_comdat_test_1.cc: New file.
8662         * testsuite/gc_comdat_test_2.cc: New file.
8663
8664 2009-05-19  Doug Kwan  <dougkwan@google.com>
8665
8666         * archive.cc (Archive::Archive): Move constructor from archive.h
8667         to here.  Initialize no_export_.
8668         (Archive::get_elf_object_for_member): Set no_export flag of object.
8669         * archive.h (Archive::Archive): Move constructor body to
8670         archive.cc.
8671         (Archive::no_export): New method.
8672         (Archive::no_export_): New field.
8673         * object.h (Object::Object): Initialize no_export_ to false.
8674         (Object::no_export, Object::set_no_export): New methods.
8675         (Object::no_export_): New field.
8676         * options.cc (General_options::parse_exclude_libs): New method.
8677         (General_options::check_excluded_libs) Same.
8678         * options.h (exclude_libs): New option.
8679         (General_options::check_excluded_libs): New method declaration.
8680         (General_options::excluded_libs_): New field.
8681         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8682         default or protected visibility if an object has no-export flag set.
8683         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8684         (check_SCRIPTS): Add exclude_libs_test.sh.
8685         (check_DATA): Add exclude_libs_test.syms.
8686         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8687         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8688         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8689         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8690         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8691         libexclude_libs_test_2.a): New rules.
8692         * testsuite/Makefile.in: Regenerate.
8693         * testsuite/exclude_libs_test.c: New file.
8694         * testsuite/exclude_libs_test.sh: Ditto.
8695         * testsuite/exclude_libs_test_1.c: Ditto.
8696         * testsuite/exclude_libs_test_2.c: Ditto.
8697
8698 2009-05-15  Ian Lance Taylor  <iant@google.com>
8699
8700         * configure.ac: Check for declarations for cases where libiberty.h
8701         checks HAVE_DECL_xxx.
8702         * configure, config.in: Rebuild.
8703
8704 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8705
8706         * gold.h (Incremental_argument_list): Remove (invalid) forward
8707         declaration.
8708         * incremental.cc (Incremental_inputs::report_achive): New method.
8709         (Incremental_inputs::report_object): New method.
8710         (Incremental_inputs::report_script): New method.
8711         (Incremental_inputs::finalize_inputs): New method.
8712         (Incremental_inputs::finalize): Call finalize_inputs().
8713         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8714         Create inputs entries.
8715         * incremental.h (Incremental_input_type): New enum.
8716         (Incremental_inputs::Incremental_input): Initialize new fields.
8717         (Incremental_inputs::report_inputs): New method.
8718         (Incremental_inputs::report_achive): New method.
8719         (Incremental_inputs::report_object): New method.
8720         (Incremental_inputs::report_script): New method.
8721         (Incremental_inputs::finalize_inputs): New method.
8722         (Incremental_inputs::Input_info): New struct.
8723         (Incremental_inputs::Input_info_map): New typedef.
8724         (Incremental_inputs::lock_): New field.
8725         (Incremental_inputs::Inputs_): New field.
8726         (Incremental_inputs::Inputs_map): New field.
8727         * main.cc (main): Call Incremental_input::report_inputs.
8728         * options.h (Input_argument_list): Typedef moved from
8729         Input_arguments.
8730         (Input_file_group::Files): Remove, use ::Input_argument_list.
8731         (Input_file_group::Input_argument_list): Remove, use
8732         ::Input_argument_list.
8733         * plugin.cc (Plugin_manager::add_input_file): Add error in
8734         incremental build.
8735         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8736         functions.
8737         * script.cc (read_input_script): Call
8738         Incremental_input::report_script.
8739         * script.h (Script_info): New class.
8740
8741 2009-04-27  Ian Lance Taylor  <iant@google.com>
8742
8743         * x86_64.cc (do_adjust_output_section): Set entsize to
8744         plt_entry_size.
8745
8746 2009-04-23  Elliott Hughes  <enh@google.com>
8747
8748         * output.cc (Output_file::close): After short writes, continue
8749         writing from the correct offset in the buffer being written.
8750
8751 2009-04-23  Chris Demetriou  <cgd@google.com>
8752
8753         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8754         * configure: Regenerate.
8755         * config.in: Regenerate.
8756         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8757         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8758
8759 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8760
8761         * incremental.cc (Incremental_inputs_header_data): Renamed from
8762         Incremental_input_header_data.
8763         (Incremental_inputs_header_data::data_size): New field.
8764         (Incremental_inputs_header_data::put_input_file_count): Renamed
8765         from input_file_count.
8766         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8767         from command_line_offset.
8768         (Incremental_inputs_header_data::put_reserved): Renamed from
8769         put_reserved.
8770         (Incremental_inputs_entry_data): Renamed from
8771         Incremental_input_entry_data.
8772         (Incremental_inputs_entry_data::data_size): New field.
8773         (Incremental_inputs::report_command_line): New method.
8774         (Incremental_inputs::finalize): New method.
8775         (Incremental_inputs::create_incremental_inputs_data): New method.
8776         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8777         * incremental.h: New file.
8778         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8779        (Layout::finalize): Create incremental inputs section in
8780         incremental builds.
8781        (Layout::create_incremental_info_sections): New method.
8782         * layout.h (Layout::incremental_inputs): New method.
8783        (Layout::create_incremental_info_sections): New method.
8784        (Layout::incremental_inputs_): New field.
8785         * main.cc (main): Notify Incremental_input of the command line.
8786
8787 2009-04-01  Ian Lance Taylor  <iant@google.com>
8788             Mikolaj Zalewski  <mikolajz@google.com>
8789
8790         * gold.h (reserve_unordered_map): Define, three versions, one for
8791         each version of Unordered_map.
8792         * layout.cc (Layout::Layout): Remove options parameter.  Add
8793         number_of_input_files parameter.  Don't initialize options_.
8794         Initialize number_of_input_files_ and resized_signatures_.  Move
8795         sections_are_attached_.
8796         (Layout::layout_group): Reserve space for group_signatures_.
8797         (Layout::find_or_add_kept_section): Change name parameter to be a
8798         reference.  Resize signatures_ map when it gets large enough.
8799         (Layout::layout_eh_frame): Use parameters->options() instead of
8800         this->options_.
8801         (Layout::make_output_section): Likewise.
8802         (Layout::attach_allocated_section_to_segment): Likewise.
8803         (Layout::finalize, Layout::create_executable_stack): Likewise.
8804         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8805         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8806         * layout.h (class Layout): Update declarations.  Remove options_
8807         field.  Add number_of_input_files_ and resized_signatures_
8808         fields.  Move sections_are_attached_ field.
8809         * main.cc (main): Pass number of input files to Layout
8810         constructor.  Don't pass options.
8811
8812 2009-03-30  Ian Lance Taylor  <iant@google.com>
8813
8814         * ffsll.c (ffsll): Correct implementation.
8815
8816 2009-03-27  Ian Lance Taylor  <iant@google.com>
8817
8818         * ffsll.c: New file.
8819         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8820         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8821         * ftruncate.c (ftruncate): Declare before definition.
8822         * mremap.c (mremap): Likewise.
8823         * pread.c (pread): Likewise.
8824         * configure, Makefile.in, config.in: Rebuild.
8825
8826         * mremap.c: New file.
8827         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8828         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8829         (mremap): Declare if HAVE_MREMAP is not defined.
8830         * configure, Makefile.in, config.in: Rebuild.
8831
8832 2009-03-27  Cary Coutant  <ccoutant@google.com>
8833
8834         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8835         position independent.
8836         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8837         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8838
8839 2009-03-24  Cary Coutant  <ccoutant@google.com>
8840
8841         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8842         an executable.
8843         (needs_dynamic_reloc): Likewise.
8844
8845 2009-03-24  Ian Lance Taylor  <iant@google.com>
8846
8847         * yyscript.y (file_cmd): Recognize EXTERN.
8848         (extern_name_list, extern_name_list_body): New nonterminals.
8849         * script.cc (script_add_extern): Define.
8850         * script-c.h (script_add_extern): Declare.
8851
8852 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8853
8854         * object.cc (is_elf_object): Define.
8855         * object.h (is_elf_object): Declare.
8856         * archive.cc (Archive::get_elf_object_for_member): Call
8857         is_elf_object.
8858         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8859
8860 2009-03-24  Elliott Hughes  <enh@google.com>
8861
8862         * output.cc (Output_file::map_anonymous): Define.
8863         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8864         try an anonymous one.  Report the size if the mmap fails.
8865         * output.h (class Output_file): Declare map_anonymous.
8866
8867 2009-03-24  Ian Lance Taylor  <iant@google.com>
8868
8869         * target-select.cc (instantiate_target): Don't acquire the lock if
8870         the instantiated_target_ field has already been set.
8871
8872 2009-03-23  Ian Lance Taylor  <iant@google.com>
8873
8874         * gold-threads.h (class Initialize_lock): Define.
8875         * gold-threads.cc (class Initialize_lock_once): Define.
8876         (initialize_lock_control): New static variable.
8877         (initialize_lock_pointer): New static variable.
8878         (initialize_lock_once): New static function.
8879         (Initialize_lock::Initialize_lock): Define.
8880         (Initialize_lock::initialize): Define.
8881         * target-select.h: Include "gold-threads.h".
8882         (class Target_selector): Add lock_ and initialize_lock_ fields.
8883         Don't define instantiate_target, just declare it.
8884         * target-select.cc (Target_selector::Target_selector): Initialize
8885         new fields.
8886         (Target_selector::instantiate_target): Define.
8887         * descriptors.h: Include "gold-threads.h".
8888         (class Descriptors): Add initialize_lock_ field.
8889         * descriptors.cc (Descriptors::Descriptors): Initialize new
8890         field.
8891         (Descriptors::open): Use initialize_lock_ field
8892         * errors.h (class Errors): Add initialize_lock_ field.
8893         * errors.cc (Errors::Errors): Initialize new field.
8894         (Errors::initialize_lock): Use initialize_lock_ field.
8895         * powerpc.cc (class Target_selector_powerpc): Remove
8896         instantiated_target_ field.  In do_recognize call
8897         instantiate_target rather than do_instantiate_target.  In
8898         do_instantiate_target just allocate a new target.
8899         * sparc.cc (class Target_selector_sparc): Likewise.
8900
8901         * freebsd.h: New file.
8902         * i386.cc: Include "freebsd.h".
8903         (Target_i386): Derive from Target_freebsd rather than
8904         Sized_target.
8905         (Target_selector_i386): Derive from Target_selector_freebsd rather
8906         than Target_selector.
8907         * x86_64.cc: Include "freebsd.h".
8908         (Target_x86_64): Derive from Target_freebsd rather than
8909         Sized_target.
8910         (Target_selector_x86_64): Derive from Target_selector_freebsd
8911         rather than Target_selector.
8912         * target.h (class Target): Add adjust_elf_header and
8913         do_adjust_elf_header.
8914         * output.cc (Output_file_header:: do_sized_write): Call target
8915         adjust_elf_header routine.
8916         * configure.tgt: Set targ_osabi.
8917         * configure.ac: Define GOLD_DEFAULT_OSABI.
8918         * parameters.cc (Parameters::default_target): Pass
8919         GOLD_DEFAULT_OSABI to select_target.
8920         * target-select.h (class Target_selector): Make instantiate_target
8921         protected rather than private.
8922         * Makefile.am (HFILES): Add freebsd.h.
8923         * configure, Makefile.in, config.in: Rebuild.
8924
8925         * merge.cc (do_add_input_section): Correct pend value.  Change
8926         message about last entry not being null terminated from error to
8927         warning.
8928
8929 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8930
8931         * incremental.cc: New file.
8932         * Makefile.am (CCFILES): Add incremental.cc.
8933         * Makefile.in: Rebuild.
8934
8935 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8936
8937         * layout.cc (Layout::output_section_name): Preserve names
8938         of '.note.' sections.
8939
8940 2009-03-19  Ian Lance Taylor  <iant@google.com>
8941
8942         * descriptors.cc (Descriptors::open): Check that the options are
8943         valid before using them.
8944
8945 2009-03-18  Ian Lance Taylor  <iant@google.com>
8946
8947         * script-sections.h: Include <list>.
8948         (class Script_sections): Change Sections_elements from std::vector
8949         to std::list.  Typedef public Elements_iterator.  Add
8950         orphan_section_placement_, data_segment_align_start_, and
8951         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8952         field.
8953         * script-sections.cc (class Orphan_section_placement): New class.
8954         (class Sections_element): Add virtual functions is_relro and
8955         orphan_section_init.  Remove virtual function place_orphan_here.
8956         (class Output_section_definition): Add is_relro and
8957         orphan_section_init.  Remove place_orphan_here.
8958         (class Orphan_output_section): Likewise.
8959         (Script_sections::Script_sections): Update for field changes.
8960         (Script_sections::data_segment_align): Set saw_data_segment_align_
8961         and data_segment_align_start_, not data_segment_align_index.
8962         (Script_sections::data_segment_relro_end): Check
8963         saw_data_segment_align_.  Use data_segment_align_start_ rather
8964         than data_segment_align_index_.
8965         (Script_sections::place_orphan): Rewrite to use
8966         Orphan_section_placement.
8967
8968 2009-03-17  Ian Lance Taylor  <iant@google.com>
8969
8970         * archive.cc (Archive::add_symbols): Check for a version attached
8971         to the symbol name in the archive map.
8972         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8973         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8974         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8975         (ver_test_11.a): New target.
8976         * testsuite/Makefile.in: Rebuild.
8977
8978         * configure.ac: Check for chsize and posix_fallocate.  Replace
8979         ftruncate.
8980         * ftruncate.c: New file, from gnulib.
8981         * output.cc (posix_fallocate): Define dummy version if not
8982         HAVE_POSIX_FALLOCATE.
8983         (Output_file::map): Call posix_fallocate rather than lseek and
8984         write.
8985         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8986         * configure, Makefile.in, config.in: Rebuild.
8987
8988 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8989
8990         * layout.h (Layout::create_note): Add section_name parameter.
8991         * layout.cc (Layout::create_note): Likewise.
8992         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8993
8994 2009-03-17  Ian Lance Taylor  <iant@google.com>
8995
8996         * descriptors.cc: Include "options.h".
8997         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8998         (Descriptors::open): Always use O_CLOEXEC when opening a new
8999         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9000         then set FD_CLOEXEC.
9001
9002         * sparc.cc (class Target_sparc): Add has_got_section.
9003         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9004         make sure we have a GOT section.
9005
9006         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9007         (Target_sparc::Scan::local): Likewise.
9008         (Target_sparc::Scan::global): Likewise.
9009         (Target_sparc::Relocate::relocate): Likewise.
9010         (Target_sparc::Relocate::relocate_tls): Likewise.
9011
9012         * symtab.cc (Symbol_table::define_default_version): New function,
9013         broken out of add_from_object.
9014         (Symbol_table::add_from_object): Call define_default_version.
9015         (Symbol_table::define_special_symbol): Add resolve_oldsym
9016         parameter.  Change all callers.  If the version for a symbol comes
9017         from a version script, resolve it with the symbol with the same
9018         name with no version.  Also add the symbol without a version if
9019         appropriate.
9020         (do_define_in_output_data): If resolving with oldsym, don't delete
9021         sym.
9022         (do_define_in_output_segment): Likewise.
9023         (do_define_as_constant): Likewise.
9024         * symtab.h (class Symbol_table): Update declarations.
9025
9026 2009-03-13  Ian Lance Taylor  <iant@google.com>
9027
9028         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9029         (Read_symbols::requeue): New function.
9030         (Read_symbols::do_read_symbols): If make_elf_object fails because
9031         the target type is not configured, and the file was searched for,
9032         issue a warning and retry with the next directory.
9033         (Add_symbols::run): If the file has an incompatible format, and
9034         it was searched for, requeue the Read_symbols task.  On error,
9035         release the object.
9036         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9037         dirindex parameter to constructor.  Change all callers.  Declare
9038         incompatible_warning and requeue.
9039         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9040         input_argument_ and input_group_ fields.  Add them to
9041         constructor.  Change all callers.
9042         (class Read_script): Add dirindex_ field.  Add it to constructor.
9043         Change all callers.
9044         * archive.cc (Archive::setup): Remove input_objects parameter.
9045         Change all callers.
9046         (Archive::get_file_and_offset): Likewise.
9047         (Archive::read_all_symbols): Likewise.
9048         (Archive::read_symbols): Likewise.
9049         (Archive::get_elf_object_for_member): Remove input_objects
9050         parameter.  Add punconfigured parameter.  Change all callers.
9051         (Archive::add_symbols): Change return type to bool.  Check return
9052         value of include_member.
9053         (Archive::include_all_members): Likewise.
9054         (Archive::include_member): Change return type to bool.  Return
9055         false if first included object has incompatible target.  Set
9056         included_member_ field.
9057         (Add_archive_symbols::run): If add_symbols returns false, requeue
9058         Read_symbols task.
9059         * archive.h (class Archive): Add included_member_ field.
9060         Initialize it in constructor.  Add input_file and searched_for
9061         methods.  Update declarations.
9062         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9063         input_argument_ fields.  Add them to constructor.  Change all
9064         callers.
9065         * script.cc: Include "target-select.h".
9066         (class Parser_closure): Add skip_on_incompatible_target_ and
9067         found_incompatible_target_ fields.  Add
9068         skip_on_incompatible_target parameter to constructor.  Change all
9069         callers.  Add methods skip_on_incompatible_target,
9070         clear_skip_on_incompatible_target, found_incompatible_target, and
9071         set_found_incompatible_target.
9072         (read_input_script): Add dirindex parameter.  Change all callers.
9073         If parser finds an incompatible target, requeue Read_symbols
9074         task.
9075         (script_set_symbol): Clear skip_on_incompatible_target in
9076         closure.
9077         (script_add_assertion, script_parse_option): Likewise.
9078         (script_start_sections, script_add_phdr): Likewise.
9079         (script_check_output_format): New function.
9080         * script.h (read_input_script): Update declaration.
9081         * script-c.h (script_check_output_format): Declare.
9082         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9083         (ignore_cmd): Remove OUTPUT_FORMAT.
9084         * fileread.cc (Input_file::Input_file): Add explicit this.
9085         (Input_file::will_search_for): New function.
9086         (Input_file::open): Add pindex parameter.  Change all callers.
9087         * fileread.h (class Input_file): Add input_file_argument method.
9088         Declare will_search_for.  Update declarations.
9089         * object.cc (make_elf_object): Add punconfigured parameter.
9090         Change all callers.
9091         * object.h (class Object): Make input_file public.  Add
9092         searched_for method.
9093         (make_elf_object): Update declaration.
9094         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9095         restart search.
9096         * dirsearch.h (class Dirsearch): Update declaration.
9097         * options.h (class General_options): Add --warn-search-mismatch.
9098         * parameters.cc (Parameters::is_compatible_target): New function.
9099         * parameters.h (class Parameters): Declare is_compatible_target.
9100         * workqueue.cc (Workqueue::add_blocker): New function.
9101         * workqueue.h (class Workqueue): Declare add_blocker.
9102
9103         * fileread.cc (Input_file::open): Remove options parameter.
9104         Change all callers.
9105         (Input_file::open_binary): Likewise.
9106         * script.cc (read_input_script): Likewise.
9107         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9108         options parameter from constructor.  Change all callers.
9109         (class Read_script): Likewise.
9110         * fileread.h (class Input_file): Update declarations.
9111         * script.h (read_input_script): Update declaration.
9112
9113 2009-03-10  Nick Clifton  <nickc@redhat.com>
9114
9115         * po/es.po: New Spanish translation.
9116
9117 2009-03-06  Cary Coutant  <ccoutant@google.com>
9118
9119         * options.cc (parse_short_option): Keep dash_z from registering itself.
9120
9121 2009-03-03  Ian Lance Taylor  <iant@google.com>
9122
9123         PR 9918
9124         * target-reloc.h (relocate_section): Pass output_section to
9125         relocate.
9126         * i386.cc (Target_i386::should_apply_static_reloc): Add
9127         output_section parameter.  Change all callers.
9128         (Target_i386::Relocate::relocate): Add output_section parameter.
9129         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9130         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9131         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9132         * testsuite/two_file_shared.sh: New script.
9133         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9134         (check_DATA): Add two_file_shared.dbg.
9135         (two_file_shared.dbg): New target.
9136         * testsuite/Makefile.in: Rebuild.
9137
9138 2009-03-01  Ian Lance Taylor  <iant@google.com>
9139
9140         * configure.ac: Check for byteswap.h.
9141         * configure: Rebuild.
9142         * config.in: Rebuild.
9143
9144 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9145
9146         * layout.cc (Layout::find_or_add_kept_section): New function.
9147         (Layout::add_comdat): Removed.
9148         * layout.h (struct Kept_section): Move out of class Layout.
9149         Remove trailing underscores from field names.  Add group_sections
9150         field.  Rename group_ field to is_group.  Change all uses.
9151         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9152         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9153         comdat_groups_ field.
9154         (Sized_relobj::include_section_group): Use
9155         find_or_add_kept_section and Kept_section::group_sections.
9156         (Sized_relobj::include_linkonce_section): Likewise.
9157         * object.cc (class Sized_relobj): Don't define Comdat_group or
9158         Comdat_group_table.  Remove find_comdat_group and
9159         add_comdat_group.  Remove comdat_groups_ field.
9160         * plugin.cc (include_comdat_group): Use
9161         Layout::find_or_add_kept_section.
9162
9163 2009-02-28  Ian Lance Taylor  <iant@google.com>
9164
9165         * README: --gc-sections and map files are now supported.  Document
9166         some build requirements.
9167
9168         PR 6992
9169         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9170         relocatable link set the value of the section symbol to zero.
9171         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9172         relocatable link don't include the section address in the local
9173         symbol value.
9174
9175 2009-02-27  Ian Lance Taylor  <iant@google.com>
9176
9177         PR 6811
9178         * options.h (class Search_directory): Add is_system_directory.
9179         (class General_options): Declare is_in_system_directory.
9180         * options.cc (get_relative_sysroot): Make static.
9181         (get_default_sysroot): Make static.
9182         (General_optoins::is_in_system_directory): New function.
9183         * fileread.cc (Input_file::is_in_system_directory): New function.
9184         * fileread.h (class Input_file): Declare is_in_system_directory.
9185         * object.h (class Object): Add is_in_system_directory.
9186         (class Input_objects): Remove system_library_directory_ field.
9187         * object.cc (Input_objects::add_object): Don't set
9188         system_library_directory_.
9189         (input_objects::found_in_system_library_directory): Remove.
9190         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9191         parameter.  Change all callers.
9192         (Symbol_table::sized_write_globals): Likewise.
9193         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9194         Call Object::is_in_system_directory.
9195         * symtab.h (class Symbol_table): Update declarations.
9196
9197         PR 5990
9198         * descriptors.h (Open_descriptor): Add is_on_stack field.
9199         * descriptors.cc (Descriptors::open): If the descriptor is on the
9200         top of the stack, remove it.  Initialize is_on_stack field.
9201         (Descriptors::release): Only add pod to stack if it is not on the
9202         stack already.
9203         (Descriptors::close_some_descriptor): Clear stack_next and
9204         is_on_stack fields.
9205
9206         PR 7091
9207         * output.cc (Output_section::find_starting_output_address): Rename
9208         from starting_output_address; add PADDR parameter; change return
9209         type.
9210         * output.h (class Output_section): Declare
9211         find_starting_output_address instead of starting_output_address.
9212         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9213         section symbol for which we can't find a merge section.
9214
9215         PR 9836
9216         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9217         hidden or internal, force the symbol to be local.
9218         * resolve.cc (Symbol::override_visibility): Define.
9219         (Symbol::override_base): Use override_visibility.
9220         (Symbol_table::resolve): Likewise.
9221         (Symbol::override_base_with_special): Likewise.
9222         (Symbol_table::override_with_special): If the visibility is hidden
9223         or internal, force the symbol to be local.
9224         * symtab.h (class Symbol): Add set_visibility and
9225         override_visibility.
9226         * testsuite/ver_test_1.sh: New file.
9227         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9228         (check_DATA): Add ver_test_1.syms.
9229         (ver_test_1.syms): New target.
9230         * testsuite/Makefile.in: Rebuild.
9231
9232 2009-02-25  Cary Coutant  <ccoutant@google.com>
9233
9234         * layout.cc (Layout::choose_output_section): Don't rename sections
9235         when using a linker script that has a SECTIONS clause.
9236         * Makefile.in: Regenerate.
9237
9238         * testsuite/Makefile.am (script_test_5.sh): New test case.
9239         * testsuite/Makefile.in: Regenerate.
9240         * testsuite/script_test_5.cc: New file.
9241         * testsuite/script_test_5.sh: New file.
9242         * testsuite/script_test_5.t: New file.
9243
9244 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9245
9246         * archive.cc (Archive::include_member): Update calls to add_symbols.
9247         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9248         the Layout argument.
9249         * dynobj.h (do_add_symbols): Add the Layout argument.
9250         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9251         Layout argument.
9252         * object.h (Object::add_symbols): Add the Layout argument.
9253         (Object::do_add_symbols): Add the Layout argument.
9254         (Sized_relobj::do_add_symbols): Add the Layout argument.
9255         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9256         Unify the two versions.
9257         (Add_plugin_symbols): Remove.
9258         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9259         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9260         (Add_plugin_symbols): Remove.
9261         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9262         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9263         (Add_symbols::run): Make it work with Pulginobj.
9264
9265 2009-02-06  Ian Lance Taylor  <iant@google.com>
9266
9267         * object.cc (Sized_relobj::do_layout): Make info message start
9268         with lower case letter.
9269
9270 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9271
9272         * binary.cc: Fix file comment.
9273
9274         * options.h (enum Incremental_disposition): Define.
9275         (class General_options): Add new options: --incremental,
9276         --incremental_changed, --incremental_unchanged,
9277         --incremental_unknown.  Add incremental_disposition_ and
9278         implicit_incremental_ fields.
9279         (General_options::incremental_disposition): New function.
9280         (class Position_dependent_options): Add incremental_disposition
9281         option.
9282         (Position_dependent_options::copy_from_options): Set incremental
9283         dispositions.
9284         * options.cc (General_options::parse_incremental_changed): New
9285         function.
9286         (General_options::parse_incremental_unchanged): New function.
9287         (General_options::parse_incremental_unknown): New function.
9288         (General_options::General_options): Initialize new fields
9289         incremental_disposition_ and implicit_incremental_.
9290         (General_options::finalize): Check for uasge of --incremental-*
9291         without --incremental.
9292
9293 2009-02-06  Chris Demetriou  <cgd@google.com>
9294
9295         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9296         pointer and to report location as the file name associated with
9297         the symbol.
9298         (gold_undefined_symbol_at_location): New function to replace the
9299         old gold_undefined_symbol functionality.
9300         * target-reloc.h (relocate_section): Update to use
9301         gold_undefined_symbol_at_location.
9302         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9303         Call gold_undefined_symbol function rather than gold_error.
9304         * errors.h (Errors::undefined_symbol): Take location as a
9305         string, rather than calculating it from a relocation.
9306         * errors.cc (Errors::fatal): Print "fatal error:" before the
9307         formatted message.
9308         (Errors::error, Errors::error_at_location): Print "error: "
9309         before the formatted message.
9310         (Errors::undefined_symbol): Take location as a string, rather
9311         than calculating it from a relocation.
9312         (gold_undefined_symbol_at_location): New function akin to
9313         old gold_undefined_symbol, calculates location from relocation.
9314         (gold_undefined_symbol): Change to take only a Symbol pointer
9315         and to report location as the file name associated with the symbol.
9316         * testsuite/debug_msg.sh: Update for changed error messages.
9317         * testsuite/undef_symbol.sh: Likewise.
9318
9319 2009-02-04  Duncan Sands  <baldrick@free.fr>
9320
9321         PR 9812
9322         * reduced_debug_output.h
9323         (Output_reduced_debug_abbrev_section::failed): Use format for
9324         gold_warning.
9325         (Output_reduced_debug_info_section::faild): Likewise.
9326
9327 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9328
9329         * script.cc (Lazy_demangler): New class.
9330         (Version_script_info::get_symbol_version_helper): Demangle a
9331         symbol only once.
9332
9333 2009-01-29  Cary Coutant  <ccoutant@google.com>
9334
9335         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9336         to __tls_get_addr.
9337         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9338
9339 2009-01-28  Ian Lance Taylor  <iant@google.com>
9340
9341         * version.cc (version_string): Bump to 1.9.
9342
9343         * gold.h: Include <cstring> and <stdint.h>.
9344         * version.cc: Include <cstdio>.
9345         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9346         warning.
9347         * reduced_debug_output.cc (insert_into_vector): Rename from
9348         Insert_into_vector; change all callers.  Use Swap_unaligned to
9349         avoid aliasing issue; remove union since it is unnecessary.
9350
9351 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9352
9353         * Makefile.am (CCFILES): Add gc.cc.
9354         (HFILES): Add gc.h.
9355         * Makefile.in: Regenerate.
9356         * gold.cc (Gc_runner): New class.
9357         (queue_initial_tasks): Call garbage collection related tasks
9358         when corresponding options are invoked.
9359         (queue_middle_gc_tasks): New function.
9360         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9361         processed early before laying out sections during garbage collection.
9362         * gold.h (queue_middle_gc_tasks): New function.
9363         (is_prefix_of): Move from "layout.cc".
9364         * i386.cc (Target_i386::gc_process_relocs): New function.
9365         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9366         * main.cc (main): Create object of class "Garbage_collection".
9367         * object.cc (Relobj::copy_symbols_data): New function.
9368         (Relobj::is_section_name_included): New function.
9369         (Sized_relobj::do_layout): Allow this function to be called twice
9370         during garbage collection and defer layout of section during the
9371         first call.
9372         * object.h (Relobj::get_symbols_data): New function.
9373         (Relobj::is_section_name_included): New function.
9374         (Relobj::copy_symbols_data): New function.
9375         (Relobj::set_symbols_data): New function.
9376         (Relobj::get_relocs_data): New function.
9377         (Relobj::set_relocs_data): New function.
9378         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9379         (Relobj::gc_process_relocs): New function.
9380         (Relobj::do_gc_process_relocs): New pure virtual function.
9381         (Relobj::sd_): New data member.
9382         (Sized_relobj::is_output_section_offset_invalid): New function.
9383         (Sized_relobj::do_gc_process_relocs): New function.
9384         * options.h (General_options::gc_sections): Modify to not be a no-op.
9385         (General_options::print_gc_sections): New option.
9386         * plugin.cc (Plugin_finish::run): Remove function call to
9387         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9388         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9389         * reloc.cc (Read_relocs::run): Add task to process relocs and
9390         determine unreferenced sections when doing garbage collection.
9391         (Gc_process_relocs): New class.
9392         (Sized_relobj::do_gc_process_relocs): New function.
9393         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9394         sections that are garbage collected.
9395         * reloc.h (Gc_process_relocs): New class.
9396         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9397         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9398         symbols whose corresponding sections are garbage collected.
9399         (Symbol_table::Symbol_table): Add new parameter for the garbage
9400         collection object.
9401         (Symbol_table::gc_mark_undef_symbols): New function.
9402         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9403         (Symbol_table::gc_mark_dyn_syms): New function.
9404         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9405         as garbage.
9406         (Symbol_table::add_from_object): Likewise.
9407         (Symbol_table::add_from_relobj): When building shared objects, do not
9408         treat externally visible symbols as garbage.
9409         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9410         table information for static and relocatable links.
9411         * symtab.h (Symbol_table::set_gc): New function.
9412         (Symbol_table::gc): New function.
9413         (Symbol_table::gc_mark_undef_symbols): New function.
9414         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9415         (Symbol_table::gc_mark_dyn_syms): New function.
9416         (Symbol_table::gc_): New data member.
9417         * target.h (Sized_target::gc_process_relocs): New pure virtual
9418         function.
9419         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9420         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9421
9422 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9423
9424         * options.h (General_options::gc_sections): Define as a no-op for now.
9425         (General_options::no_keep_memory): Ditto.
9426         (General_options::Bshareable): Define.
9427         * options.cc (General_options::finalize): Honor -Bshareable.
9428
9429 2009-01-20  Andreas Schwab  <schwab@suse.de>
9430
9431         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9432         read the value in the contents, since we don't use it.  Use the
9433         template endianness when writing.
9434         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9435
9436 2009-01-19  Andreas Schwab  <schwab@suse.de>
9437
9438         * configure.tgt (powerpc64-*): Fix targ_obj.
9439
9440 2009-01-15  Ian Lance Taylor  <iant@google.com>
9441
9442         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9443         local symbols when stripping all symbols.
9444
9445 2009-01-14  Cary Coutant  <ccoutant@google.com>
9446
9447         * output.cc (Output_reloc): Add explicit instantiations.
9448
9449 2009-01-14  Cary Coutant  <ccoutant@google.com>
9450
9451         * archive.cc (Archive::get_elf_object_for_member): Remove call
9452         to File_read::claim_for_plugin.
9453         * descriptors.cc (Descriptors::open): Remove reference to
9454         is_claimed.
9455         (Descriptors::claim_for_plugin): Remove.
9456         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9457         (Descriptors::is_claimed): Remove.
9458         (claim_descriptor_for_plugin): Remove.
9459         * fileread.cc (File_read::claim_for_plugin): Remove.
9460         * fileread.h (File_read::claim_for_plugin): Remove.
9461         (File_read::descriptor): Reopen descriptor if necessary.
9462         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9463         (Plugin_manager::all_symbols_read): Add task parameter. Change
9464         all callers.
9465         (Plugin_manager::get_input_file): New function.
9466         (Plugin_manager::release_input_file): New function.
9467         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9468         corresponding data member.
9469         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9470         and pass to base constructor. Change all callers.
9471         (get_input_file, release_input_file): New functions.
9472         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9473         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9474         (Plugin_manager::all_symbols_read): Add task parameter.
9475         (Plugin_manager::get_input_file): New function.
9476         (Plugin_manager::release_input_file): New function.
9477         (Plugin_manager::task_): New data member.
9478         (Pluginobj::Pluginobj): Add filesize parameter.
9479         (Pluginobj::filename): New function.
9480         (Pluginobj::descriptor): New function.
9481         (Pluginobj::filesize): New function.
9482         (Pluginobj::filesize_): New data member.
9483         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9484         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9485         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9486
9487         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9488         with archive libraries.
9489         * testsuite/Makefile.in: Regenerate.
9490         * testsuite/plugin_test.c (struct sym_info): New type.
9491         (get_input_file, release_input_file): New static variables.
9492         (onload): Capture new transfer vector entries.
9493         (claim_file_hook): Stop reading at end of file according to filesize.
9494         Factor out parsing of readelf output into separate function.
9495         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9496         APIs and get the source file name from the symbol table.  Convert
9497         source file name to corresponding object file name.  Print info
9498         message when adding new input files.
9499         (parse_readelf_line): New function.
9500         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9501         * testsuite/plugin_test_2.sh: Likewise.
9502         * testsuite/plugin_test_3.sh: Likewise.
9503         * testsuite/plugin_test_4.sh: New test case.
9504
9505 2009-01-07  Ian Lance Taylor  <iant@google.com>
9506
9507         * version.cc (version_string): Bump to 1.8.
9508
9509 2008-12-23  Cary Coutant  <ccoutant@google.com>
9510
9511         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9512         * plugin.cc (Plugin_manager::finish): Rename as
9513         layout_deferred_objects.  Move cleanup to separate function.
9514         (Plugin_manager::cleanup): New function.
9515         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9516         separately.
9517         * plugin.h (Plugin_manager::finish): Rename as
9518         layout_deferred_objects.
9519         (Plugin_manager::cleanup): New function.
9520         (Plugin_manager::cleanup_done): New field.
9521
9522 2008-12-23  Cary Coutant  <ccoutant@google.com>
9523
9524         * plugin.cc (is_visible_from_outside): New function.
9525         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9526         so we don't return "IR only" status for exported symbols or -r links.
9527
9528         * testsuite/Makefile.am (plugin_test_3): New test case.
9529         * testsuite/Makefile.in: Regenerate.
9530         * testsuite/plugin_test_3.sh: New file.
9531
9532 2008-12-22  Cary Coutant  <ccoutant@google.com>
9533
9534         * object.cc (Sized_relobj::layout_section): New function.
9535         (Sized_relobj::do_layout): Defer layout of input sections until after
9536         plugin has provided replacement files.
9537         (Sized_relobj::do_layout_deferred_sections): New function.
9538         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9539         (Relobj::layout_deferred_sections): New function.
9540         (Relobj::do_layout_deferred_sections): New function.
9541         (Sized_relobj::do_layout_deferred_sections): New function.
9542         (Sized_relobj::layout_section): New function.
9543         (Sized_relobj::Deferred_layout): New structure.
9544         (Sized_relobj::deferred_layout_): New field.
9545         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9546         Change all callers.  Layout deferred sections.
9547         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9548         references.
9549         (Plugin_hook::run): Move code from do_plugin_hook inline.
9550         (Plugin_hook::do_plugin_hook): Remove.
9551         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9552         (Plugin_manager::finish): Renamed, was cleanup.
9553         (Plugin_manager::should_defer_layout): New function.
9554         (Plugin_manager::add_deferred_layout_object): New function.
9555         (Plugin_manager::Deferred_layout_list): New type.
9556         (Plugin_manager::deferred_layout_objects_): New field.
9557         (Plugin_hook::do_plugin_hook): Remove.
9558
9559 2008-12-17  Ian Lance Taylor  <iant@google.com>
9560
9561         * options.h (class General_options): Add --no case for
9562         --export-dynamic.
9563
9564 2008-12-16  Cary Coutant  <ccoutant@google.com>
9565
9566         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9567         vector.
9568         (Plugin_manager::claim_file): Create plugin object even if
9569         plugin did not call the add_symbols callback.
9570         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9571         asking for more symbols than were added.
9572         * testsuite/Makefile.am (plugin_test_1): Add test case with
9573         no global symbols.
9574         (empty.syms): New target.
9575         * testsuite/Makefile.in: Regenerate.
9576         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9577         message. Don't call add_symbols if no globals.
9578         (all_symbols_read_hook): Don't provide replacement for empty
9579         claimed file.
9580
9581 2008-12-12  Ian Lance Taylor  <iant@google.com>
9582
9583         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9584         r_type == 0 for a local symbol with r_sym == 0.
9585         (scan_relocatable_relocs): Pass r_sym to
9586         local_non_section_strategy.
9587         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9588         r_sym parameter.
9589
9590         * configure.ac: Update test for TLS descriptors: they are
9591         supported as of glibc 2.9.
9592         * configure: Rebuild.
9593
9594 2008-12-11  Ian Lance Taylor  <iant@google.com>
9595
9596         PR 7091
9597         * target-reloc.h (Default_scan_relocatable_relocs): For each
9598         function, map r_type == 0 to RELOC_DISCARD.
9599
9600 2008-12-10  Cary Coutant  <ccoutant@google.com>
9601
9602         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9603         object to override a kept COMDAT group from a plugin object.
9604
9605 2008-12-09  Ian Lance Taylor  <iant@google.com>
9606
9607         PR 7088
9608         * yyscript.y (file_cmd): Handle INPUT.
9609
9610         * testsuite/initpri1.c: Change all declarations to be full
9611         prototypes by adding void, to avoid compiler warnings.
9612
9613 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9614
9615         * options.cc (General_options::parse_plugin_opt): New.
9616         (General_options::add_plugin): The argument now is just the filename.
9617         (General_options::add_plugin_option): New.
9618         * options.h (plugin_opt): New.
9619         (add_plugin): Change argument name.
9620         (add_plugin_option): New.
9621         * plugin.cc (Plugin::load): Don't parse the plugin option.
9622         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9623         (Plugin::add_option): New.
9624         (Plugin::args_): Change type.
9625         (Plugin::filename_): New.
9626         (Plugin_manager::add_plugin_option): New.
9627         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9628         * testsuite/Makefile.in: Regenerate.
9629
9630 2008-12-05  Cary Coutant  <ccoutant@google.com>
9631
9632         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9633         Handle --strip-lto-sections option.
9634         * options.h (strip_lto_sections): New option.
9635
9636 2008-12-01  Cary Coutant  <ccoutant@google.com>
9637
9638         * plugin.cc (ld_plugin_message): Change format parameter to const.
9639         Fix mismatch between new[] and delete.
9640
9641 2008-11-14  Cary Coutant  <ccoutant@google.com>
9642
9643         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9644         instead of -1U.
9645
9646 2008-11-05  Craig Silverstein  <csilvers@google.com>
9647
9648         * options.cc (General_options::parse_dynamic_list): New function.
9649         * options.h (General_options): New flags dynamic_list,
9650         dynamic_list_data, dynamic_list_cpp_new, and
9651         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9652         (General_options::in_dynamic_list): New function.
9653         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9654         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9655         (Lex::can_continue_name): Likewise.
9656         (yylex): Likewise.
9657         (read_script_file): New parameter script_options.
9658         (read_dynamic_list): New function.
9659         (Script_options::define_dynamic_list): New function.
9660         (dynamic_list_keyword_parsecodes): New variable.
9661         (dynamic_list_keywords): New variable.
9662         * script.h (Script_options::define_dynamic_list): New function
9663         prototype.
9664         (read_dynamic_list): New function prototype.
9665         * symtab.cc (strprefix): New macro.
9666         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9667         dynamic_list_data, dynamic_list_cpp_new, and
9668         dynamic_list_cpp_typeinfo.
9669         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9670         (dynamic_list_expr): New rule.
9671         (dynamic_list_nodes): Likewise.
9672         (dynamic_list_node): Likewise.
9673         * testsuite/Makefile.am (dynamic_list): New test.
9674         * testsuite/Makefile.in: Regenerated.
9675         * testsuite/dynamic_list.t: New file.
9676         * testsuite/dynamic_list.sh: New file.
9677
9678 2008-11-05  Craig Silverstein  <csilvers@google.com>
9679
9680         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9681         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9682         (t11_last): Likewise.
9683         * testsuite/ver_test_6.c (main): Likewise.
9684
9685 2008-10-07  Cary Coutant  <ccoutant@google.com>
9686
9687         * options.c (General_options::finalize): Add check for -static and
9688         -shared.
9689         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9690         is not empty.
9691
9692 2008-10-02  Cary Coutant  <ccoutant@google.com>
9693
9694         * plugin.cc (make_sized_plugin_object): Fix conditional
9695         compilation to work when not all targets are enabled.
9696
9697 2008-09-29  Cary Coutant  <ccoutant@google.com>
9698
9699         * archive.cc (Archive::get_file_and_offset): Use filename instead
9700         of name to get library path.
9701         (Archive::include_member): Unlock external member of a thin archive.
9702
9703         * testsuite/Makefile.am (TEST_AR): New variable.
9704         (thin_archive_test_1): New test.
9705         (thin_archive_test_2): New test.
9706         * testsuite/Makefile.in: Regenerate.
9707         * testsuite/thin_archive_main.cc: New file.
9708         * testsuite/thin_archive_test_1.cc: New file.
9709         * testsuite/thin_archive_test_2.cc: New file.
9710         * testsuite/thin_archive_test_3.cc: New file.
9711         * testsuite/thin_archive_test_4.cc: New file.
9712
9713 2008-09-29  Cary Coutant  <ccoutant@google.com>
9714
9715         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9716         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9717         instead of -1U.
9718         (Sized_relobj::do_finalize_local_symbols): Likewise.
9719         (Sized_relobj::map_to_kept_section): Likewise.
9720         * object.h (Sized_relobj::invalid_address): New constant.
9721         (Sized_relobj::do_output_section_offset): Check for invalid_address
9722         and return -1ULL.
9723         * output.cc (Output_reloc::local_section_offset): Use constant
9724         invalid_address instead of -1U.
9725         (Output_reloc::get_address): Likewise.
9726         (Output_section::output_address): Change -1U to -1ULL.
9727         * output.h (Output_reloc::invalid_address): New constant.
9728         * reloc.cc (Sized_relobj::write_sections): Use constant
9729         invalid_address instead of -1U.
9730         (Sized_relobj::relocate_sections): Likewise.
9731         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9732         values for merge sections.
9733         * target-reloc.h (relocate_for_relocatable): Use constant
9734         invalid_address instead of -1U.
9735
9736 2008-09-19  Cary Coutant  <ccoutant@google.com>
9737
9738         Add plugin functionality for link-time optimization (LTO).
9739         * configure.ac (plugins): Add --enable-plugins option.
9740         * configure: Regenerate.
9741         * config.in: Regenerate.
9742         * Makefile.am (LIBDL): New variable.
9743         (CCFILES): Add plugin.cc.
9744         (HFILES): Add plugin.h.
9745         (ldadd_var): Add LIBDL.
9746         * Makefile.in: Regenerate.
9747
9748         * archive.cc: Include "plugin.h".
9749         (Archive::setup): Don't preread archive symbols when using a plugin.
9750         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9751         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9752         files.
9753         (Archive::include_member): Add symbols from plugin objects.
9754         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9755         * descriptors.cc (Descriptors::open): Check for file descriptors
9756         abandoned by plugins.
9757         (Descriptors::claim_for_plugin): New function.
9758         * descriptors.h (Descriptors::claim_for_plugin): New function.
9759         (Open_descriptor::is_claimed): New field.
9760         (claim_descriptor_for_plugin): New function.
9761         * fileread.cc (File_read::claim_for_plugin): New function.
9762         * fileread.h (File_read::claim_for_plugin): New function.
9763         (File_read::descriptor): New function.
9764         * gold.cc: Include "plugin.h".
9765         (queue_initial_tasks): Add task to call plugin hooks for generating
9766         new object files.
9767         * main.cc: Include "plugin.h".
9768         (main): Load plugin libraries.
9769         * object.h (Pluginobj): Declare.
9770         (Object::pluginobj): New function.
9771         (Object::do_pluginobj): New function.
9772         (Object::set_target): New function.
9773         * options.cc: Include "plugin.h".
9774         (General_options::parse_plugin): New function.
9775         (General_options::General_options): Initialize plugins_ field.
9776         (General_options::add_plugin): New function.
9777         * options.h (Plugin_manager): Declare.
9778         (General_options): Add --plugin option.
9779         (General_options::has_plugins): New function.
9780         (General_options::plugins): New function.
9781         (General_options::add_plugin): New function.
9782         (General_options::plugins_): New field.
9783         * plugin.cc: New file.
9784         * plugin.h: New file.
9785         * readsyms.cc: Include "plugin.h".
9786         (Read_symbols::do_read_symbols): Check for archive before checking
9787         for ELF file.  Call plugin hooks to claim files.
9788         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9789         from a real object file; force override when processing replacement
9790         files.
9791         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9792         (Symbol::init_base_object): Likewise.
9793         (Symbol::init_base_output_data): Likewise.
9794         (Symbol::init_base_output_segment): Likewise.
9795         (Symbol::init_base_constant): Likewise.
9796         (Symbol::init_base_undefined): Likewise.
9797         (Symbol::output_section): Assert that object is not a plugin.
9798         (Symbol_table::add_from_pluginobj): New function.
9799         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9800         undefined.
9801         (Symbol_table::sized_write_globals): Likewise.
9802         (Symbol_table::add_from_pluginobj): Instantiate template.
9803         * symtab.h (Sized_pluginobj): Declare.
9804         (Symbol::in_real_elf): New function.
9805         (Symbol::set_in_real_elf): New function.
9806         (Symbol::in_real_elf_): New field.
9807         (Symbol_table::add_from_pluginobj): New function.
9808
9809         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9810         (LIBDL): New variable.
9811         (LDADD): Add LIBDL.
9812         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9813         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9814         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9815         (MOSTLYCLEANFILES): Likewise.
9816         * testsuite/Makefile.in: Regenerate.
9817         * testsuite/plugin_test.c: New file.
9818         * testsuite/plugin_test_1.sh: New file.
9819         * testsuite/plugin_test_2.sh: New file.
9820
9821 2008-09-16  Ian Lance Taylor  <iant@google.com>
9822
9823         * target-reloc.h (relocate_section): Check whether a symbol is
9824         defined by the ABI before reporting an undefined symbol error.
9825         * target.h (Target::is_defined_by_abi): Make parameter const.
9826         (Target::do_is_defined_by_abi): Likewise.
9827         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9828         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9829         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9830         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9831         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9832         * testsuite/Makefile.in: Rebuild.
9833
9834         * fileread.cc (make_view): Add casts to avoid warning.
9835
9836 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9837
9838         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9839         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9840
9841 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9842
9843         * options.h (General_options::output_is_executable): New.
9844         (General_options::output_is_pie): New.
9845         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9846         for shared libraries.
9847         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9848
9849 2008-09-11  Chris Demetriou  <cgd@google.com>
9850
9851         * options.h (origin): New -z option.
9852         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9853         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9854         in DT_FLAGS_1.
9855
9856 2008-09-05  Cary Coutant  <ccoutant@google.com>
9857
9858         * fileread.cc (File_read::make_view): Add check for attempt to map
9859         beyond end of file.
9860
9861 2008-09-05  Cary Coutant  <ccoutant@google.com>
9862
9863         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9864         explicit instantiations.
9865
9866 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9867
9868         PR gold/6858
9869         * options.cc (General_options::finalize): Allow undefined symbols
9870         in shlibs if linking -shared.
9871
9872         PR gold/6859
9873         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9874         symbols as not needing a dynsym entry.
9875
9876 2008-08-20  Craig Silverstein  <csilvers@google.com>
9877
9878         * fileread.cc (File_read::open): Do not lock the file unless it
9879         was successfully opened.
9880
9881 2008-08-14  Cary Coutant  <ccoutant@google.com>
9882
9883         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9884         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9885         * testsuite/tls_test.cc (struct int128): 128-bit struct
9886         for testing TLS relocs with non-zero addend.
9887         (v12): New TLS variable.
9888         (t12): New test.
9889         (t_last): Add check for v12.
9890         * testsuite/tls_test.h (t12): New function.
9891         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9892
9893 2008-08-13  Ian Lance Taylor  <iant@google.com>
9894
9895         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9896         set tls_segment_ or relro_segment_.
9897         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9898         when appropriate.
9899         * output.h (Output_section::clear_is_relro): New function.
9900         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9901         sections specially even when output_data_ is empty.
9902         (Output_segment::maximum_alignment): When first section is relro,
9903         only force alignment for PT_LOAD segments.
9904         * script.cc (script_data_segment_align): New function.
9905         (script_data_segment_relro_end): New function.
9906         * script-c.h (script_data_segment_align): Declare.
9907         (script_data_segment_relro_end): Declare.
9908         * script-sections.h (class Script_sections): Declare
9909         data_segment_align and data_segment_relro_end.  Add fields
9910         segment_align_index_ and saw_relro_end_.
9911         * script-sections.cc (class Sections_element): Add set_is_relro
9912         virtual function.  Add new bool* parameter to place_orphan_here.
9913         Add get_output_section virtual function.
9914         (class Output_section_definition): Add set_is_relro.  Add new
9915         bool* parameter to place_orphan_here.  Add get_output_section.
9916         Add is_relro_ field.
9917         (Output_section_definition::Output_section_definition): Initialize
9918         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9919         and is_relro_ fields.
9920         (Output_section_definition::place_orphan_here): Add is_relro
9921         parameter.
9922         (Output_section_definition::set_section_addresses): Set relro for
9923         output section.
9924         (Output_section_definition::alternate_constraint): Likewise.
9925         (class Orphan_output_section): Add new bool* parameter to
9926         place_orphan_here.  Add get_output_section.
9927         (Orphan_output_section::place_orphan_here): Add is_relro
9928         parameter.
9929         (Script_sections::Script_sections): Initialize
9930         data_segment_align_index_ and saw_relro_end_.
9931         (Script_sections::data_segment_align): New function.
9932         (Script_sections::data_segment_relro_end): New function.
9933         (Script_sections::place_orphan): Set or clear is_relro.
9934         (Script_sections::set_section_addresses): Force alignment of first
9935         TLS section.
9936         * yyscript.y (exp): Call script_data_segment_align and
9937         script_data_segment_relro_end.
9938         * testsuite/relro_script_test.t: New file.
9939         * testsuite/relro_test.cc (using_script): Declare.
9940         (t1, t2): Test using_script.
9941         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9942         (relro_script_test_SOURCES): Define.
9943         (relro_script_test_DEPENDENCIES): Define.
9944         (relro_script_test_LDFLAGS): Define.
9945         (relro_script_test_LDADD): Define.
9946         (relro_script_test.so): New target.
9947         * testsuite/Makefile.in: Rebuild.
9948
9949 2008-08-06  Cary Coutant <ccoutant@google.com>
9950
9951         * archive.cc (Archive::total_archives, Archive::total_members)
9952         (Archive::total_members_loaded): New variables.
9953         (Archive::setup): Add parameter.  Add option to preread
9954         archive symbols.
9955         (Archive::read_armap): Add counter.
9956         (Archive::get_file_and_offset): New function.
9957         (Archive::get_elf_object_for_member): New function.
9958         (Archive::read_all_symbols): New function.
9959         (Archive::read_symbols): New function.
9960         (Archive::add_symbols): Add counters.
9961         (Archive::include_all_members): Use armap to find members if it's
9962         already built.
9963         (Archive::include_member): Skip reading symbols if already read.
9964         Factored code into Archive::get_file_and_offset and
9965         Archive::get_elf_object_for_member.  Changed call to
9966         Mapfile::report_include_archive_member.
9967         (Archive::print_stats): New function.
9968         * archive.h: Declare Object and Read_symbols_data classes.
9969         (Archive::Archive): Add initializers for new members.
9970         (Archive::setup): Add parameter.
9971         (Archive::print_stats): New function.
9972         (Archive::total_archives, Archive::total_members)
9973         (Archive::total_members_loaded): New variables.
9974         (Archive::get_file_and_offset): New function.
9975         (Archive::get_elf_object_for_member): New function.
9976         (Archive::read_all_symbols): New function.
9977         (Archive::read_symbols): New function.
9978         (Archive::Archive_member): New class.
9979         (Archive::members_): New member.
9980         (Archive::num_members_): New member.
9981         * main.cc: Include archive.h.
9982         (main): Call Archive::print_stats.
9983         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9984         archive parameter; member_name is now the fully-decorated name.
9985         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9986         * options.h: (General_options): Add --preread-archive-symbols option.
9987         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9988         Archive::setup.
9989
9990 2008-08-04  Ian Lance Taylor  <iant@google.com>
9991
9992         * symtab.h (Symbol::use_plt_offset): New function.
9993         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9994         * powerpc.cc (Relocate::relocate): Likewise.
9995         * sparc.cc (Relocate::relocate): Likewise.
9996         * x86_64.cc (Relocate::relocate): Likewise.
9997         * testsuite/weak_plt.sh: New test.
9998         * testsuite/weak_plt_main.cc: New test.
9999         * testsuite/weak_plt_shared.cc: New test.
10000         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10001         (check_PROGRAMS): Add weak_plt.
10002         (check_DATA): Add weak_plt_shared.so.
10003         (weak_plt_main_pic.o, weak_plt): New targets.
10004         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10005         * testsuite/Makefile.in: Rebuild.
10006
10007         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10008         gcctestdir/ld.
10009         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10010         * testsuite/Makefile.in: Rebuild.
10011
10012 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10013
10014         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10015         * Makefile.in: Regenerate.
10016         * po/POTFILES.in: Regenerate.
10017
10018 2008-07-29  Ian Lance Taylor  <iant@google.com>
10019
10020         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10021         symbols before other symbols.
10022         * testsuite/script_test_2.cc (test_addr): Declare.
10023         (test_addr_alias): Declare.
10024         (main): Check that test_addr and test_addr_alias have the right
10025         values.
10026         * testsuite/script_test_2.t: Define test_addr_alias and
10027         test_addr.
10028
10029 2008-07-24  Ian Lance Taylor  <iant@google.com>
10030
10031         PR 5990
10032         * descriptors.cc: New file.
10033         * descriptors.h: New file.
10034         * gold-threads.h (class Hold_optional_lock): New class.
10035         * fileread.cc: Include "descriptors.h".
10036         (File_read::~File_read): Release descriptor rather than closing
10037         it.
10038         (File_read::open) [file]: Call open_descriptor rather than open.
10039         Set is_descriptor_opened_.
10040         (File_read::open) [memory]: Assert that descriptor is not open.
10041         (File_read::reopen_descriptor): New function.
10042         (File_read::release): Release descriptor.
10043         (File_read::do_read): Make non-const.  Reopen descriptor.
10044         (File_read::read): Make non-const.
10045         (File_read::make_view): Reopen descriptor.
10046         (File_read::do_readv): Likewise.
10047         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10048         Update declarations.
10049         * layout.cc: Include "descriptors.h".
10050         (Layout::create_build_id): Use open_descriptor rather than open.
10051         * output.cc: Include "descriptors.h".
10052         (Output_file::open): Use open_descriptor rather than open.
10053         * archive.cc (Archive::const_iterator): Change Archive to be
10054         non-const.
10055         (Archive::begin, Archive::end): Make non-const.
10056         (Archive::count_members): Likewise.
10057         * archive.h (class Archive): Update declarations.
10058         * object.h (Object::read): Make non-const.
10059         * Makefile.am (CCFILES): Add descriptors.cc.
10060         (HFILES): Add descriptors.h.
10061         * Makefile.in: Rebuild.
10062
10063         PR 6716
10064         * gold.h: Always include <clocale>.  Add Solaris workarounds
10065         following code in binutils/sysdep.h.
10066
10067         PR 6048
10068         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10069         this->eh_frame_hdr_ is NULL before using it.
10070
10071         * dynobj.cc (Versions::Versions): Update comment.
10072
10073         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10074         the base version name.
10075
10076         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10077         array size plus one.
10078         (Stringpool_template::set_string_offsets): Subtract one from key
10079         before using it as an array index.
10080         (Stringpool_template::get_offset_with_length): Likewise.
10081         (Stringpool_template::write_to_buffer): Likewise.
10082         * stringpool.h (Stringpool_template::get_offset_from_key):
10083         Likewise.
10084
10085 2008-07-23  Ian Lance Taylor  <iant@google.com>
10086
10087         PR 6658
10088         * object.h (Merged_symbol_value::value): Do our best to handle a
10089         negative addend.
10090
10091         PR 6647
10092         * script.cc (Version_script_info::get_versions): Don't add empty
10093         version tag to return value.
10094         (Version_script_info::get_symbol_version_helper): Change return
10095         type to bool.  Add pversion parameter.  Change all callers.
10096         (script_register_vers_node): Don't require a non-NULL tag.
10097         * script.h (class Version_script_info): Update declarations.
10098         (Version_script_info::get_symbol_version): Change return type to
10099         bool.  Add version parameter.  Change all callers.
10100         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10101         handling.  Handle an empty version from a version script.
10102         (Symbol_table::define_special_symbol): Likewise.
10103         * testsuite/ver_test_10.script: New file.
10104         * testsuite/ver_test_10.sh: New file.
10105         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10106         (check_DATA): Add ver_test_10.syms.
10107         (ver_test_10.syms, ver_test_10.so): New target.
10108         * testsuite/Makefile.in: Rebuild.
10109
10110 2008-07-23  Simon Baldwin  <simonb@google.com>
10111
10112         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10113         to zero for undefined symbols from dynamic libraries.
10114
10115 2008-07-23  Ian Lance Taylor  <iant@google.com>
10116
10117         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10118         Change all callers.
10119         * symtab.h (class Symbol_table): Update declaration.
10120         * testsuite/ver_test_9.cc: New file.
10121         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10122         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10123         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10124         (ver_test_9.so, ver_test_9.o): New targets.
10125         * testsuite/Makefile.in: Rebuild.
10126
10127 2008-07-22  Ian Lance Taylor  <iant@google.com>
10128
10129         * options.h (class General_options): Define --check-sections.
10130         * layout.cc (Layout::set_segment_offsets): Handle
10131         --check-sections.
10132
10133         * options.h (class General_options): Define -n/--nmagic and
10134         -N/--omagic.
10135         * options.cc (General_options::finalize): For -n/--nmagic or
10136         -N/--omagic, set -static.
10137         * layout.cc (Layout::attach_allocated_section_to_segment): If
10138         -N/--omagic, don't put read-only and read-write sections in
10139         different segments.
10140         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10141         finding a read-only segment.
10142         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10143         don't set the minimum segment alignment to the common page size,
10144         and don't set the file offset to the address modulo the page size.
10145         * script-sections.cc (Script_sections::create_segments): If
10146         -n/--omagic, don't put read-only and read-write sections in
10147         different segments.
10148
10149         * cref.cc: New file.
10150         * cref.h: New file.
10151         * options.h (class General_options): Add --print-symbol-counts.
10152         * main.cc (main): Issue defined symbol report if requested.
10153         * archive.cc (Archive::interpret_header): Make into a const member
10154         function.
10155         (Archive::add_symbols): Call Input_objects::archive_start and
10156         archive_stop.
10157         (Archive::const_iterator): Define new class.
10158         (Archive::begin, Archive::end): New functions.
10159         (Archive::include_all_members): Rewrite to use iterator.
10160         (Archive::count_members): New function.
10161         * archive.h (class Archive): Update declarations.
10162         (Archive::filename): New function.
10163         * object.cc: Include "cref.h".
10164         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10165         (Sized_relobj::do_get_global_symbol_counts): New function.
10166         (Input_objects::add_object): Add object to cross-referencer.
10167         (Input_objects::archive_start): New function.
10168         (Input_objects::archive_stop): New function.
10169         (Input_objects::print_symbol_counts): New function.
10170         * object.h: Declare Cref and Archive.
10171         (Object::get_global_symbol_counts): New function.
10172         (Object::do_get_global_symbol_counts): New pure virtual function.
10173         (class Sized_relobj): Add defined_count_ field.  Update
10174         declarations.
10175         (class Input_objects): Add cref_ field.  Update constructor.
10176         Update declarations.
10177         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10178         defined_count_.
10179         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10180         symbol counts.
10181         (Sized_dynobj::do_get_global_symbol_counts): New function.
10182         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10183         defined_count_.  Update declarations.  Define Symbols typedef.
10184         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10185         parameter.  Change all callers.
10186         (Symbol_table::add_from_dynobj): Add sympointers and defined
10187         parameters.  Change all callers.
10188         * symtab.h (class Symbol_table): Update declarations.
10189         * Makefile.am (CCFILES): Add cref.cc.
10190         (HFILES): Add cref.h.
10191         * Makefile.in: Rebuild.
10192
10193 2008-07-22  Simon Baldwin  <simonb@google.com>
10194
10195         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10196         to zero when writing undefined symbols.
10197
10198 2008-07-22  Ian Lance Taylor  <iant@google.com>
10199
10200         * output.cc (Output_section::add_input_section): Don't try to
10201         merge empty merge sections.
10202
10203 2008-07-21  Craig Silverstein  <csilvers@google.com>
10204
10205         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10206         Include symbol version in error message.
10207
10208 2008-07-20  Chris Demetriou  <cgd@google.com>
10209
10210         * configure.ac (gold_cv_c_random_seed): New configured variable.
10211         (RANDOM_SEED_CFLAGS): New substituted variable.
10212         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10213         * configure: Rebuild.
10214         * Makefile.in: Likewise.
10215         * testsuite/Makefile.in: Likewise.
10216
10217 2008-07-18  Ian Lance Taylor  <iant@google.com>
10218
10219         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10220         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10221         * testsuite/ver_test_main.cc (main): Call t4.
10222         (t4, t4_2a): Define.
10223         * testsuite/ver_test_2.cc (t4_2): Define.
10224         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10225         * testsuite/ver_test_4.cc (t4_2a): Define.
10226         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10227         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10228
10229 2008-07-17  Ian Lance Taylor  <iant@google.com>
10230
10231         * dynobj.cc (Versions::add_def): If we give an error about a
10232         missing version, go ahead and create the version anyhow.
10233
10234 2008-07-10  Ian Lance Taylor  <iant@google.com>
10235
10236         Handle output sections with more than 0x7fffffff bytes.
10237         * object.h (class Relobj): Change map_to_output_ to
10238         output_sections_, and just keep a section pointer.  Change all
10239         uses.  Move comdat group support to Sized_relobj.
10240         (Relobj::is_section_specially_mapped): Remove.
10241         (Relobj::output_section): Remove poff parameter.  Change all
10242         callers.
10243         (Relobj::output_section_offset): New function.
10244         (Relobj::set_section_offset): Rewrite.
10245         (Relobj::map_to_output): Remove.
10246         (Relobj::output_sections): New function.
10247         (Relobj::do_output_section_offset): New pure virtual function.
10248         (Relobj::do_set_section_offset): Likewise.
10249         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10250         group support from Relobj.  Update declarations.
10251         (Sized_relobj::get_output_section_offset): New function.
10252         (Sized_relobj::do_output_section_offset): New function.
10253         (Sized_relobj::do_set_section_offset): New function.
10254         * object.cc (Relobj::output_section_address): Remove.
10255         (Sized_relobj::Sized_relobj): Initialize new fields.
10256         (Sized_relobj::include_section_group): Cast find_kept_object to
10257         Sized_relobj.
10258         (Sized_relobj::include_linkonce_section): Likewise.
10259         (Sized_relobj::do_layout): Use separate arrays for output section
10260         and output offset.
10261         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10262         output_sections.
10263         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10264         output_sections and section_offsets.
10265         (Sized_relobj::write_local_symbols): Likewise.
10266         (map_to_kept_section): Compute output address directly.
10267         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10268         output_sections and section_offsets.
10269         (Sized_relobj::write_sections): Likewise.
10270         (Sized_relobj::relocate_sections): Likewise.
10271         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10272         * output.h (class Output_reloc): Update declarations.  Change
10273         u2_.relobj to Sized_relobj*.
10274         (class Output_data_reloc): Change add functions to use
10275         Sized_relobj*.
10276         * output.cc (Output_reloc::Output_reloc): Change relobj to
10277         Sized_relobj*.
10278         (Output_reloc::local_section_offset): Change return type to
10279         Elf_Addr.  Use get_output_section_offset.
10280         (Output_reloc::get_address): Likewise.
10281         (Output_section::is_input_address_mapped): Don't call
10282         is_section_specially_mapped.
10283         (Output_section::output_offset): Likewise.
10284         (Output_section::output_address): Likewise.
10285         (Output_section::starting_output_address): Likewise.
10286         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10287         parameter to Sized_relobj*.
10288         (Copy_relocs::need_copy_reloc): Likewise.
10289         (Copy_relocs::save): Likewise.
10290         * copy-relocs.h (class Copy_relocs): Update declarations.
10291         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10292         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10293         * target-reloc.h (relocate_for_relocatable): Change
10294         offset_in_output_section type to Elf_Addr.  Change code that uses
10295         it as well.
10296         * layout.cc (Layout::layout): Always set *off.
10297         * mapfile.cc (Mapfile::print_input_section): Use
10298         output_section_offset.
10299         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10300         Sized_relobj*.
10301         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10302         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10303         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10304
10305 2008-07-03  Ian Lance Taylor  <iant@google.com>
10306
10307         * layout.cc (Layout::include_section): Do not discard unrecognized
10308         SHT_STRTAB sections.
10309
10310 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10311
10312         * script.cc (Lex::can_continue_name): Make '?' allowable in
10313         version-script names.
10314         * testsuite/version_script.map: Change glob pattern to use '?'
10315
10316 2008-06-30  Manish Singh  <yosh@gimp.org>
10317
10318         PR 6585
10319         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10320         Correct typo.
10321
10322 2008-06-30  Ian Lance Taylor  <iant@google.com>
10323
10324         PR 6660
10325         PR 6682
10326         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10327         versions]: Don't try to read the value in the contents, since we
10328         don't use it.  Use the template endianness when writing.
10329
10330 2008-06-25  Cary Coutant  <ccoutant@google.com>
10331
10332         * fileread.cc (File_read::make_view): Assert on zero-length view.
10333         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10334         symbol table when there are no symbols to read.
10335
10336 2008-06-23  Craig Silverstein  <csilvers@google.com>
10337
10338         * version.cc (version_string): Bump to 1.7
10339
10340 2008-06-18  Craig Silverstein  <csilvers@google.com>
10341
10342         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10343         constant 0xFFFF to type Valtype.
10344         (Powerpc_relocate_functions::rel16_ha): Likewise.
10345
10346 2008-06-17  Ian Lance Taylor  <iant@google.com>
10347
10348         * output.h (Output_section::Input_section): Initialize p2align_ to
10349         zero for Output_section_data constructors.
10350         (Output_section::Input_section::addralign): If not an input
10351         section, return the alignment of the Output_section_data.
10352         * testsuite/copy_test.cc: New file.
10353         * testsuite/copy_test_1.cc: New file.
10354         * testsuite/copy_test_2.cc: New file.
10355         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10356         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10357         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10358         (copy_test_1_pic.o, copy_test_1.so): New targets.
10359         (copy_test_2_pic.o, copy_test_2.so): New targets.
10360         * testsuite/Makefile.in: Rebuild.
10361
10362         * script-sections.cc (Script_sections::place_orphan): Initialize
10363         local variable exact.
10364
10365 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10366
10367         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10368
10369 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10370             David S. Miller  <davem@davemloft.net>
10371
10372         * powerpc.cc: New file.
10373         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10374         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10375         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10376         * Makefile.in: Rebuild.
10377
10378 2008-06-09  Ian Lance Taylor  <iant@google.com>
10379
10380         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10381         <exception>.
10382         (throwing, orig_terminate): New static variables.
10383         (terminate_handler): New static function.
10384         (t2): Set terminate handler.
10385
10386 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10387
10388         PR 6584
10389         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10390         alignment.
10391
10392 2008-05-30  Cary Coutant  <ccoutant@google.com>
10393
10394         * archive.cc (Archive::include_all_members) Correct to step
10395         over symbol table and extended name table in thin archives.
10396
10397 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10398
10399         PR 6407
10400         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10401         calculation.
10402
10403 2008-05-28  Caleb Howe  <cshowe@google.com>
10404
10405         * reduced_debug_output.cc: New file.
10406         * reduced_debug_output.h: New file.
10407         * options.h (class General_options): Add --strip-debug-non-line.
10408         * options.cc (General_options::finalize): Add strip_debug_non_line
10409         to the strip heirarchy.
10410         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10411         fields.
10412         * layout.cc: Include "reduced_debug_output.h".
10413         (Layout::Layout): Initialize new fields.
10414         (line_only_debug_sections): New static array.
10415         (is_lines_only_debug_sections): New static inline function.
10416         (Layout::include_section): Handle --strip-debug-non-line.
10417         (Layout::make_output_section): If --strip-debug-non-line, build
10418         new output sections for .debug_abbrev and .debug_info.
10419         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10420         gold.  Warn about possible overflow.
10421         (read_signed_LEB_128): Likewise.
10422         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10423         (read_signed_LEB_128): Declare.
10424         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10425         (HFILES): Add reduced_debug_output.h.
10426         * Makefile.in: Rebuild.
10427
10428 2008-05-21  Ian Lance Taylor  <iant@google.com>
10429
10430         * mapfile.cc: New file.
10431         * mapfile.h: New file.
10432         * options.h (class General_options): Add -M/--print-map and -Map.
10433         * options.cc (General_options::finalize): Make -M equivalent to
10434         -Map -.
10435         * main.cc: Include <cstdio> and "mapfile.h".
10436         (main): Open mapfile if requested.
10437         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10438         constructor.  Change caller.
10439         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10440         (queue_middle_tasks): Likewise.
10441         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10442         declarations.
10443         * archive.cc: Include "mapfile.h".
10444         (Archive::add_symbols): Add mapfile parameter.  Change all
10445         callers.  Pass mapfile, symbol, and reason to include_member.
10446         (Archive::include_all_members): Add mapfile parameter.  Change all
10447         callers.
10448         (Archive::include_member): Add mapfile, sym, and why parameters.
10449         Change all callers.  Report inclusion to map file.
10450         * archive.h: Include "fileread.h".
10451         (class Archive): Update declarations.
10452         (Archive::file): New const method.
10453         (class Add_archive_symbols): Add mapfile_ field.  Update
10454         constructor.  Change all callers.
10455         * readsyms.h (class Read_symbols): Likewise.
10456         (class Finish_group): Likewise.
10457         (class Read_script): Likewise.
10458         * common.cc: Include "mapfile.h".
10459         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10460         all callers.
10461         (Symbol_table::do_allocate_commons): Likewise.
10462         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10463         symbol allocation to mapfile.
10464         * common.h (class Allocate_commons_task): Add mapfile_ field.
10465         Update constructor.  Change all callers.
10466         * symtab.h (class Symbol_table): Update declarations.
10467         * layout.cc: Include "mapfile.h".
10468         (Layout_task_runner::run): Print information to mapfile.
10469         (Layout::create_gold_note): Change Output_data_fixed_space to
10470         Output_data_zero_fill.
10471         (Layout::create_build_id): Likewise.
10472         (Layout::print_to_mapfile): New function.
10473         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10474         constructor.  Change caller.
10475         (class Layout): Declare print_to_mapfile.
10476         * output.cc (Output_section::Input_section::print_to_mapfile): New
10477         function.
10478         (Output_section::add_input_section): If producing a map, always
10479         add to input_sections_ list.
10480         (Output_section::do_print_to_mapfile): New function.
10481         (Output_segment::print_sections_to_mapfile): New function.
10482         (Output_segment::print_section_list_to_mapfile): New function.
10483         * output.h: Include "mapfile.h".
10484         (Output_data::print_to_mapfile): New function.
10485         (Output_data::do_print_to_mapfile): New virtual function.
10486         (Output_segment_headers::do_print_to_mapfile): New function.
10487         (Output_file_header::do_print_to_mapfile): New function.
10488         (Output_data_const::do_print_to_mapfile): New function.
10489         (class Output_data_const_buffer): Add map_name_ field.  Update
10490         constructor.  Change all callers.  Add do_print_to_mapfile
10491         function.
10492         (class Output_data_fixed_space): Likewise.
10493         (class Output_data_space): Likewise.
10494         (class Output_data_zero_fill): New class.
10495         (Output_data_strtab::do_print_to_mapfile): New function.
10496         (Output_data_reloc_base::do_print_to_mapfile): New function.
10497         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10498         (Output_data_group::do_print_to_mapfile): New function.
10499         (Output_data_got::do_print_to_mapfile): New function.
10500         (Output_data_dynamic::do_print_to_mapfile): New function.
10501         (Output_symtab_xindex::do_print_to_mapfile): New function.
10502         (class Output_section): Declare do_print_to_mapflie.  Declare
10503         print_to_mapfile in Input_section.
10504         (class Output_segment): Declare new functions.
10505         * object.h (Sized_relobj::symbol_count): New function.
10506         * script-sections.cc
10507         (Output_section_element_dot_assignment::set_section_addresses):
10508         Change Output_data_fixed_space to Output_data_zero_fill.
10509         (Output_data_expression::do_print_to_mapfile): New function.
10510         * script.cc (read_input_script): Add mapfile parameter.  Change
10511         all callers.
10512         * script.h (read_input_script): Update declaration.
10513         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10514         (Eh_frame::do_print_to_mapfile): New function.
10515         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10516         (Output_merge_string::do_print_to_mapfile): New function.
10517         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10518         function.
10519         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10520         function.
10521         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10522         function.
10523         * Makefile.am (CCFILES): Add mapfile.cc.
10524         (HFILES): Add mapfile.h.
10525         * Makefile.in: Rebuild.
10526
10527 2008-05-19  Ian Lance Taylor  <iant@google.com>
10528
10529         * options.h (class General_options): Add -z relro.
10530         * layout.cc (Layout::Layout): Initialize relro_segment_.
10531         (Layout::add_output_section_data): Return the output section.
10532         (Layout::make_output_section): Rcognize relro sections and mark
10533         them appropriately.
10534         (Layout::attach_allocated_section_to_segment): Put relro sections
10535         in a PT_GNU_RELRO segment.
10536         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10537         section as relro.
10538         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10539         PT_TLS segments.
10540         (Layout::linkonce_mapping): Map d.rel.ro.local to
10541         .data.rel.ro.local.
10542         (Layout::output_section_name): Us .data.rel.ro.local for any
10543         section which begins with that.
10544         * layout.h (class Layout): Update add_output_section_data
10545         declaration.  Add relro_segment_ field.
10546         * output.cc (Output_section::Output_section): Initialize is_relro_
10547         and is_relro_local_ fields.
10548         (Output_segment::add_output_section): Group relro sections.
10549         (Output_segment::is_first_section_relro): New function.
10550         (Output_segment::maximum_alignment): If there is a relro section,
10551         align the segment to the common page size.
10552         (Output_segment::set_section_addresses): Track whether we are
10553         looking at relro sections.  If the last section is a relro
10554         section, align to the common page size.
10555         (Output_segment::set_section_list_addresses): Add in_relro
10556         parameter.  Change all callers.  Align to the page size when
10557         moving from relro to non-relro section.
10558         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10559         segment.
10560         * output.h (class Output_section): Add is_relro_ and
10561         is_relro_local_ fields.
10562         (Output_section::is_relro): New function.
10563         (Output_section::set_is_relro): New function.
10564         (Output_section::is_relro_local): New function.
10565         (Output_section::set_is_relro_local): New function.
10566         (class Output_segment): Update declarations.
10567         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10568         * sparc.cc (Target_sparc::got_section): Likewise.
10569         * x86_64.cc (Target_x86_64::got_section): Likewise.
10570         * testsuite/relro_test_main.cc: New file.
10571         * testsuite/relro_test.cc: New file.
10572         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10573         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10574         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10575         (relro_test.so, relro_test_pic.o): New targets.
10576         * testsuite/Makefile.in: Rebuild.
10577
10578 2008-05-16  Ian Lance Taylor  <iant@google.com>
10579
10580         * output.cc (Output_segment::add_output_section): Remove front
10581         parameter.
10582         * output.h (class Output_segment): Remove
10583         add_initial_output_section and overloaded add_output_section.
10584         Update declaration of remaining add_output_section.
10585         * layout.cc (Layout::create_interp): Call add_output_section
10586         rather than add_initial_output_section.
10587         (Layout::finish_dynamic_section): Likewise.
10588
10589         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10590         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10591         know the dynamic type.
10592         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10593         field.  Initialize it in constructor.
10594         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10595         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10596         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10597         reloc.
10598
10599         * output.cc (Output_reloc::get_address): Change return type to
10600         Elf_Addr.
10601         * output.h (class Output_reloc): Update get_address declaration.
10602         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10603         for section addresses.
10604
10605 2008-05-09  Ian Lance Taylor  <iant@google.com>
10606
10607         PR 6493
10608         * gold.cc (gold_nomem): Use return value of write.
10609
10610 2008-05-08  Ian Lance Taylor  <iant@google.com>
10611
10612         * symtab.c (Symbol::init_base_output_data): Add version
10613         parameter.  Change all callers.
10614         (Symbol::init_base_output_segment): Likewise.
10615         (Symbol::init_base_constant): Likewise.
10616         (Symbol::init_base_undefined): Likewise.
10617         (Sized_symbol::init_output_data): Likewise.
10618         (Sized_symbol::init_output_segment): Likewise.
10619         (Sized_symbol::init_constant): Likewise.
10620         (Sized_symbol::init_undefined): Likewise.
10621         (Symbol_table::do_define_in_output_data): If the new symbol has a
10622         version, mark it as the default.
10623         (Symbol_table::do_define_in_output_segment): Likewise.
10624         (Symbol_table::do_define_as_constant): Likewise.
10625         * symtab.h (class Symbol): Update declarations.
10626         (class Sized_symbol): Likewise.
10627         * resolve.cc (Symbol::override_version): New function.
10628         (Symbol::override_base): Call override_version.
10629         (Symbol::override_base_with_special): Likewise.
10630         * testsuite/ver_script_8.script: New file.
10631         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10632         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10633         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10634         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10635
10636 2008-05-06  Ian Lance Taylor  <iant@google.com>
10637
10638         PR 6049
10639         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10640         functions.
10641         (class General_options): Remove existing --undefined, and add
10642         --no-undefined instead.  Add new --undefined as synonym for -u.
10643         * archive.cc (Archive::add_symbols): Check whether symbol was
10644         named with -u.
10645         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10646         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10647         all uses.  Add IS_UNDEFINED.  Update declarations to split
10648         different versions of init_base.  Declare init_base_undefined.
10649         (Symbol::is_defined): Handle IS_UNDEFINED.
10650         (Symbol::is_undefined): Likewise.
10651         (Symbol::is_weak_undefined): Call is_undefined.
10652         (Symbol::is_absolute): Handle IS_CONSTANT.
10653         (class Sized_symbol): Update declarations to split different
10654         versions of init.  Declare init_undefined.
10655         (class Symbol_table): Declare new functions.
10656         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10657         Change all callers.
10658         (Symbol::init_base_output_data): Likewise.
10659         (Symbol::init_base_output_segment): Likewise.
10660         (Symbol::init_base_constant): Likewise.
10661         (Symbol::init_base_undefined): New function.
10662         (Sized_symbol::init_object): Rename from init.  Change all
10663         callers.
10664         (Sized_symbol::init_output_data): Likewise.
10665         (Sized_symbol::init_output_segment): Likewise.
10666         (Sized_symbol::init_constant): Likewise.
10667         (Sized_symbol::init_undefined): New function.
10668         (Symbol_table::add_undefined_symbols_from_command_line): New
10669         function.
10670         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10671         function.
10672         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10673         (Symbol::output_section): Likewise.
10674         (Symbol::set_output_section): Likewise.
10675         (Symbol_table::sized_finalize_symbol): Likewise.
10676         (Symbol_table::sized_write_globals): Likewise.
10677         * resolve.cc (Symbol_table::should_override): Likewise.
10678         (Symbol::override_base_with_special): Likewise.
10679
10680         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10681         symbol, change it to have default visibility.
10682         * testsuite/protected_1.cc: New file.
10683         * testsuite/protected_2.cc: New file.
10684         * testsuite/protected_3.cc: New file.
10685         * testsuite/protected_main_1.cc: New file.
10686         * testsuite/protected_main_2.cc: New file.
10687         * testsuite/protected_main_3.cc: New file.
10688         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10689         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10690         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10691         (protected_1.so): New target.
10692         (protected_1_pic.o, protected_2_pic.o): New targets.
10693         (protected_3_pic.o): New target.
10694         (check_PROGRAMS): Add protected_2.
10695         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10696         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10697         * testsuite/Makefile.in: Rebuild.
10698
10699         * options.h (DEFINE_var): Add set_user_set_##varname__.
10700         (DEFINE_bool_alias): New macro.
10701         (class General_options): Define -Bstatic using DEFINE_bool_alias
10702         rather than DEFINE_special.  Add --undefined as an alias for -z
10703         defs.
10704         * options.cc (General_options::parse_Bstatic): Remove.
10705
10706         * options.h (class General_options): Add --fatal-warnings.
10707         * main.cc (main): Implement --fatal-warnings.
10708         * errors.h (Errors::warning_count): New function.
10709
10710         * options.h (class General_options): Add -Bsymbolic-functions.
10711         * symtab.h (Symbol::is_preemptible): Check for
10712         -Bsymbolic-functions.
10713
10714 2008-05-05  Ian Lance Taylor  <iant@google.com>
10715
10716         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10717         as noVARNAME rather than no-VARNAME.
10718         (class General_options): Add option -z combreloc.
10719         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10720         get_address.
10721         (Output_reloc::sort_before) [SHT_REL]: New function.
10722         (Output_reloc::sort_before) [SHT_RELA]: New function.
10723         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10724         Sort_relocs_comparison.
10725         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10726         parameter.  Change all callers.
10727         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10728         sort_relocs parameter.  Change all callers.
10729         * output.cc (Output_reloc::get_address): New function, broken out
10730         of write_rel.
10731         (Output_reloc::write_rel): Call it.
10732         (Output_reloc::compare): New function.
10733         (Output_data_reloc_base::do_write): Optionally sort relocs.
10734
10735         * configure.ac: If targ_extra_obj is set, link it in.
10736         * configure.tgt: Initialize all variables.
10737         (x86_64*): Set targ_extra_obj and targ_extra_size.
10738         * configure: Rebuild.
10739
10740         * object.cc (Sized_relobj::include_section_group): Adjust section
10741         indexes read from group data.  Build vector to pass to
10742         layout_group.
10743         * layout.cc (Layout::layout_group): Add flags and shndxes
10744         parameters.  Remove contents parameter.  Change caller.  Update
10745         explicit instantiations.
10746         * layout.h (class Layout): Update layout_group declaration.
10747         * output.cc (Output_data_group::Output_data_group): Add flags and
10748         input_shndxes parameters.  Remove contents parameter.  Change
10749         caller.
10750         (Output_data_group::do_write): Change input_sections_ to
10751         input_shndxes_.
10752         * output.h (class Output_data_group): Update constructor
10753         declaration.  Rename input_sections_ to input_shndxes_.
10754         * testsuite/many_sections_test.cc: Add template.
10755
10756 2008-04-30  Cary Coutant  <ccoutant@google.com>
10757
10758         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10759
10760         * layout.cc (Layout::include_section): Refactored check for debug
10761         info section.
10762         (Layout::add_comdat): Add new parameters.  Change type
10763         of signature parameter.  Add object and shndx to signatures table.
10764         (Layout::find_kept_object): New function.
10765         * layout.h: Include <cstring>.
10766         (Layout::is_debug_info_section): New function.
10767         (Layout::add_comdat): Add new parameters.
10768         (Layout::find_kept_object): New function.
10769         (Layout::Kept_section): New struct.
10770         (Layout::Signatures): Change type of map range.
10771         * object.cc (Relobj::output_section_address): New function.
10772         (Sized_relobj::include_section_group): Add new parameters.  Change
10773         calls to Layout::add_comdat.  Change to build table of kept comdat
10774         groups and table mapping discarded sections to kept sections.
10775         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10776         (Sized_relobj::do_layout): Change calls to include_section_group and
10777         include_linkonce_section.
10778         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10779         value to zero when section is discarded.
10780         (Sized_relobj::map_to_kept_section): New function.
10781         * object.h (Relobj::output_section_address): New function.
10782         (Relobj::Comdat_group): New type.
10783         (Relobj::find_comdat_group): New function.
10784         (Relobj::Comdat_group_table): New type.
10785         (Relobj::Kept_comdat_section): New type.
10786         (Relobj::Kept_comdat_section_table): New type.
10787         (Relobj::add_comdat_group): New function.
10788         (Relobj::set_kept_comdat_section): New function.
10789         (Relobj::get_kept_comdat_section): New function.
10790         (Relobj::comdat_groups_): New field.
10791         (Relobj::kept_comdat_sections_): New field.
10792         (Symbol_value::input_value): Update comment.
10793         (Sized_relobj::map_to_kept_section) New function.
10794         (Sized_relobj::include_linkonce_section): Add new parameter.
10795         * target-reloc.h (Comdat_behavior): New type.
10796         (get_comdat_behavior): New function.
10797         (relocate_section): Add code to map a discarded section to the
10798         corresponding kept section when applying a relocation.
10799
10800 2008-04-30  Craig Silverstein  <csilvers@google.com>
10801
10802         * dwarf_reader.cc (next_generation_count): New static var.
10803         (Addr2line_cache_entry): New struct.
10804         (addr2line_cache): New static var.
10805         (Dwarf_line_info::one_addr2line): Added caching.
10806         (Dwarf_line_info::clear_addr2line_cache): New function.
10807         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10808         cache-size parameter.
10809         (Dwarf_line_info::one_addr2line_cache): New function.
10810         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10811         new cache-size argument to one_addr2line(), and clear cache.
10812
10813 2008-04-28  Cary Coutant  <ccoutant@google.com>
10814
10815         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10816         R_386_PC8 relocations.
10817
10818 2008-04-23  Ian Lance Taylor  <iant@google.com>
10819
10820         * object.cc (Sized_relobj::include_section_group): Check for
10821         invalid section group.
10822
10823         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10824         header size.
10825
10826         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10827         than read for file header.
10828         * archive.cc (Archive::include_member): Likewise.
10829
10830 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10831
10832         * aclocal.m4: Regenerate.
10833         * configure: Regenerate.
10834
10835 2008-04-19  Ian Lance Taylor  <iant@google.com>
10836
10837         * version.cc (version_string): Bump to 1.6.
10838
10839         * testsuite/Makefile.am (many_sections_r_test): New target.
10840         (many_sections_r_test_SOURCES): Remove.
10841         (many_sections_r_test_DEPENDENCIES): Remove.
10842         (many_sections_r_test_LDFLAGS): Remove.
10843         (many_sections_r_test_LDADD): Remove.
10844
10845         * object.cc (Sized_relobj::do_add_symbols): Always pass
10846         local_symbol_count_ to add_from_relobj.
10847
10848         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10849         every thousand variables.
10850         * testsuite/Makefile.in: Rebuild.
10851
10852         * object.cc (Xindex::initialize_symtab_xindex): New function.
10853         (Xindex::read_symtab_xindex): New function.
10854         (Xindex::sym_xindex_to_shndx): New function.
10855         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10856         available.
10857         (Sized_relobj::do_initialize_xindex): New function.
10858         (Sized_relobj::do_read_symbols): Adjust section links.
10859         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10860         parameter.  Change all callers.
10861         (Sized_relobj::include_section_group): Adjust section links and
10862         symbol section indexes.
10863         (Sized_relobj::do_layout): Adjust section links.
10864         (Sized_relobj::do_count_local_symbols): Adjust section links and
10865         symbol section indexes.
10866         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10867         ordinary and special symbols.
10868         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10869         dynsym_xindex parameters.  Change all callers.  Adjust section
10870         links.  Use SHN_XINDEX when needed.
10871         (Sized_relobj::get_symbol_location_info): Adjust section links.
10872         Don't get fooled by special symbols.
10873         * object.h (class Xindex): Define.
10874         (class Object): Add xindex_ parameter.  Declare virtual functoin
10875         do_initialize_xindex.
10876         (Object::adjust_sym_shndx): New function.
10877         (Object::set_xindex): New protected function.
10878         (class Symbol_value): Add is_ordinary_shndx_ field.
10879         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10880         (Symbol_value::value): Assert ordinary section.
10881         (Symbol_value::initialize_input_to_output_map): Likewise.
10882         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10883         Change all callers.
10884         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10885         all callers.
10886         (class Sized_relobj): Update declarations.
10887         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10888         parameter.  Change all callers.
10889         (Sized_relobj::adjust_shndx): New function.
10890         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10891         field.
10892         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10893         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10894         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10895         (Sized_dynobj::read_dynsym_section): Adjust section links.
10896         (Sized_dynobj::read_dynamic): Likewise.
10897         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10898         section links.
10899         (Sized_dynobj::do_initialize_xindex): New function.
10900         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10901         do_initialize_xindex.
10902         (Sized_dynobj::adjust_shndx): New function.
10903         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10904         dynsym_xindex_ fields.
10905         (Layout::finalize): Add a call to set_section_indexes before
10906         creating the symtab sections.
10907         (Layout::set_section_indexes): Don't do anything if the section
10908         already has a section index.
10909         (Layout::create_symtab_sections): Add shnum parameter.  Change
10910         caller.  Create .symtab_shndx section if needed.
10911         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10912         caller.
10913         (Layout::allocated_output_section_count): New function.
10914         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10915         needed.
10916         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10917         fields.  Update declarations.
10918         (Layout::symtab_xindex): New function.
10919         (Layout::dynsym_xindex): New function.
10920         (class Write_symbols_task): Add layout_ field.
10921         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10922         Change caller.
10923         * output.cc (Output_section_headers::Output_section_headers): Add
10924         shstrtab_section parameter.  Change all callers.
10925         (Output_section_headers::do_sized_write): Store overflow values
10926         for section count and section string table section index in
10927         section header zero.
10928         (Output_file_header::do_sized_write): Check for overflow of
10929         section count and section string table section index.
10930         (Output_symtab_xindex::do_write): New function.
10931         (Output_symtab_xindex::endian_do_write): New function.
10932         * output.h (class Output_section_headers): Add shstrtab_section_.
10933         Update declarations.
10934         (class Output_symtab_xindex): Define.
10935         (Output_section::has_out_shndx): New function.
10936         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10937         field.
10938         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10939         Change all callers.
10940         (Sized_symbol::init): Likewise.
10941         (Symbol::output_section): Check for ordinary symbol.
10942         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10943         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10944         callers.
10945         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10946         Change all callers.  Simplify handling of symbols from sections
10947         not included in the link.
10948         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10949         distinction.
10950         (Weak_alias_sorter::operator()): Assert that symbols are
10951         ordinary.
10952         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10953         distinction.
10954         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10955         parameters.  Change all callers.
10956         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10957         symbol distinction.  Use SHN_XINDEX when needed.
10958         (Symbol_table::write_section_symbol): Add symtab_xindex
10959         parameter.  Change all callers.
10960         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10961         SHN_XINDEX when needed.
10962         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10963         declarations.
10964         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10965         (Symbol::is_defined): Check is_ordinary.
10966         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10967         (Symbol::is_absolute, Symbol::is_common): Likewise.
10968         (class Sized_symbol): Update declarations.
10969         (class Symbol_table): Update declarations.
10970         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10971         parameters.  Change all callers.
10972         (Sized_symbol::override): Likewise.
10973         (Symbol_table::override): Likewise.
10974         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10975         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10976         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10977         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10978         to be in an ordinary section.
10979         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10980         object and is_ordinary parameters.  Change all callers.
10981         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10982         Change all callers.  Don't add undefined or non-ordinary symbols
10983         to reloc_map_.
10984         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10985         Change all callers.
10986         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10987         declarations.
10988         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10989         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10990         (Sized_relobj::relocate_sections): Likewise.
10991         * target-reloc.h (scan_relocs): Adjust section symbol index.
10992         (scan_relocatable_relocs): Likewise.
10993         * i386.cc (Scan::local): Check for ordinary symbols.
10994         * sparc.cc (Scan::local): Likewise.
10995         * x86_64.cc (Scan::local): Likewise.
10996         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10997         to symbol_section_and_value.
10998         * testsuite/many_sections_test.cc: New file.
10999         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11000         (check_PROGRAMS): Add many_sections_test.
11001         (many_sections_test_SOURCES): Define.
11002         (many_sections_test_DEPENDENCIES): Define.
11003         (many_sections_test_LDFLAGS): Define.
11004         (BUILT_SOURCES): Add many_sections_define.h.
11005         (many_sections_define.h): New target.
11006         (BUILT_SOURCES): Add many_sections_check.h.
11007         (many_sections_check.h): New target.
11008         (check_PROGRAMS): Add many_sections_r_test.
11009         (many_sections_r_test_SOURCES): Define.
11010         (many_sections_r_test_DEPENDENCIES): Define.
11011         (many_sections_r_test_LDFLAGS): Define.
11012         (many_sections_r_test_LDADD): Define.
11013         (many_sections_r_test.o): New target.
11014         * testsuite/Makefile.in: Rebuild.
11015
11016 2008-04-17  Cary Coutant  <ccoutant@google.com>
11017
11018         * errors.cc (Errors::info): New function.
11019         (gold_info): New function.
11020         * errors.h (Errors::info): New function.
11021         * gold.h (gold_info): New function.
11022         * object.cc (Input_objects::add_object): Print trace output.
11023         * options.cc (options::parse_set): New function.
11024         (General_options::parse_wrap): Deleted.
11025         (General_options::General_options): Deleted initializer.
11026         * options.h (options::String_set): New typedef.
11027         (options::parse_set): New function.
11028         (DEFINE_set): New macro.
11029         (General_options::wrap): Changed to use DEFINE_set. Changed
11030         callers of any_wrap_symbols and is_wrap_symbol.
11031         (General_options::trace, General_options::trace_symbol):
11032         New options.
11033         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11034         (General_options::wrap_symbols_): Deleted.
11035         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11036
11037 2008-04-17  David S. Miller  <davem@davemloft.net>
11038
11039         * options.cc (General_options::parse_V): New function.
11040         * options.h: Add entries for -V and -Qy.
11041
11042 2008-04-17  Ian Lance Taylor  <iant@google.com>
11043
11044         * common.cc (Symbol_table::allocate_commons): Remove options
11045         parameter.  Change caller.
11046         (Symbol_table::do_allocate_commons): Remove options parameter.
11047         Change caller.  Just call do_allocate_commons_list twice.
11048         (Symbol_table::do_allocate_commons_list): New function, broken out
11049         of do_allocate_commons.
11050         * common.h (class Allocate_commons_task): Remove options_ field.
11051         Update constructor.
11052         * symtab.cc (Symbol_table::Symbol_table): Initialize
11053         tls_commons_.
11054         (Symbol_table::add_from_object): Put TLS common symbols on
11055         tls_commons_ list.
11056         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11057         which are IN_OUTPUT_DATA.
11058         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11059         allocate_commons and do_allocate_commons declarations.  Declare
11060         do_allocate_commons_list.
11061         * gold.cc (queue_middle_tasks): Update creation of
11062         Allocate_commons_task to not pass options.
11063         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11064         (TLS_TEST_C_FLAGS): New variable.
11065         (tls_test_c_pic.o): New target.
11066         (tls_test_shared.so): Link in tls_test_c_pic.o.
11067         (tls_test_c_pic_ie.o): New target.
11068         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11069         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11070         (tls_test_c.o): New target.
11071         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11072         (tls_pic_test_LDADD): Likewise.
11073         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11074         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11075         (tls_test_c_gnu2.o): New target.
11076         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11077         tls_test_c_gnu2.o.
11078         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11079         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11080         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11081         * testsuite/tls_test.cc: Include "config.h".
11082         (t_last): Call t11_last.
11083         * testsuite/tls_test.h (t11, t11_last): Declare.
11084         * testsuite/tls_test_c.c: New file.
11085         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11086         * configure.ac: Check for OpenMP support.
11087         * configure, config.in, Makefile.in: Rebuild.
11088         * testsuite/Makefile.in: Rebuild.
11089
11090 2008-04-16  Cary Coutant  <ccoutant@google.com>
11091
11092         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11093         (Target_i386::tls_base_symbol_defined_): New field.
11094         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11095         (Target_i386::Scan::global): Likewise.
11096         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11097         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11098         (Target_x86_64::tls_base_symbol_defined_): New field.
11099         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11100         (Target_x86_64::Scan::global): Likewise.
11101
11102 2008-04-16  Cary Coutant  <ccoutant@google.com>
11103
11104         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11105         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11106         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11107         building shared libraries.
11108         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11109         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11110         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11111         * testsuite/Makefile.in: Rebuild.
11112         * testsuite/weak_undef.h: New file.
11113         * testsuite/weak_undef_file1.cc: Add extra test cases.
11114         * testsuite/weak_undef_file2.cc: Likewise.
11115         * testsuite/weak_undef_test.cc: Likewise.
11116
11117 2008-04-16  David S. Miller  <davem@davemloft.net>
11118
11119         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11120         Add issued_non_pic_error_ field.  Declare check_non_pic.
11121         (Target_sparc::Scan::check_non_pic): New function.
11122         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11123         (Target_sparc::Scan::global): Likewise.
11124
11125         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11126         * configure: Rebuild.
11127
11128         * options.h (DEFINE_enable): New macro.
11129         (new_dtags): New enable option.
11130         (initfirst, interpose, loadfltr, nodefaultlib,
11131         nodelete, nodlopen, nodump): New -z options.
11132         * layout.cc (Layout:finish_dynamic_section): If new
11133         dtags enabled, emit DT_RUNPATH.  Also, emit a
11134         DT_FLAGS_1 containing any specified -z flags.
11135
11136 2008-04-16  Ian Lance Taylor  <iant@google.com>
11137
11138         * copy-relocs.cc: New file.
11139         * copy-relocs.h: New file.
11140         * reloc.cc: Remove Copy_relocs code.
11141         * reloc.h: Likewise.
11142         * reloc-types.h (struct Reloc_types) [both versions]: Add
11143         get_reloc_addend_noerror.
11144         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11145         variants of add_global which take an addend which must be zero.
11146         * i386.cc: Include "copy-relocs.h".
11147         (class Target_i386): Change type of copy_relocs_ to variable,
11148         update initializer.
11149         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11150         Change all callers.
11151         (Target_i386::do_finalize_sections): Change handling of
11152         copy_relocs_.
11153         * sparc.cc: Include "copy-relocs.h".
11154         (class Target_sparc): Change type of copy_relocs_ to variable,
11155         update initializer.
11156         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11157         Change all callers.
11158         (Target_sparc::do_finalize_sections): Change handling of
11159         copy_relocs_.
11160         * x86_64.cc: Include "copy-relocs.h".
11161         (class Target_x86_64): Change type of copy_relocs_ to variable,
11162         update initializer.
11163         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11164         class.  Change all callers.
11165         (Target_x86_64::do_finalize_sections): Change handling of
11166         copy_relocs_.
11167         * Makefile.am (CCFILES): Add copy-relocs.cc.
11168         (HFILES): Add copy-relocs.h.
11169
11170         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11171
11172         * testsuite/script_test_4.sh: Permit leading zeroes.
11173
11174 2008-04-15  Ian Lance Taylor  <iant@google.com>
11175
11176         * script-sections.cc (Script_sections::create_segments): Use
11177         header_size_adjustment even when there is enough room for the
11178         headers.
11179         * testsuite/script_test_4.sh: New file.
11180         * testsuite/script_test_4.t: New file.
11181         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11182         (check_DATA): Add script_test_4.stdout.
11183         (MOSTLYCLEANFILES): Likewise.
11184         (script_test_4): New target.
11185         (script_test_4.stdout): New target.
11186         * testsuite/Makefile.in: Rebuild.
11187
11188         * sparc.cc: Add definitions for Output_data_plt_sparc class
11189         constants.
11190
11191 2008-04-14  David S. Miller  <davem@davemloft.net>
11192
11193         * sparc.cc: New file.
11194         * Makefile.am (TARGETSOURCES): Add sparc.cc
11195         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11196         * configure.tgt: Document targ_extra_size and
11197         targ_extra_big_endian.  Add entries for sparc-* and
11198         sparc64-*.
11199         * configure.ac: Handle targ_extra_size and
11200         targ_extra_big_endian.
11201         * Makefile.in: Rebuild.
11202         * configure: Likewise.
11203         * po/POTFILES.in: Likewise.
11204         * po/gold.pot: Likewise.
11205
11206 2008-04-14  Ian Lance Taylor  <iant@google.com>
11207
11208         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11209         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11210         in the name/type/flags to section mapping.  Don't call
11211         allocate_output_section.
11212         (Layout::choose_output_section): Change parameter from adjust_name
11213         to is_input_section.  Don't permit input sections after sections
11214         are attached to segments.  Don't call allocate_output_section.
11215         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11216         not write_enable_output_section.
11217         (Layout::make_output_section): Don't push to
11218         unattached_section_list_ nor call attach_to_segment.  Call
11219         attach_section_to_segment if sections are attached.
11220         (Layout::attach_sections_to_segments): New function.
11221         (Layout::attach_section_to_segment): New function.
11222         (Layout::attach_allocated_section_to_segment): Rename from
11223         attach_to_segment.  Remove flags parameter.
11224         (Layout::allocate_output_section): Remove function.
11225         (Layout::write_enable_output_section): Remove function.
11226         * layout.h (class Layout): Update for above changes.  Add new
11227         field sections_are_attached_.
11228         * output.h (Output_section::update_flags_for_input_section): New
11229         function.
11230         * output.cc (Output_section::add_input_section): Call
11231         update_flags_for_input_section.
11232         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11233
11234 2008-04-11  Cary Coutant  <ccoutant@google.com>
11235
11236         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11237         thought unnecessary.
11238         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11239
11240 2008-04-11  Ian Lance Taylor  <iant@google.com>
11241
11242         * output.h (class Output_section_data): Remove inline definition
11243         of set_addralign.
11244         * output.cc (Output_section_data::set_addralign): New function.
11245
11246 2008-04-11  Cary Coutant  <ccoutant@google.com>
11247
11248         Add support for TLS descriptors for i386 and x86_64.
11249         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11250         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11251         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11252         GOT_TYPE_TLS_DESC.
11253         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11254         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11255         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11256         relocations.
11257         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11258         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11259         Fix problem with initial-exec relocations.
11260         (Target_i386::Relocate::relocate_tls): Likewise.
11261         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11262         relaxation.
11263         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11264         support for section-plus-offset dynamic table entries.
11265         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11266         (Output_data_dynamic::Dynamic_entry): Add support for
11267         section-plus-offset dynamic table entries.
11268         (Output_data_dynamic::Classification): Likewise.
11269         (Output_data_dynamic::classification_): Renamed offset_.
11270         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11271         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11272         (Target_x86_64::make_plt_section): New function.
11273         (Target_x86_64::reserve_tlsdesc_entries): New function.
11274         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11275         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11276         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11277         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11278         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11279         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11280         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11281         add extra PLT entry for TLS descriptors.
11282         (Output_data_plt_x86_64::got_): New field.
11283         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11284         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11285         fields.
11286         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11287         descriptors.
11288         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11289         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11290         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11291         R_386_TLS_DESC_CALL relocations.
11292         (Target_x86_64::Scan::global): Likewise.
11293         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11294         for TLS descriptors.
11295         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11296         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11297         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11298         GD-to-IE relaxation.
11299         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11300         and TLS_DESCRIPTORS.
11301         * Makefile.in: Rebuild.
11302         * configure: Rebuild.
11303         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11304         (tls_test_shared2.so): New target.
11305         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11306         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11307         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11308         (tls_shared_gd_to_ie_test_LDADD): New variable.
11309         (tls_shared_gnu2_gd_to_ie_test): New target.
11310         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11311         New targets.
11312         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11313         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11314         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11315         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11316         (tls_shared_gnu2_test): New target.
11317         (tls_test_gnu2_shared.so): New target.
11318         (tls_shared_gnu2_test_SOURCES): New variable.
11319         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11320         (tls_shared_gnu2_test_LDFLAGS): New variable.
11321         (tls_shared_gnu2_test_LDADD): New variable.
11322         * testsuite/Makefile.in: Rebuild.
11323         * testsuite/Makefile.
11324
11325 2008-04-11  Ian Lance Taylor  <iant@google.com>
11326
11327         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11328         justsyms.t.
11329         * testsuite/Makefile.in: Rebuild.
11330
11331         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11332         long.
11333         * testsuite/script_test_2.cc (main): Adjust test.
11334
11335 2008-04-11  David S. Miller  <davem@davemloft.net>
11336             Ian Lance Taylor  <iant@google.com>
11337
11338         * options.h (General_options): Add entries for '-Y' and
11339         '-relax'.
11340         * options.cc (General_options:finalize): If -Y was used, add those
11341         entries to the library path instead of the default "/lib" and
11342         "/usr/lib".
11343
11344 2008-04-11  David S. Miller  <davem@davemloft.net>
11345
11346         * testsuite/justsyms.t: Start at 0x100.
11347         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11348         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11349         long.
11350         * testsuite/script_test_2.cc: Adjust string and section length
11351         checks.
11352
11353 2008-04-09  Ian Lance Taylor  <iant@google.com>
11354
11355         PR gold/5996
11356         * script-sections.cc (Sections_element::allocate_to_segment): Add
11357         orphan parameter.
11358         (Output_section_definition::allocate_to_segment): Likewise.
11359         (Orphan_output_section::allocate_to_segment): Likewise.
11360         (Script_sections::attach_sections_using_phdrs_clause): Don't
11361         propagate non-PT_LOAD segments to orphan sections.
11362         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11363         readelf rather than objdump.
11364         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11365         .interp section and PT_INTERP segment are the same size.
11366         * testsuite/Makefile.in: Rebuild.
11367
11368         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11369         aliases for symbols defined in the same object.
11370         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11371         (weak_alias_test_SOURCES): New variable.
11372         (weak_alias_test_DEPENDENCIES): New variable.
11373         (weak_alias_test_LDFLAGS): New variable.
11374         (weak_alias_test_LDADD): New variable.
11375         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11376         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11377         (weak_alias_test_3.o): New target.
11378         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11379         * testsuite/weak_alias_test_main.cc: New file.
11380         * testsuite/weak_alias_test_1.cc: New file.
11381         * testsuite/weak_alias_test_2.cc: New file.
11382         * testsuite/weak_alias_test_3.cc: New file.
11383
11384 2008-04-08  Ian Lance Taylor  <iant@google.com>
11385
11386         * options.h (class General_options): Add --noinhibit-exec option.
11387         * main.cc (main): Check --noinhibit-exec.
11388
11389         * options.h (class General_options): Define --wrap as a special
11390         option.  Add wrap_symbols_ field.
11391         (General_options::any_wrap_symbols): New function.
11392         (General_options::is_wrap_symbol): New function.
11393         * options.cc (General_options::parse_wrap): New function.
11394         (General_options::General_options): Initialize wrap_symbols_.
11395         * symtab.cc (Symbol_table::wrap_symbol): New function.
11396         (Symbol_table::add_from_object): Handle --wrap.
11397         * symtab.h (class Symbol_table): Declare wrap_symbol.
11398         * target.h (Target::wrap_char): New function.
11399         (Target::Target_info): Add wrap_char field.
11400         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11401         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11402         * testsuite/testfile.cc (Target_test::test_target_info):
11403         Likewise.
11404
11405         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11406         there is one.
11407
11408         * layout.h (class Layout): Add added_eh_frame_data_ field.
11409         * layout.cc (Layout::Layout): Initialize new field.
11410         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11411         output section until we find a section we merged successfully.
11412         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11413         that the size be non-zero.
11414
11415         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11416         qualifier.
11417
11418 2008-04-08  Craig Silverstein  <csilvers@google.com>
11419
11420         * configure.ac: Export new conditional variable HAVE_ZLIB.
11421         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11422         on HAVE_ZLIB.
11423         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11424         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11425
11426 2008-04-07  Ian Lance Taylor  <iant@google.com>
11427
11428         * version.cc (version_string): Set to "1.5".
11429
11430         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11431         Add issued_non_pic_error_ field.  Declare check_non_pic.
11432         (Target_x86_64::Scan::check_non_pic): New function.
11433         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11434         (Target_x86_64::Scan::global): Likewise.
11435
11436         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11437         addend parameter.  Change caller.  Handle merge sections.
11438         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11439         Address to Addend.  Don't add in the result of
11440         local_section_offset, pass down the addend and use the returned
11441         value.
11442         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11443         Update declarations of local_section_offset and symbol_value.
11444         * testsuite/two_file_test_1.cc (t18): New function.
11445         * testsuite/two_file_test_2.cc (f18): New function.
11446         * testsuite/two_file_test_main.cc (main): Call t18.
11447         * testsuite/two_file_test.h (t18, f18): Declare.
11448
11449         * configure.ac: Don't test for objdump, c++filt, or readelf.
11450         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11451         conditionals.
11452         (TEST_READELF): New variable.
11453         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11454         (check_PROGRAMS): Add two_file_strip_test.
11455         (two_file_strip_test): New target.
11456         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11457         (two_file_same_shared_strip_test_SOURCES): New variable.
11458         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11459         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11460         (two_file_same_shared_strip_test_LDADD): New variable.
11461         (two_file_shared_strip.so): New target.
11462         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11463         (ver_test_5.syms, ver_test_7.syms): Likewise.
11464         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11465         (strip_test_3.stdout): Use TEST_OBJDUMP.
11466         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11467
11468 2008-04-04  Cary Coutant  <ccoutant@google.com>
11469
11470         * symtab.h (Symbol::is_weak_undefined): New function.
11471         (Symbol::is_strong_undefined): New function.
11472         (Symbol::is_absolute): New function.
11473         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11474         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11475         absolute symbols.
11476         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11477         (weak_undef_test): New target.
11478         * testsuite/Makefile.in: Rebuild.
11479         * testsuite/weak_undef_file1.cc: New file.
11480         * testsuite/weak_undef_file2.cc: New file.
11481         * testsuite/weak_undef_test.cc: New file.
11482
11483 2008-04-03  Craig Silverstein  <csilvers@google.com>
11484
11485         * compressed_output.h (class Output_compressed_section): Use
11486         unsigned buffer.
11487         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11488         add zlib header.
11489         (zlib_compressed_suffix): Removed.
11490         (Output_compressed_section::set_final_data_size): Use unsigned
11491         buffers.
11492         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11493         Fix linker invocation.
11494         (flagstest_o_specialfile_and_compress_debug_sections):
11495         Likewise.
11496         * testsuite/Makefile.in: Regenerated.
11497
11498 2008-04-02  David S. Miller  <davem@davemloft.net>
11499
11500         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11501         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11502
11503 2008-04-02  Craig Silverstein  <csilvers@google.com>
11504
11505         * TODO: New file.
11506
11507 2008-04-02  Ian Lance Taylor  <iant@google.com>
11508
11509         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11510         parameters.  Update for new key type to views_.  Change all
11511         callers.
11512         (File_read::read): Adjust for byteshift in returned view.
11513         (File_read::add_view): New function, broken out of
11514         find_and_make_view.
11515         (File_read::make_view): New function, broken out of
11516         find_and_make_view.
11517         (File_read::find_or_make_view): Add offset and aligned
11518         parameters.  Rewrite accordingly.  Change all callers.
11519         (File_read::get_view): Add offset and aligned parameters.  Adjust
11520         for byteshift in return value.
11521         (File_read::get_lasting_view): Likewise.
11522         * fileread.h (class File_read): Update declarations.
11523         (class File_read::View): Add byteshift_ field.  Add byteshift to
11524         constructor.  Add byteshift method.
11525         * archive.h (Archive::clear_uncached_views): New function.
11526         (Archive::get_view): Add aligned parameter.  Change all callers.
11527         * object.h (Object::get_view): Add aligned parameter.  Change all
11528         callers.
11529         (Object::get_lasting_view): Likewise.
11530
11531         * fileread.cc (File_read::release): Don't call clear_views if
11532         there are multiple objects.
11533         * fileread.h (File_read::clear_uncached_views): New function.
11534         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11535         on the archive.
11536
11537 2008-03-31  Cary Coutant  <ccoutant@google.com>
11538
11539         Add thin archive support.
11540         * archive.cc (Archive::armagt): New const.
11541         (Archive::setup): Remove task parameter and calls to unlock.
11542         (Archive::unlock_nested_archives): New function.
11543         (Archive::read_header): Add nested_off parameter. Change
11544         all callers.
11545         (Archive::interpret_header): Likewise.
11546         (Archive::include_all_members): Change to handle thin
11547         archives.
11548         (Archive::include_member): Likewise.
11549         * archive.h (Archive::Archive): Add new parameters and
11550         initializers.
11551         (Archive::armagt): New const.
11552         (Archive::setup): Remove task parameter.
11553         (Archive::unlock_nested_archives): New function.
11554         (Archive::read_header): Add nested_off parameter.
11555         (Archive::interpret_header): Likewise.
11556         (Archive::Nested_archive_table): New typedef.
11557         (Archive::is_thin_archive_): New field.
11558         (Archive::nested_archives_): New field.
11559         (Archive::options_): New field.
11560         (Archive::dirpath_): New field.
11561         (Archive::task_): New field.
11562         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11563         for thin archives.  Pass additional parameters to
11564         Archive::Archive.  Unlock the archive file after calling
11565         Archive::setup.
11566
11567 2008-03-29  Ian Lance Taylor  <iant@google.com>
11568
11569         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11570         version symbol to be local.
11571         * testsuite/ver_test_4.sh: New file.
11572         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11573         (check_DATA): Add ver_test_4.syms.
11574         (ver_test_4.syms): New target.
11575         * testsuite/Makefile.in: Rebuild.
11576
11577         * output.cc
11578         (Output_section::Input_section_sort_entry::has_priority): New
11579         function.
11580         (Output_section::Input_section_sort_entry::match_file_name): New
11581         function.
11582         (Output_section::Input_section_sort_entry::match_section_name):
11583         Remove.
11584         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11585         Remove.
11586         (Output_section::Input_section_sort_entry::match_section_file):
11587         Remove.
11588         (Output_section::Input_section_sort_compare::operator()): Rewrite
11589         using new Input_section_sort_entry functions.  Sort crtbegin and
11590         crtend first.  Sort sections with no priority before sections with
11591         a priority.
11592         * testsuite/initpri1.c (d3): Check j != 4.
11593         (cd5): New constructor/destructor function.
11594         (main): Check j != 2.
11595
11596         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11597         new symbol when resolving, don't call set_is_default.
11598         * testsuite/ver_test_7.cc: New file.
11599         * testsuite/ver_test_7.sh: New file.
11600         * testsuite/Makefile.am (ver_test_7.so): New target.
11601         (ver_test_7.o): New target.
11602         (check_SCRIPTS): Add ver_test_7.sh.
11603         (check_DATA): Add ver_test_7.syms.
11604         (ver_test_7.syms): New target.
11605
11606 2008-03-28  Ian Lance Taylor  <iant@google.com>
11607
11608         * layout.cc (Layout::layout): If we see an input section with a
11609         name that needs sorting, set the must_sort flag for the output
11610         section.
11611         (Layout::make_output_section): If the name of the output section
11612         indicates that it might require sorting, set the may_sort flag.
11613         * output.h (Output_section::may_sort_attached_input_sections): New
11614         function.
11615         (Output_section::set_may_sort_attached_input_sections): New
11616         function.
11617         (Output_section::must_sort_attached_input_sections): New
11618         function.
11619         (Output_section::set_must_sort_attached_input_sections): New
11620         function.
11621         (class Output_section): Declare Input_section_sort_entry.  Define
11622         Input_section_sort_compare.  Declare
11623         sort_attached_input_sections.  Add new fields:
11624         may_sort_attached_input_sections_,
11625         must_sort_attached_input_sections_,
11626         attached_input_sections_are_sorted_.
11627         * output.cc (Output_section::Output_section): Initialize new
11628         fields.
11629         (Output_section::add_input_section): Add an entry to
11630         input_sections_ if may_sort or must_sort are true.
11631         (Output_section::set_final_data_size): Call
11632         sort_attached_input_sections if necessary.
11633         (Output_section::Input_section_sort_entry): Define new class.
11634         (Output_section::Input_section_sort_compare::operator()): New
11635         function.
11636         (Output_section::sort_attached_input_sections): New function.
11637         * configure.ac: Check whether the compiler supports constructor
11638         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11639         * testsuite/initpri1.c: New file.
11640         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11641         CONSTRUCTOR_PRIORITY.
11642         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11643         (initpri1_LDFLAGS): New variable.
11644         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11645
11646 2008-03-27  Ian Lance Taylor  <iant@google.com>
11647
11648         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11649         * testsuite/common_test_1.c: New file.
11650         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11651         (common_test_1_SOURCES): New variable.
11652         (common_test_1_DEPENDENCIES): New variable.
11653         (common_test_1_LDFLAGS): New variable.
11654
11655         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11656         and commons_ correctly when NAME/VERSION does not override
11657         NAME/NULL.
11658         * testsuite/ver_test_6.c: New file.
11659         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11660         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11661         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11662
11663 2008-03-26  Ian Lance Taylor  <iant@google.com>
11664
11665         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11666         of an undefined symbol from a version script.
11667         * testsuite/Makefile.am (ver_test_5.so): New target.
11668         (ver_test_5.o): New target.
11669         (check_SCRIPTS): Add ver_test_5.sh.
11670         (check_DATA): Add ver_test_5.syms.
11671         (ver_test_5.syms): New target.
11672         * testsuite/ver_test_5.cc: New file.
11673         * testsuite/ver_test_5.script: New file.
11674         * testsuite/ver_test_5.sh: New file.
11675         * Makefile.in, testsuite/Makefile.in: Rebuild.
11676
11677         PR gold/5986
11678         Fix problems building gold with gcc 4.3.0.
11679         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11680         (gold_error_at_location, gold_warning_at_location): Use it.
11681         * configure.ac: Check whether we can compile and use a template
11682         function with a printf attribute.
11683         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11684         when jumping over bytes.
11685         * object.cc: Instantiate Object::read_section_data.
11686         * debug.h: Include <cstring>
11687         * dwarf_reader.cc: Include <algorithm>
11688         * main.cc: Include <cstring>.
11689         * options.cc: Include <cstring>.
11690         * output.cc: Include <cstring>.
11691         * script.cc: Include <cstring>.
11692         * script.h: Include <string>.
11693         * symtab.cc: Include <cstring> and <algorithm>.
11694         * target-select.cc: Include <cstring>.
11695         * version.cc: Include <string>.
11696         * testsuite/testmain.cc: Include <cstdlib>.
11697         * configure, config.in: Rebuild.
11698
11699 2008-03-25  Ian Lance Taylor  <iant@google.com>
11700
11701         * options.cc: Include "../bfd/bfdver.h".
11702         (options::help): Print bug reporting address.
11703
11704         * version.cc (print_version): Adjust output for current value of
11705         BFD_VERSION_STRING.
11706
11707         * NEWS: New file.
11708
11709         * options.cc (options::help): Print list of supported targets.
11710         * target-select.h: Include <vector>.
11711         (class Target_selector): Make machine_, size_, and is_big_endian_
11712         fields const.  Add bfd_name_ and instantiated_target_ fields.
11713         (Target_selector::Target_selector): Add bfd_name parameter.
11714         (Target_selector::recognize): Make non-virtual, call
11715         do_recognize.
11716         (Target_selector::recognize_by_name): Make non-virtual, call
11717         do_recognize_by_name.
11718         (Target_selector::supported_names): New function.
11719         (Target_selector::bfd_name): New function.
11720         (Target_selector::do_instantiate_target): New pure virtual
11721         function.
11722         (Target_selector::do_recognize): New virtual function.
11723         (Target_selector::do_recognize_by_name): New virtual function.
11724         (Target_selector::instantiate_target): New private function.
11725         (supported_target_names): Declare.
11726         * target-select.cc (Target_selector::Target_selector): Update for
11727         new parameter and fields.
11728         (select_target_by_name): Check that the name matches before
11729         calling recognize_by_name.
11730         (supported_target_names): New function.
11731         * i386.cc (class Target_selector_i386): Update Target_selector
11732         constructor call.  Remove recognize and recognize_by_name.  Add
11733         do_instantiate_target.
11734         * x86_64.cc (class Target_selector_x86_64): Likewise.
11735         * testsuite/testfile.cc (class Target_selector_test): Update for
11736         changes to Target_selector.
11737
11738         * README: Rewrite, with some notes on unsupported features.
11739
11740 2008-03-24  Cary Coutant  <ccoutant@google.com>
11741
11742         * i386.cc (Target_i386::Got_type): New enum declaration.
11743         (Target_i386::Scan::local): Updated callers of Output_data_got
11744         member functions.
11745         (Target_i386::Scan::global): Likewise.
11746         (Target_i386::Relocate::relocate): Likewise.
11747         (Target_i386::Relocate::relocate_tls): Likewise.
11748         * object.h (Got_offset_list): New class.
11749         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11750         (Sized_relobj::local_got_offset): Likewise.
11751         (Sized_relobj::set_local_got_offset): Likewise.
11752         (Sized_relobj::local_has_tls_got_offset): Removed.
11753         (Sized_relobj::local_tls_got_offset): Removed.
11754         (Sized_relobj::set_local_tls_got_offset): Removed.
11755         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11756         * output.cc (Output_data_got::add_global): Added got_type parameter.
11757         (Output_data_got::add_global_with_rel): Likewise.
11758         (Output_data_got::add_global_with_rela): Likewise.
11759         (Output_data_got::add_global_pair_with_rel): New function.
11760         (Output_data_got::add_global_pair_with_rela): New function.
11761         (Output_data_got::add_local): Added got_type parameter.
11762         (Output_data_got::add_local_with_rel): Likewise.
11763         (Output_data_got::add_local_with_rela): Likewise.
11764         (Output_data_got::add_local_pair_with_rel): New function.
11765         (Output_data_got::add_local_pair_with_rela): New function.
11766         (Output_data_got::add_global_tls): Removed.
11767         (Output_data_got::add_global_tls_with_rel): Removed.
11768         (Output_data_got::add_global_tls_with_rela): Removed.
11769         (Output_data_got::add_local_tls): Removed.
11770         (Output_data_got::add_local_tls_with_rel): Removed.
11771         (Output_data_got::add_local_tls_with_rela): Removed.
11772         * output.h (Output_data_got::add_global): Added got_type parameter.
11773         (Output_data_got::add_global_with_rel): Likewise.
11774         (Output_data_got::add_global_with_rela): Likewise.
11775         (Output_data_got::add_global_pair_with_rel): New function.
11776         (Output_data_got::add_global_pair_with_rela): New function.
11777         (Output_data_got::add_local): Added got_type parameter.
11778         (Output_data_got::add_local_with_rel): Likewise.
11779         (Output_data_got::add_local_with_rela): Likewise.
11780         (Output_data_got::add_local_pair_with_rel): New function.
11781         (Output_data_got::add_local_pair_with_rela): New function.
11782         (Output_data_got::add_global_tls): Removed.
11783         (Output_data_got::add_global_tls_with_rel): Removed.
11784         (Output_data_got::add_global_tls_with_rela): Removed.
11785         (Output_data_got::add_local_tls): Removed.
11786         (Output_data_got::add_local_tls_with_rel): Removed.
11787         (Output_data_got::add_local_tls_with_rela): Removed.
11788         * resolve.cc (Symbol::override_base_with_special): Removed
11789         reference to has_got_offset_ field.
11790         * symtab.cc (Symbol::init_fields): Replaced initialization
11791         of got_offset_ with got_offsets_.  Removed initialization
11792         of has_got_offset_
11793         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11794         (Symbol::got_offset): Likewise.
11795         (Symbol::set_got_offset): Likewise.
11796         (Symbol::has_tls_got_offset): Removed.
11797         (Symbol::tls_got_offset): Removed.
11798         (Symbol::set_tls_got_offset): Removed.
11799         (Symbol::got_offset_): Removed.
11800         (Symbol::tls_mod_got_offset_): Removed.
11801         (Symbol::tls_pair_got_offset_): Removed.
11802         (Symbol::got_offsets_): New field.
11803         (Symbol::has_got_offset): Removed.
11804         (Symbol::has_tls_mod_got_offset): Removed.
11805         (Symbol::has_tls_pair_got_offset): Removed.
11806         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11807         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11808         member functions.
11809         (Target_x86_64::Scan::global): Likewise.
11810         (Target_x86_64::Relocate::relocate): Likewise.
11811         (Target_x86_64::Relocate::relocate_tls): Likewise.
11812
11813 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11814
11815         * yyscript.y: Fix spelling error in comment.
11816
11817 2008-03-24  Ian Lance Taylor  <iant@google.com>
11818
11819         * options.h (class General_options): Define build_id option.
11820         * layout.h (class Layout): Declare write_build_id, create_note,
11821         create_build_id.  Add build_id_note_ member.
11822         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11823         "libiberty.h", "md5.h", "sha1.h".
11824         (Layout::Layout): Initialize eh_frame_data_,
11825         eh_frame_hdr_section_, and build_id_note_.
11826         (Layout::finalize): Call create_build_id.
11827         (Layout::create_note): New function, broken out of
11828         Layout::create_gold_note.
11829         (Layout::create_gold_note): Call create_note.
11830         (Layout::create_build_id): New function.
11831         (Layout::write_build_id): New function.
11832         (Close_task_runner::run): Call write_build_id.
11833
11834         * x86_64.cc: Correct license to GPLv3.
11835
11836 2008-03-23  Ian Lance Taylor  <iant@google.com>
11837
11838         * options.cc: Include "demangle.h".
11839         (parse_optional_string): New function.
11840         (parse_long_option): Handle takes_optional_argument.
11841         (parse_short_option): Update dash_z initializer.  Handle
11842         takes_optional_argument.
11843         (General_options::General_options): Initialize do_demangle_.
11844         (General_options::finalize): Set do_demangle_.  Handle demangling
11845         style.
11846         * options.h (parse_optional_string): Declare.
11847         (struct One_option): Add optional_arg field.  Update constructor.
11848         Update call constructor calls.  Add takes_optional_argument
11849         function.
11850         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11851         (DEFINE_optional_string): Define.
11852         (General_options::demangle): Change from DEFINE_bool to
11853         DEFINE_optional_string.
11854         (General_options::no_demangle): New function.
11855         (General_options::do_demangle): New function.
11856         (General_options::set_do_demangle): New function.
11857         (General_options::execstack_status_): Move definition to end of
11858         class definition.
11859         (General_options::static_): Likewise.
11860         (General_options::do_demangle_): New field.
11861         * object.cc (big_endian>::get_symbol_location_info): Call
11862         Options::do_demangle, not Options::demangle.
11863         * symtab.cc (demangle): Likewise.
11864
11865 2008-03-22  Ian Lance Taylor  <iant@google.com>
11866
11867         * gold.h: Include <cstddef> and <sys/types.h>
11868         * options.h: Include <cstring>.
11869
11870 2008-03-21  Ian Lance Taylor  <iant@google.com>
11871
11872         * Added source code to GNU binutils.