]> Git Repo - binutils.git/blob - gold/ChangeLog
PR gold/12392
[binutils.git] / gold / ChangeLog
1 2011-07-05  Ian Lance Taylor  <[email protected]>
2
3         PR gold/12392
4         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5         symbols if necessary.
6         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7
8 2011-07-05  Ian Lance Taylor  <[email protected]>
9
10         PR gold/12952
11         * resolve.cc (Symbol::override_base_with_special): Simply override
12         version with special symbol version, ignoring previous version.
13
14 2011-07-05  Ian Lance Taylor  <[email protected]>
15
16         * object.cc (Sized_relobj_file::include_section_group): Add
17         information to comment about signature location.
18
19 2011-07-02  Ian Lance Taylor  <[email protected]>
20
21         PR gold/12957
22         * options.h (class General_options): Add -f and -F.
23         * options.cc (General_options::finalize): Fatal error if -f/-F
24         are used without -shared.
25         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
26
27 2011-07-02  Ian Lance Taylor  <[email protected]>
28
29         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
30
31 2011-07-01  Ian Lance Taylor  <[email protected]>
32
33         PR gold/12525
34         PR gold/12952
35         * resolve.cc (Symbol::override_base_with_special): Don't override
36         the version if the overriding symbol has a different name.
37         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
38         all callers.  If we give an error about an undefined version,
39         define the base version if necessary.
40         * dynobj.h (class Versions): Update declaration.
41         * testsuite/weak_alias_test_5.cc: New file.
42         * testsuite/weak_alias_test.script: New file.
43         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
44         and versioned_alias have the right value, and call t2.
45         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
46         weak_alias_test_5.so.
47         (weak_alias_test_LDADD): Likewise.
48         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
49         * testsuite/Makefile.in: Rebuild.
50
51 2011-07-01  Ian Lance Taylor  <[email protected]>
52
53         PR gold/12525
54         * options.h (class General_options): Support -z notext.
55         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
56         -Wl,-z,notext.
57         (two_file_shared_nonpic.so): Likewise.
58         (two_file_shared_mixed.so): Likewise.
59         (two_file_shared_mixed_1.so): Likewise.
60         (weak_undef_lib_nonpic.so): Likewise.
61         (alt/weak_undef_lib_nonpic.so): Likewise.
62         (tls_test_shared_nonpic.so): Likewise.
63         * testsuite/Makefile.in: Rebuild.
64
65 2011-07-01  Ian Lance Taylor  <[email protected]>
66
67         PR gold/12525
68         * configure.ac: Test whether static linking works, setting
69         the automake conditional HAVE_STATIC.
70         * testsuite/Makefile.am: Disable tests using -static if
71         HAVE_STATIC is not true.
72         * configure, testsuite/Makefile.in: Rebuild.
73
74 2011-07-01  Ian Lance Taylor  <[email protected]>
75
76         PR gold/12525
77         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
78         Assert if we see DW_EH_PE_indirect.
79         * target.h (Target::ehframe_datarel_base): New function.
80         (Target::do_ehframe_datarel_base): New target function.
81         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
82         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
83         function.
84
85 2011-07-01  Ian Lance Taylor  <[email protected]>
86
87         PR gold/12571
88         * options.h (class General_options): Add
89         --ld-generated-unwind-info.
90         * ehframe.cc (Fde::write): Add address parameter.  Change all
91         callers.  If associated with PLT, fill in address and size.
92         (Cie::set_output_offset): Only add merge mapping if there is an
93         object.
94         (Cie::write): Add address parameter.  Change all callers.
95         (Eh_frame::add_ehframe_for_plt): New function.
96         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
97         input_offset_ fields into union u_, with new plt field.
98         (Fde::Fde): Adjust for new union field.
99         (Fde::Fde) [Output_data version]: New constructor.
100         (Fde::add_mapping): Only add merge mapping if there is an object.
101         (class Cie): Update declarations.
102         (class Eh_frame): Declare add_ehframe_for_plt.
103         * layout.cc (Layout::layout_eh_frame): Break out code into
104         make_eh_frame_section, and call it.
105         (Layout::make_eh_frame_section): New function.
106         (Layout::add_eh_frame_for_plt): New function.
107         * layout.h (class Layout): Update declarations.
108         * merge.cc (Merge_map::add_mapping): Add assertion.
109         * i386.cc: Include "dwarf.h".
110         (class Output_data_plt_i386): Make first_plt_entry,
111         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
112         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
113         and plt_eh_frame_fde.
114         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
115         boundary.  Call add_eh_frame_for_plt if appropriate.
116         * x86_64.cc: Include "dwarf.h".
117         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
118         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
119         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
120         and plt_eh_frame_fde.
121         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
122         appropriate.
123
124 2011-06-29  Ian Lance Taylor  <[email protected]>
125
126         PR gold/12629
127         * object.cc (Sized_relobj_file::layout_section): Change shdr
128         parameter to be const.
129         (Sized_relobj_file::layout_eh_frame_section): New function, broken
130         out of do_layout.
131         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
132         appropriate.  Call layout_eh_frame_section.
133         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
134         sections.
135         * object.h (class Sized_relobj_file): Update declarations.
136
137 2011-06-29  Ian Lance Taylor  <[email protected]>
138
139         PR gold/12652
140         * script.cc (Token::integer_value): Accept trailing M/m/K/k
141         modifier.
142         (Lex::gather_token): Accept trailing M/m/K/k for integers.
143
144 2011-06-29  Ian Lance Taylor  <[email protected]>
145
146         PR gold/12675
147         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
148         SHT_X86_64_UNWIND.
149         * layout.cc (Layout::layout_eh_frame): Likewise.
150
151 2011-06-29  Ian Lance Taylor  <[email protected]>
152
153         PR gold/12695
154         * layout.cc (Layout::symtab_section_shndx): New function.
155         * layout.h (class Layout): Declare symtab_section_shndx.
156         * output.cc (Output_section::write_header): Call it.
157
158 2011-06-29  Ian Lance Taylor  <[email protected]>
159
160         PR gold/12818
161         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
162         symbols which are not used in a relocation.
163
164 2011-06-28  Ian Lance Taylor  <[email protected]>
165
166         PR gold/12898
167         * layout.cc (Layout::segment_precedes): Don't crash if a linker
168         script create indistinguishable segments.
169         (Layout::set_segment_offsets): Use stable_sort when sorting
170         segments.  Pass this to Compare_segments constructor.
171         * layout.h (class Layout): Make segment_precedes non-static.
172         (class Compare_segments): Change from struct to class.  Add
173         layout_ field.  Add constructor.
174         * script-sections.cc
175         (Script_sections::attach_sections_using_phdrs_clause): Rename
176         local orphan to is_orphan.  Don't report failure to put empty
177         section in segment.  On attachment failure, report name of
178         section, and attach to first PT_LOAD segment.
179
180 2011-06-28  Ian Lance Taylor  <[email protected]>
181
182         PR gold/12934
183         * target-select.cc (Target_selector::Target_selector): Add
184         emulation parameter.  Change all callers.
185         (select_target_by_bfd_name): Rename from select_target_by_name.
186         Change all callers.
187         (select_target_by_emulation): New function.
188         (supported_emulation_names): New function.
189         * target-select.h (class Target_selector): Add emulation_ field.
190         Update declarations.
191         (Target_selector::recognize_by_bfd_name): Rename from
192         recognize_by_name.  Change all callers.
193         (Target_selector::supported_bfd_names): Rename from
194         supported_names.  Change all callers.
195         (Target_selector::recognize_by_emulation): New function.
196         (Target_selector::supported_emulations): New function.
197         (Target_selector::emulation): New function.
198         (Target_selector::do_recognize_by_bfd_name): Rename from
199         do_recognize_by_name.  Change all callers.
200         (Target_selector::do_supported_bfd_names): Rename from
201         do_supported_names.  Change all callers.
202         (Target_selector::do_recognize_by_emulation): New function.
203         (Target_selector::do_supported_emulations): New function.
204         (select_target_by_bfd_name): Change name in declaration.
205         (select_target_by_emulation): Declare.
206         (supported_emulation_names): Declare.
207         * parameters.cc (parameters_force_valid_target): Try to find
208         target based on emulation from -m option.
209         * options.h (class General_options): Change doc string for -m.
210         * options.cc (help): Print emulations.
211         (General_options::parse_V): Likewise.
212         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
213         Add emulation parameter.  Change all callers.
214
215 2011-06-28  Ian Lance Taylor  <[email protected]>
216
217         * target.h (class Target): Add osabi_ field.
218         (Target::osabi): New function.
219         (Target::set_osabi): New function.
220         (Target::Target): Initialize osabi_.
221         (Target::do_adjust_elf_header): Make pure virtual.
222         (Sized_target::do_adjust_elf_header): Declare.
223         * target.cc (Sized_target::do_adjust_elf_header): New function.
224         (class Sized_target): Instantiate all versions.
225         * freebsd.h (class Target_freebsd): Remove.
226         (Target_selector_freebsd::do_recognize): Call set_osabi on
227         Target.
228         (Target_selector_freebsd::do_recognize_by_name): Likewise.
229         (Target_selector_freebsd::set_osabi): Remove.
230         * i386.cc (class Target_i386): Inherit from Sized_target rather
231         than Target_freebsd.
232         * x86_64.cc (class Target_x86_64): Likewise.
233
234 2011-06-28  Ian Lance Taylor  <[email protected]>
235
236         * target.h (Target::can_check_for_function_pointers): Rewrite.
237         Make non-virtual.
238         (Target::can_icf_inline_merge_sections): Likewise.
239         (Target::section_may_have_icf_unsafe_poineters): Likewise.
240         (Target::Target_info): Add can_icf_inline_merge_sections field.
241         (Target::do_can_check_for_function_pointers): New virtual
242         function.
243         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
244         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
245         from can_check_for_function_pointers, move in file.
246         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
247         section_may_have_icf_unsafe_poineters, move in file.
248         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
249         * i386.cc (Target_i386::do_can_check_for_function_pointers):
250         Rename from can_check_for_function_pointers, move in file.
251         (Target_i386::can_icf_inline_merge_sections): Remove.
252         (Target_i386::i386_info): Initialize
253         can_icf_inline_merge_sections.
254         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
255         Initialize can_icf_inline_merge_sections.
256         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
257         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
258         Rename from can_check_for_function_pointers, move in file.
259         (Target_x86_64::can_icf_inline_merge_sections): Remove.
260         (Target_x86_64::x86_64_info): Initialize
261         can_icf_inline_merge_sections.
262         * testsuite/testfile.cc (Target_test::test_target_info):
263         Likewise.
264         * icf.cc (get_section_contents): Correct formatting.
265
266 2011-06-27  Ian Lance Taylor  <[email protected]>
267
268         * symtab.cc (Symbol::versioned_name): New function.
269         (Symbol_table::add_to_final_symtab): Use versioned_name when
270         appropriate.
271         (Symbol_table::sized_write_symbol): Likewise.
272         * symtab.h (class Symbol): Declare versioned_name.
273         * stringpool.h (class Stringpool_template): Add variant of add
274         which takes a std::basic_string.
275         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
276         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
277         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
278         (ver_test_12.o): New target.
279         * testsuite/Makefile.in: Rebuild.
280
281 2011-06-27  Doug Kwan  <[email protected]>
282
283         * arm.cc (Arm_relocate_functions::thm_jump8,
284         Arm_relocate_functions::thm_jump11): Use a wider signed
285         type to compute offset.
286         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
287         arm_thm_jump8.
288         * testsuite/Makefile.in: Regenerate.
289         * testsuite/arm_branch_in_range.sh: Check test results of
290         arm_thm_jump11 and arm_thm_jump8.
291         * testsuite/arm_thm_jump11.s: New test source file.
292         * testsuite/arm_thm_jump11.t: New linker script.
293         * testsuite/arm_thm_jump8.s: New test source file.
294         * testsuite/arm_thm_jump8.t: New linker script.
295
296 2011-06-24  Ian Lance Taylor  <[email protected]>
297
298         * layout.cc: Include "object.h".
299         (ctors_sections_in_init_array): New static variable.
300         (Layout::is_ctors_in_init_array): New function.
301         (Layout::layout): Add entry to ctors_sections_in_init_array if
302         appropriate.
303         * layout.h (class Layout): Declare is_ctors_in_init_array.
304         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
305         is_ctors_reverse_view is set.
306         (Sized_relobj_file::write_sections): Add layout parameter.  Change
307         all callers.  Set is_ctors_reverse_view field of View_size.
308         (Sized_relobj_file::reverse_words): New function.
309         * object.h (Sized_relobj_file::View_size): Add
310         is_ctors_reverse_view field.
311         (class Sized_relobj_file): Update declarations.
312         * testsuite/initpri3.c: New test.
313         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
314         initpri3b.
315         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
316         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
317         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
318         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
319         * testsuite/Makefile.in: Rebuild.
320
321 2011-06-24  Cary Coutant  <[email protected]>
322
323         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
324         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
325         (debug_msg_cdebug.err): New targets.
326         * testsuite/Makefile.in: Regenerate.
327         * testsuite/debug_msg.sh: Check output of link with compressed debug.
328         Fix checks for link with shared library.
329
330 2011-06-24  Doug Kwan  <[email protected]>
331
332         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
333         skip empty text sections.
334         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
335
336 2011-06-22  Ian Lance Taylor  <[email protected]>
337
338         PR gold/12910
339         * options.h (class General_options): Add --ctors-in-init-array.
340         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
341         friends as SHT_PROGBITS for merging sections.
342         (Layout::layout): Remove special handling of .init_array and
343         friends.  Don't sort if doing relocatable link.  Sort for .ctors
344         and .dtors if ctors_in_init_array.
345         (Layout::make_output_section): Force correct section types for
346         .init_array and friends.  Don't sort if doing relocatable link,
347         Don't sort .ctors and .dtors if ctors_in_init_array.
348         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
349         (Layout::output_section_name): Add relobj parameter.  Change all
350         callers.  Handle .ctors. and .dtors. in code rather than table.
351         Handle .ctors and .dtors if ctors_in_init_array.
352         (Layout::match_file_name): New function, moved from output.cc.
353         * layout.h (class Layout): Update declarations.
354         * output.cc: Include "layout.h".
355         (Input_section_sort_entry::get_priority): New function.
356         (Input_section_sort_entry::match_file_name): Just call
357         Layout::match_file_name.
358         (Output_section::Input_section_sort_init_fini_compare::operator()):
359         Handle .ctors and .dtors.  Sort by explicit priority rather than
360         by name.
361         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
362         * testsuite/initpri2.c: New test.
363         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
364         (check_PROGRAMS): Add initpri2.
365         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
366         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
367         * configure, testsuite/Makefile.in: Rebuild.
368
369 2011-06-19  Ian Lance Taylor  <[email protected]>
370
371         PR gold/12880
372         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
373         .interp section to a PT_INTERP segment even if we have seen a
374         --dynamic-linker option.  Don't do it if we have seen a PHDRS
375         clause in a linker script.
376         (Layout::finalize): Don't create a .interp section if we've
377         already create a PT_INTERP segment.
378         (Layout::create_interp): Always call choose_output_section (revert
379         patch of 2011-06-17).  Don't create PT_INTERP segment.
380         * script-sections.cc
381         (Script_sections::create_note_and_tls_segments): Add a .interp
382         section to a PT_INTERP segment even if we have seen a
383         --dynamic-linker option.
384
385 2011-06-18  Ian Lance Taylor  <[email protected]>
386
387         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
388         merely because a non-PT_LOAD segment has a dynamic reloc.
389
390 2011-06-18  Ian Lance Taylor  <[email protected]>
391
392         * layout.cc (Layout::finish_dynamic_section): Don't create
393         DT_FLAGS entry if not needed.
394
395 2011-06-18  Ian Lance Taylor  <[email protected]>
396
397         PR gold/12745
398         * layout.cc (Layout::layout_eh_frame): Correct handling of
399         writable .eh_frame section.
400
401 2011-06-17  Ian Lance Taylor  <[email protected]>
402
403         PR gold/12893
404         * resolve.cc (Symbol_table::resolve): Don't give an error if a
405         symbol is redefined with the exact same object and value.
406
407 2011-06-17  Ian Lance Taylor  <[email protected]>
408
409         PR gold/12880
410         * layout.h (class Layout): Add interp_segment_ field.
411         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
412         (Layout::attach_allocated_section_to_segment): If making shared
413         library, put .interp section in PT_INTERP segment.
414         (Layout::finalize): Also call create_interp if -dynamic-linker
415         option was used.
416         (Layout::create_interp): Assert that there is no PT_INTERP
417         segment.  If not using a SECTIONS clause, use make_output_section.
418         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
419         * script-sections.cc
420         (Script_sections::create_note_and_tls_segments): If making shared
421         library, put .interp section in PT_INTERP segment.
422
423 2011-06-17  Ian Lance Taylor  <[email protected]>
424
425         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
426         when making a shared library.
427
428 2011-06-17  Ian Lance Taylor  <[email protected]>
429
430         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
431         parameter.  Change all callers.  Don't issue warning about PC32
432         against locally defined symbol.
433
434 2011-06-16  Ian Lance Taylor  <[email protected]>
435
436         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
437         occurs in same object.
438
439 2011-06-14  Alan Modra  <[email protected]>
440
441         * po/POTFILES.in: Regenerate.
442
443 2011-06-09  Ian Lance Taylor  <[email protected]>
444
445         * script-sections.cc
446         (Orphan_output_section::set_section_addresses): For a relocatable
447         link set address to 0.
448
449 2011-06-09  Cary Coutant  <[email protected]>
450
451         PR gold/12804
452         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
453         used with --compress-debug-sections.
454         * gold/object.cc (Sized_relobj_file::do_layout): Report
455         uncompressed size of compressed input sections.
456
457 2011-06-08  Cary Coutant  <[email protected]>
458
459         PR gold/12804
460         * testsuite/two_file_test_2_v1.cc: Change initialization of
461         v2 to keep it in .data.
462
463 2011-06-07  Cary Coutant  <[email protected]>
464
465         * common.cc (Symbol_table::do_allocate_commons_list): Call
466         gold_fallback.
467         * errors.cc (Errors::fatal): Adjust call to gold_exit.
468         (Errors::fallback): New function.
469         (gold_fallback): New function.
470         * errors.h (Errors::fallback): New function.
471         * gold.cc (gold_exit): Change status parameter to enum; adjust
472         all callers.
473         (queue_initial_tasks): Call gold_fallback.
474         * gold.h: Include cstdlib.
475         (Exit_status): New enum type.
476         (gold_exit): Change status parameter to enum.
477         (gold_fallback): New function.
478         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
479         (Layout::create_symtab_sections): Likewise.
480         (Layout::create_shdrs): Likewise.
481         * main.cc (main): Adjust call to gold_exit.
482         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
483         (Output_data_got::add_got_entry_pair): Likewise.
484         (Output_section::add_input_section): Likewise.
485         (Output_section::add_output_section_data): Likewise.
486         (Output_segment::set_section_list_addresses): Likewise.
487         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
488
489 2011-06-07  Cary Coutant  <[email protected]>
490
491         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
492         for incremental links.
493         * output.cc (Output_segment::set_section_list_addresses): Remove
494         FIXME and test for TLS or BSS.
495
496 2011-06-07  Cary Coutant  <[email protected]>
497
498         * testsuite/Makefile.am: Add incremental_copy_test,
499         incremental_common_test_1.
500         * testsuite/Makefile.in: Regenerate.
501         * testsuite/common_test_1_v1.c: New source file.
502         * testsuite/common_test_1_v2.c: New source file.
503         * testsuite/copy_test_v1.cc: New source file.
504
505 2011-06-07  Cary Coutant  <[email protected]>
506
507         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
508         update, allocate common from bss section's free list.
509         * incremental-dump.cc (dump_incremental_inputs): Print flag for
510         linker-defined symbols.
511         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
512         Skip GOT and PLT entries that are no longer referenced.
513         (Output_section_incremental_inputs::write_info_blocks): Mark
514         linker-defined symbols.
515         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
516         * output.cc (Output_section::allocate): New function.
517         * output.h (Output_section::allocate): New function.
518         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
519         linker-defined symbols.
520         (Symbol::override_base_with_special): Copy is_predefined_ flag.
521         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
522         (Symbol::init_base_output_data): Likewise.
523         (Symbol::init_base_output_segment): Likewise.
524         (Symbol::init_base_constant): Likewise.
525         (Sized_symbol::init_output_data): Likewise.
526         (Sized_symbol::init_output_segment): Likewise.
527         (Sized_symbol::init_constant): Likewise.
528         (Symbol_table::do_define_in_output_data): Likewise.
529         (Symbol_table::do_define_in_output_segment): Likewise.
530         (Symbol_table::do_define_as_constant): Likewise.
531         * symtab.h (Symbol::is_predefined): New function.
532         (Symbol::init_base_output_data): Add is_predefined parameter.
533         (Symbol::init_base_output_segment): Likewise.
534         (Symbol::init_base_constant): Likewise.
535         (Symbol::is_predefined_): New data member.
536         (Sized_symbol::init_output_data): Add is_predefined parameter.
537         (Sized_symbol::init_output_segment): Likewise.
538         (Sized_symbol::init_constant): Likewise.
539         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
540
541 2011-06-07  Cary Coutant  <[email protected]>
542
543         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
544         instead of emit_copy_reloc.
545         (Copy_relocs::emit_copy_reloc): Refactor.
546         (Copy_relocs::make_copy_reloc): New function.
547         (Copy_relocs::add_copy_reloc): Remove.
548         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
549         section.
550         (Copy_relocs::make_copy_reloc): New function.
551         (Copy_relocs::add_copy_reloc): Remove.
552         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
553         unchanged input files.
554         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
555         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
556         Reserve BSS space for COPY relocations.
557         (Sized_incremental_binary::do_emit_copy_relocs): New function.
558         (Output_section_incremental_inputs::write_info_blocks): Record
559         whether a symbol is copied from a shared object.
560         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
561         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
562         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
563         (Incremental_input_entry_reader::get_output_symbol_index): Add
564         is_copy parameter.
565         (Incremental_binary::emit_copy_relocs): New function.
566         (Incremental_binary::do_emit_copy_relocs): New function.
567         (Sized_incremental_binary::Sized_incremental_binary): Initialize
568         new data member.
569         (Sized_incremental_binary::add_copy_reloc): New function.
570         (Sized_incremental_binary::do_emit_copy_relocs): New function.
571         (Sized_incremental_binary::Copy_reloc): New struct.
572         (Sized_incremental_binary::Copy_relocs): New typedef.
573         (Sized_incremental_binary::copy_relocs_): New data member.
574         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
575         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
576         * target.h (Sized_target::emit_copy_reloc): New function.
577         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
578
579 2011-06-02  Cary Coutant  <[email protected]>
580
581         PR gold/12163
582         * gold/archive.cc (Archive::Archive): Initialize new data member.
583         (Archive::include_all_members): Return if archive has already been
584         included.
585         * gold/archive.h (Archive::include_all_members_): New data member.
586
587 2011-06-02  Nick Clifton  <[email protected]>
588
589         * dynobj.h: Fix spelling mistake in comment.
590         * output.cc: Likewise.
591
592 2011-05-31  Doug Kwan  <[email protected]>
593             Asier Llano
594
595         PR gold/12826
596         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
597         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
598         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
599         redundant arm_exidx_test.so.
600         * testsuite/Makefile.in: Regenerate.
601         (check_SCRIPTS): Add pr12826.sh
602         (check_DATA): Add pr12826.stdout
603         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
604         * testsuite/pr12826.sh: New file.
605         * testsuite/pr12826_1.s: Ditto.
606         * testsuite/pr12826_1.s: Ditto.
607
608 2011-05-30  Ian Lance Taylor  <[email protected]>
609
610         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
611         sections.
612
613 2011-05-29  Ian Lance Taylor  <[email protected]>
614
615         PR gold/12804
616         * testsuite/Makefile.am: Use different file name for two_file_test
617         temporary file for each incremental test.
618         * testsuite/Makefile.in: Rebuild.
619
620 2011-05-29  Ian Lance Taylor  <[email protected]>
621
622         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
623         binary input file is empty.
624
625 2011-05-27  Ian Lance Taylor  <[email protected]>
626
627         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
628         (ver_test_9.so): Likewise.
629         * testsuite/Makefile.in: Rebuild.
630
631 2011-05-26 Cary Coutant  <[email protected]>
632
633         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
634         * incremental.cc (Incremental_inputs::report_input_section): Fix
635         comment, indentation.
636         (Incremental_inputs::report_comdat_group): New function.
637         (Output_section_incremental_inputs::set_final_data_size): Adjust size
638         of data for incremental input file entry.
639         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
640         group count, COMDAT group signatures.
641         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
642         an unchanged input file.
643         * incremental.h (Incremental_object_entry::Incremental_object_entry):
644         Initialize new data member.
645         (Incremental_object_entry::add_comdat_group): New function.
646         (Incremental_object_entry::get_comdat_group_count): New function.
647         (Incremental_object_entry::get_comdat_signature_key): New function.
648         (Incremental_object_entry::groups_): New data member.
649         (Incremental_inputs::report_comdat_group): New function.
650         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
651         data for incremental input file entry.
652         (Incremental_input_entry_reader::get_comdat_group_count): New function.
653         (Incremental_input_entry_reader::get_input_section): Adjust size of
654         data for incremental input file entry.
655         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
656         (Incremental_input_entry_reader::get_comdat_group_signature): New
657         function.
658         * object.cc (Sized_relobj::include_section_group): Report kept
659         COMDAT groups for incremental links.
660
661 2011-05-24  David Meyer  <[email protected]>
662
663         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
664         with name parameter.  Add found_name parameter.
665         * fileread.cc (Input_file::find_file): Adjust code accordingly.
666         * dirsearch.h (class Dirsearch): Update declaration.
667
668 2011-05-24  Ian Lance Taylor  <[email protected]>
669
670         * archive.cc (Library_base::should_include_member): Pull in object
671         from archive if it defines the entry symbol.
672         * parameters.cc (Parameters::entry): New function.
673         * parameters.h (class Parameters): Declare entry.
674         * output.h (class Output_file_header): Remove entry_ field.
675         * output.cc (Output_file_header::Output_file_header): Remove entry
676         parameter.  Change all callers.
677         (Output_file_header::entry): Use parameters->entry.
678         * gold.cc (queue_middle_tasks): Likewise.
679         * plugin.cc (Plugin_hook::run): Likewise.
680
681 2011-05-24 Cary Coutant  <[email protected]>
682
683         * gold.cc (queue_initial_tasks): Pass incremental base filename
684         to Output_file::open_base_file; don't print error message.
685         * incremental-dump.cc (main): Adjust call to
686         Output_file::open_for_modification.
687         * incremental-dump.cc (main): Likewise.
688         * incremental.cc (Incremental_inputs::report_command_line):
689         Ignore --incremental-base option when comparing command lines.
690         Ignore parameter when given as separate argument.
691         * options.h (class General_options): Add --incremental-base.
692         * output.cc (Output_file::Output_file):
693         (Output_file::open_base_file): Add base_name and writable parameters;
694         read base file into new file; print error message here.
695         (Output_file::map_no_anonymous): Add writable parameter; adjust all
696         callers.
697         * output.h (Output_file::open_for_modification): Rename to...
698         (Output_file::open_base_file): ...this; add base_name and
699         writable parameters; adjust all callers.
700         (Output_file::map_no_anonymous): Add writable parameter; adjust all
701         callers.
702         * testsuite/Makefile.am (incremental_test_4): Test
703         --incremental-base.
704         * testsuite/Makefile.in: Regenerate.
705
706 2011-05-24 Cary Coutant  <[email protected]>
707
708         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
709         incremental_test_4.
710         * testsuite/Makefile.in: Regenerate.
711         * testsuite/two_file_test_1_v1.cc: New test source file.
712         * testsuite/two_file_test_1b_v1.cc: New test source file.
713         * testsuite/two_file_test_2_v1.cc: New test source file.
714
715 2011-05-24 Cary Coutant  <[email protected]>
716
717         * dynobj.h (Dynobj::do_dynobj): New function.
718         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
719         flag and soname for shared objects.
720         * incremental.cc (Incremental_inputs::report_object): Make
721         either Incremental_object_entry or Incremental_dynobj_entry; add
722         soname to string table.
723         (Incremental_inputs::report_input_section): Add assertion.
724         (Output_section_incremental_inputs::set_final_data_size): Adjust
725         type of input file entry for shared libraries; adjust size of
726         shared library info entry.
727         (Output_section_incremental_inputs::write_input_files): Write
728         as_needed flag for shared libraries.
729         (Output_section_incremental_inputs::write_info_blocks): Adjust type
730         of input file entry for shared libraries; write soname.
731         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
732         soname from incremental info.
733         * incremental.h (enum Incremental_input_flags): Add
734         INCREMENTAL_INPUT_AS_NEEDED.
735         (Incremental_input_entry::Incremental_input_entry): Initialize new
736         data member.
737         (Incremental_input_entry::set_as_needed): New function.
738         (Incremental_input_entry::as_needed): New function.
739         (Incremental_input_entry::do_dynobj_entry): New function.
740         (Incremental_input_entry::as_needed_): New data member.
741         (Incremental_object_entry::Incremental_object_entry): Don't check
742         for shared library.
743         (Incremental_object_entry::do_type): Likewise.
744         (class Incremental_dynobj_entry): New class.
745         (Incremental_input_entry_reader::as_needed): New function.
746         (Incremental_input_entry_reader::get_soname): New function.
747         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
748         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
749         size of shared library info entry.
750         * layout.cc (Layout::finish_dynamic_section): Don't test for 
751         incremental link when adding DT_NEEDED entries.
752         * object.h (Object::Object): Initialize new data member.
753         (Object::dynobj): New function.
754         (Object::set_as_needed): New function.
755         (Object::as_needed): New function.
756         (Object::do_dynobj): New function.
757         (Object::as_needed_): New data member.
758
759 2011-05-24 Cary Coutant  <[email protected]>
760
761         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
762         info; adjust display of GOT entries.
763         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
764         vector of input objects; remove file_status_.
765         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
766         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
767         got_plt reader; call target hooks to reserve GOT entries.
768         (Output_section_incremental_inputs::set_final_data_size): Adjust size
769         of input file info header and GOT info entry.
770         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
771         relocation info.
772         (Got_plt_view_info::got_descriptor): Remove.
773         (Got_plt_view_info::sym_index): New data member.
774         (Got_plt_view_info::input_index): New data member.
775         (Local_got_offset_visitor::visit): Write input file index.
776         (Global_got_offset_visitor::visit): Write 0 for input file index.
777         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
778         with sym_index and input_index.
779         (Output_section_incremental_inputs::write_got_plt): Adjust size of
780         incremental info GOT entry; replace got_descriptor with input_index.
781         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
782         map from input file index to object.
783         (Sized_relobj_incr::do_layout): Replace direct data member reference
784         with accessor function.
785         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
786         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
787         Adjust size of input file info header.
788         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
789         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
790         (Incremental_input_entry_reader::get_input_section): Adjust size of
791         input file info header.
792         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
793         of incremental info GOT entry.
794         (Incremental_got_plt_reader::get_got_desc): Remove.
795         (Incremental_got_plt_reader::get_got_symndx): New function.
796         (Incremental_got_plt_reader::get_got_input_index): New function.
797         (Sized_incremental_binary::Sized_incremental_binary): Remove
798         file_status_; add input_objects_.
799         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
800         (Sized_incremental_binary::set_file_is_unchanged): Remove.
801         (Sized_incremental_binary::file_is_unchanged): Remove.
802         (Sized_incremental_binary::set_input_object): New function.
803         (Sized_incremental_binary::input_object): New function.
804         (Sized_incremental_binary::file_status_): Remove.
805         (Sized_incremental_binary::input_objects_): New data member.
806         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
807         references.
808         (Sized_relobj_incr::invalid_address): Move to base class.
809         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
810         class.
811         (Sized_relobj_incr::do_output_section_offset): Likewise.
812         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
813         (Sized_relobj_incr::section_offsets_): Likewise.
814         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
815         function.
816         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
817         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
818         with accessor function.
819         (Sized_relobj_file::do_layout): Likewise.
820         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
821         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
822         (Sized_relobj_file::compute_final_local_value): Replace refs to
823         section_offsets_ with accessor function.
824         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
825         * object.h (Relobj::Relobj): Initialize new data members.
826         (Relobj::add_dyn_reloc): New function.
827         (Relobj::first_dyn_reloc): New function.
828         (Relobj::dyn_reloc_count): New function.
829         (Relobj::first_dyn_reloc_): New data member.
830         (Relobj::dyn_reloc_count_): New data member.
831         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
832         references.
833         (Sized_relobj::Address): New typedef.
834         (Sized_relobj::invalid_address): Move here from child class.
835         (Sized_relobj::Sized_relobj): Initialize new data members.
836         (Sized_relobj::sized_relobj): New function.
837         (Sized_relobj::is_output_section_offset_invalid): Move here from
838         child class.
839         (Sized_relobj::get_output_section_offset): Likewise.
840         (Sized_relobj::local_has_got_offset): Likewise.
841         (Sized_relobj::local_got_offset): Likewise.
842         (Sized_relobj::set_local_got_offset): Likewise.
843         (Sized_relobj::do_for_all_local_got_entries): Likewise.
844         (Sized_relobj::clear_got_offsets): New function.
845         (Sized_relobj::section_offsets): Move here from child class.
846         (Sized_relobj::do_output_section_offset): Likewise.
847         (Sized_relobj::do_set_section_offset): Likewise.
848         (Sized_relobj::Local_got_offsets): Likewise.
849         (Sized_relobj::local_got_offsets_): Likewise.
850         (Sized_relobj::section_offsets_): Likewise.
851         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
852         references.
853         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
854         class.
855         (Sized_relobj_file::sized_relobj): New function
856         (Sized_relobj_file::local_has_got_offset): Move to base class.
857         (Sized_relobj_file::local_got_offset): Likewise.
858         (Sized_relobj_file::set_local_got_offset): Likewise.
859         (Sized_relobj_file::get_output_section_offset): Likewise.
860         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
861         (Sized_relobj_file::do_output_section_offset): Likewise.
862         (Sized_relobj_file::do_set_section_offset): Likewise.
863         (Sized_relobj_file::Local_got_offsets): Likewise.
864         (Sized_relobj_file::local_got_offsets_): Likewise.
865         (Sized_relobj_file::section_offsets_): Likewise.
866         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
867         (all constructors).
868         (set_needs_dynsym_index): Convert relobj to derived class pointer.
869         (Output_reloc::get_symbol_index): Likewise.
870         (Output_reloc::local_section_offset): Likewise.
871         (Output_reloc::get_address): Likewise.
872         (Output_reloc::symbol_value): Likewise.
873         (Output_data_got::reserve_slot): Move to class definition.
874         (Output_data_got::reserve_local): New function.
875         (Output_data_got::reserve_slot_for_global): Remove.
876         (Output_data_got::reserve_global): New function.
877         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
878         (all constructors, two instantiations).
879         (Output_reloc::get_relobj): New function (two instantiations).
880         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
881         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
882         (Output_data_reloc::add_global): Adjust type of relobj.
883         (Output_data_reloc::add_global_relative): Likewise.
884         (Output_data_reloc::add_symbolless_global_addend): Likewise.
885         (Output_data_reloc::add_local): Likewise.
886         (Output_data_reloc::add_local_relative): Likewise.
887         (Output_data_reloc::add_symbolless_local_addend): Likewise.
888         (Output_data_reloc::add_local_section): Likewise.
889         (Output_data_reloc::add_output_section): Likewise.
890         (Output_data_reloc::add_absolute): Likewise.
891         (Output_data_reloc::add_target_specific): Likewise.
892         (Output_data_got::reserve_slot): Move definition here.
893         (Output_data_got::reserve_local): New function.
894         (Output_data_got::reserve_global): New function.
895         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
896         section_offsets_ with accessor function.
897         (Sized_relobj_file::write_sections): Likewise.
898         (Sized_relobj_file::do_relocate_sections): Likewise.
899         * target.h (Sized_target::reserve_local_got_entry): New function.
900         (Sized_target::reserve_global_got_entry): New function.
901         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
902         (Target_x86_64::reserve_global_got_entry): New function.
903         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
904
905 2011-05-23 Cary Coutant  <[email protected]>
906
907         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
908         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
909         bit when checking got_type.
910         * incremental.cc (Sized_incremental_binary::setup_readers):
911         Store symbol table and string table locations; initialize bit vector
912         of file status flags.
913         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
914         unchanged files.
915         (Sized_incremental_binary::do_process_got_plt): New function.
916         (Sized_incremental_binary::get_symtab_view): Use stored locations.
917         (Output_section_incremental_inputs::set_final_data_size): Record
918         file index for each input file.
919         (Output_section_incremental_inputs::write_got_plt): Store file index
920         instead of input entry offset for each GOT entry.
921         * incremental.h
922         (Incremental_input_entry::Incremental_input_entry): Initialize new
923         data member.
924         (Incremental_input_entry::set_offset): Store file index.
925         (Incremental_input_entry::get_file_index): New function.
926         (Incremental_input_entry::file_index_): New data member.
927         (Incremental_binary::process_got_plt): New function.
928         (Incremental_binary::do_process_got_plt): New function.
929         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
930         data members.
931         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
932         (Sized_incremental_binary::set_file_is_unchanged): New function.
933         (Sized_incremental_binary::file_is_unchanged): New function.
934         (Sized_incremental_binary::do_process_got_plt): New function.
935         (Sized_incremental_binary::file_status_): New data member.
936         (Sized_incremental_binary::main_symtab_loc_): New data member.
937         (Sized_incremental_binary::main_strtab_loc_): New data member.
938         * output.cc (Output_data_got::Got_entry::write): Add case
939         RESERVED_CODE.
940         (Output_data_got::add_global): Call add_got_entry.
941         (Output_data_got::add_global_plt): Likewise.
942         (Output_data_got::add_global_with_rel): Likewise.
943         (Output_data_got::add_global_with_rela): Likewise.
944         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
945         (Output_data_got::add_global_pair_with_rela): Likewise.
946         (Output_data_got::add_local): Call add_got_entry.
947         (Output_data_got::add_local_plt): Likewise.
948         (Output_data_got::add_local_with_rel): Likewise.
949         (Output_data_got::add_local_with_rela): Likewise.
950         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
951         (Output_data_got::add_local_pair_with_rela): Likewise.
952         (Output_data_got::reserve_slot): New function.
953         (Output_data_got::reserve_slot_for_global): New function.
954         (Output_data_got::add_got_entry): New function.
955         (Output_data_got::add_got_entry_pair): New function.
956         (Output_section::add_output_section_data): Edit FIXME.
957         * output.h
958         (Output_section_data_build::Output_section_data_build): New
959         constructor with size parameter.
960         (Output_data_space::Output_data_space): Likewise.
961         (Output_data_got::Output_data_got): Initialize new data member; new
962         constructor with size parameter.
963         (Output_data_got::add_constant): Call add_got_entry.
964         (Output_data_got::reserve_slot): New function.
965         (Output_data_got::reserve_slot_for_global): New function.
966         (class Output_data_got::Got_entry): Add RESERVED_CODE.
967         (Output_data_got::add_got_entry): New function.
968         (Output_data_got::add_got_entry_pair): New function.
969         (Output_data_got::free_list_): New data member.
970         * target.h (Sized_target::init_got_plt_for_update): New function.
971         (Sized_target::register_global_plt_entry): New function.
972         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
973         Initialize new data member; call init; add constructor with PLT count.
974         (Output_data_plt_x86_64::init): New function.
975         (Output_data_plt_x86_64::add_relocation): New function.
976         (Output_data_plt_x86_64::reserve_slot): New function.
977         (Output_data_plt_x86_64::free_list_): New data member.
978         (Target_x86_64::init_got_plt_for_update): New function.
979         (Target_x86_64::register_global_plt_entry): New function.
980         (Output_data_plt_x86_64::add_entry): Allocate from free list for
981         incremental updates.
982         (Output_data_plt_x86_64::add_relocation): New function.
983         * testsuite/object_unittest.cc (Object_test): Set default options.
984
985 2011-05-16  Ian Lance Taylor  <[email protected]>
986
987         * options.h (class General_options): Make -i a synonym for -r.
988
989 2011-05-16  Ian Lance Taylor  <[email protected]>
990
991         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
992
993 2011-05-10 Cary Coutant  <[email protected]>
994
995         * object.cc (Sized_relobj::do_count_local_symbols): Check for
996         strip_all (-s).
997
998 2011-05-06  Ian Lance Taylor  <[email protected]>
999
1000         * layout.cc (Layout::layout): If the output section flags change,
1001         update the ordering.
1002
1003 2011-04-25 Cary Coutant  <[email protected]>
1004
1005         * incremental-dump.cc (dump_incremental_inputs): Print local
1006         symbol info for each input file.
1007         * incremental.cc
1008         (Output_section_incremental_inputs::set_final_data_size): Add local
1009         symbol info to input file entries in incremental info.
1010         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1011         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1012         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1013         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1014         implementation.
1015         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1016         (Sized_incr_relobj::do_relocate): Write the local symbols.
1017         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1018         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1019         Adjust size of input file header.
1020         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1021         (Incremental_inputs_reader::get_local_symbol_count): New function.
1022         (Incremental_inputs_reader::get_input_section): Adjust size of input
1023         file header.
1024         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1025         (Sized_incr_relobj::This): New typedef.
1026         (Sized_incr_relobj::sym_size): New const data member.
1027         (Sized_incr_relobj::Local_symbol): New struct.
1028         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1029         (Sized_incr_relobj::do_local_symbol_offset): New function.
1030         (Sized_incr_relobj::local_symbol_count_): New data member.
1031         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1032         (Sized_incr_relobj::local_symbol_index_): New data member.
1033         (Sized_incr_relobj::local_symbol_offset_): New data member.
1034         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1035         (Sized_incr_relobj::local_symbols_): New data member.
1036         * object.h (Relobj::output_local_symbol_count): New function.
1037         (Relobj::local_symbol_offset): New function.
1038         (Relobj::do_output_local_symbol_count): New function.
1039         (Relobj::do_local_symbol_offset): New function.
1040         (Sized_relobj::do_output_local_symbol_count): New function.
1041         (Sized_relobj::do_local_symbol_offset): New function.
1042
1043 2011-04-22  Vladimir Simonov  <[email protected]>
1044
1045         * descriptors.cc (set_close_on_exec): New function.
1046         (Descriptors::open): Use set_close_on_exec.
1047         * output.cc (S_ISLNK): Define if not defined.
1048
1049 2011-04-22 Cary Coutant  <[email protected]>
1050
1051         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1052         global symbol map.
1053         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1054         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1055         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1056         relocations.
1057         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1058         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1059         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1060         * incremental.h
1061         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1062         function.
1063         (Incremental_binary::apply_incremental_relocs): New function.
1064         (Incremental_binary::do_apply_incremental_relocs): New function.
1065         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1066         data member.
1067         (Sized_incremental_binary::add_global_symbol): New function.
1068         (Sized_incremental_binary::global_symbol): New function.
1069         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1070         (Sized_incremental_binary::symbol_map_): New data member.
1071         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1072         * target.h (Sized_target::apply_relocation): New function.
1073         * target-reloc.h (apply_relocation): New function.
1074         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1075
1076 2011-04-22  Doug Kwan  <[email protected]>
1077
1078         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1079         flag of a SHT_ARM_EXIDX section.
1080         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1081         * testsuite/Makefile.in: Regenerate.
1082         * testsuite/arm_exidx_test.s: New file.
1083         * testsuite/arm_exidx_test.sh: Same.
1084
1085 2011-04-20 Cary Coutant  <[email protected]>
1086
1087         PR gold/12689
1088         * archive.h (Incremental_archive_entry::Archive_member):
1089         Initialize arg_serial_ (second constructor).
1090
1091 2011-04-17  Ian Lance Taylor  <[email protected]>
1092
1093         * object.cc (Relocate_info::location): Simplify location string.
1094         * errors.cc (Errors::error_at_location): Don't print program
1095         name.
1096         (Errors::warning_at_location): Likewise.
1097         (Errors::undefined_symbol): Likewise.
1098         * testsuite/debug_msg.sh: Update accordingly.
1099
1100 2011-04-14 Cary Coutant  <[email protected]>
1101
1102         * gold/layout.cc (Layout::symtab_section_offset): New function.
1103         * gold/layout.h (Layout::symtab_section_offset): New function.
1104         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1105
1106 2011-04-12  Ian Lance Taylor  <[email protected]>
1107
1108         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1109         with MREMAP_MAYMOVE.
1110         * output.h (class Output_file): Add map_is_allocated_ field.
1111         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1112         not available, provide stubs.  If mremap is not available, #define
1113         it to gold_mremap.
1114         (MREMAP_MAYMOVE): Define if not defined.
1115         (Output_file::Output_file): Initialize map_is_allocated_.
1116         (Output_file::resize): Check map_is_allocated_.
1117         (Output_file::map_anonymous): If mmap fails, use malloc.
1118         (Output_file::unmap): Don't do anything for an anonymous map.
1119         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1120         is not available, provide stubs.
1121         (File_read::View::~View): Use free rather than delete[].
1122         (File_read::make_view): Use malloc rather than new[].  If mmap
1123         fails, use malloc.
1124         (File_read::find_or_make_view): Use malloc rather than new[].
1125         * gold.h: Remove HAVE_REMAP code.
1126         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1127         exists.  Rename mremap to gold_mremap.  If mmap is not available
1128         don't do anything.
1129         * configure, config.in: Rebuild.
1130
1131 2011-04-11  Ian Lance Taylor  <[email protected]>
1132
1133         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1134         initialize local variable v.
1135
1136 2011-04-11  Cary Coutant  <[email protected]>
1137
1138         * archive.cc (Archive::include_member): Adjust call to
1139         report_object.
1140         (Add_archive_symbols::run): Track argument serial numbers.
1141         (Lib_group::include_member): Likewise.
1142         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1143         * archive.h (Incremental_archive_entry::Archive_member):
1144         Initialize arg_serial_.
1145         (Archive_member::arg_serial_): New data member.
1146         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1147         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1148         incremental link.
1149         (Sized_dynobj::do_for_all_local_got_entries): New function.
1150         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1151         function.
1152         * fileread.cc (get_mtime): New function.
1153         * fileread.h (get_mtime): New function.
1154         * gold.cc (queue_initial_tasks): Check for incremental update.
1155         (process_incremental_input): New function.
1156         (queue_middle_tasks): Don't force valid target for incremental
1157         update.
1158         * incremental-dump.cc (find_input_containing_global): Adjust
1159         size of symbol info entry.
1160         (dump_incremental_inputs): Dump argument serial number and
1161         in_system_directory flag; bias shndx by 1; print symbol names
1162         when dumping per-file symbol lists; use new symbol info readers.
1163         * incremental.cc
1164         (Output_section_incremental_inputs:update_data_size): New function.
1165         (Sized_incremental_binary::setup_readers): Setup input readers
1166         for each input file; build maps for files added from libraries
1167         and scripts.
1168         (Sized_incremental_binary::check_input_args): New function.
1169         (Sized_incremental_binary::do_check_inputs): Build map of argument
1170         serial numbers to input arguments.
1171         (Sized_incremental_binary::do_file_has_changed): Rename
1172         do_file_is_unchanged to this; compare file modification times.
1173         (Sized_incremental_binary::do_init_layout): New function.
1174         (Sized_incremental_binary::do_reserve_layout): New function.
1175         (Sized_incremental_binary::do_get_input_reader): Remove.
1176         (Sized_incremental_binary::get_symtab_view): New function.
1177         (Incremental_checker::can_incrementally_link_output_file): Remove.
1178         (Incremental_inputs::report_command_line): Exclude --debug options.
1179         (Incremental_inputs::report_archive_begin): Add parameter; track
1180         argument serial numbers; don't put input file entry for archive
1181         before archive members.
1182         (Incremental_inputs::report_archive_end): Put input file entry
1183         for archive after archive members.
1184         (Incremental_inputs::report_object): Add parameter; track argument
1185         serial numbers and in_system_directory flag.
1186         (Incremental_inputs::report_script): Add parameter; track argument
1187         serial numbers.
1188         (Output_section_incremental_inputs::set_final_data_size): Adjust
1189         size of symbol info entry; check for forwarding symbols.
1190         (Output_section_incremental_inputs::write_input_files): Write
1191         in_system_directory flag and argument serial number.
1192         (Output_section_incremental_inputs::write_info_blocks): Map section
1193         indices between incremental info and original input file; store
1194         input section index for each symbol.
1195         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1196         change operator() to visit().
1197         (class Global_got_offset_visitor): Likewise.
1198         (class Global_symbol_visitor_got_plt):
1199         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1200         classes.
1201         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1202         (Sized_incr_relobj::do_read_symbols): New function.
1203         (Sized_incr_relobj::do_layout): New function.
1204         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1205         (Sized_incr_relobj::do_add_symbols): New function.
1206         (Sized_incr_relobj::do_should_include_member): New function.
1207         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1208         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1209         (Sized_incr_relobj::do_section_size): New function.
1210         (Sized_incr_relobj::do_section_name): New function.
1211         (Sized_incr_relobj::do_section_contents): New function.
1212         (Sized_incr_relobj::do_section_flags): New function.
1213         (Sized_incr_relobj::do_section_entsize): New function.
1214         (Sized_incr_relobj::do_section_address): New function.
1215         (Sized_incr_relobj::do_section_type): New function.
1216         (Sized_incr_relobj::do_section_link): New function.
1217         (Sized_incr_relobj::do_section_info): New function.
1218         (Sized_incr_relobj::do_section_addralign): New function.
1219         (Sized_incr_relobj::do_initialize_xindex): New function.
1220         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1221         (Sized_incr_relobj::do_read_relocs): New function.
1222         (Sized_incr_relobj::do_gc_process_relocs): New function.
1223         (Sized_incr_relobj::do_scan_relocs): New function.
1224         (Sized_incr_relobj::do_count_local_symbols): New function.
1225         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1226         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1227         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1228         (Sized_incr_relobj::do_relocate): New function.
1229         (Sized_incr_relobj::do_set_section_offset): New function.
1230         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1231         (Sized_incr_dynobj::do_read_symbols): New function.
1232         (Sized_incr_dynobj::do_layout): New function.
1233         (Sized_incr_dynobj::do_add_symbols): New function.
1234         (Sized_incr_dynobj::do_should_include_member): New function.
1235         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1236         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1237         (Sized_incr_dynobj::do_section_size): New function.
1238         (Sized_incr_dynobj::do_section_name): New function.
1239         (Sized_incr_dynobj::do_section_contents): New function.
1240         (Sized_incr_dynobj::do_section_flags): New function.
1241         (Sized_incr_dynobj::do_section_entsize): New function.
1242         (Sized_incr_dynobj::do_section_address): New function.
1243         (Sized_incr_dynobj::do_section_type): New function.
1244         (Sized_incr_dynobj::do_section_link): New function.
1245         (Sized_incr_dynobj::do_section_info): New function.
1246         (Sized_incr_dynobj::do_section_addralign): New function.
1247         (Sized_incr_dynobj::do_initialize_xindex): New function.
1248         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1249         (make_sized_incremental_object): New function.
1250         (Incremental_library::copy_unused_symbols): New function.
1251         (Incremental_library::do_for_all_unused_symbols): New function.
1252         * incremental.h (enum Incremental_input_flags): New type.
1253         (class Incremental_checker): Remove.
1254         (Incremental_input_entry::Incremental_input_entry): Add argument
1255         serial number.
1256         (Incremental_input_entry::arg_serial): New function.
1257         (Incremental_input_entry::set_is_in_system_directory): New function.
1258         (Incremental_input_entry::is_in_system_directory): New function.
1259         (Incremental_input_entry::arg_serial_): New data member.
1260         (Incremental_input_entry::is_in_system_directory_): New data member.
1261         (class Script_info): Move here from script.h.
1262         (Script_info::Script_info): Add filename parameter.
1263         (Script_info::filename): New function.
1264         (Script_info::filename_): New data member.
1265         (Incremental_script_entry::Incremental_script_entry): Add argument
1266         serial number.
1267         (Incremental_object_entry::Incremental_object_entry): Likewise.
1268         (Incremental_object_entry::add_input_section): Build list of input
1269         sections with map to original shndx.
1270         (Incremental_object_entry::get_input_section_index): New function.
1271         (Incremental_object_entry::shndx_): New data member.
1272         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1273         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1274         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1275         serial number.
1276         (Incremental_inputs::report_archive_begin): Likewise.
1277         (Incremental_inputs::report_object): Likewise.
1278         (Incremental_inputs::report_script): Likewise.
1279         (class Incremental_global_symbol_reader): New class.
1280         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1281         and store flags and input file type.
1282         (Incremental_input_entry_reader::arg_serial): New function.
1283         (Incremental_input_entry_reader::type): Extract type from flags.
1284         (Incremental_input_entry_reader::is_in_system_directory): New function.
1285         (Incremental_input_entry_reader::get_input_section_count): Call
1286         accessor function for type.
1287         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1288         function for type; adjust size of global symbol entry.
1289         (Incremental_input_entry_reader::get_global_symbol_count): Call
1290         accessor function for type.
1291         (Incremental_input_entry_reader::get_object_count): Likewise.
1292         (Incremental_input_entry_reader::get_object_offset): Likewise.
1293         (Incremental_input_entry_reader::get_member_count): Likewise.
1294         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1295         (Incremental_input_entry_reader::get_member_offset): Likewise.
1296         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1297         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1298         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1299         (Incremental_input_entry_reader::get_global_symbol_reader): New
1300         function.
1301         (Incremental_input_entry_reader::get_output_symbol_index): New
1302         function.
1303         (Incremental_input_entry_reader::type_): Remove.
1304         (Incremental_input_entry_reader::flags_): New data member.
1305         (Incremental_inputs_reader::input_file_offset): New function.
1306         (Incremental_inputs_reader::input_file_index): New function.
1307         (Incremental_inputs_reader::input_file): Call input_file_offset.
1308         (Incremental_inputs_reader::input_file_at_offset): New function.
1309         (Incremental_relocs_reader::get_r_type): Reformat.
1310         (Incremental_relocs_reader::get_r_shndx): Reformat.
1311         (Incremental_relocs_reader::get_r_offset): Reformat.
1312         (Incremental_relocs_reader::data): New function.
1313         (Incremental_binary::Incremental_binary): Initialize new data members.
1314         (Incremental_binary::check_inputs): Add cmdline parameter.
1315         (Incremental_binary::file_is_unchanged): Remove.
1316         (Input_reader::arg_serial): New function.
1317         (Input_reader::get_unused_symbol_count): New function.
1318         (Input_reader::get_unused_symbol): New function.
1319         (Input_reader::do_arg_serial): New function.
1320         (Input_reader::do_get_unused_symbol_count): New function.
1321         (Input_reader::do_get_unused_symbol): New function.
1322         (Incremental_binary::input_file_count): New function.
1323         (Incremental_binary::get_input_reader): Change signature to use
1324         index instead of filename.
1325         (Incremental_binary::file_has_changed): New function.
1326         (Incremental_binary::get_input_argument): New function.
1327         (Incremental_binary::get_library): New function.
1328         (Incremental_binary::get_script_info): New function.
1329         (Incremental_binary::init_layout): New function.
1330         (Incremental_binary::reserve_layout): New function.
1331         (Incremental_binary::output_file): New function.
1332         (Incremental_binary::do_check_inputs): New function.
1333         (Incremental_binary::do_file_is_unchanged): Remove.
1334         (Incremental_binary::do_file_has_changed): New function.
1335         (Incremental_binary::do_init_layout): New function.
1336         (Incremental_binary::do_reserve_layout): New function.
1337         (Incremental_binary::do_input_file_count): New function.
1338         (Incremental_binary::do_get_input_reader): Change signature.
1339         (Incremental_binary::input_args_map_): New data member.
1340         (Incremental_binary::library_map_): New data member.
1341         (Incremental_binary::script_map_): New data member.
1342         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1343         new data members.
1344         (Sized_incremental_binary::output_section): New function.
1345         (Sized_incremental_binary::inputs_reader): Add const.
1346         (Sized_incremental_binary::symtab_reader): Add const.
1347         (Sized_incremental_binary::relocs_reader): Add const.
1348         (Sized_incremental_binary::got_plt_reader): Add const.
1349         (Sized_incremental_binary::get_symtab_view): New function.
1350         (Sized_incremental_binary::Inputs_reader): New typedef.
1351         (Sized_incremental_binary::Input_entry_reader): New typedef.
1352         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1353         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1354         (Sized_incremental_binary::do_file_has_changed): New function.
1355         (Sized_incremental_binary::do_init_layout): New function.
1356         (Sized_incremental_binary::do_reserve_layout): New function.
1357         (Sized_input_reader::Inputs_reader): Remove.
1358         (Sized_input_reader::Input_entry_reader): Remove.
1359         (Sized_input_reader::do_arg_serial): New function.
1360         (Sized_input_reader::do_get_unused_symbol_count): New function.
1361         (Sized_input_reader::do_get_unused_symbol): New function.
1362         (Sized_incremental_binary::do_input_file_count): New function.
1363         (Sized_incremental_binary::do_get_input_reader): Change signature;
1364         use index instead of filename.
1365         (Sized_incremental_binary::section_map_): New data member.
1366         (Sized_incremental_binary::input_entry_readers_): New data member.
1367         (class Sized_incr_relobj): New class.
1368         (class Sized_incr_dynobj): New class.
1369         (make_sized_incremental_object): New function.
1370         (class Incremental_library): New class.
1371         * layout.cc (Free_list::num_lists): New static data member.
1372         (Free_list::num_nodes): New static data member.
1373         (Free_list::num_removes): New static data member.
1374         (Free_list::num_remove_visits): New static data member.
1375         (Free_list::num_allocates): New static data member.
1376         (Free_list::num_allocate_visits): New static data member.
1377         (Free_list::init): New function.
1378         (Free_list::remove): New function.
1379         (Free_list::allocate): New function.
1380         (Free_list::dump): New function.
1381         (Free_list::print_stats): New function.
1382         (Layout_task_runner::run): Resize output file for incremental updates.
1383         (Layout::Layout): Initialize new data members.
1384         (Layout::set_incremental_base): New function.
1385         (Layout::init_fixed_output_section): New function.
1386         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1387         incremental updates.
1388         (Layout::create_gold_note): Do not create gold note section for
1389         incremental updates.
1390         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1391         for incremental updates.
1392         (Layout::set_section_offsets): For incremental updates, allocate space
1393         from free list.
1394         (Layout::create_symtab_sections): Layout with offsets relative to
1395         start of section; for incremental updates, allocate space from free
1396         list.
1397         (Layout::create_shdrs): For incremental updates, allocate space from
1398         free list.
1399         (Layout::finish_dynamic_section): For incremental updates, do not
1400         check --as-needed (fixed in subsequent patch).
1401         * layout.h (class Free_list): New class.
1402         (Layout::set_incremental_base): New function.
1403         (Layout::incremental_base): New function.
1404         (Layout::init_fixed_output_section): New function.
1405         (Layout::allocate): New function.
1406         (Layout::incremental_base_): New data member.
1407         (Layout::free_list_): New data member.
1408         * main.cc (main): Print Free_list statistics.
1409         * object.cc (Relobj::finalize_incremental_relocs): Add
1410         clear_counts parameter; clear counts only when clear_counts is set.
1411         (Sized_relobj::Sized_relobj): Initialize new base class.
1412         (Sized_relobj::do_layout): Don't report special sections.
1413         (Sized_relobj::do_for_all_local_got_entries): New function.
1414         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1415         symtab_off to all symbol table offsets.
1416         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1417         * object.h (class Got_offset_list): Move to top of file.
1418         (Object::Object): Allow case where input_file == NULL.
1419         (Object::~Object): Likewise.
1420         (Object::input_file): Assert that input_file != NULL.
1421         (Object::lock): Allow case where input_file == NULL.
1422         (Object::unlock): Likewise.
1423         (Object::is_locked): Likewise.
1424         (Object::token): Likewise.
1425         (Object::release): Likewise.
1426         (Object::is_incremental): New function.
1427         (Object::get_mtime): New function.
1428         (Object::for_all_local_got_entries): New function.
1429         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1430         (Object::set_is_in_system_directory): New function.
1431         (Object::is_in_system_directory): New function.
1432         (Object::do_is_incremental): New function.
1433         (Object::do_get_mtime): New function.
1434         (Object::do_for_all_local_got_entries): New function.
1435         (Object::is_in_system_directory_): New data member.
1436         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1437         (class Sized_relobj_base): New class.
1438         (class Sized_relobj): Derive from Sized_relobj_base.
1439         (class Sized_relobj::Symbols): Redeclare from base class.
1440         (class Sized_relobj::local_got_offset_list): Remove.
1441         (class Sized_relobj::Output_sections): Redeclare from base class.
1442         (class Sized_relobj::do_for_all_local_got_entries): New function.
1443         (class Sized_relobj::write_local_symbols): Add offset parameter.
1444         (class Sized_relobj::local_symbol_offset_): Update comment.
1445         (class Sized_relobj::local_dynsym_offset_): Update comment.
1446         * options.cc (Input_arguments::add_file): Remove const.
1447         * options.h (Input_file_argument::Input_file_argument):
1448         Initialize arg_serial_ (all constructors).
1449         (Input_file_argument::set_arg_serial): New function.
1450         (Input_file_argument::arg_serial): New function.
1451         (Input_file_argument::arg_serial_): New data member.
1452         (Input_arguments::Input_arguments): Initialize file_count_.
1453         (Input_arguments::add_file): Remove const.
1454         (Input_arguments::number_of_input_files): New function.
1455         (Input_arguments::file_count_): New data member.
1456         (Command_line::number_of_input_files): Call
1457         Input_arguments::number_of_input_files.
1458         * output.cc (Output_segment_headers::Output_segment_headers):
1459         Set current size.
1460         (Output_section::Input_section::current_data_size): New function.
1461         (Output_section::Output_section): Initialize new data members.
1462         (Output_section::add_input_section): Don't do merge sections for
1463         an incremental link; allocate space from free list for an
1464         incremental update.
1465         (Output_section::add_output_section_data): Allocate space from
1466         free list for an incremental update.
1467         (Output_section::update_data_size): New function.
1468         (Output_section::set_fixed_layout): New function.
1469         (Output_section::reserve): New function.
1470         (Output_segment::set_section_addresses): Remove const.
1471         (Output_segment::set_section_list_addresses): Remove const; allocate
1472         space from free list for an incremental update.
1473         (Output_segment::set_offset): Adjust size of RELRO segment for an
1474         incremental update.
1475         * output.h (Output_data::current_data_size): Move here from
1476         child classes.
1477         (Output_data::pre_finalize_data_size): New function.
1478         (Output_data::update_data_size): New function.
1479         (Output_section_headers::update_data_size): new function.
1480         (Output_section_data_build::current_data_size): Move to Output_data.
1481         (Output_data_strtab::update_data_size): New function.
1482         (Output_section::current_data_size): Move to Output_data.
1483         (Output_section::set_fixed_layout): New function.
1484         (Output_section::has_fixed_layout): New function.
1485         (Output_section::reserve): New function.
1486         (Output_section::update_data_size): New function.
1487         (Output_section::has_fixed_layout_): New data member.
1488         (Output_section::free_list_): New data member.
1489         (Output_segment::set_section_addresses): Remove const.
1490         (Output_segment::set_section_list_addresses): Remove const.
1491         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1492         New function.
1493         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1494         New function.
1495         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1496         parameter when calling Add_symbols constructor; store argument
1497         serial number for members of a lib group.
1498         (Add_symbols::locks): Allow case where token == NULL.
1499         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1500         (Read_member::~Read_member): New function.
1501         (Read_member::is_runnable): New function.
1502         (Read_member::locks): New function.
1503         (Read_member::run): New function.
1504         (Check_script::~Check_script): New function.
1505         (Check_script::is_runnable): New function.
1506         (Check_script::locks): New function.
1507         (Check_script::run): New function.
1508         (Check_library::~Check_library): New function.
1509         (Check_library::is_runnable): New function.
1510         (Check_library::locks): New function.
1511         (Check_library::run): New function.
1512         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1513         (Add_symbols::library_): New data member.
1514         (class Read_member): New class.
1515         (class Check_script): New class.
1516         (class Check_library): New class.
1517         * reloc.cc (Read_relocs::is_runnable): Allow case where
1518         token == NULL.
1519         (Read_relocs::locks): Likewise.
1520         (Scan_relocs::locks): Likewise.
1521         (Relocate_task::locks): Likewise.
1522         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1523         to clear counters.
1524         (Sized_relobj::incremental_relocs_scan): Fix comment.
1525         (Sized_relobj::do_relocate): Pass output file offset to
1526         write_local_symbols.
1527         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1528         from class declaration.
1529         * script.cc (read_input_script): Allocate Script_info; pass
1530         argument serial number to report_script.
1531         * script.h (class Script_info): Move to incremental.h.
1532         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1533         * symtab.h (Symbol_table::add_from_incrobj): New function.
1534         (Symbol_table::set_file_offset): New function.
1535
1536 2011-04-05  Cary Coutant  <[email protected]>
1537
1538         * incremental-dump.cc (dump_incremental_inputs): Change signature
1539         to take a Sized_incremental_binary; change caller.  Use readers
1540         in Sized_incremental_binary.
1541         * incremental.cc
1542         (Sized_incremental_binary::find_incremental_inputs_sections):
1543         Rename do_find_incremental_inputs_sections to this.
1544         (Sized_incremental_binary::setup_readers): New function.
1545         (Sized_incremental_binary::do_check_inputs): Check
1546         has_incremental_info_ flag; move setup code to setup_readers;
1547         use input readers.
1548         (Sized_incremental_binary::do_file_is_unchanged): New function.
1549         (Sized_incremental_binary::do_get_input_reader): New function.
1550         * incremental.h (class Incremental_binary): Move to end of file.
1551         (Incremental_binary::file_is_unchanged): New function.
1552         (Incremental_binary::do_file_is_unchanged): New function.
1553         (Incremental_binary::Input_reader): New class.
1554         (Incremental_binary::get_input_reader): New function.
1555         (class Sized_incremental_binary): Move to end of file.
1556         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1557         input section reader classes.
1558         (Sized_incremental_binary::has_incremental_info): New function.
1559         (Sized_incremental_binary::inputs_reader): New function.
1560         (Sized_incremental_binary::symtab_reader): New function.
1561         (Sized_incremental_binary::relocs_reader): New function.
1562         (Sized_incremental_binary::got_plt_reader): New function.
1563         (Sized_incremental_binary::do_file_is_unchanged): New function.
1564         (Sized_incremental_binary::Sized_input_reader): New class.
1565         (Sized_incremental_binary::get_input_reader): New function.
1566         (Sized_incremental_binary::find_incremental_inputs_sections):
1567         Rename do_find_incremental_inputs_sections to this.
1568         (Sized_incremental_binary::setup_readers): New function.
1569         (Sized_incremental_binary::has_incremental_info_): New data member.
1570         (Sized_incremental_binary::inputs_reader_): New data member.
1571         (Sized_incremental_binary::symtab_reader_): New data member.
1572         (Sized_incremental_binary::relocs_reader_): New data member.
1573         (Sized_incremental_binary::got_plt_reader_): New data member.
1574         (Sized_incremental_binary::current_input_file_): New data member.
1575
1576 2011-04-05  Paul Pluzhnikov  <[email protected]>
1577
1578         PR gold/12640
1579         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1580         violation.
1581
1582 2011-03-30  Cary Coutant  <[email protected]>
1583
1584         * archive.cc (Archive::include_member): Adjust call to report_object.
1585         (Add_archive_symbols::run): Add script_info to call to
1586         report_archive_begin.
1587         (Lib_group::include_member): Adjust call to report_object.
1588         (Add_lib_group_symbols::run): Adjust call to report_object.
1589         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1590         blocks.  Add object count for script input files.
1591         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1592         script_info parameter; change all callers.
1593         (Incremental_inputs::report_object): Add script_info parameter;
1594         change all callers.
1595         (Incremental_inputs::report_script): Store backpointer to
1596         incremental info entry.
1597         (Output_section_incremental_inputs::set_final_data_size): Record
1598         additional information for scripts.
1599         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1600         * incremental.h (Incremental_script_entry::add_object): New function.
1601         (Incremental_script_entry::get_object_count): New function.
1602         (Incremental_script_entry::get_object): New function.
1603         (Incremental_script_entry::objects_): New data member; adjust
1604         constructor.
1605         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1606         (Incremental_inputs::report_object): Add script_info parameter.
1607         (Incremental_inputs_reader::get_object_count): New function.
1608         (Incremental_inputs_reader::get_object_offset): New function.
1609         * options.cc (Input_arguments::add_file): Return reference to
1610         new input argument.
1611         * options.h (Input_argument::set_script_info): New function.
1612         (Input_argument::script_info): New function.
1613         (Input_argument::script_info_): New data member; adjust all
1614         constructors.
1615         (Input_file_group::add_file): Return reference to new input argument.
1616         (Input_file_lib::add_file): Likewise.
1617         (Input_arguments::add_file): Likewise.
1618         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1619         * script.cc (Parser_closure::Parser_closure): Add script_info
1620         parameter; adjust all callers.
1621         (Parser_closure::script_info): New function.
1622         (Parser_closure::script_info_): New data member.
1623         (read_input_script): Report scripts earlier to incremental info.
1624         (script_add_file): Set script_info in Input_argument.
1625         (script_add_library): Likewise.
1626         * script.h (Script_options::Script_info): Rewrite class.
1627
1628 2011-03-29  Cary Coutant  <[email protected]>
1629
1630         * archive.cc (Library_base::should_include_member): Move
1631         method here from class Archive.
1632         (Archive::Archive): Initialize base class.
1633         (Archive::should_include_member): Move to base class.
1634         (Archive::do_for_all_unused_symbols): New function.
1635         (Add_archive_symbols::run): Remove redundant access to
1636         incremental_inputs.
1637         (Lib_group::Lib_group): Initialize base class.
1638         (Lib_group::do_filename): New function.
1639         (Lib_group::include_member): Pass pointer to Lib_group to
1640         report_object.
1641         (Lib_group::do_for_all_unused_symbols): New function.
1642         (Add_lib_group_symbols::run): Report archive information for
1643         incremental links.
1644         * archive.h (class Library_base): New base class.
1645         (class Archive): Derive from Library_base.
1646         (Archive::filename): Move to base class.
1647         (Archive::set_incremental_info): Likewise.
1648         (Archive::incremental_info): Likewise.
1649         (Archive::Should_include): Likewise.
1650         (Archive::should_include_member): Likewise.
1651         (Archive::Armap_entry): Remove.
1652         (Archive::Unused_symbol_iterator): Remove.
1653         (Archive::unused_symbols_begin): Remove.
1654         (Archive::unused_symbols_end): Remove.
1655         (Archive::do_filename): New function.
1656         (Archive::do_get_mtime): New function.
1657         (Archive::do_for_all_unused_symbols): New function.
1658         (Archive::task_): Move to base class.
1659         (Archive::incremental_info_): Likewise.
1660         (class Lib_group): Derive from Library_base.
1661         (Lib_group::do_filename): New function.
1662         (Lib_group::do_get_mtime): New function.
1663         (Lib_group::do_for_all_unused_symbols): New function.
1664         (Lib_group::task_): Move to base class.
1665         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1666         function.
1667         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1668         function.
1669         * incremental.cc (Incremental_inputs::report_archive_begin):
1670         Use Library_base; call library's get_mtime; add incremental inputs
1671         entry before members.
1672         (class Unused_symbol_visitor): New class.
1673         (Incremental_inputs::report_archive_end): Use Library_base; use
1674         visitor class to record unused symbols; don't add incremental inputs
1675         entry after members.
1676         (Incremental_inputs::report_object): Use Library_base.
1677         * incremental.h
1678         (Incremental_archive_entry::Incremental_archive_entry): Remove
1679         unused Archive parameter.
1680         (Incremental_inputs::report_archive_begin): Use Library_base.
1681         (Incremental_inputs::report_archive_end): Likewise.
1682         (Incremental_inputs::report_object): Likewise.
1683         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1684         function.
1685         * object.h (Object::for_all_global_symbols): New function.
1686         (Object::do_for_all_global_symbols): New function.
1687         (Sized_relobj::do_for_all_global_symbols): New function.
1688         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1689         function.
1690         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1691         function.
1692
1693 2011-03-27  Ian Lance Taylor  <[email protected]>
1694
1695         * archive.cc (Archive::interpret_header): Return -1 if something
1696         goes wrong.  Change callers accordingly.
1697
1698 2011-03-25  Cary Coutant  <[email protected]>
1699
1700         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1701         * testsuite/Makefile.in: Regenerate.
1702
1703 2010-03-23  Rafael Ávila de Espíndola <[email protected]>
1704
1705         * plugin.cc (get_view): New.
1706         (Plugin::load): Pass get_view to the plugin.
1707         (Plugin_manager::get_view): New.
1708
1709 2011-03-21  Ian Lance Taylor  <[email protected]>
1710
1711         * testsuite/final_layout.sh: Rewrite to not use dc.
1712         * testsuite/relro_test.sh: Fail if dc is not present.
1713
1714 2011-03-21  Sriraman Tallam  <[email protected]>
1715
1716         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1717         Change == to -eq.
1718         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1719         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1720         Change == to -eq.
1721         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1722         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1723
1724 2011-03-14  Ian Lance Taylor  <[email protected]>
1725
1726         * script-sections.cc (Sort_output_sections::script_compare):
1727         Rename from is_before, change return type.
1728         (Sort_output_sections::operator()): Adjust accordingly.
1729
1730 2011-03-11  Jeffrey Yasskin  <[email protected]>
1731
1732         PR gold/12572
1733         * testsuite/odr_violation2.cc: Add comment to make all error line
1734         numbers double digits.
1735         * testsuite/debug_msg.sh: Adjust expected errors.
1736
1737 2011-03-09  Jeffrey Yasskin  <[email protected]>
1738
1739         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1740         but mark earlier ones as non-canonical
1741         (offset_to_iterator): Update search target and example
1742         (do_addr2line): Return extra lines in a vector*
1743         (format_file_lineno): Extract from do_addr2line
1744         (one_addr2line): Add vector* out-param
1745         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1746         when a lineno entry appeared last for its instruction
1747         (Dwarf_line_info): Add vector* out-param
1748         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1749         * symtab.cc (Odr_violation_compare): Include the lineno in the
1750         comparison again.
1751         (linenos_from_loc): New. Combine the canonical line for an
1752         address with its other lines.
1753         (True_if_intersect): New. Helper functor to make
1754         std::set_intersection a query.
1755         (detect_odr_violations): Compare sets of lines instead of just
1756         one line for each function. This became less deterministic, but
1757         has fewer false positives.
1758         * symtab.h: Declarations.
1759         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1760         mix an optimized and non-optimized object in the same binary
1761         (odr_violation2.so): Same.
1762         * testsuite/Makefile.in: Regenerate from Makefile.am.
1763         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1764         * testsuite/debug_msg.sh: Update line numbers and add
1765         assertions.
1766         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1767         non-optimized context.
1768         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1769         isn't inlined, and use OdrDerived in an optimized context.
1770         * testsuite/odr_header1.h: Defines OdrDerived, where
1771         optimization will change the
1772         first-instruction-in-the-destructor's file and line number.
1773         * testsuite/odr_header2.h: Defines OdrBase.
1774
1775 2011-03-09  Ian Lance Taylor  <[email protected]>
1776
1777         * fileread.cc (File_read::clear_views): Don't delete the whole
1778         file view.
1779
1780 2011-03-08  Ian Lance Taylor  <[email protected]>
1781
1782         PR gold/12525
1783         * fileread.cc: #include <climits>.
1784         (GOLD_IOV_MAX): Define.
1785         (File_read::read_multiple): Limit number of entries by iov_max.
1786         * fileread.h (class File_read): Always set max_readv_entries to
1787         128.
1788
1789 2011-03-07  Ian Lance Taylor  <[email protected]>
1790
1791         PR gold/12525
1792         * options.h (class General_options): Add -dy and -dn.
1793
1794 2011-03-02  Cary Coutant  <[email protected]>
1795
1796         * testsuite/script_test_9.t: Add TLS segment.
1797
1798 2011-03-02  Simon Baldwin  <[email protected]>
1799
1800         * configure.ac: Add check for gnu_indirect_function support in
1801         the toolchain building binutils.
1802         * configure: Rebuild.
1803
1804 2010-02-18  Rafael Ávila de Espíndola <[email protected]>
1805
1806         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1807         plugin only symbols.
1808         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1809         in plugin files as not needed in the symbol table.
1810
1811 2011-02-11  Sriraman Tallam  <[email protected]>
1812
1813         * output.cc (Output_section::add_input_section): Delay fill
1814         generation for section ordering.
1815
1816 2011-02-09  Ian Lance Taylor  <[email protected]>
1817
1818         PR gold/12316
1819         * object.h (class Sized_relobj): Remove clear_local_symbols.
1820         * reloc.cc (Sized_relobj::do_relocate): Don't call
1821         clear_local_symbols.
1822
1823 2010-02-08  Rafael Ávila de Espíndola <[email protected]>
1824
1825         * plugin.cc (is_visible_from_outside): Return true for symbols
1826         in the -u option.
1827
1828 2011-02-04  Jeffrey Yasskin  <[email protected]>
1829
1830         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1831         filename.
1832
1833 2011-02-02  Sriraman Tallam  <[email protected]>
1834
1835         * icf.h (is_section_foldable_candidate): Change type of parameter
1836         to std::string.
1837         * icf.cc (Icf::find_identical_sections): Change type of local variable
1838         section_name to be std::string.
1839         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1840
1841 2011-01-25  Ian Lance Taylor  <[email protected]>
1842
1843         * script.cc (script_add_extern): Rewrite to use
1844         add_symbol_reference.
1845
1846 2011-01-25  Doug Kwan  <[email protected]>
1847
1848         * icf.cc (get_section_contents): Always lock section's object.
1849
1850 2011-01-24  Ian Lance Taylor  <[email protected]>
1851
1852         * options.h (class General_options): Accept
1853         --no-detect-odr-violations.
1854
1855 2011-01-24  Ian Lance Taylor  <[email protected]>
1856
1857         * version.cc (version_string): Bump to 1.11.
1858
1859 2011-01-24  Ian Lance Taylor  <[email protected]>
1860
1861         * plugin.cc (class Plugin_rescan): Define new class.
1862         (Plugin_manager::claim_file): Set any_claimed_.
1863         (Plugin_manager::save_archive): New function.
1864         (Plugin_manager::save_input_group): New function.
1865         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1866         necessary.
1867         (Plugin_manager::new_undefined_symbol): New function.
1868         (Plugin_manager::rescan): New function.
1869         (Plugin_manager::rescannable_defines): New function.
1870         (Plugin_manager::add_input_file): Set any_added_.
1871         * plugin.h (class Plugin_manager): define new fields rescannable_,
1872         undefined_symbols_, any_claimed_, and any_added_.  Declare
1873         Plugin_rescan as friend.  Declare new functions.
1874         (Plugin_manager::Rescannable): Define type.
1875         (Plugin_manager::Rescannable_list): Define type.
1876         (Plugin_manager::Undefined_symbol_list): Define type.
1877         (Plugin_manager::Plugin_manager): Initialize new fields.
1878         * archive.cc (Archive::defines_symbol): New function.
1879         (Add_archive_symbols::run): Pass archive to plugins if any.
1880         * archive.h (class Archive): Declare defines_symbol.
1881         * readsyms.cc (Input_group::~Input_group): New function.
1882         (Finish_group::run): Pass input_group to plugins if any.
1883         * readsyms.h (class Input_group): Declare destructor.
1884         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1885         any.
1886
1887 2011-01-10  Ian Lance Taylor  <[email protected]>
1888
1889         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1890         section as relro.
1891         (Layout::set_segment_offsets): Reset increase_relro before calling
1892         set_section_addresses a second time.
1893
1894 2011-01-04  Cary Coutant  <[email protected]>
1895
1896         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1897         sections before NOBITS sections.
1898
1899 2011-01-01  H.J. Lu  <[email protected]>
1900
1901         * version.cc (print_version): Update copyright to 2011.
1902
1903 2010-12-23  Cary Coutant  <[email protected]>
1904
1905         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1906         of OS to this->add.  Add OD parameter to second form of the function.
1907
1908 2010-12-20  Ian Lance Taylor  <[email protected]>
1909
1910         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1911         second of two consecutive entries with same offset.
1912
1913 2010-12-16  Ralf Wildenhues  <[email protected]>
1914
1915         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1916         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1917         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1918         to avoid unneeded links against $(LDADD).
1919         * testsuite/Makefile.in: Regenerate.
1920
1921 2010-12-15  Ian Lance Taylor  <[email protected]>
1922
1923         PR gold/12324
1924         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1925         for R_X86_64_32 and R_X86_64_PC32.
1926         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1927         ver_matching_def_pic.o.
1928         (ver_matching_def_pic.o): New target.
1929
1930 2010-12-14  Ralf Wildenhues  <[email protected]>
1931
1932         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1933         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1934         Move definition before File_read::View member definitions.
1935         (File_read::View::~View): Initialize and hold lock before
1936         updating current_mapped_bytes.
1937
1938 2010-12-14  Ralf Wildenhues  <[email protected]>
1939
1940         * dwarf_reader.cc: Remove outdated comment.
1941         * gold-threads.cc: Fix typo in error message.
1942         * archive.cc: Fix typos in comments.
1943         * archive.h: Likewise.
1944         * arm-reloc-property.cc: Likewise.
1945         * arm-reloc-property.h: Likewise.
1946         * arm-reloc.def: Likewise.
1947         * arm.cc: Likewise.
1948         * attributes.h: Likewise.
1949         * cref.cc: Likewise.
1950         * ehframe.cc: Likewise.
1951         * fileread.h: Likewise.
1952         * gold.h: Likewise.
1953         * i386.cc: Likewise.
1954         * icf.cc: Likewise.
1955         * incremental.h: Likewise.
1956         * int_encoding.cc: Likewise.
1957         * layout.h: Likewise.
1958         * main.cc: Likewise.
1959         * merge.h: Likewise.
1960         * object.cc: Likewise.
1961         * object.h: Likewise.
1962         * options.cc: Likewise.
1963         * readsyms.cc: Likewise.
1964         * reduced_debug_output.cc: Likewise.
1965         * reloc.cc: Likewise.
1966         * script-sections.cc: Likewise.
1967         * sparc.cc: Likewise.
1968         * symtab.h: Likewise.
1969         * target-reloc.h: Likewise.
1970         * target.cc: Likewise.
1971         * target.h: Likewise.
1972         * timer.cc: Likewise.
1973         * timer.h: Likewise.
1974         * x86_64.cc: Likewise.
1975
1976 2010-12-09  Cary Coutant  <[email protected]>
1977
1978         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1979         stack.
1980         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1981         parameter; change all callers.
1982         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1983         * options.h (warn_execstack): New option.
1984
1985 2010-12-07  Doug Kwan  <[email protected]>
1986
1987         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1988         like function call relocations.
1989
1990 2010-12-07  Ian Lance Taylor  <[email protected]>
1991
1992         * archive.cc (Archive::get_elf_object_for_member): Permit
1993         punconfigured to be NULL.
1994         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1995         (Archive::include_member): Pass NULL to get_elf_object_for_member
1996         if we searched for the archive and this is the first included
1997         object.
1998
1999 2010-12-01  Ian Lance Taylor  <[email protected]>
2000
2001         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2002         track_relocs_type_ field.
2003         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2004         Set track_relocs_type_.
2005         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2006         contents when using RELA relocs.
2007         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2008         reloc_map_.
2009         * reloc.cc (Track_relocs::next_addend): New function.
2010         * reloc.h (class Track_relocs): Declare next_addend.
2011
2012 2010-12-01  Ian Lance Taylor  <[email protected]>
2013
2014         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2015         virtual destructor.
2016
2017 2010-12-01  Ian Lance Taylor  <[email protected]>
2018
2019         * README: Update compilers known to work and fail.
2020
2021 2010-11-23  Matthias Klose  <[email protected]>
2022
2023         * configure.in: For --enable-gold, handle value `default' instead of
2024         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2025         not the default.
2026         * configure: Regenerate.
2027
2028 2010-11-18  Doug Kwan  <[email protected]>
2029
2030         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2031         and right_alignment to be zero.  Store result alignment only if it is
2032         greater than existing alignment.
2033
2034 2010-11-16  Cary Coutant  <[email protected]>
2035
2036         PR gold/12220
2037         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2038         Check for ".zdebug_line".
2039
2040 2010-11-16  Doug Kwan  <[email protected]>
2041             Cary Coutant  <[email protected]>
2042
2043         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2044         by reference; adjust all callers.
2045         * output.cc (Output_segment::set_section_addresses): Adjust references
2046         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2047         list is empty.
2048         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2049         end at page boundary.
2050
2051 2010-11-16  Cary Coutant  <[email protected]>
2052
2053         PR gold/12220
2054         * layout.cc (Layout::choose_output_section): Transform names of
2055         compressed sections even when using a script with a SECTIONS clause.
2056         (Layout::output_section_name): Remove code to transform
2057         compressed debug section names.
2058         * output.cc (Output_section::add_input_section): Use uncompressed
2059         section size when tracking input sections.
2060
2061 2010-11-11  Richard Sandiford  <[email protected]>
2062
2063         * symtab.h (Symbol::NON_PIC_REF): Remove.
2064         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2065         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2066         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2067         (Symbol::use_plt_offset): Take a flags argument and pass it
2068         directly to needs_dynamic_reloc.  Restrict check for undefined
2069         weak symbols to function calls.
2070         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2071         (Target_arm::Scan::global): Use it.
2072         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2073         (Target_arm::Relocate::relocate): Likewise.
2074         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2075         parameter with an r_type parameter.  Use get_reference_flags
2076         to get the flags.
2077         (Target_arm::Relocate::relocate): Update accordingly.
2078         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2079         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2080         (Target_i386::Scan::global): Likewise.
2081         (Target_i386::Relocate::relocate): Likewise.
2082         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2083         parameter with an r_type parameter.  Use get_reference_flags
2084         to get the flags.
2085         (Target_i386::Relocate::relocate): Update accordingly.
2086         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2087         (Target_powerpc::Scan::global): Use it.
2088         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2089         (Target_powerpc::Relocate::relocate): Likewise.
2090         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2091         (Target_sparc::Scan::global): Use it.
2092         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2093         (Target_sparc::Relocate::relocate): Likewise.
2094         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2095         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2096         (Target_x86_64::Scan::global): Likewise.
2097         (Target_x86_64::Relocate::relocate): Likewise.
2098
2099 2010-11-08  Doug Kwan  <[email protected]>
2100             Cary Coutant  <[email protected]>
2101
2102         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2103         (Arm_exidx_merge_section::section_contents_): New data member.
2104         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2105         (Arm_input_section::~Arm_input_section): De-allocate memory.
2106         (Arm_input_section::original_contents_): New data member.       
2107         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2108         in parameters instead of calling Object::section_contents without
2109         locking.
2110         (Arm_output_section::group_section): New parameter TASK.  Pass it
2111         to callees that need locking objects.
2112         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2113         to lock EXIDX input sections.  Fix a formatting issue.  Call
2114         Arm_exidx_merged_section::build_contents to create merged section
2115         contents.
2116         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2117         to lock object of stub table owner.
2118         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2119         TEXT_SIZE to initialize data member TEXT_SIZE_.
2120         (Arm_exidx_input_section::addralign): Fix typo in comment.
2121         (Arm_exidx_input_section::text_size): New method.
2122         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2123         that require locking objects.  Lock objects before scanning for stubs
2124         and updating local symbols.
2125         (Arm_input_section<big_endian>::init): Copy contents of original
2126         input section.
2127         (Arm_input_section<big_endian>::do_write): Use saved contents of
2128         original input section instead of calling Object::section_contents
2129         without locking.
2130         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2131         size without calling Object::section_size().
2132         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2133         for size.  Allocate a buffer for merged EXIDX entries.
2134         (Arm_exidx_merged_section::build_contents): New method.
2135         (Arm_exidx_merged_section::do_write): Move merge section contents
2136         building code to Arm_exidx_merged_section::build_contetns.  Write
2137         out contetns in buffer instead of building it on the fly.
2138         (Arm_relobj::make_exidx_input_section): Also pass text section size
2139         to Arm_exidx_input_section constructor.
2140         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2141         (Arm_dynobj::do_read_symbols): Fix memory leak.
2142         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2143         * target.h: (class Task): Add forward declaration.
2144         (Target::relax): Add new parameter TASK and pass it to
2145         Target::do_relax().
2146         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2147
2148 2010-11-05  Cary Coutant  <[email protected]>
2149
2150         PR gold/10708
2151         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2152         object when reading from the file.
2153         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2154         second layout pass.
2155         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2156         when reading section contents.
2157         (get_section_contents): Likewise.
2158         (icf::find_identical_sections): Likewise.
2159         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2160         object when reading from the file.
2161         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2162         the object when doing deferred section layout.
2163
2164 2010-11-03  Nick Clifton  <[email protected]>
2165
2166         PR gold/12001
2167         * script.h (class Symbol_assignment: name): New member.  Returns
2168         the name of the symbol.
2169         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2170         Returns true if the given symbol name is on the list of
2171         assignments wating to be processed.
2172         * archive.cc (should_incldue_member): If the symbol is undefined,
2173         check to see if it is on the list of symbols pending assignment.
2174
2175 2010-11-03  Ryan Mansfield  <[email protected]>
2176
2177         * script-sections.cc (Script_sections::find_memory_region): Check
2178         for a NULL output section pointer.
2179
2180 2010-10-29  Doug Kwan  <[email protected]>
2181
2182         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2183         Output_section::add_relaxed_input_section.
2184         * output.cc (Output_section::add_relaxed_input_section): Add new
2185         arguments LAYOUT and NAME.  Set section order index.
2186         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2187         Copy section order index.
2188         * output.h (Output_section::add_relaxed_input_section): Add new
2189         arguments LAYOUT and NAME.
2190
2191 2010-10-29  Viktor Kutuzov  <[email protected]>
2192
2193         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2194         NATIVE_OR_CROSS_LINKER.
2195         * testsuite/Makefile.in: Regenerate.
2196
2197 2010-10-20  Doug Kwan  <[email protected]>
2198
2199         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2200         without SHF_LINK_ORDER flags.
2201         * layout.cc (Layout::choose_output_section): Do not filter
2202         SHF_LINK_ORDER flag in a relocatable link.
2203
2204 2010-10-17  Cary Coutant  <[email protected]>
2205
2206         * output.h (Output_segment::set_section_addresses): Change function
2207         signature.  Update all callers.
2208         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2209         sections.
2210         (Output_segment::set_section_addresses): Align after last TLS
2211         section.  Add padding before last relro section instead of after.
2212
2213 2010-10-17  Doug Kwan  <[email protected]>
2214
2215         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2216         GOT output section to be writable.
2217
2218 2010-10-14  Cary Coutant  <[email protected]>
2219
2220         * debug.h (DEBUG_INCREMENTAL): New flag.
2221         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2222         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2223         mode.
2224         * incremental.cc (report_command_line): Ignore all forms of
2225         --incremental.
2226         * layout.cc (Layout::Layout): Check parameters for incremental link
2227         mode.
2228         * options.cc (General_options::parse_incremental): New function.
2229         (General_options::parse_no_incremental): New function.
2230         (General_options::parse_incremental_full): New function.
2231         (General_options::parse_incremental_update): New function.
2232         (General_options::incremental_mode_): New data member.
2233         (General_options::finalize): Check incremental_mode_.
2234         * options.h (General_options): Update help text for --incremental.
2235         Add --no-incremental, --incremental-full, --incremental-update.
2236         (General_options::Incremental_mode): New enum type.
2237         (General_options::incremental_mode): New function.
2238         (General_options::incremental_mode_): New data member.
2239         * parameters.cc (Parameters::incremental_mode_): New data member.
2240         (Parameters::set_options): Set incremental_mode_.
2241         (Parameters::set_incremental_full): New function.
2242         (Parameters::incremental): New function.
2243         (Parameters::incremental_update): New function.
2244         (set_parameters_incremental_full): New function.
2245         * parameters.h (Parameters::set_incremental_full): New function.
2246         (Parameters::incremental): New function.
2247         (Parameters::incremental_update): New function.
2248         (Parameters::incremental_mode_): New data member.
2249         (set_parameters_incremental_full): New function.
2250         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2251         incremental link mode.
2252         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2253         (Sized_relobj::do_relocate_sections): Likewise.
2254         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2255         option.
2256         * testsuite/Makefile.in: Regenerate.
2257         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2258
2259 2010-10-12  Viktor Kutuzov  <[email protected]>
2260
2261         * script-sections.h (class Script_sections): Make
2262         Sections_elements typedef public.
2263         * script-sections.cc (class Sort_output_sections): Add elements_
2264         field.  Add constructor which sets it; change all callers.
2265         (Sort_output_sections::is_before): New function.
2266         (Sort_output_sections::operator()): Call is_before.
2267         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2268         conditional.
2269         * testsuite/script_test_10.sh: New test. Test script section
2270         order.
2271         * testsuite/script_test_10.t: Likewise.
2272         * testsuite/script_test_10.s: Likewise.
2273         * testsuite/Makefile.am: Wrap the cross linker tests and the
2274         common tests into NATIVE_OR_CROSS_LINKER.
2275         (check_SCRIPTS): Add script_test_10.sh.
2276         (check_DATA): Add script_test_10.stdout.
2277         (script_test_10.o, script_test_10): New targets.
2278         (script_test_10.stdout): New target.
2279         * configure, testsuite/Makefile.in: Regenerate.
2280
2281 2010-10-12  Viktor Kutuzov  <[email protected]>
2282
2283         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2284         error for the deprecated relocations.
2285         (Target_arm::Scan::global): Likewise.
2286         (Target_arm::Relocate::relocate): Likewise.
2287
2288 2010-10-12  Richard Sandiford  <[email protected]>
2289
2290         * fileread.cc (Input_file::find_file): Initialize *found_name
2291         and *namep when using the fallback search for case 4.
2292
2293 2010-10-11  Cary Coutant  <[email protected]>
2294
2295         * options.h (class General_options): Redefine -z lazy as an alias for
2296         the negation of -z now.
2297
2298 2010-10-11  Ian Lance Taylor  <[email protected]>
2299
2300         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2301         binding.
2302
2303 2010-10-06  Nick Clifton  <[email protected]>
2304
2305         * script-sections.cc(class Memory_region): Remove
2306         current_lma_offset_ field.  Rename current_vma_offset_ to
2307         current_offset_.  Add last_section_ field.
2308         (Memory_region::get_current_vma_address): Rename to
2309         get_current_address.
2310         (Memory_region::get_current_lma_address): Delete.
2311         (Memory_region::increment_vma_offset): Rename to
2312         increment_offset.
2313         (Memory_region::increment_lma_offset): Delete.
2314         (Memory_region::attributes_compatible): New method.  Returns
2315         true if the provided section is compatible with the region.
2316         (Memory_region::get_last_section): New method.  Returns the last
2317         section to use the region.
2318         (Memory_region::set_last_section): New method.  Stores the last
2319         section to use the region.
2320         (Script_sections::block_in_region): New method.  Returns true if
2321         a block of memory is contained within a region.
2322         (Script_sections::find_memory_region): New method.  Locates a
2323         memory region to be used to set a VMA or LMA address.
2324         (Output_section_definition::set_section_addresses): Add code to
2325         check for addresses set by memory regions.
2326         (Output_segment::set_section_addresses): Remove memory region
2327         walking code.
2328         (Script_sections::create_segment): Add a warning if a header
2329         segment is created outside of any region.
2330         * script-sections.h (class Script_sections): Add prototypes for
2331         find_memory_region and block_in_region methods.
2332         * testsuite/memory_test.s: Use .long instead of .word.
2333         * testsuite/memory_test.t: Add some more output sections.
2334         * testsuite/memory_test.sh: Update expected output.
2335
2336 2010-10-02  Doug Kwan  <[email protected]>
2337
2338         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2339         defintion to symtab.h
2340         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2341         declaration to defintion.
2342
2343 2010-10-01  Nick Clifton  <[email protected]>
2344
2345         * expression.cc (eval): Replace dummy argument with NULL.
2346         (eval_maybe_dot): Check for a NULL result section pointer.
2347         (Symbol_expression::value): Likewise.
2348         (Dot_expression::value): Likewise.
2349         (BINARY_EXPRESSION): Likewise.
2350         (Max_expression::value): Likewise.
2351         (Min_expression::value): Likewise.
2352         (Absolute_expression::value): Likewise.
2353         (Addr_expression::value_from_output_section): Likewise.
2354         (Loaddddr_expression::value_from_output_section): Likewise.
2355         (Segment_start_expression::value): Likewise.
2356         * script-sections.cc
2357         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2358         argument with NULL.
2359         (Sections_elememt_dot_assignment::set_section_addresses):
2360         Likewise.
2361         (Output_data_expression::do_write_to_buffer): Likewise.
2362         (Output_section_definition::finalize_symbols): Likewise.
2363         (Output_section_definition::set_section_addresses): Likewise.
2364
2365 2010-09-30  Doug Kwan  <[email protected]>
2366
2367         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2368
2369 2010-09-28  Sriraman Tallam  <[email protected]>
2370
2371         * target.h (Target::can_icf_inline_merge_sections): New virtual
2372         function.
2373         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2374         virtual function.
2375         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2376         virtual function.
2377         * icf.cc (get_section_contents): Inline merge sections only when
2378         target allows it.
2379
2380 2010-09-27  Ralf Wildenhues  <[email protected]>
2381
2382         * configure: Regenerate.
2383
2384 2010-09-17  Ian Lance Taylor  <[email protected]>
2385
2386         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2387         * testsuite/Makefile.am (memory_test.o): New target.
2388         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2389         memory_test.t.
2390         * testsuite/Makefile.in: Rebuild.
2391
2392 2010-09-17  Doug Kwan  <[email protected]>
2393
2394         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2395         defintion if relocation uses GOT entries of the symbol.
2396         * testsuite/icf_safe_test.sh: Fix test.
2397         * testsuite/icf_safe_so_test.sh: Fix test.
2398
2399 2010-09-16  Cary Coutant  <[email protected]>
2400
2401         * script_sections.cc (class Memory_region): Remove "NULL" from
2402         vector initializations.
2403
2404 2010-09-15  Cary Coutant  <[email protected]>
2405
2406         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2407         Resolve forwarding symbols.
2408
2409 2010-09-15  Doug Kwan  <[email protected]>
2410
2411         * gold/testsuite/script_test_3.t: Add ARM special sections.
2412         * gold/testsuite/script_test_4.t: Same.
2413         * gold/testsuite/script_test_5.t: Same.
2414         * gold/testsuite/script_test_6.t: Same.
2415         * gold/testsuite/script_test_7.t: Same.
2416         * gold/testsuite/script_test_7.t: Same.
2417         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2418
2419 2010-09-14  Cary Coutant  <[email protected]>
2420
2421         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2422         (Target_x86_64::Relocate::relocate_tls): Replace check for
2423         saw_tls_block_reloc_ with test for executable section.
2424
2425 2010-09-12  Cary Coutant  <[email protected]>
2426
2427         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2428         position-independent executables to shared libraries need dynamic
2429         relocations.
2430         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2431         position-independent executables.
2432         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2433         * testsuite/Makefile.in: Regenerate.
2434
2435 2010-09-10  Nick Clifton  <[email protected]>
2436
2437         PR gold/11997
2438         * testsuite/memory_test.t: Discard any sections that are not
2439         needed.
2440
2441 2010-09-09  H.J. Lu  <[email protected]>
2442
2443         PR gold/11996
2444         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2445         "This::" to work around a bug in gcc 4.2.
2446
2447         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2448
2449 2010-09-09  Rafael Espindola  <[email protected]>
2450
2451         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2452         sections with different PF_X flags in the same segment.
2453         (Layout::find_first_load_seg): Search all segments to find the first
2454         one.
2455         * options.h (rosegment): New.
2456
2457 2010-09-08  Rafael Espindola  <[email protected]>
2458
2459         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2460
2461 2010-09-08  Doug Kwan  <[email protected]>
2462
2463         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2464         (Arm_relobj::do_relocate_sections): Add new parameter for output
2465         file to match the parent.
2466         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2467         of local symbols instead of input values.  Update code to track
2468         changes in gold::relocate_section.
2469         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2470         (Sized_relobj::compute_final_local_value_internal): New methods.
2471         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2472         body into private version of Sized_relobj::compute_final_local_value.
2473         Call the inline method.
2474         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2475         merged symbol value if there is one.
2476         (Symbol_value::has_output_value): New method defintiion.
2477         (Sized_relobj::Compute_final_local_value_status): New enum type.
2478         (Sized_relobj::compute_final_local_value): New methods.
2479         (Sized_relobj::compute_final_local_value_internal): New methods.
2480         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2481         and arm_cortex_a8.sh.
2482         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2483         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2484         New tests.
2485         * Makefile.in: Regenerate.
2486         * testsuite/arm_bl_out_of_range.s: Update test.
2487         * testsuite/thumb_bl_out_of_range.s: Ditto.
2488         * testsuite/thumb_blx_out_of_range.s: Ditto.
2489         * testsuite/arm_branch_out_of_range.sh: New file.
2490         * testsuite/arm_cortex_a8.sh: Ditto.
2491         * testsuite/arm_cortex_a8_b.s: Ditto.
2492         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2493         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2494         * testsuite/arm_cortex_a8_bl.s: Ditto.
2495         * testsuite/arm_cortex_a8_blx.s: Ditto.
2496         * testsuite/arm_cortex_a8_local.s: Ditto.
2497         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2498         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2499
2500 2010-09-08  Rafael Espindola  <[email protected]>
2501
2502         * Makefile.am (memory_test.stdout): Run readelf with -W.
2503         * Makefile.in: Regenerate.
2504         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2505         64 bit output.
2506
2507 2010-09-08  Rafael Espindola  <[email protected]>
2508
2509         * script-sections.cc (Script_sections::add_memory_region): Convert
2510         field precision to int.
2511         * script.cc (script_set_section_region, script_set_section_region):
2512         Convert field precision to int.
2513
2514 2010-09-08  Rafael Espindola  <[email protected]>
2515
2516         * arm.cc (do_finalize_sections): Create the __exidx_start and
2517         __exdix_end symbols even when the section is missing.
2518
2519 2010-09-08  Nick Clifton  <[email protected]>
2520
2521         * README: Remove claim that MEMORY is not supported.
2522         * expression.cc (script_exp_function_origin)
2523         (script_exp_function_length): Move from here to ...
2524         * script.cc: ... here.
2525         (script_set_section_region, script_add_memory)
2526         (script_parse_memory_attr, script_include_directive): New
2527         functions.
2528         * script-sections.cc
2529         (class Memory_region): New class.
2530         (class Output_section_definition): Add set_memory_region,
2531         set_section_vma, set_section_lma and get_section_name methods.
2532         (class Script_Sections): Add add_memory_region,
2533         find_memory_region, find_memory_region_origin,
2534         find_memory_region_length and set_memory_region methods.
2535         Have set_section_addresses method walk the list of set memory
2536         regions.
2537         Extend the print methos to display memory regions.
2538         * script-sections.h: Add prototypes for new methods.
2539         Add enum for MEMORY region attributes.
2540         * yyscript.y: Add support for parsing MEMORY regions.
2541         * script-c.h: Add prototypes for new functions.
2542         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2543         * testsuite/Makefile.in: Regenerate.
2544         * testsuite/memory_test.sh: New script.
2545         * testsuite/memory_test.s: New assembler source file.
2546         * testsuite/memory_test.t: New linker script.
2547
2548 2010-08-27  Doug Kwan  <[email protected]>
2549
2550         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2551         reference override an existing dynamic weak reference.
2552         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2553         * testsuite/Makefile.in: Regenerate.
2554         * testsuite/dyn_weak_ref.sh: New file.
2555         * testsuite/dyn_weak_ref_1.c: Ditto.
2556         * testsuite/dyn_weak_ref_2.c: Ditto.
2557
2558 2010-08-27  Ian Lance Taylor  <[email protected]>
2559
2560         * incremental.h (class Incremental_input_entry): Add virtual
2561         destructor.
2562
2563 2010-08-27  Ian Lance Taylor  <[email protected]>
2564
2565         * testsuite/start_lib_test_3.c: Mark t3 as used.
2566
2567 2010-08-27  Nick Clifton  <[email protected]>
2568
2569         * options.cc (version_script): Fix small typo in previous
2570         whitespace tidyup.
2571
2572 2010-08-25  Nick Clifton  <[email protected]>
2573
2574         * archive.cc: Formatting fixes: Remove whitespace between
2575         typename and following asterisk.  Remove whitespace between
2576         function name and opening parenthesis.
2577         * archive.h: Likewise.
2578         * arm.cc: Likewise.
2579         * attributes.cc: Likewise.
2580         * attributes.h: Likewise.
2581         * common.cc: Likewise.
2582         * copy-relocs.cc: Likewise.
2583         * dirsearch.h: Likewise.
2584         * dynobj.cc: Likewise.
2585         * ehframe.cc: Likewise.
2586         * ehframe.h: Likewise.
2587         * expression.cc: Likewise.
2588         * fileread.cc: Likewise.
2589         * fileread.h: Likewise.
2590         * gc.h: Likewise.
2591         * gold-threads.cc: Likewise.
2592         * gold.cc: Likewise.
2593         * i386.cc: Likewise.
2594         * icf.h: Likewise.
2595         * incremental-dump.cc: Likewise.
2596         * incremental.cc: Likewise.
2597         * layout.cc: Likewise.
2598         * layout.h: Likewise.
2599         * main.cc: Likewise.
2600         * merge.cc: Likewise.
2601         * merge.h: Likewise.
2602         * object.cc: Likewise.
2603         * object.h: Likewise.
2604         * options.cc: Likewise.
2605         * options.h: Likewise.
2606         * output.cc: Likewise.
2607         * output.h: Likewise.
2608         * plugin.cc: Likewise.
2609         * plugin.h: Likewise.
2610         * powerpc.cc: Likewise.
2611         * reloc.cc: Likewise.
2612         * script-c.h: Likewise.
2613         * script-sections.cc: Likewise.
2614         * script.cc: Likewise.
2615         * stringpool.cc: Likewise.
2616         * symtab.cc: Likewise.
2617         * symtab.h: Likewise.
2618         * target.cc: Likewise.
2619         * timer.cc: Likewise.
2620         * timer.h: Likewise.
2621         * version.cc: Likewise.
2622         * x86_64.cc: Likewise.
2623
2624 2010-08-24  Nick Clifton  <[email protected]>
2625
2626         PR 11899
2627         * layout.cc (segment_precedes): Sort segments by their physical
2628         addresses, if they have been set.
2629
2630 2010-08-23  Cary Coutant  <[email protected]>
2631
2632         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2633         symbols data.
2634         (Lib_group::include_member): Unlock object after deleting its
2635         symbols data.
2636         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2637         the bug fixed here.
2638
2639 2010-08-19  Neil Vachharajani  <[email protected]>
2640             Cary Coutant  <[email protected]>
2641
2642         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2643         constructor, and set_blocker.
2644         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2645         readsyms_blocker_.
2646         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2647         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2648         * testsuite/Makefile.am (start_lib_test): New test case.
2649         * testsuite/Makefile.in: Regenerate.
2650         * testsuite/start_lib_test_main.c: New file.
2651         * testsuite/start_lib_test_1.c: New file.
2652         * testsuite/start_lib_test_2.c: New file.
2653         * testsuite/start_lib_test_3.c: New file.
2654
2655 2010-08-19  Ian Lance Taylor  <[email protected]>
2656
2657         * Makefile.in: Rebuild with automake 1.11.1.
2658         * aclocal.m4: Likewise.
2659         * testsuite/Makefile.in: Likewise.
2660
2661 2010-08-19  Ian Lance Taylor  <[email protected]>
2662
2663         PR 10893
2664         * i386.cc (class Output_data_plt_i386): Update declarations.
2665         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2666         local_ifuncs_ fields.
2667         (Target_i386::do_plt_section_for_global): New function.
2668         (Target_i386::do_plt_section_for_local): New function.
2669         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2670         parameter; change all callers.  Initialize global_ifuncs_ and
2671         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2672         __rel_iplt_end.
2673         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2674         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2675         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2676         symbols.
2677         (Target_i386::make_plt_section): New function, broken out of
2678         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2679         (Target_i386::make_plt_entry): Call make_plt_section.
2680         (Target_i386::make_local_ifunc_plt_entry): New function.
2681         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2682         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2683         R_386_IRELATIVE to switch.
2684         (Target_i386::Scan::global): Likewise.
2685         (Target_i386::Relocate::relocate): Likewise.
2686         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2687         switch.
2688         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2689         (Target_x86_64::do_plt_section_for_global): New function.
2690         (Target_x86_64::do_plt_section_for_local): New function.
2691         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2692         parameter; change all callers.  If doing a static link define
2693         __rela_iplt_start and __rela_iplt_end.
2694         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2695         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2696         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2697         to point to .plt.
2698         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2699         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2700         switch.
2701         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2702         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2703         R_X86_64_IRELATIVE to switch.
2704         (Target_x86_64::Scan::global): Likewise.
2705         (Target_x86_64::Relocate::relocate): Likewise.
2706         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2707         switch.
2708         * target.h (class Target): Add plt_section_for_global and
2709         plt_section_for_local functions.  Add do_plt_section_for_global
2710         and do_plt_section_for_local virtual functions.
2711         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2712         clarifying comments.
2713         (Symbol::use_plt_offset): Handle IFUNC symbol.
2714         * object.cc (Sized_relobj::Sized_relobj): Initialize
2715         local_plt_offsets_.
2716         (Sized_relobj::local_has_plt_offset): New function.
2717         (Sized_relobj::local_plt_offset): New function.
2718         (Sized_relobj::set_local_plt_offset): New function.
2719         (Sized_relobj::do_count): Handle IFUNC symbol.
2720         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2721         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2722         is_ifunc_symbol functions.
2723         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2724         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2725         local_plt_offsets_ field.
2726         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2727         * output.h (class Output_section_data): Add non-const
2728         output_section function.
2729         (class Output_data_got): Update declarations.
2730         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2731         Add use_plt_offset parameter to global and local constructors.
2732         Change all callers.  Change local_sym_index_ field to 31 bits.
2733         Change GSYM_CODE and CONSTANT_CODE accordingly.
2734         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2735         doing a static link don't set sh_link field.
2736         (Output_data_got::Got_entry::write): Use PLT offset if
2737         appropriate.
2738         (Output_data_got::add_global_plt): New function.
2739         (Output_data_got::add_local_plt): New function.
2740         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2741         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2742         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2743         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2744         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2745         IFUNC conditional.
2746         * testsuite/ifunc-sel.h: New file.
2747         * testsuite/ifuncmain1.c: New file.
2748         * testsuite/ifuncmain1vis.c: New file.
2749         * testsuite/ifuncmod1.c: New file.
2750         * testsuite/ifuncdep2.c: New file.
2751         * testsuite/ifuncmain2.c: New file.
2752         * testsuite/ifuncmain3.c: New file.
2753         * testsuite/ifuncmod3.c: New file.
2754         * testsuite/ifuncmain4.c: New file.
2755         * testsuite/ifuncmain5.c: New file.
2756         * testsuite/ifuncmod5.c: New file.
2757         * testsuite/ifuncmain6pie.c: New file.
2758         * testsuite/ifuncmod6.c: New file.
2759         * testsuite/ifuncmain7.c: New file.
2760         * configure, testsuite/Makefile.in: Rebuild.
2761
2762 2010-08-18  Ian Lance Taylor  <[email protected]>
2763
2764         * incremental.cc
2765         (Output_section_incremental_inputs::write_input_files): Add cast
2766         to avoid signed/unsigned comparison warning.
2767         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2768
2769 2010-08-12  Cary Coutant  <[email protected]>
2770
2771         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2772
2773 2010-08-13  Ian Lance Taylor  <[email protected]>
2774
2775         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2776
2777 2010-08-12  Cary Coutant  <[email protected]>
2778             Doug Kwan  <[email protected]>
2779
2780         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2781         defintion overrides non-weak undef, remember that the original undef
2782         is not weak.
2783         * symtab.cc (Symbol_table::sized_write_global): For undef without
2784         an original weak binding, set binding to global in output.
2785         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2786         * testsuite/Makefile.in: Regenerate.
2787         * testsuite/strong_ref_weak_def.sh: New file.
2788         * testsuite/strong_ref_weak_def_1.c: Ditto.
2789         * testsuite/strong_ref_weak_def_2.c: Ditto.
2790
2791 2010-08-12  Cary Coutant  <[email protected]>
2792
2793         * testsuite/incremental_test.sh: Rewrite.
2794         * testsuite/incremental_test_1.c: Rewrite.
2795         * testsuite/incremental_test_2.c: Rewrite.
2796
2797 2010-08-12  Cary Coutant  <[email protected]>
2798
2799         * arm.cc (Target_arm::got_size): Add const.
2800         (Target_arm::got_entry_count): New function.
2801         (Target_arm::plt_entry_count): New function.
2802         (Target_arm::first_plt_entry_offset): New function.
2803         (Target_arm::plt_entry_size): New function.
2804         (Output_data_plt_arm::entry_count): New function.
2805         (Output_data_plt_arm::first_plt_entry_offset): New function.
2806         (Output_data_plt_arm::get_plt_entry_size): New function.
2807         * i386.cc (Target_i386::got_size): Add const.
2808         (Target_i386::got_entry_count): New function.
2809         (Target_i386::plt_entry_count): New function.
2810         (Target_i386::first_plt_entry_offset): New function.
2811         (Target_i386::plt_entry_size): New function.
2812         (Output_data_plt_i386::entry_count): New function.
2813         (Output_data_plt_i386::first_plt_entry_offset): New function.
2814         (Output_data_plt_i386::get_plt_entry_size): New function.
2815         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2816         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2817         * incremental.cc: Include target.h.
2818         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2819         parameter.  Adjust all callers.  Find incremental_got_plt section.
2820         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2821         section.
2822         (Output_section_incremental_inputs::set_final_data_size): Calculate
2823         size of incremental_got_plt section.
2824         (Output_section_incremental_inputs::do_write): Write the
2825         incremental_got_plt section.
2826         (Got_plt_view_info): New struct.
2827         (Local_got_offset_visitor): New class.
2828         (Global_got_offset_visitor): New class.
2829         (Global_symbol_visitor_got_plt): New class.
2830         (Output_section_incremental_inputs::write_got_plt): New function.
2831         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2832         Add parameter.  Adjust all callers.
2833         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2834         (Incremental_inputs::got_plt_section): New function.
2835         (Incremental_inputs::got_plt_section_): New data member.
2836         (Incremental_got_plt_reader): New class.
2837         * layout.cc (Layout::create_incremental_info_sections): Add the
2838         incremental_got_plt section.
2839         * object.h (Got_offset_list::get_list): New function.
2840         (Got offset_list::for_all_got_offsets): New function.
2841         (Sized_relobj::local_got_offset_list): New function.
2842         * powerpc.cc (Target_powerpc::got_size): Add const.
2843         (Target_powerpc::got_entry_count): New function.
2844         (Target_powerpc::plt_entry_count): New function.
2845         (Target_powerpc::first_plt_entry_offset): New function.
2846         (Target_powerpc::plt_entry_size): New function.
2847         (Output_data_plt_powerpc::entry_count): New function.
2848         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2849         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2850         * sparc.cc (Target_sparc::got_size): Add const.
2851         (Target_sparc::got_entry_count): New function.
2852         (Target_sparc::plt_entry_count): New function.
2853         (Target_sparc::first_plt_entry_offset): New function.
2854         (Target_sparc::plt_entry_size): New function.
2855         (Output_data_plt_sparc::entry_count): New function.
2856         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2857         (Output_data_plt_sparc::get_plt_entry_size): New function.
2858         * symtab.h (Symbol::got_offset_list): New function.
2859         (Symbol_table::for_all_symbols): New function.
2860         * target.h (Sized_target::got_entry_count): New function.
2861         (Sized_target::plt_entry_count): New function.
2862         (Sized_target::plt_entry_size): New function.
2863         * x86_64.cc (Target_x86_64::got_size): Add const.
2864         (Target_x86_64::got_entry_count): New function.
2865         (Target_x86_64::plt_entry_count): New function.
2866         (Target_x86_64::first_plt_entry_offset): New function.
2867         (Target_x86_64::plt_entry_size): New function.
2868         (Output_data_plt_x86_64::entry_count): New function.
2869         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2870         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2871
2872 2010-08-12  Cary Coutant  <[email protected]>
2873
2874         * archive.cc: Include incremental.h.
2875         (Archive::Archive): Initialize incremental_info_.
2876         (Archive::include_member): Record archive members in incremental info.
2877         (Add_archive_symbols::run): Record begin and end of an archive in
2878         incremental info.
2879         (Lib_group::include_member): Record objects in incremental info.
2880         * archive.h (Incremental_archive_entry): Forward declaration.
2881         (Archive::set_incremental_info): New member function.
2882         (Archive::incremental_info): New member function.
2883         (Archive::Unused_symbol_iterator): New class.
2884         (Archive::unused_symbols_begin): New member function.
2885         (Archive::unused_symbols_end): New member function.
2886         (Archive::incremental_info_): New data member.
2887         * incremental-dump.cc (find_input_containing_global): New function.
2888         (dump_incremental_inputs): Dump new incremental info sections.
2889         * incremental.cc: Include symtab.h.
2890         (Output_section_incremental_inputs): New class.
2891         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2892         new incremental info sections.
2893         (Sized_incremental_binary::do_check_inputs): Likewise.
2894         (Incremental_inputs::report_archive): Remove.
2895         (Incremental_inputs::report_archive_begin): New function.
2896         (Incremental_inputs::report_archive_end): New function.
2897         (Incremental_inputs::report_object): New function.
2898         (Incremental_inputs::finalize_inputs): Remove.
2899         (Incremental_inputs::report_input_section): New function.
2900         (Incremental_inputs::report_script): Rewrite.
2901         (Incremental_inputs::finalize): Do nothing but finalize string table.
2902         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2903         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2904         (Incremental_inputs::create_data_sections): New function.
2905         (Incremental_inputs::relocs_entsize): New function.
2906         (Output_section_incremental_inputs::set_final_data_size): New function.
2907         (Output_section_incremental_inputs::do_write): New function.
2908         (Output_section_incremental_inputs::write_header): New function.
2909         (Output_section_incremental_inputs::write_input_files): New function.
2910         (Output_section_incremental_inputs::write_info_blocks): New function.
2911         (Output_section_incremental_inputs::write_symtab): New function.
2912         * incremental.h (Incremental_script_entry): Forward declaration.
2913         (Incremental_object_entry): Forward declaration.
2914         (Incremental_archive_entry): Forward declaration.
2915         (Incremental_inputs): Forward declaration.
2916         (Incremental_inputs_header_data): Remove.
2917         (Incremental_inputs_header): Remove.
2918         (Incremental_inputs_header_write): Remove.
2919         (Incremental_inputs_entry_data): Remove.
2920         (Incremental_inputs_entry): Remove.
2921         (Incremental_inputs_entry_write): Remove.
2922         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2923         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2924         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2925         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2926         Likewise.
2927         (Incremental_input_entry): New class.
2928         (Incremental_script_entry): New class.
2929         (Incremental_object_entry): New class.
2930         (Incremental_archive_entry): New class.
2931         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2932         (Incremental_inputs::report_inputs): Remove.
2933         (Incremental_inputs::report_archive): Remove.
2934         (Incremental_inputs::report_archive_begin): New function.
2935         (Incremental_inputs::report_archive_end): New function.
2936         (Incremental_inputs::report_object): Change prototype.
2937         (Incremental_inputs::report_input_section): New function.
2938         (Incremental_inputs::report_script): Change prototype.
2939         (Incremental_inputs::get_reloc_count): New function.
2940         (Incremental_inputs::set_reloc_count): New function.
2941         (Incremental_inputs::create_data_sections): New function.
2942         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2943         (Incremental_inputs::inputs_section): New function.
2944         (Incremental_inputs::symtab_section): New function.
2945         (Incremental_inputs::relocs_section): New function.
2946         (Incremental_inputs::get_stringpool): Add const.
2947         (Incremental_inputs::command_line): Add const.
2948         (Incremental_inputs::inputs): Remove.
2949         (Incremental_inputs::command_line_key): New function.
2950         (Incremental_inputs::input_file_count): New function.
2951         (Incremental_inputs::input_files): New function.
2952         (Incremental_inputs::relocs_entsize): New function.
2953         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2954         (Incremental_inputs::finalize_inputs): Remove.
2955         (Incremental_inputs::Input_info): Remove.
2956         (Incremental_inputs::lock_): Remove.
2957         (Incremental_inputs::inputs_): Change type.
2958         (Incremental_inputs::inputs_map_): Remove.
2959         (Incremental_inputs::current_object_entry_): New data member.
2960         (Incremental_inputs::inputs_section_): New data member.
2961         (Incremental_inputs::symtab_section_): New data member.
2962         (Incremental_inputs::relocs_section_): New data member.
2963         (Incremental_inputs::reloc_count_): New data member.
2964         (Incremental_inputs_reader): New class.
2965         (Incremental_symtab_reader): New class.
2966         (Incremental_relocs_reader): New class.
2967         * layout.cc (Layout::finalize): Move finalization of incremental info
2968         and creation of incremental info sections to follow finalization of
2969         symbol table.  Set offsets for postprocessing sections.
2970         (Layout::create_incremental_info_sections): Call
2971         Incremental_inputs::create_data_sections.  Add incremental symtab
2972         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2973         sections to layout after input sections.
2974         * layout.h (struct Timespec): Forward declaration.
2975         (Layout::incremental_inputs): Add const.
2976         (Layout::create_incremental_info_sections): Add parameter.
2977         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2978         * object.cc: Include incremental.h.
2979         (Relobj::finalize_incremental_relocs): New function.
2980         (Sized_relobj::do_layout): Record input sections in incremental info.
2981         * object.h (Object::output_section): New function.
2982         (Object::output_section_offset): Moved from Relobj.
2983         (Object::get_incremental_reloc_base): New function.
2984         (Object::get_incremental_reloc_count): New function.
2985         (Object::do_output_section): New function.
2986         (Object::do_output_section_offset): Moved from Relobj.
2987         (Object::do_get_incremental_reloc_base): New function.
2988         (Object::do_get_incremental_reloc_count): New function.
2989         (Object::Object): Initialize new data members.
2990         (Relobj::output_section): Renamed do_output_section and moved to
2991         protected.
2992         (Relobj::output_section_offset): Moved to Object.
2993         (Relobj::do_get_incremental_reloc_base): New function.
2994         (Relobj::do_get_incremental_reloc_count): New function.
2995         (Relobj::allocate_incremental_reloc_counts): New function.
2996         (Relobj::count_incremental_reloc): New function.
2997         (Relobj::finalize_incremental_relocs): New function.
2998         (Relobj::next_incremental_reloc_index): New function.
2999         (Relobj::reloc_counts_): New data member.
3000         (Relobj::reloc_bases_): New data member.
3001         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3002         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3003         (Sized_relobj::incremental_relocs_scan): New function.
3004         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3005         (Sized_relobj::incremental_relocs_write): New function.
3006         (Sized_relobj::incremental_relocs_write_reltype): New function.
3007         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3008         incremental link.
3009         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3010         archives and object files elsewhere.
3011         (Add_symbols::run): Report object files here.
3012         (Finish_group::run): Report end of archive at end of group.
3013         * reloc.cc: Include layout.h, incremental.h.
3014         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3015         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3016         (Sized_relobj::incremental_relocs_scan): New function.
3017         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3018         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3019         (Sized_relobj::incremental_relocs_write): New function.
3020         (Sized_relobj::incremental_relocs_write_reltype): New function.
3021         * script.cc (read_input_script): Rewrite test for incremental link.
3022         Change call to Incremental_inputs::report_script.
3023         * symtab.h (Symbol_table::first_global_index): New function.
3024         (Symbol_table::output_count): New function.
3025
3026 2010-08-12  Doug Kwan  <[email protected]>
3027
3028         * arm.cc (Target_arm::merge_object_attributes): Check command line
3029         options --no-wchar-size-warning and --no-enum-size-warning.
3030         * options.h (General_options): Add ld-compatible options
3031         --no-enum-size-warning and --no-wchar-size-warning.
3032
3033 2010-08-04  Ian Lance Taylor  <[email protected]>
3034
3035         * x86_64.cc (Target_x86_64::Scan::local): Use
3036         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3037         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3038         (Target_x86_64::Scan::global): Likewise.
3039         (Target_x86_64::Relocate::relocate): Likewise.
3040         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3041         Likewise.
3042
3043 2010-08-03  Cary Coutant  <[email protected]>
3044
3045         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3046         to reserve space in merged_strings vector. Keep total input size
3047         for stats.
3048         (Output_merge_string::do_print_merge_stats): Print total input size.
3049         * merge.h (Output_merge_string): Add input_size_ field.
3050         * stringpool.cc (Stringpool_template::string_length): Move
3051         implementations out of Stringpool_template class and place in
3052         stringpool.h.
3053         * stringpool.h (string_length): Move out of Stringpool_template.
3054
3055 2010-08-03  Ian Lance Taylor  <[email protected]>
3056
3057         PR 11712
3058         * layout.cc (relaxation_loop_body): If address of load segment is
3059         set, adjust address to include headers if possible.
3060
3061 2010-08-03  Ian Lance Taylor  <[email protected]>
3062
3063         * version.cc (version_string): Bump to 1.10.
3064
3065 2010-08-03  Ian Lance Taylor  <[email protected]>
3066
3067         PR 11805
3068         * layout.h (enum Output_section_order): Define.
3069         (class Layout): Update declarations.
3070         * layout.cc (Layout::get_output_section): Add order parameter.
3071         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3072         is_first_non_relro parameters.  Change all callers.
3073         (Layout::choose_output_section): Likewise.
3074         (Layout::add_output_section_data): Likewise.
3075         (Layout::make_output_section): Likewise.  Set order.
3076         (Layout::default_section_order): New function.
3077         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3078         * output.cc (Output_section::Output_section): Initialize order_.
3079         Don't initialize deleted fields.
3080         (Output_segment::Output_segment): Don't initialize deleted
3081         fields.
3082         (Output_segment::add_output_section_to_load): New function
3083         replacing add_output_section.  Change all callers to call this or
3084         add_output_section_to_nonload.
3085         (Output_segment::add_output_section_to_nonload): New function.
3086         (Output_segment::remove_output_section): Rewrite.
3087         (Output_segment::add_initial_output_data): Likewise.
3088         (Output_segment::has_any_data_sections): Likewise.
3089         (Output_segment::is_first_section_relro): Likewise.
3090         (Output_segment::maximum_alignment): Likewise.
3091         (Output_segment::has_dynamic_reloc): New function replacing
3092         dynamic_reloc_count.  Change all callers.
3093         (Output_segment::has_dynamic_reloc_list): New function replacing
3094         dynamic_reloc_count_list.  Change all callers.
3095         (Output_segment::set_section_addresses): Rewrite.
3096         (Output_segment::set_offset): Rewrite.
3097         (Output_segment::find_first_and_last_list): Remove.
3098         (Output_segment::set_tls_offsets): Rewrite.
3099         (Output_segment::first_section_load_address): Likewise.
3100         (Output_segment::output_section_count): Likewise.
3101         (Output_segment::section_with_lowest_load_address): Likewise.
3102         (Output_segment::write_section_headers): Likewise.
3103         (Output_segment::print_sections_to_map): Likewise.
3104         * output.h (class Output_data): Remove dynamic_reloc_count_
3105         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3106         (Output_data::add_dynamic_reloc): Rewrite.
3107         (Output_data::has_dynamic_reloc): New function.
3108         (Output_data::dynamic_reloc_count): Remove.
3109         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3110         is_last_relro_, is_first_non_relro_, is_interp_,
3111         is_dynamic_linker_section_ fields.  Add order and set_order
3112         functions.  Remove is_relro_local, set_is_relro_local,
3113         is_last_relro, set_is_last_relro, is_first_non_relro,
3114         set_is_first_non_relro functions, is_interp, set_is_interp,
3115         is_dynamic_linker_section, and set_is_dynamic_linker_section
3116         functions.
3117         (class Output_segment): Change Output_data_list from std::list to
3118         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3119         output_bss_ fields.  Update declarations.
3120
3121 2010-08-02  Ian Lance Taylor  <[email protected]>
3122
3123         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3124         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3125         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3126
3127 2010-08-02  Ian Lance Taylor  <[email protected]>
3128
3129         PR 11855
3130         * script.cc (Script_options::Script_options): Initialize
3131         symbol_definitions_ and symbol_references_.
3132         (Script_options::add_symbol_assignment): Update
3133         symbol_definitions_ and symbol_references_.
3134         (Script_options::add_symbol_reference): New function.
3135         (script_symbol): New function.
3136         * script.h (class Script_options): Add symbol_definitions_ and
3137         symbol_references_ fields.
3138         (Script_options::referenced_const_iterator): New type.
3139         (Script_options::referenced_begin): New function.
3140         (Script_options::referenced_end): New function.
3141         (Script_options::is_referenced): New function.
3142         (Script_options::any_unreferenced): New function.
3143         * script-c.h (script_symbol): Declare.
3144         * yyscript.y (exp): Call script_symbol.
3145         * symtab.cc: Include "script.h".
3146         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3147         Change all callers.  Check symbols referenced by scripts.
3148         (Symbol_table::add_undefined_symbols_from_command_line): Add
3149         layout parameter.  Change all callers.
3150         (Symbol_table::do_add_undefined_symbols_from_command_line):
3151         Likewise.  Break out loop body.  Check symbols referenced by
3152         scripts.
3153         (Symbol_table::add_undefined_symbol_from_command_line): New
3154         function broken out of
3155         do_add_undefined_symbols_from_command_line.
3156         * symtab.h (class Symbol_table): Update declarations.
3157         * archive.cc: Include "layout.h".
3158         (Archive::should_include_member): Add layout parameter.  Change
3159         all callers.  Check for symbol mentioned in expression.
3160         * archive.h (class Archive): Update declaration.
3161         * object.cc (Sized_relobj::do_should_include_member): Add layout
3162         parameter.
3163         * object.h (Object::should_include_member): Add layout parameter.
3164         Change all callers.
3165         (Object::do_should_include_member): Add layout parameter.
3166         (class Sized_relobj): Update declaration.
3167         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3168         parameter.
3169         * dynobj.h (class Sized_dynobj): Update declaration.
3170         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3171         layout parameter.
3172         * plugin.h (class Sized_pluginobj): Update declaration.
3173
3174 2010-08-02  Ian Lance Taylor  <[email protected]>
3175
3176         PR 11866
3177         * output.cc (Output_segment::set_offset): Search for the first and
3178         last sections rather than assuming that the list is in order.
3179         (Output_segment::find_first_and_last_list): New function.
3180         * output.h (class Output_segment): Update declarations.
3181         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3182         (relro_strip_test_SOURCES): New variable.
3183         (relro_strip_test_DEPENDENCIES): New variable.
3184         (relro_strip_test_LDFLAGS): New variable.
3185         (relro_strip_test_LDADD): New variable.
3186         (relro_strip_test.so): New target.
3187
3188 2010-08-02  Ian Lance Taylor  <[email protected]>
3189
3190         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3191         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3192         (Target_i386::got_tlsdesc_section): New function.
3193         (Target_i386::got_section): Create space for GOT entries for
3194         TLSDESC relocations.
3195         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3196         R_386_TLS_GOTDESC.
3197         (Target_i386::Scan::global): Likewise.
3198         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3199         using TLSDESC GOT.
3200         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3201         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3202         (Target_x86_64::got_tlsdesc_section): New function.
3203         (Target_x86_64::got_section): Create space for GOT entries for
3204         TLSDESC relocations.
3205         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3206         R_386_TLS_GOTDESC.
3207         (Target_x86_64::Scan::global): Likewise.
3208         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3209         using TLSDESC GOT.
3210
3211 2010-08-02  Ian Lance Taylor  <[email protected]>
3212
3213         * testsuite/final_layout.sh: Use dc to convert from hex to
3214         decimal.
3215
3216 2010-07-29  Sriraman Tallam  <[email protected]>
3217
3218         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3219         paramter to the call to gold::gc_process_relocs.
3220         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3221         paramter to the call to gold::gc_process_relocs.
3222         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3223         parameter to the call to gold::gc_process_relocs.
3224         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3225         template parameter to the call to gold::gc_process_relocs.
3226         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3227         paramter to the call to gold::gc_process_relocs.
3228         * gc.h (get_embedded_addend_size): New function.
3229         (gc_process_relocs): Save the size of the reloc for use by ICF.
3230         * icf.cc (get_section_contents): Get the addend from the text section
3231         for SHT_REL relocation sections.
3232         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3233         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3234         * int_encoding.h (read_from_pointer): New overloaded function.
3235         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3236         * testsuite/icf_sht_rel_addend_test.sh: New file.
3237         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3238         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3239
3240 2010-07-28  Ralf Wildenhues  <[email protected]>
3241
3242         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3243         * Makefile.in: Regenerate.
3244         * testsuite/Makefile.in: Regenerate.
3245
3246 2010-07-27  Jeffrey Yasskin  <[email protected]>
3247
3248         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3249         * gold/testsuite/debug_msg.cc: Likewise.
3250         * gold/testsuite/odr_violation1.cc
3251         * gold/testsuite/odr_violation2.cc
3252
3253 2010-07-21  Cary Coutant  <[email protected]>
3254
3255         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3256         string, and length fields.
3257         (Output_merge_string::Merged_strings_list): New type.
3258         (Output_merge_string::Merged_strings_lists): New typedef.
3259         (Output_merge_string): Replace merged_strings_ with
3260         merged_strings_lists_.
3261         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3262         Merged_strings_list per input object and section.  Don't store pointer
3263         to the string.  Don't store length with each merged string entry.
3264         (Output_merge_string::finalize_merged_data): Loop over list of merged
3265         strings lists.  Recompute length of each merged string.
3266
3267 2010-07-15  Cary Coutant  <[email protected]>
3268
3269         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3270         here.
3271
3272 2010-07-14  Ian Lance Taylor  <[email protected]>
3273
3274         * descriptors.cc (Descriptors::open): Report correct name in error
3275         message.
3276
3277 2010-07-13  Doug Kwan  <[email protected]>
3278
3279         * arm.cc (Arm_input_section::Arm_input_section): For a
3280         SHT_ARM_EXIDX section, always keeps the input sections.
3281         (Arm_input_section::set_exidx_section_link): New method.
3282         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3283         has_errors_ to false.
3284         (Arm_exidx_input_section::has_errors,
3285         Arm_exidx_input_section::set_has_errors): New methods.
3286         (Arm_exidx_input_section::has_errors_): New data member.
3287         (Arm_relobj::get_exidx_shndx_list): New method.
3288         (Arm_output_section::append_text_sections_to_list): Do not skip
3289         section without SHF_EXECINSTR.
3290         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3291         errors.
3292         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3293         section header.  Make error messages more verbose.  Check for
3294         a non-executable section linked to an EXIDX section.
3295         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3296         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3297         check that there is no deferred EXIDX section if we exit early.
3298         Instead of not making an EXIDX section in case of an error, make one
3299         and set the has_errors flag of it.
3300         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3301         in a relocatable link.
3302         (Target_arm::do_relax): Look for the EXIDX output section instead of
3303         assuming that it is called .ARM.exidx.
3304         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3305         section list.  Do not check for SHF_EXECINSTR section flags but
3306         skip any input section with errors.
3307         * output.cc (Output_section::Output_section): Initialize
3308         always_keeps_input_sections_ to false.
3309         (Output_section::add_input_section): Check for
3310         always_keeps_input_sections_.
3311         *  output.h (Output_section::always_keeps_input_sections,
3312         Output_section::set_always_keeps_input_sections): New methods.
3313         (Output_section::always_keeps_input_sections): New data member.
3314
3315 2010-07-13  Rafael Espindola  <[email protected]>
3316
3317         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3318         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3319
3320 2010-07-13  Philip Herron  <[email protected]>
3321             Ian Lance Taylor  <[email protected]>
3322
3323         * output.h (Output_section_lookup_maps::add_merge_section):
3324         Correct check of whether value was inserted.
3325         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3326         (Output_section_lookup_maps::add_relaxed_input_section):
3327         Likewise.
3328         * arm.cc (Target_arm::got_section): Remove used local os.
3329         * i386.cc (Target_i386::got_section): Likewise.
3330         * x86_64.cc (Target_x86_64::got_section): Likewise.
3331         * sparc.cc (Target_sparc::got_section): Likewise.
3332         (Target_sparc::relocate): Remove unused local have_got_offset.
3333         * powerpc.cc (Target_powerpc::relocate): Likewise.
3334
3335 2010-07-13  Ian Lance Taylor  <[email protected]>
3336
3337         * compressed_output.cc (zlib_decompress): Fix signature in
3338         !HAVE_ZLIB_H case.
3339
3340         * archive.cc (Archive::include_member): Unlock an external member
3341         of a thin archive.  Don't bother to delete an object we know is
3342         NULL.
3343
3344 2010-07-12  Cary Coutant  <[email protected]>
3345
3346         * compressed_output.cc (zlib_decompress): New function.
3347         (get_uncompressed_size): New function.
3348         (decompress_input_section): New function.
3349         * compressed_output.h (get_uncompressed_size): New function.
3350         (decompress_input_section): New function.
3351         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3352         Handle compressed debug sections.
3353         * layout.cc (is_compressed_debug_section): New function.
3354         (Layout::output_section_name): Map compressed section names to
3355         canonical names.
3356         * layout.h (is_compressed_debug_section): New function.
3357         (is_debug_info_section): Recognize compressed debug sections.
3358         * merge.cc: Include compressed_output.h.
3359         (Output_merge_data::do_add_input_section): Handle compressed
3360         debug sections.
3361         (Output_merge_string::do_add_input_section): Handle compressed
3362         debug sections.
3363         * object.cc: Include compressed_output.h.
3364         (Sized_relobj::Sized_relobj): Initialize new data members.
3365         (build_compressed_section_map): New function.
3366         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3367         * object.h (Object::section_is_compressed): New method.
3368         (Object::do_section_is_compressed): New method.
3369         (Sized_relobj::Compressed_section_map): New type.
3370         (Sized_relobj::do_section_is_compressed): New method.
3371         (Sized_relobj::compressed_sections_): New data member.
3372         * output.cc (Output_section::add_input_section): Handle compressed
3373         debug sections.
3374         * reloc.cc: Include compressed_output.h.
3375         (Sized_relobj::write_sections): Handle compressed debug sections.
3376
3377 2010-07-08  Cary Coutant  <[email protected]>
3378
3379         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3380         weak when resolving to a dynamic def.
3381         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3382         for weak undef/dynamic def cases. Adjust callers.
3383         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3384         undef_binding_weak_.
3385         (Symbol_table::sized_write_globals): Adjust symbol binding.
3386         (Symbol_table::sized_write_symbol): Add binding parameter.
3387         * symtab.h (Symbol::set_undef_binding): New method.
3388         (Symbol::is_undef_binding_weak): New method.
3389         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3390         (Symbol_table::should_override): Add new parameter.
3391         (Symbol_table::sized_write_symbol): Add new parameter.
3392
3393         * testsuite/weak_undef_file1.cc: Add new test case.
3394         * testsuite/weak_undef_file2.cc: Fix header comment.
3395         * testsuite/weak_undef_test.cc: Add new test case.
3396
3397 2010-06-29  Doug Kwan  <[email protected]>
3398
3399         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3400         Initialize USE_SYMBOL_.
3401         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3402         definition.
3403         (Arm_reloc_property::uses_symbol_): New data member declaration.
3404         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3405         uses symbol value and symbol is undefined but not weakly undefined.
3406
3407 2010-06-28  Rafael Espindola  <[email protected]>
3408
3409         * plugin.cc (Plugin::load): Use dlerror.
3410
3411 2010-06-26  Jeffrey Yaskin  <[email protected]>
3412
3413         * symtab.cc (detect_odr_violations): When reporting an ODR
3414         violation, report an object where the symbol is defined.
3415
3416 2010-06-25  Doug Kwan  <[email protected]>
3417
3418         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3419         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3420         definition.
3421         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3422         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3423         target hook to detect function points.
3424         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3425         * icf.h (Icf::check_section_for_function_pointers): Change type of
3426         parameter SECTION_NAME to const reference to std::string.  Use
3427         target hook to determine if section may have unsafe pointers.
3428         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3429         method definition.
3430
3431 2010-06-21  Rafael Espindola  <[email protected]>
3432
3433         * fileread.cc (Input_file::find_fie): New
3434         (Input_file::open): Use Input_file::find_fie.
3435         * fileread.h (Input_file::find_fie): New
3436         * plugin.cc (set_extra_library_path): New.
3437         (Plugin::load): Add set_extra_library_path to the transfer vector.
3438         (Plugin_manager::set_extra_library_path): New.
3439         (Plugin_manager::add_input_file): Use the extra search path if set.
3440         (set_extra_library_path(): New.
3441         * plugin.h (Plugin_manager): Add set_extra_library_path and
3442         extra_search_path_.
3443
3444 2010-06-19  Cary Coutant  <[email protected]>
3445
3446         * layout.cc (gdb_sections): Add .debug_types.
3447         (lines_only_debug_sections): Likewise.
3448
3449 2010-06-18  Rafael Espindola  <[email protected]>
3450
3451         * plugin.cc (add_input_file,add_input_library)
3452         (Plugin_manager::add_input_file): Make filename arguments const.
3453         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3454         const.
3455
3456 2010-06-16  Doug Kwan  <[email protected]>
3457
3458         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3459         .ARM.attributes section if we have not merged any input
3460         attributes sections.
3461
3462 2010-06-15  Viktor Kutuzov  <[email protected]>
3463
3464         * arm.cc: Allow combining objects with no EABI version
3465         information.
3466
3467 2010-06-15  Rafael Espindola  <[email protected]>
3468
3469         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3470
3471 2010-06-15  Viktor Kutuzov  <[email protected]>
3472
3473         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3474         (struct iovec): Correct !HAVE_READV definition.
3475
3476 2010-06-10  Cary Coutant  <[email protected]>
3477
3478         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3479         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3480         reloc sections.
3481         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3482
3483         PR 11683
3484         * symtab.h (Symbol::is_placeholder): New member function.
3485         * target-reloc.h (relocate_section): Check for placeholder symbols.
3486
3487         * testsuite/Makefile.am (plugin_test_8): New test.
3488         (plugin_test_9): New test.
3489         * testsuite/Makefile.in: Regenerate.
3490
3491 2010-06-09  Nick Clifton  <[email protected]>
3492
3493         * yyscript.y (input_list_element): Allow strings prefixed with
3494         the '-' character.  Treat these as libraries.
3495         * script.cc (script_add_library): New function.  Adds a library
3496         specified by "-l<name>" found in an input script.
3497         * script-c.h: Add prototype for script_add_library.
3498
3499 2010-06-07  Doug Kwan  <[email protected]>
3500
3501         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3502         Restrict stub-group size to be within long conditional branch
3503         range when working around cortex-A8 erratum.
3504
3505 2010-06-07  Damien Diederen  <[email protected]>
3506
3507         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3508         #ifdef typo.
3509
3510 2010-06-03  Sriraman Tallam  <[email protected]>
3511
3512         PR gold/11658
3513         * output.cc
3514         (Output_section::Input_section_sort_entry::compare_section_ordering):
3515         Change to return non-zero correctly.
3516         (Output_section::Input_section_sort_section_order_index_compare
3517         ::operator()): Change to fix ambiguity in comparisons.
3518
3519 2010-06-01  Sriraman Tallam  <[email protected]>
3520
3521         * gold.h (is_wildcard_string): New function.
3522         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3523         (Layout::layout_eh_frame): Ditto.
3524         (Layout::find_section_order_index): New method.
3525         (Layout::read_layout_from_file): New method.
3526         * layout.h (Layout::find_section_order_index): New method.
3527         (Layout::read_layout_from_file): New method.
3528         (Layout::input_section_position_): New private member.
3529         (Layout::input_section_glob_): New private member.
3530         * main.cc (main): Call read_layout_from_file here.
3531         * options.h (--section-ordering-file): New option.
3532         * output.cc (Output_section::input_section_order_specified_): New
3533         member.
3534         (Output_section::Output_section): Initialize new member.
3535         (Output_section::add_input_section): Add new parameter.
3536         Keep input sections when --section-ordering-file is used.
3537         (Output_section::set_final_data_size): Sort input sections when
3538         section ordering file is specified.
3539         (Output_section::Input_section_sort_entry): Add new parameter.
3540         Check sorting type.
3541         (Output_section::Input_section_sort_entry::compare_section_ordering):
3542         New method.
3543         (Output_section::Input_section_sort_compare::operator()): Change to
3544         consider section_order_index.
3545         (Output_section::Input_section_sort_init_fini_compare::operator()):
3546         Change to consider section_order_index.
3547         (Output_section::Input_section_sort_section_order_index_compare
3548         ::operator()): New method.
3549         (Output_section::sort_attached_input_sections): Change to sort
3550         according to section order when specified.
3551         (Output_section::add_input_section<32, true>): Add new parameter.
3552         (Output_section::add_input_section<64, true>): Add new parameter.
3553         (Output_section::add_input_section<32, false>): Add new parameter.
3554         (Output_section::add_input_section<64, false>): Add new parameter.
3555         * output.h (Output_section::add_input_section): Add new parameter.
3556         (Output_section::input_section_order_specified): New
3557         method.
3558         (Output_section::set_input_section_order_specified): New method.
3559         (Input_section::Input_section): Initialize section_order_index_.
3560         (Input_section::section_order_index): New method.
3561         (Input_section::set_section_order_index): New method.
3562         (Input_section::section_order_index_): New member.
3563         (Input_section::Input_section_sort_section_order_index_compare): New
3564         struct.
3565         (Output_section::input_section_order_specified_): New member.
3566         * script-sections.cc (is_wildcard_string): Delete and move modified
3567         method to gold.h.
3568         (Output_section_element_input::Output_section_element_input): Modify
3569         call to is_wildcard_string.
3570         (Output_section_element_input::Input_section_pattern
3571         ::Input_section_pattern): Ditto.
3572         (Output_section_element_input::Output_section_element_input): Ditto.
3573         * testsuite/Makefile.am (final_layout): New test case.
3574         * testsuite/Makefile.in: Regenerate.
3575         * testsuite/final_layout.cc: New file.
3576         * testsuite/final_layout.sh: New file.
3577
3578 2010-06-01  Rafael Espindola  <[email protected]>
3579
3580         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3581
3582 2010-06-01  Rafael Espindola  <[email protected]>
3583
3584         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3585         visibility of symbols.
3586
3587 2010-05-27  Doug Kwan  <[email protected]>
3588
3589         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3590         from start of output section instead of address for a local symbol
3591         in a merged or relaxed section when doing a relocatable link.
3592
3593 2010-05-26  Rafael Espindola  <[email protected]>
3594
3595        PR 11604
3596         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3597         adding sections the garbage collector removed.
3598         * gold/testsuite/Makefile.am: Add test.
3599         * gold/testsuite/Makefile.in: Regenerate.
3600         * gold/testsuite/plugin_test_7.sh: New.
3601         * gold/testsuite/plugin_test_7_1.c: New.
3602         * gold/testsuite/plugin_test_7_2.c: New.
3603
3604 2010-05-26  Rafael Espindola  <[email protected]>
3605
3606         * script-sections.cc (Output_section_definition::set_section_addresses):
3607         Check for --section-start.
3608
3609 2010-05-26  Doug Kwan  <[email protected]>
3610
3611         * arm.cc (Arm_scan_relocatable_relocs): New class.
3612         (Target_arm::relocate_special_relocatable): New method.
3613         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3614         (Arm_relocate_functions::thumb_branch_common): Same.
3615         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3616         instead of Default_scan_relocatable_relocs.
3617         * target-reloc.h (relocate_for_relocatable): Let target handle
3618         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3619         * target.h (Sized_target::relocate_special_relocatable): New method.
3620
3621 2010-05-25  Viktor Kutuzov  <[email protected]>
3622
3623         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3624
3625 2010-05-23  Doug Kwan  <[email protected]>
3626
3627         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3628         instead of a cast.
3629         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3630         with a direct branch, not a conditional branch, to a stub.
3631         * merge.cc (Output_merge_base::record_input_section): New method
3632         defintion.
3633         (Output_merge_data::do_add_input_section): Record input section if
3634         keeps-input-sections flag is set.
3635         (Output_merge_string::do_add_input_section): Ditto.
3636         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3637         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3638         INPUT_SECTIONS_.
3639         (Output_merge_base::keeps_input_sections,
3640         Output_merge_base::set_keeps_input_sections,
3641         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3642         method definitions.
3643         (Output_merge_base::Input_sections): New type declaration.
3644         (Output_merge_base::input_sections_begin,
3645         Output_merge_base::input_sections_end,
3646         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3647         (Output_merge_base::bool keeps_input_sections_,
3648         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3649         Output_merge_base::input_sections_): New data members.
3650         (Output_merge_data::do_set_keeps_input_sections): New method
3651         defintion.
3652         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3653         * output.cc (Output_section::Input_section::relobj): Move method
3654         defintion from class declaration to here and handle merge sections.
3655         (Output_section::Input_section::shndx): Ditto.
3656         (Output_section::Output_section): Remove initializations of removed
3657         data members and initialize new data member LOOKUP_MAPS_.
3658         (Output_section::add_input_section): Set keeps-input-sections flag
3659         for a newly created merge output section as appropriate.  Adjust code
3660         to use Output_section_lookup_maps class.
3661         (Output_section::add_relaxed_input_section): Adjst code for lookup
3662         maps code refactoring.
3663         (Output_section::add_merge_input_section): Add a new parameter
3664         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3665         class.  If adding input section to a newly created merge output
3666         section fails, remove the new merge section.
3667         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3668         Adjust code for use of the Output_section_lookup_maps class.
3669         (Output_section::find_merge_section): Ditto.
3670         (Output_section::build_lookup_maps): New method defintion.
3671         (Output_section::find_relaxed_input_section): Adjust code to use
3672         Output_section_lookup_maps class.
3673         (Output_section::get_input_sections): Export merge sections.  Adjust
3674         code to use Output_section_lookup_maps class.
3675         (Output_section:::add_script_input_section): Adjust code to use
3676         Output_section_lookup_maps class.  Update lookup maps for merge
3677         sections also.
3678         (Output_section::discard_states): Use Output_section_lookup_maps.
3679         (Output_section::restore_states): Same.
3680         * output.h (Merge_section_properties): Move class defintion out of
3681         Output_section.
3682         (Output_section_lookup_maps): New class.
3683         (Output_section::Input_section::is_merge_section): New method
3684         defintion.
3685         (Output_section::Input_section::relobj): Move defintion out of class
3686         defintion.  Declare method only.
3687         (Output_section::Input_section::shndx): Ditto.
3688         (Output_section::Input_section::output_merge_base): New method defintion.
3689         (Output_section::Input_section::u2_.pomb): New union field.
3690         (Output_section::Merge_section_by_properties_map,
3691         Output_section::Output_section_data_by_input_section_map,
3692         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3693         Remove types.
3694         (Output_section::add_merge_input_section): Add new parameter
3695         KEEPS_INPUT_SECTIONS.
3696         (Output_section::build_lookup_maps): New method declaration.
3697         (Output_section::merge_section_map_,
3698         Output_section::merge_section_by_properties_map_,
3699         Output_section::relaxed_input_section_map_,
3700         Output_section::is_relaxed_input_section_map_valid_): Remove data
3701         members.
3702         (Output_section::lookup_maps_): New data member.
3703
3704 2010-05-21  Doug Kwan  <[email protected]>
3705
3706         PR gold/11619
3707         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3708         avoid a compilation error.
3709
3710 2010-05-19  Rafael Espindola  <[email protected]>
3711
3712         * script-sections.cc (Output_section_definition::allocate_to_segment):
3713         Update the phdrs_list even when the output section is NULL.
3714         * testsuite/Makefile.am: Add test.
3715         * testsuite/Makefile.in: Regenerate.
3716         * testsuite/script_test_9.cc: New.
3717         * testsuite/script_test_9.sh: New.
3718         * testsuite/script_test_9.t: New.
3719
3720 2010-05-19  Doug Kwan  <[email protected]>
3721
3722         * arm.cc (Arm_input_section::original_size): New method.
3723         (Arm_input_section::do_addralign): Add a cast.
3724         (Arm_input_section::do_output_offset): Remove static cast.
3725         (Arm_input_section::original_addralign,
3726          Arm_input_section::original_size_): Change type to uint32_t.
3727         (Arm_input_section::init): Add safe casts for section alignment
3728         and size.
3729         (Arm_input_section::set_final_data_size): Do not set address and
3730         offset of stub table.
3731         (Arm_output_section::fix_exidx_coverage): Change use of of
3732         Output_section::Simple_input_section to that of
3733         Output_section::Input_section.
3734         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3735         except for the first pass.
3736         * output.cc (Output_section::get_input_sections): Change type of
3737         input_sections to std::list<Input_section>.
3738         (Output_section::add_script_input_section): Rename from
3739         Output_section::add_simple_input_section.  Change type of SIS
3740         parameter from Simple_input_section to Input_section.
3741         * output.h (Output_section::Simple_input_section): Remove class.
3742         (Output_section::Input_section): Change class visibility to public.
3743         (Output_section::Input_section::addralign): Use stored alignments
3744         for special input sections if set.
3745         (Output_section::Input_section::set_addralign): New method.
3746         (Output_section::get_input_sections): Change parameter type from
3747         list of Simple_input_section to list of Input_section.
3748         (Output_section::add_script_input_section): Rename from
3749         Output_section::add_simple_input_section. Change first parameter's
3750         type from Simple_input_section to Input_section and remove the
3751         second and third parameters.
3752         * script-sections.cc (Input_section::Input_section_list): Change
3753         type to list of Output_section::Input_section/
3754         (Input_section_info::Input_section_info): Change parameter type of
3755         INPUT_SECTION to Output_section::Input_section.
3756         (Input_section_info::input_section): Change return type.
3757         (Input_section_info::input_section_): Change type to
3758         Output_section::Input_section.
3759         (Output_section_element_input::set_section_addresses): Adjust code
3760         to use Output_section::Input_section instead of
3761         Output_section::Simple_input_section.  Adjust code for renaming
3762         of Output_section::add_simple_input_section.
3763         (Orphan_output_section::set_section_addresses): Ditto.
3764
3765 2010-05-18  Ralf Wildenhues  <[email protected]>
3766
3767         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3768         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3769
3770 2010-05-18  Rafael Espindola  <[email protected]>
3771
3772         * options.cc (General_options::finalize): Handle -nostdlib.
3773         * options.h (nostdlib): New option.
3774         * script.cc (script_add_search_dir): Handle -nostdlib.
3775
3776 2010-05-12  Doug Kwan  <[email protected]>
3777
3778         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3779         attributes section only if there no attributes section after merging.
3780         (Target_arm::merge_object_attributes): Move value of
3781         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3782         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3783         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3784         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3785         and arm_attr_merge_7.stdout.
3786         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3787         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3788         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3789         arm_attr_merge_7b.o): New rules.
3790         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3791         arm_attr_merge_7
3792         * testsuite/Makefile.in: Regenerate.
3793         * testsuite/arm_attr_merge.sh: New file.
3794         * testsuite/arm_attr_merge_[67][ab].s: Same.
3795
3796 2010-05-05  Nick Clifton  <[email protected]>
3797
3798         * po/es.po: Updated Spanish translation.
3799
3800 2010-04-27  H.J. Lu  <[email protected]>
3801
3802         * Makefile.am (install-exec-local): Properly install gold as
3803         default cross linker.
3804         * Makefile.in: Regenerated.
3805
3806 2010-04-27  H.J. Lu  <[email protected]>
3807             Nick Clifton  <[email protected]>
3808
3809         * configure.ac (install_as_default): Define and set to false
3810         unless --enable-gold or --enable-gold=both/gold has been
3811         specified.
3812         * configure: Regenerate.
3813
3814         * Makefile.am (install-exec-local): Install the executable as
3815         'ld.gold'.  If install_as_default is true then also install it as
3816         'ld'.
3817         * Makefile.in: Regenerated.
3818
3819 2010-04-24  Ian Lance Taylor  <[email protected]>
3820
3821         * layout.cc (Layout::layout_reloc): In relocatable link don't
3822         combine reloc sections for grouped sections.
3823
3824 2010-04-23  Sriraman Tallam  <[email protected]>
3825
3826         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3827         sections that are not ordinary to icf.
3828         * icf.cc (get_section_contents): Handle relocation pointing to section
3829         with no object or shndx information.
3830         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3831         * testsuite/Makefile.in: Regenerate.
3832         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3833         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3834
3835 2010-04-22  Ian Lance Taylor  <[email protected]>
3836
3837         * expression.cc (Expression::Expression_eval_info): Add
3838         result_alignment_pointer field.
3839         (Expression::eval_with_dot): Add result_alignment_pointer
3840         parameter.  Change all callers.
3841         (Expression::eval_maybe_dot): Likewise.
3842         (class Binary_expression): Add alignment_pointer parameter to
3843         left_value and right_value.  Change all callers.
3844         (BINARY_EXPRESSION): Set result alignment.
3845         (class Trinary_expression): Add alignment_pointer parameter to
3846         arg2_value and arg3_value.  Change all callers.
3847         (Trinary_cond::value): Set result alignment.
3848         (Max_expression::value, Min_expression::value): Likewise.
3849         (Align_expression::value): Likewise.
3850         * script-sections.cc (class Sections_element): Add dot_alignment
3851         parameter to set_section_addresses virtual function.  Update
3852         instantiations.
3853         (class Output_section_element): Likewise.
3854         (Script_sections::create_segments): Add dot_alignment parameter.
3855         Change all callers.
3856         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3857         (Script_sections::set_phdrs_clause_addresses): Likewise.
3858         * script-sections.h: Update declarations.
3859         * script.h: Update declarations.
3860         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3861         min_p_align.
3862         * testsuite/script_test_3.t: Set large alignment.
3863         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3864         segment has expected alignment.
3865
3866 2010-04-22  Nick Clifton  <[email protected]>
3867
3868         * po/gold.pot: Updated by the Translation project.
3869         * po/vi.po: Updated Vietnamese translation.
3870
3871 2010-04-22  H.J. Lu  <[email protected]>
3872
3873         * testsuite/Makefile.am (check_PROGRAMS): Add
3874         icf_virtual_function_folding_test.
3875         * testsuite/Makefile.in: Regenerated.
3876
3877 2010-04-15  Andrew Haley  <[email protected]>
3878
3879         * options.h (merge_exidx_entries): New option.
3880         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3881         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3882         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3883         (Target_arm::merge_exidx_entries): New function.
3884         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3885         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3886         to Arm_exidx_fixup constructor.
3887         Add new arg, merge_exidx_entries.
3888         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3889         Arm_output_section::fix_exidx_coverage.
3890
3891 2010-04-18  Sriraman Tallam  <[email protected]>
3892
3893         * icf.cc (get_section_contents): Check for preemptible functions.
3894         Ignore addend when appropriate.
3895         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3896         section folded.
3897         (add_from_relobj): Check for section folded.
3898         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3899         * symtab.h (should_add_dynsym_entry): Add new parameter.
3900         * target-reloc.h (scan_relocs): Check for section folded.
3901         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3902         Check reloc types for function pointers in shared objects.
3903         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3904         case.
3905         (icf_preemptible_functions_test): New test case.
3906         (icf_string_merge_test): New test case.
3907         * testsuite.Makefile.in: Regenerate.
3908         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3909         bar_glob.  Refactor code.
3910         * testsuite/icf_preemptible_functions_test.cc: New file.
3911         * testsuite/icf_preemptible_functions_test.sh: New file.
3912         * testsuite/icf_string_merge_test.cc: New file.
3913         * testsuite/icf_string_merge_test.sh: New file.
3914         * testsuite/icf_virtual_function_folding_test.cc: New file.
3915         * testsuite/icf_virtual_function_folding_test.sh: New file.
3916
3917 2010-04-14  Doug Kwan  <[email protected]>
3918
3919         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3920         for local symbol recounting if we remove a section due to ICF.
3921         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3922         there are no regular objects in input.
3923
3924 2010-04-13  Doug Kwan  <[email protected]>
3925
3926         * arm.cc (Arm_input_section::set_final_data_size): Compute
3927         accurate final data size instead of using current data size.
3928
3929 2010-04-09  Doug Kwan  <[email protected]>
3930
3931         * layout.cc (Layout::choose_output_section): Handle script section
3932         types.
3933         (Layout::make_output_section_for_script): Add section type parameter.
3934         Handle script section types.
3935         * layout.h (Layout::make_output_section_for_script): Add section
3936         type parameter.
3937         * output.cc (Output_section::Output_section): Initialize data member
3938         is_noload_.
3939         (Output_section::do_reset_address_and_file_offset): Do not set address
3940         to 0 if section is a NOLOAD section.
3941         * output.h (Output_section::is_noload): New method.
3942         (Output_section::set_is_noload): Ditto.
3943         (Output_section::is_noload_): New data member.
3944         * script-c.h (Script_section_type): New enum type.
3945         (struct Parser_output_section_header): Add new file section_type.
3946         * script-sections.cc (Sections_element::output_section_name): Add
3947         parameter for returning script section type.
3948         (Output_section_definition::output_section_name): Ditto.
3949         (Output_section_definition::section_type)P; New method.
3950         (Output_section_definiton::script_section_type_name): Ditto.
3951         (Output_section_definition::script_section_type_): New data member.
3952         (Output_section_definition::Output_section_definition): Initialize
3953         data member Output_section_definition::script_section_type_.
3954         (Output_section_definition::create_sections): Pass script section type
3955         to Layout::make_output_section_for_script.
3956         (Output_section_definition::output_section_name): Return script
3957         section type to caller.
3958         (Output_section_definition::set_section_address): Do not advance
3959         dot value and load address if section type is NOLOAD.  Set address
3960         of NOLOAD sections regardless of section flags.
3961         (Output_section_definition::print): Print section type if it is
3962         not SCRIPT_SECTION_TYPE_NONE.
3963         (Output_section_definition::section_type): New method.
3964         (Output_section_definition::script_section_type_name): Ditto.
3965         (Script_sections::output_section_name): Add new parameter
3966         PSECTION_TYPE for returning script section type.  Pass it to
3967         section elements.  Handle discard sections.
3968         (Sort_output_sections::operator()): Handle NOLOAD sections.
3969         * script-sections.h (Script_sections::Section_type): New enum type.
3970         (Script_sections::output_section_name): Add a new parameter for
3971         returning script section type.
3972         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3973         INFO and NOLOAD.
3974         * yyscript.y (union): Add new field SECTION_TYPE.
3975         (COPY, DSECT, INFO, NOLOAD): New tokens.
3976         (opt_address_and_section_type): Change type to output_section_header.
3977         (section_type): New non-terminal
3978         (section_header): Handle section type.
3979         (opt_address_and_section_type): Return section type value.
3980
3981 2010-04-09  H.J. Lu  <[email protected]>
3982
3983         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3984         * testsuite/plugin_common_test_2.c (foo): Likewise.
3985
3986 2010-04-08  Doug Kwan  <[email protected]>
3987
3988         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3989         Output_merge_data.
3990         * output.cc (Output_section::add_merge_input_section): Simplify
3991         code and return status of Output_merge_base::add_input_section.
3992         Update merge section map only if Output_merge_base::add_input_section
3993         returns true.
3994
3995 2010-04-07  Doug Kwan  <[email protected]>
3996
3997         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3998         if section is marked as containing instructions but has no mapping
3999         symbols.
4000         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4001         correct section index.
4002         (Arm_relobj::find_linked_text_section): Ditto.
4003
4004 2010-04-07  Cary Coutant  <[email protected]>
4005
4006         * archive.cc (include_member): Destroy Read_symbols_data object before
4007         releasing file.
4008         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4009         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4010         (Read_symbols_data::~Read_symbols_data) New destructor.
4011         (Section_relocs::Section_relocs) New constructor.
4012         (Section_relocs::~Section_relocs) New destructor.
4013         (Read_relocs_data::Read_relocs_data) New constructor.
4014         (Read_relocs_data::~Read_relocs_data) New destructor.
4015         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4016         pointers to NULL after deleting.
4017
4018 2010-04-07  Doug Kwan  <[email protected]>
4019
4020         * arm.cc: Replace "endianity" with "endianness" in comments.
4021         (Arm_exidx_cantunwind): Ditto.
4022         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4023         (Arm_relobj::merge_flags_and_attributes): New method.
4024         (Arm_relobj::merge_flags_and_attributes_): New data member.
4025         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4026         (Arm_relobj::scan_sections_for_stubs): Ditto.
4027         (Arm_relobj::do_read_symbols): Check to see if we really want to
4028         merge processor-specific flags and attributes.  Exit early if
4029         an object is empty except for section names and the undefined symbol.
4030         (Target_arm::do_finalize_sections): Move check for ELF format to
4031         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4032         attributes from a regular object only when we have determined that
4033         it is aapropriate.  Do not create an .ARM.attributes section in
4034         output if there is no regular input object.
4035         (Target_arm::merge_processor_specific_flags): Check
4036         --warn-mismatch before printing any error.
4037         (Target_arm::merge_object_attributes): Ditto.
4038         * gold.cc (queue_middle_tasks): Handle the case in which there is
4039         no regular object in input.
4040         * options.cc (General_options::parse_EB): New method.
4041         (General_options::parse_EL): Same.
4042         (General_options::General_options): Initialize endianness_.
4043         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4044         New options.
4045         (General_options::Endianness): New enum.
4046         (General_options::endianness): New method.
4047         (General_options::endianness_): New data member.
4048         * parameters.cc (Parameters::set_options): Check target endianness.
4049         (Parameters::set_target_once): Ditto.
4050         (Parameters::check_target_endianness): New method.
4051         (parameters_force_valid_target): If either -EL or -EB is specified,
4052         use it to define endianness of default target.
4053         * parameters.h (Parameters::check_target_endianness): New method
4054         declaration.
4055         * target.h (class Target): Change "endianity" to "endianness"
4056         in comments.
4057
4058 2010-04-07  Ralf Wildenhues  <[email protected]>
4059
4060         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4061         * configure: Regenerate.
4062         * Makefile.in: Regenerate.
4063         * testsuite/Makefile.in: Regenerate.
4064
4065 2010-04-06  Cary Coutant  <[email protected]>
4066
4067         gcc PR lto/42757
4068         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4069         prevailing definitions of common symbols.
4070         * testsuite/plugin_test_6.sh: New test case.
4071         * testsuite/plugin_common_test_1.c: New test case.
4072         * testsuite/plugin_common_test_2.c: New test case.
4073         * testsuite/Makefile.am (plugin_test_6): New test case.
4074         * testsuite/Makefile.in: Regenerate.
4075
4076 2010-04-06  Nick Clifton  <[email protected]>
4077
4078         * po/vi.po: New Vietnamese translation.
4079
4080 2010-03-30  Doug Kwan  <[email protected]>
4081
4082         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4083
4084 2010-03-25  Doug Kwan  <[email protected]>
4085
4086         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4087         to avoid a conversion warning on a 32-bit host.
4088
4089 2010-03-24  Ian Lance Taylor  <[email protected]>
4090
4091         * testsuite/script_test_3.t: Add a TLS segment.
4092         * testsuite/Makefile.am (check_PROGRAMS): Add
4093         tls_phdrs_script_test.
4094         (tls_phdrs_script_test_SOURCES): Define.
4095         (tls_phdrs_script_test_DEPENDENCIES): Define.
4096         (tls_phdrs_script_test_LDFLAGS): Define.
4097         (tls_phdrs_script_test_LDADD): Define.
4098         * testsuite/Makefile.in: Rebuild.
4099
4100 2010-03-23  Cary Coutant  <[email protected]>
4101
4102         * fileread.cc (find_or_make_view): Fix comment.
4103
4104 2010-03-23  Ian Lance Taylor  <[email protected]>
4105
4106         * script-sections.cc (class Orphan_section_placement): Define
4107         PLACE_TLS and PLACE_TLS_BSS.
4108         (Orphan_section_placement::Orphan_section_placement): Initialize
4109         new places.
4110         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4111         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4112         (tls_script_test_SOURCES): Define.
4113         (tls_script_test_DEPENDENCIES): Define.
4114         (tls_script_test_LDFLAGS): Define.
4115         (tls_script_test_LDADD): Define.
4116         * testsuite/Makefile.in: Rebuild.
4117
4118 2010-03-22  Doug Kwan  <[email protected]>
4119
4120         * arm.cc (Arm_relocate_functions::abs8,
4121         Arm_relocate_functions::abs16): Use correct check for overflow
4122         specified in the ARM ELF specs.
4123         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4124         target of a BLX instruction specially.
4125         (Reloc_stub::stub_type_for_reloc): Ditto.
4126         (Relocate::relocate): Use symbolic names instead of numeric relocation
4127         codes to report error.
4128         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4129         workaround.
4130         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4131         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4132         thumb2_blx_out_of_range.stdout
4133         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4134         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4135         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4136         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4137         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4138         thumb2_blx_in_range, thumb2_blx_in_range.o,
4139         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4140         thumb2_blx_out_of_range.o): New rules.
4141         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4142         thumb2_blx_in_range and thumb2_blx_out_of_range.
4143         * testsuite/Makefile.in: Regenerate.
4144         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4145         * testsuite/thumb_blx_in_range.s: New file.
4146         * testsuite/thumb_blx_out_of_range.s: New file.
4147
4148 2010-03-22  Rafael Espindola  <[email protected]>
4149
4150         * archive.cc (Should_include): Move to archive.h.
4151         (should_include_member): Make it a member of Archive.
4152         (Lib_group): New.
4153         (Add_lib_group_symbols): New.
4154         * archive.h: Include options.h.
4155         (Archive_member): Moved from Archive.
4156         (Should_include): Moved from archive.cc.
4157         (Lib_group): New.
4158         (Add_lib_group_symbols): New.
4159         * dynobj.cc (do_should_include_member): New.
4160         * dynobj.h (do_should_include_member): New.
4161         * gold.cc (queue_initial_tasks): Update call to queue.
4162         * main.cc (main): Print lib group stats.
4163         * object.cc (do_should_include_member): New.
4164         * object.h: Include archive.h.
4165         (Object::should_include_member): New.
4166         (Object::do_should_include_member): New.
4167         (Sized_relobj::do_should_include_member): New.
4168         * options.cc (General_options::parse_start_lib): New.
4169         (General_options::parse_end_lib): New.
4170         (Input_arguments::add_file): Handle lib groups.
4171         (Input_arguments::start_group): Check we are not in a lib.
4172         (Input_arguments::start_lib): New.
4173         (Input_arguments::end_lib): New.
4174         * options.h (General_options): Add start_lib and end_lib.
4175         (Input_argument::lib_): New.
4176         (Input_argument::lib): New.
4177         (Input_argument::is_lib): New.
4178         (Input_file_lib): New.
4179         (Input_arguments::in_lib_): New.
4180         (Input_arguments::in_lib): New.
4181         (Input_arguments::start_lib): New.
4182         (Input_arguments::end_lib_): New.
4183         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4184         in unused members as preempted.
4185         (Sized_pluginobj::do_should_include_member): New.
4186         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4187         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4188         return the blocker.
4189         (Read_symbols::do_whole_lib_group): New.
4190         (Read_symbols::do_lib_group): New.
4191         (Read_symbols::do_read_symbols): Handle lib groups.
4192         (Read_symbols::get_name): Handle lib groups.
4193         * readsyms.h (Read_symbols): Add an archive member pointer.
4194         (Read_symbols::do_whole_lib_group): New.
4195         (Read_symbols::do_lib_group): New.
4196         (Read_symbols::member_): New.
4197         * script.cc (read_input_script): Update call to queue_soon.
4198
4199 2010-03-19  Doug Kwan  <[email protected]>
4200
4201         * arm.cc (Stub_table::Stub_table): Initialize new data members
4202         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4203         (Stub_table::add_reloc_stub): Assign stub offset and update
4204         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4205         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4206         New data members.
4207         (Stub_table::update_data_size_and_addralign): Use
4208         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4209         instead of going over all reloc stubs.
4210         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4211         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4212         Stringpool_template::offset_ to size of Stringpool_char.
4213         (Stringpool_template::new_key_offset): Remove code to initialize
4214         Stringpool_template::offset_.
4215         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4216         Stringpool_template::offset_ to zero.
4217
4218 2010-03-15  Doug Kwan  <[email protected]>
4219
4220         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4221         offset_.
4222         (Stringpool_template::new_key_offset): New method.
4223         (Stringpool_template::add_string): Assign offsets when adding new
4224         strings.
4225         (Stringpool_template::set_string_offsets): Do not set string offsets
4226         when not optimizing.
4227         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4228         member size_.
4229         (Chunked_vector::clear): Clear size_.
4230         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4231         (Chunked_vector::size): Return size_.
4232         (Chunked_vector::push_back): Use size_ to find insert position.
4233         (Chunked_vector::size_): New data member.
4234         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4235         (Stringpool_template::new_key_offset): New method declaration.
4236         (Stringpool_template::offset_): New data member.
4237
4238 2010-03-15   Rafael Espindola  <[email protected]>
4239
4240         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4241         Add_symbols' constructor.
4242         * readsyms.h (Add_symbols): Remove the input_group member.
4243
4244 2010-03-10  Ian Lance Taylor  <[email protected]>
4245
4246         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4247         target to ask whether a reference to a symbol requires a stack
4248         split.
4249         * target.h (Target::is_call_to_non_split): New function.
4250         (Target::do_is_call_to_non_split): Declare virtual function.
4251         * target.cc: Include "symtab.h".
4252         (Target::do_is_call_to_non_split): New function.
4253         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4254
4255 2010-03-10  Cary Coutant  <[email protected]>
4256
4257         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4258         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4259         (File_read::open[2]): Add whole_file_view_ to list of views.
4260         (File_read::make_view): Remove test of whole_file_view_.
4261         (File_read::find_or_make_view): Create whole_file_view_ if
4262         necessary.
4263         (File_read::clear_views): Replace bool parameter with enum;
4264         adjust all callers.  Don't delete views with permanent data;
4265         do delete cached views and views from archives if
4266         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4267         if clearing the corresponding view.
4268         * fileread.h (File_read::Clear_views_mode): New enum.
4269         (File_read::View::is_permanent_view): New method.
4270         (File_read::clear_views): Replace bool parameter
4271         with enum; adjust all callers.
4272         * options.h (General_options): Change keep_files_mapped option;
4273         add map_whole_files.
4274         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4275         releasing the file.
4276         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4277         the file.
4278
4279 2010-03-10  David S. Miller  <[email protected]>
4280
4281         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4282
4283 2010-03-09  Sriraman Tallam  <[email protected]>
4284
4285         * icf.cc (get_section_contents): Add '@' marker after processing the
4286         merge reloc.
4287
4288 2010-03-08  Doug Kwan  <[email protected]>
4289
4290         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4291         due to a conversion warning.
4292         (Arm_relobj::update_output_local_symbol_count): Check for local
4293         symbol with unset output index.
4294
4295 2010-03-05  Ian Lance Taylor  <[email protected]>
4296
4297         * options.h (class General_options): Add --spare-dynamic-tags.
4298         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4299         --spare-dynamic-tags.
4300
4301 2010-03-05  Ian Lance Taylor  <[email protected]>
4302
4303         * incremental.cc: Include "libiberty.h".
4304
4305 2010-03-05  Rainer Orth  <[email protected]>
4306
4307         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4308         function, is_info_ member.
4309         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4310         (Versions::Versions): Update caller.
4311         (Versions::define_base_version): Likewise.
4312         (Versions::add_def): Likewise.
4313
4314 2010-03-03  Sriraman Tallam  <[email protected]>
4315
4316         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4317         (Scan::possible_function_pointer_reloc): New function.
4318         (Scan::local_reloc_may_be_function_pointer): Change to call
4319         possible_function_pointer_reloc.
4320         (Scan::global_reloc_may_be_function_pointer): Ditto.
4321         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4322         relocations in ".data.rel.ro._ZTV" section.
4323         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4324         * testsuite/icf_safe_so_test.cc: Ditto.
4325         * testsuite/icf_safe_test.cc: Ditto.
4326         * testsuite/icf_safe_test.sh: Ditto.
4327
4328 2010-03-03  Viktor Kutuzov  <[email protected]>
4329             Ian Lance Taylor  <[email protected]>
4330
4331         * target-reloc.h (relocate_section): Check the symbol table index
4332         for -1U before setting the local symbol index.
4333         (scan_relocatable_relocs): If copying the relocation, record that
4334         the local symbol is required.
4335         * object.h (Symbol_value::is_output_symtab_index_set): New
4336         function.
4337         (Symbol_value::may_be_discarded_from_output_symtab): New
4338         function.
4339         (Symbol_value::has_output_symtab_entry): New function.
4340         (Symbol_value::needs_output_symtab_entry): Remove.
4341         (Symbol_value::output_symtab_index): Make sure the symbol index is
4342         set.
4343         (Symbol_value::set_output_symtab_index): Make sure the symbol
4344         index is not set.  Make sure the new index is valid.
4345         (Symbol_value::set_must_have_output_symtab_entry): New function.
4346         (Symbol_value::has_output_dynsym_entry): New function.
4347         (Symbol_value::set_output_dynsym_index): Make sure the new index
4348         is valid.
4349         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4350         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4351         local symbol if permitted.
4352         (Sized_relobj::do_finalize_local_symbols): Call
4353         is_output_symtab_index_set rather than needs_output_symtab_entry.
4354         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4355         rather than needs_output_symtab_entry.  Call
4356         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4357         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4358         is_output_symtab_index_set rather than needs_output_symtab_entry.
4359         * testsuite/discard_locals_relocatable_test.c: New file.
4360         * testsuite/discard_locals_test.sh: Test -r.
4361         * testsuite/Makefile.am (check_DATA): Add
4362         discard_locals_relocatable_test1.syms,
4363         discard_local_relocatable_test2.syms.
4364         (MOSTLYCLEANFILES): Likewise.  Also add
4365         discard_locals_relocatable_test1.lout and
4366         discard_locals_relocatable_test2.out.
4367         (discard_locals_relocatable_test1.syms): New target.
4368         (discard_locals_relocatable_test.o): New target.
4369         (discard_locals_relocatable_test1.out): New target.
4370         (discard_locals_relocatable_test2.syms): New target.
4371         (discard_locals_relocatable_test2.out): New target.
4372         (various): Add missing ../ld-new dependencies.
4373         * testsuite/Makefile.in: Rebuild.
4374
4375 2010-03-03  Nick Clifton  <[email protected]>
4376
4377         * po/fi.po: New Finnish translation.
4378
4379 2010-03-01  Doug Kwan  <[email protected]>
4380
4381         * layout.cc (Layout::Layout): Force section types of .init_array*,
4382         .preinit_array* and .fini_array* sections.
4383         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4384         Fix check of return value of std::string::find.().
4385         (Output_section::Input_section_sort_compare::operator()): Remove
4386         comment about .init_array.
4387         (Output_section::Input_section_sort_init_fini_compare::operator()):
4388         New method.
4389         (Output_section::sort_attached_input_sections): Handle .init_array
4390         and .fini_array specially.
4391         * output.h (Output_section::Inut_section_sort_compare): Update
4392         comment.
4393         (Output_section::Input_section_sort_init_fini_compare): New struct.
4394
4395 2010-02-26  Doug Kwan  <[email protected]>
4396
4397         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4398         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4399         * testsuite/debug_msg.sh: Avoid matching source line number for
4400         use of global variable undef_int.
4401
4402 2010-02-26  Doug Kwan  <[email protected]>
4403
4404         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4405         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4406         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4407         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4408         * options.cc (General_options::General_options): Initialize member
4409         fix_v4bx_.
4410         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4411         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4412         and rm_no_fix_v4bx.stdout
4413         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4414         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4415         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4416         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4417         and arm_no_fix_v4bx.
4418         * Makefile.in: Regenerate.
4419         * testsuite/arm_fix_v4bx.s: New file.
4420         * testsuite/arm_fix_v4bx.sh: Ditto.
4421
4422 2010-02-24  Doug Kwan  <[email protected]>
4423
4424         * arm.cc (Target_arm::got_section): Make the .got section the first
4425         non RELRO section in the data segment.
4426         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4427         suffixes of section names.
4428
4429 2010-02-24  Doug Kwan  <[email protected]>
4430
4431         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4432         flags and attributes merging if an input file is a binary file.
4433         * fileread.cc (Input_file::open): Record format of original file.
4434         * fileread.h (Input_file::Format): New enum type.
4435         (Input_file::Input_file): Initialize data member format_.
4436         (Input_file::format): New method definition.
4437         (Input_file::format_):: New data member.
4438
4439 2010-02-24  Doug Kwan  <[email protected]>
4440
4441         * arm.cc (Arm_output_data_got): New class.
4442         (ARM_TCB_SIZE): New constant
4443         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4444         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4445         If user uses a script with a SECTIONS clause, issue only a warning
4446         for a misplaced EXIDX input section.  Otherwise, issue an error.
4447         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4448         garbage collection.
4449         (Target_arm::got_mode_index_entry): Handle static linking.
4450         (Target_arm::Scan::local): Ditto.
4451         (Target_arm::Scan::global): Ditto.
4452         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4453         all incorrectly implemented relocations.
4454         (Target_arm::fix_exidx_coverage): Pass layout to
4455         Arm_output_section::fix_exidx_coverage.
4456         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4457         from ".ARM.exidx." and ".ARM.extab.".
4458
4459 2010-02-23  Viktor Kutuzov  <[email protected]>
4460
4461         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4462         section if it does not already exist.
4463         * attributes.cc (Attributes_section_data::Attributes_section_data):
4464         Don't crash if size is zero.
4465
4466 2010-02-23  Viktor Kutuzov  <[email protected]>
4467             Ian Lance Taylor  <[email protected]>
4468
4469         * gold.cc (queue_middle_tasks): If no input files were opened,
4470         exit.
4471         * workqueue.h (Task_function::Task_function): Assert that there is
4472         a blocker.
4473
4474 2010-02-22  Doug Kwan  <[email protected]>
4475
4476         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4477         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4478         types to avoid warnings due to different uint64_t implementations
4479         on different hosts.
4480
4481 2010-02-21  Doug Kwan  <[email protected]>
4482
4483         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4484         handling of the maximum backward branch offset.
4485         (Arm_relocate_functions::thumb_branch_common): Ditto.
4486         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4487         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4488         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4489         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4490         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4491         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4492         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4493         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4494         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4495         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4496         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4497         thumb2_bl_out_of_range.o): New rules.
4498         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4499         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4500         thumb2_bl_out_of_range
4501         * testsuite/Makefile.in: Regenerate.
4502         * testsuite/arm_bl_in_range.s: New file.
4503         * testsuite/arm_bl_out_of_range.s: Ditto.
4504         * testsuite/arm_branch_in_range.sh: Ditto.
4505         * testsuite/arm_branch_range.t: Ditto.
4506         * testsuite/thumb2_branch_range.t: Ditto.
4507         * testsuite/thumb_bl_in_range.s: Ditto.
4508         * testsuite/thumb_bl_out_of_range.s: Ditto.
4509         * testsuite/thumb_branch_range.t: Ditto.
4510
4511 2010-02-20  Sriraman Tallam  <[email protected]>
4512
4513         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4514         Add reloc offset information.
4515         * icf.cc (get_section_contents): Change iterators to point to the new
4516         vectors. Add reloc offset information to the contents.
4517         * icf.h (Icf::Sections_reachable_info): New typedef.
4518         (Icf::Sections_reachable_list): New typedef.
4519         (Icf::Offset_info): New typedef.
4520         (Icf::Reloc_info): New struct typedef.
4521         (Icf::Reloc_info_list): New typedef.
4522         (Icf::symbol_reloc_list): Delete method.
4523         (Icf::addend_reloc_list): Delete method.
4524         (Icf::section_reloc_list): Delete method.
4525         (Icf::reloc_info_list): New method.
4526         (Icf::reloc_info_list_): New member.
4527
4528 2010-02-19  Doug Kwan  <[email protected]>
4529
4530         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4531         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4532         * arm.cc (Arm_relocation_functions): New forward declaration.
4533         (Target_arm::Target_arm): Initialize new data members
4534         got_mod_index_offset_ and tls_base_symbol_defined_.
4535         (Target_arm::Relocate::relocate_tls): New method.
4536         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4537          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4538         New methods.
4539         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4540         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4541         (Target_arm::got_mod_index_offset_,
4542         Target_arm::tls_base_symbol_defined_): New data members.
4543         (Target_arm::Scan::local, Target::Scan::global,
4544         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4545         relocations.
4546
4547 2010-02-18  Doug Kwan  <[email protected]>
4548
4549         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4550         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4551         text section as a parameter becuase some broken tools may not set
4552         the link in section header.
4553         (Target_arm::has_got_section): New method.
4554         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4555         without any mapping symbol as data only.  Remove warning.
4556         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4557         link in its section header, try to discover the link by inspecting the
4558         REL31 relocation at the beginning of the section.
4559         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4560         in error message.
4561         (Target_arm::Scan::global): Treat any reference to the symbol
4562         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4563
4564 2010-02-12  Sriraman Tallam  <[email protected]>
4565
4566         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4567         (Scan::global_reloc_may_be_function_pointer): New function.
4568         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4569         (Scan::global_reloc_may_be_function_pointer): New function.
4570         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4571         (Scan::global_reloc_may_be_function_pointer): New function.
4572         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4573         (Scan::global_reloc_may_be_function_pointer): New function.
4574         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4575         (Scan::global_reloc_may_be_function_pointer): New function.
4576         (Scan::possible_function_pointer_reloc): New function.
4577         (Target_x86_64::can_check_for_function_pointers): New function.
4578         * gc.h (gc_process_relocs): Scan relocation types to determine if
4579         function pointers were taken for targets that support it.
4580         * icf.cc (Icf::find_identical_sections): Include functions for
4581         folding in safe ICF whose pointer is not taken.
4582         * icf.h (Secn_fptr_taken_set): New typedef.
4583         (fptr_section_id_): New member.
4584         (section_has_function_pointers): New function.
4585         (set_section_has_function_pointers): New function.
4586         (check_section_for_function_pointers): New function.
4587         * options.h: Fix comment for safe ICF option.
4588         * target.h (can_check_for_function_pointers): New function.
4589         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4590         Modify icf_safe_test for X86-64.
4591         * testsuite/Makefile.in: Regenerate.
4592         * testsuite/icf_safe_so_test.cc: New file.
4593         * testsuite/icf_safe_so_test.sh: New file.
4594         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4595         (main): Change to take pointer to function kept_func_3.
4596         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4597         folding is done correctly for X86-64.
4598
4599 2010-02-12  David S. Miller  <[email protected]>
4600
4601         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4602         is_symbolless parameter.
4603         (Output_reloc<SHT_REL>::is_symbolless): New.
4604         (Output_reloc<SHT_REL>::is_symbolless_): New.
4605         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4606         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4607         (Output_reloc<SHT_RELA>::is_symbolless): New.
4608         (Output_data_reloc::add_global): Handle is_symbolless.
4609         (Output_data_reloc::add_global_relative): Likewise.
4610         (Output_data_reloc::add_local): Likewise.
4611         (Output_data_reloc::add_local_relative): Likewise.
4612         (Output_data_reloc::add_symbolless_global_addend): New.
4613         (Output_data_reloc::add_symbolless_local_addend): New.
4614         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4615         is_symbolless.
4616         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4617         instead of ->is_relative_
4618         (Output_reloc::write): Likewise.
4619         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4620         (Output_reloc::write_rel): Simplify.
4621
4622         * sparc.cc (Target_sparc::Scan::local): Use
4623         ->add_symbolless_local_addend as needed.
4624         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4625         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4626         based upon relocation offset.
4627
4628 2010-02-11  Doug Kwan  <[email protected]>
4629
4630         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4631         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4632         beginning of function.
4633         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4634         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4635         parameter is_32bit in calls to should_apply_static_reloc.
4636         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4637         (check_DATA): Add arm_abs_global.stdout.
4638         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4639         arm_abs_global.stdout): New rules.
4640         (MOSTLLYCLEANFILES): Add arm_abs_global
4641         * Makefile.in: Regenerate.
4642         * testsuite/arm_abs_global.s: New file.
4643         * testsuite/arm_abs_global.sh: Ditto.
4644         * testsuite/arm_abs_lib.s: Ditto.
4645
4646 2010-02-11  Ian Lance Taylor  <[email protected]>
4647
4648         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4649         Read_relocs task.
4650         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4651         Allocate_commons_task first.
4652         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4653         task, rather than symtab_lock_.
4654         (Gc_process_relocs::~Gc_process_relocs): New function.
4655         (Gc_process_relocs::is_runnable): Check this_blocker_.
4656         (Gc_process_relocs::locks): Use next_blocker_ rather than
4657         blocker_.
4658         (Scan_relocs::~Scan_relocs): New function.
4659         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4660         symtab_lock_.
4661         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4662         next_blocker_.
4663         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4664         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4665         constructor accordingly.
4666         (class Gc_process_relocs): Likewise.
4667         (class Scan_relocs): Likewise.
4668         * common.h (class Allocate_commons_task): Remove symtab_lock_
4669         field, and corresponding constructor parameter.
4670         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4671         symtab_lock_.
4672         (Allocate_commons_task::locks): Likewise.
4673
4674 2010-02-11  Ian Lance Taylor  <[email protected]>
4675
4676         * gold-threads.h (class Once): Define.
4677         (class Initialize_lock): Rewrite as child of Once.
4678         * gold-threads.cc (class Once_initialize): Define.
4679         (once_pointer_control): New static variable.
4680         (once_pointer, once_arg): New static variables.
4681         (c_run_once): New static function.
4682         (Once::Once, Once::run_once, Once::internal_run): New functions.
4683         (class Initialize_lock_once): Remove.
4684         (initialize_lock_control): Remove.
4685         (initialize_lock_pointer): Remove.
4686         (initialize_lock_once): Remove.
4687         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4688         (Initialize_lock::initialize): Rewrite.
4689         (Initialize_lock::do_run_once): New function.
4690         * archive.cc (Archive::interpret_header): Only clear name if it is
4691         not already empty.
4692         * fileread.cc: Include "gold-threads.h"
4693         (file_counts_lock): New static variable.
4694         (file_counts_initialize_lock): Likewise.
4695         (File_read::release): Only increment counts when using --stats.
4696         Use a lock around the increment.
4697         * parameters.cc (class Set_parameters_target_once): Define.
4698         (set_parameters_target_once): New static variable.
4699         (Parameters::Parameters): Move here from parameters.h.
4700         (Parameters::set_target): Rewrite.
4701         (Parameters::set_target_once): New function.
4702         (Parameters::clear_target): Move here and rewrite.
4703         * parameters.h (class Parameters): Update declarations.  Add
4704         set_parameters_target_once_ field.
4705         (Parameters::Parameters): Move to parameters.cc.
4706         (Parameters::clear_target): Likewise.
4707         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4708         task.
4709         (Start_group::~Start_group): New function.
4710         (Start_group::is_runnable): New function.
4711         (Start_group::locks, Start_group::run): New functions.
4712         (Finish_group::run): Change saw_undefined to size_t.
4713         * readsyms.h (class Start_group): Define.
4714         (class Finish_group): Change saw_undefined_ field to size_t.
4715         (Finish_group::Finish_group): Remove saw_undefined and
4716         this_blocker parameters.  Change all callers.
4717         (Finish_group::set_saw_undefined): New function.
4718         (Finish_group::set_blocker): New function.
4719         * symtab.h (class Symbol_table): Change saw_undefined to return
4720         size_t.  Change saw_undefined_ field to size_t.
4721         * target-select.cc (Set_target_once::do_run_once): New function.
4722         (Target_selector::Target_selector): Initialize set_target_once_
4723         field.  Don't initialize lock_ and initialize_lock_ fields.
4724         (Target_selector::instantiate_target): Rewrite.
4725         (Target_selector::set_target): New function.
4726         * target-select.h (class Set_target_once): Define.
4727         (class Target_selector): Update declarations.  Make
4728         Set_target_once a friend.  Remove lock_ and initialize_lock_
4729         fields.  Add set_target_once_ field.
4730
4731 2010-02-10  Ian Lance Taylor  <[email protected]>
4732
4733         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4734         queueing any tasks.
4735         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4736         (queue_middle_tasks): Add all blockers before queueing any tasks.
4737         (queue_final_tasks): Likewise.
4738         * token.h (Task_token::add_blockers): New function.
4739         * object.h (Input_objects::number_of_relobjs): New function.
4740
4741 2010-02-10  Ian Lance Taylor  <[email protected]>
4742
4743         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4744         shared, not if not position independent.
4745         * x86_64.cc (Relocate::relocate_tls): Likewise.
4746         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4747         (tls_pie_pic_test): New target.
4748         * testsuite/Makefile.in: Rebuild.
4749
4750         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4751         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4752         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4753         * testsuite/Makefile.in: Rebuild.
4754
4755 2010-02-09  David S. Miller  <[email protected]>
4756
4757         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4758         R_SPARC_RELATIVE using ->add_local_relative().
4759         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4760
4761         * output.h (Output_data_dynamic::add_section_size): New method
4762         that takes two Output_data objects.
4763         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4764         entry param.  Handle it in initializers.
4765         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4766         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4767         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4768         arg.
4769         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4770         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4771         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4772         for dynrel_includes_plt.
4773         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4774         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4775         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4776         before .rela.plt
4777         (Target_sparc::do_finalize_sections): Update to pass true for
4778         dynrel_includes_plt.
4779         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4780         output before .rela.plt
4781         (Target_powerpc::do_finalize_sections): Update to pass true for
4782         dynrel_includes_plt when 32-bit.
4783
4784 2010-02-08  Doug Kwan  <[email protected]>
4785
4786         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4787         method.
4788         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4789         Arm_relobj::scan_section_for_cortex_a8_stubs,
4790         Arm_relobj::do_relocation_section): Instead of calling
4791         Output_section::output_address, use faster
4792         Arm_relobj::simple_input_section_output_address.
4793
4794 2010-02-08  David S. Miller  <[email protected]>
4795
4796         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4797         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4798         relocation helper function.
4799
4800         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4801         just like R_SPARC_GOT{10,13,22}.
4802         (Target_sparc::Scan::local): Likewise.
4803         (Target_sparc::Relocate:relocate): Likewise.
4804
4805 2010-02-06  Ian Lance Taylor  <[email protected]>
4806
4807         * configure.ac: Rewrite targetobjs duplicate removal code to use
4808         only shell constructs.
4809         * configure: Rebuild.
4810
4811 2010-02-05  Doug Kwan  <[email protected]>
4812
4813         PR 11247
4814         * arm.cc (Arm_relobj::section_is_scannable): New method.
4815         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4816         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4817
4818 2010-02-04  Doug Kwan  <[email protected]>
4819
4820         PR 11247
4821         * arm-reloc-property.cc (cstdio): Include.
4822         * configure.ac (targetobjs): Remove duplicates.
4823         * configure: Regenerate.
4824         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4825         big and little endian version for a given address size.
4826
4827 2010-02-03  Doug Kwan  <[email protected]>
4828
4829         * arm-reloc-property.cc
4830         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4831         definition.
4832         * arm-reloc-property.h
4833         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4834         New method definition.
4835         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4836         declaration.
4837         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4838         overflow to N.
4839         (GOT_PREL): Change implemented to Y.
4840         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4841         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4842         (Arm_relocate_functions::movw_abs_nc): Remove method.
4843         (Arm_relocate_functions::movt_abs): Ditto.
4844         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4845         (Arm_relocate_functions::thm_movt_abs): Ditto.
4846         (Arm_relocate_functions::movw_rel_nc): Ditto.
4847         (Arm_relocate_functions::movw_rel): Ditto.
4848         (Arm_relocate_functions::movt_rel): Ditto.
4849         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4850         (Arm_relocate_functions:thm_movw_rel): Ditto.
4851         (Arm_relocate_functions:thm_movt_rel): Ditto.
4852         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4853         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4854         New method definitions.
4855         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4856         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4857         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4858         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4859         (Target_arm::Relocate::relocate): Check for non-static or
4860         unimplemented relocation code and exit early.  Change calls to
4861         Target_arm::reloc_uses_thumb_bit and
4862         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4863         instead.  Refactor code to handle similar relocations to increase
4864         code sharing.  Remove check for unsupported relocation code in switch
4865         statement.
4866         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4867         relocation property table to find out size.  Change error message to
4868         print out the name of a relocation code instead of the numeric value.
4869         (Target_arm::scan_reloc_for_stub): Use relocation property table
4870         instead of calling Target_arm::reloc_uses_thumb_bit().
4871
4872 2010-02-02  Doug Kwan  <[email protected]>
4873
4874         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4875         types of relaxed input section.
4876
4877 2010-02-02  Doug Kwan  <[email protected]>
4878
4879         * Makefile.am (HFILES): Add arm-reloc-property.h.
4880         (DEFFILES): New.
4881         (TARGETSOURCES): Add arm-reloc-property.cc
4882         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4883         (libgold_a_SOURCES): $(DEFFILES)
4884         * Makefile.in: Regenerate.
4885         * arm-reloc-property.cc: New file.
4886         * arm-reloc-property.h: New file.
4887         * arm-reloc.def: New file.
4888         * arm.cc: Update comments.
4889         (arm-reloc-property.h): New included header.
4890         (arm_reloc_property_table): New global variable.
4891         (Target_arm::do_select_as_default_target): New method definition.
4892         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4893         arm-reloc-property to targ_extra_obj.
4894         * parameters.cc (set_parameters_target): Call
4895         Target::select_as_default_target().
4896         * target.h (Target::select_as_default_target): New method definition.
4897         (Target::do_select_as_default_target): Same.
4898
4899 2010-02-01  Doug Kwan  <[email protected]>
4900
4901         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4902         first_output_text_section_.
4903         (Arm_exidx_fixup::first_output_text_section): New method definition.
4904         (Arm_exidx_fixup::first_output_text_section_): New data member.
4905         (Arm_exidx_fixup::process_exidx_section): Record the first text
4906         output section seen.
4907         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4908         and entsize in output section header.
4909
4910 2010-01-29  Viktor Kutuzov  <[email protected]>
4911
4912         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4913         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4914         (Arm_relocate_functions::thm_alu11): New Method.
4915         (Arm_relocate_functions::thm_pc8): New Method.
4916         (Arm_relocate_functions::thm_pc12): New Method.
4917         (Target_arm::Scan::local): Handle the relocations.
4918         (Target_arm::Scan::global): Likewise.
4919         (Target_arm::Relocate::relocate): Likewise.
4920         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4921
4922 2010-01-29  Doug Kwan  <[email protected]>
4923
4924         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4925         of relocation types as ld.
4926
4927 2010-01-29  Doug Kwan  <[email protected]>
4928
4929         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4930         to public.
4931         (Arm_relocate_functions::thumb_branch_common): Ditto.
4932         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4933         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4934         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4935         Arm_relocate_functions::jump24): Remove.
4936         (Target_arm::Relocate::relocate): Adjust code to call
4937         Arm_relocation_functions::arm_branch_common and
4938         Arm_relocation_functions::thumb_branch_common instead of their removed
4939         wrappers.  Merge switch-cases together to reduce source code size.
4940
4941 2010-01-29  Doug Kwan  <[email protected]>
4942
4943         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4944         output_local_symbol_count_needs_update_.
4945         (Arm_relobj::output_local_symbol_count_needs_update,
4946          Arm_relobj::set_output_local_symbol_count_needs_update,
4947          Arm_relobj::update_output_local_symbol_count): New methods.
4948         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4949         member.
4950         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4951         of pointed function as in a R_ARM_PREL31 relocation.
4952         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4953         for output local symbol count updating.
4954         (Target_arm::do_relax): Update output local symbol counts in objects
4955         if necessary.
4956         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4957
4958 2010-01-29  Viktor Kutuzov  <[email protected]>
4959
4960         * arm.cc: Added support for the ARM relocations:
4961         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4962         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4963         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4964         movw_prel_nc).
4965         (Arm_relocate_functions::movw_rel): New method.
4966         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4967         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4968         thm_movw_prel_nc).
4969         (Arm_relocate_functions::thm_movw_rel): New method.
4970         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4971         thm_movt_prel).
4972         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4973         relocations.
4974         (Target_arm::Scan::global): Likewise.
4975         (Target_arm::Relocate::relocate): Likewise.
4976         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4977         Likewise.
4978
4979 2010-01-27  Viktor Kutuzov  <[email protected]>
4980
4981         * arm.cc: Added support for ARM group relocations.
4982         (Target_arm::reloc_needs_sym_origin): New method.
4983         (Arm_relocate_functions::calc_grp_kn): New method.
4984         (Arm_relocate_functions::calc_grp_residual): New method.
4985         (Arm_relocate_functions::calc_grp_gn): New method.
4986         (Arm_relocate_functions::arm_grp_alu): New Method.
4987         (Arm_relocate_functions::arm_grp_ldr): New Method.
4988         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4989         (Arm_relocate_functions::arm_grp_ldc): New Method.
4990         (Target_arm::Scan::local): Handle the ARM group relocations.
4991         (Target_arm::Scan::global): Likewise.
4992         (Target_arm::Relocate::relocate): Likewise.
4993         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4994         Likewise.
4995
4996 2010-01-26  Doug Kwan  <[email protected]>
4997
4998         * arm.cc (set): Include.
4999         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5000         pointer type.
5001         (Arm_output_section::Text_section_list): New type.
5002         (Arm_output_section::append_text_sections_to_list): New method.
5003         (Arm_output_section::fix_exidx_coverage): Ditto.
5004         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5005         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5006         Relobj::set_section_offset() instead of
5007         Sized_relobj::invalidate_section_offset().
5008         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5009         parameter for section headers. Ignore relocation sections for
5010         unallocated sections and EXIDX sections.
5011         (Target_arm::fix_exidx_coverage): New method.
5012         (Target_arm::output_section_address_less_than): New type.
5013         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5014         linked text section instead of the EXIDX section.
5015         (Arm_output_section::create_stub_group): Add an assertion to check
5016         that this is not an EXIDX output section.
5017         (Arm_output_section::append_text_sections_to_list): New method.
5018         (Arm_output_section::fix_exidx_coverage): Ditto.
5019         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5020         Arm_relobj::section_needs_reloc_stub_scanning.
5021         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5022         first pass.
5023         (Target_arm::fix_exidx_coverage): New method.
5024         * object.h (Relobj::set_output_section): New method.
5025         (Sized_relobj::invalidate_section_offset): Remove method.
5026         (Sized_relobj::do_invalidate_section_offset): Remove method.
5027         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5028
5029 2010-01-25  Doug Kwan  <[email protected]>
5030
5031         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5032         Fix warning due to signed and unsigned comparison on a 32-bit host.
5033
5034 2010-01-22  Doug Kwan  <[email protected]>
5035
5036         * arm.cc (Target_arm::do_relax): Record an output section for section
5037         offset adjustment it contains any stub table that has changed.
5038         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5039         offsets in an output section if necessary.
5040         * output.cc (Output_section::Output_section): Initialize
5041         section_offsets_need_adjustments_.
5042         (Output_section::add_input_section_for_script): Renamed to
5043         Output_section::add_simple_input_section.
5044         (Output_section::save_states): Add a comment.
5045         (Output_section::discard_states): New method defintion.
5046         (Output_section::adjust_section_offsets): Same.
5047         * output.h (Output_section::add_input_section_for_script): Renamed to
5048         Output_section::add_simple_input_section.
5049         (Output_section::discard_states): New method declaration.
5050         (Output_section::adjust_section_offsets): Same.
5051         (Output_section::section_offsets_need_adjustment,
5052         Output_section::set_section_offsets_need_adjustment): New method
5053         definitions.
5054         (Output_section::section_offsets_need_adjustment_): New data member.
5055         * script-sections.cc
5056         (Output_section_element_input::set_section_address): Adjust code for
5057         renaming of Output_section::add_input_section_for_script.
5058         (Orphan_output_section::set_section_address): Same.
5059
5060 2010-01-22  Viktor Kutuzov  <[email protected]>
5061
5062         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5063         Fix_v4bx enum values .
5064         * gold/options.h (General_options): New option definitions.
5065         (General_options::fix_v4bx): New method.
5066         (General_options::Fix_v4bx): New enum.
5067         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5068         (General_options::parse_fix_v4bx_interworking): New method.
5069
5070 2010-01-22  Doug Kwan  <[email protected]>
5071
5072         * arm.cc (Arm_exidx_fixup): New class.
5073
5074 2010-01-21  Doug Kwan  <[email protected]>
5075
5076         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5077         classes.
5078         (Arm_exidx_section_offset_map): New type.
5079
5080 2010-01-21  Doug Kwan  <[email protected]>
5081
5082         * arm.cc (Arm_exidx_input_section): New class.
5083         (Arm_relobj::exidx_input_section_by_link,
5084         Arm_relobj::exidx_input_section_by_shndx,
5085         Arm_relobj::make_exidx_input_section): New methods.
5086         (read_arm_attributes_section): Remove.
5087         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5088         information about them.
5089         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5090         to here.
5091
5092 2010-01-20  Doug Kwan  <[email protected]>
5093
5094         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5095         Input_section_specifier to Section_id.
5096         (Target_arm::new_arm_input_section: Adjust code for change of key
5097         type.
5098         (Target_arm::find_arm_input_section): Ditto.
5099         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5100         (Section_id): Remove.
5101         (Garbage_collection::Section_id_hash): Remove.
5102         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5103         (Section_id): Remove.
5104         (Icf::Section_id_hash): Remove.
5105         * object.h (Section_id, Const_section_id, Section_id_hash,
5106         Const_section_id_hash): New type definitions.
5107         * output.cc (Output_section::add_relaxed_input_section): Change to
5108         use Const_section_id instead of Input_section_specifier as key type.
5109         (Output_section::add_merge_input_section): Ditto.
5110         (Output_section::build_relaxation_map): Change to use Section_id
5111         instead of Input_section_specifier as key type.
5112         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5113         Ditto.
5114         (Output_section::convert_input_sections_to_relaxed_sections): Change
5115         to use Const_section_id instead of Input_section_specifier as key type.
5116         (Output_section::find_merge_section): Ditto.
5117         (Output_section::find_relaxed_input_section): Ditto.
5118         * output.h (Input_section_specifier): Remove class.
5119         (Output_section::Output_section_data_by_input_section_map): Change
5120         key type to Const_section_id.
5121         (Output_section::Output_relaxed_input_section_by_input_section_map):
5122         Ditto.
5123         (Output_section::Relaxation_map): Change key type to Section_id.
5124
5125 2010-01-20  Viktor Kutuzov  <[email protected]>
5126
5127         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5128         (class Arm_v4bx_stub): New class.
5129         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5130         (Stub_factory::make_arm_v4bx_stub): New method.
5131         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5132         (Stub_table::empty): Handle v4bx stubs.
5133         (Stub_table::add_arm_v4bx_stub): New method.
5134         (Stub_table::find_arm_v4bx_stub): New method.
5135         (Arm_relocate_functions::v4bx): New method.
5136         (Target_arm::fix_v4bx): New method.
5137         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5138         (Stub_table::relocate_stubs): Likewise.
5139         (Stub_table::do_write): Likewise.
5140         (Stub_table::update_data_size_and_addralign): Likewise.
5141         (Stub_table::finalize_stubs):  Likewise.
5142         (Target_arm::Scan::local): Likewise.
5143         (Target_arm::Scan::global): Likewise.
5144         (Target_arm::do_finalize_sections): Likewise.
5145         (Target_arm::Relocate::relocate): Likewise.
5146         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5147         Likewise.
5148         (Target_arm::scan_reloc_for_stub): Likewise.
5149         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5150
5151 2010-01-19  Ian Lance Taylor  <[email protected]>
5152
5153         * output.cc (Output_section_headers::do_sized_write): Write large
5154         segment count to sh_info field.
5155         (Output_file_header::do_sized_write): For large segment count,
5156         write PN_XNUM to e_phnum field.
5157
5158 2010-01-15  Viktor Kutuzov  <[email protected]>
5159
5160         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5161         (Arm_relocate_functions::thm_jump8): New function.
5162         (Arm_relocate_functions::thm_jump11): New function.
5163         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5164         R_ARM_THM_JUMP11.
5165         (Target_arm::Scan::global): Likewise.
5166         (Target_arm::Relocate::relocate): Likewise.
5167         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5168         Likewise.
5169
5170 2010-01-14  Doug Kwan  <[email protected]>
5171
5172         * arm.cc (map, utility): Include headers.
5173         (Target_arm::apply_cortex_a8_workaround): New method.
5174         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5175         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5176         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5177         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5178         the --[no-]fix-cortex-a8 command line options.
5179         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5180         (Target_arm::relocate_stub): Use addend in instruction template.
5181         * options.h (DEFINE_bool): Set the user-set flag.
5182         (General_options): Add --[no-]-fix-cortex options.
5183         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5184         : Update fast look-up map after conversion.
5185
5186 2010-01-14  Sriraman Tallam  <[email protected]>
5187
5188         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5189         in the first pass of do_layout.
5190
5191 2010-01-13  Doug Kwan  <[email protected]>
5192
5193         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5194         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5195         apparent compiler problem of not folding static constant integral
5196         data members of elfcpp::Elf_sizes<32>.
5197
5198 2010-01-13  Doug Kwan  <[email protected]>
5199
5200         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5201         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5202         Arm_relobj::scan_section_for_cortex_a8_erratum,
5203         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5204         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5205         sections to scan for relocation stubs into a new method
5206         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5207         relocation and Cortex-A8 stub scanning.
5208         (Target_arm::do_relax): Force stubs to be after stubbed sections
5209         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5210         the beginning of a new relaxation pass.  Update a comment.
5211         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5212
5213 2010-01-12  Ian Lance Taylor  <[email protected]>
5214
5215         * target-reloc.h (visibility_error): New inline function.
5216         (relocate_section): Call visibility_error.
5217         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5218         (MOSTLYCLEANFILES): Likewise.
5219         (protected_4_pic.o, protected_3.err): New targets.
5220         * testsuite/protected_4.cc: New file.
5221
5222 2010-01-12  Doug Kwan  <[email protected]>
5223
5224         * arm.cc (Cortex_a8_reloc): New class.
5225         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5226         and cortex_a8_relocs_info_.
5227         (Target_arm::fix_cortex_a8): New method definition.
5228         (Target_arm::Cortex_a8_relocs_info): New type.
5229         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5230         New data member declarations.
5231         (Target_arm::scan_reloc_for_stub): Record information about
5232         relocations for THUMB branches that might be exempted from the
5233         Cortex-A8 workaround.
5234         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5235         at the beginning of a relaxation pass.
5236
5237 2010-01-12  Doug Kwan  <[email protected]>
5238
5239         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5240         (Arm_relobj::Mapping_symbol_position,
5241          Arm_reloj::Mapping_symbol_position_less,
5242          Arm_relobj::Mapping_symbols_info): New types.
5243         (Target_arm::is_mapping_symbol_name): New method definition.
5244         (Arm_relobj::do_count_local_symbols): Save information about mapping
5245         symbols.
5246
5247 2010-01-11  Doug Kwan  <[email protected]>
5248
5249         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5250         Arm_relocate_functions::thumb32_branch_upper,
5251         Arm_relocate_functions::thumb32_branch_lower,
5252         Arm_relocate_functions::thumb32_cond_branch_offset,
5253         Arm_relocate_functions::thumb32_cond_branch_upper,
5254         Arm_relocate_functions::thumb32_cond_branch_lower,
5255         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5256         branch offset encoding.
5257         (Arm_relocate_functions::thumb_branch_common): Use new branch
5258         offset encoding methods to avoid code duplication.
5259         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5260         (Stub_addend_reader::operator()): Use new branch encoding method
5261         to avoid code duplication.
5262
5263 2010-01-11  Doug Kwan  <[email protected]>
5264
5265         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5266         (Target_arm::do_finalize_sections): Define special EXIDX section
5267         symbols only if referenced.
5268         * gc.h (Garbage_collection::add_reference): New method.
5269         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5270         code duplication.
5271
5272 2010-01-11  Ian Lance Taylor  <[email protected]>
5273
5274         * script.cc (Version_script_info::build_expression_list_lookup):
5275         Change complaing about duplicate wildcard match from error to
5276         warning.
5277
5278         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5279         of 2009-12-30.
5280         (Version_script_info::Version_script_info): Initialize globs_,
5281         default_version_, default_is_global_, and exact_.  Don't
5282         initialize globals_ or locals_.
5283         (Version_script_info::build_lookup_tables): Build local symbols
5284         first.
5285         (Version_script_info::unquote): New function.
5286         (Version_script_info::add_exact_match): New function.
5287         (Version_script_info::build_expression_list_lookup): Remove lookup
5288         parameter.  Add is_global parameter.  Change all callers.  Handle
5289         wildcard pattern specially.  Unquote pattern.  Call
5290         add_exact_match.
5291         (Version_script_info::get_name_to_match): New function.
5292         (Version_script_info::get_symbol_version): New function.
5293         (Version_script_info::get_symbol_version_helper): Remove.
5294         (Version_script_info::check_unmatched_names): Call unquote.
5295         * script.h (class Version_script_info): Change get_symbol_version
5296         to be non-inline and add is_global parameter; change all callers.
5297         Rewrite symbol_is_local.  Update declarations.  Define struct
5298         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5299         Remove globals_ and locals_ members.  Add exact_, globs_,
5300         default_version_, is_global_.
5301         (Version_script_info::Glob): Remove pattern, add expression and
5302         is_global.  Update constructor.  Change all callers.
5303         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5304         default version.
5305         (Versions::symbol_section_contents): If a symbol is undefined, or
5306         defined in a dynamic object, set the version index to
5307         VER_NDX_LOCAL.
5308         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5309         symbol_is_local.
5310         (Symbol_table::add_from_pluginobj): Likewise.
5311         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5312
5313 2010-01-11  Doug Kwan  <[email protected]>
5314
5315         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5316         (incremental_dump_LDADD): Add linking option for libintl.
5317         * Makefile.in: Regenerate.
5318
5319 2010-01-11  H.J. Lu  <[email protected]>
5320
5321         PR gold/11144
5322         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5323         instead of -Ds.
5324         * testsuite/Makefile.in: Regenerated.
5325
5326 2010-01-10  Doug Kwan  <[email protected]>
5327
5328         * options.h (DEFINE_var): Use parentheses around argument varname__
5329         in macro body to avoid any unintended subsequent substitutions.
5330
5331 2010-01-10  Ian Lance Taylor  <[email protected]>
5332
5333         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5334         candidates before doing symbol resolution.
5335
5336         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5337         ODR candidates if only one is weak.
5338
5339 2010-01-08  Ian Lance Taylor  <[email protected]>
5340
5341         * script.cc (Version_script_info::build_expression_list_lookup):
5342         Don't warn about ambiguous version, just record the ambiguity.
5343         (Version_script_info::get_symbol_version_helper): Give error if
5344         version is ambiguous.
5345
5346 2010-01-08  Doug Kwan  <[email protected]>
5347
5348         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5349           prev_data_size_ and prev_addralign_.  Remove initializer for
5350           deleted data member has_been_changed_.
5351           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5352           to determine if the table is empty.
5353           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5354           Remove.
5355           (Stub_table::add_reloc_stub): Define method in class definition
5356           instead of just declaring it there.
5357           (Stub_table::add_cortex_a8_stub): New method definition.
5358           (Stub_table::update_data_size_and_addralign): Ditto.
5359           (Stub_table::finalize_stubs): Ditto.
5360           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5361           (Stub_table::do_addralign_): Return address alignment in the
5362           (Stub_table::do_reset_address_and_file_offset): Define method in
5363           class definition instead of declaring it there.  Set current data
5364           size to be the data size of the previous pass.
5365           (Stub_table::set_final_data_size): Use current data size as the
5366           final data size.
5367           (Stub_table::relocate_stub): Change parameter type of stub from
5368           Reloc_stub pointer to Stub pointer.
5369           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5370           (Stub_table::Cortex_a8_stub_list): New typedef.
5371           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5372            Stub_table::prev_addralign_): New data member.
5373           (Arm_relobj::Arm_relobj): Initialize data member
5374           section_has_cortex_a8_workaround_.
5375           (Arm_relobj::section_has_cortex_a8_workaround,
5376            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5377            definitions.
5378           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5379           declarations.
5380           (Target_arm::relocate_stub): Change parameter type of stub from
5381           Reloc_stub pointer to Stub pointer.
5382           (Insn_template::size, Insn_template::alignment): Handle
5383           THUMB16_SPECIAL_TYPE.
5384           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5385            Stub_table::update_data_size_and_addralign,
5386            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5387           definitions.
5388           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5389           (Stub_table::do_write): Ditto.
5390           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5391
5392 2010-01-08  Ian Lance Taylor  <[email protected]>
5393
5394         PR 11108
5395         * symtab.h (class Symbol): Remove fields is_target_special_ and
5396         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5397         (Symbol::is_defined_in_discarded_section): New function.
5398         (Symbol::set_is_defined_in_discarded_section): New function.
5399         (Symbol::has_plt_offset): Rewrite.
5400         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5401         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5402         Don't initialize is_target_special_ or has_plt_offset_.
5403         Initialize is_defined_in_discarded_section_.
5404         (Symbol_table::add_from_relobj): If appropriate, set
5405         is_defined_in_discarded_section.
5406         * resolve.cc (Symbol::override_base_with_special): Don't test
5407         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5408         * target-reloc.h (relocate_section): Do special handling for
5409         symbols defined in discarded sections for global symbols as well
5410         as local symbols.
5411
5412 2010-01-08  Ian Lance Taylor  <[email protected]>
5413
5414         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5415         the SHT_SYMTAB case.
5416
5417 2010-01-08  Ian Lance Taylor  <[email protected]>
5418
5419         * object.cc (Sized_relobj::do_layout): Don't get confused if
5420         layout_eh_frame returns NULL.
5421
5422 2010-01-08  Ian Lance Taylor  <[email protected]>
5423
5424         PR 11084
5425         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5426         dynamic symbol table, use the normal symbol table.
5427         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5428         symbol table.
5429
5430 2010-01-08  Ian Lance Taylor  <[email protected]>
5431
5432         PR 11072
5433         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5434         sections.
5435
5436 2010-01-08  H.J. Lu  <[email protected]>
5437
5438         * version.cc (print_version): Change to "Copyright 2010".
5439
5440 2010-01-08  Ian Lance Taylor  <[email protected]>
5441
5442         PR 10287
5443         PR 11063
5444         * i386.cc (class Target_i386): Change return type of plt_section
5445         to be non-const.
5446         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5447         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5448         tls_desc_rel_ field.
5449         (Output_data_plt_i386::rel_tls_desc): New function.
5450         (Target_i386::rel_tls_desc_section): New function.
5451         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5452         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5453         R_386_TLS_DESC reloc in rel_tls_desc_section.
5454         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5455         Define struct Tlsdesc_info.
5456         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5457         (Target_x86_64::do_reloc_symbol_index): New function.
5458         (Target_x86_64::add_tlsdesc_info): New function.
5459         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5460         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5461         tlsdesc_rel_ field.
5462         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5463         all callers.
5464         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5465         (Target_x86_64::rela_tlsdesc_section): New function.
5466         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5467         handling.
5468         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5469         (Target_x86_64::do_reloc_addend): New function.
5470         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5471         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5472         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5473         (Output_reloc::type): New function.
5474         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5475         (Output_reloc::is_target_specific): New function.
5476         (Output_reloc::target_arg): New function.
5477         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5478         absolute relocs and target specific relocs.
5479         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5480         add_target_specific.
5481         (class Output_data_reloc) [SHT_RELA]: Likewise.
5482         * output.cc (Output_reloc::Output_reloc): Add four new versions
5483         for absolute relocs and target specific relocs.
5484         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5485         (Output_reloc::get_symbol_index): Likewise.
5486         (Output_reloc::local_section_offset): Check that local_sym_index_
5487         is not TARGET_CODE or 0.
5488         (Output_reloc::symbol_value): Likewise.
5489         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5490         reloc.
5491         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5492         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5493         functions.
5494         * layout.cc (add_target_dynamic_tags): Use output section for
5495         DT_PLTRELSZ and DT_JMPREL.
5496
5497 2010-01-07  Ian Lance Taylor  <[email protected]>
5498
5499         PR 11061
5500         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5501         function.
5502         (class Output_data_reloc_generic): Define.
5503         (class Output_data_reloc_base): Change base class to
5504         Output_data_reloc_generic.  Change add() method to call
5505         bump_relative_reloc_count for a relative reloc.  Remove
5506         sort_relocs_ field.
5507         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5508         to sort_relocs().
5509         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5510         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5511         appropriate.
5512         * layout.h (class Layout): Update declaration.
5513
5514 2010-01-07  Ian Lance Taylor  <[email protected]>
5515
5516         * output.h (class Output_data): Add const version of
5517         output_section and do_output_section.
5518         (class Output_section_data): Add const version of
5519         do_output_section.
5520         (class Output_section): Likewise.
5521         * layout.cc (Layout::add_target_dynamic_tags): New function.
5522         * layout.h (class Layout): Update declarations.
5523         * arm.cc (Target_arm::do_finalize_sections): Use
5524         add_target_dynamic_tags.
5525         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5526         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5527         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5528         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5529
5530 2010-01-07  Ian Lance Taylor  <[email protected]>
5531
5532         PR 11042
5533         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5534         object as needed.
5535
5536 2010-01-07  Dmitry Gorbachev  <[email protected]>
5537             Ian Lance Taylor  <[email protected]>
5538
5539         PR 11019
5540         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5541         Xindex::read_symtab_xindex.
5542
5543 2010-01-07  Doug Kwan  <[email protected]>
5544
5545         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5546         (Insn_template::thumb16_bcond_insn): New method declaration.
5547         (Insn_template): Fix spelling.
5548         (Stub::thumb16_special): New method declaration.
5549         (Stub::do_write): Define virtual method which was previously pure
5550         virtual.
5551         (Stub::do_thumb16_special): New method declaration.
5552         (Stub::do_fixed_endian_write): New template member.
5553         (Reloc_stub::do_write): Remove.
5554         (Reloc_stub::do_fixed_endian_write): Remove.
5555         (Cortex_a8_stub): New class definition.
5556         (Stub_factory::make_cortex_a8_stub): New method definition.
5557         (Stub_factory::Stub_factory): Add missing static storage class
5558         qualifier for elf32_arm_stub_a8_veneer_blx.
5559
5560 2010-01-07  Ian Lance Taylor  <[email protected]>
5561
5562         PR 10980
5563         * options.h (class General_options): Add --warn-unresolved-symbols
5564         and --error-unresolved-symbols.
5565         * errors.cc (Errors::undefined_symbol): Implement
5566         --warn-unresolved-symbols.
5567
5568         * options.h (class General_options): Add -z text and -z textoff.
5569         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5570
5571 2010-01-06  Sriraman Tallam  <[email protected]>
5572
5573         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5574         (Garbage_collection::cident_sections): New function.
5575         (Garbage_collection::add_cident_section): New function.
5576         (Garbage_collection::cident_sections_): New member.
5577         (gc_process_relocs): Add references to sections whose names are C
5578         identifiers.
5579         * gold.h (cident_section_start_prefix): New constant.
5580         (cident_section_stop_prefix): New constant.
5581         (is_cident): New function.
5582         * layout.cc (Layout::define_section_symbols): Replace string constants
5583         with the newly defined constants.
5584         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5585         C identifiers.
5586         * testsuite/Makefile.am: Add gc_orphan_section_test.
5587         * testsuite/Makefile.in: Regenerate.
5588         * testsuite/gc_orphan_section_test.cc: New file.
5589         * testsuite/gc_orphan_section_test.sh: New file.
5590
5591 2010-01-06  Ian Lance Taylor  <[email protected]>
5592
5593         PR 10980
5594         * options.h (class General_options): Add --warn-shared-textrel.
5595         * layout.cc (Layout::finish_dynamic_section): Implement
5596         --warn-shared-textrel.
5597
5598         PR 10980
5599         * options.h (class General_options): Add --warn-multiple-gp.
5600
5601 2010-01-06  Viktor Kutuzov  <[email protected]>
5602
5603         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5604         $(THREADSLIB) and $(LIBDL).
5605         * Makefile.in: Rebuild.
5606
5607 2010-01-06  Ian Lance Taylor  <[email protected]>
5608
5609         PR 10980
5610         * options.cc (General_options::parse_section_start): New function.
5611         (General_options::section_start): New function.
5612         (General_options::General_options): Initialize all members.
5613         * options.h: Include <map>
5614         (class General_options): Add --section-start.  Add section_starts_
5615         member.
5616         * layout.cc (Layout::attach_allocated_section_to_segment): If
5617         --section-start was used, set the address of the segment.  Remove
5618         local sort_sections.
5619         (Layout::relaxation_loop_body): If the address of the load segment
5620         has been set by --section-start, don't use it.
5621         * output.h (Output_segment::update_flags_for_output_section): New
5622         function.
5623         * output.cc (Output_segment::add_output_section): Call
5624         update_flags_for_output_section.
5625
5626 2010-01-05  Ian Lance Taylor  <[email protected]>
5627
5628         PR 10980
5629         * options.h (class General_options): Add --undefined-version.
5630         * script.cc (struct Version_expression): Add was_matched_by_symbol
5631         field.
5632         (Version_script_info::matched_symbol): New function.
5633         (Version_script_info::get_symbol_version_helper): Call
5634         matched_symbol.
5635         (Version_script_info::check_unmatched_names): New function.
5636         * script.h (class Version_script_info): Update declarations.
5637         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5638
5639         * options.h (class General_options): Use DEFINE_bool_alias for
5640         allow_multiple_definition.
5641         * resolve.cc (Symbol_table::should_override): Don't test
5642         allow_multiple_definition.
5643
5644         PR 10980
5645         * options.h (class General_options): Add --cref.
5646         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5647         until after printing cref table.
5648         * cref.cc: Include "symtab.h".
5649         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5650         (Cref_table_compare::operator()): New function.
5651         (Cref_inputs::gather_cref): New function.
5652         (filecol): New static const.
5653         (Cref_inputs::print_cref): New function.
5654         (Cref::print_cref): New function.
5655         * cref.h: Include <cstdio>.
5656         (class Cref): Update declarations.
5657         * mapfile.h (Mapfile::file): New function.
5658         * object.h (class Object): Define Symbols.  Declare virtual
5659         do_get_global_symbols.
5660         (Object::get_global_symbols): New function.
5661         * object.cc (Input_objects::add_object): Pass object to cref_ if
5662         --cref.
5663         (Input_objects::archive_start): Likewise.
5664         (Input_objects::archive_stop): Likewise.
5665         (Input_objects::print_cref): New function.
5666         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5667         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5668         --cref.
5669         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5670         function.
5671         * plugin.h (class Sized_pluginobj): Update declarations.
5672
5673 2010-01-05  Ian Lance Taylor  <[email protected]>
5674
5675         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5676         to is_default_version.  Rename insdef to insdefault.
5677         (Symbol_table::add_from_relobj): Rename def to is_default_version
5678         and local to is_forced_local.
5679         (Symbol_table::add_from_pluginobj): Likewise.
5680         (Symbol_table::add_from_dynobj): Likewise.
5681         (Symbol_table::define_special_symbol): Rename insdef to
5682         insdefault.
5683
5684 2010-01-04  Ian Lance Taylor  <[email protected]>
5685
5686         PR 10980
5687         * options.h (class General_options): Add
5688         --allow-multiple-definition and -z muldefs.
5689         * resolve.cc (Symbol_table::should_override): Don't warn about a
5690         multiple symbol definition if --allow-multiple-definition or -z
5691         muldefs.
5692
5693         PR 10980
5694         * options.h (class General_options): Add --add-needed and
5695         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5696         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5697         error if --copy-dt-needed-entries aka --add-needed is used and
5698         would cause a change in behaviour.
5699
5700         PR 10980
5701         * options.h (class General_options): Add -G as a short version of
5702         --shared.  Add no-op options -assert, -g, and -i.
5703
5704 2010-01-04  Sriraman Tallam  <[email protected]>
5705
5706         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5707         check for .text or .gnu.linkonce.t sections.
5708         * icf.cc (Icf::find_identical_sections): Ditto.
5709         Change the detection for mangled function name within the section
5710         name.
5711         * icf.h (is_section_foldable_candidate): New function.
5712
5713 2009-12-30  Ian Lance Taylor  <[email protected]>
5714
5715         PR 10980
5716         * options.h (class General_options): Permit two dashes with
5717         --retain-symbols-file.
5718
5719 2009-12-30  Ian Lance Taylor  <[email protected]>
5720
5721         PR 10979
5722         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5723         don't put the file header and segment headers in the text
5724         segment.
5725
5726         PR 10979
5727         * common.cc (Sort_commons::operator()): Stabilize sort when both
5728         entries are NULL.
5729         (Symbol_table::do_allocate_commons_list): When allocating common
5730         symbols, skip a symbol which is no longer common.
5731         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5732         an object before checking its type.
5733         * testsuite/common_test_2.c: New file.
5734         * testsuite/common_test_3.c: New file.
5735         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5736         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5737         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5738         (common_test_2_pic.o, common_test_2.so): New targets.
5739         (common_test_3_pic.o, common_test_3.so): New targets.
5740         * testsuite/Makefile.in: Rebuild.
5741
5742         PR 10979
5743         * script.cc (read_input_script): If we see a new SECTIONS clause,
5744         and we have added an input section, give an error.
5745         * layout.h (class Layout): Add have_added_input_section function.
5746         Add have_added_input_section_ field.
5747         * layout.cc (Layout::Layout): Initialize
5748         have_added_input_section_.
5749         (Layout::layout): Set have_added_input_section_.
5750         (Layout::layout_eh_frame): Likewise.
5751
5752 2009-12-30  Ian Lance Taylor  <[email protected]>
5753
5754         PR 10931
5755         * options.h (class General_options): Add --sort-common option.
5756         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5757         * common.cc (Sort_common): Add sort_order parameter to
5758         constructor.  Add sort_order_ field.
5759         (Sort_commons::operator): Check sort_order_.
5760         (Symbol_table::allocate_commons): Determine the sort order.
5761         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5762         Change all callers.
5763         (Symbol_table::do_allocate_commons_list): Likewise.
5764
5765 2009-12-30  Ian Lance Taylor  <[email protected]>
5766
5767         PR 10916
5768         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5769         symbols from this object, don't change the visibility of an
5770         undefined symbol.
5771         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5772
5773 2009-12-30  Ian Lance Taylor  <[email protected]>
5774
5775         PR 10861
5776         * script.h (class Version_script_info): Define Language enum.
5777         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5778         new fields globals_, locals_, and is_finalized_.
5779         * script.cc: Various formatting fixes.
5780         (class Parser_closure): Change language_stack_ from a vector of
5781         std::string to one of Version_script_info::Language.  Adjust all
5782         uses accordingly.
5783         (class Lazy_demangler): Remove.
5784         (struct Version_expression): Change language from std::string to
5785         Version_script_info::Language.
5786         (Version_script_info::Version_script_info): New function.
5787         (Version_script_info::~Version_script_info): Don't call clear.
5788         (Version_script_info::finalize): New function.
5789         (Version_script_info::build_lookup_tables): New function.
5790         (Version_script_info::build_expression_list_lookup): New
5791         function.
5792         (Version_script_info::get_symbol_version_helper): Rewrite to use
5793         lookup tables.
5794         (Version_script_info::print_expression_list): Adjust to use
5795         Version_script_info::Language.
5796         (script_push_lex_into_version_mode): Check that the version script
5797         has not been finalized.
5798         (version_script_push_lang): Change language string to
5799         Version_script_info::Language.
5800         * options.cc (Command_line::version_script): New function.
5801         * options.h (class General_options): Add finalize_dynamic_list
5802         function.  Change version_script from declaration to definition.
5803         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5804         * testsuite/version_script.map: Remove duplicate def of foo.
5805         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5806         version_script.map.
5807         * testsuite/Makefile.in: Rebuild.
5808
5809 2009-12-30  Ian Lance Taylor  <[email protected]>
5810
5811         PR 10843
5812         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5813         if the input symbol index is 0, make the output symbol index 0.
5814
5815 2009-12-30  Ian Lance Taylor  <[email protected]>
5816
5817         PR 10670
5818         * options.h (class General_options): Add -x/--discard-all.
5819         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5820         --discard-all.  If the local symbol needs a dynamic entry, check
5821         that before handling --discard-locals.
5822
5823 2009-12-30  Ian Lance Taylor  <[email protected]>
5824
5825         PR 10450
5826         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5827         flags to PF_R.
5828         (Output_segment::add_output_section): Don't change the flags if
5829         the type is PT_TLS.
5830
5831         PR 10450
5832         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5833         GNU hash table if they need a dynamic value.  Otherwise, don't add
5834         them if they are defined in a dynamic object or are forced local.
5835
5836 2009-12-29  Ian Lance Taylor  <[email protected]>
5837
5838         PR 10450
5839         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5840         .gnu.hash table for a 32-bit target.
5841
5842         PR 10450
5843         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5844         regular and a dynamic object only needs a dynamic symbol table
5845         entry if it is externally visible.
5846
5847         PR 10450
5848         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5849         constructor.  Add global_offset_table_ field.
5850         (Target_i386::got_section): Set global_offset_table_.
5851         (Target_i386::do_finalize_sections): Set global_offset_table_
5852         size.
5853         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5854         in constructor.  Add global_offset_table_ field.
5855         (Target_x86_64::got_section): Set global_offset_table_.
5856         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5857         size.
5858
5859         * layout.cc (Layout::Layout): Initialize increase_relro_.
5860         (Layout::get_output_section): Add is_relro, is_last_relro, and
5861         is_first_non_relro parameters.  Change all callers.
5862         (Layout::choose_output_section): Likewise.
5863         (Layout::add_output_section_data): Likewise.
5864         (Layout::make_output_section): Likewise.
5865         (Layout::set_segment_offsets): Clear increase_relro when using a
5866         linker script.
5867         * layout.h (class Layout): Add increase_relro method.  Add
5868         increase_relro_ field.  Update declarations.
5869         * output.cc (Output_section::Output_section): Initialize
5870         is_last_relro_ and is_first_non_relro_.
5871         (Output_segment::add_output_section): Group relro sections is
5872         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5873         (Output_segment::maximum_alignment): Remove relro handling.
5874         (Output_segment::set_section_addresses): Add increase_relro
5875         parameter.  Change all callers.  Add initial alignment to align
5876         relro sections on separate page.  Remove old relro handling.
5877         (Output_segment::set_section_list_addresses): Remove in_relro
5878         parameter.  Change all callers.
5879         (Output_segment::set_offset): Add increase parameter.  Change all
5880         callers.  Remove old relro handling.
5881         * output.h (class Output_section): Add new methods: is_last_relro,
5882         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5883         Add is_last_relro_ and is_first_non_relro_ fields.
5884         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5885         Create separate .got.plt section.  Call increase_relro.
5886         * x86_64.cc (Target_x86_64::got_section): Likewise.
5887         * testsuite/relro_script_test.t: Add .got.plt.
5888
5889         PR 10450
5890         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5891         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5892         (Layout::finalize): Call set_dynamic_symbol_size.
5893         (Layout::set_dynamic_symbol_size): New function.
5894         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5895         set_dynamic_symbol_size.
5896
5897         PR 10450
5898         * output.h (class Output_section): Add is_entsize_zero_ field.
5899         * output.cc (Output_section::Output_section): Initialize
5900         is_entsize_zero_.
5901         (Output_section::set_entsize): If two different entsizes are
5902         requested, force it to zero.
5903         (Output_section::add_input_section): Set flags for .debug_str
5904         before updating section flags.  Set entsize.
5905         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5906         and SHF_STRING if all input sections have those flags.
5907
5908 2009-12-29   Rafael Espindola  <[email protected]>
5909
5910         * main.cc (main): Fix the sys time reporting.
5911         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5912         reporting.
5913
5914 2009-12-29  Sriraman Tallam  <[email protected]>
5915
5916         * options.cc (General_options::parse_version): Allow -v to exit
5917         without an error if there is nothing to link.
5918
5919 2009-12-29  Ian Lance Taylor  <[email protected]>
5920
5921         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5922         using a version of gcc before 4.1.
5923         * configure: Rebuild.
5924
5925 2009-12-28  Chris Demetriou  <[email protected]>
5926
5927         * attributes.cc (Output_attributes_section_data::do_write): Use
5928         std::vector::front rather than std::vector::data.
5929
5930 2009-12-28  Ian Lance Taylor  <[email protected]>
5931
5932         * symtab.h (class Symbol_table): Add enum Defined.
5933         * resolve.cc (Symbol_table::should_override): Add defined
5934         parameter.  Change all callers.  Test whether object is NULL
5935         before calling a method on it.
5936         (Symbol_table::report_resolve_problem): Add defined parameter.
5937         Change all callers.
5938         (Symbol_table::should_override_with_special): Likewise.
5939         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5940         parameter.  Change all callers.
5941         (Symbol_table::do_define_in_output_data): Likewise.
5942         (Symbol_table::define_in_output_segment): Likewise.
5943         (Symbol_table::do_define_in_output_segment): Likewise.
5944         (Symbol_table::define_as_constant): Likewise.
5945         (Symbol_table::do_define_as_constant): Likewise.
5946         * script.h (class Symbol_assignment): Add is_defsym parameter to
5947         constructor; change all callers.
5948         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5949         parameter.  Change all callers.  Add is_defsym_ field.
5950         (class Parser_closure): Add parsing_defsym parameter to
5951         constructor; change all callers.  Add parsing_defsym accessor
5952         function.  Add parsing_defsym_ field.
5953
5954 2009-12-28  Ian Lance Taylor  <[email protected]>
5955
5956         * gold.cc (queue_middle_tasks): Fix formatting.
5957         * object.cc (Relobj::is_section_name_included): Likewise.
5958
5959 2009-12-23  Ian Lance Taylor  <[email protected]>
5960
5961         * i386.cc (Target_i386::do_calls_non_split): Recognize
5962         -fsplit-stack prologue for a function with a static chain.
5963         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5964         -fsplit-stack prologue when using %r11.
5965
5966 2009-12-21  Sriraman Tallam  <[email protected]>
5967
5968         * options.cc (General_options::parse_version): Make -v continue and do
5969         the link like GNU ld does.
5970
5971 2009-12-17  Rafael Avila de Espindola  <[email protected]>
5972
5973         * Makefile.am (CCFILES): Add timer.cc.
5974         (HFILES): Add timer.h.
5975         * configure.ac: Check for sysconf and times.
5976         * main.cc: include timer.h.
5977         (main): Use Timer instead of get_run_time.
5978         * timer.cc: New.
5979         * timer.h: New.
5980         * workqueue.cc: include timer.h.
5981         (Workqueue::find_and_run_task):
5982         Report user, sys and wall time.
5983         * Makefile.in: Regenerate.
5984         * config.in: Regenerate.
5985         * configure: Regenerate.
5986
5987 2009-12-16  Doug Kwan  <[email protected]>
5988
5989         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5990         sections.
5991         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5992         relaxed input sections.
5993         * output.cc (Output_section::find_relaxed_input_section): Change
5994         return type to Output_relaxed_input_section pointer.  Adjust code
5995         for new type of relaxed_input_section_map_.
5996         * output.h (Output_section::find_relaxed_input_section): Change
5997         return type to Output_relaxed_input_section pointer.
5998         (Output_section::Output_relaxed_input_section_by_input_section_map):
5999         New type.
6000         (Output_section::relaxed_input_section_map_): Change type to
6001         Output_section::Output_relaxed_input_section_by_input_section_map.
6002         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6003         input section.
6004
6005 2009-12-15  Ian Lance Taylor  <[email protected]>
6006
6007         * layout.cc (Layout::create_shstrtab): Only write out after input
6008         sections if we are compressing debug sections.
6009
6010 2009-12-15  Ian Lance Taylor  <[email protected]>
6011
6012         * archive.cc (Archive::add_symbols): Only look up a symbol without
6013         a version if there is, in fact, a version.
6014
6015 2009-12-14  Ian Lance Taylor  <[email protected]>
6016
6017         Revert -Wshadow changes, all changes from:
6018         2009-12-11  Doug Kwan  <[email protected]>
6019         2009-12-11  Nick Clifton  <[email protected]>
6020         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6021
6022 2009-12-11  Doug Kwan  <[email protected]>
6023
6024         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6025         due to -Wshadow.
6026         * attributes.cc (Object_attribute::size): Ditto.
6027         (Attributes_section_data::size): Ditto.
6028         (Attributes_section_data::Attributes_section_data): Ditto.
6029         (Output_attributes_section_data::do_write): Ditto.
6030         * attributes.h (Object_attribute::set_type): Ditto.
6031         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6032
6033 2009-12-11  Nick Clifton  <[email protected]>
6034
6035         * archive.cc: Fix shadowed variable warnings.
6036         * arm.cc: Likewise.
6037         * compressed_output.cc: Likewise.
6038         * compressed_output.h: Likewise.
6039         * configure: Likewise.
6040         * dwarf_reader.cc: Likewise.
6041         * dynobj.cc: Likewise.
6042         * dynobj.h: Likewise.
6043         * ehframe.cc: Likewise.
6044         * ehframe.h: Likewise.
6045         * errors.cc: Likewise.
6046         * expression.cc: Likewise.
6047         * fileread.cc: Likewise.
6048         * fileread.h: Likewise.
6049         * freebsd.h: Likewise.
6050         * i386.cc: Likewise.
6051         * icf.cc: Likewise.
6052         * incremental.h: Likewise.
6053         * layout.cc: Likewise.
6054         * layout.h: Likewise.
6055         * mapfile.cc: Likewise.
6056         * merge.cc: Likewise.
6057         * merge.h: Likewise.
6058         * object.cc: Likewise.
6059         * object.h: Likewise.
6060         * options.h: Likewise.
6061         * output.cc: Likewise.
6062         * output.h: Likewise.
6063         * parameters.cc: Likewise.
6064         * plugin.cc: Likewise.
6065         * powerpc.cc: Likewise.
6066         * reduced_debug_output.cc: Likewise.
6067         * reduced_debug_output.h: Likewise.
6068         * reloc.cc: Likewise.
6069         * reloc.h: Likewise.
6070         * resolve.cc: Likewise.
6071         * script-sections.cc: Likewise.
6072         * script.cc: Likewise.
6073         * script.h: Likewise.
6074         * sparc.cc: Likewise.
6075         * symtab.cc: Likewise.
6076         * symtab.h: Likewise.
6077         * target-select.cc: Likewise.
6078         * target-select.h: Likewise.
6079         * token.h: Likewise.
6080         * workqueue.cc: Likewise.
6081         * workqueue.h: Likewise.
6082         * x86_64.cc: Likewise.
6083
6084 2009-12-10  Doug Kwan  <[email protected]>
6085
6086         * arm.cc (attributes.h): New include.
6087         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6088         (Arm_relobj::~Arm_relobj): Delete object pointed by
6089         attributes_section_data_.
6090         (Arm_relobj::attributes_section_data): New method definition.
6091         (Arm_relobj::attributes_section_data_): New data member declaration.
6092         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6093         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6094         attributes_section_data_.
6095         (Arm_dynobj::attributes_section_data): New method definition.
6096         (Arm_dynobj::attributes_section_data_): New data member declaration.
6097         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6098         initialization value of may_use_blx_ to false.
6099         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6100         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6101         object attributes to compute results instead of hard-coding.
6102         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6103         Target_arm::get_secondary_compatible_arch,
6104         Target_arm::set_secondary_compatible_arch
6105         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6106         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6107         New method declarations.
6108         (Target_arm::get_aeabi_object_attribute): New method definition.
6109         (Target_arm::attributes_section_data_): New data member declaration.
6110         (read_arm_attributes_section): New template definition.
6111         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6112         (Arm_dynobj::do_read_symbols): Ditto.
6113         (Target_arm::do_finalize_sections): Merge attributes sections from
6114         input.  Check for BLX use after attributes section merging.
6115         Fix __exidx_start and __exidx_end visibility.  Create an
6116         .ARM.attributes section if necessary.
6117         (Target_arm::get_secondary_compatible_arch,
6118         Target_arm::set_secondary_compatible_arch,
6119         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6120         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6121         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6122         New method definitions.
6123
6124 2009-12-09  Ian Lance Taylor  <[email protected]>
6125
6126         * plugin.cc (Plugin::load): Don't cast from void* to a function
6127         pointer.
6128
6129 2009-12-09  Ian Lance Taylor  <[email protected]>
6130
6131         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6132         information fields.
6133
6134 2009-12-09  H.J. Lu  <[email protected]>
6135
6136         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6137         Replace two_file_shared_1.so with two_file_shared_2.so.
6138         * testsuite/Makefile.in: Regenerated.
6139
6140 2009-12-08  Doug Kwan  <[email protected]>
6141
6142         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6143         (HFILES): Add attributes.h and int_encoding.h.
6144         * Makefile.in: Regenerate.
6145         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6146         function definitions to int_encoding.cc
6147         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6148         prototypes to int_encoding.h
6149         * reduced_debug_output.cc (int_encoding.h): New include.
6150         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6151         function definitions to int_encoding.cc
6152         (insert_into_vector, read_from_pointer): Move template definitions to
6153         int_encoding.h
6154         * attributes.cc: New file.
6155         * attributes.h: New file.
6156         * int_encoding.cc: New file.
6157         * int_encoding.h: New file.
6158
6159 2009-12-07  Rafael Avila de Espindola  <[email protected]>
6160
6161         PR gold/11055
6162         * incremental-dump.cc (dump_incremental_inputs): New.
6163         (main): Use dump_incremental_inputs.
6164
6165 2009-12-07  H.J. Lu  <[email protected]>
6166
6167         PR gold/10893
6168         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6169         checking elfcpp::STT_FUNC.
6170         (Target_i386::Relocate::relocate): Likewise.
6171         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6172
6173         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6174         symbols from shared libraries into normal FUNC symbols.
6175
6176         * symtab.h (Symbol): Add is_func and use it.
6177
6178 2009-12-05  Doug Kwan  <[email protected]>
6179
6180         * arm.cc (Target_arm::arm_info): Initialize new fields
6181         attributes_section and attributes_vendor.
6182         * i386.cc (Target_i386::i386_info): Same.
6183         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6184         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6185         fields attributes_section and attributes_vendor.
6186         * sparc.cc (Target_sparc::sparc_info): Same.
6187         * target.h (Target::attributes_section, Target::attributes_vendor,
6188         Target::is_attributes_section, Target::attribute_arg_type,
6189         Target::attributes_order): New method definitions.
6190         (Target::Target_info::attributes_section,
6191         Target::Target_info::attributes_vendor): New fields.
6192         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6193         virtual method definitions.
6194         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6195         attributes_section and attributes_vendor.
6196         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6197
6198 2009-12-05  Doug Kwan  <[email protected]>
6199
6200         * arm.cc: Update comments about interworking and stub generation.
6201         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6202         considered as non-PIC.
6203         (Arm_relocate_functions::base_abs): Fix formatting.
6204         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6205         of function to use GOT entry address instead of offset.
6206         (Target_arm::Scan::global): Issue an error if a symbol would need a
6207         PLT does not get one because it is untyped.  Remove code to create
6208         dynamic symbols for relative branches.
6209         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6210         takes unsigned integer instead of boolean.
6211
6212 2009-12-05  H.J. Lu  <[email protected]>
6213
6214         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6215         (two_file_test_LDADD): Likewise.
6216         (common_test_1_LDADD): Likewise.
6217         (exception_test_LDADD) Likewise.
6218         (weak_test_LDADD): Likewise.
6219         (many_sections_test_LDADD): Likewise.
6220         (initpri1_LDADD): Likewise.
6221         (script_test_1_LDADD): Likewise.
6222         (script_test_2_LDADD): Likewise.
6223         (justsyms_LDADD): Likewise.
6224         (binary_test_LDADD): Likewise.
6225         (large_LDADD): Likewise.
6226         * testsuite/Makefile.in: Regenerated.
6227
6228 2009-12-04  H.J. Lu  <[email protected]>
6229
6230         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6231         (Symbol_table::override_with_special): Likewise.
6232         (Symbol_table::add_from_object): Likewise.
6233
6234 2009-12-04  Rafael Avila de Espindola  <[email protected]>
6235
6236         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6237         Don't set the data_offset twice.
6238
6239 2009-12-04  Rafael Avila de Espindola  <[email protected]>
6240
6241         * testsuite/Makefile.in: Regenerate.
6242
6243 2009-12-03  Doug Kwan  <[email protected]>
6244
6245         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6246         (Target_arm::do_finalize_sections): Add parameter for symbol table
6247         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6248         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6249         parameter for symbol table pointer.
6250         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6251         an additional parameter for a pointer to symbol table.
6252         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6253         parameter for a symbol table pointer.
6254         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6255         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6256         Ditto.
6257         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6258         parameter for a symbol table pointer.
6259
6260 2009-12-03  Rafael Avila de Espindola  <[email protected]>
6261
6262         * incremental.cc (Incremental_inputs_header)
6263         (Incremental_inputs_header_write, Incremental_inputs_entry)
6264         (Incremental_inputs_entry_write): Move ...
6265         * incremental.h (Incremental_inputs_header)
6266         (Incremental_inputs_header_write, Incremental_inputs_entry)
6267         (Incremental_inputs_entry_write): here.
6268
6269 2009-12-02  Rafael Avila de Espindola  <[email protected]>
6270
6271         * incremental.cc (make_sized_incremental_binary): Set the target.
6272         Error if it is incompatible.
6273         * output.h (Output_file): Add filename method.
6274
6275 2009-12-02  Rafael Avila de Espindola  <[email protected]>
6276
6277         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6278         from the get_* methods.
6279
6280 2009-12-02  Rafael Avila de Espindola  <[email protected]>
6281
6282         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6283         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6284         Write 0 for the data_offset of scripts.
6285
6286 2009-12-02  Rafael Avila de Espindola  <[email protected]>
6287
6288         * testsuite/Makefile.am: Add the incremental_test.sh test.
6289         * testsuite/incremental_test.sh: New.
6290         * testsuite/incremental_test_1.c: New.
6291         * testsuite/incremental_test_2.c: New.
6292
6293 2009-12-01  Rafael Avila de Espindola  <[email protected]>
6294
6295        * incremental-dump.cc (main): Fix typos.
6296
6297 2009-11-27  Rafael Avila de Espindola  <[email protected]>
6298
6299         PR gold/11025
6300         * incremental-dump.cc (main): Use llu to print 64 bit values.
6301
6302 2009-11-26  Per Øyvind Karlsen <[email protected]>
6303             H.J. Lu  <[email protected]>
6304
6305         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6306         $(LIBDL).
6307         (incremental_dump_LDADD): Likewise.
6308         * Makefile.in: Regenerated.
6309
6310 2009-11-25  Doug Kwan  <[email protected]>
6311
6312         Revert:
6313
6314         2009-11-25  Doug Kwan  <[email protected]>
6315
6316                 * arm.cc (Target_arm::Target_arm): Move method definition
6317                 outside of class definition.  Add code to handle
6318                 --target1-rel, --target1-abs and --target2= options.
6319                 (Target_arm::get_reloc_reloc_type): Change method to be
6320                 non-static and const.
6321                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6322                 New data member declaration.
6323                 (Target_arm::Scan::local, Target_arm::Scan::global,
6324                 Target_arm::Relocate::relocate,
6325                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6326                 Adjust call to Target_arm::get_real_reloc_type.
6327                 (Target_arm::get_real_reloc_type): Use command line options
6328                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6329                 * options.h (--target1-rel, --target1-abs, --target2): New
6330                 ARM-only options.
6331
6332 2009-11-25  Doug Kwan  <[email protected]>
6333
6334         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6335         class definition.  Add code to handle --target1-rel, --target1-abs
6336         and --target2= options.
6337         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6338         and const.
6339         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6340         member declaration.
6341         (Target_arm::Scan::local, Target_arm::Scan::global,
6342         Target_arm::Relocate::relocate,
6343         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6344         call to Target_arm::get_real_reloc_type.
6345         (Target_arm::get_real_reloc_type): Use command line options to
6346         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6347         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6348         options.
6349
6350 2009-11-25  Doug Kwan  <[email protected]>
6351
6352         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6353         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6354         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6355         formatting.
6356         (Arm_relocate_functions::thm_call): Replace body with a call to
6357         Arm_relocate_functions::thumb_branch_common.
6358         (Arm_relocate_functions::thm_jump24,
6359         Arm_relocate_functions::thm_xpc22): New method definitions.
6360         (Arm_relocate_functions::thumb_branch_common): New method definition.
6361         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6362         operator.
6363         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6364         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6365
6366 2009-11-24  Rafael Avila de Espindola  <[email protected]>
6367
6368         * Makefile.am: Build incremental-dump
6369         * Makefile.in: Regenerate.
6370         * incremental-dump.cc: New.
6371         * incremental.cc (Incremental_inputs_header_data,
6372         Incremental_inputs_entry_data): Move to incremental.h
6373         * incremental.h: (Incremental_inputs_header_data,
6374         Incremental_inputs_entry_data): Move from incremental.cc
6375
6376 2009-11-24  Rafael Avila de Espindola  <[email protected]>
6377
6378         * incremental.cc (Incremental_inputs_header,
6379         Incremental_inputs_header_write, Incremental_inputs_entry,
6380         Incremental_inputs_entry_write): Add a typedef with the data type.
6381
6382 2009-11-24  Rafael Avila de Espindola  <[email protected]>
6383
6384         * incremental.cc (Incremental_inputs_header,
6385         Incremental_inputs_header_write, Incremental_inputs_entry,
6386         Incremental_inputs_entry_write): Update comment about which
6387         type has the filed descriptions.
6388
6389 2009-11-15  Doug Kwan  <[email protected]>
6390
6391         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6392         (Arm_relocate_functions::arm_branch_common): Change method defintion
6393         in class definition to a method declaration and update list of formal
6394         parameters.
6395         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6396         Arm_relocation_functions::jump24): Adjust call to
6397         Arm_relocate_functions::arm_branch_common.  Update list of formal
6398         parameters.
6399         (Arm_relocate_functions::xpc25): New method definition.
6400         (Arm_relocate_functions::arm_branch_common): Move method defintion
6401         out from class definition.  Use stubs for mode-switching and extending
6402         branch ranges.
6403         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6404         specially.  Change code to enable use of stubs in ARM branches.
6405
6406 2009-11-10  Doug Kwan  <[email protected]>
6407
6408         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6409         in method declaration.
6410         (Target_arm::relocate_stub): New method declaration.
6411         (Target_arm::default_target): Change to return a pointer instead of
6412         a const reference.
6413         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6414         Target_arm::default_target.
6415         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6416         method definition.
6417         (Target_arm::relocate_section): Adjust view.
6418         (Target_arm::relocate_stub): New method definition.
6419
6420 2009-11-10  Doug Kwan  <[email protected]>
6421
6422         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6423         a format warning.
6424         * incremental.cc (open_incremental_binary): Initialized local
6425         variables to avoid warnings.
6426         * object.cc (make_elf_object): Ditto.
6427         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6428         a format warning.
6429
6430 009-11-09  H.J. Lu  <[email protected]>
6431
6432         PR gold/10930
6433         * testsuite/plugin_test.c: Include "config.h".
6434
6435 2009-11-09  Doug Kwan  <[email protected]>
6436
6437         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6438         (arm_symbol_value): Remove.
6439         (Arm_relocate_functions::arm_branch_common,
6440         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6441         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6442         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6443         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6444         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6445         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6446         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6447         Arm_relocate_functions::thm_mobw_abs_nc,
6448         Arm_relocate_functions::thm_mov_abs,
6449         Arm_relocate_functions::movw_prel_nc,
6450         Arm_relocate_functions::thm_movt_abs,
6451         Arm_relocate_functions::movt_prel,
6452         Arm_relocate_functions::thm_movw_prel_nc,
6453         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6454         (Target_arm::Relocate::relocate): Only decompose address into two
6455         parts if relocation type uses the thumb-bit and pass the actual
6456         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6457         calls to methods in Arm_relocate_functions for this change.
6458
6459 2009-11-08  Ian Lance Taylor  <[email protected]>
6460
6461         PR 10925
6462         * reloc.cc: Instantiate
6463         Sized_relobj::initialize_input_to_output_maps and
6464         Sized_relobj:free_input_to_output_maps.
6465
6466 2009-11-06  Ian Lance Taylor  <[email protected]>
6467
6468         PR 10876
6469         * defstd.cc (in_segment): Set only_if_ref true for "end".
6470
6471 2009-11-06  Doug Kwan  <[email protected]>
6472
6473         * arm.cc (class Reloc_stub): Correct a comment.
6474         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6475         (Target_arm::scan_section_for_stubs): New method declaration.
6476         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6477         Change methods from private to protected.
6478         (Target_arm::do_may_relax): New method definition.
6479         (Target_arm::do_relax, Target_arm::group_sections,
6480         Target_arm::scan_reloc_for_stub,
6481         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6482         (Target_arm::arm_input_section_map_): New data member declaration.
6483         (Target_arm::scan_reloc_for_stub,
6484         Target_arm::scan_reloc_section_for_stubs,
6485         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6486         Target_arm::do_relax): New method definitions.
6487
6488 2009-11-06  Mikolaj Zalewski  <[email protected]>
6489
6490         * configure.ac: Check for (struct stat)::st_mtim
6491         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6492         * config.in: Regenerate.
6493         * configure: Regenerate.
6494
6495 2009-11-05  Ian Lance Taylor  <[email protected]>
6496
6497         PR 10910
6498         * output.cc (Output_segment::add_output_section): Add missing
6499         return statement.
6500
6501 2009-11-04  Ian Lance Taylor  <[email protected]>
6502
6503         PR 10880
6504         * object.h (class Object): Add is_needed and set_is_needed
6505         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6506         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6507         defined in a dynamic object and referenced by a regular object,
6508         set is_needed for the dynamic object.
6509         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6510         if the file is marked with as_needed and it is not needed.
6511
6512 2009-11-04  Ian Lance Taylor  <[email protected]>
6513
6514         PR 10887
6515         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6516         tags if data is discarded by linker script.
6517         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6518         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6519         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6520         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6521
6522 2009-11-04  Ian Lance Taylor  <[email protected]>
6523
6524         * layout.cc (Layout::get_output_section): Add is_interp and
6525         is_dynamic_linker_section parameters.  Change all callers.
6526         (Layout::choose_output_section): Likewise.
6527         (Layout::make_output_section): Likewise.
6528         (Layout::add_output_section_data): Add is_dynamic_linker_section
6529         parameter.  Change all callers.
6530         * layout.h (class Layout): Update declarations.
6531         * output.h (class Output_section): Add is_interp, set_is_interp,
6532         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6533         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6534         generate_code_fills_at_write_ to a bitfield.
6535         * output.cc (Output_section::Output_sections): Initialize new
6536         fields.
6537         (Output_segment::add_output_section): Add do_sort parameter.
6538         Change all callers.
6539
6540 2009-11-03  Ian Lance Taylor  <[email protected]>
6541
6542         PR 10860
6543         * options.h (class General_options): Add --warn-common.
6544         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6545         merging two common symbols.
6546         (Symbol_table::should_override): Handle --warn-common when merging
6547         a common symbol with a defined symbol.  Use report_resolve_problem
6548         for multiple definitions.
6549         (Symbol_table::report_resolve_problem): New function.
6550         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6551
6552 2009-11-03  Doug Kwan  <[email protected]>
6553
6554         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6555         stub_factory_.
6556         (Target_arm::stub_factory): New method definition.
6557         (Target_arm::new_arm_input_section,
6558         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6559         Target_arm::reloc_uses_thumb_bit): New method declarations.
6560         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6561         New type definitions.
6562         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6563         member declarations.
6564         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6565         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6566         New method definitions.
6567
6568 2009-11-03  Ian Lance Taylor  <[email protected]>
6569
6570         * options.h (class General_options): Add --warn_constructors.
6571
6572 2009-11-03  Ian Lance Taylor  <[email protected]>
6573
6574         PR 10893
6575         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6576         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6577
6578 2009-11-03  Ian Lance Taylor  <[email protected]>
6579
6580         PR 10895
6581         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6582         --msgid-bugs-address.
6583         (install-pdf): New target.
6584         (install-data_yes): Look up one directory to find mkinstalldirs.
6585
6586 2009-11-03  H.J. Lu  <[email protected]>
6587
6588         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6589         tree.
6590
6591 2009-10-30  Doug Kwan  <[email protected]>
6592
6593         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6594
6595 2009-10-30  Doug Kwan  <[email protected]>
6596
6597         * arm.cc (Stub_addend_reader): New struct template definition
6598         and partial specializations.
6599         (Stub_addend_reader::operator()): New method definition for a
6600         partially specialized template.
6601
6602 2009-10-30  Doug Kwan  <[email protected]>
6603
6604         * arm.cc (Arm_relobj::processor_specific_flags): New method
6605         definition.
6606         (Arm_relobj::do_read_symbols): New method declaration.
6607         (Arm_relobj::processor_specific_flags_): New data member declaration.
6608         (Arm_dynobj): New class definition.
6609         (Target_arm::do_finalize_sections): Add input_objects parameter.
6610         (Target_arm::do_adjust_elf_header): New method declaration.
6611         (Target_arm::are_eabi_versions_compatible,
6612         (Target_arm::merge_processor_specific_flags): New method declaration.
6613         (Target_arm::do_make_elf_object): New overloaded method definitions
6614         and declaration.
6615         (Arm_relobj::do_read_symbols): New method definition.
6616         (Arm_dynobj::do_read_symbols): Ditto.
6617         (Target_arm::do_finalize_sections): Add input_objects parameters.
6618         Merge processor-specific flags from all input objects.
6619         (Target_arm::are_eabi_versions_compatible,
6620         Target_arm::merge_processor_specific_flags,
6621         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6622         New method definitions.
6623         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6624         Input_objects pointer type parameter.
6625         * layout.cc (Layout::finalize): Pass input objects to target's.
6626         finalize_sections function.
6627         * output.cc (Output_file_header::do_sized_write): Set ELF file
6628         header's processor-specific flags.
6629         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6630         Input_objects pointer type parameter.
6631         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6632         * target.h (Input_objects): New forward class declaration.
6633         (Target::processor_specific_flags,
6634         Target::are_processor_specific_flags_sect): New method definitions.
6635         (Target::finalize_sections): Add input_objects parameter.
6636         (Target::Target): Initialize processor_specific_flags_ and
6637         are_processor_specific_flags_set_.
6638         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6639         parameter.
6640         (Target::set_processor_specific_flags): New method definition.
6641         (Target::processor_specific_flags_,
6642         Target::are_processor_specific_flags_set_): New data member
6643         declarations.
6644         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6645         Input_objects pointer type parameter.
6646
6647 2009-10-30  Doug Kwan  <[email protected]>
6648
6649         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6650
6651 2009-10-28  Ian Lance Taylor  <[email protected]>
6652
6653         * object.h (class Relobj): Drop options parameter from
6654         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6655         do_scan_relocs, do_relocate.  Change all callers.
6656         (class Sized_relobj): Drop options parameters from
6657         do_gc_process_relocs, do_scan_relocs, do_relocate,
6658         do_relocate_sections, relocate_sections, emit_relocs_scan,
6659         emit_relocs_scan_reltype.  Change all callers.
6660         (struct Relocate_info): Remove options field and all references to
6661         it.
6662         * reloc.h (class Read_relocs): Remove options constructor
6663         parameter and options_ field.  Change all callers.
6664         (class Gc_process_relocs, class Scan_relocs): Likewise.
6665         (class Relocate_task): Likewise.
6666         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6667         all callers.
6668         (scan_relocatable_relocs): Likewise.
6669         * target.h (class Sized_target): Remove options parameter from
6670         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6671         all callers.
6672         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6673         callers.
6674         * arm.cc: Update functions to remove options parameters.
6675         * i386.cc: Likewise.
6676         * powerpc.cc: Likewise.
6677         * sparc.cc: Likewise.
6678         * x86_64.cc: Likewise.
6679         * testsuite/testfile.cc: Likewise.
6680
6681 2009-10-28  Doug Kwan  <[email protected]>
6682
6683         * arm.cc (Arm_relobj): New class definition.
6684         (Arm_relobj::scan_sections_for_stubs,
6685         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6686         New method definitions.
6687
6688 2009-10-28  Cary Coutant  <[email protected]>
6689
6690         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6691         (Plugin::cleanup_done_): New member.
6692         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6693         (Plugin_manager::cleanup_done_): Remove.
6694         (Plugin_manager::add_input_file): Edit error message.
6695         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6696         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6697
6698 2009-10-27  Mikolaj Zalewski  <[email protected]>
6699
6700         * fileread.cc: (File_read::View::~View): Use the new
6701         data_ownership_ filed.
6702         (File_read::~File_read): Dispose the new whole_file_view_.
6703         (File_read::open): Mmap the whole file if needed.
6704         (File_read::open): Use whole_file_view_ instead of contents_.
6705         (File_read::find_view): Use whole_file_view_ if applicable.
6706         (File_read::do_read): Use whole_file_view_ instead of contents_.
6707         (File_read::make_view): Use whole_file_view_ instead of contents_,
6708         update File_read::View::View call.
6709         (File_read::find_or_make_view): Update File_read::View::View
6710         call.
6711         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6712         remove contents_
6713         (File_read::View::Data_ownership): New enum.
6714         (File_read::View::View): Replace bool mapped_ with Data_ownership
6715         argument.
6716         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6717         (File_read::View::data_ownership_): New field.
6718         (File_read::contents_): Remove (replaced by whole_file_view_).
6719         (File_read::whole_file_view_): New field.
6720         * options.h (class General_options): Add --keep-files-mapped.
6721
6722 2009-10-27  Cary Coutant  <[email protected]>
6723
6724         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6725         * testsuite/Makefile.am (plugin_test_5): New test case.
6726         * testsuite/Makefile.in: Regenerate.
6727
6728 2009-10-25  Doug Kwan  <[email protected]>
6729
6730         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6731         from private to protected to allow access by child class.
6732         (Sized_relobj::do_relocate_sections): New method declaration.
6733         (Sized_relobj::relocate_sections): Virtualize.
6734         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6735         Sized_relobj::relocate_sections.  Instantiate template explicitly
6736         for different target sizes and endianity.
6737
6738 2009-10-24  Doug Kwan  <[email protected]>
6739
6740         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6741         (Arm_input_section::as_arm_input_section): New method.
6742         (Arm_output_section): New class definition.
6743         (Arm_output_section::create_stub_group,
6744         Arm_output_section::group_sections): New method definitions.
6745
6746 2009-10-22  Doug Kwan  <[email protected]>
6747
6748         * arm.cc (Arm_input_section): New class definition.
6749         (Arm_input_section::init, Arm_input_section:do_write,
6750         Arm_input_section::set_final_data_size,
6751         Arm_input_section::do_reset_address_and_file_offset): New method
6752         definitions.
6753
6754 2009-10-21  Doug Kwan  <[email protected]>
6755
6756         * arm.cc (Stub_table, Arm_input_section): New forward class
6757         declarations.
6758         (Stub_table): New class defintion.
6759         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6760         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6761         New method definition.
6762
6763 2009-10-21  Doug Kwan  <[email protected]>
6764
6765         * arm.cc: Update copyright comments.
6766         (Target_arm): New forward class template declaration.
6767         (Arm_address): New type.
6768         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6769         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6770         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6771         constants.
6772         (Insn_template): Same.
6773         (DEF_STUBS): New macro.
6774         (Stub_type): New enum type.
6775         (Stub_template): New class definition.
6776         (Stub): Same.
6777         (Reloc_stub): Same.
6778         (Stub_factory): Same.
6779         (Target_arm::Target_arm): Initialize may_use_blx_ and
6780         should_force_pic_veneer_.
6781         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6782         Target_arm::should_force_pic_veneer,
6783         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6784         Target_arm::using_thumb_only, Target_arm:;default_target): New
6785         method defintions.
6786         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6787         New data member declarations.
6788         (Insn_template::size, Insn_template::alignment): New method defintions.
6789         (Stub_template::Stub_template): New method definition.
6790         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6791         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6792         (Stub_factory::Stub_factory): New method definition.
6793         * gold.h (string_hash): New template.
6794         * output.h (Input_section_specifier::hash_value): Use
6795         gold::string_hash.
6796         (Input_section_specifier::string_hash): Remove.
6797         * stringpool.cc (Stringpool_template::string_hash): Use
6798         gold::string_hash.
6799
6800 2009-10-20  Doug Kwan  <[email protected]>
6801
6802         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6803         symbols of relaxed input sections.
6804         * output.h (Output_section::find_relaxed_input_section): Make
6805         method public.
6806
6807 2009-10-16  Doug Kwan  <[email protected]>
6808
6809         * dynobj.cc (Versions::Versions): Initialize version_script_.
6810         Only insert base version symbol definition for a shared object
6811         if version script defines any version versions.
6812         (Versions::define_base_version): New method definition.
6813         (Versions::add_def): Check that base version is not needed.
6814         (Versions::add_need): Define base version lazily.
6815         * dynobj.h (Versions::define_base_version): New method declaration.
6816         (Versions::needs_base_version_): New data member declaration.
6817         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6818         (check_DATA): Add no_version_test.stdout.
6819         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6820         New make rules.
6821         * testsuite/Makefile.in: Regenerate.
6822         * testsuite/no_version_test.c: New file.
6823         * testsuite/no_version_test.sh: Ditto.
6824
6825 2009-10-16  Doug Kwan  <[email protected]>
6826
6827         * expression.cc (class Segment_start_expression): New class definition.
6828         (Segment_start_expression::value): New method definition.
6829         (script_exp_function_segment_start): Return a new
6830         Segment_start_expression.
6831         * gold/script-c.h (script_saw_segment_start_expression): New function
6832         prototype.
6833         * script-sections.cc (Script_sections::Script_sections): Initialize
6834         SAW_SEGMENT_START_EXPRESSION_ to false.
6835         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6836         and -Tbbs options to specify section addresses if given in
6837         command line and no SEGMENT_START expression is seen in a script.
6838         * script-sections.h (Script_sections::saw_segment_start_expression,
6839         Script_sections::set_saw_segment_start_expression): New method
6840         definition.
6841         (Script_sections::saw_segment_start_expression_): New data member
6842         declaration.
6843         * script.cc (script_saw_segment_start_expression): New function.
6844         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6845         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6846         script_test_7.sh and script_test_8.sh.
6847         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6848         script_test_8.stdout.
6849         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6850         (script_test_6, script_test_6.stdout, script_test_7,
6851         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6852         * Makefile.in: Regenerate.
6853         * testsuite/script_test_6.sh: New file.
6854         * testsuite/script_test_6.t: Same.
6855         * testsuite/script_test_7.sh: Same.
6856         * testsuite/script_test_7.t: Same.
6857         * testsuite/script_test_8.sh: Same.
6858
6859 2009-10-16  Doug Kwan  <[email protected]>
6860
6861         * output.cc (Output_segment::set_section_list_address): Cast
6862         expressions to unsigned long long type to avoid format warnings.
6863
6864 2009-10-15  Ian Lance Taylor  <[email protected]>
6865
6866         * script.cc (Script_options::add_symbol_assignment): Always add a
6867         dot assignment to script_sections_.
6868         * script-sections.cc (Script_sections::add_dot_assignment):
6869         Initialize if necessary.
6870
6871         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6872         program headers with no load segment if there is a linker script.
6873
6874         * layout.cc (Layout::set_segment_offsets): Align the file offset
6875         to the segment aligment for -N or -n with no load segment.
6876         * output.cc (Output_segment::add_output_section): Don't crash if
6877         the first section is a TLS section.
6878         (Output_segment::set_section_list_addresses): Print an error
6879         message if the address moves backward in a linker script.
6880         * script-sections.cc
6881         (Output_section_element_input::set_section_addresses): Don't
6882         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6883         (Orphan_output_section::set_section_addresses): Likewise.
6884
6885 2009-10-15  Doug Kwan  <[email protected]>
6886
6887         * layout.cc (Layout::finish_dynamic_section): Generate tags
6888         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6889         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6890         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6891
6892 2009-10-14  Ian Lance Taylor  <[email protected]>
6893
6894         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6895         fields.
6896         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6897         data_shdr fields of relinfo.
6898         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6899         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6900         R_386_TLS_LDO_32, adjust based on section flags.
6901         (Target_i386::Relocate::fix_up_ldo): Remove.
6902
6903 2009-10-13  Ian Lance Taylor  <[email protected]>
6904
6905         Add support for -pie.
6906         * options.h (class General_options): Add -pie and
6907         --pic-executable.
6908         (General_options::output_is_position_independent): Test -pie.
6909         (General_options::output_is_executable): Return true if not shared
6910         and not relocatable.
6911         (General_options::output_is_pie): Remove.
6912         * options.cc (General_options::finalize): Reject incompatible uses
6913         of -pie.
6914         * gold.cc (queue_middle_tasks): A -pie link is not static.
6915         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6916         * symtab.cc (Symbol::final_value_is_known): Return false if
6917         output_is_position_independent.
6918         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6919         output_is_position_independent.
6920         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6921         output_is_position_independent.
6922         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6923         output_is_position_independent.
6924         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6925         two_file_pie_test.
6926         (basic_pie_test.o, basic_pie_test): New targets.
6927         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6928         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6929         (two_file_pie_test): New target.
6930         * testsuite/Makefile.in: Rebuild.
6931         * README: Remove note saying that -pie is not supported.
6932
6933 2009-10-13  Bernhard Reutner-Fischer  <[email protected]>
6934
6935         * options.h (class General_options): Add -init and -fini.
6936         * layout.cc (Layout::finish_dynamic_section): Emit
6937         given init and fini functions.
6938
6939 2009-10-13  Sriraman Tallam  <[email protected]>
6940
6941         * gc.h (gc_process_relocs): Check if icf is enabled using new
6942         function.
6943         * gold.cc (queue_initial_tasks): Likewise.
6944         (queue_middle_tasks): Likewise.
6945         * object.cc (do_layout): Likewise.
6946         * symtab.cc (is_section_folded): Likewise.
6947         * main.cc (main): Likewise.
6948         * reloc.cc (Read_relocs::run): Likewise.
6949         (Sized_relobj::do_scan_relocs): Likewise.
6950         * icf.cc (is_function_ctor_or_dtor): New function.
6951         (Icf::find_identical_sections): Check if function is ctor or dtor when
6952         safe icf is chosen.
6953         * options.h (General_options::icf): Change option to be an enum.
6954         (Icf_status): New enum.
6955         (icf_enabled): New method.
6956         (icf_safe_folding): New method.
6957         (set_icf_status): New method.
6958         (icf_status_): New variable.
6959         * (options.cc) (General_options::finalize): Set icf_status_.
6960         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6961         icf_test and icf_keep_unique_test to use the --icf enum flag.
6962         * testsuite/icf_safe_test.sh: New file.
6963         * testsuite/icf_safe_test.cc: New file.
6964
6965 2009-10-12  Sriraman Tallam  <[email protected]>
6966
6967         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6968         includes to gc.h and icf.h.
6969         * arm.cc: Include gc.h.
6970         * gold.cc: Likewise.
6971         * i386.cc: Likewise.
6972         * powerpc.cc: Likewise.
6973         * sparc.cc: Likewise.
6974         * x86_64.cc: Likewise.
6975         * gc.h: Include icf.h.
6976
6977 2009-10-11  Ian Lance Taylor  <[email protected]>
6978
6979         * plugin.cc: Include "gold.h" before other header files.
6980
6981 2009-10-10  Chris Demetriou  <[email protected]>
6982
6983         * options.h (Input_file_argument::Input_file_type): New enum.
6984         (Input_file_argument::is_lib_): Replace with...
6985         (Input_file_argument::type_): New member.
6986         (Input_file_argument::Input_file_argument): Take Input_file_type
6987         'type' rather than boolean 'is_lib' as second argument.
6988         (Input_file_argument::is_lib): Use type_.
6989         (Input_file_argument::is_searched_file): New function.
6990         (Input_file_argument::may_need_search): Handle is_searched_file.
6991         * options.cc (General_options::parse_library): Support -l:filename.
6992         (General_options::parse_just_symbols): Update for Input_file_argument
6993         changes.
6994         (Command_line::process): Likewise.
6995         * archive.cc (Archive::get_file_and_offset): Likewise.
6996         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6997         * script.cc (read_script_file, script_add_file): Likewise.
6998         * fileread.cc (Input_file::Input_file): Likewise.
6999         (Input_file::will_search_for): Handle is_searched_file.
7000         (Input_file::open): Likewise.
7001         * readsyms.cc (Read_symbols::get_name): Likewise.
7002         * testsuite/Makefile.am (searched_file_test): New test.
7003         * testsuite/Makefile.in: Regenerate.
7004         * testsuite/searched_file_test.cc: New file.
7005         * testsuite/searched_file_test_lib.cc: New file.
7006
7007 2009-10-09  Andrew Pinski  <[email protected]>
7008             Ian Lance Taylor  <[email protected]>
7009
7010         * descriptor.cc: Include <cstdio> and "binary-io.h".
7011         (Descriptors::open): Open the files in binary mode always.
7012         * script.cc (Lex::get_token): Treat \r as whitespace.
7013
7014 2009-10-09  Ian Lance Taylor  <[email protected]>
7015
7016         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7017
7018 2009-10-09  Andrew Pinski  <[email protected]>
7019             Ian Lance Taylor  <[email protected]>
7020
7021         * configure.ac: Check for readv function also.
7022         * fileread.cc (readv): Define if not HAVE_READV.
7023         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7024         does not exist.
7025         * config.in: Regenerate.
7026         * configure: Regenerate.
7027
7028 2009-10-09  Doug Kwan  <[email protected]>
7029
7030         * layout.cc (Layout::make_output_section): Call target hook to make
7031         ordinary output section.
7032         (Layout::finalize): Adjust parameter list of call the
7033         Target::may_relax().
7034         * layout.h (class Layout::section_list): New method.
7035         * merge.h (Output_merge_base::entsize): Change visibility to public.
7036         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7037         New methods.
7038         (Output_merge_string::do_is_string): New method.
7039         * object.cc (Sized_relobj::do_setup): renamed from
7040         Sized_relobj::set_up.
7041         * object.h (Sized_relobj::adjust_shndx,
7042         Sized_relobj::initializ_input_to_output_maps,
7043         Sized_relobj::free_input_to_output_maps): Change visibilities to
7044         protected.
7045         (Sized_relobj::setup): Virtualize.
7046         (Sized_relobj::do_setup): New method declaration.
7047         (Sized_relobj::invalidate_section_offset,
7048         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7049         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7050         * options.cc (parse_int): New function.
7051         * options.h (parse_int): New declaration.
7052         (DEFINE_int): New macro.
7053         (stub_group_size): New option.
7054         * output.cc (Output_section::Output_section): Initialize memebers
7055         merge_section_map_, merge_section_by_properties_map_,
7056         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7057         (Output_section::add_input_section): Handled deferred code-fill
7058         generation and remove an old comment.
7059         (Output_section::add_relaxed_input_section): New method definition.
7060         (Output_section::add_merge_input_section): Use merge section by
7061         properties map to speed to search.  Update merge section maps
7062         as appropriate.
7063         (Output_section::build_relaxation_map): New method definition.
7064         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7065         Same.
7066         (Output_section::relax_input_section): Renamed to
7067         Output_section::convert_input_sections_to_relaxed_sections and change
7068         interface to take a vector of pointers to relaxed sections.
7069         (Output_section::find_merge_section,
7070         Output_section::find_relaxed_input_section): New method definitions.
7071         (Output_section::is_input_address_mapped,
7072         Output_section::output_offset, Output_section::output_address):
7073         Use output section data maps to speed up searching.
7074         (Output_section::find_starting_output_address): Add comments.
7075         (Output_section::do_write,
7076         Output_section::write_to_postprocessing_buffer): Do code-fill
7077         generation as appropriate.
7078         (Output_section::get_input_sections): Invalidate relaxed input section
7079         map.
7080         (Output_section::restore_states): Adjust type of checkpoint .
7081         Invalidate relaxed input section map.
7082         * output.h (Output_merge_base): New class declaration.
7083         (Input_section_specifier): New class defintion.
7084         (class Output_relaxed_input_section) Change base class to
7085         Output_section_data_build.
7086         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7087         base class initializer.
7088         (Output_section::add_relaxed_input_section): New method declaration.
7089         (Output_section::Input_section): Change visibility to protected.
7090         (Output_section::Input_section::relobj,
7091         Output_section::Input_section::shndx): Handle relaxed input sections.
7092         Output_section::input_sections) Change visibility to protected.  Also
7093         define overload to return a non-const pointer.
7094         (Output_section::Merge_section_properties): New class defintion.
7095         (Output_section::Merge_section_by_properties_map,
7096         Output_section::Output_section_data_by_input_section_map,
7097         Output_section::Relaxation_map): New types.
7098         (Output_section::relax_input_section): Rename method to
7099         Output_section::convert_input_sections_to_relaxed_sections and change
7100         interface to take a vector of relaxed section pointers.
7101         (Output_section::find_merge_section,
7102         Output_section::find_relaxed_input_section,
7103         Output_section::build_relaxation_map,
7104         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7105         New method declarations.
7106         (Output_section::merge_section_map_
7107         Output_section::merge_section_by_properties_map_,
7108         Output_section::relaxed_input_section_map_,
7109         Output_section::is_relaxed_input_section_map_valid_,
7110         Output_section::generate_code_fills_at_write_): New data members.
7111         * script-sections.cc
7112         (Output_section_element_input::set_section_addresses): Call
7113         current_data_size and addralign methods of relaxed input sections.
7114         (Orphan_output_section::set_section_addresses): Call current_data_size
7115         and addralign methods of relaxed input sections.
7116         * symtab.cc (Symbol_table::compute_final_value): Extract template
7117         from the body of Symbol_table::sized_finalize_symbol.
7118         (Symbol_table::sized_finalized_symbol): Call
7119         Symbol_table::compute_final_value.
7120         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7121         (Symbol_table::compute_final_value): New templated method declaration.
7122         * target.cc (Target::do_make_output_section): New method defintion.
7123         * target.h (Target::make_output_section): New method declaration.
7124         (Target::relax): Add more parameters for input objects, symbol table
7125         and layout.  Adjust call to do_relax.
7126         (Target::do_make_output_section): New method declaration.
7127         (Target::do_relax): Add parameters for input objects, symbol table
7128         and layout.
7129
7130 2009-10-09  Andrew Pinski  <[email protected]>
7131
7132         * pread.c: Include stdio.h.
7133
7134 2009-10-09  Andrew Pinski  <[email protected]>
7135
7136         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7137         defined.
7138
7139 2009-10-09  Andrew Pinski  <[email protected]>
7140
7141         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7142         Change read_shndx type to unsigned int.
7143         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7144         int.
7145         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7146         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7147         Change read_shndx type to unsigned int.
7148         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7149         int.
7150         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7151         * layout.cc (Layout::create_symtab_sections): Cast the result of
7152         local_symcount * symsize to off_t in the gold_assert.
7153
7154 2009-10-09  Viktor Kutuzov  <[email protected]>
7155
7156         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7157         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7158         R_ARM_BASE_ABS.
7159         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7160         (Arm_relocate_functions::thm_abs5): New function.
7161         (Arm_relocate_functions::abs12): New function.
7162         (Arm_relocate_functions::abs16): New function.
7163         (Arm_relocate_functions::base_abs): New function.
7164         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7165         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7166         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7167         R_ARM_BASE_ABS.
7168         (Scan::global): Likewise.
7169         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7170         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7171         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7172         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7173         R_ARM_BASE_ABS.
7174
7175 2009-10-09  Viktor Kutuzov  <[email protected]>
7176
7177         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7178         (Arm_relocate_functions::movt_prel): New function.
7179         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7180         (Arm_relocate_functions::thm_movt_prel): New function.
7181         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7182         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7183         (Scan::global, Relocate::relocate): Likewise.
7184         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7185
7186 2009-10-09  Mikolaj Zalewski  <[email protected]>
7187
7188         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7189         Incremental_checker.
7190         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7191         unsigned int.
7192         (class Incremental_inputs_header): New class.
7193         (Incremental_inputs_header_writer): Edit comment.
7194         (Incremental_inputs_entry): New class.
7195         (Incremental_inputs_entry_writer): Edit comment.
7196         (Sized_incremental_binary::do_find_incremental_inputs_section):
7197         Add *strtab_shndx parameter, fill it.
7198         (Sized_incremental_binary::do_check_inputs): New method.
7199         (Incremental_checker::can_incrementally_link_output_file): Use
7200         Sized_incremental_binary::check_inputs.
7201         (Incremental_inputs::report_command_line): Save command line in
7202         command_line_.
7203         * incremental.h:
7204         (Incremental_binary::find_incremental_inputs_section): New
7205         method.
7206         (Incremental_binary::do_find_incremental_inputs_section): Add
7207         strtab_shndx parameter.
7208         (Incremental_binary::do_check_inputs): New pure virtual method.
7209         (Sized_incremental_binary::do_check_inputs): Declare.
7210         (Incremental_checker::Incremental_checker): Add incremental_inputs
7211         parameter, use it to initialize incremental_inputs_.
7212         (Incremental_checker::incremental_inputs_): New field.
7213         (Incremental_checker::command_line): New method.
7214         (Incremental_checker::inputs): New method.
7215         (Incremental_checker::command_line_): New field.
7216
7217 2009-10-09  Mikolaj Zalewski  <[email protected]>
7218
7219         * incremental.cc: Include <cstdarg> and "target-select.h".
7220         (vexplain_no_incremental): New function.
7221         (explain_no_incremental): New function.
7222         (Incremental_binary::error): New method.
7223         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7224         method.
7225         (make_sized_incremental_binary): New function.
7226         (open_incremental_binary): New function.
7227         (can_incrementally_link_file): Add checks if output is ELF and has
7228         inputs section.
7229         * incremental.h: Include "elfcpp_file.h" and "output.h".
7230         (Incremental_binary): New class.
7231         (Sized_incremental_binary): New class.
7232         (open_incremental_binary): Declare.
7233         * object.cc (is_elf_object): Use
7234         elfcpp::Elf_recognizer::is_elf_file.
7235         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7236         * output.h (Output_file::filesize): New method.
7237
7238 2009-10-07  Viktor Kutuzov  <[email protected]>
7239
7240         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7241         New function.
7242         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7243         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7244         function.
7245         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7246         function.
7247         (Arm_relocate_functions::movw_abs_nc): New function.
7248         (Arm_relocate_functions::movt_abs): New function.
7249         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7250         (Arm_relocate_functions::thm_movt_abs): New function.
7251         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7252         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7253         (Scan::global): Likewise.
7254         (Relocate::relocate): Likewise.
7255         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7256
7257 2009-10-07  Viktor Kutuzov  <[email protected]>
7258
7259         * arm.cc (Arm_relocate_functions::got_prel) New function.
7260         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7261         (Relocate::relocate): Likewise.
7262         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7263
7264 2009-10-06  Ian Lance Taylor  <[email protected]>
7265
7266         * options.h (class General_options): Define
7267         split_stack_adjust_size parameter.
7268         * object.h (class Object): Add uses_split_stack_ and
7269         has_no_split_stack_ fields.  Add uses_split_stack and
7270         has_no_split_stack accessor functions.  Declare
7271         handle_split_stack_section.
7272         (class Reloc_symbol_changes): Define.
7273         (class Sized_relobj): Define Function_offsets.  Declare
7274         split_stack_adjust, split_stack_adjust_reltype, and
7275         find_functions.
7276         * object.cc (Object::handle_split_stack_section): New function.
7277         (Sized_relobj::do_layout): Call handle_split_stack_section.
7278         * dynobj.cc (Sized_dynobj::do_layout): Call
7279         handle_split_stack_section.
7280         * reloc.cc (Sized_relobj::relocate_sections): Call
7281         split_stack_adjust for executable sections in split_stack
7282         objects.  Pass reloc_map to relocate_section.
7283         (Sized_relobj::split_stack_adjust): New function.
7284         (Sized_relobj::split_stack_adjust_reltype): New function.
7285         (Sized_relobj::find_functions): New function.
7286         * target-reloc.h: Include "object.h".
7287         (relocate_section): Add reloc_symbol_changes parameter.  Change
7288         all callers.
7289         * target.h (class Target): Add calls_non_split method.  Declare
7290         do_calls_non_split virtual method.  Declare match_view and
7291         set_view_to_nop.
7292         * target.cc: Include "elfcpp.h".
7293         (Target::do_calls_non_split): New function.
7294         (Target::match_view): New function.
7295         (Target::set_view_to_nop): New function.
7296         * gold.cc (queue_middle_tasks): Give an error if mixing
7297         split-stack and non-split-stack objects with -r.
7298         * i386.cc (Target_i386::relocate_section): Add
7299         reloc_symbol_changes parameter.
7300         (Target_i386::do_calls_non_split): New function.
7301         * x86_64.cc (Target_x86_64::relocate_section): Add
7302         reloc_symbol_changes parameter.
7303         (Target_x86_64::do_calls_non_split): New function.
7304         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7305         parameter.
7306         * powerpc.cc (Target_powerpc::relocate_section): Add
7307         reloc_symbol_changes parameter.
7308         * sparc.cc (Target_sparc::relocate_section): Add
7309         reloc_symbol_changes parameter.
7310         * configure.ac: Call AM_CONDITIONAL for the default target.
7311         * configure: Rebuild.
7312         * testsuite/Makefile.am (TEST_AS): New variable.
7313         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7314         (check_DATA): Add split_i386 and split_x86_64 files.
7315         (SPLIT_DEFSYMS): Define.
7316         (split_i386_[1234n].o): New targets.
7317         (split_i386_[124]): New targets.
7318         (split_i386_[1234r].stdout): New targets.
7319         (split_x86_64_[1234n].o): New targets.
7320         (split_x86_64_[124]): New targets.
7321         (split_x86_64_[1234r].stdout): New targets.
7322         (MOSTLYCLEANFILES): Add new executables.
7323         * testsuite/split_i386.sh: New file.
7324         * testsuite/split_x86_64.sh: New file.
7325         * testsuite/split_i386_1.s: New file.
7326         * testsuite/split_i386_2.s: New file.
7327         * testsuite/split_i386_3.s: New file.
7328         * testsuite/split_i386_4.s: New file.
7329         * testsuite/split_i386_n.s: New file.
7330         * testsuite/split_x86_64_1.s: New file.
7331         * testsuite/split_x86_64_2.s: New file.
7332         * testsuite/split_x86_64_3.s: New file.
7333         * testsuite/split_x86_64_4.s: New file.
7334         * testsuite/split_x86_64_n.s: New file.
7335         * testsuite/testfile.cc (Target_test): Update relocation_section
7336         function.
7337         * testsuite/Makefile.in: Rebuild.
7338
7339 2009-10-06  Ian Lance Taylor  <[email protected]>
7340
7341         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7342         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7343         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7344         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7345         the address on ldo_addrs_.
7346         (Target_i386::Relocate::fix_up_ldo): New function.
7347
7348 2009-10-06   Rafael Espindola  <[email protected]>
7349
7350         * plugin.cc (add_input_library): New.
7351         (Plugin::load): Add add_input_library to tv.
7352         (Plugin_manager::add_input_file): Add the is_lib argument.
7353         (add_input_file): Update call to Plugin_manager::add_input_file.
7354         (add_input_library): New.
7355         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7356
7357 2009-09-30  Doug Kwan  <[email protected]>
7358
7359         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7360         symbol and call Symbol::may_need_copy_reloc to determine if
7361         a copy reloc is needed.
7362         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7363         nocopyreloc is given in command line.
7364         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7365         given in command line.
7366         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7367         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7368         of the removed Target_i386::may_need_copy_reloc.
7369         * options.h (copyreloc): New option with default value false.
7370         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7371         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7372         instead of the removed Target_powerpc::may_need_copy_reloc.
7373         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7374         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7375         instead of the removed Target_sparc::may_need_copy_reloc.
7376         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7377         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7378         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7379         instead of the removed Target_x86_64::may_need_copy_reloc.
7380
7381 2009-09-30  Ian Lance Taylor  <[email protected]>
7382
7383         * object.h (class Object): Remove target_ field, and target,
7384         sized_target, and set_target methods.
7385         (Object::sized_target): Remove.
7386         (class Sized_relobj): Update declarations.  Remove sized_target.
7387         * object.cc (Sized_relobj::setup): Remove target parameter.
7388         Change all callers.
7389         (Input_objects::add_object): Don't do anything with the target.
7390         (make_elf_sized_object): Add punconfigured parameter.  Change all
7391         callers.  Set or test parameter target.
7392         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7393         Change all callers.
7394         * parameters.cc (Parameters::set_target): Change parameter type to
7395         be non-const.
7396         (Parameters::default_target): Remove.
7397         (set_parameters_target): Change parameter type to be non-const.
7398         (parameters_force_valid_target): New function.
7399         (parameters_clear_target): New function.
7400         * parameters.h (class Parameters): Update declarations.  Remove
7401         default_target method.  Add sized_target and clear_target
7402         methods.  Change target_ to be non-const.
7403         (set_parameters_target): Update declaration.
7404         (parameters_force_valid_target): Declare.
7405         (parameters_clear_target): Declare.
7406         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7407         as NULL if we aren't searching.
7408         (Add_symbols::run): Don't check for compatible target.
7409         * fileread.cc (Input_file::open_binary): Call
7410         parameters_force_valid_target.
7411         * gold.cc (queue_middle_tasks): Likewise.
7412         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7413         set_target on object.
7414         * dynobj.h (class Sized_dynobj): Update declarations.
7415         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7416         make_elf_object returns NULL.
7417         (Archive::include_member): Don't check whether object target is
7418         compatible.
7419         * output.cc (Output_section::add_input_section): Get target from
7420         parameters.
7421         (Output_section::relax_input_section): Likewise.
7422         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7423         parameters.
7424         (Sized_relobj::do_scan_relocs): Likewise.
7425         (Sized_relobj::relocate_sections): Likewise.
7426         * resolve.cc (Symbol_table::resolve): Likewise.
7427         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7428         parameter.  Change all callers.
7429         (Symbol_table::add_from_object): Get target from parameters.
7430         (Symbol_table::add_from_relobj): Don't check object target.
7431         (Symbol_table::add_from_dynobj): Likewise.
7432         (Symbol_table::define_special_symbol): Get target from
7433         parameters.
7434         * symtab.h (class Symbol_table): Update declaration.
7435         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7436         parameter.  Change all callers.  Clear parameter target.
7437         (Binary_test): Test target here.
7438         * testsuite/object_unittest.cc (gold_testsuite): Remove
7439         target_test_pointer parameter.  Change all callers.
7440         (Object_test): Test target here.
7441
7442 2009-09-26  Ian Lance Taylor  <[email protected]>
7443
7444         * testsuite/initpri1.c: Don't try to use constructor priorities if
7445         compiling with gcc before 4.3.
7446
7447 2009-09-22  Mikolaj Zalewski  <[email protected]>
7448
7449         * testsuite/retain_symbols_file_test.sh (check_present): Change
7450         output file name to retain_symbols_file_test.stdout.
7451         (check_absent): Likewise.
7452
7453 2009-09-18  Craig Silverstein  <[email protected]>
7454
7455         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7456         * options.cc: Include <cerrno> and <fstream>.
7457         (General_options::finalize): Parse -retain-symbols-file tag.
7458         * options.h: New flag.
7459         (General_options): New method should_retain_symbol, new
7460         variable symbols_to_retain.
7461         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7462         should_retain_symbol map.
7463         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7464         * testsuite/Makefile.in: Regenerate.
7465         * testsuite/retain_symbols_file_test.sh: New file.
7466
7467 2009-09-18  Nick Clifton  <[email protected]>
7468
7469         * po/es.po: Updated Spanish translation.
7470
7471 2009-09-17  Doug Kwan  <[email protected]>
7472
7473         * debug.h (DEBUG_RELAXATION): New constant.
7474         (DEBUG_ALL): Add DEBUG_RELAXATION.
7475         (debug_string_to_enum): Add relaxation debug option.
7476         * layout.cc
7477         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7478         Layout::Relaxation_debug_check::read_sections,
7479         Layout::Relaxation_debug_check::read_sections): New method definitions.
7480         (Layout::Layout): Initialize data members
7481         record_output_section_data_from_scrips_,
7482         script_output_section_data_list_ and relaxation_debug_check_.
7483         (Layout::save_segments, Layout::restore_segments,
7484         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7485         Layout::relaxation_loop_body): New method definitions.
7486         (Layout::finalize): Support relaxation.  Move section layout code to
7487         Layout::relaxation_loop_body.
7488         (Layout::set_asection_address_from_script): Move code for orphan
7489         section placement out.
7490         (Layout::place_orphan_sections_in_script): New method definition.
7491         * layout.h (Output_segment_headers, Output_file_header):
7492         New forward class declarations.
7493         (Layout::~Layout): Define.
7494         (Layout::new_output_section_data_from_script): New method definition.
7495         (Layout::place_orphan_sections_in_script): New method declaration.
7496         (Layout::Segment_states): New type declaration.
7497         (Layout::save_segments, Layout::restore_segments,
7498         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7499         Layout::relaxation_loop_body): New method declarations.
7500         (Layout::Output_section_data_list): New type declaration.
7501         (Layout::Relaxation_debug_check): New class definition.
7502         (Layout::record_output_section_data_from_script_,
7503         Layout::script_output_section_data_list_, Layout::segment_states_,
7504         Layout::relaxation_debug_check_): New data members.
7505         * output.cc: (Output_section_headers::do_size): New method definition.
7506         (Output_section_headers::Output_section_headers): Move size
7507         computation to Output_section_headers::do_size.
7508         (Output_segment_headers::do_size): New method definition.
7509         (Output_file_header::Output_file_header): Move size computation to
7510         Output_file_header::do_size and call it.
7511         (Output_file_header::do_size): New method definition.
7512         (Output_data_group::Output_data_group): Adjust call to
7513         Output_section_data.
7514         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7515         (Output_symtab_xindex::do_write): Add array bound check.
7516         (Output_section::Input_section::print_to_mapfile): Handle
7517         RELAXED_INPUT_SECTION_CODE.
7518         (Output_section::Output_section): Initialize data member checkpoint_.
7519         (Output_section::~Output_section): Delete checkpoint object pointed
7520         by checkpoint_.
7521         (Output_section::add_input_section): Always add an Input_section if
7522         relaxing.
7523         (Output_section::add_merge_input_section): Add assert.
7524         (Output_section::relax_input_section): New method definition.
7525         (Output_section::set_final_data_size): Set load address to zero for
7526         an unallocated section.
7527         (Output_section::do_address_and_file_offset_have_reset_values):
7528         New method definition.
7529         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7530         Handle relaxed input section.
7531         (Output_section::sort_attached_input_sections): Checkpoint input
7532         section list lazily.
7533         (Output_section::get_input_sections): Change type of input_sections to
7534         list of Simple_input_section pointers.  Checkpoint input section list
7535         lazily.  Also handle relaxed input sections.
7536         (Output_section::add_input_section_for_script): Take a reference to
7537         a Simple_input_section object instead of Relobj pointer and section
7538         index as parameter.  Handle relaxed input sections.
7539         (Output_section::save_states, Output_section::restore_states): New
7540         method definitions.
7541         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7542         (Output_data::is_data_size_fixed): New method definition.
7543         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7544         if it is fixed.
7545         (Output_data::address_and_file_offset_have_reset_values): New method
7546         definition.
7547         (Output_data::do_address_and_file_offset_have_reset_values): New method
7548         definition.
7549         (Output_data::set_data_size): Check that data size is not fixed.
7550         (Output_data::fix_data_size): New method definition.
7551         (Output_data::is_data_size_fixed_): New data member.
7552         (Output_section_headers::set_final_data_size): New method definition.
7553         (Output_section_headers::do_size): New method declaration.
7554         (Output_segment_headers::set_final_data_size): New method definition.
7555         (Output_segment_headers::do_size): New method declaration.
7556         (Output_file_header::set_final_data_size)::New method definition.
7557         (Output_file_header::do_size)::New method declaration.
7558         (Output_section_data::Output_section_data): Add new parameter
7559         is_data_size_fixed and use it to fix data size.
7560         (Output_data_const::Output_data_const): Adjust call to base class
7561         constructor and fix data size.
7562         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7563         base class constructor and fix data size.
7564         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7565         base class constructor and fix data size.
7566         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7567         class constructor and fix data size.
7568         (Output_data_group::set_final_data_size): New method definition.
7569         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7570         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7571         class constructor and fix data size.
7572         (Output_relaxed_input_section): New class definition.
7573         (Output_section::Simple_input_section): New class definition.
7574         (Output_section::get_input_sections): Adjust parameter list.
7575         (Output_section::add_input_section_for_script): Same.
7576         (Output_section::save_states, Output_section::restore_states,
7577         Output_section::do_address_and_file_offset_have_reset_values,
7578         (Output_section::Input_section::Input_section): Handle
7579         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7580         Output_relaxed_input_section.
7581         (Output_section::Input_section::is_input_section,
7582         Output_section::Input_section::set_output_section): Handle relaxed
7583         input section.
7584         (Output_section::Input_section::is_relaxed_input_section,
7585         Output_section::Input_section::output_section_data,
7586         Output_section::Input_section::relaxed_input_section): New method
7587         definitions.
7588         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7589         value.
7590         (Output_section::Input_section::u1_): Update comments.
7591         (Output_section::Input_section::u2_): Add new union member poris.
7592         (Output_section::Checkpoint_output_section): New classs definition.
7593         (Output_section::relax_input_section): New method declaration.
7594         (Output_section::checkpoint_): New data member.
7595         (Output_segment): Update comments.
7596         (Output_segment::Output_segment): Un-privatize copy constructor.
7597         (Output_segment::operator=): Un-privatize.
7598         * script-sections.cc (Output_section_element::Input_section_list):
7599         Change element type to Output_section::Simple_input_section.
7600         (Output_section_element_dot_assignment::set_section_addresses):
7601         Register output section data for relaxation clean up.
7602         (Output_data_exression::Output_data_expression): Adjust call to base
7603         constructor to fix data size.
7604         (Output_section_element_data::set_section_addresses): Register
7605         Output_data_expression object for relaxation clean up.
7606         (struct Input_section_info): Replace Relobj pointer and section index
7607         pair with Output_section::Simple_input_section and Convert struct to a
7608         class.
7609         (Input_section_sorter::operator()): Adjust access to
7610         Input_section_info data member to use accessors.
7611         (Output_section_element_input::set_section_addresses): Use layout
7612         parameter.  Adjust code to use Output_section::Simple_input_section
7613         and Input_secction_info classes.  Register filler for relaxation
7614         clean up.
7615         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7616         and section index pair with Output_section::Simple_input_section
7617         class.  Adjust code accordingly.
7618         (Phdrs_element::release_segment): New method definition.
7619         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7620         segment list.
7621         (Script_sections::release_segments): New method definition.
7622         * gold/script-sections.h (Script_sections::release_segments): New
7623         method declaration.
7624         * gold/target.h (Target::may_relax, Target::relax,
7625         Target::do_may_relax, Target::do_relax): New method definitions.
7626
7627 2009-09-17  Viktor Kutuzov  <[email protected]>
7628
7629         * arm.cc (has_signed_unsigned_overflow): New function.
7630         (Arm_relocate_functions::abs8): New function.
7631         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7632         (Target_arm::Scan::global): Likewise.
7633         (Target_arm::relocate::relocate): Likewise.
7634         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7635         Likewise.
7636
7637 2009-09-16  Cary Coutant  <[email protected]>
7638
7639         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7640         * testsuite/Makefile.in: Regenerate.
7641
7642 2009-09-11  Nick Clifton  <[email protected]>
7643
7644         * po/gold.pot: Updated by the Translation project.
7645
7646 2009-09-08  Cary Coutant  <[email protected]>
7647
7648         * output.cc (Output_file::open): Add execute permission to empty file.
7649         * testsuite/Makefile.am (permission_test): New test.
7650         * testsuite/Makefile.in: Regenerate.
7651
7652 2009-09-02  Ian Lance Taylor  <[email protected]>
7653
7654         * output.cc (Output_file::resize): Call map_no_anonymous rather
7655         than map.
7656
7657 2009-09-01  Mikolaj Zalewski  <[email protected]>
7658
7659         * gold.cc: Include "incremental.h".
7660         (queue_initial_tasks): Call Incremental_checker methods.
7661         * incremental.cc: Include "output.h".
7662         (Incremental_checker::can_incrementally_link_output_file): New
7663         method.
7664         * incremental.h (Incremental_checker): New class.
7665
7666         * output.cc (Output_file::open_for_modification): New method.
7667         (Output_file::map_anonymous): Changed return type to bool.  Record
7668         map in base_ field.
7669         (Output_file::map_no_anonymous): New method, broken out of map.
7670         (Output_file::map): Use map_no_anonymous and map_anonymous.
7671         * output.h (class Output_file): Update declarations.
7672
7673 2009-08-24  Cary Coutant  <[email protected]>
7674
7675         * options.h (Command_line::Pre_options): New class.
7676         (Command_line::pre_options): New member.
7677         * options.cc (gold::options::ready_to_register): New variable.
7678         (One_option::register_option): Do nothing if not registering options.
7679         Assert if same short option registered twice.
7680         (General_options::General_options): Turn off option registration when
7681         done constructing.
7682         (Command_line::Pre_options::Pre_options): New constructor.
7683
7684 2009-08-24  Cary Coutant  <[email protected]>
7685
7686         * options.h (General_options::no_keep_memory): Remove incorrect
7687         short option.
7688
7689 2009-08-24  Ralf Wildenhues  <[email protected]>
7690
7691         * Makefile.am (am__skiplex, am__skipyacc): New.
7692         * Makefile.in: Regenerate.
7693
7694 2009-08-22  Ralf Wildenhues  <[email protected]>
7695
7696         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7697         (INCLUDES): ... this.
7698         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7699         (AM_CPPFLAGS): Renamed from ...
7700         (INCLUDE): ... this.
7701         * Makefile.in, testsuite/Makefile.in: Regenerate.
7702
7703         * Makefile.in: Regenerate.
7704         * aclocal.m4: Likewise.
7705         * config.in: Likewise.
7706         * configure: Likewise.
7707         * testsuite/Makefile.in: Likewise.
7708
7709         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7710         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7711         * Makefile.in: Regenerate.
7712         * testsuite/Makefile.in: Regenerate.
7713
7714 2009-08-19  Cary Coutant  <[email protected]>
7715
7716         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7717         symbols in shared libraries overridden by hidden or internal symbols
7718         in the main program.
7719
7720 2009-08-19  Chris Demetriou  <[email protected]>
7721
7722         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7723         checking source file names in error messages.
7724
7725 2009-08-18  Doug Kwan  <[email protected]>
7726
7727         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7728         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7729         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7730         an elfcpp::Ehdr as parameter.
7731         * object.cc (Object::set_target): Remove the version that looks up
7732         a target and sets it.
7733         (Sized_relobj::setup): Take a Target object instead of
7734         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7735         (make_elf_sized_object): Find target and ask target to
7736         make an ELF object.
7737         * object.h: (Object::set_target): Remove the version that looks up
7738         a target and sets it.
7739         (Sized_relobj::setup): Take a Target object instead of
7740         an elfcpp:Ehdr as parameter.
7741         * target.cc: Include dynobj.h.
7742         (Target::do_make_elf_object_implementation): New.
7743         (Target::do_make_elf_object): New.
7744         * target.h (Target::make_elf_object): New template declaration.
7745         (Target::do_make_elf_object): New method declarations.
7746         (Target::do_make_elf_object_implementation): New template declaration.
7747
7748 2009-08-14  Ian Lance Taylor  <[email protected]>
7749
7750         * gold.h (FUNCTION_NAME): Define.
7751         (gold_unreachable): Use FUNCTION_NAME.
7752
7753 2009-08-12  Sriraman Tallam  <[email protected]>
7754
7755         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7756         symbol in the --keep-unique list is not found.
7757
7758 2009-08-12  Sriraman Tallam  <[email protected]>
7759
7760         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7761         been maked as --keep-unique.
7762         (Icf::unfold_section): New function.
7763         * icf.h (Icf::unfold_section): New function.
7764         * options.h (General_options::keep_unique): New option.
7765         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7766         * testsuite/Makefile.in: Regenerate.
7767         * testsuite/icf_keep_unique_test.sh: New file.
7768         * testsuite/icf_keep_unique_test.cc: New file.
7769
7770 2009-08-12  Cary Coutant  <[email protected]>
7771
7772         PR 10471
7773         * resolve.cc (Symbol_table::resolve): Check for references from
7774         dynamic objects to hidden and internal symbols.
7775         * testsuite/Makefile.am (hidden_test.sh): New test.
7776         * testsuite/Makefile.in: Regenerate.
7777         * testsuite/hidden_test.sh: New script.
7778         * testsuite/hidden_test_1.c: New test source.
7779         * testsuite/hidden_test_main.c: New test source.
7780
7781 2009-08-11  Doug Kwan  <[email protected]>
7782
7783         * arm.cc: Update comments.
7784         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7785         segment to locate the .ARM.exidx section if present.
7786
7787 2009-08-09  Doug Kwan  <[email protected]>
7788
7789         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7790         patch.
7791
7792 2009-08-07  Sriraman Tallam  <[email protected]>
7793         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7794         compiler warnings.
7795
7796 2009-08-06  Sriraman Tallam  <[email protected]>
7797
7798         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7799         valid tls_segment only for non-debug-section relocations.
7800         * testsuite/Makefile.am: Add gc_tls_test.
7801         * testsuite/Makefile.in: Regenerate.
7802         * testsuite/gc_tls_test.cc: New file.
7803         * testsuite/gc_tls_test.sh: New file.
7804
7805 2009-08-05  Sriraman Tallam  <[email protected]>
7806
7807         * icf.cc: New file.
7808         * icf.h: New file.
7809         * Makefile.am (CCFILES): Add icf.cc.
7810         (HFILES): Add icf.h
7811         * Makefile.in: Regenerate.
7812         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7813         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7814         section, symbol and addend information for the relocs.
7815         * gold.cc (queue_middle_tasks): Call identical code folding.
7816         * gold.h: Add defines for multimap.
7817         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7818         to the call of finalize_local_symbols.
7819         * main.cc (main): Create object of class Icf.
7820         * object.cc (Sized_relobj::do_layout): Allow this function to be
7821         called twice during icf.
7822         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7823         to sections marked as identical by icf.
7824         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7825         when available.
7826         (Sized_relobj::do_section_entsize): New function.
7827         * object.h (Object::section_entsize): New function.
7828         (Object::do_section_entsize): New pure virtual function.
7829         (Relobj::finalize_local_symbols): Add new parameter.
7830         (Relobj::do_section_entsize): New function.
7831         * options.h (General_options::icf): New option.
7832         (General_options::icf_iterations): New option.
7833         (General_options::print_icf_sections): New option.
7834         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7835         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7836         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7837         icf.
7838         * symtab.cc (Symbol_table::is_section_folded): New function.
7839         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7840         to sections marked as identical by icf.
7841         * symtab.h (Symbol_table::set_icf): New function.
7842         (Symbol_table::icf): New function.
7843         (Symbol_table::is_section_folded): New function.
7844         (Symbol_table::icf_): New data member.
7845         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7846         * testsuite/Makefile.am: Add commands to build icf_test.
7847         * testsuite/Makefile.in: Regenerate.
7848         * testsuite/icf_test.sh: New file.
7849         * testsuite/icf_test.cc: New file.
7850
7851 2009-07-24  Chris Demetriou  <[email protected]>
7852
7853         * layout.cc (is_compressible_debug_section): Fix incorrect
7854         comment about compressed section names.
7855
7856 2009-07-20  Ian Lance Taylor  <[email protected]>
7857
7858         PR 10419
7859         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7860
7861 2009-07-16  Ian Lance Taylor  <[email protected]>
7862
7863         PR 10400
7864         * layout.h: #include <map>.
7865         (class Kept_section): Change from struct to class.  Add accessors
7866         and setters.  Add section size to Comdat_group mapping.  Change
7867         Comdat_group to std::map.  Add is_comdat_ field.  Add
7868         linkonce_size field in union.
7869         (class Layout): Update declaration of find_or_add_kept_section.
7870         Don't declare find_kept_object.
7871         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7872         parameter.  Add object, shndx, is_comdat, and is_group_name
7873         parameters.  Change all callers.  Adjust for new Kept_section.
7874         (Layout::find_kept_object): Remove.
7875         * object.cc (Sized_relobj::include_section_group): Update use of
7876         Kept_section.  Rename secnum to shndx.  Only record
7877         Kept_comdat_section if sections are the same size.
7878         (Sized_relobj::include_linkonce_section): Update use of
7879         Kept_section.  Only record Kept_comdat_section if sections are the
7880         same size.  Set size of linkonce section.
7881         (Sized_relobj::map_to_kept_section): Update call to
7882         get_kept_comdat_section.
7883         * object.h (class Sized_relobj): Rename fields in
7884         Kept_comdat_section to drop trailing underscores; change object
7885         field to Relobj*.  Change Kept_comdat_section_table to store
7886         struct rather than pointer.
7887         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7888         Add kept_object and kept_shndx parameters.  Change all callers.
7889         (Sized_relobj::get_kept_comdat_section): Change return type to
7890         bool.  Add kept_object and kept_shndx parameters.  Change all
7891         callers.
7892         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7893         Layout::find_or_add_kept_section.
7894
7895 2009-07-09  Ian Lance Taylor  <[email protected]>
7896
7897         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7898         Reserve space in the hash table.
7899
7900 2009-07-06  Mikolaj Zalewski  <[email protected]>
7901
7902         * fileread.cc (File_read::get_mtime): New method.
7903         * fileread.h (Timespec): New structure.
7904         (File_read::get_mtime): New method.
7905         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7906         Renamed from timestamp_nsec.
7907         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7908         Elf_Xword.
7909         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7910         timestamp_nsec.
7911         (Incremental_inputs::report_archive): Save mtime; style fix.
7912         (Incremental_inputs::report_obejct): Save mtime; style fix.
7913         (Incremental_inputs::report_script): Save mtime; style fix.
7914         (Incremental_inputs::finalize_inputs): Style fix.
7915         (Incremental_inputs::finalize): Style fix.
7916         (Incremental_inputs::create_input_section_data): Store inputs
7917         mtime.
7918         * incremental.h (Incremental_inputs::report_script): Add mtime
7919         argument.
7920         (Incremental_inputs::Input_info::Input_info): Intialize only one
7921         union member.
7922         (Incremental_inputs::Input_info::archive): Move to nameless
7923         union.
7924         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7925         (Incremental_inputs::Input_info::script): Move to nameless union.
7926         (Incremental_inputs::mtime): New field.
7927         * script.cc (read_input_script): Pass file mtime to
7928         Incremental_input.
7929         * script.h (Script_info::inputs): Style fix.
7930
7931 2009-07-01  Ian Lance Taylor  <[email protected]>
7932
7933         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7934         instead of 32.
7935
7936 2009-06-24  Ian Lance Taylor  <[email protected]>
7937
7938         PR 10156
7939         * layout.cc (Layout::choose_output_section): If we find an
7940         existing section, update the flags.
7941         (Layout::create_notes): New function, broken out of
7942         Layout::finalize.
7943         (Layout::finalize): Don't create note sections.
7944         (Layout::create_note): Don't crash if linker script discards
7945         section.
7946         (Layout::create_gold_note): Likewise.
7947         (Layout::create_build_id): Likewise.  Don't set
7948         after_input_sections on the section.
7949         (Layout::create_executable_stack_info): Remove target parameter.
7950         Change caller.
7951         * layout.h (class Layout): Declare create_notes.  Update
7952         declaration of create_executable_stack_info.
7953         * gold.cc (queue_middle_tasks): Call create_notes.
7954         * output.cc (Output_section::update_flags_for_input_section): Move
7955         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7956         invalid.
7957         * output.h (Output_data::mark_address_invalid): New function.
7958         (class Output_section): Only declare, not define,
7959         update_flags_for_input_section.  Remove set_flags.
7960
7961 2009-06-24  Ian Lance Taylor  <[email protected]>
7962
7963         * script-sections.cc (Output_section_definition::
7964         set_section_addresses): Rename shadowing local load_address to
7965         laddr.
7966
7967 2009-06-24  Ian Lance Taylor  <[email protected]>
7968
7969         PR 10244
7970         * reloc.cc (relocate_sections): Skip empty relocation sections.
7971
7972 2009-06-23  Ian Lance Taylor  <[email protected]>
7973
7974         PR 10156
7975         * layout.cc (Layout::create_note): Use choose_output_section
7976         rather than make_output_section.
7977
7978 2009-06-23  Ian Lance Taylor  <[email protected]>
7979
7980         PR 10237
7981         * options.cc (General_options::parse_V): Set printed_version_.
7982         (General_options::General_options): Initialize printed_version_.
7983         * options.h (class General_options): Add printed_version_ field.
7984         * gold.cc (queue_initial_tasks): If there are no input files,
7985         don't give a fatal error if we printed the version information.
7986         (queue_middle_tasks): If using -r with a shared object, give a
7987         fatal error rather than an ordinary error.
7988
7989 2009-06-23  Ian Lance Taylor  <[email protected]>
7990
7991         PR 10219
7992         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7993         (Layout::make_output_section): Set have_stabstr_section_ if we see
7994         a .stab*str section.
7995         (Layout::finalize): Call link_stabs_sections.
7996         (Layout::link_stabs_sections): New file.
7997         * layout.h (class Layout): Add have_stabstr_section_ field.
7998         Declare link_stabs_sections.
7999
8000 2009-06-23  Doug Kwan  <[email protected]>
8001
8002         * Makefile.am (libgold_a_LIBADD): New.
8003         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8004         * Makefile.in: Regenerate.
8005         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8006         * configure: Regenerate.
8007         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8008         * fileread.cc: Include sys/state.h
8009         * gold.h: Declare memmem and strndup if found missing.
8010         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8011
8012 2009-06-23  Ian Lance Taylor  <[email protected]>
8013
8014         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8015         * configure: Rebuild.
8016
8017 2009-06-23  Ian Lance Taylor  <[email protected]>
8018
8019         PR 10147
8020         * object.cc (Object::section_contents): Don't try to get a view if
8021         the section has length zero.
8022         (Object::handle_gnu_warning_section): If the section is empty, use
8023         the name of the section as the warning.
8024
8025 2009-06-23  Ian Lance Taylor  <[email protected]>
8026
8027         PR 10133
8028         * stringpool.h (class Stringpool_template): Add optimize_ field.
8029         (Stringpool_template::set_optimize): New function.
8030         * stringpool.cc (Stringpool_template::Stringpool_template):
8031         Initialize optimize_ field.
8032         (Stringpool_template::set_string_offsets): Test local optimize
8033         fild rather than parameter.
8034         * layout.cc (Layout::Layout): Call set_optimize on the section
8035         name stringpool.
8036
8037 2009-06-22  Ian Lance Taylor  <[email protected]>
8038
8039         PR 10030
8040         * yyscript.y: Parse TARGET.
8041         * script.cc (script_set_target): New function.
8042         * script-c.h (script_set_target): Declare.
8043         * options.cc (General_options::string_to_object_format): Rename
8044         from string_to_object_format in anonymous namespace.  Change
8045         callers.
8046         * options.h (class General_options): Declare
8047         string_to_object_format.
8048
8049 2009-06-22  Ian Lance Taylor  <[email protected]>
8050
8051         * script-sections.cc (Script_sections::create_segments): Don't put
8052         program headers in a PT_LOAD segment if -n or -N.
8053
8054 2009-06-22  Ian Lance Taylor  <[email protected]>
8055
8056         PR 10141
8057         * options.h (class General_options): Add -z lazy and -z now.  Sort
8058         -z options into alphabetical order.
8059         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8060
8061 2009-06-21  Ian Lance Taylor  <[email protected]>
8062
8063         * layout.cc (Layout::make_output_section): Call
8064         Target::new_output_section.
8065         (Layout::attach_allocated_section_to_segment): Put large section
8066         sections in a separate load segment with the large segment flag
8067         set.
8068         (Layout::segment_precedes): Sort large data segments after other
8069         load segments.
8070         (align_file_offset): New static function.
8071         (Layout::set_segment_offsets): Use align_file_offset.
8072         * output.h (class Output_section): Add is_small_section_ and
8073         is_large_section_ fields.
8074         (Output_section::is_small_section): New function.
8075         (Output_section::set_is_small_section):  New function.
8076         (Output_section::is_large_section): New function.
8077         (Output_section::set_is_large_section): New function.
8078         (Output_section::is_large_data_section): New function.
8079         (class Output_segment): Add is_large_data_segment_ field.
8080         (Output_segment::is_large_data_segment): New function.
8081         (Output_segment::set_is_large_data_segment): New function.
8082         * output.cc (Output_section::Output_section): Initialize new
8083         fields.
8084         (Output_segment::Output_segment): Likewise.
8085         (Output_segment::add_output_section): Add assertion that large
8086         data sections always go in large data segments.  Force small data
8087         sections to the end of the list of data sections.  Force small BSS
8088         sections to the start of the list of BSS sections.  For large BSS
8089         sections to the end of the list of BSS sections.
8090         * symtab.h (class Symbol): Declare is_common_shndx.
8091         (Symbol::is_defined): Check Symbol::is_common_shndx.
8092         (Symbol::is_common): Likewise.
8093         (class Symbol_table): Define enum Commons_section_type.  Update
8094         declarations.  Add small_commons_ and large_commons_ fields.
8095         * symtab.cc (Symbol::is_common_shndx): New function.
8096         (Symbol_table::Symbol_table): Initialize new fields.
8097         (Symbol_table::add_from_object): Put small and large common
8098         symbols in the right list.
8099         (Symbol_table::sized_finalized_symbol): Check
8100         Symbol::is_common_shndx.
8101         (Symbol_table::sized_write_globals): Likewise.
8102         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8103         common symbol lists.  Don't call do_allocate_commons_list if the
8104         list is empty.
8105         (Symbol_table::do_allocate_commons_list): Remove is_tls
8106         parameter.  Add comons_section_type parameter.  Change all
8107         callers.  Handle small and large common symbols.
8108         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8109         Symbol::is_common_shndx.
8110         * resolve.cc (symbol_to_bits): Likewise.
8111         * target.h (Target::small_common_shndx): New function.
8112         (Target::small_common_section_flags): New function.
8113         (Target::large_common_shndx): New function.
8114         (Target::large_common_section_flags): New function.
8115         (Target::new_output_section): New function.
8116         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8117         small_common_section_flags, and large_common_section_flags
8118         fields.
8119         (Target::do_new_output_section): New virtual function.
8120         * arm.cc (Target_arm::arm_info): Initialize new fields.
8121         * i386.cc (Target_i386::i386_info): Likewise.
8122         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8123         Likewise.
8124         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8125         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8126         (Target_x86_64::do_new_output_section): New function.
8127         * configure.ac: Define conditional MCMODEL_MEDIUM.
8128         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8129         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8130         (large_LDFLAGS): Define.
8131         * testsuite/large.c: New file.
8132         * testsuite/testfile.cc (Target_test::test_target_info):
8133         Initialize new fields.
8134         * configure, testsuite/Makefile.in: Rebuild.
8135
8136 2009-06-05  Doug Kwan  <[email protected]>
8137
8138         * Makefile.am (CCFILES): Add target.cc.
8139         * Makefile.in: Regenerate.
8140         * i386.cc (class Target_i386): Define new virtual method to
8141         override do_is_local_label_name in parent.
8142         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8143         local symbols if --discard-locals or -X is given.
8144         * options.h (class General_options): Declare new options
8145         '--discard-locals' and '-X' for discarding locals.
8146         * target.h (class Target): Define new methods is_local_label_name.
8147         Declare new virtual method do_is_local_label_name.
8148         * target.cc: New file.
8149         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8150         (check_SCRIPTS): Add discard_locals_test.sh.
8151         (check_DATA): Add discard_local_tests.syms.
8152         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8153         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8154         * testsuite/Makefile.in: Regenerate.
8155         * testsuite/discard_locals_test.c: New file.
8156         * testsuite/discard_locals_test.sh: Same.
8157
8158 2009-06-05  Doug Kwan  <[email protected]>
8159
8160         * object.cc (Sized_relobj::Sized_relobj): Initialize
8161         discarded_eh_frame_shndx_ to -1U.
8162         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8163         section.
8164         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8165         a discarded .eh_frame section.
8166         (Sized_relobj::do_finalize_local_symbols): Ditto.
8167         * object.h (class Sized_relobj): Declare new member
8168         discarded_eh_frame_shndx_.
8169         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8170         (local_labels_test.o, local_labels_test): New rules.
8171         * testsuite/Makefile.in: Regenerate.
8172
8173 2009-06-04  Doug Kwan  <[email protected]>
8174
8175         * layout.cc (Layout::section_name_mapping): Add mapping for
8176         special ARM sections.
8177
8178 2009-06-03  Doug Kwan  <[email protected]>
8179
8180         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8181         (utils::has_overflow): Same.
8182
8183 2009-06-03  Ian Lance Taylor  <[email protected]>
8184
8185         * layout.cc (Layout::section_name_mapping): New array, replacing
8186         Layout::linkonce_mapping.
8187         (Layout::section_name_mapping_count): New variable, replacing
8188         Layout::linkonce_mapping_count.
8189         (Layout::linkonce_output_name): Remove.
8190         (Layout::output_section_name): Rewrite.
8191         * layout.h (class Layout): Rename Linkonce_mapping to
8192         Section_name_mapping, linkonce_mapping to section_name_mapping,
8193         linkonce_mapping_count to section_name_mapping_count.  Don't
8194         declare linkonce_output_name.
8195
8196 2009-06-03  Doug Kwan  <[email protected]>
8197
8198         * gold/arm.cc (namespace utils): New.
8199         (Target_arm::reloc_is_non_pic): Define new method.
8200         (class Arm_relocate_functions): New.
8201         (Target_arm::Relocate::relocate): Handle relocation types used by
8202         Android.
8203
8204 2009-06-03  Ian Lance Taylor  <[email protected]>
8205
8206         * arm.cc (Target_arm::scan::global): Use || instead of |.
8207
8208 2009-06-02  Doug Kwan  <[email protected]>
8209
8210         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8211         issued_non_pic_error_.
8212         (class Target_arm::Scan): Declare new method check_non_pic.
8213         Define new method symbol_needs_plt_entry.
8214         Declare new data member issued_non_pic_error_.
8215         (class Target_arm::Relocate): Declare new method
8216         should_apply_static_reloc.
8217         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8218         (Target_arm::Scan::check_non_pic): Define new method.
8219         (Target_arm::Scan::local): Handle a small subset of reloc types used
8220         by Android.
8221         (Target_arm::Scan::local): Same.
8222         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8223
8224 2009-05-31  Mikolaj Zalewski  <[email protected]>
8225
8226         * incremental.cc (Incremental_inputs::report_command_line): Filter
8227         out --incremental-* options.
8228
8229 2009-05-29  Doug Kwan  <[email protected]>
8230
8231         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8232         template class.
8233         (class Target_arm): Update comment.
8234         (Target_arm::Target_arm): Initialize new data members GOT_,
8235         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8236         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8237         and Target_arm::rel_dyn_section.
8238         Declare new_enum Target_arm::Got_type.
8239         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8240         and DYNBSS_.
8241         Update commments for member do_dynsym_value.
8242         (Target_arm::got_size, Target_arm::plt_section,
8243         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8244         new methods inside class defintion.
8245         (Target_arm::got_section): Define new method.
8246         (Target_arm::rel_dyn_section): Same.
8247         (Output_data_plt_arm): New template class.
8248         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8249         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8250         (Output_data_plt_arm::add_entry): Same.
8251         (Output_data_plt_arm::first_plt_entry): Define new
8252         static data member for PLT instruction template.
8253         (Output_data_plt_arm::plt_entry): Same.
8254         (Output_data_plt_arm::do_write): Define new method.
8255         (Target_arm::make_plt_entry): Same.
8256         (Target_arm::do_finalize_sections): Same.
8257         (Target_arm::do_dynsym_value): Same.
8258
8259 2009-05-28  Doug Kwan  <[email protected]>
8260
8261         * Makefile.am (TARGETSOURCES): Add arm.cc.
8262         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8263         * Makefile.in: Regenerate.
8264         * arm.cc: New file.
8265         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8266
8267 2009-05-26  Doug Kwan  <[email protected]>
8268
8269         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8270         (General_options::check_excluded_libs): Strip off directories in
8271         archive name before matching like GNU ld does.
8272         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8273         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8274         (exclude_libs_test_LDFLAGS): Add linker option
8275         -Wl,--exclude-libs,libexclude_libs_test_3
8276         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8277         an explicit archive without using -l.
8278         (alt/libexclude_libs_test_3.a): New make rule.
8279         * testsuite/Makefile.in: Regenerate.
8280         * testsuite/exclude_libs_test.c : Declare lib3_default().
8281         (main): Call it.
8282         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8283         * exclude_libs_test_3.c: New file.
8284
8285 2009-05-26  Nick Clifton  <[email protected]>
8286
8287         * po/id.po: New Indonesian translation.
8288         * po/gold.pot: Updated template file.
8289
8290 2009-05-22  Sriraman Tallam  <[email protected]>
8291
8292         * testsuite/Makefile.am: Add -ffunction-sections to compile
8293         gc_comdat_test files.  Add -Wl,--gc-sections to build
8294         gc_comdat_test.
8295         * testsuite/Makefile.in: Regenerate.
8296         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8297
8298 2009-05-21  Sriraman Tallam  <[email protected]>
8299
8300         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8301         kept comdat section was garbage collected.
8302         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8303         * testsuite/Makefile.in: Regenerate.
8304         * testsuite/gc_comdat_test.sh: New file.
8305         * testsuite/gc_comdat_test_1.cc: New file.
8306         * testsuite/gc_comdat_test_2.cc: New file.
8307
8308 2009-05-19  Doug Kwan  <[email protected]>
8309
8310         * archive.cc (Archive::Archive): Move constructor from archive.h
8311         to here.  Initialize no_export_.
8312         (Archive::get_elf_object_for_member): Set no_export flag of object.
8313         * archive.h (Archive::Archive): Move constructor body to
8314         archive.cc.
8315         (Archive::no_export): New method.
8316         (Archive::no_export_): New field.
8317         * object.h (Object::Object): Initialize no_export_ to false.
8318         (Object::no_export, Object::set_no_export): New methods.
8319         (Object::no_export_): New field.
8320         * options.cc (General_options::parse_exclude_libs): New method.
8321         (General_options::check_excluded_libs) Same.
8322         * options.h (exclude_libs): New option.
8323         (General_options::check_excluded_libs): New method declaration.
8324         (General_options::excluded_libs_): New field.
8325         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8326         default or protected visibility if an object has no-export flag set.
8327         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8328         (check_SCRIPTS): Add exclude_libs_test.sh.
8329         (check_DATA): Add exclude_libs_test.syms.
8330         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8331         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8332         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8333         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8334         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8335         libexclude_libs_test_2.a): New rules.
8336         * testsuite/Makefile.in: Regenerate.
8337         * testsuite/exclude_libs_test.c: New file.
8338         * testsuite/exclude_libs_test.sh: Ditto.
8339         * testsuite/exclude_libs_test_1.c: Ditto.
8340         * testsuite/exclude_libs_test_2.c: Ditto.
8341
8342 2009-05-15  Ian Lance Taylor  <[email protected]>
8343
8344         * configure.ac: Check for declarations for cases where libiberty.h
8345         checks HAVE_DECL_xxx.
8346         * configure, config.in: Rebuild.
8347
8348 2009-05-15  Mikolaj Zalewski  <[email protected]>
8349
8350         * gold.h (Incremental_argument_list): Remove (invalid) forward
8351         declaration.
8352         * incremental.cc (Incremental_inputs::report_achive): New method.
8353         (Incremental_inputs::report_object): New method.
8354         (Incremental_inputs::report_script): New method.
8355         (Incremental_inputs::finalize_inputs): New method.
8356         (Incremental_inputs::finalize): Call finalize_inputs().
8357         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8358         Create inputs entries.
8359         * incremental.h (Incremental_input_type): New enum.
8360         (Incremental_inputs::Incremental_input): Initialize new fields.
8361         (Incremental_inputs::report_inputs): New method.
8362         (Incremental_inputs::report_achive): New method.
8363         (Incremental_inputs::report_object): New method.
8364         (Incremental_inputs::report_script): New method.
8365         (Incremental_inputs::finalize_inputs): New method.
8366         (Incremental_inputs::Input_info): New struct.
8367         (Incremental_inputs::Input_info_map): New typedef.
8368         (Incremental_inputs::lock_): New field.
8369         (Incremental_inputs::Inputs_): New field.
8370         (Incremental_inputs::Inputs_map): New field.
8371         * main.cc (main): Call Incremental_input::report_inputs.
8372         * options.h (Input_argument_list): Typedef moved from
8373         Input_arguments.
8374         (Input_file_group::Files): Remove, use ::Input_argument_list.
8375         (Input_file_group::Input_argument_list): Remove, use
8376         ::Input_argument_list.
8377         * plugin.cc (Plugin_manager::add_input_file): Add error in
8378         incremental build.
8379         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8380         functions.
8381         * script.cc (read_input_script): Call
8382         Incremental_input::report_script.
8383         * script.h (Script_info): New class.
8384
8385 2009-04-27  Ian Lance Taylor  <[email protected]>
8386
8387         * x86_64.cc (do_adjust_output_section): Set entsize to
8388         plt_entry_size.
8389
8390 2009-04-23  Elliott Hughes  <[email protected]>
8391
8392         * output.cc (Output_file::close): After short writes, continue
8393         writing from the correct offset in the buffer being written.
8394
8395 2009-04-23  Chris Demetriou  <[email protected]>
8396
8397         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8398         * configure: Regenerate.
8399         * config.in: Regenerate.
8400         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8401         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8402
8403 2009-04-21  Mikolaj Zalewski  <[email protected]>
8404
8405         * incremental.cc (Incremental_inputs_header_data): Renamed from
8406         Incremental_input_header_data.
8407         (Incremental_inputs_header_data::data_size): New field.
8408         (Incremental_inputs_header_data::put_input_file_count): Renamed
8409         from input_file_count.
8410         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8411         from command_line_offset.
8412         (Incremental_inputs_header_data::put_reserved): Renamed from
8413         put_reserved.
8414         (Incremental_inputs_entry_data): Renamed from
8415         Incremental_input_entry_data.
8416         (Incremental_inputs_entry_data::data_size): New field.
8417         (Incremental_inputs::report_command_line): New method.
8418         (Incremental_inputs::finalize): New method.
8419         (Incremental_inputs::create_incremental_inputs_data): New method.
8420         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8421         * incremental.h: New file.
8422         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8423        (Layout::finalize): Create incremental inputs section in
8424         incremental builds.
8425        (Layout::create_incremental_info_sections): New method.
8426         * layout.h (Layout::incremental_inputs): New method.
8427        (Layout::create_incremental_info_sections): New method.
8428        (Layout::incremental_inputs_): New field.
8429         * main.cc (main): Notify Incremental_input of the command line.
8430
8431 2009-04-01  Ian Lance Taylor  <[email protected]>
8432             Mikolaj Zalewski  <[email protected]>
8433
8434         * gold.h (reserve_unordered_map): Define, three versions, one for
8435         each version of Unordered_map.
8436         * layout.cc (Layout::Layout): Remove options parameter.  Add
8437         number_of_input_files parameter.  Don't initialize options_.
8438         Initialize number_of_input_files_ and resized_signatures_.  Move
8439         sections_are_attached_.
8440         (Layout::layout_group): Reserve space for group_signatures_.
8441         (Layout::find_or_add_kept_section): Change name parameter to be a
8442         reference.  Resize signatures_ map when it gets large enough.
8443         (Layout::layout_eh_frame): Use parameters->options() instead of
8444         this->options_.
8445         (Layout::make_output_section): Likewise.
8446         (Layout::attach_allocated_section_to_segment): Likewise.
8447         (Layout::finalize, Layout::create_executable_stack): Likewise.
8448         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8449         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8450         * layout.h (class Layout): Update declarations.  Remove options_
8451         field.  Add number_of_input_files_ and resized_signatures_
8452         fields.  Move sections_are_attached_ field.
8453         * main.cc (main): Pass number of input files to Layout
8454         constructor.  Don't pass options.
8455
8456 2009-03-30  Ian Lance Taylor  <[email protected]>
8457
8458         * ffsll.c (ffsll): Correct implementation.
8459
8460 2009-03-27  Ian Lance Taylor  <[email protected]>
8461
8462         * ffsll.c: New file.
8463         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8464         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8465         * ftruncate.c (ftruncate): Declare before definition.
8466         * mremap.c (mremap): Likewise.
8467         * pread.c (pread): Likewise.
8468         * configure, Makefile.in, config.in: Rebuild.
8469
8470         * mremap.c: New file.
8471         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8472         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8473         (mremap): Declare if HAVE_MREMAP is not defined.
8474         * configure, Makefile.in, config.in: Rebuild.
8475
8476 2009-03-27  Cary Coutant  <[email protected]>
8477
8478         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8479         position independent.
8480         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8481         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8482
8483 2009-03-24  Cary Coutant  <[email protected]>
8484
8485         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8486         an executable.
8487         (needs_dynamic_reloc): Likewise.
8488
8489 2009-03-24  Ian Lance Taylor  <[email protected]>
8490
8491         * yyscript.y (file_cmd): Recognize EXTERN.
8492         (extern_name_list, extern_name_list_body): New nonterminals.
8493         * script.cc (script_add_extern): Define.
8494         * script-c.h (script_add_extern): Declare.
8495
8496 2009-03-24  Rafael Avila de Espindola  <[email protected]>
8497
8498         * object.cc (is_elf_object): Define.
8499         * object.h (is_elf_object): Declare.
8500         * archive.cc (Archive::get_elf_object_for_member): Call
8501         is_elf_object.
8502         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8503
8504 2009-03-24  Elliott Hughes  <[email protected]>
8505
8506         * output.cc (Output_file::map_anonymous): Define.
8507         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8508         try an anonymous one.  Report the size if the mmap fails.
8509         * output.h (class Output_file): Declare map_anonymous.
8510
8511 2009-03-24  Ian Lance Taylor  <[email protected]>
8512
8513         * target-select.cc (instantiate_target): Don't acquire the lock if
8514         the instantiated_target_ field has already been set.
8515
8516 2009-03-23  Ian Lance Taylor  <[email protected]>
8517
8518         * gold-threads.h (class Initialize_lock): Define.
8519         * gold-threads.cc (class Initialize_lock_once): Define.
8520         (initialize_lock_control): New static variable.
8521         (initialize_lock_pointer): New static variable.
8522         (initialize_lock_once): New static function.
8523         (Initialize_lock::Initialize_lock): Define.
8524         (Initialize_lock::initialize): Define.
8525         * target-select.h: Include "gold-threads.h".
8526         (class Target_selector): Add lock_ and initialize_lock_ fields.
8527         Don't define instantiate_target, just declare it.
8528         * target-select.cc (Target_selector::Target_selector): Initialize
8529         new fields.
8530         (Target_selector::instantiate_target): Define.
8531         * descriptors.h: Include "gold-threads.h".
8532         (class Descriptors): Add initialize_lock_ field.
8533         * descriptors.cc (Descriptors::Descriptors): Initialize new
8534         field.
8535         (Descriptors::open): Use initialize_lock_ field
8536         * errors.h (class Errors): Add initialize_lock_ field.
8537         * errors.cc (Errors::Errors): Initialize new field.
8538         (Errors::initialize_lock): Use initialize_lock_ field.
8539         * powerpc.cc (class Target_selector_powerpc): Remove
8540         instantiated_target_ field.  In do_recognize call
8541         instantiate_target rather than do_instantiate_target.  In
8542         do_instantiate_target just allocate a new target.
8543         * sparc.cc (class Target_selector_sparc): Likewise.
8544
8545         * freebsd.h: New file.
8546         * i386.cc: Include "freebsd.h".
8547         (Target_i386): Derive from Target_freebsd rather than
8548         Sized_target.
8549         (Target_selector_i386): Derive from Target_selector_freebsd rather
8550         than Target_selector.
8551         * x86_64.cc: Include "freebsd.h".
8552         (Target_x86_64): Derive from Target_freebsd rather than
8553         Sized_target.
8554         (Target_selector_x86_64): Derive from Target_selector_freebsd
8555         rather than Target_selector.
8556         * target.h (class Target): Add adjust_elf_header and
8557         do_adjust_elf_header.
8558         * output.cc (Output_file_header:: do_sized_write): Call target
8559         adjust_elf_header routine.
8560         * configure.tgt: Set targ_osabi.
8561         * configure.ac: Define GOLD_DEFAULT_OSABI.
8562         * parameters.cc (Parameters::default_target): Pass
8563         GOLD_DEFAULT_OSABI to select_target.
8564         * target-select.h (class Target_selector): Make instantiate_target
8565         protected rather than private.
8566         * Makefile.am (HFILES): Add freebsd.h.
8567         * configure, Makefile.in, config.in: Rebuild.
8568
8569         * merge.cc (do_add_input_section): Correct pend value.  Change
8570         message about last entry not being null terminated from error to
8571         warning.
8572
8573 2009-03-20  Mikolaj Zalewski  <[email protected]>
8574
8575         * incremental.cc: New file.
8576         * Makefile.am (CCFILES): Add incremental.cc.
8577         * Makefile.in: Rebuild.
8578
8579 2009-03-19  Paul Pluzhnikov  <[email protected]>
8580
8581         * layout.cc (Layout::output_section_name): Preserve names
8582         of '.note.' sections.
8583
8584 2009-03-19  Ian Lance Taylor  <[email protected]>
8585
8586         * descriptors.cc (Descriptors::open): Check that the options are
8587         valid before using them.
8588
8589 2009-03-18  Ian Lance Taylor  <[email protected]>
8590
8591         * script-sections.h: Include <list>.
8592         (class Script_sections): Change Sections_elements from std::vector
8593         to std::list.  Typedef public Elements_iterator.  Add
8594         orphan_section_placement_, data_segment_align_start_, and
8595         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8596         field.
8597         * script-sections.cc (class Orphan_section_placement): New class.
8598         (class Sections_element): Add virtual functions is_relro and
8599         orphan_section_init.  Remove virtual function place_orphan_here.
8600         (class Output_section_definition): Add is_relro and
8601         orphan_section_init.  Remove place_orphan_here.
8602         (class Orphan_output_section): Likewise.
8603         (Script_sections::Script_sections): Update for field changes.
8604         (Script_sections::data_segment_align): Set saw_data_segment_align_
8605         and data_segment_align_start_, not data_segment_align_index.
8606         (Script_sections::data_segment_relro_end): Check
8607         saw_data_segment_align_.  Use data_segment_align_start_ rather
8608         than data_segment_align_index_.
8609         (Script_sections::place_orphan): Rewrite to use
8610         Orphan_section_placement.
8611
8612 2009-03-17  Ian Lance Taylor  <[email protected]>
8613
8614         * archive.cc (Archive::add_symbols): Check for a version attached
8615         to the symbol name in the archive map.
8616         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8617         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8618         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8619         (ver_test_11.a): New target.
8620         * testsuite/Makefile.in: Rebuild.
8621
8622         * configure.ac: Check for chsize and posix_fallocate.  Replace
8623         ftruncate.
8624         * ftruncate.c: New file, from gnulib.
8625         * output.cc (posix_fallocate): Define dummy version if not
8626         HAVE_POSIX_FALLOCATE.
8627         (Output_file::map): Call posix_fallocate rather than lseek and
8628         write.
8629         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8630         * configure, Makefile.in, config.in: Rebuild.
8631
8632 2009-03-17  Paul Pluzhnikov  <[email protected]>
8633
8634         * layout.h (Layout::create_note): Add section_name parameter.
8635         * layout.cc (Layout::create_note): Likewise.
8636         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8637
8638 2009-03-17  Ian Lance Taylor  <[email protected]>
8639
8640         * descriptors.cc: Include "options.h".
8641         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8642         (Descriptors::open): Always use O_CLOEXEC when opening a new
8643         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8644         then set FD_CLOEXEC.
8645
8646         * sparc.cc (class Target_sparc): Add has_got_section.
8647         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8648         make sure we have a GOT section.
8649
8650         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8651         (Target_sparc::Scan::local): Likewise.
8652         (Target_sparc::Scan::global): Likewise.
8653         (Target_sparc::Relocate::relocate): Likewise.
8654         (Target_sparc::Relocate::relocate_tls): Likewise.
8655
8656         * symtab.cc (Symbol_table::define_default_version): New function,
8657         broken out of add_from_object.
8658         (Symbol_table::add_from_object): Call define_default_version.
8659         (Symbol_table::define_special_symbol): Add resolve_oldsym
8660         parameter.  Change all callers.  If the version for a symbol comes
8661         from a version script, resolve it with the symbol with the same
8662         name with no version.  Also add the symbol without a version if
8663         appropriate.
8664         (do_define_in_output_data): If resolving with oldsym, don't delete
8665         sym.
8666         (do_define_in_output_segment): Likewise.
8667         (do_define_as_constant): Likewise.
8668         * symtab.h (class Symbol_table): Update declarations.
8669
8670 2009-03-13  Ian Lance Taylor  <[email protected]>
8671
8672         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8673         (Read_symbols::requeue): New function.
8674         (Read_symbols::do_read_symbols): If make_elf_object fails because
8675         the target type is not configured, and the file was searched for,
8676         issue a warning and retry with the next directory.
8677         (Add_symbols::run): If the file has an incompatible format, and
8678         it was searched for, requeue the Read_symbols task.  On error,
8679         release the object.
8680         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8681         dirindex parameter to constructor.  Change all callers.  Declare
8682         incompatible_warning and requeue.
8683         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8684         input_argument_ and input_group_ fields.  Add them to
8685         constructor.  Change all callers.
8686         (class Read_script): Add dirindex_ field.  Add it to constructor.
8687         Change all callers.
8688         * archive.cc (Archive::setup): Remove input_objects parameter.
8689         Change all callers.
8690         (Archive::get_file_and_offset): Likewise.
8691         (Archive::read_all_symbols): Likewise.
8692         (Archive::read_symbols): Likewise.
8693         (Archive::get_elf_object_for_member): Remove input_objects
8694         parameter.  Add punconfigured parameter.  Change all callers.
8695         (Archive::add_symbols): Change return type to bool.  Check return
8696         value of include_member.
8697         (Archive::include_all_members): Likewise.
8698         (Archive::include_member): Change return type to bool.  Return
8699         false if first included object has incompatible target.  Set
8700         included_member_ field.
8701         (Add_archive_symbols::run): If add_symbols returns false, requeue
8702         Read_symbols task.
8703         * archive.h (class Archive): Add included_member_ field.
8704         Initialize it in constructor.  Add input_file and searched_for
8705         methods.  Update declarations.
8706         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8707         input_argument_ fields.  Add them to constructor.  Change all
8708         callers.
8709         * script.cc: Include "target-select.h".
8710         (class Parser_closure): Add skip_on_incompatible_target_ and
8711         found_incompatible_target_ fields.  Add
8712         skip_on_incompatible_target parameter to constructor.  Change all
8713         callers.  Add methods skip_on_incompatible_target,
8714         clear_skip_on_incompatible_target, found_incompatible_target, and
8715         set_found_incompatible_target.
8716         (read_input_script): Add dirindex parameter.  Change all callers.
8717         If parser finds an incompatible target, requeue Read_symbols
8718         task.
8719         (script_set_symbol): Clear skip_on_incompatible_target in
8720         closure.
8721         (script_add_assertion, script_parse_option): Likewise.
8722         (script_start_sections, script_add_phdr): Likewise.
8723         (script_check_output_format): New function.
8724         * script.h (read_input_script): Update declaration.
8725         * script-c.h (script_check_output_format): Declare.
8726         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8727         (ignore_cmd): Remove OUTPUT_FORMAT.
8728         * fileread.cc (Input_file::Input_file): Add explicit this.
8729         (Input_file::will_search_for): New function.
8730         (Input_file::open): Add pindex parameter.  Change all callers.
8731         * fileread.h (class Input_file): Add input_file_argument method.
8732         Declare will_search_for.  Update declarations.
8733         * object.cc (make_elf_object): Add punconfigured parameter.
8734         Change all callers.
8735         * object.h (class Object): Make input_file public.  Add
8736         searched_for method.
8737         (make_elf_object): Update declaration.
8738         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8739         restart search.
8740         * dirsearch.h (class Dirsearch): Update declaration.
8741         * options.h (class General_options): Add --warn-search-mismatch.
8742         * parameters.cc (Parameters::is_compatible_target): New function.
8743         * parameters.h (class Parameters): Declare is_compatible_target.
8744         * workqueue.cc (Workqueue::add_blocker): New function.
8745         * workqueue.h (class Workqueue): Declare add_blocker.
8746
8747         * fileread.cc (Input_file::open): Remove options parameter.
8748         Change all callers.
8749         (Input_file::open_binary): Likewise.
8750         * script.cc (read_input_script): Likewise.
8751         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8752         options parameter from constructor.  Change all callers.
8753         (class Read_script): Likewise.
8754         * fileread.h (class Input_file): Update declarations.
8755         * script.h (read_input_script): Update declaration.
8756
8757 2009-03-10  Nick Clifton  <[email protected]>
8758
8759         * po/es.po: New Spanish translation.
8760
8761 2009-03-06  Cary Coutant  <[email protected]>
8762
8763         * options.cc (parse_short_option): Keep dash_z from registering itself.
8764
8765 2009-03-03  Ian Lance Taylor  <[email protected]>
8766
8767         PR 9918
8768         * target-reloc.h (relocate_section): Pass output_section to
8769         relocate.
8770         * i386.cc (Target_i386::should_apply_static_reloc): Add
8771         output_section parameter.  Change all callers.
8772         (Target_i386::Relocate::relocate): Add output_section parameter.
8773         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8774         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8775         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8776         * testsuite/two_file_shared.sh: New script.
8777         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8778         (check_DATA): Add two_file_shared.dbg.
8779         (two_file_shared.dbg): New target.
8780         * testsuite/Makefile.in: Rebuild.
8781
8782 2009-03-01  Ian Lance Taylor  <[email protected]>
8783
8784         * configure.ac: Check for byteswap.h.
8785         * configure: Rebuild.
8786         * config.in: Rebuild.
8787
8788 2009-03-01  Mikolaj Zalewski  <[email protected]>
8789
8790         * layout.cc (Layout::find_or_add_kept_section): New function.
8791         (Layout::add_comdat): Removed.
8792         * layout.h (struct Kept_section): Move out of class Layout.
8793         Remove trailing underscores from field names.  Add group_sections
8794         field.  Rename group_ field to is_group.  Change all uses.
8795         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8796         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8797         comdat_groups_ field.
8798         (Sized_relobj::include_section_group): Use
8799         find_or_add_kept_section and Kept_section::group_sections.
8800         (Sized_relobj::include_linkonce_section): Likewise.
8801         * object.cc (class Sized_relobj): Don't define Comdat_group or
8802         Comdat_group_table.  Remove find_comdat_group and
8803         add_comdat_group.  Remove comdat_groups_ field.
8804         * plugin.cc (include_comdat_group): Use
8805         Layout::find_or_add_kept_section.
8806
8807 2009-02-28  Ian Lance Taylor  <[email protected]>
8808
8809         * README: --gc-sections and map files are now supported.  Document
8810         some build requirements.
8811
8812         PR 6992
8813         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8814         relocatable link set the value of the section symbol to zero.
8815         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8816         relocatable link don't include the section address in the local
8817         symbol value.
8818
8819 2009-02-27  Ian Lance Taylor  <[email protected]>
8820
8821         PR 6811
8822         * options.h (class Search_directory): Add is_system_directory.
8823         (class General_options): Declare is_in_system_directory.
8824         * options.cc (get_relative_sysroot): Make static.
8825         (get_default_sysroot): Make static.
8826         (General_optoins::is_in_system_directory): New function.
8827         * fileread.cc (Input_file::is_in_system_directory): New function.
8828         * fileread.h (class Input_file): Declare is_in_system_directory.
8829         * object.h (class Object): Add is_in_system_directory.
8830         (class Input_objects): Remove system_library_directory_ field.
8831         * object.cc (Input_objects::add_object): Don't set
8832         system_library_directory_.
8833         (input_objects::found_in_system_library_directory): Remove.
8834         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8835         parameter.  Change all callers.
8836         (Symbol_table::sized_write_globals): Likewise.
8837         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8838         Call Object::is_in_system_directory.
8839         * symtab.h (class Symbol_table): Update declarations.
8840
8841         PR 5990
8842         * descriptors.h (Open_descriptor): Add is_on_stack field.
8843         * descriptors.cc (Descriptors::open): If the descriptor is on the
8844         top of the stack, remove it.  Initialize is_on_stack field.
8845         (Descriptors::release): Only add pod to stack if it is not on the
8846         stack already.
8847         (Descriptors::close_some_descriptor): Clear stack_next and
8848         is_on_stack fields.
8849
8850         PR 7091
8851         * output.cc (Output_section::find_starting_output_address): Rename
8852         from starting_output_address; add PADDR parameter; change return
8853         type.
8854         * output.h (class Output_section): Declare
8855         find_starting_output_address instead of starting_output_address.
8856         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8857         section symbol for which we can't find a merge section.
8858
8859         PR 9836
8860         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8861         hidden or internal, force the symbol to be local.
8862         * resolve.cc (Symbol::override_visibility): Define.
8863         (Symbol::override_base): Use override_visibility.
8864         (Symbol_table::resolve): Likewise.
8865         (Symbol::override_base_with_special): Likewise.
8866         (Symbol_table::override_with_special): If the visibility is hidden
8867         or internal, force the symbol to be local.
8868         * symtab.h (class Symbol): Add set_visibility and
8869         override_visibility.
8870         * testsuite/ver_test_1.sh: New file.
8871         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8872         (check_DATA): Add ver_test_1.syms.
8873         (ver_test_1.syms): New target.
8874         * testsuite/Makefile.in: Rebuild.
8875
8876 2009-02-25  Cary Coutant  <[email protected]>
8877
8878         * layout.cc (Layout::choose_output_section): Don't rename sections
8879         when using a linker script that has a SECTIONS clause.
8880         * Makefile.in: Regenerate.
8881
8882         * testsuite/Makefile.am (script_test_5.sh): New test case.
8883         * testsuite/Makefile.in: Regenerate.
8884         * testsuite/script_test_5.cc: New file.
8885         * testsuite/script_test_5.sh: New file.
8886         * testsuite/script_test_5.t: New file.
8887
8888 2009-02-13  Rafael Avila de Espindola  <[email protected]>
8889
8890         * archive.cc (Archive::include_member): Update calls to add_symbols.
8891         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8892         the Layout argument.
8893         * dynobj.h (do_add_symbols): Add the Layout argument.
8894         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8895         Layout argument.
8896         * object.h (Object::add_symbols): Add the Layout argument.
8897         (Object::do_add_symbols): Add the Layout argument.
8898         (Sized_relobj::do_add_symbols): Add the Layout argument.
8899         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8900         Unify the two versions.
8901         (Add_plugin_symbols): Remove.
8902         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8903         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8904         (Add_plugin_symbols): Remove.
8905         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8906         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8907         (Add_symbols::run): Make it work with Pulginobj.
8908
8909 2009-02-06  Ian Lance Taylor  <[email protected]>
8910
8911         * object.cc (Sized_relobj::do_layout): Make info message start
8912         with lower case letter.
8913
8914 2009-02-06  Mikolaj Zalewski  <[email protected]>
8915
8916         * binary.cc: Fix file comment.
8917
8918         * options.h (enum Incremental_disposition): Define.
8919         (class General_options): Add new options: --incremental,
8920         --incremental_changed, --incremental_unchanged,
8921         --incremental_unknown.  Add incremental_disposition_ and
8922         implicit_incremental_ fields.
8923         (General_options::incremental_disposition): New function.
8924         (class Position_dependent_options): Add incremental_disposition
8925         option.
8926         (Position_dependent_options::copy_from_options): Set incremental
8927         dispositions.
8928         * options.cc (General_options::parse_incremental_changed): New
8929         function.
8930         (General_options::parse_incremental_unchanged): New function.
8931         (General_options::parse_incremental_unknown): New function.
8932         (General_options::General_options): Initialize new fields
8933         incremental_disposition_ and implicit_incremental_.
8934         (General_options::finalize): Check for uasge of --incremental-*
8935         without --incremental.
8936
8937 2009-02-06  Chris Demetriou  <[email protected]>
8938
8939         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8940         pointer and to report location as the file name associated with
8941         the symbol.
8942         (gold_undefined_symbol_at_location): New function to replace the
8943         old gold_undefined_symbol functionality.
8944         * target-reloc.h (relocate_section): Update to use
8945         gold_undefined_symbol_at_location.
8946         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8947         Call gold_undefined_symbol function rather than gold_error.
8948         * errors.h (Errors::undefined_symbol): Take location as a
8949         string, rather than calculating it from a relocation.
8950         * errors.cc (Errors::fatal): Print "fatal error:" before the
8951         formatted message.
8952         (Errors::error, Errors::error_at_location): Print "error: "
8953         before the formatted message.
8954         (Errors::undefined_symbol): Take location as a string, rather
8955         than calculating it from a relocation.
8956         (gold_undefined_symbol_at_location): New function akin to
8957         old gold_undefined_symbol, calculates location from relocation.
8958         (gold_undefined_symbol): Change to take only a Symbol pointer
8959         and to report location as the file name associated with the symbol.
8960         * testsuite/debug_msg.sh: Update for changed error messages.
8961         * testsuite/undef_symbol.sh: Likewise.
8962
8963 2009-02-04  Duncan Sands  <[email protected]>
8964
8965         PR 9812
8966         * reduced_debug_output.h
8967         (Output_reduced_debug_abbrev_section::failed): Use format for
8968         gold_warning.
8969         (Output_reduced_debug_info_section::faild): Likewise.
8970
8971 2009-01-31  Mikolaj Zalewski  <[email protected]>
8972
8973         * script.cc (Lazy_demangler): New class.
8974         (Version_script_info::get_symbol_version_helper): Demangle a
8975         symbol only once.
8976
8977 2009-01-29  Cary Coutant  <[email protected]>
8978
8979         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8980         to __tls_get_addr.
8981         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8982
8983 2009-01-28  Ian Lance Taylor  <[email protected]>
8984
8985         * version.cc (version_string): Bump to 1.9.
8986
8987         * gold.h: Include <cstring> and <stdint.h>.
8988         * version.cc: Include <cstdio>.
8989         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8990         warning.
8991         * reduced_debug_output.cc (insert_into_vector): Rename from
8992         Insert_into_vector; change all callers.  Use Swap_unaligned to
8993         avoid aliasing issue; remove union since it is unnecessary.
8994
8995 2009-01-27  Sriraman Tallam  <[email protected]>
8996
8997         * Makefile.am (CCFILES): Add gc.cc.
8998         (HFILES): Add gc.h.
8999         * Makefile.in: Regenerate.
9000         * gold.cc (Gc_runner): New class.
9001         (queue_initial_tasks): Call garbage collection related tasks
9002         when corresponding options are invoked.
9003         (queue_middle_gc_tasks): New function.
9004         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9005         processed early before laying out sections during garbage collection.
9006         * gold.h (queue_middle_gc_tasks): New function.
9007         (is_prefix_of): Move from "layout.cc".
9008         * i386.cc (Target_i386::gc_process_relocs): New function.
9009         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9010         * main.cc (main): Create object of class "Garbage_collection".
9011         * object.cc (Relobj::copy_symbols_data): New function.
9012         (Relobj::is_section_name_included): New function.
9013         (Sized_relobj::do_layout): Allow this function to be called twice
9014         during garbage collection and defer layout of section during the
9015         first call.
9016         * object.h (Relobj::get_symbols_data): New function.
9017         (Relobj::is_section_name_included): New function.
9018         (Relobj::copy_symbols_data): New function.
9019         (Relobj::set_symbols_data): New function.
9020         (Relobj::get_relocs_data): New function.
9021         (Relobj::set_relocs_data): New function.
9022         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9023         (Relobj::gc_process_relocs): New function.
9024         (Relobj::do_gc_process_relocs): New pure virtual function.
9025         (Relobj::sd_): New data member.
9026         (Sized_relobj::is_output_section_offset_invalid): New function.
9027         (Sized_relobj::do_gc_process_relocs): New function.
9028         * options.h (General_options::gc_sections): Modify to not be a no-op.
9029         (General_options::print_gc_sections): New option.
9030         * plugin.cc (Plugin_finish::run): Remove function call to
9031         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9032         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9033         * reloc.cc (Read_relocs::run): Add task to process relocs and
9034         determine unreferenced sections when doing garbage collection.
9035         (Gc_process_relocs): New class.
9036         (Sized_relobj::do_gc_process_relocs): New function.
9037         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9038         sections that are garbage collected.
9039         * reloc.h (Gc_process_relocs): New class.
9040         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9041         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9042         symbols whose corresponding sections are garbage collected.
9043         (Symbol_table::Symbol_table): Add new parameter for the garbage
9044         collection object.
9045         (Symbol_table::gc_mark_undef_symbols): New function.
9046         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9047         (Symbol_table::gc_mark_dyn_syms): New function.
9048         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9049         as garbage.
9050         (Symbol_table::add_from_object): Likewise.
9051         (Symbol_table::add_from_relobj): When building shared objects, do not
9052         treat externally visible symbols as garbage.
9053         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9054         table information for static and relocatable links.
9055         * symtab.h (Symbol_table::set_gc): New function.
9056         (Symbol_table::gc): New function.
9057         (Symbol_table::gc_mark_undef_symbols): New function.
9058         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9059         (Symbol_table::gc_mark_dyn_syms): New function.
9060         (Symbol_table::gc_): New data member.
9061         * target.h (Sized_target::gc_process_relocs): New pure virtual
9062         function.
9063         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9064         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9065
9066 2009-01-20  Chris Faylor <[email protected]>
9067
9068         * options.h (General_options::gc_sections): Define as a no-op for now.
9069         (General_options::no_keep_memory): Ditto.
9070         (General_options::Bshareable): Define.
9071         * options.cc (General_options::finalize): Honor -Bshareable.
9072
9073 2009-01-20  Andreas Schwab  <[email protected]>
9074
9075         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9076         read the value in the contents, since we don't use it.  Use the
9077         template endianness when writing.
9078         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9079
9080 2009-01-19  Andreas Schwab  <[email protected]>
9081
9082         * configure.tgt (powerpc64-*): Fix targ_obj.
9083
9084 2009-01-15  Ian Lance Taylor  <[email protected]>
9085
9086         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9087         local symbols when stripping all symbols.
9088
9089 2009-01-14  Cary Coutant  <[email protected]>
9090
9091         * output.cc (Output_reloc): Add explicit instantiations.
9092
9093 2009-01-14  Cary Coutant  <[email protected]>
9094
9095         * archive.cc (Archive::get_elf_object_for_member): Remove call
9096         to File_read::claim_for_plugin.
9097         * descriptors.cc (Descriptors::open): Remove reference to
9098         is_claimed.
9099         (Descriptors::claim_for_plugin): Remove.
9100         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9101         (Descriptors::is_claimed): Remove.
9102         (claim_descriptor_for_plugin): Remove.
9103         * fileread.cc (File_read::claim_for_plugin): Remove.
9104         * fileread.h (File_read::claim_for_plugin): Remove.
9105         (File_read::descriptor): Reopen descriptor if necessary.
9106         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9107         (Plugin_manager::all_symbols_read): Add task parameter. Change
9108         all callers.
9109         (Plugin_manager::get_input_file): New function.
9110         (Plugin_manager::release_input_file): New function.
9111         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9112         corresponding data member.
9113         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9114         and pass to base constructor. Change all callers.
9115         (get_input_file, release_input_file): New functions.
9116         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9117         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9118         (Plugin_manager::all_symbols_read): Add task parameter.
9119         (Plugin_manager::get_input_file): New function.
9120         (Plugin_manager::release_input_file): New function.
9121         (Plugin_manager::task_): New data member.
9122         (Pluginobj::Pluginobj): Add filesize parameter.
9123         (Pluginobj::filename): New function.
9124         (Pluginobj::descriptor): New function.
9125         (Pluginobj::filesize): New function.
9126         (Pluginobj::filesize_): New data member.
9127         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9128         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9129         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9130
9131         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9132         with archive libraries.
9133         * testsuite/Makefile.in: Regenerate.
9134         * testsuite/plugin_test.c (struct sym_info): New type.
9135         (get_input_file, release_input_file): New static variables.
9136         (onload): Capture new transfer vector entries.
9137         (claim_file_hook): Stop reading at end of file according to filesize.
9138         Factor out parsing of readelf output into separate function.
9139         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9140         APIs and get the source file name from the symbol table.  Convert
9141         source file name to corresponding object file name.  Print info
9142         message when adding new input files.
9143         (parse_readelf_line): New function.
9144         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9145         * testsuite/plugin_test_2.sh: Likewise.
9146         * testsuite/plugin_test_3.sh: Likewise.
9147         * testsuite/plugin_test_4.sh: New test case.
9148
9149 2009-01-07  Ian Lance Taylor  <[email protected]>
9150
9151         * version.cc (version_string): Bump to 1.8.
9152
9153 2008-12-23  Cary Coutant  <[email protected]>
9154
9155         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9156         * plugin.cc (Plugin_manager::finish): Rename as
9157         layout_deferred_objects.  Move cleanup to separate function.
9158         (Plugin_manager::cleanup): New function.
9159         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9160         separately.
9161         * plugin.h (Plugin_manager::finish): Rename as
9162         layout_deferred_objects.
9163         (Plugin_manager::cleanup): New function.
9164         (Plugin_manager::cleanup_done): New field.
9165
9166 2008-12-23  Cary Coutant  <[email protected]>
9167
9168         * plugin.cc (is_visible_from_outside): New function.
9169         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9170         so we don't return "IR only" status for exported symbols or -r links.
9171
9172         * testsuite/Makefile.am (plugin_test_3): New test case.
9173         * testsuite/Makefile.in: Regenerate.
9174         * testsuite/plugin_test_3.sh: New file.
9175
9176 2008-12-22  Cary Coutant  <[email protected]>
9177
9178         * object.cc (Sized_relobj::layout_section): New function.
9179         (Sized_relobj::do_layout): Defer layout of input sections until after
9180         plugin has provided replacement files.
9181         (Sized_relobj::do_layout_deferred_sections): New function.
9182         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9183         (Relobj::layout_deferred_sections): New function.
9184         (Relobj::do_layout_deferred_sections): New function.
9185         (Sized_relobj::do_layout_deferred_sections): New function.
9186         (Sized_relobj::layout_section): New function.
9187         (Sized_relobj::Deferred_layout): New structure.
9188         (Sized_relobj::deferred_layout_): New field.
9189         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9190         Change all callers.  Layout deferred sections.
9191         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9192         references.
9193         (Plugin_hook::run): Move code from do_plugin_hook inline.
9194         (Plugin_hook::do_plugin_hook): Remove.
9195         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9196         (Plugin_manager::finish): Renamed, was cleanup.
9197         (Plugin_manager::should_defer_layout): New function.
9198         (Plugin_manager::add_deferred_layout_object): New function.
9199         (Plugin_manager::Deferred_layout_list): New type.
9200         (Plugin_manager::deferred_layout_objects_): New field.
9201         (Plugin_hook::do_plugin_hook): Remove.
9202
9203 2008-12-17  Ian Lance Taylor  <[email protected]>
9204
9205         * options.h (class General_options): Add --no case for
9206         --export-dynamic.
9207
9208 2008-12-16  Cary Coutant  <[email protected]>
9209
9210         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9211         vector.
9212         (Plugin_manager::claim_file): Create plugin object even if
9213         plugin did not call the add_symbols callback.
9214         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9215         asking for more symbols than were added.
9216         * testsuite/Makefile.am (plugin_test_1): Add test case with
9217         no global symbols.
9218         (empty.syms): New target.
9219         * testsuite/Makefile.in: Regenerate.
9220         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9221         message. Don't call add_symbols if no globals.
9222         (all_symbols_read_hook): Don't provide replacement for empty
9223         claimed file.
9224
9225 2008-12-12  Ian Lance Taylor  <[email protected]>
9226
9227         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9228         r_type == 0 for a local symbol with r_sym == 0.
9229         (scan_relocatable_relocs): Pass r_sym to
9230         local_non_section_strategy.
9231         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9232         r_sym parameter.
9233
9234         * configure.ac: Update test for TLS descriptors: they are
9235         supported as of glibc 2.9.
9236         * configure: Rebuild.
9237
9238 2008-12-11  Ian Lance Taylor  <[email protected]>
9239
9240         PR 7091
9241         * target-reloc.h (Default_scan_relocatable_relocs): For each
9242         function, map r_type == 0 to RELOC_DISCARD.
9243
9244 2008-12-10  Cary Coutant  <[email protected]>
9245
9246         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9247         object to override a kept COMDAT group from a plugin object.
9248
9249 2008-12-09  Ian Lance Taylor  <[email protected]>
9250
9251         PR 7088
9252         * yyscript.y (file_cmd): Handle INPUT.
9253
9254         * testsuite/initpri1.c: Change all declarations to be full
9255         prototypes by adding void, to avoid compiler warnings.
9256
9257 2008-12-05  Rafael Avila de Espindola  <[email protected]>
9258
9259         * options.cc (General_options::parse_plugin_opt): New.
9260         (General_options::add_plugin): The argument now is just the filename.
9261         (General_options::add_plugin_option): New.
9262         * options.h (plugin_opt): New.
9263         (add_plugin): Change argument name.
9264         (add_plugin_option): New.
9265         * plugin.cc (Plugin::load): Don't parse the plugin option.
9266         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9267         (Plugin::add_option): New.
9268         (Plugin::args_): Change type.
9269         (Plugin::filename_): New.
9270         (Plugin_manager::add_plugin_option): New.
9271         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9272         * testsuite/Makefile.in: Regenerate.
9273
9274 2008-12-05  Cary Coutant  <[email protected]>
9275
9276         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9277         Handle --strip-lto-sections option.
9278         * options.h (strip_lto_sections): New option.
9279
9280 2008-12-01  Cary Coutant  <[email protected]>
9281
9282         * plugin.cc (ld_plugin_message): Change format parameter to const.
9283         Fix mismatch between new[] and delete.
9284
9285 2008-11-14  Cary Coutant  <[email protected]>
9286
9287         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9288         instead of -1U.
9289
9290 2008-11-05  Craig Silverstein  <[email protected]>
9291
9292         * options.cc (General_options::parse_dynamic_list): New function.
9293         * options.h (General_options): New flags dynamic_list,
9294         dynamic_list_data, dynamic_list_cpp_new, and
9295         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9296         (General_options::in_dynamic_list): New function.
9297         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9298         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9299         (Lex::can_continue_name): Likewise.
9300         (yylex): Likewise.
9301         (read_script_file): New parameter script_options.
9302         (read_dynamic_list): New function.
9303         (Script_options::define_dynamic_list): New function.
9304         (dynamic_list_keyword_parsecodes): New variable.
9305         (dynamic_list_keywords): New variable.
9306         * script.h (Script_options::define_dynamic_list): New function
9307         prototype.
9308         (read_dynamic_list): New function prototype.
9309         * symtab.cc (strprefix): New macro.
9310         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9311         dynamic_list_data, dynamic_list_cpp_new, and
9312         dynamic_list_cpp_typeinfo.
9313         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9314         (dynamic_list_expr): New rule.
9315         (dynamic_list_nodes): Likewise.
9316         (dynamic_list_node): Likewise.
9317         * testsuite/Makefile.am (dynamic_list): New test.
9318         * testsuite/Makefile.in: Regenerated.
9319         * testsuite/dynamic_list.t: New file.
9320         * testsuite/dynamic_list.sh: New file.
9321
9322 2008-11-05  Craig Silverstein  <[email protected]>
9323
9324         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9325         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9326         (t11_last): Likewise.
9327         * testsuite/ver_test_6.c (main): Likewise.
9328
9329 2008-10-07  Cary Coutant  <[email protected]>
9330
9331         * options.c (General_options::finalize): Add check for -static and
9332         -shared.
9333         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9334         is not empty.
9335
9336 2008-10-02  Cary Coutant  <[email protected]>
9337
9338         * plugin.cc (make_sized_plugin_object): Fix conditional
9339         compilation to work when not all targets are enabled.
9340
9341 2008-09-29  Cary Coutant  <[email protected]>
9342
9343         * archive.cc (Archive::get_file_and_offset): Use filename instead
9344         of name to get library path.
9345         (Archive::include_member): Unlock external member of a thin archive.
9346
9347         * testsuite/Makefile.am (TEST_AR): New variable.
9348         (thin_archive_test_1): New test.
9349         (thin_archive_test_2): New test.
9350         * testsuite/Makefile.in: Regenerate.
9351         * testsuite/thin_archive_main.cc: New file.
9352         * testsuite/thin_archive_test_1.cc: New file.
9353         * testsuite/thin_archive_test_2.cc: New file.
9354         * testsuite/thin_archive_test_3.cc: New file.
9355         * testsuite/thin_archive_test_4.cc: New file.
9356
9357 2008-09-29  Cary Coutant  <[email protected]>
9358
9359         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9360         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9361         instead of -1U.
9362         (Sized_relobj::do_finalize_local_symbols): Likewise.
9363         (Sized_relobj::map_to_kept_section): Likewise.
9364         * object.h (Sized_relobj::invalid_address): New constant.
9365         (Sized_relobj::do_output_section_offset): Check for invalid_address
9366         and return -1ULL.
9367         * output.cc (Output_reloc::local_section_offset): Use constant
9368         invalid_address instead of -1U.
9369         (Output_reloc::get_address): Likewise.
9370         (Output_section::output_address): Change -1U to -1ULL.
9371         * output.h (Output_reloc::invalid_address): New constant.
9372         * reloc.cc (Sized_relobj::write_sections): Use constant
9373         invalid_address instead of -1U.
9374         (Sized_relobj::relocate_sections): Likewise.
9375         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9376         values for merge sections.
9377         * target-reloc.h (relocate_for_relocatable): Use constant
9378         invalid_address instead of -1U.
9379
9380 2008-09-19  Cary Coutant  <[email protected]>
9381
9382         Add plugin functionality for link-time optimization (LTO).
9383         * configure.ac (plugins): Add --enable-plugins option.
9384         * configure: Regenerate.
9385         * config.in: Regenerate.
9386         * Makefile.am (LIBDL): New variable.
9387         (CCFILES): Add plugin.cc.
9388         (HFILES): Add plugin.h.
9389         (ldadd_var): Add LIBDL.
9390         * Makefile.in: Regenerate.
9391
9392         * archive.cc: Include "plugin.h".
9393         (Archive::setup): Don't preread archive symbols when using a plugin.
9394         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9395         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9396         files.
9397         (Archive::include_member): Add symbols from plugin objects.
9398         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9399         * descriptors.cc (Descriptors::open): Check for file descriptors
9400         abandoned by plugins.
9401         (Descriptors::claim_for_plugin): New function.
9402         * descriptors.h (Descriptors::claim_for_plugin): New function.
9403         (Open_descriptor::is_claimed): New field.
9404         (claim_descriptor_for_plugin): New function.
9405         * fileread.cc (File_read::claim_for_plugin): New function.
9406         * fileread.h (File_read::claim_for_plugin): New function.
9407         (File_read::descriptor): New function.
9408         * gold.cc: Include "plugin.h".
9409         (queue_initial_tasks): Add task to call plugin hooks for generating
9410         new object files.
9411         * main.cc: Include "plugin.h".
9412         (main): Load plugin libraries.
9413         * object.h (Pluginobj): Declare.
9414         (Object::pluginobj): New function.
9415         (Object::do_pluginobj): New function.
9416         (Object::set_target): New function.
9417         * options.cc: Include "plugin.h".
9418         (General_options::parse_plugin): New function.
9419         (General_options::General_options): Initialize plugins_ field.
9420         (General_options::add_plugin): New function.
9421         * options.h (Plugin_manager): Declare.
9422         (General_options): Add --plugin option.
9423         (General_options::has_plugins): New function.
9424         (General_options::plugins): New function.
9425         (General_options::add_plugin): New function.
9426         (General_options::plugins_): New field.
9427         * plugin.cc: New file.
9428         * plugin.h: New file.
9429         * readsyms.cc: Include "plugin.h".
9430         (Read_symbols::do_read_symbols): Check for archive before checking
9431         for ELF file.  Call plugin hooks to claim files.
9432         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9433         from a real object file; force override when processing replacement
9434         files.
9435         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9436         (Symbol::init_base_object): Likewise.
9437         (Symbol::init_base_output_data): Likewise.
9438         (Symbol::init_base_output_segment): Likewise.
9439         (Symbol::init_base_constant): Likewise.
9440         (Symbol::init_base_undefined): Likewise.
9441         (Symbol::output_section): Assert that object is not a plugin.
9442         (Symbol_table::add_from_pluginobj): New function.
9443         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9444         undefined.
9445         (Symbol_table::sized_write_globals): Likewise.
9446         (Symbol_table::add_from_pluginobj): Instantiate template.
9447         * symtab.h (Sized_pluginobj): Declare.
9448         (Symbol::in_real_elf): New function.
9449         (Symbol::set_in_real_elf): New function.
9450         (Symbol::in_real_elf_): New field.
9451         (Symbol_table::add_from_pluginobj): New function.
9452
9453         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9454         (LIBDL): New variable.
9455         (LDADD): Add LIBDL.
9456         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9457         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9458         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9459         (MOSTLYCLEANFILES): Likewise.
9460         * testsuite/Makefile.in: Regenerate.
9461         * testsuite/plugin_test.c: New file.
9462         * testsuite/plugin_test_1.sh: New file.
9463         * testsuite/plugin_test_2.sh: New file.
9464
9465 2008-09-16  Ian Lance Taylor  <[email protected]>
9466
9467         * target-reloc.h (relocate_section): Check whether a symbol is
9468         defined by the ABI before reporting an undefined symbol error.
9469         * target.h (Target::is_defined_by_abi): Make parameter const.
9470         (Target::do_is_defined_by_abi): Likewise.
9471         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9472         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9473         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9474         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9475         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9476         * testsuite/Makefile.in: Rebuild.
9477
9478         * fileread.cc (make_view): Add casts to avoid warning.
9479
9480 2008-09-16  Alexandre Oliva  <[email protected]>
9481
9482         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9483         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9484
9485 2008-09-16  Alexandre Oliva  <[email protected]>
9486
9487         * options.h (General_options::output_is_executable): New.
9488         (General_options::output_is_pie): New.
9489         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9490         for shared libraries.
9491         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9492
9493 2008-09-11  Chris Demetriou  <[email protected]>
9494
9495         * options.h (origin): New -z option.
9496         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9497         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9498         in DT_FLAGS_1.
9499
9500 2008-09-05  Cary Coutant  <[email protected]>
9501
9502         * fileread.cc (File_read::make_view): Add check for attempt to map
9503         beyond end of file.
9504
9505 2008-09-05  Cary Coutant  <[email protected]>
9506
9507         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9508         explicit instantiations.
9509
9510 2008-08-28  Kris Van Hees  <[email protected]>
9511
9512         PR gold/6858
9513         * options.cc (General_options::finalize): Allow undefined symbols
9514         in shlibs if linking -shared.
9515
9516         PR gold/6859
9517         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9518         symbols as not needing a dynsym entry.
9519
9520 2008-08-20  Craig Silverstein  <[email protected]>
9521
9522         * fileread.cc (File_read::open): Do not lock the file unless it
9523         was successfully opened.
9524
9525 2008-08-14  Cary Coutant  <[email protected]>
9526
9527         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9528         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9529         * testsuite/tls_test.cc (struct int128): 128-bit struct
9530         for testing TLS relocs with non-zero addend.
9531         (v12): New TLS variable.
9532         (t12): New test.
9533         (t_last): Add check for v12.
9534         * testsuite/tls_test.h (t12): New function.
9535         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9536
9537 2008-08-13  Ian Lance Taylor  <[email protected]>
9538
9539         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9540         set tls_segment_ or relro_segment_.
9541         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9542         when appropriate.
9543         * output.h (Output_section::clear_is_relro): New function.
9544         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9545         sections specially even when output_data_ is empty.
9546         (Output_segment::maximum_alignment): When first section is relro,
9547         only force alignment for PT_LOAD segments.
9548         * script.cc (script_data_segment_align): New function.
9549         (script_data_segment_relro_end): New function.
9550         * script-c.h (script_data_segment_align): Declare.
9551         (script_data_segment_relro_end): Declare.
9552         * script-sections.h (class Script_sections): Declare
9553         data_segment_align and data_segment_relro_end.  Add fields
9554         segment_align_index_ and saw_relro_end_.
9555         * script-sections.cc (class Sections_element): Add set_is_relro
9556         virtual function.  Add new bool* parameter to place_orphan_here.
9557         Add get_output_section virtual function.
9558         (class Output_section_definition): Add set_is_relro.  Add new
9559         bool* parameter to place_orphan_here.  Add get_output_section.
9560         Add is_relro_ field.
9561         (Output_section_definition::Output_section_definition): Initialize
9562         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9563         and is_relro_ fields.
9564         (Output_section_definition::place_orphan_here): Add is_relro
9565         parameter.
9566         (Output_section_definition::set_section_addresses): Set relro for
9567         output section.
9568         (Output_section_definition::alternate_constraint): Likewise.
9569         (class Orphan_output_section): Add new bool* parameter to
9570         place_orphan_here.  Add get_output_section.
9571         (Orphan_output_section::place_orphan_here): Add is_relro
9572         parameter.
9573         (Script_sections::Script_sections): Initialize
9574         data_segment_align_index_ and saw_relro_end_.
9575         (Script_sections::data_segment_align): New function.
9576         (Script_sections::data_segment_relro_end): New function.
9577         (Script_sections::place_orphan): Set or clear is_relro.
9578         (Script_sections::set_section_addresses): Force alignment of first
9579         TLS section.
9580         * yyscript.y (exp): Call script_data_segment_align and
9581         script_data_segment_relro_end.
9582         * testsuite/relro_script_test.t: New file.
9583         * testsuite/relro_test.cc (using_script): Declare.
9584         (t1, t2): Test using_script.
9585         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9586         (relro_script_test_SOURCES): Define.
9587         (relro_script_test_DEPENDENCIES): Define.
9588         (relro_script_test_LDFLAGS): Define.
9589         (relro_script_test_LDADD): Define.
9590         (relro_script_test.so): New target.
9591         * testsuite/Makefile.in: Rebuild.
9592
9593 2008-08-06  Cary Coutant <[email protected]>
9594
9595         * archive.cc (Archive::total_archives, Archive::total_members)
9596         (Archive::total_members_loaded): New variables.
9597         (Archive::setup): Add parameter.  Add option to preread
9598         archive symbols.
9599         (Archive::read_armap): Add counter.
9600         (Archive::get_file_and_offset): New function.
9601         (Archive::get_elf_object_for_member): New function.
9602         (Archive::read_all_symbols): New function.
9603         (Archive::read_symbols): New function.
9604         (Archive::add_symbols): Add counters.
9605         (Archive::include_all_members): Use armap to find members if it's
9606         already built.
9607         (Archive::include_member): Skip reading symbols if already read.
9608         Factored code into Archive::get_file_and_offset and
9609         Archive::get_elf_object_for_member.  Changed call to
9610         Mapfile::report_include_archive_member.
9611         (Archive::print_stats): New function.
9612         * archive.h: Declare Object and Read_symbols_data classes.
9613         (Archive::Archive): Add initializers for new members.
9614         (Archive::setup): Add parameter.
9615         (Archive::print_stats): New function.
9616         (Archive::total_archives, Archive::total_members)
9617         (Archive::total_members_loaded): New variables.
9618         (Archive::get_file_and_offset): New function.
9619         (Archive::get_elf_object_for_member): New function.
9620         (Archive::read_all_symbols): New function.
9621         (Archive::read_symbols): New function.
9622         (Archive::Archive_member): New class.
9623         (Archive::members_): New member.
9624         (Archive::num_members_): New member.
9625         * main.cc: Include archive.h.
9626         (main): Call Archive::print_stats.
9627         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9628         archive parameter; member_name is now the fully-decorated name.
9629         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9630         * options.h: (General_options): Add --preread-archive-symbols option.
9631         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9632         Archive::setup.
9633
9634 2008-08-04  Ian Lance Taylor  <[email protected]>
9635
9636         * symtab.h (Symbol::use_plt_offset): New function.
9637         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9638         * powerpc.cc (Relocate::relocate): Likewise.
9639         * sparc.cc (Relocate::relocate): Likewise.
9640         * x86_64.cc (Relocate::relocate): Likewise.
9641         * testsuite/weak_plt.sh: New test.
9642         * testsuite/weak_plt_main.cc: New test.
9643         * testsuite/weak_plt_shared.cc: New test.
9644         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9645         (check_PROGRAMS): Add weak_plt.
9646         (check_DATA): Add weak_plt_shared.so.
9647         (weak_plt_main_pic.o, weak_plt): New targets.
9648         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9649         * testsuite/Makefile.in: Rebuild.
9650
9651         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9652         gcctestdir/ld.
9653         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9654         * testsuite/Makefile.in: Rebuild.
9655
9656 2008-08-04  Alan Modra  <[email protected]>
9657
9658         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9659         * Makefile.in: Regenerate.
9660         * po/POTFILES.in: Regenerate.
9661
9662 2008-07-29  Ian Lance Taylor  <[email protected]>
9663
9664         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9665         symbols before other symbols.
9666         * testsuite/script_test_2.cc (test_addr): Declare.
9667         (test_addr_alias): Declare.
9668         (main): Check that test_addr and test_addr_alias have the right
9669         values.
9670         * testsuite/script_test_2.t: Define test_addr_alias and
9671         test_addr.
9672
9673 2008-07-24  Ian Lance Taylor  <[email protected]>
9674
9675         PR 5990
9676         * descriptors.cc: New file.
9677         * descriptors.h: New file.
9678         * gold-threads.h (class Hold_optional_lock): New class.
9679         * fileread.cc: Include "descriptors.h".
9680         (File_read::~File_read): Release descriptor rather than closing
9681         it.
9682         (File_read::open) [file]: Call open_descriptor rather than open.
9683         Set is_descriptor_opened_.
9684         (File_read::open) [memory]: Assert that descriptor is not open.
9685         (File_read::reopen_descriptor): New function.
9686         (File_read::release): Release descriptor.
9687         (File_read::do_read): Make non-const.  Reopen descriptor.
9688         (File_read::read): Make non-const.
9689         (File_read::make_view): Reopen descriptor.
9690         (File_read::do_readv): Likewise.
9691         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9692         Update declarations.
9693         * layout.cc: Include "descriptors.h".
9694         (Layout::create_build_id): Use open_descriptor rather than open.
9695         * output.cc: Include "descriptors.h".
9696         (Output_file::open): Use open_descriptor rather than open.
9697         * archive.cc (Archive::const_iterator): Change Archive to be
9698         non-const.
9699         (Archive::begin, Archive::end): Make non-const.
9700         (Archive::count_members): Likewise.
9701         * archive.h (class Archive): Update declarations.
9702         * object.h (Object::read): Make non-const.
9703         * Makefile.am (CCFILES): Add descriptors.cc.
9704         (HFILES): Add descriptors.h.
9705         * Makefile.in: Rebuild.
9706
9707         PR 6716
9708         * gold.h: Always include <clocale>.  Add Solaris workarounds
9709         following code in binutils/sysdep.h.
9710
9711         PR 6048
9712         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9713         this->eh_frame_hdr_ is NULL before using it.
9714
9715         * dynobj.cc (Versions::Versions): Update comment.
9716
9717         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9718         the base version name.
9719
9720         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9721         array size plus one.
9722         (Stringpool_template::set_string_offsets): Subtract one from key
9723         before using it as an array index.
9724         (Stringpool_template::get_offset_with_length): Likewise.
9725         (Stringpool_template::write_to_buffer): Likewise.
9726         * stringpool.h (Stringpool_template::get_offset_from_key):
9727         Likewise.
9728
9729 2008-07-23  Ian Lance Taylor  <[email protected]>
9730
9731         PR 6658
9732         * object.h (Merged_symbol_value::value): Do our best to handle a
9733         negative addend.
9734
9735         PR 6647
9736         * script.cc (Version_script_info::get_versions): Don't add empty
9737         version tag to return value.
9738         (Version_script_info::get_symbol_version_helper): Change return
9739         type to bool.  Add pversion parameter.  Change all callers.
9740         (script_register_vers_node): Don't require a non-NULL tag.
9741         * script.h (class Version_script_info): Update declarations.
9742         (Version_script_info::get_symbol_version): Change return type to
9743         bool.  Add version parameter.  Change all callers.
9744         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9745         handling.  Handle an empty version from a version script.
9746         (Symbol_table::define_special_symbol): Likewise.
9747         * testsuite/ver_test_10.script: New file.
9748         * testsuite/ver_test_10.sh: New file.
9749         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9750         (check_DATA): Add ver_test_10.syms.
9751         (ver_test_10.syms, ver_test_10.so): New target.
9752         * testsuite/Makefile.in: Rebuild.
9753
9754 2008-07-23  Simon Baldwin  <[email protected]>
9755
9756         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9757         to zero for undefined symbols from dynamic libraries.
9758
9759 2008-07-23  Ian Lance Taylor  <[email protected]>
9760
9761         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9762         Change all callers.
9763         * symtab.h (class Symbol_table): Update declaration.
9764         * testsuite/ver_test_9.cc: New file.
9765         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9766         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9767         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9768         (ver_test_9.so, ver_test_9.o): New targets.
9769         * testsuite/Makefile.in: Rebuild.
9770
9771 2008-07-22  Ian Lance Taylor  <[email protected]>
9772
9773         * options.h (class General_options): Define --check-sections.
9774         * layout.cc (Layout::set_segment_offsets): Handle
9775         --check-sections.
9776
9777         * options.h (class General_options): Define -n/--nmagic and
9778         -N/--omagic.
9779         * options.cc (General_options::finalize): For -n/--nmagic or
9780         -N/--omagic, set -static.
9781         * layout.cc (Layout::attach_allocated_section_to_segment): If
9782         -N/--omagic, don't put read-only and read-write sections in
9783         different segments.
9784         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9785         finding a read-only segment.
9786         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9787         don't set the minimum segment alignment to the common page size,
9788         and don't set the file offset to the address modulo the page size.
9789         * script-sections.cc (Script_sections::create_segments): If
9790         -n/--omagic, don't put read-only and read-write sections in
9791         different segments.
9792
9793         * cref.cc: New file.
9794         * cref.h: New file.
9795         * options.h (class General_options): Add --print-symbol-counts.
9796         * main.cc (main): Issue defined symbol report if requested.
9797         * archive.cc (Archive::interpret_header): Make into a const member
9798         function.
9799         (Archive::add_symbols): Call Input_objects::archive_start and
9800         archive_stop.
9801         (Archive::const_iterator): Define new class.
9802         (Archive::begin, Archive::end): New functions.
9803         (Archive::include_all_members): Rewrite to use iterator.
9804         (Archive::count_members): New function.
9805         * archive.h (class Archive): Update declarations.
9806         (Archive::filename): New function.
9807         * object.cc: Include "cref.h".
9808         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9809         (Sized_relobj::do_get_global_symbol_counts): New function.
9810         (Input_objects::add_object): Add object to cross-referencer.
9811         (Input_objects::archive_start): New function.
9812         (Input_objects::archive_stop): New function.
9813         (Input_objects::print_symbol_counts): New function.
9814         * object.h: Declare Cref and Archive.
9815         (Object::get_global_symbol_counts): New function.
9816         (Object::do_get_global_symbol_counts): New pure virtual function.
9817         (class Sized_relobj): Add defined_count_ field.  Update
9818         declarations.
9819         (class Input_objects): Add cref_ field.  Update constructor.
9820         Update declarations.
9821         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9822         defined_count_.
9823         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9824         symbol counts.
9825         (Sized_dynobj::do_get_global_symbol_counts): New function.
9826         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9827         defined_count_.  Update declarations.  Define Symbols typedef.
9828         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9829         parameter.  Change all callers.
9830         (Symbol_table::add_from_dynobj): Add sympointers and defined
9831         parameters.  Change all callers.
9832         * symtab.h (class Symbol_table): Update declarations.
9833         * Makefile.am (CCFILES): Add cref.cc.
9834         (HFILES): Add cref.h.
9835         * Makefile.in: Rebuild.
9836
9837 2008-07-22  Simon Baldwin  <[email protected]>
9838
9839         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9840         to zero when writing undefined symbols.
9841
9842 2008-07-22  Ian Lance Taylor  <[email protected]>
9843
9844         * output.cc (Output_section::add_input_section): Don't try to
9845         merge empty merge sections.
9846
9847 2008-07-21  Craig Silverstein  <[email protected]>
9848
9849         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9850         Include symbol version in error message.
9851
9852 2008-07-20  Chris Demetriou  <[email protected]>
9853
9854         * configure.ac (gold_cv_c_random_seed): New configured variable.
9855         (RANDOM_SEED_CFLAGS): New substituted variable.
9856         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9857         * configure: Rebuild.
9858         * Makefile.in: Likewise.
9859         * testsuite/Makefile.in: Likewise.
9860
9861 2008-07-18  Ian Lance Taylor  <[email protected]>
9862
9863         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9864         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9865         * testsuite/ver_test_main.cc (main): Call t4.
9866         (t4, t4_2a): Define.
9867         * testsuite/ver_test_2.cc (t4_2): Define.
9868         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9869         * testsuite/ver_test_4.cc (t4_2a): Define.
9870         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9871         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9872
9873 2008-07-17  Ian Lance Taylor  <[email protected]>
9874
9875         * dynobj.cc (Versions::add_def): If we give an error about a
9876         missing version, go ahead and create the version anyhow.
9877
9878 2008-07-10  Ian Lance Taylor  <[email protected]>
9879
9880         Handle output sections with more than 0x7fffffff bytes.
9881         * object.h (class Relobj): Change map_to_output_ to
9882         output_sections_, and just keep a section pointer.  Change all
9883         uses.  Move comdat group support to Sized_relobj.
9884         (Relobj::is_section_specially_mapped): Remove.
9885         (Relobj::output_section): Remove poff parameter.  Change all
9886         callers.
9887         (Relobj::output_section_offset): New function.
9888         (Relobj::set_section_offset): Rewrite.
9889         (Relobj::map_to_output): Remove.
9890         (Relobj::output_sections): New function.
9891         (Relobj::do_output_section_offset): New pure virtual function.
9892         (Relobj::do_set_section_offset): Likewise.
9893         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9894         group support from Relobj.  Update declarations.
9895         (Sized_relobj::get_output_section_offset): New function.
9896         (Sized_relobj::do_output_section_offset): New function.
9897         (Sized_relobj::do_set_section_offset): New function.
9898         * object.cc (Relobj::output_section_address): Remove.
9899         (Sized_relobj::Sized_relobj): Initialize new fields.
9900         (Sized_relobj::include_section_group): Cast find_kept_object to
9901         Sized_relobj.
9902         (Sized_relobj::include_linkonce_section): Likewise.
9903         (Sized_relobj::do_layout): Use separate arrays for output section
9904         and output offset.
9905         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9906         output_sections.
9907         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9908         output_sections and section_offsets.
9909         (Sized_relobj::write_local_symbols): Likewise.
9910         (map_to_kept_section): Compute output address directly.
9911         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9912         output_sections and section_offsets.
9913         (Sized_relobj::write_sections): Likewise.
9914         (Sized_relobj::relocate_sections): Likewise.
9915         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9916         * output.h (class Output_reloc): Update declarations.  Change
9917         u2_.relobj to Sized_relobj*.
9918         (class Output_data_reloc): Change add functions to use
9919         Sized_relobj*.
9920         * output.cc (Output_reloc::Output_reloc): Change relobj to
9921         Sized_relobj*.
9922         (Output_reloc::local_section_offset): Change return type to
9923         Elf_Addr.  Use get_output_section_offset.
9924         (Output_reloc::get_address): Likewise.
9925         (Output_section::is_input_address_mapped): Don't call
9926         is_section_specially_mapped.
9927         (Output_section::output_offset): Likewise.
9928         (Output_section::output_address): Likewise.
9929         (Output_section::starting_output_address): Likewise.
9930         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9931         parameter to Sized_relobj*.
9932         (Copy_relocs::need_copy_reloc): Likewise.
9933         (Copy_relocs::save): Likewise.
9934         * copy-relocs.h (class Copy_relocs): Update declarations.
9935         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9936         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9937         * target-reloc.h (relocate_for_relocatable): Change
9938         offset_in_output_section type to Elf_Addr.  Change code that uses
9939         it as well.
9940         * layout.cc (Layout::layout): Always set *off.
9941         * mapfile.cc (Mapfile::print_input_section): Use
9942         output_section_offset.
9943         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9944         Sized_relobj*.
9945         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9946         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9947         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9948
9949 2008-07-03  Ian Lance Taylor  <[email protected]>
9950
9951         * layout.cc (Layout::include_section): Do not discard unrecognized
9952         SHT_STRTAB sections.
9953
9954 2008-06-30  Craig Silverstein  <[email protected]>
9955
9956         * script.cc (Lex::can_continue_name): Make '?' allowable in
9957         version-script names.
9958         * testsuite/version_script.map: Change glob pattern to use '?'
9959
9960 2008-06-30  Manish Singh  <[email protected]>
9961
9962         PR 6585
9963         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9964         Correct typo.
9965
9966 2008-06-30  Ian Lance Taylor  <[email protected]>
9967
9968         PR 6660
9969         PR 6682
9970         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9971         versions]: Don't try to read the value in the contents, since we
9972         don't use it.  Use the template endianness when writing.
9973
9974 2008-06-25  Cary Coutant  <[email protected]>
9975
9976         * fileread.cc (File_read::make_view): Assert on zero-length view.
9977         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9978         symbol table when there are no symbols to read.
9979
9980 2008-06-23  Craig Silverstein  <[email protected]>
9981
9982         * version.cc (version_string): Bump to 1.7
9983
9984 2008-06-18  Craig Silverstein  <[email protected]>
9985
9986         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9987         constant 0xFFFF to type Valtype.
9988         (Powerpc_relocate_functions::rel16_ha): Likewise.
9989
9990 2008-06-17  Ian Lance Taylor  <[email protected]>
9991
9992         * output.h (Output_section::Input_section): Initialize p2align_ to
9993         zero for Output_section_data constructors.
9994         (Output_section::Input_section::addralign): If not an input
9995         section, return the alignment of the Output_section_data.
9996         * testsuite/copy_test.cc: New file.
9997         * testsuite/copy_test_1.cc: New file.
9998         * testsuite/copy_test_2.cc: New file.
9999         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10000         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10001         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10002         (copy_test_1_pic.o, copy_test_1.so): New targets.
10003         (copy_test_2_pic.o, copy_test_2.so): New targets.
10004         * testsuite/Makefile.in: Rebuild.
10005
10006         * script-sections.cc (Script_sections::place_orphan): Initialize
10007         local variable exact.
10008
10009 2008-06-13  David Edelsohn  <[email protected]>
10010
10011         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10012
10013 2008-06-12  David Edelsohn  <[email protected]>
10014             David S. Miller  <[email protected]>
10015
10016         * powerpc.cc: New file.
10017         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10018         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10019         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10020         * Makefile.in: Rebuild.
10021
10022 2008-06-09  Ian Lance Taylor  <[email protected]>
10023
10024         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10025         <exception>.
10026         (throwing, orig_terminate): New static variables.
10027         (terminate_handler): New static function.
10028         (t2): Set terminate handler.
10029
10030 2008-06-05  Kris Van Hees  <[email protected]>
10031
10032         PR 6584
10033         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10034         alignment.
10035
10036 2008-05-30  Cary Coutant  <[email protected]>
10037
10038         * archive.cc (Archive::include_all_members) Correct to step
10039         over symbol table and extended name table in thin archives.
10040
10041 2008-05-29  Kris Van Hees  <[email protected]>
10042
10043         PR 6407
10044         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10045         calculation.
10046
10047 2008-05-28  Caleb Howe  <[email protected]>
10048
10049         * reduced_debug_output.cc: New file.
10050         * reduced_debug_output.h: New file.
10051         * options.h (class General_options): Add --strip-debug-non-line.
10052         * options.cc (General_options::finalize): Add strip_debug_non_line
10053         to the strip heirarchy.
10054         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10055         fields.
10056         * layout.cc: Include "reduced_debug_output.h".
10057         (Layout::Layout): Initialize new fields.
10058         (line_only_debug_sections): New static array.
10059         (is_lines_only_debug_sections): New static inline function.
10060         (Layout::include_section): Handle --strip-debug-non-line.
10061         (Layout::make_output_section): If --strip-debug-non-line, build
10062         new output sections for .debug_abbrev and .debug_info.
10063         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10064         gold.  Warn about possible overflow.
10065         (read_signed_LEB_128): Likewise.
10066         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10067         (read_signed_LEB_128): Declare.
10068         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10069         (HFILES): Add reduced_debug_output.h.
10070         * Makefile.in: Rebuild.
10071
10072 2008-05-21  Ian Lance Taylor  <[email protected]>
10073
10074         * mapfile.cc: New file.
10075         * mapfile.h: New file.
10076         * options.h (class General_options): Add -M/--print-map and -Map.
10077         * options.cc (General_options::finalize): Make -M equivalent to
10078         -Map -.
10079         * main.cc: Include <cstdio> and "mapfile.h".
10080         (main): Open mapfile if requested.
10081         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10082         constructor.  Change caller.
10083         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10084         (queue_middle_tasks): Likewise.
10085         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10086         declarations.
10087         * archive.cc: Include "mapfile.h".
10088         (Archive::add_symbols): Add mapfile parameter.  Change all
10089         callers.  Pass mapfile, symbol, and reason to include_member.
10090         (Archive::include_all_members): Add mapfile parameter.  Change all
10091         callers.
10092         (Archive::include_member): Add mapfile, sym, and why parameters.
10093         Change all callers.  Report inclusion to map file.
10094         * archive.h: Include "fileread.h".
10095         (class Archive): Update declarations.
10096         (Archive::file): New const method.
10097         (class Add_archive_symbols): Add mapfile_ field.  Update
10098         constructor.  Change all callers.
10099         * readsyms.h (class Read_symbols): Likewise.
10100         (class Finish_group): Likewise.
10101         (class Read_script): Likewise.
10102         * common.cc: Include "mapfile.h".
10103         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10104         all callers.
10105         (Symbol_table::do_allocate_commons): Likewise.
10106         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10107         symbol allocation to mapfile.
10108         * common.h (class Allocate_commons_task): Add mapfile_ field.
10109         Update constructor.  Change all callers.
10110         * symtab.h (class Symbol_table): Update declarations.
10111         * layout.cc: Include "mapfile.h".
10112         (Layout_task_runner::run): Print information to mapfile.
10113         (Layout::create_gold_note): Change Output_data_fixed_space to
10114         Output_data_zero_fill.
10115         (Layout::create_build_id): Likewise.
10116         (Layout::print_to_mapfile): New function.
10117         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10118         constructor.  Change caller.
10119         (class Layout): Declare print_to_mapfile.
10120         * output.cc (Output_section::Input_section::print_to_mapfile): New
10121         function.
10122         (Output_section::add_input_section): If producing a map, always
10123         add to input_sections_ list.
10124         (Output_section::do_print_to_mapfile): New function.
10125         (Output_segment::print_sections_to_mapfile): New function.
10126         (Output_segment::print_section_list_to_mapfile): New function.
10127         * output.h: Include "mapfile.h".
10128         (Output_data::print_to_mapfile): New function.
10129         (Output_data::do_print_to_mapfile): New virtual function.
10130         (Output_segment_headers::do_print_to_mapfile): New function.
10131         (Output_file_header::do_print_to_mapfile): New function.
10132         (Output_data_const::do_print_to_mapfile): New function.
10133         (class Output_data_const_buffer): Add map_name_ field.  Update
10134         constructor.  Change all callers.  Add do_print_to_mapfile
10135         function.
10136         (class Output_data_fixed_space): Likewise.
10137         (class Output_data_space): Likewise.
10138         (class Output_data_zero_fill): New class.
10139         (Output_data_strtab::do_print_to_mapfile): New function.
10140         (Output_data_reloc_base::do_print_to_mapfile): New function.
10141         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10142         (Output_data_group::do_print_to_mapfile): New function.
10143         (Output_data_got::do_print_to_mapfile): New function.
10144         (Output_data_dynamic::do_print_to_mapfile): New function.
10145         (Output_symtab_xindex::do_print_to_mapfile): New function.
10146         (class Output_section): Declare do_print_to_mapflie.  Declare
10147         print_to_mapfile in Input_section.
10148         (class Output_segment): Declare new functions.
10149         * object.h (Sized_relobj::symbol_count): New function.
10150         * script-sections.cc
10151         (Output_section_element_dot_assignment::set_section_addresses):
10152         Change Output_data_fixed_space to Output_data_zero_fill.
10153         (Output_data_expression::do_print_to_mapfile): New function.
10154         * script.cc (read_input_script): Add mapfile parameter.  Change
10155         all callers.
10156         * script.h (read_input_script): Update declaration.
10157         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10158         (Eh_frame::do_print_to_mapfile): New function.
10159         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10160         (Output_merge_string::do_print_to_mapfile): New function.
10161         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10162         function.
10163         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10164         function.
10165         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10166         function.
10167         * Makefile.am (CCFILES): Add mapfile.cc.
10168         (HFILES): Add mapfile.h.
10169         * Makefile.in: Rebuild.
10170
10171 2008-05-19  Ian Lance Taylor  <[email protected]>
10172
10173         * options.h (class General_options): Add -z relro.
10174         * layout.cc (Layout::Layout): Initialize relro_segment_.
10175         (Layout::add_output_section_data): Return the output section.
10176         (Layout::make_output_section): Rcognize relro sections and mark
10177         them appropriately.
10178         (Layout::attach_allocated_section_to_segment): Put relro sections
10179         in a PT_GNU_RELRO segment.
10180         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10181         section as relro.
10182         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10183         PT_TLS segments.
10184         (Layout::linkonce_mapping): Map d.rel.ro.local to
10185         .data.rel.ro.local.
10186         (Layout::output_section_name): Us .data.rel.ro.local for any
10187         section which begins with that.
10188         * layout.h (class Layout): Update add_output_section_data
10189         declaration.  Add relro_segment_ field.
10190         * output.cc (Output_section::Output_section): Initialize is_relro_
10191         and is_relro_local_ fields.
10192         (Output_segment::add_output_section): Group relro sections.
10193         (Output_segment::is_first_section_relro): New function.
10194         (Output_segment::maximum_alignment): If there is a relro section,
10195         align the segment to the common page size.
10196         (Output_segment::set_section_addresses): Track whether we are
10197         looking at relro sections.  If the last section is a relro
10198         section, align to the common page size.
10199         (Output_segment::set_section_list_addresses): Add in_relro
10200         parameter.  Change all callers.  Align to the page size when
10201         moving from relro to non-relro section.
10202         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10203         segment.
10204         * output.h (class Output_section): Add is_relro_ and
10205         is_relro_local_ fields.
10206         (Output_section::is_relro): New function.
10207         (Output_section::set_is_relro): New function.
10208         (Output_section::is_relro_local): New function.
10209         (Output_section::set_is_relro_local): New function.
10210         (class Output_segment): Update declarations.
10211         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10212         * sparc.cc (Target_sparc::got_section): Likewise.
10213         * x86_64.cc (Target_x86_64::got_section): Likewise.
10214         * testsuite/relro_test_main.cc: New file.
10215         * testsuite/relro_test.cc: New file.
10216         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10217         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10218         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10219         (relro_test.so, relro_test_pic.o): New targets.
10220         * testsuite/Makefile.in: Rebuild.
10221
10222 2008-05-16  Ian Lance Taylor  <[email protected]>
10223
10224         * output.cc (Output_segment::add_output_section): Remove front
10225         parameter.
10226         * output.h (class Output_segment): Remove
10227         add_initial_output_section and overloaded add_output_section.
10228         Update declaration of remaining add_output_section.
10229         * layout.cc (Layout::create_interp): Call add_output_section
10230         rather than add_initial_output_section.
10231         (Layout::finish_dynamic_section): Likewise.
10232
10233         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10234         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10235         know the dynamic type.
10236         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10237         field.  Initialize it in constructor.
10238         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10239         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10240         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10241         reloc.
10242
10243         * output.cc (Output_reloc::get_address): Change return type to
10244         Elf_Addr.
10245         * output.h (class Output_reloc): Update get_address declaration.
10246         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10247         for section addresses.
10248
10249 2008-05-09  Ian Lance Taylor  <[email protected]>
10250
10251         PR 6493
10252         * gold.cc (gold_nomem): Use return value of write.
10253
10254 2008-05-08  Ian Lance Taylor  <[email protected]>
10255
10256         * symtab.c (Symbol::init_base_output_data): Add version
10257         parameter.  Change all callers.
10258         (Symbol::init_base_output_segment): Likewise.
10259         (Symbol::init_base_constant): Likewise.
10260         (Symbol::init_base_undefined): Likewise.
10261         (Sized_symbol::init_output_data): Likewise.
10262         (Sized_symbol::init_output_segment): Likewise.
10263         (Sized_symbol::init_constant): Likewise.
10264         (Sized_symbol::init_undefined): Likewise.
10265         (Symbol_table::do_define_in_output_data): If the new symbol has a
10266         version, mark it as the default.
10267         (Symbol_table::do_define_in_output_segment): Likewise.
10268         (Symbol_table::do_define_as_constant): Likewise.
10269         * symtab.h (class Symbol): Update declarations.
10270         (class Sized_symbol): Likewise.
10271         * resolve.cc (Symbol::override_version): New function.
10272         (Symbol::override_base): Call override_version.
10273         (Symbol::override_base_with_special): Likewise.
10274         * testsuite/ver_script_8.script: New file.
10275         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10276         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10277         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10278         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10279
10280 2008-05-06  Ian Lance Taylor  <[email protected]>
10281
10282         PR 6049
10283         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10284         functions.
10285         (class General_options): Remove existing --undefined, and add
10286         --no-undefined instead.  Add new --undefined as synonym for -u.
10287         * archive.cc (Archive::add_symbols): Check whether symbol was
10288         named with -u.
10289         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10290         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10291         all uses.  Add IS_UNDEFINED.  Update declarations to split
10292         different versions of init_base.  Declare init_base_undefined.
10293         (Symbol::is_defined): Handle IS_UNDEFINED.
10294         (Symbol::is_undefined): Likewise.
10295         (Symbol::is_weak_undefined): Call is_undefined.
10296         (Symbol::is_absolute): Handle IS_CONSTANT.
10297         (class Sized_symbol): Update declarations to split different
10298         versions of init.  Declare init_undefined.
10299         (class Symbol_table): Declare new functions.
10300         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10301         Change all callers.
10302         (Symbol::init_base_output_data): Likewise.
10303         (Symbol::init_base_output_segment): Likewise.
10304         (Symbol::init_base_constant): Likewise.
10305         (Symbol::init_base_undefined): New function.
10306         (Sized_symbol::init_object): Rename from init.  Change all
10307         callers.
10308         (Sized_symbol::init_output_data): Likewise.
10309         (Sized_symbol::init_output_segment): Likewise.
10310         (Sized_symbol::init_constant): Likewise.
10311         (Sized_symbol::init_undefined): New function.
10312         (Symbol_table::add_undefined_symbols_from_command_line): New
10313         function.
10314         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10315         function.
10316         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10317         (Symbol::output_section): Likewise.
10318         (Symbol::set_output_section): Likewise.
10319         (Symbol_table::sized_finalize_symbol): Likewise.
10320         (Symbol_table::sized_write_globals): Likewise.
10321         * resolve.cc (Symbol_table::should_override): Likewise.
10322         (Symbol::override_base_with_special): Likewise.
10323
10324         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10325         symbol, change it to have default visibility.
10326         * testsuite/protected_1.cc: New file.
10327         * testsuite/protected_2.cc: New file.
10328         * testsuite/protected_3.cc: New file.
10329         * testsuite/protected_main_1.cc: New file.
10330         * testsuite/protected_main_2.cc: New file.
10331         * testsuite/protected_main_3.cc: New file.
10332         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10333         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10334         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10335         (protected_1.so): New target.
10336         (protected_1_pic.o, protected_2_pic.o): New targets.
10337         (protected_3_pic.o): New target.
10338         (check_PROGRAMS): Add protected_2.
10339         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10340         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10341         * testsuite/Makefile.in: Rebuild.
10342
10343         * options.h (DEFINE_var): Add set_user_set_##varname__.
10344         (DEFINE_bool_alias): New macro.
10345         (class General_options): Define -Bstatic using DEFINE_bool_alias
10346         rather than DEFINE_special.  Add --undefined as an alias for -z
10347         defs.
10348         * options.cc (General_options::parse_Bstatic): Remove.
10349
10350         * options.h (class General_options): Add --fatal-warnings.
10351         * main.cc (main): Implement --fatal-warnings.
10352         * errors.h (Errors::warning_count): New function.
10353
10354         * options.h (class General_options): Add -Bsymbolic-functions.
10355         * symtab.h (Symbol::is_preemptible): Check for
10356         -Bsymbolic-functions.
10357
10358 2008-05-05  Ian Lance Taylor  <[email protected]>
10359
10360         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10361         as noVARNAME rather than no-VARNAME.
10362         (class General_options): Add option -z combreloc.
10363         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10364         get_address.
10365         (Output_reloc::sort_before) [SHT_REL]: New function.
10366         (Output_reloc::sort_before) [SHT_RELA]: New function.
10367         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10368         Sort_relocs_comparison.
10369         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10370         parameter.  Change all callers.
10371         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10372         sort_relocs parameter.  Change all callers.
10373         * output.cc (Output_reloc::get_address): New function, broken out
10374         of write_rel.
10375         (Output_reloc::write_rel): Call it.
10376         (Output_reloc::compare): New function.
10377         (Output_data_reloc_base::do_write): Optionally sort relocs.
10378
10379         * configure.ac: If targ_extra_obj is set, link it in.
10380         * configure.tgt: Initialize all variables.
10381         (x86_64*): Set targ_extra_obj and targ_extra_size.
10382         * configure: Rebuild.
10383
10384         * object.cc (Sized_relobj::include_section_group): Adjust section
10385         indexes read from group data.  Build vector to pass to
10386         layout_group.
10387         * layout.cc (Layout::layout_group): Add flags and shndxes
10388         parameters.  Remove contents parameter.  Change caller.  Update
10389         explicit instantiations.
10390         * layout.h (class Layout): Update layout_group declaration.
10391         * output.cc (Output_data_group::Output_data_group): Add flags and
10392         input_shndxes parameters.  Remove contents parameter.  Change
10393         caller.
10394         (Output_data_group::do_write): Change input_sections_ to
10395         input_shndxes_.
10396         * output.h (class Output_data_group): Update constructor
10397         declaration.  Rename input_sections_ to input_shndxes_.
10398         * testsuite/many_sections_test.cc: Add template.
10399
10400 2008-04-30  Cary Coutant  <[email protected]>
10401
10402         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10403
10404         * layout.cc (Layout::include_section): Refactored check for debug
10405         info section.
10406         (Layout::add_comdat): Add new parameters.  Change type
10407         of signature parameter.  Add object and shndx to signatures table.
10408         (Layout::find_kept_object): New function.
10409         * layout.h: Include <cstring>.
10410         (Layout::is_debug_info_section): New function.
10411         (Layout::add_comdat): Add new parameters.
10412         (Layout::find_kept_object): New function.
10413         (Layout::Kept_section): New struct.
10414         (Layout::Signatures): Change type of map range.
10415         * object.cc (Relobj::output_section_address): New function.
10416         (Sized_relobj::include_section_group): Add new parameters.  Change
10417         calls to Layout::add_comdat.  Change to build table of kept comdat
10418         groups and table mapping discarded sections to kept sections.
10419         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10420         (Sized_relobj::do_layout): Change calls to include_section_group and
10421         include_linkonce_section.
10422         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10423         value to zero when section is discarded.
10424         (Sized_relobj::map_to_kept_section): New function.
10425         * object.h (Relobj::output_section_address): New function.
10426         (Relobj::Comdat_group): New type.
10427         (Relobj::find_comdat_group): New function.
10428         (Relobj::Comdat_group_table): New type.
10429         (Relobj::Kept_comdat_section): New type.
10430         (Relobj::Kept_comdat_section_table): New type.
10431         (Relobj::add_comdat_group): New function.
10432         (Relobj::set_kept_comdat_section): New function.
10433         (Relobj::get_kept_comdat_section): New function.
10434         (Relobj::comdat_groups_): New field.
10435         (Relobj::kept_comdat_sections_): New field.
10436         (Symbol_value::input_value): Update comment.
10437         (Sized_relobj::map_to_kept_section) New function.
10438         (Sized_relobj::include_linkonce_section): Add new parameter.
10439         * target-reloc.h (Comdat_behavior): New type.
10440         (get_comdat_behavior): New function.
10441         (relocate_section): Add code to map a discarded section to the
10442         corresponding kept section when applying a relocation.
10443
10444 2008-04-30  Craig Silverstein  <[email protected]>
10445
10446         * dwarf_reader.cc (next_generation_count): New static var.
10447         (Addr2line_cache_entry): New struct.
10448         (addr2line_cache): New static var.
10449         (Dwarf_line_info::one_addr2line): Added caching.
10450         (Dwarf_line_info::clear_addr2line_cache): New function.
10451         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10452         cache-size parameter.
10453         (Dwarf_line_info::one_addr2line_cache): New function.
10454         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10455         new cache-size argument to one_addr2line(), and clear cache.
10456
10457 2008-04-28  Cary Coutant  <[email protected]>
10458
10459         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10460         R_386_PC8 relocations.
10461
10462 2008-04-23  Ian Lance Taylor  <[email protected]>
10463
10464         * object.cc (Sized_relobj::include_section_group): Check for
10465         invalid section group.
10466
10467         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10468         header size.
10469
10470         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10471         than read for file header.
10472         * archive.cc (Archive::include_member): Likewise.
10473
10474 2008-04-23  Paolo Bonzini  <[email protected]>
10475
10476         * aclocal.m4: Regenerate.
10477         * configure: Regenerate.
10478
10479 2008-04-19  Ian Lance Taylor  <[email protected]>
10480
10481         * version.cc (version_string): Bump to 1.6.
10482
10483         * testsuite/Makefile.am (many_sections_r_test): New target.
10484         (many_sections_r_test_SOURCES): Remove.
10485         (many_sections_r_test_DEPENDENCIES): Remove.
10486         (many_sections_r_test_LDFLAGS): Remove.
10487         (many_sections_r_test_LDADD): Remove.
10488
10489         * object.cc (Sized_relobj::do_add_symbols): Always pass
10490         local_symbol_count_ to add_from_relobj.
10491
10492         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10493         every thousand variables.
10494         * testsuite/Makefile.in: Rebuild.
10495
10496         * object.cc (Xindex::initialize_symtab_xindex): New function.
10497         (Xindex::read_symtab_xindex): New function.
10498         (Xindex::sym_xindex_to_shndx): New function.
10499         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10500         available.
10501         (Sized_relobj::do_initialize_xindex): New function.
10502         (Sized_relobj::do_read_symbols): Adjust section links.
10503         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10504         parameter.  Change all callers.
10505         (Sized_relobj::include_section_group): Adjust section links and
10506         symbol section indexes.
10507         (Sized_relobj::do_layout): Adjust section links.
10508         (Sized_relobj::do_count_local_symbols): Adjust section links and
10509         symbol section indexes.
10510         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10511         ordinary and special symbols.
10512         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10513         dynsym_xindex parameters.  Change all callers.  Adjust section
10514         links.  Use SHN_XINDEX when needed.
10515         (Sized_relobj::get_symbol_location_info): Adjust section links.
10516         Don't get fooled by special symbols.
10517         * object.h (class Xindex): Define.
10518         (class Object): Add xindex_ parameter.  Declare virtual functoin
10519         do_initialize_xindex.
10520         (Object::adjust_sym_shndx): New function.
10521         (Object::set_xindex): New protected function.
10522         (class Symbol_value): Add is_ordinary_shndx_ field.
10523         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10524         (Symbol_value::value): Assert ordinary section.
10525         (Symbol_value::initialize_input_to_output_map): Likewise.
10526         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10527         Change all callers.
10528         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10529         all callers.
10530         (class Sized_relobj): Update declarations.
10531         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10532         parameter.  Change all callers.
10533         (Sized_relobj::adjust_shndx): New function.
10534         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10535         field.
10536         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10537         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10538         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10539         (Sized_dynobj::read_dynsym_section): Adjust section links.
10540         (Sized_dynobj::read_dynamic): Likewise.
10541         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10542         section links.
10543         (Sized_dynobj::do_initialize_xindex): New function.
10544         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10545         do_initialize_xindex.
10546         (Sized_dynobj::adjust_shndx): New function.
10547         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10548         dynsym_xindex_ fields.
10549         (Layout::finalize): Add a call to set_section_indexes before
10550         creating the symtab sections.
10551         (Layout::set_section_indexes): Don't do anything if the section
10552         already has a section index.
10553         (Layout::create_symtab_sections): Add shnum parameter.  Change
10554         caller.  Create .symtab_shndx section if needed.
10555         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10556         caller.
10557         (Layout::allocated_output_section_count): New function.
10558         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10559         needed.
10560         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10561         fields.  Update declarations.
10562         (Layout::symtab_xindex): New function.
10563         (Layout::dynsym_xindex): New function.
10564         (class Write_symbols_task): Add layout_ field.
10565         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10566         Change caller.
10567         * output.cc (Output_section_headers::Output_section_headers): Add
10568         shstrtab_section parameter.  Change all callers.
10569         (Output_section_headers::do_sized_write): Store overflow values
10570         for section count and section string table section index in
10571         section header zero.
10572         (Output_file_header::do_sized_write): Check for overflow of
10573         section count and section string table section index.
10574         (Output_symtab_xindex::do_write): New function.
10575         (Output_symtab_xindex::endian_do_write): New function.
10576         * output.h (class Output_section_headers): Add shstrtab_section_.
10577         Update declarations.
10578         (class Output_symtab_xindex): Define.
10579         (Output_section::has_out_shndx): New function.
10580         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10581         field.
10582         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10583         Change all callers.
10584         (Sized_symbol::init): Likewise.
10585         (Symbol::output_section): Check for ordinary symbol.
10586         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10587         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10588         callers.
10589         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10590         Change all callers.  Simplify handling of symbols from sections
10591         not included in the link.
10592         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10593         distinction.
10594         (Weak_alias_sorter::operator()): Assert that symbols are
10595         ordinary.
10596         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10597         distinction.
10598         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10599         parameters.  Change all callers.
10600         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10601         symbol distinction.  Use SHN_XINDEX when needed.
10602         (Symbol_table::write_section_symbol): Add symtab_xindex
10603         parameter.  Change all callers.
10604         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10605         SHN_XINDEX when needed.
10606         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10607         declarations.
10608         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10609         (Symbol::is_defined): Check is_ordinary.
10610         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10611         (Symbol::is_absolute, Symbol::is_common): Likewise.
10612         (class Sized_symbol): Update declarations.
10613         (class Symbol_table): Update declarations.
10614         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10615         parameters.  Change all callers.
10616         (Sized_symbol::override): Likewise.
10617         (Symbol_table::override): Likewise.
10618         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10619         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10620         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10621         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10622         to be in an ordinary section.
10623         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10624         object and is_ordinary parameters.  Change all callers.
10625         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10626         Change all callers.  Don't add undefined or non-ordinary symbols
10627         to reloc_map_.
10628         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10629         Change all callers.
10630         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10631         declarations.
10632         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10633         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10634         (Sized_relobj::relocate_sections): Likewise.
10635         * target-reloc.h (scan_relocs): Adjust section symbol index.
10636         (scan_relocatable_relocs): Likewise.
10637         * i386.cc (Scan::local): Check for ordinary symbols.
10638         * sparc.cc (Scan::local): Likewise.
10639         * x86_64.cc (Scan::local): Likewise.
10640         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10641         to symbol_section_and_value.
10642         * testsuite/many_sections_test.cc: New file.
10643         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10644         (check_PROGRAMS): Add many_sections_test.
10645         (many_sections_test_SOURCES): Define.
10646         (many_sections_test_DEPENDENCIES): Define.
10647         (many_sections_test_LDFLAGS): Define.
10648         (BUILT_SOURCES): Add many_sections_define.h.
10649         (many_sections_define.h): New target.
10650         (BUILT_SOURCES): Add many_sections_check.h.
10651         (many_sections_check.h): New target.
10652         (check_PROGRAMS): Add many_sections_r_test.
10653         (many_sections_r_test_SOURCES): Define.
10654         (many_sections_r_test_DEPENDENCIES): Define.
10655         (many_sections_r_test_LDFLAGS): Define.
10656         (many_sections_r_test_LDADD): Define.
10657         (many_sections_r_test.o): New target.
10658         * testsuite/Makefile.in: Rebuild.
10659
10660 2008-04-17  Cary Coutant  <[email protected]>
10661
10662         * errors.cc (Errors::info): New function.
10663         (gold_info): New function.
10664         * errors.h (Errors::info): New function.
10665         * gold.h (gold_info): New function.
10666         * object.cc (Input_objects::add_object): Print trace output.
10667         * options.cc (options::parse_set): New function.
10668         (General_options::parse_wrap): Deleted.
10669         (General_options::General_options): Deleted initializer.
10670         * options.h (options::String_set): New typedef.
10671         (options::parse_set): New function.
10672         (DEFINE_set): New macro.
10673         (General_options::wrap): Changed to use DEFINE_set. Changed
10674         callers of any_wrap_symbols and is_wrap_symbol.
10675         (General_options::trace, General_options::trace_symbol):
10676         New options.
10677         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10678         (General_options::wrap_symbols_): Deleted.
10679         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10680
10681 2008-04-17  David S. Miller  <[email protected]>
10682
10683         * options.cc (General_options::parse_V): New function.
10684         * options.h: Add entries for -V and -Qy.
10685
10686 2008-04-17  Ian Lance Taylor  <[email protected]>
10687
10688         * common.cc (Symbol_table::allocate_commons): Remove options
10689         parameter.  Change caller.
10690         (Symbol_table::do_allocate_commons): Remove options parameter.
10691         Change caller.  Just call do_allocate_commons_list twice.
10692         (Symbol_table::do_allocate_commons_list): New function, broken out
10693         of do_allocate_commons.
10694         * common.h (class Allocate_commons_task): Remove options_ field.
10695         Update constructor.
10696         * symtab.cc (Symbol_table::Symbol_table): Initialize
10697         tls_commons_.
10698         (Symbol_table::add_from_object): Put TLS common symbols on
10699         tls_commons_ list.
10700         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10701         which are IN_OUTPUT_DATA.
10702         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10703         allocate_commons and do_allocate_commons declarations.  Declare
10704         do_allocate_commons_list.
10705         * gold.cc (queue_middle_tasks): Update creation of
10706         Allocate_commons_task to not pass options.
10707         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10708         (TLS_TEST_C_FLAGS): New variable.
10709         (tls_test_c_pic.o): New target.
10710         (tls_test_shared.so): Link in tls_test_c_pic.o.
10711         (tls_test_c_pic_ie.o): New target.
10712         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10713         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10714         (tls_test_c.o): New target.
10715         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10716         (tls_pic_test_LDADD): Likewise.
10717         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10718         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10719         (tls_test_c_gnu2.o): New target.
10720         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10721         tls_test_c_gnu2.o.
10722         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10723         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10724         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10725         * testsuite/tls_test.cc: Include "config.h".
10726         (t_last): Call t11_last.
10727         * testsuite/tls_test.h (t11, t11_last): Declare.
10728         * testsuite/tls_test_c.c: New file.
10729         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10730         * configure.ac: Check for OpenMP support.
10731         * configure, config.in, Makefile.in: Rebuild.
10732         * testsuite/Makefile.in: Rebuild.
10733
10734 2008-04-16  Cary Coutant  <[email protected]>
10735
10736         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10737         (Target_i386::tls_base_symbol_defined_): New field.
10738         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10739         (Target_i386::Scan::global): Likewise.
10740         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10741         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10742         (Target_x86_64::tls_base_symbol_defined_): New field.
10743         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10744         (Target_x86_64::Scan::global): Likewise.
10745
10746 2008-04-16  Cary Coutant  <[email protected]>
10747
10748         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10749         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10750         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10751         building shared libraries.
10752         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10753         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10754         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10755         * testsuite/Makefile.in: Rebuild.
10756         * testsuite/weak_undef.h: New file.
10757         * testsuite/weak_undef_file1.cc: Add extra test cases.
10758         * testsuite/weak_undef_file2.cc: Likewise.
10759         * testsuite/weak_undef_test.cc: Likewise.
10760
10761 2008-04-16  David S. Miller  <[email protected]>
10762
10763         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10764         Add issued_non_pic_error_ field.  Declare check_non_pic.
10765         (Target_sparc::Scan::check_non_pic): New function.
10766         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10767         (Target_sparc::Scan::global): Likewise.
10768
10769         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10770         * configure: Rebuild.
10771
10772         * options.h (DEFINE_enable): New macro.
10773         (new_dtags): New enable option.
10774         (initfirst, interpose, loadfltr, nodefaultlib,
10775         nodelete, nodlopen, nodump): New -z options.
10776         * layout.cc (Layout:finish_dynamic_section): If new
10777         dtags enabled, emit DT_RUNPATH.  Also, emit a
10778         DT_FLAGS_1 containing any specified -z flags.
10779
10780 2008-04-16  Ian Lance Taylor  <[email protected]>
10781
10782         * copy-relocs.cc: New file.
10783         * copy-relocs.h: New file.
10784         * reloc.cc: Remove Copy_relocs code.
10785         * reloc.h: Likewise.
10786         * reloc-types.h (struct Reloc_types) [both versions]: Add
10787         get_reloc_addend_noerror.
10788         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10789         variants of add_global which take an addend which must be zero.
10790         * i386.cc: Include "copy-relocs.h".
10791         (class Target_i386): Change type of copy_relocs_ to variable,
10792         update initializer.
10793         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10794         Change all callers.
10795         (Target_i386::do_finalize_sections): Change handling of
10796         copy_relocs_.
10797         * sparc.cc: Include "copy-relocs.h".
10798         (class Target_sparc): Change type of copy_relocs_ to variable,
10799         update initializer.
10800         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10801         Change all callers.
10802         (Target_sparc::do_finalize_sections): Change handling of
10803         copy_relocs_.
10804         * x86_64.cc: Include "copy-relocs.h".
10805         (class Target_x86_64): Change type of copy_relocs_ to variable,
10806         update initializer.
10807         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10808         class.  Change all callers.
10809         (Target_x86_64::do_finalize_sections): Change handling of
10810         copy_relocs_.
10811         * Makefile.am (CCFILES): Add copy-relocs.cc.
10812         (HFILES): Add copy-relocs.h.
10813
10814         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10815
10816         * testsuite/script_test_4.sh: Permit leading zeroes.
10817
10818 2008-04-15  Ian Lance Taylor  <[email protected]>
10819
10820         * script-sections.cc (Script_sections::create_segments): Use
10821         header_size_adjustment even when there is enough room for the
10822         headers.
10823         * testsuite/script_test_4.sh: New file.
10824         * testsuite/script_test_4.t: New file.
10825         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10826         (check_DATA): Add script_test_4.stdout.
10827         (MOSTLYCLEANFILES): Likewise.
10828         (script_test_4): New target.
10829         (script_test_4.stdout): New target.
10830         * testsuite/Makefile.in: Rebuild.
10831
10832         * sparc.cc: Add definitions for Output_data_plt_sparc class
10833         constants.
10834
10835 2008-04-14  David S. Miller  <[email protected]>
10836
10837         * sparc.cc: New file.
10838         * Makefile.am (TARGETSOURCES): Add sparc.cc
10839         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10840         * configure.tgt: Document targ_extra_size and
10841         targ_extra_big_endian.  Add entries for sparc-* and
10842         sparc64-*.
10843         * configure.ac: Handle targ_extra_size and
10844         targ_extra_big_endian.
10845         * Makefile.in: Rebuild.
10846         * configure: Likewise.
10847         * po/POTFILES.in: Likewise.
10848         * po/gold.pot: Likewise.
10849
10850 2008-04-14  Ian Lance Taylor  <[email protected]>
10851
10852         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10853         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10854         in the name/type/flags to section mapping.  Don't call
10855         allocate_output_section.
10856         (Layout::choose_output_section): Change parameter from adjust_name
10857         to is_input_section.  Don't permit input sections after sections
10858         are attached to segments.  Don't call allocate_output_section.
10859         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10860         not write_enable_output_section.
10861         (Layout::make_output_section): Don't push to
10862         unattached_section_list_ nor call attach_to_segment.  Call
10863         attach_section_to_segment if sections are attached.
10864         (Layout::attach_sections_to_segments): New function.
10865         (Layout::attach_section_to_segment): New function.
10866         (Layout::attach_allocated_section_to_segment): Rename from
10867         attach_to_segment.  Remove flags parameter.
10868         (Layout::allocate_output_section): Remove function.
10869         (Layout::write_enable_output_section): Remove function.
10870         * layout.h (class Layout): Update for above changes.  Add new
10871         field sections_are_attached_.
10872         * output.h (Output_section::update_flags_for_input_section): New
10873         function.
10874         * output.cc (Output_section::add_input_section): Call
10875         update_flags_for_input_section.
10876         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10877
10878 2008-04-11  Cary Coutant  <[email protected]>
10879
10880         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10881         thought unnecessary.
10882         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10883
10884 2008-04-11  Ian Lance Taylor  <[email protected]>
10885
10886         * output.h (class Output_section_data): Remove inline definition
10887         of set_addralign.
10888         * output.cc (Output_section_data::set_addralign): New function.
10889
10890 2008-04-11  Cary Coutant  <[email protected]>
10891
10892         Add support for TLS descriptors for i386 and x86_64.
10893         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10894         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10895         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10896         GOT_TYPE_TLS_DESC.
10897         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10898         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10899         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10900         relocations.
10901         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10902         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10903         Fix problem with initial-exec relocations.
10904         (Target_i386::Relocate::relocate_tls): Likewise.
10905         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10906         relaxation.
10907         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10908         support for section-plus-offset dynamic table entries.
10909         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10910         (Output_data_dynamic::Dynamic_entry): Add support for
10911         section-plus-offset dynamic table entries.
10912         (Output_data_dynamic::Classification): Likewise.
10913         (Output_data_dynamic::classification_): Renamed offset_.
10914         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10915         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10916         (Target_x86_64::make_plt_section): New function.
10917         (Target_x86_64::reserve_tlsdesc_entries): New function.
10918         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10919         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10920         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10921         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10922         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10923         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10924         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10925         add extra PLT entry for TLS descriptors.
10926         (Output_data_plt_x86_64::got_): New field.
10927         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10928         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10929         fields.
10930         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10931         descriptors.
10932         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10933         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10934         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10935         R_386_TLS_DESC_CALL relocations.
10936         (Target_x86_64::Scan::global): Likewise.
10937         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10938         for TLS descriptors.
10939         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10940         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10941         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10942         GD-to-IE relaxation.
10943         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10944         and TLS_DESCRIPTORS.
10945         * Makefile.in: Rebuild.
10946         * configure: Rebuild.
10947         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10948         (tls_test_shared2.so): New target.
10949         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10950         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10951         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10952         (tls_shared_gd_to_ie_test_LDADD): New variable.
10953         (tls_shared_gnu2_gd_to_ie_test): New target.
10954         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10955         New targets.
10956         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10957         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10958         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10959         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10960         (tls_shared_gnu2_test): New target.
10961         (tls_test_gnu2_shared.so): New target.
10962         (tls_shared_gnu2_test_SOURCES): New variable.
10963         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10964         (tls_shared_gnu2_test_LDFLAGS): New variable.
10965         (tls_shared_gnu2_test_LDADD): New variable.
10966         * testsuite/Makefile.in: Rebuild.
10967         * testsuite/Makefile.
10968
10969 2008-04-11  Ian Lance Taylor  <[email protected]>
10970
10971         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10972         justsyms.t.
10973         * testsuite/Makefile.in: Rebuild.
10974
10975         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10976         long.
10977         * testsuite/script_test_2.cc (main): Adjust test.
10978
10979 2008-04-11  David S. Miller  <[email protected]>
10980             Ian Lance Taylor  <[email protected]>
10981
10982         * options.h (General_options): Add entries for '-Y' and
10983         '-relax'.
10984         * options.cc (General_options:finalize): If -Y was used, add those
10985         entries to the library path instead of the default "/lib" and
10986         "/usr/lib".
10987
10988 2008-04-11  David S. Miller  <[email protected]>
10989
10990         * testsuite/justsyms.t: Start at 0x100.
10991         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10992         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10993         long.
10994         * testsuite/script_test_2.cc: Adjust string and section length
10995         checks.
10996
10997 2008-04-09  Ian Lance Taylor  <[email protected]>
10998
10999         PR gold/5996
11000         * script-sections.cc (Sections_element::allocate_to_segment): Add
11001         orphan parameter.
11002         (Output_section_definition::allocate_to_segment): Likewise.
11003         (Orphan_output_section::allocate_to_segment): Likewise.
11004         (Script_sections::attach_sections_using_phdrs_clause): Don't
11005         propagate non-PT_LOAD segments to orphan sections.
11006         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11007         readelf rather than objdump.
11008         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11009         .interp section and PT_INTERP segment are the same size.
11010         * testsuite/Makefile.in: Rebuild.
11011
11012         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11013         aliases for symbols defined in the same object.
11014         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11015         (weak_alias_test_SOURCES): New variable.
11016         (weak_alias_test_DEPENDENCIES): New variable.
11017         (weak_alias_test_LDFLAGS): New variable.
11018         (weak_alias_test_LDADD): New variable.
11019         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11020         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11021         (weak_alias_test_3.o): New target.
11022         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11023         * testsuite/weak_alias_test_main.cc: New file.
11024         * testsuite/weak_alias_test_1.cc: New file.
11025         * testsuite/weak_alias_test_2.cc: New file.
11026         * testsuite/weak_alias_test_3.cc: New file.
11027
11028 2008-04-08  Ian Lance Taylor  <[email protected]>
11029
11030         * options.h (class General_options): Add --noinhibit-exec option.
11031         * main.cc (main): Check --noinhibit-exec.
11032
11033         * options.h (class General_options): Define --wrap as a special
11034         option.  Add wrap_symbols_ field.
11035         (General_options::any_wrap_symbols): New function.
11036         (General_options::is_wrap_symbol): New function.
11037         * options.cc (General_options::parse_wrap): New function.
11038         (General_options::General_options): Initialize wrap_symbols_.
11039         * symtab.cc (Symbol_table::wrap_symbol): New function.
11040         (Symbol_table::add_from_object): Handle --wrap.
11041         * symtab.h (class Symbol_table): Declare wrap_symbol.
11042         * target.h (Target::wrap_char): New function.
11043         (Target::Target_info): Add wrap_char field.
11044         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11045         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11046         * testsuite/testfile.cc (Target_test::test_target_info):
11047         Likewise.
11048
11049         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11050         there is one.
11051
11052         * layout.h (class Layout): Add added_eh_frame_data_ field.
11053         * layout.cc (Layout::Layout): Initialize new field.
11054         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11055         output section until we find a section we merged successfully.
11056         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11057         that the size be non-zero.
11058
11059         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11060         qualifier.
11061
11062 2008-04-08  Craig Silverstein  <[email protected]>
11063
11064         * configure.ac: Export new conditional variable HAVE_ZLIB.
11065         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11066         on HAVE_ZLIB.
11067         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11068         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11069
11070 2008-04-07  Ian Lance Taylor  <[email protected]>
11071
11072         * version.cc (version_string): Set to "1.5".
11073
11074         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11075         Add issued_non_pic_error_ field.  Declare check_non_pic.
11076         (Target_x86_64::Scan::check_non_pic): New function.
11077         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11078         (Target_x86_64::Scan::global): Likewise.
11079
11080         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11081         addend parameter.  Change caller.  Handle merge sections.
11082         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11083         Address to Addend.  Don't add in the result of
11084         local_section_offset, pass down the addend and use the returned
11085         value.
11086         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11087         Update declarations of local_section_offset and symbol_value.
11088         * testsuite/two_file_test_1.cc (t18): New function.
11089         * testsuite/two_file_test_2.cc (f18): New function.
11090         * testsuite/two_file_test_main.cc (main): Call t18.
11091         * testsuite/two_file_test.h (t18, f18): Declare.
11092
11093         * configure.ac: Don't test for objdump, c++filt, or readelf.
11094         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11095         conditionals.
11096         (TEST_READELF): New variable.
11097         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11098         (check_PROGRAMS): Add two_file_strip_test.
11099         (two_file_strip_test): New target.
11100         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11101         (two_file_same_shared_strip_test_SOURCES): New variable.
11102         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11103         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11104         (two_file_same_shared_strip_test_LDADD): New variable.
11105         (two_file_shared_strip.so): New target.
11106         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11107         (ver_test_5.syms, ver_test_7.syms): Likewise.
11108         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11109         (strip_test_3.stdout): Use TEST_OBJDUMP.
11110         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11111
11112 2008-04-04  Cary Coutant  <[email protected]>
11113
11114         * symtab.h (Symbol::is_weak_undefined): New function.
11115         (Symbol::is_strong_undefined): New function.
11116         (Symbol::is_absolute): New function.
11117         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11118         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11119         absolute symbols.
11120         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11121         (weak_undef_test): New target.
11122         * testsuite/Makefile.in: Rebuild.
11123         * testsuite/weak_undef_file1.cc: New file.
11124         * testsuite/weak_undef_file2.cc: New file.
11125         * testsuite/weak_undef_test.cc: New file.
11126
11127 2008-04-03  Craig Silverstein  <[email protected]>
11128
11129         * compressed_output.h (class Output_compressed_section): Use
11130         unsigned buffer.
11131         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11132         add zlib header.
11133         (zlib_compressed_suffix): Removed.
11134         (Output_compressed_section::set_final_data_size): Use unsigned
11135         buffers.
11136         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11137         Fix linker invocation.
11138         (flagstest_o_specialfile_and_compress_debug_sections):
11139         Likewise.
11140         * testsuite/Makefile.in: Regenerated.
11141
11142 2008-04-02  David S. Miller  <[email protected]>
11143
11144         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11145         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11146
11147 2008-04-02  Craig Silverstein  <[email protected]>
11148
11149         * TODO: New file.
11150
11151 2008-04-02  Ian Lance Taylor  <[email protected]>
11152
11153         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11154         parameters.  Update for new key type to views_.  Change all
11155         callers.
11156         (File_read::read): Adjust for byteshift in returned view.
11157         (File_read::add_view): New function, broken out of
11158         find_and_make_view.
11159         (File_read::make_view): New function, broken out of
11160         find_and_make_view.
11161         (File_read::find_or_make_view): Add offset and aligned
11162         parameters.  Rewrite accordingly.  Change all callers.
11163         (File_read::get_view): Add offset and aligned parameters.  Adjust
11164         for byteshift in return value.
11165         (File_read::get_lasting_view): Likewise.
11166         * fileread.h (class File_read): Update declarations.
11167         (class File_read::View): Add byteshift_ field.  Add byteshift to
11168         constructor.  Add byteshift method.
11169         * archive.h (Archive::clear_uncached_views): New function.
11170         (Archive::get_view): Add aligned parameter.  Change all callers.
11171         * object.h (Object::get_view): Add aligned parameter.  Change all
11172         callers.
11173         (Object::get_lasting_view): Likewise.
11174
11175         * fileread.cc (File_read::release): Don't call clear_views if
11176         there are multiple objects.
11177         * fileread.h (File_read::clear_uncached_views): New function.
11178         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11179         on the archive.
11180
11181 2008-03-31  Cary Coutant  <[email protected]>
11182
11183         Add thin archive support.
11184         * archive.cc (Archive::armagt): New const.
11185         (Archive::setup): Remove task parameter and calls to unlock.
11186         (Archive::unlock_nested_archives): New function.
11187         (Archive::read_header): Add nested_off parameter. Change
11188         all callers.
11189         (Archive::interpret_header): Likewise.
11190         (Archive::include_all_members): Change to handle thin
11191         archives.
11192         (Archive::include_member): Likewise.
11193         * archive.h (Archive::Archive): Add new parameters and
11194         initializers.
11195         (Archive::armagt): New const.
11196         (Archive::setup): Remove task parameter.
11197         (Archive::unlock_nested_archives): New function.
11198         (Archive::read_header): Add nested_off parameter.
11199         (Archive::interpret_header): Likewise.
11200         (Archive::Nested_archive_table): New typedef.
11201         (Archive::is_thin_archive_): New field.
11202         (Archive::nested_archives_): New field.
11203         (Archive::options_): New field.
11204         (Archive::dirpath_): New field.
11205         (Archive::task_): New field.
11206         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11207         for thin archives.  Pass additional parameters to
11208         Archive::Archive.  Unlock the archive file after calling
11209         Archive::setup.
11210
11211 2008-03-29  Ian Lance Taylor  <[email protected]>
11212
11213         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11214         version symbol to be local.
11215         * testsuite/ver_test_4.sh: New file.
11216         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11217         (check_DATA): Add ver_test_4.syms.
11218         (ver_test_4.syms): New target.
11219         * testsuite/Makefile.in: Rebuild.
11220
11221         * output.cc
11222         (Output_section::Input_section_sort_entry::has_priority): New
11223         function.
11224         (Output_section::Input_section_sort_entry::match_file_name): New
11225         function.
11226         (Output_section::Input_section_sort_entry::match_section_name):
11227         Remove.
11228         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11229         Remove.
11230         (Output_section::Input_section_sort_entry::match_section_file):
11231         Remove.
11232         (Output_section::Input_section_sort_compare::operator()): Rewrite
11233         using new Input_section_sort_entry functions.  Sort crtbegin and
11234         crtend first.  Sort sections with no priority before sections with
11235         a priority.
11236         * testsuite/initpri1.c (d3): Check j != 4.
11237         (cd5): New constructor/destructor function.
11238         (main): Check j != 2.
11239
11240         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11241         new symbol when resolving, don't call set_is_default.
11242         * testsuite/ver_test_7.cc: New file.
11243         * testsuite/ver_test_7.sh: New file.
11244         * testsuite/Makefile.am (ver_test_7.so): New target.
11245         (ver_test_7.o): New target.
11246         (check_SCRIPTS): Add ver_test_7.sh.
11247         (check_DATA): Add ver_test_7.syms.
11248         (ver_test_7.syms): New target.
11249
11250 2008-03-28  Ian Lance Taylor  <[email protected]>
11251
11252         * layout.cc (Layout::layout): If we see an input section with a
11253         name that needs sorting, set the must_sort flag for the output
11254         section.
11255         (Layout::make_output_section): If the name of the output section
11256         indicates that it might require sorting, set the may_sort flag.
11257         * output.h (Output_section::may_sort_attached_input_sections): New
11258         function.
11259         (Output_section::set_may_sort_attached_input_sections): New
11260         function.
11261         (Output_section::must_sort_attached_input_sections): New
11262         function.
11263         (Output_section::set_must_sort_attached_input_sections): New
11264         function.
11265         (class Output_section): Declare Input_section_sort_entry.  Define
11266         Input_section_sort_compare.  Declare
11267         sort_attached_input_sections.  Add new fields:
11268         may_sort_attached_input_sections_,
11269         must_sort_attached_input_sections_,
11270         attached_input_sections_are_sorted_.
11271         * output.cc (Output_section::Output_section): Initialize new
11272         fields.
11273         (Output_section::add_input_section): Add an entry to
11274         input_sections_ if may_sort or must_sort are true.
11275         (Output_section::set_final_data_size): Call
11276         sort_attached_input_sections if necessary.
11277         (Output_section::Input_section_sort_entry): Define new class.
11278         (Output_section::Input_section_sort_compare::operator()): New
11279         function.
11280         (Output_section::sort_attached_input_sections): New function.
11281         * configure.ac: Check whether the compiler supports constructor
11282         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11283         * testsuite/initpri1.c: New file.
11284         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11285         CONSTRUCTOR_PRIORITY.
11286         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11287         (initpri1_LDFLAGS): New variable.
11288         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11289
11290 2008-03-27  Ian Lance Taylor  <[email protected]>
11291
11292         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11293         * testsuite/common_test_1.c: New file.
11294         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11295         (common_test_1_SOURCES): New variable.
11296         (common_test_1_DEPENDENCIES): New variable.
11297         (common_test_1_LDFLAGS): New variable.
11298
11299         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11300         and commons_ correctly when NAME/VERSION does not override
11301         NAME/NULL.
11302         * testsuite/ver_test_6.c: New file.
11303         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11304         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11305         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11306
11307 2008-03-26  Ian Lance Taylor  <[email protected]>
11308
11309         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11310         of an undefined symbol from a version script.
11311         * testsuite/Makefile.am (ver_test_5.so): New target.
11312         (ver_test_5.o): New target.
11313         (check_SCRIPTS): Add ver_test_5.sh.
11314         (check_DATA): Add ver_test_5.syms.
11315         (ver_test_5.syms): New target.
11316         * testsuite/ver_test_5.cc: New file.
11317         * testsuite/ver_test_5.script: New file.
11318         * testsuite/ver_test_5.sh: New file.
11319         * Makefile.in, testsuite/Makefile.in: Rebuild.
11320
11321         PR gold/5986
11322         Fix problems building gold with gcc 4.3.0.
11323         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11324         (gold_error_at_location, gold_warning_at_location): Use it.
11325         * configure.ac: Check whether we can compile and use a template
11326         function with a printf attribute.
11327         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11328         when jumping over bytes.
11329         * object.cc: Instantiate Object::read_section_data.
11330         * debug.h: Include <cstring>
11331         * dwarf_reader.cc: Include <algorithm>
11332         * main.cc: Include <cstring>.
11333         * options.cc: Include <cstring>.
11334         * output.cc: Include <cstring>.
11335         * script.cc: Include <cstring>.
11336         * script.h: Include <string>.
11337         * symtab.cc: Include <cstring> and <algorithm>.
11338         * target-select.cc: Include <cstring>.
11339         * version.cc: Include <string>.
11340         * testsuite/testmain.cc: Include <cstdlib>.
11341         * configure, config.in: Rebuild.
11342
11343 2008-03-25  Ian Lance Taylor  <[email protected]>
11344
11345         * options.cc: Include "../bfd/bfdver.h".
11346         (options::help): Print bug reporting address.
11347
11348         * version.cc (print_version): Adjust output for current value of
11349         BFD_VERSION_STRING.
11350
11351         * NEWS: New file.
11352
11353         * options.cc (options::help): Print list of supported targets.
11354         * target-select.h: Include <vector>.
11355         (class Target_selector): Make machine_, size_, and is_big_endian_
11356         fields const.  Add bfd_name_ and instantiated_target_ fields.
11357         (Target_selector::Target_selector): Add bfd_name parameter.
11358         (Target_selector::recognize): Make non-virtual, call
11359         do_recognize.
11360         (Target_selector::recognize_by_name): Make non-virtual, call
11361         do_recognize_by_name.
11362         (Target_selector::supported_names): New function.
11363         (Target_selector::bfd_name): New function.
11364         (Target_selector::do_instantiate_target): New pure virtual
11365         function.
11366         (Target_selector::do_recognize): New virtual function.
11367         (Target_selector::do_recognize_by_name): New virtual function.
11368         (Target_selector::instantiate_target): New private function.
11369         (supported_target_names): Declare.
11370         * target-select.cc (Target_selector::Target_selector): Update for
11371         new parameter and fields.
11372         (select_target_by_name): Check that the name matches before
11373         calling recognize_by_name.
11374         (supported_target_names): New function.
11375         * i386.cc (class Target_selector_i386): Update Target_selector
11376         constructor call.  Remove recognize and recognize_by_name.  Add
11377         do_instantiate_target.
11378         * x86_64.cc (class Target_selector_x86_64): Likewise.
11379         * testsuite/testfile.cc (class Target_selector_test): Update for
11380         changes to Target_selector.
11381
11382         * README: Rewrite, with some notes on unsupported features.
11383
11384 2008-03-24  Cary Coutant  <[email protected]>
11385
11386         * i386.cc (Target_i386::Got_type): New enum declaration.
11387         (Target_i386::Scan::local): Updated callers of Output_data_got
11388         member functions.
11389         (Target_i386::Scan::global): Likewise.
11390         (Target_i386::Relocate::relocate): Likewise.
11391         (Target_i386::Relocate::relocate_tls): Likewise.
11392         * object.h (Got_offset_list): New class.
11393         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11394         (Sized_relobj::local_got_offset): Likewise.
11395         (Sized_relobj::set_local_got_offset): Likewise.
11396         (Sized_relobj::local_has_tls_got_offset): Removed.
11397         (Sized_relobj::local_tls_got_offset): Removed.
11398         (Sized_relobj::set_local_tls_got_offset): Removed.
11399         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11400         * output.cc (Output_data_got::add_global): Added got_type parameter.
11401         (Output_data_got::add_global_with_rel): Likewise.
11402         (Output_data_got::add_global_with_rela): Likewise.
11403         (Output_data_got::add_global_pair_with_rel): New function.
11404         (Output_data_got::add_global_pair_with_rela): New function.
11405         (Output_data_got::add_local): Added got_type parameter.
11406         (Output_data_got::add_local_with_rel): Likewise.
11407         (Output_data_got::add_local_with_rela): Likewise.
11408         (Output_data_got::add_local_pair_with_rel): New function.
11409         (Output_data_got::add_local_pair_with_rela): New function.
11410         (Output_data_got::add_global_tls): Removed.
11411         (Output_data_got::add_global_tls_with_rel): Removed.
11412         (Output_data_got::add_global_tls_with_rela): Removed.
11413         (Output_data_got::add_local_tls): Removed.
11414         (Output_data_got::add_local_tls_with_rel): Removed.
11415         (Output_data_got::add_local_tls_with_rela): Removed.
11416         * output.h (Output_data_got::add_global): Added got_type parameter.
11417         (Output_data_got::add_global_with_rel): Likewise.
11418         (Output_data_got::add_global_with_rela): Likewise.
11419         (Output_data_got::add_global_pair_with_rel): New function.
11420         (Output_data_got::add_global_pair_with_rela): New function.
11421         (Output_data_got::add_local): Added got_type parameter.
11422         (Output_data_got::add_local_with_rel): Likewise.
11423         (Output_data_got::add_local_with_rela): Likewise.
11424         (Output_data_got::add_local_pair_with_rel): New function.
11425         (Output_data_got::add_local_pair_with_rela): New function.
11426         (Output_data_got::add_global_tls): Removed.
11427         (Output_data_got::add_global_tls_with_rel): Removed.
11428         (Output_data_got::add_global_tls_with_rela): Removed.
11429         (Output_data_got::add_local_tls): Removed.
11430         (Output_data_got::add_local_tls_with_rel): Removed.
11431         (Output_data_got::add_local_tls_with_rela): Removed.
11432         * resolve.cc (Symbol::override_base_with_special): Removed
11433         reference to has_got_offset_ field.
11434         * symtab.cc (Symbol::init_fields): Replaced initialization
11435         of got_offset_ with got_offsets_.  Removed initialization
11436         of has_got_offset_
11437         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11438         (Symbol::got_offset): Likewise.
11439         (Symbol::set_got_offset): Likewise.
11440         (Symbol::has_tls_got_offset): Removed.
11441         (Symbol::tls_got_offset): Removed.
11442         (Symbol::set_tls_got_offset): Removed.
11443         (Symbol::got_offset_): Removed.
11444         (Symbol::tls_mod_got_offset_): Removed.
11445         (Symbol::tls_pair_got_offset_): Removed.
11446         (Symbol::got_offsets_): New field.
11447         (Symbol::has_got_offset): Removed.
11448         (Symbol::has_tls_mod_got_offset): Removed.
11449         (Symbol::has_tls_pair_got_offset): Removed.
11450         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11451         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11452         member functions.
11453         (Target_x86_64::Scan::global): Likewise.
11454         (Target_x86_64::Relocate::relocate): Likewise.
11455         (Target_x86_64::Relocate::relocate_tls): Likewise.
11456
11457 2008-03-25  Ben Elliston  <[email protected]>
11458
11459         * yyscript.y: Fix spelling error in comment.
11460
11461 2008-03-24  Ian Lance Taylor  <[email protected]>
11462
11463         * options.h (class General_options): Define build_id option.
11464         * layout.h (class Layout): Declare write_build_id, create_note,
11465         create_build_id.  Add build_id_note_ member.
11466         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11467         "libiberty.h", "md5.h", "sha1.h".
11468         (Layout::Layout): Initialize eh_frame_data_,
11469         eh_frame_hdr_section_, and build_id_note_.
11470         (Layout::finalize): Call create_build_id.
11471         (Layout::create_note): New function, broken out of
11472         Layout::create_gold_note.
11473         (Layout::create_gold_note): Call create_note.
11474         (Layout::create_build_id): New function.
11475         (Layout::write_build_id): New function.
11476         (Close_task_runner::run): Call write_build_id.
11477
11478         * x86_64.cc: Correct license to GPLv3.
11479
11480 2008-03-23  Ian Lance Taylor  <[email protected]>
11481
11482         * options.cc: Include "demangle.h".
11483         (parse_optional_string): New function.
11484         (parse_long_option): Handle takes_optional_argument.
11485         (parse_short_option): Update dash_z initializer.  Handle
11486         takes_optional_argument.
11487         (General_options::General_options): Initialize do_demangle_.
11488         (General_options::finalize): Set do_demangle_.  Handle demangling
11489         style.
11490         * options.h (parse_optional_string): Declare.
11491         (struct One_option): Add optional_arg field.  Update constructor.
11492         Update call constructor calls.  Add takes_optional_argument
11493         function.
11494         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11495         (DEFINE_optional_string): Define.
11496         (General_options::demangle): Change from DEFINE_bool to
11497         DEFINE_optional_string.
11498         (General_options::no_demangle): New function.
11499         (General_options::do_demangle): New function.
11500         (General_options::set_do_demangle): New function.
11501         (General_options::execstack_status_): Move definition to end of
11502         class definition.
11503         (General_options::static_): Likewise.
11504         (General_options::do_demangle_): New field.
11505         * object.cc (big_endian>::get_symbol_location_info): Call
11506         Options::do_demangle, not Options::demangle.
11507         * symtab.cc (demangle): Likewise.
11508
11509 2008-03-22  Ian Lance Taylor  <[email protected]>
11510
11511         * gold.h: Include <cstddef> and <sys/types.h>
11512         * options.h: Include <cstring>.
11513
11514 2008-03-21  Ian Lance Taylor  <[email protected]>
11515
11516         * Added source code to GNU binutils.
This page took 0.69383 seconds and 4 git commands to generate.