* layout.cc (Layout::finish_dynamic_section): Don't create
[platform/upstream/binutils.git] / gold / ChangeLog
1 2011-06-18  Ian Lance Taylor  <iant@google.com>
2
3         * layout.cc (Layout::finish_dynamic_section): Don't create
4         DT_FLAGS entry if not needed.
5
6 2011-06-18  Ian Lance Taylor  <iant@google.com>
7
8         PR gold/12745
9         * layout.cc (Layout::layout_eh_frame): Correct handling of
10         writable .eh_frame section.
11
12 2011-06-17  Ian Lance Taylor  <iant@google.com>
13
14         PR gold/12893
15         * resolve.cc (Symbol_table::resolve): Don't give an error if a
16         symbol is redefined with the exact same object and value.
17
18 2011-06-17  Ian Lance Taylor  <iant@google.com>
19
20         PR gold/12880
21         * layout.h (class Layout): Add interp_segment_ field.
22         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
23         (Layout::attach_allocated_section_to_segment): If making shared
24         library, put .interp section in PT_INTERP segment.
25         (Layout::finalize): Also call create_interp if -dynamic-linker
26         option was used.
27         (Layout::create_interp): Assert that there is no PT_INTERP
28         segment.  If not using a SECTIONS clause, use make_output_section.
29         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
30         * script-sections.cc
31         (Script_sections::create_note_and_tls_segments): If making shared
32         library, put .interp section in PT_INTERP segment.
33
34 2011-06-17  Ian Lance Taylor  <iant@google.com>
35
36         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
37         when making a shared library.
38
39 2011-06-17  Ian Lance Taylor  <iant@google.com>
40
41         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
42         parameter.  Change all callers.  Don't issue warning about PC32
43         against locally defined symbol.
44
45 2011-06-16  Ian Lance Taylor  <iant@google.com>
46
47         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
48         occurs in same object.
49
50 2011-06-14  Alan Modra  <amodra@gmail.com>
51
52         * po/POTFILES.in: Regenerate.
53
54 2011-06-09  Ian Lance Taylor  <iant@google.com>
55
56         * script-sections.cc
57         (Orphan_output_section::set_section_addresses): For a relocatable
58         link set address to 0.
59
60 2011-06-09  Cary Coutant  <ccoutant@google.com>
61
62         PR gold/12804
63         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
64         used with --compress-debug-sections.
65         * gold/object.cc (Sized_relobj_file::do_layout): Report
66         uncompressed size of compressed input sections.
67
68 2011-06-08  Cary Coutant  <ccoutant@google.com>
69
70         PR gold/12804
71         * testsuite/two_file_test_2_v1.cc: Change initialization of
72         v2 to keep it in .data.
73
74 2011-06-07  Cary Coutant  <ccoutant@google.com>
75
76         * common.cc (Symbol_table::do_allocate_commons_list): Call
77         gold_fallback.
78         * errors.cc (Errors::fatal): Adjust call to gold_exit.
79         (Errors::fallback): New function.
80         (gold_fallback): New function.
81         * errors.h (Errors::fallback): New function.
82         * gold.cc (gold_exit): Change status parameter to enum; adjust
83         all callers.
84         (queue_initial_tasks): Call gold_fallback.
85         * gold.h: Include cstdlib.
86         (Exit_status): New enum type.
87         (gold_exit): Change status parameter to enum.
88         (gold_fallback): New function.
89         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
90         (Layout::create_symtab_sections): Likewise.
91         (Layout::create_shdrs): Likewise.
92         * main.cc (main): Adjust call to gold_exit.
93         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
94         (Output_data_got::add_got_entry_pair): Likewise.
95         (Output_section::add_input_section): Likewise.
96         (Output_section::add_output_section_data): Likewise.
97         (Output_segment::set_section_list_addresses): Likewise.
98         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
99
100 2011-06-07  Cary Coutant  <ccoutant@google.com>
101
102         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
103         for incremental links.
104         * output.cc (Output_segment::set_section_list_addresses): Remove
105         FIXME and test for TLS or BSS.
106
107 2011-06-07  Cary Coutant  <ccoutant@google.com>
108
109         * testsuite/Makefile.am: Add incremental_copy_test,
110         incremental_common_test_1.
111         * testsuite/Makefile.in: Regenerate.
112         * testsuite/common_test_1_v1.c: New source file.
113         * testsuite/common_test_1_v2.c: New source file.
114         * testsuite/copy_test_v1.cc: New source file.
115
116 2011-06-07  Cary Coutant  <ccoutant@google.com>
117
118         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
119         update, allocate common from bss section's free list.
120         * incremental-dump.cc (dump_incremental_inputs): Print flag for
121         linker-defined symbols.
122         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
123         Skip GOT and PLT entries that are no longer referenced.
124         (Output_section_incremental_inputs::write_info_blocks): Mark
125         linker-defined symbols.
126         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
127         * output.cc (Output_section::allocate): New function.
128         * output.h (Output_section::allocate): New function.
129         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
130         linker-defined symbols.
131         (Symbol::override_base_with_special): Copy is_predefined_ flag.
132         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
133         (Symbol::init_base_output_data): Likewise.
134         (Symbol::init_base_output_segment): Likewise.
135         (Symbol::init_base_constant): Likewise.
136         (Sized_symbol::init_output_data): Likewise.
137         (Sized_symbol::init_output_segment): Likewise.
138         (Sized_symbol::init_constant): Likewise.
139         (Symbol_table::do_define_in_output_data): Likewise.
140         (Symbol_table::do_define_in_output_segment): Likewise.
141         (Symbol_table::do_define_as_constant): Likewise.
142         * symtab.h (Symbol::is_predefined): New function.
143         (Symbol::init_base_output_data): Add is_predefined parameter.
144         (Symbol::init_base_output_segment): Likewise.
145         (Symbol::init_base_constant): Likewise.
146         (Symbol::is_predefined_): New data member.
147         (Sized_symbol::init_output_data): Add is_predefined parameter.
148         (Sized_symbol::init_output_segment): Likewise.
149         (Sized_symbol::init_constant): Likewise.
150         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
151
152 2011-06-07  Cary Coutant  <ccoutant@google.com>
153
154         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
155         instead of emit_copy_reloc.
156         (Copy_relocs::emit_copy_reloc): Refactor.
157         (Copy_relocs::make_copy_reloc): New function.
158         (Copy_relocs::add_copy_reloc): Remove.
159         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
160         section.
161         (Copy_relocs::make_copy_reloc): New function.
162         (Copy_relocs::add_copy_reloc): Remove.
163         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
164         unchanged input files.
165         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
166         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
167         Reserve BSS space for COPY relocations.
168         (Sized_incremental_binary::do_emit_copy_relocs): New function.
169         (Output_section_incremental_inputs::write_info_blocks): Record
170         whether a symbol is copied from a shared object.
171         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
172         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
173         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
174         (Incremental_input_entry_reader::get_output_symbol_index): Add
175         is_copy parameter.
176         (Incremental_binary::emit_copy_relocs): New function.
177         (Incremental_binary::do_emit_copy_relocs): New function.
178         (Sized_incremental_binary::Sized_incremental_binary): Initialize
179         new data member.
180         (Sized_incremental_binary::add_copy_reloc): New function.
181         (Sized_incremental_binary::do_emit_copy_relocs): New function.
182         (Sized_incremental_binary::Copy_reloc): New struct.
183         (Sized_incremental_binary::Copy_relocs): New typedef.
184         (Sized_incremental_binary::copy_relocs_): New data member.
185         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
186         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
187         * target.h (Sized_target::emit_copy_reloc): New function.
188         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
189
190 2011-06-02  Cary Coutant  <ccoutant@google.com>
191
192         PR gold/12163
193         * gold/archive.cc (Archive::Archive): Initialize new data member.
194         (Archive::include_all_members): Return if archive has already been
195         included.
196         * gold/archive.h (Archive::include_all_members_): New data member.
197
198 2011-06-02  Nick Clifton  <nickc@redhat.com>
199
200         * dynobj.h: Fix spelling mistake in comment.
201         * output.cc: Likewise.
202
203 2011-05-31  Doug Kwan  <dougkwan@google.com>
204             Asier Llano
205
206         PR gold/12826
207         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
208         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
209         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
210         redundant arm_exidx_test.so.
211         * testsuite/Makefile.in: Regenerate.
212         (check_SCRIPTS): Add pr12826.sh
213         (check_DATA): Add pr12826.stdout
214         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
215         * testsuite/pr12826.sh: New file.
216         * testsuite/pr12826_1.s: Ditto.
217         * testsuite/pr12826_1.s: Ditto.
218
219 2011-05-30  Ian Lance Taylor  <iant@google.com>
220
221         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
222         sections.
223
224 2011-05-29  Ian Lance Taylor  <iant@google.com>
225
226         PR gold/12804
227         * testsuite/Makefile.am: Use different file name for two_file_test
228         temporary file for each incremental test.
229         * testsuite/Makefile.in: Rebuild.
230
231 2011-05-29  Ian Lance Taylor  <iant@google.com>
232
233         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
234         binary input file is empty.
235
236 2011-05-27  Ian Lance Taylor  <iant@google.com>
237
238         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
239         (ver_test_9.so): Likewise.
240         * testsuite/Makefile.in: Rebuild.
241
242 2011-05-26 Cary Coutant  <ccoutant@google.com>
243
244         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
245         * incremental.cc (Incremental_inputs::report_input_section): Fix
246         comment, indentation.
247         (Incremental_inputs::report_comdat_group): New function.
248         (Output_section_incremental_inputs::set_final_data_size): Adjust size
249         of data for incremental input file entry.
250         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
251         group count, COMDAT group signatures.
252         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
253         an unchanged input file.
254         * incremental.h (Incremental_object_entry::Incremental_object_entry):
255         Initialize new data member.
256         (Incremental_object_entry::add_comdat_group): New function.
257         (Incremental_object_entry::get_comdat_group_count): New function.
258         (Incremental_object_entry::get_comdat_signature_key): New function.
259         (Incremental_object_entry::groups_): New data member.
260         (Incremental_inputs::report_comdat_group): New function.
261         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
262         data for incremental input file entry.
263         (Incremental_input_entry_reader::get_comdat_group_count): New function.
264         (Incremental_input_entry_reader::get_input_section): Adjust size of
265         data for incremental input file entry.
266         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
267         (Incremental_input_entry_reader::get_comdat_group_signature): New
268         function.
269         * object.cc (Sized_relobj::include_section_group): Report kept
270         COMDAT groups for incremental links.
271
272 2011-05-24  David Meyer  <pdox@google.com>
273
274         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
275         with name parameter.  Add found_name parameter.
276         * fileread.cc (Input_file::find_file): Adjust code accordingly.
277         * dirsearch.h (class Dirsearch): Update declaration.
278
279 2011-05-24  Ian Lance Taylor  <iant@google.com>
280
281         * archive.cc (Library_base::should_include_member): Pull in object
282         from archive if it defines the entry symbol.
283         * parameters.cc (Parameters::entry): New function.
284         * parameters.h (class Parameters): Declare entry.
285         * output.h (class Output_file_header): Remove entry_ field.
286         * output.cc (Output_file_header::Output_file_header): Remove entry
287         parameter.  Change all callers.
288         (Output_file_header::entry): Use parameters->entry.
289         * gold.cc (queue_middle_tasks): Likewise.
290         * plugin.cc (Plugin_hook::run): Likewise.
291
292 2011-05-24 Cary Coutant  <ccoutant@google.com>
293
294         * gold.cc (queue_initial_tasks): Pass incremental base filename
295         to Output_file::open_base_file; don't print error message.
296         * incremental-dump.cc (main): Adjust call to
297         Output_file::open_for_modification.
298         * incremental-dump.cc (main): Likewise.
299         * incremental.cc (Incremental_inputs::report_command_line):
300         Ignore --incremental-base option when comparing command lines.
301         Ignore parameter when given as separate argument.
302         * options.h (class General_options): Add --incremental-base.
303         * output.cc (Output_file::Output_file):
304         (Output_file::open_base_file): Add base_name and writable parameters;
305         read base file into new file; print error message here.
306         (Output_file::map_no_anonymous): Add writable parameter; adjust all
307         callers.
308         * output.h (Output_file::open_for_modification): Rename to...
309         (Output_file::open_base_file): ...this; add base_name and
310         writable parameters; adjust all callers.
311         (Output_file::map_no_anonymous): Add writable parameter; adjust all
312         callers.
313         * testsuite/Makefile.am (incremental_test_4): Test
314         --incremental-base.
315         * testsuite/Makefile.in: Regenerate.
316
317 2011-05-24 Cary Coutant  <ccoutant@google.com>
318
319         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
320         incremental_test_4.
321         * testsuite/Makefile.in: Regenerate.
322         * testsuite/two_file_test_1_v1.cc: New test source file.
323         * testsuite/two_file_test_1b_v1.cc: New test source file.
324         * testsuite/two_file_test_2_v1.cc: New test source file.
325
326 2011-05-24 Cary Coutant  <ccoutant@google.com>
327
328         * dynobj.h (Dynobj::do_dynobj): New function.
329         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
330         flag and soname for shared objects.
331         * incremental.cc (Incremental_inputs::report_object): Make
332         either Incremental_object_entry or Incremental_dynobj_entry; add
333         soname to string table.
334         (Incremental_inputs::report_input_section): Add assertion.
335         (Output_section_incremental_inputs::set_final_data_size): Adjust
336         type of input file entry for shared libraries; adjust size of
337         shared library info entry.
338         (Output_section_incremental_inputs::write_input_files): Write
339         as_needed flag for shared libraries.
340         (Output_section_incremental_inputs::write_info_blocks): Adjust type
341         of input file entry for shared libraries; write soname.
342         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
343         soname from incremental info.
344         * incremental.h (enum Incremental_input_flags): Add
345         INCREMENTAL_INPUT_AS_NEEDED.
346         (Incremental_input_entry::Incremental_input_entry): Initialize new
347         data member.
348         (Incremental_input_entry::set_as_needed): New function.
349         (Incremental_input_entry::as_needed): New function.
350         (Incremental_input_entry::do_dynobj_entry): New function.
351         (Incremental_input_entry::as_needed_): New data member.
352         (Incremental_object_entry::Incremental_object_entry): Don't check
353         for shared library.
354         (Incremental_object_entry::do_type): Likewise.
355         (class Incremental_dynobj_entry): New class.
356         (Incremental_input_entry_reader::as_needed): New function.
357         (Incremental_input_entry_reader::get_soname): New function.
358         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
359         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
360         size of shared library info entry.
361         * layout.cc (Layout::finish_dynamic_section): Don't test for 
362         incremental link when adding DT_NEEDED entries.
363         * object.h (Object::Object): Initialize new data member.
364         (Object::dynobj): New function.
365         (Object::set_as_needed): New function.
366         (Object::as_needed): New function.
367         (Object::do_dynobj): New function.
368         (Object::as_needed_): New data member.
369
370 2011-05-24 Cary Coutant  <ccoutant@google.com>
371
372         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
373         info; adjust display of GOT entries.
374         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
375         vector of input objects; remove file_status_.
376         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
377         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
378         got_plt reader; call target hooks to reserve GOT entries.
379         (Output_section_incremental_inputs::set_final_data_size): Adjust size
380         of input file info header and GOT info entry.
381         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
382         relocation info.
383         (Got_plt_view_info::got_descriptor): Remove.
384         (Got_plt_view_info::sym_index): New data member.
385         (Got_plt_view_info::input_index): New data member.
386         (Local_got_offset_visitor::visit): Write input file index.
387         (Global_got_offset_visitor::visit): Write 0 for input file index.
388         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
389         with sym_index and input_index.
390         (Output_section_incremental_inputs::write_got_plt): Adjust size of
391         incremental info GOT entry; replace got_descriptor with input_index.
392         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
393         map from input file index to object.
394         (Sized_relobj_incr::do_layout): Replace direct data member reference
395         with accessor function.
396         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
397         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
398         Adjust size of input file info header.
399         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
400         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
401         (Incremental_input_entry_reader::get_input_section): Adjust size of
402         input file info header.
403         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
404         of incremental info GOT entry.
405         (Incremental_got_plt_reader::get_got_desc): Remove.
406         (Incremental_got_plt_reader::get_got_symndx): New function.
407         (Incremental_got_plt_reader::get_got_input_index): New function.
408         (Sized_incremental_binary::Sized_incremental_binary): Remove
409         file_status_; add input_objects_.
410         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
411         (Sized_incremental_binary::set_file_is_unchanged): Remove.
412         (Sized_incremental_binary::file_is_unchanged): Remove.
413         (Sized_incremental_binary::set_input_object): New function.
414         (Sized_incremental_binary::input_object): New function.
415         (Sized_incremental_binary::file_status_): Remove.
416         (Sized_incremental_binary::input_objects_): New data member.
417         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
418         references.
419         (Sized_relobj_incr::invalid_address): Move to base class.
420         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
421         class.
422         (Sized_relobj_incr::do_output_section_offset): Likewise.
423         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
424         (Sized_relobj_incr::section_offsets_): Likewise.
425         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
426         function.
427         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
428         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
429         with accessor function.
430         (Sized_relobj_file::do_layout): Likewise.
431         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
432         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
433         (Sized_relobj_file::compute_final_local_value): Replace refs to
434         section_offsets_ with accessor function.
435         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
436         * object.h (Relobj::Relobj): Initialize new data members.
437         (Relobj::add_dyn_reloc): New function.
438         (Relobj::first_dyn_reloc): New function.
439         (Relobj::dyn_reloc_count): New function.
440         (Relobj::first_dyn_reloc_): New data member.
441         (Relobj::dyn_reloc_count_): New data member.
442         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
443         references.
444         (Sized_relobj::Address): New typedef.
445         (Sized_relobj::invalid_address): Move here from child class.
446         (Sized_relobj::Sized_relobj): Initialize new data members.
447         (Sized_relobj::sized_relobj): New function.
448         (Sized_relobj::is_output_section_offset_invalid): Move here from
449         child class.
450         (Sized_relobj::get_output_section_offset): Likewise.
451         (Sized_relobj::local_has_got_offset): Likewise.
452         (Sized_relobj::local_got_offset): Likewise.
453         (Sized_relobj::set_local_got_offset): Likewise.
454         (Sized_relobj::do_for_all_local_got_entries): Likewise.
455         (Sized_relobj::clear_got_offsets): New function.
456         (Sized_relobj::section_offsets): Move here from child class.
457         (Sized_relobj::do_output_section_offset): Likewise.
458         (Sized_relobj::do_set_section_offset): Likewise.
459         (Sized_relobj::Local_got_offsets): Likewise.
460         (Sized_relobj::local_got_offsets_): Likewise.
461         (Sized_relobj::section_offsets_): Likewise.
462         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
463         references.
464         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
465         class.
466         (Sized_relobj_file::sized_relobj): New function
467         (Sized_relobj_file::local_has_got_offset): Move to base class.
468         (Sized_relobj_file::local_got_offset): Likewise.
469         (Sized_relobj_file::set_local_got_offset): Likewise.
470         (Sized_relobj_file::get_output_section_offset): Likewise.
471         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
472         (Sized_relobj_file::do_output_section_offset): Likewise.
473         (Sized_relobj_file::do_set_section_offset): Likewise.
474         (Sized_relobj_file::Local_got_offsets): Likewise.
475         (Sized_relobj_file::local_got_offsets_): Likewise.
476         (Sized_relobj_file::section_offsets_): Likewise.
477         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
478         (all constructors).
479         (set_needs_dynsym_index): Convert relobj to derived class pointer.
480         (Output_reloc::get_symbol_index): Likewise.
481         (Output_reloc::local_section_offset): Likewise.
482         (Output_reloc::get_address): Likewise.
483         (Output_reloc::symbol_value): Likewise.
484         (Output_data_got::reserve_slot): Move to class definition.
485         (Output_data_got::reserve_local): New function.
486         (Output_data_got::reserve_slot_for_global): Remove.
487         (Output_data_got::reserve_global): New function.
488         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
489         (all constructors, two instantiations).
490         (Output_reloc::get_relobj): New function (two instantiations).
491         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
492         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
493         (Output_data_reloc::add_global): Adjust type of relobj.
494         (Output_data_reloc::add_global_relative): Likewise.
495         (Output_data_reloc::add_symbolless_global_addend): Likewise.
496         (Output_data_reloc::add_local): Likewise.
497         (Output_data_reloc::add_local_relative): Likewise.
498         (Output_data_reloc::add_symbolless_local_addend): Likewise.
499         (Output_data_reloc::add_local_section): Likewise.
500         (Output_data_reloc::add_output_section): Likewise.
501         (Output_data_reloc::add_absolute): Likewise.
502         (Output_data_reloc::add_target_specific): Likewise.
503         (Output_data_got::reserve_slot): Move definition here.
504         (Output_data_got::reserve_local): New function.
505         (Output_data_got::reserve_global): New function.
506         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
507         section_offsets_ with accessor function.
508         (Sized_relobj_file::write_sections): Likewise.
509         (Sized_relobj_file::do_relocate_sections): Likewise.
510         * target.h (Sized_target::reserve_local_got_entry): New function.
511         (Sized_target::reserve_global_got_entry): New function.
512         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
513         (Target_x86_64::reserve_global_got_entry): New function.
514         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
515
516 2011-05-23 Cary Coutant  <ccoutant@google.com>
517
518         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
519         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
520         bit when checking got_type.
521         * incremental.cc (Sized_incremental_binary::setup_readers):
522         Store symbol table and string table locations; initialize bit vector
523         of file status flags.
524         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
525         unchanged files.
526         (Sized_incremental_binary::do_process_got_plt): New function.
527         (Sized_incremental_binary::get_symtab_view): Use stored locations.
528         (Output_section_incremental_inputs::set_final_data_size): Record
529         file index for each input file.
530         (Output_section_incremental_inputs::write_got_plt): Store file index
531         instead of input entry offset for each GOT entry.
532         * incremental.h
533         (Incremental_input_entry::Incremental_input_entry): Initialize new
534         data member.
535         (Incremental_input_entry::set_offset): Store file index.
536         (Incremental_input_entry::get_file_index): New function.
537         (Incremental_input_entry::file_index_): New data member.
538         (Incremental_binary::process_got_plt): New function.
539         (Incremental_binary::do_process_got_plt): New function.
540         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
541         data members.
542         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
543         (Sized_incremental_binary::set_file_is_unchanged): New function.
544         (Sized_incremental_binary::file_is_unchanged): New function.
545         (Sized_incremental_binary::do_process_got_plt): New function.
546         (Sized_incremental_binary::file_status_): New data member.
547         (Sized_incremental_binary::main_symtab_loc_): New data member.
548         (Sized_incremental_binary::main_strtab_loc_): New data member.
549         * output.cc (Output_data_got::Got_entry::write): Add case
550         RESERVED_CODE.
551         (Output_data_got::add_global): Call add_got_entry.
552         (Output_data_got::add_global_plt): Likewise.
553         (Output_data_got::add_global_with_rel): Likewise.
554         (Output_data_got::add_global_with_rela): Likewise.
555         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
556         (Output_data_got::add_global_pair_with_rela): Likewise.
557         (Output_data_got::add_local): Call add_got_entry.
558         (Output_data_got::add_local_plt): Likewise.
559         (Output_data_got::add_local_with_rel): Likewise.
560         (Output_data_got::add_local_with_rela): Likewise.
561         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
562         (Output_data_got::add_local_pair_with_rela): Likewise.
563         (Output_data_got::reserve_slot): New function.
564         (Output_data_got::reserve_slot_for_global): New function.
565         (Output_data_got::add_got_entry): New function.
566         (Output_data_got::add_got_entry_pair): New function.
567         (Output_section::add_output_section_data): Edit FIXME.
568         * output.h
569         (Output_section_data_build::Output_section_data_build): New
570         constructor with size parameter.
571         (Output_data_space::Output_data_space): Likewise.
572         (Output_data_got::Output_data_got): Initialize new data member; new
573         constructor with size parameter.
574         (Output_data_got::add_constant): Call add_got_entry.
575         (Output_data_got::reserve_slot): New function.
576         (Output_data_got::reserve_slot_for_global): New function.
577         (class Output_data_got::Got_entry): Add RESERVED_CODE.
578         (Output_data_got::add_got_entry): New function.
579         (Output_data_got::add_got_entry_pair): New function.
580         (Output_data_got::free_list_): New data member.
581         * target.h (Sized_target::init_got_plt_for_update): New function.
582         (Sized_target::register_global_plt_entry): New function.
583         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
584         Initialize new data member; call init; add constructor with PLT count.
585         (Output_data_plt_x86_64::init): New function.
586         (Output_data_plt_x86_64::add_relocation): New function.
587         (Output_data_plt_x86_64::reserve_slot): New function.
588         (Output_data_plt_x86_64::free_list_): New data member.
589         (Target_x86_64::init_got_plt_for_update): New function.
590         (Target_x86_64::register_global_plt_entry): New function.
591         (Output_data_plt_x86_64::add_entry): Allocate from free list for
592         incremental updates.
593         (Output_data_plt_x86_64::add_relocation): New function.
594         * testsuite/object_unittest.cc (Object_test): Set default options.
595
596 2011-05-16  Ian Lance Taylor  <iant@google.com>
597
598         * options.h (class General_options): Make -i a synonym for -r.
599
600 2011-05-16  Ian Lance Taylor  <iant@google.com>
601
602         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
603
604 2011-05-10 Cary Coutant  <ccoutant@google.com>
605
606         * object.cc (Sized_relobj::do_count_local_symbols): Check for
607         strip_all (-s).
608
609 2011-05-06  Ian Lance Taylor  <iant@google.com>
610
611         * layout.cc (Layout::layout): If the output section flags change,
612         update the ordering.
613
614 2011-04-25 Cary Coutant  <ccoutant@google.com>
615
616         * incremental-dump.cc (dump_incremental_inputs): Print local
617         symbol info for each input file.
618         * incremental.cc
619         (Output_section_incremental_inputs::set_final_data_size): Add local
620         symbol info to input file entries in incremental info.
621         (Output_section_incremental_inputs::write_info_blocks): Likewise.
622         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
623         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
624         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
625         implementation.
626         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
627         (Sized_incr_relobj::do_relocate): Write the local symbols.
628         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
629         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
630         Adjust size of input file header.
631         (Incremental_inputs_reader::get_local_symbol_offset): New function.
632         (Incremental_inputs_reader::get_local_symbol_count): New function.
633         (Incremental_inputs_reader::get_input_section): Adjust size of input
634         file header.
635         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
636         (Sized_incr_relobj::This): New typedef.
637         (Sized_incr_relobj::sym_size): New const data member.
638         (Sized_incr_relobj::Local_symbol): New struct.
639         (Sized_incr_relobj::do_output_local_symbol_count): New function.
640         (Sized_incr_relobj::do_local_symbol_offset): New function.
641         (Sized_incr_relobj::local_symbol_count_): New data member.
642         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
643         (Sized_incr_relobj::local_symbol_index_): New data member.
644         (Sized_incr_relobj::local_symbol_offset_): New data member.
645         (Sized_incr_relobj::local_dynsym_offset_): New data member.
646         (Sized_incr_relobj::local_symbols_): New data member.
647         * object.h (Relobj::output_local_symbol_count): New function.
648         (Relobj::local_symbol_offset): New function.
649         (Relobj::do_output_local_symbol_count): New function.
650         (Relobj::do_local_symbol_offset): New function.
651         (Sized_relobj::do_output_local_symbol_count): New function.
652         (Sized_relobj::do_local_symbol_offset): New function.
653
654 2011-04-22  Vladimir Simonov  <sv@sw.ru>
655
656         * descriptors.cc (set_close_on_exec): New function.
657         (Descriptors::open): Use set_close_on_exec.
658         * output.cc (S_ISLNK): Define if not defined.
659
660 2011-04-22 Cary Coutant  <ccoutant@google.com>
661
662         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
663         global symbol map.
664         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
665         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
666         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
667         relocations.
668         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
669         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
670         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
671         * incremental.h
672         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
673         function.
674         (Incremental_binary::apply_incremental_relocs): New function.
675         (Incremental_binary::do_apply_incremental_relocs): New function.
676         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
677         data member.
678         (Sized_incremental_binary::add_global_symbol): New function.
679         (Sized_incremental_binary::global_symbol): New function.
680         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
681         (Sized_incremental_binary::symbol_map_): New data member.
682         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
683         * target.h (Sized_target::apply_relocation): New function.
684         * target-reloc.h (apply_relocation): New function.
685         * x86_64.cc (Target_x86_64::apply_relocation): New function.
686
687 2011-04-22  Doug Kwan  <dougkwan@google.com>
688
689         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
690         flag of a SHT_ARM_EXIDX section.
691         * testsuite/Makefile.am (arm_exidx_test): New test rules.
692         * testsuite/Makefile.in: Regenerate.
693         * testsuite/arm_exidx_test.s: New file.
694         * testsuite/arm_exidx_test.sh: Same.
695
696 2011-04-20 Cary Coutant  <ccoutant@google.com>
697
698         PR gold/12689
699         * archive.h (Incremental_archive_entry::Archive_member):
700         Initialize arg_serial_ (second constructor).
701
702 2011-04-17  Ian Lance Taylor  <iant@google.com>
703
704         * object.cc (Relocate_info::location): Simplify location string.
705         * errors.cc (Errors::error_at_location): Don't print program
706         name.
707         (Errors::warning_at_location): Likewise.
708         (Errors::undefined_symbol): Likewise.
709         * testsuite/debug_msg.sh: Update accordingly.
710
711 2011-04-14 Cary Coutant  <ccoutant@google.com>
712
713         * gold/layout.cc (Layout::symtab_section_offset): New function.
714         * gold/layout.h (Layout::symtab_section_offset): New function.
715         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
716
717 2011-04-12  Ian Lance Taylor  <iant@google.com>
718
719         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
720         with MREMAP_MAYMOVE.
721         * output.h (class Output_file): Add map_is_allocated_ field.
722         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
723         not available, provide stubs.  If mremap is not available, #define
724         it to gold_mremap.
725         (MREMAP_MAYMOVE): Define if not defined.
726         (Output_file::Output_file): Initialize map_is_allocated_.
727         (Output_file::resize): Check map_is_allocated_.
728         (Output_file::map_anonymous): If mmap fails, use malloc.
729         (Output_file::unmap): Don't do anything for an anonymous map.
730         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
731         is not available, provide stubs.
732         (File_read::View::~View): Use free rather than delete[].
733         (File_read::make_view): Use malloc rather than new[].  If mmap
734         fails, use malloc.
735         (File_read::find_or_make_view): Use malloc rather than new[].
736         * gold.h: Remove HAVE_REMAP code.
737         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
738         exists.  Rename mremap to gold_mremap.  If mmap is not available
739         don't do anything.
740         * configure, config.in: Rebuild.
741
742 2011-04-11  Ian Lance Taylor  <iant@google.com>
743
744         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
745         initialize local variable v.
746
747 2011-04-11  Cary Coutant  <ccoutant@google.com>
748
749         * archive.cc (Archive::include_member): Adjust call to
750         report_object.
751         (Add_archive_symbols::run): Track argument serial numbers.
752         (Lib_group::include_member): Likewise.
753         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
754         * archive.h (Incremental_archive_entry::Archive_member):
755         Initialize arg_serial_.
756         (Archive_member::arg_serial_): New data member.
757         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
758         (Sized_dynobj::do_add_symbols): Track symbols when doing an
759         incremental link.
760         (Sized_dynobj::do_for_all_local_got_entries): New function.
761         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
762         function.
763         * fileread.cc (get_mtime): New function.
764         * fileread.h (get_mtime): New function.
765         * gold.cc (queue_initial_tasks): Check for incremental update.
766         (process_incremental_input): New function.
767         (queue_middle_tasks): Don't force valid target for incremental
768         update.
769         * incremental-dump.cc (find_input_containing_global): Adjust
770         size of symbol info entry.
771         (dump_incremental_inputs): Dump argument serial number and
772         in_system_directory flag; bias shndx by 1; print symbol names
773         when dumping per-file symbol lists; use new symbol info readers.
774         * incremental.cc
775         (Output_section_incremental_inputs:update_data_size): New function.
776         (Sized_incremental_binary::setup_readers): Setup input readers
777         for each input file; build maps for files added from libraries
778         and scripts.
779         (Sized_incremental_binary::check_input_args): New function.
780         (Sized_incremental_binary::do_check_inputs): Build map of argument
781         serial numbers to input arguments.
782         (Sized_incremental_binary::do_file_has_changed): Rename
783         do_file_is_unchanged to this; compare file modification times.
784         (Sized_incremental_binary::do_init_layout): New function.
785         (Sized_incremental_binary::do_reserve_layout): New function.
786         (Sized_incremental_binary::do_get_input_reader): Remove.
787         (Sized_incremental_binary::get_symtab_view): New function.
788         (Incremental_checker::can_incrementally_link_output_file): Remove.
789         (Incremental_inputs::report_command_line): Exclude --debug options.
790         (Incremental_inputs::report_archive_begin): Add parameter; track
791         argument serial numbers; don't put input file entry for archive
792         before archive members.
793         (Incremental_inputs::report_archive_end): Put input file entry
794         for archive after archive members.
795         (Incremental_inputs::report_object): Add parameter; track argument
796         serial numbers and in_system_directory flag.
797         (Incremental_inputs::report_script): Add parameter; track argument
798         serial numbers.
799         (Output_section_incremental_inputs::set_final_data_size): Adjust
800         size of symbol info entry; check for forwarding symbols.
801         (Output_section_incremental_inputs::write_input_files): Write
802         in_system_directory flag and argument serial number.
803         (Output_section_incremental_inputs::write_info_blocks): Map section
804         indices between incremental info and original input file; store
805         input section index for each symbol.
806         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
807         change operator() to visit().
808         (class Global_got_offset_visitor): Likewise.
809         (class Global_symbol_visitor_got_plt):
810         (Output_section_incremental_inputs::write_got_plt): Use new visitor
811         classes.
812         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
813         (Sized_incr_relobj::do_read_symbols): New function.
814         (Sized_incr_relobj::do_layout): New function.
815         (Sized_incr_relobj::do_layout_deferred_sections): New function.
816         (Sized_incr_relobj::do_add_symbols): New function.
817         (Sized_incr_relobj::do_should_include_member): New function.
818         (Sized_incr_relobj::do_for_all_global_symbols): New function.
819         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
820         (Sized_incr_relobj::do_section_size): New function.
821         (Sized_incr_relobj::do_section_name): New function.
822         (Sized_incr_relobj::do_section_contents): New function.
823         (Sized_incr_relobj::do_section_flags): New function.
824         (Sized_incr_relobj::do_section_entsize): New function.
825         (Sized_incr_relobj::do_section_address): New function.
826         (Sized_incr_relobj::do_section_type): New function.
827         (Sized_incr_relobj::do_section_link): New function.
828         (Sized_incr_relobj::do_section_info): New function.
829         (Sized_incr_relobj::do_section_addralign): New function.
830         (Sized_incr_relobj::do_initialize_xindex): New function.
831         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
832         (Sized_incr_relobj::do_read_relocs): New function.
833         (Sized_incr_relobj::do_gc_process_relocs): New function.
834         (Sized_incr_relobj::do_scan_relocs): New function.
835         (Sized_incr_relobj::do_count_local_symbols): New function.
836         (Sized_incr_relobj::do_finalize_local_symbols): New function.
837         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
838         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
839         (Sized_incr_relobj::do_relocate): New function.
840         (Sized_incr_relobj::do_set_section_offset): New function.
841         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
842         (Sized_incr_dynobj::do_read_symbols): New function.
843         (Sized_incr_dynobj::do_layout): New function.
844         (Sized_incr_dynobj::do_add_symbols): New function.
845         (Sized_incr_dynobj::do_should_include_member): New function.
846         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
847         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
848         (Sized_incr_dynobj::do_section_size): New function.
849         (Sized_incr_dynobj::do_section_name): New function.
850         (Sized_incr_dynobj::do_section_contents): New function.
851         (Sized_incr_dynobj::do_section_flags): New function.
852         (Sized_incr_dynobj::do_section_entsize): New function.
853         (Sized_incr_dynobj::do_section_address): New function.
854         (Sized_incr_dynobj::do_section_type): New function.
855         (Sized_incr_dynobj::do_section_link): New function.
856         (Sized_incr_dynobj::do_section_info): New function.
857         (Sized_incr_dynobj::do_section_addralign): New function.
858         (Sized_incr_dynobj::do_initialize_xindex): New function.
859         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
860         (make_sized_incremental_object): New function.
861         (Incremental_library::copy_unused_symbols): New function.
862         (Incremental_library::do_for_all_unused_symbols): New function.
863         * incremental.h (enum Incremental_input_flags): New type.
864         (class Incremental_checker): Remove.
865         (Incremental_input_entry::Incremental_input_entry): Add argument
866         serial number.
867         (Incremental_input_entry::arg_serial): New function.
868         (Incremental_input_entry::set_is_in_system_directory): New function.
869         (Incremental_input_entry::is_in_system_directory): New function.
870         (Incremental_input_entry::arg_serial_): New data member.
871         (Incremental_input_entry::is_in_system_directory_): New data member.
872         (class Script_info): Move here from script.h.
873         (Script_info::Script_info): Add filename parameter.
874         (Script_info::filename): New function.
875         (Script_info::filename_): New data member.
876         (Incremental_script_entry::Incremental_script_entry): Add argument
877         serial number.
878         (Incremental_object_entry::Incremental_object_entry): Likewise.
879         (Incremental_object_entry::add_input_section): Build list of input
880         sections with map to original shndx.
881         (Incremental_object_entry::get_input_section_index): New function.
882         (Incremental_object_entry::shndx_): New data member.
883         (Incremental_object_entry::name_key_): Rename; adjust all refs.
884         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
885         (Incremental_archive_entry::Incremental_archive_entry): Add argument
886         serial number.
887         (Incremental_inputs::report_archive_begin): Likewise.
888         (Incremental_inputs::report_object): Likewise.
889         (Incremental_inputs::report_script): Likewise.
890         (class Incremental_global_symbol_reader): New class.
891         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
892         and store flags and input file type.
893         (Incremental_input_entry_reader::arg_serial): New function.
894         (Incremental_input_entry_reader::type): Extract type from flags.
895         (Incremental_input_entry_reader::is_in_system_directory): New function.
896         (Incremental_input_entry_reader::get_input_section_count): Call
897         accessor function for type.
898         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
899         function for type; adjust size of global symbol entry.
900         (Incremental_input_entry_reader::get_global_symbol_count): Call
901         accessor function for type.
902         (Incremental_input_entry_reader::get_object_count): Likewise.
903         (Incremental_input_entry_reader::get_object_offset): Likewise.
904         (Incremental_input_entry_reader::get_member_count): Likewise.
905         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
906         (Incremental_input_entry_reader::get_member_offset): Likewise.
907         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
908         (Incremental_input_entry_reader::Global_symbol_info): Remove.
909         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
910         (Incremental_input_entry_reader::get_global_symbol_reader): New
911         function.
912         (Incremental_input_entry_reader::get_output_symbol_index): New
913         function.
914         (Incremental_input_entry_reader::type_): Remove.
915         (Incremental_input_entry_reader::flags_): New data member.
916         (Incremental_inputs_reader::input_file_offset): New function.
917         (Incremental_inputs_reader::input_file_index): New function.
918         (Incremental_inputs_reader::input_file): Call input_file_offset.
919         (Incremental_inputs_reader::input_file_at_offset): New function.
920         (Incremental_relocs_reader::get_r_type): Reformat.
921         (Incremental_relocs_reader::get_r_shndx): Reformat.
922         (Incremental_relocs_reader::get_r_offset): Reformat.
923         (Incremental_relocs_reader::data): New function.
924         (Incremental_binary::Incremental_binary): Initialize new data members.
925         (Incremental_binary::check_inputs): Add cmdline parameter.
926         (Incremental_binary::file_is_unchanged): Remove.
927         (Input_reader::arg_serial): New function.
928         (Input_reader::get_unused_symbol_count): New function.
929         (Input_reader::get_unused_symbol): New function.
930         (Input_reader::do_arg_serial): New function.
931         (Input_reader::do_get_unused_symbol_count): New function.
932         (Input_reader::do_get_unused_symbol): New function.
933         (Incremental_binary::input_file_count): New function.
934         (Incremental_binary::get_input_reader): Change signature to use
935         index instead of filename.
936         (Incremental_binary::file_has_changed): New function.
937         (Incremental_binary::get_input_argument): New function.
938         (Incremental_binary::get_library): New function.
939         (Incremental_binary::get_script_info): New function.
940         (Incremental_binary::init_layout): New function.
941         (Incremental_binary::reserve_layout): New function.
942         (Incremental_binary::output_file): New function.
943         (Incremental_binary::do_check_inputs): New function.
944         (Incremental_binary::do_file_is_unchanged): Remove.
945         (Incremental_binary::do_file_has_changed): New function.
946         (Incremental_binary::do_init_layout): New function.
947         (Incremental_binary::do_reserve_layout): New function.
948         (Incremental_binary::do_input_file_count): New function.
949         (Incremental_binary::do_get_input_reader): Change signature.
950         (Incremental_binary::input_args_map_): New data member.
951         (Incremental_binary::library_map_): New data member.
952         (Incremental_binary::script_map_): New data member.
953         (Sized_incremental_binary::Sized_incremental_binary): Initialize
954         new data members.
955         (Sized_incremental_binary::output_section): New function.
956         (Sized_incremental_binary::inputs_reader): Add const.
957         (Sized_incremental_binary::symtab_reader): Add const.
958         (Sized_incremental_binary::relocs_reader): Add const.
959         (Sized_incremental_binary::got_plt_reader): Add const.
960         (Sized_incremental_binary::get_symtab_view): New function.
961         (Sized_incremental_binary::Inputs_reader): New typedef.
962         (Sized_incremental_binary::Input_entry_reader): New typedef.
963         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
964         (Sized_incremental_binary::do_file_is_unchanged): Remove.
965         (Sized_incremental_binary::do_file_has_changed): New function.
966         (Sized_incremental_binary::do_init_layout): New function.
967         (Sized_incremental_binary::do_reserve_layout): New function.
968         (Sized_input_reader::Inputs_reader): Remove.
969         (Sized_input_reader::Input_entry_reader): Remove.
970         (Sized_input_reader::do_arg_serial): New function.
971         (Sized_input_reader::do_get_unused_symbol_count): New function.
972         (Sized_input_reader::do_get_unused_symbol): New function.
973         (Sized_incremental_binary::do_input_file_count): New function.
974         (Sized_incremental_binary::do_get_input_reader): Change signature;
975         use index instead of filename.
976         (Sized_incremental_binary::section_map_): New data member.
977         (Sized_incremental_binary::input_entry_readers_): New data member.
978         (class Sized_incr_relobj): New class.
979         (class Sized_incr_dynobj): New class.
980         (make_sized_incremental_object): New function.
981         (class Incremental_library): New class.
982         * layout.cc (Free_list::num_lists): New static data member.
983         (Free_list::num_nodes): New static data member.
984         (Free_list::num_removes): New static data member.
985         (Free_list::num_remove_visits): New static data member.
986         (Free_list::num_allocates): New static data member.
987         (Free_list::num_allocate_visits): New static data member.
988         (Free_list::init): New function.
989         (Free_list::remove): New function.
990         (Free_list::allocate): New function.
991         (Free_list::dump): New function.
992         (Free_list::print_stats): New function.
993         (Layout_task_runner::run): Resize output file for incremental updates.
994         (Layout::Layout): Initialize new data members.
995         (Layout::set_incremental_base): New function.
996         (Layout::init_fixed_output_section): New function.
997         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
998         incremental updates.
999         (Layout::create_gold_note): Do not create gold note section for
1000         incremental updates.
1001         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1002         for incremental updates.
1003         (Layout::set_section_offsets): For incremental updates, allocate space
1004         from free list.
1005         (Layout::create_symtab_sections): Layout with offsets relative to
1006         start of section; for incremental updates, allocate space from free
1007         list.
1008         (Layout::create_shdrs): For incremental updates, allocate space from
1009         free list.
1010         (Layout::finish_dynamic_section): For incremental updates, do not
1011         check --as-needed (fixed in subsequent patch).
1012         * layout.h (class Free_list): New class.
1013         (Layout::set_incremental_base): New function.
1014         (Layout::incremental_base): New function.
1015         (Layout::init_fixed_output_section): New function.
1016         (Layout::allocate): New function.
1017         (Layout::incremental_base_): New data member.
1018         (Layout::free_list_): New data member.
1019         * main.cc (main): Print Free_list statistics.
1020         * object.cc (Relobj::finalize_incremental_relocs): Add
1021         clear_counts parameter; clear counts only when clear_counts is set.
1022         (Sized_relobj::Sized_relobj): Initialize new base class.
1023         (Sized_relobj::do_layout): Don't report special sections.
1024         (Sized_relobj::do_for_all_local_got_entries): New function.
1025         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1026         symtab_off to all symbol table offsets.
1027         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1028         * object.h (class Got_offset_list): Move to top of file.
1029         (Object::Object): Allow case where input_file == NULL.
1030         (Object::~Object): Likewise.
1031         (Object::input_file): Assert that input_file != NULL.
1032         (Object::lock): Allow case where input_file == NULL.
1033         (Object::unlock): Likewise.
1034         (Object::is_locked): Likewise.
1035         (Object::token): Likewise.
1036         (Object::release): Likewise.
1037         (Object::is_incremental): New function.
1038         (Object::get_mtime): New function.
1039         (Object::for_all_local_got_entries): New function.
1040         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1041         (Object::set_is_in_system_directory): New function.
1042         (Object::is_in_system_directory): New function.
1043         (Object::do_is_incremental): New function.
1044         (Object::do_get_mtime): New function.
1045         (Object::do_for_all_local_got_entries): New function.
1046         (Object::is_in_system_directory_): New data member.
1047         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1048         (class Sized_relobj_base): New class.
1049         (class Sized_relobj): Derive from Sized_relobj_base.
1050         (class Sized_relobj::Symbols): Redeclare from base class.
1051         (class Sized_relobj::local_got_offset_list): Remove.
1052         (class Sized_relobj::Output_sections): Redeclare from base class.
1053         (class Sized_relobj::do_for_all_local_got_entries): New function.
1054         (class Sized_relobj::write_local_symbols): Add offset parameter.
1055         (class Sized_relobj::local_symbol_offset_): Update comment.
1056         (class Sized_relobj::local_dynsym_offset_): Update comment.
1057         * options.cc (Input_arguments::add_file): Remove const.
1058         * options.h (Input_file_argument::Input_file_argument):
1059         Initialize arg_serial_ (all constructors).
1060         (Input_file_argument::set_arg_serial): New function.
1061         (Input_file_argument::arg_serial): New function.
1062         (Input_file_argument::arg_serial_): New data member.
1063         (Input_arguments::Input_arguments): Initialize file_count_.
1064         (Input_arguments::add_file): Remove const.
1065         (Input_arguments::number_of_input_files): New function.
1066         (Input_arguments::file_count_): New data member.
1067         (Command_line::number_of_input_files): Call
1068         Input_arguments::number_of_input_files.
1069         * output.cc (Output_segment_headers::Output_segment_headers):
1070         Set current size.
1071         (Output_section::Input_section::current_data_size): New function.
1072         (Output_section::Output_section): Initialize new data members.
1073         (Output_section::add_input_section): Don't do merge sections for
1074         an incremental link; allocate space from free list for an
1075         incremental update.
1076         (Output_section::add_output_section_data): Allocate space from
1077         free list for an incremental update.
1078         (Output_section::update_data_size): New function.
1079         (Output_section::set_fixed_layout): New function.
1080         (Output_section::reserve): New function.
1081         (Output_segment::set_section_addresses): Remove const.
1082         (Output_segment::set_section_list_addresses): Remove const; allocate
1083         space from free list for an incremental update.
1084         (Output_segment::set_offset): Adjust size of RELRO segment for an
1085         incremental update.
1086         * output.h (Output_data::current_data_size): Move here from
1087         child classes.
1088         (Output_data::pre_finalize_data_size): New function.
1089         (Output_data::update_data_size): New function.
1090         (Output_section_headers::update_data_size): new function.
1091         (Output_section_data_build::current_data_size): Move to Output_data.
1092         (Output_data_strtab::update_data_size): New function.
1093         (Output_section::current_data_size): Move to Output_data.
1094         (Output_section::set_fixed_layout): New function.
1095         (Output_section::has_fixed_layout): New function.
1096         (Output_section::reserve): New function.
1097         (Output_section::update_data_size): New function.
1098         (Output_section::has_fixed_layout_): New data member.
1099         (Output_section::free_list_): New data member.
1100         (Output_segment::set_section_addresses): Remove const.
1101         (Output_segment::set_section_list_addresses): Remove const.
1102         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1103         New function.
1104         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1105         New function.
1106         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1107         parameter when calling Add_symbols constructor; store argument
1108         serial number for members of a lib group.
1109         (Add_symbols::locks): Allow case where token == NULL.
1110         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1111         (Read_member::~Read_member): New function.
1112         (Read_member::is_runnable): New function.
1113         (Read_member::locks): New function.
1114         (Read_member::run): New function.
1115         (Check_script::~Check_script): New function.
1116         (Check_script::is_runnable): New function.
1117         (Check_script::locks): New function.
1118         (Check_script::run): New function.
1119         (Check_library::~Check_library): New function.
1120         (Check_library::is_runnable): New function.
1121         (Check_library::locks): New function.
1122         (Check_library::run): New function.
1123         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1124         (Add_symbols::library_): New data member.
1125         (class Read_member): New class.
1126         (class Check_script): New class.
1127         (class Check_library): New class.
1128         * reloc.cc (Read_relocs::is_runnable): Allow case where
1129         token == NULL.
1130         (Read_relocs::locks): Likewise.
1131         (Scan_relocs::locks): Likewise.
1132         (Relocate_task::locks): Likewise.
1133         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1134         to clear counters.
1135         (Sized_relobj::incremental_relocs_scan): Fix comment.
1136         (Sized_relobj::do_relocate): Pass output file offset to
1137         write_local_symbols.
1138         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1139         from class declaration.
1140         * script.cc (read_input_script): Allocate Script_info; pass
1141         argument serial number to report_script.
1142         * script.h (class Script_info): Move to incremental.h.
1143         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1144         * symtab.h (Symbol_table::add_from_incrobj): New function.
1145         (Symbol_table::set_file_offset): New function.
1146
1147 2011-04-05  Cary Coutant  <ccoutant@google.com>
1148
1149         * incremental-dump.cc (dump_incremental_inputs): Change signature
1150         to take a Sized_incremental_binary; change caller.  Use readers
1151         in Sized_incremental_binary.
1152         * incremental.cc
1153         (Sized_incremental_binary::find_incremental_inputs_sections):
1154         Rename do_find_incremental_inputs_sections to this.
1155         (Sized_incremental_binary::setup_readers): New function.
1156         (Sized_incremental_binary::do_check_inputs): Check
1157         has_incremental_info_ flag; move setup code to setup_readers;
1158         use input readers.
1159         (Sized_incremental_binary::do_file_is_unchanged): New function.
1160         (Sized_incremental_binary::do_get_input_reader): New function.
1161         * incremental.h (class Incremental_binary): Move to end of file.
1162         (Incremental_binary::file_is_unchanged): New function.
1163         (Incremental_binary::do_file_is_unchanged): New function.
1164         (Incremental_binary::Input_reader): New class.
1165         (Incremental_binary::get_input_reader): New function.
1166         (class Sized_incremental_binary): Move to end of file.
1167         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1168         input section reader classes.
1169         (Sized_incremental_binary::has_incremental_info): New function.
1170         (Sized_incremental_binary::inputs_reader): New function.
1171         (Sized_incremental_binary::symtab_reader): New function.
1172         (Sized_incremental_binary::relocs_reader): New function.
1173         (Sized_incremental_binary::got_plt_reader): New function.
1174         (Sized_incremental_binary::do_file_is_unchanged): New function.
1175         (Sized_incremental_binary::Sized_input_reader): New class.
1176         (Sized_incremental_binary::get_input_reader): New function.
1177         (Sized_incremental_binary::find_incremental_inputs_sections):
1178         Rename do_find_incremental_inputs_sections to this.
1179         (Sized_incremental_binary::setup_readers): New function.
1180         (Sized_incremental_binary::has_incremental_info_): New data member.
1181         (Sized_incremental_binary::inputs_reader_): New data member.
1182         (Sized_incremental_binary::symtab_reader_): New data member.
1183         (Sized_incremental_binary::relocs_reader_): New data member.
1184         (Sized_incremental_binary::got_plt_reader_): New data member.
1185         (Sized_incremental_binary::current_input_file_): New data member.
1186
1187 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1188
1189         PR gold/12640
1190         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1191         violation.
1192
1193 2011-03-30  Cary Coutant  <ccoutant@google.com>
1194
1195         * archive.cc (Archive::include_member): Adjust call to report_object.
1196         (Add_archive_symbols::run): Add script_info to call to
1197         report_archive_begin.
1198         (Lib_group::include_member): Adjust call to report_object.
1199         (Add_lib_group_symbols::run): Adjust call to report_object.
1200         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1201         blocks.  Add object count for script input files.
1202         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1203         script_info parameter; change all callers.
1204         (Incremental_inputs::report_object): Add script_info parameter;
1205         change all callers.
1206         (Incremental_inputs::report_script): Store backpointer to
1207         incremental info entry.
1208         (Output_section_incremental_inputs::set_final_data_size): Record
1209         additional information for scripts.
1210         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1211         * incremental.h (Incremental_script_entry::add_object): New function.
1212         (Incremental_script_entry::get_object_count): New function.
1213         (Incremental_script_entry::get_object): New function.
1214         (Incremental_script_entry::objects_): New data member; adjust
1215         constructor.
1216         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1217         (Incremental_inputs::report_object): Add script_info parameter.
1218         (Incremental_inputs_reader::get_object_count): New function.
1219         (Incremental_inputs_reader::get_object_offset): New function.
1220         * options.cc (Input_arguments::add_file): Return reference to
1221         new input argument.
1222         * options.h (Input_argument::set_script_info): New function.
1223         (Input_argument::script_info): New function.
1224         (Input_argument::script_info_): New data member; adjust all
1225         constructors.
1226         (Input_file_group::add_file): Return reference to new input argument.
1227         (Input_file_lib::add_file): Likewise.
1228         (Input_arguments::add_file): Likewise.
1229         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1230         * script.cc (Parser_closure::Parser_closure): Add script_info
1231         parameter; adjust all callers.
1232         (Parser_closure::script_info): New function.
1233         (Parser_closure::script_info_): New data member.
1234         (read_input_script): Report scripts earlier to incremental info.
1235         (script_add_file): Set script_info in Input_argument.
1236         (script_add_library): Likewise.
1237         * script.h (Script_options::Script_info): Rewrite class.
1238
1239 2011-03-29  Cary Coutant  <ccoutant@google.com>
1240
1241         * archive.cc (Library_base::should_include_member): Move
1242         method here from class Archive.
1243         (Archive::Archive): Initialize base class.
1244         (Archive::should_include_member): Move to base class.
1245         (Archive::do_for_all_unused_symbols): New function.
1246         (Add_archive_symbols::run): Remove redundant access to
1247         incremental_inputs.
1248         (Lib_group::Lib_group): Initialize base class.
1249         (Lib_group::do_filename): New function.
1250         (Lib_group::include_member): Pass pointer to Lib_group to
1251         report_object.
1252         (Lib_group::do_for_all_unused_symbols): New function.
1253         (Add_lib_group_symbols::run): Report archive information for
1254         incremental links.
1255         * archive.h (class Library_base): New base class.
1256         (class Archive): Derive from Library_base.
1257         (Archive::filename): Move to base class.
1258         (Archive::set_incremental_info): Likewise.
1259         (Archive::incremental_info): Likewise.
1260         (Archive::Should_include): Likewise.
1261         (Archive::should_include_member): Likewise.
1262         (Archive::Armap_entry): Remove.
1263         (Archive::Unused_symbol_iterator): Remove.
1264         (Archive::unused_symbols_begin): Remove.
1265         (Archive::unused_symbols_end): Remove.
1266         (Archive::do_filename): New function.
1267         (Archive::do_get_mtime): New function.
1268         (Archive::do_for_all_unused_symbols): New function.
1269         (Archive::task_): Move to base class.
1270         (Archive::incremental_info_): Likewise.
1271         (class Lib_group): Derive from Library_base.
1272         (Lib_group::do_filename): New function.
1273         (Lib_group::do_get_mtime): New function.
1274         (Lib_group::do_for_all_unused_symbols): New function.
1275         (Lib_group::task_): Move to base class.
1276         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1277         function.
1278         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1279         function.
1280         * incremental.cc (Incremental_inputs::report_archive_begin):
1281         Use Library_base; call library's get_mtime; add incremental inputs
1282         entry before members.
1283         (class Unused_symbol_visitor): New class.
1284         (Incremental_inputs::report_archive_end): Use Library_base; use
1285         visitor class to record unused symbols; don't add incremental inputs
1286         entry after members.
1287         (Incremental_inputs::report_object): Use Library_base.
1288         * incremental.h
1289         (Incremental_archive_entry::Incremental_archive_entry): Remove
1290         unused Archive parameter.
1291         (Incremental_inputs::report_archive_begin): Use Library_base.
1292         (Incremental_inputs::report_archive_end): Likewise.
1293         (Incremental_inputs::report_object): Likewise.
1294         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1295         function.
1296         * object.h (Object::for_all_global_symbols): New function.
1297         (Object::do_for_all_global_symbols): New function.
1298         (Sized_relobj::do_for_all_global_symbols): New function.
1299         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1300         function.
1301         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1302         function.
1303
1304 2011-03-27  Ian Lance Taylor  <iant@google.com>
1305
1306         * archive.cc (Archive::interpret_header): Return -1 if something
1307         goes wrong.  Change callers accordingly.
1308
1309 2011-03-25  Cary Coutant  <ccoutant@google.com>
1310
1311         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1312         * testsuite/Makefile.in: Regenerate.
1313
1314 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1315
1316         * plugin.cc (get_view): New.
1317         (Plugin::load): Pass get_view to the plugin.
1318         (Plugin_manager::get_view): New.
1319
1320 2011-03-21  Ian Lance Taylor  <iant@google.com>
1321
1322         * testsuite/final_layout.sh: Rewrite to not use dc.
1323         * testsuite/relro_test.sh: Fail if dc is not present.
1324
1325 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1326
1327         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1328         Change == to -eq.
1329         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1330         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1331         Change == to -eq.
1332         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1333         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1334
1335 2011-03-14  Ian Lance Taylor  <iant@google.com>
1336
1337         * script-sections.cc (Sort_output_sections::script_compare):
1338         Rename from is_before, change return type.
1339         (Sort_output_sections::operator()): Adjust accordingly.
1340
1341 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1342
1343         PR gold/12572
1344         * testsuite/odr_violation2.cc: Add comment to make all error line
1345         numbers double digits.
1346         * testsuite/debug_msg.sh: Adjust expected errors.
1347
1348 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1349
1350         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1351         but mark earlier ones as non-canonical
1352         (offset_to_iterator): Update search target and example
1353         (do_addr2line): Return extra lines in a vector*
1354         (format_file_lineno): Extract from do_addr2line
1355         (one_addr2line): Add vector* out-param
1356         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1357         when a lineno entry appeared last for its instruction
1358         (Dwarf_line_info): Add vector* out-param
1359         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1360         * symtab.cc (Odr_violation_compare): Include the lineno in the
1361         comparison again.
1362         (linenos_from_loc): New. Combine the canonical line for an
1363         address with its other lines.
1364         (True_if_intersect): New. Helper functor to make
1365         std::set_intersection a query.
1366         (detect_odr_violations): Compare sets of lines instead of just
1367         one line for each function. This became less deterministic, but
1368         has fewer false positives.
1369         * symtab.h: Declarations.
1370         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1371         mix an optimized and non-optimized object in the same binary
1372         (odr_violation2.so): Same.
1373         * testsuite/Makefile.in: Regenerate from Makefile.am.
1374         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1375         * testsuite/debug_msg.sh: Update line numbers and add
1376         assertions.
1377         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1378         non-optimized context.
1379         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1380         isn't inlined, and use OdrDerived in an optimized context.
1381         * testsuite/odr_header1.h: Defines OdrDerived, where
1382         optimization will change the
1383         first-instruction-in-the-destructor's file and line number.
1384         * testsuite/odr_header2.h: Defines OdrBase.
1385
1386 2011-03-09  Ian Lance Taylor  <iant@google.com>
1387
1388         * fileread.cc (File_read::clear_views): Don't delete the whole
1389         file view.
1390
1391 2011-03-08  Ian Lance Taylor  <iant@google.com>
1392
1393         PR gold/12525
1394         * fileread.cc: #include <climits>.
1395         (GOLD_IOV_MAX): Define.
1396         (File_read::read_multiple): Limit number of entries by iov_max.
1397         * fileread.h (class File_read): Always set max_readv_entries to
1398         128.
1399
1400 2011-03-07  Ian Lance Taylor  <iant@google.com>
1401
1402         PR gold/12525
1403         * options.h (class General_options): Add -dy and -dn.
1404
1405 2011-03-02  Cary Coutant  <ccoutant@google.com>
1406
1407         * testsuite/script_test_9.t: Add TLS segment.
1408
1409 2011-03-02  Simon Baldwin  <simonb@google.com>
1410
1411         * configure.ac: Add check for gnu_indirect_function support in
1412         the toolchain building binutils.
1413         * configure: Rebuild.
1414
1415 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1416
1417         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1418         plugin only symbols.
1419         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1420         in plugin files as not needed in the symbol table.
1421
1422 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1423
1424         * output.cc (Output_section::add_input_section): Delay fill
1425         generation for section ordering.
1426
1427 2011-02-09  Ian Lance Taylor  <iant@google.com>
1428
1429         PR gold/12316
1430         * object.h (class Sized_relobj): Remove clear_local_symbols.
1431         * reloc.cc (Sized_relobj::do_relocate): Don't call
1432         clear_local_symbols.
1433
1434 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1435
1436         * plugin.cc (is_visible_from_outside): Return true for symbols
1437         in the -u option.
1438
1439 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1440
1441         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1442         filename.
1443
1444 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1445
1446         * icf.h (is_section_foldable_candidate): Change type of parameter
1447         to std::string.
1448         * icf.cc (Icf::find_identical_sections): Change type of local variable
1449         section_name to be std::string.
1450         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1451
1452 2011-01-25  Ian Lance Taylor  <iant@google.com>
1453
1454         * script.cc (script_add_extern): Rewrite to use
1455         add_symbol_reference.
1456
1457 2011-01-25  Doug Kwan  <dougkwan@google.com>
1458
1459         * icf.cc (get_section_contents): Always lock section's object.
1460
1461 2011-01-24  Ian Lance Taylor  <iant@google.com>
1462
1463         * options.h (class General_options): Accept
1464         --no-detect-odr-violations.
1465
1466 2011-01-24  Ian Lance Taylor  <iant@google.com>
1467
1468         * version.cc (version_string): Bump to 1.11.
1469
1470 2011-01-24  Ian Lance Taylor  <iant@google.com>
1471
1472         * plugin.cc (class Plugin_rescan): Define new class.
1473         (Plugin_manager::claim_file): Set any_claimed_.
1474         (Plugin_manager::save_archive): New function.
1475         (Plugin_manager::save_input_group): New function.
1476         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1477         necessary.
1478         (Plugin_manager::new_undefined_symbol): New function.
1479         (Plugin_manager::rescan): New function.
1480         (Plugin_manager::rescannable_defines): New function.
1481         (Plugin_manager::add_input_file): Set any_added_.
1482         * plugin.h (class Plugin_manager): define new fields rescannable_,
1483         undefined_symbols_, any_claimed_, and any_added_.  Declare
1484         Plugin_rescan as friend.  Declare new functions.
1485         (Plugin_manager::Rescannable): Define type.
1486         (Plugin_manager::Rescannable_list): Define type.
1487         (Plugin_manager::Undefined_symbol_list): Define type.
1488         (Plugin_manager::Plugin_manager): Initialize new fields.
1489         * archive.cc (Archive::defines_symbol): New function.
1490         (Add_archive_symbols::run): Pass archive to plugins if any.
1491         * archive.h (class Archive): Declare defines_symbol.
1492         * readsyms.cc (Input_group::~Input_group): New function.
1493         (Finish_group::run): Pass input_group to plugins if any.
1494         * readsyms.h (class Input_group): Declare destructor.
1495         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1496         any.
1497
1498 2011-01-10  Ian Lance Taylor  <iant@google.com>
1499
1500         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1501         section as relro.
1502         (Layout::set_segment_offsets): Reset increase_relro before calling
1503         set_section_addresses a second time.
1504
1505 2011-01-04  Cary Coutant  <ccoutant@google.com>
1506
1507         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1508         sections before NOBITS sections.
1509
1510 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1511
1512         * version.cc (print_version): Update copyright to 2011.
1513
1514 2010-12-23  Cary Coutant  <ccoutant@google.com>
1515
1516         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1517         of OS to this->add.  Add OD parameter to second form of the function.
1518
1519 2010-12-20  Ian Lance Taylor  <iant@google.com>
1520
1521         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1522         second of two consecutive entries with same offset.
1523
1524 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1525
1526         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1527         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1528         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1529         to avoid unneeded links against $(LDADD).
1530         * testsuite/Makefile.in: Regenerate.
1531
1532 2010-12-15  Ian Lance Taylor  <iant@google.com>
1533
1534         PR gold/12324
1535         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1536         for R_X86_64_32 and R_X86_64_PC32.
1537         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1538         ver_matching_def_pic.o.
1539         (ver_matching_def_pic.o): New target.
1540
1541 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1542
1543         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1544         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1545         Move definition before File_read::View member definitions.
1546         (File_read::View::~View): Initialize and hold lock before
1547         updating current_mapped_bytes.
1548
1549 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1550
1551         * dwarf_reader.cc: Remove outdated comment.
1552         * gold-threads.cc: Fix typo in error message.
1553         * archive.cc: Fix typos in comments.
1554         * archive.h: Likewise.
1555         * arm-reloc-property.cc: Likewise.
1556         * arm-reloc-property.h: Likewise.
1557         * arm-reloc.def: Likewise.
1558         * arm.cc: Likewise.
1559         * attributes.h: Likewise.
1560         * cref.cc: Likewise.
1561         * ehframe.cc: Likewise.
1562         * fileread.h: Likewise.
1563         * gold.h: Likewise.
1564         * i386.cc: Likewise.
1565         * icf.cc: Likewise.
1566         * incremental.h: Likewise.
1567         * int_encoding.cc: Likewise.
1568         * layout.h: Likewise.
1569         * main.cc: Likewise.
1570         * merge.h: Likewise.
1571         * object.cc: Likewise.
1572         * object.h: Likewise.
1573         * options.cc: Likewise.
1574         * readsyms.cc: Likewise.
1575         * reduced_debug_output.cc: Likewise.
1576         * reloc.cc: Likewise.
1577         * script-sections.cc: Likewise.
1578         * sparc.cc: Likewise.
1579         * symtab.h: Likewise.
1580         * target-reloc.h: Likewise.
1581         * target.cc: Likewise.
1582         * target.h: Likewise.
1583         * timer.cc: Likewise.
1584         * timer.h: Likewise.
1585         * x86_64.cc: Likewise.
1586
1587 2010-12-09  Cary Coutant  <ccoutant@google.com>
1588
1589         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1590         stack.
1591         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1592         parameter; change all callers.
1593         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1594         * options.h (warn_execstack): New option.
1595
1596 2010-12-07  Doug Kwan  <dougkwan@google.com>
1597
1598         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1599         like function call relocations.
1600
1601 2010-12-07  Ian Lance Taylor  <iant@google.com>
1602
1603         * archive.cc (Archive::get_elf_object_for_member): Permit
1604         punconfigured to be NULL.
1605         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1606         (Archive::include_member): Pass NULL to get_elf_object_for_member
1607         if we searched for the archive and this is the first included
1608         object.
1609
1610 2010-12-01  Ian Lance Taylor  <iant@google.com>
1611
1612         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1613         track_relocs_type_ field.
1614         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1615         Set track_relocs_type_.
1616         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1617         contents when using RELA relocs.
1618         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1619         reloc_map_.
1620         * reloc.cc (Track_relocs::next_addend): New function.
1621         * reloc.h (class Track_relocs): Declare next_addend.
1622
1623 2010-12-01  Ian Lance Taylor  <iant@google.com>
1624
1625         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1626         virtual destructor.
1627
1628 2010-12-01  Ian Lance Taylor  <iant@google.com>
1629
1630         * README: Update compilers known to work and fail.
1631
1632 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1633
1634         * configure.in: For --enable-gold, handle value `default' instead of
1635         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1636         not the default.
1637         * configure: Regenerate.
1638
1639 2010-11-18  Doug Kwan  <dougkwan@google.com>
1640
1641         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1642         and right_alignment to be zero.  Store result alignment only if it is
1643         greater than existing alignment.
1644
1645 2010-11-16  Cary Coutant  <ccoutant@google.com>
1646
1647         PR gold/12220
1648         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1649         Check for ".zdebug_line".
1650
1651 2010-11-16  Doug Kwan  <dougkwan@google.com>
1652             Cary Coutant  <ccoutant@google.com>
1653
1654         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1655         by reference; adjust all callers.
1656         * output.cc (Output_segment::set_section_addresses): Adjust references
1657         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1658         list is empty.
1659         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1660         end at page boundary.
1661
1662 2010-11-16  Cary Coutant  <ccoutant@google.com>
1663
1664         PR gold/12220
1665         * layout.cc (Layout::choose_output_section): Transform names of
1666         compressed sections even when using a script with a SECTIONS clause.
1667         (Layout::output_section_name): Remove code to transform
1668         compressed debug section names.
1669         * output.cc (Output_section::add_input_section): Use uncompressed
1670         section size when tracking input sections.
1671
1672 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1673
1674         * symtab.h (Symbol::NON_PIC_REF): Remove.
1675         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1676         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1677         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1678         (Symbol::use_plt_offset): Take a flags argument and pass it
1679         directly to needs_dynamic_reloc.  Restrict check for undefined
1680         weak symbols to function calls.
1681         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1682         (Target_arm::Scan::global): Use it.
1683         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1684         (Target_arm::Relocate::relocate): Likewise.
1685         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1686         parameter with an r_type parameter.  Use get_reference_flags
1687         to get the flags.
1688         (Target_arm::Relocate::relocate): Update accordingly.
1689         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1690         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1691         (Target_i386::Scan::global): Likewise.
1692         (Target_i386::Relocate::relocate): Likewise.
1693         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1694         parameter with an r_type parameter.  Use get_reference_flags
1695         to get the flags.
1696         (Target_i386::Relocate::relocate): Update accordingly.
1697         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1698         (Target_powerpc::Scan::global): Use it.
1699         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1700         (Target_powerpc::Relocate::relocate): Likewise.
1701         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1702         (Target_sparc::Scan::global): Use it.
1703         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1704         (Target_sparc::Relocate::relocate): Likewise.
1705         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1706         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1707         (Target_x86_64::Scan::global): Likewise.
1708         (Target_x86_64::Relocate::relocate): Likewise.
1709
1710 2010-11-08  Doug Kwan  <dougkwan@google.com>
1711             Cary Coutant  <ccoutant@google.com>
1712
1713         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1714         (Arm_exidx_merge_section::section_contents_): New data member.
1715         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1716         (Arm_input_section::~Arm_input_section): De-allocate memory.
1717         (Arm_input_section::original_contents_): New data member.       
1718         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1719         in parameters instead of calling Object::section_contents without
1720         locking.
1721         (Arm_output_section::group_section): New parameter TASK.  Pass it
1722         to callees that need locking objects.
1723         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1724         to lock EXIDX input sections.  Fix a formatting issue.  Call
1725         Arm_exidx_merged_section::build_contents to create merged section
1726         contents.
1727         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1728         to lock object of stub table owner.
1729         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1730         TEXT_SIZE to initialize data member TEXT_SIZE_.
1731         (Arm_exidx_input_section::addralign): Fix typo in comment.
1732         (Arm_exidx_input_section::text_size): New method.
1733         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1734         that require locking objects.  Lock objects before scanning for stubs
1735         and updating local symbols.
1736         (Arm_input_section<big_endian>::init): Copy contents of original
1737         input section.
1738         (Arm_input_section<big_endian>::do_write): Use saved contents of
1739         original input section instead of calling Object::section_contents
1740         without locking.
1741         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1742         size without calling Object::section_size().
1743         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1744         for size.  Allocate a buffer for merged EXIDX entries.
1745         (Arm_exidx_merged_section::build_contents): New method.
1746         (Arm_exidx_merged_section::do_write): Move merge section contents
1747         building code to Arm_exidx_merged_section::build_contetns.  Write
1748         out contetns in buffer instead of building it on the fly.
1749         (Arm_relobj::make_exidx_input_section): Also pass text section size
1750         to Arm_exidx_input_section constructor.
1751         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1752         (Arm_dynobj::do_read_symbols): Fix memory leak.
1753         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1754         * target.h: (class Task): Add forward declaration.
1755         (Target::relax): Add new parameter TASK and pass it to
1756         Target::do_relax().
1757         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1758
1759 2010-11-05  Cary Coutant  <ccoutant@google.com>
1760
1761         PR gold/10708
1762         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1763         object when reading from the file.
1764         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1765         second layout pass.
1766         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1767         when reading section contents.
1768         (get_section_contents): Likewise.
1769         (icf::find_identical_sections): Likewise.
1770         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1771         object when reading from the file.
1772         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1773         the object when doing deferred section layout.
1774
1775 2010-11-03  Nick Clifton  <nickc@redhat.com>
1776
1777         PR gold/12001
1778         * script.h (class Symbol_assignment: name): New member.  Returns
1779         the name of the symbol.
1780         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1781         Returns true if the given symbol name is on the list of
1782         assignments wating to be processed.
1783         * archive.cc (should_incldue_member): If the symbol is undefined,
1784         check to see if it is on the list of symbols pending assignment.
1785
1786 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1787
1788         * script-sections.cc (Script_sections::find_memory_region): Check
1789         for a NULL output section pointer.
1790
1791 2010-10-29  Doug Kwan  <dougkwan@google.com>
1792
1793         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1794         Output_section::add_relaxed_input_section.
1795         * output.cc (Output_section::add_relaxed_input_section): Add new
1796         arguments LAYOUT and NAME.  Set section order index.
1797         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1798         Copy section order index.
1799         * output.h (Output_section::add_relaxed_input_section): Add new
1800         arguments LAYOUT and NAME.
1801
1802 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1803
1804         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1805         NATIVE_OR_CROSS_LINKER.
1806         * testsuite/Makefile.in: Regenerate.
1807
1808 2010-10-20  Doug Kwan  <dougkwan@google.com>
1809
1810         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1811         without SHF_LINK_ORDER flags.
1812         * layout.cc (Layout::choose_output_section): Do not filter
1813         SHF_LINK_ORDER flag in a relocatable link.
1814
1815 2010-10-17  Cary Coutant  <ccoutant@google.com>
1816
1817         * output.h (Output_segment::set_section_addresses): Change function
1818         signature.  Update all callers.
1819         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1820         sections.
1821         (Output_segment::set_section_addresses): Align after last TLS
1822         section.  Add padding before last relro section instead of after.
1823
1824 2010-10-17  Doug Kwan  <dougkwan@google.com>
1825
1826         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1827         GOT output section to be writable.
1828
1829 2010-10-14  Cary Coutant  <ccoutant@google.com>
1830
1831         * debug.h (DEBUG_INCREMENTAL): New flag.
1832         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1833         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1834         mode.
1835         * incremental.cc (report_command_line): Ignore all forms of
1836         --incremental.
1837         * layout.cc (Layout::Layout): Check parameters for incremental link
1838         mode.
1839         * options.cc (General_options::parse_incremental): New function.
1840         (General_options::parse_no_incremental): New function.
1841         (General_options::parse_incremental_full): New function.
1842         (General_options::parse_incremental_update): New function.
1843         (General_options::incremental_mode_): New data member.
1844         (General_options::finalize): Check incremental_mode_.
1845         * options.h (General_options): Update help text for --incremental.
1846         Add --no-incremental, --incremental-full, --incremental-update.
1847         (General_options::Incremental_mode): New enum type.
1848         (General_options::incremental_mode): New function.
1849         (General_options::incremental_mode_): New data member.
1850         * parameters.cc (Parameters::incremental_mode_): New data member.
1851         (Parameters::set_options): Set incremental_mode_.
1852         (Parameters::set_incremental_full): New function.
1853         (Parameters::incremental): New function.
1854         (Parameters::incremental_update): New function.
1855         (set_parameters_incremental_full): New function.
1856         * parameters.h (Parameters::set_incremental_full): New function.
1857         (Parameters::incremental): New function.
1858         (Parameters::incremental_update): New function.
1859         (Parameters::incremental_mode_): New data member.
1860         (set_parameters_incremental_full): New function.
1861         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1862         incremental link mode.
1863         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1864         (Sized_relobj::do_relocate_sections): Likewise.
1865         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1866         option.
1867         * testsuite/Makefile.in: Regenerate.
1868         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1869
1870 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1871
1872         * script-sections.h (class Script_sections): Make
1873         Sections_elements typedef public.
1874         * script-sections.cc (class Sort_output_sections): Add elements_
1875         field.  Add constructor which sets it; change all callers.
1876         (Sort_output_sections::is_before): New function.
1877         (Sort_output_sections::operator()): Call is_before.
1878         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1879         conditional.
1880         * testsuite/script_test_10.sh: New test. Test script section
1881         order.
1882         * testsuite/script_test_10.t: Likewise.
1883         * testsuite/script_test_10.s: Likewise.
1884         * testsuite/Makefile.am: Wrap the cross linker tests and the
1885         common tests into NATIVE_OR_CROSS_LINKER.
1886         (check_SCRIPTS): Add script_test_10.sh.
1887         (check_DATA): Add script_test_10.stdout.
1888         (script_test_10.o, script_test_10): New targets.
1889         (script_test_10.stdout): New target.
1890         * configure, testsuite/Makefile.in: Regenerate.
1891
1892 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1893
1894         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1895         error for the deprecated relocations.
1896         (Target_arm::Scan::global): Likewise.
1897         (Target_arm::Relocate::relocate): Likewise.
1898
1899 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1900
1901         * fileread.cc (Input_file::find_file): Initialize *found_name
1902         and *namep when using the fallback search for case 4.
1903
1904 2010-10-11  Cary Coutant  <ccoutant@google.com>
1905
1906         * options.h (class General_options): Redefine -z lazy as an alias for
1907         the negation of -z now.
1908
1909 2010-10-11  Ian Lance Taylor  <iant@google.com>
1910
1911         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1912         binding.
1913
1914 2010-10-06  Nick Clifton  <nickc@redhat.com>
1915
1916         * script-sections.cc(class Memory_region): Remove
1917         current_lma_offset_ field.  Rename current_vma_offset_ to
1918         current_offset_.  Add last_section_ field.
1919         (Memory_region::get_current_vma_address): Rename to
1920         get_current_address.
1921         (Memory_region::get_current_lma_address): Delete.
1922         (Memory_region::increment_vma_offset): Rename to
1923         increment_offset.
1924         (Memory_region::increment_lma_offset): Delete.
1925         (Memory_region::attributes_compatible): New method.  Returns
1926         true if the provided section is compatible with the region.
1927         (Memory_region::get_last_section): New method.  Returns the last
1928         section to use the region.
1929         (Memory_region::set_last_section): New method.  Stores the last
1930         section to use the region.
1931         (Script_sections::block_in_region): New method.  Returns true if
1932         a block of memory is contained within a region.
1933         (Script_sections::find_memory_region): New method.  Locates a
1934         memory region to be used to set a VMA or LMA address.
1935         (Output_section_definition::set_section_addresses): Add code to
1936         check for addresses set by memory regions.
1937         (Output_segment::set_section_addresses): Remove memory region
1938         walking code.
1939         (Script_sections::create_segment): Add a warning if a header
1940         segment is created outside of any region.
1941         * script-sections.h (class Script_sections): Add prototypes for
1942         find_memory_region and block_in_region methods.
1943         * testsuite/memory_test.s: Use .long instead of .word.
1944         * testsuite/memory_test.t: Add some more output sections.
1945         * testsuite/memory_test.sh: Update expected output.
1946
1947 2010-10-02  Doug Kwan  <dougkwan@google.com>
1948
1949         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1950         defintion to symtab.h
1951         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1952         declaration to defintion.
1953
1954 2010-10-01  Nick Clifton  <nickc@redhat.com>
1955
1956         * expression.cc (eval): Replace dummy argument with NULL.
1957         (eval_maybe_dot): Check for a NULL result section pointer.
1958         (Symbol_expression::value): Likewise.
1959         (Dot_expression::value): Likewise.
1960         (BINARY_EXPRESSION): Likewise.
1961         (Max_expression::value): Likewise.
1962         (Min_expression::value): Likewise.
1963         (Absolute_expression::value): Likewise.
1964         (Addr_expression::value_from_output_section): Likewise.
1965         (Loaddddr_expression::value_from_output_section): Likewise.
1966         (Segment_start_expression::value): Likewise.
1967         * script-sections.cc
1968         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1969         argument with NULL.
1970         (Sections_elememt_dot_assignment::set_section_addresses):
1971         Likewise.
1972         (Output_data_expression::do_write_to_buffer): Likewise.
1973         (Output_section_definition::finalize_symbols): Likewise.
1974         (Output_section_definition::set_section_addresses): Likewise.
1975
1976 2010-09-30  Doug Kwan  <dougkwan@google.com>
1977
1978         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1979
1980 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1981
1982         * target.h (Target::can_icf_inline_merge_sections): New virtual
1983         function.
1984         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1985         virtual function.
1986         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1987         virtual function.
1988         * icf.cc (get_section_contents): Inline merge sections only when
1989         target allows it.
1990
1991 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1992
1993         * configure: Regenerate.
1994
1995 2010-09-17  Ian Lance Taylor  <iant@google.com>
1996
1997         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1998         * testsuite/Makefile.am (memory_test.o): New target.
1999         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2000         memory_test.t.
2001         * testsuite/Makefile.in: Rebuild.
2002
2003 2010-09-17  Doug Kwan  <dougkwan@google.com>
2004
2005         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2006         defintion if relocation uses GOT entries of the symbol.
2007         * testsuite/icf_safe_test.sh: Fix test.
2008         * testsuite/icf_safe_so_test.sh: Fix test.
2009
2010 2010-09-16  Cary Coutant  <ccoutant@google.com>
2011
2012         * script_sections.cc (class Memory_region): Remove "NULL" from
2013         vector initializations.
2014
2015 2010-09-15  Cary Coutant  <ccoutant@google.com>
2016
2017         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2018         Resolve forwarding symbols.
2019
2020 2010-09-15  Doug Kwan  <dougkwan@google.com>
2021
2022         * gold/testsuite/script_test_3.t: Add ARM special sections.
2023         * gold/testsuite/script_test_4.t: Same.
2024         * gold/testsuite/script_test_5.t: Same.
2025         * gold/testsuite/script_test_6.t: Same.
2026         * gold/testsuite/script_test_7.t: Same.
2027         * gold/testsuite/script_test_7.t: Same.
2028         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2029
2030 2010-09-14  Cary Coutant  <ccoutant@google.com>
2031
2032         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2033         (Target_x86_64::Relocate::relocate_tls): Replace check for
2034         saw_tls_block_reloc_ with test for executable section.
2035
2036 2010-09-12  Cary Coutant  <ccoutant@google.com>
2037
2038         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2039         position-independent executables to shared libraries need dynamic
2040         relocations.
2041         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2042         position-independent executables.
2043         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2044         * testsuite/Makefile.in: Regenerate.
2045
2046 2010-09-10  Nick Clifton  <nickc@redhat.com>
2047
2048         PR gold/11997
2049         * testsuite/memory_test.t: Discard any sections that are not
2050         needed.
2051
2052 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2053
2054         PR gold/11996
2055         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2056         "This::" to work around a bug in gcc 4.2.
2057
2058         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2059
2060 2010-09-09  Rafael Espindola  <espindola@google.com>
2061
2062         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2063         sections with different PF_X flags in the same segment.
2064         (Layout::find_first_load_seg): Search all segments to find the first
2065         one.
2066         * options.h (rosegment): New.
2067
2068 2010-09-08  Rafael Espindola  <espindola@google.com>
2069
2070         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2071
2072 2010-09-08  Doug Kwan  <dougkwan@google.com>
2073
2074         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2075         (Arm_relobj::do_relocate_sections): Add new parameter for output
2076         file to match the parent.
2077         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2078         of local symbols instead of input values.  Update code to track
2079         changes in gold::relocate_section.
2080         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2081         (Sized_relobj::compute_final_local_value_internal): New methods.
2082         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2083         body into private version of Sized_relobj::compute_final_local_value.
2084         Call the inline method.
2085         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2086         merged symbol value if there is one.
2087         (Symbol_value::has_output_value): New method defintiion.
2088         (Sized_relobj::Compute_final_local_value_status): New enum type.
2089         (Sized_relobj::compute_final_local_value): New methods.
2090         (Sized_relobj::compute_final_local_value_internal): New methods.
2091         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2092         and arm_cortex_a8.sh.
2093         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2094         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2095         New tests.
2096         * Makefile.in: Regenerate.
2097         * testsuite/arm_bl_out_of_range.s: Update test.
2098         * testsuite/thumb_bl_out_of_range.s: Ditto.
2099         * testsuite/thumb_blx_out_of_range.s: Ditto.
2100         * testsuite/arm_branch_out_of_range.sh: New file.
2101         * testsuite/arm_cortex_a8.sh: Ditto.
2102         * testsuite/arm_cortex_a8_b.s: Ditto.
2103         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2104         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2105         * testsuite/arm_cortex_a8_bl.s: Ditto.
2106         * testsuite/arm_cortex_a8_blx.s: Ditto.
2107         * testsuite/arm_cortex_a8_local.s: Ditto.
2108         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2109         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2110
2111 2010-09-08  Rafael Espindola  <espindola@google.com>
2112
2113         * Makefile.am (memory_test.stdout): Run readelf with -W.
2114         * Makefile.in: Regenerate.
2115         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2116         64 bit output.
2117
2118 2010-09-08  Rafael Espindola  <espindola@google.com>
2119
2120         * script-sections.cc (Script_sections::add_memory_region): Convert
2121         field precision to int.
2122         * script.cc (script_set_section_region, script_set_section_region):
2123         Convert field precision to int.
2124
2125 2010-09-08  Rafael Espindola  <espindola@google.com>
2126
2127         * arm.cc (do_finalize_sections): Create the __exidx_start and
2128         __exdix_end symbols even when the section is missing.
2129
2130 2010-09-08  Nick Clifton  <nickc@redhat.com>
2131
2132         * README: Remove claim that MEMORY is not supported.
2133         * expression.cc (script_exp_function_origin)
2134         (script_exp_function_length): Move from here to ...
2135         * script.cc: ... here.
2136         (script_set_section_region, script_add_memory)
2137         (script_parse_memory_attr, script_include_directive): New
2138         functions.
2139         * script-sections.cc
2140         (class Memory_region): New class.
2141         (class Output_section_definition): Add set_memory_region,
2142         set_section_vma, set_section_lma and get_section_name methods.
2143         (class Script_Sections): Add add_memory_region,
2144         find_memory_region, find_memory_region_origin,
2145         find_memory_region_length and set_memory_region methods.
2146         Have set_section_addresses method walk the list of set memory
2147         regions.
2148         Extend the print methos to display memory regions.
2149         * script-sections.h: Add prototypes for new methods.
2150         Add enum for MEMORY region attributes.
2151         * yyscript.y: Add support for parsing MEMORY regions.
2152         * script-c.h: Add prototypes for new functions.
2153         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2154         * testsuite/Makefile.in: Regenerate.
2155         * testsuite/memory_test.sh: New script.
2156         * testsuite/memory_test.s: New assembler source file.
2157         * testsuite/memory_test.t: New linker script.
2158
2159 2010-08-27  Doug Kwan  <dougkwan@google.com>
2160
2161         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2162         reference override an existing dynamic weak reference.
2163         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2164         * testsuite/Makefile.in: Regenerate.
2165         * testsuite/dyn_weak_ref.sh: New file.
2166         * testsuite/dyn_weak_ref_1.c: Ditto.
2167         * testsuite/dyn_weak_ref_2.c: Ditto.
2168
2169 2010-08-27  Ian Lance Taylor  <iant@google.com>
2170
2171         * incremental.h (class Incremental_input_entry): Add virtual
2172         destructor.
2173
2174 2010-08-27  Ian Lance Taylor  <iant@google.com>
2175
2176         * testsuite/start_lib_test_3.c: Mark t3 as used.
2177
2178 2010-08-27  Nick Clifton  <nickc@redhat.com>
2179
2180         * options.cc (version_script): Fix small typo in previous
2181         whitespace tidyup.
2182
2183 2010-08-25  Nick Clifton  <nickc@redhat.com>
2184
2185         * archive.cc: Formatting fixes: Remove whitespace between
2186         typename and following asterisk.  Remove whitespace between
2187         function name and opening parenthesis.
2188         * archive.h: Likewise.
2189         * arm.cc: Likewise.
2190         * attributes.cc: Likewise.
2191         * attributes.h: Likewise.
2192         * common.cc: Likewise.
2193         * copy-relocs.cc: Likewise.
2194         * dirsearch.h: Likewise.
2195         * dynobj.cc: Likewise.
2196         * ehframe.cc: Likewise.
2197         * ehframe.h: Likewise.
2198         * expression.cc: Likewise.
2199         * fileread.cc: Likewise.
2200         * fileread.h: Likewise.
2201         * gc.h: Likewise.
2202         * gold-threads.cc: Likewise.
2203         * gold.cc: Likewise.
2204         * i386.cc: Likewise.
2205         * icf.h: Likewise.
2206         * incremental-dump.cc: Likewise.
2207         * incremental.cc: Likewise.
2208         * layout.cc: Likewise.
2209         * layout.h: Likewise.
2210         * main.cc: Likewise.
2211         * merge.cc: Likewise.
2212         * merge.h: Likewise.
2213         * object.cc: Likewise.
2214         * object.h: Likewise.
2215         * options.cc: Likewise.
2216         * options.h: Likewise.
2217         * output.cc: Likewise.
2218         * output.h: Likewise.
2219         * plugin.cc: Likewise.
2220         * plugin.h: Likewise.
2221         * powerpc.cc: Likewise.
2222         * reloc.cc: Likewise.
2223         * script-c.h: Likewise.
2224         * script-sections.cc: Likewise.
2225         * script.cc: Likewise.
2226         * stringpool.cc: Likewise.
2227         * symtab.cc: Likewise.
2228         * symtab.h: Likewise.
2229         * target.cc: Likewise.
2230         * timer.cc: Likewise.
2231         * timer.h: Likewise.
2232         * version.cc: Likewise.
2233         * x86_64.cc: Likewise.
2234
2235 2010-08-24  Nick Clifton  <nickc@redhat.com>
2236
2237         PR 11899
2238         * layout.cc (segment_precedes): Sort segments by their physical
2239         addresses, if they have been set.
2240
2241 2010-08-23  Cary Coutant  <ccoutant@google.com>
2242
2243         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2244         symbols data.
2245         (Lib_group::include_member): Unlock object after deleting its
2246         symbols data.
2247         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2248         the bug fixed here.
2249
2250 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2251             Cary Coutant  <ccoutant@google.com>
2252
2253         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2254         constructor, and set_blocker.
2255         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2256         readsyms_blocker_.
2257         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2258         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2259         * testsuite/Makefile.am (start_lib_test): New test case.
2260         * testsuite/Makefile.in: Regenerate.
2261         * testsuite/start_lib_test_main.c: New file.
2262         * testsuite/start_lib_test_1.c: New file.
2263         * testsuite/start_lib_test_2.c: New file.
2264         * testsuite/start_lib_test_3.c: New file.
2265
2266 2010-08-19  Ian Lance Taylor  <iant@google.com>
2267
2268         * Makefile.in: Rebuild with automake 1.11.1.
2269         * aclocal.m4: Likewise.
2270         * testsuite/Makefile.in: Likewise.
2271
2272 2010-08-19  Ian Lance Taylor  <iant@google.com>
2273
2274         PR 10893
2275         * i386.cc (class Output_data_plt_i386): Update declarations.
2276         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2277         local_ifuncs_ fields.
2278         (Target_i386::do_plt_section_for_global): New function.
2279         (Target_i386::do_plt_section_for_local): New function.
2280         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2281         parameter; change all callers.  Initialize global_ifuncs_ and
2282         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2283         __rel_iplt_end.
2284         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2285         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2286         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2287         symbols.
2288         (Target_i386::make_plt_section): New function, broken out of
2289         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2290         (Target_i386::make_plt_entry): Call make_plt_section.
2291         (Target_i386::make_local_ifunc_plt_entry): New function.
2292         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2293         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2294         R_386_IRELATIVE to switch.
2295         (Target_i386::Scan::global): Likewise.
2296         (Target_i386::Relocate::relocate): Likewise.
2297         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2298         switch.
2299         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2300         (Target_x86_64::do_plt_section_for_global): New function.
2301         (Target_x86_64::do_plt_section_for_local): New function.
2302         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2303         parameter; change all callers.  If doing a static link define
2304         __rela_iplt_start and __rela_iplt_end.
2305         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2306         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2307         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2308         to point to .plt.
2309         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2310         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2311         switch.
2312         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2313         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2314         R_X86_64_IRELATIVE to switch.
2315         (Target_x86_64::Scan::global): Likewise.
2316         (Target_x86_64::Relocate::relocate): Likewise.
2317         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2318         switch.
2319         * target.h (class Target): Add plt_section_for_global and
2320         plt_section_for_local functions.  Add do_plt_section_for_global
2321         and do_plt_section_for_local virtual functions.
2322         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2323         clarifying comments.
2324         (Symbol::use_plt_offset): Handle IFUNC symbol.
2325         * object.cc (Sized_relobj::Sized_relobj): Initialize
2326         local_plt_offsets_.
2327         (Sized_relobj::local_has_plt_offset): New function.
2328         (Sized_relobj::local_plt_offset): New function.
2329         (Sized_relobj::set_local_plt_offset): New function.
2330         (Sized_relobj::do_count): Handle IFUNC symbol.
2331         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2332         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2333         is_ifunc_symbol functions.
2334         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2335         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2336         local_plt_offsets_ field.
2337         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2338         * output.h (class Output_section_data): Add non-const
2339         output_section function.
2340         (class Output_data_got): Update declarations.
2341         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2342         Add use_plt_offset parameter to global and local constructors.
2343         Change all callers.  Change local_sym_index_ field to 31 bits.
2344         Change GSYM_CODE and CONSTANT_CODE accordingly.
2345         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2346         doing a static link don't set sh_link field.
2347         (Output_data_got::Got_entry::write): Use PLT offset if
2348         appropriate.
2349         (Output_data_got::add_global_plt): New function.
2350         (Output_data_got::add_local_plt): New function.
2351         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2352         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2353         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2354         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2355         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2356         IFUNC conditional.
2357         * testsuite/ifunc-sel.h: New file.
2358         * testsuite/ifuncmain1.c: New file.
2359         * testsuite/ifuncmain1vis.c: New file.
2360         * testsuite/ifuncmod1.c: New file.
2361         * testsuite/ifuncdep2.c: New file.
2362         * testsuite/ifuncmain2.c: New file.
2363         * testsuite/ifuncmain3.c: New file.
2364         * testsuite/ifuncmod3.c: New file.
2365         * testsuite/ifuncmain4.c: New file.
2366         * testsuite/ifuncmain5.c: New file.
2367         * testsuite/ifuncmod5.c: New file.
2368         * testsuite/ifuncmain6pie.c: New file.
2369         * testsuite/ifuncmod6.c: New file.
2370         * testsuite/ifuncmain7.c: New file.
2371         * configure, testsuite/Makefile.in: Rebuild.
2372
2373 2010-08-18  Ian Lance Taylor  <iant@google.com>
2374
2375         * incremental.cc
2376         (Output_section_incremental_inputs::write_input_files): Add cast
2377         to avoid signed/unsigned comparison warning.
2378         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2379
2380 2010-08-12  Cary Coutant  <ccoutant@google.com>
2381
2382         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2383
2384 2010-08-13  Ian Lance Taylor  <iant@google.com>
2385
2386         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2387
2388 2010-08-12  Cary Coutant  <ccoutant@google.com>
2389             Doug Kwan  <dougkwan@google.com>
2390
2391         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2392         defintion overrides non-weak undef, remember that the original undef
2393         is not weak.
2394         * symtab.cc (Symbol_table::sized_write_global): For undef without
2395         an original weak binding, set binding to global in output.
2396         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2397         * testsuite/Makefile.in: Regenerate.
2398         * testsuite/strong_ref_weak_def.sh: New file.
2399         * testsuite/strong_ref_weak_def_1.c: Ditto.
2400         * testsuite/strong_ref_weak_def_2.c: Ditto.
2401
2402 2010-08-12  Cary Coutant  <ccoutant@google.com>
2403
2404         * testsuite/incremental_test.sh: Rewrite.
2405         * testsuite/incremental_test_1.c: Rewrite.
2406         * testsuite/incremental_test_2.c: Rewrite.
2407
2408 2010-08-12  Cary Coutant  <ccoutant@google.com>
2409
2410         * arm.cc (Target_arm::got_size): Add const.
2411         (Target_arm::got_entry_count): New function.
2412         (Target_arm::plt_entry_count): New function.
2413         (Target_arm::first_plt_entry_offset): New function.
2414         (Target_arm::plt_entry_size): New function.
2415         (Output_data_plt_arm::entry_count): New function.
2416         (Output_data_plt_arm::first_plt_entry_offset): New function.
2417         (Output_data_plt_arm::get_plt_entry_size): New function.
2418         * i386.cc (Target_i386::got_size): Add const.
2419         (Target_i386::got_entry_count): New function.
2420         (Target_i386::plt_entry_count): New function.
2421         (Target_i386::first_plt_entry_offset): New function.
2422         (Target_i386::plt_entry_size): New function.
2423         (Output_data_plt_i386::entry_count): New function.
2424         (Output_data_plt_i386::first_plt_entry_offset): New function.
2425         (Output_data_plt_i386::get_plt_entry_size): New function.
2426         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2427         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2428         * incremental.cc: Include target.h.
2429         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2430         parameter.  Adjust all callers.  Find incremental_got_plt section.
2431         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2432         section.
2433         (Output_section_incremental_inputs::set_final_data_size): Calculate
2434         size of incremental_got_plt section.
2435         (Output_section_incremental_inputs::do_write): Write the
2436         incremental_got_plt section.
2437         (Got_plt_view_info): New struct.
2438         (Local_got_offset_visitor): New class.
2439         (Global_got_offset_visitor): New class.
2440         (Global_symbol_visitor_got_plt): New class.
2441         (Output_section_incremental_inputs::write_got_plt): New function.
2442         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2443         Add parameter.  Adjust all callers.
2444         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2445         (Incremental_inputs::got_plt_section): New function.
2446         (Incremental_inputs::got_plt_section_): New data member.
2447         (Incremental_got_plt_reader): New class.
2448         * layout.cc (Layout::create_incremental_info_sections): Add the
2449         incremental_got_plt section.
2450         * object.h (Got_offset_list::get_list): New function.
2451         (Got offset_list::for_all_got_offsets): New function.
2452         (Sized_relobj::local_got_offset_list): New function.
2453         * powerpc.cc (Target_powerpc::got_size): Add const.
2454         (Target_powerpc::got_entry_count): New function.
2455         (Target_powerpc::plt_entry_count): New function.
2456         (Target_powerpc::first_plt_entry_offset): New function.
2457         (Target_powerpc::plt_entry_size): New function.
2458         (Output_data_plt_powerpc::entry_count): New function.
2459         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2460         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2461         * sparc.cc (Target_sparc::got_size): Add const.
2462         (Target_sparc::got_entry_count): New function.
2463         (Target_sparc::plt_entry_count): New function.
2464         (Target_sparc::first_plt_entry_offset): New function.
2465         (Target_sparc::plt_entry_size): New function.
2466         (Output_data_plt_sparc::entry_count): New function.
2467         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2468         (Output_data_plt_sparc::get_plt_entry_size): New function.
2469         * symtab.h (Symbol::got_offset_list): New function.
2470         (Symbol_table::for_all_symbols): New function.
2471         * target.h (Sized_target::got_entry_count): New function.
2472         (Sized_target::plt_entry_count): New function.
2473         (Sized_target::plt_entry_size): New function.
2474         * x86_64.cc (Target_x86_64::got_size): Add const.
2475         (Target_x86_64::got_entry_count): New function.
2476         (Target_x86_64::plt_entry_count): New function.
2477         (Target_x86_64::first_plt_entry_offset): New function.
2478         (Target_x86_64::plt_entry_size): New function.
2479         (Output_data_plt_x86_64::entry_count): New function.
2480         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2481         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2482
2483 2010-08-12  Cary Coutant  <ccoutant@google.com>
2484
2485         * archive.cc: Include incremental.h.
2486         (Archive::Archive): Initialize incremental_info_.
2487         (Archive::include_member): Record archive members in incremental info.
2488         (Add_archive_symbols::run): Record begin and end of an archive in
2489         incremental info.
2490         (Lib_group::include_member): Record objects in incremental info.
2491         * archive.h (Incremental_archive_entry): Forward declaration.
2492         (Archive::set_incremental_info): New member function.
2493         (Archive::incremental_info): New member function.
2494         (Archive::Unused_symbol_iterator): New class.
2495         (Archive::unused_symbols_begin): New member function.
2496         (Archive::unused_symbols_end): New member function.
2497         (Archive::incremental_info_): New data member.
2498         * incremental-dump.cc (find_input_containing_global): New function.
2499         (dump_incremental_inputs): Dump new incremental info sections.
2500         * incremental.cc: Include symtab.h.
2501         (Output_section_incremental_inputs): New class.
2502         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2503         new incremental info sections.
2504         (Sized_incremental_binary::do_check_inputs): Likewise.
2505         (Incremental_inputs::report_archive): Remove.
2506         (Incremental_inputs::report_archive_begin): New function.
2507         (Incremental_inputs::report_archive_end): New function.
2508         (Incremental_inputs::report_object): New function.
2509         (Incremental_inputs::finalize_inputs): Remove.
2510         (Incremental_inputs::report_input_section): New function.
2511         (Incremental_inputs::report_script): Rewrite.
2512         (Incremental_inputs::finalize): Do nothing but finalize string table.
2513         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2514         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2515         (Incremental_inputs::create_data_sections): New function.
2516         (Incremental_inputs::relocs_entsize): New function.
2517         (Output_section_incremental_inputs::set_final_data_size): New function.
2518         (Output_section_incremental_inputs::do_write): New function.
2519         (Output_section_incremental_inputs::write_header): New function.
2520         (Output_section_incremental_inputs::write_input_files): New function.
2521         (Output_section_incremental_inputs::write_info_blocks): New function.
2522         (Output_section_incremental_inputs::write_symtab): New function.
2523         * incremental.h (Incremental_script_entry): Forward declaration.
2524         (Incremental_object_entry): Forward declaration.
2525         (Incremental_archive_entry): Forward declaration.
2526         (Incremental_inputs): Forward declaration.
2527         (Incremental_inputs_header_data): Remove.
2528         (Incremental_inputs_header): Remove.
2529         (Incremental_inputs_header_write): Remove.
2530         (Incremental_inputs_entry_data): Remove.
2531         (Incremental_inputs_entry): Remove.
2532         (Incremental_inputs_entry_write): Remove.
2533         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2534         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2535         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2536         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2537         Likewise.
2538         (Incremental_input_entry): New class.
2539         (Incremental_script_entry): New class.
2540         (Incremental_object_entry): New class.
2541         (Incremental_archive_entry): New class.
2542         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2543         (Incremental_inputs::report_inputs): Remove.
2544         (Incremental_inputs::report_archive): Remove.
2545         (Incremental_inputs::report_archive_begin): New function.
2546         (Incremental_inputs::report_archive_end): New function.
2547         (Incremental_inputs::report_object): Change prototype.
2548         (Incremental_inputs::report_input_section): New function.
2549         (Incremental_inputs::report_script): Change prototype.
2550         (Incremental_inputs::get_reloc_count): New function.
2551         (Incremental_inputs::set_reloc_count): New function.
2552         (Incremental_inputs::create_data_sections): New function.
2553         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2554         (Incremental_inputs::inputs_section): New function.
2555         (Incremental_inputs::symtab_section): New function.
2556         (Incremental_inputs::relocs_section): New function.
2557         (Incremental_inputs::get_stringpool): Add const.
2558         (Incremental_inputs::command_line): Add const.
2559         (Incremental_inputs::inputs): Remove.
2560         (Incremental_inputs::command_line_key): New function.
2561         (Incremental_inputs::input_file_count): New function.
2562         (Incremental_inputs::input_files): New function.
2563         (Incremental_inputs::relocs_entsize): New function.
2564         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2565         (Incremental_inputs::finalize_inputs): Remove.
2566         (Incremental_inputs::Input_info): Remove.
2567         (Incremental_inputs::lock_): Remove.
2568         (Incremental_inputs::inputs_): Change type.
2569         (Incremental_inputs::inputs_map_): Remove.
2570         (Incremental_inputs::current_object_entry_): New data member.
2571         (Incremental_inputs::inputs_section_): New data member.
2572         (Incremental_inputs::symtab_section_): New data member.
2573         (Incremental_inputs::relocs_section_): New data member.
2574         (Incremental_inputs::reloc_count_): New data member.
2575         (Incremental_inputs_reader): New class.
2576         (Incremental_symtab_reader): New class.
2577         (Incremental_relocs_reader): New class.
2578         * layout.cc (Layout::finalize): Move finalization of incremental info
2579         and creation of incremental info sections to follow finalization of
2580         symbol table.  Set offsets for postprocessing sections.
2581         (Layout::create_incremental_info_sections): Call
2582         Incremental_inputs::create_data_sections.  Add incremental symtab
2583         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2584         sections to layout after input sections.
2585         * layout.h (struct Timespec): Forward declaration.
2586         (Layout::incremental_inputs): Add const.
2587         (Layout::create_incremental_info_sections): Add parameter.
2588         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2589         * object.cc: Include incremental.h.
2590         (Relobj::finalize_incremental_relocs): New function.
2591         (Sized_relobj::do_layout): Record input sections in incremental info.
2592         * object.h (Object::output_section): New function.
2593         (Object::output_section_offset): Moved from Relobj.
2594         (Object::get_incremental_reloc_base): New function.
2595         (Object::get_incremental_reloc_count): New function.
2596         (Object::do_output_section): New function.
2597         (Object::do_output_section_offset): Moved from Relobj.
2598         (Object::do_get_incremental_reloc_base): New function.
2599         (Object::do_get_incremental_reloc_count): New function.
2600         (Object::Object): Initialize new data members.
2601         (Relobj::output_section): Renamed do_output_section and moved to
2602         protected.
2603         (Relobj::output_section_offset): Moved to Object.
2604         (Relobj::do_get_incremental_reloc_base): New function.
2605         (Relobj::do_get_incremental_reloc_count): New function.
2606         (Relobj::allocate_incremental_reloc_counts): New function.
2607         (Relobj::count_incremental_reloc): New function.
2608         (Relobj::finalize_incremental_relocs): New function.
2609         (Relobj::next_incremental_reloc_index): New function.
2610         (Relobj::reloc_counts_): New data member.
2611         (Relobj::reloc_bases_): New data member.
2612         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2613         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2614         (Sized_relobj::incremental_relocs_scan): New function.
2615         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2616         (Sized_relobj::incremental_relocs_write): New function.
2617         (Sized_relobj::incremental_relocs_write_reltype): New function.
2618         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2619         incremental link.
2620         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2621         archives and object files elsewhere.
2622         (Add_symbols::run): Report object files here.
2623         (Finish_group::run): Report end of archive at end of group.
2624         * reloc.cc: Include layout.h, incremental.h.
2625         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2626         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2627         (Sized_relobj::incremental_relocs_scan): New function.
2628         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2629         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2630         (Sized_relobj::incremental_relocs_write): New function.
2631         (Sized_relobj::incremental_relocs_write_reltype): New function.
2632         * script.cc (read_input_script): Rewrite test for incremental link.
2633         Change call to Incremental_inputs::report_script.
2634         * symtab.h (Symbol_table::first_global_index): New function.
2635         (Symbol_table::output_count): New function.
2636
2637 2010-08-12  Doug Kwan  <dougkwan@google.com>
2638
2639         * arm.cc (Target_arm::merge_object_attributes): Check command line
2640         options --no-wchar-size-warning and --no-enum-size-warning.
2641         * options.h (General_options): Add ld-compatible options
2642         --no-enum-size-warning and --no-wchar-size-warning.
2643
2644 2010-08-04  Ian Lance Taylor  <iant@google.com>
2645
2646         * x86_64.cc (Target_x86_64::Scan::local): Use
2647         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2648         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2649         (Target_x86_64::Scan::global): Likewise.
2650         (Target_x86_64::Relocate::relocate): Likewise.
2651         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2652         Likewise.
2653
2654 2010-08-03  Cary Coutant  <ccoutant@google.com>
2655
2656         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2657         to reserve space in merged_strings vector. Keep total input size
2658         for stats.
2659         (Output_merge_string::do_print_merge_stats): Print total input size.
2660         * merge.h (Output_merge_string): Add input_size_ field.
2661         * stringpool.cc (Stringpool_template::string_length): Move
2662         implementations out of Stringpool_template class and place in
2663         stringpool.h.
2664         * stringpool.h (string_length): Move out of Stringpool_template.
2665
2666 2010-08-03  Ian Lance Taylor  <iant@google.com>
2667
2668         PR 11712
2669         * layout.cc (relaxation_loop_body): If address of load segment is
2670         set, adjust address to include headers if possible.
2671
2672 2010-08-03  Ian Lance Taylor  <iant@google.com>
2673
2674         * version.cc (version_string): Bump to 1.10.
2675
2676 2010-08-03  Ian Lance Taylor  <iant@google.com>
2677
2678         PR 11805
2679         * layout.h (enum Output_section_order): Define.
2680         (class Layout): Update declarations.
2681         * layout.cc (Layout::get_output_section): Add order parameter.
2682         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2683         is_first_non_relro parameters.  Change all callers.
2684         (Layout::choose_output_section): Likewise.
2685         (Layout::add_output_section_data): Likewise.
2686         (Layout::make_output_section): Likewise.  Set order.
2687         (Layout::default_section_order): New function.
2688         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2689         * output.cc (Output_section::Output_section): Initialize order_.
2690         Don't initialize deleted fields.
2691         (Output_segment::Output_segment): Don't initialize deleted
2692         fields.
2693         (Output_segment::add_output_section_to_load): New function
2694         replacing add_output_section.  Change all callers to call this or
2695         add_output_section_to_nonload.
2696         (Output_segment::add_output_section_to_nonload): New function.
2697         (Output_segment::remove_output_section): Rewrite.
2698         (Output_segment::add_initial_output_data): Likewise.
2699         (Output_segment::has_any_data_sections): Likewise.
2700         (Output_segment::is_first_section_relro): Likewise.
2701         (Output_segment::maximum_alignment): Likewise.
2702         (Output_segment::has_dynamic_reloc): New function replacing
2703         dynamic_reloc_count.  Change all callers.
2704         (Output_segment::has_dynamic_reloc_list): New function replacing
2705         dynamic_reloc_count_list.  Change all callers.
2706         (Output_segment::set_section_addresses): Rewrite.
2707         (Output_segment::set_offset): Rewrite.
2708         (Output_segment::find_first_and_last_list): Remove.
2709         (Output_segment::set_tls_offsets): Rewrite.
2710         (Output_segment::first_section_load_address): Likewise.
2711         (Output_segment::output_section_count): Likewise.
2712         (Output_segment::section_with_lowest_load_address): Likewise.
2713         (Output_segment::write_section_headers): Likewise.
2714         (Output_segment::print_sections_to_map): Likewise.
2715         * output.h (class Output_data): Remove dynamic_reloc_count_
2716         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2717         (Output_data::add_dynamic_reloc): Rewrite.
2718         (Output_data::has_dynamic_reloc): New function.
2719         (Output_data::dynamic_reloc_count): Remove.
2720         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2721         is_last_relro_, is_first_non_relro_, is_interp_,
2722         is_dynamic_linker_section_ fields.  Add order and set_order
2723         functions.  Remove is_relro_local, set_is_relro_local,
2724         is_last_relro, set_is_last_relro, is_first_non_relro,
2725         set_is_first_non_relro functions, is_interp, set_is_interp,
2726         is_dynamic_linker_section, and set_is_dynamic_linker_section
2727         functions.
2728         (class Output_segment): Change Output_data_list from std::list to
2729         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2730         output_bss_ fields.  Update declarations.
2731
2732 2010-08-02  Ian Lance Taylor  <iant@google.com>
2733
2734         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2735         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2736         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2737
2738 2010-08-02  Ian Lance Taylor  <iant@google.com>
2739
2740         PR 11855
2741         * script.cc (Script_options::Script_options): Initialize
2742         symbol_definitions_ and symbol_references_.
2743         (Script_options::add_symbol_assignment): Update
2744         symbol_definitions_ and symbol_references_.
2745         (Script_options::add_symbol_reference): New function.
2746         (script_symbol): New function.
2747         * script.h (class Script_options): Add symbol_definitions_ and
2748         symbol_references_ fields.
2749         (Script_options::referenced_const_iterator): New type.
2750         (Script_options::referenced_begin): New function.
2751         (Script_options::referenced_end): New function.
2752         (Script_options::is_referenced): New function.
2753         (Script_options::any_unreferenced): New function.
2754         * script-c.h (script_symbol): Declare.
2755         * yyscript.y (exp): Call script_symbol.
2756         * symtab.cc: Include "script.h".
2757         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2758         Change all callers.  Check symbols referenced by scripts.
2759         (Symbol_table::add_undefined_symbols_from_command_line): Add
2760         layout parameter.  Change all callers.
2761         (Symbol_table::do_add_undefined_symbols_from_command_line):
2762         Likewise.  Break out loop body.  Check symbols referenced by
2763         scripts.
2764         (Symbol_table::add_undefined_symbol_from_command_line): New
2765         function broken out of
2766         do_add_undefined_symbols_from_command_line.
2767         * symtab.h (class Symbol_table): Update declarations.
2768         * archive.cc: Include "layout.h".
2769         (Archive::should_include_member): Add layout parameter.  Change
2770         all callers.  Check for symbol mentioned in expression.
2771         * archive.h (class Archive): Update declaration.
2772         * object.cc (Sized_relobj::do_should_include_member): Add layout
2773         parameter.
2774         * object.h (Object::should_include_member): Add layout parameter.
2775         Change all callers.
2776         (Object::do_should_include_member): Add layout parameter.
2777         (class Sized_relobj): Update declaration.
2778         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2779         parameter.
2780         * dynobj.h (class Sized_dynobj): Update declaration.
2781         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2782         layout parameter.
2783         * plugin.h (class Sized_pluginobj): Update declaration.
2784
2785 2010-08-02  Ian Lance Taylor  <iant@google.com>
2786
2787         PR 11866
2788         * output.cc (Output_segment::set_offset): Search for the first and
2789         last sections rather than assuming that the list is in order.
2790         (Output_segment::find_first_and_last_list): New function.
2791         * output.h (class Output_segment): Update declarations.
2792         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2793         (relro_strip_test_SOURCES): New variable.
2794         (relro_strip_test_DEPENDENCIES): New variable.
2795         (relro_strip_test_LDFLAGS): New variable.
2796         (relro_strip_test_LDADD): New variable.
2797         (relro_strip_test.so): New target.
2798
2799 2010-08-02  Ian Lance Taylor  <iant@google.com>
2800
2801         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2802         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2803         (Target_i386::got_tlsdesc_section): New function.
2804         (Target_i386::got_section): Create space for GOT entries for
2805         TLSDESC relocations.
2806         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2807         R_386_TLS_GOTDESC.
2808         (Target_i386::Scan::global): Likewise.
2809         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2810         using TLSDESC GOT.
2811         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2812         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2813         (Target_x86_64::got_tlsdesc_section): New function.
2814         (Target_x86_64::got_section): Create space for GOT entries for
2815         TLSDESC relocations.
2816         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2817         R_386_TLS_GOTDESC.
2818         (Target_x86_64::Scan::global): Likewise.
2819         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2820         using TLSDESC GOT.
2821
2822 2010-08-02  Ian Lance Taylor  <iant@google.com>
2823
2824         * testsuite/final_layout.sh: Use dc to convert from hex to
2825         decimal.
2826
2827 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2828
2829         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2830         paramter to the call to gold::gc_process_relocs.
2831         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2832         paramter to the call to gold::gc_process_relocs.
2833         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2834         parameter to the call to gold::gc_process_relocs.
2835         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2836         template parameter to the call to gold::gc_process_relocs.
2837         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2838         paramter to the call to gold::gc_process_relocs.
2839         * gc.h (get_embedded_addend_size): New function.
2840         (gc_process_relocs): Save the size of the reloc for use by ICF.
2841         * icf.cc (get_section_contents): Get the addend from the text section
2842         for SHT_REL relocation sections.
2843         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2844         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2845         * int_encoding.h (read_from_pointer): New overloaded function.
2846         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2847         * testsuite/icf_sht_rel_addend_test.sh: New file.
2848         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2849         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2850
2851 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2852
2853         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2854         * Makefile.in: Regenerate.
2855         * testsuite/Makefile.in: Regenerate.
2856
2857 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2858
2859         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2860         * gold/testsuite/debug_msg.cc: Likewise.
2861         * gold/testsuite/odr_violation1.cc
2862         * gold/testsuite/odr_violation2.cc
2863
2864 2010-07-21  Cary Coutant  <ccoutant@google.com>
2865
2866         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2867         string, and length fields.
2868         (Output_merge_string::Merged_strings_list): New type.
2869         (Output_merge_string::Merged_strings_lists): New typedef.
2870         (Output_merge_string): Replace merged_strings_ with
2871         merged_strings_lists_.
2872         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2873         Merged_strings_list per input object and section.  Don't store pointer
2874         to the string.  Don't store length with each merged string entry.
2875         (Output_merge_string::finalize_merged_data): Loop over list of merged
2876         strings lists.  Recompute length of each merged string.
2877
2878 2010-07-15  Cary Coutant  <ccoutant@google.com>
2879
2880         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2881         here.
2882
2883 2010-07-14  Ian Lance Taylor  <iant@google.com>
2884
2885         * descriptors.cc (Descriptors::open): Report correct name in error
2886         message.
2887
2888 2010-07-13  Doug Kwan  <dougkwan@google.com>
2889
2890         * arm.cc (Arm_input_section::Arm_input_section): For a
2891         SHT_ARM_EXIDX section, always keeps the input sections.
2892         (Arm_input_section::set_exidx_section_link): New method.
2893         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2894         has_errors_ to false.
2895         (Arm_exidx_input_section::has_errors,
2896         Arm_exidx_input_section::set_has_errors): New methods.
2897         (Arm_exidx_input_section::has_errors_): New data member.
2898         (Arm_relobj::get_exidx_shndx_list): New method.
2899         (Arm_output_section::append_text_sections_to_list): Do not skip
2900         section without SHF_EXECINSTR.
2901         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2902         errors.
2903         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2904         section header.  Make error messages more verbose.  Check for
2905         a non-executable section linked to an EXIDX section.
2906         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2907         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2908         check that there is no deferred EXIDX section if we exit early.
2909         Instead of not making an EXIDX section in case of an error, make one
2910         and set the has_errors flag of it.
2911         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2912         in a relocatable link.
2913         (Target_arm::do_relax): Look for the EXIDX output section instead of
2914         assuming that it is called .ARM.exidx.
2915         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2916         section list.  Do not check for SHF_EXECINSTR section flags but
2917         skip any input section with errors.
2918         * output.cc (Output_section::Output_section): Initialize
2919         always_keeps_input_sections_ to false.
2920         (Output_section::add_input_section): Check for
2921         always_keeps_input_sections_.
2922         *  output.h (Output_section::always_keeps_input_sections,
2923         Output_section::set_always_keeps_input_sections): New methods.
2924         (Output_section::always_keeps_input_sections): New data member.
2925
2926 2010-07-13  Rafael Espindola  <espindola@google.com>
2927
2928         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2929         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2930
2931 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2932             Ian Lance Taylor  <iant@google.com>
2933
2934         * output.h (Output_section_lookup_maps::add_merge_section):
2935         Correct check of whether value was inserted.
2936         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2937         (Output_section_lookup_maps::add_relaxed_input_section):
2938         Likewise.
2939         * arm.cc (Target_arm::got_section): Remove used local os.
2940         * i386.cc (Target_i386::got_section): Likewise.
2941         * x86_64.cc (Target_x86_64::got_section): Likewise.
2942         * sparc.cc (Target_sparc::got_section): Likewise.
2943         (Target_sparc::relocate): Remove unused local have_got_offset.
2944         * powerpc.cc (Target_powerpc::relocate): Likewise.
2945
2946 2010-07-13  Ian Lance Taylor  <iant@google.com>
2947
2948         * compressed_output.cc (zlib_decompress): Fix signature in
2949         !HAVE_ZLIB_H case.
2950
2951         * archive.cc (Archive::include_member): Unlock an external member
2952         of a thin archive.  Don't bother to delete an object we know is
2953         NULL.
2954
2955 2010-07-12  Cary Coutant  <ccoutant@google.com>
2956
2957         * compressed_output.cc (zlib_decompress): New function.
2958         (get_uncompressed_size): New function.
2959         (decompress_input_section): New function.
2960         * compressed_output.h (get_uncompressed_size): New function.
2961         (decompress_input_section): New function.
2962         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2963         Handle compressed debug sections.
2964         * layout.cc (is_compressed_debug_section): New function.
2965         (Layout::output_section_name): Map compressed section names to
2966         canonical names.
2967         * layout.h (is_compressed_debug_section): New function.
2968         (is_debug_info_section): Recognize compressed debug sections.
2969         * merge.cc: Include compressed_output.h.
2970         (Output_merge_data::do_add_input_section): Handle compressed
2971         debug sections.
2972         (Output_merge_string::do_add_input_section): Handle compressed
2973         debug sections.
2974         * object.cc: Include compressed_output.h.
2975         (Sized_relobj::Sized_relobj): Initialize new data members.
2976         (build_compressed_section_map): New function.
2977         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2978         * object.h (Object::section_is_compressed): New method.
2979         (Object::do_section_is_compressed): New method.
2980         (Sized_relobj::Compressed_section_map): New type.
2981         (Sized_relobj::do_section_is_compressed): New method.
2982         (Sized_relobj::compressed_sections_): New data member.
2983         * output.cc (Output_section::add_input_section): Handle compressed
2984         debug sections.
2985         * reloc.cc: Include compressed_output.h.
2986         (Sized_relobj::write_sections): Handle compressed debug sections.
2987
2988 2010-07-08  Cary Coutant  <ccoutant@google.com>
2989
2990         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2991         weak when resolving to a dynamic def.
2992         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2993         for weak undef/dynamic def cases. Adjust callers.
2994         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2995         undef_binding_weak_.
2996         (Symbol_table::sized_write_globals): Adjust symbol binding.
2997         (Symbol_table::sized_write_symbol): Add binding parameter.
2998         * symtab.h (Symbol::set_undef_binding): New method.
2999         (Symbol::is_undef_binding_weak): New method.
3000         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3001         (Symbol_table::should_override): Add new parameter.
3002         (Symbol_table::sized_write_symbol): Add new parameter.
3003
3004         * testsuite/weak_undef_file1.cc: Add new test case.
3005         * testsuite/weak_undef_file2.cc: Fix header comment.
3006         * testsuite/weak_undef_test.cc: Add new test case.
3007
3008 2010-06-29  Doug Kwan  <dougkwan@google.com>
3009
3010         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3011         Initialize USE_SYMBOL_.
3012         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3013         definition.
3014         (Arm_reloc_property::uses_symbol_): New data member declaration.
3015         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3016         uses symbol value and symbol is undefined but not weakly undefined.
3017
3018 2010-06-28  Rafael Espindola  <espindola@google.com>
3019
3020         * plugin.cc (Plugin::load): Use dlerror.
3021
3022 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3023
3024         * symtab.cc (detect_odr_violations): When reporting an ODR
3025         violation, report an object where the symbol is defined.
3026
3027 2010-06-25  Doug Kwan  <dougkwan@google.com>
3028
3029         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3030         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3031         definition.
3032         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3033         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3034         target hook to detect function points.
3035         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3036         * icf.h (Icf::check_section_for_function_pointers): Change type of
3037         parameter SECTION_NAME to const reference to std::string.  Use
3038         target hook to determine if section may have unsafe pointers.
3039         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3040         method definition.
3041
3042 2010-06-21  Rafael Espindola  <espindola@google.com>
3043
3044         * fileread.cc (Input_file::find_fie): New
3045         (Input_file::open): Use Input_file::find_fie.
3046         * fileread.h (Input_file::find_fie): New
3047         * plugin.cc (set_extra_library_path): New.
3048         (Plugin::load): Add set_extra_library_path to the transfer vector.
3049         (Plugin_manager::set_extra_library_path): New.
3050         (Plugin_manager::add_input_file): Use the extra search path if set.
3051         (set_extra_library_path(): New.
3052         * plugin.h (Plugin_manager): Add set_extra_library_path and
3053         extra_search_path_.
3054
3055 2010-06-19  Cary Coutant  <ccoutant@google.com>
3056
3057         * layout.cc (gdb_sections): Add .debug_types.
3058         (lines_only_debug_sections): Likewise.
3059
3060 2010-06-18  Rafael Espindola  <espindola@google.com>
3061
3062         * plugin.cc (add_input_file,add_input_library)
3063         (Plugin_manager::add_input_file): Make filename arguments const.
3064         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3065         const.
3066
3067 2010-06-16  Doug Kwan  <dougkwan@google.com>
3068
3069         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3070         .ARM.attributes section if we have not merged any input
3071         attributes sections.
3072
3073 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3074
3075         * arm.cc: Allow combining objects with no EABI version
3076         information.
3077
3078 2010-06-15  Rafael Espindola  <espindola@google.com>
3079
3080         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3081
3082 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3083
3084         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3085         (struct iovec): Correct !HAVE_READV definition.
3086
3087 2010-06-10  Cary Coutant  <ccoutant@google.com>
3088
3089         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3090         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3091         reloc sections.
3092         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3093
3094         PR 11683
3095         * symtab.h (Symbol::is_placeholder): New member function.
3096         * target-reloc.h (relocate_section): Check for placeholder symbols.
3097
3098         * testsuite/Makefile.am (plugin_test_8): New test.
3099         (plugin_test_9): New test.
3100         * testsuite/Makefile.in: Regenerate.
3101
3102 2010-06-09  Nick Clifton  <nickc@redhat.com>
3103
3104         * yyscript.y (input_list_element): Allow strings prefixed with
3105         the '-' character.  Treat these as libraries.
3106         * script.cc (script_add_library): New function.  Adds a library
3107         specified by "-l<name>" found in an input script.
3108         * script-c.h: Add prototype for script_add_library.
3109
3110 2010-06-07  Doug Kwan  <dougkwan@google.com>
3111
3112         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3113         Restrict stub-group size to be within long conditional branch
3114         range when working around cortex-A8 erratum.
3115
3116 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3117
3118         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3119         #ifdef typo.
3120
3121 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3122
3123         PR gold/11658
3124         * output.cc
3125         (Output_section::Input_section_sort_entry::compare_section_ordering):
3126         Change to return non-zero correctly.
3127         (Output_section::Input_section_sort_section_order_index_compare
3128         ::operator()): Change to fix ambiguity in comparisons.
3129
3130 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3131
3132         * gold.h (is_wildcard_string): New function.
3133         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3134         (Layout::layout_eh_frame): Ditto.
3135         (Layout::find_section_order_index): New method.
3136         (Layout::read_layout_from_file): New method.
3137         * layout.h (Layout::find_section_order_index): New method.
3138         (Layout::read_layout_from_file): New method.
3139         (Layout::input_section_position_): New private member.
3140         (Layout::input_section_glob_): New private member.
3141         * main.cc (main): Call read_layout_from_file here.
3142         * options.h (--section-ordering-file): New option.
3143         * output.cc (Output_section::input_section_order_specified_): New
3144         member.
3145         (Output_section::Output_section): Initialize new member.
3146         (Output_section::add_input_section): Add new parameter.
3147         Keep input sections when --section-ordering-file is used.
3148         (Output_section::set_final_data_size): Sort input sections when
3149         section ordering file is specified.
3150         (Output_section::Input_section_sort_entry): Add new parameter.
3151         Check sorting type.
3152         (Output_section::Input_section_sort_entry::compare_section_ordering):
3153         New method.
3154         (Output_section::Input_section_sort_compare::operator()): Change to
3155         consider section_order_index.
3156         (Output_section::Input_section_sort_init_fini_compare::operator()):
3157         Change to consider section_order_index.
3158         (Output_section::Input_section_sort_section_order_index_compare
3159         ::operator()): New method.
3160         (Output_section::sort_attached_input_sections): Change to sort
3161         according to section order when specified.
3162         (Output_section::add_input_section<32, true>): Add new parameter.
3163         (Output_section::add_input_section<64, true>): Add new parameter.
3164         (Output_section::add_input_section<32, false>): Add new parameter.
3165         (Output_section::add_input_section<64, false>): Add new parameter.
3166         * output.h (Output_section::add_input_section): Add new parameter.
3167         (Output_section::input_section_order_specified): New
3168         method.
3169         (Output_section::set_input_section_order_specified): New method.
3170         (Input_section::Input_section): Initialize section_order_index_.
3171         (Input_section::section_order_index): New method.
3172         (Input_section::set_section_order_index): New method.
3173         (Input_section::section_order_index_): New member.
3174         (Input_section::Input_section_sort_section_order_index_compare): New
3175         struct.
3176         (Output_section::input_section_order_specified_): New member.
3177         * script-sections.cc (is_wildcard_string): Delete and move modified
3178         method to gold.h.
3179         (Output_section_element_input::Output_section_element_input): Modify
3180         call to is_wildcard_string.
3181         (Output_section_element_input::Input_section_pattern
3182         ::Input_section_pattern): Ditto.
3183         (Output_section_element_input::Output_section_element_input): Ditto.
3184         * testsuite/Makefile.am (final_layout): New test case.
3185         * testsuite/Makefile.in: Regenerate.
3186         * testsuite/final_layout.cc: New file.
3187         * testsuite/final_layout.sh: New file.
3188
3189 2010-06-01  Rafael Espindola  <espindola@google.com>
3190
3191         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3192
3193 2010-06-01  Rafael Espindola  <espindola@google.com>
3194
3195         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3196         visibility of symbols.
3197
3198 2010-05-27  Doug Kwan  <dougkwan@google.com>
3199
3200         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3201         from start of output section instead of address for a local symbol
3202         in a merged or relaxed section when doing a relocatable link.
3203
3204 2010-05-26  Rafael Espindola  <espindola@google.com>
3205
3206        PR 11604
3207         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3208         adding sections the garbage collector removed.
3209         * gold/testsuite/Makefile.am: Add test.
3210         * gold/testsuite/Makefile.in: Regenerate.
3211         * gold/testsuite/plugin_test_7.sh: New.
3212         * gold/testsuite/plugin_test_7_1.c: New.
3213         * gold/testsuite/plugin_test_7_2.c: New.
3214
3215 2010-05-26  Rafael Espindola  <espindola@google.com>
3216
3217         * script-sections.cc (Output_section_definition::set_section_addresses):
3218         Check for --section-start.
3219
3220 2010-05-26  Doug Kwan  <dougkwan@google.com>
3221
3222         * arm.cc (Arm_scan_relocatable_relocs): New class.
3223         (Target_arm::relocate_special_relocatable): New method.
3224         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3225         (Arm_relocate_functions::thumb_branch_common): Same.
3226         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3227         instead of Default_scan_relocatable_relocs.
3228         * target-reloc.h (relocate_for_relocatable): Let target handle
3229         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3230         * target.h (Sized_target::relocate_special_relocatable): New method.
3231
3232 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3233
3234         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3235
3236 2010-05-23  Doug Kwan  <dougkwan@google.com>
3237
3238         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3239         instead of a cast.
3240         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3241         with a direct branch, not a conditional branch, to a stub.
3242         * merge.cc (Output_merge_base::record_input_section): New method
3243         defintion.
3244         (Output_merge_data::do_add_input_section): Record input section if
3245         keeps-input-sections flag is set.
3246         (Output_merge_string::do_add_input_section): Ditto.
3247         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3248         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3249         INPUT_SECTIONS_.
3250         (Output_merge_base::keeps_input_sections,
3251         Output_merge_base::set_keeps_input_sections,
3252         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3253         method definitions.
3254         (Output_merge_base::Input_sections): New type declaration.
3255         (Output_merge_base::input_sections_begin,
3256         Output_merge_base::input_sections_end,
3257         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3258         (Output_merge_base::bool keeps_input_sections_,
3259         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3260         Output_merge_base::input_sections_): New data members.
3261         (Output_merge_data::do_set_keeps_input_sections): New method
3262         defintion.
3263         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3264         * output.cc (Output_section::Input_section::relobj): Move method
3265         defintion from class declaration to here and handle merge sections.
3266         (Output_section::Input_section::shndx): Ditto.
3267         (Output_section::Output_section): Remove initializations of removed
3268         data members and initialize new data member LOOKUP_MAPS_.
3269         (Output_section::add_input_section): Set keeps-input-sections flag
3270         for a newly created merge output section as appropriate.  Adjust code
3271         to use Output_section_lookup_maps class.
3272         (Output_section::add_relaxed_input_section): Adjst code for lookup
3273         maps code refactoring.
3274         (Output_section::add_merge_input_section): Add a new parameter
3275         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3276         class.  If adding input section to a newly created merge output
3277         section fails, remove the new merge section.
3278         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3279         Adjust code for use of the Output_section_lookup_maps class.
3280         (Output_section::find_merge_section): Ditto.
3281         (Output_section::build_lookup_maps): New method defintion.
3282         (Output_section::find_relaxed_input_section): Adjust code to use
3283         Output_section_lookup_maps class.
3284         (Output_section::get_input_sections): Export merge sections.  Adjust
3285         code to use Output_section_lookup_maps class.
3286         (Output_section:::add_script_input_section): Adjust code to use
3287         Output_section_lookup_maps class.  Update lookup maps for merge
3288         sections also.
3289         (Output_section::discard_states): Use Output_section_lookup_maps.
3290         (Output_section::restore_states): Same.
3291         * output.h (Merge_section_properties): Move class defintion out of
3292         Output_section.
3293         (Output_section_lookup_maps): New class.
3294         (Output_section::Input_section::is_merge_section): New method
3295         defintion.
3296         (Output_section::Input_section::relobj): Move defintion out of class
3297         defintion.  Declare method only.
3298         (Output_section::Input_section::shndx): Ditto.
3299         (Output_section::Input_section::output_merge_base): New method defintion.
3300         (Output_section::Input_section::u2_.pomb): New union field.
3301         (Output_section::Merge_section_by_properties_map,
3302         Output_section::Output_section_data_by_input_section_map,
3303         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3304         Remove types.
3305         (Output_section::add_merge_input_section): Add new parameter
3306         KEEPS_INPUT_SECTIONS.
3307         (Output_section::build_lookup_maps): New method declaration.
3308         (Output_section::merge_section_map_,
3309         Output_section::merge_section_by_properties_map_,
3310         Output_section::relaxed_input_section_map_,
3311         Output_section::is_relaxed_input_section_map_valid_): Remove data
3312         members.
3313         (Output_section::lookup_maps_): New data member.
3314
3315 2010-05-21  Doug Kwan  <dougkwan@google.com>
3316
3317         PR gold/11619
3318         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3319         avoid a compilation error.
3320
3321 2010-05-19  Rafael Espindola  <espindola@google.com>
3322
3323         * script-sections.cc (Output_section_definition::allocate_to_segment):
3324         Update the phdrs_list even when the output section is NULL.
3325         * testsuite/Makefile.am: Add test.
3326         * testsuite/Makefile.in: Regenerate.
3327         * testsuite/script_test_9.cc: New.
3328         * testsuite/script_test_9.sh: New.
3329         * testsuite/script_test_9.t: New.
3330
3331 2010-05-19  Doug Kwan  <dougkwan@google.com>
3332
3333         * arm.cc (Arm_input_section::original_size): New method.
3334         (Arm_input_section::do_addralign): Add a cast.
3335         (Arm_input_section::do_output_offset): Remove static cast.
3336         (Arm_input_section::original_addralign,
3337          Arm_input_section::original_size_): Change type to uint32_t.
3338         (Arm_input_section::init): Add safe casts for section alignment
3339         and size.
3340         (Arm_input_section::set_final_data_size): Do not set address and
3341         offset of stub table.
3342         (Arm_output_section::fix_exidx_coverage): Change use of of
3343         Output_section::Simple_input_section to that of
3344         Output_section::Input_section.
3345         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3346         except for the first pass.
3347         * output.cc (Output_section::get_input_sections): Change type of
3348         input_sections to std::list<Input_section>.
3349         (Output_section::add_script_input_section): Rename from
3350         Output_section::add_simple_input_section.  Change type of SIS
3351         parameter from Simple_input_section to Input_section.
3352         * output.h (Output_section::Simple_input_section): Remove class.
3353         (Output_section::Input_section): Change class visibility to public.
3354         (Output_section::Input_section::addralign): Use stored alignments
3355         for special input sections if set.
3356         (Output_section::Input_section::set_addralign): New method.
3357         (Output_section::get_input_sections): Change parameter type from
3358         list of Simple_input_section to list of Input_section.
3359         (Output_section::add_script_input_section): Rename from
3360         Output_section::add_simple_input_section. Change first parameter's
3361         type from Simple_input_section to Input_section and remove the
3362         second and third parameters.
3363         * script-sections.cc (Input_section::Input_section_list): Change
3364         type to list of Output_section::Input_section/
3365         (Input_section_info::Input_section_info): Change parameter type of
3366         INPUT_SECTION to Output_section::Input_section.
3367         (Input_section_info::input_section): Change return type.
3368         (Input_section_info::input_section_): Change type to
3369         Output_section::Input_section.
3370         (Output_section_element_input::set_section_addresses): Adjust code
3371         to use Output_section::Input_section instead of
3372         Output_section::Simple_input_section.  Adjust code for renaming
3373         of Output_section::add_simple_input_section.
3374         (Orphan_output_section::set_section_addresses): Ditto.
3375
3376 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3377
3378         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3379         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3380
3381 2010-05-18  Rafael Espindola  <espindola@google.com>
3382
3383         * options.cc (General_options::finalize): Handle -nostdlib.
3384         * options.h (nostdlib): New option.
3385         * script.cc (script_add_search_dir): Handle -nostdlib.
3386
3387 2010-05-12  Doug Kwan  <dougkwan@google.com>
3388
3389         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3390         attributes section only if there no attributes section after merging.
3391         (Target_arm::merge_object_attributes): Move value of
3392         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3393         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3394         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3395         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3396         and arm_attr_merge_7.stdout.
3397         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3398         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3399         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3400         arm_attr_merge_7b.o): New rules.
3401         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3402         arm_attr_merge_7
3403         * testsuite/Makefile.in: Regenerate.
3404         * testsuite/arm_attr_merge.sh: New file.
3405         * testsuite/arm_attr_merge_[67][ab].s: Same.
3406
3407 2010-05-05  Nick Clifton  <nickc@redhat.com>
3408
3409         * po/es.po: Updated Spanish translation.
3410
3411 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3412
3413         * Makefile.am (install-exec-local): Properly install gold as
3414         default cross linker.
3415         * Makefile.in: Regenerated.
3416
3417 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3418             Nick Clifton  <nickc@redhat.com>
3419
3420         * configure.ac (install_as_default): Define and set to false
3421         unless --enable-gold or --enable-gold=both/gold has been
3422         specified.
3423         * configure: Regenerate.
3424
3425         * Makefile.am (install-exec-local): Install the executable as
3426         'ld.gold'.  If install_as_default is true then also install it as
3427         'ld'.
3428         * Makefile.in: Regenerated.
3429
3430 2010-04-24  Ian Lance Taylor  <iant@google.com>
3431
3432         * layout.cc (Layout::layout_reloc): In relocatable link don't
3433         combine reloc sections for grouped sections.
3434
3435 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3436
3437         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3438         sections that are not ordinary to icf.
3439         * icf.cc (get_section_contents): Handle relocation pointing to section
3440         with no object or shndx information.
3441         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3442         * testsuite/Makefile.in: Regenerate.
3443         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3444         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3445
3446 2010-04-22  Ian Lance Taylor  <iant@google.com>
3447
3448         * expression.cc (Expression::Expression_eval_info): Add
3449         result_alignment_pointer field.
3450         (Expression::eval_with_dot): Add result_alignment_pointer
3451         parameter.  Change all callers.
3452         (Expression::eval_maybe_dot): Likewise.
3453         (class Binary_expression): Add alignment_pointer parameter to
3454         left_value and right_value.  Change all callers.
3455         (BINARY_EXPRESSION): Set result alignment.
3456         (class Trinary_expression): Add alignment_pointer parameter to
3457         arg2_value and arg3_value.  Change all callers.
3458         (Trinary_cond::value): Set result alignment.
3459         (Max_expression::value, Min_expression::value): Likewise.
3460         (Align_expression::value): Likewise.
3461         * script-sections.cc (class Sections_element): Add dot_alignment
3462         parameter to set_section_addresses virtual function.  Update
3463         instantiations.
3464         (class Output_section_element): Likewise.
3465         (Script_sections::create_segments): Add dot_alignment parameter.
3466         Change all callers.
3467         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3468         (Script_sections::set_phdrs_clause_addresses): Likewise.
3469         * script-sections.h: Update declarations.
3470         * script.h: Update declarations.
3471         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3472         min_p_align.
3473         * testsuite/script_test_3.t: Set large alignment.
3474         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3475         segment has expected alignment.
3476
3477 2010-04-22  Nick Clifton  <nickc@redhat.com>
3478
3479         * po/gold.pot: Updated by the Translation project.
3480         * po/vi.po: Updated Vietnamese translation.
3481
3482 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3483
3484         * testsuite/Makefile.am (check_PROGRAMS): Add
3485         icf_virtual_function_folding_test.
3486         * testsuite/Makefile.in: Regenerated.
3487
3488 2010-04-15  Andrew Haley  <aph@redhat.com>
3489
3490         * options.h (merge_exidx_entries): New option.
3491         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3492         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3493         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3494         (Target_arm::merge_exidx_entries): New function.
3495         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3496         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3497         to Arm_exidx_fixup constructor.
3498         Add new arg, merge_exidx_entries.
3499         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3500         Arm_output_section::fix_exidx_coverage.
3501
3502 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3503
3504         * icf.cc (get_section_contents): Check for preemptible functions.
3505         Ignore addend when appropriate.
3506         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3507         section folded.
3508         (add_from_relobj): Check for section folded.
3509         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3510         * symtab.h (should_add_dynsym_entry): Add new parameter.
3511         * target-reloc.h (scan_relocs): Check for section folded.
3512         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3513         Check reloc types for function pointers in shared objects.
3514         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3515         case.
3516         (icf_preemptible_functions_test): New test case.
3517         (icf_string_merge_test): New test case.
3518         * testsuite.Makefile.in: Regenerate.
3519         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3520         bar_glob.  Refactor code.
3521         * testsuite/icf_preemptible_functions_test.cc: New file.
3522         * testsuite/icf_preemptible_functions_test.sh: New file.
3523         * testsuite/icf_string_merge_test.cc: New file.
3524         * testsuite/icf_string_merge_test.sh: New file.
3525         * testsuite/icf_virtual_function_folding_test.cc: New file.
3526         * testsuite/icf_virtual_function_folding_test.sh: New file.
3527
3528 2010-04-14  Doug Kwan  <dougkwan@google.com>
3529
3530         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3531         for local symbol recounting if we remove a section due to ICF.
3532         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3533         there are no regular objects in input.
3534
3535 2010-04-13  Doug Kwan  <dougkwan@google.com>
3536
3537         * arm.cc (Arm_input_section::set_final_data_size): Compute
3538         accurate final data size instead of using current data size.
3539
3540 2010-04-09  Doug Kwan  <dougkwan@google.com>
3541
3542         * layout.cc (Layout::choose_output_section): Handle script section
3543         types.
3544         (Layout::make_output_section_for_script): Add section type parameter.
3545         Handle script section types.
3546         * layout.h (Layout::make_output_section_for_script): Add section
3547         type parameter.
3548         * output.cc (Output_section::Output_section): Initialize data member
3549         is_noload_.
3550         (Output_section::do_reset_address_and_file_offset): Do not set address
3551         to 0 if section is a NOLOAD section.
3552         * output.h (Output_section::is_noload): New method.
3553         (Output_section::set_is_noload): Ditto.
3554         (Output_section::is_noload_): New data member.
3555         * script-c.h (Script_section_type): New enum type.
3556         (struct Parser_output_section_header): Add new file section_type.
3557         * script-sections.cc (Sections_element::output_section_name): Add
3558         parameter for returning script section type.
3559         (Output_section_definition::output_section_name): Ditto.
3560         (Output_section_definition::section_type)P; New method.
3561         (Output_section_definiton::script_section_type_name): Ditto.
3562         (Output_section_definition::script_section_type_): New data member.
3563         (Output_section_definition::Output_section_definition): Initialize
3564         data member Output_section_definition::script_section_type_.
3565         (Output_section_definition::create_sections): Pass script section type
3566         to Layout::make_output_section_for_script.
3567         (Output_section_definition::output_section_name): Return script
3568         section type to caller.
3569         (Output_section_definition::set_section_address): Do not advance
3570         dot value and load address if section type is NOLOAD.  Set address
3571         of NOLOAD sections regardless of section flags.
3572         (Output_section_definition::print): Print section type if it is
3573         not SCRIPT_SECTION_TYPE_NONE.
3574         (Output_section_definition::section_type): New method.
3575         (Output_section_definition::script_section_type_name): Ditto.
3576         (Script_sections::output_section_name): Add new parameter
3577         PSECTION_TYPE for returning script section type.  Pass it to
3578         section elements.  Handle discard sections.
3579         (Sort_output_sections::operator()): Handle NOLOAD sections.
3580         * script-sections.h (Script_sections::Section_type): New enum type.
3581         (Script_sections::output_section_name): Add a new parameter for
3582         returning script section type.
3583         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3584         INFO and NOLOAD.
3585         * yyscript.y (union): Add new field SECTION_TYPE.
3586         (COPY, DSECT, INFO, NOLOAD): New tokens.
3587         (opt_address_and_section_type): Change type to output_section_header.
3588         (section_type): New non-terminal
3589         (section_header): Handle section type.
3590         (opt_address_and_section_type): Return section type value.
3591
3592 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3593
3594         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3595         * testsuite/plugin_common_test_2.c (foo): Likewise.
3596
3597 2010-04-08  Doug Kwan  <dougkwan@google.com>
3598
3599         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3600         Output_merge_data.
3601         * output.cc (Output_section::add_merge_input_section): Simplify
3602         code and return status of Output_merge_base::add_input_section.
3603         Update merge section map only if Output_merge_base::add_input_section
3604         returns true.
3605
3606 2010-04-07  Doug Kwan  <dougkwan@google.com>
3607
3608         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3609         if section is marked as containing instructions but has no mapping
3610         symbols.
3611         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3612         correct section index.
3613         (Arm_relobj::find_linked_text_section): Ditto.
3614
3615 2010-04-07  Cary Coutant  <ccoutant@google.com>
3616
3617         * archive.cc (include_member): Destroy Read_symbols_data object before
3618         releasing file.
3619         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3620         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3621         (Read_symbols_data::~Read_symbols_data) New destructor.
3622         (Section_relocs::Section_relocs) New constructor.
3623         (Section_relocs::~Section_relocs) New destructor.
3624         (Read_relocs_data::Read_relocs_data) New constructor.
3625         (Read_relocs_data::~Read_relocs_data) New destructor.
3626         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3627         pointers to NULL after deleting.
3628
3629 2010-04-07  Doug Kwan  <dougkwan@google.com>
3630
3631         * arm.cc: Replace "endianity" with "endianness" in comments.
3632         (Arm_exidx_cantunwind): Ditto.
3633         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3634         (Arm_relobj::merge_flags_and_attributes): New method.
3635         (Arm_relobj::merge_flags_and_attributes_): New data member.
3636         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3637         (Arm_relobj::scan_sections_for_stubs): Ditto.
3638         (Arm_relobj::do_read_symbols): Check to see if we really want to
3639         merge processor-specific flags and attributes.  Exit early if
3640         an object is empty except for section names and the undefined symbol.
3641         (Target_arm::do_finalize_sections): Move check for ELF format to
3642         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3643         attributes from a regular object only when we have determined that
3644         it is aapropriate.  Do not create an .ARM.attributes section in
3645         output if there is no regular input object.
3646         (Target_arm::merge_processor_specific_flags): Check
3647         --warn-mismatch before printing any error.
3648         (Target_arm::merge_object_attributes): Ditto.
3649         * gold.cc (queue_middle_tasks): Handle the case in which there is
3650         no regular object in input.
3651         * options.cc (General_options::parse_EB): New method.
3652         (General_options::parse_EL): Same.
3653         (General_options::General_options): Initialize endianness_.
3654         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3655         New options.
3656         (General_options::Endianness): New enum.
3657         (General_options::endianness): New method.
3658         (General_options::endianness_): New data member.
3659         * parameters.cc (Parameters::set_options): Check target endianness.
3660         (Parameters::set_target_once): Ditto.
3661         (Parameters::check_target_endianness): New method.
3662         (parameters_force_valid_target): If either -EL or -EB is specified,
3663         use it to define endianness of default target.
3664         * parameters.h (Parameters::check_target_endianness): New method
3665         declaration.
3666         * target.h (class Target): Change "endianity" to "endianness"
3667         in comments.
3668
3669 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3670
3671         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3672         * configure: Regenerate.
3673         * Makefile.in: Regenerate.
3674         * testsuite/Makefile.in: Regenerate.
3675
3676 2010-04-06  Cary Coutant  <ccoutant@google.com>
3677
3678         gcc PR lto/42757
3679         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3680         prevailing definitions of common symbols.
3681         * testsuite/plugin_test_6.sh: New test case.
3682         * testsuite/plugin_common_test_1.c: New test case.
3683         * testsuite/plugin_common_test_2.c: New test case.
3684         * testsuite/Makefile.am (plugin_test_6): New test case.
3685         * testsuite/Makefile.in: Regenerate.
3686
3687 2010-04-06  Nick Clifton  <nickc@redhat.com>
3688
3689         * po/vi.po: New Vietnamese translation.
3690
3691 2010-03-30  Doug Kwan  <dougkwan@google.com>
3692
3693         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3694
3695 2010-03-25  Doug Kwan  <dougkwan@google.com>
3696
3697         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3698         to avoid a conversion warning on a 32-bit host.
3699
3700 2010-03-24  Ian Lance Taylor  <iant@google.com>
3701
3702         * testsuite/script_test_3.t: Add a TLS segment.
3703         * testsuite/Makefile.am (check_PROGRAMS): Add
3704         tls_phdrs_script_test.
3705         (tls_phdrs_script_test_SOURCES): Define.
3706         (tls_phdrs_script_test_DEPENDENCIES): Define.
3707         (tls_phdrs_script_test_LDFLAGS): Define.
3708         (tls_phdrs_script_test_LDADD): Define.
3709         * testsuite/Makefile.in: Rebuild.
3710
3711 2010-03-23  Cary Coutant  <ccoutant@google.com>
3712
3713         * fileread.cc (find_or_make_view): Fix comment.
3714
3715 2010-03-23  Ian Lance Taylor  <iant@google.com>
3716
3717         * script-sections.cc (class Orphan_section_placement): Define
3718         PLACE_TLS and PLACE_TLS_BSS.
3719         (Orphan_section_placement::Orphan_section_placement): Initialize
3720         new places.
3721         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3722         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3723         (tls_script_test_SOURCES): Define.
3724         (tls_script_test_DEPENDENCIES): Define.
3725         (tls_script_test_LDFLAGS): Define.
3726         (tls_script_test_LDADD): Define.
3727         * testsuite/Makefile.in: Rebuild.
3728
3729 2010-03-22  Doug Kwan  <dougkwan@google.com>
3730
3731         * arm.cc (Arm_relocate_functions::abs8,
3732         Arm_relocate_functions::abs16): Use correct check for overflow
3733         specified in the ARM ELF specs.
3734         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3735         target of a BLX instruction specially.
3736         (Reloc_stub::stub_type_for_reloc): Ditto.
3737         (Relocate::relocate): Use symbolic names instead of numeric relocation
3738         codes to report error.
3739         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3740         workaround.
3741         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3742         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3743         thumb2_blx_out_of_range.stdout
3744         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3745         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3746         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3747         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3748         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3749         thumb2_blx_in_range, thumb2_blx_in_range.o,
3750         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3751         thumb2_blx_out_of_range.o): New rules.
3752         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3753         thumb2_blx_in_range and thumb2_blx_out_of_range.
3754         * testsuite/Makefile.in: Regenerate.
3755         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3756         * testsuite/thumb_blx_in_range.s: New file.
3757         * testsuite/thumb_blx_out_of_range.s: New file.
3758
3759 2010-03-22  Rafael Espindola  <espindola@google.com>
3760
3761         * archive.cc (Should_include): Move to archive.h.
3762         (should_include_member): Make it a member of Archive.
3763         (Lib_group): New.
3764         (Add_lib_group_symbols): New.
3765         * archive.h: Include options.h.
3766         (Archive_member): Moved from Archive.
3767         (Should_include): Moved from archive.cc.
3768         (Lib_group): New.
3769         (Add_lib_group_symbols): New.
3770         * dynobj.cc (do_should_include_member): New.
3771         * dynobj.h (do_should_include_member): New.
3772         * gold.cc (queue_initial_tasks): Update call to queue.
3773         * main.cc (main): Print lib group stats.
3774         * object.cc (do_should_include_member): New.
3775         * object.h: Include archive.h.
3776         (Object::should_include_member): New.
3777         (Object::do_should_include_member): New.
3778         (Sized_relobj::do_should_include_member): New.
3779         * options.cc (General_options::parse_start_lib): New.
3780         (General_options::parse_end_lib): New.
3781         (Input_arguments::add_file): Handle lib groups.
3782         (Input_arguments::start_group): Check we are not in a lib.
3783         (Input_arguments::start_lib): New.
3784         (Input_arguments::end_lib): New.
3785         * options.h (General_options): Add start_lib and end_lib.
3786         (Input_argument::lib_): New.
3787         (Input_argument::lib): New.
3788         (Input_argument::is_lib): New.
3789         (Input_file_lib): New.
3790         (Input_arguments::in_lib_): New.
3791         (Input_arguments::in_lib): New.
3792         (Input_arguments::start_lib): New.
3793         (Input_arguments::end_lib_): New.
3794         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3795         in unused members as preempted.
3796         (Sized_pluginobj::do_should_include_member): New.
3797         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3798         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3799         return the blocker.
3800         (Read_symbols::do_whole_lib_group): New.
3801         (Read_symbols::do_lib_group): New.
3802         (Read_symbols::do_read_symbols): Handle lib groups.
3803         (Read_symbols::get_name): Handle lib groups.
3804         * readsyms.h (Read_symbols): Add an archive member pointer.
3805         (Read_symbols::do_whole_lib_group): New.
3806         (Read_symbols::do_lib_group): New.
3807         (Read_symbols::member_): New.
3808         * script.cc (read_input_script): Update call to queue_soon.
3809
3810 2010-03-19  Doug Kwan  <dougkwan@google.com>
3811
3812         * arm.cc (Stub_table::Stub_table): Initialize new data members
3813         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3814         (Stub_table::add_reloc_stub): Assign stub offset and update
3815         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3816         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3817         New data members.
3818         (Stub_table::update_data_size_and_addralign): Use
3819         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3820         instead of going over all reloc stubs.
3821         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3822         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3823         Stringpool_template::offset_ to size of Stringpool_char.
3824         (Stringpool_template::new_key_offset): Remove code to initialize
3825         Stringpool_template::offset_.
3826         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3827         Stringpool_template::offset_ to zero.
3828
3829 2010-03-15  Doug Kwan  <dougkwan@google.com>
3830
3831         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3832         offset_.
3833         (Stringpool_template::new_key_offset): New method.
3834         (Stringpool_template::add_string): Assign offsets when adding new
3835         strings.
3836         (Stringpool_template::set_string_offsets): Do not set string offsets
3837         when not optimizing.
3838         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3839         member size_.
3840         (Chunked_vector::clear): Clear size_.
3841         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3842         (Chunked_vector::size): Return size_.
3843         (Chunked_vector::push_back): Use size_ to find insert position.
3844         (Chunked_vector::size_): New data member.
3845         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3846         (Stringpool_template::new_key_offset): New method declaration.
3847         (Stringpool_template::offset_): New data member.
3848
3849 2010-03-15   Rafael Espindola  <espindola@google.com>
3850
3851         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3852         Add_symbols' constructor.
3853         * readsyms.h (Add_symbols): Remove the input_group member.
3854
3855 2010-03-10  Ian Lance Taylor  <iant@google.com>
3856
3857         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3858         target to ask whether a reference to a symbol requires a stack
3859         split.
3860         * target.h (Target::is_call_to_non_split): New function.
3861         (Target::do_is_call_to_non_split): Declare virtual function.
3862         * target.cc: Include "symtab.h".
3863         (Target::do_is_call_to_non_split): New function.
3864         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3865
3866 2010-03-10  Cary Coutant  <ccoutant@google.com>
3867
3868         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3869         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3870         (File_read::open[2]): Add whole_file_view_ to list of views.
3871         (File_read::make_view): Remove test of whole_file_view_.
3872         (File_read::find_or_make_view): Create whole_file_view_ if
3873         necessary.
3874         (File_read::clear_views): Replace bool parameter with enum;
3875         adjust all callers.  Don't delete views with permanent data;
3876         do delete cached views and views from archives if
3877         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3878         if clearing the corresponding view.
3879         * fileread.h (File_read::Clear_views_mode): New enum.
3880         (File_read::View::is_permanent_view): New method.
3881         (File_read::clear_views): Replace bool parameter
3882         with enum; adjust all callers.
3883         * options.h (General_options): Change keep_files_mapped option;
3884         add map_whole_files.
3885         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3886         releasing the file.
3887         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3888         the file.
3889
3890 2010-03-10  David S. Miller  <davem@davemloft.net>
3891
3892         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3893
3894 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3895
3896         * icf.cc (get_section_contents): Add '@' marker after processing the
3897         merge reloc.
3898
3899 2010-03-08  Doug Kwan  <dougkwan@google.com>
3900
3901         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3902         due to a conversion warning.
3903         (Arm_relobj::update_output_local_symbol_count): Check for local
3904         symbol with unset output index.
3905
3906 2010-03-05  Ian Lance Taylor  <iant@google.com>
3907
3908         * options.h (class General_options): Add --spare-dynamic-tags.
3909         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3910         --spare-dynamic-tags.
3911
3912 2010-03-05  Ian Lance Taylor  <iant@google.com>
3913
3914         * incremental.cc: Include "libiberty.h".
3915
3916 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3917
3918         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3919         function, is_info_ member.
3920         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3921         (Versions::Versions): Update caller.
3922         (Versions::define_base_version): Likewise.
3923         (Versions::add_def): Likewise.
3924
3925 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3926
3927         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3928         (Scan::possible_function_pointer_reloc): New function.
3929         (Scan::local_reloc_may_be_function_pointer): Change to call
3930         possible_function_pointer_reloc.
3931         (Scan::global_reloc_may_be_function_pointer): Ditto.
3932         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3933         relocations in ".data.rel.ro._ZTV" section.
3934         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3935         * testsuite/icf_safe_so_test.cc: Ditto.
3936         * testsuite/icf_safe_test.cc: Ditto.
3937         * testsuite/icf_safe_test.sh: Ditto.
3938
3939 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3940             Ian Lance Taylor  <iant@google.com>
3941
3942         * target-reloc.h (relocate_section): Check the symbol table index
3943         for -1U before setting the local symbol index.
3944         (scan_relocatable_relocs): If copying the relocation, record that
3945         the local symbol is required.
3946         * object.h (Symbol_value::is_output_symtab_index_set): New
3947         function.
3948         (Symbol_value::may_be_discarded_from_output_symtab): New
3949         function.
3950         (Symbol_value::has_output_symtab_entry): New function.
3951         (Symbol_value::needs_output_symtab_entry): Remove.
3952         (Symbol_value::output_symtab_index): Make sure the symbol index is
3953         set.
3954         (Symbol_value::set_output_symtab_index): Make sure the symbol
3955         index is not set.  Make sure the new index is valid.
3956         (Symbol_value::set_must_have_output_symtab_entry): New function.
3957         (Symbol_value::has_output_dynsym_entry): New function.
3958         (Symbol_value::set_output_dynsym_index): Make sure the new index
3959         is valid.
3960         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3961         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3962         local symbol if permitted.
3963         (Sized_relobj::do_finalize_local_symbols): Call
3964         is_output_symtab_index_set rather than needs_output_symtab_entry.
3965         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3966         rather than needs_output_symtab_entry.  Call
3967         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3968         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3969         is_output_symtab_index_set rather than needs_output_symtab_entry.
3970         * testsuite/discard_locals_relocatable_test.c: New file.
3971         * testsuite/discard_locals_test.sh: Test -r.
3972         * testsuite/Makefile.am (check_DATA): Add
3973         discard_locals_relocatable_test1.syms,
3974         discard_local_relocatable_test2.syms.
3975         (MOSTLYCLEANFILES): Likewise.  Also add
3976         discard_locals_relocatable_test1.lout and
3977         discard_locals_relocatable_test2.out.
3978         (discard_locals_relocatable_test1.syms): New target.
3979         (discard_locals_relocatable_test.o): New target.
3980         (discard_locals_relocatable_test1.out): New target.
3981         (discard_locals_relocatable_test2.syms): New target.
3982         (discard_locals_relocatable_test2.out): New target.
3983         (various): Add missing ../ld-new dependencies.
3984         * testsuite/Makefile.in: Rebuild.
3985
3986 2010-03-03  Nick Clifton  <nickc@redhat.com>
3987
3988         * po/fi.po: New Finnish translation.
3989
3990 2010-03-01  Doug Kwan  <dougkwan@google.com>
3991
3992         * layout.cc (Layout::Layout): Force section types of .init_array*,
3993         .preinit_array* and .fini_array* sections.
3994         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3995         Fix check of return value of std::string::find.().
3996         (Output_section::Input_section_sort_compare::operator()): Remove
3997         comment about .init_array.
3998         (Output_section::Input_section_sort_init_fini_compare::operator()):
3999         New method.
4000         (Output_section::sort_attached_input_sections): Handle .init_array
4001         and .fini_array specially.
4002         * output.h (Output_section::Inut_section_sort_compare): Update
4003         comment.
4004         (Output_section::Input_section_sort_init_fini_compare): New struct.
4005
4006 2010-02-26  Doug Kwan  <dougkwan@google.com>
4007
4008         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4009         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4010         * testsuite/debug_msg.sh: Avoid matching source line number for
4011         use of global variable undef_int.
4012
4013 2010-02-26  Doug Kwan  <dougkwan@google.com>
4014
4015         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4016         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4017         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4018         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4019         * options.cc (General_options::General_options): Initialize member
4020         fix_v4bx_.
4021         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4022         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4023         and rm_no_fix_v4bx.stdout
4024         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4025         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4026         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4027         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4028         and arm_no_fix_v4bx.
4029         * Makefile.in: Regenerate.
4030         * testsuite/arm_fix_v4bx.s: New file.
4031         * testsuite/arm_fix_v4bx.sh: Ditto.
4032
4033 2010-02-24  Doug Kwan  <dougkwan@google.com>
4034
4035         * arm.cc (Target_arm::got_section): Make the .got section the first
4036         non RELRO section in the data segment.
4037         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4038         suffixes of section names.
4039
4040 2010-02-24  Doug Kwan  <dougkwan@google.com>
4041
4042         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4043         flags and attributes merging if an input file is a binary file.
4044         * fileread.cc (Input_file::open): Record format of original file.
4045         * fileread.h (Input_file::Format): New enum type.
4046         (Input_file::Input_file): Initialize data member format_.
4047         (Input_file::format): New method definition.
4048         (Input_file::format_):: New data member.
4049
4050 2010-02-24  Doug Kwan  <dougkwan@google.com>
4051
4052         * arm.cc (Arm_output_data_got): New class.
4053         (ARM_TCB_SIZE): New constant
4054         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4055         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4056         If user uses a script with a SECTIONS clause, issue only a warning
4057         for a misplaced EXIDX input section.  Otherwise, issue an error.
4058         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4059         garbage collection.
4060         (Target_arm::got_mode_index_entry): Handle static linking.
4061         (Target_arm::Scan::local): Ditto.
4062         (Target_arm::Scan::global): Ditto.
4063         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4064         all incorrectly implemented relocations.
4065         (Target_arm::fix_exidx_coverage): Pass layout to
4066         Arm_output_section::fix_exidx_coverage.
4067         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4068         from ".ARM.exidx." and ".ARM.extab.".
4069
4070 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4071
4072         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4073         section if it does not already exist.
4074         * attributes.cc (Attributes_section_data::Attributes_section_data):
4075         Don't crash if size is zero.
4076
4077 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4078             Ian Lance Taylor  <iant@google.com>
4079
4080         * gold.cc (queue_middle_tasks): If no input files were opened,
4081         exit.
4082         * workqueue.h (Task_function::Task_function): Assert that there is
4083         a blocker.
4084
4085 2010-02-22  Doug Kwan  <dougkwan@google.com>
4086
4087         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4088         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4089         types to avoid warnings due to different uint64_t implementations
4090         on different hosts.
4091
4092 2010-02-21  Doug Kwan  <dougkwan@google.com>
4093
4094         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4095         handling of the maximum backward branch offset.
4096         (Arm_relocate_functions::thumb_branch_common): Ditto.
4097         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4098         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4099         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4100         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4101         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4102         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4103         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4104         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4105         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4106         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4107         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4108         thumb2_bl_out_of_range.o): New rules.
4109         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4110         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4111         thumb2_bl_out_of_range
4112         * testsuite/Makefile.in: Regenerate.
4113         * testsuite/arm_bl_in_range.s: New file.
4114         * testsuite/arm_bl_out_of_range.s: Ditto.
4115         * testsuite/arm_branch_in_range.sh: Ditto.
4116         * testsuite/arm_branch_range.t: Ditto.
4117         * testsuite/thumb2_branch_range.t: Ditto.
4118         * testsuite/thumb_bl_in_range.s: Ditto.
4119         * testsuite/thumb_bl_out_of_range.s: Ditto.
4120         * testsuite/thumb_branch_range.t: Ditto.
4121
4122 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4123
4124         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4125         Add reloc offset information.
4126         * icf.cc (get_section_contents): Change iterators to point to the new
4127         vectors. Add reloc offset information to the contents.
4128         * icf.h (Icf::Sections_reachable_info): New typedef.
4129         (Icf::Sections_reachable_list): New typedef.
4130         (Icf::Offset_info): New typedef.
4131         (Icf::Reloc_info): New struct typedef.
4132         (Icf::Reloc_info_list): New typedef.
4133         (Icf::symbol_reloc_list): Delete method.
4134         (Icf::addend_reloc_list): Delete method.
4135         (Icf::section_reloc_list): Delete method.
4136         (Icf::reloc_info_list): New method.
4137         (Icf::reloc_info_list_): New member.
4138
4139 2010-02-19  Doug Kwan  <dougkwan@google.com>
4140
4141         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4142         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4143         * arm.cc (Arm_relocation_functions): New forward declaration.
4144         (Target_arm::Target_arm): Initialize new data members
4145         got_mod_index_offset_ and tls_base_symbol_defined_.
4146         (Target_arm::Relocate::relocate_tls): New method.
4147         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4148          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4149         New methods.
4150         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4151         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4152         (Target_arm::got_mod_index_offset_,
4153         Target_arm::tls_base_symbol_defined_): New data members.
4154         (Target_arm::Scan::local, Target::Scan::global,
4155         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4156         relocations.
4157
4158 2010-02-18  Doug Kwan  <dougkwan@google.com>
4159
4160         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4161         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4162         text section as a parameter becuase some broken tools may not set
4163         the link in section header.
4164         (Target_arm::has_got_section): New method.
4165         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4166         without any mapping symbol as data only.  Remove warning.
4167         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4168         link in its section header, try to discover the link by inspecting the
4169         REL31 relocation at the beginning of the section.
4170         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4171         in error message.
4172         (Target_arm::Scan::global): Treat any reference to the symbol
4173         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4174
4175 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4176
4177         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4178         (Scan::global_reloc_may_be_function_pointer): New function.
4179         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4180         (Scan::global_reloc_may_be_function_pointer): New function.
4181         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4182         (Scan::global_reloc_may_be_function_pointer): New function.
4183         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4184         (Scan::global_reloc_may_be_function_pointer): New function.
4185         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4186         (Scan::global_reloc_may_be_function_pointer): New function.
4187         (Scan::possible_function_pointer_reloc): New function.
4188         (Target_x86_64::can_check_for_function_pointers): New function.
4189         * gc.h (gc_process_relocs): Scan relocation types to determine if
4190         function pointers were taken for targets that support it.
4191         * icf.cc (Icf::find_identical_sections): Include functions for
4192         folding in safe ICF whose pointer is not taken.
4193         * icf.h (Secn_fptr_taken_set): New typedef.
4194         (fptr_section_id_): New member.
4195         (section_has_function_pointers): New function.
4196         (set_section_has_function_pointers): New function.
4197         (check_section_for_function_pointers): New function.
4198         * options.h: Fix comment for safe ICF option.
4199         * target.h (can_check_for_function_pointers): New function.
4200         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4201         Modify icf_safe_test for X86-64.
4202         * testsuite/Makefile.in: Regenerate.
4203         * testsuite/icf_safe_so_test.cc: New file.
4204         * testsuite/icf_safe_so_test.sh: New file.
4205         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4206         (main): Change to take pointer to function kept_func_3.
4207         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4208         folding is done correctly for X86-64.
4209
4210 2010-02-12  David S. Miller  <davem@davemloft.net>
4211
4212         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4213         is_symbolless parameter.
4214         (Output_reloc<SHT_REL>::is_symbolless): New.
4215         (Output_reloc<SHT_REL>::is_symbolless_): New.
4216         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4217         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4218         (Output_reloc<SHT_RELA>::is_symbolless): New.
4219         (Output_data_reloc::add_global): Handle is_symbolless.
4220         (Output_data_reloc::add_global_relative): Likewise.
4221         (Output_data_reloc::add_local): Likewise.
4222         (Output_data_reloc::add_local_relative): Likewise.
4223         (Output_data_reloc::add_symbolless_global_addend): New.
4224         (Output_data_reloc::add_symbolless_local_addend): New.
4225         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4226         is_symbolless.
4227         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4228         instead of ->is_relative_
4229         (Output_reloc::write): Likewise.
4230         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4231         (Output_reloc::write_rel): Simplify.
4232
4233         * sparc.cc (Target_sparc::Scan::local): Use
4234         ->add_symbolless_local_addend as needed.
4235         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4236         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4237         based upon relocation offset.
4238
4239 2010-02-11  Doug Kwan  <dougkwan@google.com>
4240
4241         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4242         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4243         beginning of function.
4244         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4245         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4246         parameter is_32bit in calls to should_apply_static_reloc.
4247         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4248         (check_DATA): Add arm_abs_global.stdout.
4249         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4250         arm_abs_global.stdout): New rules.
4251         (MOSTLLYCLEANFILES): Add arm_abs_global
4252         * Makefile.in: Regenerate.
4253         * testsuite/arm_abs_global.s: New file.
4254         * testsuite/arm_abs_global.sh: Ditto.
4255         * testsuite/arm_abs_lib.s: Ditto.
4256
4257 2010-02-11  Ian Lance Taylor  <iant@google.com>
4258
4259         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4260         Read_relocs task.
4261         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4262         Allocate_commons_task first.
4263         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4264         task, rather than symtab_lock_.
4265         (Gc_process_relocs::~Gc_process_relocs): New function.
4266         (Gc_process_relocs::is_runnable): Check this_blocker_.
4267         (Gc_process_relocs::locks): Use next_blocker_ rather than
4268         blocker_.
4269         (Scan_relocs::~Scan_relocs): New function.
4270         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4271         symtab_lock_.
4272         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4273         next_blocker_.
4274         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4275         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4276         constructor accordingly.
4277         (class Gc_process_relocs): Likewise.
4278         (class Scan_relocs): Likewise.
4279         * common.h (class Allocate_commons_task): Remove symtab_lock_
4280         field, and corresponding constructor parameter.
4281         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4282         symtab_lock_.
4283         (Allocate_commons_task::locks): Likewise.
4284
4285 2010-02-11  Ian Lance Taylor  <iant@google.com>
4286
4287         * gold-threads.h (class Once): Define.
4288         (class Initialize_lock): Rewrite as child of Once.
4289         * gold-threads.cc (class Once_initialize): Define.
4290         (once_pointer_control): New static variable.
4291         (once_pointer, once_arg): New static variables.
4292         (c_run_once): New static function.
4293         (Once::Once, Once::run_once, Once::internal_run): New functions.
4294         (class Initialize_lock_once): Remove.
4295         (initialize_lock_control): Remove.
4296         (initialize_lock_pointer): Remove.
4297         (initialize_lock_once): Remove.
4298         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4299         (Initialize_lock::initialize): Rewrite.
4300         (Initialize_lock::do_run_once): New function.
4301         * archive.cc (Archive::interpret_header): Only clear name if it is
4302         not already empty.
4303         * fileread.cc: Include "gold-threads.h"
4304         (file_counts_lock): New static variable.
4305         (file_counts_initialize_lock): Likewise.
4306         (File_read::release): Only increment counts when using --stats.
4307         Use a lock around the increment.
4308         * parameters.cc (class Set_parameters_target_once): Define.
4309         (set_parameters_target_once): New static variable.
4310         (Parameters::Parameters): Move here from parameters.h.
4311         (Parameters::set_target): Rewrite.
4312         (Parameters::set_target_once): New function.
4313         (Parameters::clear_target): Move here and rewrite.
4314         * parameters.h (class Parameters): Update declarations.  Add
4315         set_parameters_target_once_ field.
4316         (Parameters::Parameters): Move to parameters.cc.
4317         (Parameters::clear_target): Likewise.
4318         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4319         task.
4320         (Start_group::~Start_group): New function.
4321         (Start_group::is_runnable): New function.
4322         (Start_group::locks, Start_group::run): New functions.
4323         (Finish_group::run): Change saw_undefined to size_t.
4324         * readsyms.h (class Start_group): Define.
4325         (class Finish_group): Change saw_undefined_ field to size_t.
4326         (Finish_group::Finish_group): Remove saw_undefined and
4327         this_blocker parameters.  Change all callers.
4328         (Finish_group::set_saw_undefined): New function.
4329         (Finish_group::set_blocker): New function.
4330         * symtab.h (class Symbol_table): Change saw_undefined to return
4331         size_t.  Change saw_undefined_ field to size_t.
4332         * target-select.cc (Set_target_once::do_run_once): New function.
4333         (Target_selector::Target_selector): Initialize set_target_once_
4334         field.  Don't initialize lock_ and initialize_lock_ fields.
4335         (Target_selector::instantiate_target): Rewrite.
4336         (Target_selector::set_target): New function.
4337         * target-select.h (class Set_target_once): Define.
4338         (class Target_selector): Update declarations.  Make
4339         Set_target_once a friend.  Remove lock_ and initialize_lock_
4340         fields.  Add set_target_once_ field.
4341
4342 2010-02-10  Ian Lance Taylor  <iant@google.com>
4343
4344         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4345         queueing any tasks.
4346         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4347         (queue_middle_tasks): Add all blockers before queueing any tasks.
4348         (queue_final_tasks): Likewise.
4349         * token.h (Task_token::add_blockers): New function.
4350         * object.h (Input_objects::number_of_relobjs): New function.
4351
4352 2010-02-10  Ian Lance Taylor  <iant@google.com>
4353
4354         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4355         shared, not if not position independent.
4356         * x86_64.cc (Relocate::relocate_tls): Likewise.
4357         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4358         (tls_pie_pic_test): New target.
4359         * testsuite/Makefile.in: Rebuild.
4360
4361         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4362         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4363         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4364         * testsuite/Makefile.in: Rebuild.
4365
4366 2010-02-09  David S. Miller  <davem@davemloft.net>
4367
4368         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4369         R_SPARC_RELATIVE using ->add_local_relative().
4370         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4371
4372         * output.h (Output_data_dynamic::add_section_size): New method
4373         that takes two Output_data objects.
4374         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4375         entry param.  Handle it in initializers.
4376         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4377         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4378         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4379         arg.
4380         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4381         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4382         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4383         for dynrel_includes_plt.
4384         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4385         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4386         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4387         before .rela.plt
4388         (Target_sparc::do_finalize_sections): Update to pass true for
4389         dynrel_includes_plt.
4390         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4391         output before .rela.plt
4392         (Target_powerpc::do_finalize_sections): Update to pass true for
4393         dynrel_includes_plt when 32-bit.
4394
4395 2010-02-08  Doug Kwan  <dougkwan@google.com>
4396
4397         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4398         method.
4399         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4400         Arm_relobj::scan_section_for_cortex_a8_stubs,
4401         Arm_relobj::do_relocation_section): Instead of calling
4402         Output_section::output_address, use faster
4403         Arm_relobj::simple_input_section_output_address.
4404
4405 2010-02-08  David S. Miller  <davem@davemloft.net>
4406
4407         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4408         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4409         relocation helper function.
4410
4411         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4412         just like R_SPARC_GOT{10,13,22}.
4413         (Target_sparc::Scan::local): Likewise.
4414         (Target_sparc::Relocate:relocate): Likewise.
4415
4416 2010-02-06  Ian Lance Taylor  <iant@google.com>
4417
4418         * configure.ac: Rewrite targetobjs duplicate removal code to use
4419         only shell constructs.
4420         * configure: Rebuild.
4421
4422 2010-02-05  Doug Kwan  <dougkwan@google.com>
4423
4424         PR 11247
4425         * arm.cc (Arm_relobj::section_is_scannable): New method.
4426         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4427         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4428
4429 2010-02-04  Doug Kwan  <dougkwan@google.com>
4430
4431         PR 11247
4432         * arm-reloc-property.cc (cstdio): Include.
4433         * configure.ac (targetobjs): Remove duplicates.
4434         * configure: Regenerate.
4435         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4436         big and little endian version for a given address size.
4437
4438 2010-02-03  Doug Kwan  <dougkwan@google.com>
4439
4440         * arm-reloc-property.cc
4441         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4442         definition.
4443         * arm-reloc-property.h
4444         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4445         New method definition.
4446         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4447         declaration.
4448         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4449         overflow to N.
4450         (GOT_PREL): Change implemented to Y.
4451         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4452         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4453         (Arm_relocate_functions::movw_abs_nc): Remove method.
4454         (Arm_relocate_functions::movt_abs): Ditto.
4455         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4456         (Arm_relocate_functions::thm_movt_abs): Ditto.
4457         (Arm_relocate_functions::movw_rel_nc): Ditto.
4458         (Arm_relocate_functions::movw_rel): Ditto.
4459         (Arm_relocate_functions::movt_rel): Ditto.
4460         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4461         (Arm_relocate_functions:thm_movw_rel): Ditto.
4462         (Arm_relocate_functions:thm_movt_rel): Ditto.
4463         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4464         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4465         New method definitions.
4466         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4467         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4468         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4469         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4470         (Target_arm::Relocate::relocate): Check for non-static or
4471         unimplemented relocation code and exit early.  Change calls to
4472         Target_arm::reloc_uses_thumb_bit and
4473         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4474         instead.  Refactor code to handle similar relocations to increase
4475         code sharing.  Remove check for unsupported relocation code in switch
4476         statement.
4477         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4478         relocation property table to find out size.  Change error message to
4479         print out the name of a relocation code instead of the numeric value.
4480         (Target_arm::scan_reloc_for_stub): Use relocation property table
4481         instead of calling Target_arm::reloc_uses_thumb_bit().
4482
4483 2010-02-02  Doug Kwan  <dougkwan@google.com>
4484
4485         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4486         types of relaxed input section.
4487
4488 2010-02-02  Doug Kwan  <dougkwan@google.com>
4489
4490         * Makefile.am (HFILES): Add arm-reloc-property.h.
4491         (DEFFILES): New.
4492         (TARGETSOURCES): Add arm-reloc-property.cc
4493         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4494         (libgold_a_SOURCES): $(DEFFILES)
4495         * Makefile.in: Regenerate.
4496         * arm-reloc-property.cc: New file.
4497         * arm-reloc-property.h: New file.
4498         * arm-reloc.def: New file.
4499         * arm.cc: Update comments.
4500         (arm-reloc-property.h): New included header.
4501         (arm_reloc_property_table): New global variable.
4502         (Target_arm::do_select_as_default_target): New method definition.
4503         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4504         arm-reloc-property to targ_extra_obj.
4505         * parameters.cc (set_parameters_target): Call
4506         Target::select_as_default_target().
4507         * target.h (Target::select_as_default_target): New method definition.
4508         (Target::do_select_as_default_target): Same.
4509
4510 2010-02-01  Doug Kwan  <dougkwan@google.com>
4511
4512         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4513         first_output_text_section_.
4514         (Arm_exidx_fixup::first_output_text_section): New method definition.
4515         (Arm_exidx_fixup::first_output_text_section_): New data member.
4516         (Arm_exidx_fixup::process_exidx_section): Record the first text
4517         output section seen.
4518         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4519         and entsize in output section header.
4520
4521 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4522
4523         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4524         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4525         (Arm_relocate_functions::thm_alu11): New Method.
4526         (Arm_relocate_functions::thm_pc8): New Method.
4527         (Arm_relocate_functions::thm_pc12): New Method.
4528         (Target_arm::Scan::local): Handle the relocations.
4529         (Target_arm::Scan::global): Likewise.
4530         (Target_arm::Relocate::relocate): Likewise.
4531         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4532
4533 2010-01-29  Doug Kwan  <dougkwan@google.com>
4534
4535         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4536         of relocation types as ld.
4537
4538 2010-01-29  Doug Kwan  <dougkwan@google.com>
4539
4540         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4541         to public.
4542         (Arm_relocate_functions::thumb_branch_common): Ditto.
4543         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4544         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4545         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4546         Arm_relocate_functions::jump24): Remove.
4547         (Target_arm::Relocate::relocate): Adjust code to call
4548         Arm_relocation_functions::arm_branch_common and
4549         Arm_relocation_functions::thumb_branch_common instead of their removed
4550         wrappers.  Merge switch-cases together to reduce source code size.
4551
4552 2010-01-29  Doug Kwan  <dougkwan@google.com>
4553
4554         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4555         output_local_symbol_count_needs_update_.
4556         (Arm_relobj::output_local_symbol_count_needs_update,
4557          Arm_relobj::set_output_local_symbol_count_needs_update,
4558          Arm_relobj::update_output_local_symbol_count): New methods.
4559         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4560         member.
4561         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4562         of pointed function as in a R_ARM_PREL31 relocation.
4563         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4564         for output local symbol count updating.
4565         (Target_arm::do_relax): Update output local symbol counts in objects
4566         if necessary.
4567         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4568
4569 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4570
4571         * arm.cc: Added support for the ARM relocations:
4572         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4573         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4574         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4575         movw_prel_nc).
4576         (Arm_relocate_functions::movw_rel): New method.
4577         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4578         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4579         thm_movw_prel_nc).
4580         (Arm_relocate_functions::thm_movw_rel): New method.
4581         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4582         thm_movt_prel).
4583         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4584         relocations.
4585         (Target_arm::Scan::global): Likewise.
4586         (Target_arm::Relocate::relocate): Likewise.
4587         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4588         Likewise.
4589
4590 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4591
4592         * arm.cc: Added support for ARM group relocations.
4593         (Target_arm::reloc_needs_sym_origin): New method.
4594         (Arm_relocate_functions::calc_grp_kn): New method.
4595         (Arm_relocate_functions::calc_grp_residual): New method.
4596         (Arm_relocate_functions::calc_grp_gn): New method.
4597         (Arm_relocate_functions::arm_grp_alu): New Method.
4598         (Arm_relocate_functions::arm_grp_ldr): New Method.
4599         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4600         (Arm_relocate_functions::arm_grp_ldc): New Method.
4601         (Target_arm::Scan::local): Handle the ARM group relocations.
4602         (Target_arm::Scan::global): Likewise.
4603         (Target_arm::Relocate::relocate): Likewise.
4604         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4605         Likewise.
4606
4607 2010-01-26  Doug Kwan  <dougkwan@google.com>
4608
4609         * arm.cc (set): Include.
4610         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4611         pointer type.
4612         (Arm_output_section::Text_section_list): New type.
4613         (Arm_output_section::append_text_sections_to_list): New method.
4614         (Arm_output_section::fix_exidx_coverage): Ditto.
4615         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4616         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4617         Relobj::set_section_offset() instead of
4618         Sized_relobj::invalidate_section_offset().
4619         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4620         parameter for section headers. Ignore relocation sections for
4621         unallocated sections and EXIDX sections.
4622         (Target_arm::fix_exidx_coverage): New method.
4623         (Target_arm::output_section_address_less_than): New type.
4624         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4625         linked text section instead of the EXIDX section.
4626         (Arm_output_section::create_stub_group): Add an assertion to check
4627         that this is not an EXIDX output section.
4628         (Arm_output_section::append_text_sections_to_list): New method.
4629         (Arm_output_section::fix_exidx_coverage): Ditto.
4630         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4631         Arm_relobj::section_needs_reloc_stub_scanning.
4632         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4633         first pass.
4634         (Target_arm::fix_exidx_coverage): New method.
4635         * object.h (Relobj::set_output_section): New method.
4636         (Sized_relobj::invalidate_section_offset): Remove method.
4637         (Sized_relobj::do_invalidate_section_offset): Remove method.
4638         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4639
4640 2010-01-25  Doug Kwan  <dougkwan@google.com>
4641
4642         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4643         Fix warning due to signed and unsigned comparison on a 32-bit host.
4644
4645 2010-01-22  Doug Kwan  <dougkwan@google.com>
4646
4647         * arm.cc (Target_arm::do_relax): Record an output section for section
4648         offset adjustment it contains any stub table that has changed.
4649         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4650         offsets in an output section if necessary.
4651         * output.cc (Output_section::Output_section): Initialize
4652         section_offsets_need_adjustments_.
4653         (Output_section::add_input_section_for_script): Renamed to
4654         Output_section::add_simple_input_section.
4655         (Output_section::save_states): Add a comment.
4656         (Output_section::discard_states): New method defintion.
4657         (Output_section::adjust_section_offsets): Same.
4658         * output.h (Output_section::add_input_section_for_script): Renamed to
4659         Output_section::add_simple_input_section.
4660         (Output_section::discard_states): New method declaration.
4661         (Output_section::adjust_section_offsets): Same.
4662         (Output_section::section_offsets_need_adjustment,
4663         Output_section::set_section_offsets_need_adjustment): New method
4664         definitions.
4665         (Output_section::section_offsets_need_adjustment_): New data member.
4666         * script-sections.cc
4667         (Output_section_element_input::set_section_address): Adjust code for
4668         renaming of Output_section::add_input_section_for_script.
4669         (Orphan_output_section::set_section_address): Same.
4670
4671 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4672
4673         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4674         Fix_v4bx enum values .
4675         * gold/options.h (General_options): New option definitions.
4676         (General_options::fix_v4bx): New method.
4677         (General_options::Fix_v4bx): New enum.
4678         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4679         (General_options::parse_fix_v4bx_interworking): New method.
4680
4681 2010-01-22  Doug Kwan  <dougkwan@google.com>
4682
4683         * arm.cc (Arm_exidx_fixup): New class.
4684
4685 2010-01-21  Doug Kwan  <dougkwan@google.com>
4686
4687         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4688         classes.
4689         (Arm_exidx_section_offset_map): New type.
4690
4691 2010-01-21  Doug Kwan  <dougkwan@google.com>
4692
4693         * arm.cc (Arm_exidx_input_section): New class.
4694         (Arm_relobj::exidx_input_section_by_link,
4695         Arm_relobj::exidx_input_section_by_shndx,
4696         Arm_relobj::make_exidx_input_section): New methods.
4697         (read_arm_attributes_section): Remove.
4698         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4699         information about them.
4700         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4701         to here.
4702
4703 2010-01-20  Doug Kwan  <dougkwan@google.com>
4704
4705         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4706         Input_section_specifier to Section_id.
4707         (Target_arm::new_arm_input_section: Adjust code for change of key
4708         type.
4709         (Target_arm::find_arm_input_section): Ditto.
4710         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4711         (Section_id): Remove.
4712         (Garbage_collection::Section_id_hash): Remove.
4713         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4714         (Section_id): Remove.
4715         (Icf::Section_id_hash): Remove.
4716         * object.h (Section_id, Const_section_id, Section_id_hash,
4717         Const_section_id_hash): New type definitions.
4718         * output.cc (Output_section::add_relaxed_input_section): Change to
4719         use Const_section_id instead of Input_section_specifier as key type.
4720         (Output_section::add_merge_input_section): Ditto.
4721         (Output_section::build_relaxation_map): Change to use Section_id
4722         instead of Input_section_specifier as key type.
4723         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4724         Ditto.
4725         (Output_section::convert_input_sections_to_relaxed_sections): Change
4726         to use Const_section_id instead of Input_section_specifier as key type.
4727         (Output_section::find_merge_section): Ditto.
4728         (Output_section::find_relaxed_input_section): Ditto.
4729         * output.h (Input_section_specifier): Remove class.
4730         (Output_section::Output_section_data_by_input_section_map): Change
4731         key type to Const_section_id.
4732         (Output_section::Output_relaxed_input_section_by_input_section_map):
4733         Ditto.
4734         (Output_section::Relaxation_map): Change key type to Section_id.
4735
4736 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4737
4738         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4739         (class Arm_v4bx_stub): New class.
4740         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4741         (Stub_factory::make_arm_v4bx_stub): New method.
4742         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4743         (Stub_table::empty): Handle v4bx stubs.
4744         (Stub_table::add_arm_v4bx_stub): New method.
4745         (Stub_table::find_arm_v4bx_stub): New method.
4746         (Arm_relocate_functions::v4bx): New method.
4747         (Target_arm::fix_v4bx): New method.
4748         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4749         (Stub_table::relocate_stubs): Likewise.
4750         (Stub_table::do_write): Likewise.
4751         (Stub_table::update_data_size_and_addralign): Likewise.
4752         (Stub_table::finalize_stubs):  Likewise.
4753         (Target_arm::Scan::local): Likewise.
4754         (Target_arm::Scan::global): Likewise.
4755         (Target_arm::do_finalize_sections): Likewise.
4756         (Target_arm::Relocate::relocate): Likewise.
4757         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4758         Likewise.
4759         (Target_arm::scan_reloc_for_stub): Likewise.
4760         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4761
4762 2010-01-19  Ian Lance Taylor  <iant@google.com>
4763
4764         * output.cc (Output_section_headers::do_sized_write): Write large
4765         segment count to sh_info field.
4766         (Output_file_header::do_sized_write): For large segment count,
4767         write PN_XNUM to e_phnum field.
4768
4769 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4770
4771         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4772         (Arm_relocate_functions::thm_jump8): New function.
4773         (Arm_relocate_functions::thm_jump11): New function.
4774         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4775         R_ARM_THM_JUMP11.
4776         (Target_arm::Scan::global): Likewise.
4777         (Target_arm::Relocate::relocate): Likewise.
4778         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4779         Likewise.
4780
4781 2010-01-14  Doug Kwan  <dougkwan@google.com>
4782
4783         * arm.cc (map, utility): Include headers.
4784         (Target_arm::apply_cortex_a8_workaround): New method.
4785         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4786         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4787         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4788         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4789         the --[no-]fix-cortex-a8 command line options.
4790         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4791         (Target_arm::relocate_stub): Use addend in instruction template.
4792         * options.h (DEFINE_bool): Set the user-set flag.
4793         (General_options): Add --[no-]-fix-cortex options.
4794         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4795         : Update fast look-up map after conversion.
4796
4797 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4798
4799         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4800         in the first pass of do_layout.
4801
4802 2010-01-13  Doug Kwan  <dougkwan@google.com>
4803
4804         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4805         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4806         apparent compiler problem of not folding static constant integral
4807         data members of elfcpp::Elf_sizes<32>.
4808
4809 2010-01-13  Doug Kwan  <dougkwan@google.com>
4810
4811         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4812         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4813         Arm_relobj::scan_section_for_cortex_a8_erratum,
4814         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4815         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4816         sections to scan for relocation stubs into a new method
4817         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4818         relocation and Cortex-A8 stub scanning.
4819         (Target_arm::do_relax): Force stubs to be after stubbed sections
4820         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4821         the beginning of a new relaxation pass.  Update a comment.
4822         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4823
4824 2010-01-12  Ian Lance Taylor  <iant@google.com>
4825
4826         * target-reloc.h (visibility_error): New inline function.
4827         (relocate_section): Call visibility_error.
4828         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4829         (MOSTLYCLEANFILES): Likewise.
4830         (protected_4_pic.o, protected_3.err): New targets.
4831         * testsuite/protected_4.cc: New file.
4832
4833 2010-01-12  Doug Kwan  <dougkwan@google.com>
4834
4835         * arm.cc (Cortex_a8_reloc): New class.
4836         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4837         and cortex_a8_relocs_info_.
4838         (Target_arm::fix_cortex_a8): New method definition.
4839         (Target_arm::Cortex_a8_relocs_info): New type.
4840         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4841         New data member declarations.
4842         (Target_arm::scan_reloc_for_stub): Record information about
4843         relocations for THUMB branches that might be exempted from the
4844         Cortex-A8 workaround.
4845         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4846         at the beginning of a relaxation pass.
4847
4848 2010-01-12  Doug Kwan  <dougkwan@google.com>
4849
4850         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4851         (Arm_relobj::Mapping_symbol_position,
4852          Arm_reloj::Mapping_symbol_position_less,
4853          Arm_relobj::Mapping_symbols_info): New types.
4854         (Target_arm::is_mapping_symbol_name): New method definition.
4855         (Arm_relobj::do_count_local_symbols): Save information about mapping
4856         symbols.
4857
4858 2010-01-11  Doug Kwan  <dougkwan@google.com>
4859
4860         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4861         Arm_relocate_functions::thumb32_branch_upper,
4862         Arm_relocate_functions::thumb32_branch_lower,
4863         Arm_relocate_functions::thumb32_cond_branch_offset,
4864         Arm_relocate_functions::thumb32_cond_branch_upper,
4865         Arm_relocate_functions::thumb32_cond_branch_lower,
4866         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4867         branch offset encoding.
4868         (Arm_relocate_functions::thumb_branch_common): Use new branch
4869         offset encoding methods to avoid code duplication.
4870         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4871         (Stub_addend_reader::operator()): Use new branch encoding method
4872         to avoid code duplication.
4873
4874 2010-01-11  Doug Kwan  <dougkwan@google.com>
4875
4876         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4877         (Target_arm::do_finalize_sections): Define special EXIDX section
4878         symbols only if referenced.
4879         * gc.h (Garbage_collection::add_reference): New method.
4880         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4881         code duplication.
4882
4883 2010-01-11  Ian Lance Taylor  <iant@google.com>
4884
4885         * script.cc (Version_script_info::build_expression_list_lookup):
4886         Change complaing about duplicate wildcard match from error to
4887         warning.
4888
4889         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4890         of 2009-12-30.
4891         (Version_script_info::Version_script_info): Initialize globs_,
4892         default_version_, default_is_global_, and exact_.  Don't
4893         initialize globals_ or locals_.
4894         (Version_script_info::build_lookup_tables): Build local symbols
4895         first.
4896         (Version_script_info::unquote): New function.
4897         (Version_script_info::add_exact_match): New function.
4898         (Version_script_info::build_expression_list_lookup): Remove lookup
4899         parameter.  Add is_global parameter.  Change all callers.  Handle
4900         wildcard pattern specially.  Unquote pattern.  Call
4901         add_exact_match.
4902         (Version_script_info::get_name_to_match): New function.
4903         (Version_script_info::get_symbol_version): New function.
4904         (Version_script_info::get_symbol_version_helper): Remove.
4905         (Version_script_info::check_unmatched_names): Call unquote.
4906         * script.h (class Version_script_info): Change get_symbol_version
4907         to be non-inline and add is_global parameter; change all callers.
4908         Rewrite symbol_is_local.  Update declarations.  Define struct
4909         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4910         Remove globals_ and locals_ members.  Add exact_, globs_,
4911         default_version_, is_global_.
4912         (Version_script_info::Glob): Remove pattern, add expression and
4913         is_global.  Update constructor.  Change all callers.
4914         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4915         default version.
4916         (Versions::symbol_section_contents): If a symbol is undefined, or
4917         defined in a dynamic object, set the version index to
4918         VER_NDX_LOCAL.
4919         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4920         symbol_is_local.
4921         (Symbol_table::add_from_pluginobj): Likewise.
4922         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4923
4924 2010-01-11  Doug Kwan  <dougkwan@google.com>
4925
4926         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4927         (incremental_dump_LDADD): Add linking option for libintl.
4928         * Makefile.in: Regenerate.
4929
4930 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4931
4932         PR gold/11144
4933         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4934         instead of -Ds.
4935         * testsuite/Makefile.in: Regenerated.
4936
4937 2010-01-10  Doug Kwan  <dougkwan@google.com>
4938
4939         * options.h (DEFINE_var): Use parentheses around argument varname__
4940         in macro body to avoid any unintended subsequent substitutions.
4941
4942 2010-01-10  Ian Lance Taylor  <iant@google.com>
4943
4944         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4945         candidates before doing symbol resolution.
4946
4947         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4948         ODR candidates if only one is weak.
4949
4950 2010-01-08  Ian Lance Taylor  <iant@google.com>
4951
4952         * script.cc (Version_script_info::build_expression_list_lookup):
4953         Don't warn about ambiguous version, just record the ambiguity.
4954         (Version_script_info::get_symbol_version_helper): Give error if
4955         version is ambiguous.
4956
4957 2010-01-08  Doug Kwan  <dougkwan@google.com>
4958
4959         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4960           prev_data_size_ and prev_addralign_.  Remove initializer for
4961           deleted data member has_been_changed_.
4962           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4963           to determine if the table is empty.
4964           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4965           Remove.
4966           (Stub_table::add_reloc_stub): Define method in class definition
4967           instead of just declaring it there.
4968           (Stub_table::add_cortex_a8_stub): New method definition.
4969           (Stub_table::update_data_size_and_addralign): Ditto.
4970           (Stub_table::finalize_stubs): Ditto.
4971           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4972           (Stub_table::do_addralign_): Return address alignment in the
4973           (Stub_table::do_reset_address_and_file_offset): Define method in
4974           class definition instead of declaring it there.  Set current data
4975           size to be the data size of the previous pass.
4976           (Stub_table::set_final_data_size): Use current data size as the
4977           final data size.
4978           (Stub_table::relocate_stub): Change parameter type of stub from
4979           Reloc_stub pointer to Stub pointer.
4980           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4981           (Stub_table::Cortex_a8_stub_list): New typedef.
4982           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4983            Stub_table::prev_addralign_): New data member.
4984           (Arm_relobj::Arm_relobj): Initialize data member
4985           section_has_cortex_a8_workaround_.
4986           (Arm_relobj::section_has_cortex_a8_workaround,
4987            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4988            definitions.
4989           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4990           declarations.
4991           (Target_arm::relocate_stub): Change parameter type of stub from
4992           Reloc_stub pointer to Stub pointer.
4993           (Insn_template::size, Insn_template::alignment): Handle
4994           THUMB16_SPECIAL_TYPE.
4995           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4996            Stub_table::update_data_size_and_addralign,
4997            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4998           definitions.
4999           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5000           (Stub_table::do_write): Ditto.
5001           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5002
5003 2010-01-08  Ian Lance Taylor  <iant@google.com>
5004
5005         PR 11108
5006         * symtab.h (class Symbol): Remove fields is_target_special_ and
5007         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5008         (Symbol::is_defined_in_discarded_section): New function.
5009         (Symbol::set_is_defined_in_discarded_section): New function.
5010         (Symbol::has_plt_offset): Rewrite.
5011         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5012         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5013         Don't initialize is_target_special_ or has_plt_offset_.
5014         Initialize is_defined_in_discarded_section_.
5015         (Symbol_table::add_from_relobj): If appropriate, set
5016         is_defined_in_discarded_section.
5017         * resolve.cc (Symbol::override_base_with_special): Don't test
5018         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5019         * target-reloc.h (relocate_section): Do special handling for
5020         symbols defined in discarded sections for global symbols as well
5021         as local symbols.
5022
5023 2010-01-08  Ian Lance Taylor  <iant@google.com>
5024
5025         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5026         the SHT_SYMTAB case.
5027
5028 2010-01-08  Ian Lance Taylor  <iant@google.com>
5029
5030         * object.cc (Sized_relobj::do_layout): Don't get confused if
5031         layout_eh_frame returns NULL.
5032
5033 2010-01-08  Ian Lance Taylor  <iant@google.com>
5034
5035         PR 11084
5036         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5037         dynamic symbol table, use the normal symbol table.
5038         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5039         symbol table.
5040
5041 2010-01-08  Ian Lance Taylor  <iant@google.com>
5042
5043         PR 11072
5044         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5045         sections.
5046
5047 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5048
5049         * version.cc (print_version): Change to "Copyright 2010".
5050
5051 2010-01-08  Ian Lance Taylor  <iant@google.com>
5052
5053         PR 10287
5054         PR 11063
5055         * i386.cc (class Target_i386): Change return type of plt_section
5056         to be non-const.
5057         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5058         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5059         tls_desc_rel_ field.
5060         (Output_data_plt_i386::rel_tls_desc): New function.
5061         (Target_i386::rel_tls_desc_section): New function.
5062         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5063         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5064         R_386_TLS_DESC reloc in rel_tls_desc_section.
5065         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5066         Define struct Tlsdesc_info.
5067         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5068         (Target_x86_64::do_reloc_symbol_index): New function.
5069         (Target_x86_64::add_tlsdesc_info): New function.
5070         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5071         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5072         tlsdesc_rel_ field.
5073         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5074         all callers.
5075         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5076         (Target_x86_64::rela_tlsdesc_section): New function.
5077         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5078         handling.
5079         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5080         (Target_x86_64::do_reloc_addend): New function.
5081         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5082         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5083         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5084         (Output_reloc::type): New function.
5085         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5086         (Output_reloc::is_target_specific): New function.
5087         (Output_reloc::target_arg): New function.
5088         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5089         absolute relocs and target specific relocs.
5090         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5091         add_target_specific.
5092         (class Output_data_reloc) [SHT_RELA]: Likewise.
5093         * output.cc (Output_reloc::Output_reloc): Add four new versions
5094         for absolute relocs and target specific relocs.
5095         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5096         (Output_reloc::get_symbol_index): Likewise.
5097         (Output_reloc::local_section_offset): Check that local_sym_index_
5098         is not TARGET_CODE or 0.
5099         (Output_reloc::symbol_value): Likewise.
5100         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5101         reloc.
5102         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5103         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5104         functions.
5105         * layout.cc (add_target_dynamic_tags): Use output section for
5106         DT_PLTRELSZ and DT_JMPREL.
5107
5108 2010-01-07  Ian Lance Taylor  <iant@google.com>
5109
5110         PR 11061
5111         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5112         function.
5113         (class Output_data_reloc_generic): Define.
5114         (class Output_data_reloc_base): Change base class to
5115         Output_data_reloc_generic.  Change add() method to call
5116         bump_relative_reloc_count for a relative reloc.  Remove
5117         sort_relocs_ field.
5118         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5119         to sort_relocs().
5120         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5121         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5122         appropriate.
5123         * layout.h (class Layout): Update declaration.
5124
5125 2010-01-07  Ian Lance Taylor  <iant@google.com>
5126
5127         * output.h (class Output_data): Add const version of
5128         output_section and do_output_section.
5129         (class Output_section_data): Add const version of
5130         do_output_section.
5131         (class Output_section): Likewise.
5132         * layout.cc (Layout::add_target_dynamic_tags): New function.
5133         * layout.h (class Layout): Update declarations.
5134         * arm.cc (Target_arm::do_finalize_sections): Use
5135         add_target_dynamic_tags.
5136         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5137         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5138         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5139         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5140
5141 2010-01-07  Ian Lance Taylor  <iant@google.com>
5142
5143         PR 11042
5144         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5145         object as needed.
5146
5147 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5148             Ian Lance Taylor  <iant@google.com>
5149
5150         PR 11019
5151         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5152         Xindex::read_symtab_xindex.
5153
5154 2010-01-07  Doug Kwan  <dougkwan@google.com>
5155
5156         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5157         (Insn_template::thumb16_bcond_insn): New method declaration.
5158         (Insn_template): Fix spelling.
5159         (Stub::thumb16_special): New method declaration.
5160         (Stub::do_write): Define virtual method which was previously pure
5161         virtual.
5162         (Stub::do_thumb16_special): New method declaration.
5163         (Stub::do_fixed_endian_write): New template member.
5164         (Reloc_stub::do_write): Remove.
5165         (Reloc_stub::do_fixed_endian_write): Remove.
5166         (Cortex_a8_stub): New class definition.
5167         (Stub_factory::make_cortex_a8_stub): New method definition.
5168         (Stub_factory::Stub_factory): Add missing static storage class
5169         qualifier for elf32_arm_stub_a8_veneer_blx.
5170
5171 2010-01-07  Ian Lance Taylor  <iant@google.com>
5172
5173         PR 10980
5174         * options.h (class General_options): Add --warn-unresolved-symbols
5175         and --error-unresolved-symbols.
5176         * errors.cc (Errors::undefined_symbol): Implement
5177         --warn-unresolved-symbols.
5178
5179         * options.h (class General_options): Add -z text and -z textoff.
5180         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5181
5182 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5183
5184         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5185         (Garbage_collection::cident_sections): New function.
5186         (Garbage_collection::add_cident_section): New function.
5187         (Garbage_collection::cident_sections_): New member.
5188         (gc_process_relocs): Add references to sections whose names are C
5189         identifiers.
5190         * gold.h (cident_section_start_prefix): New constant.
5191         (cident_section_stop_prefix): New constant.
5192         (is_cident): New function.
5193         * layout.cc (Layout::define_section_symbols): Replace string constants
5194         with the newly defined constants.
5195         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5196         C identifiers.
5197         * testsuite/Makefile.am: Add gc_orphan_section_test.
5198         * testsuite/Makefile.in: Regenerate.
5199         * testsuite/gc_orphan_section_test.cc: New file.
5200         * testsuite/gc_orphan_section_test.sh: New file.
5201
5202 2010-01-06  Ian Lance Taylor  <iant@google.com>
5203
5204         PR 10980
5205         * options.h (class General_options): Add --warn-shared-textrel.
5206         * layout.cc (Layout::finish_dynamic_section): Implement
5207         --warn-shared-textrel.
5208
5209         PR 10980
5210         * options.h (class General_options): Add --warn-multiple-gp.
5211
5212 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5213
5214         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5215         $(THREADSLIB) and $(LIBDL).
5216         * Makefile.in: Rebuild.
5217
5218 2010-01-06  Ian Lance Taylor  <iant@google.com>
5219
5220         PR 10980
5221         * options.cc (General_options::parse_section_start): New function.
5222         (General_options::section_start): New function.
5223         (General_options::General_options): Initialize all members.
5224         * options.h: Include <map>
5225         (class General_options): Add --section-start.  Add section_starts_
5226         member.
5227         * layout.cc (Layout::attach_allocated_section_to_segment): If
5228         --section-start was used, set the address of the segment.  Remove
5229         local sort_sections.
5230         (Layout::relaxation_loop_body): If the address of the load segment
5231         has been set by --section-start, don't use it.
5232         * output.h (Output_segment::update_flags_for_output_section): New
5233         function.
5234         * output.cc (Output_segment::add_output_section): Call
5235         update_flags_for_output_section.
5236
5237 2010-01-05  Ian Lance Taylor  <iant@google.com>
5238
5239         PR 10980
5240         * options.h (class General_options): Add --undefined-version.
5241         * script.cc (struct Version_expression): Add was_matched_by_symbol
5242         field.
5243         (Version_script_info::matched_symbol): New function.
5244         (Version_script_info::get_symbol_version_helper): Call
5245         matched_symbol.
5246         (Version_script_info::check_unmatched_names): New function.
5247         * script.h (class Version_script_info): Update declarations.
5248         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5249
5250         * options.h (class General_options): Use DEFINE_bool_alias for
5251         allow_multiple_definition.
5252         * resolve.cc (Symbol_table::should_override): Don't test
5253         allow_multiple_definition.
5254
5255         PR 10980
5256         * options.h (class General_options): Add --cref.
5257         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5258         until after printing cref table.
5259         * cref.cc: Include "symtab.h".
5260         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5261         (Cref_table_compare::operator()): New function.
5262         (Cref_inputs::gather_cref): New function.
5263         (filecol): New static const.
5264         (Cref_inputs::print_cref): New function.
5265         (Cref::print_cref): New function.
5266         * cref.h: Include <cstdio>.
5267         (class Cref): Update declarations.
5268         * mapfile.h (Mapfile::file): New function.
5269         * object.h (class Object): Define Symbols.  Declare virtual
5270         do_get_global_symbols.
5271         (Object::get_global_symbols): New function.
5272         * object.cc (Input_objects::add_object): Pass object to cref_ if
5273         --cref.
5274         (Input_objects::archive_start): Likewise.
5275         (Input_objects::archive_stop): Likewise.
5276         (Input_objects::print_cref): New function.
5277         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5278         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5279         --cref.
5280         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5281         function.
5282         * plugin.h (class Sized_pluginobj): Update declarations.
5283
5284 2010-01-05  Ian Lance Taylor  <iant@google.com>
5285
5286         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5287         to is_default_version.  Rename insdef to insdefault.
5288         (Symbol_table::add_from_relobj): Rename def to is_default_version
5289         and local to is_forced_local.
5290         (Symbol_table::add_from_pluginobj): Likewise.
5291         (Symbol_table::add_from_dynobj): Likewise.
5292         (Symbol_table::define_special_symbol): Rename insdef to
5293         insdefault.
5294
5295 2010-01-04  Ian Lance Taylor  <iant@google.com>
5296
5297         PR 10980
5298         * options.h (class General_options): Add
5299         --allow-multiple-definition and -z muldefs.
5300         * resolve.cc (Symbol_table::should_override): Don't warn about a
5301         multiple symbol definition if --allow-multiple-definition or -z
5302         muldefs.
5303
5304         PR 10980
5305         * options.h (class General_options): Add --add-needed and
5306         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5307         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5308         error if --copy-dt-needed-entries aka --add-needed is used and
5309         would cause a change in behaviour.
5310
5311         PR 10980
5312         * options.h (class General_options): Add -G as a short version of
5313         --shared.  Add no-op options -assert, -g, and -i.
5314
5315 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5316
5317         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5318         check for .text or .gnu.linkonce.t sections.
5319         * icf.cc (Icf::find_identical_sections): Ditto.
5320         Change the detection for mangled function name within the section
5321         name.
5322         * icf.h (is_section_foldable_candidate): New function.
5323
5324 2009-12-30  Ian Lance Taylor  <iant@google.com>
5325
5326         PR 10980
5327         * options.h (class General_options): Permit two dashes with
5328         --retain-symbols-file.
5329
5330 2009-12-30  Ian Lance Taylor  <iant@google.com>
5331
5332         PR 10979
5333         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5334         don't put the file header and segment headers in the text
5335         segment.
5336
5337         PR 10979
5338         * common.cc (Sort_commons::operator()): Stabilize sort when both
5339         entries are NULL.
5340         (Symbol_table::do_allocate_commons_list): When allocating common
5341         symbols, skip a symbol which is no longer common.
5342         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5343         an object before checking its type.
5344         * testsuite/common_test_2.c: New file.
5345         * testsuite/common_test_3.c: New file.
5346         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5347         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5348         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5349         (common_test_2_pic.o, common_test_2.so): New targets.
5350         (common_test_3_pic.o, common_test_3.so): New targets.
5351         * testsuite/Makefile.in: Rebuild.
5352
5353         PR 10979
5354         * script.cc (read_input_script): If we see a new SECTIONS clause,
5355         and we have added an input section, give an error.
5356         * layout.h (class Layout): Add have_added_input_section function.
5357         Add have_added_input_section_ field.
5358         * layout.cc (Layout::Layout): Initialize
5359         have_added_input_section_.
5360         (Layout::layout): Set have_added_input_section_.
5361         (Layout::layout_eh_frame): Likewise.
5362
5363 2009-12-30  Ian Lance Taylor  <iant@google.com>
5364
5365         PR 10931
5366         * options.h (class General_options): Add --sort-common option.
5367         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5368         * common.cc (Sort_common): Add sort_order parameter to
5369         constructor.  Add sort_order_ field.
5370         (Sort_commons::operator): Check sort_order_.
5371         (Symbol_table::allocate_commons): Determine the sort order.
5372         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5373         Change all callers.
5374         (Symbol_table::do_allocate_commons_list): Likewise.
5375
5376 2009-12-30  Ian Lance Taylor  <iant@google.com>
5377
5378         PR 10916
5379         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5380         symbols from this object, don't change the visibility of an
5381         undefined symbol.
5382         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5383
5384 2009-12-30  Ian Lance Taylor  <iant@google.com>
5385
5386         PR 10861
5387         * script.h (class Version_script_info): Define Language enum.
5388         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5389         new fields globals_, locals_, and is_finalized_.
5390         * script.cc: Various formatting fixes.
5391         (class Parser_closure): Change language_stack_ from a vector of
5392         std::string to one of Version_script_info::Language.  Adjust all
5393         uses accordingly.
5394         (class Lazy_demangler): Remove.
5395         (struct Version_expression): Change language from std::string to
5396         Version_script_info::Language.
5397         (Version_script_info::Version_script_info): New function.
5398         (Version_script_info::~Version_script_info): Don't call clear.
5399         (Version_script_info::finalize): New function.
5400         (Version_script_info::build_lookup_tables): New function.
5401         (Version_script_info::build_expression_list_lookup): New
5402         function.
5403         (Version_script_info::get_symbol_version_helper): Rewrite to use
5404         lookup tables.
5405         (Version_script_info::print_expression_list): Adjust to use
5406         Version_script_info::Language.
5407         (script_push_lex_into_version_mode): Check that the version script
5408         has not been finalized.
5409         (version_script_push_lang): Change language string to
5410         Version_script_info::Language.
5411         * options.cc (Command_line::version_script): New function.
5412         * options.h (class General_options): Add finalize_dynamic_list
5413         function.  Change version_script from declaration to definition.
5414         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5415         * testsuite/version_script.map: Remove duplicate def of foo.
5416         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5417         version_script.map.
5418         * testsuite/Makefile.in: Rebuild.
5419
5420 2009-12-30  Ian Lance Taylor  <iant@google.com>
5421
5422         PR 10843
5423         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5424         if the input symbol index is 0, make the output symbol index 0.
5425
5426 2009-12-30  Ian Lance Taylor  <iant@google.com>
5427
5428         PR 10670
5429         * options.h (class General_options): Add -x/--discard-all.
5430         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5431         --discard-all.  If the local symbol needs a dynamic entry, check
5432         that before handling --discard-locals.
5433
5434 2009-12-30  Ian Lance Taylor  <iant@google.com>
5435
5436         PR 10450
5437         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5438         flags to PF_R.
5439         (Output_segment::add_output_section): Don't change the flags if
5440         the type is PT_TLS.
5441
5442         PR 10450
5443         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5444         GNU hash table if they need a dynamic value.  Otherwise, don't add
5445         them if they are defined in a dynamic object or are forced local.
5446
5447 2009-12-29  Ian Lance Taylor  <iant@google.com>
5448
5449         PR 10450
5450         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5451         .gnu.hash table for a 32-bit target.
5452
5453         PR 10450
5454         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5455         regular and a dynamic object only needs a dynamic symbol table
5456         entry if it is externally visible.
5457
5458         PR 10450
5459         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5460         constructor.  Add global_offset_table_ field.
5461         (Target_i386::got_section): Set global_offset_table_.
5462         (Target_i386::do_finalize_sections): Set global_offset_table_
5463         size.
5464         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5465         in constructor.  Add global_offset_table_ field.
5466         (Target_x86_64::got_section): Set global_offset_table_.
5467         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5468         size.
5469
5470         * layout.cc (Layout::Layout): Initialize increase_relro_.
5471         (Layout::get_output_section): Add is_relro, is_last_relro, and
5472         is_first_non_relro parameters.  Change all callers.
5473         (Layout::choose_output_section): Likewise.
5474         (Layout::add_output_section_data): Likewise.
5475         (Layout::make_output_section): Likewise.
5476         (Layout::set_segment_offsets): Clear increase_relro when using a
5477         linker script.
5478         * layout.h (class Layout): Add increase_relro method.  Add
5479         increase_relro_ field.  Update declarations.
5480         * output.cc (Output_section::Output_section): Initialize
5481         is_last_relro_ and is_first_non_relro_.
5482         (Output_segment::add_output_section): Group relro sections is
5483         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5484         (Output_segment::maximum_alignment): Remove relro handling.
5485         (Output_segment::set_section_addresses): Add increase_relro
5486         parameter.  Change all callers.  Add initial alignment to align
5487         relro sections on separate page.  Remove old relro handling.
5488         (Output_segment::set_section_list_addresses): Remove in_relro
5489         parameter.  Change all callers.
5490         (Output_segment::set_offset): Add increase parameter.  Change all
5491         callers.  Remove old relro handling.
5492         * output.h (class Output_section): Add new methods: is_last_relro,
5493         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5494         Add is_last_relro_ and is_first_non_relro_ fields.
5495         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5496         Create separate .got.plt section.  Call increase_relro.
5497         * x86_64.cc (Target_x86_64::got_section): Likewise.
5498         * testsuite/relro_script_test.t: Add .got.plt.
5499
5500         PR 10450
5501         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5502         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5503         (Layout::finalize): Call set_dynamic_symbol_size.
5504         (Layout::set_dynamic_symbol_size): New function.
5505         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5506         set_dynamic_symbol_size.
5507
5508         PR 10450
5509         * output.h (class Output_section): Add is_entsize_zero_ field.
5510         * output.cc (Output_section::Output_section): Initialize
5511         is_entsize_zero_.
5512         (Output_section::set_entsize): If two different entsizes are
5513         requested, force it to zero.
5514         (Output_section::add_input_section): Set flags for .debug_str
5515         before updating section flags.  Set entsize.
5516         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5517         and SHF_STRING if all input sections have those flags.
5518
5519 2009-12-29   Rafael Espindola  <espindola@google.com>
5520
5521         * main.cc (main): Fix the sys time reporting.
5522         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5523         reporting.
5524
5525 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5526
5527         * options.cc (General_options::parse_version): Allow -v to exit
5528         without an error if there is nothing to link.
5529
5530 2009-12-29  Ian Lance Taylor  <iant@google.com>
5531
5532         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5533         using a version of gcc before 4.1.
5534         * configure: Rebuild.
5535
5536 2009-12-28  Chris Demetriou  <cgd@google.com>
5537
5538         * attributes.cc (Output_attributes_section_data::do_write): Use
5539         std::vector::front rather than std::vector::data.
5540
5541 2009-12-28  Ian Lance Taylor  <iant@google.com>
5542
5543         * symtab.h (class Symbol_table): Add enum Defined.
5544         * resolve.cc (Symbol_table::should_override): Add defined
5545         parameter.  Change all callers.  Test whether object is NULL
5546         before calling a method on it.
5547         (Symbol_table::report_resolve_problem): Add defined parameter.
5548         Change all callers.
5549         (Symbol_table::should_override_with_special): Likewise.
5550         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5551         parameter.  Change all callers.
5552         (Symbol_table::do_define_in_output_data): Likewise.
5553         (Symbol_table::define_in_output_segment): Likewise.
5554         (Symbol_table::do_define_in_output_segment): Likewise.
5555         (Symbol_table::define_as_constant): Likewise.
5556         (Symbol_table::do_define_as_constant): Likewise.
5557         * script.h (class Symbol_assignment): Add is_defsym parameter to
5558         constructor; change all callers.
5559         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5560         parameter.  Change all callers.  Add is_defsym_ field.
5561         (class Parser_closure): Add parsing_defsym parameter to
5562         constructor; change all callers.  Add parsing_defsym accessor
5563         function.  Add parsing_defsym_ field.
5564
5565 2009-12-28  Ian Lance Taylor  <iant@google.com>
5566
5567         * gold.cc (queue_middle_tasks): Fix formatting.
5568         * object.cc (Relobj::is_section_name_included): Likewise.
5569
5570 2009-12-23  Ian Lance Taylor  <iant@google.com>
5571
5572         * i386.cc (Target_i386::do_calls_non_split): Recognize
5573         -fsplit-stack prologue for a function with a static chain.
5574         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5575         -fsplit-stack prologue when using %r11.
5576
5577 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5578
5579         * options.cc (General_options::parse_version): Make -v continue and do
5580         the link like GNU ld does.
5581
5582 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5583
5584         * Makefile.am (CCFILES): Add timer.cc.
5585         (HFILES): Add timer.h.
5586         * configure.ac: Check for sysconf and times.
5587         * main.cc: include timer.h.
5588         (main): Use Timer instead of get_run_time.
5589         * timer.cc: New.
5590         * timer.h: New.
5591         * workqueue.cc: include timer.h.
5592         (Workqueue::find_and_run_task):
5593         Report user, sys and wall time.
5594         * Makefile.in: Regenerate.
5595         * config.in: Regenerate.
5596         * configure: Regenerate.
5597
5598 2009-12-16  Doug Kwan  <dougkwan@google.com>
5599
5600         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5601         sections.
5602         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5603         relaxed input sections.
5604         * output.cc (Output_section::find_relaxed_input_section): Change
5605         return type to Output_relaxed_input_section pointer.  Adjust code
5606         for new type of relaxed_input_section_map_.
5607         * output.h (Output_section::find_relaxed_input_section): Change
5608         return type to Output_relaxed_input_section pointer.
5609         (Output_section::Output_relaxed_input_section_by_input_section_map):
5610         New type.
5611         (Output_section::relaxed_input_section_map_): Change type to
5612         Output_section::Output_relaxed_input_section_by_input_section_map.
5613         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5614         input section.
5615
5616 2009-12-15  Ian Lance Taylor  <iant@google.com>
5617
5618         * layout.cc (Layout::create_shstrtab): Only write out after input
5619         sections if we are compressing debug sections.
5620
5621 2009-12-15  Ian Lance Taylor  <iant@google.com>
5622
5623         * archive.cc (Archive::add_symbols): Only look up a symbol without
5624         a version if there is, in fact, a version.
5625
5626 2009-12-14  Ian Lance Taylor  <iant@google.com>
5627
5628         Revert -Wshadow changes, all changes from:
5629         2009-12-11  Doug Kwan  <dougkwan@google.com>
5630         2009-12-11  Nick Clifton  <nickc@redhat.com>
5631         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5632
5633 2009-12-11  Doug Kwan  <dougkwan@google.com>
5634
5635         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5636         due to -Wshadow.
5637         * attributes.cc (Object_attribute::size): Ditto.
5638         (Attributes_section_data::size): Ditto.
5639         (Attributes_section_data::Attributes_section_data): Ditto.
5640         (Output_attributes_section_data::do_write): Ditto.
5641         * attributes.h (Object_attribute::set_type): Ditto.
5642         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5643
5644 2009-12-11  Nick Clifton  <nickc@redhat.com>
5645
5646         * archive.cc: Fix shadowed variable warnings.
5647         * arm.cc: Likewise.
5648         * compressed_output.cc: Likewise.
5649         * compressed_output.h: Likewise.
5650         * configure: Likewise.
5651         * dwarf_reader.cc: Likewise.
5652         * dynobj.cc: Likewise.
5653         * dynobj.h: Likewise.
5654         * ehframe.cc: Likewise.
5655         * ehframe.h: Likewise.
5656         * errors.cc: Likewise.
5657         * expression.cc: Likewise.
5658         * fileread.cc: Likewise.
5659         * fileread.h: Likewise.
5660         * freebsd.h: Likewise.
5661         * i386.cc: Likewise.
5662         * icf.cc: Likewise.
5663         * incremental.h: Likewise.
5664         * layout.cc: Likewise.
5665         * layout.h: Likewise.
5666         * mapfile.cc: Likewise.
5667         * merge.cc: Likewise.
5668         * merge.h: Likewise.
5669         * object.cc: Likewise.
5670         * object.h: Likewise.
5671         * options.h: Likewise.
5672         * output.cc: Likewise.
5673         * output.h: Likewise.
5674         * parameters.cc: Likewise.
5675         * plugin.cc: Likewise.
5676         * powerpc.cc: Likewise.
5677         * reduced_debug_output.cc: Likewise.
5678         * reduced_debug_output.h: Likewise.
5679         * reloc.cc: Likewise.
5680         * reloc.h: Likewise.
5681         * resolve.cc: Likewise.
5682         * script-sections.cc: Likewise.
5683         * script.cc: Likewise.
5684         * script.h: Likewise.
5685         * sparc.cc: Likewise.
5686         * symtab.cc: Likewise.
5687         * symtab.h: Likewise.
5688         * target-select.cc: Likewise.
5689         * target-select.h: Likewise.
5690         * token.h: Likewise.
5691         * workqueue.cc: Likewise.
5692         * workqueue.h: Likewise.
5693         * x86_64.cc: Likewise.
5694
5695 2009-12-10  Doug Kwan  <dougkwan@google.com>
5696
5697         * arm.cc (attributes.h): New include.
5698         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5699         (Arm_relobj::~Arm_relobj): Delete object pointed by
5700         attributes_section_data_.
5701         (Arm_relobj::attributes_section_data): New method definition.
5702         (Arm_relobj::attributes_section_data_): New data member declaration.
5703         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5704         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5705         attributes_section_data_.
5706         (Arm_dynobj::attributes_section_data): New method definition.
5707         (Arm_dynobj::attributes_section_data_): New data member declaration.
5708         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5709         initialization value of may_use_blx_ to false.
5710         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5711         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5712         object attributes to compute results instead of hard-coding.
5713         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5714         Target_arm::get_secondary_compatible_arch,
5715         Target_arm::set_secondary_compatible_arch
5716         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5717         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5718         New method declarations.
5719         (Target_arm::get_aeabi_object_attribute): New method definition.
5720         (Target_arm::attributes_section_data_): New data member declaration.
5721         (read_arm_attributes_section): New template definition.
5722         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5723         (Arm_dynobj::do_read_symbols): Ditto.
5724         (Target_arm::do_finalize_sections): Merge attributes sections from
5725         input.  Check for BLX use after attributes section merging.
5726         Fix __exidx_start and __exidx_end visibility.  Create an
5727         .ARM.attributes section if necessary.
5728         (Target_arm::get_secondary_compatible_arch,
5729         Target_arm::set_secondary_compatible_arch,
5730         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5731         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5732         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5733         New method definitions.
5734
5735 2009-12-09  Ian Lance Taylor  <iant@google.com>
5736
5737         * plugin.cc (Plugin::load): Don't cast from void* to a function
5738         pointer.
5739
5740 2009-12-09  Ian Lance Taylor  <iant@google.com>
5741
5742         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5743         information fields.
5744
5745 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5746
5747         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5748         Replace two_file_shared_1.so with two_file_shared_2.so.
5749         * testsuite/Makefile.in: Regenerated.
5750
5751 2009-12-08  Doug Kwan  <dougkwan@google.com>
5752
5753         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5754         (HFILES): Add attributes.h and int_encoding.h.
5755         * Makefile.in: Regenerate.
5756         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5757         function definitions to int_encoding.cc
5758         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5759         prototypes to int_encoding.h
5760         * reduced_debug_output.cc (int_encoding.h): New include.
5761         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5762         function definitions to int_encoding.cc
5763         (insert_into_vector, read_from_pointer): Move template definitions to
5764         int_encoding.h
5765         * attributes.cc: New file.
5766         * attributes.h: New file.
5767         * int_encoding.cc: New file.
5768         * int_encoding.h: New file.
5769
5770 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5771
5772         PR gold/11055
5773         * incremental-dump.cc (dump_incremental_inputs): New.
5774         (main): Use dump_incremental_inputs.
5775
5776 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5777
5778         PR gold/10893
5779         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5780         checking elfcpp::STT_FUNC.
5781         (Target_i386::Relocate::relocate): Likewise.
5782         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5783
5784         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5785         symbols from shared libraries into normal FUNC symbols.
5786
5787         * symtab.h (Symbol): Add is_func and use it.
5788
5789 2009-12-05  Doug Kwan  <dougkwan@google.com>
5790
5791         * arm.cc (Target_arm::arm_info): Initialize new fields
5792         attributes_section and attributes_vendor.
5793         * i386.cc (Target_i386::i386_info): Same.
5794         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5795         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5796         fields attributes_section and attributes_vendor.
5797         * sparc.cc (Target_sparc::sparc_info): Same.
5798         * target.h (Target::attributes_section, Target::attributes_vendor,
5799         Target::is_attributes_section, Target::attribute_arg_type,
5800         Target::attributes_order): New method definitions.
5801         (Target::Target_info::attributes_section,
5802         Target::Target_info::attributes_vendor): New fields.
5803         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5804         virtual method definitions.
5805         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5806         attributes_section and attributes_vendor.
5807         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5808
5809 2009-12-05  Doug Kwan  <dougkwan@google.com>
5810
5811         * arm.cc: Update comments about interworking and stub generation.
5812         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5813         considered as non-PIC.
5814         (Arm_relocate_functions::base_abs): Fix formatting.
5815         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5816         of function to use GOT entry address instead of offset.
5817         (Target_arm::Scan::global): Issue an error if a symbol would need a
5818         PLT does not get one because it is untyped.  Remove code to create
5819         dynamic symbols for relative branches.
5820         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5821         takes unsigned integer instead of boolean.
5822
5823 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5824
5825         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5826         (two_file_test_LDADD): Likewise.
5827         (common_test_1_LDADD): Likewise.
5828         (exception_test_LDADD) Likewise.
5829         (weak_test_LDADD): Likewise.
5830         (many_sections_test_LDADD): Likewise.
5831         (initpri1_LDADD): Likewise.
5832         (script_test_1_LDADD): Likewise.
5833         (script_test_2_LDADD): Likewise.
5834         (justsyms_LDADD): Likewise.
5835         (binary_test_LDADD): Likewise.
5836         (large_LDADD): Likewise.
5837         * testsuite/Makefile.in: Regenerated.
5838
5839 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5840
5841         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5842         (Symbol_table::override_with_special): Likewise.
5843         (Symbol_table::add_from_object): Likewise.
5844
5845 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5846
5847         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5848         Don't set the data_offset twice.
5849
5850 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5851
5852         * testsuite/Makefile.in: Regenerate.
5853
5854 2009-12-03  Doug Kwan  <dougkwan@google.com>
5855
5856         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5857         (Target_arm::do_finalize_sections): Add parameter for symbol table
5858         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5859         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5860         parameter for symbol table pointer.
5861         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5862         an additional parameter for a pointer to symbol table.
5863         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5864         parameter for a symbol table pointer.
5865         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5866         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5867         Ditto.
5868         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5869         parameter for a symbol table pointer.
5870
5871 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5872
5873         * incremental.cc (Incremental_inputs_header)
5874         (Incremental_inputs_header_write, Incremental_inputs_entry)
5875         (Incremental_inputs_entry_write): Move ...
5876         * incremental.h (Incremental_inputs_header)
5877         (Incremental_inputs_header_write, Incremental_inputs_entry)
5878         (Incremental_inputs_entry_write): here.
5879
5880 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5881
5882         * incremental.cc (make_sized_incremental_binary): Set the target.
5883         Error if it is incompatible.
5884         * output.h (Output_file): Add filename method.
5885
5886 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5887
5888         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5889         from the get_* methods.
5890
5891 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5892
5893         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5894         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5895         Write 0 for the data_offset of scripts.
5896
5897 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5898
5899         * testsuite/Makefile.am: Add the incremental_test.sh test.
5900         * testsuite/incremental_test.sh: New.
5901         * testsuite/incremental_test_1.c: New.
5902         * testsuite/incremental_test_2.c: New.
5903
5904 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5905
5906        * incremental-dump.cc (main): Fix typos.
5907
5908 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5909
5910         PR gold/11025
5911         * incremental-dump.cc (main): Use llu to print 64 bit values.
5912
5913 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5914             H.J. Lu  <hongjiu.lu@intel.com>
5915
5916         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5917         $(LIBDL).
5918         (incremental_dump_LDADD): Likewise.
5919         * Makefile.in: Regenerated.
5920
5921 2009-11-25  Doug Kwan  <dougkwan@google.com>
5922
5923         Revert:
5924
5925         2009-11-25  Doug Kwan  <dougkwan@google.com>
5926
5927                 * arm.cc (Target_arm::Target_arm): Move method definition
5928                 outside of class definition.  Add code to handle
5929                 --target1-rel, --target1-abs and --target2= options.
5930                 (Target_arm::get_reloc_reloc_type): Change method to be
5931                 non-static and const.
5932                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5933                 New data member declaration.
5934                 (Target_arm::Scan::local, Target_arm::Scan::global,
5935                 Target_arm::Relocate::relocate,
5936                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5937                 Adjust call to Target_arm::get_real_reloc_type.
5938                 (Target_arm::get_real_reloc_type): Use command line options
5939                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5940                 * options.h (--target1-rel, --target1-abs, --target2): New
5941                 ARM-only options.
5942
5943 2009-11-25  Doug Kwan  <dougkwan@google.com>
5944
5945         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5946         class definition.  Add code to handle --target1-rel, --target1-abs
5947         and --target2= options.
5948         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5949         and const.
5950         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5951         member declaration.
5952         (Target_arm::Scan::local, Target_arm::Scan::global,
5953         Target_arm::Relocate::relocate,
5954         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5955         call to Target_arm::get_real_reloc_type.
5956         (Target_arm::get_real_reloc_type): Use command line options to
5957         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5958         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5959         options.
5960
5961 2009-11-25  Doug Kwan  <dougkwan@google.com>
5962
5963         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5964         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5965         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5966         formatting.
5967         (Arm_relocate_functions::thm_call): Replace body with a call to
5968         Arm_relocate_functions::thumb_branch_common.
5969         (Arm_relocate_functions::thm_jump24,
5970         Arm_relocate_functions::thm_xpc22): New method definitions.
5971         (Arm_relocate_functions::thumb_branch_common): New method definition.
5972         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5973         operator.
5974         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5975         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5976
5977 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5978
5979         * Makefile.am: Build incremental-dump
5980         * Makefile.in: Regenerate.
5981         * incremental-dump.cc: New.
5982         * incremental.cc (Incremental_inputs_header_data,
5983         Incremental_inputs_entry_data): Move to incremental.h
5984         * incremental.h: (Incremental_inputs_header_data,
5985         Incremental_inputs_entry_data): Move from incremental.cc
5986
5987 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5988
5989         * incremental.cc (Incremental_inputs_header,
5990         Incremental_inputs_header_write, Incremental_inputs_entry,
5991         Incremental_inputs_entry_write): Add a typedef with the data type.
5992
5993 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5994
5995         * incremental.cc (Incremental_inputs_header,
5996         Incremental_inputs_header_write, Incremental_inputs_entry,
5997         Incremental_inputs_entry_write): Update comment about which
5998         type has the filed descriptions.
5999
6000 2009-11-15  Doug Kwan  <dougkwan@google.com>
6001
6002         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6003         (Arm_relocate_functions::arm_branch_common): Change method defintion
6004         in class definition to a method declaration and update list of formal
6005         parameters.
6006         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6007         Arm_relocation_functions::jump24): Adjust call to
6008         Arm_relocate_functions::arm_branch_common.  Update list of formal
6009         parameters.
6010         (Arm_relocate_functions::xpc25): New method definition.
6011         (Arm_relocate_functions::arm_branch_common): Move method defintion
6012         out from class definition.  Use stubs for mode-switching and extending
6013         branch ranges.
6014         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6015         specially.  Change code to enable use of stubs in ARM branches.
6016
6017 2009-11-10  Doug Kwan  <dougkwan@google.com>
6018
6019         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6020         in method declaration.
6021         (Target_arm::relocate_stub): New method declaration.
6022         (Target_arm::default_target): Change to return a pointer instead of
6023         a const reference.
6024         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6025         Target_arm::default_target.
6026         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6027         method definition.
6028         (Target_arm::relocate_section): Adjust view.
6029         (Target_arm::relocate_stub): New method definition.
6030
6031 2009-11-10  Doug Kwan  <dougkwan@google.com>
6032
6033         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6034         a format warning.
6035         * incremental.cc (open_incremental_binary): Initialized local
6036         variables to avoid warnings.
6037         * object.cc (make_elf_object): Ditto.
6038         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6039         a format warning.
6040
6041 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6042
6043         PR gold/10930
6044         * testsuite/plugin_test.c: Include "config.h".
6045
6046 2009-11-09  Doug Kwan  <dougkwan@google.com>
6047
6048         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6049         (arm_symbol_value): Remove.
6050         (Arm_relocate_functions::arm_branch_common,
6051         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6052         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6053         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6054         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6055         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6056         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6057         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6058         Arm_relocate_functions::thm_mobw_abs_nc,
6059         Arm_relocate_functions::thm_mov_abs,
6060         Arm_relocate_functions::movw_prel_nc,
6061         Arm_relocate_functions::thm_movt_abs,
6062         Arm_relocate_functions::movt_prel,
6063         Arm_relocate_functions::thm_movw_prel_nc,
6064         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6065         (Target_arm::Relocate::relocate): Only decompose address into two
6066         parts if relocation type uses the thumb-bit and pass the actual
6067         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6068         calls to methods in Arm_relocate_functions for this change.
6069
6070 2009-11-08  Ian Lance Taylor  <iant@google.com>
6071
6072         PR 10925
6073         * reloc.cc: Instantiate
6074         Sized_relobj::initialize_input_to_output_maps and
6075         Sized_relobj:free_input_to_output_maps.
6076
6077 2009-11-06  Ian Lance Taylor  <iant@google.com>
6078
6079         PR 10876
6080         * defstd.cc (in_segment): Set only_if_ref true for "end".
6081
6082 2009-11-06  Doug Kwan  <dougkwan@google.com>
6083
6084         * arm.cc (class Reloc_stub): Correct a comment.
6085         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6086         (Target_arm::scan_section_for_stubs): New method declaration.
6087         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6088         Change methods from private to protected.
6089         (Target_arm::do_may_relax): New method definition.
6090         (Target_arm::do_relax, Target_arm::group_sections,
6091         Target_arm::scan_reloc_for_stub,
6092         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6093         (Target_arm::arm_input_section_map_): New data member declaration.
6094         (Target_arm::scan_reloc_for_stub,
6095         Target_arm::scan_reloc_section_for_stubs,
6096         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6097         Target_arm::do_relax): New method definitions.
6098
6099 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6100
6101         * configure.ac: Check for (struct stat)::st_mtim
6102         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6103         * config.in: Regenerate.
6104         * configure: Regenerate.
6105
6106 2009-11-05  Ian Lance Taylor  <iant@google.com>
6107
6108         PR 10910
6109         * output.cc (Output_segment::add_output_section): Add missing
6110         return statement.
6111
6112 2009-11-04  Ian Lance Taylor  <iant@google.com>
6113
6114         PR 10880
6115         * object.h (class Object): Add is_needed and set_is_needed
6116         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6117         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6118         defined in a dynamic object and referenced by a regular object,
6119         set is_needed for the dynamic object.
6120         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6121         if the file is marked with as_needed and it is not needed.
6122
6123 2009-11-04  Ian Lance Taylor  <iant@google.com>
6124
6125         PR 10887
6126         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6127         tags if data is discarded by linker script.
6128         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6129         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6130         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6131         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6132
6133 2009-11-04  Ian Lance Taylor  <iant@google.com>
6134
6135         * layout.cc (Layout::get_output_section): Add is_interp and
6136         is_dynamic_linker_section parameters.  Change all callers.
6137         (Layout::choose_output_section): Likewise.
6138         (Layout::make_output_section): Likewise.
6139         (Layout::add_output_section_data): Add is_dynamic_linker_section
6140         parameter.  Change all callers.
6141         * layout.h (class Layout): Update declarations.
6142         * output.h (class Output_section): Add is_interp, set_is_interp,
6143         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6144         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6145         generate_code_fills_at_write_ to a bitfield.
6146         * output.cc (Output_section::Output_sections): Initialize new
6147         fields.
6148         (Output_segment::add_output_section): Add do_sort parameter.
6149         Change all callers.
6150
6151 2009-11-03  Ian Lance Taylor  <iant@google.com>
6152
6153         PR 10860
6154         * options.h (class General_options): Add --warn-common.
6155         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6156         merging two common symbols.
6157         (Symbol_table::should_override): Handle --warn-common when merging
6158         a common symbol with a defined symbol.  Use report_resolve_problem
6159         for multiple definitions.
6160         (Symbol_table::report_resolve_problem): New function.
6161         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6162
6163 2009-11-03  Doug Kwan  <dougkwan@google.com>
6164
6165         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6166         stub_factory_.
6167         (Target_arm::stub_factory): New method definition.
6168         (Target_arm::new_arm_input_section,
6169         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6170         Target_arm::reloc_uses_thumb_bit): New method declarations.
6171         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6172         New type definitions.
6173         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6174         member declarations.
6175         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6176         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6177         New method definitions.
6178
6179 2009-11-03  Ian Lance Taylor  <iant@google.com>
6180
6181         * options.h (class General_options): Add --warn_constructors.
6182
6183 2009-11-03  Ian Lance Taylor  <iant@google.com>
6184
6185         PR 10893
6186         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6187         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6188
6189 2009-11-03  Ian Lance Taylor  <iant@google.com>
6190
6191         PR 10895
6192         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6193         --msgid-bugs-address.
6194         (install-pdf): New target.
6195         (install-data_yes): Look up one directory to find mkinstalldirs.
6196
6197 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6198
6199         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6200         tree.
6201
6202 2009-10-30  Doug Kwan  <dougkwan@google.com>
6203
6204         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6205
6206 2009-10-30  Doug Kwan  <dougkwan@google.com>
6207
6208         * arm.cc (Stub_addend_reader): New struct template definition
6209         and partial specializations.
6210         (Stub_addend_reader::operator()): New method definition for a
6211         partially specialized template.
6212
6213 2009-10-30  Doug Kwan  <dougkwan@google.com>
6214
6215         * arm.cc (Arm_relobj::processor_specific_flags): New method
6216         definition.
6217         (Arm_relobj::do_read_symbols): New method declaration.
6218         (Arm_relobj::processor_specific_flags_): New data member declaration.
6219         (Arm_dynobj): New class definition.
6220         (Target_arm::do_finalize_sections): Add input_objects parameter.
6221         (Target_arm::do_adjust_elf_header): New method declaration.
6222         (Target_arm::are_eabi_versions_compatible,
6223         (Target_arm::merge_processor_specific_flags): New method declaration.
6224         (Target_arm::do_make_elf_object): New overloaded method definitions
6225         and declaration.
6226         (Arm_relobj::do_read_symbols): New method definition.
6227         (Arm_dynobj::do_read_symbols): Ditto.
6228         (Target_arm::do_finalize_sections): Add input_objects parameters.
6229         Merge processor-specific flags from all input objects.
6230         (Target_arm::are_eabi_versions_compatible,
6231         Target_arm::merge_processor_specific_flags,
6232         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6233         New method definitions.
6234         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6235         Input_objects pointer type parameter.
6236         * layout.cc (Layout::finalize): Pass input objects to target's.
6237         finalize_sections function.
6238         * output.cc (Output_file_header::do_sized_write): Set ELF file
6239         header's processor-specific flags.
6240         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6241         Input_objects pointer type parameter.
6242         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6243         * target.h (Input_objects): New forward class declaration.
6244         (Target::processor_specific_flags,
6245         Target::are_processor_specific_flags_sect): New method definitions.
6246         (Target::finalize_sections): Add input_objects parameter.
6247         (Target::Target): Initialize processor_specific_flags_ and
6248         are_processor_specific_flags_set_.
6249         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6250         parameter.
6251         (Target::set_processor_specific_flags): New method definition.
6252         (Target::processor_specific_flags_,
6253         Target::are_processor_specific_flags_set_): New data member
6254         declarations.
6255         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6256         Input_objects pointer type parameter.
6257
6258 2009-10-30  Doug Kwan  <dougkwan@google.com>
6259
6260         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6261
6262 2009-10-28  Ian Lance Taylor  <iant@google.com>
6263
6264         * object.h (class Relobj): Drop options parameter from
6265         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6266         do_scan_relocs, do_relocate.  Change all callers.
6267         (class Sized_relobj): Drop options parameters from
6268         do_gc_process_relocs, do_scan_relocs, do_relocate,
6269         do_relocate_sections, relocate_sections, emit_relocs_scan,
6270         emit_relocs_scan_reltype.  Change all callers.
6271         (struct Relocate_info): Remove options field and all references to
6272         it.
6273         * reloc.h (class Read_relocs): Remove options constructor
6274         parameter and options_ field.  Change all callers.
6275         (class Gc_process_relocs, class Scan_relocs): Likewise.
6276         (class Relocate_task): Likewise.
6277         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6278         all callers.
6279         (scan_relocatable_relocs): Likewise.
6280         * target.h (class Sized_target): Remove options parameter from
6281         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6282         all callers.
6283         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6284         callers.
6285         * arm.cc: Update functions to remove options parameters.
6286         * i386.cc: Likewise.
6287         * powerpc.cc: Likewise.
6288         * sparc.cc: Likewise.
6289         * x86_64.cc: Likewise.
6290         * testsuite/testfile.cc: Likewise.
6291
6292 2009-10-28  Doug Kwan  <dougkwan@google.com>
6293
6294         * arm.cc (Arm_relobj): New class definition.
6295         (Arm_relobj::scan_sections_for_stubs,
6296         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6297         New method definitions.
6298
6299 2009-10-28  Cary Coutant  <ccoutant@google.com>
6300
6301         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6302         (Plugin::cleanup_done_): New member.
6303         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6304         (Plugin_manager::cleanup_done_): Remove.
6305         (Plugin_manager::add_input_file): Edit error message.
6306         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6307         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6308
6309 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6310
6311         * fileread.cc: (File_read::View::~View): Use the new
6312         data_ownership_ filed.
6313         (File_read::~File_read): Dispose the new whole_file_view_.
6314         (File_read::open): Mmap the whole file if needed.
6315         (File_read::open): Use whole_file_view_ instead of contents_.
6316         (File_read::find_view): Use whole_file_view_ if applicable.
6317         (File_read::do_read): Use whole_file_view_ instead of contents_.
6318         (File_read::make_view): Use whole_file_view_ instead of contents_,
6319         update File_read::View::View call.
6320         (File_read::find_or_make_view): Update File_read::View::View
6321         call.
6322         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6323         remove contents_
6324         (File_read::View::Data_ownership): New enum.
6325         (File_read::View::View): Replace bool mapped_ with Data_ownership
6326         argument.
6327         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6328         (File_read::View::data_ownership_): New field.
6329         (File_read::contents_): Remove (replaced by whole_file_view_).
6330         (File_read::whole_file_view_): New field.
6331         * options.h (class General_options): Add --keep-files-mapped.
6332
6333 2009-10-27  Cary Coutant  <ccoutant@google.com>
6334
6335         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6336         * testsuite/Makefile.am (plugin_test_5): New test case.
6337         * testsuite/Makefile.in: Regenerate.
6338
6339 2009-10-25  Doug Kwan  <dougkwan@google.com>
6340
6341         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6342         from private to protected to allow access by child class.
6343         (Sized_relobj::do_relocate_sections): New method declaration.
6344         (Sized_relobj::relocate_sections): Virtualize.
6345         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6346         Sized_relobj::relocate_sections.  Instantiate template explicitly
6347         for different target sizes and endianity.
6348
6349 2009-10-24  Doug Kwan  <dougkwan@google.com>
6350
6351         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6352         (Arm_input_section::as_arm_input_section): New method.
6353         (Arm_output_section): New class definition.
6354         (Arm_output_section::create_stub_group,
6355         Arm_output_section::group_sections): New method definitions.
6356
6357 2009-10-22  Doug Kwan  <dougkwan@google.com>
6358
6359         * arm.cc (Arm_input_section): New class definition.
6360         (Arm_input_section::init, Arm_input_section:do_write,
6361         Arm_input_section::set_final_data_size,
6362         Arm_input_section::do_reset_address_and_file_offset): New method
6363         definitions.
6364
6365 2009-10-21  Doug Kwan  <dougkwan@google.com>
6366
6367         * arm.cc (Stub_table, Arm_input_section): New forward class
6368         declarations.
6369         (Stub_table): New class defintion.
6370         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6371         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6372         New method definition.
6373
6374 2009-10-21  Doug Kwan  <dougkwan@google.com>
6375
6376         * arm.cc: Update copyright comments.
6377         (Target_arm): New forward class template declaration.
6378         (Arm_address): New type.
6379         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6380         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6381         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6382         constants.
6383         (Insn_template): Same.
6384         (DEF_STUBS): New macro.
6385         (Stub_type): New enum type.
6386         (Stub_template): New class definition.
6387         (Stub): Same.
6388         (Reloc_stub): Same.
6389         (Stub_factory): Same.
6390         (Target_arm::Target_arm): Initialize may_use_blx_ and
6391         should_force_pic_veneer_.
6392         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6393         Target_arm::should_force_pic_veneer,
6394         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6395         Target_arm::using_thumb_only, Target_arm:;default_target): New
6396         method defintions.
6397         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6398         New data member declarations.
6399         (Insn_template::size, Insn_template::alignment): New method defintions.
6400         (Stub_template::Stub_template): New method definition.
6401         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6402         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6403         (Stub_factory::Stub_factory): New method definition.
6404         * gold.h (string_hash): New template.
6405         * output.h (Input_section_specifier::hash_value): Use
6406         gold::string_hash.
6407         (Input_section_specifier::string_hash): Remove.
6408         * stringpool.cc (Stringpool_template::string_hash): Use
6409         gold::string_hash.
6410
6411 2009-10-20  Doug Kwan  <dougkwan@google.com>
6412
6413         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6414         symbols of relaxed input sections.
6415         * output.h (Output_section::find_relaxed_input_section): Make
6416         method public.
6417
6418 2009-10-16  Doug Kwan  <dougkwan@google.com>
6419
6420         * dynobj.cc (Versions::Versions): Initialize version_script_.
6421         Only insert base version symbol definition for a shared object
6422         if version script defines any version versions.
6423         (Versions::define_base_version): New method definition.
6424         (Versions::add_def): Check that base version is not needed.
6425         (Versions::add_need): Define base version lazily.
6426         * dynobj.h (Versions::define_base_version): New method declaration.
6427         (Versions::needs_base_version_): New data member declaration.
6428         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6429         (check_DATA): Add no_version_test.stdout.
6430         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6431         New make rules.
6432         * testsuite/Makefile.in: Regenerate.
6433         * testsuite/no_version_test.c: New file.
6434         * testsuite/no_version_test.sh: Ditto.
6435
6436 2009-10-16  Doug Kwan  <dougkwan@google.com>
6437
6438         * expression.cc (class Segment_start_expression): New class definition.
6439         (Segment_start_expression::value): New method definition.
6440         (script_exp_function_segment_start): Return a new
6441         Segment_start_expression.
6442         * gold/script-c.h (script_saw_segment_start_expression): New function
6443         prototype.
6444         * script-sections.cc (Script_sections::Script_sections): Initialize
6445         SAW_SEGMENT_START_EXPRESSION_ to false.
6446         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6447         and -Tbbs options to specify section addresses if given in
6448         command line and no SEGMENT_START expression is seen in a script.
6449         * script-sections.h (Script_sections::saw_segment_start_expression,
6450         Script_sections::set_saw_segment_start_expression): New method
6451         definition.
6452         (Script_sections::saw_segment_start_expression_): New data member
6453         declaration.
6454         * script.cc (script_saw_segment_start_expression): New function.
6455         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6456         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6457         script_test_7.sh and script_test_8.sh.
6458         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6459         script_test_8.stdout.
6460         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6461         (script_test_6, script_test_6.stdout, script_test_7,
6462         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6463         * Makefile.in: Regenerate.
6464         * testsuite/script_test_6.sh: New file.
6465         * testsuite/script_test_6.t: Same.
6466         * testsuite/script_test_7.sh: Same.
6467         * testsuite/script_test_7.t: Same.
6468         * testsuite/script_test_8.sh: Same.
6469
6470 2009-10-16  Doug Kwan  <dougkwan@google.com>
6471
6472         * output.cc (Output_segment::set_section_list_address): Cast
6473         expressions to unsigned long long type to avoid format warnings.
6474
6475 2009-10-15  Ian Lance Taylor  <iant@google.com>
6476
6477         * script.cc (Script_options::add_symbol_assignment): Always add a
6478         dot assignment to script_sections_.
6479         * script-sections.cc (Script_sections::add_dot_assignment):
6480         Initialize if necessary.
6481
6482         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6483         program headers with no load segment if there is a linker script.
6484
6485         * layout.cc (Layout::set_segment_offsets): Align the file offset
6486         to the segment aligment for -N or -n with no load segment.
6487         * output.cc (Output_segment::add_output_section): Don't crash if
6488         the first section is a TLS section.
6489         (Output_segment::set_section_list_addresses): Print an error
6490         message if the address moves backward in a linker script.
6491         * script-sections.cc
6492         (Output_section_element_input::set_section_addresses): Don't
6493         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6494         (Orphan_output_section::set_section_addresses): Likewise.
6495
6496 2009-10-15  Doug Kwan  <dougkwan@google.com>
6497
6498         * layout.cc (Layout::finish_dynamic_section): Generate tags
6499         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6500         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6501         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6502
6503 2009-10-14  Ian Lance Taylor  <iant@google.com>
6504
6505         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6506         fields.
6507         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6508         data_shdr fields of relinfo.
6509         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6510         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6511         R_386_TLS_LDO_32, adjust based on section flags.
6512         (Target_i386::Relocate::fix_up_ldo): Remove.
6513
6514 2009-10-13  Ian Lance Taylor  <iant@google.com>
6515
6516         Add support for -pie.
6517         * options.h (class General_options): Add -pie and
6518         --pic-executable.
6519         (General_options::output_is_position_independent): Test -pie.
6520         (General_options::output_is_executable): Return true if not shared
6521         and not relocatable.
6522         (General_options::output_is_pie): Remove.
6523         * options.cc (General_options::finalize): Reject incompatible uses
6524         of -pie.
6525         * gold.cc (queue_middle_tasks): A -pie link is not static.
6526         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6527         * symtab.cc (Symbol::final_value_is_known): Return false if
6528         output_is_position_independent.
6529         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6530         output_is_position_independent.
6531         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6532         output_is_position_independent.
6533         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6534         output_is_position_independent.
6535         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6536         two_file_pie_test.
6537         (basic_pie_test.o, basic_pie_test): New targets.
6538         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6539         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6540         (two_file_pie_test): New target.
6541         * testsuite/Makefile.in: Rebuild.
6542         * README: Remove note saying that -pie is not supported.
6543
6544 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6545
6546         * options.h (class General_options): Add -init and -fini.
6547         * layout.cc (Layout::finish_dynamic_section): Emit
6548         given init and fini functions.
6549
6550 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6551
6552         * gc.h (gc_process_relocs): Check if icf is enabled using new
6553         function.
6554         * gold.cc (queue_initial_tasks): Likewise.
6555         (queue_middle_tasks): Likewise.
6556         * object.cc (do_layout): Likewise.
6557         * symtab.cc (is_section_folded): Likewise.
6558         * main.cc (main): Likewise.
6559         * reloc.cc (Read_relocs::run): Likewise.
6560         (Sized_relobj::do_scan_relocs): Likewise.
6561         * icf.cc (is_function_ctor_or_dtor): New function.
6562         (Icf::find_identical_sections): Check if function is ctor or dtor when
6563         safe icf is chosen.
6564         * options.h (General_options::icf): Change option to be an enum.
6565         (Icf_status): New enum.
6566         (icf_enabled): New method.
6567         (icf_safe_folding): New method.
6568         (set_icf_status): New method.
6569         (icf_status_): New variable.
6570         * (options.cc) (General_options::finalize): Set icf_status_.
6571         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6572         icf_test and icf_keep_unique_test to use the --icf enum flag.
6573         * testsuite/icf_safe_test.sh: New file.
6574         * testsuite/icf_safe_test.cc: New file.
6575
6576 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6577
6578         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6579         includes to gc.h and icf.h.
6580         * arm.cc: Include gc.h.
6581         * gold.cc: Likewise.
6582         * i386.cc: Likewise.
6583         * powerpc.cc: Likewise.
6584         * sparc.cc: Likewise.
6585         * x86_64.cc: Likewise.
6586         * gc.h: Include icf.h.
6587
6588 2009-10-11  Ian Lance Taylor  <iant@google.com>
6589
6590         * plugin.cc: Include "gold.h" before other header files.
6591
6592 2009-10-10  Chris Demetriou  <cgd@google.com>
6593
6594         * options.h (Input_file_argument::Input_file_type): New enum.
6595         (Input_file_argument::is_lib_): Replace with...
6596         (Input_file_argument::type_): New member.
6597         (Input_file_argument::Input_file_argument): Take Input_file_type
6598         'type' rather than boolean 'is_lib' as second argument.
6599         (Input_file_argument::is_lib): Use type_.
6600         (Input_file_argument::is_searched_file): New function.
6601         (Input_file_argument::may_need_search): Handle is_searched_file.
6602         * options.cc (General_options::parse_library): Support -l:filename.
6603         (General_options::parse_just_symbols): Update for Input_file_argument
6604         changes.
6605         (Command_line::process): Likewise.
6606         * archive.cc (Archive::get_file_and_offset): Likewise.
6607         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6608         * script.cc (read_script_file, script_add_file): Likewise.
6609         * fileread.cc (Input_file::Input_file): Likewise.
6610         (Input_file::will_search_for): Handle is_searched_file.
6611         (Input_file::open): Likewise.
6612         * readsyms.cc (Read_symbols::get_name): Likewise.
6613         * testsuite/Makefile.am (searched_file_test): New test.
6614         * testsuite/Makefile.in: Regenerate.
6615         * testsuite/searched_file_test.cc: New file.
6616         * testsuite/searched_file_test_lib.cc: New file.
6617
6618 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6619             Ian Lance Taylor  <iant@google.com>
6620
6621         * descriptor.cc: Include <cstdio> and "binary-io.h".
6622         (Descriptors::open): Open the files in binary mode always.
6623         * script.cc (Lex::get_token): Treat \r as whitespace.
6624
6625 2009-10-09  Ian Lance Taylor  <iant@google.com>
6626
6627         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6628
6629 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6630             Ian Lance Taylor  <iant@google.com>
6631
6632         * configure.ac: Check for readv function also.
6633         * fileread.cc (readv): Define if not HAVE_READV.
6634         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6635         does not exist.
6636         * config.in: Regenerate.
6637         * configure: Regenerate.
6638
6639 2009-10-09  Doug Kwan  <dougkwan@google.com>
6640
6641         * layout.cc (Layout::make_output_section): Call target hook to make
6642         ordinary output section.
6643         (Layout::finalize): Adjust parameter list of call the
6644         Target::may_relax().
6645         * layout.h (class Layout::section_list): New method.
6646         * merge.h (Output_merge_base::entsize): Change visibility to public.
6647         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6648         New methods.
6649         (Output_merge_string::do_is_string): New method.
6650         * object.cc (Sized_relobj::do_setup): renamed from
6651         Sized_relobj::set_up.
6652         * object.h (Sized_relobj::adjust_shndx,
6653         Sized_relobj::initializ_input_to_output_maps,
6654         Sized_relobj::free_input_to_output_maps): Change visibilities to
6655         protected.
6656         (Sized_relobj::setup): Virtualize.
6657         (Sized_relobj::do_setup): New method declaration.
6658         (Sized_relobj::invalidate_section_offset,
6659         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6660         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6661         * options.cc (parse_int): New function.
6662         * options.h (parse_int): New declaration.
6663         (DEFINE_int): New macro.
6664         (stub_group_size): New option.
6665         * output.cc (Output_section::Output_section): Initialize memebers
6666         merge_section_map_, merge_section_by_properties_map_,
6667         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6668         (Output_section::add_input_section): Handled deferred code-fill
6669         generation and remove an old comment.
6670         (Output_section::add_relaxed_input_section): New method definition.
6671         (Output_section::add_merge_input_section): Use merge section by
6672         properties map to speed to search.  Update merge section maps
6673         as appropriate.
6674         (Output_section::build_relaxation_map): New method definition.
6675         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6676         Same.
6677         (Output_section::relax_input_section): Renamed to
6678         Output_section::convert_input_sections_to_relaxed_sections and change
6679         interface to take a vector of pointers to relaxed sections.
6680         (Output_section::find_merge_section,
6681         Output_section::find_relaxed_input_section): New method definitions.
6682         (Output_section::is_input_address_mapped,
6683         Output_section::output_offset, Output_section::output_address):
6684         Use output section data maps to speed up searching.
6685         (Output_section::find_starting_output_address): Add comments.
6686         (Output_section::do_write,
6687         Output_section::write_to_postprocessing_buffer): Do code-fill
6688         generation as appropriate.
6689         (Output_section::get_input_sections): Invalidate relaxed input section
6690         map.
6691         (Output_section::restore_states): Adjust type of checkpoint .
6692         Invalidate relaxed input section map.
6693         * output.h (Output_merge_base): New class declaration.
6694         (Input_section_specifier): New class defintion.
6695         (class Output_relaxed_input_section) Change base class to
6696         Output_section_data_build.
6697         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6698         base class initializer.
6699         (Output_section::add_relaxed_input_section): New method declaration.
6700         (Output_section::Input_section): Change visibility to protected.
6701         (Output_section::Input_section::relobj,
6702         Output_section::Input_section::shndx): Handle relaxed input sections.
6703         Output_section::input_sections) Change visibility to protected.  Also
6704         define overload to return a non-const pointer.
6705         (Output_section::Merge_section_properties): New class defintion.
6706         (Output_section::Merge_section_by_properties_map,
6707         Output_section::Output_section_data_by_input_section_map,
6708         Output_section::Relaxation_map): New types.
6709         (Output_section::relax_input_section): Rename method to
6710         Output_section::convert_input_sections_to_relaxed_sections and change
6711         interface to take a vector of relaxed section pointers.
6712         (Output_section::find_merge_section,
6713         Output_section::find_relaxed_input_section,
6714         Output_section::build_relaxation_map,
6715         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6716         New method declarations.
6717         (Output_section::merge_section_map_
6718         Output_section::merge_section_by_properties_map_,
6719         Output_section::relaxed_input_section_map_,
6720         Output_section::is_relaxed_input_section_map_valid_,
6721         Output_section::generate_code_fills_at_write_): New data members.
6722         * script-sections.cc
6723         (Output_section_element_input::set_section_addresses): Call
6724         current_data_size and addralign methods of relaxed input sections.
6725         (Orphan_output_section::set_section_addresses): Call current_data_size
6726         and addralign methods of relaxed input sections.
6727         * symtab.cc (Symbol_table::compute_final_value): Extract template
6728         from the body of Symbol_table::sized_finalize_symbol.
6729         (Symbol_table::sized_finalized_symbol): Call
6730         Symbol_table::compute_final_value.
6731         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6732         (Symbol_table::compute_final_value): New templated method declaration.
6733         * target.cc (Target::do_make_output_section): New method defintion.
6734         * target.h (Target::make_output_section): New method declaration.
6735         (Target::relax): Add more parameters for input objects, symbol table
6736         and layout.  Adjust call to do_relax.
6737         (Target::do_make_output_section): New method declaration.
6738         (Target::do_relax): Add parameters for input objects, symbol table
6739         and layout.
6740
6741 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6742
6743         * pread.c: Include stdio.h.
6744
6745 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6746
6747         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6748         defined.
6749
6750 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6751
6752         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6753         Change read_shndx type to unsigned int.
6754         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6755         int.
6756         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6757         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6758         Change read_shndx type to unsigned int.
6759         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6760         int.
6761         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6762         * layout.cc (Layout::create_symtab_sections): Cast the result of
6763         local_symcount * symsize to off_t in the gold_assert.
6764
6765 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6766
6767         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6768         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6769         R_ARM_BASE_ABS.
6770         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6771         (Arm_relocate_functions::thm_abs5): New function.
6772         (Arm_relocate_functions::abs12): New function.
6773         (Arm_relocate_functions::abs16): New function.
6774         (Arm_relocate_functions::base_abs): New function.
6775         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6776         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6777         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6778         R_ARM_BASE_ABS.
6779         (Scan::global): Likewise.
6780         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6781         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6782         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6783         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6784         R_ARM_BASE_ABS.
6785
6786 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6787
6788         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6789         (Arm_relocate_functions::movt_prel): New function.
6790         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6791         (Arm_relocate_functions::thm_movt_prel): New function.
6792         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6793         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6794         (Scan::global, Relocate::relocate): Likewise.
6795         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6796
6797 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6798
6799         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6800         Incremental_checker.
6801         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6802         unsigned int.
6803         (class Incremental_inputs_header): New class.
6804         (Incremental_inputs_header_writer): Edit comment.
6805         (Incremental_inputs_entry): New class.
6806         (Incremental_inputs_entry_writer): Edit comment.
6807         (Sized_incremental_binary::do_find_incremental_inputs_section):
6808         Add *strtab_shndx parameter, fill it.
6809         (Sized_incremental_binary::do_check_inputs): New method.
6810         (Incremental_checker::can_incrementally_link_output_file): Use
6811         Sized_incremental_binary::check_inputs.
6812         (Incremental_inputs::report_command_line): Save command line in
6813         command_line_.
6814         * incremental.h:
6815         (Incremental_binary::find_incremental_inputs_section): New
6816         method.
6817         (Incremental_binary::do_find_incremental_inputs_section): Add
6818         strtab_shndx parameter.
6819         (Incremental_binary::do_check_inputs): New pure virtual method.
6820         (Sized_incremental_binary::do_check_inputs): Declare.
6821         (Incremental_checker::Incremental_checker): Add incremental_inputs
6822         parameter, use it to initialize incremental_inputs_.
6823         (Incremental_checker::incremental_inputs_): New field.
6824         (Incremental_checker::command_line): New method.
6825         (Incremental_checker::inputs): New method.
6826         (Incremental_checker::command_line_): New field.
6827
6828 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6829
6830         * incremental.cc: Include <cstdarg> and "target-select.h".
6831         (vexplain_no_incremental): New function.
6832         (explain_no_incremental): New function.
6833         (Incremental_binary::error): New method.
6834         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6835         method.
6836         (make_sized_incremental_binary): New function.
6837         (open_incremental_binary): New function.
6838         (can_incrementally_link_file): Add checks if output is ELF and has
6839         inputs section.
6840         * incremental.h: Include "elfcpp_file.h" and "output.h".
6841         (Incremental_binary): New class.
6842         (Sized_incremental_binary): New class.
6843         (open_incremental_binary): Declare.
6844         * object.cc (is_elf_object): Use
6845         elfcpp::Elf_recognizer::is_elf_file.
6846         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6847         * output.h (Output_file::filesize): New method.
6848
6849 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6850
6851         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6852         New function.
6853         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6854         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6855         function.
6856         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6857         function.
6858         (Arm_relocate_functions::movw_abs_nc): New function.
6859         (Arm_relocate_functions::movt_abs): New function.
6860         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6861         (Arm_relocate_functions::thm_movt_abs): New function.
6862         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6863         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6864         (Scan::global): Likewise.
6865         (Relocate::relocate): Likewise.
6866         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6867
6868 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6869
6870         * arm.cc (Arm_relocate_functions::got_prel) New function.
6871         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6872         (Relocate::relocate): Likewise.
6873         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6874
6875 2009-10-06  Ian Lance Taylor  <iant@google.com>
6876
6877         * options.h (class General_options): Define
6878         split_stack_adjust_size parameter.
6879         * object.h (class Object): Add uses_split_stack_ and
6880         has_no_split_stack_ fields.  Add uses_split_stack and
6881         has_no_split_stack accessor functions.  Declare
6882         handle_split_stack_section.
6883         (class Reloc_symbol_changes): Define.
6884         (class Sized_relobj): Define Function_offsets.  Declare
6885         split_stack_adjust, split_stack_adjust_reltype, and
6886         find_functions.
6887         * object.cc (Object::handle_split_stack_section): New function.
6888         (Sized_relobj::do_layout): Call handle_split_stack_section.
6889         * dynobj.cc (Sized_dynobj::do_layout): Call
6890         handle_split_stack_section.
6891         * reloc.cc (Sized_relobj::relocate_sections): Call
6892         split_stack_adjust for executable sections in split_stack
6893         objects.  Pass reloc_map to relocate_section.
6894         (Sized_relobj::split_stack_adjust): New function.
6895         (Sized_relobj::split_stack_adjust_reltype): New function.
6896         (Sized_relobj::find_functions): New function.
6897         * target-reloc.h: Include "object.h".
6898         (relocate_section): Add reloc_symbol_changes parameter.  Change
6899         all callers.
6900         * target.h (class Target): Add calls_non_split method.  Declare
6901         do_calls_non_split virtual method.  Declare match_view and
6902         set_view_to_nop.
6903         * target.cc: Include "elfcpp.h".
6904         (Target::do_calls_non_split): New function.
6905         (Target::match_view): New function.
6906         (Target::set_view_to_nop): New function.
6907         * gold.cc (queue_middle_tasks): Give an error if mixing
6908         split-stack and non-split-stack objects with -r.
6909         * i386.cc (Target_i386::relocate_section): Add
6910         reloc_symbol_changes parameter.
6911         (Target_i386::do_calls_non_split): New function.
6912         * x86_64.cc (Target_x86_64::relocate_section): Add
6913         reloc_symbol_changes parameter.
6914         (Target_x86_64::do_calls_non_split): New function.
6915         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6916         parameter.
6917         * powerpc.cc (Target_powerpc::relocate_section): Add
6918         reloc_symbol_changes parameter.
6919         * sparc.cc (Target_sparc::relocate_section): Add
6920         reloc_symbol_changes parameter.
6921         * configure.ac: Call AM_CONDITIONAL for the default target.
6922         * configure: Rebuild.
6923         * testsuite/Makefile.am (TEST_AS): New variable.
6924         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6925         (check_DATA): Add split_i386 and split_x86_64 files.
6926         (SPLIT_DEFSYMS): Define.
6927         (split_i386_[1234n].o): New targets.
6928         (split_i386_[124]): New targets.
6929         (split_i386_[1234r].stdout): New targets.
6930         (split_x86_64_[1234n].o): New targets.
6931         (split_x86_64_[124]): New targets.
6932         (split_x86_64_[1234r].stdout): New targets.
6933         (MOSTLYCLEANFILES): Add new executables.
6934         * testsuite/split_i386.sh: New file.
6935         * testsuite/split_x86_64.sh: New file.
6936         * testsuite/split_i386_1.s: New file.
6937         * testsuite/split_i386_2.s: New file.
6938         * testsuite/split_i386_3.s: New file.
6939         * testsuite/split_i386_4.s: New file.
6940         * testsuite/split_i386_n.s: New file.
6941         * testsuite/split_x86_64_1.s: New file.
6942         * testsuite/split_x86_64_2.s: New file.
6943         * testsuite/split_x86_64_3.s: New file.
6944         * testsuite/split_x86_64_4.s: New file.
6945         * testsuite/split_x86_64_n.s: New file.
6946         * testsuite/testfile.cc (Target_test): Update relocation_section
6947         function.
6948         * testsuite/Makefile.in: Rebuild.
6949
6950 2009-10-06  Ian Lance Taylor  <iant@google.com>
6951
6952         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6953         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6954         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6955         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6956         the address on ldo_addrs_.
6957         (Target_i386::Relocate::fix_up_ldo): New function.
6958
6959 2009-10-06   Rafael Espindola  <espindola@google.com>
6960
6961         * plugin.cc (add_input_library): New.
6962         (Plugin::load): Add add_input_library to tv.
6963         (Plugin_manager::add_input_file): Add the is_lib argument.
6964         (add_input_file): Update call to Plugin_manager::add_input_file.
6965         (add_input_library): New.
6966         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6967
6968 2009-09-30  Doug Kwan  <dougkwan@google.com>
6969
6970         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6971         symbol and call Symbol::may_need_copy_reloc to determine if
6972         a copy reloc is needed.
6973         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6974         nocopyreloc is given in command line.
6975         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6976         given in command line.
6977         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6978         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6979         of the removed Target_i386::may_need_copy_reloc.
6980         * options.h (copyreloc): New option with default value false.
6981         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6982         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6983         instead of the removed Target_powerpc::may_need_copy_reloc.
6984         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6985         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6986         instead of the removed Target_sparc::may_need_copy_reloc.
6987         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6988         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6989         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6990         instead of the removed Target_x86_64::may_need_copy_reloc.
6991
6992 2009-09-30  Ian Lance Taylor  <iant@google.com>
6993
6994         * object.h (class Object): Remove target_ field, and target,
6995         sized_target, and set_target methods.
6996         (Object::sized_target): Remove.
6997         (class Sized_relobj): Update declarations.  Remove sized_target.
6998         * object.cc (Sized_relobj::setup): Remove target parameter.
6999         Change all callers.
7000         (Input_objects::add_object): Don't do anything with the target.
7001         (make_elf_sized_object): Add punconfigured parameter.  Change all
7002         callers.  Set or test parameter target.
7003         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7004         Change all callers.
7005         * parameters.cc (Parameters::set_target): Change parameter type to
7006         be non-const.
7007         (Parameters::default_target): Remove.
7008         (set_parameters_target): Change parameter type to be non-const.
7009         (parameters_force_valid_target): New function.
7010         (parameters_clear_target): New function.
7011         * parameters.h (class Parameters): Update declarations.  Remove
7012         default_target method.  Add sized_target and clear_target
7013         methods.  Change target_ to be non-const.
7014         (set_parameters_target): Update declaration.
7015         (parameters_force_valid_target): Declare.
7016         (parameters_clear_target): Declare.
7017         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7018         as NULL if we aren't searching.
7019         (Add_symbols::run): Don't check for compatible target.
7020         * fileread.cc (Input_file::open_binary): Call
7021         parameters_force_valid_target.
7022         * gold.cc (queue_middle_tasks): Likewise.
7023         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7024         set_target on object.
7025         * dynobj.h (class Sized_dynobj): Update declarations.
7026         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7027         make_elf_object returns NULL.
7028         (Archive::include_member): Don't check whether object target is
7029         compatible.
7030         * output.cc (Output_section::add_input_section): Get target from
7031         parameters.
7032         (Output_section::relax_input_section): Likewise.
7033         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7034         parameters.
7035         (Sized_relobj::do_scan_relocs): Likewise.
7036         (Sized_relobj::relocate_sections): Likewise.
7037         * resolve.cc (Symbol_table::resolve): Likewise.
7038         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7039         parameter.  Change all callers.
7040         (Symbol_table::add_from_object): Get target from parameters.
7041         (Symbol_table::add_from_relobj): Don't check object target.
7042         (Symbol_table::add_from_dynobj): Likewise.
7043         (Symbol_table::define_special_symbol): Get target from
7044         parameters.
7045         * symtab.h (class Symbol_table): Update declaration.
7046         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7047         parameter.  Change all callers.  Clear parameter target.
7048         (Binary_test): Test target here.
7049         * testsuite/object_unittest.cc (gold_testsuite): Remove
7050         target_test_pointer parameter.  Change all callers.
7051         (Object_test): Test target here.
7052
7053 2009-09-26  Ian Lance Taylor  <iant@google.com>
7054
7055         * testsuite/initpri1.c: Don't try to use constructor priorities if
7056         compiling with gcc before 4.3.
7057
7058 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7059
7060         * testsuite/retain_symbols_file_test.sh (check_present): Change
7061         output file name to retain_symbols_file_test.stdout.
7062         (check_absent): Likewise.
7063
7064 2009-09-18  Craig Silverstein  <csilvers@google.com>
7065
7066         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7067         * options.cc: Include <cerrno> and <fstream>.
7068         (General_options::finalize): Parse -retain-symbols-file tag.
7069         * options.h: New flag.
7070         (General_options): New method should_retain_symbol, new
7071         variable symbols_to_retain.
7072         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7073         should_retain_symbol map.
7074         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7075         * testsuite/Makefile.in: Regenerate.
7076         * testsuite/retain_symbols_file_test.sh: New file.
7077
7078 2009-09-18  Nick Clifton  <nickc@redhat.com>
7079
7080         * po/es.po: Updated Spanish translation.
7081
7082 2009-09-17  Doug Kwan  <dougkwan@google.com>
7083
7084         * debug.h (DEBUG_RELAXATION): New constant.
7085         (DEBUG_ALL): Add DEBUG_RELAXATION.
7086         (debug_string_to_enum): Add relaxation debug option.
7087         * layout.cc
7088         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7089         Layout::Relaxation_debug_check::read_sections,
7090         Layout::Relaxation_debug_check::read_sections): New method definitions.
7091         (Layout::Layout): Initialize data members
7092         record_output_section_data_from_scrips_,
7093         script_output_section_data_list_ and relaxation_debug_check_.
7094         (Layout::save_segments, Layout::restore_segments,
7095         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7096         Layout::relaxation_loop_body): New method definitions.
7097         (Layout::finalize): Support relaxation.  Move section layout code to
7098         Layout::relaxation_loop_body.
7099         (Layout::set_asection_address_from_script): Move code for orphan
7100         section placement out.
7101         (Layout::place_orphan_sections_in_script): New method definition.
7102         * layout.h (Output_segment_headers, Output_file_header):
7103         New forward class declarations.
7104         (Layout::~Layout): Define.
7105         (Layout::new_output_section_data_from_script): New method definition.
7106         (Layout::place_orphan_sections_in_script): New method declaration.
7107         (Layout::Segment_states): New type declaration.
7108         (Layout::save_segments, Layout::restore_segments,
7109         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7110         Layout::relaxation_loop_body): New method declarations.
7111         (Layout::Output_section_data_list): New type declaration.
7112         (Layout::Relaxation_debug_check): New class definition.
7113         (Layout::record_output_section_data_from_script_,
7114         Layout::script_output_section_data_list_, Layout::segment_states_,
7115         Layout::relaxation_debug_check_): New data members.
7116         * output.cc: (Output_section_headers::do_size): New method definition.
7117         (Output_section_headers::Output_section_headers): Move size
7118         computation to Output_section_headers::do_size.
7119         (Output_segment_headers::do_size): New method definition.
7120         (Output_file_header::Output_file_header): Move size computation to
7121         Output_file_header::do_size and call it.
7122         (Output_file_header::do_size): New method definition.
7123         (Output_data_group::Output_data_group): Adjust call to
7124         Output_section_data.
7125         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7126         (Output_symtab_xindex::do_write): Add array bound check.
7127         (Output_section::Input_section::print_to_mapfile): Handle
7128         RELAXED_INPUT_SECTION_CODE.
7129         (Output_section::Output_section): Initialize data member checkpoint_.
7130         (Output_section::~Output_section): Delete checkpoint object pointed
7131         by checkpoint_.
7132         (Output_section::add_input_section): Always add an Input_section if
7133         relaxing.
7134         (Output_section::add_merge_input_section): Add assert.
7135         (Output_section::relax_input_section): New method definition.
7136         (Output_section::set_final_data_size): Set load address to zero for
7137         an unallocated section.
7138         (Output_section::do_address_and_file_offset_have_reset_values):
7139         New method definition.
7140         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7141         Handle relaxed input section.
7142         (Output_section::sort_attached_input_sections): Checkpoint input
7143         section list lazily.
7144         (Output_section::get_input_sections): Change type of input_sections to
7145         list of Simple_input_section pointers.  Checkpoint input section list
7146         lazily.  Also handle relaxed input sections.
7147         (Output_section::add_input_section_for_script): Take a reference to
7148         a Simple_input_section object instead of Relobj pointer and section
7149         index as parameter.  Handle relaxed input sections.
7150         (Output_section::save_states, Output_section::restore_states): New
7151         method definitions.
7152         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7153         (Output_data::is_data_size_fixed): New method definition.
7154         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7155         if it is fixed.
7156         (Output_data::address_and_file_offset_have_reset_values): New method
7157         definition.
7158         (Output_data::do_address_and_file_offset_have_reset_values): New method
7159         definition.
7160         (Output_data::set_data_size): Check that data size is not fixed.
7161         (Output_data::fix_data_size): New method definition.
7162         (Output_data::is_data_size_fixed_): New data member.
7163         (Output_section_headers::set_final_data_size): New method definition.
7164         (Output_section_headers::do_size): New method declaration.
7165         (Output_segment_headers::set_final_data_size): New method definition.
7166         (Output_segment_headers::do_size): New method declaration.
7167         (Output_file_header::set_final_data_size)::New method definition.
7168         (Output_file_header::do_size)::New method declaration.
7169         (Output_section_data::Output_section_data): Add new parameter
7170         is_data_size_fixed and use it to fix data size.
7171         (Output_data_const::Output_data_const): Adjust call to base class
7172         constructor and fix data size.
7173         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7174         base class constructor and fix data size.
7175         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7176         base class constructor and fix data size.
7177         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7178         class constructor and fix data size.
7179         (Output_data_group::set_final_data_size): New method definition.
7180         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7181         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7182         class constructor and fix data size.
7183         (Output_relaxed_input_section): New class definition.
7184         (Output_section::Simple_input_section): New class definition.
7185         (Output_section::get_input_sections): Adjust parameter list.
7186         (Output_section::add_input_section_for_script): Same.
7187         (Output_section::save_states, Output_section::restore_states,
7188         Output_section::do_address_and_file_offset_have_reset_values,
7189         (Output_section::Input_section::Input_section): Handle
7190         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7191         Output_relaxed_input_section.
7192         (Output_section::Input_section::is_input_section,
7193         Output_section::Input_section::set_output_section): Handle relaxed
7194         input section.
7195         (Output_section::Input_section::is_relaxed_input_section,
7196         Output_section::Input_section::output_section_data,
7197         Output_section::Input_section::relaxed_input_section): New method
7198         definitions.
7199         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7200         value.
7201         (Output_section::Input_section::u1_): Update comments.
7202         (Output_section::Input_section::u2_): Add new union member poris.
7203         (Output_section::Checkpoint_output_section): New classs definition.
7204         (Output_section::relax_input_section): New method declaration.
7205         (Output_section::checkpoint_): New data member.
7206         (Output_segment): Update comments.
7207         (Output_segment::Output_segment): Un-privatize copy constructor.
7208         (Output_segment::operator=): Un-privatize.
7209         * script-sections.cc (Output_section_element::Input_section_list):
7210         Change element type to Output_section::Simple_input_section.
7211         (Output_section_element_dot_assignment::set_section_addresses):
7212         Register output section data for relaxation clean up.
7213         (Output_data_exression::Output_data_expression): Adjust call to base
7214         constructor to fix data size.
7215         (Output_section_element_data::set_section_addresses): Register
7216         Output_data_expression object for relaxation clean up.
7217         (struct Input_section_info): Replace Relobj pointer and section index
7218         pair with Output_section::Simple_input_section and Convert struct to a
7219         class.
7220         (Input_section_sorter::operator()): Adjust access to
7221         Input_section_info data member to use accessors.
7222         (Output_section_element_input::set_section_addresses): Use layout
7223         parameter.  Adjust code to use Output_section::Simple_input_section
7224         and Input_secction_info classes.  Register filler for relaxation
7225         clean up.
7226         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7227         and section index pair with Output_section::Simple_input_section
7228         class.  Adjust code accordingly.
7229         (Phdrs_element::release_segment): New method definition.
7230         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7231         segment list.
7232         (Script_sections::release_segments): New method definition.
7233         * gold/script-sections.h (Script_sections::release_segments): New
7234         method declaration.
7235         * gold/target.h (Target::may_relax, Target::relax,
7236         Target::do_may_relax, Target::do_relax): New method definitions.
7237
7238 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7239
7240         * arm.cc (has_signed_unsigned_overflow): New function.
7241         (Arm_relocate_functions::abs8): New function.
7242         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7243         (Target_arm::Scan::global): Likewise.
7244         (Target_arm::relocate::relocate): Likewise.
7245         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7246         Likewise.
7247
7248 2009-09-16  Cary Coutant  <ccoutant@google.com>
7249
7250         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7251         * testsuite/Makefile.in: Regenerate.
7252
7253 2009-09-11  Nick Clifton  <nickc@redhat.com>
7254
7255         * po/gold.pot: Updated by the Translation project.
7256
7257 2009-09-08  Cary Coutant  <ccoutant@google.com>
7258
7259         * output.cc (Output_file::open): Add execute permission to empty file.
7260         * testsuite/Makefile.am (permission_test): New test.
7261         * testsuite/Makefile.in: Regenerate.
7262
7263 2009-09-02  Ian Lance Taylor  <iant@google.com>
7264
7265         * output.cc (Output_file::resize): Call map_no_anonymous rather
7266         than map.
7267
7268 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7269
7270         * gold.cc: Include "incremental.h".
7271         (queue_initial_tasks): Call Incremental_checker methods.
7272         * incremental.cc: Include "output.h".
7273         (Incremental_checker::can_incrementally_link_output_file): New
7274         method.
7275         * incremental.h (Incremental_checker): New class.
7276
7277         * output.cc (Output_file::open_for_modification): New method.
7278         (Output_file::map_anonymous): Changed return type to bool.  Record
7279         map in base_ field.
7280         (Output_file::map_no_anonymous): New method, broken out of map.
7281         (Output_file::map): Use map_no_anonymous and map_anonymous.
7282         * output.h (class Output_file): Update declarations.
7283
7284 2009-08-24  Cary Coutant  <ccoutant@google.com>
7285
7286         * options.h (Command_line::Pre_options): New class.
7287         (Command_line::pre_options): New member.
7288         * options.cc (gold::options::ready_to_register): New variable.
7289         (One_option::register_option): Do nothing if not registering options.
7290         Assert if same short option registered twice.
7291         (General_options::General_options): Turn off option registration when
7292         done constructing.
7293         (Command_line::Pre_options::Pre_options): New constructor.
7294
7295 2009-08-24  Cary Coutant  <ccoutant@google.com>
7296
7297         * options.h (General_options::no_keep_memory): Remove incorrect
7298         short option.
7299
7300 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7301
7302         * Makefile.am (am__skiplex, am__skipyacc): New.
7303         * Makefile.in: Regenerate.
7304
7305 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7306
7307         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7308         (INCLUDES): ... this.
7309         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7310         (AM_CPPFLAGS): Renamed from ...
7311         (INCLUDE): ... this.
7312         * Makefile.in, testsuite/Makefile.in: Regenerate.
7313
7314         * Makefile.in: Regenerate.
7315         * aclocal.m4: Likewise.
7316         * config.in: Likewise.
7317         * configure: Likewise.
7318         * testsuite/Makefile.in: Likewise.
7319
7320         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7321         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7322         * Makefile.in: Regenerate.
7323         * testsuite/Makefile.in: Regenerate.
7324
7325 2009-08-19  Cary Coutant  <ccoutant@google.com>
7326
7327         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7328         symbols in shared libraries overridden by hidden or internal symbols
7329         in the main program.
7330
7331 2009-08-19  Chris Demetriou  <cgd@google.com>
7332
7333         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7334         checking source file names in error messages.
7335
7336 2009-08-18  Doug Kwan  <dougkwan@google.com>
7337
7338         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7339         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7340         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7341         an elfcpp::Ehdr as parameter.
7342         * object.cc (Object::set_target): Remove the version that looks up
7343         a target and sets it.
7344         (Sized_relobj::setup): Take a Target object instead of
7345         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7346         (make_elf_sized_object): Find target and ask target to
7347         make an ELF object.
7348         * object.h: (Object::set_target): Remove the version that looks up
7349         a target and sets it.
7350         (Sized_relobj::setup): Take a Target object instead of
7351         an elfcpp:Ehdr as parameter.
7352         * target.cc: Include dynobj.h.
7353         (Target::do_make_elf_object_implementation): New.
7354         (Target::do_make_elf_object): New.
7355         * target.h (Target::make_elf_object): New template declaration.
7356         (Target::do_make_elf_object): New method declarations.
7357         (Target::do_make_elf_object_implementation): New template declaration.
7358
7359 2009-08-14  Ian Lance Taylor  <iant@google.com>
7360
7361         * gold.h (FUNCTION_NAME): Define.
7362         (gold_unreachable): Use FUNCTION_NAME.
7363
7364 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7365
7366         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7367         symbol in the --keep-unique list is not found.
7368
7369 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7370
7371         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7372         been maked as --keep-unique.
7373         (Icf::unfold_section): New function.
7374         * icf.h (Icf::unfold_section): New function.
7375         * options.h (General_options::keep_unique): New option.
7376         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7377         * testsuite/Makefile.in: Regenerate.
7378         * testsuite/icf_keep_unique_test.sh: New file.
7379         * testsuite/icf_keep_unique_test.cc: New file.
7380
7381 2009-08-12  Cary Coutant  <ccoutant@google.com>
7382
7383         PR 10471
7384         * resolve.cc (Symbol_table::resolve): Check for references from
7385         dynamic objects to hidden and internal symbols.
7386         * testsuite/Makefile.am (hidden_test.sh): New test.
7387         * testsuite/Makefile.in: Regenerate.
7388         * testsuite/hidden_test.sh: New script.
7389         * testsuite/hidden_test_1.c: New test source.
7390         * testsuite/hidden_test_main.c: New test source.
7391
7392 2009-08-11  Doug Kwan  <dougkwan@google.com>
7393
7394         * arm.cc: Update comments.
7395         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7396         segment to locate the .ARM.exidx section if present.
7397
7398 2009-08-09  Doug Kwan  <dougkwan@google.com>
7399
7400         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7401         patch.
7402
7403 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7404         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7405         compiler warnings.
7406
7407 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7408
7409         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7410         valid tls_segment only for non-debug-section relocations.
7411         * testsuite/Makefile.am: Add gc_tls_test.
7412         * testsuite/Makefile.in: Regenerate.
7413         * testsuite/gc_tls_test.cc: New file.
7414         * testsuite/gc_tls_test.sh: New file.
7415
7416 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7417
7418         * icf.cc: New file.
7419         * icf.h: New file.
7420         * Makefile.am (CCFILES): Add icf.cc.
7421         (HFILES): Add icf.h
7422         * Makefile.in: Regenerate.
7423         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7424         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7425         section, symbol and addend information for the relocs.
7426         * gold.cc (queue_middle_tasks): Call identical code folding.
7427         * gold.h: Add defines for multimap.
7428         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7429         to the call of finalize_local_symbols.
7430         * main.cc (main): Create object of class Icf.
7431         * object.cc (Sized_relobj::do_layout): Allow this function to be
7432         called twice during icf.
7433         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7434         to sections marked as identical by icf.
7435         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7436         when available.
7437         (Sized_relobj::do_section_entsize): New function.
7438         * object.h (Object::section_entsize): New function.
7439         (Object::do_section_entsize): New pure virtual function.
7440         (Relobj::finalize_local_symbols): Add new parameter.
7441         (Relobj::do_section_entsize): New function.
7442         * options.h (General_options::icf): New option.
7443         (General_options::icf_iterations): New option.
7444         (General_options::print_icf_sections): New option.
7445         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7446         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7447         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7448         icf.
7449         * symtab.cc (Symbol_table::is_section_folded): New function.
7450         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7451         to sections marked as identical by icf.
7452         * symtab.h (Symbol_table::set_icf): New function.
7453         (Symbol_table::icf): New function.
7454         (Symbol_table::is_section_folded): New function.
7455         (Symbol_table::icf_): New data member.
7456         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7457         * testsuite/Makefile.am: Add commands to build icf_test.
7458         * testsuite/Makefile.in: Regenerate.
7459         * testsuite/icf_test.sh: New file.
7460         * testsuite/icf_test.cc: New file.
7461
7462 2009-07-24  Chris Demetriou  <cgd@google.com>
7463
7464         * layout.cc (is_compressible_debug_section): Fix incorrect
7465         comment about compressed section names.
7466
7467 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7468
7469         PR 10419
7470         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7471
7472 2009-07-16  Ian Lance Taylor  <iant@google.com>
7473
7474         PR 10400
7475         * layout.h: #include <map>.
7476         (class Kept_section): Change from struct to class.  Add accessors
7477         and setters.  Add section size to Comdat_group mapping.  Change
7478         Comdat_group to std::map.  Add is_comdat_ field.  Add
7479         linkonce_size field in union.
7480         (class Layout): Update declaration of find_or_add_kept_section.
7481         Don't declare find_kept_object.
7482         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7483         parameter.  Add object, shndx, is_comdat, and is_group_name
7484         parameters.  Change all callers.  Adjust for new Kept_section.
7485         (Layout::find_kept_object): Remove.
7486         * object.cc (Sized_relobj::include_section_group): Update use of
7487         Kept_section.  Rename secnum to shndx.  Only record
7488         Kept_comdat_section if sections are the same size.
7489         (Sized_relobj::include_linkonce_section): Update use of
7490         Kept_section.  Only record Kept_comdat_section if sections are the
7491         same size.  Set size of linkonce section.
7492         (Sized_relobj::map_to_kept_section): Update call to
7493         get_kept_comdat_section.
7494         * object.h (class Sized_relobj): Rename fields in
7495         Kept_comdat_section to drop trailing underscores; change object
7496         field to Relobj*.  Change Kept_comdat_section_table to store
7497         struct rather than pointer.
7498         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7499         Add kept_object and kept_shndx parameters.  Change all callers.
7500         (Sized_relobj::get_kept_comdat_section): Change return type to
7501         bool.  Add kept_object and kept_shndx parameters.  Change all
7502         callers.
7503         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7504         Layout::find_or_add_kept_section.
7505
7506 2009-07-09  Ian Lance Taylor  <iant@google.com>
7507
7508         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7509         Reserve space in the hash table.
7510
7511 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7512
7513         * fileread.cc (File_read::get_mtime): New method.
7514         * fileread.h (Timespec): New structure.
7515         (File_read::get_mtime): New method.
7516         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7517         Renamed from timestamp_nsec.
7518         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7519         Elf_Xword.
7520         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7521         timestamp_nsec.
7522         (Incremental_inputs::report_archive): Save mtime; style fix.
7523         (Incremental_inputs::report_obejct): Save mtime; style fix.
7524         (Incremental_inputs::report_script): Save mtime; style fix.
7525         (Incremental_inputs::finalize_inputs): Style fix.
7526         (Incremental_inputs::finalize): Style fix.
7527         (Incremental_inputs::create_input_section_data): Store inputs
7528         mtime.
7529         * incremental.h (Incremental_inputs::report_script): Add mtime
7530         argument.
7531         (Incremental_inputs::Input_info::Input_info): Intialize only one
7532         union member.
7533         (Incremental_inputs::Input_info::archive): Move to nameless
7534         union.
7535         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7536         (Incremental_inputs::Input_info::script): Move to nameless union.
7537         (Incremental_inputs::mtime): New field.
7538         * script.cc (read_input_script): Pass file mtime to
7539         Incremental_input.
7540         * script.h (Script_info::inputs): Style fix.
7541
7542 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7543
7544         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7545         instead of 32.
7546
7547 2009-06-24  Ian Lance Taylor  <iant@google.com>
7548
7549         PR 10156
7550         * layout.cc (Layout::choose_output_section): If we find an
7551         existing section, update the flags.
7552         (Layout::create_notes): New function, broken out of
7553         Layout::finalize.
7554         (Layout::finalize): Don't create note sections.
7555         (Layout::create_note): Don't crash if linker script discards
7556         section.
7557         (Layout::create_gold_note): Likewise.
7558         (Layout::create_build_id): Likewise.  Don't set
7559         after_input_sections on the section.
7560         (Layout::create_executable_stack_info): Remove target parameter.
7561         Change caller.
7562         * layout.h (class Layout): Declare create_notes.  Update
7563         declaration of create_executable_stack_info.
7564         * gold.cc (queue_middle_tasks): Call create_notes.
7565         * output.cc (Output_section::update_flags_for_input_section): Move
7566         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7567         invalid.
7568         * output.h (Output_data::mark_address_invalid): New function.
7569         (class Output_section): Only declare, not define,
7570         update_flags_for_input_section.  Remove set_flags.
7571
7572 2009-06-24  Ian Lance Taylor  <iant@google.com>
7573
7574         * script-sections.cc (Output_section_definition::
7575         set_section_addresses): Rename shadowing local load_address to
7576         laddr.
7577
7578 2009-06-24  Ian Lance Taylor  <iant@google.com>
7579
7580         PR 10244
7581         * reloc.cc (relocate_sections): Skip empty relocation sections.
7582
7583 2009-06-23  Ian Lance Taylor  <iant@google.com>
7584
7585         PR 10156
7586         * layout.cc (Layout::create_note): Use choose_output_section
7587         rather than make_output_section.
7588
7589 2009-06-23  Ian Lance Taylor  <iant@google.com>
7590
7591         PR 10237
7592         * options.cc (General_options::parse_V): Set printed_version_.
7593         (General_options::General_options): Initialize printed_version_.
7594         * options.h (class General_options): Add printed_version_ field.
7595         * gold.cc (queue_initial_tasks): If there are no input files,
7596         don't give a fatal error if we printed the version information.
7597         (queue_middle_tasks): If using -r with a shared object, give a
7598         fatal error rather than an ordinary error.
7599
7600 2009-06-23  Ian Lance Taylor  <iant@google.com>
7601
7602         PR 10219
7603         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7604         (Layout::make_output_section): Set have_stabstr_section_ if we see
7605         a .stab*str section.
7606         (Layout::finalize): Call link_stabs_sections.
7607         (Layout::link_stabs_sections): New file.
7608         * layout.h (class Layout): Add have_stabstr_section_ field.
7609         Declare link_stabs_sections.
7610
7611 2009-06-23  Doug Kwan  <dougkwan@google.com>
7612
7613         * Makefile.am (libgold_a_LIBADD): New.
7614         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7615         * Makefile.in: Regenerate.
7616         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7617         * configure: Regenerate.
7618         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7619         * fileread.cc: Include sys/state.h
7620         * gold.h: Declare memmem and strndup if found missing.
7621         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7622
7623 2009-06-23  Ian Lance Taylor  <iant@google.com>
7624
7625         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7626         * configure: Rebuild.
7627
7628 2009-06-23  Ian Lance Taylor  <iant@google.com>
7629
7630         PR 10147
7631         * object.cc (Object::section_contents): Don't try to get a view if
7632         the section has length zero.
7633         (Object::handle_gnu_warning_section): If the section is empty, use
7634         the name of the section as the warning.
7635
7636 2009-06-23  Ian Lance Taylor  <iant@google.com>
7637
7638         PR 10133
7639         * stringpool.h (class Stringpool_template): Add optimize_ field.
7640         (Stringpool_template::set_optimize): New function.
7641         * stringpool.cc (Stringpool_template::Stringpool_template):
7642         Initialize optimize_ field.
7643         (Stringpool_template::set_string_offsets): Test local optimize
7644         fild rather than parameter.
7645         * layout.cc (Layout::Layout): Call set_optimize on the section
7646         name stringpool.
7647
7648 2009-06-22  Ian Lance Taylor  <iant@google.com>
7649
7650         PR 10030
7651         * yyscript.y: Parse TARGET.
7652         * script.cc (script_set_target): New function.
7653         * script-c.h (script_set_target): Declare.
7654         * options.cc (General_options::string_to_object_format): Rename
7655         from string_to_object_format in anonymous namespace.  Change
7656         callers.
7657         * options.h (class General_options): Declare
7658         string_to_object_format.
7659
7660 2009-06-22  Ian Lance Taylor  <iant@google.com>
7661
7662         * script-sections.cc (Script_sections::create_segments): Don't put
7663         program headers in a PT_LOAD segment if -n or -N.
7664
7665 2009-06-22  Ian Lance Taylor  <iant@google.com>
7666
7667         PR 10141
7668         * options.h (class General_options): Add -z lazy and -z now.  Sort
7669         -z options into alphabetical order.
7670         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7671
7672 2009-06-21  Ian Lance Taylor  <iant@google.com>
7673
7674         * layout.cc (Layout::make_output_section): Call
7675         Target::new_output_section.
7676         (Layout::attach_allocated_section_to_segment): Put large section
7677         sections in a separate load segment with the large segment flag
7678         set.
7679         (Layout::segment_precedes): Sort large data segments after other
7680         load segments.
7681         (align_file_offset): New static function.
7682         (Layout::set_segment_offsets): Use align_file_offset.
7683         * output.h (class Output_section): Add is_small_section_ and
7684         is_large_section_ fields.
7685         (Output_section::is_small_section): New function.
7686         (Output_section::set_is_small_section):  New function.
7687         (Output_section::is_large_section): New function.
7688         (Output_section::set_is_large_section): New function.
7689         (Output_section::is_large_data_section): New function.
7690         (class Output_segment): Add is_large_data_segment_ field.
7691         (Output_segment::is_large_data_segment): New function.
7692         (Output_segment::set_is_large_data_segment): New function.
7693         * output.cc (Output_section::Output_section): Initialize new
7694         fields.
7695         (Output_segment::Output_segment): Likewise.
7696         (Output_segment::add_output_section): Add assertion that large
7697         data sections always go in large data segments.  Force small data
7698         sections to the end of the list of data sections.  Force small BSS
7699         sections to the start of the list of BSS sections.  For large BSS
7700         sections to the end of the list of BSS sections.
7701         * symtab.h (class Symbol): Declare is_common_shndx.
7702         (Symbol::is_defined): Check Symbol::is_common_shndx.
7703         (Symbol::is_common): Likewise.
7704         (class Symbol_table): Define enum Commons_section_type.  Update
7705         declarations.  Add small_commons_ and large_commons_ fields.
7706         * symtab.cc (Symbol::is_common_shndx): New function.
7707         (Symbol_table::Symbol_table): Initialize new fields.
7708         (Symbol_table::add_from_object): Put small and large common
7709         symbols in the right list.
7710         (Symbol_table::sized_finalized_symbol): Check
7711         Symbol::is_common_shndx.
7712         (Symbol_table::sized_write_globals): Likewise.
7713         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7714         common symbol lists.  Don't call do_allocate_commons_list if the
7715         list is empty.
7716         (Symbol_table::do_allocate_commons_list): Remove is_tls
7717         parameter.  Add comons_section_type parameter.  Change all
7718         callers.  Handle small and large common symbols.
7719         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7720         Symbol::is_common_shndx.
7721         * resolve.cc (symbol_to_bits): Likewise.
7722         * target.h (Target::small_common_shndx): New function.
7723         (Target::small_common_section_flags): New function.
7724         (Target::large_common_shndx): New function.
7725         (Target::large_common_section_flags): New function.
7726         (Target::new_output_section): New function.
7727         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7728         small_common_section_flags, and large_common_section_flags
7729         fields.
7730         (Target::do_new_output_section): New virtual function.
7731         * arm.cc (Target_arm::arm_info): Initialize new fields.
7732         * i386.cc (Target_i386::i386_info): Likewise.
7733         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7734         Likewise.
7735         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7736         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7737         (Target_x86_64::do_new_output_section): New function.
7738         * configure.ac: Define conditional MCMODEL_MEDIUM.
7739         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7740         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7741         (large_LDFLAGS): Define.
7742         * testsuite/large.c: New file.
7743         * testsuite/testfile.cc (Target_test::test_target_info):
7744         Initialize new fields.
7745         * configure, testsuite/Makefile.in: Rebuild.
7746
7747 2009-06-05  Doug Kwan  <dougkwan@google.com>
7748
7749         * Makefile.am (CCFILES): Add target.cc.
7750         * Makefile.in: Regenerate.
7751         * i386.cc (class Target_i386): Define new virtual method to
7752         override do_is_local_label_name in parent.
7753         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7754         local symbols if --discard-locals or -X is given.
7755         * options.h (class General_options): Declare new options
7756         '--discard-locals' and '-X' for discarding locals.
7757         * target.h (class Target): Define new methods is_local_label_name.
7758         Declare new virtual method do_is_local_label_name.
7759         * target.cc: New file.
7760         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7761         (check_SCRIPTS): Add discard_locals_test.sh.
7762         (check_DATA): Add discard_local_tests.syms.
7763         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7764         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7765         * testsuite/Makefile.in: Regenerate.
7766         * testsuite/discard_locals_test.c: New file.
7767         * testsuite/discard_locals_test.sh: Same.
7768
7769 2009-06-05  Doug Kwan  <dougkwan@google.com>
7770
7771         * object.cc (Sized_relobj::Sized_relobj): Initialize
7772         discarded_eh_frame_shndx_ to -1U.
7773         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7774         section.
7775         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7776         a discarded .eh_frame section.
7777         (Sized_relobj::do_finalize_local_symbols): Ditto.
7778         * object.h (class Sized_relobj): Declare new member
7779         discarded_eh_frame_shndx_.
7780         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7781         (local_labels_test.o, local_labels_test): New rules.
7782         * testsuite/Makefile.in: Regenerate.
7783
7784 2009-06-04  Doug Kwan  <dougkwan@google.com>
7785
7786         * layout.cc (Layout::section_name_mapping): Add mapping for
7787         special ARM sections.
7788
7789 2009-06-03  Doug Kwan  <dougkwan@google.com>
7790
7791         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7792         (utils::has_overflow): Same.
7793
7794 2009-06-03  Ian Lance Taylor  <iant@google.com>
7795
7796         * layout.cc (Layout::section_name_mapping): New array, replacing
7797         Layout::linkonce_mapping.
7798         (Layout::section_name_mapping_count): New variable, replacing
7799         Layout::linkonce_mapping_count.
7800         (Layout::linkonce_output_name): Remove.
7801         (Layout::output_section_name): Rewrite.
7802         * layout.h (class Layout): Rename Linkonce_mapping to
7803         Section_name_mapping, linkonce_mapping to section_name_mapping,
7804         linkonce_mapping_count to section_name_mapping_count.  Don't
7805         declare linkonce_output_name.
7806
7807 2009-06-03  Doug Kwan  <dougkwan@google.com>
7808
7809         * gold/arm.cc (namespace utils): New.
7810         (Target_arm::reloc_is_non_pic): Define new method.
7811         (class Arm_relocate_functions): New.
7812         (Target_arm::Relocate::relocate): Handle relocation types used by
7813         Android.
7814
7815 2009-06-03  Ian Lance Taylor  <iant@google.com>
7816
7817         * arm.cc (Target_arm::scan::global): Use || instead of |.
7818
7819 2009-06-02  Doug Kwan  <dougkwan@google.com>
7820
7821         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7822         issued_non_pic_error_.
7823         (class Target_arm::Scan): Declare new method check_non_pic.
7824         Define new method symbol_needs_plt_entry.
7825         Declare new data member issued_non_pic_error_.
7826         (class Target_arm::Relocate): Declare new method
7827         should_apply_static_reloc.
7828         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7829         (Target_arm::Scan::check_non_pic): Define new method.
7830         (Target_arm::Scan::local): Handle a small subset of reloc types used
7831         by Android.
7832         (Target_arm::Scan::local): Same.
7833         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7834
7835 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7836
7837         * incremental.cc (Incremental_inputs::report_command_line): Filter
7838         out --incremental-* options.
7839
7840 2009-05-29  Doug Kwan  <dougkwan@google.com>
7841
7842         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7843         template class.
7844         (class Target_arm): Update comment.
7845         (Target_arm::Target_arm): Initialize new data members GOT_,
7846         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7847         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7848         and Target_arm::rel_dyn_section.
7849         Declare new_enum Target_arm::Got_type.
7850         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7851         and DYNBSS_.
7852         Update commments for member do_dynsym_value.
7853         (Target_arm::got_size, Target_arm::plt_section,
7854         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7855         new methods inside class defintion.
7856         (Target_arm::got_section): Define new method.
7857         (Target_arm::rel_dyn_section): Same.
7858         (Output_data_plt_arm): New template class.
7859         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7860         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7861         (Output_data_plt_arm::add_entry): Same.
7862         (Output_data_plt_arm::first_plt_entry): Define new
7863         static data member for PLT instruction template.
7864         (Output_data_plt_arm::plt_entry): Same.
7865         (Output_data_plt_arm::do_write): Define new method.
7866         (Target_arm::make_plt_entry): Same.
7867         (Target_arm::do_finalize_sections): Same.
7868         (Target_arm::do_dynsym_value): Same.
7869
7870 2009-05-28  Doug Kwan  <dougkwan@google.com>
7871
7872         * Makefile.am (TARGETSOURCES): Add arm.cc.
7873         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7874         * Makefile.in: Regenerate.
7875         * arm.cc: New file.
7876         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7877
7878 2009-05-26  Doug Kwan  <dougkwan@google.com>
7879
7880         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7881         (General_options::check_excluded_libs): Strip off directories in
7882         archive name before matching like GNU ld does.
7883         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7884         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7885         (exclude_libs_test_LDFLAGS): Add linker option
7886         -Wl,--exclude-libs,libexclude_libs_test_3
7887         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7888         an explicit archive without using -l.
7889         (alt/libexclude_libs_test_3.a): New make rule.
7890         * testsuite/Makefile.in: Regenerate.
7891         * testsuite/exclude_libs_test.c : Declare lib3_default().
7892         (main): Call it.
7893         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7894         * exclude_libs_test_3.c: New file.
7895
7896 2009-05-26  Nick Clifton  <nickc@redhat.com>
7897
7898         * po/id.po: New Indonesian translation.
7899         * po/gold.pot: Updated template file.
7900
7901 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7902
7903         * testsuite/Makefile.am: Add -ffunction-sections to compile
7904         gc_comdat_test files.  Add -Wl,--gc-sections to build
7905         gc_comdat_test.
7906         * testsuite/Makefile.in: Regenerate.
7907         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7908
7909 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7910
7911         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7912         kept comdat section was garbage collected.
7913         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7914         * testsuite/Makefile.in: Regenerate.
7915         * testsuite/gc_comdat_test.sh: New file.
7916         * testsuite/gc_comdat_test_1.cc: New file.
7917         * testsuite/gc_comdat_test_2.cc: New file.
7918
7919 2009-05-19  Doug Kwan  <dougkwan@google.com>
7920
7921         * archive.cc (Archive::Archive): Move constructor from archive.h
7922         to here.  Initialize no_export_.
7923         (Archive::get_elf_object_for_member): Set no_export flag of object.
7924         * archive.h (Archive::Archive): Move constructor body to
7925         archive.cc.
7926         (Archive::no_export): New method.
7927         (Archive::no_export_): New field.
7928         * object.h (Object::Object): Initialize no_export_ to false.
7929         (Object::no_export, Object::set_no_export): New methods.
7930         (Object::no_export_): New field.
7931         * options.cc (General_options::parse_exclude_libs): New method.
7932         (General_options::check_excluded_libs) Same.
7933         * options.h (exclude_libs): New option.
7934         (General_options::check_excluded_libs): New method declaration.
7935         (General_options::excluded_libs_): New field.
7936         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7937         default or protected visibility if an object has no-export flag set.
7938         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7939         (check_SCRIPTS): Add exclude_libs_test.sh.
7940         (check_DATA): Add exclude_libs_test.syms.
7941         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7942         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7943         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7944         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7945         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7946         libexclude_libs_test_2.a): New rules.
7947         * testsuite/Makefile.in: Regenerate.
7948         * testsuite/exclude_libs_test.c: New file.
7949         * testsuite/exclude_libs_test.sh: Ditto.
7950         * testsuite/exclude_libs_test_1.c: Ditto.
7951         * testsuite/exclude_libs_test_2.c: Ditto.
7952
7953 2009-05-15  Ian Lance Taylor  <iant@google.com>
7954
7955         * configure.ac: Check for declarations for cases where libiberty.h
7956         checks HAVE_DECL_xxx.
7957         * configure, config.in: Rebuild.
7958
7959 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7960
7961         * gold.h (Incremental_argument_list): Remove (invalid) forward
7962         declaration.
7963         * incremental.cc (Incremental_inputs::report_achive): New method.
7964         (Incremental_inputs::report_object): New method.
7965         (Incremental_inputs::report_script): New method.
7966         (Incremental_inputs::finalize_inputs): New method.
7967         (Incremental_inputs::finalize): Call finalize_inputs().
7968         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7969         Create inputs entries.
7970         * incremental.h (Incremental_input_type): New enum.
7971         (Incremental_inputs::Incremental_input): Initialize new fields.
7972         (Incremental_inputs::report_inputs): New method.
7973         (Incremental_inputs::report_achive): New method.
7974         (Incremental_inputs::report_object): New method.
7975         (Incremental_inputs::report_script): New method.
7976         (Incremental_inputs::finalize_inputs): New method.
7977         (Incremental_inputs::Input_info): New struct.
7978         (Incremental_inputs::Input_info_map): New typedef.
7979         (Incremental_inputs::lock_): New field.
7980         (Incremental_inputs::Inputs_): New field.
7981         (Incremental_inputs::Inputs_map): New field.
7982         * main.cc (main): Call Incremental_input::report_inputs.
7983         * options.h (Input_argument_list): Typedef moved from
7984         Input_arguments.
7985         (Input_file_group::Files): Remove, use ::Input_argument_list.
7986         (Input_file_group::Input_argument_list): Remove, use
7987         ::Input_argument_list.
7988         * plugin.cc (Plugin_manager::add_input_file): Add error in
7989         incremental build.
7990         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7991         functions.
7992         * script.cc (read_input_script): Call
7993         Incremental_input::report_script.
7994         * script.h (Script_info): New class.
7995
7996 2009-04-27  Ian Lance Taylor  <iant@google.com>
7997
7998         * x86_64.cc (do_adjust_output_section): Set entsize to
7999         plt_entry_size.
8000
8001 2009-04-23  Elliott Hughes  <enh@google.com>
8002
8003         * output.cc (Output_file::close): After short writes, continue
8004         writing from the correct offset in the buffer being written.
8005
8006 2009-04-23  Chris Demetriou  <cgd@google.com>
8007
8008         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8009         * configure: Regenerate.
8010         * config.in: Regenerate.
8011         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8012         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8013
8014 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8015
8016         * incremental.cc (Incremental_inputs_header_data): Renamed from
8017         Incremental_input_header_data.
8018         (Incremental_inputs_header_data::data_size): New field.
8019         (Incremental_inputs_header_data::put_input_file_count): Renamed
8020         from input_file_count.
8021         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8022         from command_line_offset.
8023         (Incremental_inputs_header_data::put_reserved): Renamed from
8024         put_reserved.
8025         (Incremental_inputs_entry_data): Renamed from
8026         Incremental_input_entry_data.
8027         (Incremental_inputs_entry_data::data_size): New field.
8028         (Incremental_inputs::report_command_line): New method.
8029         (Incremental_inputs::finalize): New method.
8030         (Incremental_inputs::create_incremental_inputs_data): New method.
8031         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8032         * incremental.h: New file.
8033         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8034        (Layout::finalize): Create incremental inputs section in
8035         incremental builds.
8036        (Layout::create_incremental_info_sections): New method.
8037         * layout.h (Layout::incremental_inputs): New method.
8038        (Layout::create_incremental_info_sections): New method.
8039        (Layout::incremental_inputs_): New field.
8040         * main.cc (main): Notify Incremental_input of the command line.
8041
8042 2009-04-01  Ian Lance Taylor  <iant@google.com>
8043             Mikolaj Zalewski  <mikolajz@google.com>
8044
8045         * gold.h (reserve_unordered_map): Define, three versions, one for
8046         each version of Unordered_map.
8047         * layout.cc (Layout::Layout): Remove options parameter.  Add
8048         number_of_input_files parameter.  Don't initialize options_.
8049         Initialize number_of_input_files_ and resized_signatures_.  Move
8050         sections_are_attached_.
8051         (Layout::layout_group): Reserve space for group_signatures_.
8052         (Layout::find_or_add_kept_section): Change name parameter to be a
8053         reference.  Resize signatures_ map when it gets large enough.
8054         (Layout::layout_eh_frame): Use parameters->options() instead of
8055         this->options_.
8056         (Layout::make_output_section): Likewise.
8057         (Layout::attach_allocated_section_to_segment): Likewise.
8058         (Layout::finalize, Layout::create_executable_stack): Likewise.
8059         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8060         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8061         * layout.h (class Layout): Update declarations.  Remove options_
8062         field.  Add number_of_input_files_ and resized_signatures_
8063         fields.  Move sections_are_attached_ field.
8064         * main.cc (main): Pass number of input files to Layout
8065         constructor.  Don't pass options.
8066
8067 2009-03-30  Ian Lance Taylor  <iant@google.com>
8068
8069         * ffsll.c (ffsll): Correct implementation.
8070
8071 2009-03-27  Ian Lance Taylor  <iant@google.com>
8072
8073         * ffsll.c: New file.
8074         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8075         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8076         * ftruncate.c (ftruncate): Declare before definition.
8077         * mremap.c (mremap): Likewise.
8078         * pread.c (pread): Likewise.
8079         * configure, Makefile.in, config.in: Rebuild.
8080
8081         * mremap.c: New file.
8082         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8083         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8084         (mremap): Declare if HAVE_MREMAP is not defined.
8085         * configure, Makefile.in, config.in: Rebuild.
8086
8087 2009-03-27  Cary Coutant  <ccoutant@google.com>
8088
8089         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8090         position independent.
8091         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8092         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8093
8094 2009-03-24  Cary Coutant  <ccoutant@google.com>
8095
8096         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8097         an executable.
8098         (needs_dynamic_reloc): Likewise.
8099
8100 2009-03-24  Ian Lance Taylor  <iant@google.com>
8101
8102         * yyscript.y (file_cmd): Recognize EXTERN.
8103         (extern_name_list, extern_name_list_body): New nonterminals.
8104         * script.cc (script_add_extern): Define.
8105         * script-c.h (script_add_extern): Declare.
8106
8107 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8108
8109         * object.cc (is_elf_object): Define.
8110         * object.h (is_elf_object): Declare.
8111         * archive.cc (Archive::get_elf_object_for_member): Call
8112         is_elf_object.
8113         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8114
8115 2009-03-24  Elliott Hughes  <enh@google.com>
8116
8117         * output.cc (Output_file::map_anonymous): Define.
8118         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8119         try an anonymous one.  Report the size if the mmap fails.
8120         * output.h (class Output_file): Declare map_anonymous.
8121
8122 2009-03-24  Ian Lance Taylor  <iant@google.com>
8123
8124         * target-select.cc (instantiate_target): Don't acquire the lock if
8125         the instantiated_target_ field has already been set.
8126
8127 2009-03-23  Ian Lance Taylor  <iant@google.com>
8128
8129         * gold-threads.h (class Initialize_lock): Define.
8130         * gold-threads.cc (class Initialize_lock_once): Define.
8131         (initialize_lock_control): New static variable.
8132         (initialize_lock_pointer): New static variable.
8133         (initialize_lock_once): New static function.
8134         (Initialize_lock::Initialize_lock): Define.
8135         (Initialize_lock::initialize): Define.
8136         * target-select.h: Include "gold-threads.h".
8137         (class Target_selector): Add lock_ and initialize_lock_ fields.
8138         Don't define instantiate_target, just declare it.
8139         * target-select.cc (Target_selector::Target_selector): Initialize
8140         new fields.
8141         (Target_selector::instantiate_target): Define.
8142         * descriptors.h: Include "gold-threads.h".
8143         (class Descriptors): Add initialize_lock_ field.
8144         * descriptors.cc (Descriptors::Descriptors): Initialize new
8145         field.
8146         (Descriptors::open): Use initialize_lock_ field
8147         * errors.h (class Errors): Add initialize_lock_ field.
8148         * errors.cc (Errors::Errors): Initialize new field.
8149         (Errors::initialize_lock): Use initialize_lock_ field.
8150         * powerpc.cc (class Target_selector_powerpc): Remove
8151         instantiated_target_ field.  In do_recognize call
8152         instantiate_target rather than do_instantiate_target.  In
8153         do_instantiate_target just allocate a new target.
8154         * sparc.cc (class Target_selector_sparc): Likewise.
8155
8156         * freebsd.h: New file.
8157         * i386.cc: Include "freebsd.h".
8158         (Target_i386): Derive from Target_freebsd rather than
8159         Sized_target.
8160         (Target_selector_i386): Derive from Target_selector_freebsd rather
8161         than Target_selector.
8162         * x86_64.cc: Include "freebsd.h".
8163         (Target_x86_64): Derive from Target_freebsd rather than
8164         Sized_target.
8165         (Target_selector_x86_64): Derive from Target_selector_freebsd
8166         rather than Target_selector.
8167         * target.h (class Target): Add adjust_elf_header and
8168         do_adjust_elf_header.
8169         * output.cc (Output_file_header:: do_sized_write): Call target
8170         adjust_elf_header routine.
8171         * configure.tgt: Set targ_osabi.
8172         * configure.ac: Define GOLD_DEFAULT_OSABI.
8173         * parameters.cc (Parameters::default_target): Pass
8174         GOLD_DEFAULT_OSABI to select_target.
8175         * target-select.h (class Target_selector): Make instantiate_target
8176         protected rather than private.
8177         * Makefile.am (HFILES): Add freebsd.h.
8178         * configure, Makefile.in, config.in: Rebuild.
8179
8180         * merge.cc (do_add_input_section): Correct pend value.  Change
8181         message about last entry not being null terminated from error to
8182         warning.
8183
8184 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8185
8186         * incremental.cc: New file.
8187         * Makefile.am (CCFILES): Add incremental.cc.
8188         * Makefile.in: Rebuild.
8189
8190 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8191
8192         * layout.cc (Layout::output_section_name): Preserve names
8193         of '.note.' sections.
8194
8195 2009-03-19  Ian Lance Taylor  <iant@google.com>
8196
8197         * descriptors.cc (Descriptors::open): Check that the options are
8198         valid before using them.
8199
8200 2009-03-18  Ian Lance Taylor  <iant@google.com>
8201
8202         * script-sections.h: Include <list>.
8203         (class Script_sections): Change Sections_elements from std::vector
8204         to std::list.  Typedef public Elements_iterator.  Add
8205         orphan_section_placement_, data_segment_align_start_, and
8206         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8207         field.
8208         * script-sections.cc (class Orphan_section_placement): New class.
8209         (class Sections_element): Add virtual functions is_relro and
8210         orphan_section_init.  Remove virtual function place_orphan_here.
8211         (class Output_section_definition): Add is_relro and
8212         orphan_section_init.  Remove place_orphan_here.
8213         (class Orphan_output_section): Likewise.
8214         (Script_sections::Script_sections): Update for field changes.
8215         (Script_sections::data_segment_align): Set saw_data_segment_align_
8216         and data_segment_align_start_, not data_segment_align_index.
8217         (Script_sections::data_segment_relro_end): Check
8218         saw_data_segment_align_.  Use data_segment_align_start_ rather
8219         than data_segment_align_index_.
8220         (Script_sections::place_orphan): Rewrite to use
8221         Orphan_section_placement.
8222
8223 2009-03-17  Ian Lance Taylor  <iant@google.com>
8224
8225         * archive.cc (Archive::add_symbols): Check for a version attached
8226         to the symbol name in the archive map.
8227         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8228         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8229         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8230         (ver_test_11.a): New target.
8231         * testsuite/Makefile.in: Rebuild.
8232
8233         * configure.ac: Check for chsize and posix_fallocate.  Replace
8234         ftruncate.
8235         * ftruncate.c: New file, from gnulib.
8236         * output.cc (posix_fallocate): Define dummy version if not
8237         HAVE_POSIX_FALLOCATE.
8238         (Output_file::map): Call posix_fallocate rather than lseek and
8239         write.
8240         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8241         * configure, Makefile.in, config.in: Rebuild.
8242
8243 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8244
8245         * layout.h (Layout::create_note): Add section_name parameter.
8246         * layout.cc (Layout::create_note): Likewise.
8247         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8248
8249 2009-03-17  Ian Lance Taylor  <iant@google.com>
8250
8251         * descriptors.cc: Include "options.h".
8252         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8253         (Descriptors::open): Always use O_CLOEXEC when opening a new
8254         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8255         then set FD_CLOEXEC.
8256
8257         * sparc.cc (class Target_sparc): Add has_got_section.
8258         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8259         make sure we have a GOT section.
8260
8261         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8262         (Target_sparc::Scan::local): Likewise.
8263         (Target_sparc::Scan::global): Likewise.
8264         (Target_sparc::Relocate::relocate): Likewise.
8265         (Target_sparc::Relocate::relocate_tls): Likewise.
8266
8267         * symtab.cc (Symbol_table::define_default_version): New function,
8268         broken out of add_from_object.
8269         (Symbol_table::add_from_object): Call define_default_version.
8270         (Symbol_table::define_special_symbol): Add resolve_oldsym
8271         parameter.  Change all callers.  If the version for a symbol comes
8272         from a version script, resolve it with the symbol with the same
8273         name with no version.  Also add the symbol without a version if
8274         appropriate.
8275         (do_define_in_output_data): If resolving with oldsym, don't delete
8276         sym.
8277         (do_define_in_output_segment): Likewise.
8278         (do_define_as_constant): Likewise.
8279         * symtab.h (class Symbol_table): Update declarations.
8280
8281 2009-03-13  Ian Lance Taylor  <iant@google.com>
8282
8283         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8284         (Read_symbols::requeue): New function.
8285         (Read_symbols::do_read_symbols): If make_elf_object fails because
8286         the target type is not configured, and the file was searched for,
8287         issue a warning and retry with the next directory.
8288         (Add_symbols::run): If the file has an incompatible format, and
8289         it was searched for, requeue the Read_symbols task.  On error,
8290         release the object.
8291         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8292         dirindex parameter to constructor.  Change all callers.  Declare
8293         incompatible_warning and requeue.
8294         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8295         input_argument_ and input_group_ fields.  Add them to
8296         constructor.  Change all callers.
8297         (class Read_script): Add dirindex_ field.  Add it to constructor.
8298         Change all callers.
8299         * archive.cc (Archive::setup): Remove input_objects parameter.
8300         Change all callers.
8301         (Archive::get_file_and_offset): Likewise.
8302         (Archive::read_all_symbols): Likewise.
8303         (Archive::read_symbols): Likewise.
8304         (Archive::get_elf_object_for_member): Remove input_objects
8305         parameter.  Add punconfigured parameter.  Change all callers.
8306         (Archive::add_symbols): Change return type to bool.  Check return
8307         value of include_member.
8308         (Archive::include_all_members): Likewise.
8309         (Archive::include_member): Change return type to bool.  Return
8310         false if first included object has incompatible target.  Set
8311         included_member_ field.
8312         (Add_archive_symbols::run): If add_symbols returns false, requeue
8313         Read_symbols task.
8314         * archive.h (class Archive): Add included_member_ field.
8315         Initialize it in constructor.  Add input_file and searched_for
8316         methods.  Update declarations.
8317         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8318         input_argument_ fields.  Add them to constructor.  Change all
8319         callers.
8320         * script.cc: Include "target-select.h".
8321         (class Parser_closure): Add skip_on_incompatible_target_ and
8322         found_incompatible_target_ fields.  Add
8323         skip_on_incompatible_target parameter to constructor.  Change all
8324         callers.  Add methods skip_on_incompatible_target,
8325         clear_skip_on_incompatible_target, found_incompatible_target, and
8326         set_found_incompatible_target.
8327         (read_input_script): Add dirindex parameter.  Change all callers.
8328         If parser finds an incompatible target, requeue Read_symbols
8329         task.
8330         (script_set_symbol): Clear skip_on_incompatible_target in
8331         closure.
8332         (script_add_assertion, script_parse_option): Likewise.
8333         (script_start_sections, script_add_phdr): Likewise.
8334         (script_check_output_format): New function.
8335         * script.h (read_input_script): Update declaration.
8336         * script-c.h (script_check_output_format): Declare.
8337         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8338         (ignore_cmd): Remove OUTPUT_FORMAT.
8339         * fileread.cc (Input_file::Input_file): Add explicit this.
8340         (Input_file::will_search_for): New function.
8341         (Input_file::open): Add pindex parameter.  Change all callers.
8342         * fileread.h (class Input_file): Add input_file_argument method.
8343         Declare will_search_for.  Update declarations.
8344         * object.cc (make_elf_object): Add punconfigured parameter.
8345         Change all callers.
8346         * object.h (class Object): Make input_file public.  Add
8347         searched_for method.
8348         (make_elf_object): Update declaration.
8349         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8350         restart search.
8351         * dirsearch.h (class Dirsearch): Update declaration.
8352         * options.h (class General_options): Add --warn-search-mismatch.
8353         * parameters.cc (Parameters::is_compatible_target): New function.
8354         * parameters.h (class Parameters): Declare is_compatible_target.
8355         * workqueue.cc (Workqueue::add_blocker): New function.
8356         * workqueue.h (class Workqueue): Declare add_blocker.
8357
8358         * fileread.cc (Input_file::open): Remove options parameter.
8359         Change all callers.
8360         (Input_file::open_binary): Likewise.
8361         * script.cc (read_input_script): Likewise.
8362         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8363         options parameter from constructor.  Change all callers.
8364         (class Read_script): Likewise.
8365         * fileread.h (class Input_file): Update declarations.
8366         * script.h (read_input_script): Update declaration.
8367
8368 2009-03-10  Nick Clifton  <nickc@redhat.com>
8369
8370         * po/es.po: New Spanish translation.
8371
8372 2009-03-06  Cary Coutant  <ccoutant@google.com>
8373
8374         * options.cc (parse_short_option): Keep dash_z from registering itself.
8375
8376 2009-03-03  Ian Lance Taylor  <iant@google.com>
8377
8378         PR 9918
8379         * target-reloc.h (relocate_section): Pass output_section to
8380         relocate.
8381         * i386.cc (Target_i386::should_apply_static_reloc): Add
8382         output_section parameter.  Change all callers.
8383         (Target_i386::Relocate::relocate): Add output_section parameter.
8384         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8385         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8386         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8387         * testsuite/two_file_shared.sh: New script.
8388         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8389         (check_DATA): Add two_file_shared.dbg.
8390         (two_file_shared.dbg): New target.
8391         * testsuite/Makefile.in: Rebuild.
8392
8393 2009-03-01  Ian Lance Taylor  <iant@google.com>
8394
8395         * configure.ac: Check for byteswap.h.
8396         * configure: Rebuild.
8397         * config.in: Rebuild.
8398
8399 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8400
8401         * layout.cc (Layout::find_or_add_kept_section): New function.
8402         (Layout::add_comdat): Removed.
8403         * layout.h (struct Kept_section): Move out of class Layout.
8404         Remove trailing underscores from field names.  Add group_sections
8405         field.  Rename group_ field to is_group.  Change all uses.
8406         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8407         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8408         comdat_groups_ field.
8409         (Sized_relobj::include_section_group): Use
8410         find_or_add_kept_section and Kept_section::group_sections.
8411         (Sized_relobj::include_linkonce_section): Likewise.
8412         * object.cc (class Sized_relobj): Don't define Comdat_group or
8413         Comdat_group_table.  Remove find_comdat_group and
8414         add_comdat_group.  Remove comdat_groups_ field.
8415         * plugin.cc (include_comdat_group): Use
8416         Layout::find_or_add_kept_section.
8417
8418 2009-02-28  Ian Lance Taylor  <iant@google.com>
8419
8420         * README: --gc-sections and map files are now supported.  Document
8421         some build requirements.
8422
8423         PR 6992
8424         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8425         relocatable link set the value of the section symbol to zero.
8426         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8427         relocatable link don't include the section address in the local
8428         symbol value.
8429
8430 2009-02-27  Ian Lance Taylor  <iant@google.com>
8431
8432         PR 6811
8433         * options.h (class Search_directory): Add is_system_directory.
8434         (class General_options): Declare is_in_system_directory.
8435         * options.cc (get_relative_sysroot): Make static.
8436         (get_default_sysroot): Make static.
8437         (General_optoins::is_in_system_directory): New function.
8438         * fileread.cc (Input_file::is_in_system_directory): New function.
8439         * fileread.h (class Input_file): Declare is_in_system_directory.
8440         * object.h (class Object): Add is_in_system_directory.
8441         (class Input_objects): Remove system_library_directory_ field.
8442         * object.cc (Input_objects::add_object): Don't set
8443         system_library_directory_.
8444         (input_objects::found_in_system_library_directory): Remove.
8445         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8446         parameter.  Change all callers.
8447         (Symbol_table::sized_write_globals): Likewise.
8448         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8449         Call Object::is_in_system_directory.
8450         * symtab.h (class Symbol_table): Update declarations.
8451
8452         PR 5990
8453         * descriptors.h (Open_descriptor): Add is_on_stack field.
8454         * descriptors.cc (Descriptors::open): If the descriptor is on the
8455         top of the stack, remove it.  Initialize is_on_stack field.
8456         (Descriptors::release): Only add pod to stack if it is not on the
8457         stack already.
8458         (Descriptors::close_some_descriptor): Clear stack_next and
8459         is_on_stack fields.
8460
8461         PR 7091
8462         * output.cc (Output_section::find_starting_output_address): Rename
8463         from starting_output_address; add PADDR parameter; change return
8464         type.
8465         * output.h (class Output_section): Declare
8466         find_starting_output_address instead of starting_output_address.
8467         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8468         section symbol for which we can't find a merge section.
8469
8470         PR 9836
8471         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8472         hidden or internal, force the symbol to be local.
8473         * resolve.cc (Symbol::override_visibility): Define.
8474         (Symbol::override_base): Use override_visibility.
8475         (Symbol_table::resolve): Likewise.
8476         (Symbol::override_base_with_special): Likewise.
8477         (Symbol_table::override_with_special): If the visibility is hidden
8478         or internal, force the symbol to be local.
8479         * symtab.h (class Symbol): Add set_visibility and
8480         override_visibility.
8481         * testsuite/ver_test_1.sh: New file.
8482         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8483         (check_DATA): Add ver_test_1.syms.
8484         (ver_test_1.syms): New target.
8485         * testsuite/Makefile.in: Rebuild.
8486
8487 2009-02-25  Cary Coutant  <ccoutant@google.com>
8488
8489         * layout.cc (Layout::choose_output_section): Don't rename sections
8490         when using a linker script that has a SECTIONS clause.
8491         * Makefile.in: Regenerate.
8492
8493         * testsuite/Makefile.am (script_test_5.sh): New test case.
8494         * testsuite/Makefile.in: Regenerate.
8495         * testsuite/script_test_5.cc: New file.
8496         * testsuite/script_test_5.sh: New file.
8497         * testsuite/script_test_5.t: New file.
8498
8499 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8500
8501         * archive.cc (Archive::include_member): Update calls to add_symbols.
8502         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8503         the Layout argument.
8504         * dynobj.h (do_add_symbols): Add the Layout argument.
8505         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8506         Layout argument.
8507         * object.h (Object::add_symbols): Add the Layout argument.
8508         (Object::do_add_symbols): Add the Layout argument.
8509         (Sized_relobj::do_add_symbols): Add the Layout argument.
8510         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8511         Unify the two versions.
8512         (Add_plugin_symbols): Remove.
8513         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8514         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8515         (Add_plugin_symbols): Remove.
8516         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8517         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8518         (Add_symbols::run): Make it work with Pulginobj.
8519
8520 2009-02-06  Ian Lance Taylor  <iant@google.com>
8521
8522         * object.cc (Sized_relobj::do_layout): Make info message start
8523         with lower case letter.
8524
8525 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8526
8527         * binary.cc: Fix file comment.
8528
8529         * options.h (enum Incremental_disposition): Define.
8530         (class General_options): Add new options: --incremental,
8531         --incremental_changed, --incremental_unchanged,
8532         --incremental_unknown.  Add incremental_disposition_ and
8533         implicit_incremental_ fields.
8534         (General_options::incremental_disposition): New function.
8535         (class Position_dependent_options): Add incremental_disposition
8536         option.
8537         (Position_dependent_options::copy_from_options): Set incremental
8538         dispositions.
8539         * options.cc (General_options::parse_incremental_changed): New
8540         function.
8541         (General_options::parse_incremental_unchanged): New function.
8542         (General_options::parse_incremental_unknown): New function.
8543         (General_options::General_options): Initialize new fields
8544         incremental_disposition_ and implicit_incremental_.
8545         (General_options::finalize): Check for uasge of --incremental-*
8546         without --incremental.
8547
8548 2009-02-06  Chris Demetriou  <cgd@google.com>
8549
8550         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8551         pointer and to report location as the file name associated with
8552         the symbol.
8553         (gold_undefined_symbol_at_location): New function to replace the
8554         old gold_undefined_symbol functionality.
8555         * target-reloc.h (relocate_section): Update to use
8556         gold_undefined_symbol_at_location.
8557         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8558         Call gold_undefined_symbol function rather than gold_error.
8559         * errors.h (Errors::undefined_symbol): Take location as a
8560         string, rather than calculating it from a relocation.
8561         * errors.cc (Errors::fatal): Print "fatal error:" before the
8562         formatted message.
8563         (Errors::error, Errors::error_at_location): Print "error: "
8564         before the formatted message.
8565         (Errors::undefined_symbol): Take location as a string, rather
8566         than calculating it from a relocation.
8567         (gold_undefined_symbol_at_location): New function akin to
8568         old gold_undefined_symbol, calculates location from relocation.
8569         (gold_undefined_symbol): Change to take only a Symbol pointer
8570         and to report location as the file name associated with the symbol.
8571         * testsuite/debug_msg.sh: Update for changed error messages.
8572         * testsuite/undef_symbol.sh: Likewise.
8573
8574 2009-02-04  Duncan Sands  <baldrick@free.fr>
8575
8576         PR 9812
8577         * reduced_debug_output.h
8578         (Output_reduced_debug_abbrev_section::failed): Use format for
8579         gold_warning.
8580         (Output_reduced_debug_info_section::faild): Likewise.
8581
8582 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8583
8584         * script.cc (Lazy_demangler): New class.
8585         (Version_script_info::get_symbol_version_helper): Demangle a
8586         symbol only once.
8587
8588 2009-01-29  Cary Coutant  <ccoutant@google.com>
8589
8590         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8591         to __tls_get_addr.
8592         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8593
8594 2009-01-28  Ian Lance Taylor  <iant@google.com>
8595
8596         * version.cc (version_string): Bump to 1.9.
8597
8598         * gold.h: Include <cstring> and <stdint.h>.
8599         * version.cc: Include <cstdio>.
8600         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8601         warning.
8602         * reduced_debug_output.cc (insert_into_vector): Rename from
8603         Insert_into_vector; change all callers.  Use Swap_unaligned to
8604         avoid aliasing issue; remove union since it is unnecessary.
8605
8606 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8607
8608         * Makefile.am (CCFILES): Add gc.cc.
8609         (HFILES): Add gc.h.
8610         * Makefile.in: Regenerate.
8611         * gold.cc (Gc_runner): New class.
8612         (queue_initial_tasks): Call garbage collection related tasks
8613         when corresponding options are invoked.
8614         (queue_middle_gc_tasks): New function.
8615         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8616         processed early before laying out sections during garbage collection.
8617         * gold.h (queue_middle_gc_tasks): New function.
8618         (is_prefix_of): Move from "layout.cc".
8619         * i386.cc (Target_i386::gc_process_relocs): New function.
8620         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8621         * main.cc (main): Create object of class "Garbage_collection".
8622         * object.cc (Relobj::copy_symbols_data): New function.
8623         (Relobj::is_section_name_included): New function.
8624         (Sized_relobj::do_layout): Allow this function to be called twice
8625         during garbage collection and defer layout of section during the
8626         first call.
8627         * object.h (Relobj::get_symbols_data): New function.
8628         (Relobj::is_section_name_included): New function.
8629         (Relobj::copy_symbols_data): New function.
8630         (Relobj::set_symbols_data): New function.
8631         (Relobj::get_relocs_data): New function.
8632         (Relobj::set_relocs_data): New function.
8633         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8634         (Relobj::gc_process_relocs): New function.
8635         (Relobj::do_gc_process_relocs): New pure virtual function.
8636         (Relobj::sd_): New data member.
8637         (Sized_relobj::is_output_section_offset_invalid): New function.
8638         (Sized_relobj::do_gc_process_relocs): New function.
8639         * options.h (General_options::gc_sections): Modify to not be a no-op.
8640         (General_options::print_gc_sections): New option.
8641         * plugin.cc (Plugin_finish::run): Remove function call to
8642         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8643         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8644         * reloc.cc (Read_relocs::run): Add task to process relocs and
8645         determine unreferenced sections when doing garbage collection.
8646         (Gc_process_relocs): New class.
8647         (Sized_relobj::do_gc_process_relocs): New function.
8648         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8649         sections that are garbage collected.
8650         * reloc.h (Gc_process_relocs): New class.
8651         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8652         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8653         symbols whose corresponding sections are garbage collected.
8654         (Symbol_table::Symbol_table): Add new parameter for the garbage
8655         collection object.
8656         (Symbol_table::gc_mark_undef_symbols): New function.
8657         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8658         (Symbol_table::gc_mark_dyn_syms): New function.
8659         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8660         as garbage.
8661         (Symbol_table::add_from_object): Likewise.
8662         (Symbol_table::add_from_relobj): When building shared objects, do not
8663         treat externally visible symbols as garbage.
8664         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8665         table information for static and relocatable links.
8666         * symtab.h (Symbol_table::set_gc): New function.
8667         (Symbol_table::gc): New function.
8668         (Symbol_table::gc_mark_undef_symbols): New function.
8669         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8670         (Symbol_table::gc_mark_dyn_syms): New function.
8671         (Symbol_table::gc_): New data member.
8672         * target.h (Sized_target::gc_process_relocs): New pure virtual
8673         function.
8674         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8675         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8676
8677 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8678
8679         * options.h (General_options::gc_sections): Define as a no-op for now.
8680         (General_options::no_keep_memory): Ditto.
8681         (General_options::Bshareable): Define.
8682         * options.cc (General_options::finalize): Honor -Bshareable.
8683
8684 2009-01-20  Andreas Schwab  <schwab@suse.de>
8685
8686         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8687         read the value in the contents, since we don't use it.  Use the
8688         template endianness when writing.
8689         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8690
8691 2009-01-19  Andreas Schwab  <schwab@suse.de>
8692
8693         * configure.tgt (powerpc64-*): Fix targ_obj.
8694
8695 2009-01-15  Ian Lance Taylor  <iant@google.com>
8696
8697         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8698         local symbols when stripping all symbols.
8699
8700 2009-01-14  Cary Coutant  <ccoutant@google.com>
8701
8702         * output.cc (Output_reloc): Add explicit instantiations.
8703
8704 2009-01-14  Cary Coutant  <ccoutant@google.com>
8705
8706         * archive.cc (Archive::get_elf_object_for_member): Remove call
8707         to File_read::claim_for_plugin.
8708         * descriptors.cc (Descriptors::open): Remove reference to
8709         is_claimed.
8710         (Descriptors::claim_for_plugin): Remove.
8711         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8712         (Descriptors::is_claimed): Remove.
8713         (claim_descriptor_for_plugin): Remove.
8714         * fileread.cc (File_read::claim_for_plugin): Remove.
8715         * fileread.h (File_read::claim_for_plugin): Remove.
8716         (File_read::descriptor): Reopen descriptor if necessary.
8717         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8718         (Plugin_manager::all_symbols_read): Add task parameter. Change
8719         all callers.
8720         (Plugin_manager::get_input_file): New function.
8721         (Plugin_manager::release_input_file): New function.
8722         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8723         corresponding data member.
8724         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8725         and pass to base constructor. Change all callers.
8726         (get_input_file, release_input_file): New functions.
8727         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8728         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8729         (Plugin_manager::all_symbols_read): Add task parameter.
8730         (Plugin_manager::get_input_file): New function.
8731         (Plugin_manager::release_input_file): New function.
8732         (Plugin_manager::task_): New data member.
8733         (Pluginobj::Pluginobj): Add filesize parameter.
8734         (Pluginobj::filename): New function.
8735         (Pluginobj::descriptor): New function.
8736         (Pluginobj::filesize): New function.
8737         (Pluginobj::filesize_): New data member.
8738         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8739         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8740         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8741
8742         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8743         with archive libraries.
8744         * testsuite/Makefile.in: Regenerate.
8745         * testsuite/plugin_test.c (struct sym_info): New type.
8746         (get_input_file, release_input_file): New static variables.
8747         (onload): Capture new transfer vector entries.
8748         (claim_file_hook): Stop reading at end of file according to filesize.
8749         Factor out parsing of readelf output into separate function.
8750         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8751         APIs and get the source file name from the symbol table.  Convert
8752         source file name to corresponding object file name.  Print info
8753         message when adding new input files.
8754         (parse_readelf_line): New function.
8755         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8756         * testsuite/plugin_test_2.sh: Likewise.
8757         * testsuite/plugin_test_3.sh: Likewise.
8758         * testsuite/plugin_test_4.sh: New test case.
8759
8760 2009-01-07  Ian Lance Taylor  <iant@google.com>
8761
8762         * version.cc (version_string): Bump to 1.8.
8763
8764 2008-12-23  Cary Coutant  <ccoutant@google.com>
8765
8766         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8767         * plugin.cc (Plugin_manager::finish): Rename as
8768         layout_deferred_objects.  Move cleanup to separate function.
8769         (Plugin_manager::cleanup): New function.
8770         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8771         separately.
8772         * plugin.h (Plugin_manager::finish): Rename as
8773         layout_deferred_objects.
8774         (Plugin_manager::cleanup): New function.
8775         (Plugin_manager::cleanup_done): New field.
8776
8777 2008-12-23  Cary Coutant  <ccoutant@google.com>
8778
8779         * plugin.cc (is_visible_from_outside): New function.
8780         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8781         so we don't return "IR only" status for exported symbols or -r links.
8782
8783         * testsuite/Makefile.am (plugin_test_3): New test case.
8784         * testsuite/Makefile.in: Regenerate.
8785         * testsuite/plugin_test_3.sh: New file.
8786
8787 2008-12-22  Cary Coutant  <ccoutant@google.com>
8788
8789         * object.cc (Sized_relobj::layout_section): New function.
8790         (Sized_relobj::do_layout): Defer layout of input sections until after
8791         plugin has provided replacement files.
8792         (Sized_relobj::do_layout_deferred_sections): New function.
8793         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8794         (Relobj::layout_deferred_sections): New function.
8795         (Relobj::do_layout_deferred_sections): New function.
8796         (Sized_relobj::do_layout_deferred_sections): New function.
8797         (Sized_relobj::layout_section): New function.
8798         (Sized_relobj::Deferred_layout): New structure.
8799         (Sized_relobj::deferred_layout_): New field.
8800         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8801         Change all callers.  Layout deferred sections.
8802         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8803         references.
8804         (Plugin_hook::run): Move code from do_plugin_hook inline.
8805         (Plugin_hook::do_plugin_hook): Remove.
8806         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8807         (Plugin_manager::finish): Renamed, was cleanup.
8808         (Plugin_manager::should_defer_layout): New function.
8809         (Plugin_manager::add_deferred_layout_object): New function.
8810         (Plugin_manager::Deferred_layout_list): New type.
8811         (Plugin_manager::deferred_layout_objects_): New field.
8812         (Plugin_hook::do_plugin_hook): Remove.
8813
8814 2008-12-17  Ian Lance Taylor  <iant@google.com>
8815
8816         * options.h (class General_options): Add --no case for
8817         --export-dynamic.
8818
8819 2008-12-16  Cary Coutant  <ccoutant@google.com>
8820
8821         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8822         vector.
8823         (Plugin_manager::claim_file): Create plugin object even if
8824         plugin did not call the add_symbols callback.
8825         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8826         asking for more symbols than were added.
8827         * testsuite/Makefile.am (plugin_test_1): Add test case with
8828         no global symbols.
8829         (empty.syms): New target.
8830         * testsuite/Makefile.in: Regenerate.
8831         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8832         message. Don't call add_symbols if no globals.
8833         (all_symbols_read_hook): Don't provide replacement for empty
8834         claimed file.
8835
8836 2008-12-12  Ian Lance Taylor  <iant@google.com>
8837
8838         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8839         r_type == 0 for a local symbol with r_sym == 0.
8840         (scan_relocatable_relocs): Pass r_sym to
8841         local_non_section_strategy.
8842         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8843         r_sym parameter.
8844
8845         * configure.ac: Update test for TLS descriptors: they are
8846         supported as of glibc 2.9.
8847         * configure: Rebuild.
8848
8849 2008-12-11  Ian Lance Taylor  <iant@google.com>
8850
8851         PR 7091
8852         * target-reloc.h (Default_scan_relocatable_relocs): For each
8853         function, map r_type == 0 to RELOC_DISCARD.
8854
8855 2008-12-10  Cary Coutant  <ccoutant@google.com>
8856
8857         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8858         object to override a kept COMDAT group from a plugin object.
8859
8860 2008-12-09  Ian Lance Taylor  <iant@google.com>
8861
8862         PR 7088
8863         * yyscript.y (file_cmd): Handle INPUT.
8864
8865         * testsuite/initpri1.c: Change all declarations to be full
8866         prototypes by adding void, to avoid compiler warnings.
8867
8868 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8869
8870         * options.cc (General_options::parse_plugin_opt): New.
8871         (General_options::add_plugin): The argument now is just the filename.
8872         (General_options::add_plugin_option): New.
8873         * options.h (plugin_opt): New.
8874         (add_plugin): Change argument name.
8875         (add_plugin_option): New.
8876         * plugin.cc (Plugin::load): Don't parse the plugin option.
8877         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8878         (Plugin::add_option): New.
8879         (Plugin::args_): Change type.
8880         (Plugin::filename_): New.
8881         (Plugin_manager::add_plugin_option): New.
8882         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8883         * testsuite/Makefile.in: Regenerate.
8884
8885 2008-12-05  Cary Coutant  <ccoutant@google.com>
8886
8887         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8888         Handle --strip-lto-sections option.
8889         * options.h (strip_lto_sections): New option.
8890
8891 2008-12-01  Cary Coutant  <ccoutant@google.com>
8892
8893         * plugin.cc (ld_plugin_message): Change format parameter to const.
8894         Fix mismatch between new[] and delete.
8895
8896 2008-11-14  Cary Coutant  <ccoutant@google.com>
8897
8898         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8899         instead of -1U.
8900
8901 2008-11-05  Craig Silverstein  <csilvers@google.com>
8902
8903         * options.cc (General_options::parse_dynamic_list): New function.
8904         * options.h (General_options): New flags dynamic_list,
8905         dynamic_list_data, dynamic_list_cpp_new, and
8906         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8907         (General_options::in_dynamic_list): New function.
8908         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8909         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8910         (Lex::can_continue_name): Likewise.
8911         (yylex): Likewise.
8912         (read_script_file): New parameter script_options.
8913         (read_dynamic_list): New function.
8914         (Script_options::define_dynamic_list): New function.
8915         (dynamic_list_keyword_parsecodes): New variable.
8916         (dynamic_list_keywords): New variable.
8917         * script.h (Script_options::define_dynamic_list): New function
8918         prototype.
8919         (read_dynamic_list): New function prototype.
8920         * symtab.cc (strprefix): New macro.
8921         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8922         dynamic_list_data, dynamic_list_cpp_new, and
8923         dynamic_list_cpp_typeinfo.
8924         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8925         (dynamic_list_expr): New rule.
8926         (dynamic_list_nodes): Likewise.
8927         (dynamic_list_node): Likewise.
8928         * testsuite/Makefile.am (dynamic_list): New test.
8929         * testsuite/Makefile.in: Regenerated.
8930         * testsuite/dynamic_list.t: New file.
8931         * testsuite/dynamic_list.sh: New file.
8932
8933 2008-11-05  Craig Silverstein  <csilvers@google.com>
8934
8935         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8936         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8937         (t11_last): Likewise.
8938         * testsuite/ver_test_6.c (main): Likewise.
8939
8940 2008-10-07  Cary Coutant  <ccoutant@google.com>
8941
8942         * options.c (General_options::finalize): Add check for -static and
8943         -shared.
8944         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8945         is not empty.
8946
8947 2008-10-02  Cary Coutant  <ccoutant@google.com>
8948
8949         * plugin.cc (make_sized_plugin_object): Fix conditional
8950         compilation to work when not all targets are enabled.
8951
8952 2008-09-29  Cary Coutant  <ccoutant@google.com>
8953
8954         * archive.cc (Archive::get_file_and_offset): Use filename instead
8955         of name to get library path.
8956         (Archive::include_member): Unlock external member of a thin archive.
8957
8958         * testsuite/Makefile.am (TEST_AR): New variable.
8959         (thin_archive_test_1): New test.
8960         (thin_archive_test_2): New test.
8961         * testsuite/Makefile.in: Regenerate.
8962         * testsuite/thin_archive_main.cc: New file.
8963         * testsuite/thin_archive_test_1.cc: New file.
8964         * testsuite/thin_archive_test_2.cc: New file.
8965         * testsuite/thin_archive_test_3.cc: New file.
8966         * testsuite/thin_archive_test_4.cc: New file.
8967
8968 2008-09-29  Cary Coutant  <ccoutant@google.com>
8969
8970         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8971         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8972         instead of -1U.
8973         (Sized_relobj::do_finalize_local_symbols): Likewise.
8974         (Sized_relobj::map_to_kept_section): Likewise.
8975         * object.h (Sized_relobj::invalid_address): New constant.
8976         (Sized_relobj::do_output_section_offset): Check for invalid_address
8977         and return -1ULL.
8978         * output.cc (Output_reloc::local_section_offset): Use constant
8979         invalid_address instead of -1U.
8980         (Output_reloc::get_address): Likewise.
8981         (Output_section::output_address): Change -1U to -1ULL.
8982         * output.h (Output_reloc::invalid_address): New constant.
8983         * reloc.cc (Sized_relobj::write_sections): Use constant
8984         invalid_address instead of -1U.
8985         (Sized_relobj::relocate_sections): Likewise.
8986         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8987         values for merge sections.
8988         * target-reloc.h (relocate_for_relocatable): Use constant
8989         invalid_address instead of -1U.
8990
8991 2008-09-19  Cary Coutant  <ccoutant@google.com>
8992
8993         Add plugin functionality for link-time optimization (LTO).
8994         * configure.ac (plugins): Add --enable-plugins option.
8995         * configure: Regenerate.
8996         * config.in: Regenerate.
8997         * Makefile.am (LIBDL): New variable.
8998         (CCFILES): Add plugin.cc.
8999         (HFILES): Add plugin.h.
9000         (ldadd_var): Add LIBDL.
9001         * Makefile.in: Regenerate.
9002
9003         * archive.cc: Include "plugin.h".
9004         (Archive::setup): Don't preread archive symbols when using a plugin.
9005         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9006         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9007         files.
9008         (Archive::include_member): Add symbols from plugin objects.
9009         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9010         * descriptors.cc (Descriptors::open): Check for file descriptors
9011         abandoned by plugins.
9012         (Descriptors::claim_for_plugin): New function.
9013         * descriptors.h (Descriptors::claim_for_plugin): New function.
9014         (Open_descriptor::is_claimed): New field.
9015         (claim_descriptor_for_plugin): New function.
9016         * fileread.cc (File_read::claim_for_plugin): New function.
9017         * fileread.h (File_read::claim_for_plugin): New function.
9018         (File_read::descriptor): New function.
9019         * gold.cc: Include "plugin.h".
9020         (queue_initial_tasks): Add task to call plugin hooks for generating
9021         new object files.
9022         * main.cc: Include "plugin.h".
9023         (main): Load plugin libraries.
9024         * object.h (Pluginobj): Declare.
9025         (Object::pluginobj): New function.
9026         (Object::do_pluginobj): New function.
9027         (Object::set_target): New function.
9028         * options.cc: Include "plugin.h".
9029         (General_options::parse_plugin): New function.
9030         (General_options::General_options): Initialize plugins_ field.
9031         (General_options::add_plugin): New function.
9032         * options.h (Plugin_manager): Declare.
9033         (General_options): Add --plugin option.
9034         (General_options::has_plugins): New function.
9035         (General_options::plugins): New function.
9036         (General_options::add_plugin): New function.
9037         (General_options::plugins_): New field.
9038         * plugin.cc: New file.
9039         * plugin.h: New file.
9040         * readsyms.cc: Include "plugin.h".
9041         (Read_symbols::do_read_symbols): Check for archive before checking
9042         for ELF file.  Call plugin hooks to claim files.
9043         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9044         from a real object file; force override when processing replacement
9045         files.
9046         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9047         (Symbol::init_base_object): Likewise.
9048         (Symbol::init_base_output_data): Likewise.
9049         (Symbol::init_base_output_segment): Likewise.
9050         (Symbol::init_base_constant): Likewise.
9051         (Symbol::init_base_undefined): Likewise.
9052         (Symbol::output_section): Assert that object is not a plugin.
9053         (Symbol_table::add_from_pluginobj): New function.
9054         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9055         undefined.
9056         (Symbol_table::sized_write_globals): Likewise.
9057         (Symbol_table::add_from_pluginobj): Instantiate template.
9058         * symtab.h (Sized_pluginobj): Declare.
9059         (Symbol::in_real_elf): New function.
9060         (Symbol::set_in_real_elf): New function.
9061         (Symbol::in_real_elf_): New field.
9062         (Symbol_table::add_from_pluginobj): New function.
9063
9064         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9065         (LIBDL): New variable.
9066         (LDADD): Add LIBDL.
9067         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9068         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9069         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9070         (MOSTLYCLEANFILES): Likewise.
9071         * testsuite/Makefile.in: Regenerate.
9072         * testsuite/plugin_test.c: New file.
9073         * testsuite/plugin_test_1.sh: New file.
9074         * testsuite/plugin_test_2.sh: New file.
9075
9076 2008-09-16  Ian Lance Taylor  <iant@google.com>
9077
9078         * target-reloc.h (relocate_section): Check whether a symbol is
9079         defined by the ABI before reporting an undefined symbol error.
9080         * target.h (Target::is_defined_by_abi): Make parameter const.
9081         (Target::do_is_defined_by_abi): Likewise.
9082         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9083         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9084         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9085         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9086         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9087         * testsuite/Makefile.in: Rebuild.
9088
9089         * fileread.cc (make_view): Add casts to avoid warning.
9090
9091 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9092
9093         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9094         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9095
9096 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9097
9098         * options.h (General_options::output_is_executable): New.
9099         (General_options::output_is_pie): New.
9100         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9101         for shared libraries.
9102         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9103
9104 2008-09-11  Chris Demetriou  <cgd@google.com>
9105
9106         * options.h (origin): New -z option.
9107         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9108         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9109         in DT_FLAGS_1.
9110
9111 2008-09-05  Cary Coutant  <ccoutant@google.com>
9112
9113         * fileread.cc (File_read::make_view): Add check for attempt to map
9114         beyond end of file.
9115
9116 2008-09-05  Cary Coutant  <ccoutant@google.com>
9117
9118         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9119         explicit instantiations.
9120
9121 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9122
9123         PR gold/6858
9124         * options.cc (General_options::finalize): Allow undefined symbols
9125         in shlibs if linking -shared.
9126
9127         PR gold/6859
9128         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9129         symbols as not needing a dynsym entry.
9130
9131 2008-08-20  Craig Silverstein  <csilvers@google.com>
9132
9133         * fileread.cc (File_read::open): Do not lock the file unless it
9134         was successfully opened.
9135
9136 2008-08-14  Cary Coutant  <ccoutant@google.com>
9137
9138         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9139         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9140         * testsuite/tls_test.cc (struct int128): 128-bit struct
9141         for testing TLS relocs with non-zero addend.
9142         (v12): New TLS variable.
9143         (t12): New test.
9144         (t_last): Add check for v12.
9145         * testsuite/tls_test.h (t12): New function.
9146         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9147
9148 2008-08-13  Ian Lance Taylor  <iant@google.com>
9149
9150         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9151         set tls_segment_ or relro_segment_.
9152         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9153         when appropriate.
9154         * output.h (Output_section::clear_is_relro): New function.
9155         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9156         sections specially even when output_data_ is empty.
9157         (Output_segment::maximum_alignment): When first section is relro,
9158         only force alignment for PT_LOAD segments.
9159         * script.cc (script_data_segment_align): New function.
9160         (script_data_segment_relro_end): New function.
9161         * script-c.h (script_data_segment_align): Declare.
9162         (script_data_segment_relro_end): Declare.
9163         * script-sections.h (class Script_sections): Declare
9164         data_segment_align and data_segment_relro_end.  Add fields
9165         segment_align_index_ and saw_relro_end_.
9166         * script-sections.cc (class Sections_element): Add set_is_relro
9167         virtual function.  Add new bool* parameter to place_orphan_here.
9168         Add get_output_section virtual function.
9169         (class Output_section_definition): Add set_is_relro.  Add new
9170         bool* parameter to place_orphan_here.  Add get_output_section.
9171         Add is_relro_ field.
9172         (Output_section_definition::Output_section_definition): Initialize
9173         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9174         and is_relro_ fields.
9175         (Output_section_definition::place_orphan_here): Add is_relro
9176         parameter.
9177         (Output_section_definition::set_section_addresses): Set relro for
9178         output section.
9179         (Output_section_definition::alternate_constraint): Likewise.
9180         (class Orphan_output_section): Add new bool* parameter to
9181         place_orphan_here.  Add get_output_section.
9182         (Orphan_output_section::place_orphan_here): Add is_relro
9183         parameter.
9184         (Script_sections::Script_sections): Initialize
9185         data_segment_align_index_ and saw_relro_end_.
9186         (Script_sections::data_segment_align): New function.
9187         (Script_sections::data_segment_relro_end): New function.
9188         (Script_sections::place_orphan): Set or clear is_relro.
9189         (Script_sections::set_section_addresses): Force alignment of first
9190         TLS section.
9191         * yyscript.y (exp): Call script_data_segment_align and
9192         script_data_segment_relro_end.
9193         * testsuite/relro_script_test.t: New file.
9194         * testsuite/relro_test.cc (using_script): Declare.
9195         (t1, t2): Test using_script.
9196         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9197         (relro_script_test_SOURCES): Define.
9198         (relro_script_test_DEPENDENCIES): Define.
9199         (relro_script_test_LDFLAGS): Define.
9200         (relro_script_test_LDADD): Define.
9201         (relro_script_test.so): New target.
9202         * testsuite/Makefile.in: Rebuild.
9203
9204 2008-08-06  Cary Coutant <ccoutant@google.com>
9205
9206         * archive.cc (Archive::total_archives, Archive::total_members)
9207         (Archive::total_members_loaded): New variables.
9208         (Archive::setup): Add parameter.  Add option to preread
9209         archive symbols.
9210         (Archive::read_armap): Add counter.
9211         (Archive::get_file_and_offset): New function.
9212         (Archive::get_elf_object_for_member): New function.
9213         (Archive::read_all_symbols): New function.
9214         (Archive::read_symbols): New function.
9215         (Archive::add_symbols): Add counters.
9216         (Archive::include_all_members): Use armap to find members if it's
9217         already built.
9218         (Archive::include_member): Skip reading symbols if already read.
9219         Factored code into Archive::get_file_and_offset and
9220         Archive::get_elf_object_for_member.  Changed call to
9221         Mapfile::report_include_archive_member.
9222         (Archive::print_stats): New function.
9223         * archive.h: Declare Object and Read_symbols_data classes.
9224         (Archive::Archive): Add initializers for new members.
9225         (Archive::setup): Add parameter.
9226         (Archive::print_stats): New function.
9227         (Archive::total_archives, Archive::total_members)
9228         (Archive::total_members_loaded): New variables.
9229         (Archive::get_file_and_offset): New function.
9230         (Archive::get_elf_object_for_member): New function.
9231         (Archive::read_all_symbols): New function.
9232         (Archive::read_symbols): New function.
9233         (Archive::Archive_member): New class.
9234         (Archive::members_): New member.
9235         (Archive::num_members_): New member.
9236         * main.cc: Include archive.h.
9237         (main): Call Archive::print_stats.
9238         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9239         archive parameter; member_name is now the fully-decorated name.
9240         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9241         * options.h: (General_options): Add --preread-archive-symbols option.
9242         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9243         Archive::setup.
9244
9245 2008-08-04  Ian Lance Taylor  <iant@google.com>
9246
9247         * symtab.h (Symbol::use_plt_offset): New function.
9248         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9249         * powerpc.cc (Relocate::relocate): Likewise.
9250         * sparc.cc (Relocate::relocate): Likewise.
9251         * x86_64.cc (Relocate::relocate): Likewise.
9252         * testsuite/weak_plt.sh: New test.
9253         * testsuite/weak_plt_main.cc: New test.
9254         * testsuite/weak_plt_shared.cc: New test.
9255         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9256         (check_PROGRAMS): Add weak_plt.
9257         (check_DATA): Add weak_plt_shared.so.
9258         (weak_plt_main_pic.o, weak_plt): New targets.
9259         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9260         * testsuite/Makefile.in: Rebuild.
9261
9262         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9263         gcctestdir/ld.
9264         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9265         * testsuite/Makefile.in: Rebuild.
9266
9267 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9268
9269         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9270         * Makefile.in: Regenerate.
9271         * po/POTFILES.in: Regenerate.
9272
9273 2008-07-29  Ian Lance Taylor  <iant@google.com>
9274
9275         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9276         symbols before other symbols.
9277         * testsuite/script_test_2.cc (test_addr): Declare.
9278         (test_addr_alias): Declare.
9279         (main): Check that test_addr and test_addr_alias have the right
9280         values.
9281         * testsuite/script_test_2.t: Define test_addr_alias and
9282         test_addr.
9283
9284 2008-07-24  Ian Lance Taylor  <iant@google.com>
9285
9286         PR 5990
9287         * descriptors.cc: New file.
9288         * descriptors.h: New file.
9289         * gold-threads.h (class Hold_optional_lock): New class.
9290         * fileread.cc: Include "descriptors.h".
9291         (File_read::~File_read): Release descriptor rather than closing
9292         it.
9293         (File_read::open) [file]: Call open_descriptor rather than open.
9294         Set is_descriptor_opened_.
9295         (File_read::open) [memory]: Assert that descriptor is not open.
9296         (File_read::reopen_descriptor): New function.
9297         (File_read::release): Release descriptor.
9298         (File_read::do_read): Make non-const.  Reopen descriptor.
9299         (File_read::read): Make non-const.
9300         (File_read::make_view): Reopen descriptor.
9301         (File_read::do_readv): Likewise.
9302         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9303         Update declarations.
9304         * layout.cc: Include "descriptors.h".
9305         (Layout::create_build_id): Use open_descriptor rather than open.
9306         * output.cc: Include "descriptors.h".
9307         (Output_file::open): Use open_descriptor rather than open.
9308         * archive.cc (Archive::const_iterator): Change Archive to be
9309         non-const.
9310         (Archive::begin, Archive::end): Make non-const.
9311         (Archive::count_members): Likewise.
9312         * archive.h (class Archive): Update declarations.
9313         * object.h (Object::read): Make non-const.
9314         * Makefile.am (CCFILES): Add descriptors.cc.
9315         (HFILES): Add descriptors.h.
9316         * Makefile.in: Rebuild.
9317
9318         PR 6716
9319         * gold.h: Always include <clocale>.  Add Solaris workarounds
9320         following code in binutils/sysdep.h.
9321
9322         PR 6048
9323         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9324         this->eh_frame_hdr_ is NULL before using it.
9325
9326         * dynobj.cc (Versions::Versions): Update comment.
9327
9328         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9329         the base version name.
9330
9331         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9332         array size plus one.
9333         (Stringpool_template::set_string_offsets): Subtract one from key
9334         before using it as an array index.
9335         (Stringpool_template::get_offset_with_length): Likewise.
9336         (Stringpool_template::write_to_buffer): Likewise.
9337         * stringpool.h (Stringpool_template::get_offset_from_key):
9338         Likewise.
9339
9340 2008-07-23  Ian Lance Taylor  <iant@google.com>
9341
9342         PR 6658
9343         * object.h (Merged_symbol_value::value): Do our best to handle a
9344         negative addend.
9345
9346         PR 6647
9347         * script.cc (Version_script_info::get_versions): Don't add empty
9348         version tag to return value.
9349         (Version_script_info::get_symbol_version_helper): Change return
9350         type to bool.  Add pversion parameter.  Change all callers.
9351         (script_register_vers_node): Don't require a non-NULL tag.
9352         * script.h (class Version_script_info): Update declarations.
9353         (Version_script_info::get_symbol_version): Change return type to
9354         bool.  Add version parameter.  Change all callers.
9355         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9356         handling.  Handle an empty version from a version script.
9357         (Symbol_table::define_special_symbol): Likewise.
9358         * testsuite/ver_test_10.script: New file.
9359         * testsuite/ver_test_10.sh: New file.
9360         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9361         (check_DATA): Add ver_test_10.syms.
9362         (ver_test_10.syms, ver_test_10.so): New target.
9363         * testsuite/Makefile.in: Rebuild.
9364
9365 2008-07-23  Simon Baldwin  <simonb@google.com>
9366
9367         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9368         to zero for undefined symbols from dynamic libraries.
9369
9370 2008-07-23  Ian Lance Taylor  <iant@google.com>
9371
9372         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9373         Change all callers.
9374         * symtab.h (class Symbol_table): Update declaration.
9375         * testsuite/ver_test_9.cc: New file.
9376         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9377         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9378         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9379         (ver_test_9.so, ver_test_9.o): New targets.
9380         * testsuite/Makefile.in: Rebuild.
9381
9382 2008-07-22  Ian Lance Taylor  <iant@google.com>
9383
9384         * options.h (class General_options): Define --check-sections.
9385         * layout.cc (Layout::set_segment_offsets): Handle
9386         --check-sections.
9387
9388         * options.h (class General_options): Define -n/--nmagic and
9389         -N/--omagic.
9390         * options.cc (General_options::finalize): For -n/--nmagic or
9391         -N/--omagic, set -static.
9392         * layout.cc (Layout::attach_allocated_section_to_segment): If
9393         -N/--omagic, don't put read-only and read-write sections in
9394         different segments.
9395         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9396         finding a read-only segment.
9397         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9398         don't set the minimum segment alignment to the common page size,
9399         and don't set the file offset to the address modulo the page size.
9400         * script-sections.cc (Script_sections::create_segments): If
9401         -n/--omagic, don't put read-only and read-write sections in
9402         different segments.
9403
9404         * cref.cc: New file.
9405         * cref.h: New file.
9406         * options.h (class General_options): Add --print-symbol-counts.
9407         * main.cc (main): Issue defined symbol report if requested.
9408         * archive.cc (Archive::interpret_header): Make into a const member
9409         function.
9410         (Archive::add_symbols): Call Input_objects::archive_start and
9411         archive_stop.
9412         (Archive::const_iterator): Define new class.
9413         (Archive::begin, Archive::end): New functions.
9414         (Archive::include_all_members): Rewrite to use iterator.
9415         (Archive::count_members): New function.
9416         * archive.h (class Archive): Update declarations.
9417         (Archive::filename): New function.
9418         * object.cc: Include "cref.h".
9419         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9420         (Sized_relobj::do_get_global_symbol_counts): New function.
9421         (Input_objects::add_object): Add object to cross-referencer.
9422         (Input_objects::archive_start): New function.
9423         (Input_objects::archive_stop): New function.
9424         (Input_objects::print_symbol_counts): New function.
9425         * object.h: Declare Cref and Archive.
9426         (Object::get_global_symbol_counts): New function.
9427         (Object::do_get_global_symbol_counts): New pure virtual function.
9428         (class Sized_relobj): Add defined_count_ field.  Update
9429         declarations.
9430         (class Input_objects): Add cref_ field.  Update constructor.
9431         Update declarations.
9432         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9433         defined_count_.
9434         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9435         symbol counts.
9436         (Sized_dynobj::do_get_global_symbol_counts): New function.
9437         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9438         defined_count_.  Update declarations.  Define Symbols typedef.
9439         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9440         parameter.  Change all callers.
9441         (Symbol_table::add_from_dynobj): Add sympointers and defined
9442         parameters.  Change all callers.
9443         * symtab.h (class Symbol_table): Update declarations.
9444         * Makefile.am (CCFILES): Add cref.cc.
9445         (HFILES): Add cref.h.
9446         * Makefile.in: Rebuild.
9447
9448 2008-07-22  Simon Baldwin  <simonb@google.com>
9449
9450         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9451         to zero when writing undefined symbols.
9452
9453 2008-07-22  Ian Lance Taylor  <iant@google.com>
9454
9455         * output.cc (Output_section::add_input_section): Don't try to
9456         merge empty merge sections.
9457
9458 2008-07-21  Craig Silverstein  <csilvers@google.com>
9459
9460         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9461         Include symbol version in error message.
9462
9463 2008-07-20  Chris Demetriou  <cgd@google.com>
9464
9465         * configure.ac (gold_cv_c_random_seed): New configured variable.
9466         (RANDOM_SEED_CFLAGS): New substituted variable.
9467         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9468         * configure: Rebuild.
9469         * Makefile.in: Likewise.
9470         * testsuite/Makefile.in: Likewise.
9471
9472 2008-07-18  Ian Lance Taylor  <iant@google.com>
9473
9474         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9475         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9476         * testsuite/ver_test_main.cc (main): Call t4.
9477         (t4, t4_2a): Define.
9478         * testsuite/ver_test_2.cc (t4_2): Define.
9479         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9480         * testsuite/ver_test_4.cc (t4_2a): Define.
9481         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9482         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9483
9484 2008-07-17  Ian Lance Taylor  <iant@google.com>
9485
9486         * dynobj.cc (Versions::add_def): If we give an error about a
9487         missing version, go ahead and create the version anyhow.
9488
9489 2008-07-10  Ian Lance Taylor  <iant@google.com>
9490
9491         Handle output sections with more than 0x7fffffff bytes.
9492         * object.h (class Relobj): Change map_to_output_ to
9493         output_sections_, and just keep a section pointer.  Change all
9494         uses.  Move comdat group support to Sized_relobj.
9495         (Relobj::is_section_specially_mapped): Remove.
9496         (Relobj::output_section): Remove poff parameter.  Change all
9497         callers.
9498         (Relobj::output_section_offset): New function.
9499         (Relobj::set_section_offset): Rewrite.
9500         (Relobj::map_to_output): Remove.
9501         (Relobj::output_sections): New function.
9502         (Relobj::do_output_section_offset): New pure virtual function.
9503         (Relobj::do_set_section_offset): Likewise.
9504         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9505         group support from Relobj.  Update declarations.
9506         (Sized_relobj::get_output_section_offset): New function.
9507         (Sized_relobj::do_output_section_offset): New function.
9508         (Sized_relobj::do_set_section_offset): New function.
9509         * object.cc (Relobj::output_section_address): Remove.
9510         (Sized_relobj::Sized_relobj): Initialize new fields.
9511         (Sized_relobj::include_section_group): Cast find_kept_object to
9512         Sized_relobj.
9513         (Sized_relobj::include_linkonce_section): Likewise.
9514         (Sized_relobj::do_layout): Use separate arrays for output section
9515         and output offset.
9516         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9517         output_sections.
9518         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9519         output_sections and section_offsets.
9520         (Sized_relobj::write_local_symbols): Likewise.
9521         (map_to_kept_section): Compute output address directly.
9522         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9523         output_sections and section_offsets.
9524         (Sized_relobj::write_sections): Likewise.
9525         (Sized_relobj::relocate_sections): Likewise.
9526         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9527         * output.h (class Output_reloc): Update declarations.  Change
9528         u2_.relobj to Sized_relobj*.
9529         (class Output_data_reloc): Change add functions to use
9530         Sized_relobj*.
9531         * output.cc (Output_reloc::Output_reloc): Change relobj to
9532         Sized_relobj*.
9533         (Output_reloc::local_section_offset): Change return type to
9534         Elf_Addr.  Use get_output_section_offset.
9535         (Output_reloc::get_address): Likewise.
9536         (Output_section::is_input_address_mapped): Don't call
9537         is_section_specially_mapped.
9538         (Output_section::output_offset): Likewise.
9539         (Output_section::output_address): Likewise.
9540         (Output_section::starting_output_address): Likewise.
9541         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9542         parameter to Sized_relobj*.
9543         (Copy_relocs::need_copy_reloc): Likewise.
9544         (Copy_relocs::save): Likewise.
9545         * copy-relocs.h (class Copy_relocs): Update declarations.
9546         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9547         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9548         * target-reloc.h (relocate_for_relocatable): Change
9549         offset_in_output_section type to Elf_Addr.  Change code that uses
9550         it as well.
9551         * layout.cc (Layout::layout): Always set *off.
9552         * mapfile.cc (Mapfile::print_input_section): Use
9553         output_section_offset.
9554         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9555         Sized_relobj*.
9556         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9557         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9558         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9559
9560 2008-07-03  Ian Lance Taylor  <iant@google.com>
9561
9562         * layout.cc (Layout::include_section): Do not discard unrecognized
9563         SHT_STRTAB sections.
9564
9565 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9566
9567         * script.cc (Lex::can_continue_name): Make '?' allowable in
9568         version-script names.
9569         * testsuite/version_script.map: Change glob pattern to use '?'
9570
9571 2008-06-30  Manish Singh  <yosh@gimp.org>
9572
9573         PR 6585
9574         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9575         Correct typo.
9576
9577 2008-06-30  Ian Lance Taylor  <iant@google.com>
9578
9579         PR 6660
9580         PR 6682
9581         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9582         versions]: Don't try to read the value in the contents, since we
9583         don't use it.  Use the template endianness when writing.
9584
9585 2008-06-25  Cary Coutant  <ccoutant@google.com>
9586
9587         * fileread.cc (File_read::make_view): Assert on zero-length view.
9588         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9589         symbol table when there are no symbols to read.
9590
9591 2008-06-23  Craig Silverstein  <csilvers@google.com>
9592
9593         * version.cc (version_string): Bump to 1.7
9594
9595 2008-06-18  Craig Silverstein  <csilvers@google.com>
9596
9597         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9598         constant 0xFFFF to type Valtype.
9599         (Powerpc_relocate_functions::rel16_ha): Likewise.
9600
9601 2008-06-17  Ian Lance Taylor  <iant@google.com>
9602
9603         * output.h (Output_section::Input_section): Initialize p2align_ to
9604         zero for Output_section_data constructors.
9605         (Output_section::Input_section::addralign): If not an input
9606         section, return the alignment of the Output_section_data.
9607         * testsuite/copy_test.cc: New file.
9608         * testsuite/copy_test_1.cc: New file.
9609         * testsuite/copy_test_2.cc: New file.
9610         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9611         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9612         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9613         (copy_test_1_pic.o, copy_test_1.so): New targets.
9614         (copy_test_2_pic.o, copy_test_2.so): New targets.
9615         * testsuite/Makefile.in: Rebuild.
9616
9617         * script-sections.cc (Script_sections::place_orphan): Initialize
9618         local variable exact.
9619
9620 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9621
9622         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9623
9624 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9625             David S. Miller  <davem@davemloft.net>
9626
9627         * powerpc.cc: New file.
9628         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9629         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9630         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9631         * Makefile.in: Rebuild.
9632
9633 2008-06-09  Ian Lance Taylor  <iant@google.com>
9634
9635         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9636         <exception>.
9637         (throwing, orig_terminate): New static variables.
9638         (terminate_handler): New static function.
9639         (t2): Set terminate handler.
9640
9641 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9642
9643         PR 6584
9644         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9645         alignment.
9646
9647 2008-05-30  Cary Coutant  <ccoutant@google.com>
9648
9649         * archive.cc (Archive::include_all_members) Correct to step
9650         over symbol table and extended name table in thin archives.
9651
9652 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9653
9654         PR 6407
9655         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9656         calculation.
9657
9658 2008-05-28  Caleb Howe  <cshowe@google.com>
9659
9660         * reduced_debug_output.cc: New file.
9661         * reduced_debug_output.h: New file.
9662         * options.h (class General_options): Add --strip-debug-non-line.
9663         * options.cc (General_options::finalize): Add strip_debug_non_line
9664         to the strip heirarchy.
9665         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9666         fields.
9667         * layout.cc: Include "reduced_debug_output.h".
9668         (Layout::Layout): Initialize new fields.
9669         (line_only_debug_sections): New static array.
9670         (is_lines_only_debug_sections): New static inline function.
9671         (Layout::include_section): Handle --strip-debug-non-line.
9672         (Layout::make_output_section): If --strip-debug-non-line, build
9673         new output sections for .debug_abbrev and .debug_info.
9674         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9675         gold.  Warn about possible overflow.
9676         (read_signed_LEB_128): Likewise.
9677         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9678         (read_signed_LEB_128): Declare.
9679         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9680         (HFILES): Add reduced_debug_output.h.
9681         * Makefile.in: Rebuild.
9682
9683 2008-05-21  Ian Lance Taylor  <iant@google.com>
9684
9685         * mapfile.cc: New file.
9686         * mapfile.h: New file.
9687         * options.h (class General_options): Add -M/--print-map and -Map.
9688         * options.cc (General_options::finalize): Make -M equivalent to
9689         -Map -.
9690         * main.cc: Include <cstdio> and "mapfile.h".
9691         (main): Open mapfile if requested.
9692         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9693         constructor.  Change caller.
9694         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9695         (queue_middle_tasks): Likewise.
9696         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9697         declarations.
9698         * archive.cc: Include "mapfile.h".
9699         (Archive::add_symbols): Add mapfile parameter.  Change all
9700         callers.  Pass mapfile, symbol, and reason to include_member.
9701         (Archive::include_all_members): Add mapfile parameter.  Change all
9702         callers.
9703         (Archive::include_member): Add mapfile, sym, and why parameters.
9704         Change all callers.  Report inclusion to map file.
9705         * archive.h: Include "fileread.h".
9706         (class Archive): Update declarations.
9707         (Archive::file): New const method.
9708         (class Add_archive_symbols): Add mapfile_ field.  Update
9709         constructor.  Change all callers.
9710         * readsyms.h (class Read_symbols): Likewise.
9711         (class Finish_group): Likewise.
9712         (class Read_script): Likewise.
9713         * common.cc: Include "mapfile.h".
9714         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9715         all callers.
9716         (Symbol_table::do_allocate_commons): Likewise.
9717         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9718         symbol allocation to mapfile.
9719         * common.h (class Allocate_commons_task): Add mapfile_ field.
9720         Update constructor.  Change all callers.
9721         * symtab.h (class Symbol_table): Update declarations.
9722         * layout.cc: Include "mapfile.h".
9723         (Layout_task_runner::run): Print information to mapfile.
9724         (Layout::create_gold_note): Change Output_data_fixed_space to
9725         Output_data_zero_fill.
9726         (Layout::create_build_id): Likewise.
9727         (Layout::print_to_mapfile): New function.
9728         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9729         constructor.  Change caller.
9730         (class Layout): Declare print_to_mapfile.
9731         * output.cc (Output_section::Input_section::print_to_mapfile): New
9732         function.
9733         (Output_section::add_input_section): If producing a map, always
9734         add to input_sections_ list.
9735         (Output_section::do_print_to_mapfile): New function.
9736         (Output_segment::print_sections_to_mapfile): New function.
9737         (Output_segment::print_section_list_to_mapfile): New function.
9738         * output.h: Include "mapfile.h".
9739         (Output_data::print_to_mapfile): New function.
9740         (Output_data::do_print_to_mapfile): New virtual function.
9741         (Output_segment_headers::do_print_to_mapfile): New function.
9742         (Output_file_header::do_print_to_mapfile): New function.
9743         (Output_data_const::do_print_to_mapfile): New function.
9744         (class Output_data_const_buffer): Add map_name_ field.  Update
9745         constructor.  Change all callers.  Add do_print_to_mapfile
9746         function.
9747         (class Output_data_fixed_space): Likewise.
9748         (class Output_data_space): Likewise.
9749         (class Output_data_zero_fill): New class.
9750         (Output_data_strtab::do_print_to_mapfile): New function.
9751         (Output_data_reloc_base::do_print_to_mapfile): New function.
9752         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9753         (Output_data_group::do_print_to_mapfile): New function.
9754         (Output_data_got::do_print_to_mapfile): New function.
9755         (Output_data_dynamic::do_print_to_mapfile): New function.
9756         (Output_symtab_xindex::do_print_to_mapfile): New function.
9757         (class Output_section): Declare do_print_to_mapflie.  Declare
9758         print_to_mapfile in Input_section.
9759         (class Output_segment): Declare new functions.
9760         * object.h (Sized_relobj::symbol_count): New function.
9761         * script-sections.cc
9762         (Output_section_element_dot_assignment::set_section_addresses):
9763         Change Output_data_fixed_space to Output_data_zero_fill.
9764         (Output_data_expression::do_print_to_mapfile): New function.
9765         * script.cc (read_input_script): Add mapfile parameter.  Change
9766         all callers.
9767         * script.h (read_input_script): Update declaration.
9768         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9769         (Eh_frame::do_print_to_mapfile): New function.
9770         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9771         (Output_merge_string::do_print_to_mapfile): New function.
9772         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9773         function.
9774         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9775         function.
9776         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9777         function.
9778         * Makefile.am (CCFILES): Add mapfile.cc.
9779         (HFILES): Add mapfile.h.
9780         * Makefile.in: Rebuild.
9781
9782 2008-05-19  Ian Lance Taylor  <iant@google.com>
9783
9784         * options.h (class General_options): Add -z relro.
9785         * layout.cc (Layout::Layout): Initialize relro_segment_.
9786         (Layout::add_output_section_data): Return the output section.
9787         (Layout::make_output_section): Rcognize relro sections and mark
9788         them appropriately.
9789         (Layout::attach_allocated_section_to_segment): Put relro sections
9790         in a PT_GNU_RELRO segment.
9791         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9792         section as relro.
9793         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9794         PT_TLS segments.
9795         (Layout::linkonce_mapping): Map d.rel.ro.local to
9796         .data.rel.ro.local.
9797         (Layout::output_section_name): Us .data.rel.ro.local for any
9798         section which begins with that.
9799         * layout.h (class Layout): Update add_output_section_data
9800         declaration.  Add relro_segment_ field.
9801         * output.cc (Output_section::Output_section): Initialize is_relro_
9802         and is_relro_local_ fields.
9803         (Output_segment::add_output_section): Group relro sections.
9804         (Output_segment::is_first_section_relro): New function.
9805         (Output_segment::maximum_alignment): If there is a relro section,
9806         align the segment to the common page size.
9807         (Output_segment::set_section_addresses): Track whether we are
9808         looking at relro sections.  If the last section is a relro
9809         section, align to the common page size.
9810         (Output_segment::set_section_list_addresses): Add in_relro
9811         parameter.  Change all callers.  Align to the page size when
9812         moving from relro to non-relro section.
9813         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9814         segment.
9815         * output.h (class Output_section): Add is_relro_ and
9816         is_relro_local_ fields.
9817         (Output_section::is_relro): New function.
9818         (Output_section::set_is_relro): New function.
9819         (Output_section::is_relro_local): New function.
9820         (Output_section::set_is_relro_local): New function.
9821         (class Output_segment): Update declarations.
9822         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9823         * sparc.cc (Target_sparc::got_section): Likewise.
9824         * x86_64.cc (Target_x86_64::got_section): Likewise.
9825         * testsuite/relro_test_main.cc: New file.
9826         * testsuite/relro_test.cc: New file.
9827         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9828         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9829         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9830         (relro_test.so, relro_test_pic.o): New targets.
9831         * testsuite/Makefile.in: Rebuild.
9832
9833 2008-05-16  Ian Lance Taylor  <iant@google.com>
9834
9835         * output.cc (Output_segment::add_output_section): Remove front
9836         parameter.
9837         * output.h (class Output_segment): Remove
9838         add_initial_output_section and overloaded add_output_section.
9839         Update declaration of remaining add_output_section.
9840         * layout.cc (Layout::create_interp): Call add_output_section
9841         rather than add_initial_output_section.
9842         (Layout::finish_dynamic_section): Likewise.
9843
9844         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9845         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9846         know the dynamic type.
9847         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9848         field.  Initialize it in constructor.
9849         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9850         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9851         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9852         reloc.
9853
9854         * output.cc (Output_reloc::get_address): Change return type to
9855         Elf_Addr.
9856         * output.h (class Output_reloc): Update get_address declaration.
9857         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9858         for section addresses.
9859
9860 2008-05-09  Ian Lance Taylor  <iant@google.com>
9861
9862         PR 6493
9863         * gold.cc (gold_nomem): Use return value of write.
9864
9865 2008-05-08  Ian Lance Taylor  <iant@google.com>
9866
9867         * symtab.c (Symbol::init_base_output_data): Add version
9868         parameter.  Change all callers.
9869         (Symbol::init_base_output_segment): Likewise.
9870         (Symbol::init_base_constant): Likewise.
9871         (Symbol::init_base_undefined): Likewise.
9872         (Sized_symbol::init_output_data): Likewise.
9873         (Sized_symbol::init_output_segment): Likewise.
9874         (Sized_symbol::init_constant): Likewise.
9875         (Sized_symbol::init_undefined): Likewise.
9876         (Symbol_table::do_define_in_output_data): If the new symbol has a
9877         version, mark it as the default.
9878         (Symbol_table::do_define_in_output_segment): Likewise.
9879         (Symbol_table::do_define_as_constant): Likewise.
9880         * symtab.h (class Symbol): Update declarations.
9881         (class Sized_symbol): Likewise.
9882         * resolve.cc (Symbol::override_version): New function.
9883         (Symbol::override_base): Call override_version.
9884         (Symbol::override_base_with_special): Likewise.
9885         * testsuite/ver_script_8.script: New file.
9886         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9887         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9888         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9889         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9890
9891 2008-05-06  Ian Lance Taylor  <iant@google.com>
9892
9893         PR 6049
9894         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9895         functions.
9896         (class General_options): Remove existing --undefined, and add
9897         --no-undefined instead.  Add new --undefined as synonym for -u.
9898         * archive.cc (Archive::add_symbols): Check whether symbol was
9899         named with -u.
9900         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9901         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9902         all uses.  Add IS_UNDEFINED.  Update declarations to split
9903         different versions of init_base.  Declare init_base_undefined.
9904         (Symbol::is_defined): Handle IS_UNDEFINED.
9905         (Symbol::is_undefined): Likewise.
9906         (Symbol::is_weak_undefined): Call is_undefined.
9907         (Symbol::is_absolute): Handle IS_CONSTANT.
9908         (class Sized_symbol): Update declarations to split different
9909         versions of init.  Declare init_undefined.
9910         (class Symbol_table): Declare new functions.
9911         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9912         Change all callers.
9913         (Symbol::init_base_output_data): Likewise.
9914         (Symbol::init_base_output_segment): Likewise.
9915         (Symbol::init_base_constant): Likewise.
9916         (Symbol::init_base_undefined): New function.
9917         (Sized_symbol::init_object): Rename from init.  Change all
9918         callers.
9919         (Sized_symbol::init_output_data): Likewise.
9920         (Sized_symbol::init_output_segment): Likewise.
9921         (Sized_symbol::init_constant): Likewise.
9922         (Sized_symbol::init_undefined): New function.
9923         (Symbol_table::add_undefined_symbols_from_command_line): New
9924         function.
9925         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9926         function.
9927         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9928         (Symbol::output_section): Likewise.
9929         (Symbol::set_output_section): Likewise.
9930         (Symbol_table::sized_finalize_symbol): Likewise.
9931         (Symbol_table::sized_write_globals): Likewise.
9932         * resolve.cc (Symbol_table::should_override): Likewise.
9933         (Symbol::override_base_with_special): Likewise.
9934
9935         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9936         symbol, change it to have default visibility.
9937         * testsuite/protected_1.cc: New file.
9938         * testsuite/protected_2.cc: New file.
9939         * testsuite/protected_3.cc: New file.
9940         * testsuite/protected_main_1.cc: New file.
9941         * testsuite/protected_main_2.cc: New file.
9942         * testsuite/protected_main_3.cc: New file.
9943         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9944         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9945         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9946         (protected_1.so): New target.
9947         (protected_1_pic.o, protected_2_pic.o): New targets.
9948         (protected_3_pic.o): New target.
9949         (check_PROGRAMS): Add protected_2.
9950         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9951         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9952         * testsuite/Makefile.in: Rebuild.
9953
9954         * options.h (DEFINE_var): Add set_user_set_##varname__.
9955         (DEFINE_bool_alias): New macro.
9956         (class General_options): Define -Bstatic using DEFINE_bool_alias
9957         rather than DEFINE_special.  Add --undefined as an alias for -z
9958         defs.
9959         * options.cc (General_options::parse_Bstatic): Remove.
9960
9961         * options.h (class General_options): Add --fatal-warnings.
9962         * main.cc (main): Implement --fatal-warnings.
9963         * errors.h (Errors::warning_count): New function.
9964
9965         * options.h (class General_options): Add -Bsymbolic-functions.
9966         * symtab.h (Symbol::is_preemptible): Check for
9967         -Bsymbolic-functions.
9968
9969 2008-05-05  Ian Lance Taylor  <iant@google.com>
9970
9971         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9972         as noVARNAME rather than no-VARNAME.
9973         (class General_options): Add option -z combreloc.
9974         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9975         get_address.
9976         (Output_reloc::sort_before) [SHT_REL]: New function.
9977         (Output_reloc::sort_before) [SHT_RELA]: New function.
9978         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9979         Sort_relocs_comparison.
9980         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9981         parameter.  Change all callers.
9982         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9983         sort_relocs parameter.  Change all callers.
9984         * output.cc (Output_reloc::get_address): New function, broken out
9985         of write_rel.
9986         (Output_reloc::write_rel): Call it.
9987         (Output_reloc::compare): New function.
9988         (Output_data_reloc_base::do_write): Optionally sort relocs.
9989
9990         * configure.ac: If targ_extra_obj is set, link it in.
9991         * configure.tgt: Initialize all variables.
9992         (x86_64*): Set targ_extra_obj and targ_extra_size.
9993         * configure: Rebuild.
9994
9995         * object.cc (Sized_relobj::include_section_group): Adjust section
9996         indexes read from group data.  Build vector to pass to
9997         layout_group.
9998         * layout.cc (Layout::layout_group): Add flags and shndxes
9999         parameters.  Remove contents parameter.  Change caller.  Update
10000         explicit instantiations.
10001         * layout.h (class Layout): Update layout_group declaration.
10002         * output.cc (Output_data_group::Output_data_group): Add flags and
10003         input_shndxes parameters.  Remove contents parameter.  Change
10004         caller.
10005         (Output_data_group::do_write): Change input_sections_ to
10006         input_shndxes_.
10007         * output.h (class Output_data_group): Update constructor
10008         declaration.  Rename input_sections_ to input_shndxes_.
10009         * testsuite/many_sections_test.cc: Add template.
10010
10011 2008-04-30  Cary Coutant  <ccoutant@google.com>
10012
10013         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10014
10015         * layout.cc (Layout::include_section): Refactored check for debug
10016         info section.
10017         (Layout::add_comdat): Add new parameters.  Change type
10018         of signature parameter.  Add object and shndx to signatures table.
10019         (Layout::find_kept_object): New function.
10020         * layout.h: Include <cstring>.
10021         (Layout::is_debug_info_section): New function.
10022         (Layout::add_comdat): Add new parameters.
10023         (Layout::find_kept_object): New function.
10024         (Layout::Kept_section): New struct.
10025         (Layout::Signatures): Change type of map range.
10026         * object.cc (Relobj::output_section_address): New function.
10027         (Sized_relobj::include_section_group): Add new parameters.  Change
10028         calls to Layout::add_comdat.  Change to build table of kept comdat
10029         groups and table mapping discarded sections to kept sections.
10030         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10031         (Sized_relobj::do_layout): Change calls to include_section_group and
10032         include_linkonce_section.
10033         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10034         value to zero when section is discarded.
10035         (Sized_relobj::map_to_kept_section): New function.
10036         * object.h (Relobj::output_section_address): New function.
10037         (Relobj::Comdat_group): New type.
10038         (Relobj::find_comdat_group): New function.
10039         (Relobj::Comdat_group_table): New type.
10040         (Relobj::Kept_comdat_section): New type.
10041         (Relobj::Kept_comdat_section_table): New type.
10042         (Relobj::add_comdat_group): New function.
10043         (Relobj::set_kept_comdat_section): New function.
10044         (Relobj::get_kept_comdat_section): New function.
10045         (Relobj::comdat_groups_): New field.
10046         (Relobj::kept_comdat_sections_): New field.
10047         (Symbol_value::input_value): Update comment.
10048         (Sized_relobj::map_to_kept_section) New function.
10049         (Sized_relobj::include_linkonce_section): Add new parameter.
10050         * target-reloc.h (Comdat_behavior): New type.
10051         (get_comdat_behavior): New function.
10052         (relocate_section): Add code to map a discarded section to the
10053         corresponding kept section when applying a relocation.
10054
10055 2008-04-30  Craig Silverstein  <csilvers@google.com>
10056
10057         * dwarf_reader.cc (next_generation_count): New static var.
10058         (Addr2line_cache_entry): New struct.
10059         (addr2line_cache): New static var.
10060         (Dwarf_line_info::one_addr2line): Added caching.
10061         (Dwarf_line_info::clear_addr2line_cache): New function.
10062         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10063         cache-size parameter.
10064         (Dwarf_line_info::one_addr2line_cache): New function.
10065         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10066         new cache-size argument to one_addr2line(), and clear cache.
10067
10068 2008-04-28  Cary Coutant  <ccoutant@google.com>
10069
10070         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10071         R_386_PC8 relocations.
10072
10073 2008-04-23  Ian Lance Taylor  <iant@google.com>
10074
10075         * object.cc (Sized_relobj::include_section_group): Check for
10076         invalid section group.
10077
10078         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10079         header size.
10080
10081         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10082         than read for file header.
10083         * archive.cc (Archive::include_member): Likewise.
10084
10085 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10086
10087         * aclocal.m4: Regenerate.
10088         * configure: Regenerate.
10089
10090 2008-04-19  Ian Lance Taylor  <iant@google.com>
10091
10092         * version.cc (version_string): Bump to 1.6.
10093
10094         * testsuite/Makefile.am (many_sections_r_test): New target.
10095         (many_sections_r_test_SOURCES): Remove.
10096         (many_sections_r_test_DEPENDENCIES): Remove.
10097         (many_sections_r_test_LDFLAGS): Remove.
10098         (many_sections_r_test_LDADD): Remove.
10099
10100         * object.cc (Sized_relobj::do_add_symbols): Always pass
10101         local_symbol_count_ to add_from_relobj.
10102
10103         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10104         every thousand variables.
10105         * testsuite/Makefile.in: Rebuild.
10106
10107         * object.cc (Xindex::initialize_symtab_xindex): New function.
10108         (Xindex::read_symtab_xindex): New function.
10109         (Xindex::sym_xindex_to_shndx): New function.
10110         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10111         available.
10112         (Sized_relobj::do_initialize_xindex): New function.
10113         (Sized_relobj::do_read_symbols): Adjust section links.
10114         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10115         parameter.  Change all callers.
10116         (Sized_relobj::include_section_group): Adjust section links and
10117         symbol section indexes.
10118         (Sized_relobj::do_layout): Adjust section links.
10119         (Sized_relobj::do_count_local_symbols): Adjust section links and
10120         symbol section indexes.
10121         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10122         ordinary and special symbols.
10123         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10124         dynsym_xindex parameters.  Change all callers.  Adjust section
10125         links.  Use SHN_XINDEX when needed.
10126         (Sized_relobj::get_symbol_location_info): Adjust section links.
10127         Don't get fooled by special symbols.
10128         * object.h (class Xindex): Define.
10129         (class Object): Add xindex_ parameter.  Declare virtual functoin
10130         do_initialize_xindex.
10131         (Object::adjust_sym_shndx): New function.
10132         (Object::set_xindex): New protected function.
10133         (class Symbol_value): Add is_ordinary_shndx_ field.
10134         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10135         (Symbol_value::value): Assert ordinary section.
10136         (Symbol_value::initialize_input_to_output_map): Likewise.
10137         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10138         Change all callers.
10139         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10140         all callers.
10141         (class Sized_relobj): Update declarations.
10142         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10143         parameter.  Change all callers.
10144         (Sized_relobj::adjust_shndx): New function.
10145         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10146         field.
10147         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10148         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10149         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10150         (Sized_dynobj::read_dynsym_section): Adjust section links.
10151         (Sized_dynobj::read_dynamic): Likewise.
10152         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10153         section links.
10154         (Sized_dynobj::do_initialize_xindex): New function.
10155         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10156         do_initialize_xindex.
10157         (Sized_dynobj::adjust_shndx): New function.
10158         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10159         dynsym_xindex_ fields.
10160         (Layout::finalize): Add a call to set_section_indexes before
10161         creating the symtab sections.
10162         (Layout::set_section_indexes): Don't do anything if the section
10163         already has a section index.
10164         (Layout::create_symtab_sections): Add shnum parameter.  Change
10165         caller.  Create .symtab_shndx section if needed.
10166         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10167         caller.
10168         (Layout::allocated_output_section_count): New function.
10169         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10170         needed.
10171         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10172         fields.  Update declarations.
10173         (Layout::symtab_xindex): New function.
10174         (Layout::dynsym_xindex): New function.
10175         (class Write_symbols_task): Add layout_ field.
10176         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10177         Change caller.
10178         * output.cc (Output_section_headers::Output_section_headers): Add
10179         shstrtab_section parameter.  Change all callers.
10180         (Output_section_headers::do_sized_write): Store overflow values
10181         for section count and section string table section index in
10182         section header zero.
10183         (Output_file_header::do_sized_write): Check for overflow of
10184         section count and section string table section index.
10185         (Output_symtab_xindex::do_write): New function.
10186         (Output_symtab_xindex::endian_do_write): New function.
10187         * output.h (class Output_section_headers): Add shstrtab_section_.
10188         Update declarations.
10189         (class Output_symtab_xindex): Define.
10190         (Output_section::has_out_shndx): New function.
10191         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10192         field.
10193         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10194         Change all callers.
10195         (Sized_symbol::init): Likewise.
10196         (Symbol::output_section): Check for ordinary symbol.
10197         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10198         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10199         callers.
10200         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10201         Change all callers.  Simplify handling of symbols from sections
10202         not included in the link.
10203         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10204         distinction.
10205         (Weak_alias_sorter::operator()): Assert that symbols are
10206         ordinary.
10207         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10208         distinction.
10209         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10210         parameters.  Change all callers.
10211         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10212         symbol distinction.  Use SHN_XINDEX when needed.
10213         (Symbol_table::write_section_symbol): Add symtab_xindex
10214         parameter.  Change all callers.
10215         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10216         SHN_XINDEX when needed.
10217         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10218         declarations.
10219         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10220         (Symbol::is_defined): Check is_ordinary.
10221         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10222         (Symbol::is_absolute, Symbol::is_common): Likewise.
10223         (class Sized_symbol): Update declarations.
10224         (class Symbol_table): Update declarations.
10225         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10226         parameters.  Change all callers.
10227         (Sized_symbol::override): Likewise.
10228         (Symbol_table::override): Likewise.
10229         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10230         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10231         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10232         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10233         to be in an ordinary section.
10234         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10235         object and is_ordinary parameters.  Change all callers.
10236         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10237         Change all callers.  Don't add undefined or non-ordinary symbols
10238         to reloc_map_.
10239         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10240         Change all callers.
10241         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10242         declarations.
10243         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10244         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10245         (Sized_relobj::relocate_sections): Likewise.
10246         * target-reloc.h (scan_relocs): Adjust section symbol index.
10247         (scan_relocatable_relocs): Likewise.
10248         * i386.cc (Scan::local): Check for ordinary symbols.
10249         * sparc.cc (Scan::local): Likewise.
10250         * x86_64.cc (Scan::local): Likewise.
10251         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10252         to symbol_section_and_value.
10253         * testsuite/many_sections_test.cc: New file.
10254         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10255         (check_PROGRAMS): Add many_sections_test.
10256         (many_sections_test_SOURCES): Define.
10257         (many_sections_test_DEPENDENCIES): Define.
10258         (many_sections_test_LDFLAGS): Define.
10259         (BUILT_SOURCES): Add many_sections_define.h.
10260         (many_sections_define.h): New target.
10261         (BUILT_SOURCES): Add many_sections_check.h.
10262         (many_sections_check.h): New target.
10263         (check_PROGRAMS): Add many_sections_r_test.
10264         (many_sections_r_test_SOURCES): Define.
10265         (many_sections_r_test_DEPENDENCIES): Define.
10266         (many_sections_r_test_LDFLAGS): Define.
10267         (many_sections_r_test_LDADD): Define.
10268         (many_sections_r_test.o): New target.
10269         * testsuite/Makefile.in: Rebuild.
10270
10271 2008-04-17  Cary Coutant  <ccoutant@google.com>
10272
10273         * errors.cc (Errors::info): New function.
10274         (gold_info): New function.
10275         * errors.h (Errors::info): New function.
10276         * gold.h (gold_info): New function.
10277         * object.cc (Input_objects::add_object): Print trace output.
10278         * options.cc (options::parse_set): New function.
10279         (General_options::parse_wrap): Deleted.
10280         (General_options::General_options): Deleted initializer.
10281         * options.h (options::String_set): New typedef.
10282         (options::parse_set): New function.
10283         (DEFINE_set): New macro.
10284         (General_options::wrap): Changed to use DEFINE_set. Changed
10285         callers of any_wrap_symbols and is_wrap_symbol.
10286         (General_options::trace, General_options::trace_symbol):
10287         New options.
10288         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10289         (General_options::wrap_symbols_): Deleted.
10290         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10291
10292 2008-04-17  David S. Miller  <davem@davemloft.net>
10293
10294         * options.cc (General_options::parse_V): New function.
10295         * options.h: Add entries for -V and -Qy.
10296
10297 2008-04-17  Ian Lance Taylor  <iant@google.com>
10298
10299         * common.cc (Symbol_table::allocate_commons): Remove options
10300         parameter.  Change caller.
10301         (Symbol_table::do_allocate_commons): Remove options parameter.
10302         Change caller.  Just call do_allocate_commons_list twice.
10303         (Symbol_table::do_allocate_commons_list): New function, broken out
10304         of do_allocate_commons.
10305         * common.h (class Allocate_commons_task): Remove options_ field.
10306         Update constructor.
10307         * symtab.cc (Symbol_table::Symbol_table): Initialize
10308         tls_commons_.
10309         (Symbol_table::add_from_object): Put TLS common symbols on
10310         tls_commons_ list.
10311         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10312         which are IN_OUTPUT_DATA.
10313         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10314         allocate_commons and do_allocate_commons declarations.  Declare
10315         do_allocate_commons_list.
10316         * gold.cc (queue_middle_tasks): Update creation of
10317         Allocate_commons_task to not pass options.
10318         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10319         (TLS_TEST_C_FLAGS): New variable.
10320         (tls_test_c_pic.o): New target.
10321         (tls_test_shared.so): Link in tls_test_c_pic.o.
10322         (tls_test_c_pic_ie.o): New target.
10323         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10324         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10325         (tls_test_c.o): New target.
10326         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10327         (tls_pic_test_LDADD): Likewise.
10328         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10329         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10330         (tls_test_c_gnu2.o): New target.
10331         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10332         tls_test_c_gnu2.o.
10333         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10334         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10335         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10336         * testsuite/tls_test.cc: Include "config.h".
10337         (t_last): Call t11_last.
10338         * testsuite/tls_test.h (t11, t11_last): Declare.
10339         * testsuite/tls_test_c.c: New file.
10340         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10341         * configure.ac: Check for OpenMP support.
10342         * configure, config.in, Makefile.in: Rebuild.
10343         * testsuite/Makefile.in: Rebuild.
10344
10345 2008-04-16  Cary Coutant  <ccoutant@google.com>
10346
10347         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10348         (Target_i386::tls_base_symbol_defined_): New field.
10349         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10350         (Target_i386::Scan::global): Likewise.
10351         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10352         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10353         (Target_x86_64::tls_base_symbol_defined_): New field.
10354         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10355         (Target_x86_64::Scan::global): Likewise.
10356
10357 2008-04-16  Cary Coutant  <ccoutant@google.com>
10358
10359         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10360         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10361         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10362         building shared libraries.
10363         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10364         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10365         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10366         * testsuite/Makefile.in: Rebuild.
10367         * testsuite/weak_undef.h: New file.
10368         * testsuite/weak_undef_file1.cc: Add extra test cases.
10369         * testsuite/weak_undef_file2.cc: Likewise.
10370         * testsuite/weak_undef_test.cc: Likewise.
10371
10372 2008-04-16  David S. Miller  <davem@davemloft.net>
10373
10374         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10375         Add issued_non_pic_error_ field.  Declare check_non_pic.
10376         (Target_sparc::Scan::check_non_pic): New function.
10377         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10378         (Target_sparc::Scan::global): Likewise.
10379
10380         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10381         * configure: Rebuild.
10382
10383         * options.h (DEFINE_enable): New macro.
10384         (new_dtags): New enable option.
10385         (initfirst, interpose, loadfltr, nodefaultlib,
10386         nodelete, nodlopen, nodump): New -z options.
10387         * layout.cc (Layout:finish_dynamic_section): If new
10388         dtags enabled, emit DT_RUNPATH.  Also, emit a
10389         DT_FLAGS_1 containing any specified -z flags.
10390
10391 2008-04-16  Ian Lance Taylor  <iant@google.com>
10392
10393         * copy-relocs.cc: New file.
10394         * copy-relocs.h: New file.
10395         * reloc.cc: Remove Copy_relocs code.
10396         * reloc.h: Likewise.
10397         * reloc-types.h (struct Reloc_types) [both versions]: Add
10398         get_reloc_addend_noerror.
10399         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10400         variants of add_global which take an addend which must be zero.
10401         * i386.cc: Include "copy-relocs.h".
10402         (class Target_i386): Change type of copy_relocs_ to variable,
10403         update initializer.
10404         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10405         Change all callers.
10406         (Target_i386::do_finalize_sections): Change handling of
10407         copy_relocs_.
10408         * sparc.cc: Include "copy-relocs.h".
10409         (class Target_sparc): Change type of copy_relocs_ to variable,
10410         update initializer.
10411         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10412         Change all callers.
10413         (Target_sparc::do_finalize_sections): Change handling of
10414         copy_relocs_.
10415         * x86_64.cc: Include "copy-relocs.h".
10416         (class Target_x86_64): Change type of copy_relocs_ to variable,
10417         update initializer.
10418         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10419         class.  Change all callers.
10420         (Target_x86_64::do_finalize_sections): Change handling of
10421         copy_relocs_.
10422         * Makefile.am (CCFILES): Add copy-relocs.cc.
10423         (HFILES): Add copy-relocs.h.
10424
10425         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10426
10427         * testsuite/script_test_4.sh: Permit leading zeroes.
10428
10429 2008-04-15  Ian Lance Taylor  <iant@google.com>
10430
10431         * script-sections.cc (Script_sections::create_segments): Use
10432         header_size_adjustment even when there is enough room for the
10433         headers.
10434         * testsuite/script_test_4.sh: New file.
10435         * testsuite/script_test_4.t: New file.
10436         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10437         (check_DATA): Add script_test_4.stdout.
10438         (MOSTLYCLEANFILES): Likewise.
10439         (script_test_4): New target.
10440         (script_test_4.stdout): New target.
10441         * testsuite/Makefile.in: Rebuild.
10442
10443         * sparc.cc: Add definitions for Output_data_plt_sparc class
10444         constants.
10445
10446 2008-04-14  David S. Miller  <davem@davemloft.net>
10447
10448         * sparc.cc: New file.
10449         * Makefile.am (TARGETSOURCES): Add sparc.cc
10450         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10451         * configure.tgt: Document targ_extra_size and
10452         targ_extra_big_endian.  Add entries for sparc-* and
10453         sparc64-*.
10454         * configure.ac: Handle targ_extra_size and
10455         targ_extra_big_endian.
10456         * Makefile.in: Rebuild.
10457         * configure: Likewise.
10458         * po/POTFILES.in: Likewise.
10459         * po/gold.pot: Likewise.
10460
10461 2008-04-14  Ian Lance Taylor  <iant@google.com>
10462
10463         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10464         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10465         in the name/type/flags to section mapping.  Don't call
10466         allocate_output_section.
10467         (Layout::choose_output_section): Change parameter from adjust_name
10468         to is_input_section.  Don't permit input sections after sections
10469         are attached to segments.  Don't call allocate_output_section.
10470         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10471         not write_enable_output_section.
10472         (Layout::make_output_section): Don't push to
10473         unattached_section_list_ nor call attach_to_segment.  Call
10474         attach_section_to_segment if sections are attached.
10475         (Layout::attach_sections_to_segments): New function.
10476         (Layout::attach_section_to_segment): New function.
10477         (Layout::attach_allocated_section_to_segment): Rename from
10478         attach_to_segment.  Remove flags parameter.
10479         (Layout::allocate_output_section): Remove function.
10480         (Layout::write_enable_output_section): Remove function.
10481         * layout.h (class Layout): Update for above changes.  Add new
10482         field sections_are_attached_.
10483         * output.h (Output_section::update_flags_for_input_section): New
10484         function.
10485         * output.cc (Output_section::add_input_section): Call
10486         update_flags_for_input_section.
10487         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10488
10489 2008-04-11  Cary Coutant  <ccoutant@google.com>
10490
10491         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10492         thought unnecessary.
10493         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10494
10495 2008-04-11  Ian Lance Taylor  <iant@google.com>
10496
10497         * output.h (class Output_section_data): Remove inline definition
10498         of set_addralign.
10499         * output.cc (Output_section_data::set_addralign): New function.
10500
10501 2008-04-11  Cary Coutant  <ccoutant@google.com>
10502
10503         Add support for TLS descriptors for i386 and x86_64.
10504         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10505         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10506         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10507         GOT_TYPE_TLS_DESC.
10508         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10509         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10510         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10511         relocations.
10512         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10513         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10514         Fix problem with initial-exec relocations.
10515         (Target_i386::Relocate::relocate_tls): Likewise.
10516         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10517         relaxation.
10518         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10519         support for section-plus-offset dynamic table entries.
10520         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10521         (Output_data_dynamic::Dynamic_entry): Add support for
10522         section-plus-offset dynamic table entries.
10523         (Output_data_dynamic::Classification): Likewise.
10524         (Output_data_dynamic::classification_): Renamed offset_.
10525         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10526         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10527         (Target_x86_64::make_plt_section): New function.
10528         (Target_x86_64::reserve_tlsdesc_entries): New function.
10529         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10530         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10531         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10532         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10533         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10534         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10535         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10536         add extra PLT entry for TLS descriptors.
10537         (Output_data_plt_x86_64::got_): New field.
10538         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10539         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10540         fields.
10541         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10542         descriptors.
10543         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10544         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10545         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10546         R_386_TLS_DESC_CALL relocations.
10547         (Target_x86_64::Scan::global): Likewise.
10548         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10549         for TLS descriptors.
10550         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10551         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10552         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10553         GD-to-IE relaxation.
10554         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10555         and TLS_DESCRIPTORS.
10556         * Makefile.in: Rebuild.
10557         * configure: Rebuild.
10558         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10559         (tls_test_shared2.so): New target.
10560         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10561         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10562         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10563         (tls_shared_gd_to_ie_test_LDADD): New variable.
10564         (tls_shared_gnu2_gd_to_ie_test): New target.
10565         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10566         New targets.
10567         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10568         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10569         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10570         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10571         (tls_shared_gnu2_test): New target.
10572         (tls_test_gnu2_shared.so): New target.
10573         (tls_shared_gnu2_test_SOURCES): New variable.
10574         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10575         (tls_shared_gnu2_test_LDFLAGS): New variable.
10576         (tls_shared_gnu2_test_LDADD): New variable.
10577         * testsuite/Makefile.in: Rebuild.
10578         * testsuite/Makefile.
10579
10580 2008-04-11  Ian Lance Taylor  <iant@google.com>
10581
10582         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10583         justsyms.t.
10584         * testsuite/Makefile.in: Rebuild.
10585
10586         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10587         long.
10588         * testsuite/script_test_2.cc (main): Adjust test.
10589
10590 2008-04-11  David S. Miller  <davem@davemloft.net>
10591             Ian Lance Taylor  <iant@google.com>
10592
10593         * options.h (General_options): Add entries for '-Y' and
10594         '-relax'.
10595         * options.cc (General_options:finalize): If -Y was used, add those
10596         entries to the library path instead of the default "/lib" and
10597         "/usr/lib".
10598
10599 2008-04-11  David S. Miller  <davem@davemloft.net>
10600
10601         * testsuite/justsyms.t: Start at 0x100.
10602         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10603         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10604         long.
10605         * testsuite/script_test_2.cc: Adjust string and section length
10606         checks.
10607
10608 2008-04-09  Ian Lance Taylor  <iant@google.com>
10609
10610         PR gold/5996
10611         * script-sections.cc (Sections_element::allocate_to_segment): Add
10612         orphan parameter.
10613         (Output_section_definition::allocate_to_segment): Likewise.
10614         (Orphan_output_section::allocate_to_segment): Likewise.
10615         (Script_sections::attach_sections_using_phdrs_clause): Don't
10616         propagate non-PT_LOAD segments to orphan sections.
10617         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10618         readelf rather than objdump.
10619         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10620         .interp section and PT_INTERP segment are the same size.
10621         * testsuite/Makefile.in: Rebuild.
10622
10623         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10624         aliases for symbols defined in the same object.
10625         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10626         (weak_alias_test_SOURCES): New variable.
10627         (weak_alias_test_DEPENDENCIES): New variable.
10628         (weak_alias_test_LDFLAGS): New variable.
10629         (weak_alias_test_LDADD): New variable.
10630         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10631         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10632         (weak_alias_test_3.o): New target.
10633         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10634         * testsuite/weak_alias_test_main.cc: New file.
10635         * testsuite/weak_alias_test_1.cc: New file.
10636         * testsuite/weak_alias_test_2.cc: New file.
10637         * testsuite/weak_alias_test_3.cc: New file.
10638
10639 2008-04-08  Ian Lance Taylor  <iant@google.com>
10640
10641         * options.h (class General_options): Add --noinhibit-exec option.
10642         * main.cc (main): Check --noinhibit-exec.
10643
10644         * options.h (class General_options): Define --wrap as a special
10645         option.  Add wrap_symbols_ field.
10646         (General_options::any_wrap_symbols): New function.
10647         (General_options::is_wrap_symbol): New function.
10648         * options.cc (General_options::parse_wrap): New function.
10649         (General_options::General_options): Initialize wrap_symbols_.
10650         * symtab.cc (Symbol_table::wrap_symbol): New function.
10651         (Symbol_table::add_from_object): Handle --wrap.
10652         * symtab.h (class Symbol_table): Declare wrap_symbol.
10653         * target.h (Target::wrap_char): New function.
10654         (Target::Target_info): Add wrap_char field.
10655         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10656         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10657         * testsuite/testfile.cc (Target_test::test_target_info):
10658         Likewise.
10659
10660         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10661         there is one.
10662
10663         * layout.h (class Layout): Add added_eh_frame_data_ field.
10664         * layout.cc (Layout::Layout): Initialize new field.
10665         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10666         output section until we find a section we merged successfully.
10667         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10668         that the size be non-zero.
10669
10670         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10671         qualifier.
10672
10673 2008-04-08  Craig Silverstein  <csilvers@google.com>
10674
10675         * configure.ac: Export new conditional variable HAVE_ZLIB.
10676         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10677         on HAVE_ZLIB.
10678         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10679         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10680
10681 2008-04-07  Ian Lance Taylor  <iant@google.com>
10682
10683         * version.cc (version_string): Set to "1.5".
10684
10685         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10686         Add issued_non_pic_error_ field.  Declare check_non_pic.
10687         (Target_x86_64::Scan::check_non_pic): New function.
10688         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10689         (Target_x86_64::Scan::global): Likewise.
10690
10691         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10692         addend parameter.  Change caller.  Handle merge sections.
10693         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10694         Address to Addend.  Don't add in the result of
10695         local_section_offset, pass down the addend and use the returned
10696         value.
10697         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10698         Update declarations of local_section_offset and symbol_value.
10699         * testsuite/two_file_test_1.cc (t18): New function.
10700         * testsuite/two_file_test_2.cc (f18): New function.
10701         * testsuite/two_file_test_main.cc (main): Call t18.
10702         * testsuite/two_file_test.h (t18, f18): Declare.
10703
10704         * configure.ac: Don't test for objdump, c++filt, or readelf.
10705         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10706         conditionals.
10707         (TEST_READELF): New variable.
10708         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10709         (check_PROGRAMS): Add two_file_strip_test.
10710         (two_file_strip_test): New target.
10711         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10712         (two_file_same_shared_strip_test_SOURCES): New variable.
10713         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10714         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10715         (two_file_same_shared_strip_test_LDADD): New variable.
10716         (two_file_shared_strip.so): New target.
10717         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10718         (ver_test_5.syms, ver_test_7.syms): Likewise.
10719         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10720         (strip_test_3.stdout): Use TEST_OBJDUMP.
10721         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10722
10723 2008-04-04  Cary Coutant  <ccoutant@google.com>
10724
10725         * symtab.h (Symbol::is_weak_undefined): New function.
10726         (Symbol::is_strong_undefined): New function.
10727         (Symbol::is_absolute): New function.
10728         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10729         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10730         absolute symbols.
10731         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10732         (weak_undef_test): New target.
10733         * testsuite/Makefile.in: Rebuild.
10734         * testsuite/weak_undef_file1.cc: New file.
10735         * testsuite/weak_undef_file2.cc: New file.
10736         * testsuite/weak_undef_test.cc: New file.
10737
10738 2008-04-03  Craig Silverstein  <csilvers@google.com>
10739
10740         * compressed_output.h (class Output_compressed_section): Use
10741         unsigned buffer.
10742         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10743         add zlib header.
10744         (zlib_compressed_suffix): Removed.
10745         (Output_compressed_section::set_final_data_size): Use unsigned
10746         buffers.
10747         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10748         Fix linker invocation.
10749         (flagstest_o_specialfile_and_compress_debug_sections):
10750         Likewise.
10751         * testsuite/Makefile.in: Regenerated.
10752
10753 2008-04-02  David S. Miller  <davem@davemloft.net>
10754
10755         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10756         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10757
10758 2008-04-02  Craig Silverstein  <csilvers@google.com>
10759
10760         * TODO: New file.
10761
10762 2008-04-02  Ian Lance Taylor  <iant@google.com>
10763
10764         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10765         parameters.  Update for new key type to views_.  Change all
10766         callers.
10767         (File_read::read): Adjust for byteshift in returned view.
10768         (File_read::add_view): New function, broken out of
10769         find_and_make_view.
10770         (File_read::make_view): New function, broken out of
10771         find_and_make_view.
10772         (File_read::find_or_make_view): Add offset and aligned
10773         parameters.  Rewrite accordingly.  Change all callers.
10774         (File_read::get_view): Add offset and aligned parameters.  Adjust
10775         for byteshift in return value.
10776         (File_read::get_lasting_view): Likewise.
10777         * fileread.h (class File_read): Update declarations.
10778         (class File_read::View): Add byteshift_ field.  Add byteshift to
10779         constructor.  Add byteshift method.
10780         * archive.h (Archive::clear_uncached_views): New function.
10781         (Archive::get_view): Add aligned parameter.  Change all callers.
10782         * object.h (Object::get_view): Add aligned parameter.  Change all
10783         callers.
10784         (Object::get_lasting_view): Likewise.
10785
10786         * fileread.cc (File_read::release): Don't call clear_views if
10787         there are multiple objects.
10788         * fileread.h (File_read::clear_uncached_views): New function.
10789         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10790         on the archive.
10791
10792 2008-03-31  Cary Coutant  <ccoutant@google.com>
10793
10794         Add thin archive support.
10795         * archive.cc (Archive::armagt): New const.
10796         (Archive::setup): Remove task parameter and calls to unlock.
10797         (Archive::unlock_nested_archives): New function.
10798         (Archive::read_header): Add nested_off parameter. Change
10799         all callers.
10800         (Archive::interpret_header): Likewise.
10801         (Archive::include_all_members): Change to handle thin
10802         archives.
10803         (Archive::include_member): Likewise.
10804         * archive.h (Archive::Archive): Add new parameters and
10805         initializers.
10806         (Archive::armagt): New const.
10807         (Archive::setup): Remove task parameter.
10808         (Archive::unlock_nested_archives): New function.
10809         (Archive::read_header): Add nested_off parameter.
10810         (Archive::interpret_header): Likewise.
10811         (Archive::Nested_archive_table): New typedef.
10812         (Archive::is_thin_archive_): New field.
10813         (Archive::nested_archives_): New field.
10814         (Archive::options_): New field.
10815         (Archive::dirpath_): New field.
10816         (Archive::task_): New field.
10817         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10818         for thin archives.  Pass additional parameters to
10819         Archive::Archive.  Unlock the archive file after calling
10820         Archive::setup.
10821
10822 2008-03-29  Ian Lance Taylor  <iant@google.com>
10823
10824         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10825         version symbol to be local.
10826         * testsuite/ver_test_4.sh: New file.
10827         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10828         (check_DATA): Add ver_test_4.syms.
10829         (ver_test_4.syms): New target.
10830         * testsuite/Makefile.in: Rebuild.
10831
10832         * output.cc
10833         (Output_section::Input_section_sort_entry::has_priority): New
10834         function.
10835         (Output_section::Input_section_sort_entry::match_file_name): New
10836         function.
10837         (Output_section::Input_section_sort_entry::match_section_name):
10838         Remove.
10839         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10840         Remove.
10841         (Output_section::Input_section_sort_entry::match_section_file):
10842         Remove.
10843         (Output_section::Input_section_sort_compare::operator()): Rewrite
10844         using new Input_section_sort_entry functions.  Sort crtbegin and
10845         crtend first.  Sort sections with no priority before sections with
10846         a priority.
10847         * testsuite/initpri1.c (d3): Check j != 4.
10848         (cd5): New constructor/destructor function.
10849         (main): Check j != 2.
10850
10851         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10852         new symbol when resolving, don't call set_is_default.
10853         * testsuite/ver_test_7.cc: New file.
10854         * testsuite/ver_test_7.sh: New file.
10855         * testsuite/Makefile.am (ver_test_7.so): New target.
10856         (ver_test_7.o): New target.
10857         (check_SCRIPTS): Add ver_test_7.sh.
10858         (check_DATA): Add ver_test_7.syms.
10859         (ver_test_7.syms): New target.
10860
10861 2008-03-28  Ian Lance Taylor  <iant@google.com>
10862
10863         * layout.cc (Layout::layout): If we see an input section with a
10864         name that needs sorting, set the must_sort flag for the output
10865         section.
10866         (Layout::make_output_section): If the name of the output section
10867         indicates that it might require sorting, set the may_sort flag.
10868         * output.h (Output_section::may_sort_attached_input_sections): New
10869         function.
10870         (Output_section::set_may_sort_attached_input_sections): New
10871         function.
10872         (Output_section::must_sort_attached_input_sections): New
10873         function.
10874         (Output_section::set_must_sort_attached_input_sections): New
10875         function.
10876         (class Output_section): Declare Input_section_sort_entry.  Define
10877         Input_section_sort_compare.  Declare
10878         sort_attached_input_sections.  Add new fields:
10879         may_sort_attached_input_sections_,
10880         must_sort_attached_input_sections_,
10881         attached_input_sections_are_sorted_.
10882         * output.cc (Output_section::Output_section): Initialize new
10883         fields.
10884         (Output_section::add_input_section): Add an entry to
10885         input_sections_ if may_sort or must_sort are true.
10886         (Output_section::set_final_data_size): Call
10887         sort_attached_input_sections if necessary.
10888         (Output_section::Input_section_sort_entry): Define new class.
10889         (Output_section::Input_section_sort_compare::operator()): New
10890         function.
10891         (Output_section::sort_attached_input_sections): New function.
10892         * configure.ac: Check whether the compiler supports constructor
10893         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10894         * testsuite/initpri1.c: New file.
10895         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10896         CONSTRUCTOR_PRIORITY.
10897         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10898         (initpri1_LDFLAGS): New variable.
10899         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10900
10901 2008-03-27  Ian Lance Taylor  <iant@google.com>
10902
10903         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10904         * testsuite/common_test_1.c: New file.
10905         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10906         (common_test_1_SOURCES): New variable.
10907         (common_test_1_DEPENDENCIES): New variable.
10908         (common_test_1_LDFLAGS): New variable.
10909
10910         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10911         and commons_ correctly when NAME/VERSION does not override
10912         NAME/NULL.
10913         * testsuite/ver_test_6.c: New file.
10914         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10915         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10916         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10917
10918 2008-03-26  Ian Lance Taylor  <iant@google.com>
10919
10920         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10921         of an undefined symbol from a version script.
10922         * testsuite/Makefile.am (ver_test_5.so): New target.
10923         (ver_test_5.o): New target.
10924         (check_SCRIPTS): Add ver_test_5.sh.
10925         (check_DATA): Add ver_test_5.syms.
10926         (ver_test_5.syms): New target.
10927         * testsuite/ver_test_5.cc: New file.
10928         * testsuite/ver_test_5.script: New file.
10929         * testsuite/ver_test_5.sh: New file.
10930         * Makefile.in, testsuite/Makefile.in: Rebuild.
10931
10932         PR gold/5986
10933         Fix problems building gold with gcc 4.3.0.
10934         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10935         (gold_error_at_location, gold_warning_at_location): Use it.
10936         * configure.ac: Check whether we can compile and use a template
10937         function with a printf attribute.
10938         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10939         when jumping over bytes.
10940         * object.cc: Instantiate Object::read_section_data.
10941         * debug.h: Include <cstring>
10942         * dwarf_reader.cc: Include <algorithm>
10943         * main.cc: Include <cstring>.
10944         * options.cc: Include <cstring>.
10945         * output.cc: Include <cstring>.
10946         * script.cc: Include <cstring>.
10947         * script.h: Include <string>.
10948         * symtab.cc: Include <cstring> and <algorithm>.
10949         * target-select.cc: Include <cstring>.
10950         * version.cc: Include <string>.
10951         * testsuite/testmain.cc: Include <cstdlib>.
10952         * configure, config.in: Rebuild.
10953
10954 2008-03-25  Ian Lance Taylor  <iant@google.com>
10955
10956         * options.cc: Include "../bfd/bfdver.h".
10957         (options::help): Print bug reporting address.
10958
10959         * version.cc (print_version): Adjust output for current value of
10960         BFD_VERSION_STRING.
10961
10962         * NEWS: New file.
10963
10964         * options.cc (options::help): Print list of supported targets.
10965         * target-select.h: Include <vector>.
10966         (class Target_selector): Make machine_, size_, and is_big_endian_
10967         fields const.  Add bfd_name_ and instantiated_target_ fields.
10968         (Target_selector::Target_selector): Add bfd_name parameter.
10969         (Target_selector::recognize): Make non-virtual, call
10970         do_recognize.
10971         (Target_selector::recognize_by_name): Make non-virtual, call
10972         do_recognize_by_name.
10973         (Target_selector::supported_names): New function.
10974         (Target_selector::bfd_name): New function.
10975         (Target_selector::do_instantiate_target): New pure virtual
10976         function.
10977         (Target_selector::do_recognize): New virtual function.
10978         (Target_selector::do_recognize_by_name): New virtual function.
10979         (Target_selector::instantiate_target): New private function.
10980         (supported_target_names): Declare.
10981         * target-select.cc (Target_selector::Target_selector): Update for
10982         new parameter and fields.
10983         (select_target_by_name): Check that the name matches before
10984         calling recognize_by_name.
10985         (supported_target_names): New function.
10986         * i386.cc (class Target_selector_i386): Update Target_selector
10987         constructor call.  Remove recognize and recognize_by_name.  Add
10988         do_instantiate_target.
10989         * x86_64.cc (class Target_selector_x86_64): Likewise.
10990         * testsuite/testfile.cc (class Target_selector_test): Update for
10991         changes to Target_selector.
10992
10993         * README: Rewrite, with some notes on unsupported features.
10994
10995 2008-03-24  Cary Coutant  <ccoutant@google.com>
10996
10997         * i386.cc (Target_i386::Got_type): New enum declaration.
10998         (Target_i386::Scan::local): Updated callers of Output_data_got
10999         member functions.
11000         (Target_i386::Scan::global): Likewise.
11001         (Target_i386::Relocate::relocate): Likewise.
11002         (Target_i386::Relocate::relocate_tls): Likewise.
11003         * object.h (Got_offset_list): New class.
11004         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11005         (Sized_relobj::local_got_offset): Likewise.
11006         (Sized_relobj::set_local_got_offset): Likewise.
11007         (Sized_relobj::local_has_tls_got_offset): Removed.
11008         (Sized_relobj::local_tls_got_offset): Removed.
11009         (Sized_relobj::set_local_tls_got_offset): Removed.
11010         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11011         * output.cc (Output_data_got::add_global): Added got_type parameter.
11012         (Output_data_got::add_global_with_rel): Likewise.
11013         (Output_data_got::add_global_with_rela): Likewise.
11014         (Output_data_got::add_global_pair_with_rel): New function.
11015         (Output_data_got::add_global_pair_with_rela): New function.
11016         (Output_data_got::add_local): Added got_type parameter.
11017         (Output_data_got::add_local_with_rel): Likewise.
11018         (Output_data_got::add_local_with_rela): Likewise.
11019         (Output_data_got::add_local_pair_with_rel): New function.
11020         (Output_data_got::add_local_pair_with_rela): New function.
11021         (Output_data_got::add_global_tls): Removed.
11022         (Output_data_got::add_global_tls_with_rel): Removed.
11023         (Output_data_got::add_global_tls_with_rela): Removed.
11024         (Output_data_got::add_local_tls): Removed.
11025         (Output_data_got::add_local_tls_with_rel): Removed.
11026         (Output_data_got::add_local_tls_with_rela): Removed.
11027         * output.h (Output_data_got::add_global): Added got_type parameter.
11028         (Output_data_got::add_global_with_rel): Likewise.
11029         (Output_data_got::add_global_with_rela): Likewise.
11030         (Output_data_got::add_global_pair_with_rel): New function.
11031         (Output_data_got::add_global_pair_with_rela): New function.
11032         (Output_data_got::add_local): Added got_type parameter.
11033         (Output_data_got::add_local_with_rel): Likewise.
11034         (Output_data_got::add_local_with_rela): Likewise.
11035         (Output_data_got::add_local_pair_with_rel): New function.
11036         (Output_data_got::add_local_pair_with_rela): New function.
11037         (Output_data_got::add_global_tls): Removed.
11038         (Output_data_got::add_global_tls_with_rel): Removed.
11039         (Output_data_got::add_global_tls_with_rela): Removed.
11040         (Output_data_got::add_local_tls): Removed.
11041         (Output_data_got::add_local_tls_with_rel): Removed.
11042         (Output_data_got::add_local_tls_with_rela): Removed.
11043         * resolve.cc (Symbol::override_base_with_special): Removed
11044         reference to has_got_offset_ field.
11045         * symtab.cc (Symbol::init_fields): Replaced initialization
11046         of got_offset_ with got_offsets_.  Removed initialization
11047         of has_got_offset_
11048         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11049         (Symbol::got_offset): Likewise.
11050         (Symbol::set_got_offset): Likewise.
11051         (Symbol::has_tls_got_offset): Removed.
11052         (Symbol::tls_got_offset): Removed.
11053         (Symbol::set_tls_got_offset): Removed.
11054         (Symbol::got_offset_): Removed.
11055         (Symbol::tls_mod_got_offset_): Removed.
11056         (Symbol::tls_pair_got_offset_): Removed.
11057         (Symbol::got_offsets_): New field.
11058         (Symbol::has_got_offset): Removed.
11059         (Symbol::has_tls_mod_got_offset): Removed.
11060         (Symbol::has_tls_pair_got_offset): Removed.
11061         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11062         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11063         member functions.
11064         (Target_x86_64::Scan::global): Likewise.
11065         (Target_x86_64::Relocate::relocate): Likewise.
11066         (Target_x86_64::Relocate::relocate_tls): Likewise.
11067
11068 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11069
11070         * yyscript.y: Fix spelling error in comment.
11071
11072 2008-03-24  Ian Lance Taylor  <iant@google.com>
11073
11074         * options.h (class General_options): Define build_id option.
11075         * layout.h (class Layout): Declare write_build_id, create_note,
11076         create_build_id.  Add build_id_note_ member.
11077         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11078         "libiberty.h", "md5.h", "sha1.h".
11079         (Layout::Layout): Initialize eh_frame_data_,
11080         eh_frame_hdr_section_, and build_id_note_.
11081         (Layout::finalize): Call create_build_id.
11082         (Layout::create_note): New function, broken out of
11083         Layout::create_gold_note.
11084         (Layout::create_gold_note): Call create_note.
11085         (Layout::create_build_id): New function.
11086         (Layout::write_build_id): New function.
11087         (Close_task_runner::run): Call write_build_id.
11088
11089         * x86_64.cc: Correct license to GPLv3.
11090
11091 2008-03-23  Ian Lance Taylor  <iant@google.com>
11092
11093         * options.cc: Include "demangle.h".
11094         (parse_optional_string): New function.
11095         (parse_long_option): Handle takes_optional_argument.
11096         (parse_short_option): Update dash_z initializer.  Handle
11097         takes_optional_argument.
11098         (General_options::General_options): Initialize do_demangle_.
11099         (General_options::finalize): Set do_demangle_.  Handle demangling
11100         style.
11101         * options.h (parse_optional_string): Declare.
11102         (struct One_option): Add optional_arg field.  Update constructor.
11103         Update call constructor calls.  Add takes_optional_argument
11104         function.
11105         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11106         (DEFINE_optional_string): Define.
11107         (General_options::demangle): Change from DEFINE_bool to
11108         DEFINE_optional_string.
11109         (General_options::no_demangle): New function.
11110         (General_options::do_demangle): New function.
11111         (General_options::set_do_demangle): New function.
11112         (General_options::execstack_status_): Move definition to end of
11113         class definition.
11114         (General_options::static_): Likewise.
11115         (General_options::do_demangle_): New field.
11116         * object.cc (big_endian>::get_symbol_location_info): Call
11117         Options::do_demangle, not Options::demangle.
11118         * symtab.cc (demangle): Likewise.
11119
11120 2008-03-22  Ian Lance Taylor  <iant@google.com>
11121
11122         * gold.h: Include <cstddef> and <sys/types.h>
11123         * options.h: Include <cstring>.
11124
11125 2008-03-21  Ian Lance Taylor  <iant@google.com>
11126
11127         * Added source code to GNU binutils.