2011-06-28 Tristan Gingold <gingold@adacore.com>
[binutils.git] / gold / ChangeLog
blob1ec3942f688d48ba113e807f43c36002947aba2d
1 2011-06-27  Ian Lance Taylor  <iant@google.com>
3         * symtab.cc (Symbol::versioned_name): New function.
4         (Symbol_table::add_to_final_symtab): Use versioned_name when
5         appropriate.
6         (Symbol_table::sized_write_symbol): Likewise.
7         * symtab.h (class Symbol): Declare versioned_name.
8         * stringpool.h (class Stringpool_template): Add variant of add
9         which takes a std::basic_string.
10         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
11         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
12         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
13         (ver_test_12.o): New target.
14         * testsuite/Makefile.in: Rebuild.
16 2011-06-27  Doug Kwan  <dougkwan@google.com>
18         * arm.cc (Arm_relocate_functions::thm_jump8,
19         Arm_relocate_functions::thm_jump11): Use a wider signed
20         type to compute offset.
21         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
22         arm_thm_jump8.
23         * testsuite/Makefile.in: Regenerate.
24         * testsuite/arm_branch_in_range.sh: Check test results of
25         arm_thm_jump11 and arm_thm_jump8.
26         * testsuite/arm_thm_jump11.s: New test source file.
27         * testsuite/arm_thm_jump11.t: New linker script.
28         * testsuite/arm_thm_jump8.s: New test source file.
29         * testsuite/arm_thm_jump8.t: New linker script.
31 2011-06-24  Ian Lance Taylor  <iant@google.com>
33         * layout.cc: Include "object.h".
34         (ctors_sections_in_init_array): New static variable.
35         (Layout::is_ctors_in_init_array): New function.
36         (Layout::layout): Add entry to ctors_sections_in_init_array if
37         appropriate.
38         * layout.h (class Layout): Declare is_ctors_in_init_array.
39         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
40         is_ctors_reverse_view is set.
41         (Sized_relobj_file::write_sections): Add layout parameter.  Change
42         all callers.  Set is_ctors_reverse_view field of View_size.
43         (Sized_relobj_file::reverse_words): New function.
44         * object.h (Sized_relobj_file::View_size): Add
45         is_ctors_reverse_view field.
46         (class Sized_relobj_file): Update declarations.
47         * testsuite/initpri3.c: New test.
48         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
49         initpri3b.
50         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
51         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
52         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
53         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
54         * testsuite/Makefile.in: Rebuild.
56 2011-06-24  Cary Coutant  <ccoutant@google.com>
58         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
59         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
60         (debug_msg_cdebug.err): New targets.
61         * testsuite/Makefile.in: Regenerate.
62         * testsuite/debug_msg.sh: Check output of link with compressed debug.
63         Fix checks for link with shared library.
65 2011-06-24  Doug Kwan  <dougkwan@google.com>
67         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
68         skip empty text sections.
69         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
71 2011-06-22  Ian Lance Taylor  <iant@google.com>
73         PR gold/12910
74         * options.h (class General_options): Add --ctors-in-init-array.
75         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
76         friends as SHT_PROGBITS for merging sections.
77         (Layout::layout): Remove special handling of .init_array and
78         friends.  Don't sort if doing relocatable link.  Sort for .ctors
79         and .dtors if ctors_in_init_array.
80         (Layout::make_output_section): Force correct section types for
81         .init_array and friends.  Don't sort if doing relocatable link,
82         Don't sort .ctors and .dtors if ctors_in_init_array.
83         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
84         (Layout::output_section_name): Add relobj parameter.  Change all
85         callers.  Handle .ctors. and .dtors. in code rather than table.
86         Handle .ctors and .dtors if ctors_in_init_array.
87         (Layout::match_file_name): New function, moved from output.cc.
88         * layout.h (class Layout): Update declarations.
89         * output.cc: Include "layout.h".
90         (Input_section_sort_entry::get_priority): New function.
91         (Input_section_sort_entry::match_file_name): Just call
92         Layout::match_file_name.
93         (Output_section::Input_section_sort_init_fini_compare::operator()):
94         Handle .ctors and .dtors.  Sort by explicit priority rather than
95         by name.
96         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
97         * testsuite/initpri2.c: New test.
98         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
99         (check_PROGRAMS): Add initpri2.
100         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
101         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
102         * configure, testsuite/Makefile.in: Rebuild.
104 2011-06-19  Ian Lance Taylor  <iant@google.com>
106         PR gold/12880
107         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
108         .interp section to a PT_INTERP segment even if we have seen a
109         --dynamic-linker option.  Don't do it if we have seen a PHDRS
110         clause in a linker script.
111         (Layout::finalize): Don't create a .interp section if we've
112         already create a PT_INTERP segment.
113         (Layout::create_interp): Always call choose_output_section (revert
114         patch of 2011-06-17).  Don't create PT_INTERP segment.
115         * script-sections.cc
116         (Script_sections::create_note_and_tls_segments): Add a .interp
117         section to a PT_INTERP segment even if we have seen a
118         --dynamic-linker option.
120 2011-06-18  Ian Lance Taylor  <iant@google.com>
122         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
123         merely because a non-PT_LOAD segment has a dynamic reloc.
125 2011-06-18  Ian Lance Taylor  <iant@google.com>
127         * layout.cc (Layout::finish_dynamic_section): Don't create
128         DT_FLAGS entry if not needed.
130 2011-06-18  Ian Lance Taylor  <iant@google.com>
132         PR gold/12745
133         * layout.cc (Layout::layout_eh_frame): Correct handling of
134         writable .eh_frame section.
136 2011-06-17  Ian Lance Taylor  <iant@google.com>
138         PR gold/12893
139         * resolve.cc (Symbol_table::resolve): Don't give an error if a
140         symbol is redefined with the exact same object and value.
142 2011-06-17  Ian Lance Taylor  <iant@google.com>
144         PR gold/12880
145         * layout.h (class Layout): Add interp_segment_ field.
146         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
147         (Layout::attach_allocated_section_to_segment): If making shared
148         library, put .interp section in PT_INTERP segment.
149         (Layout::finalize): Also call create_interp if -dynamic-linker
150         option was used.
151         (Layout::create_interp): Assert that there is no PT_INTERP
152         segment.  If not using a SECTIONS clause, use make_output_section.
153         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
154         * script-sections.cc
155         (Script_sections::create_note_and_tls_segments): If making shared
156         library, put .interp section in PT_INTERP segment.
158 2011-06-17  Ian Lance Taylor  <iant@google.com>
160         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
161         when making a shared library.
163 2011-06-17  Ian Lance Taylor  <iant@google.com>
165         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
166         parameter.  Change all callers.  Don't issue warning about PC32
167         against locally defined symbol.
169 2011-06-16  Ian Lance Taylor  <iant@google.com>
171         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
172         occurs in same object.
174 2011-06-14  Alan Modra  <amodra@gmail.com>
176         * po/POTFILES.in: Regenerate.
178 2011-06-09  Ian Lance Taylor  <iant@google.com>
180         * script-sections.cc
181         (Orphan_output_section::set_section_addresses): For a relocatable
182         link set address to 0.
184 2011-06-09  Cary Coutant  <ccoutant@google.com>
186         PR gold/12804
187         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
188         used with --compress-debug-sections.
189         * gold/object.cc (Sized_relobj_file::do_layout): Report
190         uncompressed size of compressed input sections.
192 2011-06-08  Cary Coutant  <ccoutant@google.com>
194         PR gold/12804
195         * testsuite/two_file_test_2_v1.cc: Change initialization of
196         v2 to keep it in .data.
198 2011-06-07  Cary Coutant  <ccoutant@google.com>
200         * common.cc (Symbol_table::do_allocate_commons_list): Call
201         gold_fallback.
202         * errors.cc (Errors::fatal): Adjust call to gold_exit.
203         (Errors::fallback): New function.
204         (gold_fallback): New function.
205         * errors.h (Errors::fallback): New function.
206         * gold.cc (gold_exit): Change status parameter to enum; adjust
207         all callers.
208         (queue_initial_tasks): Call gold_fallback.
209         * gold.h: Include cstdlib.
210         (Exit_status): New enum type.
211         (gold_exit): Change status parameter to enum.
212         (gold_fallback): New function.
213         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
214         (Layout::create_symtab_sections): Likewise.
215         (Layout::create_shdrs): Likewise.
216         * main.cc (main): Adjust call to gold_exit.
217         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
218         (Output_data_got::add_got_entry_pair): Likewise.
219         (Output_section::add_input_section): Likewise.
220         (Output_section::add_output_section_data): Likewise.
221         (Output_segment::set_section_list_addresses): Likewise.
222         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
224 2011-06-07  Cary Coutant  <ccoutant@google.com>
226         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
227         for incremental links.
228         * output.cc (Output_segment::set_section_list_addresses): Remove
229         FIXME and test for TLS or BSS.
231 2011-06-07  Cary Coutant  <ccoutant@google.com>
233         * testsuite/Makefile.am: Add incremental_copy_test,
234         incremental_common_test_1.
235         * testsuite/Makefile.in: Regenerate.
236         * testsuite/common_test_1_v1.c: New source file.
237         * testsuite/common_test_1_v2.c: New source file.
238         * testsuite/copy_test_v1.cc: New source file.
240 2011-06-07  Cary Coutant  <ccoutant@google.com>
242         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
243         update, allocate common from bss section's free list.
244         * incremental-dump.cc (dump_incremental_inputs): Print flag for
245         linker-defined symbols.
246         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
247         Skip GOT and PLT entries that are no longer referenced.
248         (Output_section_incremental_inputs::write_info_blocks): Mark
249         linker-defined symbols.
250         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
251         * output.cc (Output_section::allocate): New function.
252         * output.h (Output_section::allocate): New function.
253         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
254         linker-defined symbols.
255         (Symbol::override_base_with_special): Copy is_predefined_ flag.
256         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
257         (Symbol::init_base_output_data): Likewise.
258         (Symbol::init_base_output_segment): Likewise.
259         (Symbol::init_base_constant): Likewise.
260         (Sized_symbol::init_output_data): Likewise.
261         (Sized_symbol::init_output_segment): Likewise.
262         (Sized_symbol::init_constant): Likewise.
263         (Symbol_table::do_define_in_output_data): Likewise.
264         (Symbol_table::do_define_in_output_segment): Likewise.
265         (Symbol_table::do_define_as_constant): Likewise.
266         * symtab.h (Symbol::is_predefined): New function.
267         (Symbol::init_base_output_data): Add is_predefined parameter.
268         (Symbol::init_base_output_segment): Likewise.
269         (Symbol::init_base_constant): Likewise.
270         (Symbol::is_predefined_): New data member.
271         (Sized_symbol::init_output_data): Add is_predefined parameter.
272         (Sized_symbol::init_output_segment): Likewise.
273         (Sized_symbol::init_constant): Likewise.
274         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
276 2011-06-07  Cary Coutant  <ccoutant@google.com>
278         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
279         instead of emit_copy_reloc.
280         (Copy_relocs::emit_copy_reloc): Refactor.
281         (Copy_relocs::make_copy_reloc): New function.
282         (Copy_relocs::add_copy_reloc): Remove.
283         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
284         section.
285         (Copy_relocs::make_copy_reloc): New function.
286         (Copy_relocs::add_copy_reloc): Remove.
287         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
288         unchanged input files.
289         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
290         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
291         Reserve BSS space for COPY relocations.
292         (Sized_incremental_binary::do_emit_copy_relocs): New function.
293         (Output_section_incremental_inputs::write_info_blocks): Record
294         whether a symbol is copied from a shared object.
295         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
296         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
297         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
298         (Incremental_input_entry_reader::get_output_symbol_index): Add
299         is_copy parameter.
300         (Incremental_binary::emit_copy_relocs): New function.
301         (Incremental_binary::do_emit_copy_relocs): New function.
302         (Sized_incremental_binary::Sized_incremental_binary): Initialize
303         new data member.
304         (Sized_incremental_binary::add_copy_reloc): New function.
305         (Sized_incremental_binary::do_emit_copy_relocs): New function.
306         (Sized_incremental_binary::Copy_reloc): New struct.
307         (Sized_incremental_binary::Copy_relocs): New typedef.
308         (Sized_incremental_binary::copy_relocs_): New data member.
309         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
310         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
311         * target.h (Sized_target::emit_copy_reloc): New function.
312         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
314 2011-06-02  Cary Coutant  <ccoutant@google.com>
316         PR gold/12163
317         * gold/archive.cc (Archive::Archive): Initialize new data member.
318         (Archive::include_all_members): Return if archive has already been
319         included.
320         * gold/archive.h (Archive::include_all_members_): New data member.
322 2011-06-02  Nick Clifton  <nickc@redhat.com>
324         * dynobj.h: Fix spelling mistake in comment.
325         * output.cc: Likewise.
327 2011-05-31  Doug Kwan  <dougkwan@google.com>
328             Asier Llano
330         PR gold/12826
331         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
332         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
333         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
334         redundant arm_exidx_test.so.
335         * testsuite/Makefile.in: Regenerate.
336         (check_SCRIPTS): Add pr12826.sh
337         (check_DATA): Add pr12826.stdout
338         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
339         * testsuite/pr12826.sh: New file.
340         * testsuite/pr12826_1.s: Ditto.
341         * testsuite/pr12826_1.s: Ditto.
343 2011-05-30  Ian Lance Taylor  <iant@google.com>
345         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
346         sections.
348 2011-05-29  Ian Lance Taylor  <iant@google.com>
350         PR gold/12804
351         * testsuite/Makefile.am: Use different file name for two_file_test
352         temporary file for each incremental test.
353         * testsuite/Makefile.in: Rebuild.
355 2011-05-29  Ian Lance Taylor  <iant@google.com>
357         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
358         binary input file is empty.
360 2011-05-27  Ian Lance Taylor  <iant@google.com>
362         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
363         (ver_test_9.so): Likewise.
364         * testsuite/Makefile.in: Rebuild.
366 2011-05-26 Cary Coutant  <ccoutant@google.com>
368         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
369         * incremental.cc (Incremental_inputs::report_input_section): Fix
370         comment, indentation.
371         (Incremental_inputs::report_comdat_group): New function.
372         (Output_section_incremental_inputs::set_final_data_size): Adjust size
373         of data for incremental input file entry.
374         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
375         group count, COMDAT group signatures.
376         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
377         an unchanged input file.
378         * incremental.h (Incremental_object_entry::Incremental_object_entry):
379         Initialize new data member.
380         (Incremental_object_entry::add_comdat_group): New function.
381         (Incremental_object_entry::get_comdat_group_count): New function.
382         (Incremental_object_entry::get_comdat_signature_key): New function.
383         (Incremental_object_entry::groups_): New data member.
384         (Incremental_inputs::report_comdat_group): New function.
385         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
386         data for incremental input file entry.
387         (Incremental_input_entry_reader::get_comdat_group_count): New function.
388         (Incremental_input_entry_reader::get_input_section): Adjust size of
389         data for incremental input file entry.
390         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
391         (Incremental_input_entry_reader::get_comdat_group_signature): New
392         function.
393         * object.cc (Sized_relobj::include_section_group): Report kept
394         COMDAT groups for incremental links.
396 2011-05-24  David Meyer  <pdox@google.com>
398         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
399         with name parameter.  Add found_name parameter.
400         * fileread.cc (Input_file::find_file): Adjust code accordingly.
401         * dirsearch.h (class Dirsearch): Update declaration.
403 2011-05-24  Ian Lance Taylor  <iant@google.com>
405         * archive.cc (Library_base::should_include_member): Pull in object
406         from archive if it defines the entry symbol.
407         * parameters.cc (Parameters::entry): New function.
408         * parameters.h (class Parameters): Declare entry.
409         * output.h (class Output_file_header): Remove entry_ field.
410         * output.cc (Output_file_header::Output_file_header): Remove entry
411         parameter.  Change all callers.
412         (Output_file_header::entry): Use parameters->entry.
413         * gold.cc (queue_middle_tasks): Likewise.
414         * plugin.cc (Plugin_hook::run): Likewise.
416 2011-05-24 Cary Coutant  <ccoutant@google.com>
418         * gold.cc (queue_initial_tasks): Pass incremental base filename
419         to Output_file::open_base_file; don't print error message.
420         * incremental-dump.cc (main): Adjust call to
421         Output_file::open_for_modification.
422         * incremental-dump.cc (main): Likewise.
423         * incremental.cc (Incremental_inputs::report_command_line):
424         Ignore --incremental-base option when comparing command lines.
425         Ignore parameter when given as separate argument.
426         * options.h (class General_options): Add --incremental-base.
427         * output.cc (Output_file::Output_file):
428         (Output_file::open_base_file): Add base_name and writable parameters;
429         read base file into new file; print error message here.
430         (Output_file::map_no_anonymous): Add writable parameter; adjust all
431         callers.
432         * output.h (Output_file::open_for_modification): Rename to...
433         (Output_file::open_base_file): ...this; add base_name and
434         writable parameters; adjust all callers.
435         (Output_file::map_no_anonymous): Add writable parameter; adjust all
436         callers.
437         * testsuite/Makefile.am (incremental_test_4): Test
438         --incremental-base.
439         * testsuite/Makefile.in: Regenerate.
441 2011-05-24 Cary Coutant  <ccoutant@google.com>
443         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
444         incremental_test_4.
445         * testsuite/Makefile.in: Regenerate.
446         * testsuite/two_file_test_1_v1.cc: New test source file.
447         * testsuite/two_file_test_1b_v1.cc: New test source file.
448         * testsuite/two_file_test_2_v1.cc: New test source file.
450 2011-05-24 Cary Coutant  <ccoutant@google.com>
452         * dynobj.h (Dynobj::do_dynobj): New function.
453         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
454         flag and soname for shared objects.
455         * incremental.cc (Incremental_inputs::report_object): Make
456         either Incremental_object_entry or Incremental_dynobj_entry; add
457         soname to string table.
458         (Incremental_inputs::report_input_section): Add assertion.
459         (Output_section_incremental_inputs::set_final_data_size): Adjust
460         type of input file entry for shared libraries; adjust size of
461         shared library info entry.
462         (Output_section_incremental_inputs::write_input_files): Write
463         as_needed flag for shared libraries.
464         (Output_section_incremental_inputs::write_info_blocks): Adjust type
465         of input file entry for shared libraries; write soname.
466         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
467         soname from incremental info.
468         * incremental.h (enum Incremental_input_flags): Add
469         INCREMENTAL_INPUT_AS_NEEDED.
470         (Incremental_input_entry::Incremental_input_entry): Initialize new
471         data member.
472         (Incremental_input_entry::set_as_needed): New function.
473         (Incremental_input_entry::as_needed): New function.
474         (Incremental_input_entry::do_dynobj_entry): New function.
475         (Incremental_input_entry::as_needed_): New data member.
476         (Incremental_object_entry::Incremental_object_entry): Don't check
477         for shared library.
478         (Incremental_object_entry::do_type): Likewise.
479         (class Incremental_dynobj_entry): New class.
480         (Incremental_input_entry_reader::as_needed): New function.
481         (Incremental_input_entry_reader::get_soname): New function.
482         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
483         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
484         size of shared library info entry.
485         * layout.cc (Layout::finish_dynamic_section): Don't test for 
486         incremental link when adding DT_NEEDED entries.
487         * object.h (Object::Object): Initialize new data member.
488         (Object::dynobj): New function.
489         (Object::set_as_needed): New function.
490         (Object::as_needed): New function.
491         (Object::do_dynobj): New function.
492         (Object::as_needed_): New data member.
494 2011-05-24 Cary Coutant  <ccoutant@google.com>
496         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
497         info; adjust display of GOT entries.
498         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
499         vector of input objects; remove file_status_.
500         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
501         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
502         got_plt reader; call target hooks to reserve GOT entries.
503         (Output_section_incremental_inputs::set_final_data_size): Adjust size
504         of input file info header and GOT info entry.
505         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
506         relocation info.
507         (Got_plt_view_info::got_descriptor): Remove.
508         (Got_plt_view_info::sym_index): New data member.
509         (Got_plt_view_info::input_index): New data member.
510         (Local_got_offset_visitor::visit): Write input file index.
511         (Global_got_offset_visitor::visit): Write 0 for input file index.
512         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
513         with sym_index and input_index.
514         (Output_section_incremental_inputs::write_got_plt): Adjust size of
515         incremental info GOT entry; replace got_descriptor with input_index.
516         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
517         map from input file index to object.
518         (Sized_relobj_incr::do_layout): Replace direct data member reference
519         with accessor function.
520         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
521         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
522         Adjust size of input file info header.
523         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
524         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
525         (Incremental_input_entry_reader::get_input_section): Adjust size of
526         input file info header.
527         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
528         of incremental info GOT entry.
529         (Incremental_got_plt_reader::get_got_desc): Remove.
530         (Incremental_got_plt_reader::get_got_symndx): New function.
531         (Incremental_got_plt_reader::get_got_input_index): New function.
532         (Sized_incremental_binary::Sized_incremental_binary): Remove
533         file_status_; add input_objects_.
534         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
535         (Sized_incremental_binary::set_file_is_unchanged): Remove.
536         (Sized_incremental_binary::file_is_unchanged): Remove.
537         (Sized_incremental_binary::set_input_object): New function.
538         (Sized_incremental_binary::input_object): New function.
539         (Sized_incremental_binary::file_status_): Remove.
540         (Sized_incremental_binary::input_objects_): New data member.
541         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
542         references.
543         (Sized_relobj_incr::invalid_address): Move to base class.
544         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
545         class.
546         (Sized_relobj_incr::do_output_section_offset): Likewise.
547         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
548         (Sized_relobj_incr::section_offsets_): Likewise.
549         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
550         function.
551         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
552         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
553         with accessor function.
554         (Sized_relobj_file::do_layout): Likewise.
555         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
556         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
557         (Sized_relobj_file::compute_final_local_value): Replace refs to
558         section_offsets_ with accessor function.
559         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
560         * object.h (Relobj::Relobj): Initialize new data members.
561         (Relobj::add_dyn_reloc): New function.
562         (Relobj::first_dyn_reloc): New function.
563         (Relobj::dyn_reloc_count): New function.
564         (Relobj::first_dyn_reloc_): New data member.
565         (Relobj::dyn_reloc_count_): New data member.
566         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
567         references.
568         (Sized_relobj::Address): New typedef.
569         (Sized_relobj::invalid_address): Move here from child class.
570         (Sized_relobj::Sized_relobj): Initialize new data members.
571         (Sized_relobj::sized_relobj): New function.
572         (Sized_relobj::is_output_section_offset_invalid): Move here from
573         child class.
574         (Sized_relobj::get_output_section_offset): Likewise.
575         (Sized_relobj::local_has_got_offset): Likewise.
576         (Sized_relobj::local_got_offset): Likewise.
577         (Sized_relobj::set_local_got_offset): Likewise.
578         (Sized_relobj::do_for_all_local_got_entries): Likewise.
579         (Sized_relobj::clear_got_offsets): New function.
580         (Sized_relobj::section_offsets): Move here from child class.
581         (Sized_relobj::do_output_section_offset): Likewise.
582         (Sized_relobj::do_set_section_offset): Likewise.
583         (Sized_relobj::Local_got_offsets): Likewise.
584         (Sized_relobj::local_got_offsets_): Likewise.
585         (Sized_relobj::section_offsets_): Likewise.
586         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
587         references.
588         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
589         class.
590         (Sized_relobj_file::sized_relobj): New function
591         (Sized_relobj_file::local_has_got_offset): Move to base class.
592         (Sized_relobj_file::local_got_offset): Likewise.
593         (Sized_relobj_file::set_local_got_offset): Likewise.
594         (Sized_relobj_file::get_output_section_offset): Likewise.
595         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
596         (Sized_relobj_file::do_output_section_offset): Likewise.
597         (Sized_relobj_file::do_set_section_offset): Likewise.
598         (Sized_relobj_file::Local_got_offsets): Likewise.
599         (Sized_relobj_file::local_got_offsets_): Likewise.
600         (Sized_relobj_file::section_offsets_): Likewise.
601         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
602         (all constructors).
603         (set_needs_dynsym_index): Convert relobj to derived class pointer.
604         (Output_reloc::get_symbol_index): Likewise.
605         (Output_reloc::local_section_offset): Likewise.
606         (Output_reloc::get_address): Likewise.
607         (Output_reloc::symbol_value): Likewise.
608         (Output_data_got::reserve_slot): Move to class definition.
609         (Output_data_got::reserve_local): New function.
610         (Output_data_got::reserve_slot_for_global): Remove.
611         (Output_data_got::reserve_global): New function.
612         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
613         (all constructors, two instantiations).
614         (Output_reloc::get_relobj): New function (two instantiations).
615         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
616         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
617         (Output_data_reloc::add_global): Adjust type of relobj.
618         (Output_data_reloc::add_global_relative): Likewise.
619         (Output_data_reloc::add_symbolless_global_addend): Likewise.
620         (Output_data_reloc::add_local): Likewise.
621         (Output_data_reloc::add_local_relative): Likewise.
622         (Output_data_reloc::add_symbolless_local_addend): Likewise.
623         (Output_data_reloc::add_local_section): Likewise.
624         (Output_data_reloc::add_output_section): Likewise.
625         (Output_data_reloc::add_absolute): Likewise.
626         (Output_data_reloc::add_target_specific): Likewise.
627         (Output_data_got::reserve_slot): Move definition here.
628         (Output_data_got::reserve_local): New function.
629         (Output_data_got::reserve_global): New function.
630         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
631         section_offsets_ with accessor function.
632         (Sized_relobj_file::write_sections): Likewise.
633         (Sized_relobj_file::do_relocate_sections): Likewise.
634         * target.h (Sized_target::reserve_local_got_entry): New function.
635         (Sized_target::reserve_global_got_entry): New function.
636         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
637         (Target_x86_64::reserve_global_got_entry): New function.
638         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
640 2011-05-23 Cary Coutant  <ccoutant@google.com>
642         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
643         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
644         bit when checking got_type.
645         * incremental.cc (Sized_incremental_binary::setup_readers):
646         Store symbol table and string table locations; initialize bit vector
647         of file status flags.
648         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
649         unchanged files.
650         (Sized_incremental_binary::do_process_got_plt): New function.
651         (Sized_incremental_binary::get_symtab_view): Use stored locations.
652         (Output_section_incremental_inputs::set_final_data_size): Record
653         file index for each input file.
654         (Output_section_incremental_inputs::write_got_plt): Store file index
655         instead of input entry offset for each GOT entry.
656         * incremental.h
657         (Incremental_input_entry::Incremental_input_entry): Initialize new
658         data member.
659         (Incremental_input_entry::set_offset): Store file index.
660         (Incremental_input_entry::get_file_index): New function.
661         (Incremental_input_entry::file_index_): New data member.
662         (Incremental_binary::process_got_plt): New function.
663         (Incremental_binary::do_process_got_plt): New function.
664         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
665         data members.
666         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
667         (Sized_incremental_binary::set_file_is_unchanged): New function.
668         (Sized_incremental_binary::file_is_unchanged): New function.
669         (Sized_incremental_binary::do_process_got_plt): New function.
670         (Sized_incremental_binary::file_status_): New data member.
671         (Sized_incremental_binary::main_symtab_loc_): New data member.
672         (Sized_incremental_binary::main_strtab_loc_): New data member.
673         * output.cc (Output_data_got::Got_entry::write): Add case
674         RESERVED_CODE.
675         (Output_data_got::add_global): Call add_got_entry.
676         (Output_data_got::add_global_plt): Likewise.
677         (Output_data_got::add_global_with_rel): Likewise.
678         (Output_data_got::add_global_with_rela): Likewise.
679         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
680         (Output_data_got::add_global_pair_with_rela): Likewise.
681         (Output_data_got::add_local): Call add_got_entry.
682         (Output_data_got::add_local_plt): Likewise.
683         (Output_data_got::add_local_with_rel): Likewise.
684         (Output_data_got::add_local_with_rela): Likewise.
685         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
686         (Output_data_got::add_local_pair_with_rela): Likewise.
687         (Output_data_got::reserve_slot): New function.
688         (Output_data_got::reserve_slot_for_global): New function.
689         (Output_data_got::add_got_entry): New function.
690         (Output_data_got::add_got_entry_pair): New function.
691         (Output_section::add_output_section_data): Edit FIXME.
692         * output.h
693         (Output_section_data_build::Output_section_data_build): New
694         constructor with size parameter.
695         (Output_data_space::Output_data_space): Likewise.
696         (Output_data_got::Output_data_got): Initialize new data member; new
697         constructor with size parameter.
698         (Output_data_got::add_constant): Call add_got_entry.
699         (Output_data_got::reserve_slot): New function.
700         (Output_data_got::reserve_slot_for_global): New function.
701         (class Output_data_got::Got_entry): Add RESERVED_CODE.
702         (Output_data_got::add_got_entry): New function.
703         (Output_data_got::add_got_entry_pair): New function.
704         (Output_data_got::free_list_): New data member.
705         * target.h (Sized_target::init_got_plt_for_update): New function.
706         (Sized_target::register_global_plt_entry): New function.
707         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
708         Initialize new data member; call init; add constructor with PLT count.
709         (Output_data_plt_x86_64::init): New function.
710         (Output_data_plt_x86_64::add_relocation): New function.
711         (Output_data_plt_x86_64::reserve_slot): New function.
712         (Output_data_plt_x86_64::free_list_): New data member.
713         (Target_x86_64::init_got_plt_for_update): New function.
714         (Target_x86_64::register_global_plt_entry): New function.
715         (Output_data_plt_x86_64::add_entry): Allocate from free list for
716         incremental updates.
717         (Output_data_plt_x86_64::add_relocation): New function.
718         * testsuite/object_unittest.cc (Object_test): Set default options.
720 2011-05-16  Ian Lance Taylor  <iant@google.com>
722         * options.h (class General_options): Make -i a synonym for -r.
724 2011-05-16  Ian Lance Taylor  <iant@google.com>
726         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
728 2011-05-10 Cary Coutant  <ccoutant@google.com>
730         * object.cc (Sized_relobj::do_count_local_symbols): Check for
731         strip_all (-s).
733 2011-05-06  Ian Lance Taylor  <iant@google.com>
735         * layout.cc (Layout::layout): If the output section flags change,
736         update the ordering.
738 2011-04-25 Cary Coutant  <ccoutant@google.com>
740         * incremental-dump.cc (dump_incremental_inputs): Print local
741         symbol info for each input file.
742         * incremental.cc
743         (Output_section_incremental_inputs::set_final_data_size): Add local
744         symbol info to input file entries in incremental info.
745         (Output_section_incremental_inputs::write_info_blocks): Likewise.
746         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
747         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
748         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
749         implementation.
750         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
751         (Sized_incr_relobj::do_relocate): Write the local symbols.
752         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
753         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
754         Adjust size of input file header.
755         (Incremental_inputs_reader::get_local_symbol_offset): New function.
756         (Incremental_inputs_reader::get_local_symbol_count): New function.
757         (Incremental_inputs_reader::get_input_section): Adjust size of input
758         file header.
759         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
760         (Sized_incr_relobj::This): New typedef.
761         (Sized_incr_relobj::sym_size): New const data member.
762         (Sized_incr_relobj::Local_symbol): New struct.
763         (Sized_incr_relobj::do_output_local_symbol_count): New function.
764         (Sized_incr_relobj::do_local_symbol_offset): New function.
765         (Sized_incr_relobj::local_symbol_count_): New data member.
766         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
767         (Sized_incr_relobj::local_symbol_index_): New data member.
768         (Sized_incr_relobj::local_symbol_offset_): New data member.
769         (Sized_incr_relobj::local_dynsym_offset_): New data member.
770         (Sized_incr_relobj::local_symbols_): New data member.
771         * object.h (Relobj::output_local_symbol_count): New function.
772         (Relobj::local_symbol_offset): New function.
773         (Relobj::do_output_local_symbol_count): New function.
774         (Relobj::do_local_symbol_offset): New function.
775         (Sized_relobj::do_output_local_symbol_count): New function.
776         (Sized_relobj::do_local_symbol_offset): New function.
778 2011-04-22  Vladimir Simonov  <sv@sw.ru>
780         * descriptors.cc (set_close_on_exec): New function.
781         (Descriptors::open): Use set_close_on_exec.
782         * output.cc (S_ISLNK): Define if not defined.
784 2011-04-22 Cary Coutant  <ccoutant@google.com>
786         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
787         global symbol map.
788         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
789         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
790         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
791         relocations.
792         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
793         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
794         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
795         * incremental.h
796         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
797         function.
798         (Incremental_binary::apply_incremental_relocs): New function.
799         (Incremental_binary::do_apply_incremental_relocs): New function.
800         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
801         data member.
802         (Sized_incremental_binary::add_global_symbol): New function.
803         (Sized_incremental_binary::global_symbol): New function.
804         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
805         (Sized_incremental_binary::symbol_map_): New data member.
806         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
807         * target.h (Sized_target::apply_relocation): New function.
808         * target-reloc.h (apply_relocation): New function.
809         * x86_64.cc (Target_x86_64::apply_relocation): New function.
811 2011-04-22  Doug Kwan  <dougkwan@google.com>
813         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
814         flag of a SHT_ARM_EXIDX section.
815         * testsuite/Makefile.am (arm_exidx_test): New test rules.
816         * testsuite/Makefile.in: Regenerate.
817         * testsuite/arm_exidx_test.s: New file.
818         * testsuite/arm_exidx_test.sh: Same.
820 2011-04-20 Cary Coutant  <ccoutant@google.com>
822         PR gold/12689
823         * archive.h (Incremental_archive_entry::Archive_member):
824         Initialize arg_serial_ (second constructor).
826 2011-04-17  Ian Lance Taylor  <iant@google.com>
828         * object.cc (Relocate_info::location): Simplify location string.
829         * errors.cc (Errors::error_at_location): Don't print program
830         name.
831         (Errors::warning_at_location): Likewise.
832         (Errors::undefined_symbol): Likewise.
833         * testsuite/debug_msg.sh: Update accordingly.
835 2011-04-14 Cary Coutant  <ccoutant@google.com>
837         * gold/layout.cc (Layout::symtab_section_offset): New function.
838         * gold/layout.h (Layout::symtab_section_offset): New function.
839         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
841 2011-04-12  Ian Lance Taylor  <iant@google.com>
843         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
844         with MREMAP_MAYMOVE.
845         * output.h (class Output_file): Add map_is_allocated_ field.
846         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
847         not available, provide stubs.  If mremap is not available, #define
848         it to gold_mremap.
849         (MREMAP_MAYMOVE): Define if not defined.
850         (Output_file::Output_file): Initialize map_is_allocated_.
851         (Output_file::resize): Check map_is_allocated_.
852         (Output_file::map_anonymous): If mmap fails, use malloc.
853         (Output_file::unmap): Don't do anything for an anonymous map.
854         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
855         is not available, provide stubs.
856         (File_read::View::~View): Use free rather than delete[].
857         (File_read::make_view): Use malloc rather than new[].  If mmap
858         fails, use malloc.
859         (File_read::find_or_make_view): Use malloc rather than new[].
860         * gold.h: Remove HAVE_REMAP code.
861         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
862         exists.  Rename mremap to gold_mremap.  If mmap is not available
863         don't do anything.
864         * configure, config.in: Rebuild.
866 2011-04-11  Ian Lance Taylor  <iant@google.com>
868         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
869         initialize local variable v.
871 2011-04-11  Cary Coutant  <ccoutant@google.com>
873         * archive.cc (Archive::include_member): Adjust call to
874         report_object.
875         (Add_archive_symbols::run): Track argument serial numbers.
876         (Lib_group::include_member): Likewise.
877         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
878         * archive.h (Incremental_archive_entry::Archive_member):
879         Initialize arg_serial_.
880         (Archive_member::arg_serial_): New data member.
881         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
882         (Sized_dynobj::do_add_symbols): Track symbols when doing an
883         incremental link.
884         (Sized_dynobj::do_for_all_local_got_entries): New function.
885         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
886         function.
887         * fileread.cc (get_mtime): New function.
888         * fileread.h (get_mtime): New function.
889         * gold.cc (queue_initial_tasks): Check for incremental update.
890         (process_incremental_input): New function.
891         (queue_middle_tasks): Don't force valid target for incremental
892         update.
893         * incremental-dump.cc (find_input_containing_global): Adjust
894         size of symbol info entry.
895         (dump_incremental_inputs): Dump argument serial number and
896         in_system_directory flag; bias shndx by 1; print symbol names
897         when dumping per-file symbol lists; use new symbol info readers.
898         * incremental.cc
899         (Output_section_incremental_inputs:update_data_size): New function.
900         (Sized_incremental_binary::setup_readers): Setup input readers
901         for each input file; build maps for files added from libraries
902         and scripts.
903         (Sized_incremental_binary::check_input_args): New function.
904         (Sized_incremental_binary::do_check_inputs): Build map of argument
905         serial numbers to input arguments.
906         (Sized_incremental_binary::do_file_has_changed): Rename
907         do_file_is_unchanged to this; compare file modification times.
908         (Sized_incremental_binary::do_init_layout): New function.
909         (Sized_incremental_binary::do_reserve_layout): New function.
910         (Sized_incremental_binary::do_get_input_reader): Remove.
911         (Sized_incremental_binary::get_symtab_view): New function.
912         (Incremental_checker::can_incrementally_link_output_file): Remove.
913         (Incremental_inputs::report_command_line): Exclude --debug options.
914         (Incremental_inputs::report_archive_begin): Add parameter; track
915         argument serial numbers; don't put input file entry for archive
916         before archive members.
917         (Incremental_inputs::report_archive_end): Put input file entry
918         for archive after archive members.
919         (Incremental_inputs::report_object): Add parameter; track argument
920         serial numbers and in_system_directory flag.
921         (Incremental_inputs::report_script): Add parameter; track argument
922         serial numbers.
923         (Output_section_incremental_inputs::set_final_data_size): Adjust
924         size of symbol info entry; check for forwarding symbols.
925         (Output_section_incremental_inputs::write_input_files): Write
926         in_system_directory flag and argument serial number.
927         (Output_section_incremental_inputs::write_info_blocks): Map section
928         indices between incremental info and original input file; store
929         input section index for each symbol.
930         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
931         change operator() to visit().
932         (class Global_got_offset_visitor): Likewise.
933         (class Global_symbol_visitor_got_plt):
934         (Output_section_incremental_inputs::write_got_plt): Use new visitor
935         classes.
936         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
937         (Sized_incr_relobj::do_read_symbols): New function.
938         (Sized_incr_relobj::do_layout): New function.
939         (Sized_incr_relobj::do_layout_deferred_sections): New function.
940         (Sized_incr_relobj::do_add_symbols): New function.
941         (Sized_incr_relobj::do_should_include_member): New function.
942         (Sized_incr_relobj::do_for_all_global_symbols): New function.
943         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
944         (Sized_incr_relobj::do_section_size): New function.
945         (Sized_incr_relobj::do_section_name): New function.
946         (Sized_incr_relobj::do_section_contents): New function.
947         (Sized_incr_relobj::do_section_flags): New function.
948         (Sized_incr_relobj::do_section_entsize): New function.
949         (Sized_incr_relobj::do_section_address): New function.
950         (Sized_incr_relobj::do_section_type): New function.
951         (Sized_incr_relobj::do_section_link): New function.
952         (Sized_incr_relobj::do_section_info): New function.
953         (Sized_incr_relobj::do_section_addralign): New function.
954         (Sized_incr_relobj::do_initialize_xindex): New function.
955         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
956         (Sized_incr_relobj::do_read_relocs): New function.
957         (Sized_incr_relobj::do_gc_process_relocs): New function.
958         (Sized_incr_relobj::do_scan_relocs): New function.
959         (Sized_incr_relobj::do_count_local_symbols): New function.
960         (Sized_incr_relobj::do_finalize_local_symbols): New function.
961         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
962         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
963         (Sized_incr_relobj::do_relocate): New function.
964         (Sized_incr_relobj::do_set_section_offset): New function.
965         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
966         (Sized_incr_dynobj::do_read_symbols): New function.
967         (Sized_incr_dynobj::do_layout): New function.
968         (Sized_incr_dynobj::do_add_symbols): New function.
969         (Sized_incr_dynobj::do_should_include_member): New function.
970         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
971         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
972         (Sized_incr_dynobj::do_section_size): New function.
973         (Sized_incr_dynobj::do_section_name): New function.
974         (Sized_incr_dynobj::do_section_contents): New function.
975         (Sized_incr_dynobj::do_section_flags): New function.
976         (Sized_incr_dynobj::do_section_entsize): New function.
977         (Sized_incr_dynobj::do_section_address): New function.
978         (Sized_incr_dynobj::do_section_type): New function.
979         (Sized_incr_dynobj::do_section_link): New function.
980         (Sized_incr_dynobj::do_section_info): New function.
981         (Sized_incr_dynobj::do_section_addralign): New function.
982         (Sized_incr_dynobj::do_initialize_xindex): New function.
983         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
984         (make_sized_incremental_object): New function.
985         (Incremental_library::copy_unused_symbols): New function.
986         (Incremental_library::do_for_all_unused_symbols): New function.
987         * incremental.h (enum Incremental_input_flags): New type.
988         (class Incremental_checker): Remove.
989         (Incremental_input_entry::Incremental_input_entry): Add argument
990         serial number.
991         (Incremental_input_entry::arg_serial): New function.
992         (Incremental_input_entry::set_is_in_system_directory): New function.
993         (Incremental_input_entry::is_in_system_directory): New function.
994         (Incremental_input_entry::arg_serial_): New data member.
995         (Incremental_input_entry::is_in_system_directory_): New data member.
996         (class Script_info): Move here from script.h.
997         (Script_info::Script_info): Add filename parameter.
998         (Script_info::filename): New function.
999         (Script_info::filename_): New data member.
1000         (Incremental_script_entry::Incremental_script_entry): Add argument
1001         serial number.
1002         (Incremental_object_entry::Incremental_object_entry): Likewise.
1003         (Incremental_object_entry::add_input_section): Build list of input
1004         sections with map to original shndx.
1005         (Incremental_object_entry::get_input_section_index): New function.
1006         (Incremental_object_entry::shndx_): New data member.
1007         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1008         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1009         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1010         serial number.
1011         (Incremental_inputs::report_archive_begin): Likewise.
1012         (Incremental_inputs::report_object): Likewise.
1013         (Incremental_inputs::report_script): Likewise.
1014         (class Incremental_global_symbol_reader): New class.
1015         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1016         and store flags and input file type.
1017         (Incremental_input_entry_reader::arg_serial): New function.
1018         (Incremental_input_entry_reader::type): Extract type from flags.
1019         (Incremental_input_entry_reader::is_in_system_directory): New function.
1020         (Incremental_input_entry_reader::get_input_section_count): Call
1021         accessor function for type.
1022         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1023         function for type; adjust size of global symbol entry.
1024         (Incremental_input_entry_reader::get_global_symbol_count): Call
1025         accessor function for type.
1026         (Incremental_input_entry_reader::get_object_count): Likewise.
1027         (Incremental_input_entry_reader::get_object_offset): Likewise.
1028         (Incremental_input_entry_reader::get_member_count): Likewise.
1029         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1030         (Incremental_input_entry_reader::get_member_offset): Likewise.
1031         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1032         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1033         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1034         (Incremental_input_entry_reader::get_global_symbol_reader): New
1035         function.
1036         (Incremental_input_entry_reader::get_output_symbol_index): New
1037         function.
1038         (Incremental_input_entry_reader::type_): Remove.
1039         (Incremental_input_entry_reader::flags_): New data member.
1040         (Incremental_inputs_reader::input_file_offset): New function.
1041         (Incremental_inputs_reader::input_file_index): New function.
1042         (Incremental_inputs_reader::input_file): Call input_file_offset.
1043         (Incremental_inputs_reader::input_file_at_offset): New function.
1044         (Incremental_relocs_reader::get_r_type): Reformat.
1045         (Incremental_relocs_reader::get_r_shndx): Reformat.
1046         (Incremental_relocs_reader::get_r_offset): Reformat.
1047         (Incremental_relocs_reader::data): New function.
1048         (Incremental_binary::Incremental_binary): Initialize new data members.
1049         (Incremental_binary::check_inputs): Add cmdline parameter.
1050         (Incremental_binary::file_is_unchanged): Remove.
1051         (Input_reader::arg_serial): New function.
1052         (Input_reader::get_unused_symbol_count): New function.
1053         (Input_reader::get_unused_symbol): New function.
1054         (Input_reader::do_arg_serial): New function.
1055         (Input_reader::do_get_unused_symbol_count): New function.
1056         (Input_reader::do_get_unused_symbol): New function.
1057         (Incremental_binary::input_file_count): New function.
1058         (Incremental_binary::get_input_reader): Change signature to use
1059         index instead of filename.
1060         (Incremental_binary::file_has_changed): New function.
1061         (Incremental_binary::get_input_argument): New function.
1062         (Incremental_binary::get_library): New function.
1063         (Incremental_binary::get_script_info): New function.
1064         (Incremental_binary::init_layout): New function.
1065         (Incremental_binary::reserve_layout): New function.
1066         (Incremental_binary::output_file): New function.
1067         (Incremental_binary::do_check_inputs): New function.
1068         (Incremental_binary::do_file_is_unchanged): Remove.
1069         (Incremental_binary::do_file_has_changed): New function.
1070         (Incremental_binary::do_init_layout): New function.
1071         (Incremental_binary::do_reserve_layout): New function.
1072         (Incremental_binary::do_input_file_count): New function.
1073         (Incremental_binary::do_get_input_reader): Change signature.
1074         (Incremental_binary::input_args_map_): New data member.
1075         (Incremental_binary::library_map_): New data member.
1076         (Incremental_binary::script_map_): New data member.
1077         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1078         new data members.
1079         (Sized_incremental_binary::output_section): New function.
1080         (Sized_incremental_binary::inputs_reader): Add const.
1081         (Sized_incremental_binary::symtab_reader): Add const.
1082         (Sized_incremental_binary::relocs_reader): Add const.
1083         (Sized_incremental_binary::got_plt_reader): Add const.
1084         (Sized_incremental_binary::get_symtab_view): New function.
1085         (Sized_incremental_binary::Inputs_reader): New typedef.
1086         (Sized_incremental_binary::Input_entry_reader): New typedef.
1087         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1088         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1089         (Sized_incremental_binary::do_file_has_changed): New function.
1090         (Sized_incremental_binary::do_init_layout): New function.
1091         (Sized_incremental_binary::do_reserve_layout): New function.
1092         (Sized_input_reader::Inputs_reader): Remove.
1093         (Sized_input_reader::Input_entry_reader): Remove.
1094         (Sized_input_reader::do_arg_serial): New function.
1095         (Sized_input_reader::do_get_unused_symbol_count): New function.
1096         (Sized_input_reader::do_get_unused_symbol): New function.
1097         (Sized_incremental_binary::do_input_file_count): New function.
1098         (Sized_incremental_binary::do_get_input_reader): Change signature;
1099         use index instead of filename.
1100         (Sized_incremental_binary::section_map_): New data member.
1101         (Sized_incremental_binary::input_entry_readers_): New data member.
1102         (class Sized_incr_relobj): New class.
1103         (class Sized_incr_dynobj): New class.
1104         (make_sized_incremental_object): New function.
1105         (class Incremental_library): New class.
1106         * layout.cc (Free_list::num_lists): New static data member.
1107         (Free_list::num_nodes): New static data member.
1108         (Free_list::num_removes): New static data member.
1109         (Free_list::num_remove_visits): New static data member.
1110         (Free_list::num_allocates): New static data member.
1111         (Free_list::num_allocate_visits): New static data member.
1112         (Free_list::init): New function.
1113         (Free_list::remove): New function.
1114         (Free_list::allocate): New function.
1115         (Free_list::dump): New function.
1116         (Free_list::print_stats): New function.
1117         (Layout_task_runner::run): Resize output file for incremental updates.
1118         (Layout::Layout): Initialize new data members.
1119         (Layout::set_incremental_base): New function.
1120         (Layout::init_fixed_output_section): New function.
1121         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1122         incremental updates.
1123         (Layout::create_gold_note): Do not create gold note section for
1124         incremental updates.
1125         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1126         for incremental updates.
1127         (Layout::set_section_offsets): For incremental updates, allocate space
1128         from free list.
1129         (Layout::create_symtab_sections): Layout with offsets relative to
1130         start of section; for incremental updates, allocate space from free
1131         list.
1132         (Layout::create_shdrs): For incremental updates, allocate space from
1133         free list.
1134         (Layout::finish_dynamic_section): For incremental updates, do not
1135         check --as-needed (fixed in subsequent patch).
1136         * layout.h (class Free_list): New class.
1137         (Layout::set_incremental_base): New function.
1138         (Layout::incremental_base): New function.
1139         (Layout::init_fixed_output_section): New function.
1140         (Layout::allocate): New function.
1141         (Layout::incremental_base_): New data member.
1142         (Layout::free_list_): New data member.
1143         * main.cc (main): Print Free_list statistics.
1144         * object.cc (Relobj::finalize_incremental_relocs): Add
1145         clear_counts parameter; clear counts only when clear_counts is set.
1146         (Sized_relobj::Sized_relobj): Initialize new base class.
1147         (Sized_relobj::do_layout): Don't report special sections.
1148         (Sized_relobj::do_for_all_local_got_entries): New function.
1149         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1150         symtab_off to all symbol table offsets.
1151         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1152         * object.h (class Got_offset_list): Move to top of file.
1153         (Object::Object): Allow case where input_file == NULL.
1154         (Object::~Object): Likewise.
1155         (Object::input_file): Assert that input_file != NULL.
1156         (Object::lock): Allow case where input_file == NULL.
1157         (Object::unlock): Likewise.
1158         (Object::is_locked): Likewise.
1159         (Object::token): Likewise.
1160         (Object::release): Likewise.
1161         (Object::is_incremental): New function.
1162         (Object::get_mtime): New function.
1163         (Object::for_all_local_got_entries): New function.
1164         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1165         (Object::set_is_in_system_directory): New function.
1166         (Object::is_in_system_directory): New function.
1167         (Object::do_is_incremental): New function.
1168         (Object::do_get_mtime): New function.
1169         (Object::do_for_all_local_got_entries): New function.
1170         (Object::is_in_system_directory_): New data member.
1171         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1172         (class Sized_relobj_base): New class.
1173         (class Sized_relobj): Derive from Sized_relobj_base.
1174         (class Sized_relobj::Symbols): Redeclare from base class.
1175         (class Sized_relobj::local_got_offset_list): Remove.
1176         (class Sized_relobj::Output_sections): Redeclare from base class.
1177         (class Sized_relobj::do_for_all_local_got_entries): New function.
1178         (class Sized_relobj::write_local_symbols): Add offset parameter.
1179         (class Sized_relobj::local_symbol_offset_): Update comment.
1180         (class Sized_relobj::local_dynsym_offset_): Update comment.
1181         * options.cc (Input_arguments::add_file): Remove const.
1182         * options.h (Input_file_argument::Input_file_argument):
1183         Initialize arg_serial_ (all constructors).
1184         (Input_file_argument::set_arg_serial): New function.
1185         (Input_file_argument::arg_serial): New function.
1186         (Input_file_argument::arg_serial_): New data member.
1187         (Input_arguments::Input_arguments): Initialize file_count_.
1188         (Input_arguments::add_file): Remove const.
1189         (Input_arguments::number_of_input_files): New function.
1190         (Input_arguments::file_count_): New data member.
1191         (Command_line::number_of_input_files): Call
1192         Input_arguments::number_of_input_files.
1193         * output.cc (Output_segment_headers::Output_segment_headers):
1194         Set current size.
1195         (Output_section::Input_section::current_data_size): New function.
1196         (Output_section::Output_section): Initialize new data members.
1197         (Output_section::add_input_section): Don't do merge sections for
1198         an incremental link; allocate space from free list for an
1199         incremental update.
1200         (Output_section::add_output_section_data): Allocate space from
1201         free list for an incremental update.
1202         (Output_section::update_data_size): New function.
1203         (Output_section::set_fixed_layout): New function.
1204         (Output_section::reserve): New function.
1205         (Output_segment::set_section_addresses): Remove const.
1206         (Output_segment::set_section_list_addresses): Remove const; allocate
1207         space from free list for an incremental update.
1208         (Output_segment::set_offset): Adjust size of RELRO segment for an
1209         incremental update.
1210         * output.h (Output_data::current_data_size): Move here from
1211         child classes.
1212         (Output_data::pre_finalize_data_size): New function.
1213         (Output_data::update_data_size): New function.
1214         (Output_section_headers::update_data_size): new function.
1215         (Output_section_data_build::current_data_size): Move to Output_data.
1216         (Output_data_strtab::update_data_size): New function.
1217         (Output_section::current_data_size): Move to Output_data.
1218         (Output_section::set_fixed_layout): New function.
1219         (Output_section::has_fixed_layout): New function.
1220         (Output_section::reserve): New function.
1221         (Output_section::update_data_size): New function.
1222         (Output_section::has_fixed_layout_): New data member.
1223         (Output_section::free_list_): New data member.
1224         (Output_segment::set_section_addresses): Remove const.
1225         (Output_segment::set_section_list_addresses): Remove const.
1226         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1227         New function.
1228         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1229         New function.
1230         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1231         parameter when calling Add_symbols constructor; store argument
1232         serial number for members of a lib group.
1233         (Add_symbols::locks): Allow case where token == NULL.
1234         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1235         (Read_member::~Read_member): New function.
1236         (Read_member::is_runnable): New function.
1237         (Read_member::locks): New function.
1238         (Read_member::run): New function.
1239         (Check_script::~Check_script): New function.
1240         (Check_script::is_runnable): New function.
1241         (Check_script::locks): New function.
1242         (Check_script::run): New function.
1243         (Check_library::~Check_library): New function.
1244         (Check_library::is_runnable): New function.
1245         (Check_library::locks): New function.
1246         (Check_library::run): New function.
1247         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1248         (Add_symbols::library_): New data member.
1249         (class Read_member): New class.
1250         (class Check_script): New class.
1251         (class Check_library): New class.
1252         * reloc.cc (Read_relocs::is_runnable): Allow case where
1253         token == NULL.
1254         (Read_relocs::locks): Likewise.
1255         (Scan_relocs::locks): Likewise.
1256         (Relocate_task::locks): Likewise.
1257         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1258         to clear counters.
1259         (Sized_relobj::incremental_relocs_scan): Fix comment.
1260         (Sized_relobj::do_relocate): Pass output file offset to
1261         write_local_symbols.
1262         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1263         from class declaration.
1264         * script.cc (read_input_script): Allocate Script_info; pass
1265         argument serial number to report_script.
1266         * script.h (class Script_info): Move to incremental.h.
1267         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1268         * symtab.h (Symbol_table::add_from_incrobj): New function.
1269         (Symbol_table::set_file_offset): New function.
1271 2011-04-05  Cary Coutant  <ccoutant@google.com>
1273         * incremental-dump.cc (dump_incremental_inputs): Change signature
1274         to take a Sized_incremental_binary; change caller.  Use readers
1275         in Sized_incremental_binary.
1276         * incremental.cc
1277         (Sized_incremental_binary::find_incremental_inputs_sections):
1278         Rename do_find_incremental_inputs_sections to this.
1279         (Sized_incremental_binary::setup_readers): New function.
1280         (Sized_incremental_binary::do_check_inputs): Check
1281         has_incremental_info_ flag; move setup code to setup_readers;
1282         use input readers.
1283         (Sized_incremental_binary::do_file_is_unchanged): New function.
1284         (Sized_incremental_binary::do_get_input_reader): New function.
1285         * incremental.h (class Incremental_binary): Move to end of file.
1286         (Incremental_binary::file_is_unchanged): New function.
1287         (Incremental_binary::do_file_is_unchanged): New function.
1288         (Incremental_binary::Input_reader): New class.
1289         (Incremental_binary::get_input_reader): New function.
1290         (class Sized_incremental_binary): Move to end of file.
1291         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1292         input section reader classes.
1293         (Sized_incremental_binary::has_incremental_info): New function.
1294         (Sized_incremental_binary::inputs_reader): New function.
1295         (Sized_incremental_binary::symtab_reader): New function.
1296         (Sized_incremental_binary::relocs_reader): New function.
1297         (Sized_incremental_binary::got_plt_reader): New function.
1298         (Sized_incremental_binary::do_file_is_unchanged): New function.
1299         (Sized_incremental_binary::Sized_input_reader): New class.
1300         (Sized_incremental_binary::get_input_reader): New function.
1301         (Sized_incremental_binary::find_incremental_inputs_sections):
1302         Rename do_find_incremental_inputs_sections to this.
1303         (Sized_incremental_binary::setup_readers): New function.
1304         (Sized_incremental_binary::has_incremental_info_): New data member.
1305         (Sized_incremental_binary::inputs_reader_): New data member.
1306         (Sized_incremental_binary::symtab_reader_): New data member.
1307         (Sized_incremental_binary::relocs_reader_): New data member.
1308         (Sized_incremental_binary::got_plt_reader_): New data member.
1309         (Sized_incremental_binary::current_input_file_): New data member.
1311 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1313         PR gold/12640
1314         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1315         violation.
1317 2011-03-30  Cary Coutant  <ccoutant@google.com>
1319         * archive.cc (Archive::include_member): Adjust call to report_object.
1320         (Add_archive_symbols::run): Add script_info to call to
1321         report_archive_begin.
1322         (Lib_group::include_member): Adjust call to report_object.
1323         (Add_lib_group_symbols::run): Adjust call to report_object.
1324         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1325         blocks.  Add object count for script input files.
1326         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1327         script_info parameter; change all callers.
1328         (Incremental_inputs::report_object): Add script_info parameter;
1329         change all callers.
1330         (Incremental_inputs::report_script): Store backpointer to
1331         incremental info entry.
1332         (Output_section_incremental_inputs::set_final_data_size): Record
1333         additional information for scripts.
1334         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1335         * incremental.h (Incremental_script_entry::add_object): New function.
1336         (Incremental_script_entry::get_object_count): New function.
1337         (Incremental_script_entry::get_object): New function.
1338         (Incremental_script_entry::objects_): New data member; adjust
1339         constructor.
1340         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1341         (Incremental_inputs::report_object): Add script_info parameter.
1342         (Incremental_inputs_reader::get_object_count): New function.
1343         (Incremental_inputs_reader::get_object_offset): New function.
1344         * options.cc (Input_arguments::add_file): Return reference to
1345         new input argument.
1346         * options.h (Input_argument::set_script_info): New function.
1347         (Input_argument::script_info): New function.
1348         (Input_argument::script_info_): New data member; adjust all
1349         constructors.
1350         (Input_file_group::add_file): Return reference to new input argument.
1351         (Input_file_lib::add_file): Likewise.
1352         (Input_arguments::add_file): Likewise.
1353         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1354         * script.cc (Parser_closure::Parser_closure): Add script_info
1355         parameter; adjust all callers.
1356         (Parser_closure::script_info): New function.
1357         (Parser_closure::script_info_): New data member.
1358         (read_input_script): Report scripts earlier to incremental info.
1359         (script_add_file): Set script_info in Input_argument.
1360         (script_add_library): Likewise.
1361         * script.h (Script_options::Script_info): Rewrite class.
1363 2011-03-29  Cary Coutant  <ccoutant@google.com>
1365         * archive.cc (Library_base::should_include_member): Move
1366         method here from class Archive.
1367         (Archive::Archive): Initialize base class.
1368         (Archive::should_include_member): Move to base class.
1369         (Archive::do_for_all_unused_symbols): New function.
1370         (Add_archive_symbols::run): Remove redundant access to
1371         incremental_inputs.
1372         (Lib_group::Lib_group): Initialize base class.
1373         (Lib_group::do_filename): New function.
1374         (Lib_group::include_member): Pass pointer to Lib_group to
1375         report_object.
1376         (Lib_group::do_for_all_unused_symbols): New function.
1377         (Add_lib_group_symbols::run): Report archive information for
1378         incremental links.
1379         * archive.h (class Library_base): New base class.
1380         (class Archive): Derive from Library_base.
1381         (Archive::filename): Move to base class.
1382         (Archive::set_incremental_info): Likewise.
1383         (Archive::incremental_info): Likewise.
1384         (Archive::Should_include): Likewise.
1385         (Archive::should_include_member): Likewise.
1386         (Archive::Armap_entry): Remove.
1387         (Archive::Unused_symbol_iterator): Remove.
1388         (Archive::unused_symbols_begin): Remove.
1389         (Archive::unused_symbols_end): Remove.
1390         (Archive::do_filename): New function.
1391         (Archive::do_get_mtime): New function.
1392         (Archive::do_for_all_unused_symbols): New function.
1393         (Archive::task_): Move to base class.
1394         (Archive::incremental_info_): Likewise.
1395         (class Lib_group): Derive from Library_base.
1396         (Lib_group::do_filename): New function.
1397         (Lib_group::do_get_mtime): New function.
1398         (Lib_group::do_for_all_unused_symbols): New function.
1399         (Lib_group::task_): Move to base class.
1400         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1401         function.
1402         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1403         function.
1404         * incremental.cc (Incremental_inputs::report_archive_begin):
1405         Use Library_base; call library's get_mtime; add incremental inputs
1406         entry before members.
1407         (class Unused_symbol_visitor): New class.
1408         (Incremental_inputs::report_archive_end): Use Library_base; use
1409         visitor class to record unused symbols; don't add incremental inputs
1410         entry after members.
1411         (Incremental_inputs::report_object): Use Library_base.
1412         * incremental.h
1413         (Incremental_archive_entry::Incremental_archive_entry): Remove
1414         unused Archive parameter.
1415         (Incremental_inputs::report_archive_begin): Use Library_base.
1416         (Incremental_inputs::report_archive_end): Likewise.
1417         (Incremental_inputs::report_object): Likewise.
1418         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1419         function.
1420         * object.h (Object::for_all_global_symbols): New function.
1421         (Object::do_for_all_global_symbols): New function.
1422         (Sized_relobj::do_for_all_global_symbols): New function.
1423         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1424         function.
1425         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1426         function.
1428 2011-03-27  Ian Lance Taylor  <iant@google.com>
1430         * archive.cc (Archive::interpret_header): Return -1 if something
1431         goes wrong.  Change callers accordingly.
1433 2011-03-25  Cary Coutant  <ccoutant@google.com>
1435         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1436         * testsuite/Makefile.in: Regenerate.
1438 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1440         * plugin.cc (get_view): New.
1441         (Plugin::load): Pass get_view to the plugin.
1442         (Plugin_manager::get_view): New.
1444 2011-03-21  Ian Lance Taylor  <iant@google.com>
1446         * testsuite/final_layout.sh: Rewrite to not use dc.
1447         * testsuite/relro_test.sh: Fail if dc is not present.
1449 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1451         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1452         Change == to -eq.
1453         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1454         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1455         Change == to -eq.
1456         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1457         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1459 2011-03-14  Ian Lance Taylor  <iant@google.com>
1461         * script-sections.cc (Sort_output_sections::script_compare):
1462         Rename from is_before, change return type.
1463         (Sort_output_sections::operator()): Adjust accordingly.
1465 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1467         PR gold/12572
1468         * testsuite/odr_violation2.cc: Add comment to make all error line
1469         numbers double digits.
1470         * testsuite/debug_msg.sh: Adjust expected errors.
1472 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1474         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1475         but mark earlier ones as non-canonical
1476         (offset_to_iterator): Update search target and example
1477         (do_addr2line): Return extra lines in a vector*
1478         (format_file_lineno): Extract from do_addr2line
1479         (one_addr2line): Add vector* out-param
1480         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1481         when a lineno entry appeared last for its instruction
1482         (Dwarf_line_info): Add vector* out-param
1483         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1484         * symtab.cc (Odr_violation_compare): Include the lineno in the
1485         comparison again.
1486         (linenos_from_loc): New. Combine the canonical line for an
1487         address with its other lines.
1488         (True_if_intersect): New. Helper functor to make
1489         std::set_intersection a query.
1490         (detect_odr_violations): Compare sets of lines instead of just
1491         one line for each function. This became less deterministic, but
1492         has fewer false positives.
1493         * symtab.h: Declarations.
1494         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1495         mix an optimized and non-optimized object in the same binary
1496         (odr_violation2.so): Same.
1497         * testsuite/Makefile.in: Regenerate from Makefile.am.
1498         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1499         * testsuite/debug_msg.sh: Update line numbers and add
1500         assertions.
1501         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1502         non-optimized context.
1503         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1504         isn't inlined, and use OdrDerived in an optimized context.
1505         * testsuite/odr_header1.h: Defines OdrDerived, where
1506         optimization will change the
1507         first-instruction-in-the-destructor's file and line number.
1508         * testsuite/odr_header2.h: Defines OdrBase.
1510 2011-03-09  Ian Lance Taylor  <iant@google.com>
1512         * fileread.cc (File_read::clear_views): Don't delete the whole
1513         file view.
1515 2011-03-08  Ian Lance Taylor  <iant@google.com>
1517         PR gold/12525
1518         * fileread.cc: #include <climits>.
1519         (GOLD_IOV_MAX): Define.
1520         (File_read::read_multiple): Limit number of entries by iov_max.
1521         * fileread.h (class File_read): Always set max_readv_entries to
1522         128.
1524 2011-03-07  Ian Lance Taylor  <iant@google.com>
1526         PR gold/12525
1527         * options.h (class General_options): Add -dy and -dn.
1529 2011-03-02  Cary Coutant  <ccoutant@google.com>
1531         * testsuite/script_test_9.t: Add TLS segment.
1533 2011-03-02  Simon Baldwin  <simonb@google.com>
1535         * configure.ac: Add check for gnu_indirect_function support in
1536         the toolchain building binutils.
1537         * configure: Rebuild.
1539 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1541         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1542         plugin only symbols.
1543         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1544         in plugin files as not needed in the symbol table.
1546 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1548         * output.cc (Output_section::add_input_section): Delay fill
1549         generation for section ordering.
1551 2011-02-09  Ian Lance Taylor  <iant@google.com>
1553         PR gold/12316
1554         * object.h (class Sized_relobj): Remove clear_local_symbols.
1555         * reloc.cc (Sized_relobj::do_relocate): Don't call
1556         clear_local_symbols.
1558 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1560         * plugin.cc (is_visible_from_outside): Return true for symbols
1561         in the -u option.
1563 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1565         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1566         filename.
1568 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1570         * icf.h (is_section_foldable_candidate): Change type of parameter
1571         to std::string.
1572         * icf.cc (Icf::find_identical_sections): Change type of local variable
1573         section_name to be std::string.
1574         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1576 2011-01-25  Ian Lance Taylor  <iant@google.com>
1578         * script.cc (script_add_extern): Rewrite to use
1579         add_symbol_reference.
1581 2011-01-25  Doug Kwan  <dougkwan@google.com>
1583         * icf.cc (get_section_contents): Always lock section's object.
1585 2011-01-24  Ian Lance Taylor  <iant@google.com>
1587         * options.h (class General_options): Accept
1588         --no-detect-odr-violations.
1590 2011-01-24  Ian Lance Taylor  <iant@google.com>
1592         * version.cc (version_string): Bump to 1.11.
1594 2011-01-24  Ian Lance Taylor  <iant@google.com>
1596         * plugin.cc (class Plugin_rescan): Define new class.
1597         (Plugin_manager::claim_file): Set any_claimed_.
1598         (Plugin_manager::save_archive): New function.
1599         (Plugin_manager::save_input_group): New function.
1600         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1601         necessary.
1602         (Plugin_manager::new_undefined_symbol): New function.
1603         (Plugin_manager::rescan): New function.
1604         (Plugin_manager::rescannable_defines): New function.
1605         (Plugin_manager::add_input_file): Set any_added_.
1606         * plugin.h (class Plugin_manager): define new fields rescannable_,
1607         undefined_symbols_, any_claimed_, and any_added_.  Declare
1608         Plugin_rescan as friend.  Declare new functions.
1609         (Plugin_manager::Rescannable): Define type.
1610         (Plugin_manager::Rescannable_list): Define type.
1611         (Plugin_manager::Undefined_symbol_list): Define type.
1612         (Plugin_manager::Plugin_manager): Initialize new fields.
1613         * archive.cc (Archive::defines_symbol): New function.
1614         (Add_archive_symbols::run): Pass archive to plugins if any.
1615         * archive.h (class Archive): Declare defines_symbol.
1616         * readsyms.cc (Input_group::~Input_group): New function.
1617         (Finish_group::run): Pass input_group to plugins if any.
1618         * readsyms.h (class Input_group): Declare destructor.
1619         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1620         any.
1622 2011-01-10  Ian Lance Taylor  <iant@google.com>
1624         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1625         section as relro.
1626         (Layout::set_segment_offsets): Reset increase_relro before calling
1627         set_section_addresses a second time.
1629 2011-01-04  Cary Coutant  <ccoutant@google.com>
1631         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1632         sections before NOBITS sections.
1634 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1636         * version.cc (print_version): Update copyright to 2011.
1638 2010-12-23  Cary Coutant  <ccoutant@google.com>
1640         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1641         of OS to this->add.  Add OD parameter to second form of the function.
1643 2010-12-20  Ian Lance Taylor  <iant@google.com>
1645         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1646         second of two consecutive entries with same offset.
1648 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1650         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1651         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1652         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1653         to avoid unneeded links against $(LDADD).
1654         * testsuite/Makefile.in: Regenerate.
1656 2010-12-15  Ian Lance Taylor  <iant@google.com>
1658         PR gold/12324
1659         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1660         for R_X86_64_32 and R_X86_64_PC32.
1661         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1662         ver_matching_def_pic.o.
1663         (ver_matching_def_pic.o): New target.
1665 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1667         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1668         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1669         Move definition before File_read::View member definitions.
1670         (File_read::View::~View): Initialize and hold lock before
1671         updating current_mapped_bytes.
1673 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1675         * dwarf_reader.cc: Remove outdated comment.
1676         * gold-threads.cc: Fix typo in error message.
1677         * archive.cc: Fix typos in comments.
1678         * archive.h: Likewise.
1679         * arm-reloc-property.cc: Likewise.
1680         * arm-reloc-property.h: Likewise.
1681         * arm-reloc.def: Likewise.
1682         * arm.cc: Likewise.
1683         * attributes.h: Likewise.
1684         * cref.cc: Likewise.
1685         * ehframe.cc: Likewise.
1686         * fileread.h: Likewise.
1687         * gold.h: Likewise.
1688         * i386.cc: Likewise.
1689         * icf.cc: Likewise.
1690         * incremental.h: Likewise.
1691         * int_encoding.cc: Likewise.
1692         * layout.h: Likewise.
1693         * main.cc: Likewise.
1694         * merge.h: Likewise.
1695         * object.cc: Likewise.
1696         * object.h: Likewise.
1697         * options.cc: Likewise.
1698         * readsyms.cc: Likewise.
1699         * reduced_debug_output.cc: Likewise.
1700         * reloc.cc: Likewise.
1701         * script-sections.cc: Likewise.
1702         * sparc.cc: Likewise.
1703         * symtab.h: Likewise.
1704         * target-reloc.h: Likewise.
1705         * target.cc: Likewise.
1706         * target.h: Likewise.
1707         * timer.cc: Likewise.
1708         * timer.h: Likewise.
1709         * x86_64.cc: Likewise.
1711 2010-12-09  Cary Coutant  <ccoutant@google.com>
1713         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1714         stack.
1715         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1716         parameter; change all callers.
1717         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1718         * options.h (warn_execstack): New option.
1720 2010-12-07  Doug Kwan  <dougkwan@google.com>
1722         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1723         like function call relocations.
1725 2010-12-07  Ian Lance Taylor  <iant@google.com>
1727         * archive.cc (Archive::get_elf_object_for_member): Permit
1728         punconfigured to be NULL.
1729         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1730         (Archive::include_member): Pass NULL to get_elf_object_for_member
1731         if we searched for the archive and this is the first included
1732         object.
1734 2010-12-01  Ian Lance Taylor  <iant@google.com>
1736         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1737         track_relocs_type_ field.
1738         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1739         Set track_relocs_type_.
1740         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1741         contents when using RELA relocs.
1742         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1743         reloc_map_.
1744         * reloc.cc (Track_relocs::next_addend): New function.
1745         * reloc.h (class Track_relocs): Declare next_addend.
1747 2010-12-01  Ian Lance Taylor  <iant@google.com>
1749         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1750         virtual destructor.
1752 2010-12-01  Ian Lance Taylor  <iant@google.com>
1754         * README: Update compilers known to work and fail.
1756 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1758         * configure.in: For --enable-gold, handle value `default' instead of
1759         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1760         not the default.
1761         * configure: Regenerate.
1763 2010-11-18  Doug Kwan  <dougkwan@google.com>
1765         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1766         and right_alignment to be zero.  Store result alignment only if it is
1767         greater than existing alignment.
1769 2010-11-16  Cary Coutant  <ccoutant@google.com>
1771         PR gold/12220
1772         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1773         Check for ".zdebug_line".
1775 2010-11-16  Doug Kwan  <dougkwan@google.com>
1776             Cary Coutant  <ccoutant@google.com>
1778         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1779         by reference; adjust all callers.
1780         * output.cc (Output_segment::set_section_addresses): Adjust references
1781         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1782         list is empty.
1783         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1784         end at page boundary.
1786 2010-11-16  Cary Coutant  <ccoutant@google.com>
1788         PR gold/12220
1789         * layout.cc (Layout::choose_output_section): Transform names of
1790         compressed sections even when using a script with a SECTIONS clause.
1791         (Layout::output_section_name): Remove code to transform
1792         compressed debug section names.
1793         * output.cc (Output_section::add_input_section): Use uncompressed
1794         section size when tracking input sections.
1796 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1798         * symtab.h (Symbol::NON_PIC_REF): Remove.
1799         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1800         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1801         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1802         (Symbol::use_plt_offset): Take a flags argument and pass it
1803         directly to needs_dynamic_reloc.  Restrict check for undefined
1804         weak symbols to function calls.
1805         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1806         (Target_arm::Scan::global): Use it.
1807         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1808         (Target_arm::Relocate::relocate): Likewise.
1809         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1810         parameter with an r_type parameter.  Use get_reference_flags
1811         to get the flags.
1812         (Target_arm::Relocate::relocate): Update accordingly.
1813         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1814         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1815         (Target_i386::Scan::global): Likewise.
1816         (Target_i386::Relocate::relocate): Likewise.
1817         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1818         parameter with an r_type parameter.  Use get_reference_flags
1819         to get the flags.
1820         (Target_i386::Relocate::relocate): Update accordingly.
1821         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1822         (Target_powerpc::Scan::global): Use it.
1823         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1824         (Target_powerpc::Relocate::relocate): Likewise.
1825         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1826         (Target_sparc::Scan::global): Use it.
1827         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1828         (Target_sparc::Relocate::relocate): Likewise.
1829         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1830         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1831         (Target_x86_64::Scan::global): Likewise.
1832         (Target_x86_64::Relocate::relocate): Likewise.
1834 2010-11-08  Doug Kwan  <dougkwan@google.com>
1835             Cary Coutant  <ccoutant@google.com>
1837         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1838         (Arm_exidx_merge_section::section_contents_): New data member.
1839         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1840         (Arm_input_section::~Arm_input_section): De-allocate memory.
1841         (Arm_input_section::original_contents_): New data member.       
1842         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1843         in parameters instead of calling Object::section_contents without
1844         locking.
1845         (Arm_output_section::group_section): New parameter TASK.  Pass it
1846         to callees that need locking objects.
1847         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1848         to lock EXIDX input sections.  Fix a formatting issue.  Call
1849         Arm_exidx_merged_section::build_contents to create merged section
1850         contents.
1851         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1852         to lock object of stub table owner.
1853         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1854         TEXT_SIZE to initialize data member TEXT_SIZE_.
1855         (Arm_exidx_input_section::addralign): Fix typo in comment.
1856         (Arm_exidx_input_section::text_size): New method.
1857         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1858         that require locking objects.  Lock objects before scanning for stubs
1859         and updating local symbols.
1860         (Arm_input_section<big_endian>::init): Copy contents of original
1861         input section.
1862         (Arm_input_section<big_endian>::do_write): Use saved contents of
1863         original input section instead of calling Object::section_contents
1864         without locking.
1865         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1866         size without calling Object::section_size().
1867         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1868         for size.  Allocate a buffer for merged EXIDX entries.
1869         (Arm_exidx_merged_section::build_contents): New method.
1870         (Arm_exidx_merged_section::do_write): Move merge section contents
1871         building code to Arm_exidx_merged_section::build_contetns.  Write
1872         out contetns in buffer instead of building it on the fly.
1873         (Arm_relobj::make_exidx_input_section): Also pass text section size
1874         to Arm_exidx_input_section constructor.
1875         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1876         (Arm_dynobj::do_read_symbols): Fix memory leak.
1877         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1878         * target.h: (class Task): Add forward declaration.
1879         (Target::relax): Add new parameter TASK and pass it to
1880         Target::do_relax().
1881         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1883 2010-11-05  Cary Coutant  <ccoutant@google.com>
1885         PR gold/10708
1886         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1887         object when reading from the file.
1888         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1889         second layout pass.
1890         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1891         when reading section contents.
1892         (get_section_contents): Likewise.
1893         (icf::find_identical_sections): Likewise.
1894         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1895         object when reading from the file.
1896         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1897         the object when doing deferred section layout.
1899 2010-11-03  Nick Clifton  <nickc@redhat.com>
1901         PR gold/12001
1902         * script.h (class Symbol_assignment: name): New member.  Returns
1903         the name of the symbol.
1904         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1905         Returns true if the given symbol name is on the list of
1906         assignments wating to be processed.
1907         * archive.cc (should_incldue_member): If the symbol is undefined,
1908         check to see if it is on the list of symbols pending assignment.
1910 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1912         * script-sections.cc (Script_sections::find_memory_region): Check
1913         for a NULL output section pointer.
1915 2010-10-29  Doug Kwan  <dougkwan@google.com>
1917         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1918         Output_section::add_relaxed_input_section.
1919         * output.cc (Output_section::add_relaxed_input_section): Add new
1920         arguments LAYOUT and NAME.  Set section order index.
1921         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1922         Copy section order index.
1923         * output.h (Output_section::add_relaxed_input_section): Add new
1924         arguments LAYOUT and NAME.
1926 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1928         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1929         NATIVE_OR_CROSS_LINKER.
1930         * testsuite/Makefile.in: Regenerate.
1932 2010-10-20  Doug Kwan  <dougkwan@google.com>
1934         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1935         without SHF_LINK_ORDER flags.
1936         * layout.cc (Layout::choose_output_section): Do not filter
1937         SHF_LINK_ORDER flag in a relocatable link.
1939 2010-10-17  Cary Coutant  <ccoutant@google.com>
1941         * output.h (Output_segment::set_section_addresses): Change function
1942         signature.  Update all callers.
1943         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1944         sections.
1945         (Output_segment::set_section_addresses): Align after last TLS
1946         section.  Add padding before last relro section instead of after.
1948 2010-10-17  Doug Kwan  <dougkwan@google.com>
1950         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1951         GOT output section to be writable.
1953 2010-10-14  Cary Coutant  <ccoutant@google.com>
1955         * debug.h (DEBUG_INCREMENTAL): New flag.
1956         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1957         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1958         mode.
1959         * incremental.cc (report_command_line): Ignore all forms of
1960         --incremental.
1961         * layout.cc (Layout::Layout): Check parameters for incremental link
1962         mode.
1963         * options.cc (General_options::parse_incremental): New function.
1964         (General_options::parse_no_incremental): New function.
1965         (General_options::parse_incremental_full): New function.
1966         (General_options::parse_incremental_update): New function.
1967         (General_options::incremental_mode_): New data member.
1968         (General_options::finalize): Check incremental_mode_.
1969         * options.h (General_options): Update help text for --incremental.
1970         Add --no-incremental, --incremental-full, --incremental-update.
1971         (General_options::Incremental_mode): New enum type.
1972         (General_options::incremental_mode): New function.
1973         (General_options::incremental_mode_): New data member.
1974         * parameters.cc (Parameters::incremental_mode_): New data member.
1975         (Parameters::set_options): Set incremental_mode_.
1976         (Parameters::set_incremental_full): New function.
1977         (Parameters::incremental): New function.
1978         (Parameters::incremental_update): New function.
1979         (set_parameters_incremental_full): New function.
1980         * parameters.h (Parameters::set_incremental_full): New function.
1981         (Parameters::incremental): New function.
1982         (Parameters::incremental_update): New function.
1983         (Parameters::incremental_mode_): New data member.
1984         (set_parameters_incremental_full): New function.
1985         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1986         incremental link mode.
1987         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1988         (Sized_relobj::do_relocate_sections): Likewise.
1989         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1990         option.
1991         * testsuite/Makefile.in: Regenerate.
1992         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1994 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1996         * script-sections.h (class Script_sections): Make
1997         Sections_elements typedef public.
1998         * script-sections.cc (class Sort_output_sections): Add elements_
1999         field.  Add constructor which sets it; change all callers.
2000         (Sort_output_sections::is_before): New function.
2001         (Sort_output_sections::operator()): Call is_before.
2002         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2003         conditional.
2004         * testsuite/script_test_10.sh: New test. Test script section
2005         order.
2006         * testsuite/script_test_10.t: Likewise.
2007         * testsuite/script_test_10.s: Likewise.
2008         * testsuite/Makefile.am: Wrap the cross linker tests and the
2009         common tests into NATIVE_OR_CROSS_LINKER.
2010         (check_SCRIPTS): Add script_test_10.sh.
2011         (check_DATA): Add script_test_10.stdout.
2012         (script_test_10.o, script_test_10): New targets.
2013         (script_test_10.stdout): New target.
2014         * configure, testsuite/Makefile.in: Regenerate.
2016 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2018         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2019         error for the deprecated relocations.
2020         (Target_arm::Scan::global): Likewise.
2021         (Target_arm::Relocate::relocate): Likewise.
2023 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2025         * fileread.cc (Input_file::find_file): Initialize *found_name
2026         and *namep when using the fallback search for case 4.
2028 2010-10-11  Cary Coutant  <ccoutant@google.com>
2030         * options.h (class General_options): Redefine -z lazy as an alias for
2031         the negation of -z now.
2033 2010-10-11  Ian Lance Taylor  <iant@google.com>
2035         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2036         binding.
2038 2010-10-06  Nick Clifton  <nickc@redhat.com>
2040         * script-sections.cc(class Memory_region): Remove
2041         current_lma_offset_ field.  Rename current_vma_offset_ to
2042         current_offset_.  Add last_section_ field.
2043         (Memory_region::get_current_vma_address): Rename to
2044         get_current_address.
2045         (Memory_region::get_current_lma_address): Delete.
2046         (Memory_region::increment_vma_offset): Rename to
2047         increment_offset.
2048         (Memory_region::increment_lma_offset): Delete.
2049         (Memory_region::attributes_compatible): New method.  Returns
2050         true if the provided section is compatible with the region.
2051         (Memory_region::get_last_section): New method.  Returns the last
2052         section to use the region.
2053         (Memory_region::set_last_section): New method.  Stores the last
2054         section to use the region.
2055         (Script_sections::block_in_region): New method.  Returns true if
2056         a block of memory is contained within a region.
2057         (Script_sections::find_memory_region): New method.  Locates a
2058         memory region to be used to set a VMA or LMA address.
2059         (Output_section_definition::set_section_addresses): Add code to
2060         check for addresses set by memory regions.
2061         (Output_segment::set_section_addresses): Remove memory region
2062         walking code.
2063         (Script_sections::create_segment): Add a warning if a header
2064         segment is created outside of any region.
2065         * script-sections.h (class Script_sections): Add prototypes for
2066         find_memory_region and block_in_region methods.
2067         * testsuite/memory_test.s: Use .long instead of .word.
2068         * testsuite/memory_test.t: Add some more output sections.
2069         * testsuite/memory_test.sh: Update expected output.
2071 2010-10-02  Doug Kwan  <dougkwan@google.com>
2073         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2074         defintion to symtab.h
2075         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2076         declaration to defintion.
2078 2010-10-01  Nick Clifton  <nickc@redhat.com>
2080         * expression.cc (eval): Replace dummy argument with NULL.
2081         (eval_maybe_dot): Check for a NULL result section pointer.
2082         (Symbol_expression::value): Likewise.
2083         (Dot_expression::value): Likewise.
2084         (BINARY_EXPRESSION): Likewise.
2085         (Max_expression::value): Likewise.
2086         (Min_expression::value): Likewise.
2087         (Absolute_expression::value): Likewise.
2088         (Addr_expression::value_from_output_section): Likewise.
2089         (Loaddddr_expression::value_from_output_section): Likewise.
2090         (Segment_start_expression::value): Likewise.
2091         * script-sections.cc
2092         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2093         argument with NULL.
2094         (Sections_elememt_dot_assignment::set_section_addresses):
2095         Likewise.
2096         (Output_data_expression::do_write_to_buffer): Likewise.
2097         (Output_section_definition::finalize_symbols): Likewise.
2098         (Output_section_definition::set_section_addresses): Likewise.
2100 2010-09-30  Doug Kwan  <dougkwan@google.com>
2102         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2104 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2106         * target.h (Target::can_icf_inline_merge_sections): New virtual
2107         function.
2108         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2109         virtual function.
2110         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2111         virtual function.
2112         * icf.cc (get_section_contents): Inline merge sections only when
2113         target allows it.
2115 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2117         * configure: Regenerate.
2119 2010-09-17  Ian Lance Taylor  <iant@google.com>
2121         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2122         * testsuite/Makefile.am (memory_test.o): New target.
2123         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2124         memory_test.t.
2125         * testsuite/Makefile.in: Rebuild.
2127 2010-09-17  Doug Kwan  <dougkwan@google.com>
2129         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2130         defintion if relocation uses GOT entries of the symbol.
2131         * testsuite/icf_safe_test.sh: Fix test.
2132         * testsuite/icf_safe_so_test.sh: Fix test.
2134 2010-09-16  Cary Coutant  <ccoutant@google.com>
2136         * script_sections.cc (class Memory_region): Remove "NULL" from
2137         vector initializations.
2139 2010-09-15  Cary Coutant  <ccoutant@google.com>
2141         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2142         Resolve forwarding symbols.
2144 2010-09-15  Doug Kwan  <dougkwan@google.com>
2146         * gold/testsuite/script_test_3.t: Add ARM special sections.
2147         * gold/testsuite/script_test_4.t: Same.
2148         * gold/testsuite/script_test_5.t: Same.
2149         * gold/testsuite/script_test_6.t: Same.
2150         * gold/testsuite/script_test_7.t: Same.
2151         * gold/testsuite/script_test_7.t: Same.
2152         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2154 2010-09-14  Cary Coutant  <ccoutant@google.com>
2156         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2157         (Target_x86_64::Relocate::relocate_tls): Replace check for
2158         saw_tls_block_reloc_ with test for executable section.
2160 2010-09-12  Cary Coutant  <ccoutant@google.com>
2162         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2163         position-independent executables to shared libraries need dynamic
2164         relocations.
2165         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2166         position-independent executables.
2167         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2168         * testsuite/Makefile.in: Regenerate.
2170 2010-09-10  Nick Clifton  <nickc@redhat.com>
2172         PR gold/11997
2173         * testsuite/memory_test.t: Discard any sections that are not
2174         needed.
2176 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2178         PR gold/11996
2179         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2180         "This::" to work around a bug in gcc 4.2.
2182         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2184 2010-09-09  Rafael Espindola  <espindola@google.com>
2186         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2187         sections with different PF_X flags in the same segment.
2188         (Layout::find_first_load_seg): Search all segments to find the first
2189         one.
2190         * options.h (rosegment): New.
2192 2010-09-08  Rafael Espindola  <espindola@google.com>
2194         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2196 2010-09-08  Doug Kwan  <dougkwan@google.com>
2198         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2199         (Arm_relobj::do_relocate_sections): Add new parameter for output
2200         file to match the parent.
2201         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2202         of local symbols instead of input values.  Update code to track
2203         changes in gold::relocate_section.
2204         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2205         (Sized_relobj::compute_final_local_value_internal): New methods.
2206         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2207         body into private version of Sized_relobj::compute_final_local_value.
2208         Call the inline method.
2209         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2210         merged symbol value if there is one.
2211         (Symbol_value::has_output_value): New method defintiion.
2212         (Sized_relobj::Compute_final_local_value_status): New enum type.
2213         (Sized_relobj::compute_final_local_value): New methods.
2214         (Sized_relobj::compute_final_local_value_internal): New methods.
2215         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2216         and arm_cortex_a8.sh.
2217         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2218         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2219         New tests.
2220         * Makefile.in: Regenerate.
2221         * testsuite/arm_bl_out_of_range.s: Update test.
2222         * testsuite/thumb_bl_out_of_range.s: Ditto.
2223         * testsuite/thumb_blx_out_of_range.s: Ditto.
2224         * testsuite/arm_branch_out_of_range.sh: New file.
2225         * testsuite/arm_cortex_a8.sh: Ditto.
2226         * testsuite/arm_cortex_a8_b.s: Ditto.
2227         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2228         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2229         * testsuite/arm_cortex_a8_bl.s: Ditto.
2230         * testsuite/arm_cortex_a8_blx.s: Ditto.
2231         * testsuite/arm_cortex_a8_local.s: Ditto.
2232         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2233         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2235 2010-09-08  Rafael Espindola  <espindola@google.com>
2237         * Makefile.am (memory_test.stdout): Run readelf with -W.
2238         * Makefile.in: Regenerate.
2239         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2240         64 bit output.
2242 2010-09-08  Rafael Espindola  <espindola@google.com>
2244         * script-sections.cc (Script_sections::add_memory_region): Convert
2245         field precision to int.
2246         * script.cc (script_set_section_region, script_set_section_region):
2247         Convert field precision to int.
2249 2010-09-08  Rafael Espindola  <espindola@google.com>
2251         * arm.cc (do_finalize_sections): Create the __exidx_start and
2252         __exdix_end symbols even when the section is missing.
2254 2010-09-08  Nick Clifton  <nickc@redhat.com>
2256         * README: Remove claim that MEMORY is not supported.
2257         * expression.cc (script_exp_function_origin)
2258         (script_exp_function_length): Move from here to ...
2259         * script.cc: ... here.
2260         (script_set_section_region, script_add_memory)
2261         (script_parse_memory_attr, script_include_directive): New
2262         functions.
2263         * script-sections.cc
2264         (class Memory_region): New class.
2265         (class Output_section_definition): Add set_memory_region,
2266         set_section_vma, set_section_lma and get_section_name methods.
2267         (class Script_Sections): Add add_memory_region,
2268         find_memory_region, find_memory_region_origin,
2269         find_memory_region_length and set_memory_region methods.
2270         Have set_section_addresses method walk the list of set memory
2271         regions.
2272         Extend the print methos to display memory regions.
2273         * script-sections.h: Add prototypes for new methods.
2274         Add enum for MEMORY region attributes.
2275         * yyscript.y: Add support for parsing MEMORY regions.
2276         * script-c.h: Add prototypes for new functions.
2277         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2278         * testsuite/Makefile.in: Regenerate.
2279         * testsuite/memory_test.sh: New script.
2280         * testsuite/memory_test.s: New assembler source file.
2281         * testsuite/memory_test.t: New linker script.
2283 2010-08-27  Doug Kwan  <dougkwan@google.com>
2285         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2286         reference override an existing dynamic weak reference.
2287         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2288         * testsuite/Makefile.in: Regenerate.
2289         * testsuite/dyn_weak_ref.sh: New file.
2290         * testsuite/dyn_weak_ref_1.c: Ditto.
2291         * testsuite/dyn_weak_ref_2.c: Ditto.
2293 2010-08-27  Ian Lance Taylor  <iant@google.com>
2295         * incremental.h (class Incremental_input_entry): Add virtual
2296         destructor.
2298 2010-08-27  Ian Lance Taylor  <iant@google.com>
2300         * testsuite/start_lib_test_3.c: Mark t3 as used.
2302 2010-08-27  Nick Clifton  <nickc@redhat.com>
2304         * options.cc (version_script): Fix small typo in previous
2305         whitespace tidyup.
2307 2010-08-25  Nick Clifton  <nickc@redhat.com>
2309         * archive.cc: Formatting fixes: Remove whitespace between
2310         typename and following asterisk.  Remove whitespace between
2311         function name and opening parenthesis.
2312         * archive.h: Likewise.
2313         * arm.cc: Likewise.
2314         * attributes.cc: Likewise.
2315         * attributes.h: Likewise.
2316         * common.cc: Likewise.
2317         * copy-relocs.cc: Likewise.
2318         * dirsearch.h: Likewise.
2319         * dynobj.cc: Likewise.
2320         * ehframe.cc: Likewise.
2321         * ehframe.h: Likewise.
2322         * expression.cc: Likewise.
2323         * fileread.cc: Likewise.
2324         * fileread.h: Likewise.
2325         * gc.h: Likewise.
2326         * gold-threads.cc: Likewise.
2327         * gold.cc: Likewise.
2328         * i386.cc: Likewise.
2329         * icf.h: Likewise.
2330         * incremental-dump.cc: Likewise.
2331         * incremental.cc: Likewise.
2332         * layout.cc: Likewise.
2333         * layout.h: Likewise.
2334         * main.cc: Likewise.
2335         * merge.cc: Likewise.
2336         * merge.h: Likewise.
2337         * object.cc: Likewise.
2338         * object.h: Likewise.
2339         * options.cc: Likewise.
2340         * options.h: Likewise.
2341         * output.cc: Likewise.
2342         * output.h: Likewise.
2343         * plugin.cc: Likewise.
2344         * plugin.h: Likewise.
2345         * powerpc.cc: Likewise.
2346         * reloc.cc: Likewise.
2347         * script-c.h: Likewise.
2348         * script-sections.cc: Likewise.
2349         * script.cc: Likewise.
2350         * stringpool.cc: Likewise.
2351         * symtab.cc: Likewise.
2352         * symtab.h: Likewise.
2353         * target.cc: Likewise.
2354         * timer.cc: Likewise.
2355         * timer.h: Likewise.
2356         * version.cc: Likewise.
2357         * x86_64.cc: Likewise.
2359 2010-08-24  Nick Clifton  <nickc@redhat.com>
2361         PR 11899
2362         * layout.cc (segment_precedes): Sort segments by their physical
2363         addresses, if they have been set.
2365 2010-08-23  Cary Coutant  <ccoutant@google.com>
2367         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2368         symbols data.
2369         (Lib_group::include_member): Unlock object after deleting its
2370         symbols data.
2371         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2372         the bug fixed here.
2374 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2375             Cary Coutant  <ccoutant@google.com>
2377         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2378         constructor, and set_blocker.
2379         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2380         readsyms_blocker_.
2381         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2382         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2383         * testsuite/Makefile.am (start_lib_test): New test case.
2384         * testsuite/Makefile.in: Regenerate.
2385         * testsuite/start_lib_test_main.c: New file.
2386         * testsuite/start_lib_test_1.c: New file.
2387         * testsuite/start_lib_test_2.c: New file.
2388         * testsuite/start_lib_test_3.c: New file.
2390 2010-08-19  Ian Lance Taylor  <iant@google.com>
2392         * Makefile.in: Rebuild with automake 1.11.1.
2393         * aclocal.m4: Likewise.
2394         * testsuite/Makefile.in: Likewise.
2396 2010-08-19  Ian Lance Taylor  <iant@google.com>
2398         PR 10893
2399         * i386.cc (class Output_data_plt_i386): Update declarations.
2400         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2401         local_ifuncs_ fields.
2402         (Target_i386::do_plt_section_for_global): New function.
2403         (Target_i386::do_plt_section_for_local): New function.
2404         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2405         parameter; change all callers.  Initialize global_ifuncs_ and
2406         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2407         __rel_iplt_end.
2408         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2409         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2410         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2411         symbols.
2412         (Target_i386::make_plt_section): New function, broken out of
2413         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2414         (Target_i386::make_plt_entry): Call make_plt_section.
2415         (Target_i386::make_local_ifunc_plt_entry): New function.
2416         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2417         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2418         R_386_IRELATIVE to switch.
2419         (Target_i386::Scan::global): Likewise.
2420         (Target_i386::Relocate::relocate): Likewise.
2421         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2422         switch.
2423         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2424         (Target_x86_64::do_plt_section_for_global): New function.
2425         (Target_x86_64::do_plt_section_for_local): New function.
2426         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2427         parameter; change all callers.  If doing a static link define
2428         __rela_iplt_start and __rela_iplt_end.
2429         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2430         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2431         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2432         to point to .plt.
2433         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2434         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2435         switch.
2436         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2437         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2438         R_X86_64_IRELATIVE to switch.
2439         (Target_x86_64::Scan::global): Likewise.
2440         (Target_x86_64::Relocate::relocate): Likewise.
2441         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2442         switch.
2443         * target.h (class Target): Add plt_section_for_global and
2444         plt_section_for_local functions.  Add do_plt_section_for_global
2445         and do_plt_section_for_local virtual functions.
2446         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2447         clarifying comments.
2448         (Symbol::use_plt_offset): Handle IFUNC symbol.
2449         * object.cc (Sized_relobj::Sized_relobj): Initialize
2450         local_plt_offsets_.
2451         (Sized_relobj::local_has_plt_offset): New function.
2452         (Sized_relobj::local_plt_offset): New function.
2453         (Sized_relobj::set_local_plt_offset): New function.
2454         (Sized_relobj::do_count): Handle IFUNC symbol.
2455         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2456         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2457         is_ifunc_symbol functions.
2458         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2459         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2460         local_plt_offsets_ field.
2461         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2462         * output.h (class Output_section_data): Add non-const
2463         output_section function.
2464         (class Output_data_got): Update declarations.
2465         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2466         Add use_plt_offset parameter to global and local constructors.
2467         Change all callers.  Change local_sym_index_ field to 31 bits.
2468         Change GSYM_CODE and CONSTANT_CODE accordingly.
2469         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2470         doing a static link don't set sh_link field.
2471         (Output_data_got::Got_entry::write): Use PLT offset if
2472         appropriate.
2473         (Output_data_got::add_global_plt): New function.
2474         (Output_data_got::add_local_plt): New function.
2475         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2476         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2477         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2478         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2479         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2480         IFUNC conditional.
2481         * testsuite/ifunc-sel.h: New file.
2482         * testsuite/ifuncmain1.c: New file.
2483         * testsuite/ifuncmain1vis.c: New file.
2484         * testsuite/ifuncmod1.c: New file.
2485         * testsuite/ifuncdep2.c: New file.
2486         * testsuite/ifuncmain2.c: New file.
2487         * testsuite/ifuncmain3.c: New file.
2488         * testsuite/ifuncmod3.c: New file.
2489         * testsuite/ifuncmain4.c: New file.
2490         * testsuite/ifuncmain5.c: New file.
2491         * testsuite/ifuncmod5.c: New file.
2492         * testsuite/ifuncmain6pie.c: New file.
2493         * testsuite/ifuncmod6.c: New file.
2494         * testsuite/ifuncmain7.c: New file.
2495         * configure, testsuite/Makefile.in: Rebuild.
2497 2010-08-18  Ian Lance Taylor  <iant@google.com>
2499         * incremental.cc
2500         (Output_section_incremental_inputs::write_input_files): Add cast
2501         to avoid signed/unsigned comparison warning.
2502         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2504 2010-08-12  Cary Coutant  <ccoutant@google.com>
2506         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2508 2010-08-13  Ian Lance Taylor  <iant@google.com>
2510         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2512 2010-08-12  Cary Coutant  <ccoutant@google.com>
2513             Doug Kwan  <dougkwan@google.com>
2515         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2516         defintion overrides non-weak undef, remember that the original undef
2517         is not weak.
2518         * symtab.cc (Symbol_table::sized_write_global): For undef without
2519         an original weak binding, set binding to global in output.
2520         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2521         * testsuite/Makefile.in: Regenerate.
2522         * testsuite/strong_ref_weak_def.sh: New file.
2523         * testsuite/strong_ref_weak_def_1.c: Ditto.
2524         * testsuite/strong_ref_weak_def_2.c: Ditto.
2526 2010-08-12  Cary Coutant  <ccoutant@google.com>
2528         * testsuite/incremental_test.sh: Rewrite.
2529         * testsuite/incremental_test_1.c: Rewrite.
2530         * testsuite/incremental_test_2.c: Rewrite.
2532 2010-08-12  Cary Coutant  <ccoutant@google.com>
2534         * arm.cc (Target_arm::got_size): Add const.
2535         (Target_arm::got_entry_count): New function.
2536         (Target_arm::plt_entry_count): New function.
2537         (Target_arm::first_plt_entry_offset): New function.
2538         (Target_arm::plt_entry_size): New function.
2539         (Output_data_plt_arm::entry_count): New function.
2540         (Output_data_plt_arm::first_plt_entry_offset): New function.
2541         (Output_data_plt_arm::get_plt_entry_size): New function.
2542         * i386.cc (Target_i386::got_size): Add const.
2543         (Target_i386::got_entry_count): New function.
2544         (Target_i386::plt_entry_count): New function.
2545         (Target_i386::first_plt_entry_offset): New function.
2546         (Target_i386::plt_entry_size): New function.
2547         (Output_data_plt_i386::entry_count): New function.
2548         (Output_data_plt_i386::first_plt_entry_offset): New function.
2549         (Output_data_plt_i386::get_plt_entry_size): New function.
2550         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2551         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2552         * incremental.cc: Include target.h.
2553         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2554         parameter.  Adjust all callers.  Find incremental_got_plt section.
2555         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2556         section.
2557         (Output_section_incremental_inputs::set_final_data_size): Calculate
2558         size of incremental_got_plt section.
2559         (Output_section_incremental_inputs::do_write): Write the
2560         incremental_got_plt section.
2561         (Got_plt_view_info): New struct.
2562         (Local_got_offset_visitor): New class.
2563         (Global_got_offset_visitor): New class.
2564         (Global_symbol_visitor_got_plt): New class.
2565         (Output_section_incremental_inputs::write_got_plt): New function.
2566         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2567         Add parameter.  Adjust all callers.
2568         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2569         (Incremental_inputs::got_plt_section): New function.
2570         (Incremental_inputs::got_plt_section_): New data member.
2571         (Incremental_got_plt_reader): New class.
2572         * layout.cc (Layout::create_incremental_info_sections): Add the
2573         incremental_got_plt section.
2574         * object.h (Got_offset_list::get_list): New function.
2575         (Got offset_list::for_all_got_offsets): New function.
2576         (Sized_relobj::local_got_offset_list): New function.
2577         * powerpc.cc (Target_powerpc::got_size): Add const.
2578         (Target_powerpc::got_entry_count): New function.
2579         (Target_powerpc::plt_entry_count): New function.
2580         (Target_powerpc::first_plt_entry_offset): New function.
2581         (Target_powerpc::plt_entry_size): New function.
2582         (Output_data_plt_powerpc::entry_count): New function.
2583         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2584         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2585         * sparc.cc (Target_sparc::got_size): Add const.
2586         (Target_sparc::got_entry_count): New function.
2587         (Target_sparc::plt_entry_count): New function.
2588         (Target_sparc::first_plt_entry_offset): New function.
2589         (Target_sparc::plt_entry_size): New function.
2590         (Output_data_plt_sparc::entry_count): New function.
2591         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2592         (Output_data_plt_sparc::get_plt_entry_size): New function.
2593         * symtab.h (Symbol::got_offset_list): New function.
2594         (Symbol_table::for_all_symbols): New function.
2595         * target.h (Sized_target::got_entry_count): New function.
2596         (Sized_target::plt_entry_count): New function.
2597         (Sized_target::plt_entry_size): New function.
2598         * x86_64.cc (Target_x86_64::got_size): Add const.
2599         (Target_x86_64::got_entry_count): New function.
2600         (Target_x86_64::plt_entry_count): New function.
2601         (Target_x86_64::first_plt_entry_offset): New function.
2602         (Target_x86_64::plt_entry_size): New function.
2603         (Output_data_plt_x86_64::entry_count): New function.
2604         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2605         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2607 2010-08-12  Cary Coutant  <ccoutant@google.com>
2609         * archive.cc: Include incremental.h.
2610         (Archive::Archive): Initialize incremental_info_.
2611         (Archive::include_member): Record archive members in incremental info.
2612         (Add_archive_symbols::run): Record begin and end of an archive in
2613         incremental info.
2614         (Lib_group::include_member): Record objects in incremental info.
2615         * archive.h (Incremental_archive_entry): Forward declaration.
2616         (Archive::set_incremental_info): New member function.
2617         (Archive::incremental_info): New member function.
2618         (Archive::Unused_symbol_iterator): New class.
2619         (Archive::unused_symbols_begin): New member function.
2620         (Archive::unused_symbols_end): New member function.
2621         (Archive::incremental_info_): New data member.
2622         * incremental-dump.cc (find_input_containing_global): New function.
2623         (dump_incremental_inputs): Dump new incremental info sections.
2624         * incremental.cc: Include symtab.h.
2625         (Output_section_incremental_inputs): New class.
2626         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2627         new incremental info sections.
2628         (Sized_incremental_binary::do_check_inputs): Likewise.
2629         (Incremental_inputs::report_archive): Remove.
2630         (Incremental_inputs::report_archive_begin): New function.
2631         (Incremental_inputs::report_archive_end): New function.
2632         (Incremental_inputs::report_object): New function.
2633         (Incremental_inputs::finalize_inputs): Remove.
2634         (Incremental_inputs::report_input_section): New function.
2635         (Incremental_inputs::report_script): Rewrite.
2636         (Incremental_inputs::finalize): Do nothing but finalize string table.
2637         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2638         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2639         (Incremental_inputs::create_data_sections): New function.
2640         (Incremental_inputs::relocs_entsize): New function.
2641         (Output_section_incremental_inputs::set_final_data_size): New function.
2642         (Output_section_incremental_inputs::do_write): New function.
2643         (Output_section_incremental_inputs::write_header): New function.
2644         (Output_section_incremental_inputs::write_input_files): New function.
2645         (Output_section_incremental_inputs::write_info_blocks): New function.
2646         (Output_section_incremental_inputs::write_symtab): New function.
2647         * incremental.h (Incremental_script_entry): Forward declaration.
2648         (Incremental_object_entry): Forward declaration.
2649         (Incremental_archive_entry): Forward declaration.
2650         (Incremental_inputs): Forward declaration.
2651         (Incremental_inputs_header_data): Remove.
2652         (Incremental_inputs_header): Remove.
2653         (Incremental_inputs_header_write): Remove.
2654         (Incremental_inputs_entry_data): Remove.
2655         (Incremental_inputs_entry): Remove.
2656         (Incremental_inputs_entry_write): Remove.
2657         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2658         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2659         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2660         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2661         Likewise.
2662         (Incremental_input_entry): New class.
2663         (Incremental_script_entry): New class.
2664         (Incremental_object_entry): New class.
2665         (Incremental_archive_entry): New class.
2666         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2667         (Incremental_inputs::report_inputs): Remove.
2668         (Incremental_inputs::report_archive): Remove.
2669         (Incremental_inputs::report_archive_begin): New function.
2670         (Incremental_inputs::report_archive_end): New function.
2671         (Incremental_inputs::report_object): Change prototype.
2672         (Incremental_inputs::report_input_section): New function.
2673         (Incremental_inputs::report_script): Change prototype.
2674         (Incremental_inputs::get_reloc_count): New function.
2675         (Incremental_inputs::set_reloc_count): New function.
2676         (Incremental_inputs::create_data_sections): New function.
2677         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2678         (Incremental_inputs::inputs_section): New function.
2679         (Incremental_inputs::symtab_section): New function.
2680         (Incremental_inputs::relocs_section): New function.
2681         (Incremental_inputs::get_stringpool): Add const.
2682         (Incremental_inputs::command_line): Add const.
2683         (Incremental_inputs::inputs): Remove.
2684         (Incremental_inputs::command_line_key): New function.
2685         (Incremental_inputs::input_file_count): New function.
2686         (Incremental_inputs::input_files): New function.
2687         (Incremental_inputs::relocs_entsize): New function.
2688         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2689         (Incremental_inputs::finalize_inputs): Remove.
2690         (Incremental_inputs::Input_info): Remove.
2691         (Incremental_inputs::lock_): Remove.
2692         (Incremental_inputs::inputs_): Change type.
2693         (Incremental_inputs::inputs_map_): Remove.
2694         (Incremental_inputs::current_object_entry_): New data member.
2695         (Incremental_inputs::inputs_section_): New data member.
2696         (Incremental_inputs::symtab_section_): New data member.
2697         (Incremental_inputs::relocs_section_): New data member.
2698         (Incremental_inputs::reloc_count_): New data member.
2699         (Incremental_inputs_reader): New class.
2700         (Incremental_symtab_reader): New class.
2701         (Incremental_relocs_reader): New class.
2702         * layout.cc (Layout::finalize): Move finalization of incremental info
2703         and creation of incremental info sections to follow finalization of
2704         symbol table.  Set offsets for postprocessing sections.
2705         (Layout::create_incremental_info_sections): Call
2706         Incremental_inputs::create_data_sections.  Add incremental symtab
2707         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2708         sections to layout after input sections.
2709         * layout.h (struct Timespec): Forward declaration.
2710         (Layout::incremental_inputs): Add const.
2711         (Layout::create_incremental_info_sections): Add parameter.
2712         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2713         * object.cc: Include incremental.h.
2714         (Relobj::finalize_incremental_relocs): New function.
2715         (Sized_relobj::do_layout): Record input sections in incremental info.
2716         * object.h (Object::output_section): New function.
2717         (Object::output_section_offset): Moved from Relobj.
2718         (Object::get_incremental_reloc_base): New function.
2719         (Object::get_incremental_reloc_count): New function.
2720         (Object::do_output_section): New function.
2721         (Object::do_output_section_offset): Moved from Relobj.
2722         (Object::do_get_incremental_reloc_base): New function.
2723         (Object::do_get_incremental_reloc_count): New function.
2724         (Object::Object): Initialize new data members.
2725         (Relobj::output_section): Renamed do_output_section and moved to
2726         protected.
2727         (Relobj::output_section_offset): Moved to Object.
2728         (Relobj::do_get_incremental_reloc_base): New function.
2729         (Relobj::do_get_incremental_reloc_count): New function.
2730         (Relobj::allocate_incremental_reloc_counts): New function.
2731         (Relobj::count_incremental_reloc): New function.
2732         (Relobj::finalize_incremental_relocs): New function.
2733         (Relobj::next_incremental_reloc_index): New function.
2734         (Relobj::reloc_counts_): New data member.
2735         (Relobj::reloc_bases_): New data member.
2736         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2737         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2738         (Sized_relobj::incremental_relocs_scan): New function.
2739         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2740         (Sized_relobj::incremental_relocs_write): New function.
2741         (Sized_relobj::incremental_relocs_write_reltype): New function.
2742         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2743         incremental link.
2744         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2745         archives and object files elsewhere.
2746         (Add_symbols::run): Report object files here.
2747         (Finish_group::run): Report end of archive at end of group.
2748         * reloc.cc: Include layout.h, incremental.h.
2749         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2750         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2751         (Sized_relobj::incremental_relocs_scan): New function.
2752         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2753         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2754         (Sized_relobj::incremental_relocs_write): New function.
2755         (Sized_relobj::incremental_relocs_write_reltype): New function.
2756         * script.cc (read_input_script): Rewrite test for incremental link.
2757         Change call to Incremental_inputs::report_script.
2758         * symtab.h (Symbol_table::first_global_index): New function.
2759         (Symbol_table::output_count): New function.
2761 2010-08-12  Doug Kwan  <dougkwan@google.com>
2763         * arm.cc (Target_arm::merge_object_attributes): Check command line
2764         options --no-wchar-size-warning and --no-enum-size-warning.
2765         * options.h (General_options): Add ld-compatible options
2766         --no-enum-size-warning and --no-wchar-size-warning.
2768 2010-08-04  Ian Lance Taylor  <iant@google.com>
2770         * x86_64.cc (Target_x86_64::Scan::local): Use
2771         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2772         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2773         (Target_x86_64::Scan::global): Likewise.
2774         (Target_x86_64::Relocate::relocate): Likewise.
2775         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2776         Likewise.
2778 2010-08-03  Cary Coutant  <ccoutant@google.com>
2780         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2781         to reserve space in merged_strings vector. Keep total input size
2782         for stats.
2783         (Output_merge_string::do_print_merge_stats): Print total input size.
2784         * merge.h (Output_merge_string): Add input_size_ field.
2785         * stringpool.cc (Stringpool_template::string_length): Move
2786         implementations out of Stringpool_template class and place in
2787         stringpool.h.
2788         * stringpool.h (string_length): Move out of Stringpool_template.
2790 2010-08-03  Ian Lance Taylor  <iant@google.com>
2792         PR 11712
2793         * layout.cc (relaxation_loop_body): If address of load segment is
2794         set, adjust address to include headers if possible.
2796 2010-08-03  Ian Lance Taylor  <iant@google.com>
2798         * version.cc (version_string): Bump to 1.10.
2800 2010-08-03  Ian Lance Taylor  <iant@google.com>
2802         PR 11805
2803         * layout.h (enum Output_section_order): Define.
2804         (class Layout): Update declarations.
2805         * layout.cc (Layout::get_output_section): Add order parameter.
2806         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2807         is_first_non_relro parameters.  Change all callers.
2808         (Layout::choose_output_section): Likewise.
2809         (Layout::add_output_section_data): Likewise.
2810         (Layout::make_output_section): Likewise.  Set order.
2811         (Layout::default_section_order): New function.
2812         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2813         * output.cc (Output_section::Output_section): Initialize order_.
2814         Don't initialize deleted fields.
2815         (Output_segment::Output_segment): Don't initialize deleted
2816         fields.
2817         (Output_segment::add_output_section_to_load): New function
2818         replacing add_output_section.  Change all callers to call this or
2819         add_output_section_to_nonload.
2820         (Output_segment::add_output_section_to_nonload): New function.
2821         (Output_segment::remove_output_section): Rewrite.
2822         (Output_segment::add_initial_output_data): Likewise.
2823         (Output_segment::has_any_data_sections): Likewise.
2824         (Output_segment::is_first_section_relro): Likewise.
2825         (Output_segment::maximum_alignment): Likewise.
2826         (Output_segment::has_dynamic_reloc): New function replacing
2827         dynamic_reloc_count.  Change all callers.
2828         (Output_segment::has_dynamic_reloc_list): New function replacing
2829         dynamic_reloc_count_list.  Change all callers.
2830         (Output_segment::set_section_addresses): Rewrite.
2831         (Output_segment::set_offset): Rewrite.
2832         (Output_segment::find_first_and_last_list): Remove.
2833         (Output_segment::set_tls_offsets): Rewrite.
2834         (Output_segment::first_section_load_address): Likewise.
2835         (Output_segment::output_section_count): Likewise.
2836         (Output_segment::section_with_lowest_load_address): Likewise.
2837         (Output_segment::write_section_headers): Likewise.
2838         (Output_segment::print_sections_to_map): Likewise.
2839         * output.h (class Output_data): Remove dynamic_reloc_count_
2840         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2841         (Output_data::add_dynamic_reloc): Rewrite.
2842         (Output_data::has_dynamic_reloc): New function.
2843         (Output_data::dynamic_reloc_count): Remove.
2844         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2845         is_last_relro_, is_first_non_relro_, is_interp_,
2846         is_dynamic_linker_section_ fields.  Add order and set_order
2847         functions.  Remove is_relro_local, set_is_relro_local,
2848         is_last_relro, set_is_last_relro, is_first_non_relro,
2849         set_is_first_non_relro functions, is_interp, set_is_interp,
2850         is_dynamic_linker_section, and set_is_dynamic_linker_section
2851         functions.
2852         (class Output_segment): Change Output_data_list from std::list to
2853         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2854         output_bss_ fields.  Update declarations.
2856 2010-08-02  Ian Lance Taylor  <iant@google.com>
2858         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2859         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2860         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2862 2010-08-02  Ian Lance Taylor  <iant@google.com>
2864         PR 11855
2865         * script.cc (Script_options::Script_options): Initialize
2866         symbol_definitions_ and symbol_references_.
2867         (Script_options::add_symbol_assignment): Update
2868         symbol_definitions_ and symbol_references_.
2869         (Script_options::add_symbol_reference): New function.
2870         (script_symbol): New function.
2871         * script.h (class Script_options): Add symbol_definitions_ and
2872         symbol_references_ fields.
2873         (Script_options::referenced_const_iterator): New type.
2874         (Script_options::referenced_begin): New function.
2875         (Script_options::referenced_end): New function.
2876         (Script_options::is_referenced): New function.
2877         (Script_options::any_unreferenced): New function.
2878         * script-c.h (script_symbol): Declare.
2879         * yyscript.y (exp): Call script_symbol.
2880         * symtab.cc: Include "script.h".
2881         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2882         Change all callers.  Check symbols referenced by scripts.
2883         (Symbol_table::add_undefined_symbols_from_command_line): Add
2884         layout parameter.  Change all callers.
2885         (Symbol_table::do_add_undefined_symbols_from_command_line):
2886         Likewise.  Break out loop body.  Check symbols referenced by
2887         scripts.
2888         (Symbol_table::add_undefined_symbol_from_command_line): New
2889         function broken out of
2890         do_add_undefined_symbols_from_command_line.
2891         * symtab.h (class Symbol_table): Update declarations.
2892         * archive.cc: Include "layout.h".
2893         (Archive::should_include_member): Add layout parameter.  Change
2894         all callers.  Check for symbol mentioned in expression.
2895         * archive.h (class Archive): Update declaration.
2896         * object.cc (Sized_relobj::do_should_include_member): Add layout
2897         parameter.
2898         * object.h (Object::should_include_member): Add layout parameter.
2899         Change all callers.
2900         (Object::do_should_include_member): Add layout parameter.
2901         (class Sized_relobj): Update declaration.
2902         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2903         parameter.
2904         * dynobj.h (class Sized_dynobj): Update declaration.
2905         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2906         layout parameter.
2907         * plugin.h (class Sized_pluginobj): Update declaration.
2909 2010-08-02  Ian Lance Taylor  <iant@google.com>
2911         PR 11866
2912         * output.cc (Output_segment::set_offset): Search for the first and
2913         last sections rather than assuming that the list is in order.
2914         (Output_segment::find_first_and_last_list): New function.
2915         * output.h (class Output_segment): Update declarations.
2916         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2917         (relro_strip_test_SOURCES): New variable.
2918         (relro_strip_test_DEPENDENCIES): New variable.
2919         (relro_strip_test_LDFLAGS): New variable.
2920         (relro_strip_test_LDADD): New variable.
2921         (relro_strip_test.so): New target.
2923 2010-08-02  Ian Lance Taylor  <iant@google.com>
2925         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2926         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2927         (Target_i386::got_tlsdesc_section): New function.
2928         (Target_i386::got_section): Create space for GOT entries for
2929         TLSDESC relocations.
2930         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2931         R_386_TLS_GOTDESC.
2932         (Target_i386::Scan::global): Likewise.
2933         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2934         using TLSDESC GOT.
2935         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2936         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2937         (Target_x86_64::got_tlsdesc_section): New function.
2938         (Target_x86_64::got_section): Create space for GOT entries for
2939         TLSDESC relocations.
2940         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2941         R_386_TLS_GOTDESC.
2942         (Target_x86_64::Scan::global): Likewise.
2943         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2944         using TLSDESC GOT.
2946 2010-08-02  Ian Lance Taylor  <iant@google.com>
2948         * testsuite/final_layout.sh: Use dc to convert from hex to
2949         decimal.
2951 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2953         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2954         paramter to the call to gold::gc_process_relocs.
2955         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2956         paramter to the call to gold::gc_process_relocs.
2957         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2958         parameter to the call to gold::gc_process_relocs.
2959         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2960         template parameter to the call to gold::gc_process_relocs.
2961         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2962         paramter to the call to gold::gc_process_relocs.
2963         * gc.h (get_embedded_addend_size): New function.
2964         (gc_process_relocs): Save the size of the reloc for use by ICF.
2965         * icf.cc (get_section_contents): Get the addend from the text section
2966         for SHT_REL relocation sections.
2967         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2968         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2969         * int_encoding.h (read_from_pointer): New overloaded function.
2970         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2971         * testsuite/icf_sht_rel_addend_test.sh: New file.
2972         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2973         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2975 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2977         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2978         * Makefile.in: Regenerate.
2979         * testsuite/Makefile.in: Regenerate.
2981 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2983         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2984         * gold/testsuite/debug_msg.cc: Likewise.
2985         * gold/testsuite/odr_violation1.cc
2986         * gold/testsuite/odr_violation2.cc
2988 2010-07-21  Cary Coutant  <ccoutant@google.com>
2990         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2991         string, and length fields.
2992         (Output_merge_string::Merged_strings_list): New type.
2993         (Output_merge_string::Merged_strings_lists): New typedef.
2994         (Output_merge_string): Replace merged_strings_ with
2995         merged_strings_lists_.
2996         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2997         Merged_strings_list per input object and section.  Don't store pointer
2998         to the string.  Don't store length with each merged string entry.
2999         (Output_merge_string::finalize_merged_data): Loop over list of merged
3000         strings lists.  Recompute length of each merged string.
3002 2010-07-15  Cary Coutant  <ccoutant@google.com>
3004         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3005         here.
3007 2010-07-14  Ian Lance Taylor  <iant@google.com>
3009         * descriptors.cc (Descriptors::open): Report correct name in error
3010         message.
3012 2010-07-13  Doug Kwan  <dougkwan@google.com>
3014         * arm.cc (Arm_input_section::Arm_input_section): For a
3015         SHT_ARM_EXIDX section, always keeps the input sections.
3016         (Arm_input_section::set_exidx_section_link): New method.
3017         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3018         has_errors_ to false.
3019         (Arm_exidx_input_section::has_errors,
3020         Arm_exidx_input_section::set_has_errors): New methods.
3021         (Arm_exidx_input_section::has_errors_): New data member.
3022         (Arm_relobj::get_exidx_shndx_list): New method.
3023         (Arm_output_section::append_text_sections_to_list): Do not skip
3024         section without SHF_EXECINSTR.
3025         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3026         errors.
3027         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3028         section header.  Make error messages more verbose.  Check for
3029         a non-executable section linked to an EXIDX section.
3030         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3031         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3032         check that there is no deferred EXIDX section if we exit early.
3033         Instead of not making an EXIDX section in case of an error, make one
3034         and set the has_errors flag of it.
3035         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3036         in a relocatable link.
3037         (Target_arm::do_relax): Look for the EXIDX output section instead of
3038         assuming that it is called .ARM.exidx.
3039         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3040         section list.  Do not check for SHF_EXECINSTR section flags but
3041         skip any input section with errors.
3042         * output.cc (Output_section::Output_section): Initialize
3043         always_keeps_input_sections_ to false.
3044         (Output_section::add_input_section): Check for
3045         always_keeps_input_sections_.
3046         *  output.h (Output_section::always_keeps_input_sections,
3047         Output_section::set_always_keeps_input_sections): New methods.
3048         (Output_section::always_keeps_input_sections): New data member.
3050 2010-07-13  Rafael Espindola  <espindola@google.com>
3052         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3053         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3055 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3056             Ian Lance Taylor  <iant@google.com>
3058         * output.h (Output_section_lookup_maps::add_merge_section):
3059         Correct check of whether value was inserted.
3060         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3061         (Output_section_lookup_maps::add_relaxed_input_section):
3062         Likewise.
3063         * arm.cc (Target_arm::got_section): Remove used local os.
3064         * i386.cc (Target_i386::got_section): Likewise.
3065         * x86_64.cc (Target_x86_64::got_section): Likewise.
3066         * sparc.cc (Target_sparc::got_section): Likewise.
3067         (Target_sparc::relocate): Remove unused local have_got_offset.
3068         * powerpc.cc (Target_powerpc::relocate): Likewise.
3070 2010-07-13  Ian Lance Taylor  <iant@google.com>
3072         * compressed_output.cc (zlib_decompress): Fix signature in
3073         !HAVE_ZLIB_H case.
3075         * archive.cc (Archive::include_member): Unlock an external member
3076         of a thin archive.  Don't bother to delete an object we know is
3077         NULL.
3079 2010-07-12  Cary Coutant  <ccoutant@google.com>
3081         * compressed_output.cc (zlib_decompress): New function.
3082         (get_uncompressed_size): New function.
3083         (decompress_input_section): New function.
3084         * compressed_output.h (get_uncompressed_size): New function.
3085         (decompress_input_section): New function.
3086         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3087         Handle compressed debug sections.
3088         * layout.cc (is_compressed_debug_section): New function.
3089         (Layout::output_section_name): Map compressed section names to
3090         canonical names.
3091         * layout.h (is_compressed_debug_section): New function.
3092         (is_debug_info_section): Recognize compressed debug sections.
3093         * merge.cc: Include compressed_output.h.
3094         (Output_merge_data::do_add_input_section): Handle compressed
3095         debug sections.
3096         (Output_merge_string::do_add_input_section): Handle compressed
3097         debug sections.
3098         * object.cc: Include compressed_output.h.
3099         (Sized_relobj::Sized_relobj): Initialize new data members.
3100         (build_compressed_section_map): New function.
3101         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3102         * object.h (Object::section_is_compressed): New method.
3103         (Object::do_section_is_compressed): New method.
3104         (Sized_relobj::Compressed_section_map): New type.
3105         (Sized_relobj::do_section_is_compressed): New method.
3106         (Sized_relobj::compressed_sections_): New data member.
3107         * output.cc (Output_section::add_input_section): Handle compressed
3108         debug sections.
3109         * reloc.cc: Include compressed_output.h.
3110         (Sized_relobj::write_sections): Handle compressed debug sections.
3112 2010-07-08  Cary Coutant  <ccoutant@google.com>
3114         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3115         weak when resolving to a dynamic def.
3116         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3117         for weak undef/dynamic def cases. Adjust callers.
3118         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3119         undef_binding_weak_.
3120         (Symbol_table::sized_write_globals): Adjust symbol binding.
3121         (Symbol_table::sized_write_symbol): Add binding parameter.
3122         * symtab.h (Symbol::set_undef_binding): New method.
3123         (Symbol::is_undef_binding_weak): New method.
3124         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3125         (Symbol_table::should_override): Add new parameter.
3126         (Symbol_table::sized_write_symbol): Add new parameter.
3128         * testsuite/weak_undef_file1.cc: Add new test case.
3129         * testsuite/weak_undef_file2.cc: Fix header comment.
3130         * testsuite/weak_undef_test.cc: Add new test case.
3132 2010-06-29  Doug Kwan  <dougkwan@google.com>
3134         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3135         Initialize USE_SYMBOL_.
3136         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3137         definition.
3138         (Arm_reloc_property::uses_symbol_): New data member declaration.
3139         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3140         uses symbol value and symbol is undefined but not weakly undefined.
3142 2010-06-28  Rafael Espindola  <espindola@google.com>
3144         * plugin.cc (Plugin::load): Use dlerror.
3146 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3148         * symtab.cc (detect_odr_violations): When reporting an ODR
3149         violation, report an object where the symbol is defined.
3151 2010-06-25  Doug Kwan  <dougkwan@google.com>
3153         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3154         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3155         definition.
3156         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3157         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3158         target hook to detect function points.
3159         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3160         * icf.h (Icf::check_section_for_function_pointers): Change type of
3161         parameter SECTION_NAME to const reference to std::string.  Use
3162         target hook to determine if section may have unsafe pointers.
3163         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3164         method definition.
3166 2010-06-21  Rafael Espindola  <espindola@google.com>
3168         * fileread.cc (Input_file::find_fie): New
3169         (Input_file::open): Use Input_file::find_fie.
3170         * fileread.h (Input_file::find_fie): New
3171         * plugin.cc (set_extra_library_path): New.
3172         (Plugin::load): Add set_extra_library_path to the transfer vector.
3173         (Plugin_manager::set_extra_library_path): New.
3174         (Plugin_manager::add_input_file): Use the extra search path if set.
3175         (set_extra_library_path(): New.
3176         * plugin.h (Plugin_manager): Add set_extra_library_path and
3177         extra_search_path_.
3179 2010-06-19  Cary Coutant  <ccoutant@google.com>
3181         * layout.cc (gdb_sections): Add .debug_types.
3182         (lines_only_debug_sections): Likewise.
3184 2010-06-18  Rafael Espindola  <espindola@google.com>
3186         * plugin.cc (add_input_file,add_input_library)
3187         (Plugin_manager::add_input_file): Make filename arguments const.
3188         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3189         const.
3191 2010-06-16  Doug Kwan  <dougkwan@google.com>
3193         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3194         .ARM.attributes section if we have not merged any input
3195         attributes sections.
3197 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3199         * arm.cc: Allow combining objects with no EABI version
3200         information.
3202 2010-06-15  Rafael Espindola  <espindola@google.com>
3204         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3206 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3208         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3209         (struct iovec): Correct !HAVE_READV definition.
3211 2010-06-10  Cary Coutant  <ccoutant@google.com>
3213         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3214         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3215         reloc sections.
3216         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3218         PR 11683
3219         * symtab.h (Symbol::is_placeholder): New member function.
3220         * target-reloc.h (relocate_section): Check for placeholder symbols.
3222         * testsuite/Makefile.am (plugin_test_8): New test.
3223         (plugin_test_9): New test.
3224         * testsuite/Makefile.in: Regenerate.
3226 2010-06-09  Nick Clifton  <nickc@redhat.com>
3228         * yyscript.y (input_list_element): Allow strings prefixed with
3229         the '-' character.  Treat these as libraries.
3230         * script.cc (script_add_library): New function.  Adds a library
3231         specified by "-l<name>" found in an input script.
3232         * script-c.h: Add prototype for script_add_library.
3234 2010-06-07  Doug Kwan  <dougkwan@google.com>
3236         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3237         Restrict stub-group size to be within long conditional branch
3238         range when working around cortex-A8 erratum.
3240 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3242         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3243         #ifdef typo.
3245 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3247         PR gold/11658
3248         * output.cc
3249         (Output_section::Input_section_sort_entry::compare_section_ordering):
3250         Change to return non-zero correctly.
3251         (Output_section::Input_section_sort_section_order_index_compare
3252         ::operator()): Change to fix ambiguity in comparisons.
3254 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3256         * gold.h (is_wildcard_string): New function.
3257         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3258         (Layout::layout_eh_frame): Ditto.
3259         (Layout::find_section_order_index): New method.
3260         (Layout::read_layout_from_file): New method.
3261         * layout.h (Layout::find_section_order_index): New method.
3262         (Layout::read_layout_from_file): New method.
3263         (Layout::input_section_position_): New private member.
3264         (Layout::input_section_glob_): New private member.
3265         * main.cc (main): Call read_layout_from_file here.
3266         * options.h (--section-ordering-file): New option.
3267         * output.cc (Output_section::input_section_order_specified_): New
3268         member.
3269         (Output_section::Output_section): Initialize new member.
3270         (Output_section::add_input_section): Add new parameter.
3271         Keep input sections when --section-ordering-file is used.
3272         (Output_section::set_final_data_size): Sort input sections when
3273         section ordering file is specified.
3274         (Output_section::Input_section_sort_entry): Add new parameter.
3275         Check sorting type.
3276         (Output_section::Input_section_sort_entry::compare_section_ordering):
3277         New method.
3278         (Output_section::Input_section_sort_compare::operator()): Change to
3279         consider section_order_index.
3280         (Output_section::Input_section_sort_init_fini_compare::operator()):
3281         Change to consider section_order_index.
3282         (Output_section::Input_section_sort_section_order_index_compare
3283         ::operator()): New method.
3284         (Output_section::sort_attached_input_sections): Change to sort
3285         according to section order when specified.
3286         (Output_section::add_input_section<32, true>): Add new parameter.
3287         (Output_section::add_input_section<64, true>): Add new parameter.
3288         (Output_section::add_input_section<32, false>): Add new parameter.
3289         (Output_section::add_input_section<64, false>): Add new parameter.
3290         * output.h (Output_section::add_input_section): Add new parameter.
3291         (Output_section::input_section_order_specified): New
3292         method.
3293         (Output_section::set_input_section_order_specified): New method.
3294         (Input_section::Input_section): Initialize section_order_index_.
3295         (Input_section::section_order_index): New method.
3296         (Input_section::set_section_order_index): New method.
3297         (Input_section::section_order_index_): New member.
3298         (Input_section::Input_section_sort_section_order_index_compare): New
3299         struct.
3300         (Output_section::input_section_order_specified_): New member.
3301         * script-sections.cc (is_wildcard_string): Delete and move modified
3302         method to gold.h.
3303         (Output_section_element_input::Output_section_element_input): Modify
3304         call to is_wildcard_string.
3305         (Output_section_element_input::Input_section_pattern
3306         ::Input_section_pattern): Ditto.
3307         (Output_section_element_input::Output_section_element_input): Ditto.
3308         * testsuite/Makefile.am (final_layout): New test case.
3309         * testsuite/Makefile.in: Regenerate.
3310         * testsuite/final_layout.cc: New file.
3311         * testsuite/final_layout.sh: New file.
3313 2010-06-01  Rafael Espindola  <espindola@google.com>
3315         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3317 2010-06-01  Rafael Espindola  <espindola@google.com>
3319         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3320         visibility of symbols.
3322 2010-05-27  Doug Kwan  <dougkwan@google.com>
3324         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3325         from start of output section instead of address for a local symbol
3326         in a merged or relaxed section when doing a relocatable link.
3328 2010-05-26  Rafael Espindola  <espindola@google.com>
3330        PR 11604
3331         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3332         adding sections the garbage collector removed.
3333         * gold/testsuite/Makefile.am: Add test.
3334         * gold/testsuite/Makefile.in: Regenerate.
3335         * gold/testsuite/plugin_test_7.sh: New.
3336         * gold/testsuite/plugin_test_7_1.c: New.
3337         * gold/testsuite/plugin_test_7_2.c: New.
3339 2010-05-26  Rafael Espindola  <espindola@google.com>
3341         * script-sections.cc (Output_section_definition::set_section_addresses):
3342         Check for --section-start.
3344 2010-05-26  Doug Kwan  <dougkwan@google.com>
3346         * arm.cc (Arm_scan_relocatable_relocs): New class.
3347         (Target_arm::relocate_special_relocatable): New method.
3348         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3349         (Arm_relocate_functions::thumb_branch_common): Same.
3350         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3351         instead of Default_scan_relocatable_relocs.
3352         * target-reloc.h (relocate_for_relocatable): Let target handle
3353         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3354         * target.h (Sized_target::relocate_special_relocatable): New method.
3356 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3358         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3360 2010-05-23  Doug Kwan  <dougkwan@google.com>
3362         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3363         instead of a cast.
3364         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3365         with a direct branch, not a conditional branch, to a stub.
3366         * merge.cc (Output_merge_base::record_input_section): New method
3367         defintion.
3368         (Output_merge_data::do_add_input_section): Record input section if
3369         keeps-input-sections flag is set.
3370         (Output_merge_string::do_add_input_section): Ditto.
3371         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3372         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3373         INPUT_SECTIONS_.
3374         (Output_merge_base::keeps_input_sections,
3375         Output_merge_base::set_keeps_input_sections,
3376         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3377         method definitions.
3378         (Output_merge_base::Input_sections): New type declaration.
3379         (Output_merge_base::input_sections_begin,
3380         Output_merge_base::input_sections_end,
3381         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3382         (Output_merge_base::bool keeps_input_sections_,
3383         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3384         Output_merge_base::input_sections_): New data members.
3385         (Output_merge_data::do_set_keeps_input_sections): New method
3386         defintion.
3387         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3388         * output.cc (Output_section::Input_section::relobj): Move method
3389         defintion from class declaration to here and handle merge sections.
3390         (Output_section::Input_section::shndx): Ditto.
3391         (Output_section::Output_section): Remove initializations of removed
3392         data members and initialize new data member LOOKUP_MAPS_.
3393         (Output_section::add_input_section): Set keeps-input-sections flag
3394         for a newly created merge output section as appropriate.  Adjust code
3395         to use Output_section_lookup_maps class.
3396         (Output_section::add_relaxed_input_section): Adjst code for lookup
3397         maps code refactoring.
3398         (Output_section::add_merge_input_section): Add a new parameter
3399         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3400         class.  If adding input section to a newly created merge output
3401         section fails, remove the new merge section.
3402         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3403         Adjust code for use of the Output_section_lookup_maps class.
3404         (Output_section::find_merge_section): Ditto.
3405         (Output_section::build_lookup_maps): New method defintion.
3406         (Output_section::find_relaxed_input_section): Adjust code to use
3407         Output_section_lookup_maps class.
3408         (Output_section::get_input_sections): Export merge sections.  Adjust
3409         code to use Output_section_lookup_maps class.
3410         (Output_section:::add_script_input_section): Adjust code to use
3411         Output_section_lookup_maps class.  Update lookup maps for merge
3412         sections also.
3413         (Output_section::discard_states): Use Output_section_lookup_maps.
3414         (Output_section::restore_states): Same.
3415         * output.h (Merge_section_properties): Move class defintion out of
3416         Output_section.
3417         (Output_section_lookup_maps): New class.
3418         (Output_section::Input_section::is_merge_section): New method
3419         defintion.
3420         (Output_section::Input_section::relobj): Move defintion out of class
3421         defintion.  Declare method only.
3422         (Output_section::Input_section::shndx): Ditto.
3423         (Output_section::Input_section::output_merge_base): New method defintion.
3424         (Output_section::Input_section::u2_.pomb): New union field.
3425         (Output_section::Merge_section_by_properties_map,
3426         Output_section::Output_section_data_by_input_section_map,
3427         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3428         Remove types.
3429         (Output_section::add_merge_input_section): Add new parameter
3430         KEEPS_INPUT_SECTIONS.
3431         (Output_section::build_lookup_maps): New method declaration.
3432         (Output_section::merge_section_map_,
3433         Output_section::merge_section_by_properties_map_,
3434         Output_section::relaxed_input_section_map_,
3435         Output_section::is_relaxed_input_section_map_valid_): Remove data
3436         members.
3437         (Output_section::lookup_maps_): New data member.
3439 2010-05-21  Doug Kwan  <dougkwan@google.com>
3441         PR gold/11619
3442         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3443         avoid a compilation error.
3445 2010-05-19  Rafael Espindola  <espindola@google.com>
3447         * script-sections.cc (Output_section_definition::allocate_to_segment):
3448         Update the phdrs_list even when the output section is NULL.
3449         * testsuite/Makefile.am: Add test.
3450         * testsuite/Makefile.in: Regenerate.
3451         * testsuite/script_test_9.cc: New.
3452         * testsuite/script_test_9.sh: New.
3453         * testsuite/script_test_9.t: New.
3455 2010-05-19  Doug Kwan  <dougkwan@google.com>
3457         * arm.cc (Arm_input_section::original_size): New method.
3458         (Arm_input_section::do_addralign): Add a cast.
3459         (Arm_input_section::do_output_offset): Remove static cast.
3460         (Arm_input_section::original_addralign,
3461          Arm_input_section::original_size_): Change type to uint32_t.
3462         (Arm_input_section::init): Add safe casts for section alignment
3463         and size.
3464         (Arm_input_section::set_final_data_size): Do not set address and
3465         offset of stub table.
3466         (Arm_output_section::fix_exidx_coverage): Change use of of
3467         Output_section::Simple_input_section to that of
3468         Output_section::Input_section.
3469         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3470         except for the first pass.
3471         * output.cc (Output_section::get_input_sections): Change type of
3472         input_sections to std::list<Input_section>.
3473         (Output_section::add_script_input_section): Rename from
3474         Output_section::add_simple_input_section.  Change type of SIS
3475         parameter from Simple_input_section to Input_section.
3476         * output.h (Output_section::Simple_input_section): Remove class.
3477         (Output_section::Input_section): Change class visibility to public.
3478         (Output_section::Input_section::addralign): Use stored alignments
3479         for special input sections if set.
3480         (Output_section::Input_section::set_addralign): New method.
3481         (Output_section::get_input_sections): Change parameter type from
3482         list of Simple_input_section to list of Input_section.
3483         (Output_section::add_script_input_section): Rename from
3484         Output_section::add_simple_input_section. Change first parameter's
3485         type from Simple_input_section to Input_section and remove the
3486         second and third parameters.
3487         * script-sections.cc (Input_section::Input_section_list): Change
3488         type to list of Output_section::Input_section/
3489         (Input_section_info::Input_section_info): Change parameter type of
3490         INPUT_SECTION to Output_section::Input_section.
3491         (Input_section_info::input_section): Change return type.
3492         (Input_section_info::input_section_): Change type to
3493         Output_section::Input_section.
3494         (Output_section_element_input::set_section_addresses): Adjust code
3495         to use Output_section::Input_section instead of
3496         Output_section::Simple_input_section.  Adjust code for renaming
3497         of Output_section::add_simple_input_section.
3498         (Orphan_output_section::set_section_addresses): Ditto.
3500 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3502         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3503         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3505 2010-05-18  Rafael Espindola  <espindola@google.com>
3507         * options.cc (General_options::finalize): Handle -nostdlib.
3508         * options.h (nostdlib): New option.
3509         * script.cc (script_add_search_dir): Handle -nostdlib.
3511 2010-05-12  Doug Kwan  <dougkwan@google.com>
3513         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3514         attributes section only if there no attributes section after merging.
3515         (Target_arm::merge_object_attributes): Move value of
3516         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3517         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3518         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3519         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3520         and arm_attr_merge_7.stdout.
3521         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3522         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3523         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3524         arm_attr_merge_7b.o): New rules.
3525         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3526         arm_attr_merge_7
3527         * testsuite/Makefile.in: Regenerate.
3528         * testsuite/arm_attr_merge.sh: New file.
3529         * testsuite/arm_attr_merge_[67][ab].s: Same.
3531 2010-05-05  Nick Clifton  <nickc@redhat.com>
3533         * po/es.po: Updated Spanish translation.
3535 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3537         * Makefile.am (install-exec-local): Properly install gold as
3538         default cross linker.
3539         * Makefile.in: Regenerated.
3541 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3542             Nick Clifton  <nickc@redhat.com>
3544         * configure.ac (install_as_default): Define and set to false
3545         unless --enable-gold or --enable-gold=both/gold has been
3546         specified.
3547         * configure: Regenerate.
3549         * Makefile.am (install-exec-local): Install the executable as
3550         'ld.gold'.  If install_as_default is true then also install it as
3551         'ld'.
3552         * Makefile.in: Regenerated.
3554 2010-04-24  Ian Lance Taylor  <iant@google.com>
3556         * layout.cc (Layout::layout_reloc): In relocatable link don't
3557         combine reloc sections for grouped sections.
3559 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3561         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3562         sections that are not ordinary to icf.
3563         * icf.cc (get_section_contents): Handle relocation pointing to section
3564         with no object or shndx information.
3565         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3566         * testsuite/Makefile.in: Regenerate.
3567         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3568         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3570 2010-04-22  Ian Lance Taylor  <iant@google.com>
3572         * expression.cc (Expression::Expression_eval_info): Add
3573         result_alignment_pointer field.
3574         (Expression::eval_with_dot): Add result_alignment_pointer
3575         parameter.  Change all callers.
3576         (Expression::eval_maybe_dot): Likewise.
3577         (class Binary_expression): Add alignment_pointer parameter to
3578         left_value and right_value.  Change all callers.
3579         (BINARY_EXPRESSION): Set result alignment.
3580         (class Trinary_expression): Add alignment_pointer parameter to
3581         arg2_value and arg3_value.  Change all callers.
3582         (Trinary_cond::value): Set result alignment.
3583         (Max_expression::value, Min_expression::value): Likewise.
3584         (Align_expression::value): Likewise.
3585         * script-sections.cc (class Sections_element): Add dot_alignment
3586         parameter to set_section_addresses virtual function.  Update
3587         instantiations.
3588         (class Output_section_element): Likewise.
3589         (Script_sections::create_segments): Add dot_alignment parameter.
3590         Change all callers.
3591         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3592         (Script_sections::set_phdrs_clause_addresses): Likewise.
3593         * script-sections.h: Update declarations.
3594         * script.h: Update declarations.
3595         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3596         min_p_align.
3597         * testsuite/script_test_3.t: Set large alignment.
3598         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3599         segment has expected alignment.
3601 2010-04-22  Nick Clifton  <nickc@redhat.com>
3603         * po/gold.pot: Updated by the Translation project.
3604         * po/vi.po: Updated Vietnamese translation.
3606 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3608         * testsuite/Makefile.am (check_PROGRAMS): Add
3609         icf_virtual_function_folding_test.
3610         * testsuite/Makefile.in: Regenerated.
3612 2010-04-15  Andrew Haley  <aph@redhat.com>
3614         * options.h (merge_exidx_entries): New option.
3615         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3616         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3617         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3618         (Target_arm::merge_exidx_entries): New function.
3619         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3620         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3621         to Arm_exidx_fixup constructor.
3622         Add new arg, merge_exidx_entries.
3623         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3624         Arm_output_section::fix_exidx_coverage.
3626 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3628         * icf.cc (get_section_contents): Check for preemptible functions.
3629         Ignore addend when appropriate.
3630         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3631         section folded.
3632         (add_from_relobj): Check for section folded.
3633         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3634         * symtab.h (should_add_dynsym_entry): Add new parameter.
3635         * target-reloc.h (scan_relocs): Check for section folded.
3636         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3637         Check reloc types for function pointers in shared objects.
3638         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3639         case.
3640         (icf_preemptible_functions_test): New test case.
3641         (icf_string_merge_test): New test case.
3642         * testsuite.Makefile.in: Regenerate.
3643         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3644         bar_glob.  Refactor code.
3645         * testsuite/icf_preemptible_functions_test.cc: New file.
3646         * testsuite/icf_preemptible_functions_test.sh: New file.
3647         * testsuite/icf_string_merge_test.cc: New file.
3648         * testsuite/icf_string_merge_test.sh: New file.
3649         * testsuite/icf_virtual_function_folding_test.cc: New file.
3650         * testsuite/icf_virtual_function_folding_test.sh: New file.
3652 2010-04-14  Doug Kwan  <dougkwan@google.com>
3654         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3655         for local symbol recounting if we remove a section due to ICF.
3656         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3657         there are no regular objects in input.
3659 2010-04-13  Doug Kwan  <dougkwan@google.com>
3661         * arm.cc (Arm_input_section::set_final_data_size): Compute
3662         accurate final data size instead of using current data size.
3664 2010-04-09  Doug Kwan  <dougkwan@google.com>
3666         * layout.cc (Layout::choose_output_section): Handle script section
3667         types.
3668         (Layout::make_output_section_for_script): Add section type parameter.
3669         Handle script section types.
3670         * layout.h (Layout::make_output_section_for_script): Add section
3671         type parameter.
3672         * output.cc (Output_section::Output_section): Initialize data member
3673         is_noload_.
3674         (Output_section::do_reset_address_and_file_offset): Do not set address
3675         to 0 if section is a NOLOAD section.
3676         * output.h (Output_section::is_noload): New method.
3677         (Output_section::set_is_noload): Ditto.
3678         (Output_section::is_noload_): New data member.
3679         * script-c.h (Script_section_type): New enum type.
3680         (struct Parser_output_section_header): Add new file section_type.
3681         * script-sections.cc (Sections_element::output_section_name): Add
3682         parameter for returning script section type.
3683         (Output_section_definition::output_section_name): Ditto.
3684         (Output_section_definition::section_type)P; New method.
3685         (Output_section_definiton::script_section_type_name): Ditto.
3686         (Output_section_definition::script_section_type_): New data member.
3687         (Output_section_definition::Output_section_definition): Initialize
3688         data member Output_section_definition::script_section_type_.
3689         (Output_section_definition::create_sections): Pass script section type
3690         to Layout::make_output_section_for_script.
3691         (Output_section_definition::output_section_name): Return script
3692         section type to caller.
3693         (Output_section_definition::set_section_address): Do not advance
3694         dot value and load address if section type is NOLOAD.  Set address
3695         of NOLOAD sections regardless of section flags.
3696         (Output_section_definition::print): Print section type if it is
3697         not SCRIPT_SECTION_TYPE_NONE.
3698         (Output_section_definition::section_type): New method.
3699         (Output_section_definition::script_section_type_name): Ditto.
3700         (Script_sections::output_section_name): Add new parameter
3701         PSECTION_TYPE for returning script section type.  Pass it to
3702         section elements.  Handle discard sections.
3703         (Sort_output_sections::operator()): Handle NOLOAD sections.
3704         * script-sections.h (Script_sections::Section_type): New enum type.
3705         (Script_sections::output_section_name): Add a new parameter for
3706         returning script section type.
3707         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3708         INFO and NOLOAD.
3709         * yyscript.y (union): Add new field SECTION_TYPE.
3710         (COPY, DSECT, INFO, NOLOAD): New tokens.
3711         (opt_address_and_section_type): Change type to output_section_header.
3712         (section_type): New non-terminal
3713         (section_header): Handle section type.
3714         (opt_address_and_section_type): Return section type value.
3716 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3718         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3719         * testsuite/plugin_common_test_2.c (foo): Likewise.
3721 2010-04-08  Doug Kwan  <dougkwan@google.com>
3723         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3724         Output_merge_data.
3725         * output.cc (Output_section::add_merge_input_section): Simplify
3726         code and return status of Output_merge_base::add_input_section.
3727         Update merge section map only if Output_merge_base::add_input_section
3728         returns true.
3730 2010-04-07  Doug Kwan  <dougkwan@google.com>
3732         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3733         if section is marked as containing instructions but has no mapping
3734         symbols.
3735         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3736         correct section index.
3737         (Arm_relobj::find_linked_text_section): Ditto.
3739 2010-04-07  Cary Coutant  <ccoutant@google.com>
3741         * archive.cc (include_member): Destroy Read_symbols_data object before
3742         releasing file.
3743         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3744         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3745         (Read_symbols_data::~Read_symbols_data) New destructor.
3746         (Section_relocs::Section_relocs) New constructor.
3747         (Section_relocs::~Section_relocs) New destructor.
3748         (Read_relocs_data::Read_relocs_data) New constructor.
3749         (Read_relocs_data::~Read_relocs_data) New destructor.
3750         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3751         pointers to NULL after deleting.
3753 2010-04-07  Doug Kwan  <dougkwan@google.com>
3755         * arm.cc: Replace "endianity" with "endianness" in comments.
3756         (Arm_exidx_cantunwind): Ditto.
3757         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3758         (Arm_relobj::merge_flags_and_attributes): New method.
3759         (Arm_relobj::merge_flags_and_attributes_): New data member.
3760         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3761         (Arm_relobj::scan_sections_for_stubs): Ditto.
3762         (Arm_relobj::do_read_symbols): Check to see if we really want to
3763         merge processor-specific flags and attributes.  Exit early if
3764         an object is empty except for section names and the undefined symbol.
3765         (Target_arm::do_finalize_sections): Move check for ELF format to
3766         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3767         attributes from a regular object only when we have determined that
3768         it is aapropriate.  Do not create an .ARM.attributes section in
3769         output if there is no regular input object.
3770         (Target_arm::merge_processor_specific_flags): Check
3771         --warn-mismatch before printing any error.
3772         (Target_arm::merge_object_attributes): Ditto.
3773         * gold.cc (queue_middle_tasks): Handle the case in which there is
3774         no regular object in input.
3775         * options.cc (General_options::parse_EB): New method.
3776         (General_options::parse_EL): Same.
3777         (General_options::General_options): Initialize endianness_.
3778         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3779         New options.
3780         (General_options::Endianness): New enum.
3781         (General_options::endianness): New method.
3782         (General_options::endianness_): New data member.
3783         * parameters.cc (Parameters::set_options): Check target endianness.
3784         (Parameters::set_target_once): Ditto.
3785         (Parameters::check_target_endianness): New method.
3786         (parameters_force_valid_target): If either -EL or -EB is specified,
3787         use it to define endianness of default target.
3788         * parameters.h (Parameters::check_target_endianness): New method
3789         declaration.
3790         * target.h (class Target): Change "endianity" to "endianness"
3791         in comments.
3793 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3795         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3796         * configure: Regenerate.
3797         * Makefile.in: Regenerate.
3798         * testsuite/Makefile.in: Regenerate.
3800 2010-04-06  Cary Coutant  <ccoutant@google.com>
3802         gcc PR lto/42757
3803         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3804         prevailing definitions of common symbols.
3805         * testsuite/plugin_test_6.sh: New test case.
3806         * testsuite/plugin_common_test_1.c: New test case.
3807         * testsuite/plugin_common_test_2.c: New test case.
3808         * testsuite/Makefile.am (plugin_test_6): New test case.
3809         * testsuite/Makefile.in: Regenerate.
3811 2010-04-06  Nick Clifton  <nickc@redhat.com>
3813         * po/vi.po: New Vietnamese translation.
3815 2010-03-30  Doug Kwan  <dougkwan@google.com>
3817         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3819 2010-03-25  Doug Kwan  <dougkwan@google.com>
3821         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3822         to avoid a conversion warning on a 32-bit host.
3824 2010-03-24  Ian Lance Taylor  <iant@google.com>
3826         * testsuite/script_test_3.t: Add a TLS segment.
3827         * testsuite/Makefile.am (check_PROGRAMS): Add
3828         tls_phdrs_script_test.
3829         (tls_phdrs_script_test_SOURCES): Define.
3830         (tls_phdrs_script_test_DEPENDENCIES): Define.
3831         (tls_phdrs_script_test_LDFLAGS): Define.
3832         (tls_phdrs_script_test_LDADD): Define.
3833         * testsuite/Makefile.in: Rebuild.
3835 2010-03-23  Cary Coutant  <ccoutant@google.com>
3837         * fileread.cc (find_or_make_view): Fix comment.
3839 2010-03-23  Ian Lance Taylor  <iant@google.com>
3841         * script-sections.cc (class Orphan_section_placement): Define
3842         PLACE_TLS and PLACE_TLS_BSS.
3843         (Orphan_section_placement::Orphan_section_placement): Initialize
3844         new places.
3845         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3846         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3847         (tls_script_test_SOURCES): Define.
3848         (tls_script_test_DEPENDENCIES): Define.
3849         (tls_script_test_LDFLAGS): Define.
3850         (tls_script_test_LDADD): Define.
3851         * testsuite/Makefile.in: Rebuild.
3853 2010-03-22  Doug Kwan  <dougkwan@google.com>
3855         * arm.cc (Arm_relocate_functions::abs8,
3856         Arm_relocate_functions::abs16): Use correct check for overflow
3857         specified in the ARM ELF specs.
3858         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3859         target of a BLX instruction specially.
3860         (Reloc_stub::stub_type_for_reloc): Ditto.
3861         (Relocate::relocate): Use symbolic names instead of numeric relocation
3862         codes to report error.
3863         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3864         workaround.
3865         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3866         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3867         thumb2_blx_out_of_range.stdout
3868         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3869         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3870         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3871         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3872         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3873         thumb2_blx_in_range, thumb2_blx_in_range.o,
3874         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3875         thumb2_blx_out_of_range.o): New rules.
3876         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3877         thumb2_blx_in_range and thumb2_blx_out_of_range.
3878         * testsuite/Makefile.in: Regenerate.
3879         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3880         * testsuite/thumb_blx_in_range.s: New file.
3881         * testsuite/thumb_blx_out_of_range.s: New file.
3883 2010-03-22  Rafael Espindola  <espindola@google.com>
3885         * archive.cc (Should_include): Move to archive.h.
3886         (should_include_member): Make it a member of Archive.
3887         (Lib_group): New.
3888         (Add_lib_group_symbols): New.
3889         * archive.h: Include options.h.
3890         (Archive_member): Moved from Archive.
3891         (Should_include): Moved from archive.cc.
3892         (Lib_group): New.
3893         (Add_lib_group_symbols): New.
3894         * dynobj.cc (do_should_include_member): New.
3895         * dynobj.h (do_should_include_member): New.
3896         * gold.cc (queue_initial_tasks): Update call to queue.
3897         * main.cc (main): Print lib group stats.
3898         * object.cc (do_should_include_member): New.
3899         * object.h: Include archive.h.
3900         (Object::should_include_member): New.
3901         (Object::do_should_include_member): New.
3902         (Sized_relobj::do_should_include_member): New.
3903         * options.cc (General_options::parse_start_lib): New.
3904         (General_options::parse_end_lib): New.
3905         (Input_arguments::add_file): Handle lib groups.
3906         (Input_arguments::start_group): Check we are not in a lib.
3907         (Input_arguments::start_lib): New.
3908         (Input_arguments::end_lib): New.
3909         * options.h (General_options): Add start_lib and end_lib.
3910         (Input_argument::lib_): New.
3911         (Input_argument::lib): New.
3912         (Input_argument::is_lib): New.
3913         (Input_file_lib): New.
3914         (Input_arguments::in_lib_): New.
3915         (Input_arguments::in_lib): New.
3916         (Input_arguments::start_lib): New.
3917         (Input_arguments::end_lib_): New.
3918         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3919         in unused members as preempted.
3920         (Sized_pluginobj::do_should_include_member): New.
3921         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3922         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3923         return the blocker.
3924         (Read_symbols::do_whole_lib_group): New.
3925         (Read_symbols::do_lib_group): New.
3926         (Read_symbols::do_read_symbols): Handle lib groups.
3927         (Read_symbols::get_name): Handle lib groups.
3928         * readsyms.h (Read_symbols): Add an archive member pointer.
3929         (Read_symbols::do_whole_lib_group): New.
3930         (Read_symbols::do_lib_group): New.
3931         (Read_symbols::member_): New.
3932         * script.cc (read_input_script): Update call to queue_soon.
3934 2010-03-19  Doug Kwan  <dougkwan@google.com>
3936         * arm.cc (Stub_table::Stub_table): Initialize new data members
3937         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3938         (Stub_table::add_reloc_stub): Assign stub offset and update
3939         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3940         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3941         New data members.
3942         (Stub_table::update_data_size_and_addralign): Use
3943         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3944         instead of going over all reloc stubs.
3945         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3946         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3947         Stringpool_template::offset_ to size of Stringpool_char.
3948         (Stringpool_template::new_key_offset): Remove code to initialize
3949         Stringpool_template::offset_.
3950         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3951         Stringpool_template::offset_ to zero.
3953 2010-03-15  Doug Kwan  <dougkwan@google.com>
3955         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3956         offset_.
3957         (Stringpool_template::new_key_offset): New method.
3958         (Stringpool_template::add_string): Assign offsets when adding new
3959         strings.
3960         (Stringpool_template::set_string_offsets): Do not set string offsets
3961         when not optimizing.
3962         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3963         member size_.
3964         (Chunked_vector::clear): Clear size_.
3965         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3966         (Chunked_vector::size): Return size_.
3967         (Chunked_vector::push_back): Use size_ to find insert position.
3968         (Chunked_vector::size_): New data member.
3969         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3970         (Stringpool_template::new_key_offset): New method declaration.
3971         (Stringpool_template::offset_): New data member.
3973 2010-03-15   Rafael Espindola  <espindola@google.com>
3975         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3976         Add_symbols' constructor.
3977         * readsyms.h (Add_symbols): Remove the input_group member.
3979 2010-03-10  Ian Lance Taylor  <iant@google.com>
3981         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3982         target to ask whether a reference to a symbol requires a stack
3983         split.
3984         * target.h (Target::is_call_to_non_split): New function.
3985         (Target::do_is_call_to_non_split): Declare virtual function.
3986         * target.cc: Include "symtab.h".
3987         (Target::do_is_call_to_non_split): New function.
3988         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3990 2010-03-10  Cary Coutant  <ccoutant@google.com>
3992         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3993         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3994         (File_read::open[2]): Add whole_file_view_ to list of views.
3995         (File_read::make_view): Remove test of whole_file_view_.
3996         (File_read::find_or_make_view): Create whole_file_view_ if
3997         necessary.
3998         (File_read::clear_views): Replace bool parameter with enum;
3999         adjust all callers.  Don't delete views with permanent data;
4000         do delete cached views and views from archives if
4001         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4002         if clearing the corresponding view.
4003         * fileread.h (File_read::Clear_views_mode): New enum.
4004         (File_read::View::is_permanent_view): New method.
4005         (File_read::clear_views): Replace bool parameter
4006         with enum; adjust all callers.
4007         * options.h (General_options): Change keep_files_mapped option;
4008         add map_whole_files.
4009         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4010         releasing the file.
4011         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4012         the file.
4014 2010-03-10  David S. Miller  <davem@davemloft.net>
4016         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4018 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4020         * icf.cc (get_section_contents): Add '@' marker after processing the
4021         merge reloc.
4023 2010-03-08  Doug Kwan  <dougkwan@google.com>
4025         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4026         due to a conversion warning.
4027         (Arm_relobj::update_output_local_symbol_count): Check for local
4028         symbol with unset output index.
4030 2010-03-05  Ian Lance Taylor  <iant@google.com>
4032         * options.h (class General_options): Add --spare-dynamic-tags.
4033         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4034         --spare-dynamic-tags.
4036 2010-03-05  Ian Lance Taylor  <iant@google.com>
4038         * incremental.cc: Include "libiberty.h".
4040 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4042         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4043         function, is_info_ member.
4044         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4045         (Versions::Versions): Update caller.
4046         (Versions::define_base_version): Likewise.
4047         (Versions::add_def): Likewise.
4049 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4051         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4052         (Scan::possible_function_pointer_reloc): New function.
4053         (Scan::local_reloc_may_be_function_pointer): Change to call
4054         possible_function_pointer_reloc.
4055         (Scan::global_reloc_may_be_function_pointer): Ditto.
4056         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4057         relocations in ".data.rel.ro._ZTV" section.
4058         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4059         * testsuite/icf_safe_so_test.cc: Ditto.
4060         * testsuite/icf_safe_test.cc: Ditto.
4061         * testsuite/icf_safe_test.sh: Ditto.
4063 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4064             Ian Lance Taylor  <iant@google.com>
4066         * target-reloc.h (relocate_section): Check the symbol table index
4067         for -1U before setting the local symbol index.
4068         (scan_relocatable_relocs): If copying the relocation, record that
4069         the local symbol is required.
4070         * object.h (Symbol_value::is_output_symtab_index_set): New
4071         function.
4072         (Symbol_value::may_be_discarded_from_output_symtab): New
4073         function.
4074         (Symbol_value::has_output_symtab_entry): New function.
4075         (Symbol_value::needs_output_symtab_entry): Remove.
4076         (Symbol_value::output_symtab_index): Make sure the symbol index is
4077         set.
4078         (Symbol_value::set_output_symtab_index): Make sure the symbol
4079         index is not set.  Make sure the new index is valid.
4080         (Symbol_value::set_must_have_output_symtab_entry): New function.
4081         (Symbol_value::has_output_dynsym_entry): New function.
4082         (Symbol_value::set_output_dynsym_index): Make sure the new index
4083         is valid.
4084         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4085         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4086         local symbol if permitted.
4087         (Sized_relobj::do_finalize_local_symbols): Call
4088         is_output_symtab_index_set rather than needs_output_symtab_entry.
4089         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4090         rather than needs_output_symtab_entry.  Call
4091         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4092         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4093         is_output_symtab_index_set rather than needs_output_symtab_entry.
4094         * testsuite/discard_locals_relocatable_test.c: New file.
4095         * testsuite/discard_locals_test.sh: Test -r.
4096         * testsuite/Makefile.am (check_DATA): Add
4097         discard_locals_relocatable_test1.syms,
4098         discard_local_relocatable_test2.syms.
4099         (MOSTLYCLEANFILES): Likewise.  Also add
4100         discard_locals_relocatable_test1.lout and
4101         discard_locals_relocatable_test2.out.
4102         (discard_locals_relocatable_test1.syms): New target.
4103         (discard_locals_relocatable_test.o): New target.
4104         (discard_locals_relocatable_test1.out): New target.
4105         (discard_locals_relocatable_test2.syms): New target.
4106         (discard_locals_relocatable_test2.out): New target.
4107         (various): Add missing ../ld-new dependencies.
4108         * testsuite/Makefile.in: Rebuild.
4110 2010-03-03  Nick Clifton  <nickc@redhat.com>
4112         * po/fi.po: New Finnish translation.
4114 2010-03-01  Doug Kwan  <dougkwan@google.com>
4116         * layout.cc (Layout::Layout): Force section types of .init_array*,
4117         .preinit_array* and .fini_array* sections.
4118         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4119         Fix check of return value of std::string::find.().
4120         (Output_section::Input_section_sort_compare::operator()): Remove
4121         comment about .init_array.
4122         (Output_section::Input_section_sort_init_fini_compare::operator()):
4123         New method.
4124         (Output_section::sort_attached_input_sections): Handle .init_array
4125         and .fini_array specially.
4126         * output.h (Output_section::Inut_section_sort_compare): Update
4127         comment.
4128         (Output_section::Input_section_sort_init_fini_compare): New struct.
4130 2010-02-26  Doug Kwan  <dougkwan@google.com>
4132         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4133         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4134         * testsuite/debug_msg.sh: Avoid matching source line number for
4135         use of global variable undef_int.
4137 2010-02-26  Doug Kwan  <dougkwan@google.com>
4139         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4140         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4141         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4142         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4143         * options.cc (General_options::General_options): Initialize member
4144         fix_v4bx_.
4145         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4146         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4147         and rm_no_fix_v4bx.stdout
4148         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4149         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4150         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4151         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4152         and arm_no_fix_v4bx.
4153         * Makefile.in: Regenerate.
4154         * testsuite/arm_fix_v4bx.s: New file.
4155         * testsuite/arm_fix_v4bx.sh: Ditto.
4157 2010-02-24  Doug Kwan  <dougkwan@google.com>
4159         * arm.cc (Target_arm::got_section): Make the .got section the first
4160         non RELRO section in the data segment.
4161         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4162         suffixes of section names.
4164 2010-02-24  Doug Kwan  <dougkwan@google.com>
4166         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4167         flags and attributes merging if an input file is a binary file.
4168         * fileread.cc (Input_file::open): Record format of original file.
4169         * fileread.h (Input_file::Format): New enum type.
4170         (Input_file::Input_file): Initialize data member format_.
4171         (Input_file::format): New method definition.
4172         (Input_file::format_):: New data member.
4174 2010-02-24  Doug Kwan  <dougkwan@google.com>
4176         * arm.cc (Arm_output_data_got): New class.
4177         (ARM_TCB_SIZE): New constant
4178         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4179         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4180         If user uses a script with a SECTIONS clause, issue only a warning
4181         for a misplaced EXIDX input section.  Otherwise, issue an error.
4182         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4183         garbage collection.
4184         (Target_arm::got_mode_index_entry): Handle static linking.
4185         (Target_arm::Scan::local): Ditto.
4186         (Target_arm::Scan::global): Ditto.
4187         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4188         all incorrectly implemented relocations.
4189         (Target_arm::fix_exidx_coverage): Pass layout to
4190         Arm_output_section::fix_exidx_coverage.
4191         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4192         from ".ARM.exidx." and ".ARM.extab.".
4194 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4196         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4197         section if it does not already exist.
4198         * attributes.cc (Attributes_section_data::Attributes_section_data):
4199         Don't crash if size is zero.
4201 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4202             Ian Lance Taylor  <iant@google.com>
4204         * gold.cc (queue_middle_tasks): If no input files were opened,
4205         exit.
4206         * workqueue.h (Task_function::Task_function): Assert that there is
4207         a blocker.
4209 2010-02-22  Doug Kwan  <dougkwan@google.com>
4211         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4212         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4213         types to avoid warnings due to different uint64_t implementations
4214         on different hosts.
4216 2010-02-21  Doug Kwan  <dougkwan@google.com>
4218         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4219         handling of the maximum backward branch offset.
4220         (Arm_relocate_functions::thumb_branch_common): Ditto.
4221         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4222         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4223         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4224         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4225         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4226         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4227         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4228         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4229         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4230         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4231         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4232         thumb2_bl_out_of_range.o): New rules.
4233         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4234         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4235         thumb2_bl_out_of_range
4236         * testsuite/Makefile.in: Regenerate.
4237         * testsuite/arm_bl_in_range.s: New file.
4238         * testsuite/arm_bl_out_of_range.s: Ditto.
4239         * testsuite/arm_branch_in_range.sh: Ditto.
4240         * testsuite/arm_branch_range.t: Ditto.
4241         * testsuite/thumb2_branch_range.t: Ditto.
4242         * testsuite/thumb_bl_in_range.s: Ditto.
4243         * testsuite/thumb_bl_out_of_range.s: Ditto.
4244         * testsuite/thumb_branch_range.t: Ditto.
4246 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4248         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4249         Add reloc offset information.
4250         * icf.cc (get_section_contents): Change iterators to point to the new
4251         vectors. Add reloc offset information to the contents.
4252         * icf.h (Icf::Sections_reachable_info): New typedef.
4253         (Icf::Sections_reachable_list): New typedef.
4254         (Icf::Offset_info): New typedef.
4255         (Icf::Reloc_info): New struct typedef.
4256         (Icf::Reloc_info_list): New typedef.
4257         (Icf::symbol_reloc_list): Delete method.
4258         (Icf::addend_reloc_list): Delete method.
4259         (Icf::section_reloc_list): Delete method.
4260         (Icf::reloc_info_list): New method.
4261         (Icf::reloc_info_list_): New member.
4263 2010-02-19  Doug Kwan  <dougkwan@google.com>
4265         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4266         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4267         * arm.cc (Arm_relocation_functions): New forward declaration.
4268         (Target_arm::Target_arm): Initialize new data members
4269         got_mod_index_offset_ and tls_base_symbol_defined_.
4270         (Target_arm::Relocate::relocate_tls): New method.
4271         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4272          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4273         New methods.
4274         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4275         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4276         (Target_arm::got_mod_index_offset_,
4277         Target_arm::tls_base_symbol_defined_): New data members.
4278         (Target_arm::Scan::local, Target::Scan::global,
4279         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4280         relocations.
4282 2010-02-18  Doug Kwan  <dougkwan@google.com>
4284         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4285         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4286         text section as a parameter becuase some broken tools may not set
4287         the link in section header.
4288         (Target_arm::has_got_section): New method.
4289         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4290         without any mapping symbol as data only.  Remove warning.
4291         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4292         link in its section header, try to discover the link by inspecting the
4293         REL31 relocation at the beginning of the section.
4294         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4295         in error message.
4296         (Target_arm::Scan::global): Treat any reference to the symbol
4297         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4299 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4301         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4302         (Scan::global_reloc_may_be_function_pointer): New function.
4303         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4304         (Scan::global_reloc_may_be_function_pointer): New function.
4305         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4306         (Scan::global_reloc_may_be_function_pointer): New function.
4307         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4308         (Scan::global_reloc_may_be_function_pointer): New function.
4309         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4310         (Scan::global_reloc_may_be_function_pointer): New function.
4311         (Scan::possible_function_pointer_reloc): New function.
4312         (Target_x86_64::can_check_for_function_pointers): New function.
4313         * gc.h (gc_process_relocs): Scan relocation types to determine if
4314         function pointers were taken for targets that support it.
4315         * icf.cc (Icf::find_identical_sections): Include functions for
4316         folding in safe ICF whose pointer is not taken.
4317         * icf.h (Secn_fptr_taken_set): New typedef.
4318         (fptr_section_id_): New member.
4319         (section_has_function_pointers): New function.
4320         (set_section_has_function_pointers): New function.
4321         (check_section_for_function_pointers): New function.
4322         * options.h: Fix comment for safe ICF option.
4323         * target.h (can_check_for_function_pointers): New function.
4324         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4325         Modify icf_safe_test for X86-64.
4326         * testsuite/Makefile.in: Regenerate.
4327         * testsuite/icf_safe_so_test.cc: New file.
4328         * testsuite/icf_safe_so_test.sh: New file.
4329         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4330         (main): Change to take pointer to function kept_func_3.
4331         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4332         folding is done correctly for X86-64.
4334 2010-02-12  David S. Miller  <davem@davemloft.net>
4336         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4337         is_symbolless parameter.
4338         (Output_reloc<SHT_REL>::is_symbolless): New.
4339         (Output_reloc<SHT_REL>::is_symbolless_): New.
4340         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4341         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4342         (Output_reloc<SHT_RELA>::is_symbolless): New.
4343         (Output_data_reloc::add_global): Handle is_symbolless.
4344         (Output_data_reloc::add_global_relative): Likewise.
4345         (Output_data_reloc::add_local): Likewise.
4346         (Output_data_reloc::add_local_relative): Likewise.
4347         (Output_data_reloc::add_symbolless_global_addend): New.
4348         (Output_data_reloc::add_symbolless_local_addend): New.
4349         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4350         is_symbolless.
4351         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4352         instead of ->is_relative_
4353         (Output_reloc::write): Likewise.
4354         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4355         (Output_reloc::write_rel): Simplify.
4357         * sparc.cc (Target_sparc::Scan::local): Use
4358         ->add_symbolless_local_addend as needed.
4359         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4360         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4361         based upon relocation offset.
4363 2010-02-11  Doug Kwan  <dougkwan@google.com>
4365         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4366         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4367         beginning of function.
4368         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4369         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4370         parameter is_32bit in calls to should_apply_static_reloc.
4371         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4372         (check_DATA): Add arm_abs_global.stdout.
4373         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4374         arm_abs_global.stdout): New rules.
4375         (MOSTLLYCLEANFILES): Add arm_abs_global
4376         * Makefile.in: Regenerate.
4377         * testsuite/arm_abs_global.s: New file.
4378         * testsuite/arm_abs_global.sh: Ditto.
4379         * testsuite/arm_abs_lib.s: Ditto.
4381 2010-02-11  Ian Lance Taylor  <iant@google.com>
4383         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4384         Read_relocs task.
4385         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4386         Allocate_commons_task first.
4387         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4388         task, rather than symtab_lock_.
4389         (Gc_process_relocs::~Gc_process_relocs): New function.
4390         (Gc_process_relocs::is_runnable): Check this_blocker_.
4391         (Gc_process_relocs::locks): Use next_blocker_ rather than
4392         blocker_.
4393         (Scan_relocs::~Scan_relocs): New function.
4394         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4395         symtab_lock_.
4396         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4397         next_blocker_.
4398         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4399         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4400         constructor accordingly.
4401         (class Gc_process_relocs): Likewise.
4402         (class Scan_relocs): Likewise.
4403         * common.h (class Allocate_commons_task): Remove symtab_lock_
4404         field, and corresponding constructor parameter.
4405         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4406         symtab_lock_.
4407         (Allocate_commons_task::locks): Likewise.
4409 2010-02-11  Ian Lance Taylor  <iant@google.com>
4411         * gold-threads.h (class Once): Define.
4412         (class Initialize_lock): Rewrite as child of Once.
4413         * gold-threads.cc (class Once_initialize): Define.
4414         (once_pointer_control): New static variable.
4415         (once_pointer, once_arg): New static variables.
4416         (c_run_once): New static function.
4417         (Once::Once, Once::run_once, Once::internal_run): New functions.
4418         (class Initialize_lock_once): Remove.
4419         (initialize_lock_control): Remove.
4420         (initialize_lock_pointer): Remove.
4421         (initialize_lock_once): Remove.
4422         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4423         (Initialize_lock::initialize): Rewrite.
4424         (Initialize_lock::do_run_once): New function.
4425         * archive.cc (Archive::interpret_header): Only clear name if it is
4426         not already empty.
4427         * fileread.cc: Include "gold-threads.h"
4428         (file_counts_lock): New static variable.
4429         (file_counts_initialize_lock): Likewise.
4430         (File_read::release): Only increment counts when using --stats.
4431         Use a lock around the increment.
4432         * parameters.cc (class Set_parameters_target_once): Define.
4433         (set_parameters_target_once): New static variable.
4434         (Parameters::Parameters): Move here from parameters.h.
4435         (Parameters::set_target): Rewrite.
4436         (Parameters::set_target_once): New function.
4437         (Parameters::clear_target): Move here and rewrite.
4438         * parameters.h (class Parameters): Update declarations.  Add
4439         set_parameters_target_once_ field.
4440         (Parameters::Parameters): Move to parameters.cc.
4441         (Parameters::clear_target): Likewise.
4442         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4443         task.
4444         (Start_group::~Start_group): New function.
4445         (Start_group::is_runnable): New function.
4446         (Start_group::locks, Start_group::run): New functions.
4447         (Finish_group::run): Change saw_undefined to size_t.
4448         * readsyms.h (class Start_group): Define.
4449         (class Finish_group): Change saw_undefined_ field to size_t.
4450         (Finish_group::Finish_group): Remove saw_undefined and
4451         this_blocker parameters.  Change all callers.
4452         (Finish_group::set_saw_undefined): New function.
4453         (Finish_group::set_blocker): New function.
4454         * symtab.h (class Symbol_table): Change saw_undefined to return
4455         size_t.  Change saw_undefined_ field to size_t.
4456         * target-select.cc (Set_target_once::do_run_once): New function.
4457         (Target_selector::Target_selector): Initialize set_target_once_
4458         field.  Don't initialize lock_ and initialize_lock_ fields.
4459         (Target_selector::instantiate_target): Rewrite.
4460         (Target_selector::set_target): New function.
4461         * target-select.h (class Set_target_once): Define.
4462         (class Target_selector): Update declarations.  Make
4463         Set_target_once a friend.  Remove lock_ and initialize_lock_
4464         fields.  Add set_target_once_ field.
4466 2010-02-10  Ian Lance Taylor  <iant@google.com>
4468         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4469         queueing any tasks.
4470         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4471         (queue_middle_tasks): Add all blockers before queueing any tasks.
4472         (queue_final_tasks): Likewise.
4473         * token.h (Task_token::add_blockers): New function.
4474         * object.h (Input_objects::number_of_relobjs): New function.
4476 2010-02-10  Ian Lance Taylor  <iant@google.com>
4478         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4479         shared, not if not position independent.
4480         * x86_64.cc (Relocate::relocate_tls): Likewise.
4481         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4482         (tls_pie_pic_test): New target.
4483         * testsuite/Makefile.in: Rebuild.
4485         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4486         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4487         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4488         * testsuite/Makefile.in: Rebuild.
4490 2010-02-09  David S. Miller  <davem@davemloft.net>
4492         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4493         R_SPARC_RELATIVE using ->add_local_relative().
4494         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4496         * output.h (Output_data_dynamic::add_section_size): New method
4497         that takes two Output_data objects.
4498         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4499         entry param.  Handle it in initializers.
4500         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4501         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4502         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4503         arg.
4504         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4505         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4506         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4507         for dynrel_includes_plt.
4508         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4509         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4510         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4511         before .rela.plt
4512         (Target_sparc::do_finalize_sections): Update to pass true for
4513         dynrel_includes_plt.
4514         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4515         output before .rela.plt
4516         (Target_powerpc::do_finalize_sections): Update to pass true for
4517         dynrel_includes_plt when 32-bit.
4519 2010-02-08  Doug Kwan  <dougkwan@google.com>
4521         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4522         method.
4523         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4524         Arm_relobj::scan_section_for_cortex_a8_stubs,
4525         Arm_relobj::do_relocation_section): Instead of calling
4526         Output_section::output_address, use faster
4527         Arm_relobj::simple_input_section_output_address.
4529 2010-02-08  David S. Miller  <davem@davemloft.net>
4531         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4532         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4533         relocation helper function.
4535         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4536         just like R_SPARC_GOT{10,13,22}.
4537         (Target_sparc::Scan::local): Likewise.
4538         (Target_sparc::Relocate:relocate): Likewise.
4540 2010-02-06  Ian Lance Taylor  <iant@google.com>
4542         * configure.ac: Rewrite targetobjs duplicate removal code to use
4543         only shell constructs.
4544         * configure: Rebuild.
4546 2010-02-05  Doug Kwan  <dougkwan@google.com>
4548         PR 11247
4549         * arm.cc (Arm_relobj::section_is_scannable): New method.
4550         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4551         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4553 2010-02-04  Doug Kwan  <dougkwan@google.com>
4555         PR 11247
4556         * arm-reloc-property.cc (cstdio): Include.
4557         * configure.ac (targetobjs): Remove duplicates.
4558         * configure: Regenerate.
4559         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4560         big and little endian version for a given address size.
4562 2010-02-03  Doug Kwan  <dougkwan@google.com>
4564         * arm-reloc-property.cc
4565         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4566         definition.
4567         * arm-reloc-property.h
4568         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4569         New method definition.
4570         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4571         declaration.
4572         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4573         overflow to N.
4574         (GOT_PREL): Change implemented to Y.
4575         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4576         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4577         (Arm_relocate_functions::movw_abs_nc): Remove method.
4578         (Arm_relocate_functions::movt_abs): Ditto.
4579         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4580         (Arm_relocate_functions::thm_movt_abs): Ditto.
4581         (Arm_relocate_functions::movw_rel_nc): Ditto.
4582         (Arm_relocate_functions::movw_rel): Ditto.
4583         (Arm_relocate_functions::movt_rel): Ditto.
4584         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4585         (Arm_relocate_functions:thm_movw_rel): Ditto.
4586         (Arm_relocate_functions:thm_movt_rel): Ditto.
4587         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4588         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4589         New method definitions.
4590         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4591         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4592         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4593         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4594         (Target_arm::Relocate::relocate): Check for non-static or
4595         unimplemented relocation code and exit early.  Change calls to
4596         Target_arm::reloc_uses_thumb_bit and
4597         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4598         instead.  Refactor code to handle similar relocations to increase
4599         code sharing.  Remove check for unsupported relocation code in switch
4600         statement.
4601         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4602         relocation property table to find out size.  Change error message to
4603         print out the name of a relocation code instead of the numeric value.
4604         (Target_arm::scan_reloc_for_stub): Use relocation property table
4605         instead of calling Target_arm::reloc_uses_thumb_bit().
4607 2010-02-02  Doug Kwan  <dougkwan@google.com>
4609         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4610         types of relaxed input section.
4612 2010-02-02  Doug Kwan  <dougkwan@google.com>
4614         * Makefile.am (HFILES): Add arm-reloc-property.h.
4615         (DEFFILES): New.
4616         (TARGETSOURCES): Add arm-reloc-property.cc
4617         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4618         (libgold_a_SOURCES): $(DEFFILES)
4619         * Makefile.in: Regenerate.
4620         * arm-reloc-property.cc: New file.
4621         * arm-reloc-property.h: New file.
4622         * arm-reloc.def: New file.
4623         * arm.cc: Update comments.
4624         (arm-reloc-property.h): New included header.
4625         (arm_reloc_property_table): New global variable.
4626         (Target_arm::do_select_as_default_target): New method definition.
4627         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4628         arm-reloc-property to targ_extra_obj.
4629         * parameters.cc (set_parameters_target): Call
4630         Target::select_as_default_target().
4631         * target.h (Target::select_as_default_target): New method definition.
4632         (Target::do_select_as_default_target): Same.
4634 2010-02-01  Doug Kwan  <dougkwan@google.com>
4636         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4637         first_output_text_section_.
4638         (Arm_exidx_fixup::first_output_text_section): New method definition.
4639         (Arm_exidx_fixup::first_output_text_section_): New data member.
4640         (Arm_exidx_fixup::process_exidx_section): Record the first text
4641         output section seen.
4642         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4643         and entsize in output section header.
4645 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4647         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4648         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4649         (Arm_relocate_functions::thm_alu11): New Method.
4650         (Arm_relocate_functions::thm_pc8): New Method.
4651         (Arm_relocate_functions::thm_pc12): New Method.
4652         (Target_arm::Scan::local): Handle the relocations.
4653         (Target_arm::Scan::global): Likewise.
4654         (Target_arm::Relocate::relocate): Likewise.
4655         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4657 2010-01-29  Doug Kwan  <dougkwan@google.com>
4659         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4660         of relocation types as ld.
4662 2010-01-29  Doug Kwan  <dougkwan@google.com>
4664         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4665         to public.
4666         (Arm_relocate_functions::thumb_branch_common): Ditto.
4667         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4668         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4669         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4670         Arm_relocate_functions::jump24): Remove.
4671         (Target_arm::Relocate::relocate): Adjust code to call
4672         Arm_relocation_functions::arm_branch_common and
4673         Arm_relocation_functions::thumb_branch_common instead of their removed
4674         wrappers.  Merge switch-cases together to reduce source code size.
4676 2010-01-29  Doug Kwan  <dougkwan@google.com>
4678         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4679         output_local_symbol_count_needs_update_.
4680         (Arm_relobj::output_local_symbol_count_needs_update,
4681          Arm_relobj::set_output_local_symbol_count_needs_update,
4682          Arm_relobj::update_output_local_symbol_count): New methods.
4683         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4684         member.
4685         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4686         of pointed function as in a R_ARM_PREL31 relocation.
4687         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4688         for output local symbol count updating.
4689         (Target_arm::do_relax): Update output local symbol counts in objects
4690         if necessary.
4691         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4693 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4695         * arm.cc: Added support for the ARM relocations:
4696         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4697         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4698         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4699         movw_prel_nc).
4700         (Arm_relocate_functions::movw_rel): New method.
4701         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4702         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4703         thm_movw_prel_nc).
4704         (Arm_relocate_functions::thm_movw_rel): New method.
4705         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4706         thm_movt_prel).
4707         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4708         relocations.
4709         (Target_arm::Scan::global): Likewise.
4710         (Target_arm::Relocate::relocate): Likewise.
4711         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4712         Likewise.
4714 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4716         * arm.cc: Added support for ARM group relocations.
4717         (Target_arm::reloc_needs_sym_origin): New method.
4718         (Arm_relocate_functions::calc_grp_kn): New method.
4719         (Arm_relocate_functions::calc_grp_residual): New method.
4720         (Arm_relocate_functions::calc_grp_gn): New method.
4721         (Arm_relocate_functions::arm_grp_alu): New Method.
4722         (Arm_relocate_functions::arm_grp_ldr): New Method.
4723         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4724         (Arm_relocate_functions::arm_grp_ldc): New Method.
4725         (Target_arm::Scan::local): Handle the ARM group relocations.
4726         (Target_arm::Scan::global): Likewise.
4727         (Target_arm::Relocate::relocate): Likewise.
4728         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4729         Likewise.
4731 2010-01-26  Doug Kwan  <dougkwan@google.com>
4733         * arm.cc (set): Include.
4734         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4735         pointer type.
4736         (Arm_output_section::Text_section_list): New type.
4737         (Arm_output_section::append_text_sections_to_list): New method.
4738         (Arm_output_section::fix_exidx_coverage): Ditto.
4739         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4740         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4741         Relobj::set_section_offset() instead of
4742         Sized_relobj::invalidate_section_offset().
4743         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4744         parameter for section headers. Ignore relocation sections for
4745         unallocated sections and EXIDX sections.
4746         (Target_arm::fix_exidx_coverage): New method.
4747         (Target_arm::output_section_address_less_than): New type.
4748         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4749         linked text section instead of the EXIDX section.
4750         (Arm_output_section::create_stub_group): Add an assertion to check
4751         that this is not an EXIDX output section.
4752         (Arm_output_section::append_text_sections_to_list): New method.
4753         (Arm_output_section::fix_exidx_coverage): Ditto.
4754         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4755         Arm_relobj::section_needs_reloc_stub_scanning.
4756         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4757         first pass.
4758         (Target_arm::fix_exidx_coverage): New method.
4759         * object.h (Relobj::set_output_section): New method.
4760         (Sized_relobj::invalidate_section_offset): Remove method.
4761         (Sized_relobj::do_invalidate_section_offset): Remove method.
4762         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4764 2010-01-25  Doug Kwan  <dougkwan@google.com>
4766         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4767         Fix warning due to signed and unsigned comparison on a 32-bit host.
4769 2010-01-22  Doug Kwan  <dougkwan@google.com>
4771         * arm.cc (Target_arm::do_relax): Record an output section for section
4772         offset adjustment it contains any stub table that has changed.
4773         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4774         offsets in an output section if necessary.
4775         * output.cc (Output_section::Output_section): Initialize
4776         section_offsets_need_adjustments_.
4777         (Output_section::add_input_section_for_script): Renamed to
4778         Output_section::add_simple_input_section.
4779         (Output_section::save_states): Add a comment.
4780         (Output_section::discard_states): New method defintion.
4781         (Output_section::adjust_section_offsets): Same.
4782         * output.h (Output_section::add_input_section_for_script): Renamed to
4783         Output_section::add_simple_input_section.
4784         (Output_section::discard_states): New method declaration.
4785         (Output_section::adjust_section_offsets): Same.
4786         (Output_section::section_offsets_need_adjustment,
4787         Output_section::set_section_offsets_need_adjustment): New method
4788         definitions.
4789         (Output_section::section_offsets_need_adjustment_): New data member.
4790         * script-sections.cc
4791         (Output_section_element_input::set_section_address): Adjust code for
4792         renaming of Output_section::add_input_section_for_script.
4793         (Orphan_output_section::set_section_address): Same.
4795 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4797         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4798         Fix_v4bx enum values .
4799         * gold/options.h (General_options): New option definitions.
4800         (General_options::fix_v4bx): New method.
4801         (General_options::Fix_v4bx): New enum.
4802         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4803         (General_options::parse_fix_v4bx_interworking): New method.
4805 2010-01-22  Doug Kwan  <dougkwan@google.com>
4807         * arm.cc (Arm_exidx_fixup): New class.
4809 2010-01-21  Doug Kwan  <dougkwan@google.com>
4811         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4812         classes.
4813         (Arm_exidx_section_offset_map): New type.
4815 2010-01-21  Doug Kwan  <dougkwan@google.com>
4817         * arm.cc (Arm_exidx_input_section): New class.
4818         (Arm_relobj::exidx_input_section_by_link,
4819         Arm_relobj::exidx_input_section_by_shndx,
4820         Arm_relobj::make_exidx_input_section): New methods.
4821         (read_arm_attributes_section): Remove.
4822         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4823         information about them.
4824         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4825         to here.
4827 2010-01-20  Doug Kwan  <dougkwan@google.com>
4829         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4830         Input_section_specifier to Section_id.
4831         (Target_arm::new_arm_input_section: Adjust code for change of key
4832         type.
4833         (Target_arm::find_arm_input_section): Ditto.
4834         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4835         (Section_id): Remove.
4836         (Garbage_collection::Section_id_hash): Remove.
4837         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4838         (Section_id): Remove.
4839         (Icf::Section_id_hash): Remove.
4840         * object.h (Section_id, Const_section_id, Section_id_hash,
4841         Const_section_id_hash): New type definitions.
4842         * output.cc (Output_section::add_relaxed_input_section): Change to
4843         use Const_section_id instead of Input_section_specifier as key type.
4844         (Output_section::add_merge_input_section): Ditto.
4845         (Output_section::build_relaxation_map): Change to use Section_id
4846         instead of Input_section_specifier as key type.
4847         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4848         Ditto.
4849         (Output_section::convert_input_sections_to_relaxed_sections): Change
4850         to use Const_section_id instead of Input_section_specifier as key type.
4851         (Output_section::find_merge_section): Ditto.
4852         (Output_section::find_relaxed_input_section): Ditto.
4853         * output.h (Input_section_specifier): Remove class.
4854         (Output_section::Output_section_data_by_input_section_map): Change
4855         key type to Const_section_id.
4856         (Output_section::Output_relaxed_input_section_by_input_section_map):
4857         Ditto.
4858         (Output_section::Relaxation_map): Change key type to Section_id.
4860 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4862         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4863         (class Arm_v4bx_stub): New class.
4864         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4865         (Stub_factory::make_arm_v4bx_stub): New method.
4866         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4867         (Stub_table::empty): Handle v4bx stubs.
4868         (Stub_table::add_arm_v4bx_stub): New method.
4869         (Stub_table::find_arm_v4bx_stub): New method.
4870         (Arm_relocate_functions::v4bx): New method.
4871         (Target_arm::fix_v4bx): New method.
4872         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4873         (Stub_table::relocate_stubs): Likewise.
4874         (Stub_table::do_write): Likewise.
4875         (Stub_table::update_data_size_and_addralign): Likewise.
4876         (Stub_table::finalize_stubs):  Likewise.
4877         (Target_arm::Scan::local): Likewise.
4878         (Target_arm::Scan::global): Likewise.
4879         (Target_arm::do_finalize_sections): Likewise.
4880         (Target_arm::Relocate::relocate): Likewise.
4881         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4882         Likewise.
4883         (Target_arm::scan_reloc_for_stub): Likewise.
4884         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4886 2010-01-19  Ian Lance Taylor  <iant@google.com>
4888         * output.cc (Output_section_headers::do_sized_write): Write large
4889         segment count to sh_info field.
4890         (Output_file_header::do_sized_write): For large segment count,
4891         write PN_XNUM to e_phnum field.
4893 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4895         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4896         (Arm_relocate_functions::thm_jump8): New function.
4897         (Arm_relocate_functions::thm_jump11): New function.
4898         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4899         R_ARM_THM_JUMP11.
4900         (Target_arm::Scan::global): Likewise.
4901         (Target_arm::Relocate::relocate): Likewise.
4902         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4903         Likewise.
4905 2010-01-14  Doug Kwan  <dougkwan@google.com>
4907         * arm.cc (map, utility): Include headers.
4908         (Target_arm::apply_cortex_a8_workaround): New method.
4909         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4910         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4911         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4912         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4913         the --[no-]fix-cortex-a8 command line options.
4914         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4915         (Target_arm::relocate_stub): Use addend in instruction template.
4916         * options.h (DEFINE_bool): Set the user-set flag.
4917         (General_options): Add --[no-]-fix-cortex options.
4918         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4919         : Update fast look-up map after conversion.
4921 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4923         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4924         in the first pass of do_layout.
4926 2010-01-13  Doug Kwan  <dougkwan@google.com>
4928         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4929         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4930         apparent compiler problem of not folding static constant integral
4931         data members of elfcpp::Elf_sizes<32>.
4933 2010-01-13  Doug Kwan  <dougkwan@google.com>
4935         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4936         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4937         Arm_relobj::scan_section_for_cortex_a8_erratum,
4938         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4939         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4940         sections to scan for relocation stubs into a new method
4941         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4942         relocation and Cortex-A8 stub scanning.
4943         (Target_arm::do_relax): Force stubs to be after stubbed sections
4944         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4945         the beginning of a new relaxation pass.  Update a comment.
4946         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4948 2010-01-12  Ian Lance Taylor  <iant@google.com>
4950         * target-reloc.h (visibility_error): New inline function.
4951         (relocate_section): Call visibility_error.
4952         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4953         (MOSTLYCLEANFILES): Likewise.
4954         (protected_4_pic.o, protected_3.err): New targets.
4955         * testsuite/protected_4.cc: New file.
4957 2010-01-12  Doug Kwan  <dougkwan@google.com>
4959         * arm.cc (Cortex_a8_reloc): New class.
4960         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4961         and cortex_a8_relocs_info_.
4962         (Target_arm::fix_cortex_a8): New method definition.
4963         (Target_arm::Cortex_a8_relocs_info): New type.
4964         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4965         New data member declarations.
4966         (Target_arm::scan_reloc_for_stub): Record information about
4967         relocations for THUMB branches that might be exempted from the
4968         Cortex-A8 workaround.
4969         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4970         at the beginning of a relaxation pass.
4972 2010-01-12  Doug Kwan  <dougkwan@google.com>
4974         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4975         (Arm_relobj::Mapping_symbol_position,
4976          Arm_reloj::Mapping_symbol_position_less,
4977          Arm_relobj::Mapping_symbols_info): New types.
4978         (Target_arm::is_mapping_symbol_name): New method definition.
4979         (Arm_relobj::do_count_local_symbols): Save information about mapping
4980         symbols.
4982 2010-01-11  Doug Kwan  <dougkwan@google.com>
4984         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4985         Arm_relocate_functions::thumb32_branch_upper,
4986         Arm_relocate_functions::thumb32_branch_lower,
4987         Arm_relocate_functions::thumb32_cond_branch_offset,
4988         Arm_relocate_functions::thumb32_cond_branch_upper,
4989         Arm_relocate_functions::thumb32_cond_branch_lower,
4990         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4991         branch offset encoding.
4992         (Arm_relocate_functions::thumb_branch_common): Use new branch
4993         offset encoding methods to avoid code duplication.
4994         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4995         (Stub_addend_reader::operator()): Use new branch encoding method
4996         to avoid code duplication.
4998 2010-01-11  Doug Kwan  <dougkwan@google.com>
5000         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5001         (Target_arm::do_finalize_sections): Define special EXIDX section
5002         symbols only if referenced.
5003         * gc.h (Garbage_collection::add_reference): New method.
5004         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5005         code duplication.
5007 2010-01-11  Ian Lance Taylor  <iant@google.com>
5009         * script.cc (Version_script_info::build_expression_list_lookup):
5010         Change complaing about duplicate wildcard match from error to
5011         warning.
5013         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5014         of 2009-12-30.
5015         (Version_script_info::Version_script_info): Initialize globs_,
5016         default_version_, default_is_global_, and exact_.  Don't
5017         initialize globals_ or locals_.
5018         (Version_script_info::build_lookup_tables): Build local symbols
5019         first.
5020         (Version_script_info::unquote): New function.
5021         (Version_script_info::add_exact_match): New function.
5022         (Version_script_info::build_expression_list_lookup): Remove lookup
5023         parameter.  Add is_global parameter.  Change all callers.  Handle
5024         wildcard pattern specially.  Unquote pattern.  Call
5025         add_exact_match.
5026         (Version_script_info::get_name_to_match): New function.
5027         (Version_script_info::get_symbol_version): New function.
5028         (Version_script_info::get_symbol_version_helper): Remove.
5029         (Version_script_info::check_unmatched_names): Call unquote.
5030         * script.h (class Version_script_info): Change get_symbol_version
5031         to be non-inline and add is_global parameter; change all callers.
5032         Rewrite symbol_is_local.  Update declarations.  Define struct
5033         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5034         Remove globals_ and locals_ members.  Add exact_, globs_,
5035         default_version_, is_global_.
5036         (Version_script_info::Glob): Remove pattern, add expression and
5037         is_global.  Update constructor.  Change all callers.
5038         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5039         default version.
5040         (Versions::symbol_section_contents): If a symbol is undefined, or
5041         defined in a dynamic object, set the version index to
5042         VER_NDX_LOCAL.
5043         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5044         symbol_is_local.
5045         (Symbol_table::add_from_pluginobj): Likewise.
5046         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5048 2010-01-11  Doug Kwan  <dougkwan@google.com>
5050         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5051         (incremental_dump_LDADD): Add linking option for libintl.
5052         * Makefile.in: Regenerate.
5054 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5056         PR gold/11144
5057         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5058         instead of -Ds.
5059         * testsuite/Makefile.in: Regenerated.
5061 2010-01-10  Doug Kwan  <dougkwan@google.com>
5063         * options.h (DEFINE_var): Use parentheses around argument varname__
5064         in macro body to avoid any unintended subsequent substitutions.
5066 2010-01-10  Ian Lance Taylor  <iant@google.com>
5068         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5069         candidates before doing symbol resolution.
5071         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5072         ODR candidates if only one is weak.
5074 2010-01-08  Ian Lance Taylor  <iant@google.com>
5076         * script.cc (Version_script_info::build_expression_list_lookup):
5077         Don't warn about ambiguous version, just record the ambiguity.
5078         (Version_script_info::get_symbol_version_helper): Give error if
5079         version is ambiguous.
5081 2010-01-08  Doug Kwan  <dougkwan@google.com>
5083         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5084           prev_data_size_ and prev_addralign_.  Remove initializer for
5085           deleted data member has_been_changed_.
5086           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5087           to determine if the table is empty.
5088           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5089           Remove.
5090           (Stub_table::add_reloc_stub): Define method in class definition
5091           instead of just declaring it there.
5092           (Stub_table::add_cortex_a8_stub): New method definition.
5093           (Stub_table::update_data_size_and_addralign): Ditto.
5094           (Stub_table::finalize_stubs): Ditto.
5095           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5096           (Stub_table::do_addralign_): Return address alignment in the
5097           (Stub_table::do_reset_address_and_file_offset): Define method in
5098           class definition instead of declaring it there.  Set current data
5099           size to be the data size of the previous pass.
5100           (Stub_table::set_final_data_size): Use current data size as the
5101           final data size.
5102           (Stub_table::relocate_stub): Change parameter type of stub from
5103           Reloc_stub pointer to Stub pointer.
5104           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5105           (Stub_table::Cortex_a8_stub_list): New typedef.
5106           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5107            Stub_table::prev_addralign_): New data member.
5108           (Arm_relobj::Arm_relobj): Initialize data member
5109           section_has_cortex_a8_workaround_.
5110           (Arm_relobj::section_has_cortex_a8_workaround,
5111            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5112            definitions.
5113           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5114           declarations.
5115           (Target_arm::relocate_stub): Change parameter type of stub from
5116           Reloc_stub pointer to Stub pointer.
5117           (Insn_template::size, Insn_template::alignment): Handle
5118           THUMB16_SPECIAL_TYPE.
5119           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5120            Stub_table::update_data_size_and_addralign,
5121            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5122           definitions.
5123           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5124           (Stub_table::do_write): Ditto.
5125           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5127 2010-01-08  Ian Lance Taylor  <iant@google.com>
5129         PR 11108
5130         * symtab.h (class Symbol): Remove fields is_target_special_ and
5131         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5132         (Symbol::is_defined_in_discarded_section): New function.
5133         (Symbol::set_is_defined_in_discarded_section): New function.
5134         (Symbol::has_plt_offset): Rewrite.
5135         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5136         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5137         Don't initialize is_target_special_ or has_plt_offset_.
5138         Initialize is_defined_in_discarded_section_.
5139         (Symbol_table::add_from_relobj): If appropriate, set
5140         is_defined_in_discarded_section.
5141         * resolve.cc (Symbol::override_base_with_special): Don't test
5142         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5143         * target-reloc.h (relocate_section): Do special handling for
5144         symbols defined in discarded sections for global symbols as well
5145         as local symbols.
5147 2010-01-08  Ian Lance Taylor  <iant@google.com>
5149         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5150         the SHT_SYMTAB case.
5152 2010-01-08  Ian Lance Taylor  <iant@google.com>
5154         * object.cc (Sized_relobj::do_layout): Don't get confused if
5155         layout_eh_frame returns NULL.
5157 2010-01-08  Ian Lance Taylor  <iant@google.com>
5159         PR 11084
5160         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5161         dynamic symbol table, use the normal symbol table.
5162         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5163         symbol table.
5165 2010-01-08  Ian Lance Taylor  <iant@google.com>
5167         PR 11072
5168         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5169         sections.
5171 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5173         * version.cc (print_version): Change to "Copyright 2010".
5175 2010-01-08  Ian Lance Taylor  <iant@google.com>
5177         PR 10287
5178         PR 11063
5179         * i386.cc (class Target_i386): Change return type of plt_section
5180         to be non-const.
5181         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5182         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5183         tls_desc_rel_ field.
5184         (Output_data_plt_i386::rel_tls_desc): New function.
5185         (Target_i386::rel_tls_desc_section): New function.
5186         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5187         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5188         R_386_TLS_DESC reloc in rel_tls_desc_section.
5189         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5190         Define struct Tlsdesc_info.
5191         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5192         (Target_x86_64::do_reloc_symbol_index): New function.
5193         (Target_x86_64::add_tlsdesc_info): New function.
5194         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5195         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5196         tlsdesc_rel_ field.
5197         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5198         all callers.
5199         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5200         (Target_x86_64::rela_tlsdesc_section): New function.
5201         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5202         handling.
5203         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5204         (Target_x86_64::do_reloc_addend): New function.
5205         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5206         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5207         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5208         (Output_reloc::type): New function.
5209         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5210         (Output_reloc::is_target_specific): New function.
5211         (Output_reloc::target_arg): New function.
5212         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5213         absolute relocs and target specific relocs.
5214         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5215         add_target_specific.
5216         (class Output_data_reloc) [SHT_RELA]: Likewise.
5217         * output.cc (Output_reloc::Output_reloc): Add four new versions
5218         for absolute relocs and target specific relocs.
5219         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5220         (Output_reloc::get_symbol_index): Likewise.
5221         (Output_reloc::local_section_offset): Check that local_sym_index_
5222         is not TARGET_CODE or 0.
5223         (Output_reloc::symbol_value): Likewise.
5224         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5225         reloc.
5226         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5227         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5228         functions.
5229         * layout.cc (add_target_dynamic_tags): Use output section for
5230         DT_PLTRELSZ and DT_JMPREL.
5232 2010-01-07  Ian Lance Taylor  <iant@google.com>
5234         PR 11061
5235         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5236         function.
5237         (class Output_data_reloc_generic): Define.
5238         (class Output_data_reloc_base): Change base class to
5239         Output_data_reloc_generic.  Change add() method to call
5240         bump_relative_reloc_count for a relative reloc.  Remove
5241         sort_relocs_ field.
5242         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5243         to sort_relocs().
5244         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5245         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5246         appropriate.
5247         * layout.h (class Layout): Update declaration.
5249 2010-01-07  Ian Lance Taylor  <iant@google.com>
5251         * output.h (class Output_data): Add const version of
5252         output_section and do_output_section.
5253         (class Output_section_data): Add const version of
5254         do_output_section.
5255         (class Output_section): Likewise.
5256         * layout.cc (Layout::add_target_dynamic_tags): New function.
5257         * layout.h (class Layout): Update declarations.
5258         * arm.cc (Target_arm::do_finalize_sections): Use
5259         add_target_dynamic_tags.
5260         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5261         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5262         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5263         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5265 2010-01-07  Ian Lance Taylor  <iant@google.com>
5267         PR 11042
5268         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5269         object as needed.
5271 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5272             Ian Lance Taylor  <iant@google.com>
5274         PR 11019
5275         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5276         Xindex::read_symtab_xindex.
5278 2010-01-07  Doug Kwan  <dougkwan@google.com>
5280         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5281         (Insn_template::thumb16_bcond_insn): New method declaration.
5282         (Insn_template): Fix spelling.
5283         (Stub::thumb16_special): New method declaration.
5284         (Stub::do_write): Define virtual method which was previously pure
5285         virtual.
5286         (Stub::do_thumb16_special): New method declaration.
5287         (Stub::do_fixed_endian_write): New template member.
5288         (Reloc_stub::do_write): Remove.
5289         (Reloc_stub::do_fixed_endian_write): Remove.
5290         (Cortex_a8_stub): New class definition.
5291         (Stub_factory::make_cortex_a8_stub): New method definition.
5292         (Stub_factory::Stub_factory): Add missing static storage class
5293         qualifier for elf32_arm_stub_a8_veneer_blx.
5295 2010-01-07  Ian Lance Taylor  <iant@google.com>
5297         PR 10980
5298         * options.h (class General_options): Add --warn-unresolved-symbols
5299         and --error-unresolved-symbols.
5300         * errors.cc (Errors::undefined_symbol): Implement
5301         --warn-unresolved-symbols.
5303         * options.h (class General_options): Add -z text and -z textoff.
5304         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5306 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5308         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5309         (Garbage_collection::cident_sections): New function.
5310         (Garbage_collection::add_cident_section): New function.
5311         (Garbage_collection::cident_sections_): New member.
5312         (gc_process_relocs): Add references to sections whose names are C
5313         identifiers.
5314         * gold.h (cident_section_start_prefix): New constant.
5315         (cident_section_stop_prefix): New constant.
5316         (is_cident): New function.
5317         * layout.cc (Layout::define_section_symbols): Replace string constants
5318         with the newly defined constants.
5319         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5320         C identifiers.
5321         * testsuite/Makefile.am: Add gc_orphan_section_test.
5322         * testsuite/Makefile.in: Regenerate.
5323         * testsuite/gc_orphan_section_test.cc: New file.
5324         * testsuite/gc_orphan_section_test.sh: New file.
5326 2010-01-06  Ian Lance Taylor  <iant@google.com>
5328         PR 10980
5329         * options.h (class General_options): Add --warn-shared-textrel.
5330         * layout.cc (Layout::finish_dynamic_section): Implement
5331         --warn-shared-textrel.
5333         PR 10980
5334         * options.h (class General_options): Add --warn-multiple-gp.
5336 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5338         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5339         $(THREADSLIB) and $(LIBDL).
5340         * Makefile.in: Rebuild.
5342 2010-01-06  Ian Lance Taylor  <iant@google.com>
5344         PR 10980
5345         * options.cc (General_options::parse_section_start): New function.
5346         (General_options::section_start): New function.
5347         (General_options::General_options): Initialize all members.
5348         * options.h: Include <map>
5349         (class General_options): Add --section-start.  Add section_starts_
5350         member.
5351         * layout.cc (Layout::attach_allocated_section_to_segment): If
5352         --section-start was used, set the address of the segment.  Remove
5353         local sort_sections.
5354         (Layout::relaxation_loop_body): If the address of the load segment
5355         has been set by --section-start, don't use it.
5356         * output.h (Output_segment::update_flags_for_output_section): New
5357         function.
5358         * output.cc (Output_segment::add_output_section): Call
5359         update_flags_for_output_section.
5361 2010-01-05  Ian Lance Taylor  <iant@google.com>
5363         PR 10980
5364         * options.h (class General_options): Add --undefined-version.
5365         * script.cc (struct Version_expression): Add was_matched_by_symbol
5366         field.
5367         (Version_script_info::matched_symbol): New function.
5368         (Version_script_info::get_symbol_version_helper): Call
5369         matched_symbol.
5370         (Version_script_info::check_unmatched_names): New function.
5371         * script.h (class Version_script_info): Update declarations.
5372         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5374         * options.h (class General_options): Use DEFINE_bool_alias for
5375         allow_multiple_definition.
5376         * resolve.cc (Symbol_table::should_override): Don't test
5377         allow_multiple_definition.
5379         PR 10980
5380         * options.h (class General_options): Add --cref.
5381         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5382         until after printing cref table.
5383         * cref.cc: Include "symtab.h".
5384         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5385         (Cref_table_compare::operator()): New function.
5386         (Cref_inputs::gather_cref): New function.
5387         (filecol): New static const.
5388         (Cref_inputs::print_cref): New function.
5389         (Cref::print_cref): New function.
5390         * cref.h: Include <cstdio>.
5391         (class Cref): Update declarations.
5392         * mapfile.h (Mapfile::file): New function.
5393         * object.h (class Object): Define Symbols.  Declare virtual
5394         do_get_global_symbols.
5395         (Object::get_global_symbols): New function.
5396         * object.cc (Input_objects::add_object): Pass object to cref_ if
5397         --cref.
5398         (Input_objects::archive_start): Likewise.
5399         (Input_objects::archive_stop): Likewise.
5400         (Input_objects::print_cref): New function.
5401         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5402         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5403         --cref.
5404         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5405         function.
5406         * plugin.h (class Sized_pluginobj): Update declarations.
5408 2010-01-05  Ian Lance Taylor  <iant@google.com>
5410         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5411         to is_default_version.  Rename insdef to insdefault.
5412         (Symbol_table::add_from_relobj): Rename def to is_default_version
5413         and local to is_forced_local.
5414         (Symbol_table::add_from_pluginobj): Likewise.
5415         (Symbol_table::add_from_dynobj): Likewise.
5416         (Symbol_table::define_special_symbol): Rename insdef to
5417         insdefault.
5419 2010-01-04  Ian Lance Taylor  <iant@google.com>
5421         PR 10980
5422         * options.h (class General_options): Add
5423         --allow-multiple-definition and -z muldefs.
5424         * resolve.cc (Symbol_table::should_override): Don't warn about a
5425         multiple symbol definition if --allow-multiple-definition or -z
5426         muldefs.
5428         PR 10980
5429         * options.h (class General_options): Add --add-needed and
5430         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5431         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5432         error if --copy-dt-needed-entries aka --add-needed is used and
5433         would cause a change in behaviour.
5435         PR 10980
5436         * options.h (class General_options): Add -G as a short version of
5437         --shared.  Add no-op options -assert, -g, and -i.
5439 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5441         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5442         check for .text or .gnu.linkonce.t sections.
5443         * icf.cc (Icf::find_identical_sections): Ditto.
5444         Change the detection for mangled function name within the section
5445         name.
5446         * icf.h (is_section_foldable_candidate): New function.
5448 2009-12-30  Ian Lance Taylor  <iant@google.com>
5450         PR 10980
5451         * options.h (class General_options): Permit two dashes with
5452         --retain-symbols-file.
5454 2009-12-30  Ian Lance Taylor  <iant@google.com>
5456         PR 10979
5457         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5458         don't put the file header and segment headers in the text
5459         segment.
5461         PR 10979
5462         * common.cc (Sort_commons::operator()): Stabilize sort when both
5463         entries are NULL.
5464         (Symbol_table::do_allocate_commons_list): When allocating common
5465         symbols, skip a symbol which is no longer common.
5466         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5467         an object before checking its type.
5468         * testsuite/common_test_2.c: New file.
5469         * testsuite/common_test_3.c: New file.
5470         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5471         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5472         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5473         (common_test_2_pic.o, common_test_2.so): New targets.
5474         (common_test_3_pic.o, common_test_3.so): New targets.
5475         * testsuite/Makefile.in: Rebuild.
5477         PR 10979
5478         * script.cc (read_input_script): If we see a new SECTIONS clause,
5479         and we have added an input section, give an error.
5480         * layout.h (class Layout): Add have_added_input_section function.
5481         Add have_added_input_section_ field.
5482         * layout.cc (Layout::Layout): Initialize
5483         have_added_input_section_.
5484         (Layout::layout): Set have_added_input_section_.
5485         (Layout::layout_eh_frame): Likewise.
5487 2009-12-30  Ian Lance Taylor  <iant@google.com>
5489         PR 10931
5490         * options.h (class General_options): Add --sort-common option.
5491         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5492         * common.cc (Sort_common): Add sort_order parameter to
5493         constructor.  Add sort_order_ field.
5494         (Sort_commons::operator): Check sort_order_.
5495         (Symbol_table::allocate_commons): Determine the sort order.
5496         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5497         Change all callers.
5498         (Symbol_table::do_allocate_commons_list): Likewise.
5500 2009-12-30  Ian Lance Taylor  <iant@google.com>
5502         PR 10916
5503         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5504         symbols from this object, don't change the visibility of an
5505         undefined symbol.
5506         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5508 2009-12-30  Ian Lance Taylor  <iant@google.com>
5510         PR 10861
5511         * script.h (class Version_script_info): Define Language enum.
5512         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5513         new fields globals_, locals_, and is_finalized_.
5514         * script.cc: Various formatting fixes.
5515         (class Parser_closure): Change language_stack_ from a vector of
5516         std::string to one of Version_script_info::Language.  Adjust all
5517         uses accordingly.
5518         (class Lazy_demangler): Remove.
5519         (struct Version_expression): Change language from std::string to
5520         Version_script_info::Language.
5521         (Version_script_info::Version_script_info): New function.
5522         (Version_script_info::~Version_script_info): Don't call clear.
5523         (Version_script_info::finalize): New function.
5524         (Version_script_info::build_lookup_tables): New function.
5525         (Version_script_info::build_expression_list_lookup): New
5526         function.
5527         (Version_script_info::get_symbol_version_helper): Rewrite to use
5528         lookup tables.
5529         (Version_script_info::print_expression_list): Adjust to use
5530         Version_script_info::Language.
5531         (script_push_lex_into_version_mode): Check that the version script
5532         has not been finalized.
5533         (version_script_push_lang): Change language string to
5534         Version_script_info::Language.
5535         * options.cc (Command_line::version_script): New function.
5536         * options.h (class General_options): Add finalize_dynamic_list
5537         function.  Change version_script from declaration to definition.
5538         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5539         * testsuite/version_script.map: Remove duplicate def of foo.
5540         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5541         version_script.map.
5542         * testsuite/Makefile.in: Rebuild.
5544 2009-12-30  Ian Lance Taylor  <iant@google.com>
5546         PR 10843
5547         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5548         if the input symbol index is 0, make the output symbol index 0.
5550 2009-12-30  Ian Lance Taylor  <iant@google.com>
5552         PR 10670
5553         * options.h (class General_options): Add -x/--discard-all.
5554         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5555         --discard-all.  If the local symbol needs a dynamic entry, check
5556         that before handling --discard-locals.
5558 2009-12-30  Ian Lance Taylor  <iant@google.com>
5560         PR 10450
5561         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5562         flags to PF_R.
5563         (Output_segment::add_output_section): Don't change the flags if
5564         the type is PT_TLS.
5566         PR 10450
5567         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5568         GNU hash table if they need a dynamic value.  Otherwise, don't add
5569         them if they are defined in a dynamic object or are forced local.
5571 2009-12-29  Ian Lance Taylor  <iant@google.com>
5573         PR 10450
5574         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5575         .gnu.hash table for a 32-bit target.
5577         PR 10450
5578         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5579         regular and a dynamic object only needs a dynamic symbol table
5580         entry if it is externally visible.
5582         PR 10450
5583         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5584         constructor.  Add global_offset_table_ field.
5585         (Target_i386::got_section): Set global_offset_table_.
5586         (Target_i386::do_finalize_sections): Set global_offset_table_
5587         size.
5588         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5589         in constructor.  Add global_offset_table_ field.
5590         (Target_x86_64::got_section): Set global_offset_table_.
5591         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5592         size.
5594         * layout.cc (Layout::Layout): Initialize increase_relro_.
5595         (Layout::get_output_section): Add is_relro, is_last_relro, and
5596         is_first_non_relro parameters.  Change all callers.
5597         (Layout::choose_output_section): Likewise.
5598         (Layout::add_output_section_data): Likewise.
5599         (Layout::make_output_section): Likewise.
5600         (Layout::set_segment_offsets): Clear increase_relro when using a
5601         linker script.
5602         * layout.h (class Layout): Add increase_relro method.  Add
5603         increase_relro_ field.  Update declarations.
5604         * output.cc (Output_section::Output_section): Initialize
5605         is_last_relro_ and is_first_non_relro_.
5606         (Output_segment::add_output_section): Group relro sections is
5607         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5608         (Output_segment::maximum_alignment): Remove relro handling.
5609         (Output_segment::set_section_addresses): Add increase_relro
5610         parameter.  Change all callers.  Add initial alignment to align
5611         relro sections on separate page.  Remove old relro handling.
5612         (Output_segment::set_section_list_addresses): Remove in_relro
5613         parameter.  Change all callers.
5614         (Output_segment::set_offset): Add increase parameter.  Change all
5615         callers.  Remove old relro handling.
5616         * output.h (class Output_section): Add new methods: is_last_relro,
5617         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5618         Add is_last_relro_ and is_first_non_relro_ fields.
5619         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5620         Create separate .got.plt section.  Call increase_relro.
5621         * x86_64.cc (Target_x86_64::got_section): Likewise.
5622         * testsuite/relro_script_test.t: Add .got.plt.
5624         PR 10450
5625         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5626         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5627         (Layout::finalize): Call set_dynamic_symbol_size.
5628         (Layout::set_dynamic_symbol_size): New function.
5629         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5630         set_dynamic_symbol_size.
5632         PR 10450
5633         * output.h (class Output_section): Add is_entsize_zero_ field.
5634         * output.cc (Output_section::Output_section): Initialize
5635         is_entsize_zero_.
5636         (Output_section::set_entsize): If two different entsizes are
5637         requested, force it to zero.
5638         (Output_section::add_input_section): Set flags for .debug_str
5639         before updating section flags.  Set entsize.
5640         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5641         and SHF_STRING if all input sections have those flags.
5643 2009-12-29   Rafael Espindola  <espindola@google.com>
5645         * main.cc (main): Fix the sys time reporting.
5646         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5647         reporting.
5649 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5651         * options.cc (General_options::parse_version): Allow -v to exit
5652         without an error if there is nothing to link.
5654 2009-12-29  Ian Lance Taylor  <iant@google.com>
5656         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5657         using a version of gcc before 4.1.
5658         * configure: Rebuild.
5660 2009-12-28  Chris Demetriou  <cgd@google.com>
5662         * attributes.cc (Output_attributes_section_data::do_write): Use
5663         std::vector::front rather than std::vector::data.
5665 2009-12-28  Ian Lance Taylor  <iant@google.com>
5667         * symtab.h (class Symbol_table): Add enum Defined.
5668         * resolve.cc (Symbol_table::should_override): Add defined
5669         parameter.  Change all callers.  Test whether object is NULL
5670         before calling a method on it.
5671         (Symbol_table::report_resolve_problem): Add defined parameter.
5672         Change all callers.
5673         (Symbol_table::should_override_with_special): Likewise.
5674         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5675         parameter.  Change all callers.
5676         (Symbol_table::do_define_in_output_data): Likewise.
5677         (Symbol_table::define_in_output_segment): Likewise.
5678         (Symbol_table::do_define_in_output_segment): Likewise.
5679         (Symbol_table::define_as_constant): Likewise.
5680         (Symbol_table::do_define_as_constant): Likewise.
5681         * script.h (class Symbol_assignment): Add is_defsym parameter to
5682         constructor; change all callers.
5683         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5684         parameter.  Change all callers.  Add is_defsym_ field.
5685         (class Parser_closure): Add parsing_defsym parameter to
5686         constructor; change all callers.  Add parsing_defsym accessor
5687         function.  Add parsing_defsym_ field.
5689 2009-12-28  Ian Lance Taylor  <iant@google.com>
5691         * gold.cc (queue_middle_tasks): Fix formatting.
5692         * object.cc (Relobj::is_section_name_included): Likewise.
5694 2009-12-23  Ian Lance Taylor  <iant@google.com>
5696         * i386.cc (Target_i386::do_calls_non_split): Recognize
5697         -fsplit-stack prologue for a function with a static chain.
5698         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5699         -fsplit-stack prologue when using %r11.
5701 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5703         * options.cc (General_options::parse_version): Make -v continue and do
5704         the link like GNU ld does.
5706 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5708         * Makefile.am (CCFILES): Add timer.cc.
5709         (HFILES): Add timer.h.
5710         * configure.ac: Check for sysconf and times.
5711         * main.cc: include timer.h.
5712         (main): Use Timer instead of get_run_time.
5713         * timer.cc: New.
5714         * timer.h: New.
5715         * workqueue.cc: include timer.h.
5716         (Workqueue::find_and_run_task):
5717         Report user, sys and wall time.
5718         * Makefile.in: Regenerate.
5719         * config.in: Regenerate.
5720         * configure: Regenerate.
5722 2009-12-16  Doug Kwan  <dougkwan@google.com>
5724         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5725         sections.
5726         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5727         relaxed input sections.
5728         * output.cc (Output_section::find_relaxed_input_section): Change
5729         return type to Output_relaxed_input_section pointer.  Adjust code
5730         for new type of relaxed_input_section_map_.
5731         * output.h (Output_section::find_relaxed_input_section): Change
5732         return type to Output_relaxed_input_section pointer.
5733         (Output_section::Output_relaxed_input_section_by_input_section_map):
5734         New type.
5735         (Output_section::relaxed_input_section_map_): Change type to
5736         Output_section::Output_relaxed_input_section_by_input_section_map.
5737         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5738         input section.
5740 2009-12-15  Ian Lance Taylor  <iant@google.com>
5742         * layout.cc (Layout::create_shstrtab): Only write out after input
5743         sections if we are compressing debug sections.
5745 2009-12-15  Ian Lance Taylor  <iant@google.com>
5747         * archive.cc (Archive::add_symbols): Only look up a symbol without
5748         a version if there is, in fact, a version.
5750 2009-12-14  Ian Lance Taylor  <iant@google.com>
5752         Revert -Wshadow changes, all changes from:
5753         2009-12-11  Doug Kwan  <dougkwan@google.com>
5754         2009-12-11  Nick Clifton  <nickc@redhat.com>
5755         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5757 2009-12-11  Doug Kwan  <dougkwan@google.com>
5759         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5760         due to -Wshadow.
5761         * attributes.cc (Object_attribute::size): Ditto.
5762         (Attributes_section_data::size): Ditto.
5763         (Attributes_section_data::Attributes_section_data): Ditto.
5764         (Output_attributes_section_data::do_write): Ditto.
5765         * attributes.h (Object_attribute::set_type): Ditto.
5766         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5768 2009-12-11  Nick Clifton  <nickc@redhat.com>
5770         * archive.cc: Fix shadowed variable warnings.
5771         * arm.cc: Likewise.
5772         * compressed_output.cc: Likewise.
5773         * compressed_output.h: Likewise.
5774         * configure: Likewise.
5775         * dwarf_reader.cc: Likewise.
5776         * dynobj.cc: Likewise.
5777         * dynobj.h: Likewise.
5778         * ehframe.cc: Likewise.
5779         * ehframe.h: Likewise.
5780         * errors.cc: Likewise.
5781         * expression.cc: Likewise.
5782         * fileread.cc: Likewise.
5783         * fileread.h: Likewise.
5784         * freebsd.h: Likewise.
5785         * i386.cc: Likewise.
5786         * icf.cc: Likewise.
5787         * incremental.h: Likewise.
5788         * layout.cc: Likewise.
5789         * layout.h: Likewise.
5790         * mapfile.cc: Likewise.
5791         * merge.cc: Likewise.
5792         * merge.h: Likewise.
5793         * object.cc: Likewise.
5794         * object.h: Likewise.
5795         * options.h: Likewise.
5796         * output.cc: Likewise.
5797         * output.h: Likewise.
5798         * parameters.cc: Likewise.
5799         * plugin.cc: Likewise.
5800         * powerpc.cc: Likewise.
5801         * reduced_debug_output.cc: Likewise.
5802         * reduced_debug_output.h: Likewise.
5803         * reloc.cc: Likewise.
5804         * reloc.h: Likewise.
5805         * resolve.cc: Likewise.
5806         * script-sections.cc: Likewise.
5807         * script.cc: Likewise.
5808         * script.h: Likewise.
5809         * sparc.cc: Likewise.
5810         * symtab.cc: Likewise.
5811         * symtab.h: Likewise.
5812         * target-select.cc: Likewise.
5813         * target-select.h: Likewise.
5814         * token.h: Likewise.
5815         * workqueue.cc: Likewise.
5816         * workqueue.h: Likewise.
5817         * x86_64.cc: Likewise.
5819 2009-12-10  Doug Kwan  <dougkwan@google.com>
5821         * arm.cc (attributes.h): New include.
5822         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5823         (Arm_relobj::~Arm_relobj): Delete object pointed by
5824         attributes_section_data_.
5825         (Arm_relobj::attributes_section_data): New method definition.
5826         (Arm_relobj::attributes_section_data_): New data member declaration.
5827         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5828         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5829         attributes_section_data_.
5830         (Arm_dynobj::attributes_section_data): New method definition.
5831         (Arm_dynobj::attributes_section_data_): New data member declaration.
5832         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5833         initialization value of may_use_blx_ to false.
5834         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5835         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5836         object attributes to compute results instead of hard-coding.
5837         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5838         Target_arm::get_secondary_compatible_arch,
5839         Target_arm::set_secondary_compatible_arch
5840         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5841         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5842         New method declarations.
5843         (Target_arm::get_aeabi_object_attribute): New method definition.
5844         (Target_arm::attributes_section_data_): New data member declaration.
5845         (read_arm_attributes_section): New template definition.
5846         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5847         (Arm_dynobj::do_read_symbols): Ditto.
5848         (Target_arm::do_finalize_sections): Merge attributes sections from
5849         input.  Check for BLX use after attributes section merging.
5850         Fix __exidx_start and __exidx_end visibility.  Create an
5851         .ARM.attributes section if necessary.
5852         (Target_arm::get_secondary_compatible_arch,
5853         Target_arm::set_secondary_compatible_arch,
5854         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5855         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5856         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5857         New method definitions.
5859 2009-12-09  Ian Lance Taylor  <iant@google.com>
5861         * plugin.cc (Plugin::load): Don't cast from void* to a function
5862         pointer.
5864 2009-12-09  Ian Lance Taylor  <iant@google.com>
5866         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5867         information fields.
5869 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5871         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5872         Replace two_file_shared_1.so with two_file_shared_2.so.
5873         * testsuite/Makefile.in: Regenerated.
5875 2009-12-08  Doug Kwan  <dougkwan@google.com>
5877         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5878         (HFILES): Add attributes.h and int_encoding.h.
5879         * Makefile.in: Regenerate.
5880         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5881         function definitions to int_encoding.cc
5882         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5883         prototypes to int_encoding.h
5884         * reduced_debug_output.cc (int_encoding.h): New include.
5885         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5886         function definitions to int_encoding.cc
5887         (insert_into_vector, read_from_pointer): Move template definitions to
5888         int_encoding.h
5889         * attributes.cc: New file.
5890         * attributes.h: New file.
5891         * int_encoding.cc: New file.
5892         * int_encoding.h: New file.
5894 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5896         PR gold/11055
5897         * incremental-dump.cc (dump_incremental_inputs): New.
5898         (main): Use dump_incremental_inputs.
5900 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5902         PR gold/10893
5903         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5904         checking elfcpp::STT_FUNC.
5905         (Target_i386::Relocate::relocate): Likewise.
5906         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5908         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5909         symbols from shared libraries into normal FUNC symbols.
5911         * symtab.h (Symbol): Add is_func and use it.
5913 2009-12-05  Doug Kwan  <dougkwan@google.com>
5915         * arm.cc (Target_arm::arm_info): Initialize new fields
5916         attributes_section and attributes_vendor.
5917         * i386.cc (Target_i386::i386_info): Same.
5918         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5919         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5920         fields attributes_section and attributes_vendor.
5921         * sparc.cc (Target_sparc::sparc_info): Same.
5922         * target.h (Target::attributes_section, Target::attributes_vendor,
5923         Target::is_attributes_section, Target::attribute_arg_type,
5924         Target::attributes_order): New method definitions.
5925         (Target::Target_info::attributes_section,
5926         Target::Target_info::attributes_vendor): New fields.
5927         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5928         virtual method definitions.
5929         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5930         attributes_section and attributes_vendor.
5931         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5933 2009-12-05  Doug Kwan  <dougkwan@google.com>
5935         * arm.cc: Update comments about interworking and stub generation.
5936         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5937         considered as non-PIC.
5938         (Arm_relocate_functions::base_abs): Fix formatting.
5939         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5940         of function to use GOT entry address instead of offset.
5941         (Target_arm::Scan::global): Issue an error if a symbol would need a
5942         PLT does not get one because it is untyped.  Remove code to create
5943         dynamic symbols for relative branches.
5944         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5945         takes unsigned integer instead of boolean.
5947 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5949         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5950         (two_file_test_LDADD): Likewise.
5951         (common_test_1_LDADD): Likewise.
5952         (exception_test_LDADD) Likewise.
5953         (weak_test_LDADD): Likewise.
5954         (many_sections_test_LDADD): Likewise.
5955         (initpri1_LDADD): Likewise.
5956         (script_test_1_LDADD): Likewise.
5957         (script_test_2_LDADD): Likewise.
5958         (justsyms_LDADD): Likewise.
5959         (binary_test_LDADD): Likewise.
5960         (large_LDADD): Likewise.
5961         * testsuite/Makefile.in: Regenerated.
5963 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5965         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5966         (Symbol_table::override_with_special): Likewise.
5967         (Symbol_table::add_from_object): Likewise.
5969 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5971         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5972         Don't set the data_offset twice.
5974 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5976         * testsuite/Makefile.in: Regenerate.
5978 2009-12-03  Doug Kwan  <dougkwan@google.com>
5980         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5981         (Target_arm::do_finalize_sections): Add parameter for symbol table
5982         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5983         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5984         parameter for symbol table pointer.
5985         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5986         an additional parameter for a pointer to symbol table.
5987         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5988         parameter for a symbol table pointer.
5989         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5990         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5991         Ditto.
5992         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5993         parameter for a symbol table pointer.
5995 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5997         * incremental.cc (Incremental_inputs_header)
5998         (Incremental_inputs_header_write, Incremental_inputs_entry)
5999         (Incremental_inputs_entry_write): Move ...
6000         * incremental.h (Incremental_inputs_header)
6001         (Incremental_inputs_header_write, Incremental_inputs_entry)
6002         (Incremental_inputs_entry_write): here.
6004 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6006         * incremental.cc (make_sized_incremental_binary): Set the target.
6007         Error if it is incompatible.
6008         * output.h (Output_file): Add filename method.
6010 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6012         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6013         from the get_* methods.
6015 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6017         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6018         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6019         Write 0 for the data_offset of scripts.
6021 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6023         * testsuite/Makefile.am: Add the incremental_test.sh test.
6024         * testsuite/incremental_test.sh: New.
6025         * testsuite/incremental_test_1.c: New.
6026         * testsuite/incremental_test_2.c: New.
6028 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6030        * incremental-dump.cc (main): Fix typos.
6032 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6034         PR gold/11025
6035         * incremental-dump.cc (main): Use llu to print 64 bit values.
6037 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6038             H.J. Lu  <hongjiu.lu@intel.com>
6040         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6041         $(LIBDL).
6042         (incremental_dump_LDADD): Likewise.
6043         * Makefile.in: Regenerated.
6045 2009-11-25  Doug Kwan  <dougkwan@google.com>
6047         Revert:
6049         2009-11-25  Doug Kwan  <dougkwan@google.com>
6051                 * arm.cc (Target_arm::Target_arm): Move method definition
6052                 outside of class definition.  Add code to handle
6053                 --target1-rel, --target1-abs and --target2= options.
6054                 (Target_arm::get_reloc_reloc_type): Change method to be
6055                 non-static and const.
6056                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6057                 New data member declaration.
6058                 (Target_arm::Scan::local, Target_arm::Scan::global,
6059                 Target_arm::Relocate::relocate,
6060                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6061                 Adjust call to Target_arm::get_real_reloc_type.
6062                 (Target_arm::get_real_reloc_type): Use command line options
6063                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6064                 * options.h (--target1-rel, --target1-abs, --target2): New
6065                 ARM-only options.
6067 2009-11-25  Doug Kwan  <dougkwan@google.com>
6069         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6070         class definition.  Add code to handle --target1-rel, --target1-abs
6071         and --target2= options.
6072         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6073         and const.
6074         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6075         member declaration.
6076         (Target_arm::Scan::local, Target_arm::Scan::global,
6077         Target_arm::Relocate::relocate,
6078         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6079         call to Target_arm::get_real_reloc_type.
6080         (Target_arm::get_real_reloc_type): Use command line options to
6081         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6082         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6083         options.
6085 2009-11-25  Doug Kwan  <dougkwan@google.com>
6087         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6088         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6089         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6090         formatting.
6091         (Arm_relocate_functions::thm_call): Replace body with a call to
6092         Arm_relocate_functions::thumb_branch_common.
6093         (Arm_relocate_functions::thm_jump24,
6094         Arm_relocate_functions::thm_xpc22): New method definitions.
6095         (Arm_relocate_functions::thumb_branch_common): New method definition.
6096         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6097         operator.
6098         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6099         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6101 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6103         * Makefile.am: Build incremental-dump
6104         * Makefile.in: Regenerate.
6105         * incremental-dump.cc: New.
6106         * incremental.cc (Incremental_inputs_header_data,
6107         Incremental_inputs_entry_data): Move to incremental.h
6108         * incremental.h: (Incremental_inputs_header_data,
6109         Incremental_inputs_entry_data): Move from incremental.cc
6111 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6113         * incremental.cc (Incremental_inputs_header,
6114         Incremental_inputs_header_write, Incremental_inputs_entry,
6115         Incremental_inputs_entry_write): Add a typedef with the data type.
6117 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6119         * incremental.cc (Incremental_inputs_header,
6120         Incremental_inputs_header_write, Incremental_inputs_entry,
6121         Incremental_inputs_entry_write): Update comment about which
6122         type has the filed descriptions.
6124 2009-11-15  Doug Kwan  <dougkwan@google.com>
6126         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6127         (Arm_relocate_functions::arm_branch_common): Change method defintion
6128         in class definition to a method declaration and update list of formal
6129         parameters.
6130         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6131         Arm_relocation_functions::jump24): Adjust call to
6132         Arm_relocate_functions::arm_branch_common.  Update list of formal
6133         parameters.
6134         (Arm_relocate_functions::xpc25): New method definition.
6135         (Arm_relocate_functions::arm_branch_common): Move method defintion
6136         out from class definition.  Use stubs for mode-switching and extending
6137         branch ranges.
6138         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6139         specially.  Change code to enable use of stubs in ARM branches.
6141 2009-11-10  Doug Kwan  <dougkwan@google.com>
6143         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6144         in method declaration.
6145         (Target_arm::relocate_stub): New method declaration.
6146         (Target_arm::default_target): Change to return a pointer instead of
6147         a const reference.
6148         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6149         Target_arm::default_target.
6150         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6151         method definition.
6152         (Target_arm::relocate_section): Adjust view.
6153         (Target_arm::relocate_stub): New method definition.
6155 2009-11-10  Doug Kwan  <dougkwan@google.com>
6157         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6158         a format warning.
6159         * incremental.cc (open_incremental_binary): Initialized local
6160         variables to avoid warnings.
6161         * object.cc (make_elf_object): Ditto.
6162         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6163         a format warning.
6165 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6167         PR gold/10930
6168         * testsuite/plugin_test.c: Include "config.h".
6170 2009-11-09  Doug Kwan  <dougkwan@google.com>
6172         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6173         (arm_symbol_value): Remove.
6174         (Arm_relocate_functions::arm_branch_common,
6175         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6176         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6177         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6178         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6179         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6180         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6181         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6182         Arm_relocate_functions::thm_mobw_abs_nc,
6183         Arm_relocate_functions::thm_mov_abs,
6184         Arm_relocate_functions::movw_prel_nc,
6185         Arm_relocate_functions::thm_movt_abs,
6186         Arm_relocate_functions::movt_prel,
6187         Arm_relocate_functions::thm_movw_prel_nc,
6188         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6189         (Target_arm::Relocate::relocate): Only decompose address into two
6190         parts if relocation type uses the thumb-bit and pass the actual
6191         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6192         calls to methods in Arm_relocate_functions for this change.
6194 2009-11-08  Ian Lance Taylor  <iant@google.com>
6196         PR 10925
6197         * reloc.cc: Instantiate
6198         Sized_relobj::initialize_input_to_output_maps and
6199         Sized_relobj:free_input_to_output_maps.
6201 2009-11-06  Ian Lance Taylor  <iant@google.com>
6203         PR 10876
6204         * defstd.cc (in_segment): Set only_if_ref true for "end".
6206 2009-11-06  Doug Kwan  <dougkwan@google.com>
6208         * arm.cc (class Reloc_stub): Correct a comment.
6209         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6210         (Target_arm::scan_section_for_stubs): New method declaration.
6211         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6212         Change methods from private to protected.
6213         (Target_arm::do_may_relax): New method definition.
6214         (Target_arm::do_relax, Target_arm::group_sections,
6215         Target_arm::scan_reloc_for_stub,
6216         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6217         (Target_arm::arm_input_section_map_): New data member declaration.
6218         (Target_arm::scan_reloc_for_stub,
6219         Target_arm::scan_reloc_section_for_stubs,
6220         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6221         Target_arm::do_relax): New method definitions.
6223 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6225         * configure.ac: Check for (struct stat)::st_mtim
6226         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6227         * config.in: Regenerate.
6228         * configure: Regenerate.
6230 2009-11-05  Ian Lance Taylor  <iant@google.com>
6232         PR 10910
6233         * output.cc (Output_segment::add_output_section): Add missing
6234         return statement.
6236 2009-11-04  Ian Lance Taylor  <iant@google.com>
6238         PR 10880
6239         * object.h (class Object): Add is_needed and set_is_needed
6240         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6241         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6242         defined in a dynamic object and referenced by a regular object,
6243         set is_needed for the dynamic object.
6244         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6245         if the file is marked with as_needed and it is not needed.
6247 2009-11-04  Ian Lance Taylor  <iant@google.com>
6249         PR 10887
6250         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6251         tags if data is discarded by linker script.
6252         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6253         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6254         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6255         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6257 2009-11-04  Ian Lance Taylor  <iant@google.com>
6259         * layout.cc (Layout::get_output_section): Add is_interp and
6260         is_dynamic_linker_section parameters.  Change all callers.
6261         (Layout::choose_output_section): Likewise.
6262         (Layout::make_output_section): Likewise.
6263         (Layout::add_output_section_data): Add is_dynamic_linker_section
6264         parameter.  Change all callers.
6265         * layout.h (class Layout): Update declarations.
6266         * output.h (class Output_section): Add is_interp, set_is_interp,
6267         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6268         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6269         generate_code_fills_at_write_ to a bitfield.
6270         * output.cc (Output_section::Output_sections): Initialize new
6271         fields.
6272         (Output_segment::add_output_section): Add do_sort parameter.
6273         Change all callers.
6275 2009-11-03  Ian Lance Taylor  <iant@google.com>
6277         PR 10860
6278         * options.h (class General_options): Add --warn-common.
6279         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6280         merging two common symbols.
6281         (Symbol_table::should_override): Handle --warn-common when merging
6282         a common symbol with a defined symbol.  Use report_resolve_problem
6283         for multiple definitions.
6284         (Symbol_table::report_resolve_problem): New function.
6285         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6287 2009-11-03  Doug Kwan  <dougkwan@google.com>
6289         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6290         stub_factory_.
6291         (Target_arm::stub_factory): New method definition.
6292         (Target_arm::new_arm_input_section,
6293         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6294         Target_arm::reloc_uses_thumb_bit): New method declarations.
6295         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6296         New type definitions.
6297         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6298         member declarations.
6299         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6300         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6301         New method definitions.
6303 2009-11-03  Ian Lance Taylor  <iant@google.com>
6305         * options.h (class General_options): Add --warn_constructors.
6307 2009-11-03  Ian Lance Taylor  <iant@google.com>
6309         PR 10893
6310         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6311         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6313 2009-11-03  Ian Lance Taylor  <iant@google.com>
6315         PR 10895
6316         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6317         --msgid-bugs-address.
6318         (install-pdf): New target.
6319         (install-data_yes): Look up one directory to find mkinstalldirs.
6321 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6323         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6324         tree.
6326 2009-10-30  Doug Kwan  <dougkwan@google.com>
6328         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6330 2009-10-30  Doug Kwan  <dougkwan@google.com>
6332         * arm.cc (Stub_addend_reader): New struct template definition
6333         and partial specializations.
6334         (Stub_addend_reader::operator()): New method definition for a
6335         partially specialized template.
6337 2009-10-30  Doug Kwan  <dougkwan@google.com>
6339         * arm.cc (Arm_relobj::processor_specific_flags): New method
6340         definition.
6341         (Arm_relobj::do_read_symbols): New method declaration.
6342         (Arm_relobj::processor_specific_flags_): New data member declaration.
6343         (Arm_dynobj): New class definition.
6344         (Target_arm::do_finalize_sections): Add input_objects parameter.
6345         (Target_arm::do_adjust_elf_header): New method declaration.
6346         (Target_arm::are_eabi_versions_compatible,
6347         (Target_arm::merge_processor_specific_flags): New method declaration.
6348         (Target_arm::do_make_elf_object): New overloaded method definitions
6349         and declaration.
6350         (Arm_relobj::do_read_symbols): New method definition.
6351         (Arm_dynobj::do_read_symbols): Ditto.
6352         (Target_arm::do_finalize_sections): Add input_objects parameters.
6353         Merge processor-specific flags from all input objects.
6354         (Target_arm::are_eabi_versions_compatible,
6355         Target_arm::merge_processor_specific_flags,
6356         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6357         New method definitions.
6358         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6359         Input_objects pointer type parameter.
6360         * layout.cc (Layout::finalize): Pass input objects to target's.
6361         finalize_sections function.
6362         * output.cc (Output_file_header::do_sized_write): Set ELF file
6363         header's processor-specific flags.
6364         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6365         Input_objects pointer type parameter.
6366         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6367         * target.h (Input_objects): New forward class declaration.
6368         (Target::processor_specific_flags,
6369         Target::are_processor_specific_flags_sect): New method definitions.
6370         (Target::finalize_sections): Add input_objects parameter.
6371         (Target::Target): Initialize processor_specific_flags_ and
6372         are_processor_specific_flags_set_.
6373         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6374         parameter.
6375         (Target::set_processor_specific_flags): New method definition.
6376         (Target::processor_specific_flags_,
6377         Target::are_processor_specific_flags_set_): New data member
6378         declarations.
6379         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6380         Input_objects pointer type parameter.
6382 2009-10-30  Doug Kwan  <dougkwan@google.com>
6384         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6386 2009-10-28  Ian Lance Taylor  <iant@google.com>
6388         * object.h (class Relobj): Drop options parameter from
6389         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6390         do_scan_relocs, do_relocate.  Change all callers.
6391         (class Sized_relobj): Drop options parameters from
6392         do_gc_process_relocs, do_scan_relocs, do_relocate,
6393         do_relocate_sections, relocate_sections, emit_relocs_scan,
6394         emit_relocs_scan_reltype.  Change all callers.
6395         (struct Relocate_info): Remove options field and all references to
6396         it.
6397         * reloc.h (class Read_relocs): Remove options constructor
6398         parameter and options_ field.  Change all callers.
6399         (class Gc_process_relocs, class Scan_relocs): Likewise.
6400         (class Relocate_task): Likewise.
6401         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6402         all callers.
6403         (scan_relocatable_relocs): Likewise.
6404         * target.h (class Sized_target): Remove options parameter from
6405         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6406         all callers.
6407         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6408         callers.
6409         * arm.cc: Update functions to remove options parameters.
6410         * i386.cc: Likewise.
6411         * powerpc.cc: Likewise.
6412         * sparc.cc: Likewise.
6413         * x86_64.cc: Likewise.
6414         * testsuite/testfile.cc: Likewise.
6416 2009-10-28  Doug Kwan  <dougkwan@google.com>
6418         * arm.cc (Arm_relobj): New class definition.
6419         (Arm_relobj::scan_sections_for_stubs,
6420         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6421         New method definitions.
6423 2009-10-28  Cary Coutant  <ccoutant@google.com>
6425         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6426         (Plugin::cleanup_done_): New member.
6427         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6428         (Plugin_manager::cleanup_done_): Remove.
6429         (Plugin_manager::add_input_file): Edit error message.
6430         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6431         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6433 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6435         * fileread.cc: (File_read::View::~View): Use the new
6436         data_ownership_ filed.
6437         (File_read::~File_read): Dispose the new whole_file_view_.
6438         (File_read::open): Mmap the whole file if needed.
6439         (File_read::open): Use whole_file_view_ instead of contents_.
6440         (File_read::find_view): Use whole_file_view_ if applicable.
6441         (File_read::do_read): Use whole_file_view_ instead of contents_.
6442         (File_read::make_view): Use whole_file_view_ instead of contents_,
6443         update File_read::View::View call.
6444         (File_read::find_or_make_view): Update File_read::View::View
6445         call.
6446         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6447         remove contents_
6448         (File_read::View::Data_ownership): New enum.
6449         (File_read::View::View): Replace bool mapped_ with Data_ownership
6450         argument.
6451         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6452         (File_read::View::data_ownership_): New field.
6453         (File_read::contents_): Remove (replaced by whole_file_view_).
6454         (File_read::whole_file_view_): New field.
6455         * options.h (class General_options): Add --keep-files-mapped.
6457 2009-10-27  Cary Coutant  <ccoutant@google.com>
6459         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6460         * testsuite/Makefile.am (plugin_test_5): New test case.
6461         * testsuite/Makefile.in: Regenerate.
6463 2009-10-25  Doug Kwan  <dougkwan@google.com>
6465         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6466         from private to protected to allow access by child class.
6467         (Sized_relobj::do_relocate_sections): New method declaration.
6468         (Sized_relobj::relocate_sections): Virtualize.
6469         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6470         Sized_relobj::relocate_sections.  Instantiate template explicitly
6471         for different target sizes and endianity.
6473 2009-10-24  Doug Kwan  <dougkwan@google.com>
6475         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6476         (Arm_input_section::as_arm_input_section): New method.
6477         (Arm_output_section): New class definition.
6478         (Arm_output_section::create_stub_group,
6479         Arm_output_section::group_sections): New method definitions.
6481 2009-10-22  Doug Kwan  <dougkwan@google.com>
6483         * arm.cc (Arm_input_section): New class definition.
6484         (Arm_input_section::init, Arm_input_section:do_write,
6485         Arm_input_section::set_final_data_size,
6486         Arm_input_section::do_reset_address_and_file_offset): New method
6487         definitions.
6489 2009-10-21  Doug Kwan  <dougkwan@google.com>
6491         * arm.cc (Stub_table, Arm_input_section): New forward class
6492         declarations.
6493         (Stub_table): New class defintion.
6494         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6495         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6496         New method definition.
6498 2009-10-21  Doug Kwan  <dougkwan@google.com>
6500         * arm.cc: Update copyright comments.
6501         (Target_arm): New forward class template declaration.
6502         (Arm_address): New type.
6503         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6504         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6505         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6506         constants.
6507         (Insn_template): Same.
6508         (DEF_STUBS): New macro.
6509         (Stub_type): New enum type.
6510         (Stub_template): New class definition.
6511         (Stub): Same.
6512         (Reloc_stub): Same.
6513         (Stub_factory): Same.
6514         (Target_arm::Target_arm): Initialize may_use_blx_ and
6515         should_force_pic_veneer_.
6516         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6517         Target_arm::should_force_pic_veneer,
6518         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6519         Target_arm::using_thumb_only, Target_arm:;default_target): New
6520         method defintions.
6521         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6522         New data member declarations.
6523         (Insn_template::size, Insn_template::alignment): New method defintions.
6524         (Stub_template::Stub_template): New method definition.
6525         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6526         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6527         (Stub_factory::Stub_factory): New method definition.
6528         * gold.h (string_hash): New template.
6529         * output.h (Input_section_specifier::hash_value): Use
6530         gold::string_hash.
6531         (Input_section_specifier::string_hash): Remove.
6532         * stringpool.cc (Stringpool_template::string_hash): Use
6533         gold::string_hash.
6535 2009-10-20  Doug Kwan  <dougkwan@google.com>
6537         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6538         symbols of relaxed input sections.
6539         * output.h (Output_section::find_relaxed_input_section): Make
6540         method public.
6542 2009-10-16  Doug Kwan  <dougkwan@google.com>
6544         * dynobj.cc (Versions::Versions): Initialize version_script_.
6545         Only insert base version symbol definition for a shared object
6546         if version script defines any version versions.
6547         (Versions::define_base_version): New method definition.
6548         (Versions::add_def): Check that base version is not needed.
6549         (Versions::add_need): Define base version lazily.
6550         * dynobj.h (Versions::define_base_version): New method declaration.
6551         (Versions::needs_base_version_): New data member declaration.
6552         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6553         (check_DATA): Add no_version_test.stdout.
6554         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6555         New make rules.
6556         * testsuite/Makefile.in: Regenerate.
6557         * testsuite/no_version_test.c: New file.
6558         * testsuite/no_version_test.sh: Ditto.
6560 2009-10-16  Doug Kwan  <dougkwan@google.com>
6562         * expression.cc (class Segment_start_expression): New class definition.
6563         (Segment_start_expression::value): New method definition.
6564         (script_exp_function_segment_start): Return a new
6565         Segment_start_expression.
6566         * gold/script-c.h (script_saw_segment_start_expression): New function
6567         prototype.
6568         * script-sections.cc (Script_sections::Script_sections): Initialize
6569         SAW_SEGMENT_START_EXPRESSION_ to false.
6570         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6571         and -Tbbs options to specify section addresses if given in
6572         command line and no SEGMENT_START expression is seen in a script.
6573         * script-sections.h (Script_sections::saw_segment_start_expression,
6574         Script_sections::set_saw_segment_start_expression): New method
6575         definition.
6576         (Script_sections::saw_segment_start_expression_): New data member
6577         declaration.
6578         * script.cc (script_saw_segment_start_expression): New function.
6579         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6580         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6581         script_test_7.sh and script_test_8.sh.
6582         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6583         script_test_8.stdout.
6584         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6585         (script_test_6, script_test_6.stdout, script_test_7,
6586         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6587         * Makefile.in: Regenerate.
6588         * testsuite/script_test_6.sh: New file.
6589         * testsuite/script_test_6.t: Same.
6590         * testsuite/script_test_7.sh: Same.
6591         * testsuite/script_test_7.t: Same.
6592         * testsuite/script_test_8.sh: Same.
6594 2009-10-16  Doug Kwan  <dougkwan@google.com>
6596         * output.cc (Output_segment::set_section_list_address): Cast
6597         expressions to unsigned long long type to avoid format warnings.
6599 2009-10-15  Ian Lance Taylor  <iant@google.com>
6601         * script.cc (Script_options::add_symbol_assignment): Always add a
6602         dot assignment to script_sections_.
6603         * script-sections.cc (Script_sections::add_dot_assignment):
6604         Initialize if necessary.
6606         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6607         program headers with no load segment if there is a linker script.
6609         * layout.cc (Layout::set_segment_offsets): Align the file offset
6610         to the segment aligment for -N or -n with no load segment.
6611         * output.cc (Output_segment::add_output_section): Don't crash if
6612         the first section is a TLS section.
6613         (Output_segment::set_section_list_addresses): Print an error
6614         message if the address moves backward in a linker script.
6615         * script-sections.cc
6616         (Output_section_element_input::set_section_addresses): Don't
6617         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6618         (Orphan_output_section::set_section_addresses): Likewise.
6620 2009-10-15  Doug Kwan  <dougkwan@google.com>
6622         * layout.cc (Layout::finish_dynamic_section): Generate tags
6623         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6624         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6625         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6627 2009-10-14  Ian Lance Taylor  <iant@google.com>
6629         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6630         fields.
6631         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6632         data_shdr fields of relinfo.
6633         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6634         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6635         R_386_TLS_LDO_32, adjust based on section flags.
6636         (Target_i386::Relocate::fix_up_ldo): Remove.
6638 2009-10-13  Ian Lance Taylor  <iant@google.com>
6640         Add support for -pie.
6641         * options.h (class General_options): Add -pie and
6642         --pic-executable.
6643         (General_options::output_is_position_independent): Test -pie.
6644         (General_options::output_is_executable): Return true if not shared
6645         and not relocatable.
6646         (General_options::output_is_pie): Remove.
6647         * options.cc (General_options::finalize): Reject incompatible uses
6648         of -pie.
6649         * gold.cc (queue_middle_tasks): A -pie link is not static.
6650         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6651         * symtab.cc (Symbol::final_value_is_known): Return false if
6652         output_is_position_independent.
6653         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6654         output_is_position_independent.
6655         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6656         output_is_position_independent.
6657         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6658         output_is_position_independent.
6659         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6660         two_file_pie_test.
6661         (basic_pie_test.o, basic_pie_test): New targets.
6662         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6663         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6664         (two_file_pie_test): New target.
6665         * testsuite/Makefile.in: Rebuild.
6666         * README: Remove note saying that -pie is not supported.
6668 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6670         * options.h (class General_options): Add -init and -fini.
6671         * layout.cc (Layout::finish_dynamic_section): Emit
6672         given init and fini functions.
6674 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6676         * gc.h (gc_process_relocs): Check if icf is enabled using new
6677         function.
6678         * gold.cc (queue_initial_tasks): Likewise.
6679         (queue_middle_tasks): Likewise.
6680         * object.cc (do_layout): Likewise.
6681         * symtab.cc (is_section_folded): Likewise.
6682         * main.cc (main): Likewise.
6683         * reloc.cc (Read_relocs::run): Likewise.
6684         (Sized_relobj::do_scan_relocs): Likewise.
6685         * icf.cc (is_function_ctor_or_dtor): New function.
6686         (Icf::find_identical_sections): Check if function is ctor or dtor when
6687         safe icf is chosen.
6688         * options.h (General_options::icf): Change option to be an enum.
6689         (Icf_status): New enum.
6690         (icf_enabled): New method.
6691         (icf_safe_folding): New method.
6692         (set_icf_status): New method.
6693         (icf_status_): New variable.
6694         * (options.cc) (General_options::finalize): Set icf_status_.
6695         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6696         icf_test and icf_keep_unique_test to use the --icf enum flag.
6697         * testsuite/icf_safe_test.sh: New file.
6698         * testsuite/icf_safe_test.cc: New file.
6700 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6702         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6703         includes to gc.h and icf.h.
6704         * arm.cc: Include gc.h.
6705         * gold.cc: Likewise.
6706         * i386.cc: Likewise.
6707         * powerpc.cc: Likewise.
6708         * sparc.cc: Likewise.
6709         * x86_64.cc: Likewise.
6710         * gc.h: Include icf.h.
6712 2009-10-11  Ian Lance Taylor  <iant@google.com>
6714         * plugin.cc: Include "gold.h" before other header files.
6716 2009-10-10  Chris Demetriou  <cgd@google.com>
6718         * options.h (Input_file_argument::Input_file_type): New enum.
6719         (Input_file_argument::is_lib_): Replace with...
6720         (Input_file_argument::type_): New member.
6721         (Input_file_argument::Input_file_argument): Take Input_file_type
6722         'type' rather than boolean 'is_lib' as second argument.
6723         (Input_file_argument::is_lib): Use type_.
6724         (Input_file_argument::is_searched_file): New function.
6725         (Input_file_argument::may_need_search): Handle is_searched_file.
6726         * options.cc (General_options::parse_library): Support -l:filename.
6727         (General_options::parse_just_symbols): Update for Input_file_argument
6728         changes.
6729         (Command_line::process): Likewise.
6730         * archive.cc (Archive::get_file_and_offset): Likewise.
6731         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6732         * script.cc (read_script_file, script_add_file): Likewise.
6733         * fileread.cc (Input_file::Input_file): Likewise.
6734         (Input_file::will_search_for): Handle is_searched_file.
6735         (Input_file::open): Likewise.
6736         * readsyms.cc (Read_symbols::get_name): Likewise.
6737         * testsuite/Makefile.am (searched_file_test): New test.
6738         * testsuite/Makefile.in: Regenerate.
6739         * testsuite/searched_file_test.cc: New file.
6740         * testsuite/searched_file_test_lib.cc: New file.
6742 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6743             Ian Lance Taylor  <iant@google.com>
6745         * descriptor.cc: Include <cstdio> and "binary-io.h".
6746         (Descriptors::open): Open the files in binary mode always.
6747         * script.cc (Lex::get_token): Treat \r as whitespace.
6749 2009-10-09  Ian Lance Taylor  <iant@google.com>
6751         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6753 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6754             Ian Lance Taylor  <iant@google.com>
6756         * configure.ac: Check for readv function also.
6757         * fileread.cc (readv): Define if not HAVE_READV.
6758         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6759         does not exist.
6760         * config.in: Regenerate.
6761         * configure: Regenerate.
6763 2009-10-09  Doug Kwan  <dougkwan@google.com>
6765         * layout.cc (Layout::make_output_section): Call target hook to make
6766         ordinary output section.
6767         (Layout::finalize): Adjust parameter list of call the
6768         Target::may_relax().
6769         * layout.h (class Layout::section_list): New method.
6770         * merge.h (Output_merge_base::entsize): Change visibility to public.
6771         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6772         New methods.
6773         (Output_merge_string::do_is_string): New method.
6774         * object.cc (Sized_relobj::do_setup): renamed from
6775         Sized_relobj::set_up.
6776         * object.h (Sized_relobj::adjust_shndx,
6777         Sized_relobj::initializ_input_to_output_maps,
6778         Sized_relobj::free_input_to_output_maps): Change visibilities to
6779         protected.
6780         (Sized_relobj::setup): Virtualize.
6781         (Sized_relobj::do_setup): New method declaration.
6782         (Sized_relobj::invalidate_section_offset,
6783         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6784         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6785         * options.cc (parse_int): New function.
6786         * options.h (parse_int): New declaration.
6787         (DEFINE_int): New macro.
6788         (stub_group_size): New option.
6789         * output.cc (Output_section::Output_section): Initialize memebers
6790         merge_section_map_, merge_section_by_properties_map_,
6791         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6792         (Output_section::add_input_section): Handled deferred code-fill
6793         generation and remove an old comment.
6794         (Output_section::add_relaxed_input_section): New method definition.
6795         (Output_section::add_merge_input_section): Use merge section by
6796         properties map to speed to search.  Update merge section maps
6797         as appropriate.
6798         (Output_section::build_relaxation_map): New method definition.
6799         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6800         Same.
6801         (Output_section::relax_input_section): Renamed to
6802         Output_section::convert_input_sections_to_relaxed_sections and change
6803         interface to take a vector of pointers to relaxed sections.
6804         (Output_section::find_merge_section,
6805         Output_section::find_relaxed_input_section): New method definitions.
6806         (Output_section::is_input_address_mapped,
6807         Output_section::output_offset, Output_section::output_address):
6808         Use output section data maps to speed up searching.
6809         (Output_section::find_starting_output_address): Add comments.
6810         (Output_section::do_write,
6811         Output_section::write_to_postprocessing_buffer): Do code-fill
6812         generation as appropriate.
6813         (Output_section::get_input_sections): Invalidate relaxed input section
6814         map.
6815         (Output_section::restore_states): Adjust type of checkpoint .
6816         Invalidate relaxed input section map.
6817         * output.h (Output_merge_base): New class declaration.
6818         (Input_section_specifier): New class defintion.
6819         (class Output_relaxed_input_section) Change base class to
6820         Output_section_data_build.
6821         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6822         base class initializer.
6823         (Output_section::add_relaxed_input_section): New method declaration.
6824         (Output_section::Input_section): Change visibility to protected.
6825         (Output_section::Input_section::relobj,
6826         Output_section::Input_section::shndx): Handle relaxed input sections.
6827         Output_section::input_sections) Change visibility to protected.  Also
6828         define overload to return a non-const pointer.
6829         (Output_section::Merge_section_properties): New class defintion.
6830         (Output_section::Merge_section_by_properties_map,
6831         Output_section::Output_section_data_by_input_section_map,
6832         Output_section::Relaxation_map): New types.
6833         (Output_section::relax_input_section): Rename method to
6834         Output_section::convert_input_sections_to_relaxed_sections and change
6835         interface to take a vector of relaxed section pointers.
6836         (Output_section::find_merge_section,
6837         Output_section::find_relaxed_input_section,
6838         Output_section::build_relaxation_map,
6839         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6840         New method declarations.
6841         (Output_section::merge_section_map_
6842         Output_section::merge_section_by_properties_map_,
6843         Output_section::relaxed_input_section_map_,
6844         Output_section::is_relaxed_input_section_map_valid_,
6845         Output_section::generate_code_fills_at_write_): New data members.
6846         * script-sections.cc
6847         (Output_section_element_input::set_section_addresses): Call
6848         current_data_size and addralign methods of relaxed input sections.
6849         (Orphan_output_section::set_section_addresses): Call current_data_size
6850         and addralign methods of relaxed input sections.
6851         * symtab.cc (Symbol_table::compute_final_value): Extract template
6852         from the body of Symbol_table::sized_finalize_symbol.
6853         (Symbol_table::sized_finalized_symbol): Call
6854         Symbol_table::compute_final_value.
6855         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6856         (Symbol_table::compute_final_value): New templated method declaration.
6857         * target.cc (Target::do_make_output_section): New method defintion.
6858         * target.h (Target::make_output_section): New method declaration.
6859         (Target::relax): Add more parameters for input objects, symbol table
6860         and layout.  Adjust call to do_relax.
6861         (Target::do_make_output_section): New method declaration.
6862         (Target::do_relax): Add parameters for input objects, symbol table
6863         and layout.
6865 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6867         * pread.c: Include stdio.h.
6869 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6871         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6872         defined.
6874 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6876         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6877         Change read_shndx type to unsigned int.
6878         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6879         int.
6880         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6881         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6882         Change read_shndx type to unsigned int.
6883         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6884         int.
6885         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6886         * layout.cc (Layout::create_symtab_sections): Cast the result of
6887         local_symcount * symsize to off_t in the gold_assert.
6889 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6891         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6892         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6893         R_ARM_BASE_ABS.
6894         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6895         (Arm_relocate_functions::thm_abs5): New function.
6896         (Arm_relocate_functions::abs12): New function.
6897         (Arm_relocate_functions::abs16): New function.
6898         (Arm_relocate_functions::base_abs): New function.
6899         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6900         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6901         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6902         R_ARM_BASE_ABS.
6903         (Scan::global): Likewise.
6904         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6905         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6906         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6907         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6908         R_ARM_BASE_ABS.
6910 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6912         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6913         (Arm_relocate_functions::movt_prel): New function.
6914         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6915         (Arm_relocate_functions::thm_movt_prel): New function.
6916         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6917         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6918         (Scan::global, Relocate::relocate): Likewise.
6919         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6921 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6923         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6924         Incremental_checker.
6925         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6926         unsigned int.
6927         (class Incremental_inputs_header): New class.
6928         (Incremental_inputs_header_writer): Edit comment.
6929         (Incremental_inputs_entry): New class.
6930         (Incremental_inputs_entry_writer): Edit comment.
6931         (Sized_incremental_binary::do_find_incremental_inputs_section):
6932         Add *strtab_shndx parameter, fill it.
6933         (Sized_incremental_binary::do_check_inputs): New method.
6934         (Incremental_checker::can_incrementally_link_output_file): Use
6935         Sized_incremental_binary::check_inputs.
6936         (Incremental_inputs::report_command_line): Save command line in
6937         command_line_.
6938         * incremental.h:
6939         (Incremental_binary::find_incremental_inputs_section): New
6940         method.
6941         (Incremental_binary::do_find_incremental_inputs_section): Add
6942         strtab_shndx parameter.
6943         (Incremental_binary::do_check_inputs): New pure virtual method.
6944         (Sized_incremental_binary::do_check_inputs): Declare.
6945         (Incremental_checker::Incremental_checker): Add incremental_inputs
6946         parameter, use it to initialize incremental_inputs_.
6947         (Incremental_checker::incremental_inputs_): New field.
6948         (Incremental_checker::command_line): New method.
6949         (Incremental_checker::inputs): New method.
6950         (Incremental_checker::command_line_): New field.
6952 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6954         * incremental.cc: Include <cstdarg> and "target-select.h".
6955         (vexplain_no_incremental): New function.
6956         (explain_no_incremental): New function.
6957         (Incremental_binary::error): New method.
6958         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6959         method.
6960         (make_sized_incremental_binary): New function.
6961         (open_incremental_binary): New function.
6962         (can_incrementally_link_file): Add checks if output is ELF and has
6963         inputs section.
6964         * incremental.h: Include "elfcpp_file.h" and "output.h".
6965         (Incremental_binary): New class.
6966         (Sized_incremental_binary): New class.
6967         (open_incremental_binary): Declare.
6968         * object.cc (is_elf_object): Use
6969         elfcpp::Elf_recognizer::is_elf_file.
6970         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6971         * output.h (Output_file::filesize): New method.
6973 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6975         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6976         New function.
6977         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6978         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6979         function.
6980         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6981         function.
6982         (Arm_relocate_functions::movw_abs_nc): New function.
6983         (Arm_relocate_functions::movt_abs): New function.
6984         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6985         (Arm_relocate_functions::thm_movt_abs): New function.
6986         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6987         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6988         (Scan::global): Likewise.
6989         (Relocate::relocate): Likewise.
6990         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6992 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6994         * arm.cc (Arm_relocate_functions::got_prel) New function.
6995         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6996         (Relocate::relocate): Likewise.
6997         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6999 2009-10-06  Ian Lance Taylor  <iant@google.com>
7001         * options.h (class General_options): Define
7002         split_stack_adjust_size parameter.
7003         * object.h (class Object): Add uses_split_stack_ and
7004         has_no_split_stack_ fields.  Add uses_split_stack and
7005         has_no_split_stack accessor functions.  Declare
7006         handle_split_stack_section.
7007         (class Reloc_symbol_changes): Define.
7008         (class Sized_relobj): Define Function_offsets.  Declare
7009         split_stack_adjust, split_stack_adjust_reltype, and
7010         find_functions.
7011         * object.cc (Object::handle_split_stack_section): New function.
7012         (Sized_relobj::do_layout): Call handle_split_stack_section.
7013         * dynobj.cc (Sized_dynobj::do_layout): Call
7014         handle_split_stack_section.
7015         * reloc.cc (Sized_relobj::relocate_sections): Call
7016         split_stack_adjust for executable sections in split_stack
7017         objects.  Pass reloc_map to relocate_section.
7018         (Sized_relobj::split_stack_adjust): New function.
7019         (Sized_relobj::split_stack_adjust_reltype): New function.
7020         (Sized_relobj::find_functions): New function.
7021         * target-reloc.h: Include "object.h".
7022         (relocate_section): Add reloc_symbol_changes parameter.  Change
7023         all callers.
7024         * target.h (class Target): Add calls_non_split method.  Declare
7025         do_calls_non_split virtual method.  Declare match_view and
7026         set_view_to_nop.
7027         * target.cc: Include "elfcpp.h".
7028         (Target::do_calls_non_split): New function.
7029         (Target::match_view): New function.
7030         (Target::set_view_to_nop): New function.
7031         * gold.cc (queue_middle_tasks): Give an error if mixing
7032         split-stack and non-split-stack objects with -r.
7033         * i386.cc (Target_i386::relocate_section): Add
7034         reloc_symbol_changes parameter.
7035         (Target_i386::do_calls_non_split): New function.
7036         * x86_64.cc (Target_x86_64::relocate_section): Add
7037         reloc_symbol_changes parameter.
7038         (Target_x86_64::do_calls_non_split): New function.
7039         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7040         parameter.
7041         * powerpc.cc (Target_powerpc::relocate_section): Add
7042         reloc_symbol_changes parameter.
7043         * sparc.cc (Target_sparc::relocate_section): Add
7044         reloc_symbol_changes parameter.
7045         * configure.ac: Call AM_CONDITIONAL for the default target.
7046         * configure: Rebuild.
7047         * testsuite/Makefile.am (TEST_AS): New variable.
7048         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7049         (check_DATA): Add split_i386 and split_x86_64 files.
7050         (SPLIT_DEFSYMS): Define.
7051         (split_i386_[1234n].o): New targets.
7052         (split_i386_[124]): New targets.
7053         (split_i386_[1234r].stdout): New targets.
7054         (split_x86_64_[1234n].o): New targets.
7055         (split_x86_64_[124]): New targets.
7056         (split_x86_64_[1234r].stdout): New targets.
7057         (MOSTLYCLEANFILES): Add new executables.
7058         * testsuite/split_i386.sh: New file.
7059         * testsuite/split_x86_64.sh: New file.
7060         * testsuite/split_i386_1.s: New file.
7061         * testsuite/split_i386_2.s: New file.
7062         * testsuite/split_i386_3.s: New file.
7063         * testsuite/split_i386_4.s: New file.
7064         * testsuite/split_i386_n.s: New file.
7065         * testsuite/split_x86_64_1.s: New file.
7066         * testsuite/split_x86_64_2.s: New file.
7067         * testsuite/split_x86_64_3.s: New file.
7068         * testsuite/split_x86_64_4.s: New file.
7069         * testsuite/split_x86_64_n.s: New file.
7070         * testsuite/testfile.cc (Target_test): Update relocation_section
7071         function.
7072         * testsuite/Makefile.in: Rebuild.
7074 2009-10-06  Ian Lance Taylor  <iant@google.com>
7076         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7077         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7078         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7079         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7080         the address on ldo_addrs_.
7081         (Target_i386::Relocate::fix_up_ldo): New function.
7083 2009-10-06   Rafael Espindola  <espindola@google.com>
7085         * plugin.cc (add_input_library): New.
7086         (Plugin::load): Add add_input_library to tv.
7087         (Plugin_manager::add_input_file): Add the is_lib argument.
7088         (add_input_file): Update call to Plugin_manager::add_input_file.
7089         (add_input_library): New.
7090         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7092 2009-09-30  Doug Kwan  <dougkwan@google.com>
7094         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7095         symbol and call Symbol::may_need_copy_reloc to determine if
7096         a copy reloc is needed.
7097         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7098         nocopyreloc is given in command line.
7099         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7100         given in command line.
7101         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7102         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7103         of the removed Target_i386::may_need_copy_reloc.
7104         * options.h (copyreloc): New option with default value false.
7105         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7106         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7107         instead of the removed Target_powerpc::may_need_copy_reloc.
7108         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7109         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7110         instead of the removed Target_sparc::may_need_copy_reloc.
7111         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7112         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7113         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7114         instead of the removed Target_x86_64::may_need_copy_reloc.
7116 2009-09-30  Ian Lance Taylor  <iant@google.com>
7118         * object.h (class Object): Remove target_ field, and target,
7119         sized_target, and set_target methods.
7120         (Object::sized_target): Remove.
7121         (class Sized_relobj): Update declarations.  Remove sized_target.
7122         * object.cc (Sized_relobj::setup): Remove target parameter.
7123         Change all callers.
7124         (Input_objects::add_object): Don't do anything with the target.
7125         (make_elf_sized_object): Add punconfigured parameter.  Change all
7126         callers.  Set or test parameter target.
7127         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7128         Change all callers.
7129         * parameters.cc (Parameters::set_target): Change parameter type to
7130         be non-const.
7131         (Parameters::default_target): Remove.
7132         (set_parameters_target): Change parameter type to be non-const.
7133         (parameters_force_valid_target): New function.
7134         (parameters_clear_target): New function.
7135         * parameters.h (class Parameters): Update declarations.  Remove
7136         default_target method.  Add sized_target and clear_target
7137         methods.  Change target_ to be non-const.
7138         (set_parameters_target): Update declaration.
7139         (parameters_force_valid_target): Declare.
7140         (parameters_clear_target): Declare.
7141         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7142         as NULL if we aren't searching.
7143         (Add_symbols::run): Don't check for compatible target.
7144         * fileread.cc (Input_file::open_binary): Call
7145         parameters_force_valid_target.
7146         * gold.cc (queue_middle_tasks): Likewise.
7147         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7148         set_target on object.
7149         * dynobj.h (class Sized_dynobj): Update declarations.
7150         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7151         make_elf_object returns NULL.
7152         (Archive::include_member): Don't check whether object target is
7153         compatible.
7154         * output.cc (Output_section::add_input_section): Get target from
7155         parameters.
7156         (Output_section::relax_input_section): Likewise.
7157         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7158         parameters.
7159         (Sized_relobj::do_scan_relocs): Likewise.
7160         (Sized_relobj::relocate_sections): Likewise.
7161         * resolve.cc (Symbol_table::resolve): Likewise.
7162         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7163         parameter.  Change all callers.
7164         (Symbol_table::add_from_object): Get target from parameters.
7165         (Symbol_table::add_from_relobj): Don't check object target.
7166         (Symbol_table::add_from_dynobj): Likewise.
7167         (Symbol_table::define_special_symbol): Get target from
7168         parameters.
7169         * symtab.h (class Symbol_table): Update declaration.
7170         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7171         parameter.  Change all callers.  Clear parameter target.
7172         (Binary_test): Test target here.
7173         * testsuite/object_unittest.cc (gold_testsuite): Remove
7174         target_test_pointer parameter.  Change all callers.
7175         (Object_test): Test target here.
7177 2009-09-26  Ian Lance Taylor  <iant@google.com>
7179         * testsuite/initpri1.c: Don't try to use constructor priorities if
7180         compiling with gcc before 4.3.
7182 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7184         * testsuite/retain_symbols_file_test.sh (check_present): Change
7185         output file name to retain_symbols_file_test.stdout.
7186         (check_absent): Likewise.
7188 2009-09-18  Craig Silverstein  <csilvers@google.com>
7190         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7191         * options.cc: Include <cerrno> and <fstream>.
7192         (General_options::finalize): Parse -retain-symbols-file tag.
7193         * options.h: New flag.
7194         (General_options): New method should_retain_symbol, new
7195         variable symbols_to_retain.
7196         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7197         should_retain_symbol map.
7198         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7199         * testsuite/Makefile.in: Regenerate.
7200         * testsuite/retain_symbols_file_test.sh: New file.
7202 2009-09-18  Nick Clifton  <nickc@redhat.com>
7204         * po/es.po: Updated Spanish translation.
7206 2009-09-17  Doug Kwan  <dougkwan@google.com>
7208         * debug.h (DEBUG_RELAXATION): New constant.
7209         (DEBUG_ALL): Add DEBUG_RELAXATION.
7210         (debug_string_to_enum): Add relaxation debug option.
7211         * layout.cc
7212         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7213         Layout::Relaxation_debug_check::read_sections,
7214         Layout::Relaxation_debug_check::read_sections): New method definitions.
7215         (Layout::Layout): Initialize data members
7216         record_output_section_data_from_scrips_,
7217         script_output_section_data_list_ and relaxation_debug_check_.
7218         (Layout::save_segments, Layout::restore_segments,
7219         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7220         Layout::relaxation_loop_body): New method definitions.
7221         (Layout::finalize): Support relaxation.  Move section layout code to
7222         Layout::relaxation_loop_body.
7223         (Layout::set_asection_address_from_script): Move code for orphan
7224         section placement out.
7225         (Layout::place_orphan_sections_in_script): New method definition.
7226         * layout.h (Output_segment_headers, Output_file_header):
7227         New forward class declarations.
7228         (Layout::~Layout): Define.
7229         (Layout::new_output_section_data_from_script): New method definition.
7230         (Layout::place_orphan_sections_in_script): New method declaration.
7231         (Layout::Segment_states): New type declaration.
7232         (Layout::save_segments, Layout::restore_segments,
7233         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7234         Layout::relaxation_loop_body): New method declarations.
7235         (Layout::Output_section_data_list): New type declaration.
7236         (Layout::Relaxation_debug_check): New class definition.
7237         (Layout::record_output_section_data_from_script_,
7238         Layout::script_output_section_data_list_, Layout::segment_states_,
7239         Layout::relaxation_debug_check_): New data members.
7240         * output.cc: (Output_section_headers::do_size): New method definition.
7241         (Output_section_headers::Output_section_headers): Move size
7242         computation to Output_section_headers::do_size.
7243         (Output_segment_headers::do_size): New method definition.
7244         (Output_file_header::Output_file_header): Move size computation to
7245         Output_file_header::do_size and call it.
7246         (Output_file_header::do_size): New method definition.
7247         (Output_data_group::Output_data_group): Adjust call to
7248         Output_section_data.
7249         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7250         (Output_symtab_xindex::do_write): Add array bound check.
7251         (Output_section::Input_section::print_to_mapfile): Handle
7252         RELAXED_INPUT_SECTION_CODE.
7253         (Output_section::Output_section): Initialize data member checkpoint_.
7254         (Output_section::~Output_section): Delete checkpoint object pointed
7255         by checkpoint_.
7256         (Output_section::add_input_section): Always add an Input_section if
7257         relaxing.
7258         (Output_section::add_merge_input_section): Add assert.
7259         (Output_section::relax_input_section): New method definition.
7260         (Output_section::set_final_data_size): Set load address to zero for
7261         an unallocated section.
7262         (Output_section::do_address_and_file_offset_have_reset_values):
7263         New method definition.
7264         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7265         Handle relaxed input section.
7266         (Output_section::sort_attached_input_sections): Checkpoint input
7267         section list lazily.
7268         (Output_section::get_input_sections): Change type of input_sections to
7269         list of Simple_input_section pointers.  Checkpoint input section list
7270         lazily.  Also handle relaxed input sections.
7271         (Output_section::add_input_section_for_script): Take a reference to
7272         a Simple_input_section object instead of Relobj pointer and section
7273         index as parameter.  Handle relaxed input sections.
7274         (Output_section::save_states, Output_section::restore_states): New
7275         method definitions.
7276         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7277         (Output_data::is_data_size_fixed): New method definition.
7278         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7279         if it is fixed.
7280         (Output_data::address_and_file_offset_have_reset_values): New method
7281         definition.
7282         (Output_data::do_address_and_file_offset_have_reset_values): New method
7283         definition.
7284         (Output_data::set_data_size): Check that data size is not fixed.
7285         (Output_data::fix_data_size): New method definition.
7286         (Output_data::is_data_size_fixed_): New data member.
7287         (Output_section_headers::set_final_data_size): New method definition.
7288         (Output_section_headers::do_size): New method declaration.
7289         (Output_segment_headers::set_final_data_size): New method definition.
7290         (Output_segment_headers::do_size): New method declaration.
7291         (Output_file_header::set_final_data_size)::New method definition.
7292         (Output_file_header::do_size)::New method declaration.
7293         (Output_section_data::Output_section_data): Add new parameter
7294         is_data_size_fixed and use it to fix data size.
7295         (Output_data_const::Output_data_const): Adjust call to base class
7296         constructor and fix data size.
7297         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7298         base class constructor and fix data size.
7299         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7300         base class constructor and fix data size.
7301         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7302         class constructor and fix data size.
7303         (Output_data_group::set_final_data_size): New method definition.
7304         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7305         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7306         class constructor and fix data size.
7307         (Output_relaxed_input_section): New class definition.
7308         (Output_section::Simple_input_section): New class definition.
7309         (Output_section::get_input_sections): Adjust parameter list.
7310         (Output_section::add_input_section_for_script): Same.
7311         (Output_section::save_states, Output_section::restore_states,
7312         Output_section::do_address_and_file_offset_have_reset_values,
7313         (Output_section::Input_section::Input_section): Handle
7314         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7315         Output_relaxed_input_section.
7316         (Output_section::Input_section::is_input_section,
7317         Output_section::Input_section::set_output_section): Handle relaxed
7318         input section.
7319         (Output_section::Input_section::is_relaxed_input_section,
7320         Output_section::Input_section::output_section_data,
7321         Output_section::Input_section::relaxed_input_section): New method
7322         definitions.
7323         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7324         value.
7325         (Output_section::Input_section::u1_): Update comments.
7326         (Output_section::Input_section::u2_): Add new union member poris.
7327         (Output_section::Checkpoint_output_section): New classs definition.
7328         (Output_section::relax_input_section): New method declaration.
7329         (Output_section::checkpoint_): New data member.
7330         (Output_segment): Update comments.
7331         (Output_segment::Output_segment): Un-privatize copy constructor.
7332         (Output_segment::operator=): Un-privatize.
7333         * script-sections.cc (Output_section_element::Input_section_list):
7334         Change element type to Output_section::Simple_input_section.
7335         (Output_section_element_dot_assignment::set_section_addresses):
7336         Register output section data for relaxation clean up.
7337         (Output_data_exression::Output_data_expression): Adjust call to base
7338         constructor to fix data size.
7339         (Output_section_element_data::set_section_addresses): Register
7340         Output_data_expression object for relaxation clean up.
7341         (struct Input_section_info): Replace Relobj pointer and section index
7342         pair with Output_section::Simple_input_section and Convert struct to a
7343         class.
7344         (Input_section_sorter::operator()): Adjust access to
7345         Input_section_info data member to use accessors.
7346         (Output_section_element_input::set_section_addresses): Use layout
7347         parameter.  Adjust code to use Output_section::Simple_input_section
7348         and Input_secction_info classes.  Register filler for relaxation
7349         clean up.
7350         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7351         and section index pair with Output_section::Simple_input_section
7352         class.  Adjust code accordingly.
7353         (Phdrs_element::release_segment): New method definition.
7354         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7355         segment list.
7356         (Script_sections::release_segments): New method definition.
7357         * gold/script-sections.h (Script_sections::release_segments): New
7358         method declaration.
7359         * gold/target.h (Target::may_relax, Target::relax,
7360         Target::do_may_relax, Target::do_relax): New method definitions.
7362 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7364         * arm.cc (has_signed_unsigned_overflow): New function.
7365         (Arm_relocate_functions::abs8): New function.
7366         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7367         (Target_arm::Scan::global): Likewise.
7368         (Target_arm::relocate::relocate): Likewise.
7369         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7370         Likewise.
7372 2009-09-16  Cary Coutant  <ccoutant@google.com>
7374         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7375         * testsuite/Makefile.in: Regenerate.
7377 2009-09-11  Nick Clifton  <nickc@redhat.com>
7379         * po/gold.pot: Updated by the Translation project.
7381 2009-09-08  Cary Coutant  <ccoutant@google.com>
7383         * output.cc (Output_file::open): Add execute permission to empty file.
7384         * testsuite/Makefile.am (permission_test): New test.
7385         * testsuite/Makefile.in: Regenerate.
7387 2009-09-02  Ian Lance Taylor  <iant@google.com>
7389         * output.cc (Output_file::resize): Call map_no_anonymous rather
7390         than map.
7392 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7394         * gold.cc: Include "incremental.h".
7395         (queue_initial_tasks): Call Incremental_checker methods.
7396         * incremental.cc: Include "output.h".
7397         (Incremental_checker::can_incrementally_link_output_file): New
7398         method.
7399         * incremental.h (Incremental_checker): New class.
7401         * output.cc (Output_file::open_for_modification): New method.
7402         (Output_file::map_anonymous): Changed return type to bool.  Record
7403         map in base_ field.
7404         (Output_file::map_no_anonymous): New method, broken out of map.
7405         (Output_file::map): Use map_no_anonymous and map_anonymous.
7406         * output.h (class Output_file): Update declarations.
7408 2009-08-24  Cary Coutant  <ccoutant@google.com>
7410         * options.h (Command_line::Pre_options): New class.
7411         (Command_line::pre_options): New member.
7412         * options.cc (gold::options::ready_to_register): New variable.
7413         (One_option::register_option): Do nothing if not registering options.
7414         Assert if same short option registered twice.
7415         (General_options::General_options): Turn off option registration when
7416         done constructing.
7417         (Command_line::Pre_options::Pre_options): New constructor.
7419 2009-08-24  Cary Coutant  <ccoutant@google.com>
7421         * options.h (General_options::no_keep_memory): Remove incorrect
7422         short option.
7424 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7426         * Makefile.am (am__skiplex, am__skipyacc): New.
7427         * Makefile.in: Regenerate.
7429 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7431         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7432         (INCLUDES): ... this.
7433         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7434         (AM_CPPFLAGS): Renamed from ...
7435         (INCLUDE): ... this.
7436         * Makefile.in, testsuite/Makefile.in: Regenerate.
7438         * Makefile.in: Regenerate.
7439         * aclocal.m4: Likewise.
7440         * config.in: Likewise.
7441         * configure: Likewise.
7442         * testsuite/Makefile.in: Likewise.
7444         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7445         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7446         * Makefile.in: Regenerate.
7447         * testsuite/Makefile.in: Regenerate.
7449 2009-08-19  Cary Coutant  <ccoutant@google.com>
7451         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7452         symbols in shared libraries overridden by hidden or internal symbols
7453         in the main program.
7455 2009-08-19  Chris Demetriou  <cgd@google.com>
7457         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7458         checking source file names in error messages.
7460 2009-08-18  Doug Kwan  <dougkwan@google.com>
7462         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7463         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7464         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7465         an elfcpp::Ehdr as parameter.
7466         * object.cc (Object::set_target): Remove the version that looks up
7467         a target and sets it.
7468         (Sized_relobj::setup): Take a Target object instead of
7469         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7470         (make_elf_sized_object): Find target and ask target to
7471         make an ELF object.
7472         * object.h: (Object::set_target): Remove the version that looks up
7473         a target and sets it.
7474         (Sized_relobj::setup): Take a Target object instead of
7475         an elfcpp:Ehdr as parameter.
7476         * target.cc: Include dynobj.h.
7477         (Target::do_make_elf_object_implementation): New.
7478         (Target::do_make_elf_object): New.
7479         * target.h (Target::make_elf_object): New template declaration.
7480         (Target::do_make_elf_object): New method declarations.
7481         (Target::do_make_elf_object_implementation): New template declaration.
7483 2009-08-14  Ian Lance Taylor  <iant@google.com>
7485         * gold.h (FUNCTION_NAME): Define.
7486         (gold_unreachable): Use FUNCTION_NAME.
7488 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7490         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7491         symbol in the --keep-unique list is not found.
7493 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7495         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7496         been maked as --keep-unique.
7497         (Icf::unfold_section): New function.
7498         * icf.h (Icf::unfold_section): New function.
7499         * options.h (General_options::keep_unique): New option.
7500         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7501         * testsuite/Makefile.in: Regenerate.
7502         * testsuite/icf_keep_unique_test.sh: New file.
7503         * testsuite/icf_keep_unique_test.cc: New file.
7505 2009-08-12  Cary Coutant  <ccoutant@google.com>
7507         PR 10471
7508         * resolve.cc (Symbol_table::resolve): Check for references from
7509         dynamic objects to hidden and internal symbols.
7510         * testsuite/Makefile.am (hidden_test.sh): New test.
7511         * testsuite/Makefile.in: Regenerate.
7512         * testsuite/hidden_test.sh: New script.
7513         * testsuite/hidden_test_1.c: New test source.
7514         * testsuite/hidden_test_main.c: New test source.
7516 2009-08-11  Doug Kwan  <dougkwan@google.com>
7518         * arm.cc: Update comments.
7519         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7520         segment to locate the .ARM.exidx section if present.
7522 2009-08-09  Doug Kwan  <dougkwan@google.com>
7524         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7525         patch.
7527 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7528         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7529         compiler warnings.
7531 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7533         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7534         valid tls_segment only for non-debug-section relocations.
7535         * testsuite/Makefile.am: Add gc_tls_test.
7536         * testsuite/Makefile.in: Regenerate.
7537         * testsuite/gc_tls_test.cc: New file.
7538         * testsuite/gc_tls_test.sh: New file.
7540 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7542         * icf.cc: New file.
7543         * icf.h: New file.
7544         * Makefile.am (CCFILES): Add icf.cc.
7545         (HFILES): Add icf.h
7546         * Makefile.in: Regenerate.
7547         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7548         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7549         section, symbol and addend information for the relocs.
7550         * gold.cc (queue_middle_tasks): Call identical code folding.
7551         * gold.h: Add defines for multimap.
7552         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7553         to the call of finalize_local_symbols.
7554         * main.cc (main): Create object of class Icf.
7555         * object.cc (Sized_relobj::do_layout): Allow this function to be
7556         called twice during icf.
7557         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7558         to sections marked as identical by icf.
7559         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7560         when available.
7561         (Sized_relobj::do_section_entsize): New function.
7562         * object.h (Object::section_entsize): New function.
7563         (Object::do_section_entsize): New pure virtual function.
7564         (Relobj::finalize_local_symbols): Add new parameter.
7565         (Relobj::do_section_entsize): New function.
7566         * options.h (General_options::icf): New option.
7567         (General_options::icf_iterations): New option.
7568         (General_options::print_icf_sections): New option.
7569         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7570         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7571         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7572         icf.
7573         * symtab.cc (Symbol_table::is_section_folded): New function.
7574         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7575         to sections marked as identical by icf.
7576         * symtab.h (Symbol_table::set_icf): New function.
7577         (Symbol_table::icf): New function.
7578         (Symbol_table::is_section_folded): New function.
7579         (Symbol_table::icf_): New data member.
7580         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7581         * testsuite/Makefile.am: Add commands to build icf_test.
7582         * testsuite/Makefile.in: Regenerate.
7583         * testsuite/icf_test.sh: New file.
7584         * testsuite/icf_test.cc: New file.
7586 2009-07-24  Chris Demetriou  <cgd@google.com>
7588         * layout.cc (is_compressible_debug_section): Fix incorrect
7589         comment about compressed section names.
7591 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7593         PR 10419
7594         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7596 2009-07-16  Ian Lance Taylor  <iant@google.com>
7598         PR 10400
7599         * layout.h: #include <map>.
7600         (class Kept_section): Change from struct to class.  Add accessors
7601         and setters.  Add section size to Comdat_group mapping.  Change
7602         Comdat_group to std::map.  Add is_comdat_ field.  Add
7603         linkonce_size field in union.
7604         (class Layout): Update declaration of find_or_add_kept_section.
7605         Don't declare find_kept_object.
7606         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7607         parameter.  Add object, shndx, is_comdat, and is_group_name
7608         parameters.  Change all callers.  Adjust for new Kept_section.
7609         (Layout::find_kept_object): Remove.
7610         * object.cc (Sized_relobj::include_section_group): Update use of
7611         Kept_section.  Rename secnum to shndx.  Only record
7612         Kept_comdat_section if sections are the same size.
7613         (Sized_relobj::include_linkonce_section): Update use of
7614         Kept_section.  Only record Kept_comdat_section if sections are the
7615         same size.  Set size of linkonce section.
7616         (Sized_relobj::map_to_kept_section): Update call to
7617         get_kept_comdat_section.
7618         * object.h (class Sized_relobj): Rename fields in
7619         Kept_comdat_section to drop trailing underscores; change object
7620         field to Relobj*.  Change Kept_comdat_section_table to store
7621         struct rather than pointer.
7622         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7623         Add kept_object and kept_shndx parameters.  Change all callers.
7624         (Sized_relobj::get_kept_comdat_section): Change return type to
7625         bool.  Add kept_object and kept_shndx parameters.  Change all
7626         callers.
7627         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7628         Layout::find_or_add_kept_section.
7630 2009-07-09  Ian Lance Taylor  <iant@google.com>
7632         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7633         Reserve space in the hash table.
7635 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7637         * fileread.cc (File_read::get_mtime): New method.
7638         * fileread.h (Timespec): New structure.
7639         (File_read::get_mtime): New method.
7640         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7641         Renamed from timestamp_nsec.
7642         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7643         Elf_Xword.
7644         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7645         timestamp_nsec.
7646         (Incremental_inputs::report_archive): Save mtime; style fix.
7647         (Incremental_inputs::report_obejct): Save mtime; style fix.
7648         (Incremental_inputs::report_script): Save mtime; style fix.
7649         (Incremental_inputs::finalize_inputs): Style fix.
7650         (Incremental_inputs::finalize): Style fix.
7651         (Incremental_inputs::create_input_section_data): Store inputs
7652         mtime.
7653         * incremental.h (Incremental_inputs::report_script): Add mtime
7654         argument.
7655         (Incremental_inputs::Input_info::Input_info): Intialize only one
7656         union member.
7657         (Incremental_inputs::Input_info::archive): Move to nameless
7658         union.
7659         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7660         (Incremental_inputs::Input_info::script): Move to nameless union.
7661         (Incremental_inputs::mtime): New field.
7662         * script.cc (read_input_script): Pass file mtime to
7663         Incremental_input.
7664         * script.h (Script_info::inputs): Style fix.
7666 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7668         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7669         instead of 32.
7671 2009-06-24  Ian Lance Taylor  <iant@google.com>
7673         PR 10156
7674         * layout.cc (Layout::choose_output_section): If we find an
7675         existing section, update the flags.
7676         (Layout::create_notes): New function, broken out of
7677         Layout::finalize.
7678         (Layout::finalize): Don't create note sections.
7679         (Layout::create_note): Don't crash if linker script discards
7680         section.
7681         (Layout::create_gold_note): Likewise.
7682         (Layout::create_build_id): Likewise.  Don't set
7683         after_input_sections on the section.
7684         (Layout::create_executable_stack_info): Remove target parameter.
7685         Change caller.
7686         * layout.h (class Layout): Declare create_notes.  Update
7687         declaration of create_executable_stack_info.
7688         * gold.cc (queue_middle_tasks): Call create_notes.
7689         * output.cc (Output_section::update_flags_for_input_section): Move
7690         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7691         invalid.
7692         * output.h (Output_data::mark_address_invalid): New function.
7693         (class Output_section): Only declare, not define,
7694         update_flags_for_input_section.  Remove set_flags.
7696 2009-06-24  Ian Lance Taylor  <iant@google.com>
7698         * script-sections.cc (Output_section_definition::
7699         set_section_addresses): Rename shadowing local load_address to
7700         laddr.
7702 2009-06-24  Ian Lance Taylor  <iant@google.com>
7704         PR 10244
7705         * reloc.cc (relocate_sections): Skip empty relocation sections.
7707 2009-06-23  Ian Lance Taylor  <iant@google.com>
7709         PR 10156
7710         * layout.cc (Layout::create_note): Use choose_output_section
7711         rather than make_output_section.
7713 2009-06-23  Ian Lance Taylor  <iant@google.com>
7715         PR 10237
7716         * options.cc (General_options::parse_V): Set printed_version_.
7717         (General_options::General_options): Initialize printed_version_.
7718         * options.h (class General_options): Add printed_version_ field.
7719         * gold.cc (queue_initial_tasks): If there are no input files,
7720         don't give a fatal error if we printed the version information.
7721         (queue_middle_tasks): If using -r with a shared object, give a
7722         fatal error rather than an ordinary error.
7724 2009-06-23  Ian Lance Taylor  <iant@google.com>
7726         PR 10219
7727         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7728         (Layout::make_output_section): Set have_stabstr_section_ if we see
7729         a .stab*str section.
7730         (Layout::finalize): Call link_stabs_sections.
7731         (Layout::link_stabs_sections): New file.
7732         * layout.h (class Layout): Add have_stabstr_section_ field.
7733         Declare link_stabs_sections.
7735 2009-06-23  Doug Kwan  <dougkwan@google.com>
7737         * Makefile.am (libgold_a_LIBADD): New.
7738         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7739         * Makefile.in: Regenerate.
7740         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7741         * configure: Regenerate.
7742         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7743         * fileread.cc: Include sys/state.h
7744         * gold.h: Declare memmem and strndup if found missing.
7745         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7747 2009-06-23  Ian Lance Taylor  <iant@google.com>
7749         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7750         * configure: Rebuild.
7752 2009-06-23  Ian Lance Taylor  <iant@google.com>
7754         PR 10147
7755         * object.cc (Object::section_contents): Don't try to get a view if
7756         the section has length zero.
7757         (Object::handle_gnu_warning_section): If the section is empty, use
7758         the name of the section as the warning.
7760 2009-06-23  Ian Lance Taylor  <iant@google.com>
7762         PR 10133
7763         * stringpool.h (class Stringpool_template): Add optimize_ field.
7764         (Stringpool_template::set_optimize): New function.
7765         * stringpool.cc (Stringpool_template::Stringpool_template):
7766         Initialize optimize_ field.
7767         (Stringpool_template::set_string_offsets): Test local optimize
7768         fild rather than parameter.
7769         * layout.cc (Layout::Layout): Call set_optimize on the section
7770         name stringpool.
7772 2009-06-22  Ian Lance Taylor  <iant@google.com>
7774         PR 10030
7775         * yyscript.y: Parse TARGET.
7776         * script.cc (script_set_target): New function.
7777         * script-c.h (script_set_target): Declare.
7778         * options.cc (General_options::string_to_object_format): Rename
7779         from string_to_object_format in anonymous namespace.  Change
7780         callers.
7781         * options.h (class General_options): Declare
7782         string_to_object_format.
7784 2009-06-22  Ian Lance Taylor  <iant@google.com>
7786         * script-sections.cc (Script_sections::create_segments): Don't put
7787         program headers in a PT_LOAD segment if -n or -N.
7789 2009-06-22  Ian Lance Taylor  <iant@google.com>
7791         PR 10141
7792         * options.h (class General_options): Add -z lazy and -z now.  Sort
7793         -z options into alphabetical order.
7794         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7796 2009-06-21  Ian Lance Taylor  <iant@google.com>
7798         * layout.cc (Layout::make_output_section): Call
7799         Target::new_output_section.
7800         (Layout::attach_allocated_section_to_segment): Put large section
7801         sections in a separate load segment with the large segment flag
7802         set.
7803         (Layout::segment_precedes): Sort large data segments after other
7804         load segments.
7805         (align_file_offset): New static function.
7806         (Layout::set_segment_offsets): Use align_file_offset.
7807         * output.h (class Output_section): Add is_small_section_ and
7808         is_large_section_ fields.
7809         (Output_section::is_small_section): New function.
7810         (Output_section::set_is_small_section):  New function.
7811         (Output_section::is_large_section): New function.
7812         (Output_section::set_is_large_section): New function.
7813         (Output_section::is_large_data_section): New function.
7814         (class Output_segment): Add is_large_data_segment_ field.
7815         (Output_segment::is_large_data_segment): New function.
7816         (Output_segment::set_is_large_data_segment): New function.
7817         * output.cc (Output_section::Output_section): Initialize new
7818         fields.
7819         (Output_segment::Output_segment): Likewise.
7820         (Output_segment::add_output_section): Add assertion that large
7821         data sections always go in large data segments.  Force small data
7822         sections to the end of the list of data sections.  Force small BSS
7823         sections to the start of the list of BSS sections.  For large BSS
7824         sections to the end of the list of BSS sections.
7825         * symtab.h (class Symbol): Declare is_common_shndx.
7826         (Symbol::is_defined): Check Symbol::is_common_shndx.
7827         (Symbol::is_common): Likewise.
7828         (class Symbol_table): Define enum Commons_section_type.  Update
7829         declarations.  Add small_commons_ and large_commons_ fields.
7830         * symtab.cc (Symbol::is_common_shndx): New function.
7831         (Symbol_table::Symbol_table): Initialize new fields.
7832         (Symbol_table::add_from_object): Put small and large common
7833         symbols in the right list.
7834         (Symbol_table::sized_finalized_symbol): Check
7835         Symbol::is_common_shndx.
7836         (Symbol_table::sized_write_globals): Likewise.
7837         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7838         common symbol lists.  Don't call do_allocate_commons_list if the
7839         list is empty.
7840         (Symbol_table::do_allocate_commons_list): Remove is_tls
7841         parameter.  Add comons_section_type parameter.  Change all
7842         callers.  Handle small and large common symbols.
7843         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7844         Symbol::is_common_shndx.
7845         * resolve.cc (symbol_to_bits): Likewise.
7846         * target.h (Target::small_common_shndx): New function.
7847         (Target::small_common_section_flags): New function.
7848         (Target::large_common_shndx): New function.
7849         (Target::large_common_section_flags): New function.
7850         (Target::new_output_section): New function.
7851         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7852         small_common_section_flags, and large_common_section_flags
7853         fields.
7854         (Target::do_new_output_section): New virtual function.
7855         * arm.cc (Target_arm::arm_info): Initialize new fields.
7856         * i386.cc (Target_i386::i386_info): Likewise.
7857         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7858         Likewise.
7859         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7860         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7861         (Target_x86_64::do_new_output_section): New function.
7862         * configure.ac: Define conditional MCMODEL_MEDIUM.
7863         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7864         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7865         (large_LDFLAGS): Define.
7866         * testsuite/large.c: New file.
7867         * testsuite/testfile.cc (Target_test::test_target_info):
7868         Initialize new fields.
7869         * configure, testsuite/Makefile.in: Rebuild.
7871 2009-06-05  Doug Kwan  <dougkwan@google.com>
7873         * Makefile.am (CCFILES): Add target.cc.
7874         * Makefile.in: Regenerate.
7875         * i386.cc (class Target_i386): Define new virtual method to
7876         override do_is_local_label_name in parent.
7877         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7878         local symbols if --discard-locals or -X is given.
7879         * options.h (class General_options): Declare new options
7880         '--discard-locals' and '-X' for discarding locals.
7881         * target.h (class Target): Define new methods is_local_label_name.
7882         Declare new virtual method do_is_local_label_name.
7883         * target.cc: New file.
7884         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7885         (check_SCRIPTS): Add discard_locals_test.sh.
7886         (check_DATA): Add discard_local_tests.syms.
7887         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7888         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7889         * testsuite/Makefile.in: Regenerate.
7890         * testsuite/discard_locals_test.c: New file.
7891         * testsuite/discard_locals_test.sh: Same.
7893 2009-06-05  Doug Kwan  <dougkwan@google.com>
7895         * object.cc (Sized_relobj::Sized_relobj): Initialize
7896         discarded_eh_frame_shndx_ to -1U.
7897         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7898         section.
7899         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7900         a discarded .eh_frame section.
7901         (Sized_relobj::do_finalize_local_symbols): Ditto.
7902         * object.h (class Sized_relobj): Declare new member
7903         discarded_eh_frame_shndx_.
7904         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7905         (local_labels_test.o, local_labels_test): New rules.
7906         * testsuite/Makefile.in: Regenerate.
7908 2009-06-04  Doug Kwan  <dougkwan@google.com>
7910         * layout.cc (Layout::section_name_mapping): Add mapping for
7911         special ARM sections.
7913 2009-06-03  Doug Kwan  <dougkwan@google.com>
7915         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7916         (utils::has_overflow): Same.
7918 2009-06-03  Ian Lance Taylor  <iant@google.com>
7920         * layout.cc (Layout::section_name_mapping): New array, replacing
7921         Layout::linkonce_mapping.
7922         (Layout::section_name_mapping_count): New variable, replacing
7923         Layout::linkonce_mapping_count.
7924         (Layout::linkonce_output_name): Remove.
7925         (Layout::output_section_name): Rewrite.
7926         * layout.h (class Layout): Rename Linkonce_mapping to
7927         Section_name_mapping, linkonce_mapping to section_name_mapping,
7928         linkonce_mapping_count to section_name_mapping_count.  Don't
7929         declare linkonce_output_name.
7931 2009-06-03  Doug Kwan  <dougkwan@google.com>
7933         * gold/arm.cc (namespace utils): New.
7934         (Target_arm::reloc_is_non_pic): Define new method.
7935         (class Arm_relocate_functions): New.
7936         (Target_arm::Relocate::relocate): Handle relocation types used by
7937         Android.
7939 2009-06-03  Ian Lance Taylor  <iant@google.com>
7941         * arm.cc (Target_arm::scan::global): Use || instead of |.
7943 2009-06-02  Doug Kwan  <dougkwan@google.com>
7945         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7946         issued_non_pic_error_.
7947         (class Target_arm::Scan): Declare new method check_non_pic.
7948         Define new method symbol_needs_plt_entry.
7949         Declare new data member issued_non_pic_error_.
7950         (class Target_arm::Relocate): Declare new method
7951         should_apply_static_reloc.
7952         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7953         (Target_arm::Scan::check_non_pic): Define new method.
7954         (Target_arm::Scan::local): Handle a small subset of reloc types used
7955         by Android.
7956         (Target_arm::Scan::local): Same.
7957         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7959 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7961         * incremental.cc (Incremental_inputs::report_command_line): Filter
7962         out --incremental-* options.
7964 2009-05-29  Doug Kwan  <dougkwan@google.com>
7966         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7967         template class.
7968         (class Target_arm): Update comment.
7969         (Target_arm::Target_arm): Initialize new data members GOT_,
7970         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7971         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7972         and Target_arm::rel_dyn_section.
7973         Declare new_enum Target_arm::Got_type.
7974         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7975         and DYNBSS_.
7976         Update commments for member do_dynsym_value.
7977         (Target_arm::got_size, Target_arm::plt_section,
7978         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7979         new methods inside class defintion.
7980         (Target_arm::got_section): Define new method.
7981         (Target_arm::rel_dyn_section): Same.
7982         (Output_data_plt_arm): New template class.
7983         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7984         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7985         (Output_data_plt_arm::add_entry): Same.
7986         (Output_data_plt_arm::first_plt_entry): Define new
7987         static data member for PLT instruction template.
7988         (Output_data_plt_arm::plt_entry): Same.
7989         (Output_data_plt_arm::do_write): Define new method.
7990         (Target_arm::make_plt_entry): Same.
7991         (Target_arm::do_finalize_sections): Same.
7992         (Target_arm::do_dynsym_value): Same.
7994 2009-05-28  Doug Kwan  <dougkwan@google.com>
7996         * Makefile.am (TARGETSOURCES): Add arm.cc.
7997         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7998         * Makefile.in: Regenerate.
7999         * arm.cc: New file.
8000         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8002 2009-05-26  Doug Kwan  <dougkwan@google.com>
8004         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8005         (General_options::check_excluded_libs): Strip off directories in
8006         archive name before matching like GNU ld does.
8007         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8008         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8009         (exclude_libs_test_LDFLAGS): Add linker option
8010         -Wl,--exclude-libs,libexclude_libs_test_3
8011         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8012         an explicit archive without using -l.
8013         (alt/libexclude_libs_test_3.a): New make rule.
8014         * testsuite/Makefile.in: Regenerate.
8015         * testsuite/exclude_libs_test.c : Declare lib3_default().
8016         (main): Call it.
8017         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8018         * exclude_libs_test_3.c: New file.
8020 2009-05-26  Nick Clifton  <nickc@redhat.com>
8022         * po/id.po: New Indonesian translation.
8023         * po/gold.pot: Updated template file.
8025 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8027         * testsuite/Makefile.am: Add -ffunction-sections to compile
8028         gc_comdat_test files.  Add -Wl,--gc-sections to build
8029         gc_comdat_test.
8030         * testsuite/Makefile.in: Regenerate.
8031         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8033 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8035         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8036         kept comdat section was garbage collected.
8037         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8038         * testsuite/Makefile.in: Regenerate.
8039         * testsuite/gc_comdat_test.sh: New file.
8040         * testsuite/gc_comdat_test_1.cc: New file.
8041         * testsuite/gc_comdat_test_2.cc: New file.
8043 2009-05-19  Doug Kwan  <dougkwan@google.com>
8045         * archive.cc (Archive::Archive): Move constructor from archive.h
8046         to here.  Initialize no_export_.
8047         (Archive::get_elf_object_for_member): Set no_export flag of object.
8048         * archive.h (Archive::Archive): Move constructor body to
8049         archive.cc.
8050         (Archive::no_export): New method.
8051         (Archive::no_export_): New field.
8052         * object.h (Object::Object): Initialize no_export_ to false.
8053         (Object::no_export, Object::set_no_export): New methods.
8054         (Object::no_export_): New field.
8055         * options.cc (General_options::parse_exclude_libs): New method.
8056         (General_options::check_excluded_libs) Same.
8057         * options.h (exclude_libs): New option.
8058         (General_options::check_excluded_libs): New method declaration.
8059         (General_options::excluded_libs_): New field.
8060         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8061         default or protected visibility if an object has no-export flag set.
8062         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8063         (check_SCRIPTS): Add exclude_libs_test.sh.
8064         (check_DATA): Add exclude_libs_test.syms.
8065         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8066         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8067         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8068         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8069         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8070         libexclude_libs_test_2.a): New rules.
8071         * testsuite/Makefile.in: Regenerate.
8072         * testsuite/exclude_libs_test.c: New file.
8073         * testsuite/exclude_libs_test.sh: Ditto.
8074         * testsuite/exclude_libs_test_1.c: Ditto.
8075         * testsuite/exclude_libs_test_2.c: Ditto.
8077 2009-05-15  Ian Lance Taylor  <iant@google.com>
8079         * configure.ac: Check for declarations for cases where libiberty.h
8080         checks HAVE_DECL_xxx.
8081         * configure, config.in: Rebuild.
8083 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8085         * gold.h (Incremental_argument_list): Remove (invalid) forward
8086         declaration.
8087         * incremental.cc (Incremental_inputs::report_achive): New method.
8088         (Incremental_inputs::report_object): New method.
8089         (Incremental_inputs::report_script): New method.
8090         (Incremental_inputs::finalize_inputs): New method.
8091         (Incremental_inputs::finalize): Call finalize_inputs().
8092         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8093         Create inputs entries.
8094         * incremental.h (Incremental_input_type): New enum.
8095         (Incremental_inputs::Incremental_input): Initialize new fields.
8096         (Incremental_inputs::report_inputs): New method.
8097         (Incremental_inputs::report_achive): New method.
8098         (Incremental_inputs::report_object): New method.
8099         (Incremental_inputs::report_script): New method.
8100         (Incremental_inputs::finalize_inputs): New method.
8101         (Incremental_inputs::Input_info): New struct.
8102         (Incremental_inputs::Input_info_map): New typedef.
8103         (Incremental_inputs::lock_): New field.
8104         (Incremental_inputs::Inputs_): New field.
8105         (Incremental_inputs::Inputs_map): New field.
8106         * main.cc (main): Call Incremental_input::report_inputs.
8107         * options.h (Input_argument_list): Typedef moved from
8108         Input_arguments.
8109         (Input_file_group::Files): Remove, use ::Input_argument_list.
8110         (Input_file_group::Input_argument_list): Remove, use
8111         ::Input_argument_list.
8112         * plugin.cc (Plugin_manager::add_input_file): Add error in
8113         incremental build.
8114         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8115         functions.
8116         * script.cc (read_input_script): Call
8117         Incremental_input::report_script.
8118         * script.h (Script_info): New class.
8120 2009-04-27  Ian Lance Taylor  <iant@google.com>
8122         * x86_64.cc (do_adjust_output_section): Set entsize to
8123         plt_entry_size.
8125 2009-04-23  Elliott Hughes  <enh@google.com>
8127         * output.cc (Output_file::close): After short writes, continue
8128         writing from the correct offset in the buffer being written.
8130 2009-04-23  Chris Demetriou  <cgd@google.com>
8132         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8133         * configure: Regenerate.
8134         * config.in: Regenerate.
8135         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8136         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8138 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8140         * incremental.cc (Incremental_inputs_header_data): Renamed from
8141         Incremental_input_header_data.
8142         (Incremental_inputs_header_data::data_size): New field.
8143         (Incremental_inputs_header_data::put_input_file_count): Renamed
8144         from input_file_count.
8145         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8146         from command_line_offset.
8147         (Incremental_inputs_header_data::put_reserved): Renamed from
8148         put_reserved.
8149         (Incremental_inputs_entry_data): Renamed from
8150         Incremental_input_entry_data.
8151         (Incremental_inputs_entry_data::data_size): New field.
8152         (Incremental_inputs::report_command_line): New method.
8153         (Incremental_inputs::finalize): New method.
8154         (Incremental_inputs::create_incremental_inputs_data): New method.
8155         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8156         * incremental.h: New file.
8157         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8158        (Layout::finalize): Create incremental inputs section in
8159         incremental builds.
8160        (Layout::create_incremental_info_sections): New method.
8161         * layout.h (Layout::incremental_inputs): New method.
8162        (Layout::create_incremental_info_sections): New method.
8163        (Layout::incremental_inputs_): New field.
8164         * main.cc (main): Notify Incremental_input of the command line.
8166 2009-04-01  Ian Lance Taylor  <iant@google.com>
8167             Mikolaj Zalewski  <mikolajz@google.com>
8169         * gold.h (reserve_unordered_map): Define, three versions, one for
8170         each version of Unordered_map.
8171         * layout.cc (Layout::Layout): Remove options parameter.  Add
8172         number_of_input_files parameter.  Don't initialize options_.
8173         Initialize number_of_input_files_ and resized_signatures_.  Move
8174         sections_are_attached_.
8175         (Layout::layout_group): Reserve space for group_signatures_.
8176         (Layout::find_or_add_kept_section): Change name parameter to be a
8177         reference.  Resize signatures_ map when it gets large enough.
8178         (Layout::layout_eh_frame): Use parameters->options() instead of
8179         this->options_.
8180         (Layout::make_output_section): Likewise.
8181         (Layout::attach_allocated_section_to_segment): Likewise.
8182         (Layout::finalize, Layout::create_executable_stack): Likewise.
8183         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8184         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8185         * layout.h (class Layout): Update declarations.  Remove options_
8186         field.  Add number_of_input_files_ and resized_signatures_
8187         fields.  Move sections_are_attached_ field.
8188         * main.cc (main): Pass number of input files to Layout
8189         constructor.  Don't pass options.
8191 2009-03-30  Ian Lance Taylor  <iant@google.com>
8193         * ffsll.c (ffsll): Correct implementation.
8195 2009-03-27  Ian Lance Taylor  <iant@google.com>
8197         * ffsll.c: New file.
8198         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8199         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8200         * ftruncate.c (ftruncate): Declare before definition.
8201         * mremap.c (mremap): Likewise.
8202         * pread.c (pread): Likewise.
8203         * configure, Makefile.in, config.in: Rebuild.
8205         * mremap.c: New file.
8206         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8207         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8208         (mremap): Declare if HAVE_MREMAP is not defined.
8209         * configure, Makefile.in, config.in: Rebuild.
8211 2009-03-27  Cary Coutant  <ccoutant@google.com>
8213         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8214         position independent.
8215         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8216         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8218 2009-03-24  Cary Coutant  <ccoutant@google.com>
8220         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8221         an executable.
8222         (needs_dynamic_reloc): Likewise.
8224 2009-03-24  Ian Lance Taylor  <iant@google.com>
8226         * yyscript.y (file_cmd): Recognize EXTERN.
8227         (extern_name_list, extern_name_list_body): New nonterminals.
8228         * script.cc (script_add_extern): Define.
8229         * script-c.h (script_add_extern): Declare.
8231 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8233         * object.cc (is_elf_object): Define.
8234         * object.h (is_elf_object): Declare.
8235         * archive.cc (Archive::get_elf_object_for_member): Call
8236         is_elf_object.
8237         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8239 2009-03-24  Elliott Hughes  <enh@google.com>
8241         * output.cc (Output_file::map_anonymous): Define.
8242         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8243         try an anonymous one.  Report the size if the mmap fails.
8244         * output.h (class Output_file): Declare map_anonymous.
8246 2009-03-24  Ian Lance Taylor  <iant@google.com>
8248         * target-select.cc (instantiate_target): Don't acquire the lock if
8249         the instantiated_target_ field has already been set.
8251 2009-03-23  Ian Lance Taylor  <iant@google.com>
8253         * gold-threads.h (class Initialize_lock): Define.
8254         * gold-threads.cc (class Initialize_lock_once): Define.
8255         (initialize_lock_control): New static variable.
8256         (initialize_lock_pointer): New static variable.
8257         (initialize_lock_once): New static function.
8258         (Initialize_lock::Initialize_lock): Define.
8259         (Initialize_lock::initialize): Define.
8260         * target-select.h: Include "gold-threads.h".
8261         (class Target_selector): Add lock_ and initialize_lock_ fields.
8262         Don't define instantiate_target, just declare it.
8263         * target-select.cc (Target_selector::Target_selector): Initialize
8264         new fields.
8265         (Target_selector::instantiate_target): Define.
8266         * descriptors.h: Include "gold-threads.h".
8267         (class Descriptors): Add initialize_lock_ field.
8268         * descriptors.cc (Descriptors::Descriptors): Initialize new
8269         field.
8270         (Descriptors::open): Use initialize_lock_ field
8271         * errors.h (class Errors): Add initialize_lock_ field.
8272         * errors.cc (Errors::Errors): Initialize new field.
8273         (Errors::initialize_lock): Use initialize_lock_ field.
8274         * powerpc.cc (class Target_selector_powerpc): Remove
8275         instantiated_target_ field.  In do_recognize call
8276         instantiate_target rather than do_instantiate_target.  In
8277         do_instantiate_target just allocate a new target.
8278         * sparc.cc (class Target_selector_sparc): Likewise.
8280         * freebsd.h: New file.
8281         * i386.cc: Include "freebsd.h".
8282         (Target_i386): Derive from Target_freebsd rather than
8283         Sized_target.
8284         (Target_selector_i386): Derive from Target_selector_freebsd rather
8285         than Target_selector.
8286         * x86_64.cc: Include "freebsd.h".
8287         (Target_x86_64): Derive from Target_freebsd rather than
8288         Sized_target.
8289         (Target_selector_x86_64): Derive from Target_selector_freebsd
8290         rather than Target_selector.
8291         * target.h (class Target): Add adjust_elf_header and
8292         do_adjust_elf_header.
8293         * output.cc (Output_file_header:: do_sized_write): Call target
8294         adjust_elf_header routine.
8295         * configure.tgt: Set targ_osabi.
8296         * configure.ac: Define GOLD_DEFAULT_OSABI.
8297         * parameters.cc (Parameters::default_target): Pass
8298         GOLD_DEFAULT_OSABI to select_target.
8299         * target-select.h (class Target_selector): Make instantiate_target
8300         protected rather than private.
8301         * Makefile.am (HFILES): Add freebsd.h.
8302         * configure, Makefile.in, config.in: Rebuild.
8304         * merge.cc (do_add_input_section): Correct pend value.  Change
8305         message about last entry not being null terminated from error to
8306         warning.
8308 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8310         * incremental.cc: New file.
8311         * Makefile.am (CCFILES): Add incremental.cc.
8312         * Makefile.in: Rebuild.
8314 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8316         * layout.cc (Layout::output_section_name): Preserve names
8317         of '.note.' sections.
8319 2009-03-19  Ian Lance Taylor  <iant@google.com>
8321         * descriptors.cc (Descriptors::open): Check that the options are
8322         valid before using them.
8324 2009-03-18  Ian Lance Taylor  <iant@google.com>
8326         * script-sections.h: Include <list>.
8327         (class Script_sections): Change Sections_elements from std::vector
8328         to std::list.  Typedef public Elements_iterator.  Add
8329         orphan_section_placement_, data_segment_align_start_, and
8330         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8331         field.
8332         * script-sections.cc (class Orphan_section_placement): New class.
8333         (class Sections_element): Add virtual functions is_relro and
8334         orphan_section_init.  Remove virtual function place_orphan_here.
8335         (class Output_section_definition): Add is_relro and
8336         orphan_section_init.  Remove place_orphan_here.
8337         (class Orphan_output_section): Likewise.
8338         (Script_sections::Script_sections): Update for field changes.
8339         (Script_sections::data_segment_align): Set saw_data_segment_align_
8340         and data_segment_align_start_, not data_segment_align_index.
8341         (Script_sections::data_segment_relro_end): Check
8342         saw_data_segment_align_.  Use data_segment_align_start_ rather
8343         than data_segment_align_index_.
8344         (Script_sections::place_orphan): Rewrite to use
8345         Orphan_section_placement.
8347 2009-03-17  Ian Lance Taylor  <iant@google.com>
8349         * archive.cc (Archive::add_symbols): Check for a version attached
8350         to the symbol name in the archive map.
8351         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8352         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8353         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8354         (ver_test_11.a): New target.
8355         * testsuite/Makefile.in: Rebuild.
8357         * configure.ac: Check for chsize and posix_fallocate.  Replace
8358         ftruncate.
8359         * ftruncate.c: New file, from gnulib.
8360         * output.cc (posix_fallocate): Define dummy version if not
8361         HAVE_POSIX_FALLOCATE.
8362         (Output_file::map): Call posix_fallocate rather than lseek and
8363         write.
8364         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8365         * configure, Makefile.in, config.in: Rebuild.
8367 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8369         * layout.h (Layout::create_note): Add section_name parameter.
8370         * layout.cc (Layout::create_note): Likewise.
8371         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8373 2009-03-17  Ian Lance Taylor  <iant@google.com>
8375         * descriptors.cc: Include "options.h".
8376         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8377         (Descriptors::open): Always use O_CLOEXEC when opening a new
8378         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8379         then set FD_CLOEXEC.
8381         * sparc.cc (class Target_sparc): Add has_got_section.
8382         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8383         make sure we have a GOT section.
8385         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8386         (Target_sparc::Scan::local): Likewise.
8387         (Target_sparc::Scan::global): Likewise.
8388         (Target_sparc::Relocate::relocate): Likewise.
8389         (Target_sparc::Relocate::relocate_tls): Likewise.
8391         * symtab.cc (Symbol_table::define_default_version): New function,
8392         broken out of add_from_object.
8393         (Symbol_table::add_from_object): Call define_default_version.
8394         (Symbol_table::define_special_symbol): Add resolve_oldsym
8395         parameter.  Change all callers.  If the version for a symbol comes
8396         from a version script, resolve it with the symbol with the same
8397         name with no version.  Also add the symbol without a version if
8398         appropriate.
8399         (do_define_in_output_data): If resolving with oldsym, don't delete
8400         sym.
8401         (do_define_in_output_segment): Likewise.
8402         (do_define_as_constant): Likewise.
8403         * symtab.h (class Symbol_table): Update declarations.
8405 2009-03-13  Ian Lance Taylor  <iant@google.com>
8407         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8408         (Read_symbols::requeue): New function.
8409         (Read_symbols::do_read_symbols): If make_elf_object fails because
8410         the target type is not configured, and the file was searched for,
8411         issue a warning and retry with the next directory.
8412         (Add_symbols::run): If the file has an incompatible format, and
8413         it was searched for, requeue the Read_symbols task.  On error,
8414         release the object.
8415         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8416         dirindex parameter to constructor.  Change all callers.  Declare
8417         incompatible_warning and requeue.
8418         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8419         input_argument_ and input_group_ fields.  Add them to
8420         constructor.  Change all callers.
8421         (class Read_script): Add dirindex_ field.  Add it to constructor.
8422         Change all callers.
8423         * archive.cc (Archive::setup): Remove input_objects parameter.
8424         Change all callers.
8425         (Archive::get_file_and_offset): Likewise.
8426         (Archive::read_all_symbols): Likewise.
8427         (Archive::read_symbols): Likewise.
8428         (Archive::get_elf_object_for_member): Remove input_objects
8429         parameter.  Add punconfigured parameter.  Change all callers.
8430         (Archive::add_symbols): Change return type to bool.  Check return
8431         value of include_member.
8432         (Archive::include_all_members): Likewise.
8433         (Archive::include_member): Change return type to bool.  Return
8434         false if first included object has incompatible target.  Set
8435         included_member_ field.
8436         (Add_archive_symbols::run): If add_symbols returns false, requeue
8437         Read_symbols task.
8438         * archive.h (class Archive): Add included_member_ field.
8439         Initialize it in constructor.  Add input_file and searched_for
8440         methods.  Update declarations.
8441         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8442         input_argument_ fields.  Add them to constructor.  Change all
8443         callers.
8444         * script.cc: Include "target-select.h".
8445         (class Parser_closure): Add skip_on_incompatible_target_ and
8446         found_incompatible_target_ fields.  Add
8447         skip_on_incompatible_target parameter to constructor.  Change all
8448         callers.  Add methods skip_on_incompatible_target,
8449         clear_skip_on_incompatible_target, found_incompatible_target, and
8450         set_found_incompatible_target.
8451         (read_input_script): Add dirindex parameter.  Change all callers.
8452         If parser finds an incompatible target, requeue Read_symbols
8453         task.
8454         (script_set_symbol): Clear skip_on_incompatible_target in
8455         closure.
8456         (script_add_assertion, script_parse_option): Likewise.
8457         (script_start_sections, script_add_phdr): Likewise.
8458         (script_check_output_format): New function.
8459         * script.h (read_input_script): Update declaration.
8460         * script-c.h (script_check_output_format): Declare.
8461         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8462         (ignore_cmd): Remove OUTPUT_FORMAT.
8463         * fileread.cc (Input_file::Input_file): Add explicit this.
8464         (Input_file::will_search_for): New function.
8465         (Input_file::open): Add pindex parameter.  Change all callers.
8466         * fileread.h (class Input_file): Add input_file_argument method.
8467         Declare will_search_for.  Update declarations.
8468         * object.cc (make_elf_object): Add punconfigured parameter.
8469         Change all callers.
8470         * object.h (class Object): Make input_file public.  Add
8471         searched_for method.
8472         (make_elf_object): Update declaration.
8473         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8474         restart search.
8475         * dirsearch.h (class Dirsearch): Update declaration.
8476         * options.h (class General_options): Add --warn-search-mismatch.
8477         * parameters.cc (Parameters::is_compatible_target): New function.
8478         * parameters.h (class Parameters): Declare is_compatible_target.
8479         * workqueue.cc (Workqueue::add_blocker): New function.
8480         * workqueue.h (class Workqueue): Declare add_blocker.
8482         * fileread.cc (Input_file::open): Remove options parameter.
8483         Change all callers.
8484         (Input_file::open_binary): Likewise.
8485         * script.cc (read_input_script): Likewise.
8486         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8487         options parameter from constructor.  Change all callers.
8488         (class Read_script): Likewise.
8489         * fileread.h (class Input_file): Update declarations.
8490         * script.h (read_input_script): Update declaration.
8492 2009-03-10  Nick Clifton  <nickc@redhat.com>
8494         * po/es.po: New Spanish translation.
8496 2009-03-06  Cary Coutant  <ccoutant@google.com>
8498         * options.cc (parse_short_option): Keep dash_z from registering itself.
8500 2009-03-03  Ian Lance Taylor  <iant@google.com>
8502         PR 9918
8503         * target-reloc.h (relocate_section): Pass output_section to
8504         relocate.
8505         * i386.cc (Target_i386::should_apply_static_reloc): Add
8506         output_section parameter.  Change all callers.
8507         (Target_i386::Relocate::relocate): Add output_section parameter.
8508         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8509         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8510         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8511         * testsuite/two_file_shared.sh: New script.
8512         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8513         (check_DATA): Add two_file_shared.dbg.
8514         (two_file_shared.dbg): New target.
8515         * testsuite/Makefile.in: Rebuild.
8517 2009-03-01  Ian Lance Taylor  <iant@google.com>
8519         * configure.ac: Check for byteswap.h.
8520         * configure: Rebuild.
8521         * config.in: Rebuild.
8523 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8525         * layout.cc (Layout::find_or_add_kept_section): New function.
8526         (Layout::add_comdat): Removed.
8527         * layout.h (struct Kept_section): Move out of class Layout.
8528         Remove trailing underscores from field names.  Add group_sections
8529         field.  Rename group_ field to is_group.  Change all uses.
8530         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8531         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8532         comdat_groups_ field.
8533         (Sized_relobj::include_section_group): Use
8534         find_or_add_kept_section and Kept_section::group_sections.
8535         (Sized_relobj::include_linkonce_section): Likewise.
8536         * object.cc (class Sized_relobj): Don't define Comdat_group or
8537         Comdat_group_table.  Remove find_comdat_group and
8538         add_comdat_group.  Remove comdat_groups_ field.
8539         * plugin.cc (include_comdat_group): Use
8540         Layout::find_or_add_kept_section.
8542 2009-02-28  Ian Lance Taylor  <iant@google.com>
8544         * README: --gc-sections and map files are now supported.  Document
8545         some build requirements.
8547         PR 6992
8548         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8549         relocatable link set the value of the section symbol to zero.
8550         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8551         relocatable link don't include the section address in the local
8552         symbol value.
8554 2009-02-27  Ian Lance Taylor  <iant@google.com>
8556         PR 6811
8557         * options.h (class Search_directory): Add is_system_directory.
8558         (class General_options): Declare is_in_system_directory.
8559         * options.cc (get_relative_sysroot): Make static.
8560         (get_default_sysroot): Make static.
8561         (General_optoins::is_in_system_directory): New function.
8562         * fileread.cc (Input_file::is_in_system_directory): New function.
8563         * fileread.h (class Input_file): Declare is_in_system_directory.
8564         * object.h (class Object): Add is_in_system_directory.
8565         (class Input_objects): Remove system_library_directory_ field.
8566         * object.cc (Input_objects::add_object): Don't set
8567         system_library_directory_.
8568         (input_objects::found_in_system_library_directory): Remove.
8569         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8570         parameter.  Change all callers.
8571         (Symbol_table::sized_write_globals): Likewise.
8572         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8573         Call Object::is_in_system_directory.
8574         * symtab.h (class Symbol_table): Update declarations.
8576         PR 5990
8577         * descriptors.h (Open_descriptor): Add is_on_stack field.
8578         * descriptors.cc (Descriptors::open): If the descriptor is on the
8579         top of the stack, remove it.  Initialize is_on_stack field.
8580         (Descriptors::release): Only add pod to stack if it is not on the
8581         stack already.
8582         (Descriptors::close_some_descriptor): Clear stack_next and
8583         is_on_stack fields.
8585         PR 7091
8586         * output.cc (Output_section::find_starting_output_address): Rename
8587         from starting_output_address; add PADDR parameter; change return
8588         type.
8589         * output.h (class Output_section): Declare
8590         find_starting_output_address instead of starting_output_address.
8591         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8592         section symbol for which we can't find a merge section.
8594         PR 9836
8595         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8596         hidden or internal, force the symbol to be local.
8597         * resolve.cc (Symbol::override_visibility): Define.
8598         (Symbol::override_base): Use override_visibility.
8599         (Symbol_table::resolve): Likewise.
8600         (Symbol::override_base_with_special): Likewise.
8601         (Symbol_table::override_with_special): If the visibility is hidden
8602         or internal, force the symbol to be local.
8603         * symtab.h (class Symbol): Add set_visibility and
8604         override_visibility.
8605         * testsuite/ver_test_1.sh: New file.
8606         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8607         (check_DATA): Add ver_test_1.syms.
8608         (ver_test_1.syms): New target.
8609         * testsuite/Makefile.in: Rebuild.
8611 2009-02-25  Cary Coutant  <ccoutant@google.com>
8613         * layout.cc (Layout::choose_output_section): Don't rename sections
8614         when using a linker script that has a SECTIONS clause.
8615         * Makefile.in: Regenerate.
8617         * testsuite/Makefile.am (script_test_5.sh): New test case.
8618         * testsuite/Makefile.in: Regenerate.
8619         * testsuite/script_test_5.cc: New file.
8620         * testsuite/script_test_5.sh: New file.
8621         * testsuite/script_test_5.t: New file.
8623 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8625         * archive.cc (Archive::include_member): Update calls to add_symbols.
8626         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8627         the Layout argument.
8628         * dynobj.h (do_add_symbols): Add the Layout argument.
8629         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8630         Layout argument.
8631         * object.h (Object::add_symbols): Add the Layout argument.
8632         (Object::do_add_symbols): Add the Layout argument.
8633         (Sized_relobj::do_add_symbols): Add the Layout argument.
8634         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8635         Unify the two versions.
8636         (Add_plugin_symbols): Remove.
8637         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8638         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8639         (Add_plugin_symbols): Remove.
8640         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8641         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8642         (Add_symbols::run): Make it work with Pulginobj.
8644 2009-02-06  Ian Lance Taylor  <iant@google.com>
8646         * object.cc (Sized_relobj::do_layout): Make info message start
8647         with lower case letter.
8649 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8651         * binary.cc: Fix file comment.
8653         * options.h (enum Incremental_disposition): Define.
8654         (class General_options): Add new options: --incremental,
8655         --incremental_changed, --incremental_unchanged,
8656         --incremental_unknown.  Add incremental_disposition_ and
8657         implicit_incremental_ fields.
8658         (General_options::incremental_disposition): New function.
8659         (class Position_dependent_options): Add incremental_disposition
8660         option.
8661         (Position_dependent_options::copy_from_options): Set incremental
8662         dispositions.
8663         * options.cc (General_options::parse_incremental_changed): New
8664         function.
8665         (General_options::parse_incremental_unchanged): New function.
8666         (General_options::parse_incremental_unknown): New function.
8667         (General_options::General_options): Initialize new fields
8668         incremental_disposition_ and implicit_incremental_.
8669         (General_options::finalize): Check for uasge of --incremental-*
8670         without --incremental.
8672 2009-02-06  Chris Demetriou  <cgd@google.com>
8674         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8675         pointer and to report location as the file name associated with
8676         the symbol.
8677         (gold_undefined_symbol_at_location): New function to replace the
8678         old gold_undefined_symbol functionality.
8679         * target-reloc.h (relocate_section): Update to use
8680         gold_undefined_symbol_at_location.
8681         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8682         Call gold_undefined_symbol function rather than gold_error.
8683         * errors.h (Errors::undefined_symbol): Take location as a
8684         string, rather than calculating it from a relocation.
8685         * errors.cc (Errors::fatal): Print "fatal error:" before the
8686         formatted message.
8687         (Errors::error, Errors::error_at_location): Print "error: "
8688         before the formatted message.
8689         (Errors::undefined_symbol): Take location as a string, rather
8690         than calculating it from a relocation.
8691         (gold_undefined_symbol_at_location): New function akin to
8692         old gold_undefined_symbol, calculates location from relocation.
8693         (gold_undefined_symbol): Change to take only a Symbol pointer
8694         and to report location as the file name associated with the symbol.
8695         * testsuite/debug_msg.sh: Update for changed error messages.
8696         * testsuite/undef_symbol.sh: Likewise.
8698 2009-02-04  Duncan Sands  <baldrick@free.fr>
8700         PR 9812
8701         * reduced_debug_output.h
8702         (Output_reduced_debug_abbrev_section::failed): Use format for
8703         gold_warning.
8704         (Output_reduced_debug_info_section::faild): Likewise.
8706 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8708         * script.cc (Lazy_demangler): New class.
8709         (Version_script_info::get_symbol_version_helper): Demangle a
8710         symbol only once.
8712 2009-01-29  Cary Coutant  <ccoutant@google.com>
8714         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8715         to __tls_get_addr.
8716         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8718 2009-01-28  Ian Lance Taylor  <iant@google.com>
8720         * version.cc (version_string): Bump to 1.9.
8722         * gold.h: Include <cstring> and <stdint.h>.
8723         * version.cc: Include <cstdio>.
8724         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8725         warning.
8726         * reduced_debug_output.cc (insert_into_vector): Rename from
8727         Insert_into_vector; change all callers.  Use Swap_unaligned to
8728         avoid aliasing issue; remove union since it is unnecessary.
8730 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8732         * Makefile.am (CCFILES): Add gc.cc.
8733         (HFILES): Add gc.h.
8734         * Makefile.in: Regenerate.
8735         * gold.cc (Gc_runner): New class.
8736         (queue_initial_tasks): Call garbage collection related tasks
8737         when corresponding options are invoked.
8738         (queue_middle_gc_tasks): New function.
8739         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8740         processed early before laying out sections during garbage collection.
8741         * gold.h (queue_middle_gc_tasks): New function.
8742         (is_prefix_of): Move from "layout.cc".
8743         * i386.cc (Target_i386::gc_process_relocs): New function.
8744         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8745         * main.cc (main): Create object of class "Garbage_collection".
8746         * object.cc (Relobj::copy_symbols_data): New function.
8747         (Relobj::is_section_name_included): New function.
8748         (Sized_relobj::do_layout): Allow this function to be called twice
8749         during garbage collection and defer layout of section during the
8750         first call.
8751         * object.h (Relobj::get_symbols_data): New function.
8752         (Relobj::is_section_name_included): New function.
8753         (Relobj::copy_symbols_data): New function.
8754         (Relobj::set_symbols_data): New function.
8755         (Relobj::get_relocs_data): New function.
8756         (Relobj::set_relocs_data): New function.
8757         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8758         (Relobj::gc_process_relocs): New function.
8759         (Relobj::do_gc_process_relocs): New pure virtual function.
8760         (Relobj::sd_): New data member.
8761         (Sized_relobj::is_output_section_offset_invalid): New function.
8762         (Sized_relobj::do_gc_process_relocs): New function.
8763         * options.h (General_options::gc_sections): Modify to not be a no-op.
8764         (General_options::print_gc_sections): New option.
8765         * plugin.cc (Plugin_finish::run): Remove function call to
8766         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8767         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8768         * reloc.cc (Read_relocs::run): Add task to process relocs and
8769         determine unreferenced sections when doing garbage collection.
8770         (Gc_process_relocs): New class.
8771         (Sized_relobj::do_gc_process_relocs): New function.
8772         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8773         sections that are garbage collected.
8774         * reloc.h (Gc_process_relocs): New class.
8775         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8776         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8777         symbols whose corresponding sections are garbage collected.
8778         (Symbol_table::Symbol_table): Add new parameter for the garbage
8779         collection object.
8780         (Symbol_table::gc_mark_undef_symbols): New function.
8781         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8782         (Symbol_table::gc_mark_dyn_syms): New function.
8783         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8784         as garbage.
8785         (Symbol_table::add_from_object): Likewise.
8786         (Symbol_table::add_from_relobj): When building shared objects, do not
8787         treat externally visible symbols as garbage.
8788         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8789         table information for static and relocatable links.
8790         * symtab.h (Symbol_table::set_gc): New function.
8791         (Symbol_table::gc): New function.
8792         (Symbol_table::gc_mark_undef_symbols): New function.
8793         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8794         (Symbol_table::gc_mark_dyn_syms): New function.
8795         (Symbol_table::gc_): New data member.
8796         * target.h (Sized_target::gc_process_relocs): New pure virtual
8797         function.
8798         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8799         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8801 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8803         * options.h (General_options::gc_sections): Define as a no-op for now.
8804         (General_options::no_keep_memory): Ditto.
8805         (General_options::Bshareable): Define.
8806         * options.cc (General_options::finalize): Honor -Bshareable.
8808 2009-01-20  Andreas Schwab  <schwab@suse.de>
8810         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8811         read the value in the contents, since we don't use it.  Use the
8812         template endianness when writing.
8813         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8815 2009-01-19  Andreas Schwab  <schwab@suse.de>
8817         * configure.tgt (powerpc64-*): Fix targ_obj.
8819 2009-01-15  Ian Lance Taylor  <iant@google.com>
8821         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8822         local symbols when stripping all symbols.
8824 2009-01-14  Cary Coutant  <ccoutant@google.com>
8826         * output.cc (Output_reloc): Add explicit instantiations.
8828 2009-01-14  Cary Coutant  <ccoutant@google.com>
8830         * archive.cc (Archive::get_elf_object_for_member): Remove call
8831         to File_read::claim_for_plugin.
8832         * descriptors.cc (Descriptors::open): Remove reference to
8833         is_claimed.
8834         (Descriptors::claim_for_plugin): Remove.
8835         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8836         (Descriptors::is_claimed): Remove.
8837         (claim_descriptor_for_plugin): Remove.
8838         * fileread.cc (File_read::claim_for_plugin): Remove.
8839         * fileread.h (File_read::claim_for_plugin): Remove.
8840         (File_read::descriptor): Reopen descriptor if necessary.
8841         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8842         (Plugin_manager::all_symbols_read): Add task parameter. Change
8843         all callers.
8844         (Plugin_manager::get_input_file): New function.
8845         (Plugin_manager::release_input_file): New function.
8846         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8847         corresponding data member.
8848         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8849         and pass to base constructor. Change all callers.
8850         (get_input_file, release_input_file): New functions.
8851         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8852         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8853         (Plugin_manager::all_symbols_read): Add task parameter.
8854         (Plugin_manager::get_input_file): New function.
8855         (Plugin_manager::release_input_file): New function.
8856         (Plugin_manager::task_): New data member.
8857         (Pluginobj::Pluginobj): Add filesize parameter.
8858         (Pluginobj::filename): New function.
8859         (Pluginobj::descriptor): New function.
8860         (Pluginobj::filesize): New function.
8861         (Pluginobj::filesize_): New data member.
8862         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8863         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8864         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8866         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8867         with archive libraries.
8868         * testsuite/Makefile.in: Regenerate.
8869         * testsuite/plugin_test.c (struct sym_info): New type.
8870         (get_input_file, release_input_file): New static variables.
8871         (onload): Capture new transfer vector entries.
8872         (claim_file_hook): Stop reading at end of file according to filesize.
8873         Factor out parsing of readelf output into separate function.
8874         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8875         APIs and get the source file name from the symbol table.  Convert
8876         source file name to corresponding object file name.  Print info
8877         message when adding new input files.
8878         (parse_readelf_line): New function.
8879         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8880         * testsuite/plugin_test_2.sh: Likewise.
8881         * testsuite/plugin_test_3.sh: Likewise.
8882         * testsuite/plugin_test_4.sh: New test case.
8884 2009-01-07  Ian Lance Taylor  <iant@google.com>
8886         * version.cc (version_string): Bump to 1.8.
8888 2008-12-23  Cary Coutant  <ccoutant@google.com>
8890         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8891         * plugin.cc (Plugin_manager::finish): Rename as
8892         layout_deferred_objects.  Move cleanup to separate function.
8893         (Plugin_manager::cleanup): New function.
8894         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8895         separately.
8896         * plugin.h (Plugin_manager::finish): Rename as
8897         layout_deferred_objects.
8898         (Plugin_manager::cleanup): New function.
8899         (Plugin_manager::cleanup_done): New field.
8901 2008-12-23  Cary Coutant  <ccoutant@google.com>
8903         * plugin.cc (is_visible_from_outside): New function.
8904         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8905         so we don't return "IR only" status for exported symbols or -r links.
8907         * testsuite/Makefile.am (plugin_test_3): New test case.
8908         * testsuite/Makefile.in: Regenerate.
8909         * testsuite/plugin_test_3.sh: New file.
8911 2008-12-22  Cary Coutant  <ccoutant@google.com>
8913         * object.cc (Sized_relobj::layout_section): New function.
8914         (Sized_relobj::do_layout): Defer layout of input sections until after
8915         plugin has provided replacement files.
8916         (Sized_relobj::do_layout_deferred_sections): New function.
8917         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8918         (Relobj::layout_deferred_sections): New function.
8919         (Relobj::do_layout_deferred_sections): New function.
8920         (Sized_relobj::do_layout_deferred_sections): New function.
8921         (Sized_relobj::layout_section): New function.
8922         (Sized_relobj::Deferred_layout): New structure.
8923         (Sized_relobj::deferred_layout_): New field.
8924         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8925         Change all callers.  Layout deferred sections.
8926         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8927         references.
8928         (Plugin_hook::run): Move code from do_plugin_hook inline.
8929         (Plugin_hook::do_plugin_hook): Remove.
8930         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8931         (Plugin_manager::finish): Renamed, was cleanup.
8932         (Plugin_manager::should_defer_layout): New function.
8933         (Plugin_manager::add_deferred_layout_object): New function.
8934         (Plugin_manager::Deferred_layout_list): New type.
8935         (Plugin_manager::deferred_layout_objects_): New field.
8936         (Plugin_hook::do_plugin_hook): Remove.
8938 2008-12-17  Ian Lance Taylor  <iant@google.com>
8940         * options.h (class General_options): Add --no case for
8941         --export-dynamic.
8943 2008-12-16  Cary Coutant  <ccoutant@google.com>
8945         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8946         vector.
8947         (Plugin_manager::claim_file): Create plugin object even if
8948         plugin did not call the add_symbols callback.
8949         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8950         asking for more symbols than were added.
8951         * testsuite/Makefile.am (plugin_test_1): Add test case with
8952         no global symbols.
8953         (empty.syms): New target.
8954         * testsuite/Makefile.in: Regenerate.
8955         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8956         message. Don't call add_symbols if no globals.
8957         (all_symbols_read_hook): Don't provide replacement for empty
8958         claimed file.
8960 2008-12-12  Ian Lance Taylor  <iant@google.com>
8962         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8963         r_type == 0 for a local symbol with r_sym == 0.
8964         (scan_relocatable_relocs): Pass r_sym to
8965         local_non_section_strategy.
8966         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8967         r_sym parameter.
8969         * configure.ac: Update test for TLS descriptors: they are
8970         supported as of glibc 2.9.
8971         * configure: Rebuild.
8973 2008-12-11  Ian Lance Taylor  <iant@google.com>
8975         PR 7091
8976         * target-reloc.h (Default_scan_relocatable_relocs): For each
8977         function, map r_type == 0 to RELOC_DISCARD.
8979 2008-12-10  Cary Coutant  <ccoutant@google.com>
8981         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8982         object to override a kept COMDAT group from a plugin object.
8984 2008-12-09  Ian Lance Taylor  <iant@google.com>
8986         PR 7088
8987         * yyscript.y (file_cmd): Handle INPUT.
8989         * testsuite/initpri1.c: Change all declarations to be full
8990         prototypes by adding void, to avoid compiler warnings.
8992 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8994         * options.cc (General_options::parse_plugin_opt): New.
8995         (General_options::add_plugin): The argument now is just the filename.
8996         (General_options::add_plugin_option): New.
8997         * options.h (plugin_opt): New.
8998         (add_plugin): Change argument name.
8999         (add_plugin_option): New.
9000         * plugin.cc (Plugin::load): Don't parse the plugin option.
9001         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9002         (Plugin::add_option): New.
9003         (Plugin::args_): Change type.
9004         (Plugin::filename_): New.
9005         (Plugin_manager::add_plugin_option): New.
9006         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9007         * testsuite/Makefile.in: Regenerate.
9009 2008-12-05  Cary Coutant  <ccoutant@google.com>
9011         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9012         Handle --strip-lto-sections option.
9013         * options.h (strip_lto_sections): New option.
9015 2008-12-01  Cary Coutant  <ccoutant@google.com>
9017         * plugin.cc (ld_plugin_message): Change format parameter to const.
9018         Fix mismatch between new[] and delete.
9020 2008-11-14  Cary Coutant  <ccoutant@google.com>
9022         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9023         instead of -1U.
9025 2008-11-05  Craig Silverstein  <csilvers@google.com>
9027         * options.cc (General_options::parse_dynamic_list): New function.
9028         * options.h (General_options): New flags dynamic_list,
9029         dynamic_list_data, dynamic_list_cpp_new, and
9030         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9031         (General_options::in_dynamic_list): New function.
9032         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9033         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9034         (Lex::can_continue_name): Likewise.
9035         (yylex): Likewise.
9036         (read_script_file): New parameter script_options.
9037         (read_dynamic_list): New function.
9038         (Script_options::define_dynamic_list): New function.
9039         (dynamic_list_keyword_parsecodes): New variable.
9040         (dynamic_list_keywords): New variable.
9041         * script.h (Script_options::define_dynamic_list): New function
9042         prototype.
9043         (read_dynamic_list): New function prototype.
9044         * symtab.cc (strprefix): New macro.
9045         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9046         dynamic_list_data, dynamic_list_cpp_new, and
9047         dynamic_list_cpp_typeinfo.
9048         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9049         (dynamic_list_expr): New rule.
9050         (dynamic_list_nodes): Likewise.
9051         (dynamic_list_node): Likewise.
9052         * testsuite/Makefile.am (dynamic_list): New test.
9053         * testsuite/Makefile.in: Regenerated.
9054         * testsuite/dynamic_list.t: New file.
9055         * testsuite/dynamic_list.sh: New file.
9057 2008-11-05  Craig Silverstein  <csilvers@google.com>
9059         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9060         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9061         (t11_last): Likewise.
9062         * testsuite/ver_test_6.c (main): Likewise.
9064 2008-10-07  Cary Coutant  <ccoutant@google.com>
9066         * options.c (General_options::finalize): Add check for -static and
9067         -shared.
9068         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9069         is not empty.
9071 2008-10-02  Cary Coutant  <ccoutant@google.com>
9073         * plugin.cc (make_sized_plugin_object): Fix conditional
9074         compilation to work when not all targets are enabled.
9076 2008-09-29  Cary Coutant  <ccoutant@google.com>
9078         * archive.cc (Archive::get_file_and_offset): Use filename instead
9079         of name to get library path.
9080         (Archive::include_member): Unlock external member of a thin archive.
9082         * testsuite/Makefile.am (TEST_AR): New variable.
9083         (thin_archive_test_1): New test.
9084         (thin_archive_test_2): New test.
9085         * testsuite/Makefile.in: Regenerate.
9086         * testsuite/thin_archive_main.cc: New file.
9087         * testsuite/thin_archive_test_1.cc: New file.
9088         * testsuite/thin_archive_test_2.cc: New file.
9089         * testsuite/thin_archive_test_3.cc: New file.
9090         * testsuite/thin_archive_test_4.cc: New file.
9092 2008-09-29  Cary Coutant  <ccoutant@google.com>
9094         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9095         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9096         instead of -1U.
9097         (Sized_relobj::do_finalize_local_symbols): Likewise.
9098         (Sized_relobj::map_to_kept_section): Likewise.
9099         * object.h (Sized_relobj::invalid_address): New constant.
9100         (Sized_relobj::do_output_section_offset): Check for invalid_address
9101         and return -1ULL.
9102         * output.cc (Output_reloc::local_section_offset): Use constant
9103         invalid_address instead of -1U.
9104         (Output_reloc::get_address): Likewise.
9105         (Output_section::output_address): Change -1U to -1ULL.
9106         * output.h (Output_reloc::invalid_address): New constant.
9107         * reloc.cc (Sized_relobj::write_sections): Use constant
9108         invalid_address instead of -1U.
9109         (Sized_relobj::relocate_sections): Likewise.
9110         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9111         values for merge sections.
9112         * target-reloc.h (relocate_for_relocatable): Use constant
9113         invalid_address instead of -1U.
9115 2008-09-19  Cary Coutant  <ccoutant@google.com>
9117         Add plugin functionality for link-time optimization (LTO).
9118         * configure.ac (plugins): Add --enable-plugins option.
9119         * configure: Regenerate.
9120         * config.in: Regenerate.
9121         * Makefile.am (LIBDL): New variable.
9122         (CCFILES): Add plugin.cc.
9123         (HFILES): Add plugin.h.
9124         (ldadd_var): Add LIBDL.
9125         * Makefile.in: Regenerate.
9127         * archive.cc: Include "plugin.h".
9128         (Archive::setup): Don't preread archive symbols when using a plugin.
9129         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9130         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9131         files.
9132         (Archive::include_member): Add symbols from plugin objects.
9133         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9134         * descriptors.cc (Descriptors::open): Check for file descriptors
9135         abandoned by plugins.
9136         (Descriptors::claim_for_plugin): New function.
9137         * descriptors.h (Descriptors::claim_for_plugin): New function.
9138         (Open_descriptor::is_claimed): New field.
9139         (claim_descriptor_for_plugin): New function.
9140         * fileread.cc (File_read::claim_for_plugin): New function.
9141         * fileread.h (File_read::claim_for_plugin): New function.
9142         (File_read::descriptor): New function.
9143         * gold.cc: Include "plugin.h".
9144         (queue_initial_tasks): Add task to call plugin hooks for generating
9145         new object files.
9146         * main.cc: Include "plugin.h".
9147         (main): Load plugin libraries.
9148         * object.h (Pluginobj): Declare.
9149         (Object::pluginobj): New function.
9150         (Object::do_pluginobj): New function.
9151         (Object::set_target): New function.
9152         * options.cc: Include "plugin.h".
9153         (General_options::parse_plugin): New function.
9154         (General_options::General_options): Initialize plugins_ field.
9155         (General_options::add_plugin): New function.
9156         * options.h (Plugin_manager): Declare.
9157         (General_options): Add --plugin option.
9158         (General_options::has_plugins): New function.
9159         (General_options::plugins): New function.
9160         (General_options::add_plugin): New function.
9161         (General_options::plugins_): New field.
9162         * plugin.cc: New file.
9163         * plugin.h: New file.
9164         * readsyms.cc: Include "plugin.h".
9165         (Read_symbols::do_read_symbols): Check for archive before checking
9166         for ELF file.  Call plugin hooks to claim files.
9167         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9168         from a real object file; force override when processing replacement
9169         files.
9170         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9171         (Symbol::init_base_object): Likewise.
9172         (Symbol::init_base_output_data): Likewise.
9173         (Symbol::init_base_output_segment): Likewise.
9174         (Symbol::init_base_constant): Likewise.
9175         (Symbol::init_base_undefined): Likewise.
9176         (Symbol::output_section): Assert that object is not a plugin.
9177         (Symbol_table::add_from_pluginobj): New function.
9178         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9179         undefined.
9180         (Symbol_table::sized_write_globals): Likewise.
9181         (Symbol_table::add_from_pluginobj): Instantiate template.
9182         * symtab.h (Sized_pluginobj): Declare.
9183         (Symbol::in_real_elf): New function.
9184         (Symbol::set_in_real_elf): New function.
9185         (Symbol::in_real_elf_): New field.
9186         (Symbol_table::add_from_pluginobj): New function.
9188         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9189         (LIBDL): New variable.
9190         (LDADD): Add LIBDL.
9191         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9192         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9193         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9194         (MOSTLYCLEANFILES): Likewise.
9195         * testsuite/Makefile.in: Regenerate.
9196         * testsuite/plugin_test.c: New file.
9197         * testsuite/plugin_test_1.sh: New file.
9198         * testsuite/plugin_test_2.sh: New file.
9200 2008-09-16  Ian Lance Taylor  <iant@google.com>
9202         * target-reloc.h (relocate_section): Check whether a symbol is
9203         defined by the ABI before reporting an undefined symbol error.
9204         * target.h (Target::is_defined_by_abi): Make parameter const.
9205         (Target::do_is_defined_by_abi): Likewise.
9206         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9207         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9208         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9209         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9210         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9211         * testsuite/Makefile.in: Rebuild.
9213         * fileread.cc (make_view): Add casts to avoid warning.
9215 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9217         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9218         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9220 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9222         * options.h (General_options::output_is_executable): New.
9223         (General_options::output_is_pie): New.
9224         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9225         for shared libraries.
9226         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9228 2008-09-11  Chris Demetriou  <cgd@google.com>
9230         * options.h (origin): New -z option.
9231         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9232         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9233         in DT_FLAGS_1.
9235 2008-09-05  Cary Coutant  <ccoutant@google.com>
9237         * fileread.cc (File_read::make_view): Add check for attempt to map
9238         beyond end of file.
9240 2008-09-05  Cary Coutant  <ccoutant@google.com>
9242         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9243         explicit instantiations.
9245 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9247         PR gold/6858
9248         * options.cc (General_options::finalize): Allow undefined symbols
9249         in shlibs if linking -shared.
9251         PR gold/6859
9252         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9253         symbols as not needing a dynsym entry.
9255 2008-08-20  Craig Silverstein  <csilvers@google.com>
9257         * fileread.cc (File_read::open): Do not lock the file unless it
9258         was successfully opened.
9260 2008-08-14  Cary Coutant  <ccoutant@google.com>
9262         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9263         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9264         * testsuite/tls_test.cc (struct int128): 128-bit struct
9265         for testing TLS relocs with non-zero addend.
9266         (v12): New TLS variable.
9267         (t12): New test.
9268         (t_last): Add check for v12.
9269         * testsuite/tls_test.h (t12): New function.
9270         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9272 2008-08-13  Ian Lance Taylor  <iant@google.com>
9274         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9275         set tls_segment_ or relro_segment_.
9276         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9277         when appropriate.
9278         * output.h (Output_section::clear_is_relro): New function.
9279         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9280         sections specially even when output_data_ is empty.
9281         (Output_segment::maximum_alignment): When first section is relro,
9282         only force alignment for PT_LOAD segments.
9283         * script.cc (script_data_segment_align): New function.
9284         (script_data_segment_relro_end): New function.
9285         * script-c.h (script_data_segment_align): Declare.
9286         (script_data_segment_relro_end): Declare.
9287         * script-sections.h (class Script_sections): Declare
9288         data_segment_align and data_segment_relro_end.  Add fields
9289         segment_align_index_ and saw_relro_end_.
9290         * script-sections.cc (class Sections_element): Add set_is_relro
9291         virtual function.  Add new bool* parameter to place_orphan_here.
9292         Add get_output_section virtual function.
9293         (class Output_section_definition): Add set_is_relro.  Add new
9294         bool* parameter to place_orphan_here.  Add get_output_section.
9295         Add is_relro_ field.
9296         (Output_section_definition::Output_section_definition): Initialize
9297         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9298         and is_relro_ fields.
9299         (Output_section_definition::place_orphan_here): Add is_relro
9300         parameter.
9301         (Output_section_definition::set_section_addresses): Set relro for
9302         output section.
9303         (Output_section_definition::alternate_constraint): Likewise.
9304         (class Orphan_output_section): Add new bool* parameter to
9305         place_orphan_here.  Add get_output_section.
9306         (Orphan_output_section::place_orphan_here): Add is_relro
9307         parameter.
9308         (Script_sections::Script_sections): Initialize
9309         data_segment_align_index_ and saw_relro_end_.
9310         (Script_sections::data_segment_align): New function.
9311         (Script_sections::data_segment_relro_end): New function.
9312         (Script_sections::place_orphan): Set or clear is_relro.
9313         (Script_sections::set_section_addresses): Force alignment of first
9314         TLS section.
9315         * yyscript.y (exp): Call script_data_segment_align and
9316         script_data_segment_relro_end.
9317         * testsuite/relro_script_test.t: New file.
9318         * testsuite/relro_test.cc (using_script): Declare.
9319         (t1, t2): Test using_script.
9320         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9321         (relro_script_test_SOURCES): Define.
9322         (relro_script_test_DEPENDENCIES): Define.
9323         (relro_script_test_LDFLAGS): Define.
9324         (relro_script_test_LDADD): Define.
9325         (relro_script_test.so): New target.
9326         * testsuite/Makefile.in: Rebuild.
9328 2008-08-06  Cary Coutant <ccoutant@google.com>
9330         * archive.cc (Archive::total_archives, Archive::total_members)
9331         (Archive::total_members_loaded): New variables.
9332         (Archive::setup): Add parameter.  Add option to preread
9333         archive symbols.
9334         (Archive::read_armap): Add counter.
9335         (Archive::get_file_and_offset): New function.
9336         (Archive::get_elf_object_for_member): New function.
9337         (Archive::read_all_symbols): New function.
9338         (Archive::read_symbols): New function.
9339         (Archive::add_symbols): Add counters.
9340         (Archive::include_all_members): Use armap to find members if it's
9341         already built.
9342         (Archive::include_member): Skip reading symbols if already read.
9343         Factored code into Archive::get_file_and_offset and
9344         Archive::get_elf_object_for_member.  Changed call to
9345         Mapfile::report_include_archive_member.
9346         (Archive::print_stats): New function.
9347         * archive.h: Declare Object and Read_symbols_data classes.
9348         (Archive::Archive): Add initializers for new members.
9349         (Archive::setup): Add parameter.
9350         (Archive::print_stats): New function.
9351         (Archive::total_archives, Archive::total_members)
9352         (Archive::total_members_loaded): New variables.
9353         (Archive::get_file_and_offset): New function.
9354         (Archive::get_elf_object_for_member): New function.
9355         (Archive::read_all_symbols): New function.
9356         (Archive::read_symbols): New function.
9357         (Archive::Archive_member): New class.
9358         (Archive::members_): New member.
9359         (Archive::num_members_): New member.
9360         * main.cc: Include archive.h.
9361         (main): Call Archive::print_stats.
9362         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9363         archive parameter; member_name is now the fully-decorated name.
9364         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9365         * options.h: (General_options): Add --preread-archive-symbols option.
9366         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9367         Archive::setup.
9369 2008-08-04  Ian Lance Taylor  <iant@google.com>
9371         * symtab.h (Symbol::use_plt_offset): New function.
9372         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9373         * powerpc.cc (Relocate::relocate): Likewise.
9374         * sparc.cc (Relocate::relocate): Likewise.
9375         * x86_64.cc (Relocate::relocate): Likewise.
9376         * testsuite/weak_plt.sh: New test.
9377         * testsuite/weak_plt_main.cc: New test.
9378         * testsuite/weak_plt_shared.cc: New test.
9379         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9380         (check_PROGRAMS): Add weak_plt.
9381         (check_DATA): Add weak_plt_shared.so.
9382         (weak_plt_main_pic.o, weak_plt): New targets.
9383         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9384         * testsuite/Makefile.in: Rebuild.
9386         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9387         gcctestdir/ld.
9388         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9389         * testsuite/Makefile.in: Rebuild.
9391 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9393         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9394         * Makefile.in: Regenerate.
9395         * po/POTFILES.in: Regenerate.
9397 2008-07-29  Ian Lance Taylor  <iant@google.com>
9399         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9400         symbols before other symbols.
9401         * testsuite/script_test_2.cc (test_addr): Declare.
9402         (test_addr_alias): Declare.
9403         (main): Check that test_addr and test_addr_alias have the right
9404         values.
9405         * testsuite/script_test_2.t: Define test_addr_alias and
9406         test_addr.
9408 2008-07-24  Ian Lance Taylor  <iant@google.com>
9410         PR 5990
9411         * descriptors.cc: New file.
9412         * descriptors.h: New file.
9413         * gold-threads.h (class Hold_optional_lock): New class.
9414         * fileread.cc: Include "descriptors.h".
9415         (File_read::~File_read): Release descriptor rather than closing
9416         it.
9417         (File_read::open) [file]: Call open_descriptor rather than open.
9418         Set is_descriptor_opened_.
9419         (File_read::open) [memory]: Assert that descriptor is not open.
9420         (File_read::reopen_descriptor): New function.
9421         (File_read::release): Release descriptor.
9422         (File_read::do_read): Make non-const.  Reopen descriptor.
9423         (File_read::read): Make non-const.
9424         (File_read::make_view): Reopen descriptor.
9425         (File_read::do_readv): Likewise.
9426         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9427         Update declarations.
9428         * layout.cc: Include "descriptors.h".
9429         (Layout::create_build_id): Use open_descriptor rather than open.
9430         * output.cc: Include "descriptors.h".
9431         (Output_file::open): Use open_descriptor rather than open.
9432         * archive.cc (Archive::const_iterator): Change Archive to be
9433         non-const.
9434         (Archive::begin, Archive::end): Make non-const.
9435         (Archive::count_members): Likewise.
9436         * archive.h (class Archive): Update declarations.
9437         * object.h (Object::read): Make non-const.
9438         * Makefile.am (CCFILES): Add descriptors.cc.
9439         (HFILES): Add descriptors.h.
9440         * Makefile.in: Rebuild.
9442         PR 6716
9443         * gold.h: Always include <clocale>.  Add Solaris workarounds
9444         following code in binutils/sysdep.h.
9446         PR 6048
9447         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9448         this->eh_frame_hdr_ is NULL before using it.
9450         * dynobj.cc (Versions::Versions): Update comment.
9452         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9453         the base version name.
9455         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9456         array size plus one.
9457         (Stringpool_template::set_string_offsets): Subtract one from key
9458         before using it as an array index.
9459         (Stringpool_template::get_offset_with_length): Likewise.
9460         (Stringpool_template::write_to_buffer): Likewise.
9461         * stringpool.h (Stringpool_template::get_offset_from_key):
9462         Likewise.
9464 2008-07-23  Ian Lance Taylor  <iant@google.com>
9466         PR 6658
9467         * object.h (Merged_symbol_value::value): Do our best to handle a
9468         negative addend.
9470         PR 6647
9471         * script.cc (Version_script_info::get_versions): Don't add empty
9472         version tag to return value.
9473         (Version_script_info::get_symbol_version_helper): Change return
9474         type to bool.  Add pversion parameter.  Change all callers.
9475         (script_register_vers_node): Don't require a non-NULL tag.
9476         * script.h (class Version_script_info): Update declarations.
9477         (Version_script_info::get_symbol_version): Change return type to
9478         bool.  Add version parameter.  Change all callers.
9479         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9480         handling.  Handle an empty version from a version script.
9481         (Symbol_table::define_special_symbol): Likewise.
9482         * testsuite/ver_test_10.script: New file.
9483         * testsuite/ver_test_10.sh: New file.
9484         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9485         (check_DATA): Add ver_test_10.syms.
9486         (ver_test_10.syms, ver_test_10.so): New target.
9487         * testsuite/Makefile.in: Rebuild.
9489 2008-07-23  Simon Baldwin  <simonb@google.com>
9491         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9492         to zero for undefined symbols from dynamic libraries.
9494 2008-07-23  Ian Lance Taylor  <iant@google.com>
9496         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9497         Change all callers.
9498         * symtab.h (class Symbol_table): Update declaration.
9499         * testsuite/ver_test_9.cc: New file.
9500         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9501         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9502         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9503         (ver_test_9.so, ver_test_9.o): New targets.
9504         * testsuite/Makefile.in: Rebuild.
9506 2008-07-22  Ian Lance Taylor  <iant@google.com>
9508         * options.h (class General_options): Define --check-sections.
9509         * layout.cc (Layout::set_segment_offsets): Handle
9510         --check-sections.
9512         * options.h (class General_options): Define -n/--nmagic and
9513         -N/--omagic.
9514         * options.cc (General_options::finalize): For -n/--nmagic or
9515         -N/--omagic, set -static.
9516         * layout.cc (Layout::attach_allocated_section_to_segment): If
9517         -N/--omagic, don't put read-only and read-write sections in
9518         different segments.
9519         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9520         finding a read-only segment.
9521         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9522         don't set the minimum segment alignment to the common page size,
9523         and don't set the file offset to the address modulo the page size.
9524         * script-sections.cc (Script_sections::create_segments): If
9525         -n/--omagic, don't put read-only and read-write sections in
9526         different segments.
9528         * cref.cc: New file.
9529         * cref.h: New file.
9530         * options.h (class General_options): Add --print-symbol-counts.
9531         * main.cc (main): Issue defined symbol report if requested.
9532         * archive.cc (Archive::interpret_header): Make into a const member
9533         function.
9534         (Archive::add_symbols): Call Input_objects::archive_start and
9535         archive_stop.
9536         (Archive::const_iterator): Define new class.
9537         (Archive::begin, Archive::end): New functions.
9538         (Archive::include_all_members): Rewrite to use iterator.
9539         (Archive::count_members): New function.
9540         * archive.h (class Archive): Update declarations.
9541         (Archive::filename): New function.
9542         * object.cc: Include "cref.h".
9543         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9544         (Sized_relobj::do_get_global_symbol_counts): New function.
9545         (Input_objects::add_object): Add object to cross-referencer.
9546         (Input_objects::archive_start): New function.
9547         (Input_objects::archive_stop): New function.
9548         (Input_objects::print_symbol_counts): New function.
9549         * object.h: Declare Cref and Archive.
9550         (Object::get_global_symbol_counts): New function.
9551         (Object::do_get_global_symbol_counts): New pure virtual function.
9552         (class Sized_relobj): Add defined_count_ field.  Update
9553         declarations.
9554         (class Input_objects): Add cref_ field.  Update constructor.
9555         Update declarations.
9556         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9557         defined_count_.
9558         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9559         symbol counts.
9560         (Sized_dynobj::do_get_global_symbol_counts): New function.
9561         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9562         defined_count_.  Update declarations.  Define Symbols typedef.
9563         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9564         parameter.  Change all callers.
9565         (Symbol_table::add_from_dynobj): Add sympointers and defined
9566         parameters.  Change all callers.
9567         * symtab.h (class Symbol_table): Update declarations.
9568         * Makefile.am (CCFILES): Add cref.cc.
9569         (HFILES): Add cref.h.
9570         * Makefile.in: Rebuild.
9572 2008-07-22  Simon Baldwin  <simonb@google.com>
9574         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9575         to zero when writing undefined symbols.
9577 2008-07-22  Ian Lance Taylor  <iant@google.com>
9579         * output.cc (Output_section::add_input_section): Don't try to
9580         merge empty merge sections.
9582 2008-07-21  Craig Silverstein  <csilvers@google.com>
9584         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9585         Include symbol version in error message.
9587 2008-07-20  Chris Demetriou  <cgd@google.com>
9589         * configure.ac (gold_cv_c_random_seed): New configured variable.
9590         (RANDOM_SEED_CFLAGS): New substituted variable.
9591         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9592         * configure: Rebuild.
9593         * Makefile.in: Likewise.
9594         * testsuite/Makefile.in: Likewise.
9596 2008-07-18  Ian Lance Taylor  <iant@google.com>
9598         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9599         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9600         * testsuite/ver_test_main.cc (main): Call t4.
9601         (t4, t4_2a): Define.
9602         * testsuite/ver_test_2.cc (t4_2): Define.
9603         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9604         * testsuite/ver_test_4.cc (t4_2a): Define.
9605         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9606         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9608 2008-07-17  Ian Lance Taylor  <iant@google.com>
9610         * dynobj.cc (Versions::add_def): If we give an error about a
9611         missing version, go ahead and create the version anyhow.
9613 2008-07-10  Ian Lance Taylor  <iant@google.com>
9615         Handle output sections with more than 0x7fffffff bytes.
9616         * object.h (class Relobj): Change map_to_output_ to
9617         output_sections_, and just keep a section pointer.  Change all
9618         uses.  Move comdat group support to Sized_relobj.
9619         (Relobj::is_section_specially_mapped): Remove.
9620         (Relobj::output_section): Remove poff parameter.  Change all
9621         callers.
9622         (Relobj::output_section_offset): New function.
9623         (Relobj::set_section_offset): Rewrite.
9624         (Relobj::map_to_output): Remove.
9625         (Relobj::output_sections): New function.
9626         (Relobj::do_output_section_offset): New pure virtual function.
9627         (Relobj::do_set_section_offset): Likewise.
9628         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9629         group support from Relobj.  Update declarations.
9630         (Sized_relobj::get_output_section_offset): New function.
9631         (Sized_relobj::do_output_section_offset): New function.
9632         (Sized_relobj::do_set_section_offset): New function.
9633         * object.cc (Relobj::output_section_address): Remove.
9634         (Sized_relobj::Sized_relobj): Initialize new fields.
9635         (Sized_relobj::include_section_group): Cast find_kept_object to
9636         Sized_relobj.
9637         (Sized_relobj::include_linkonce_section): Likewise.
9638         (Sized_relobj::do_layout): Use separate arrays for output section
9639         and output offset.
9640         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9641         output_sections.
9642         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9643         output_sections and section_offsets.
9644         (Sized_relobj::write_local_symbols): Likewise.
9645         (map_to_kept_section): Compute output address directly.
9646         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9647         output_sections and section_offsets.
9648         (Sized_relobj::write_sections): Likewise.
9649         (Sized_relobj::relocate_sections): Likewise.
9650         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9651         * output.h (class Output_reloc): Update declarations.  Change
9652         u2_.relobj to Sized_relobj*.
9653         (class Output_data_reloc): Change add functions to use
9654         Sized_relobj*.
9655         * output.cc (Output_reloc::Output_reloc): Change relobj to
9656         Sized_relobj*.
9657         (Output_reloc::local_section_offset): Change return type to
9658         Elf_Addr.  Use get_output_section_offset.
9659         (Output_reloc::get_address): Likewise.
9660         (Output_section::is_input_address_mapped): Don't call
9661         is_section_specially_mapped.
9662         (Output_section::output_offset): Likewise.
9663         (Output_section::output_address): Likewise.
9664         (Output_section::starting_output_address): Likewise.
9665         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9666         parameter to Sized_relobj*.
9667         (Copy_relocs::need_copy_reloc): Likewise.
9668         (Copy_relocs::save): Likewise.
9669         * copy-relocs.h (class Copy_relocs): Update declarations.
9670         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9671         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9672         * target-reloc.h (relocate_for_relocatable): Change
9673         offset_in_output_section type to Elf_Addr.  Change code that uses
9674         it as well.
9675         * layout.cc (Layout::layout): Always set *off.
9676         * mapfile.cc (Mapfile::print_input_section): Use
9677         output_section_offset.
9678         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9679         Sized_relobj*.
9680         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9681         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9682         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9684 2008-07-03  Ian Lance Taylor  <iant@google.com>
9686         * layout.cc (Layout::include_section): Do not discard unrecognized
9687         SHT_STRTAB sections.
9689 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9691         * script.cc (Lex::can_continue_name): Make '?' allowable in
9692         version-script names.
9693         * testsuite/version_script.map: Change glob pattern to use '?'
9695 2008-06-30  Manish Singh  <yosh@gimp.org>
9697         PR 6585
9698         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9699         Correct typo.
9701 2008-06-30  Ian Lance Taylor  <iant@google.com>
9703         PR 6660
9704         PR 6682
9705         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9706         versions]: Don't try to read the value in the contents, since we
9707         don't use it.  Use the template endianness when writing.
9709 2008-06-25  Cary Coutant  <ccoutant@google.com>
9711         * fileread.cc (File_read::make_view): Assert on zero-length view.
9712         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9713         symbol table when there are no symbols to read.
9715 2008-06-23  Craig Silverstein  <csilvers@google.com>
9717         * version.cc (version_string): Bump to 1.7
9719 2008-06-18  Craig Silverstein  <csilvers@google.com>
9721         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9722         constant 0xFFFF to type Valtype.
9723         (Powerpc_relocate_functions::rel16_ha): Likewise.
9725 2008-06-17  Ian Lance Taylor  <iant@google.com>
9727         * output.h (Output_section::Input_section): Initialize p2align_ to
9728         zero for Output_section_data constructors.
9729         (Output_section::Input_section::addralign): If not an input
9730         section, return the alignment of the Output_section_data.
9731         * testsuite/copy_test.cc: New file.
9732         * testsuite/copy_test_1.cc: New file.
9733         * testsuite/copy_test_2.cc: New file.
9734         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9735         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9736         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9737         (copy_test_1_pic.o, copy_test_1.so): New targets.
9738         (copy_test_2_pic.o, copy_test_2.so): New targets.
9739         * testsuite/Makefile.in: Rebuild.
9741         * script-sections.cc (Script_sections::place_orphan): Initialize
9742         local variable exact.
9744 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9746         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9748 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9749             David S. Miller  <davem@davemloft.net>
9751         * powerpc.cc: New file.
9752         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9753         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9754         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9755         * Makefile.in: Rebuild.
9757 2008-06-09  Ian Lance Taylor  <iant@google.com>
9759         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9760         <exception>.
9761         (throwing, orig_terminate): New static variables.
9762         (terminate_handler): New static function.
9763         (t2): Set terminate handler.
9765 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9767         PR 6584
9768         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9769         alignment.
9771 2008-05-30  Cary Coutant  <ccoutant@google.com>
9773         * archive.cc (Archive::include_all_members) Correct to step
9774         over symbol table and extended name table in thin archives.
9776 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9778         PR 6407
9779         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9780         calculation.
9782 2008-05-28  Caleb Howe  <cshowe@google.com>
9784         * reduced_debug_output.cc: New file.
9785         * reduced_debug_output.h: New file.
9786         * options.h (class General_options): Add --strip-debug-non-line.
9787         * options.cc (General_options::finalize): Add strip_debug_non_line
9788         to the strip heirarchy.
9789         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9790         fields.
9791         * layout.cc: Include "reduced_debug_output.h".
9792         (Layout::Layout): Initialize new fields.
9793         (line_only_debug_sections): New static array.
9794         (is_lines_only_debug_sections): New static inline function.
9795         (Layout::include_section): Handle --strip-debug-non-line.
9796         (Layout::make_output_section): If --strip-debug-non-line, build
9797         new output sections for .debug_abbrev and .debug_info.
9798         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9799         gold.  Warn about possible overflow.
9800         (read_signed_LEB_128): Likewise.
9801         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9802         (read_signed_LEB_128): Declare.
9803         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9804         (HFILES): Add reduced_debug_output.h.
9805         * Makefile.in: Rebuild.
9807 2008-05-21  Ian Lance Taylor  <iant@google.com>
9809         * mapfile.cc: New file.
9810         * mapfile.h: New file.
9811         * options.h (class General_options): Add -M/--print-map and -Map.
9812         * options.cc (General_options::finalize): Make -M equivalent to
9813         -Map -.
9814         * main.cc: Include <cstdio> and "mapfile.h".
9815         (main): Open mapfile if requested.
9816         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9817         constructor.  Change caller.
9818         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9819         (queue_middle_tasks): Likewise.
9820         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9821         declarations.
9822         * archive.cc: Include "mapfile.h".
9823         (Archive::add_symbols): Add mapfile parameter.  Change all
9824         callers.  Pass mapfile, symbol, and reason to include_member.
9825         (Archive::include_all_members): Add mapfile parameter.  Change all
9826         callers.
9827         (Archive::include_member): Add mapfile, sym, and why parameters.
9828         Change all callers.  Report inclusion to map file.
9829         * archive.h: Include "fileread.h".
9830         (class Archive): Update declarations.
9831         (Archive::file): New const method.
9832         (class Add_archive_symbols): Add mapfile_ field.  Update
9833         constructor.  Change all callers.
9834         * readsyms.h (class Read_symbols): Likewise.
9835         (class Finish_group): Likewise.
9836         (class Read_script): Likewise.
9837         * common.cc: Include "mapfile.h".
9838         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9839         all callers.
9840         (Symbol_table::do_allocate_commons): Likewise.
9841         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9842         symbol allocation to mapfile.
9843         * common.h (class Allocate_commons_task): Add mapfile_ field.
9844         Update constructor.  Change all callers.
9845         * symtab.h (class Symbol_table): Update declarations.
9846         * layout.cc: Include "mapfile.h".
9847         (Layout_task_runner::run): Print information to mapfile.
9848         (Layout::create_gold_note): Change Output_data_fixed_space to
9849         Output_data_zero_fill.
9850         (Layout::create_build_id): Likewise.
9851         (Layout::print_to_mapfile): New function.
9852         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9853         constructor.  Change caller.
9854         (class Layout): Declare print_to_mapfile.
9855         * output.cc (Output_section::Input_section::print_to_mapfile): New
9856         function.
9857         (Output_section::add_input_section): If producing a map, always
9858         add to input_sections_ list.
9859         (Output_section::do_print_to_mapfile): New function.
9860         (Output_segment::print_sections_to_mapfile): New function.
9861         (Output_segment::print_section_list_to_mapfile): New function.
9862         * output.h: Include "mapfile.h".
9863         (Output_data::print_to_mapfile): New function.
9864         (Output_data::do_print_to_mapfile): New virtual function.
9865         (Output_segment_headers::do_print_to_mapfile): New function.
9866         (Output_file_header::do_print_to_mapfile): New function.
9867         (Output_data_const::do_print_to_mapfile): New function.
9868         (class Output_data_const_buffer): Add map_name_ field.  Update
9869         constructor.  Change all callers.  Add do_print_to_mapfile
9870         function.
9871         (class Output_data_fixed_space): Likewise.
9872         (class Output_data_space): Likewise.
9873         (class Output_data_zero_fill): New class.
9874         (Output_data_strtab::do_print_to_mapfile): New function.
9875         (Output_data_reloc_base::do_print_to_mapfile): New function.
9876         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9877         (Output_data_group::do_print_to_mapfile): New function.
9878         (Output_data_got::do_print_to_mapfile): New function.
9879         (Output_data_dynamic::do_print_to_mapfile): New function.
9880         (Output_symtab_xindex::do_print_to_mapfile): New function.
9881         (class Output_section): Declare do_print_to_mapflie.  Declare
9882         print_to_mapfile in Input_section.
9883         (class Output_segment): Declare new functions.
9884         * object.h (Sized_relobj::symbol_count): New function.
9885         * script-sections.cc
9886         (Output_section_element_dot_assignment::set_section_addresses):
9887         Change Output_data_fixed_space to Output_data_zero_fill.
9888         (Output_data_expression::do_print_to_mapfile): New function.
9889         * script.cc (read_input_script): Add mapfile parameter.  Change
9890         all callers.
9891         * script.h (read_input_script): Update declaration.
9892         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9893         (Eh_frame::do_print_to_mapfile): New function.
9894         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9895         (Output_merge_string::do_print_to_mapfile): New function.
9896         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9897         function.
9898         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9899         function.
9900         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9901         function.
9902         * Makefile.am (CCFILES): Add mapfile.cc.
9903         (HFILES): Add mapfile.h.
9904         * Makefile.in: Rebuild.
9906 2008-05-19  Ian Lance Taylor  <iant@google.com>
9908         * options.h (class General_options): Add -z relro.
9909         * layout.cc (Layout::Layout): Initialize relro_segment_.
9910         (Layout::add_output_section_data): Return the output section.
9911         (Layout::make_output_section): Rcognize relro sections and mark
9912         them appropriately.
9913         (Layout::attach_allocated_section_to_segment): Put relro sections
9914         in a PT_GNU_RELRO segment.
9915         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9916         section as relro.
9917         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9918         PT_TLS segments.
9919         (Layout::linkonce_mapping): Map d.rel.ro.local to
9920         .data.rel.ro.local.
9921         (Layout::output_section_name): Us .data.rel.ro.local for any
9922         section which begins with that.
9923         * layout.h (class Layout): Update add_output_section_data
9924         declaration.  Add relro_segment_ field.
9925         * output.cc (Output_section::Output_section): Initialize is_relro_
9926         and is_relro_local_ fields.
9927         (Output_segment::add_output_section): Group relro sections.
9928         (Output_segment::is_first_section_relro): New function.
9929         (Output_segment::maximum_alignment): If there is a relro section,
9930         align the segment to the common page size.
9931         (Output_segment::set_section_addresses): Track whether we are
9932         looking at relro sections.  If the last section is a relro
9933         section, align to the common page size.
9934         (Output_segment::set_section_list_addresses): Add in_relro
9935         parameter.  Change all callers.  Align to the page size when
9936         moving from relro to non-relro section.
9937         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9938         segment.
9939         * output.h (class Output_section): Add is_relro_ and
9940         is_relro_local_ fields.
9941         (Output_section::is_relro): New function.
9942         (Output_section::set_is_relro): New function.
9943         (Output_section::is_relro_local): New function.
9944         (Output_section::set_is_relro_local): New function.
9945         (class Output_segment): Update declarations.
9946         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9947         * sparc.cc (Target_sparc::got_section): Likewise.
9948         * x86_64.cc (Target_x86_64::got_section): Likewise.
9949         * testsuite/relro_test_main.cc: New file.
9950         * testsuite/relro_test.cc: New file.
9951         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9952         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9953         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9954         (relro_test.so, relro_test_pic.o): New targets.
9955         * testsuite/Makefile.in: Rebuild.
9957 2008-05-16  Ian Lance Taylor  <iant@google.com>
9959         * output.cc (Output_segment::add_output_section): Remove front
9960         parameter.
9961         * output.h (class Output_segment): Remove
9962         add_initial_output_section and overloaded add_output_section.
9963         Update declaration of remaining add_output_section.
9964         * layout.cc (Layout::create_interp): Call add_output_section
9965         rather than add_initial_output_section.
9966         (Layout::finish_dynamic_section): Likewise.
9968         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9969         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9970         know the dynamic type.
9971         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9972         field.  Initialize it in constructor.
9973         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9974         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9975         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9976         reloc.
9978         * output.cc (Output_reloc::get_address): Change return type to
9979         Elf_Addr.
9980         * output.h (class Output_reloc): Update get_address declaration.
9981         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9982         for section addresses.
9984 2008-05-09  Ian Lance Taylor  <iant@google.com>
9986         PR 6493
9987         * gold.cc (gold_nomem): Use return value of write.
9989 2008-05-08  Ian Lance Taylor  <iant@google.com>
9991         * symtab.c (Symbol::init_base_output_data): Add version
9992         parameter.  Change all callers.
9993         (Symbol::init_base_output_segment): Likewise.
9994         (Symbol::init_base_constant): Likewise.
9995         (Symbol::init_base_undefined): Likewise.
9996         (Sized_symbol::init_output_data): Likewise.
9997         (Sized_symbol::init_output_segment): Likewise.
9998         (Sized_symbol::init_constant): Likewise.
9999         (Sized_symbol::init_undefined): Likewise.
10000         (Symbol_table::do_define_in_output_data): If the new symbol has a
10001         version, mark it as the default.
10002         (Symbol_table::do_define_in_output_segment): Likewise.
10003         (Symbol_table::do_define_as_constant): Likewise.
10004         * symtab.h (class Symbol): Update declarations.
10005         (class Sized_symbol): Likewise.
10006         * resolve.cc (Symbol::override_version): New function.
10007         (Symbol::override_base): Call override_version.
10008         (Symbol::override_base_with_special): Likewise.
10009         * testsuite/ver_script_8.script: New file.
10010         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10011         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10012         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10013         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10015 2008-05-06  Ian Lance Taylor  <iant@google.com>
10017         PR 6049
10018         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10019         functions.
10020         (class General_options): Remove existing --undefined, and add
10021         --no-undefined instead.  Add new --undefined as synonym for -u.
10022         * archive.cc (Archive::add_symbols): Check whether symbol was
10023         named with -u.
10024         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10025         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10026         all uses.  Add IS_UNDEFINED.  Update declarations to split
10027         different versions of init_base.  Declare init_base_undefined.
10028         (Symbol::is_defined): Handle IS_UNDEFINED.
10029         (Symbol::is_undefined): Likewise.
10030         (Symbol::is_weak_undefined): Call is_undefined.
10031         (Symbol::is_absolute): Handle IS_CONSTANT.
10032         (class Sized_symbol): Update declarations to split different
10033         versions of init.  Declare init_undefined.
10034         (class Symbol_table): Declare new functions.
10035         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10036         Change all callers.
10037         (Symbol::init_base_output_data): Likewise.
10038         (Symbol::init_base_output_segment): Likewise.
10039         (Symbol::init_base_constant): Likewise.
10040         (Symbol::init_base_undefined): New function.
10041         (Sized_symbol::init_object): Rename from init.  Change all
10042         callers.
10043         (Sized_symbol::init_output_data): Likewise.
10044         (Sized_symbol::init_output_segment): Likewise.
10045         (Sized_symbol::init_constant): Likewise.
10046         (Sized_symbol::init_undefined): New function.
10047         (Symbol_table::add_undefined_symbols_from_command_line): New
10048         function.
10049         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10050         function.
10051         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10052         (Symbol::output_section): Likewise.
10053         (Symbol::set_output_section): Likewise.
10054         (Symbol_table::sized_finalize_symbol): Likewise.
10055         (Symbol_table::sized_write_globals): Likewise.
10056         * resolve.cc (Symbol_table::should_override): Likewise.
10057         (Symbol::override_base_with_special): Likewise.
10059         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10060         symbol, change it to have default visibility.
10061         * testsuite/protected_1.cc: New file.
10062         * testsuite/protected_2.cc: New file.
10063         * testsuite/protected_3.cc: New file.
10064         * testsuite/protected_main_1.cc: New file.
10065         * testsuite/protected_main_2.cc: New file.
10066         * testsuite/protected_main_3.cc: New file.
10067         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10068         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10069         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10070         (protected_1.so): New target.
10071         (protected_1_pic.o, protected_2_pic.o): New targets.
10072         (protected_3_pic.o): New target.
10073         (check_PROGRAMS): Add protected_2.
10074         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10075         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10076         * testsuite/Makefile.in: Rebuild.
10078         * options.h (DEFINE_var): Add set_user_set_##varname__.
10079         (DEFINE_bool_alias): New macro.
10080         (class General_options): Define -Bstatic using DEFINE_bool_alias
10081         rather than DEFINE_special.  Add --undefined as an alias for -z
10082         defs.
10083         * options.cc (General_options::parse_Bstatic): Remove.
10085         * options.h (class General_options): Add --fatal-warnings.
10086         * main.cc (main): Implement --fatal-warnings.
10087         * errors.h (Errors::warning_count): New function.
10089         * options.h (class General_options): Add -Bsymbolic-functions.
10090         * symtab.h (Symbol::is_preemptible): Check for
10091         -Bsymbolic-functions.
10093 2008-05-05  Ian Lance Taylor  <iant@google.com>
10095         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10096         as noVARNAME rather than no-VARNAME.
10097         (class General_options): Add option -z combreloc.
10098         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10099         get_address.
10100         (Output_reloc::sort_before) [SHT_REL]: New function.
10101         (Output_reloc::sort_before) [SHT_RELA]: New function.
10102         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10103         Sort_relocs_comparison.
10104         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10105         parameter.  Change all callers.
10106         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10107         sort_relocs parameter.  Change all callers.
10108         * output.cc (Output_reloc::get_address): New function, broken out
10109         of write_rel.
10110         (Output_reloc::write_rel): Call it.
10111         (Output_reloc::compare): New function.
10112         (Output_data_reloc_base::do_write): Optionally sort relocs.
10114         * configure.ac: If targ_extra_obj is set, link it in.
10115         * configure.tgt: Initialize all variables.
10116         (x86_64*): Set targ_extra_obj and targ_extra_size.
10117         * configure: Rebuild.
10119         * object.cc (Sized_relobj::include_section_group): Adjust section
10120         indexes read from group data.  Build vector to pass to
10121         layout_group.
10122         * layout.cc (Layout::layout_group): Add flags and shndxes
10123         parameters.  Remove contents parameter.  Change caller.  Update
10124         explicit instantiations.
10125         * layout.h (class Layout): Update layout_group declaration.
10126         * output.cc (Output_data_group::Output_data_group): Add flags and
10127         input_shndxes parameters.  Remove contents parameter.  Change
10128         caller.
10129         (Output_data_group::do_write): Change input_sections_ to
10130         input_shndxes_.
10131         * output.h (class Output_data_group): Update constructor
10132         declaration.  Rename input_sections_ to input_shndxes_.
10133         * testsuite/many_sections_test.cc: Add template.
10135 2008-04-30  Cary Coutant  <ccoutant@google.com>
10137         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10139         * layout.cc (Layout::include_section): Refactored check for debug
10140         info section.
10141         (Layout::add_comdat): Add new parameters.  Change type
10142         of signature parameter.  Add object and shndx to signatures table.
10143         (Layout::find_kept_object): New function.
10144         * layout.h: Include <cstring>.
10145         (Layout::is_debug_info_section): New function.
10146         (Layout::add_comdat): Add new parameters.
10147         (Layout::find_kept_object): New function.
10148         (Layout::Kept_section): New struct.
10149         (Layout::Signatures): Change type of map range.
10150         * object.cc (Relobj::output_section_address): New function.
10151         (Sized_relobj::include_section_group): Add new parameters.  Change
10152         calls to Layout::add_comdat.  Change to build table of kept comdat
10153         groups and table mapping discarded sections to kept sections.
10154         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10155         (Sized_relobj::do_layout): Change calls to include_section_group and
10156         include_linkonce_section.
10157         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10158         value to zero when section is discarded.
10159         (Sized_relobj::map_to_kept_section): New function.
10160         * object.h (Relobj::output_section_address): New function.
10161         (Relobj::Comdat_group): New type.
10162         (Relobj::find_comdat_group): New function.
10163         (Relobj::Comdat_group_table): New type.
10164         (Relobj::Kept_comdat_section): New type.
10165         (Relobj::Kept_comdat_section_table): New type.
10166         (Relobj::add_comdat_group): New function.
10167         (Relobj::set_kept_comdat_section): New function.
10168         (Relobj::get_kept_comdat_section): New function.
10169         (Relobj::comdat_groups_): New field.
10170         (Relobj::kept_comdat_sections_): New field.
10171         (Symbol_value::input_value): Update comment.
10172         (Sized_relobj::map_to_kept_section) New function.
10173         (Sized_relobj::include_linkonce_section): Add new parameter.
10174         * target-reloc.h (Comdat_behavior): New type.
10175         (get_comdat_behavior): New function.
10176         (relocate_section): Add code to map a discarded section to the
10177         corresponding kept section when applying a relocation.
10179 2008-04-30  Craig Silverstein  <csilvers@google.com>
10181         * dwarf_reader.cc (next_generation_count): New static var.
10182         (Addr2line_cache_entry): New struct.
10183         (addr2line_cache): New static var.
10184         (Dwarf_line_info::one_addr2line): Added caching.
10185         (Dwarf_line_info::clear_addr2line_cache): New function.
10186         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10187         cache-size parameter.
10188         (Dwarf_line_info::one_addr2line_cache): New function.
10189         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10190         new cache-size argument to one_addr2line(), and clear cache.
10192 2008-04-28  Cary Coutant  <ccoutant@google.com>
10194         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10195         R_386_PC8 relocations.
10197 2008-04-23  Ian Lance Taylor  <iant@google.com>
10199         * object.cc (Sized_relobj::include_section_group): Check for
10200         invalid section group.
10202         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10203         header size.
10205         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10206         than read for file header.
10207         * archive.cc (Archive::include_member): Likewise.
10209 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10211         * aclocal.m4: Regenerate.
10212         * configure: Regenerate.
10214 2008-04-19  Ian Lance Taylor  <iant@google.com>
10216         * version.cc (version_string): Bump to 1.6.
10218         * testsuite/Makefile.am (many_sections_r_test): New target.
10219         (many_sections_r_test_SOURCES): Remove.
10220         (many_sections_r_test_DEPENDENCIES): Remove.
10221         (many_sections_r_test_LDFLAGS): Remove.
10222         (many_sections_r_test_LDADD): Remove.
10224         * object.cc (Sized_relobj::do_add_symbols): Always pass
10225         local_symbol_count_ to add_from_relobj.
10227         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10228         every thousand variables.
10229         * testsuite/Makefile.in: Rebuild.
10231         * object.cc (Xindex::initialize_symtab_xindex): New function.
10232         (Xindex::read_symtab_xindex): New function.
10233         (Xindex::sym_xindex_to_shndx): New function.
10234         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10235         available.
10236         (Sized_relobj::do_initialize_xindex): New function.
10237         (Sized_relobj::do_read_symbols): Adjust section links.
10238         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10239         parameter.  Change all callers.
10240         (Sized_relobj::include_section_group): Adjust section links and
10241         symbol section indexes.
10242         (Sized_relobj::do_layout): Adjust section links.
10243         (Sized_relobj::do_count_local_symbols): Adjust section links and
10244         symbol section indexes.
10245         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10246         ordinary and special symbols.
10247         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10248         dynsym_xindex parameters.  Change all callers.  Adjust section
10249         links.  Use SHN_XINDEX when needed.
10250         (Sized_relobj::get_symbol_location_info): Adjust section links.
10251         Don't get fooled by special symbols.
10252         * object.h (class Xindex): Define.
10253         (class Object): Add xindex_ parameter.  Declare virtual functoin
10254         do_initialize_xindex.
10255         (Object::adjust_sym_shndx): New function.
10256         (Object::set_xindex): New protected function.
10257         (class Symbol_value): Add is_ordinary_shndx_ field.
10258         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10259         (Symbol_value::value): Assert ordinary section.
10260         (Symbol_value::initialize_input_to_output_map): Likewise.
10261         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10262         Change all callers.
10263         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10264         all callers.
10265         (class Sized_relobj): Update declarations.
10266         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10267         parameter.  Change all callers.
10268         (Sized_relobj::adjust_shndx): New function.
10269         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10270         field.
10271         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10272         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10273         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10274         (Sized_dynobj::read_dynsym_section): Adjust section links.
10275         (Sized_dynobj::read_dynamic): Likewise.
10276         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10277         section links.
10278         (Sized_dynobj::do_initialize_xindex): New function.
10279         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10280         do_initialize_xindex.
10281         (Sized_dynobj::adjust_shndx): New function.
10282         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10283         dynsym_xindex_ fields.
10284         (Layout::finalize): Add a call to set_section_indexes before
10285         creating the symtab sections.
10286         (Layout::set_section_indexes): Don't do anything if the section
10287         already has a section index.
10288         (Layout::create_symtab_sections): Add shnum parameter.  Change
10289         caller.  Create .symtab_shndx section if needed.
10290         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10291         caller.
10292         (Layout::allocated_output_section_count): New function.
10293         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10294         needed.
10295         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10296         fields.  Update declarations.
10297         (Layout::symtab_xindex): New function.
10298         (Layout::dynsym_xindex): New function.
10299         (class Write_symbols_task): Add layout_ field.
10300         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10301         Change caller.
10302         * output.cc (Output_section_headers::Output_section_headers): Add
10303         shstrtab_section parameter.  Change all callers.
10304         (Output_section_headers::do_sized_write): Store overflow values
10305         for section count and section string table section index in
10306         section header zero.
10307         (Output_file_header::do_sized_write): Check for overflow of
10308         section count and section string table section index.
10309         (Output_symtab_xindex::do_write): New function.
10310         (Output_symtab_xindex::endian_do_write): New function.
10311         * output.h (class Output_section_headers): Add shstrtab_section_.
10312         Update declarations.
10313         (class Output_symtab_xindex): Define.
10314         (Output_section::has_out_shndx): New function.
10315         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10316         field.
10317         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10318         Change all callers.
10319         (Sized_symbol::init): Likewise.
10320         (Symbol::output_section): Check for ordinary symbol.
10321         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10322         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10323         callers.
10324         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10325         Change all callers.  Simplify handling of symbols from sections
10326         not included in the link.
10327         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10328         distinction.
10329         (Weak_alias_sorter::operator()): Assert that symbols are
10330         ordinary.
10331         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10332         distinction.
10333         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10334         parameters.  Change all callers.
10335         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10336         symbol distinction.  Use SHN_XINDEX when needed.
10337         (Symbol_table::write_section_symbol): Add symtab_xindex
10338         parameter.  Change all callers.
10339         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10340         SHN_XINDEX when needed.
10341         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10342         declarations.
10343         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10344         (Symbol::is_defined): Check is_ordinary.
10345         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10346         (Symbol::is_absolute, Symbol::is_common): Likewise.
10347         (class Sized_symbol): Update declarations.
10348         (class Symbol_table): Update declarations.
10349         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10350         parameters.  Change all callers.
10351         (Sized_symbol::override): Likewise.
10352         (Symbol_table::override): Likewise.
10353         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10354         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10355         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10356         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10357         to be in an ordinary section.
10358         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10359         object and is_ordinary parameters.  Change all callers.
10360         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10361         Change all callers.  Don't add undefined or non-ordinary symbols
10362         to reloc_map_.
10363         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10364         Change all callers.
10365         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10366         declarations.
10367         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10368         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10369         (Sized_relobj::relocate_sections): Likewise.
10370         * target-reloc.h (scan_relocs): Adjust section symbol index.
10371         (scan_relocatable_relocs): Likewise.
10372         * i386.cc (Scan::local): Check for ordinary symbols.
10373         * sparc.cc (Scan::local): Likewise.
10374         * x86_64.cc (Scan::local): Likewise.
10375         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10376         to symbol_section_and_value.
10377         * testsuite/many_sections_test.cc: New file.
10378         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10379         (check_PROGRAMS): Add many_sections_test.
10380         (many_sections_test_SOURCES): Define.
10381         (many_sections_test_DEPENDENCIES): Define.
10382         (many_sections_test_LDFLAGS): Define.
10383         (BUILT_SOURCES): Add many_sections_define.h.
10384         (many_sections_define.h): New target.
10385         (BUILT_SOURCES): Add many_sections_check.h.
10386         (many_sections_check.h): New target.
10387         (check_PROGRAMS): Add many_sections_r_test.
10388         (many_sections_r_test_SOURCES): Define.
10389         (many_sections_r_test_DEPENDENCIES): Define.
10390         (many_sections_r_test_LDFLAGS): Define.
10391         (many_sections_r_test_LDADD): Define.
10392         (many_sections_r_test.o): New target.
10393         * testsuite/Makefile.in: Rebuild.
10395 2008-04-17  Cary Coutant  <ccoutant@google.com>
10397         * errors.cc (Errors::info): New function.
10398         (gold_info): New function.
10399         * errors.h (Errors::info): New function.
10400         * gold.h (gold_info): New function.
10401         * object.cc (Input_objects::add_object): Print trace output.
10402         * options.cc (options::parse_set): New function.
10403         (General_options::parse_wrap): Deleted.
10404         (General_options::General_options): Deleted initializer.
10405         * options.h (options::String_set): New typedef.
10406         (options::parse_set): New function.
10407         (DEFINE_set): New macro.
10408         (General_options::wrap): Changed to use DEFINE_set. Changed
10409         callers of any_wrap_symbols and is_wrap_symbol.
10410         (General_options::trace, General_options::trace_symbol):
10411         New options.
10412         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10413         (General_options::wrap_symbols_): Deleted.
10414         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10416 2008-04-17  David S. Miller  <davem@davemloft.net>
10418         * options.cc (General_options::parse_V): New function.
10419         * options.h: Add entries for -V and -Qy.
10421 2008-04-17  Ian Lance Taylor  <iant@google.com>
10423         * common.cc (Symbol_table::allocate_commons): Remove options
10424         parameter.  Change caller.
10425         (Symbol_table::do_allocate_commons): Remove options parameter.
10426         Change caller.  Just call do_allocate_commons_list twice.
10427         (Symbol_table::do_allocate_commons_list): New function, broken out
10428         of do_allocate_commons.
10429         * common.h (class Allocate_commons_task): Remove options_ field.
10430         Update constructor.
10431         * symtab.cc (Symbol_table::Symbol_table): Initialize
10432         tls_commons_.
10433         (Symbol_table::add_from_object): Put TLS common symbols on
10434         tls_commons_ list.
10435         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10436         which are IN_OUTPUT_DATA.
10437         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10438         allocate_commons and do_allocate_commons declarations.  Declare
10439         do_allocate_commons_list.
10440         * gold.cc (queue_middle_tasks): Update creation of
10441         Allocate_commons_task to not pass options.
10442         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10443         (TLS_TEST_C_FLAGS): New variable.
10444         (tls_test_c_pic.o): New target.
10445         (tls_test_shared.so): Link in tls_test_c_pic.o.
10446         (tls_test_c_pic_ie.o): New target.
10447         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10448         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10449         (tls_test_c.o): New target.
10450         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10451         (tls_pic_test_LDADD): Likewise.
10452         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10453         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10454         (tls_test_c_gnu2.o): New target.
10455         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10456         tls_test_c_gnu2.o.
10457         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10458         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10459         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10460         * testsuite/tls_test.cc: Include "config.h".
10461         (t_last): Call t11_last.
10462         * testsuite/tls_test.h (t11, t11_last): Declare.
10463         * testsuite/tls_test_c.c: New file.
10464         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10465         * configure.ac: Check for OpenMP support.
10466         * configure, config.in, Makefile.in: Rebuild.
10467         * testsuite/Makefile.in: Rebuild.
10469 2008-04-16  Cary Coutant  <ccoutant@google.com>
10471         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10472         (Target_i386::tls_base_symbol_defined_): New field.
10473         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10474         (Target_i386::Scan::global): Likewise.
10475         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10476         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10477         (Target_x86_64::tls_base_symbol_defined_): New field.
10478         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10479         (Target_x86_64::Scan::global): Likewise.
10481 2008-04-16  Cary Coutant  <ccoutant@google.com>
10483         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10484         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10485         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10486         building shared libraries.
10487         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10488         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10489         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10490         * testsuite/Makefile.in: Rebuild.
10491         * testsuite/weak_undef.h: New file.
10492         * testsuite/weak_undef_file1.cc: Add extra test cases.
10493         * testsuite/weak_undef_file2.cc: Likewise.
10494         * testsuite/weak_undef_test.cc: Likewise.
10496 2008-04-16  David S. Miller  <davem@davemloft.net>
10498         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10499         Add issued_non_pic_error_ field.  Declare check_non_pic.
10500         (Target_sparc::Scan::check_non_pic): New function.
10501         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10502         (Target_sparc::Scan::global): Likewise.
10504         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10505         * configure: Rebuild.
10507         * options.h (DEFINE_enable): New macro.
10508         (new_dtags): New enable option.
10509         (initfirst, interpose, loadfltr, nodefaultlib,
10510         nodelete, nodlopen, nodump): New -z options.
10511         * layout.cc (Layout:finish_dynamic_section): If new
10512         dtags enabled, emit DT_RUNPATH.  Also, emit a
10513         DT_FLAGS_1 containing any specified -z flags.
10515 2008-04-16  Ian Lance Taylor  <iant@google.com>
10517         * copy-relocs.cc: New file.
10518         * copy-relocs.h: New file.
10519         * reloc.cc: Remove Copy_relocs code.
10520         * reloc.h: Likewise.
10521         * reloc-types.h (struct Reloc_types) [both versions]: Add
10522         get_reloc_addend_noerror.
10523         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10524         variants of add_global which take an addend which must be zero.
10525         * i386.cc: Include "copy-relocs.h".
10526         (class Target_i386): Change type of copy_relocs_ to variable,
10527         update initializer.
10528         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10529         Change all callers.
10530         (Target_i386::do_finalize_sections): Change handling of
10531         copy_relocs_.
10532         * sparc.cc: Include "copy-relocs.h".
10533         (class Target_sparc): Change type of copy_relocs_ to variable,
10534         update initializer.
10535         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10536         Change all callers.
10537         (Target_sparc::do_finalize_sections): Change handling of
10538         copy_relocs_.
10539         * x86_64.cc: Include "copy-relocs.h".
10540         (class Target_x86_64): Change type of copy_relocs_ to variable,
10541         update initializer.
10542         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10543         class.  Change all callers.
10544         (Target_x86_64::do_finalize_sections): Change handling of
10545         copy_relocs_.
10546         * Makefile.am (CCFILES): Add copy-relocs.cc.
10547         (HFILES): Add copy-relocs.h.
10549         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10551         * testsuite/script_test_4.sh: Permit leading zeroes.
10553 2008-04-15  Ian Lance Taylor  <iant@google.com>
10555         * script-sections.cc (Script_sections::create_segments): Use
10556         header_size_adjustment even when there is enough room for the
10557         headers.
10558         * testsuite/script_test_4.sh: New file.
10559         * testsuite/script_test_4.t: New file.
10560         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10561         (check_DATA): Add script_test_4.stdout.
10562         (MOSTLYCLEANFILES): Likewise.
10563         (script_test_4): New target.
10564         (script_test_4.stdout): New target.
10565         * testsuite/Makefile.in: Rebuild.
10567         * sparc.cc: Add definitions for Output_data_plt_sparc class
10568         constants.
10570 2008-04-14  David S. Miller  <davem@davemloft.net>
10572         * sparc.cc: New file.
10573         * Makefile.am (TARGETSOURCES): Add sparc.cc
10574         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10575         * configure.tgt: Document targ_extra_size and
10576         targ_extra_big_endian.  Add entries for sparc-* and
10577         sparc64-*.
10578         * configure.ac: Handle targ_extra_size and
10579         targ_extra_big_endian.
10580         * Makefile.in: Rebuild.
10581         * configure: Likewise.
10582         * po/POTFILES.in: Likewise.
10583         * po/gold.pot: Likewise.
10585 2008-04-14  Ian Lance Taylor  <iant@google.com>
10587         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10588         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10589         in the name/type/flags to section mapping.  Don't call
10590         allocate_output_section.
10591         (Layout::choose_output_section): Change parameter from adjust_name
10592         to is_input_section.  Don't permit input sections after sections
10593         are attached to segments.  Don't call allocate_output_section.
10594         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10595         not write_enable_output_section.
10596         (Layout::make_output_section): Don't push to
10597         unattached_section_list_ nor call attach_to_segment.  Call
10598         attach_section_to_segment if sections are attached.
10599         (Layout::attach_sections_to_segments): New function.
10600         (Layout::attach_section_to_segment): New function.
10601         (Layout::attach_allocated_section_to_segment): Rename from
10602         attach_to_segment.  Remove flags parameter.
10603         (Layout::allocate_output_section): Remove function.
10604         (Layout::write_enable_output_section): Remove function.
10605         * layout.h (class Layout): Update for above changes.  Add new
10606         field sections_are_attached_.
10607         * output.h (Output_section::update_flags_for_input_section): New
10608         function.
10609         * output.cc (Output_section::add_input_section): Call
10610         update_flags_for_input_section.
10611         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10613 2008-04-11  Cary Coutant  <ccoutant@google.com>
10615         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10616         thought unnecessary.
10617         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10619 2008-04-11  Ian Lance Taylor  <iant@google.com>
10621         * output.h (class Output_section_data): Remove inline definition
10622         of set_addralign.
10623         * output.cc (Output_section_data::set_addralign): New function.
10625 2008-04-11  Cary Coutant  <ccoutant@google.com>
10627         Add support for TLS descriptors for i386 and x86_64.
10628         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10629         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10630         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10631         GOT_TYPE_TLS_DESC.
10632         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10633         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10634         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10635         relocations.
10636         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10637         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10638         Fix problem with initial-exec relocations.
10639         (Target_i386::Relocate::relocate_tls): Likewise.
10640         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10641         relaxation.
10642         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10643         support for section-plus-offset dynamic table entries.
10644         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10645         (Output_data_dynamic::Dynamic_entry): Add support for
10646         section-plus-offset dynamic table entries.
10647         (Output_data_dynamic::Classification): Likewise.
10648         (Output_data_dynamic::classification_): Renamed offset_.
10649         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10650         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10651         (Target_x86_64::make_plt_section): New function.
10652         (Target_x86_64::reserve_tlsdesc_entries): New function.
10653         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10654         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10655         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10656         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10657         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10658         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10659         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10660         add extra PLT entry for TLS descriptors.
10661         (Output_data_plt_x86_64::got_): New field.
10662         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10663         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10664         fields.
10665         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10666         descriptors.
10667         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10668         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10669         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10670         R_386_TLS_DESC_CALL relocations.
10671         (Target_x86_64::Scan::global): Likewise.
10672         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10673         for TLS descriptors.
10674         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10675         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10676         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10677         GD-to-IE relaxation.
10678         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10679         and TLS_DESCRIPTORS.
10680         * Makefile.in: Rebuild.
10681         * configure: Rebuild.
10682         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10683         (tls_test_shared2.so): New target.
10684         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10685         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10686         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10687         (tls_shared_gd_to_ie_test_LDADD): New variable.
10688         (tls_shared_gnu2_gd_to_ie_test): New target.
10689         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10690         New targets.
10691         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10692         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10693         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10694         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10695         (tls_shared_gnu2_test): New target.
10696         (tls_test_gnu2_shared.so): New target.
10697         (tls_shared_gnu2_test_SOURCES): New variable.
10698         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10699         (tls_shared_gnu2_test_LDFLAGS): New variable.
10700         (tls_shared_gnu2_test_LDADD): New variable.
10701         * testsuite/Makefile.in: Rebuild.
10702         * testsuite/Makefile.
10704 2008-04-11  Ian Lance Taylor  <iant@google.com>
10706         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10707         justsyms.t.
10708         * testsuite/Makefile.in: Rebuild.
10710         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10711         long.
10712         * testsuite/script_test_2.cc (main): Adjust test.
10714 2008-04-11  David S. Miller  <davem@davemloft.net>
10715             Ian Lance Taylor  <iant@google.com>
10717         * options.h (General_options): Add entries for '-Y' and
10718         '-relax'.
10719         * options.cc (General_options:finalize): If -Y was used, add those
10720         entries to the library path instead of the default "/lib" and
10721         "/usr/lib".
10723 2008-04-11  David S. Miller  <davem@davemloft.net>
10725         * testsuite/justsyms.t: Start at 0x100.
10726         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10727         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10728         long.
10729         * testsuite/script_test_2.cc: Adjust string and section length
10730         checks.
10732 2008-04-09  Ian Lance Taylor  <iant@google.com>
10734         PR gold/5996
10735         * script-sections.cc (Sections_element::allocate_to_segment): Add
10736         orphan parameter.
10737         (Output_section_definition::allocate_to_segment): Likewise.
10738         (Orphan_output_section::allocate_to_segment): Likewise.
10739         (Script_sections::attach_sections_using_phdrs_clause): Don't
10740         propagate non-PT_LOAD segments to orphan sections.
10741         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10742         readelf rather than objdump.
10743         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10744         .interp section and PT_INTERP segment are the same size.
10745         * testsuite/Makefile.in: Rebuild.
10747         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10748         aliases for symbols defined in the same object.
10749         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10750         (weak_alias_test_SOURCES): New variable.
10751         (weak_alias_test_DEPENDENCIES): New variable.
10752         (weak_alias_test_LDFLAGS): New variable.
10753         (weak_alias_test_LDADD): New variable.
10754         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10755         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10756         (weak_alias_test_3.o): New target.
10757         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10758         * testsuite/weak_alias_test_main.cc: New file.
10759         * testsuite/weak_alias_test_1.cc: New file.
10760         * testsuite/weak_alias_test_2.cc: New file.
10761         * testsuite/weak_alias_test_3.cc: New file.
10763 2008-04-08  Ian Lance Taylor  <iant@google.com>
10765         * options.h (class General_options): Add --noinhibit-exec option.
10766         * main.cc (main): Check --noinhibit-exec.
10768         * options.h (class General_options): Define --wrap as a special
10769         option.  Add wrap_symbols_ field.
10770         (General_options::any_wrap_symbols): New function.
10771         (General_options::is_wrap_symbol): New function.
10772         * options.cc (General_options::parse_wrap): New function.
10773         (General_options::General_options): Initialize wrap_symbols_.
10774         * symtab.cc (Symbol_table::wrap_symbol): New function.
10775         (Symbol_table::add_from_object): Handle --wrap.
10776         * symtab.h (class Symbol_table): Declare wrap_symbol.
10777         * target.h (Target::wrap_char): New function.
10778         (Target::Target_info): Add wrap_char field.
10779         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10780         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10781         * testsuite/testfile.cc (Target_test::test_target_info):
10782         Likewise.
10784         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10785         there is one.
10787         * layout.h (class Layout): Add added_eh_frame_data_ field.
10788         * layout.cc (Layout::Layout): Initialize new field.
10789         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10790         output section until we find a section we merged successfully.
10791         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10792         that the size be non-zero.
10794         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10795         qualifier.
10797 2008-04-08  Craig Silverstein  <csilvers@google.com>
10799         * configure.ac: Export new conditional variable HAVE_ZLIB.
10800         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10801         on HAVE_ZLIB.
10802         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10803         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10805 2008-04-07  Ian Lance Taylor  <iant@google.com>
10807         * version.cc (version_string): Set to "1.5".
10809         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10810         Add issued_non_pic_error_ field.  Declare check_non_pic.
10811         (Target_x86_64::Scan::check_non_pic): New function.
10812         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10813         (Target_x86_64::Scan::global): Likewise.
10815         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10816         addend parameter.  Change caller.  Handle merge sections.
10817         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10818         Address to Addend.  Don't add in the result of
10819         local_section_offset, pass down the addend and use the returned
10820         value.
10821         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10822         Update declarations of local_section_offset and symbol_value.
10823         * testsuite/two_file_test_1.cc (t18): New function.
10824         * testsuite/two_file_test_2.cc (f18): New function.
10825         * testsuite/two_file_test_main.cc (main): Call t18.
10826         * testsuite/two_file_test.h (t18, f18): Declare.
10828         * configure.ac: Don't test for objdump, c++filt, or readelf.
10829         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10830         conditionals.
10831         (TEST_READELF): New variable.
10832         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10833         (check_PROGRAMS): Add two_file_strip_test.
10834         (two_file_strip_test): New target.
10835         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10836         (two_file_same_shared_strip_test_SOURCES): New variable.
10837         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10838         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10839         (two_file_same_shared_strip_test_LDADD): New variable.
10840         (two_file_shared_strip.so): New target.
10841         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10842         (ver_test_5.syms, ver_test_7.syms): Likewise.
10843         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10844         (strip_test_3.stdout): Use TEST_OBJDUMP.
10845         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10847 2008-04-04  Cary Coutant  <ccoutant@google.com>
10849         * symtab.h (Symbol::is_weak_undefined): New function.
10850         (Symbol::is_strong_undefined): New function.
10851         (Symbol::is_absolute): New function.
10852         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10853         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10854         absolute symbols.
10855         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10856         (weak_undef_test): New target.
10857         * testsuite/Makefile.in: Rebuild.
10858         * testsuite/weak_undef_file1.cc: New file.
10859         * testsuite/weak_undef_file2.cc: New file.
10860         * testsuite/weak_undef_test.cc: New file.
10862 2008-04-03  Craig Silverstein  <csilvers@google.com>
10864         * compressed_output.h (class Output_compressed_section): Use
10865         unsigned buffer.
10866         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10867         add zlib header.
10868         (zlib_compressed_suffix): Removed.
10869         (Output_compressed_section::set_final_data_size): Use unsigned
10870         buffers.
10871         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10872         Fix linker invocation.
10873         (flagstest_o_specialfile_and_compress_debug_sections):
10874         Likewise.
10875         * testsuite/Makefile.in: Regenerated.
10877 2008-04-02  David S. Miller  <davem@davemloft.net>
10879         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10880         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10882 2008-04-02  Craig Silverstein  <csilvers@google.com>
10884         * TODO: New file.
10886 2008-04-02  Ian Lance Taylor  <iant@google.com>
10888         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10889         parameters.  Update for new key type to views_.  Change all
10890         callers.
10891         (File_read::read): Adjust for byteshift in returned view.
10892         (File_read::add_view): New function, broken out of
10893         find_and_make_view.
10894         (File_read::make_view): New function, broken out of
10895         find_and_make_view.
10896         (File_read::find_or_make_view): Add offset and aligned
10897         parameters.  Rewrite accordingly.  Change all callers.
10898         (File_read::get_view): Add offset and aligned parameters.  Adjust
10899         for byteshift in return value.
10900         (File_read::get_lasting_view): Likewise.
10901         * fileread.h (class File_read): Update declarations.
10902         (class File_read::View): Add byteshift_ field.  Add byteshift to
10903         constructor.  Add byteshift method.
10904         * archive.h (Archive::clear_uncached_views): New function.
10905         (Archive::get_view): Add aligned parameter.  Change all callers.
10906         * object.h (Object::get_view): Add aligned parameter.  Change all
10907         callers.
10908         (Object::get_lasting_view): Likewise.
10910         * fileread.cc (File_read::release): Don't call clear_views if
10911         there are multiple objects.
10912         * fileread.h (File_read::clear_uncached_views): New function.
10913         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10914         on the archive.
10916 2008-03-31  Cary Coutant  <ccoutant@google.com>
10918         Add thin archive support.
10919         * archive.cc (Archive::armagt): New const.
10920         (Archive::setup): Remove task parameter and calls to unlock.
10921         (Archive::unlock_nested_archives): New function.
10922         (Archive::read_header): Add nested_off parameter. Change
10923         all callers.
10924         (Archive::interpret_header): Likewise.
10925         (Archive::include_all_members): Change to handle thin
10926         archives.
10927         (Archive::include_member): Likewise.
10928         * archive.h (Archive::Archive): Add new parameters and
10929         initializers.
10930         (Archive::armagt): New const.
10931         (Archive::setup): Remove task parameter.
10932         (Archive::unlock_nested_archives): New function.
10933         (Archive::read_header): Add nested_off parameter.
10934         (Archive::interpret_header): Likewise.
10935         (Archive::Nested_archive_table): New typedef.
10936         (Archive::is_thin_archive_): New field.
10937         (Archive::nested_archives_): New field.
10938         (Archive::options_): New field.
10939         (Archive::dirpath_): New field.
10940         (Archive::task_): New field.
10941         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10942         for thin archives.  Pass additional parameters to
10943         Archive::Archive.  Unlock the archive file after calling
10944         Archive::setup.
10946 2008-03-29  Ian Lance Taylor  <iant@google.com>
10948         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10949         version symbol to be local.
10950         * testsuite/ver_test_4.sh: New file.
10951         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10952         (check_DATA): Add ver_test_4.syms.
10953         (ver_test_4.syms): New target.
10954         * testsuite/Makefile.in: Rebuild.
10956         * output.cc
10957         (Output_section::Input_section_sort_entry::has_priority): New
10958         function.
10959         (Output_section::Input_section_sort_entry::match_file_name): New
10960         function.
10961         (Output_section::Input_section_sort_entry::match_section_name):
10962         Remove.
10963         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10964         Remove.
10965         (Output_section::Input_section_sort_entry::match_section_file):
10966         Remove.
10967         (Output_section::Input_section_sort_compare::operator()): Rewrite
10968         using new Input_section_sort_entry functions.  Sort crtbegin and
10969         crtend first.  Sort sections with no priority before sections with
10970         a priority.
10971         * testsuite/initpri1.c (d3): Check j != 4.
10972         (cd5): New constructor/destructor function.
10973         (main): Check j != 2.
10975         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10976         new symbol when resolving, don't call set_is_default.
10977         * testsuite/ver_test_7.cc: New file.
10978         * testsuite/ver_test_7.sh: New file.
10979         * testsuite/Makefile.am (ver_test_7.so): New target.
10980         (ver_test_7.o): New target.
10981         (check_SCRIPTS): Add ver_test_7.sh.
10982         (check_DATA): Add ver_test_7.syms.
10983         (ver_test_7.syms): New target.
10985 2008-03-28  Ian Lance Taylor  <iant@google.com>
10987         * layout.cc (Layout::layout): If we see an input section with a
10988         name that needs sorting, set the must_sort flag for the output
10989         section.
10990         (Layout::make_output_section): If the name of the output section
10991         indicates that it might require sorting, set the may_sort flag.
10992         * output.h (Output_section::may_sort_attached_input_sections): New
10993         function.
10994         (Output_section::set_may_sort_attached_input_sections): New
10995         function.
10996         (Output_section::must_sort_attached_input_sections): New
10997         function.
10998         (Output_section::set_must_sort_attached_input_sections): New
10999         function.
11000         (class Output_section): Declare Input_section_sort_entry.  Define
11001         Input_section_sort_compare.  Declare
11002         sort_attached_input_sections.  Add new fields:
11003         may_sort_attached_input_sections_,
11004         must_sort_attached_input_sections_,
11005         attached_input_sections_are_sorted_.
11006         * output.cc (Output_section::Output_section): Initialize new
11007         fields.
11008         (Output_section::add_input_section): Add an entry to
11009         input_sections_ if may_sort or must_sort are true.
11010         (Output_section::set_final_data_size): Call
11011         sort_attached_input_sections if necessary.
11012         (Output_section::Input_section_sort_entry): Define new class.
11013         (Output_section::Input_section_sort_compare::operator()): New
11014         function.
11015         (Output_section::sort_attached_input_sections): New function.
11016         * configure.ac: Check whether the compiler supports constructor
11017         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11018         * testsuite/initpri1.c: New file.
11019         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11020         CONSTRUCTOR_PRIORITY.
11021         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11022         (initpri1_LDFLAGS): New variable.
11023         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11025 2008-03-27  Ian Lance Taylor  <iant@google.com>
11027         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11028         * testsuite/common_test_1.c: New file.
11029         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11030         (common_test_1_SOURCES): New variable.
11031         (common_test_1_DEPENDENCIES): New variable.
11032         (common_test_1_LDFLAGS): New variable.
11034         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11035         and commons_ correctly when NAME/VERSION does not override
11036         NAME/NULL.
11037         * testsuite/ver_test_6.c: New file.
11038         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11039         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11040         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11042 2008-03-26  Ian Lance Taylor  <iant@google.com>
11044         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11045         of an undefined symbol from a version script.
11046         * testsuite/Makefile.am (ver_test_5.so): New target.
11047         (ver_test_5.o): New target.
11048         (check_SCRIPTS): Add ver_test_5.sh.
11049         (check_DATA): Add ver_test_5.syms.
11050         (ver_test_5.syms): New target.
11051         * testsuite/ver_test_5.cc: New file.
11052         * testsuite/ver_test_5.script: New file.
11053         * testsuite/ver_test_5.sh: New file.
11054         * Makefile.in, testsuite/Makefile.in: Rebuild.
11056         PR gold/5986
11057         Fix problems building gold with gcc 4.3.0.
11058         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11059         (gold_error_at_location, gold_warning_at_location): Use it.
11060         * configure.ac: Check whether we can compile and use a template
11061         function with a printf attribute.
11062         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11063         when jumping over bytes.
11064         * object.cc: Instantiate Object::read_section_data.
11065         * debug.h: Include <cstring>
11066         * dwarf_reader.cc: Include <algorithm>
11067         * main.cc: Include <cstring>.
11068         * options.cc: Include <cstring>.
11069         * output.cc: Include <cstring>.
11070         * script.cc: Include <cstring>.
11071         * script.h: Include <string>.
11072         * symtab.cc: Include <cstring> and <algorithm>.
11073         * target-select.cc: Include <cstring>.
11074         * version.cc: Include <string>.
11075         * testsuite/testmain.cc: Include <cstdlib>.
11076         * configure, config.in: Rebuild.
11078 2008-03-25  Ian Lance Taylor  <iant@google.com>
11080         * options.cc: Include "../bfd/bfdver.h".
11081         (options::help): Print bug reporting address.
11083         * version.cc (print_version): Adjust output for current value of
11084         BFD_VERSION_STRING.
11086         * NEWS: New file.
11088         * options.cc (options::help): Print list of supported targets.
11089         * target-select.h: Include <vector>.
11090         (class Target_selector): Make machine_, size_, and is_big_endian_
11091         fields const.  Add bfd_name_ and instantiated_target_ fields.
11092         (Target_selector::Target_selector): Add bfd_name parameter.
11093         (Target_selector::recognize): Make non-virtual, call
11094         do_recognize.
11095         (Target_selector::recognize_by_name): Make non-virtual, call
11096         do_recognize_by_name.
11097         (Target_selector::supported_names): New function.
11098         (Target_selector::bfd_name): New function.
11099         (Target_selector::do_instantiate_target): New pure virtual
11100         function.
11101         (Target_selector::do_recognize): New virtual function.
11102         (Target_selector::do_recognize_by_name): New virtual function.
11103         (Target_selector::instantiate_target): New private function.
11104         (supported_target_names): Declare.
11105         * target-select.cc (Target_selector::Target_selector): Update for
11106         new parameter and fields.
11107         (select_target_by_name): Check that the name matches before
11108         calling recognize_by_name.
11109         (supported_target_names): New function.
11110         * i386.cc (class Target_selector_i386): Update Target_selector
11111         constructor call.  Remove recognize and recognize_by_name.  Add
11112         do_instantiate_target.
11113         * x86_64.cc (class Target_selector_x86_64): Likewise.
11114         * testsuite/testfile.cc (class Target_selector_test): Update for
11115         changes to Target_selector.
11117         * README: Rewrite, with some notes on unsupported features.
11119 2008-03-24  Cary Coutant  <ccoutant@google.com>
11121         * i386.cc (Target_i386::Got_type): New enum declaration.
11122         (Target_i386::Scan::local): Updated callers of Output_data_got
11123         member functions.
11124         (Target_i386::Scan::global): Likewise.
11125         (Target_i386::Relocate::relocate): Likewise.
11126         (Target_i386::Relocate::relocate_tls): Likewise.
11127         * object.h (Got_offset_list): New class.
11128         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11129         (Sized_relobj::local_got_offset): Likewise.
11130         (Sized_relobj::set_local_got_offset): Likewise.
11131         (Sized_relobj::local_has_tls_got_offset): Removed.
11132         (Sized_relobj::local_tls_got_offset): Removed.
11133         (Sized_relobj::set_local_tls_got_offset): Removed.
11134         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11135         * output.cc (Output_data_got::add_global): Added got_type parameter.
11136         (Output_data_got::add_global_with_rel): Likewise.
11137         (Output_data_got::add_global_with_rela): Likewise.
11138         (Output_data_got::add_global_pair_with_rel): New function.
11139         (Output_data_got::add_global_pair_with_rela): New function.
11140         (Output_data_got::add_local): Added got_type parameter.
11141         (Output_data_got::add_local_with_rel): Likewise.
11142         (Output_data_got::add_local_with_rela): Likewise.
11143         (Output_data_got::add_local_pair_with_rel): New function.
11144         (Output_data_got::add_local_pair_with_rela): New function.
11145         (Output_data_got::add_global_tls): Removed.
11146         (Output_data_got::add_global_tls_with_rel): Removed.
11147         (Output_data_got::add_global_tls_with_rela): Removed.
11148         (Output_data_got::add_local_tls): Removed.
11149         (Output_data_got::add_local_tls_with_rel): Removed.
11150         (Output_data_got::add_local_tls_with_rela): Removed.
11151         * output.h (Output_data_got::add_global): Added got_type parameter.
11152         (Output_data_got::add_global_with_rel): Likewise.
11153         (Output_data_got::add_global_with_rela): Likewise.
11154         (Output_data_got::add_global_pair_with_rel): New function.
11155         (Output_data_got::add_global_pair_with_rela): New function.
11156         (Output_data_got::add_local): Added got_type parameter.
11157         (Output_data_got::add_local_with_rel): Likewise.
11158         (Output_data_got::add_local_with_rela): Likewise.
11159         (Output_data_got::add_local_pair_with_rel): New function.
11160         (Output_data_got::add_local_pair_with_rela): New function.
11161         (Output_data_got::add_global_tls): Removed.
11162         (Output_data_got::add_global_tls_with_rel): Removed.
11163         (Output_data_got::add_global_tls_with_rela): Removed.
11164         (Output_data_got::add_local_tls): Removed.
11165         (Output_data_got::add_local_tls_with_rel): Removed.
11166         (Output_data_got::add_local_tls_with_rela): Removed.
11167         * resolve.cc (Symbol::override_base_with_special): Removed
11168         reference to has_got_offset_ field.
11169         * symtab.cc (Symbol::init_fields): Replaced initialization
11170         of got_offset_ with got_offsets_.  Removed initialization
11171         of has_got_offset_
11172         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11173         (Symbol::got_offset): Likewise.
11174         (Symbol::set_got_offset): Likewise.
11175         (Symbol::has_tls_got_offset): Removed.
11176         (Symbol::tls_got_offset): Removed.
11177         (Symbol::set_tls_got_offset): Removed.
11178         (Symbol::got_offset_): Removed.
11179         (Symbol::tls_mod_got_offset_): Removed.
11180         (Symbol::tls_pair_got_offset_): Removed.
11181         (Symbol::got_offsets_): New field.
11182         (Symbol::has_got_offset): Removed.
11183         (Symbol::has_tls_mod_got_offset): Removed.
11184         (Symbol::has_tls_pair_got_offset): Removed.
11185         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11186         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11187         member functions.
11188         (Target_x86_64::Scan::global): Likewise.
11189         (Target_x86_64::Relocate::relocate): Likewise.
11190         (Target_x86_64::Relocate::relocate_tls): Likewise.
11192 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11194         * yyscript.y: Fix spelling error in comment.
11196 2008-03-24  Ian Lance Taylor  <iant@google.com>
11198         * options.h (class General_options): Define build_id option.
11199         * layout.h (class Layout): Declare write_build_id, create_note,
11200         create_build_id.  Add build_id_note_ member.
11201         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11202         "libiberty.h", "md5.h", "sha1.h".
11203         (Layout::Layout): Initialize eh_frame_data_,
11204         eh_frame_hdr_section_, and build_id_note_.
11205         (Layout::finalize): Call create_build_id.
11206         (Layout::create_note): New function, broken out of
11207         Layout::create_gold_note.
11208         (Layout::create_gold_note): Call create_note.
11209         (Layout::create_build_id): New function.
11210         (Layout::write_build_id): New function.
11211         (Close_task_runner::run): Call write_build_id.
11213         * x86_64.cc: Correct license to GPLv3.
11215 2008-03-23  Ian Lance Taylor  <iant@google.com>
11217         * options.cc: Include "demangle.h".
11218         (parse_optional_string): New function.
11219         (parse_long_option): Handle takes_optional_argument.
11220         (parse_short_option): Update dash_z initializer.  Handle
11221         takes_optional_argument.
11222         (General_options::General_options): Initialize do_demangle_.
11223         (General_options::finalize): Set do_demangle_.  Handle demangling
11224         style.
11225         * options.h (parse_optional_string): Declare.
11226         (struct One_option): Add optional_arg field.  Update constructor.
11227         Update call constructor calls.  Add takes_optional_argument
11228         function.
11229         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11230         (DEFINE_optional_string): Define.
11231         (General_options::demangle): Change from DEFINE_bool to
11232         DEFINE_optional_string.
11233         (General_options::no_demangle): New function.
11234         (General_options::do_demangle): New function.
11235         (General_options::set_do_demangle): New function.
11236         (General_options::execstack_status_): Move definition to end of
11237         class definition.
11238         (General_options::static_): Likewise.
11239         (General_options::do_demangle_): New field.
11240         * object.cc (big_endian>::get_symbol_location_info): Call
11241         Options::do_demangle, not Options::demangle.
11242         * symtab.cc (demangle): Likewise.
11244 2008-03-22  Ian Lance Taylor  <iant@google.com>
11246         * gold.h: Include <cstddef> and <sys/types.h>
11247         * options.h: Include <cstring>.
11249 2008-03-21  Ian Lance Taylor  <iant@google.com>
11251         * Added source code to GNU binutils.