PR gold/12880
[platform/upstream/binutils.git] / gold / ChangeLog
1 2011-06-17  Ian Lance Taylor  <iant@google.com>
2
3         PR gold/12880
4         * layout.h (class Layout): Add interp_segment_ field.
5         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6         (Layout::attach_allocated_section_to_segment): If making shared
7         library, put .interp section in PT_INTERP segment.
8         (Layout::finalize): Also call create_interp if -dynamic-linker
9         option was used.
10         (Layout::create_interp): Assert that there is no PT_INTERP
11         segment.  If not using a SECTIONS clause, use make_output_section.
12         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
13         * script-sections.cc
14         (Script_sections::create_note_and_tls_segments): If making shared
15         library, put .interp section in PT_INTERP segment.
16
17 2011-06-17  Ian Lance Taylor  <iant@google.com>
18
19         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
20         when making a shared library.
21
22 2011-06-17  Ian Lance Taylor  <iant@google.com>
23
24         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
25         parameter.  Change all callers.  Don't issue warning about PC32
26         against locally defined symbol.
27
28 2011-06-16  Ian Lance Taylor  <iant@google.com>
29
30         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
31         occurs in same object.
32
33 2011-06-14  Alan Modra  <amodra@gmail.com>
34
35         * po/POTFILES.in: Regenerate.
36
37 2011-06-09  Ian Lance Taylor  <iant@google.com>
38
39         * script-sections.cc
40         (Orphan_output_section::set_section_addresses): For a relocatable
41         link set address to 0.
42
43 2011-06-09  Cary Coutant  <ccoutant@google.com>
44
45         PR gold/12804
46         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
47         used with --compress-debug-sections.
48         * gold/object.cc (Sized_relobj_file::do_layout): Report
49         uncompressed size of compressed input sections.
50
51 2011-06-08  Cary Coutant  <ccoutant@google.com>
52
53         PR gold/12804
54         * testsuite/two_file_test_2_v1.cc: Change initialization of
55         v2 to keep it in .data.
56
57 2011-06-07  Cary Coutant  <ccoutant@google.com>
58
59         * common.cc (Symbol_table::do_allocate_commons_list): Call
60         gold_fallback.
61         * errors.cc (Errors::fatal): Adjust call to gold_exit.
62         (Errors::fallback): New function.
63         (gold_fallback): New function.
64         * errors.h (Errors::fallback): New function.
65         * gold.cc (gold_exit): Change status parameter to enum; adjust
66         all callers.
67         (queue_initial_tasks): Call gold_fallback.
68         * gold.h: Include cstdlib.
69         (Exit_status): New enum type.
70         (gold_exit): Change status parameter to enum.
71         (gold_fallback): New function.
72         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
73         (Layout::create_symtab_sections): Likewise.
74         (Layout::create_shdrs): Likewise.
75         * main.cc (main): Adjust call to gold_exit.
76         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
77         (Output_data_got::add_got_entry_pair): Likewise.
78         (Output_section::add_input_section): Likewise.
79         (Output_section::add_output_section_data): Likewise.
80         (Output_segment::set_section_list_addresses): Likewise.
81         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
82
83 2011-06-07  Cary Coutant  <ccoutant@google.com>
84
85         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
86         for incremental links.
87         * output.cc (Output_segment::set_section_list_addresses): Remove
88         FIXME and test for TLS or BSS.
89
90 2011-06-07  Cary Coutant  <ccoutant@google.com>
91
92         * testsuite/Makefile.am: Add incremental_copy_test,
93         incremental_common_test_1.
94         * testsuite/Makefile.in: Regenerate.
95         * testsuite/common_test_1_v1.c: New source file.
96         * testsuite/common_test_1_v2.c: New source file.
97         * testsuite/copy_test_v1.cc: New source file.
98
99 2011-06-07  Cary Coutant  <ccoutant@google.com>
100
101         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
102         update, allocate common from bss section's free list.
103         * incremental-dump.cc (dump_incremental_inputs): Print flag for
104         linker-defined symbols.
105         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
106         Skip GOT and PLT entries that are no longer referenced.
107         (Output_section_incremental_inputs::write_info_blocks): Mark
108         linker-defined symbols.
109         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
110         * output.cc (Output_section::allocate): New function.
111         * output.h (Output_section::allocate): New function.
112         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
113         linker-defined symbols.
114         (Symbol::override_base_with_special): Copy is_predefined_ flag.
115         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
116         (Symbol::init_base_output_data): Likewise.
117         (Symbol::init_base_output_segment): Likewise.
118         (Symbol::init_base_constant): Likewise.
119         (Sized_symbol::init_output_data): Likewise.
120         (Sized_symbol::init_output_segment): Likewise.
121         (Sized_symbol::init_constant): Likewise.
122         (Symbol_table::do_define_in_output_data): Likewise.
123         (Symbol_table::do_define_in_output_segment): Likewise.
124         (Symbol_table::do_define_as_constant): Likewise.
125         * symtab.h (Symbol::is_predefined): New function.
126         (Symbol::init_base_output_data): Add is_predefined parameter.
127         (Symbol::init_base_output_segment): Likewise.
128         (Symbol::init_base_constant): Likewise.
129         (Symbol::is_predefined_): New data member.
130         (Sized_symbol::init_output_data): Add is_predefined parameter.
131         (Sized_symbol::init_output_segment): Likewise.
132         (Sized_symbol::init_constant): Likewise.
133         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
134
135 2011-06-07  Cary Coutant  <ccoutant@google.com>
136
137         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
138         instead of emit_copy_reloc.
139         (Copy_relocs::emit_copy_reloc): Refactor.
140         (Copy_relocs::make_copy_reloc): New function.
141         (Copy_relocs::add_copy_reloc): Remove.
142         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
143         section.
144         (Copy_relocs::make_copy_reloc): New function.
145         (Copy_relocs::add_copy_reloc): Remove.
146         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
147         unchanged input files.
148         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
149         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
150         Reserve BSS space for COPY relocations.
151         (Sized_incremental_binary::do_emit_copy_relocs): New function.
152         (Output_section_incremental_inputs::write_info_blocks): Record
153         whether a symbol is copied from a shared object.
154         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
155         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
156         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
157         (Incremental_input_entry_reader::get_output_symbol_index): Add
158         is_copy parameter.
159         (Incremental_binary::emit_copy_relocs): New function.
160         (Incremental_binary::do_emit_copy_relocs): New function.
161         (Sized_incremental_binary::Sized_incremental_binary): Initialize
162         new data member.
163         (Sized_incremental_binary::add_copy_reloc): New function.
164         (Sized_incremental_binary::do_emit_copy_relocs): New function.
165         (Sized_incremental_binary::Copy_reloc): New struct.
166         (Sized_incremental_binary::Copy_relocs): New typedef.
167         (Sized_incremental_binary::copy_relocs_): New data member.
168         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
169         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
170         * target.h (Sized_target::emit_copy_reloc): New function.
171         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
172
173 2011-06-02  Cary Coutant  <ccoutant@google.com>
174
175         PR gold/12163
176         * gold/archive.cc (Archive::Archive): Initialize new data member.
177         (Archive::include_all_members): Return if archive has already been
178         included.
179         * gold/archive.h (Archive::include_all_members_): New data member.
180
181 2011-06-02  Nick Clifton  <nickc@redhat.com>
182
183         * dynobj.h: Fix spelling mistake in comment.
184         * output.cc: Likewise.
185
186 2011-05-31  Doug Kwan  <dougkwan@google.com>
187             Asier Llano
188
189         PR gold/12826
190         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
191         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
192         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
193         redundant arm_exidx_test.so.
194         * testsuite/Makefile.in: Regenerate.
195         (check_SCRIPTS): Add pr12826.sh
196         (check_DATA): Add pr12826.stdout
197         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
198         * testsuite/pr12826.sh: New file.
199         * testsuite/pr12826_1.s: Ditto.
200         * testsuite/pr12826_1.s: Ditto.
201
202 2011-05-30  Ian Lance Taylor  <iant@google.com>
203
204         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
205         sections.
206
207 2011-05-29  Ian Lance Taylor  <iant@google.com>
208
209         PR gold/12804
210         * testsuite/Makefile.am: Use different file name for two_file_test
211         temporary file for each incremental test.
212         * testsuite/Makefile.in: Rebuild.
213
214 2011-05-29  Ian Lance Taylor  <iant@google.com>
215
216         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
217         binary input file is empty.
218
219 2011-05-27  Ian Lance Taylor  <iant@google.com>
220
221         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
222         (ver_test_9.so): Likewise.
223         * testsuite/Makefile.in: Rebuild.
224
225 2011-05-26 Cary Coutant  <ccoutant@google.com>
226
227         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
228         * incremental.cc (Incremental_inputs::report_input_section): Fix
229         comment, indentation.
230         (Incremental_inputs::report_comdat_group): New function.
231         (Output_section_incremental_inputs::set_final_data_size): Adjust size
232         of data for incremental input file entry.
233         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
234         group count, COMDAT group signatures.
235         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
236         an unchanged input file.
237         * incremental.h (Incremental_object_entry::Incremental_object_entry):
238         Initialize new data member.
239         (Incremental_object_entry::add_comdat_group): New function.
240         (Incremental_object_entry::get_comdat_group_count): New function.
241         (Incremental_object_entry::get_comdat_signature_key): New function.
242         (Incremental_object_entry::groups_): New data member.
243         (Incremental_inputs::report_comdat_group): New function.
244         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
245         data for incremental input file entry.
246         (Incremental_input_entry_reader::get_comdat_group_count): New function.
247         (Incremental_input_entry_reader::get_input_section): Adjust size of
248         data for incremental input file entry.
249         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
250         (Incremental_input_entry_reader::get_comdat_group_signature): New
251         function.
252         * object.cc (Sized_relobj::include_section_group): Report kept
253         COMDAT groups for incremental links.
254
255 2011-05-24  David Meyer  <pdox@google.com>
256
257         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
258         with name parameter.  Add found_name parameter.
259         * fileread.cc (Input_file::find_file): Adjust code accordingly.
260         * dirsearch.h (class Dirsearch): Update declaration.
261
262 2011-05-24  Ian Lance Taylor  <iant@google.com>
263
264         * archive.cc (Library_base::should_include_member): Pull in object
265         from archive if it defines the entry symbol.
266         * parameters.cc (Parameters::entry): New function.
267         * parameters.h (class Parameters): Declare entry.
268         * output.h (class Output_file_header): Remove entry_ field.
269         * output.cc (Output_file_header::Output_file_header): Remove entry
270         parameter.  Change all callers.
271         (Output_file_header::entry): Use parameters->entry.
272         * gold.cc (queue_middle_tasks): Likewise.
273         * plugin.cc (Plugin_hook::run): Likewise.
274
275 2011-05-24 Cary Coutant  <ccoutant@google.com>
276
277         * gold.cc (queue_initial_tasks): Pass incremental base filename
278         to Output_file::open_base_file; don't print error message.
279         * incremental-dump.cc (main): Adjust call to
280         Output_file::open_for_modification.
281         * incremental-dump.cc (main): Likewise.
282         * incremental.cc (Incremental_inputs::report_command_line):
283         Ignore --incremental-base option when comparing command lines.
284         Ignore parameter when given as separate argument.
285         * options.h (class General_options): Add --incremental-base.
286         * output.cc (Output_file::Output_file):
287         (Output_file::open_base_file): Add base_name and writable parameters;
288         read base file into new file; print error message here.
289         (Output_file::map_no_anonymous): Add writable parameter; adjust all
290         callers.
291         * output.h (Output_file::open_for_modification): Rename to...
292         (Output_file::open_base_file): ...this; add base_name and
293         writable parameters; adjust all callers.
294         (Output_file::map_no_anonymous): Add writable parameter; adjust all
295         callers.
296         * testsuite/Makefile.am (incremental_test_4): Test
297         --incremental-base.
298         * testsuite/Makefile.in: Regenerate.
299
300 2011-05-24 Cary Coutant  <ccoutant@google.com>
301
302         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
303         incremental_test_4.
304         * testsuite/Makefile.in: Regenerate.
305         * testsuite/two_file_test_1_v1.cc: New test source file.
306         * testsuite/two_file_test_1b_v1.cc: New test source file.
307         * testsuite/two_file_test_2_v1.cc: New test source file.
308
309 2011-05-24 Cary Coutant  <ccoutant@google.com>
310
311         * dynobj.h (Dynobj::do_dynobj): New function.
312         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
313         flag and soname for shared objects.
314         * incremental.cc (Incremental_inputs::report_object): Make
315         either Incremental_object_entry or Incremental_dynobj_entry; add
316         soname to string table.
317         (Incremental_inputs::report_input_section): Add assertion.
318         (Output_section_incremental_inputs::set_final_data_size): Adjust
319         type of input file entry for shared libraries; adjust size of
320         shared library info entry.
321         (Output_section_incremental_inputs::write_input_files): Write
322         as_needed flag for shared libraries.
323         (Output_section_incremental_inputs::write_info_blocks): Adjust type
324         of input file entry for shared libraries; write soname.
325         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
326         soname from incremental info.
327         * incremental.h (enum Incremental_input_flags): Add
328         INCREMENTAL_INPUT_AS_NEEDED.
329         (Incremental_input_entry::Incremental_input_entry): Initialize new
330         data member.
331         (Incremental_input_entry::set_as_needed): New function.
332         (Incremental_input_entry::as_needed): New function.
333         (Incremental_input_entry::do_dynobj_entry): New function.
334         (Incremental_input_entry::as_needed_): New data member.
335         (Incremental_object_entry::Incremental_object_entry): Don't check
336         for shared library.
337         (Incremental_object_entry::do_type): Likewise.
338         (class Incremental_dynobj_entry): New class.
339         (Incremental_input_entry_reader::as_needed): New function.
340         (Incremental_input_entry_reader::get_soname): New function.
341         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
342         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
343         size of shared library info entry.
344         * layout.cc (Layout::finish_dynamic_section): Don't test for 
345         incremental link when adding DT_NEEDED entries.
346         * object.h (Object::Object): Initialize new data member.
347         (Object::dynobj): New function.
348         (Object::set_as_needed): New function.
349         (Object::as_needed): New function.
350         (Object::do_dynobj): New function.
351         (Object::as_needed_): New data member.
352
353 2011-05-24 Cary Coutant  <ccoutant@google.com>
354
355         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
356         info; adjust display of GOT entries.
357         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
358         vector of input objects; remove file_status_.
359         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
360         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
361         got_plt reader; call target hooks to reserve GOT entries.
362         (Output_section_incremental_inputs::set_final_data_size): Adjust size
363         of input file info header and GOT info entry.
364         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
365         relocation info.
366         (Got_plt_view_info::got_descriptor): Remove.
367         (Got_plt_view_info::sym_index): New data member.
368         (Got_plt_view_info::input_index): New data member.
369         (Local_got_offset_visitor::visit): Write input file index.
370         (Global_got_offset_visitor::visit): Write 0 for input file index.
371         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
372         with sym_index and input_index.
373         (Output_section_incremental_inputs::write_got_plt): Adjust size of
374         incremental info GOT entry; replace got_descriptor with input_index.
375         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
376         map from input file index to object.
377         (Sized_relobj_incr::do_layout): Replace direct data member reference
378         with accessor function.
379         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
380         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
381         Adjust size of input file info header.
382         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
383         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
384         (Incremental_input_entry_reader::get_input_section): Adjust size of
385         input file info header.
386         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
387         of incremental info GOT entry.
388         (Incremental_got_plt_reader::get_got_desc): Remove.
389         (Incremental_got_plt_reader::get_got_symndx): New function.
390         (Incremental_got_plt_reader::get_got_input_index): New function.
391         (Sized_incremental_binary::Sized_incremental_binary): Remove
392         file_status_; add input_objects_.
393         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
394         (Sized_incremental_binary::set_file_is_unchanged): Remove.
395         (Sized_incremental_binary::file_is_unchanged): Remove.
396         (Sized_incremental_binary::set_input_object): New function.
397         (Sized_incremental_binary::input_object): New function.
398         (Sized_incremental_binary::file_status_): Remove.
399         (Sized_incremental_binary::input_objects_): New data member.
400         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
401         references.
402         (Sized_relobj_incr::invalid_address): Move to base class.
403         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
404         class.
405         (Sized_relobj_incr::do_output_section_offset): Likewise.
406         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
407         (Sized_relobj_incr::section_offsets_): Likewise.
408         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
409         function.
410         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
411         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
412         with accessor function.
413         (Sized_relobj_file::do_layout): Likewise.
414         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
415         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
416         (Sized_relobj_file::compute_final_local_value): Replace refs to
417         section_offsets_ with accessor function.
418         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
419         * object.h (Relobj::Relobj): Initialize new data members.
420         (Relobj::add_dyn_reloc): New function.
421         (Relobj::first_dyn_reloc): New function.
422         (Relobj::dyn_reloc_count): New function.
423         (Relobj::first_dyn_reloc_): New data member.
424         (Relobj::dyn_reloc_count_): New data member.
425         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
426         references.
427         (Sized_relobj::Address): New typedef.
428         (Sized_relobj::invalid_address): Move here from child class.
429         (Sized_relobj::Sized_relobj): Initialize new data members.
430         (Sized_relobj::sized_relobj): New function.
431         (Sized_relobj::is_output_section_offset_invalid): Move here from
432         child class.
433         (Sized_relobj::get_output_section_offset): Likewise.
434         (Sized_relobj::local_has_got_offset): Likewise.
435         (Sized_relobj::local_got_offset): Likewise.
436         (Sized_relobj::set_local_got_offset): Likewise.
437         (Sized_relobj::do_for_all_local_got_entries): Likewise.
438         (Sized_relobj::clear_got_offsets): New function.
439         (Sized_relobj::section_offsets): Move here from child class.
440         (Sized_relobj::do_output_section_offset): Likewise.
441         (Sized_relobj::do_set_section_offset): Likewise.
442         (Sized_relobj::Local_got_offsets): Likewise.
443         (Sized_relobj::local_got_offsets_): Likewise.
444         (Sized_relobj::section_offsets_): Likewise.
445         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
446         references.
447         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
448         class.
449         (Sized_relobj_file::sized_relobj): New function
450         (Sized_relobj_file::local_has_got_offset): Move to base class.
451         (Sized_relobj_file::local_got_offset): Likewise.
452         (Sized_relobj_file::set_local_got_offset): Likewise.
453         (Sized_relobj_file::get_output_section_offset): Likewise.
454         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
455         (Sized_relobj_file::do_output_section_offset): Likewise.
456         (Sized_relobj_file::do_set_section_offset): Likewise.
457         (Sized_relobj_file::Local_got_offsets): Likewise.
458         (Sized_relobj_file::local_got_offsets_): Likewise.
459         (Sized_relobj_file::section_offsets_): Likewise.
460         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
461         (all constructors).
462         (set_needs_dynsym_index): Convert relobj to derived class pointer.
463         (Output_reloc::get_symbol_index): Likewise.
464         (Output_reloc::local_section_offset): Likewise.
465         (Output_reloc::get_address): Likewise.
466         (Output_reloc::symbol_value): Likewise.
467         (Output_data_got::reserve_slot): Move to class definition.
468         (Output_data_got::reserve_local): New function.
469         (Output_data_got::reserve_slot_for_global): Remove.
470         (Output_data_got::reserve_global): New function.
471         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
472         (all constructors, two instantiations).
473         (Output_reloc::get_relobj): New function (two instantiations).
474         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
475         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
476         (Output_data_reloc::add_global): Adjust type of relobj.
477         (Output_data_reloc::add_global_relative): Likewise.
478         (Output_data_reloc::add_symbolless_global_addend): Likewise.
479         (Output_data_reloc::add_local): Likewise.
480         (Output_data_reloc::add_local_relative): Likewise.
481         (Output_data_reloc::add_symbolless_local_addend): Likewise.
482         (Output_data_reloc::add_local_section): Likewise.
483         (Output_data_reloc::add_output_section): Likewise.
484         (Output_data_reloc::add_absolute): Likewise.
485         (Output_data_reloc::add_target_specific): Likewise.
486         (Output_data_got::reserve_slot): Move definition here.
487         (Output_data_got::reserve_local): New function.
488         (Output_data_got::reserve_global): New function.
489         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
490         section_offsets_ with accessor function.
491         (Sized_relobj_file::write_sections): Likewise.
492         (Sized_relobj_file::do_relocate_sections): Likewise.
493         * target.h (Sized_target::reserve_local_got_entry): New function.
494         (Sized_target::reserve_global_got_entry): New function.
495         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
496         (Target_x86_64::reserve_global_got_entry): New function.
497         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
498
499 2011-05-23 Cary Coutant  <ccoutant@google.com>
500
501         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
502         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
503         bit when checking got_type.
504         * incremental.cc (Sized_incremental_binary::setup_readers):
505         Store symbol table and string table locations; initialize bit vector
506         of file status flags.
507         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
508         unchanged files.
509         (Sized_incremental_binary::do_process_got_plt): New function.
510         (Sized_incremental_binary::get_symtab_view): Use stored locations.
511         (Output_section_incremental_inputs::set_final_data_size): Record
512         file index for each input file.
513         (Output_section_incremental_inputs::write_got_plt): Store file index
514         instead of input entry offset for each GOT entry.
515         * incremental.h
516         (Incremental_input_entry::Incremental_input_entry): Initialize new
517         data member.
518         (Incremental_input_entry::set_offset): Store file index.
519         (Incremental_input_entry::get_file_index): New function.
520         (Incremental_input_entry::file_index_): New data member.
521         (Incremental_binary::process_got_plt): New function.
522         (Incremental_binary::do_process_got_plt): New function.
523         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
524         data members.
525         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
526         (Sized_incremental_binary::set_file_is_unchanged): New function.
527         (Sized_incremental_binary::file_is_unchanged): New function.
528         (Sized_incremental_binary::do_process_got_plt): New function.
529         (Sized_incremental_binary::file_status_): New data member.
530         (Sized_incremental_binary::main_symtab_loc_): New data member.
531         (Sized_incremental_binary::main_strtab_loc_): New data member.
532         * output.cc (Output_data_got::Got_entry::write): Add case
533         RESERVED_CODE.
534         (Output_data_got::add_global): Call add_got_entry.
535         (Output_data_got::add_global_plt): Likewise.
536         (Output_data_got::add_global_with_rel): Likewise.
537         (Output_data_got::add_global_with_rela): Likewise.
538         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
539         (Output_data_got::add_global_pair_with_rela): Likewise.
540         (Output_data_got::add_local): Call add_got_entry.
541         (Output_data_got::add_local_plt): Likewise.
542         (Output_data_got::add_local_with_rel): Likewise.
543         (Output_data_got::add_local_with_rela): Likewise.
544         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
545         (Output_data_got::add_local_pair_with_rela): Likewise.
546         (Output_data_got::reserve_slot): New function.
547         (Output_data_got::reserve_slot_for_global): New function.
548         (Output_data_got::add_got_entry): New function.
549         (Output_data_got::add_got_entry_pair): New function.
550         (Output_section::add_output_section_data): Edit FIXME.
551         * output.h
552         (Output_section_data_build::Output_section_data_build): New
553         constructor with size parameter.
554         (Output_data_space::Output_data_space): Likewise.
555         (Output_data_got::Output_data_got): Initialize new data member; new
556         constructor with size parameter.
557         (Output_data_got::add_constant): Call add_got_entry.
558         (Output_data_got::reserve_slot): New function.
559         (Output_data_got::reserve_slot_for_global): New function.
560         (class Output_data_got::Got_entry): Add RESERVED_CODE.
561         (Output_data_got::add_got_entry): New function.
562         (Output_data_got::add_got_entry_pair): New function.
563         (Output_data_got::free_list_): New data member.
564         * target.h (Sized_target::init_got_plt_for_update): New function.
565         (Sized_target::register_global_plt_entry): New function.
566         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
567         Initialize new data member; call init; add constructor with PLT count.
568         (Output_data_plt_x86_64::init): New function.
569         (Output_data_plt_x86_64::add_relocation): New function.
570         (Output_data_plt_x86_64::reserve_slot): New function.
571         (Output_data_plt_x86_64::free_list_): New data member.
572         (Target_x86_64::init_got_plt_for_update): New function.
573         (Target_x86_64::register_global_plt_entry): New function.
574         (Output_data_plt_x86_64::add_entry): Allocate from free list for
575         incremental updates.
576         (Output_data_plt_x86_64::add_relocation): New function.
577         * testsuite/object_unittest.cc (Object_test): Set default options.
578
579 2011-05-16  Ian Lance Taylor  <iant@google.com>
580
581         * options.h (class General_options): Make -i a synonym for -r.
582
583 2011-05-16  Ian Lance Taylor  <iant@google.com>
584
585         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
586
587 2011-05-10 Cary Coutant  <ccoutant@google.com>
588
589         * object.cc (Sized_relobj::do_count_local_symbols): Check for
590         strip_all (-s).
591
592 2011-05-06  Ian Lance Taylor  <iant@google.com>
593
594         * layout.cc (Layout::layout): If the output section flags change,
595         update the ordering.
596
597 2011-04-25 Cary Coutant  <ccoutant@google.com>
598
599         * incremental-dump.cc (dump_incremental_inputs): Print local
600         symbol info for each input file.
601         * incremental.cc
602         (Output_section_incremental_inputs::set_final_data_size): Add local
603         symbol info to input file entries in incremental info.
604         (Output_section_incremental_inputs::write_info_blocks): Likewise.
605         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
606         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
607         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
608         implementation.
609         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
610         (Sized_incr_relobj::do_relocate): Write the local symbols.
611         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
612         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
613         Adjust size of input file header.
614         (Incremental_inputs_reader::get_local_symbol_offset): New function.
615         (Incremental_inputs_reader::get_local_symbol_count): New function.
616         (Incremental_inputs_reader::get_input_section): Adjust size of input
617         file header.
618         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
619         (Sized_incr_relobj::This): New typedef.
620         (Sized_incr_relobj::sym_size): New const data member.
621         (Sized_incr_relobj::Local_symbol): New struct.
622         (Sized_incr_relobj::do_output_local_symbol_count): New function.
623         (Sized_incr_relobj::do_local_symbol_offset): New function.
624         (Sized_incr_relobj::local_symbol_count_): New data member.
625         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
626         (Sized_incr_relobj::local_symbol_index_): New data member.
627         (Sized_incr_relobj::local_symbol_offset_): New data member.
628         (Sized_incr_relobj::local_dynsym_offset_): New data member.
629         (Sized_incr_relobj::local_symbols_): New data member.
630         * object.h (Relobj::output_local_symbol_count): New function.
631         (Relobj::local_symbol_offset): New function.
632         (Relobj::do_output_local_symbol_count): New function.
633         (Relobj::do_local_symbol_offset): New function.
634         (Sized_relobj::do_output_local_symbol_count): New function.
635         (Sized_relobj::do_local_symbol_offset): New function.
636
637 2011-04-22  Vladimir Simonov  <sv@sw.ru>
638
639         * descriptors.cc (set_close_on_exec): New function.
640         (Descriptors::open): Use set_close_on_exec.
641         * output.cc (S_ISLNK): Define if not defined.
642
643 2011-04-22 Cary Coutant  <ccoutant@google.com>
644
645         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
646         global symbol map.
647         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
648         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
649         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
650         relocations.
651         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
652         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
653         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
654         * incremental.h
655         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
656         function.
657         (Incremental_binary::apply_incremental_relocs): New function.
658         (Incremental_binary::do_apply_incremental_relocs): New function.
659         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
660         data member.
661         (Sized_incremental_binary::add_global_symbol): New function.
662         (Sized_incremental_binary::global_symbol): New function.
663         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
664         (Sized_incremental_binary::symbol_map_): New data member.
665         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
666         * target.h (Sized_target::apply_relocation): New function.
667         * target-reloc.h (apply_relocation): New function.
668         * x86_64.cc (Target_x86_64::apply_relocation): New function.
669
670 2011-04-22  Doug Kwan  <dougkwan@google.com>
671
672         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
673         flag of a SHT_ARM_EXIDX section.
674         * testsuite/Makefile.am (arm_exidx_test): New test rules.
675         * testsuite/Makefile.in: Regenerate.
676         * testsuite/arm_exidx_test.s: New file.
677         * testsuite/arm_exidx_test.sh: Same.
678
679 2011-04-20 Cary Coutant  <ccoutant@google.com>
680
681         PR gold/12689
682         * archive.h (Incremental_archive_entry::Archive_member):
683         Initialize arg_serial_ (second constructor).
684
685 2011-04-17  Ian Lance Taylor  <iant@google.com>
686
687         * object.cc (Relocate_info::location): Simplify location string.
688         * errors.cc (Errors::error_at_location): Don't print program
689         name.
690         (Errors::warning_at_location): Likewise.
691         (Errors::undefined_symbol): Likewise.
692         * testsuite/debug_msg.sh: Update accordingly.
693
694 2011-04-14 Cary Coutant  <ccoutant@google.com>
695
696         * gold/layout.cc (Layout::symtab_section_offset): New function.
697         * gold/layout.h (Layout::symtab_section_offset): New function.
698         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
699
700 2011-04-12  Ian Lance Taylor  <iant@google.com>
701
702         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
703         with MREMAP_MAYMOVE.
704         * output.h (class Output_file): Add map_is_allocated_ field.
705         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
706         not available, provide stubs.  If mremap is not available, #define
707         it to gold_mremap.
708         (MREMAP_MAYMOVE): Define if not defined.
709         (Output_file::Output_file): Initialize map_is_allocated_.
710         (Output_file::resize): Check map_is_allocated_.
711         (Output_file::map_anonymous): If mmap fails, use malloc.
712         (Output_file::unmap): Don't do anything for an anonymous map.
713         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
714         is not available, provide stubs.
715         (File_read::View::~View): Use free rather than delete[].
716         (File_read::make_view): Use malloc rather than new[].  If mmap
717         fails, use malloc.
718         (File_read::find_or_make_view): Use malloc rather than new[].
719         * gold.h: Remove HAVE_REMAP code.
720         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
721         exists.  Rename mremap to gold_mremap.  If mmap is not available
722         don't do anything.
723         * configure, config.in: Rebuild.
724
725 2011-04-11  Ian Lance Taylor  <iant@google.com>
726
727         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
728         initialize local variable v.
729
730 2011-04-11  Cary Coutant  <ccoutant@google.com>
731
732         * archive.cc (Archive::include_member): Adjust call to
733         report_object.
734         (Add_archive_symbols::run): Track argument serial numbers.
735         (Lib_group::include_member): Likewise.
736         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
737         * archive.h (Incremental_archive_entry::Archive_member):
738         Initialize arg_serial_.
739         (Archive_member::arg_serial_): New data member.
740         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
741         (Sized_dynobj::do_add_symbols): Track symbols when doing an
742         incremental link.
743         (Sized_dynobj::do_for_all_local_got_entries): New function.
744         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
745         function.
746         * fileread.cc (get_mtime): New function.
747         * fileread.h (get_mtime): New function.
748         * gold.cc (queue_initial_tasks): Check for incremental update.
749         (process_incremental_input): New function.
750         (queue_middle_tasks): Don't force valid target for incremental
751         update.
752         * incremental-dump.cc (find_input_containing_global): Adjust
753         size of symbol info entry.
754         (dump_incremental_inputs): Dump argument serial number and
755         in_system_directory flag; bias shndx by 1; print symbol names
756         when dumping per-file symbol lists; use new symbol info readers.
757         * incremental.cc
758         (Output_section_incremental_inputs:update_data_size): New function.
759         (Sized_incremental_binary::setup_readers): Setup input readers
760         for each input file; build maps for files added from libraries
761         and scripts.
762         (Sized_incremental_binary::check_input_args): New function.
763         (Sized_incremental_binary::do_check_inputs): Build map of argument
764         serial numbers to input arguments.
765         (Sized_incremental_binary::do_file_has_changed): Rename
766         do_file_is_unchanged to this; compare file modification times.
767         (Sized_incremental_binary::do_init_layout): New function.
768         (Sized_incremental_binary::do_reserve_layout): New function.
769         (Sized_incremental_binary::do_get_input_reader): Remove.
770         (Sized_incremental_binary::get_symtab_view): New function.
771         (Incremental_checker::can_incrementally_link_output_file): Remove.
772         (Incremental_inputs::report_command_line): Exclude --debug options.
773         (Incremental_inputs::report_archive_begin): Add parameter; track
774         argument serial numbers; don't put input file entry for archive
775         before archive members.
776         (Incremental_inputs::report_archive_end): Put input file entry
777         for archive after archive members.
778         (Incremental_inputs::report_object): Add parameter; track argument
779         serial numbers and in_system_directory flag.
780         (Incremental_inputs::report_script): Add parameter; track argument
781         serial numbers.
782         (Output_section_incremental_inputs::set_final_data_size): Adjust
783         size of symbol info entry; check for forwarding symbols.
784         (Output_section_incremental_inputs::write_input_files): Write
785         in_system_directory flag and argument serial number.
786         (Output_section_incremental_inputs::write_info_blocks): Map section
787         indices between incremental info and original input file; store
788         input section index for each symbol.
789         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
790         change operator() to visit().
791         (class Global_got_offset_visitor): Likewise.
792         (class Global_symbol_visitor_got_plt):
793         (Output_section_incremental_inputs::write_got_plt): Use new visitor
794         classes.
795         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
796         (Sized_incr_relobj::do_read_symbols): New function.
797         (Sized_incr_relobj::do_layout): New function.
798         (Sized_incr_relobj::do_layout_deferred_sections): New function.
799         (Sized_incr_relobj::do_add_symbols): New function.
800         (Sized_incr_relobj::do_should_include_member): New function.
801         (Sized_incr_relobj::do_for_all_global_symbols): New function.
802         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
803         (Sized_incr_relobj::do_section_size): New function.
804         (Sized_incr_relobj::do_section_name): New function.
805         (Sized_incr_relobj::do_section_contents): New function.
806         (Sized_incr_relobj::do_section_flags): New function.
807         (Sized_incr_relobj::do_section_entsize): New function.
808         (Sized_incr_relobj::do_section_address): New function.
809         (Sized_incr_relobj::do_section_type): New function.
810         (Sized_incr_relobj::do_section_link): New function.
811         (Sized_incr_relobj::do_section_info): New function.
812         (Sized_incr_relobj::do_section_addralign): New function.
813         (Sized_incr_relobj::do_initialize_xindex): New function.
814         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
815         (Sized_incr_relobj::do_read_relocs): New function.
816         (Sized_incr_relobj::do_gc_process_relocs): New function.
817         (Sized_incr_relobj::do_scan_relocs): New function.
818         (Sized_incr_relobj::do_count_local_symbols): New function.
819         (Sized_incr_relobj::do_finalize_local_symbols): New function.
820         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
821         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
822         (Sized_incr_relobj::do_relocate): New function.
823         (Sized_incr_relobj::do_set_section_offset): New function.
824         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
825         (Sized_incr_dynobj::do_read_symbols): New function.
826         (Sized_incr_dynobj::do_layout): New function.
827         (Sized_incr_dynobj::do_add_symbols): New function.
828         (Sized_incr_dynobj::do_should_include_member): New function.
829         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
830         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
831         (Sized_incr_dynobj::do_section_size): New function.
832         (Sized_incr_dynobj::do_section_name): New function.
833         (Sized_incr_dynobj::do_section_contents): New function.
834         (Sized_incr_dynobj::do_section_flags): New function.
835         (Sized_incr_dynobj::do_section_entsize): New function.
836         (Sized_incr_dynobj::do_section_address): New function.
837         (Sized_incr_dynobj::do_section_type): New function.
838         (Sized_incr_dynobj::do_section_link): New function.
839         (Sized_incr_dynobj::do_section_info): New function.
840         (Sized_incr_dynobj::do_section_addralign): New function.
841         (Sized_incr_dynobj::do_initialize_xindex): New function.
842         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
843         (make_sized_incremental_object): New function.
844         (Incremental_library::copy_unused_symbols): New function.
845         (Incremental_library::do_for_all_unused_symbols): New function.
846         * incremental.h (enum Incremental_input_flags): New type.
847         (class Incremental_checker): Remove.
848         (Incremental_input_entry::Incremental_input_entry): Add argument
849         serial number.
850         (Incremental_input_entry::arg_serial): New function.
851         (Incremental_input_entry::set_is_in_system_directory): New function.
852         (Incremental_input_entry::is_in_system_directory): New function.
853         (Incremental_input_entry::arg_serial_): New data member.
854         (Incremental_input_entry::is_in_system_directory_): New data member.
855         (class Script_info): Move here from script.h.
856         (Script_info::Script_info): Add filename parameter.
857         (Script_info::filename): New function.
858         (Script_info::filename_): New data member.
859         (Incremental_script_entry::Incremental_script_entry): Add argument
860         serial number.
861         (Incremental_object_entry::Incremental_object_entry): Likewise.
862         (Incremental_object_entry::add_input_section): Build list of input
863         sections with map to original shndx.
864         (Incremental_object_entry::get_input_section_index): New function.
865         (Incremental_object_entry::shndx_): New data member.
866         (Incremental_object_entry::name_key_): Rename; adjust all refs.
867         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
868         (Incremental_archive_entry::Incremental_archive_entry): Add argument
869         serial number.
870         (Incremental_inputs::report_archive_begin): Likewise.
871         (Incremental_inputs::report_object): Likewise.
872         (Incremental_inputs::report_script): Likewise.
873         (class Incremental_global_symbol_reader): New class.
874         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
875         and store flags and input file type.
876         (Incremental_input_entry_reader::arg_serial): New function.
877         (Incremental_input_entry_reader::type): Extract type from flags.
878         (Incremental_input_entry_reader::is_in_system_directory): New function.
879         (Incremental_input_entry_reader::get_input_section_count): Call
880         accessor function for type.
881         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
882         function for type; adjust size of global symbol entry.
883         (Incremental_input_entry_reader::get_global_symbol_count): Call
884         accessor function for type.
885         (Incremental_input_entry_reader::get_object_count): Likewise.
886         (Incremental_input_entry_reader::get_object_offset): Likewise.
887         (Incremental_input_entry_reader::get_member_count): Likewise.
888         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
889         (Incremental_input_entry_reader::get_member_offset): Likewise.
890         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
891         (Incremental_input_entry_reader::Global_symbol_info): Remove.
892         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
893         (Incremental_input_entry_reader::get_global_symbol_reader): New
894         function.
895         (Incremental_input_entry_reader::get_output_symbol_index): New
896         function.
897         (Incremental_input_entry_reader::type_): Remove.
898         (Incremental_input_entry_reader::flags_): New data member.
899         (Incremental_inputs_reader::input_file_offset): New function.
900         (Incremental_inputs_reader::input_file_index): New function.
901         (Incremental_inputs_reader::input_file): Call input_file_offset.
902         (Incremental_inputs_reader::input_file_at_offset): New function.
903         (Incremental_relocs_reader::get_r_type): Reformat.
904         (Incremental_relocs_reader::get_r_shndx): Reformat.
905         (Incremental_relocs_reader::get_r_offset): Reformat.
906         (Incremental_relocs_reader::data): New function.
907         (Incremental_binary::Incremental_binary): Initialize new data members.
908         (Incremental_binary::check_inputs): Add cmdline parameter.
909         (Incremental_binary::file_is_unchanged): Remove.
910         (Input_reader::arg_serial): New function.
911         (Input_reader::get_unused_symbol_count): New function.
912         (Input_reader::get_unused_symbol): New function.
913         (Input_reader::do_arg_serial): New function.
914         (Input_reader::do_get_unused_symbol_count): New function.
915         (Input_reader::do_get_unused_symbol): New function.
916         (Incremental_binary::input_file_count): New function.
917         (Incremental_binary::get_input_reader): Change signature to use
918         index instead of filename.
919         (Incremental_binary::file_has_changed): New function.
920         (Incremental_binary::get_input_argument): New function.
921         (Incremental_binary::get_library): New function.
922         (Incremental_binary::get_script_info): New function.
923         (Incremental_binary::init_layout): New function.
924         (Incremental_binary::reserve_layout): New function.
925         (Incremental_binary::output_file): New function.
926         (Incremental_binary::do_check_inputs): New function.
927         (Incremental_binary::do_file_is_unchanged): Remove.
928         (Incremental_binary::do_file_has_changed): New function.
929         (Incremental_binary::do_init_layout): New function.
930         (Incremental_binary::do_reserve_layout): New function.
931         (Incremental_binary::do_input_file_count): New function.
932         (Incremental_binary::do_get_input_reader): Change signature.
933         (Incremental_binary::input_args_map_): New data member.
934         (Incremental_binary::library_map_): New data member.
935         (Incremental_binary::script_map_): New data member.
936         (Sized_incremental_binary::Sized_incremental_binary): Initialize
937         new data members.
938         (Sized_incremental_binary::output_section): New function.
939         (Sized_incremental_binary::inputs_reader): Add const.
940         (Sized_incremental_binary::symtab_reader): Add const.
941         (Sized_incremental_binary::relocs_reader): Add const.
942         (Sized_incremental_binary::got_plt_reader): Add const.
943         (Sized_incremental_binary::get_symtab_view): New function.
944         (Sized_incremental_binary::Inputs_reader): New typedef.
945         (Sized_incremental_binary::Input_entry_reader): New typedef.
946         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
947         (Sized_incremental_binary::do_file_is_unchanged): Remove.
948         (Sized_incremental_binary::do_file_has_changed): New function.
949         (Sized_incremental_binary::do_init_layout): New function.
950         (Sized_incremental_binary::do_reserve_layout): New function.
951         (Sized_input_reader::Inputs_reader): Remove.
952         (Sized_input_reader::Input_entry_reader): Remove.
953         (Sized_input_reader::do_arg_serial): New function.
954         (Sized_input_reader::do_get_unused_symbol_count): New function.
955         (Sized_input_reader::do_get_unused_symbol): New function.
956         (Sized_incremental_binary::do_input_file_count): New function.
957         (Sized_incremental_binary::do_get_input_reader): Change signature;
958         use index instead of filename.
959         (Sized_incremental_binary::section_map_): New data member.
960         (Sized_incremental_binary::input_entry_readers_): New data member.
961         (class Sized_incr_relobj): New class.
962         (class Sized_incr_dynobj): New class.
963         (make_sized_incremental_object): New function.
964         (class Incremental_library): New class.
965         * layout.cc (Free_list::num_lists): New static data member.
966         (Free_list::num_nodes): New static data member.
967         (Free_list::num_removes): New static data member.
968         (Free_list::num_remove_visits): New static data member.
969         (Free_list::num_allocates): New static data member.
970         (Free_list::num_allocate_visits): New static data member.
971         (Free_list::init): New function.
972         (Free_list::remove): New function.
973         (Free_list::allocate): New function.
974         (Free_list::dump): New function.
975         (Free_list::print_stats): New function.
976         (Layout_task_runner::run): Resize output file for incremental updates.
977         (Layout::Layout): Initialize new data members.
978         (Layout::set_incremental_base): New function.
979         (Layout::init_fixed_output_section): New function.
980         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
981         incremental updates.
982         (Layout::create_gold_note): Do not create gold note section for
983         incremental updates.
984         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
985         for incremental updates.
986         (Layout::set_section_offsets): For incremental updates, allocate space
987         from free list.
988         (Layout::create_symtab_sections): Layout with offsets relative to
989         start of section; for incremental updates, allocate space from free
990         list.
991         (Layout::create_shdrs): For incremental updates, allocate space from
992         free list.
993         (Layout::finish_dynamic_section): For incremental updates, do not
994         check --as-needed (fixed in subsequent patch).
995         * layout.h (class Free_list): New class.
996         (Layout::set_incremental_base): New function.
997         (Layout::incremental_base): New function.
998         (Layout::init_fixed_output_section): New function.
999         (Layout::allocate): New function.
1000         (Layout::incremental_base_): New data member.
1001         (Layout::free_list_): New data member.
1002         * main.cc (main): Print Free_list statistics.
1003         * object.cc (Relobj::finalize_incremental_relocs): Add
1004         clear_counts parameter; clear counts only when clear_counts is set.
1005         (Sized_relobj::Sized_relobj): Initialize new base class.
1006         (Sized_relobj::do_layout): Don't report special sections.
1007         (Sized_relobj::do_for_all_local_got_entries): New function.
1008         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1009         symtab_off to all symbol table offsets.
1010         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1011         * object.h (class Got_offset_list): Move to top of file.
1012         (Object::Object): Allow case where input_file == NULL.
1013         (Object::~Object): Likewise.
1014         (Object::input_file): Assert that input_file != NULL.
1015         (Object::lock): Allow case where input_file == NULL.
1016         (Object::unlock): Likewise.
1017         (Object::is_locked): Likewise.
1018         (Object::token): Likewise.
1019         (Object::release): Likewise.
1020         (Object::is_incremental): New function.
1021         (Object::get_mtime): New function.
1022         (Object::for_all_local_got_entries): New function.
1023         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1024         (Object::set_is_in_system_directory): New function.
1025         (Object::is_in_system_directory): New function.
1026         (Object::do_is_incremental): New function.
1027         (Object::do_get_mtime): New function.
1028         (Object::do_for_all_local_got_entries): New function.
1029         (Object::is_in_system_directory_): New data member.
1030         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1031         (class Sized_relobj_base): New class.
1032         (class Sized_relobj): Derive from Sized_relobj_base.
1033         (class Sized_relobj::Symbols): Redeclare from base class.
1034         (class Sized_relobj::local_got_offset_list): Remove.
1035         (class Sized_relobj::Output_sections): Redeclare from base class.
1036         (class Sized_relobj::do_for_all_local_got_entries): New function.
1037         (class Sized_relobj::write_local_symbols): Add offset parameter.
1038         (class Sized_relobj::local_symbol_offset_): Update comment.
1039         (class Sized_relobj::local_dynsym_offset_): Update comment.
1040         * options.cc (Input_arguments::add_file): Remove const.
1041         * options.h (Input_file_argument::Input_file_argument):
1042         Initialize arg_serial_ (all constructors).
1043         (Input_file_argument::set_arg_serial): New function.
1044         (Input_file_argument::arg_serial): New function.
1045         (Input_file_argument::arg_serial_): New data member.
1046         (Input_arguments::Input_arguments): Initialize file_count_.
1047         (Input_arguments::add_file): Remove const.
1048         (Input_arguments::number_of_input_files): New function.
1049         (Input_arguments::file_count_): New data member.
1050         (Command_line::number_of_input_files): Call
1051         Input_arguments::number_of_input_files.
1052         * output.cc (Output_segment_headers::Output_segment_headers):
1053         Set current size.
1054         (Output_section::Input_section::current_data_size): New function.
1055         (Output_section::Output_section): Initialize new data members.
1056         (Output_section::add_input_section): Don't do merge sections for
1057         an incremental link; allocate space from free list for an
1058         incremental update.
1059         (Output_section::add_output_section_data): Allocate space from
1060         free list for an incremental update.
1061         (Output_section::update_data_size): New function.
1062         (Output_section::set_fixed_layout): New function.
1063         (Output_section::reserve): New function.
1064         (Output_segment::set_section_addresses): Remove const.
1065         (Output_segment::set_section_list_addresses): Remove const; allocate
1066         space from free list for an incremental update.
1067         (Output_segment::set_offset): Adjust size of RELRO segment for an
1068         incremental update.
1069         * output.h (Output_data::current_data_size): Move here from
1070         child classes.
1071         (Output_data::pre_finalize_data_size): New function.
1072         (Output_data::update_data_size): New function.
1073         (Output_section_headers::update_data_size): new function.
1074         (Output_section_data_build::current_data_size): Move to Output_data.
1075         (Output_data_strtab::update_data_size): New function.
1076         (Output_section::current_data_size): Move to Output_data.
1077         (Output_section::set_fixed_layout): New function.
1078         (Output_section::has_fixed_layout): New function.
1079         (Output_section::reserve): New function.
1080         (Output_section::update_data_size): New function.
1081         (Output_section::has_fixed_layout_): New data member.
1082         (Output_section::free_list_): New data member.
1083         (Output_segment::set_section_addresses): Remove const.
1084         (Output_segment::set_section_list_addresses): Remove const.
1085         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1086         New function.
1087         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1088         New function.
1089         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1090         parameter when calling Add_symbols constructor; store argument
1091         serial number for members of a lib group.
1092         (Add_symbols::locks): Allow case where token == NULL.
1093         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1094         (Read_member::~Read_member): New function.
1095         (Read_member::is_runnable): New function.
1096         (Read_member::locks): New function.
1097         (Read_member::run): New function.
1098         (Check_script::~Check_script): New function.
1099         (Check_script::is_runnable): New function.
1100         (Check_script::locks): New function.
1101         (Check_script::run): New function.
1102         (Check_library::~Check_library): New function.
1103         (Check_library::is_runnable): New function.
1104         (Check_library::locks): New function.
1105         (Check_library::run): New function.
1106         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1107         (Add_symbols::library_): New data member.
1108         (class Read_member): New class.
1109         (class Check_script): New class.
1110         (class Check_library): New class.
1111         * reloc.cc (Read_relocs::is_runnable): Allow case where
1112         token == NULL.
1113         (Read_relocs::locks): Likewise.
1114         (Scan_relocs::locks): Likewise.
1115         (Relocate_task::locks): Likewise.
1116         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1117         to clear counters.
1118         (Sized_relobj::incremental_relocs_scan): Fix comment.
1119         (Sized_relobj::do_relocate): Pass output file offset to
1120         write_local_symbols.
1121         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1122         from class declaration.
1123         * script.cc (read_input_script): Allocate Script_info; pass
1124         argument serial number to report_script.
1125         * script.h (class Script_info): Move to incremental.h.
1126         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1127         * symtab.h (Symbol_table::add_from_incrobj): New function.
1128         (Symbol_table::set_file_offset): New function.
1129
1130 2011-04-05  Cary Coutant  <ccoutant@google.com>
1131
1132         * incremental-dump.cc (dump_incremental_inputs): Change signature
1133         to take a Sized_incremental_binary; change caller.  Use readers
1134         in Sized_incremental_binary.
1135         * incremental.cc
1136         (Sized_incremental_binary::find_incremental_inputs_sections):
1137         Rename do_find_incremental_inputs_sections to this.
1138         (Sized_incremental_binary::setup_readers): New function.
1139         (Sized_incremental_binary::do_check_inputs): Check
1140         has_incremental_info_ flag; move setup code to setup_readers;
1141         use input readers.
1142         (Sized_incremental_binary::do_file_is_unchanged): New function.
1143         (Sized_incremental_binary::do_get_input_reader): New function.
1144         * incremental.h (class Incremental_binary): Move to end of file.
1145         (Incremental_binary::file_is_unchanged): New function.
1146         (Incremental_binary::do_file_is_unchanged): New function.
1147         (Incremental_binary::Input_reader): New class.
1148         (Incremental_binary::get_input_reader): New function.
1149         (class Sized_incremental_binary): Move to end of file.
1150         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1151         input section reader classes.
1152         (Sized_incremental_binary::has_incremental_info): New function.
1153         (Sized_incremental_binary::inputs_reader): New function.
1154         (Sized_incremental_binary::symtab_reader): New function.
1155         (Sized_incremental_binary::relocs_reader): New function.
1156         (Sized_incremental_binary::got_plt_reader): New function.
1157         (Sized_incremental_binary::do_file_is_unchanged): New function.
1158         (Sized_incremental_binary::Sized_input_reader): New class.
1159         (Sized_incremental_binary::get_input_reader): New function.
1160         (Sized_incremental_binary::find_incremental_inputs_sections):
1161         Rename do_find_incremental_inputs_sections to this.
1162         (Sized_incremental_binary::setup_readers): New function.
1163         (Sized_incremental_binary::has_incremental_info_): New data member.
1164         (Sized_incremental_binary::inputs_reader_): New data member.
1165         (Sized_incremental_binary::symtab_reader_): New data member.
1166         (Sized_incremental_binary::relocs_reader_): New data member.
1167         (Sized_incremental_binary::got_plt_reader_): New data member.
1168         (Sized_incremental_binary::current_input_file_): New data member.
1169
1170 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1171
1172         PR gold/12640
1173         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1174         violation.
1175
1176 2011-03-30  Cary Coutant  <ccoutant@google.com>
1177
1178         * archive.cc (Archive::include_member): Adjust call to report_object.
1179         (Add_archive_symbols::run): Add script_info to call to
1180         report_archive_begin.
1181         (Lib_group::include_member): Adjust call to report_object.
1182         (Add_lib_group_symbols::run): Adjust call to report_object.
1183         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1184         blocks.  Add object count for script input files.
1185         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1186         script_info parameter; change all callers.
1187         (Incremental_inputs::report_object): Add script_info parameter;
1188         change all callers.
1189         (Incremental_inputs::report_script): Store backpointer to
1190         incremental info entry.
1191         (Output_section_incremental_inputs::set_final_data_size): Record
1192         additional information for scripts.
1193         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1194         * incremental.h (Incremental_script_entry::add_object): New function.
1195         (Incremental_script_entry::get_object_count): New function.
1196         (Incremental_script_entry::get_object): New function.
1197         (Incremental_script_entry::objects_): New data member; adjust
1198         constructor.
1199         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1200         (Incremental_inputs::report_object): Add script_info parameter.
1201         (Incremental_inputs_reader::get_object_count): New function.
1202         (Incremental_inputs_reader::get_object_offset): New function.
1203         * options.cc (Input_arguments::add_file): Return reference to
1204         new input argument.
1205         * options.h (Input_argument::set_script_info): New function.
1206         (Input_argument::script_info): New function.
1207         (Input_argument::script_info_): New data member; adjust all
1208         constructors.
1209         (Input_file_group::add_file): Return reference to new input argument.
1210         (Input_file_lib::add_file): Likewise.
1211         (Input_arguments::add_file): Likewise.
1212         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1213         * script.cc (Parser_closure::Parser_closure): Add script_info
1214         parameter; adjust all callers.
1215         (Parser_closure::script_info): New function.
1216         (Parser_closure::script_info_): New data member.
1217         (read_input_script): Report scripts earlier to incremental info.
1218         (script_add_file): Set script_info in Input_argument.
1219         (script_add_library): Likewise.
1220         * script.h (Script_options::Script_info): Rewrite class.
1221
1222 2011-03-29  Cary Coutant  <ccoutant@google.com>
1223
1224         * archive.cc (Library_base::should_include_member): Move
1225         method here from class Archive.
1226         (Archive::Archive): Initialize base class.
1227         (Archive::should_include_member): Move to base class.
1228         (Archive::do_for_all_unused_symbols): New function.
1229         (Add_archive_symbols::run): Remove redundant access to
1230         incremental_inputs.
1231         (Lib_group::Lib_group): Initialize base class.
1232         (Lib_group::do_filename): New function.
1233         (Lib_group::include_member): Pass pointer to Lib_group to
1234         report_object.
1235         (Lib_group::do_for_all_unused_symbols): New function.
1236         (Add_lib_group_symbols::run): Report archive information for
1237         incremental links.
1238         * archive.h (class Library_base): New base class.
1239         (class Archive): Derive from Library_base.
1240         (Archive::filename): Move to base class.
1241         (Archive::set_incremental_info): Likewise.
1242         (Archive::incremental_info): Likewise.
1243         (Archive::Should_include): Likewise.
1244         (Archive::should_include_member): Likewise.
1245         (Archive::Armap_entry): Remove.
1246         (Archive::Unused_symbol_iterator): Remove.
1247         (Archive::unused_symbols_begin): Remove.
1248         (Archive::unused_symbols_end): Remove.
1249         (Archive::do_filename): New function.
1250         (Archive::do_get_mtime): New function.
1251         (Archive::do_for_all_unused_symbols): New function.
1252         (Archive::task_): Move to base class.
1253         (Archive::incremental_info_): Likewise.
1254         (class Lib_group): Derive from Library_base.
1255         (Lib_group::do_filename): New function.
1256         (Lib_group::do_get_mtime): New function.
1257         (Lib_group::do_for_all_unused_symbols): New function.
1258         (Lib_group::task_): Move to base class.
1259         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1260         function.
1261         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1262         function.
1263         * incremental.cc (Incremental_inputs::report_archive_begin):
1264         Use Library_base; call library's get_mtime; add incremental inputs
1265         entry before members.
1266         (class Unused_symbol_visitor): New class.
1267         (Incremental_inputs::report_archive_end): Use Library_base; use
1268         visitor class to record unused symbols; don't add incremental inputs
1269         entry after members.
1270         (Incremental_inputs::report_object): Use Library_base.
1271         * incremental.h
1272         (Incremental_archive_entry::Incremental_archive_entry): Remove
1273         unused Archive parameter.
1274         (Incremental_inputs::report_archive_begin): Use Library_base.
1275         (Incremental_inputs::report_archive_end): Likewise.
1276         (Incremental_inputs::report_object): Likewise.
1277         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1278         function.
1279         * object.h (Object::for_all_global_symbols): New function.
1280         (Object::do_for_all_global_symbols): New function.
1281         (Sized_relobj::do_for_all_global_symbols): New function.
1282         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1283         function.
1284         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1285         function.
1286
1287 2011-03-27  Ian Lance Taylor  <iant@google.com>
1288
1289         * archive.cc (Archive::interpret_header): Return -1 if something
1290         goes wrong.  Change callers accordingly.
1291
1292 2011-03-25  Cary Coutant  <ccoutant@google.com>
1293
1294         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1295         * testsuite/Makefile.in: Regenerate.
1296
1297 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1298
1299         * plugin.cc (get_view): New.
1300         (Plugin::load): Pass get_view to the plugin.
1301         (Plugin_manager::get_view): New.
1302
1303 2011-03-21  Ian Lance Taylor  <iant@google.com>
1304
1305         * testsuite/final_layout.sh: Rewrite to not use dc.
1306         * testsuite/relro_test.sh: Fail if dc is not present.
1307
1308 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1309
1310         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1311         Change == to -eq.
1312         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1313         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1314         Change == to -eq.
1315         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1316         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1317
1318 2011-03-14  Ian Lance Taylor  <iant@google.com>
1319
1320         * script-sections.cc (Sort_output_sections::script_compare):
1321         Rename from is_before, change return type.
1322         (Sort_output_sections::operator()): Adjust accordingly.
1323
1324 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1325
1326         PR gold/12572
1327         * testsuite/odr_violation2.cc: Add comment to make all error line
1328         numbers double digits.
1329         * testsuite/debug_msg.sh: Adjust expected errors.
1330
1331 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1332
1333         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1334         but mark earlier ones as non-canonical
1335         (offset_to_iterator): Update search target and example
1336         (do_addr2line): Return extra lines in a vector*
1337         (format_file_lineno): Extract from do_addr2line
1338         (one_addr2line): Add vector* out-param
1339         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1340         when a lineno entry appeared last for its instruction
1341         (Dwarf_line_info): Add vector* out-param
1342         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1343         * symtab.cc (Odr_violation_compare): Include the lineno in the
1344         comparison again.
1345         (linenos_from_loc): New. Combine the canonical line for an
1346         address with its other lines.
1347         (True_if_intersect): New. Helper functor to make
1348         std::set_intersection a query.
1349         (detect_odr_violations): Compare sets of lines instead of just
1350         one line for each function. This became less deterministic, but
1351         has fewer false positives.
1352         * symtab.h: Declarations.
1353         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1354         mix an optimized and non-optimized object in the same binary
1355         (odr_violation2.so): Same.
1356         * testsuite/Makefile.in: Regenerate from Makefile.am.
1357         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1358         * testsuite/debug_msg.sh: Update line numbers and add
1359         assertions.
1360         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1361         non-optimized context.
1362         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1363         isn't inlined, and use OdrDerived in an optimized context.
1364         * testsuite/odr_header1.h: Defines OdrDerived, where
1365         optimization will change the
1366         first-instruction-in-the-destructor's file and line number.
1367         * testsuite/odr_header2.h: Defines OdrBase.
1368
1369 2011-03-09  Ian Lance Taylor  <iant@google.com>
1370
1371         * fileread.cc (File_read::clear_views): Don't delete the whole
1372         file view.
1373
1374 2011-03-08  Ian Lance Taylor  <iant@google.com>
1375
1376         PR gold/12525
1377         * fileread.cc: #include <climits>.
1378         (GOLD_IOV_MAX): Define.
1379         (File_read::read_multiple): Limit number of entries by iov_max.
1380         * fileread.h (class File_read): Always set max_readv_entries to
1381         128.
1382
1383 2011-03-07  Ian Lance Taylor  <iant@google.com>
1384
1385         PR gold/12525
1386         * options.h (class General_options): Add -dy and -dn.
1387
1388 2011-03-02  Cary Coutant  <ccoutant@google.com>
1389
1390         * testsuite/script_test_9.t: Add TLS segment.
1391
1392 2011-03-02  Simon Baldwin  <simonb@google.com>
1393
1394         * configure.ac: Add check for gnu_indirect_function support in
1395         the toolchain building binutils.
1396         * configure: Rebuild.
1397
1398 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1399
1400         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1401         plugin only symbols.
1402         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1403         in plugin files as not needed in the symbol table.
1404
1405 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1406
1407         * output.cc (Output_section::add_input_section): Delay fill
1408         generation for section ordering.
1409
1410 2011-02-09  Ian Lance Taylor  <iant@google.com>
1411
1412         PR gold/12316
1413         * object.h (class Sized_relobj): Remove clear_local_symbols.
1414         * reloc.cc (Sized_relobj::do_relocate): Don't call
1415         clear_local_symbols.
1416
1417 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1418
1419         * plugin.cc (is_visible_from_outside): Return true for symbols
1420         in the -u option.
1421
1422 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1423
1424         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1425         filename.
1426
1427 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1428
1429         * icf.h (is_section_foldable_candidate): Change type of parameter
1430         to std::string.
1431         * icf.cc (Icf::find_identical_sections): Change type of local variable
1432         section_name to be std::string.
1433         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1434
1435 2011-01-25  Ian Lance Taylor  <iant@google.com>
1436
1437         * script.cc (script_add_extern): Rewrite to use
1438         add_symbol_reference.
1439
1440 2011-01-25  Doug Kwan  <dougkwan@google.com>
1441
1442         * icf.cc (get_section_contents): Always lock section's object.
1443
1444 2011-01-24  Ian Lance Taylor  <iant@google.com>
1445
1446         * options.h (class General_options): Accept
1447         --no-detect-odr-violations.
1448
1449 2011-01-24  Ian Lance Taylor  <iant@google.com>
1450
1451         * version.cc (version_string): Bump to 1.11.
1452
1453 2011-01-24  Ian Lance Taylor  <iant@google.com>
1454
1455         * plugin.cc (class Plugin_rescan): Define new class.
1456         (Plugin_manager::claim_file): Set any_claimed_.
1457         (Plugin_manager::save_archive): New function.
1458         (Plugin_manager::save_input_group): New function.
1459         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1460         necessary.
1461         (Plugin_manager::new_undefined_symbol): New function.
1462         (Plugin_manager::rescan): New function.
1463         (Plugin_manager::rescannable_defines): New function.
1464         (Plugin_manager::add_input_file): Set any_added_.
1465         * plugin.h (class Plugin_manager): define new fields rescannable_,
1466         undefined_symbols_, any_claimed_, and any_added_.  Declare
1467         Plugin_rescan as friend.  Declare new functions.
1468         (Plugin_manager::Rescannable): Define type.
1469         (Plugin_manager::Rescannable_list): Define type.
1470         (Plugin_manager::Undefined_symbol_list): Define type.
1471         (Plugin_manager::Plugin_manager): Initialize new fields.
1472         * archive.cc (Archive::defines_symbol): New function.
1473         (Add_archive_symbols::run): Pass archive to plugins if any.
1474         * archive.h (class Archive): Declare defines_symbol.
1475         * readsyms.cc (Input_group::~Input_group): New function.
1476         (Finish_group::run): Pass input_group to plugins if any.
1477         * readsyms.h (class Input_group): Declare destructor.
1478         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1479         any.
1480
1481 2011-01-10  Ian Lance Taylor  <iant@google.com>
1482
1483         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1484         section as relro.
1485         (Layout::set_segment_offsets): Reset increase_relro before calling
1486         set_section_addresses a second time.
1487
1488 2011-01-04  Cary Coutant  <ccoutant@google.com>
1489
1490         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1491         sections before NOBITS sections.
1492
1493 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1494
1495         * version.cc (print_version): Update copyright to 2011.
1496
1497 2010-12-23  Cary Coutant  <ccoutant@google.com>
1498
1499         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1500         of OS to this->add.  Add OD parameter to second form of the function.
1501
1502 2010-12-20  Ian Lance Taylor  <iant@google.com>
1503
1504         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1505         second of two consecutive entries with same offset.
1506
1507 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1508
1509         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1510         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1511         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1512         to avoid unneeded links against $(LDADD).
1513         * testsuite/Makefile.in: Regenerate.
1514
1515 2010-12-15  Ian Lance Taylor  <iant@google.com>
1516
1517         PR gold/12324
1518         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1519         for R_X86_64_32 and R_X86_64_PC32.
1520         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1521         ver_matching_def_pic.o.
1522         (ver_matching_def_pic.o): New target.
1523
1524 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1525
1526         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1527         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1528         Move definition before File_read::View member definitions.
1529         (File_read::View::~View): Initialize and hold lock before
1530         updating current_mapped_bytes.
1531
1532 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1533
1534         * dwarf_reader.cc: Remove outdated comment.
1535         * gold-threads.cc: Fix typo in error message.
1536         * archive.cc: Fix typos in comments.
1537         * archive.h: Likewise.
1538         * arm-reloc-property.cc: Likewise.
1539         * arm-reloc-property.h: Likewise.
1540         * arm-reloc.def: Likewise.
1541         * arm.cc: Likewise.
1542         * attributes.h: Likewise.
1543         * cref.cc: Likewise.
1544         * ehframe.cc: Likewise.
1545         * fileread.h: Likewise.
1546         * gold.h: Likewise.
1547         * i386.cc: Likewise.
1548         * icf.cc: Likewise.
1549         * incremental.h: Likewise.
1550         * int_encoding.cc: Likewise.
1551         * layout.h: Likewise.
1552         * main.cc: Likewise.
1553         * merge.h: Likewise.
1554         * object.cc: Likewise.
1555         * object.h: Likewise.
1556         * options.cc: Likewise.
1557         * readsyms.cc: Likewise.
1558         * reduced_debug_output.cc: Likewise.
1559         * reloc.cc: Likewise.
1560         * script-sections.cc: Likewise.
1561         * sparc.cc: Likewise.
1562         * symtab.h: Likewise.
1563         * target-reloc.h: Likewise.
1564         * target.cc: Likewise.
1565         * target.h: Likewise.
1566         * timer.cc: Likewise.
1567         * timer.h: Likewise.
1568         * x86_64.cc: Likewise.
1569
1570 2010-12-09  Cary Coutant  <ccoutant@google.com>
1571
1572         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1573         stack.
1574         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1575         parameter; change all callers.
1576         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1577         * options.h (warn_execstack): New option.
1578
1579 2010-12-07  Doug Kwan  <dougkwan@google.com>
1580
1581         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1582         like function call relocations.
1583
1584 2010-12-07  Ian Lance Taylor  <iant@google.com>
1585
1586         * archive.cc (Archive::get_elf_object_for_member): Permit
1587         punconfigured to be NULL.
1588         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1589         (Archive::include_member): Pass NULL to get_elf_object_for_member
1590         if we searched for the archive and this is the first included
1591         object.
1592
1593 2010-12-01  Ian Lance Taylor  <iant@google.com>
1594
1595         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1596         track_relocs_type_ field.
1597         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1598         Set track_relocs_type_.
1599         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1600         contents when using RELA relocs.
1601         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1602         reloc_map_.
1603         * reloc.cc (Track_relocs::next_addend): New function.
1604         * reloc.h (class Track_relocs): Declare next_addend.
1605
1606 2010-12-01  Ian Lance Taylor  <iant@google.com>
1607
1608         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1609         virtual destructor.
1610
1611 2010-12-01  Ian Lance Taylor  <iant@google.com>
1612
1613         * README: Update compilers known to work and fail.
1614
1615 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1616
1617         * configure.in: For --enable-gold, handle value `default' instead of
1618         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1619         not the default.
1620         * configure: Regenerate.
1621
1622 2010-11-18  Doug Kwan  <dougkwan@google.com>
1623
1624         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1625         and right_alignment to be zero.  Store result alignment only if it is
1626         greater than existing alignment.
1627
1628 2010-11-16  Cary Coutant  <ccoutant@google.com>
1629
1630         PR gold/12220
1631         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1632         Check for ".zdebug_line".
1633
1634 2010-11-16  Doug Kwan  <dougkwan@google.com>
1635             Cary Coutant  <ccoutant@google.com>
1636
1637         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1638         by reference; adjust all callers.
1639         * output.cc (Output_segment::set_section_addresses): Adjust references
1640         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1641         list is empty.
1642         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1643         end at page boundary.
1644
1645 2010-11-16  Cary Coutant  <ccoutant@google.com>
1646
1647         PR gold/12220
1648         * layout.cc (Layout::choose_output_section): Transform names of
1649         compressed sections even when using a script with a SECTIONS clause.
1650         (Layout::output_section_name): Remove code to transform
1651         compressed debug section names.
1652         * output.cc (Output_section::add_input_section): Use uncompressed
1653         section size when tracking input sections.
1654
1655 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1656
1657         * symtab.h (Symbol::NON_PIC_REF): Remove.
1658         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1659         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1660         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1661         (Symbol::use_plt_offset): Take a flags argument and pass it
1662         directly to needs_dynamic_reloc.  Restrict check for undefined
1663         weak symbols to function calls.
1664         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1665         (Target_arm::Scan::global): Use it.
1666         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1667         (Target_arm::Relocate::relocate): Likewise.
1668         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1669         parameter with an r_type parameter.  Use get_reference_flags
1670         to get the flags.
1671         (Target_arm::Relocate::relocate): Update accordingly.
1672         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1673         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1674         (Target_i386::Scan::global): Likewise.
1675         (Target_i386::Relocate::relocate): Likewise.
1676         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1677         parameter with an r_type parameter.  Use get_reference_flags
1678         to get the flags.
1679         (Target_i386::Relocate::relocate): Update accordingly.
1680         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1681         (Target_powerpc::Scan::global): Use it.
1682         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1683         (Target_powerpc::Relocate::relocate): Likewise.
1684         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1685         (Target_sparc::Scan::global): Use it.
1686         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1687         (Target_sparc::Relocate::relocate): Likewise.
1688         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1689         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1690         (Target_x86_64::Scan::global): Likewise.
1691         (Target_x86_64::Relocate::relocate): Likewise.
1692
1693 2010-11-08  Doug Kwan  <dougkwan@google.com>
1694             Cary Coutant  <ccoutant@google.com>
1695
1696         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1697         (Arm_exidx_merge_section::section_contents_): New data member.
1698         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1699         (Arm_input_section::~Arm_input_section): De-allocate memory.
1700         (Arm_input_section::original_contents_): New data member.       
1701         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1702         in parameters instead of calling Object::section_contents without
1703         locking.
1704         (Arm_output_section::group_section): New parameter TASK.  Pass it
1705         to callees that need locking objects.
1706         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1707         to lock EXIDX input sections.  Fix a formatting issue.  Call
1708         Arm_exidx_merged_section::build_contents to create merged section
1709         contents.
1710         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1711         to lock object of stub table owner.
1712         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1713         TEXT_SIZE to initialize data member TEXT_SIZE_.
1714         (Arm_exidx_input_section::addralign): Fix typo in comment.
1715         (Arm_exidx_input_section::text_size): New method.
1716         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1717         that require locking objects.  Lock objects before scanning for stubs
1718         and updating local symbols.
1719         (Arm_input_section<big_endian>::init): Copy contents of original
1720         input section.
1721         (Arm_input_section<big_endian>::do_write): Use saved contents of
1722         original input section instead of calling Object::section_contents
1723         without locking.
1724         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1725         size without calling Object::section_size().
1726         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1727         for size.  Allocate a buffer for merged EXIDX entries.
1728         (Arm_exidx_merged_section::build_contents): New method.
1729         (Arm_exidx_merged_section::do_write): Move merge section contents
1730         building code to Arm_exidx_merged_section::build_contetns.  Write
1731         out contetns in buffer instead of building it on the fly.
1732         (Arm_relobj::make_exidx_input_section): Also pass text section size
1733         to Arm_exidx_input_section constructor.
1734         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1735         (Arm_dynobj::do_read_symbols): Fix memory leak.
1736         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1737         * target.h: (class Task): Add forward declaration.
1738         (Target::relax): Add new parameter TASK and pass it to
1739         Target::do_relax().
1740         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1741
1742 2010-11-05  Cary Coutant  <ccoutant@google.com>
1743
1744         PR gold/10708
1745         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1746         object when reading from the file.
1747         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1748         second layout pass.
1749         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1750         when reading section contents.
1751         (get_section_contents): Likewise.
1752         (icf::find_identical_sections): Likewise.
1753         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1754         object when reading from the file.
1755         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1756         the object when doing deferred section layout.
1757
1758 2010-11-03  Nick Clifton  <nickc@redhat.com>
1759
1760         PR gold/12001
1761         * script.h (class Symbol_assignment: name): New member.  Returns
1762         the name of the symbol.
1763         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1764         Returns true if the given symbol name is on the list of
1765         assignments wating to be processed.
1766         * archive.cc (should_incldue_member): If the symbol is undefined,
1767         check to see if it is on the list of symbols pending assignment.
1768
1769 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1770
1771         * script-sections.cc (Script_sections::find_memory_region): Check
1772         for a NULL output section pointer.
1773
1774 2010-10-29  Doug Kwan  <dougkwan@google.com>
1775
1776         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1777         Output_section::add_relaxed_input_section.
1778         * output.cc (Output_section::add_relaxed_input_section): Add new
1779         arguments LAYOUT and NAME.  Set section order index.
1780         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1781         Copy section order index.
1782         * output.h (Output_section::add_relaxed_input_section): Add new
1783         arguments LAYOUT and NAME.
1784
1785 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1786
1787         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1788         NATIVE_OR_CROSS_LINKER.
1789         * testsuite/Makefile.in: Regenerate.
1790
1791 2010-10-20  Doug Kwan  <dougkwan@google.com>
1792
1793         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1794         without SHF_LINK_ORDER flags.
1795         * layout.cc (Layout::choose_output_section): Do not filter
1796         SHF_LINK_ORDER flag in a relocatable link.
1797
1798 2010-10-17  Cary Coutant  <ccoutant@google.com>
1799
1800         * output.h (Output_segment::set_section_addresses): Change function
1801         signature.  Update all callers.
1802         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1803         sections.
1804         (Output_segment::set_section_addresses): Align after last TLS
1805         section.  Add padding before last relro section instead of after.
1806
1807 2010-10-17  Doug Kwan  <dougkwan@google.com>
1808
1809         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1810         GOT output section to be writable.
1811
1812 2010-10-14  Cary Coutant  <ccoutant@google.com>
1813
1814         * debug.h (DEBUG_INCREMENTAL): New flag.
1815         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1816         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1817         mode.
1818         * incremental.cc (report_command_line): Ignore all forms of
1819         --incremental.
1820         * layout.cc (Layout::Layout): Check parameters for incremental link
1821         mode.
1822         * options.cc (General_options::parse_incremental): New function.
1823         (General_options::parse_no_incremental): New function.
1824         (General_options::parse_incremental_full): New function.
1825         (General_options::parse_incremental_update): New function.
1826         (General_options::incremental_mode_): New data member.
1827         (General_options::finalize): Check incremental_mode_.
1828         * options.h (General_options): Update help text for --incremental.
1829         Add --no-incremental, --incremental-full, --incremental-update.
1830         (General_options::Incremental_mode): New enum type.
1831         (General_options::incremental_mode): New function.
1832         (General_options::incremental_mode_): New data member.
1833         * parameters.cc (Parameters::incremental_mode_): New data member.
1834         (Parameters::set_options): Set incremental_mode_.
1835         (Parameters::set_incremental_full): New function.
1836         (Parameters::incremental): New function.
1837         (Parameters::incremental_update): New function.
1838         (set_parameters_incremental_full): New function.
1839         * parameters.h (Parameters::set_incremental_full): New function.
1840         (Parameters::incremental): New function.
1841         (Parameters::incremental_update): New function.
1842         (Parameters::incremental_mode_): New data member.
1843         (set_parameters_incremental_full): New function.
1844         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1845         incremental link mode.
1846         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1847         (Sized_relobj::do_relocate_sections): Likewise.
1848         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1849         option.
1850         * testsuite/Makefile.in: Regenerate.
1851         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1852
1853 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1854
1855         * script-sections.h (class Script_sections): Make
1856         Sections_elements typedef public.
1857         * script-sections.cc (class Sort_output_sections): Add elements_
1858         field.  Add constructor which sets it; change all callers.
1859         (Sort_output_sections::is_before): New function.
1860         (Sort_output_sections::operator()): Call is_before.
1861         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1862         conditional.
1863         * testsuite/script_test_10.sh: New test. Test script section
1864         order.
1865         * testsuite/script_test_10.t: Likewise.
1866         * testsuite/script_test_10.s: Likewise.
1867         * testsuite/Makefile.am: Wrap the cross linker tests and the
1868         common tests into NATIVE_OR_CROSS_LINKER.
1869         (check_SCRIPTS): Add script_test_10.sh.
1870         (check_DATA): Add script_test_10.stdout.
1871         (script_test_10.o, script_test_10): New targets.
1872         (script_test_10.stdout): New target.
1873         * configure, testsuite/Makefile.in: Regenerate.
1874
1875 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1876
1877         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1878         error for the deprecated relocations.
1879         (Target_arm::Scan::global): Likewise.
1880         (Target_arm::Relocate::relocate): Likewise.
1881
1882 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1883
1884         * fileread.cc (Input_file::find_file): Initialize *found_name
1885         and *namep when using the fallback search for case 4.
1886
1887 2010-10-11  Cary Coutant  <ccoutant@google.com>
1888
1889         * options.h (class General_options): Redefine -z lazy as an alias for
1890         the negation of -z now.
1891
1892 2010-10-11  Ian Lance Taylor  <iant@google.com>
1893
1894         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1895         binding.
1896
1897 2010-10-06  Nick Clifton  <nickc@redhat.com>
1898
1899         * script-sections.cc(class Memory_region): Remove
1900         current_lma_offset_ field.  Rename current_vma_offset_ to
1901         current_offset_.  Add last_section_ field.
1902         (Memory_region::get_current_vma_address): Rename to
1903         get_current_address.
1904         (Memory_region::get_current_lma_address): Delete.
1905         (Memory_region::increment_vma_offset): Rename to
1906         increment_offset.
1907         (Memory_region::increment_lma_offset): Delete.
1908         (Memory_region::attributes_compatible): New method.  Returns
1909         true if the provided section is compatible with the region.
1910         (Memory_region::get_last_section): New method.  Returns the last
1911         section to use the region.
1912         (Memory_region::set_last_section): New method.  Stores the last
1913         section to use the region.
1914         (Script_sections::block_in_region): New method.  Returns true if
1915         a block of memory is contained within a region.
1916         (Script_sections::find_memory_region): New method.  Locates a
1917         memory region to be used to set a VMA or LMA address.
1918         (Output_section_definition::set_section_addresses): Add code to
1919         check for addresses set by memory regions.
1920         (Output_segment::set_section_addresses): Remove memory region
1921         walking code.
1922         (Script_sections::create_segment): Add a warning if a header
1923         segment is created outside of any region.
1924         * script-sections.h (class Script_sections): Add prototypes for
1925         find_memory_region and block_in_region methods.
1926         * testsuite/memory_test.s: Use .long instead of .word.
1927         * testsuite/memory_test.t: Add some more output sections.
1928         * testsuite/memory_test.sh: Update expected output.
1929
1930 2010-10-02  Doug Kwan  <dougkwan@google.com>
1931
1932         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1933         defintion to symtab.h
1934         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1935         declaration to defintion.
1936
1937 2010-10-01  Nick Clifton  <nickc@redhat.com>
1938
1939         * expression.cc (eval): Replace dummy argument with NULL.
1940         (eval_maybe_dot): Check for a NULL result section pointer.
1941         (Symbol_expression::value): Likewise.
1942         (Dot_expression::value): Likewise.
1943         (BINARY_EXPRESSION): Likewise.
1944         (Max_expression::value): Likewise.
1945         (Min_expression::value): Likewise.
1946         (Absolute_expression::value): Likewise.
1947         (Addr_expression::value_from_output_section): Likewise.
1948         (Loaddddr_expression::value_from_output_section): Likewise.
1949         (Segment_start_expression::value): Likewise.
1950         * script-sections.cc
1951         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1952         argument with NULL.
1953         (Sections_elememt_dot_assignment::set_section_addresses):
1954         Likewise.
1955         (Output_data_expression::do_write_to_buffer): Likewise.
1956         (Output_section_definition::finalize_symbols): Likewise.
1957         (Output_section_definition::set_section_addresses): Likewise.
1958
1959 2010-09-30  Doug Kwan  <dougkwan@google.com>
1960
1961         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1962
1963 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1964
1965         * target.h (Target::can_icf_inline_merge_sections): New virtual
1966         function.
1967         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1968         virtual function.
1969         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1970         virtual function.
1971         * icf.cc (get_section_contents): Inline merge sections only when
1972         target allows it.
1973
1974 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1975
1976         * configure: Regenerate.
1977
1978 2010-09-17  Ian Lance Taylor  <iant@google.com>
1979
1980         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1981         * testsuite/Makefile.am (memory_test.o): New target.
1982         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1983         memory_test.t.
1984         * testsuite/Makefile.in: Rebuild.
1985
1986 2010-09-17  Doug Kwan  <dougkwan@google.com>
1987
1988         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1989         defintion if relocation uses GOT entries of the symbol.
1990         * testsuite/icf_safe_test.sh: Fix test.
1991         * testsuite/icf_safe_so_test.sh: Fix test.
1992
1993 2010-09-16  Cary Coutant  <ccoutant@google.com>
1994
1995         * script_sections.cc (class Memory_region): Remove "NULL" from
1996         vector initializations.
1997
1998 2010-09-15  Cary Coutant  <ccoutant@google.com>
1999
2000         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2001         Resolve forwarding symbols.
2002
2003 2010-09-15  Doug Kwan  <dougkwan@google.com>
2004
2005         * gold/testsuite/script_test_3.t: Add ARM special sections.
2006         * gold/testsuite/script_test_4.t: Same.
2007         * gold/testsuite/script_test_5.t: Same.
2008         * gold/testsuite/script_test_6.t: Same.
2009         * gold/testsuite/script_test_7.t: Same.
2010         * gold/testsuite/script_test_7.t: Same.
2011         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2012
2013 2010-09-14  Cary Coutant  <ccoutant@google.com>
2014
2015         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2016         (Target_x86_64::Relocate::relocate_tls): Replace check for
2017         saw_tls_block_reloc_ with test for executable section.
2018
2019 2010-09-12  Cary Coutant  <ccoutant@google.com>
2020
2021         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2022         position-independent executables to shared libraries need dynamic
2023         relocations.
2024         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2025         position-independent executables.
2026         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2027         * testsuite/Makefile.in: Regenerate.
2028
2029 2010-09-10  Nick Clifton  <nickc@redhat.com>
2030
2031         PR gold/11997
2032         * testsuite/memory_test.t: Discard any sections that are not
2033         needed.
2034
2035 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2036
2037         PR gold/11996
2038         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2039         "This::" to work around a bug in gcc 4.2.
2040
2041         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2042
2043 2010-09-09  Rafael Espindola  <espindola@google.com>
2044
2045         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2046         sections with different PF_X flags in the same segment.
2047         (Layout::find_first_load_seg): Search all segments to find the first
2048         one.
2049         * options.h (rosegment): New.
2050
2051 2010-09-08  Rafael Espindola  <espindola@google.com>
2052
2053         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2054
2055 2010-09-08  Doug Kwan  <dougkwan@google.com>
2056
2057         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2058         (Arm_relobj::do_relocate_sections): Add new parameter for output
2059         file to match the parent.
2060         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2061         of local symbols instead of input values.  Update code to track
2062         changes in gold::relocate_section.
2063         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2064         (Sized_relobj::compute_final_local_value_internal): New methods.
2065         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2066         body into private version of Sized_relobj::compute_final_local_value.
2067         Call the inline method.
2068         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2069         merged symbol value if there is one.
2070         (Symbol_value::has_output_value): New method defintiion.
2071         (Sized_relobj::Compute_final_local_value_status): New enum type.
2072         (Sized_relobj::compute_final_local_value): New methods.
2073         (Sized_relobj::compute_final_local_value_internal): New methods.
2074         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2075         and arm_cortex_a8.sh.
2076         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2077         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2078         New tests.
2079         * Makefile.in: Regenerate.
2080         * testsuite/arm_bl_out_of_range.s: Update test.
2081         * testsuite/thumb_bl_out_of_range.s: Ditto.
2082         * testsuite/thumb_blx_out_of_range.s: Ditto.
2083         * testsuite/arm_branch_out_of_range.sh: New file.
2084         * testsuite/arm_cortex_a8.sh: Ditto.
2085         * testsuite/arm_cortex_a8_b.s: Ditto.
2086         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2087         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2088         * testsuite/arm_cortex_a8_bl.s: Ditto.
2089         * testsuite/arm_cortex_a8_blx.s: Ditto.
2090         * testsuite/arm_cortex_a8_local.s: Ditto.
2091         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2092         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2093
2094 2010-09-08  Rafael Espindola  <espindola@google.com>
2095
2096         * Makefile.am (memory_test.stdout): Run readelf with -W.
2097         * Makefile.in: Regenerate.
2098         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2099         64 bit output.
2100
2101 2010-09-08  Rafael Espindola  <espindola@google.com>
2102
2103         * script-sections.cc (Script_sections::add_memory_region): Convert
2104         field precision to int.
2105         * script.cc (script_set_section_region, script_set_section_region):
2106         Convert field precision to int.
2107
2108 2010-09-08  Rafael Espindola  <espindola@google.com>
2109
2110         * arm.cc (do_finalize_sections): Create the __exidx_start and
2111         __exdix_end symbols even when the section is missing.
2112
2113 2010-09-08  Nick Clifton  <nickc@redhat.com>
2114
2115         * README: Remove claim that MEMORY is not supported.
2116         * expression.cc (script_exp_function_origin)
2117         (script_exp_function_length): Move from here to ...
2118         * script.cc: ... here.
2119         (script_set_section_region, script_add_memory)
2120         (script_parse_memory_attr, script_include_directive): New
2121         functions.
2122         * script-sections.cc
2123         (class Memory_region): New class.
2124         (class Output_section_definition): Add set_memory_region,
2125         set_section_vma, set_section_lma and get_section_name methods.
2126         (class Script_Sections): Add add_memory_region,
2127         find_memory_region, find_memory_region_origin,
2128         find_memory_region_length and set_memory_region methods.
2129         Have set_section_addresses method walk the list of set memory
2130         regions.
2131         Extend the print methos to display memory regions.
2132         * script-sections.h: Add prototypes for new methods.
2133         Add enum for MEMORY region attributes.
2134         * yyscript.y: Add support for parsing MEMORY regions.
2135         * script-c.h: Add prototypes for new functions.
2136         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2137         * testsuite/Makefile.in: Regenerate.
2138         * testsuite/memory_test.sh: New script.
2139         * testsuite/memory_test.s: New assembler source file.
2140         * testsuite/memory_test.t: New linker script.
2141
2142 2010-08-27  Doug Kwan  <dougkwan@google.com>
2143
2144         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2145         reference override an existing dynamic weak reference.
2146         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2147         * testsuite/Makefile.in: Regenerate.
2148         * testsuite/dyn_weak_ref.sh: New file.
2149         * testsuite/dyn_weak_ref_1.c: Ditto.
2150         * testsuite/dyn_weak_ref_2.c: Ditto.
2151
2152 2010-08-27  Ian Lance Taylor  <iant@google.com>
2153
2154         * incremental.h (class Incremental_input_entry): Add virtual
2155         destructor.
2156
2157 2010-08-27  Ian Lance Taylor  <iant@google.com>
2158
2159         * testsuite/start_lib_test_3.c: Mark t3 as used.
2160
2161 2010-08-27  Nick Clifton  <nickc@redhat.com>
2162
2163         * options.cc (version_script): Fix small typo in previous
2164         whitespace tidyup.
2165
2166 2010-08-25  Nick Clifton  <nickc@redhat.com>
2167
2168         * archive.cc: Formatting fixes: Remove whitespace between
2169         typename and following asterisk.  Remove whitespace between
2170         function name and opening parenthesis.
2171         * archive.h: Likewise.
2172         * arm.cc: Likewise.
2173         * attributes.cc: Likewise.
2174         * attributes.h: Likewise.
2175         * common.cc: Likewise.
2176         * copy-relocs.cc: Likewise.
2177         * dirsearch.h: Likewise.
2178         * dynobj.cc: Likewise.
2179         * ehframe.cc: Likewise.
2180         * ehframe.h: Likewise.
2181         * expression.cc: Likewise.
2182         * fileread.cc: Likewise.
2183         * fileread.h: Likewise.
2184         * gc.h: Likewise.
2185         * gold-threads.cc: Likewise.
2186         * gold.cc: Likewise.
2187         * i386.cc: Likewise.
2188         * icf.h: Likewise.
2189         * incremental-dump.cc: Likewise.
2190         * incremental.cc: Likewise.
2191         * layout.cc: Likewise.
2192         * layout.h: Likewise.
2193         * main.cc: Likewise.
2194         * merge.cc: Likewise.
2195         * merge.h: Likewise.
2196         * object.cc: Likewise.
2197         * object.h: Likewise.
2198         * options.cc: Likewise.
2199         * options.h: Likewise.
2200         * output.cc: Likewise.
2201         * output.h: Likewise.
2202         * plugin.cc: Likewise.
2203         * plugin.h: Likewise.
2204         * powerpc.cc: Likewise.
2205         * reloc.cc: Likewise.
2206         * script-c.h: Likewise.
2207         * script-sections.cc: Likewise.
2208         * script.cc: Likewise.
2209         * stringpool.cc: Likewise.
2210         * symtab.cc: Likewise.
2211         * symtab.h: Likewise.
2212         * target.cc: Likewise.
2213         * timer.cc: Likewise.
2214         * timer.h: Likewise.
2215         * version.cc: Likewise.
2216         * x86_64.cc: Likewise.
2217
2218 2010-08-24  Nick Clifton  <nickc@redhat.com>
2219
2220         PR 11899
2221         * layout.cc (segment_precedes): Sort segments by their physical
2222         addresses, if they have been set.
2223
2224 2010-08-23  Cary Coutant  <ccoutant@google.com>
2225
2226         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2227         symbols data.
2228         (Lib_group::include_member): Unlock object after deleting its
2229         symbols data.
2230         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2231         the bug fixed here.
2232
2233 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2234             Cary Coutant  <ccoutant@google.com>
2235
2236         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2237         constructor, and set_blocker.
2238         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2239         readsyms_blocker_.
2240         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2241         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2242         * testsuite/Makefile.am (start_lib_test): New test case.
2243         * testsuite/Makefile.in: Regenerate.
2244         * testsuite/start_lib_test_main.c: New file.
2245         * testsuite/start_lib_test_1.c: New file.
2246         * testsuite/start_lib_test_2.c: New file.
2247         * testsuite/start_lib_test_3.c: New file.
2248
2249 2010-08-19  Ian Lance Taylor  <iant@google.com>
2250
2251         * Makefile.in: Rebuild with automake 1.11.1.
2252         * aclocal.m4: Likewise.
2253         * testsuite/Makefile.in: Likewise.
2254
2255 2010-08-19  Ian Lance Taylor  <iant@google.com>
2256
2257         PR 10893
2258         * i386.cc (class Output_data_plt_i386): Update declarations.
2259         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2260         local_ifuncs_ fields.
2261         (Target_i386::do_plt_section_for_global): New function.
2262         (Target_i386::do_plt_section_for_local): New function.
2263         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2264         parameter; change all callers.  Initialize global_ifuncs_ and
2265         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2266         __rel_iplt_end.
2267         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2268         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2269         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2270         symbols.
2271         (Target_i386::make_plt_section): New function, broken out of
2272         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2273         (Target_i386::make_plt_entry): Call make_plt_section.
2274         (Target_i386::make_local_ifunc_plt_entry): New function.
2275         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2276         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2277         R_386_IRELATIVE to switch.
2278         (Target_i386::Scan::global): Likewise.
2279         (Target_i386::Relocate::relocate): Likewise.
2280         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2281         switch.
2282         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2283         (Target_x86_64::do_plt_section_for_global): New function.
2284         (Target_x86_64::do_plt_section_for_local): New function.
2285         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2286         parameter; change all callers.  If doing a static link define
2287         __rela_iplt_start and __rela_iplt_end.
2288         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2289         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2290         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2291         to point to .plt.
2292         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2293         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2294         switch.
2295         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2296         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2297         R_X86_64_IRELATIVE to switch.
2298         (Target_x86_64::Scan::global): Likewise.
2299         (Target_x86_64::Relocate::relocate): Likewise.
2300         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2301         switch.
2302         * target.h (class Target): Add plt_section_for_global and
2303         plt_section_for_local functions.  Add do_plt_section_for_global
2304         and do_plt_section_for_local virtual functions.
2305         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2306         clarifying comments.
2307         (Symbol::use_plt_offset): Handle IFUNC symbol.
2308         * object.cc (Sized_relobj::Sized_relobj): Initialize
2309         local_plt_offsets_.
2310         (Sized_relobj::local_has_plt_offset): New function.
2311         (Sized_relobj::local_plt_offset): New function.
2312         (Sized_relobj::set_local_plt_offset): New function.
2313         (Sized_relobj::do_count): Handle IFUNC symbol.
2314         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2315         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2316         is_ifunc_symbol functions.
2317         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2318         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2319         local_plt_offsets_ field.
2320         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2321         * output.h (class Output_section_data): Add non-const
2322         output_section function.
2323         (class Output_data_got): Update declarations.
2324         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2325         Add use_plt_offset parameter to global and local constructors.
2326         Change all callers.  Change local_sym_index_ field to 31 bits.
2327         Change GSYM_CODE and CONSTANT_CODE accordingly.
2328         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2329         doing a static link don't set sh_link field.
2330         (Output_data_got::Got_entry::write): Use PLT offset if
2331         appropriate.
2332         (Output_data_got::add_global_plt): New function.
2333         (Output_data_got::add_local_plt): New function.
2334         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2335         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2336         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2337         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2338         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2339         IFUNC conditional.
2340         * testsuite/ifunc-sel.h: New file.
2341         * testsuite/ifuncmain1.c: New file.
2342         * testsuite/ifuncmain1vis.c: New file.
2343         * testsuite/ifuncmod1.c: New file.
2344         * testsuite/ifuncdep2.c: New file.
2345         * testsuite/ifuncmain2.c: New file.
2346         * testsuite/ifuncmain3.c: New file.
2347         * testsuite/ifuncmod3.c: New file.
2348         * testsuite/ifuncmain4.c: New file.
2349         * testsuite/ifuncmain5.c: New file.
2350         * testsuite/ifuncmod5.c: New file.
2351         * testsuite/ifuncmain6pie.c: New file.
2352         * testsuite/ifuncmod6.c: New file.
2353         * testsuite/ifuncmain7.c: New file.
2354         * configure, testsuite/Makefile.in: Rebuild.
2355
2356 2010-08-18  Ian Lance Taylor  <iant@google.com>
2357
2358         * incremental.cc
2359         (Output_section_incremental_inputs::write_input_files): Add cast
2360         to avoid signed/unsigned comparison warning.
2361         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2362
2363 2010-08-12  Cary Coutant  <ccoutant@google.com>
2364
2365         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2366
2367 2010-08-13  Ian Lance Taylor  <iant@google.com>
2368
2369         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2370
2371 2010-08-12  Cary Coutant  <ccoutant@google.com>
2372             Doug Kwan  <dougkwan@google.com>
2373
2374         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2375         defintion overrides non-weak undef, remember that the original undef
2376         is not weak.
2377         * symtab.cc (Symbol_table::sized_write_global): For undef without
2378         an original weak binding, set binding to global in output.
2379         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2380         * testsuite/Makefile.in: Regenerate.
2381         * testsuite/strong_ref_weak_def.sh: New file.
2382         * testsuite/strong_ref_weak_def_1.c: Ditto.
2383         * testsuite/strong_ref_weak_def_2.c: Ditto.
2384
2385 2010-08-12  Cary Coutant  <ccoutant@google.com>
2386
2387         * testsuite/incremental_test.sh: Rewrite.
2388         * testsuite/incremental_test_1.c: Rewrite.
2389         * testsuite/incremental_test_2.c: Rewrite.
2390
2391 2010-08-12  Cary Coutant  <ccoutant@google.com>
2392
2393         * arm.cc (Target_arm::got_size): Add const.
2394         (Target_arm::got_entry_count): New function.
2395         (Target_arm::plt_entry_count): New function.
2396         (Target_arm::first_plt_entry_offset): New function.
2397         (Target_arm::plt_entry_size): New function.
2398         (Output_data_plt_arm::entry_count): New function.
2399         (Output_data_plt_arm::first_plt_entry_offset): New function.
2400         (Output_data_plt_arm::get_plt_entry_size): New function.
2401         * i386.cc (Target_i386::got_size): Add const.
2402         (Target_i386::got_entry_count): New function.
2403         (Target_i386::plt_entry_count): New function.
2404         (Target_i386::first_plt_entry_offset): New function.
2405         (Target_i386::plt_entry_size): New function.
2406         (Output_data_plt_i386::entry_count): New function.
2407         (Output_data_plt_i386::first_plt_entry_offset): New function.
2408         (Output_data_plt_i386::get_plt_entry_size): New function.
2409         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2410         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2411         * incremental.cc: Include target.h.
2412         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2413         parameter.  Adjust all callers.  Find incremental_got_plt section.
2414         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2415         section.
2416         (Output_section_incremental_inputs::set_final_data_size): Calculate
2417         size of incremental_got_plt section.
2418         (Output_section_incremental_inputs::do_write): Write the
2419         incremental_got_plt section.
2420         (Got_plt_view_info): New struct.
2421         (Local_got_offset_visitor): New class.
2422         (Global_got_offset_visitor): New class.
2423         (Global_symbol_visitor_got_plt): New class.
2424         (Output_section_incremental_inputs::write_got_plt): New function.
2425         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2426         Add parameter.  Adjust all callers.
2427         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2428         (Incremental_inputs::got_plt_section): New function.
2429         (Incremental_inputs::got_plt_section_): New data member.
2430         (Incremental_got_plt_reader): New class.
2431         * layout.cc (Layout::create_incremental_info_sections): Add the
2432         incremental_got_plt section.
2433         * object.h (Got_offset_list::get_list): New function.
2434         (Got offset_list::for_all_got_offsets): New function.
2435         (Sized_relobj::local_got_offset_list): New function.
2436         * powerpc.cc (Target_powerpc::got_size): Add const.
2437         (Target_powerpc::got_entry_count): New function.
2438         (Target_powerpc::plt_entry_count): New function.
2439         (Target_powerpc::first_plt_entry_offset): New function.
2440         (Target_powerpc::plt_entry_size): New function.
2441         (Output_data_plt_powerpc::entry_count): New function.
2442         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2443         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2444         * sparc.cc (Target_sparc::got_size): Add const.
2445         (Target_sparc::got_entry_count): New function.
2446         (Target_sparc::plt_entry_count): New function.
2447         (Target_sparc::first_plt_entry_offset): New function.
2448         (Target_sparc::plt_entry_size): New function.
2449         (Output_data_plt_sparc::entry_count): New function.
2450         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2451         (Output_data_plt_sparc::get_plt_entry_size): New function.
2452         * symtab.h (Symbol::got_offset_list): New function.
2453         (Symbol_table::for_all_symbols): New function.
2454         * target.h (Sized_target::got_entry_count): New function.
2455         (Sized_target::plt_entry_count): New function.
2456         (Sized_target::plt_entry_size): New function.
2457         * x86_64.cc (Target_x86_64::got_size): Add const.
2458         (Target_x86_64::got_entry_count): New function.
2459         (Target_x86_64::plt_entry_count): New function.
2460         (Target_x86_64::first_plt_entry_offset): New function.
2461         (Target_x86_64::plt_entry_size): New function.
2462         (Output_data_plt_x86_64::entry_count): New function.
2463         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2464         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2465
2466 2010-08-12  Cary Coutant  <ccoutant@google.com>
2467
2468         * archive.cc: Include incremental.h.
2469         (Archive::Archive): Initialize incremental_info_.
2470         (Archive::include_member): Record archive members in incremental info.
2471         (Add_archive_symbols::run): Record begin and end of an archive in
2472         incremental info.
2473         (Lib_group::include_member): Record objects in incremental info.
2474         * archive.h (Incremental_archive_entry): Forward declaration.
2475         (Archive::set_incremental_info): New member function.
2476         (Archive::incremental_info): New member function.
2477         (Archive::Unused_symbol_iterator): New class.
2478         (Archive::unused_symbols_begin): New member function.
2479         (Archive::unused_symbols_end): New member function.
2480         (Archive::incremental_info_): New data member.
2481         * incremental-dump.cc (find_input_containing_global): New function.
2482         (dump_incremental_inputs): Dump new incremental info sections.
2483         * incremental.cc: Include symtab.h.
2484         (Output_section_incremental_inputs): New class.
2485         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2486         new incremental info sections.
2487         (Sized_incremental_binary::do_check_inputs): Likewise.
2488         (Incremental_inputs::report_archive): Remove.
2489         (Incremental_inputs::report_archive_begin): New function.
2490         (Incremental_inputs::report_archive_end): New function.
2491         (Incremental_inputs::report_object): New function.
2492         (Incremental_inputs::finalize_inputs): Remove.
2493         (Incremental_inputs::report_input_section): New function.
2494         (Incremental_inputs::report_script): Rewrite.
2495         (Incremental_inputs::finalize): Do nothing but finalize string table.
2496         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2497         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2498         (Incremental_inputs::create_data_sections): New function.
2499         (Incremental_inputs::relocs_entsize): New function.
2500         (Output_section_incremental_inputs::set_final_data_size): New function.
2501         (Output_section_incremental_inputs::do_write): New function.
2502         (Output_section_incremental_inputs::write_header): New function.
2503         (Output_section_incremental_inputs::write_input_files): New function.
2504         (Output_section_incremental_inputs::write_info_blocks): New function.
2505         (Output_section_incremental_inputs::write_symtab): New function.
2506         * incremental.h (Incremental_script_entry): Forward declaration.
2507         (Incremental_object_entry): Forward declaration.
2508         (Incremental_archive_entry): Forward declaration.
2509         (Incremental_inputs): Forward declaration.
2510         (Incremental_inputs_header_data): Remove.
2511         (Incremental_inputs_header): Remove.
2512         (Incremental_inputs_header_write): Remove.
2513         (Incremental_inputs_entry_data): Remove.
2514         (Incremental_inputs_entry): Remove.
2515         (Incremental_inputs_entry_write): Remove.
2516         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2517         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2518         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2519         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2520         Likewise.
2521         (Incremental_input_entry): New class.
2522         (Incremental_script_entry): New class.
2523         (Incremental_object_entry): New class.
2524         (Incremental_archive_entry): New class.
2525         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2526         (Incremental_inputs::report_inputs): Remove.
2527         (Incremental_inputs::report_archive): Remove.
2528         (Incremental_inputs::report_archive_begin): New function.
2529         (Incremental_inputs::report_archive_end): New function.
2530         (Incremental_inputs::report_object): Change prototype.
2531         (Incremental_inputs::report_input_section): New function.
2532         (Incremental_inputs::report_script): Change prototype.
2533         (Incremental_inputs::get_reloc_count): New function.
2534         (Incremental_inputs::set_reloc_count): New function.
2535         (Incremental_inputs::create_data_sections): New function.
2536         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2537         (Incremental_inputs::inputs_section): New function.
2538         (Incremental_inputs::symtab_section): New function.
2539         (Incremental_inputs::relocs_section): New function.
2540         (Incremental_inputs::get_stringpool): Add const.
2541         (Incremental_inputs::command_line): Add const.
2542         (Incremental_inputs::inputs): Remove.
2543         (Incremental_inputs::command_line_key): New function.
2544         (Incremental_inputs::input_file_count): New function.
2545         (Incremental_inputs::input_files): New function.
2546         (Incremental_inputs::relocs_entsize): New function.
2547         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2548         (Incremental_inputs::finalize_inputs): Remove.
2549         (Incremental_inputs::Input_info): Remove.
2550         (Incremental_inputs::lock_): Remove.
2551         (Incremental_inputs::inputs_): Change type.
2552         (Incremental_inputs::inputs_map_): Remove.
2553         (Incremental_inputs::current_object_entry_): New data member.
2554         (Incremental_inputs::inputs_section_): New data member.
2555         (Incremental_inputs::symtab_section_): New data member.
2556         (Incremental_inputs::relocs_section_): New data member.
2557         (Incremental_inputs::reloc_count_): New data member.
2558         (Incremental_inputs_reader): New class.
2559         (Incremental_symtab_reader): New class.
2560         (Incremental_relocs_reader): New class.
2561         * layout.cc (Layout::finalize): Move finalization of incremental info
2562         and creation of incremental info sections to follow finalization of
2563         symbol table.  Set offsets for postprocessing sections.
2564         (Layout::create_incremental_info_sections): Call
2565         Incremental_inputs::create_data_sections.  Add incremental symtab
2566         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2567         sections to layout after input sections.
2568         * layout.h (struct Timespec): Forward declaration.
2569         (Layout::incremental_inputs): Add const.
2570         (Layout::create_incremental_info_sections): Add parameter.
2571         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2572         * object.cc: Include incremental.h.
2573         (Relobj::finalize_incremental_relocs): New function.
2574         (Sized_relobj::do_layout): Record input sections in incremental info.
2575         * object.h (Object::output_section): New function.
2576         (Object::output_section_offset): Moved from Relobj.
2577         (Object::get_incremental_reloc_base): New function.
2578         (Object::get_incremental_reloc_count): New function.
2579         (Object::do_output_section): New function.
2580         (Object::do_output_section_offset): Moved from Relobj.
2581         (Object::do_get_incremental_reloc_base): New function.
2582         (Object::do_get_incremental_reloc_count): New function.
2583         (Object::Object): Initialize new data members.
2584         (Relobj::output_section): Renamed do_output_section and moved to
2585         protected.
2586         (Relobj::output_section_offset): Moved to Object.
2587         (Relobj::do_get_incremental_reloc_base): New function.
2588         (Relobj::do_get_incremental_reloc_count): New function.
2589         (Relobj::allocate_incremental_reloc_counts): New function.
2590         (Relobj::count_incremental_reloc): New function.
2591         (Relobj::finalize_incremental_relocs): New function.
2592         (Relobj::next_incremental_reloc_index): New function.
2593         (Relobj::reloc_counts_): New data member.
2594         (Relobj::reloc_bases_): New data member.
2595         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2596         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2597         (Sized_relobj::incremental_relocs_scan): New function.
2598         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2599         (Sized_relobj::incremental_relocs_write): New function.
2600         (Sized_relobj::incremental_relocs_write_reltype): New function.
2601         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2602         incremental link.
2603         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2604         archives and object files elsewhere.
2605         (Add_symbols::run): Report object files here.
2606         (Finish_group::run): Report end of archive at end of group.
2607         * reloc.cc: Include layout.h, incremental.h.
2608         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2609         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2610         (Sized_relobj::incremental_relocs_scan): New function.
2611         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2612         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2613         (Sized_relobj::incremental_relocs_write): New function.
2614         (Sized_relobj::incremental_relocs_write_reltype): New function.
2615         * script.cc (read_input_script): Rewrite test for incremental link.
2616         Change call to Incremental_inputs::report_script.
2617         * symtab.h (Symbol_table::first_global_index): New function.
2618         (Symbol_table::output_count): New function.
2619
2620 2010-08-12  Doug Kwan  <dougkwan@google.com>
2621
2622         * arm.cc (Target_arm::merge_object_attributes): Check command line
2623         options --no-wchar-size-warning and --no-enum-size-warning.
2624         * options.h (General_options): Add ld-compatible options
2625         --no-enum-size-warning and --no-wchar-size-warning.
2626
2627 2010-08-04  Ian Lance Taylor  <iant@google.com>
2628
2629         * x86_64.cc (Target_x86_64::Scan::local): Use
2630         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2631         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2632         (Target_x86_64::Scan::global): Likewise.
2633         (Target_x86_64::Relocate::relocate): Likewise.
2634         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2635         Likewise.
2636
2637 2010-08-03  Cary Coutant  <ccoutant@google.com>
2638
2639         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2640         to reserve space in merged_strings vector. Keep total input size
2641         for stats.
2642         (Output_merge_string::do_print_merge_stats): Print total input size.
2643         * merge.h (Output_merge_string): Add input_size_ field.
2644         * stringpool.cc (Stringpool_template::string_length): Move
2645         implementations out of Stringpool_template class and place in
2646         stringpool.h.
2647         * stringpool.h (string_length): Move out of Stringpool_template.
2648
2649 2010-08-03  Ian Lance Taylor  <iant@google.com>
2650
2651         PR 11712
2652         * layout.cc (relaxation_loop_body): If address of load segment is
2653         set, adjust address to include headers if possible.
2654
2655 2010-08-03  Ian Lance Taylor  <iant@google.com>
2656
2657         * version.cc (version_string): Bump to 1.10.
2658
2659 2010-08-03  Ian Lance Taylor  <iant@google.com>
2660
2661         PR 11805
2662         * layout.h (enum Output_section_order): Define.
2663         (class Layout): Update declarations.
2664         * layout.cc (Layout::get_output_section): Add order parameter.
2665         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2666         is_first_non_relro parameters.  Change all callers.
2667         (Layout::choose_output_section): Likewise.
2668         (Layout::add_output_section_data): Likewise.
2669         (Layout::make_output_section): Likewise.  Set order.
2670         (Layout::default_section_order): New function.
2671         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2672         * output.cc (Output_section::Output_section): Initialize order_.
2673         Don't initialize deleted fields.
2674         (Output_segment::Output_segment): Don't initialize deleted
2675         fields.
2676         (Output_segment::add_output_section_to_load): New function
2677         replacing add_output_section.  Change all callers to call this or
2678         add_output_section_to_nonload.
2679         (Output_segment::add_output_section_to_nonload): New function.
2680         (Output_segment::remove_output_section): Rewrite.
2681         (Output_segment::add_initial_output_data): Likewise.
2682         (Output_segment::has_any_data_sections): Likewise.
2683         (Output_segment::is_first_section_relro): Likewise.
2684         (Output_segment::maximum_alignment): Likewise.
2685         (Output_segment::has_dynamic_reloc): New function replacing
2686         dynamic_reloc_count.  Change all callers.
2687         (Output_segment::has_dynamic_reloc_list): New function replacing
2688         dynamic_reloc_count_list.  Change all callers.
2689         (Output_segment::set_section_addresses): Rewrite.
2690         (Output_segment::set_offset): Rewrite.
2691         (Output_segment::find_first_and_last_list): Remove.
2692         (Output_segment::set_tls_offsets): Rewrite.
2693         (Output_segment::first_section_load_address): Likewise.
2694         (Output_segment::output_section_count): Likewise.
2695         (Output_segment::section_with_lowest_load_address): Likewise.
2696         (Output_segment::write_section_headers): Likewise.
2697         (Output_segment::print_sections_to_map): Likewise.
2698         * output.h (class Output_data): Remove dynamic_reloc_count_
2699         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2700         (Output_data::add_dynamic_reloc): Rewrite.
2701         (Output_data::has_dynamic_reloc): New function.
2702         (Output_data::dynamic_reloc_count): Remove.
2703         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2704         is_last_relro_, is_first_non_relro_, is_interp_,
2705         is_dynamic_linker_section_ fields.  Add order and set_order
2706         functions.  Remove is_relro_local, set_is_relro_local,
2707         is_last_relro, set_is_last_relro, is_first_non_relro,
2708         set_is_first_non_relro functions, is_interp, set_is_interp,
2709         is_dynamic_linker_section, and set_is_dynamic_linker_section
2710         functions.
2711         (class Output_segment): Change Output_data_list from std::list to
2712         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2713         output_bss_ fields.  Update declarations.
2714
2715 2010-08-02  Ian Lance Taylor  <iant@google.com>
2716
2717         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2718         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2719         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2720
2721 2010-08-02  Ian Lance Taylor  <iant@google.com>
2722
2723         PR 11855
2724         * script.cc (Script_options::Script_options): Initialize
2725         symbol_definitions_ and symbol_references_.
2726         (Script_options::add_symbol_assignment): Update
2727         symbol_definitions_ and symbol_references_.
2728         (Script_options::add_symbol_reference): New function.
2729         (script_symbol): New function.
2730         * script.h (class Script_options): Add symbol_definitions_ and
2731         symbol_references_ fields.
2732         (Script_options::referenced_const_iterator): New type.
2733         (Script_options::referenced_begin): New function.
2734         (Script_options::referenced_end): New function.
2735         (Script_options::is_referenced): New function.
2736         (Script_options::any_unreferenced): New function.
2737         * script-c.h (script_symbol): Declare.
2738         * yyscript.y (exp): Call script_symbol.
2739         * symtab.cc: Include "script.h".
2740         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2741         Change all callers.  Check symbols referenced by scripts.
2742         (Symbol_table::add_undefined_symbols_from_command_line): Add
2743         layout parameter.  Change all callers.
2744         (Symbol_table::do_add_undefined_symbols_from_command_line):
2745         Likewise.  Break out loop body.  Check symbols referenced by
2746         scripts.
2747         (Symbol_table::add_undefined_symbol_from_command_line): New
2748         function broken out of
2749         do_add_undefined_symbols_from_command_line.
2750         * symtab.h (class Symbol_table): Update declarations.
2751         * archive.cc: Include "layout.h".
2752         (Archive::should_include_member): Add layout parameter.  Change
2753         all callers.  Check for symbol mentioned in expression.
2754         * archive.h (class Archive): Update declaration.
2755         * object.cc (Sized_relobj::do_should_include_member): Add layout
2756         parameter.
2757         * object.h (Object::should_include_member): Add layout parameter.
2758         Change all callers.
2759         (Object::do_should_include_member): Add layout parameter.
2760         (class Sized_relobj): Update declaration.
2761         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2762         parameter.
2763         * dynobj.h (class Sized_dynobj): Update declaration.
2764         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2765         layout parameter.
2766         * plugin.h (class Sized_pluginobj): Update declaration.
2767
2768 2010-08-02  Ian Lance Taylor  <iant@google.com>
2769
2770         PR 11866
2771         * output.cc (Output_segment::set_offset): Search for the first and
2772         last sections rather than assuming that the list is in order.
2773         (Output_segment::find_first_and_last_list): New function.
2774         * output.h (class Output_segment): Update declarations.
2775         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2776         (relro_strip_test_SOURCES): New variable.
2777         (relro_strip_test_DEPENDENCIES): New variable.
2778         (relro_strip_test_LDFLAGS): New variable.
2779         (relro_strip_test_LDADD): New variable.
2780         (relro_strip_test.so): New target.
2781
2782 2010-08-02  Ian Lance Taylor  <iant@google.com>
2783
2784         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2785         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2786         (Target_i386::got_tlsdesc_section): New function.
2787         (Target_i386::got_section): Create space for GOT entries for
2788         TLSDESC relocations.
2789         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2790         R_386_TLS_GOTDESC.
2791         (Target_i386::Scan::global): Likewise.
2792         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2793         using TLSDESC GOT.
2794         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2795         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2796         (Target_x86_64::got_tlsdesc_section): New function.
2797         (Target_x86_64::got_section): Create space for GOT entries for
2798         TLSDESC relocations.
2799         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2800         R_386_TLS_GOTDESC.
2801         (Target_x86_64::Scan::global): Likewise.
2802         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2803         using TLSDESC GOT.
2804
2805 2010-08-02  Ian Lance Taylor  <iant@google.com>
2806
2807         * testsuite/final_layout.sh: Use dc to convert from hex to
2808         decimal.
2809
2810 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2811
2812         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2813         paramter to the call to gold::gc_process_relocs.
2814         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2815         paramter to the call to gold::gc_process_relocs.
2816         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2817         parameter to the call to gold::gc_process_relocs.
2818         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2819         template parameter to the call to gold::gc_process_relocs.
2820         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2821         paramter to the call to gold::gc_process_relocs.
2822         * gc.h (get_embedded_addend_size): New function.
2823         (gc_process_relocs): Save the size of the reloc for use by ICF.
2824         * icf.cc (get_section_contents): Get the addend from the text section
2825         for SHT_REL relocation sections.
2826         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2827         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2828         * int_encoding.h (read_from_pointer): New overloaded function.
2829         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2830         * testsuite/icf_sht_rel_addend_test.sh: New file.
2831         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2832         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2833
2834 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2835
2836         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2837         * Makefile.in: Regenerate.
2838         * testsuite/Makefile.in: Regenerate.
2839
2840 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2841
2842         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2843         * gold/testsuite/debug_msg.cc: Likewise.
2844         * gold/testsuite/odr_violation1.cc
2845         * gold/testsuite/odr_violation2.cc
2846
2847 2010-07-21  Cary Coutant  <ccoutant@google.com>
2848
2849         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2850         string, and length fields.
2851         (Output_merge_string::Merged_strings_list): New type.
2852         (Output_merge_string::Merged_strings_lists): New typedef.
2853         (Output_merge_string): Replace merged_strings_ with
2854         merged_strings_lists_.
2855         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2856         Merged_strings_list per input object and section.  Don't store pointer
2857         to the string.  Don't store length with each merged string entry.
2858         (Output_merge_string::finalize_merged_data): Loop over list of merged
2859         strings lists.  Recompute length of each merged string.
2860
2861 2010-07-15  Cary Coutant  <ccoutant@google.com>
2862
2863         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2864         here.
2865
2866 2010-07-14  Ian Lance Taylor  <iant@google.com>
2867
2868         * descriptors.cc (Descriptors::open): Report correct name in error
2869         message.
2870
2871 2010-07-13  Doug Kwan  <dougkwan@google.com>
2872
2873         * arm.cc (Arm_input_section::Arm_input_section): For a
2874         SHT_ARM_EXIDX section, always keeps the input sections.
2875         (Arm_input_section::set_exidx_section_link): New method.
2876         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2877         has_errors_ to false.
2878         (Arm_exidx_input_section::has_errors,
2879         Arm_exidx_input_section::set_has_errors): New methods.
2880         (Arm_exidx_input_section::has_errors_): New data member.
2881         (Arm_relobj::get_exidx_shndx_list): New method.
2882         (Arm_output_section::append_text_sections_to_list): Do not skip
2883         section without SHF_EXECINSTR.
2884         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2885         errors.
2886         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2887         section header.  Make error messages more verbose.  Check for
2888         a non-executable section linked to an EXIDX section.
2889         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2890         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2891         check that there is no deferred EXIDX section if we exit early.
2892         Instead of not making an EXIDX section in case of an error, make one
2893         and set the has_errors flag of it.
2894         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2895         in a relocatable link.
2896         (Target_arm::do_relax): Look for the EXIDX output section instead of
2897         assuming that it is called .ARM.exidx.
2898         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2899         section list.  Do not check for SHF_EXECINSTR section flags but
2900         skip any input section with errors.
2901         * output.cc (Output_section::Output_section): Initialize
2902         always_keeps_input_sections_ to false.
2903         (Output_section::add_input_section): Check for
2904         always_keeps_input_sections_.
2905         *  output.h (Output_section::always_keeps_input_sections,
2906         Output_section::set_always_keeps_input_sections): New methods.
2907         (Output_section::always_keeps_input_sections): New data member.
2908
2909 2010-07-13  Rafael Espindola  <espindola@google.com>
2910
2911         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2912         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2913
2914 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2915             Ian Lance Taylor  <iant@google.com>
2916
2917         * output.h (Output_section_lookup_maps::add_merge_section):
2918         Correct check of whether value was inserted.
2919         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2920         (Output_section_lookup_maps::add_relaxed_input_section):
2921         Likewise.
2922         * arm.cc (Target_arm::got_section): Remove used local os.
2923         * i386.cc (Target_i386::got_section): Likewise.
2924         * x86_64.cc (Target_x86_64::got_section): Likewise.
2925         * sparc.cc (Target_sparc::got_section): Likewise.
2926         (Target_sparc::relocate): Remove unused local have_got_offset.
2927         * powerpc.cc (Target_powerpc::relocate): Likewise.
2928
2929 2010-07-13  Ian Lance Taylor  <iant@google.com>
2930
2931         * compressed_output.cc (zlib_decompress): Fix signature in
2932         !HAVE_ZLIB_H case.
2933
2934         * archive.cc (Archive::include_member): Unlock an external member
2935         of a thin archive.  Don't bother to delete an object we know is
2936         NULL.
2937
2938 2010-07-12  Cary Coutant  <ccoutant@google.com>
2939
2940         * compressed_output.cc (zlib_decompress): New function.
2941         (get_uncompressed_size): New function.
2942         (decompress_input_section): New function.
2943         * compressed_output.h (get_uncompressed_size): New function.
2944         (decompress_input_section): New function.
2945         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2946         Handle compressed debug sections.
2947         * layout.cc (is_compressed_debug_section): New function.
2948         (Layout::output_section_name): Map compressed section names to
2949         canonical names.
2950         * layout.h (is_compressed_debug_section): New function.
2951         (is_debug_info_section): Recognize compressed debug sections.
2952         * merge.cc: Include compressed_output.h.
2953         (Output_merge_data::do_add_input_section): Handle compressed
2954         debug sections.
2955         (Output_merge_string::do_add_input_section): Handle compressed
2956         debug sections.
2957         * object.cc: Include compressed_output.h.
2958         (Sized_relobj::Sized_relobj): Initialize new data members.
2959         (build_compressed_section_map): New function.
2960         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2961         * object.h (Object::section_is_compressed): New method.
2962         (Object::do_section_is_compressed): New method.
2963         (Sized_relobj::Compressed_section_map): New type.
2964         (Sized_relobj::do_section_is_compressed): New method.
2965         (Sized_relobj::compressed_sections_): New data member.
2966         * output.cc (Output_section::add_input_section): Handle compressed
2967         debug sections.
2968         * reloc.cc: Include compressed_output.h.
2969         (Sized_relobj::write_sections): Handle compressed debug sections.
2970
2971 2010-07-08  Cary Coutant  <ccoutant@google.com>
2972
2973         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2974         weak when resolving to a dynamic def.
2975         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2976         for weak undef/dynamic def cases. Adjust callers.
2977         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2978         undef_binding_weak_.
2979         (Symbol_table::sized_write_globals): Adjust symbol binding.
2980         (Symbol_table::sized_write_symbol): Add binding parameter.
2981         * symtab.h (Symbol::set_undef_binding): New method.
2982         (Symbol::is_undef_binding_weak): New method.
2983         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2984         (Symbol_table::should_override): Add new parameter.
2985         (Symbol_table::sized_write_symbol): Add new parameter.
2986
2987         * testsuite/weak_undef_file1.cc: Add new test case.
2988         * testsuite/weak_undef_file2.cc: Fix header comment.
2989         * testsuite/weak_undef_test.cc: Add new test case.
2990
2991 2010-06-29  Doug Kwan  <dougkwan@google.com>
2992
2993         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2994         Initialize USE_SYMBOL_.
2995         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2996         definition.
2997         (Arm_reloc_property::uses_symbol_): New data member declaration.
2998         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2999         uses symbol value and symbol is undefined but not weakly undefined.
3000
3001 2010-06-28  Rafael Espindola  <espindola@google.com>
3002
3003         * plugin.cc (Plugin::load): Use dlerror.
3004
3005 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3006
3007         * symtab.cc (detect_odr_violations): When reporting an ODR
3008         violation, report an object where the symbol is defined.
3009
3010 2010-06-25  Doug Kwan  <dougkwan@google.com>
3011
3012         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3013         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3014         definition.
3015         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3016         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3017         target hook to detect function points.
3018         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3019         * icf.h (Icf::check_section_for_function_pointers): Change type of
3020         parameter SECTION_NAME to const reference to std::string.  Use
3021         target hook to determine if section may have unsafe pointers.
3022         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3023         method definition.
3024
3025 2010-06-21  Rafael Espindola  <espindola@google.com>
3026
3027         * fileread.cc (Input_file::find_fie): New
3028         (Input_file::open): Use Input_file::find_fie.
3029         * fileread.h (Input_file::find_fie): New
3030         * plugin.cc (set_extra_library_path): New.
3031         (Plugin::load): Add set_extra_library_path to the transfer vector.
3032         (Plugin_manager::set_extra_library_path): New.
3033         (Plugin_manager::add_input_file): Use the extra search path if set.
3034         (set_extra_library_path(): New.
3035         * plugin.h (Plugin_manager): Add set_extra_library_path and
3036         extra_search_path_.
3037
3038 2010-06-19  Cary Coutant  <ccoutant@google.com>
3039
3040         * layout.cc (gdb_sections): Add .debug_types.
3041         (lines_only_debug_sections): Likewise.
3042
3043 2010-06-18  Rafael Espindola  <espindola@google.com>
3044
3045         * plugin.cc (add_input_file,add_input_library)
3046         (Plugin_manager::add_input_file): Make filename arguments const.
3047         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3048         const.
3049
3050 2010-06-16  Doug Kwan  <dougkwan@google.com>
3051
3052         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3053         .ARM.attributes section if we have not merged any input
3054         attributes sections.
3055
3056 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3057
3058         * arm.cc: Allow combining objects with no EABI version
3059         information.
3060
3061 2010-06-15  Rafael Espindola  <espindola@google.com>
3062
3063         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3064
3065 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3066
3067         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3068         (struct iovec): Correct !HAVE_READV definition.
3069
3070 2010-06-10  Cary Coutant  <ccoutant@google.com>
3071
3072         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3073         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3074         reloc sections.
3075         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3076
3077         PR 11683
3078         * symtab.h (Symbol::is_placeholder): New member function.
3079         * target-reloc.h (relocate_section): Check for placeholder symbols.
3080
3081         * testsuite/Makefile.am (plugin_test_8): New test.
3082         (plugin_test_9): New test.
3083         * testsuite/Makefile.in: Regenerate.
3084
3085 2010-06-09  Nick Clifton  <nickc@redhat.com>
3086
3087         * yyscript.y (input_list_element): Allow strings prefixed with
3088         the '-' character.  Treat these as libraries.
3089         * script.cc (script_add_library): New function.  Adds a library
3090         specified by "-l<name>" found in an input script.
3091         * script-c.h: Add prototype for script_add_library.
3092
3093 2010-06-07  Doug Kwan  <dougkwan@google.com>
3094
3095         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3096         Restrict stub-group size to be within long conditional branch
3097         range when working around cortex-A8 erratum.
3098
3099 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3100
3101         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3102         #ifdef typo.
3103
3104 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3105
3106         PR gold/11658
3107         * output.cc
3108         (Output_section::Input_section_sort_entry::compare_section_ordering):
3109         Change to return non-zero correctly.
3110         (Output_section::Input_section_sort_section_order_index_compare
3111         ::operator()): Change to fix ambiguity in comparisons.
3112
3113 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3114
3115         * gold.h (is_wildcard_string): New function.
3116         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3117         (Layout::layout_eh_frame): Ditto.
3118         (Layout::find_section_order_index): New method.
3119         (Layout::read_layout_from_file): New method.
3120         * layout.h (Layout::find_section_order_index): New method.
3121         (Layout::read_layout_from_file): New method.
3122         (Layout::input_section_position_): New private member.
3123         (Layout::input_section_glob_): New private member.
3124         * main.cc (main): Call read_layout_from_file here.
3125         * options.h (--section-ordering-file): New option.
3126         * output.cc (Output_section::input_section_order_specified_): New
3127         member.
3128         (Output_section::Output_section): Initialize new member.
3129         (Output_section::add_input_section): Add new parameter.
3130         Keep input sections when --section-ordering-file is used.
3131         (Output_section::set_final_data_size): Sort input sections when
3132         section ordering file is specified.
3133         (Output_section::Input_section_sort_entry): Add new parameter.
3134         Check sorting type.
3135         (Output_section::Input_section_sort_entry::compare_section_ordering):
3136         New method.
3137         (Output_section::Input_section_sort_compare::operator()): Change to
3138         consider section_order_index.
3139         (Output_section::Input_section_sort_init_fini_compare::operator()):
3140         Change to consider section_order_index.
3141         (Output_section::Input_section_sort_section_order_index_compare
3142         ::operator()): New method.
3143         (Output_section::sort_attached_input_sections): Change to sort
3144         according to section order when specified.
3145         (Output_section::add_input_section<32, true>): Add new parameter.
3146         (Output_section::add_input_section<64, true>): Add new parameter.
3147         (Output_section::add_input_section<32, false>): Add new parameter.
3148         (Output_section::add_input_section<64, false>): Add new parameter.
3149         * output.h (Output_section::add_input_section): Add new parameter.
3150         (Output_section::input_section_order_specified): New
3151         method.
3152         (Output_section::set_input_section_order_specified): New method.
3153         (Input_section::Input_section): Initialize section_order_index_.
3154         (Input_section::section_order_index): New method.
3155         (Input_section::set_section_order_index): New method.
3156         (Input_section::section_order_index_): New member.
3157         (Input_section::Input_section_sort_section_order_index_compare): New
3158         struct.
3159         (Output_section::input_section_order_specified_): New member.
3160         * script-sections.cc (is_wildcard_string): Delete and move modified
3161         method to gold.h.
3162         (Output_section_element_input::Output_section_element_input): Modify
3163         call to is_wildcard_string.
3164         (Output_section_element_input::Input_section_pattern
3165         ::Input_section_pattern): Ditto.
3166         (Output_section_element_input::Output_section_element_input): Ditto.
3167         * testsuite/Makefile.am (final_layout): New test case.
3168         * testsuite/Makefile.in: Regenerate.
3169         * testsuite/final_layout.cc: New file.
3170         * testsuite/final_layout.sh: New file.
3171
3172 2010-06-01  Rafael Espindola  <espindola@google.com>
3173
3174         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3175
3176 2010-06-01  Rafael Espindola  <espindola@google.com>
3177
3178         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3179         visibility of symbols.
3180
3181 2010-05-27  Doug Kwan  <dougkwan@google.com>
3182
3183         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3184         from start of output section instead of address for a local symbol
3185         in a merged or relaxed section when doing a relocatable link.
3186
3187 2010-05-26  Rafael Espindola  <espindola@google.com>
3188
3189        PR 11604
3190         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3191         adding sections the garbage collector removed.
3192         * gold/testsuite/Makefile.am: Add test.
3193         * gold/testsuite/Makefile.in: Regenerate.
3194         * gold/testsuite/plugin_test_7.sh: New.
3195         * gold/testsuite/plugin_test_7_1.c: New.
3196         * gold/testsuite/plugin_test_7_2.c: New.
3197
3198 2010-05-26  Rafael Espindola  <espindola@google.com>
3199
3200         * script-sections.cc (Output_section_definition::set_section_addresses):
3201         Check for --section-start.
3202
3203 2010-05-26  Doug Kwan  <dougkwan@google.com>
3204
3205         * arm.cc (Arm_scan_relocatable_relocs): New class.
3206         (Target_arm::relocate_special_relocatable): New method.
3207         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3208         (Arm_relocate_functions::thumb_branch_common): Same.
3209         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3210         instead of Default_scan_relocatable_relocs.
3211         * target-reloc.h (relocate_for_relocatable): Let target handle
3212         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3213         * target.h (Sized_target::relocate_special_relocatable): New method.
3214
3215 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3216
3217         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3218
3219 2010-05-23  Doug Kwan  <dougkwan@google.com>
3220
3221         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3222         instead of a cast.
3223         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3224         with a direct branch, not a conditional branch, to a stub.
3225         * merge.cc (Output_merge_base::record_input_section): New method
3226         defintion.
3227         (Output_merge_data::do_add_input_section): Record input section if
3228         keeps-input-sections flag is set.
3229         (Output_merge_string::do_add_input_section): Ditto.
3230         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3231         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3232         INPUT_SECTIONS_.
3233         (Output_merge_base::keeps_input_sections,
3234         Output_merge_base::set_keeps_input_sections,
3235         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3236         method definitions.
3237         (Output_merge_base::Input_sections): New type declaration.
3238         (Output_merge_base::input_sections_begin,
3239         Output_merge_base::input_sections_end,
3240         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3241         (Output_merge_base::bool keeps_input_sections_,
3242         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3243         Output_merge_base::input_sections_): New data members.
3244         (Output_merge_data::do_set_keeps_input_sections): New method
3245         defintion.
3246         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3247         * output.cc (Output_section::Input_section::relobj): Move method
3248         defintion from class declaration to here and handle merge sections.
3249         (Output_section::Input_section::shndx): Ditto.
3250         (Output_section::Output_section): Remove initializations of removed
3251         data members and initialize new data member LOOKUP_MAPS_.
3252         (Output_section::add_input_section): Set keeps-input-sections flag
3253         for a newly created merge output section as appropriate.  Adjust code
3254         to use Output_section_lookup_maps class.
3255         (Output_section::add_relaxed_input_section): Adjst code for lookup
3256         maps code refactoring.
3257         (Output_section::add_merge_input_section): Add a new parameter
3258         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3259         class.  If adding input section to a newly created merge output
3260         section fails, remove the new merge section.
3261         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3262         Adjust code for use of the Output_section_lookup_maps class.
3263         (Output_section::find_merge_section): Ditto.
3264         (Output_section::build_lookup_maps): New method defintion.
3265         (Output_section::find_relaxed_input_section): Adjust code to use
3266         Output_section_lookup_maps class.
3267         (Output_section::get_input_sections): Export merge sections.  Adjust
3268         code to use Output_section_lookup_maps class.
3269         (Output_section:::add_script_input_section): Adjust code to use
3270         Output_section_lookup_maps class.  Update lookup maps for merge
3271         sections also.
3272         (Output_section::discard_states): Use Output_section_lookup_maps.
3273         (Output_section::restore_states): Same.
3274         * output.h (Merge_section_properties): Move class defintion out of
3275         Output_section.
3276         (Output_section_lookup_maps): New class.
3277         (Output_section::Input_section::is_merge_section): New method
3278         defintion.
3279         (Output_section::Input_section::relobj): Move defintion out of class
3280         defintion.  Declare method only.
3281         (Output_section::Input_section::shndx): Ditto.
3282         (Output_section::Input_section::output_merge_base): New method defintion.
3283         (Output_section::Input_section::u2_.pomb): New union field.
3284         (Output_section::Merge_section_by_properties_map,
3285         Output_section::Output_section_data_by_input_section_map,
3286         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3287         Remove types.
3288         (Output_section::add_merge_input_section): Add new parameter
3289         KEEPS_INPUT_SECTIONS.
3290         (Output_section::build_lookup_maps): New method declaration.
3291         (Output_section::merge_section_map_,
3292         Output_section::merge_section_by_properties_map_,
3293         Output_section::relaxed_input_section_map_,
3294         Output_section::is_relaxed_input_section_map_valid_): Remove data
3295         members.
3296         (Output_section::lookup_maps_): New data member.
3297
3298 2010-05-21  Doug Kwan  <dougkwan@google.com>
3299
3300         PR gold/11619
3301         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3302         avoid a compilation error.
3303
3304 2010-05-19  Rafael Espindola  <espindola@google.com>
3305
3306         * script-sections.cc (Output_section_definition::allocate_to_segment):
3307         Update the phdrs_list even when the output section is NULL.
3308         * testsuite/Makefile.am: Add test.
3309         * testsuite/Makefile.in: Regenerate.
3310         * testsuite/script_test_9.cc: New.
3311         * testsuite/script_test_9.sh: New.
3312         * testsuite/script_test_9.t: New.
3313
3314 2010-05-19  Doug Kwan  <dougkwan@google.com>
3315
3316         * arm.cc (Arm_input_section::original_size): New method.
3317         (Arm_input_section::do_addralign): Add a cast.
3318         (Arm_input_section::do_output_offset): Remove static cast.
3319         (Arm_input_section::original_addralign,
3320          Arm_input_section::original_size_): Change type to uint32_t.
3321         (Arm_input_section::init): Add safe casts for section alignment
3322         and size.
3323         (Arm_input_section::set_final_data_size): Do not set address and
3324         offset of stub table.
3325         (Arm_output_section::fix_exidx_coverage): Change use of of
3326         Output_section::Simple_input_section to that of
3327         Output_section::Input_section.
3328         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3329         except for the first pass.
3330         * output.cc (Output_section::get_input_sections): Change type of
3331         input_sections to std::list<Input_section>.
3332         (Output_section::add_script_input_section): Rename from
3333         Output_section::add_simple_input_section.  Change type of SIS
3334         parameter from Simple_input_section to Input_section.
3335         * output.h (Output_section::Simple_input_section): Remove class.
3336         (Output_section::Input_section): Change class visibility to public.
3337         (Output_section::Input_section::addralign): Use stored alignments
3338         for special input sections if set.
3339         (Output_section::Input_section::set_addralign): New method.
3340         (Output_section::get_input_sections): Change parameter type from
3341         list of Simple_input_section to list of Input_section.
3342         (Output_section::add_script_input_section): Rename from
3343         Output_section::add_simple_input_section. Change first parameter's
3344         type from Simple_input_section to Input_section and remove the
3345         second and third parameters.
3346         * script-sections.cc (Input_section::Input_section_list): Change
3347         type to list of Output_section::Input_section/
3348         (Input_section_info::Input_section_info): Change parameter type of
3349         INPUT_SECTION to Output_section::Input_section.
3350         (Input_section_info::input_section): Change return type.
3351         (Input_section_info::input_section_): Change type to
3352         Output_section::Input_section.
3353         (Output_section_element_input::set_section_addresses): Adjust code
3354         to use Output_section::Input_section instead of
3355         Output_section::Simple_input_section.  Adjust code for renaming
3356         of Output_section::add_simple_input_section.
3357         (Orphan_output_section::set_section_addresses): Ditto.
3358
3359 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3360
3361         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3362         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3363
3364 2010-05-18  Rafael Espindola  <espindola@google.com>
3365
3366         * options.cc (General_options::finalize): Handle -nostdlib.
3367         * options.h (nostdlib): New option.
3368         * script.cc (script_add_search_dir): Handle -nostdlib.
3369
3370 2010-05-12  Doug Kwan  <dougkwan@google.com>
3371
3372         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3373         attributes section only if there no attributes section after merging.
3374         (Target_arm::merge_object_attributes): Move value of
3375         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3376         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3377         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3378         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3379         and arm_attr_merge_7.stdout.
3380         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3381         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3382         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3383         arm_attr_merge_7b.o): New rules.
3384         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3385         arm_attr_merge_7
3386         * testsuite/Makefile.in: Regenerate.
3387         * testsuite/arm_attr_merge.sh: New file.
3388         * testsuite/arm_attr_merge_[67][ab].s: Same.
3389
3390 2010-05-05  Nick Clifton  <nickc@redhat.com>
3391
3392         * po/es.po: Updated Spanish translation.
3393
3394 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3395
3396         * Makefile.am (install-exec-local): Properly install gold as
3397         default cross linker.
3398         * Makefile.in: Regenerated.
3399
3400 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3401             Nick Clifton  <nickc@redhat.com>
3402
3403         * configure.ac (install_as_default): Define and set to false
3404         unless --enable-gold or --enable-gold=both/gold has been
3405         specified.
3406         * configure: Regenerate.
3407
3408         * Makefile.am (install-exec-local): Install the executable as
3409         'ld.gold'.  If install_as_default is true then also install it as
3410         'ld'.
3411         * Makefile.in: Regenerated.
3412
3413 2010-04-24  Ian Lance Taylor  <iant@google.com>
3414
3415         * layout.cc (Layout::layout_reloc): In relocatable link don't
3416         combine reloc sections for grouped sections.
3417
3418 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3419
3420         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3421         sections that are not ordinary to icf.
3422         * icf.cc (get_section_contents): Handle relocation pointing to section
3423         with no object or shndx information.
3424         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3425         * testsuite/Makefile.in: Regenerate.
3426         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3427         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3428
3429 2010-04-22  Ian Lance Taylor  <iant@google.com>
3430
3431         * expression.cc (Expression::Expression_eval_info): Add
3432         result_alignment_pointer field.
3433         (Expression::eval_with_dot): Add result_alignment_pointer
3434         parameter.  Change all callers.
3435         (Expression::eval_maybe_dot): Likewise.
3436         (class Binary_expression): Add alignment_pointer parameter to
3437         left_value and right_value.  Change all callers.
3438         (BINARY_EXPRESSION): Set result alignment.
3439         (class Trinary_expression): Add alignment_pointer parameter to
3440         arg2_value and arg3_value.  Change all callers.
3441         (Trinary_cond::value): Set result alignment.
3442         (Max_expression::value, Min_expression::value): Likewise.
3443         (Align_expression::value): Likewise.
3444         * script-sections.cc (class Sections_element): Add dot_alignment
3445         parameter to set_section_addresses virtual function.  Update
3446         instantiations.
3447         (class Output_section_element): Likewise.
3448         (Script_sections::create_segments): Add dot_alignment parameter.
3449         Change all callers.
3450         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3451         (Script_sections::set_phdrs_clause_addresses): Likewise.
3452         * script-sections.h: Update declarations.
3453         * script.h: Update declarations.
3454         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3455         min_p_align.
3456         * testsuite/script_test_3.t: Set large alignment.
3457         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3458         segment has expected alignment.
3459
3460 2010-04-22  Nick Clifton  <nickc@redhat.com>
3461
3462         * po/gold.pot: Updated by the Translation project.
3463         * po/vi.po: Updated Vietnamese translation.
3464
3465 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3466
3467         * testsuite/Makefile.am (check_PROGRAMS): Add
3468         icf_virtual_function_folding_test.
3469         * testsuite/Makefile.in: Regenerated.
3470
3471 2010-04-15  Andrew Haley  <aph@redhat.com>
3472
3473         * options.h (merge_exidx_entries): New option.
3474         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3475         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3476         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3477         (Target_arm::merge_exidx_entries): New function.
3478         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3479         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3480         to Arm_exidx_fixup constructor.
3481         Add new arg, merge_exidx_entries.
3482         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3483         Arm_output_section::fix_exidx_coverage.
3484
3485 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3486
3487         * icf.cc (get_section_contents): Check for preemptible functions.
3488         Ignore addend when appropriate.
3489         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3490         section folded.
3491         (add_from_relobj): Check for section folded.
3492         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3493         * symtab.h (should_add_dynsym_entry): Add new parameter.
3494         * target-reloc.h (scan_relocs): Check for section folded.
3495         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3496         Check reloc types for function pointers in shared objects.
3497         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3498         case.
3499         (icf_preemptible_functions_test): New test case.
3500         (icf_string_merge_test): New test case.
3501         * testsuite.Makefile.in: Regenerate.
3502         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3503         bar_glob.  Refactor code.
3504         * testsuite/icf_preemptible_functions_test.cc: New file.
3505         * testsuite/icf_preemptible_functions_test.sh: New file.
3506         * testsuite/icf_string_merge_test.cc: New file.
3507         * testsuite/icf_string_merge_test.sh: New file.
3508         * testsuite/icf_virtual_function_folding_test.cc: New file.
3509         * testsuite/icf_virtual_function_folding_test.sh: New file.
3510
3511 2010-04-14  Doug Kwan  <dougkwan@google.com>
3512
3513         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3514         for local symbol recounting if we remove a section due to ICF.
3515         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3516         there are no regular objects in input.
3517
3518 2010-04-13  Doug Kwan  <dougkwan@google.com>
3519
3520         * arm.cc (Arm_input_section::set_final_data_size): Compute
3521         accurate final data size instead of using current data size.
3522
3523 2010-04-09  Doug Kwan  <dougkwan@google.com>
3524
3525         * layout.cc (Layout::choose_output_section): Handle script section
3526         types.
3527         (Layout::make_output_section_for_script): Add section type parameter.
3528         Handle script section types.
3529         * layout.h (Layout::make_output_section_for_script): Add section
3530         type parameter.
3531         * output.cc (Output_section::Output_section): Initialize data member
3532         is_noload_.
3533         (Output_section::do_reset_address_and_file_offset): Do not set address
3534         to 0 if section is a NOLOAD section.
3535         * output.h (Output_section::is_noload): New method.
3536         (Output_section::set_is_noload): Ditto.
3537         (Output_section::is_noload_): New data member.
3538         * script-c.h (Script_section_type): New enum type.
3539         (struct Parser_output_section_header): Add new file section_type.
3540         * script-sections.cc (Sections_element::output_section_name): Add
3541         parameter for returning script section type.
3542         (Output_section_definition::output_section_name): Ditto.
3543         (Output_section_definition::section_type)P; New method.
3544         (Output_section_definiton::script_section_type_name): Ditto.
3545         (Output_section_definition::script_section_type_): New data member.
3546         (Output_section_definition::Output_section_definition): Initialize
3547         data member Output_section_definition::script_section_type_.
3548         (Output_section_definition::create_sections): Pass script section type
3549         to Layout::make_output_section_for_script.
3550         (Output_section_definition::output_section_name): Return script
3551         section type to caller.
3552         (Output_section_definition::set_section_address): Do not advance
3553         dot value and load address if section type is NOLOAD.  Set address
3554         of NOLOAD sections regardless of section flags.
3555         (Output_section_definition::print): Print section type if it is
3556         not SCRIPT_SECTION_TYPE_NONE.
3557         (Output_section_definition::section_type): New method.
3558         (Output_section_definition::script_section_type_name): Ditto.
3559         (Script_sections::output_section_name): Add new parameter
3560         PSECTION_TYPE for returning script section type.  Pass it to
3561         section elements.  Handle discard sections.
3562         (Sort_output_sections::operator()): Handle NOLOAD sections.
3563         * script-sections.h (Script_sections::Section_type): New enum type.
3564         (Script_sections::output_section_name): Add a new parameter for
3565         returning script section type.
3566         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3567         INFO and NOLOAD.
3568         * yyscript.y (union): Add new field SECTION_TYPE.
3569         (COPY, DSECT, INFO, NOLOAD): New tokens.
3570         (opt_address_and_section_type): Change type to output_section_header.
3571         (section_type): New non-terminal
3572         (section_header): Handle section type.
3573         (opt_address_and_section_type): Return section type value.
3574
3575 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3576
3577         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3578         * testsuite/plugin_common_test_2.c (foo): Likewise.
3579
3580 2010-04-08  Doug Kwan  <dougkwan@google.com>
3581
3582         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3583         Output_merge_data.
3584         * output.cc (Output_section::add_merge_input_section): Simplify
3585         code and return status of Output_merge_base::add_input_section.
3586         Update merge section map only if Output_merge_base::add_input_section
3587         returns true.
3588
3589 2010-04-07  Doug Kwan  <dougkwan@google.com>
3590
3591         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3592         if section is marked as containing instructions but has no mapping
3593         symbols.
3594         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3595         correct section index.
3596         (Arm_relobj::find_linked_text_section): Ditto.
3597
3598 2010-04-07  Cary Coutant  <ccoutant@google.com>
3599
3600         * archive.cc (include_member): Destroy Read_symbols_data object before
3601         releasing file.
3602         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3603         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3604         (Read_symbols_data::~Read_symbols_data) New destructor.
3605         (Section_relocs::Section_relocs) New constructor.
3606         (Section_relocs::~Section_relocs) New destructor.
3607         (Read_relocs_data::Read_relocs_data) New constructor.
3608         (Read_relocs_data::~Read_relocs_data) New destructor.
3609         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3610         pointers to NULL after deleting.
3611
3612 2010-04-07  Doug Kwan  <dougkwan@google.com>
3613
3614         * arm.cc: Replace "endianity" with "endianness" in comments.
3615         (Arm_exidx_cantunwind): Ditto.
3616         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3617         (Arm_relobj::merge_flags_and_attributes): New method.
3618         (Arm_relobj::merge_flags_and_attributes_): New data member.
3619         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3620         (Arm_relobj::scan_sections_for_stubs): Ditto.
3621         (Arm_relobj::do_read_symbols): Check to see if we really want to
3622         merge processor-specific flags and attributes.  Exit early if
3623         an object is empty except for section names and the undefined symbol.
3624         (Target_arm::do_finalize_sections): Move check for ELF format to
3625         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3626         attributes from a regular object only when we have determined that
3627         it is aapropriate.  Do not create an .ARM.attributes section in
3628         output if there is no regular input object.
3629         (Target_arm::merge_processor_specific_flags): Check
3630         --warn-mismatch before printing any error.
3631         (Target_arm::merge_object_attributes): Ditto.
3632         * gold.cc (queue_middle_tasks): Handle the case in which there is
3633         no regular object in input.
3634         * options.cc (General_options::parse_EB): New method.
3635         (General_options::parse_EL): Same.
3636         (General_options::General_options): Initialize endianness_.
3637         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3638         New options.
3639         (General_options::Endianness): New enum.
3640         (General_options::endianness): New method.
3641         (General_options::endianness_): New data member.
3642         * parameters.cc (Parameters::set_options): Check target endianness.
3643         (Parameters::set_target_once): Ditto.
3644         (Parameters::check_target_endianness): New method.
3645         (parameters_force_valid_target): If either -EL or -EB is specified,
3646         use it to define endianness of default target.
3647         * parameters.h (Parameters::check_target_endianness): New method
3648         declaration.
3649         * target.h (class Target): Change "endianity" to "endianness"
3650         in comments.
3651
3652 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3653
3654         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3655         * configure: Regenerate.
3656         * Makefile.in: Regenerate.
3657         * testsuite/Makefile.in: Regenerate.
3658
3659 2010-04-06  Cary Coutant  <ccoutant@google.com>
3660
3661         gcc PR lto/42757
3662         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3663         prevailing definitions of common symbols.
3664         * testsuite/plugin_test_6.sh: New test case.
3665         * testsuite/plugin_common_test_1.c: New test case.
3666         * testsuite/plugin_common_test_2.c: New test case.
3667         * testsuite/Makefile.am (plugin_test_6): New test case.
3668         * testsuite/Makefile.in: Regenerate.
3669
3670 2010-04-06  Nick Clifton  <nickc@redhat.com>
3671
3672         * po/vi.po: New Vietnamese translation.
3673
3674 2010-03-30  Doug Kwan  <dougkwan@google.com>
3675
3676         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3677
3678 2010-03-25  Doug Kwan  <dougkwan@google.com>
3679
3680         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3681         to avoid a conversion warning on a 32-bit host.
3682
3683 2010-03-24  Ian Lance Taylor  <iant@google.com>
3684
3685         * testsuite/script_test_3.t: Add a TLS segment.
3686         * testsuite/Makefile.am (check_PROGRAMS): Add
3687         tls_phdrs_script_test.
3688         (tls_phdrs_script_test_SOURCES): Define.
3689         (tls_phdrs_script_test_DEPENDENCIES): Define.
3690         (tls_phdrs_script_test_LDFLAGS): Define.
3691         (tls_phdrs_script_test_LDADD): Define.
3692         * testsuite/Makefile.in: Rebuild.
3693
3694 2010-03-23  Cary Coutant  <ccoutant@google.com>
3695
3696         * fileread.cc (find_or_make_view): Fix comment.
3697
3698 2010-03-23  Ian Lance Taylor  <iant@google.com>
3699
3700         * script-sections.cc (class Orphan_section_placement): Define
3701         PLACE_TLS and PLACE_TLS_BSS.
3702         (Orphan_section_placement::Orphan_section_placement): Initialize
3703         new places.
3704         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3705         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3706         (tls_script_test_SOURCES): Define.
3707         (tls_script_test_DEPENDENCIES): Define.
3708         (tls_script_test_LDFLAGS): Define.
3709         (tls_script_test_LDADD): Define.
3710         * testsuite/Makefile.in: Rebuild.
3711
3712 2010-03-22  Doug Kwan  <dougkwan@google.com>
3713
3714         * arm.cc (Arm_relocate_functions::abs8,
3715         Arm_relocate_functions::abs16): Use correct check for overflow
3716         specified in the ARM ELF specs.
3717         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3718         target of a BLX instruction specially.
3719         (Reloc_stub::stub_type_for_reloc): Ditto.
3720         (Relocate::relocate): Use symbolic names instead of numeric relocation
3721         codes to report error.
3722         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3723         workaround.
3724         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3725         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3726         thumb2_blx_out_of_range.stdout
3727         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3728         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3729         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3730         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3731         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3732         thumb2_blx_in_range, thumb2_blx_in_range.o,
3733         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3734         thumb2_blx_out_of_range.o): New rules.
3735         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3736         thumb2_blx_in_range and thumb2_blx_out_of_range.
3737         * testsuite/Makefile.in: Regenerate.
3738         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3739         * testsuite/thumb_blx_in_range.s: New file.
3740         * testsuite/thumb_blx_out_of_range.s: New file.
3741
3742 2010-03-22  Rafael Espindola  <espindola@google.com>
3743
3744         * archive.cc (Should_include): Move to archive.h.
3745         (should_include_member): Make it a member of Archive.
3746         (Lib_group): New.
3747         (Add_lib_group_symbols): New.
3748         * archive.h: Include options.h.
3749         (Archive_member): Moved from Archive.
3750         (Should_include): Moved from archive.cc.
3751         (Lib_group): New.
3752         (Add_lib_group_symbols): New.
3753         * dynobj.cc (do_should_include_member): New.
3754         * dynobj.h (do_should_include_member): New.
3755         * gold.cc (queue_initial_tasks): Update call to queue.
3756         * main.cc (main): Print lib group stats.
3757         * object.cc (do_should_include_member): New.
3758         * object.h: Include archive.h.
3759         (Object::should_include_member): New.
3760         (Object::do_should_include_member): New.
3761         (Sized_relobj::do_should_include_member): New.
3762         * options.cc (General_options::parse_start_lib): New.
3763         (General_options::parse_end_lib): New.
3764         (Input_arguments::add_file): Handle lib groups.
3765         (Input_arguments::start_group): Check we are not in a lib.
3766         (Input_arguments::start_lib): New.
3767         (Input_arguments::end_lib): New.
3768         * options.h (General_options): Add start_lib and end_lib.
3769         (Input_argument::lib_): New.
3770         (Input_argument::lib): New.
3771         (Input_argument::is_lib): New.
3772         (Input_file_lib): New.
3773         (Input_arguments::in_lib_): New.
3774         (Input_arguments::in_lib): New.
3775         (Input_arguments::start_lib): New.
3776         (Input_arguments::end_lib_): New.
3777         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3778         in unused members as preempted.
3779         (Sized_pluginobj::do_should_include_member): New.
3780         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3781         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3782         return the blocker.
3783         (Read_symbols::do_whole_lib_group): New.
3784         (Read_symbols::do_lib_group): New.
3785         (Read_symbols::do_read_symbols): Handle lib groups.
3786         (Read_symbols::get_name): Handle lib groups.
3787         * readsyms.h (Read_symbols): Add an archive member pointer.
3788         (Read_symbols::do_whole_lib_group): New.
3789         (Read_symbols::do_lib_group): New.
3790         (Read_symbols::member_): New.
3791         * script.cc (read_input_script): Update call to queue_soon.
3792
3793 2010-03-19  Doug Kwan  <dougkwan@google.com>
3794
3795         * arm.cc (Stub_table::Stub_table): Initialize new data members
3796         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3797         (Stub_table::add_reloc_stub): Assign stub offset and update
3798         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3799         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3800         New data members.
3801         (Stub_table::update_data_size_and_addralign): Use
3802         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3803         instead of going over all reloc stubs.
3804         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3805         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3806         Stringpool_template::offset_ to size of Stringpool_char.
3807         (Stringpool_template::new_key_offset): Remove code to initialize
3808         Stringpool_template::offset_.
3809         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3810         Stringpool_template::offset_ to zero.
3811
3812 2010-03-15  Doug Kwan  <dougkwan@google.com>
3813
3814         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3815         offset_.
3816         (Stringpool_template::new_key_offset): New method.
3817         (Stringpool_template::add_string): Assign offsets when adding new
3818         strings.
3819         (Stringpool_template::set_string_offsets): Do not set string offsets
3820         when not optimizing.
3821         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3822         member size_.
3823         (Chunked_vector::clear): Clear size_.
3824         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3825         (Chunked_vector::size): Return size_.
3826         (Chunked_vector::push_back): Use size_ to find insert position.
3827         (Chunked_vector::size_): New data member.
3828         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3829         (Stringpool_template::new_key_offset): New method declaration.
3830         (Stringpool_template::offset_): New data member.
3831
3832 2010-03-15   Rafael Espindola  <espindola@google.com>
3833
3834         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3835         Add_symbols' constructor.
3836         * readsyms.h (Add_symbols): Remove the input_group member.
3837
3838 2010-03-10  Ian Lance Taylor  <iant@google.com>
3839
3840         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3841         target to ask whether a reference to a symbol requires a stack
3842         split.
3843         * target.h (Target::is_call_to_non_split): New function.
3844         (Target::do_is_call_to_non_split): Declare virtual function.
3845         * target.cc: Include "symtab.h".
3846         (Target::do_is_call_to_non_split): New function.
3847         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3848
3849 2010-03-10  Cary Coutant  <ccoutant@google.com>
3850
3851         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3852         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3853         (File_read::open[2]): Add whole_file_view_ to list of views.
3854         (File_read::make_view): Remove test of whole_file_view_.
3855         (File_read::find_or_make_view): Create whole_file_view_ if
3856         necessary.
3857         (File_read::clear_views): Replace bool parameter with enum;
3858         adjust all callers.  Don't delete views with permanent data;
3859         do delete cached views and views from archives if
3860         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3861         if clearing the corresponding view.
3862         * fileread.h (File_read::Clear_views_mode): New enum.
3863         (File_read::View::is_permanent_view): New method.
3864         (File_read::clear_views): Replace bool parameter
3865         with enum; adjust all callers.
3866         * options.h (General_options): Change keep_files_mapped option;
3867         add map_whole_files.
3868         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3869         releasing the file.
3870         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3871         the file.
3872
3873 2010-03-10  David S. Miller  <davem@davemloft.net>
3874
3875         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3876
3877 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3878
3879         * icf.cc (get_section_contents): Add '@' marker after processing the
3880         merge reloc.
3881
3882 2010-03-08  Doug Kwan  <dougkwan@google.com>
3883
3884         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3885         due to a conversion warning.
3886         (Arm_relobj::update_output_local_symbol_count): Check for local
3887         symbol with unset output index.
3888
3889 2010-03-05  Ian Lance Taylor  <iant@google.com>
3890
3891         * options.h (class General_options): Add --spare-dynamic-tags.
3892         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3893         --spare-dynamic-tags.
3894
3895 2010-03-05  Ian Lance Taylor  <iant@google.com>
3896
3897         * incremental.cc: Include "libiberty.h".
3898
3899 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3900
3901         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3902         function, is_info_ member.
3903         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3904         (Versions::Versions): Update caller.
3905         (Versions::define_base_version): Likewise.
3906         (Versions::add_def): Likewise.
3907
3908 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3909
3910         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3911         (Scan::possible_function_pointer_reloc): New function.
3912         (Scan::local_reloc_may_be_function_pointer): Change to call
3913         possible_function_pointer_reloc.
3914         (Scan::global_reloc_may_be_function_pointer): Ditto.
3915         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3916         relocations in ".data.rel.ro._ZTV" section.
3917         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3918         * testsuite/icf_safe_so_test.cc: Ditto.
3919         * testsuite/icf_safe_test.cc: Ditto.
3920         * testsuite/icf_safe_test.sh: Ditto.
3921
3922 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3923             Ian Lance Taylor  <iant@google.com>
3924
3925         * target-reloc.h (relocate_section): Check the symbol table index
3926         for -1U before setting the local symbol index.
3927         (scan_relocatable_relocs): If copying the relocation, record that
3928         the local symbol is required.
3929         * object.h (Symbol_value::is_output_symtab_index_set): New
3930         function.
3931         (Symbol_value::may_be_discarded_from_output_symtab): New
3932         function.
3933         (Symbol_value::has_output_symtab_entry): New function.
3934         (Symbol_value::needs_output_symtab_entry): Remove.
3935         (Symbol_value::output_symtab_index): Make sure the symbol index is
3936         set.
3937         (Symbol_value::set_output_symtab_index): Make sure the symbol
3938         index is not set.  Make sure the new index is valid.
3939         (Symbol_value::set_must_have_output_symtab_entry): New function.
3940         (Symbol_value::has_output_dynsym_entry): New function.
3941         (Symbol_value::set_output_dynsym_index): Make sure the new index
3942         is valid.
3943         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3944         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3945         local symbol if permitted.
3946         (Sized_relobj::do_finalize_local_symbols): Call
3947         is_output_symtab_index_set rather than needs_output_symtab_entry.
3948         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3949         rather than needs_output_symtab_entry.  Call
3950         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3951         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3952         is_output_symtab_index_set rather than needs_output_symtab_entry.
3953         * testsuite/discard_locals_relocatable_test.c: New file.
3954         * testsuite/discard_locals_test.sh: Test -r.
3955         * testsuite/Makefile.am (check_DATA): Add
3956         discard_locals_relocatable_test1.syms,
3957         discard_local_relocatable_test2.syms.
3958         (MOSTLYCLEANFILES): Likewise.  Also add
3959         discard_locals_relocatable_test1.lout and
3960         discard_locals_relocatable_test2.out.
3961         (discard_locals_relocatable_test1.syms): New target.
3962         (discard_locals_relocatable_test.o): New target.
3963         (discard_locals_relocatable_test1.out): New target.
3964         (discard_locals_relocatable_test2.syms): New target.
3965         (discard_locals_relocatable_test2.out): New target.
3966         (various): Add missing ../ld-new dependencies.
3967         * testsuite/Makefile.in: Rebuild.
3968
3969 2010-03-03  Nick Clifton  <nickc@redhat.com>
3970
3971         * po/fi.po: New Finnish translation.
3972
3973 2010-03-01  Doug Kwan  <dougkwan@google.com>
3974
3975         * layout.cc (Layout::Layout): Force section types of .init_array*,
3976         .preinit_array* and .fini_array* sections.
3977         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3978         Fix check of return value of std::string::find.().
3979         (Output_section::Input_section_sort_compare::operator()): Remove
3980         comment about .init_array.
3981         (Output_section::Input_section_sort_init_fini_compare::operator()):
3982         New method.
3983         (Output_section::sort_attached_input_sections): Handle .init_array
3984         and .fini_array specially.
3985         * output.h (Output_section::Inut_section_sort_compare): Update
3986         comment.
3987         (Output_section::Input_section_sort_init_fini_compare): New struct.
3988
3989 2010-02-26  Doug Kwan  <dougkwan@google.com>
3990
3991         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3992         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3993         * testsuite/debug_msg.sh: Avoid matching source line number for
3994         use of global variable undef_int.
3995
3996 2010-02-26  Doug Kwan  <dougkwan@google.com>
3997
3998         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3999         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4000         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4001         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4002         * options.cc (General_options::General_options): Initialize member
4003         fix_v4bx_.
4004         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4005         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4006         and rm_no_fix_v4bx.stdout
4007         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4008         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4009         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4010         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4011         and arm_no_fix_v4bx.
4012         * Makefile.in: Regenerate.
4013         * testsuite/arm_fix_v4bx.s: New file.
4014         * testsuite/arm_fix_v4bx.sh: Ditto.
4015
4016 2010-02-24  Doug Kwan  <dougkwan@google.com>
4017
4018         * arm.cc (Target_arm::got_section): Make the .got section the first
4019         non RELRO section in the data segment.
4020         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4021         suffixes of section names.
4022
4023 2010-02-24  Doug Kwan  <dougkwan@google.com>
4024
4025         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4026         flags and attributes merging if an input file is a binary file.
4027         * fileread.cc (Input_file::open): Record format of original file.
4028         * fileread.h (Input_file::Format): New enum type.
4029         (Input_file::Input_file): Initialize data member format_.
4030         (Input_file::format): New method definition.
4031         (Input_file::format_):: New data member.
4032
4033 2010-02-24  Doug Kwan  <dougkwan@google.com>
4034
4035         * arm.cc (Arm_output_data_got): New class.
4036         (ARM_TCB_SIZE): New constant
4037         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4038         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4039         If user uses a script with a SECTIONS clause, issue only a warning
4040         for a misplaced EXIDX input section.  Otherwise, issue an error.
4041         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4042         garbage collection.
4043         (Target_arm::got_mode_index_entry): Handle static linking.
4044         (Target_arm::Scan::local): Ditto.
4045         (Target_arm::Scan::global): Ditto.
4046         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4047         all incorrectly implemented relocations.
4048         (Target_arm::fix_exidx_coverage): Pass layout to
4049         Arm_output_section::fix_exidx_coverage.
4050         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4051         from ".ARM.exidx." and ".ARM.extab.".
4052
4053 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4054
4055         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4056         section if it does not already exist.
4057         * attributes.cc (Attributes_section_data::Attributes_section_data):
4058         Don't crash if size is zero.
4059
4060 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4061             Ian Lance Taylor  <iant@google.com>
4062
4063         * gold.cc (queue_middle_tasks): If no input files were opened,
4064         exit.
4065         * workqueue.h (Task_function::Task_function): Assert that there is
4066         a blocker.
4067
4068 2010-02-22  Doug Kwan  <dougkwan@google.com>
4069
4070         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4071         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4072         types to avoid warnings due to different uint64_t implementations
4073         on different hosts.
4074
4075 2010-02-21  Doug Kwan  <dougkwan@google.com>
4076
4077         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4078         handling of the maximum backward branch offset.
4079         (Arm_relocate_functions::thumb_branch_common): Ditto.
4080         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4081         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4082         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4083         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4084         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4085         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4086         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4087         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4088         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4089         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4090         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4091         thumb2_bl_out_of_range.o): New rules.
4092         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4093         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4094         thumb2_bl_out_of_range
4095         * testsuite/Makefile.in: Regenerate.
4096         * testsuite/arm_bl_in_range.s: New file.
4097         * testsuite/arm_bl_out_of_range.s: Ditto.
4098         * testsuite/arm_branch_in_range.sh: Ditto.
4099         * testsuite/arm_branch_range.t: Ditto.
4100         * testsuite/thumb2_branch_range.t: Ditto.
4101         * testsuite/thumb_bl_in_range.s: Ditto.
4102         * testsuite/thumb_bl_out_of_range.s: Ditto.
4103         * testsuite/thumb_branch_range.t: Ditto.
4104
4105 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4106
4107         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4108         Add reloc offset information.
4109         * icf.cc (get_section_contents): Change iterators to point to the new
4110         vectors. Add reloc offset information to the contents.
4111         * icf.h (Icf::Sections_reachable_info): New typedef.
4112         (Icf::Sections_reachable_list): New typedef.
4113         (Icf::Offset_info): New typedef.
4114         (Icf::Reloc_info): New struct typedef.
4115         (Icf::Reloc_info_list): New typedef.
4116         (Icf::symbol_reloc_list): Delete method.
4117         (Icf::addend_reloc_list): Delete method.
4118         (Icf::section_reloc_list): Delete method.
4119         (Icf::reloc_info_list): New method.
4120         (Icf::reloc_info_list_): New member.
4121
4122 2010-02-19  Doug Kwan  <dougkwan@google.com>
4123
4124         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4125         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4126         * arm.cc (Arm_relocation_functions): New forward declaration.
4127         (Target_arm::Target_arm): Initialize new data members
4128         got_mod_index_offset_ and tls_base_symbol_defined_.
4129         (Target_arm::Relocate::relocate_tls): New method.
4130         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4131          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4132         New methods.
4133         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4134         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4135         (Target_arm::got_mod_index_offset_,
4136         Target_arm::tls_base_symbol_defined_): New data members.
4137         (Target_arm::Scan::local, Target::Scan::global,
4138         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4139         relocations.
4140
4141 2010-02-18  Doug Kwan  <dougkwan@google.com>
4142
4143         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4144         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4145         text section as a parameter becuase some broken tools may not set
4146         the link in section header.
4147         (Target_arm::has_got_section): New method.
4148         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4149         without any mapping symbol as data only.  Remove warning.
4150         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4151         link in its section header, try to discover the link by inspecting the
4152         REL31 relocation at the beginning of the section.
4153         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4154         in error message.
4155         (Target_arm::Scan::global): Treat any reference to the symbol
4156         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4157
4158 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4159
4160         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4161         (Scan::global_reloc_may_be_function_pointer): New function.
4162         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4163         (Scan::global_reloc_may_be_function_pointer): New function.
4164         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4165         (Scan::global_reloc_may_be_function_pointer): New function.
4166         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4167         (Scan::global_reloc_may_be_function_pointer): New function.
4168         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4169         (Scan::global_reloc_may_be_function_pointer): New function.
4170         (Scan::possible_function_pointer_reloc): New function.
4171         (Target_x86_64::can_check_for_function_pointers): New function.
4172         * gc.h (gc_process_relocs): Scan relocation types to determine if
4173         function pointers were taken for targets that support it.
4174         * icf.cc (Icf::find_identical_sections): Include functions for
4175         folding in safe ICF whose pointer is not taken.
4176         * icf.h (Secn_fptr_taken_set): New typedef.
4177         (fptr_section_id_): New member.
4178         (section_has_function_pointers): New function.
4179         (set_section_has_function_pointers): New function.
4180         (check_section_for_function_pointers): New function.
4181         * options.h: Fix comment for safe ICF option.
4182         * target.h (can_check_for_function_pointers): New function.
4183         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4184         Modify icf_safe_test for X86-64.
4185         * testsuite/Makefile.in: Regenerate.
4186         * testsuite/icf_safe_so_test.cc: New file.
4187         * testsuite/icf_safe_so_test.sh: New file.
4188         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4189         (main): Change to take pointer to function kept_func_3.
4190         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4191         folding is done correctly for X86-64.
4192
4193 2010-02-12  David S. Miller  <davem@davemloft.net>
4194
4195         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4196         is_symbolless parameter.
4197         (Output_reloc<SHT_REL>::is_symbolless): New.
4198         (Output_reloc<SHT_REL>::is_symbolless_): New.
4199         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4200         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4201         (Output_reloc<SHT_RELA>::is_symbolless): New.
4202         (Output_data_reloc::add_global): Handle is_symbolless.
4203         (Output_data_reloc::add_global_relative): Likewise.
4204         (Output_data_reloc::add_local): Likewise.
4205         (Output_data_reloc::add_local_relative): Likewise.
4206         (Output_data_reloc::add_symbolless_global_addend): New.
4207         (Output_data_reloc::add_symbolless_local_addend): New.
4208         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4209         is_symbolless.
4210         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4211         instead of ->is_relative_
4212         (Output_reloc::write): Likewise.
4213         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4214         (Output_reloc::write_rel): Simplify.
4215
4216         * sparc.cc (Target_sparc::Scan::local): Use
4217         ->add_symbolless_local_addend as needed.
4218         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4219         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4220         based upon relocation offset.
4221
4222 2010-02-11  Doug Kwan  <dougkwan@google.com>
4223
4224         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4225         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4226         beginning of function.
4227         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4228         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4229         parameter is_32bit in calls to should_apply_static_reloc.
4230         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4231         (check_DATA): Add arm_abs_global.stdout.
4232         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4233         arm_abs_global.stdout): New rules.
4234         (MOSTLLYCLEANFILES): Add arm_abs_global
4235         * Makefile.in: Regenerate.
4236         * testsuite/arm_abs_global.s: New file.
4237         * testsuite/arm_abs_global.sh: Ditto.
4238         * testsuite/arm_abs_lib.s: Ditto.
4239
4240 2010-02-11  Ian Lance Taylor  <iant@google.com>
4241
4242         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4243         Read_relocs task.
4244         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4245         Allocate_commons_task first.
4246         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4247         task, rather than symtab_lock_.
4248         (Gc_process_relocs::~Gc_process_relocs): New function.
4249         (Gc_process_relocs::is_runnable): Check this_blocker_.
4250         (Gc_process_relocs::locks): Use next_blocker_ rather than
4251         blocker_.
4252         (Scan_relocs::~Scan_relocs): New function.
4253         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4254         symtab_lock_.
4255         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4256         next_blocker_.
4257         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4258         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4259         constructor accordingly.
4260         (class Gc_process_relocs): Likewise.
4261         (class Scan_relocs): Likewise.
4262         * common.h (class Allocate_commons_task): Remove symtab_lock_
4263         field, and corresponding constructor parameter.
4264         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4265         symtab_lock_.
4266         (Allocate_commons_task::locks): Likewise.
4267
4268 2010-02-11  Ian Lance Taylor  <iant@google.com>
4269
4270         * gold-threads.h (class Once): Define.
4271         (class Initialize_lock): Rewrite as child of Once.
4272         * gold-threads.cc (class Once_initialize): Define.
4273         (once_pointer_control): New static variable.
4274         (once_pointer, once_arg): New static variables.
4275         (c_run_once): New static function.
4276         (Once::Once, Once::run_once, Once::internal_run): New functions.
4277         (class Initialize_lock_once): Remove.
4278         (initialize_lock_control): Remove.
4279         (initialize_lock_pointer): Remove.
4280         (initialize_lock_once): Remove.
4281         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4282         (Initialize_lock::initialize): Rewrite.
4283         (Initialize_lock::do_run_once): New function.
4284         * archive.cc (Archive::interpret_header): Only clear name if it is
4285         not already empty.
4286         * fileread.cc: Include "gold-threads.h"
4287         (file_counts_lock): New static variable.
4288         (file_counts_initialize_lock): Likewise.
4289         (File_read::release): Only increment counts when using --stats.
4290         Use a lock around the increment.
4291         * parameters.cc (class Set_parameters_target_once): Define.
4292         (set_parameters_target_once): New static variable.
4293         (Parameters::Parameters): Move here from parameters.h.
4294         (Parameters::set_target): Rewrite.
4295         (Parameters::set_target_once): New function.
4296         (Parameters::clear_target): Move here and rewrite.
4297         * parameters.h (class Parameters): Update declarations.  Add
4298         set_parameters_target_once_ field.
4299         (Parameters::Parameters): Move to parameters.cc.
4300         (Parameters::clear_target): Likewise.
4301         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4302         task.
4303         (Start_group::~Start_group): New function.
4304         (Start_group::is_runnable): New function.
4305         (Start_group::locks, Start_group::run): New functions.
4306         (Finish_group::run): Change saw_undefined to size_t.
4307         * readsyms.h (class Start_group): Define.
4308         (class Finish_group): Change saw_undefined_ field to size_t.
4309         (Finish_group::Finish_group): Remove saw_undefined and
4310         this_blocker parameters.  Change all callers.
4311         (Finish_group::set_saw_undefined): New function.
4312         (Finish_group::set_blocker): New function.
4313         * symtab.h (class Symbol_table): Change saw_undefined to return
4314         size_t.  Change saw_undefined_ field to size_t.
4315         * target-select.cc (Set_target_once::do_run_once): New function.
4316         (Target_selector::Target_selector): Initialize set_target_once_
4317         field.  Don't initialize lock_ and initialize_lock_ fields.
4318         (Target_selector::instantiate_target): Rewrite.
4319         (Target_selector::set_target): New function.
4320         * target-select.h (class Set_target_once): Define.
4321         (class Target_selector): Update declarations.  Make
4322         Set_target_once a friend.  Remove lock_ and initialize_lock_
4323         fields.  Add set_target_once_ field.
4324
4325 2010-02-10  Ian Lance Taylor  <iant@google.com>
4326
4327         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4328         queueing any tasks.
4329         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4330         (queue_middle_tasks): Add all blockers before queueing any tasks.
4331         (queue_final_tasks): Likewise.
4332         * token.h (Task_token::add_blockers): New function.
4333         * object.h (Input_objects::number_of_relobjs): New function.
4334
4335 2010-02-10  Ian Lance Taylor  <iant@google.com>
4336
4337         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4338         shared, not if not position independent.
4339         * x86_64.cc (Relocate::relocate_tls): Likewise.
4340         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4341         (tls_pie_pic_test): New target.
4342         * testsuite/Makefile.in: Rebuild.
4343
4344         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4345         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4346         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4347         * testsuite/Makefile.in: Rebuild.
4348
4349 2010-02-09  David S. Miller  <davem@davemloft.net>
4350
4351         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4352         R_SPARC_RELATIVE using ->add_local_relative().
4353         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4354
4355         * output.h (Output_data_dynamic::add_section_size): New method
4356         that takes two Output_data objects.
4357         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4358         entry param.  Handle it in initializers.
4359         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4360         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4361         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4362         arg.
4363         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4364         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4365         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4366         for dynrel_includes_plt.
4367         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4368         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4369         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4370         before .rela.plt
4371         (Target_sparc::do_finalize_sections): Update to pass true for
4372         dynrel_includes_plt.
4373         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4374         output before .rela.plt
4375         (Target_powerpc::do_finalize_sections): Update to pass true for
4376         dynrel_includes_plt when 32-bit.
4377
4378 2010-02-08  Doug Kwan  <dougkwan@google.com>
4379
4380         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4381         method.
4382         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4383         Arm_relobj::scan_section_for_cortex_a8_stubs,
4384         Arm_relobj::do_relocation_section): Instead of calling
4385         Output_section::output_address, use faster
4386         Arm_relobj::simple_input_section_output_address.
4387
4388 2010-02-08  David S. Miller  <davem@davemloft.net>
4389
4390         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4391         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4392         relocation helper function.
4393
4394         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4395         just like R_SPARC_GOT{10,13,22}.
4396         (Target_sparc::Scan::local): Likewise.
4397         (Target_sparc::Relocate:relocate): Likewise.
4398
4399 2010-02-06  Ian Lance Taylor  <iant@google.com>
4400
4401         * configure.ac: Rewrite targetobjs duplicate removal code to use
4402         only shell constructs.
4403         * configure: Rebuild.
4404
4405 2010-02-05  Doug Kwan  <dougkwan@google.com>
4406
4407         PR 11247
4408         * arm.cc (Arm_relobj::section_is_scannable): New method.
4409         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4410         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4411
4412 2010-02-04  Doug Kwan  <dougkwan@google.com>
4413
4414         PR 11247
4415         * arm-reloc-property.cc (cstdio): Include.
4416         * configure.ac (targetobjs): Remove duplicates.
4417         * configure: Regenerate.
4418         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4419         big and little endian version for a given address size.
4420
4421 2010-02-03  Doug Kwan  <dougkwan@google.com>
4422
4423         * arm-reloc-property.cc
4424         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4425         definition.
4426         * arm-reloc-property.h
4427         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4428         New method definition.
4429         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4430         declaration.
4431         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4432         overflow to N.
4433         (GOT_PREL): Change implemented to Y.
4434         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4435         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4436         (Arm_relocate_functions::movw_abs_nc): Remove method.
4437         (Arm_relocate_functions::movt_abs): Ditto.
4438         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4439         (Arm_relocate_functions::thm_movt_abs): Ditto.
4440         (Arm_relocate_functions::movw_rel_nc): Ditto.
4441         (Arm_relocate_functions::movw_rel): Ditto.
4442         (Arm_relocate_functions::movt_rel): Ditto.
4443         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4444         (Arm_relocate_functions:thm_movw_rel): Ditto.
4445         (Arm_relocate_functions:thm_movt_rel): Ditto.
4446         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4447         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4448         New method definitions.
4449         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4450         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4451         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4452         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4453         (Target_arm::Relocate::relocate): Check for non-static or
4454         unimplemented relocation code and exit early.  Change calls to
4455         Target_arm::reloc_uses_thumb_bit and
4456         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4457         instead.  Refactor code to handle similar relocations to increase
4458         code sharing.  Remove check for unsupported relocation code in switch
4459         statement.
4460         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4461         relocation property table to find out size.  Change error message to
4462         print out the name of a relocation code instead of the numeric value.
4463         (Target_arm::scan_reloc_for_stub): Use relocation property table
4464         instead of calling Target_arm::reloc_uses_thumb_bit().
4465
4466 2010-02-02  Doug Kwan  <dougkwan@google.com>
4467
4468         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4469         types of relaxed input section.
4470
4471 2010-02-02  Doug Kwan  <dougkwan@google.com>
4472
4473         * Makefile.am (HFILES): Add arm-reloc-property.h.
4474         (DEFFILES): New.
4475         (TARGETSOURCES): Add arm-reloc-property.cc
4476         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4477         (libgold_a_SOURCES): $(DEFFILES)
4478         * Makefile.in: Regenerate.
4479         * arm-reloc-property.cc: New file.
4480         * arm-reloc-property.h: New file.
4481         * arm-reloc.def: New file.
4482         * arm.cc: Update comments.
4483         (arm-reloc-property.h): New included header.
4484         (arm_reloc_property_table): New global variable.
4485         (Target_arm::do_select_as_default_target): New method definition.
4486         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4487         arm-reloc-property to targ_extra_obj.
4488         * parameters.cc (set_parameters_target): Call
4489         Target::select_as_default_target().
4490         * target.h (Target::select_as_default_target): New method definition.
4491         (Target::do_select_as_default_target): Same.
4492
4493 2010-02-01  Doug Kwan  <dougkwan@google.com>
4494
4495         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4496         first_output_text_section_.
4497         (Arm_exidx_fixup::first_output_text_section): New method definition.
4498         (Arm_exidx_fixup::first_output_text_section_): New data member.
4499         (Arm_exidx_fixup::process_exidx_section): Record the first text
4500         output section seen.
4501         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4502         and entsize in output section header.
4503
4504 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4505
4506         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4507         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4508         (Arm_relocate_functions::thm_alu11): New Method.
4509         (Arm_relocate_functions::thm_pc8): New Method.
4510         (Arm_relocate_functions::thm_pc12): New Method.
4511         (Target_arm::Scan::local): Handle the relocations.
4512         (Target_arm::Scan::global): Likewise.
4513         (Target_arm::Relocate::relocate): Likewise.
4514         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4515
4516 2010-01-29  Doug Kwan  <dougkwan@google.com>
4517
4518         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4519         of relocation types as ld.
4520
4521 2010-01-29  Doug Kwan  <dougkwan@google.com>
4522
4523         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4524         to public.
4525         (Arm_relocate_functions::thumb_branch_common): Ditto.
4526         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4527         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4528         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4529         Arm_relocate_functions::jump24): Remove.
4530         (Target_arm::Relocate::relocate): Adjust code to call
4531         Arm_relocation_functions::arm_branch_common and
4532         Arm_relocation_functions::thumb_branch_common instead of their removed
4533         wrappers.  Merge switch-cases together to reduce source code size.
4534
4535 2010-01-29  Doug Kwan  <dougkwan@google.com>
4536
4537         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4538         output_local_symbol_count_needs_update_.
4539         (Arm_relobj::output_local_symbol_count_needs_update,
4540          Arm_relobj::set_output_local_symbol_count_needs_update,
4541          Arm_relobj::update_output_local_symbol_count): New methods.
4542         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4543         member.
4544         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4545         of pointed function as in a R_ARM_PREL31 relocation.
4546         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4547         for output local symbol count updating.
4548         (Target_arm::do_relax): Update output local symbol counts in objects
4549         if necessary.
4550         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4551
4552 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4553
4554         * arm.cc: Added support for the ARM relocations:
4555         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4556         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4557         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4558         movw_prel_nc).
4559         (Arm_relocate_functions::movw_rel): New method.
4560         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4561         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4562         thm_movw_prel_nc).
4563         (Arm_relocate_functions::thm_movw_rel): New method.
4564         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4565         thm_movt_prel).
4566         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4567         relocations.
4568         (Target_arm::Scan::global): Likewise.
4569         (Target_arm::Relocate::relocate): Likewise.
4570         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4571         Likewise.
4572
4573 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4574
4575         * arm.cc: Added support for ARM group relocations.
4576         (Target_arm::reloc_needs_sym_origin): New method.
4577         (Arm_relocate_functions::calc_grp_kn): New method.
4578         (Arm_relocate_functions::calc_grp_residual): New method.
4579         (Arm_relocate_functions::calc_grp_gn): New method.
4580         (Arm_relocate_functions::arm_grp_alu): New Method.
4581         (Arm_relocate_functions::arm_grp_ldr): New Method.
4582         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4583         (Arm_relocate_functions::arm_grp_ldc): New Method.
4584         (Target_arm::Scan::local): Handle the ARM group 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-26  Doug Kwan  <dougkwan@google.com>
4591
4592         * arm.cc (set): Include.
4593         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4594         pointer type.
4595         (Arm_output_section::Text_section_list): New type.
4596         (Arm_output_section::append_text_sections_to_list): New method.
4597         (Arm_output_section::fix_exidx_coverage): Ditto.
4598         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4599         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4600         Relobj::set_section_offset() instead of
4601         Sized_relobj::invalidate_section_offset().
4602         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4603         parameter for section headers. Ignore relocation sections for
4604         unallocated sections and EXIDX sections.
4605         (Target_arm::fix_exidx_coverage): New method.
4606         (Target_arm::output_section_address_less_than): New type.
4607         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4608         linked text section instead of the EXIDX section.
4609         (Arm_output_section::create_stub_group): Add an assertion to check
4610         that this is not an EXIDX output section.
4611         (Arm_output_section::append_text_sections_to_list): New method.
4612         (Arm_output_section::fix_exidx_coverage): Ditto.
4613         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4614         Arm_relobj::section_needs_reloc_stub_scanning.
4615         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4616         first pass.
4617         (Target_arm::fix_exidx_coverage): New method.
4618         * object.h (Relobj::set_output_section): New method.
4619         (Sized_relobj::invalidate_section_offset): Remove method.
4620         (Sized_relobj::do_invalidate_section_offset): Remove method.
4621         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4622
4623 2010-01-25  Doug Kwan  <dougkwan@google.com>
4624
4625         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4626         Fix warning due to signed and unsigned comparison on a 32-bit host.
4627
4628 2010-01-22  Doug Kwan  <dougkwan@google.com>
4629
4630         * arm.cc (Target_arm::do_relax): Record an output section for section
4631         offset adjustment it contains any stub table that has changed.
4632         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4633         offsets in an output section if necessary.
4634         * output.cc (Output_section::Output_section): Initialize
4635         section_offsets_need_adjustments_.
4636         (Output_section::add_input_section_for_script): Renamed to
4637         Output_section::add_simple_input_section.
4638         (Output_section::save_states): Add a comment.
4639         (Output_section::discard_states): New method defintion.
4640         (Output_section::adjust_section_offsets): Same.
4641         * output.h (Output_section::add_input_section_for_script): Renamed to
4642         Output_section::add_simple_input_section.
4643         (Output_section::discard_states): New method declaration.
4644         (Output_section::adjust_section_offsets): Same.
4645         (Output_section::section_offsets_need_adjustment,
4646         Output_section::set_section_offsets_need_adjustment): New method
4647         definitions.
4648         (Output_section::section_offsets_need_adjustment_): New data member.
4649         * script-sections.cc
4650         (Output_section_element_input::set_section_address): Adjust code for
4651         renaming of Output_section::add_input_section_for_script.
4652         (Orphan_output_section::set_section_address): Same.
4653
4654 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4655
4656         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4657         Fix_v4bx enum values .
4658         * gold/options.h (General_options): New option definitions.
4659         (General_options::fix_v4bx): New method.
4660         (General_options::Fix_v4bx): New enum.
4661         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4662         (General_options::parse_fix_v4bx_interworking): New method.
4663
4664 2010-01-22  Doug Kwan  <dougkwan@google.com>
4665
4666         * arm.cc (Arm_exidx_fixup): New class.
4667
4668 2010-01-21  Doug Kwan  <dougkwan@google.com>
4669
4670         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4671         classes.
4672         (Arm_exidx_section_offset_map): New type.
4673
4674 2010-01-21  Doug Kwan  <dougkwan@google.com>
4675
4676         * arm.cc (Arm_exidx_input_section): New class.
4677         (Arm_relobj::exidx_input_section_by_link,
4678         Arm_relobj::exidx_input_section_by_shndx,
4679         Arm_relobj::make_exidx_input_section): New methods.
4680         (read_arm_attributes_section): Remove.
4681         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4682         information about them.
4683         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4684         to here.
4685
4686 2010-01-20  Doug Kwan  <dougkwan@google.com>
4687
4688         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4689         Input_section_specifier to Section_id.
4690         (Target_arm::new_arm_input_section: Adjust code for change of key
4691         type.
4692         (Target_arm::find_arm_input_section): Ditto.
4693         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4694         (Section_id): Remove.
4695         (Garbage_collection::Section_id_hash): Remove.
4696         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4697         (Section_id): Remove.
4698         (Icf::Section_id_hash): Remove.
4699         * object.h (Section_id, Const_section_id, Section_id_hash,
4700         Const_section_id_hash): New type definitions.
4701         * output.cc (Output_section::add_relaxed_input_section): Change to
4702         use Const_section_id instead of Input_section_specifier as key type.
4703         (Output_section::add_merge_input_section): Ditto.
4704         (Output_section::build_relaxation_map): Change to use Section_id
4705         instead of Input_section_specifier as key type.
4706         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4707         Ditto.
4708         (Output_section::convert_input_sections_to_relaxed_sections): Change
4709         to use Const_section_id instead of Input_section_specifier as key type.
4710         (Output_section::find_merge_section): Ditto.
4711         (Output_section::find_relaxed_input_section): Ditto.
4712         * output.h (Input_section_specifier): Remove class.
4713         (Output_section::Output_section_data_by_input_section_map): Change
4714         key type to Const_section_id.
4715         (Output_section::Output_relaxed_input_section_by_input_section_map):
4716         Ditto.
4717         (Output_section::Relaxation_map): Change key type to Section_id.
4718
4719 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4720
4721         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4722         (class Arm_v4bx_stub): New class.
4723         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4724         (Stub_factory::make_arm_v4bx_stub): New method.
4725         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4726         (Stub_table::empty): Handle v4bx stubs.
4727         (Stub_table::add_arm_v4bx_stub): New method.
4728         (Stub_table::find_arm_v4bx_stub): New method.
4729         (Arm_relocate_functions::v4bx): New method.
4730         (Target_arm::fix_v4bx): New method.
4731         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4732         (Stub_table::relocate_stubs): Likewise.
4733         (Stub_table::do_write): Likewise.
4734         (Stub_table::update_data_size_and_addralign): Likewise.
4735         (Stub_table::finalize_stubs):  Likewise.
4736         (Target_arm::Scan::local): Likewise.
4737         (Target_arm::Scan::global): Likewise.
4738         (Target_arm::do_finalize_sections): Likewise.
4739         (Target_arm::Relocate::relocate): Likewise.
4740         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4741         Likewise.
4742         (Target_arm::scan_reloc_for_stub): Likewise.
4743         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4744
4745 2010-01-19  Ian Lance Taylor  <iant@google.com>
4746
4747         * output.cc (Output_section_headers::do_sized_write): Write large
4748         segment count to sh_info field.
4749         (Output_file_header::do_sized_write): For large segment count,
4750         write PN_XNUM to e_phnum field.
4751
4752 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4753
4754         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4755         (Arm_relocate_functions::thm_jump8): New function.
4756         (Arm_relocate_functions::thm_jump11): New function.
4757         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4758         R_ARM_THM_JUMP11.
4759         (Target_arm::Scan::global): Likewise.
4760         (Target_arm::Relocate::relocate): Likewise.
4761         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4762         Likewise.
4763
4764 2010-01-14  Doug Kwan  <dougkwan@google.com>
4765
4766         * arm.cc (map, utility): Include headers.
4767         (Target_arm::apply_cortex_a8_workaround): New method.
4768         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4769         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4770         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4771         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4772         the --[no-]fix-cortex-a8 command line options.
4773         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4774         (Target_arm::relocate_stub): Use addend in instruction template.
4775         * options.h (DEFINE_bool): Set the user-set flag.
4776         (General_options): Add --[no-]-fix-cortex options.
4777         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4778         : Update fast look-up map after conversion.
4779
4780 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4781
4782         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4783         in the first pass of do_layout.
4784
4785 2010-01-13  Doug Kwan  <dougkwan@google.com>
4786
4787         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4788         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4789         apparent compiler problem of not folding static constant integral
4790         data members of elfcpp::Elf_sizes<32>.
4791
4792 2010-01-13  Doug Kwan  <dougkwan@google.com>
4793
4794         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4795         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4796         Arm_relobj::scan_section_for_cortex_a8_erratum,
4797         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4798         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4799         sections to scan for relocation stubs into a new method
4800         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4801         relocation and Cortex-A8 stub scanning.
4802         (Target_arm::do_relax): Force stubs to be after stubbed sections
4803         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4804         the beginning of a new relaxation pass.  Update a comment.
4805         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4806
4807 2010-01-12  Ian Lance Taylor  <iant@google.com>
4808
4809         * target-reloc.h (visibility_error): New inline function.
4810         (relocate_section): Call visibility_error.
4811         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4812         (MOSTLYCLEANFILES): Likewise.
4813         (protected_4_pic.o, protected_3.err): New targets.
4814         * testsuite/protected_4.cc: New file.
4815
4816 2010-01-12  Doug Kwan  <dougkwan@google.com>
4817
4818         * arm.cc (Cortex_a8_reloc): New class.
4819         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4820         and cortex_a8_relocs_info_.
4821         (Target_arm::fix_cortex_a8): New method definition.
4822         (Target_arm::Cortex_a8_relocs_info): New type.
4823         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4824         New data member declarations.
4825         (Target_arm::scan_reloc_for_stub): Record information about
4826         relocations for THUMB branches that might be exempted from the
4827         Cortex-A8 workaround.
4828         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4829         at the beginning of a relaxation pass.
4830
4831 2010-01-12  Doug Kwan  <dougkwan@google.com>
4832
4833         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4834         (Arm_relobj::Mapping_symbol_position,
4835          Arm_reloj::Mapping_symbol_position_less,
4836          Arm_relobj::Mapping_symbols_info): New types.
4837         (Target_arm::is_mapping_symbol_name): New method definition.
4838         (Arm_relobj::do_count_local_symbols): Save information about mapping
4839         symbols.
4840
4841 2010-01-11  Doug Kwan  <dougkwan@google.com>
4842
4843         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4844         Arm_relocate_functions::thumb32_branch_upper,
4845         Arm_relocate_functions::thumb32_branch_lower,
4846         Arm_relocate_functions::thumb32_cond_branch_offset,
4847         Arm_relocate_functions::thumb32_cond_branch_upper,
4848         Arm_relocate_functions::thumb32_cond_branch_lower,
4849         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4850         branch offset encoding.
4851         (Arm_relocate_functions::thumb_branch_common): Use new branch
4852         offset encoding methods to avoid code duplication.
4853         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4854         (Stub_addend_reader::operator()): Use new branch encoding method
4855         to avoid code duplication.
4856
4857 2010-01-11  Doug Kwan  <dougkwan@google.com>
4858
4859         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4860         (Target_arm::do_finalize_sections): Define special EXIDX section
4861         symbols only if referenced.
4862         * gc.h (Garbage_collection::add_reference): New method.
4863         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4864         code duplication.
4865
4866 2010-01-11  Ian Lance Taylor  <iant@google.com>
4867
4868         * script.cc (Version_script_info::build_expression_list_lookup):
4869         Change complaing about duplicate wildcard match from error to
4870         warning.
4871
4872         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4873         of 2009-12-30.
4874         (Version_script_info::Version_script_info): Initialize globs_,
4875         default_version_, default_is_global_, and exact_.  Don't
4876         initialize globals_ or locals_.
4877         (Version_script_info::build_lookup_tables): Build local symbols
4878         first.
4879         (Version_script_info::unquote): New function.
4880         (Version_script_info::add_exact_match): New function.
4881         (Version_script_info::build_expression_list_lookup): Remove lookup
4882         parameter.  Add is_global parameter.  Change all callers.  Handle
4883         wildcard pattern specially.  Unquote pattern.  Call
4884         add_exact_match.
4885         (Version_script_info::get_name_to_match): New function.
4886         (Version_script_info::get_symbol_version): New function.
4887         (Version_script_info::get_symbol_version_helper): Remove.
4888         (Version_script_info::check_unmatched_names): Call unquote.
4889         * script.h (class Version_script_info): Change get_symbol_version
4890         to be non-inline and add is_global parameter; change all callers.
4891         Rewrite symbol_is_local.  Update declarations.  Define struct
4892         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4893         Remove globals_ and locals_ members.  Add exact_, globs_,
4894         default_version_, is_global_.
4895         (Version_script_info::Glob): Remove pattern, add expression and
4896         is_global.  Update constructor.  Change all callers.
4897         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4898         default version.
4899         (Versions::symbol_section_contents): If a symbol is undefined, or
4900         defined in a dynamic object, set the version index to
4901         VER_NDX_LOCAL.
4902         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4903         symbol_is_local.
4904         (Symbol_table::add_from_pluginobj): Likewise.
4905         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4906
4907 2010-01-11  Doug Kwan  <dougkwan@google.com>
4908
4909         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4910         (incremental_dump_LDADD): Add linking option for libintl.
4911         * Makefile.in: Regenerate.
4912
4913 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4914
4915         PR gold/11144
4916         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4917         instead of -Ds.
4918         * testsuite/Makefile.in: Regenerated.
4919
4920 2010-01-10  Doug Kwan  <dougkwan@google.com>
4921
4922         * options.h (DEFINE_var): Use parentheses around argument varname__
4923         in macro body to avoid any unintended subsequent substitutions.
4924
4925 2010-01-10  Ian Lance Taylor  <iant@google.com>
4926
4927         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4928         candidates before doing symbol resolution.
4929
4930         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4931         ODR candidates if only one is weak.
4932
4933 2010-01-08  Ian Lance Taylor  <iant@google.com>
4934
4935         * script.cc (Version_script_info::build_expression_list_lookup):
4936         Don't warn about ambiguous version, just record the ambiguity.
4937         (Version_script_info::get_symbol_version_helper): Give error if
4938         version is ambiguous.
4939
4940 2010-01-08  Doug Kwan  <dougkwan@google.com>
4941
4942         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4943           prev_data_size_ and prev_addralign_.  Remove initializer for
4944           deleted data member has_been_changed_.
4945           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4946           to determine if the table is empty.
4947           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4948           Remove.
4949           (Stub_table::add_reloc_stub): Define method in class definition
4950           instead of just declaring it there.
4951           (Stub_table::add_cortex_a8_stub): New method definition.
4952           (Stub_table::update_data_size_and_addralign): Ditto.
4953           (Stub_table::finalize_stubs): Ditto.
4954           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4955           (Stub_table::do_addralign_): Return address alignment in the
4956           (Stub_table::do_reset_address_and_file_offset): Define method in
4957           class definition instead of declaring it there.  Set current data
4958           size to be the data size of the previous pass.
4959           (Stub_table::set_final_data_size): Use current data size as the
4960           final data size.
4961           (Stub_table::relocate_stub): Change parameter type of stub from
4962           Reloc_stub pointer to Stub pointer.
4963           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4964           (Stub_table::Cortex_a8_stub_list): New typedef.
4965           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4966            Stub_table::prev_addralign_): New data member.
4967           (Arm_relobj::Arm_relobj): Initialize data member
4968           section_has_cortex_a8_workaround_.
4969           (Arm_relobj::section_has_cortex_a8_workaround,
4970            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4971            definitions.
4972           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4973           declarations.
4974           (Target_arm::relocate_stub): Change parameter type of stub from
4975           Reloc_stub pointer to Stub pointer.
4976           (Insn_template::size, Insn_template::alignment): Handle
4977           THUMB16_SPECIAL_TYPE.
4978           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4979            Stub_table::update_data_size_and_addralign,
4980            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4981           definitions.
4982           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4983           (Stub_table::do_write): Ditto.
4984           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4985
4986 2010-01-08  Ian Lance Taylor  <iant@google.com>
4987
4988         PR 11108
4989         * symtab.h (class Symbol): Remove fields is_target_special_ and
4990         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4991         (Symbol::is_defined_in_discarded_section): New function.
4992         (Symbol::set_is_defined_in_discarded_section): New function.
4993         (Symbol::has_plt_offset): Rewrite.
4994         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4995         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4996         Don't initialize is_target_special_ or has_plt_offset_.
4997         Initialize is_defined_in_discarded_section_.
4998         (Symbol_table::add_from_relobj): If appropriate, set
4999         is_defined_in_discarded_section.
5000         * resolve.cc (Symbol::override_base_with_special): Don't test
5001         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5002         * target-reloc.h (relocate_section): Do special handling for
5003         symbols defined in discarded sections for global symbols as well
5004         as local symbols.
5005
5006 2010-01-08  Ian Lance Taylor  <iant@google.com>
5007
5008         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5009         the SHT_SYMTAB case.
5010
5011 2010-01-08  Ian Lance Taylor  <iant@google.com>
5012
5013         * object.cc (Sized_relobj::do_layout): Don't get confused if
5014         layout_eh_frame returns NULL.
5015
5016 2010-01-08  Ian Lance Taylor  <iant@google.com>
5017
5018         PR 11084
5019         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5020         dynamic symbol table, use the normal symbol table.
5021         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5022         symbol table.
5023
5024 2010-01-08  Ian Lance Taylor  <iant@google.com>
5025
5026         PR 11072
5027         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5028         sections.
5029
5030 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5031
5032         * version.cc (print_version): Change to "Copyright 2010".
5033
5034 2010-01-08  Ian Lance Taylor  <iant@google.com>
5035
5036         PR 10287
5037         PR 11063
5038         * i386.cc (class Target_i386): Change return type of plt_section
5039         to be non-const.
5040         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5041         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5042         tls_desc_rel_ field.
5043         (Output_data_plt_i386::rel_tls_desc): New function.
5044         (Target_i386::rel_tls_desc_section): New function.
5045         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5046         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5047         R_386_TLS_DESC reloc in rel_tls_desc_section.
5048         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5049         Define struct Tlsdesc_info.
5050         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5051         (Target_x86_64::do_reloc_symbol_index): New function.
5052         (Target_x86_64::add_tlsdesc_info): New function.
5053         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5054         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5055         tlsdesc_rel_ field.
5056         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5057         all callers.
5058         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5059         (Target_x86_64::rela_tlsdesc_section): New function.
5060         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5061         handling.
5062         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5063         (Target_x86_64::do_reloc_addend): New function.
5064         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5065         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5066         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5067         (Output_reloc::type): New function.
5068         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5069         (Output_reloc::is_target_specific): New function.
5070         (Output_reloc::target_arg): New function.
5071         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5072         absolute relocs and target specific relocs.
5073         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5074         add_target_specific.
5075         (class Output_data_reloc) [SHT_RELA]: Likewise.
5076         * output.cc (Output_reloc::Output_reloc): Add four new versions
5077         for absolute relocs and target specific relocs.
5078         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5079         (Output_reloc::get_symbol_index): Likewise.
5080         (Output_reloc::local_section_offset): Check that local_sym_index_
5081         is not TARGET_CODE or 0.
5082         (Output_reloc::symbol_value): Likewise.
5083         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5084         reloc.
5085         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5086         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5087         functions.
5088         * layout.cc (add_target_dynamic_tags): Use output section for
5089         DT_PLTRELSZ and DT_JMPREL.
5090
5091 2010-01-07  Ian Lance Taylor  <iant@google.com>
5092
5093         PR 11061
5094         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5095         function.
5096         (class Output_data_reloc_generic): Define.
5097         (class Output_data_reloc_base): Change base class to
5098         Output_data_reloc_generic.  Change add() method to call
5099         bump_relative_reloc_count for a relative reloc.  Remove
5100         sort_relocs_ field.
5101         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5102         to sort_relocs().
5103         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5104         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5105         appropriate.
5106         * layout.h (class Layout): Update declaration.
5107
5108 2010-01-07  Ian Lance Taylor  <iant@google.com>
5109
5110         * output.h (class Output_data): Add const version of
5111         output_section and do_output_section.
5112         (class Output_section_data): Add const version of
5113         do_output_section.
5114         (class Output_section): Likewise.
5115         * layout.cc (Layout::add_target_dynamic_tags): New function.
5116         * layout.h (class Layout): Update declarations.
5117         * arm.cc (Target_arm::do_finalize_sections): Use
5118         add_target_dynamic_tags.
5119         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5120         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5121         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5122         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5123
5124 2010-01-07  Ian Lance Taylor  <iant@google.com>
5125
5126         PR 11042
5127         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5128         object as needed.
5129
5130 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5131             Ian Lance Taylor  <iant@google.com>
5132
5133         PR 11019
5134         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5135         Xindex::read_symtab_xindex.
5136
5137 2010-01-07  Doug Kwan  <dougkwan@google.com>
5138
5139         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5140         (Insn_template::thumb16_bcond_insn): New method declaration.
5141         (Insn_template): Fix spelling.
5142         (Stub::thumb16_special): New method declaration.
5143         (Stub::do_write): Define virtual method which was previously pure
5144         virtual.
5145         (Stub::do_thumb16_special): New method declaration.
5146         (Stub::do_fixed_endian_write): New template member.
5147         (Reloc_stub::do_write): Remove.
5148         (Reloc_stub::do_fixed_endian_write): Remove.
5149         (Cortex_a8_stub): New class definition.
5150         (Stub_factory::make_cortex_a8_stub): New method definition.
5151         (Stub_factory::Stub_factory): Add missing static storage class
5152         qualifier for elf32_arm_stub_a8_veneer_blx.
5153
5154 2010-01-07  Ian Lance Taylor  <iant@google.com>
5155
5156         PR 10980
5157         * options.h (class General_options): Add --warn-unresolved-symbols
5158         and --error-unresolved-symbols.
5159         * errors.cc (Errors::undefined_symbol): Implement
5160         --warn-unresolved-symbols.
5161
5162         * options.h (class General_options): Add -z text and -z textoff.
5163         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5164
5165 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5166
5167         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5168         (Garbage_collection::cident_sections): New function.
5169         (Garbage_collection::add_cident_section): New function.
5170         (Garbage_collection::cident_sections_): New member.
5171         (gc_process_relocs): Add references to sections whose names are C
5172         identifiers.
5173         * gold.h (cident_section_start_prefix): New constant.
5174         (cident_section_stop_prefix): New constant.
5175         (is_cident): New function.
5176         * layout.cc (Layout::define_section_symbols): Replace string constants
5177         with the newly defined constants.
5178         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5179         C identifiers.
5180         * testsuite/Makefile.am: Add gc_orphan_section_test.
5181         * testsuite/Makefile.in: Regenerate.
5182         * testsuite/gc_orphan_section_test.cc: New file.
5183         * testsuite/gc_orphan_section_test.sh: New file.
5184
5185 2010-01-06  Ian Lance Taylor  <iant@google.com>
5186
5187         PR 10980
5188         * options.h (class General_options): Add --warn-shared-textrel.
5189         * layout.cc (Layout::finish_dynamic_section): Implement
5190         --warn-shared-textrel.
5191
5192         PR 10980
5193         * options.h (class General_options): Add --warn-multiple-gp.
5194
5195 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5196
5197         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5198         $(THREADSLIB) and $(LIBDL).
5199         * Makefile.in: Rebuild.
5200
5201 2010-01-06  Ian Lance Taylor  <iant@google.com>
5202
5203         PR 10980
5204         * options.cc (General_options::parse_section_start): New function.
5205         (General_options::section_start): New function.
5206         (General_options::General_options): Initialize all members.
5207         * options.h: Include <map>
5208         (class General_options): Add --section-start.  Add section_starts_
5209         member.
5210         * layout.cc (Layout::attach_allocated_section_to_segment): If
5211         --section-start was used, set the address of the segment.  Remove
5212         local sort_sections.
5213         (Layout::relaxation_loop_body): If the address of the load segment
5214         has been set by --section-start, don't use it.
5215         * output.h (Output_segment::update_flags_for_output_section): New
5216         function.
5217         * output.cc (Output_segment::add_output_section): Call
5218         update_flags_for_output_section.
5219
5220 2010-01-05  Ian Lance Taylor  <iant@google.com>
5221
5222         PR 10980
5223         * options.h (class General_options): Add --undefined-version.
5224         * script.cc (struct Version_expression): Add was_matched_by_symbol
5225         field.
5226         (Version_script_info::matched_symbol): New function.
5227         (Version_script_info::get_symbol_version_helper): Call
5228         matched_symbol.
5229         (Version_script_info::check_unmatched_names): New function.
5230         * script.h (class Version_script_info): Update declarations.
5231         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5232
5233         * options.h (class General_options): Use DEFINE_bool_alias for
5234         allow_multiple_definition.
5235         * resolve.cc (Symbol_table::should_override): Don't test
5236         allow_multiple_definition.
5237
5238         PR 10980
5239         * options.h (class General_options): Add --cref.
5240         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5241         until after printing cref table.
5242         * cref.cc: Include "symtab.h".
5243         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5244         (Cref_table_compare::operator()): New function.
5245         (Cref_inputs::gather_cref): New function.
5246         (filecol): New static const.
5247         (Cref_inputs::print_cref): New function.
5248         (Cref::print_cref): New function.
5249         * cref.h: Include <cstdio>.
5250         (class Cref): Update declarations.
5251         * mapfile.h (Mapfile::file): New function.
5252         * object.h (class Object): Define Symbols.  Declare virtual
5253         do_get_global_symbols.
5254         (Object::get_global_symbols): New function.
5255         * object.cc (Input_objects::add_object): Pass object to cref_ if
5256         --cref.
5257         (Input_objects::archive_start): Likewise.
5258         (Input_objects::archive_stop): Likewise.
5259         (Input_objects::print_cref): New function.
5260         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5261         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5262         --cref.
5263         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5264         function.
5265         * plugin.h (class Sized_pluginobj): Update declarations.
5266
5267 2010-01-05  Ian Lance Taylor  <iant@google.com>
5268
5269         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5270         to is_default_version.  Rename insdef to insdefault.
5271         (Symbol_table::add_from_relobj): Rename def to is_default_version
5272         and local to is_forced_local.
5273         (Symbol_table::add_from_pluginobj): Likewise.
5274         (Symbol_table::add_from_dynobj): Likewise.
5275         (Symbol_table::define_special_symbol): Rename insdef to
5276         insdefault.
5277
5278 2010-01-04  Ian Lance Taylor  <iant@google.com>
5279
5280         PR 10980
5281         * options.h (class General_options): Add
5282         --allow-multiple-definition and -z muldefs.
5283         * resolve.cc (Symbol_table::should_override): Don't warn about a
5284         multiple symbol definition if --allow-multiple-definition or -z
5285         muldefs.
5286
5287         PR 10980
5288         * options.h (class General_options): Add --add-needed and
5289         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5290         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5291         error if --copy-dt-needed-entries aka --add-needed is used and
5292         would cause a change in behaviour.
5293
5294         PR 10980
5295         * options.h (class General_options): Add -G as a short version of
5296         --shared.  Add no-op options -assert, -g, and -i.
5297
5298 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5299
5300         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5301         check for .text or .gnu.linkonce.t sections.
5302         * icf.cc (Icf::find_identical_sections): Ditto.
5303         Change the detection for mangled function name within the section
5304         name.
5305         * icf.h (is_section_foldable_candidate): New function.
5306
5307 2009-12-30  Ian Lance Taylor  <iant@google.com>
5308
5309         PR 10980
5310         * options.h (class General_options): Permit two dashes with
5311         --retain-symbols-file.
5312
5313 2009-12-30  Ian Lance Taylor  <iant@google.com>
5314
5315         PR 10979
5316         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5317         don't put the file header and segment headers in the text
5318         segment.
5319
5320         PR 10979
5321         * common.cc (Sort_commons::operator()): Stabilize sort when both
5322         entries are NULL.
5323         (Symbol_table::do_allocate_commons_list): When allocating common
5324         symbols, skip a symbol which is no longer common.
5325         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5326         an object before checking its type.
5327         * testsuite/common_test_2.c: New file.
5328         * testsuite/common_test_3.c: New file.
5329         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5330         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5331         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5332         (common_test_2_pic.o, common_test_2.so): New targets.
5333         (common_test_3_pic.o, common_test_3.so): New targets.
5334         * testsuite/Makefile.in: Rebuild.
5335
5336         PR 10979
5337         * script.cc (read_input_script): If we see a new SECTIONS clause,
5338         and we have added an input section, give an error.
5339         * layout.h (class Layout): Add have_added_input_section function.
5340         Add have_added_input_section_ field.
5341         * layout.cc (Layout::Layout): Initialize
5342         have_added_input_section_.
5343         (Layout::layout): Set have_added_input_section_.
5344         (Layout::layout_eh_frame): Likewise.
5345
5346 2009-12-30  Ian Lance Taylor  <iant@google.com>
5347
5348         PR 10931
5349         * options.h (class General_options): Add --sort-common option.
5350         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5351         * common.cc (Sort_common): Add sort_order parameter to
5352         constructor.  Add sort_order_ field.
5353         (Sort_commons::operator): Check sort_order_.
5354         (Symbol_table::allocate_commons): Determine the sort order.
5355         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5356         Change all callers.
5357         (Symbol_table::do_allocate_commons_list): Likewise.
5358
5359 2009-12-30  Ian Lance Taylor  <iant@google.com>
5360
5361         PR 10916
5362         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5363         symbols from this object, don't change the visibility of an
5364         undefined symbol.
5365         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5366
5367 2009-12-30  Ian Lance Taylor  <iant@google.com>
5368
5369         PR 10861
5370         * script.h (class Version_script_info): Define Language enum.
5371         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5372         new fields globals_, locals_, and is_finalized_.
5373         * script.cc: Various formatting fixes.
5374         (class Parser_closure): Change language_stack_ from a vector of
5375         std::string to one of Version_script_info::Language.  Adjust all
5376         uses accordingly.
5377         (class Lazy_demangler): Remove.
5378         (struct Version_expression): Change language from std::string to
5379         Version_script_info::Language.
5380         (Version_script_info::Version_script_info): New function.
5381         (Version_script_info::~Version_script_info): Don't call clear.
5382         (Version_script_info::finalize): New function.
5383         (Version_script_info::build_lookup_tables): New function.
5384         (Version_script_info::build_expression_list_lookup): New
5385         function.
5386         (Version_script_info::get_symbol_version_helper): Rewrite to use
5387         lookup tables.
5388         (Version_script_info::print_expression_list): Adjust to use
5389         Version_script_info::Language.
5390         (script_push_lex_into_version_mode): Check that the version script
5391         has not been finalized.
5392         (version_script_push_lang): Change language string to
5393         Version_script_info::Language.
5394         * options.cc (Command_line::version_script): New function.
5395         * options.h (class General_options): Add finalize_dynamic_list
5396         function.  Change version_script from declaration to definition.
5397         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5398         * testsuite/version_script.map: Remove duplicate def of foo.
5399         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5400         version_script.map.
5401         * testsuite/Makefile.in: Rebuild.
5402
5403 2009-12-30  Ian Lance Taylor  <iant@google.com>
5404
5405         PR 10843
5406         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5407         if the input symbol index is 0, make the output symbol index 0.
5408
5409 2009-12-30  Ian Lance Taylor  <iant@google.com>
5410
5411         PR 10670
5412         * options.h (class General_options): Add -x/--discard-all.
5413         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5414         --discard-all.  If the local symbol needs a dynamic entry, check
5415         that before handling --discard-locals.
5416
5417 2009-12-30  Ian Lance Taylor  <iant@google.com>
5418
5419         PR 10450
5420         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5421         flags to PF_R.
5422         (Output_segment::add_output_section): Don't change the flags if
5423         the type is PT_TLS.
5424
5425         PR 10450
5426         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5427         GNU hash table if they need a dynamic value.  Otherwise, don't add
5428         them if they are defined in a dynamic object or are forced local.
5429
5430 2009-12-29  Ian Lance Taylor  <iant@google.com>
5431
5432         PR 10450
5433         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5434         .gnu.hash table for a 32-bit target.
5435
5436         PR 10450
5437         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5438         regular and a dynamic object only needs a dynamic symbol table
5439         entry if it is externally visible.
5440
5441         PR 10450
5442         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5443         constructor.  Add global_offset_table_ field.
5444         (Target_i386::got_section): Set global_offset_table_.
5445         (Target_i386::do_finalize_sections): Set global_offset_table_
5446         size.
5447         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5448         in constructor.  Add global_offset_table_ field.
5449         (Target_x86_64::got_section): Set global_offset_table_.
5450         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5451         size.
5452
5453         * layout.cc (Layout::Layout): Initialize increase_relro_.
5454         (Layout::get_output_section): Add is_relro, is_last_relro, and
5455         is_first_non_relro parameters.  Change all callers.
5456         (Layout::choose_output_section): Likewise.
5457         (Layout::add_output_section_data): Likewise.
5458         (Layout::make_output_section): Likewise.
5459         (Layout::set_segment_offsets): Clear increase_relro when using a
5460         linker script.
5461         * layout.h (class Layout): Add increase_relro method.  Add
5462         increase_relro_ field.  Update declarations.
5463         * output.cc (Output_section::Output_section): Initialize
5464         is_last_relro_ and is_first_non_relro_.
5465         (Output_segment::add_output_section): Group relro sections is
5466         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5467         (Output_segment::maximum_alignment): Remove relro handling.
5468         (Output_segment::set_section_addresses): Add increase_relro
5469         parameter.  Change all callers.  Add initial alignment to align
5470         relro sections on separate page.  Remove old relro handling.
5471         (Output_segment::set_section_list_addresses): Remove in_relro
5472         parameter.  Change all callers.
5473         (Output_segment::set_offset): Add increase parameter.  Change all
5474         callers.  Remove old relro handling.
5475         * output.h (class Output_section): Add new methods: is_last_relro,
5476         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5477         Add is_last_relro_ and is_first_non_relro_ fields.
5478         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5479         Create separate .got.plt section.  Call increase_relro.
5480         * x86_64.cc (Target_x86_64::got_section): Likewise.
5481         * testsuite/relro_script_test.t: Add .got.plt.
5482
5483         PR 10450
5484         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5485         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5486         (Layout::finalize): Call set_dynamic_symbol_size.
5487         (Layout::set_dynamic_symbol_size): New function.
5488         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5489         set_dynamic_symbol_size.
5490
5491         PR 10450
5492         * output.h (class Output_section): Add is_entsize_zero_ field.
5493         * output.cc (Output_section::Output_section): Initialize
5494         is_entsize_zero_.
5495         (Output_section::set_entsize): If two different entsizes are
5496         requested, force it to zero.
5497         (Output_section::add_input_section): Set flags for .debug_str
5498         before updating section flags.  Set entsize.
5499         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5500         and SHF_STRING if all input sections have those flags.
5501
5502 2009-12-29   Rafael Espindola  <espindola@google.com>
5503
5504         * main.cc (main): Fix the sys time reporting.
5505         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5506         reporting.
5507
5508 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5509
5510         * options.cc (General_options::parse_version): Allow -v to exit
5511         without an error if there is nothing to link.
5512
5513 2009-12-29  Ian Lance Taylor  <iant@google.com>
5514
5515         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5516         using a version of gcc before 4.1.
5517         * configure: Rebuild.
5518
5519 2009-12-28  Chris Demetriou  <cgd@google.com>
5520
5521         * attributes.cc (Output_attributes_section_data::do_write): Use
5522         std::vector::front rather than std::vector::data.
5523
5524 2009-12-28  Ian Lance Taylor  <iant@google.com>
5525
5526         * symtab.h (class Symbol_table): Add enum Defined.
5527         * resolve.cc (Symbol_table::should_override): Add defined
5528         parameter.  Change all callers.  Test whether object is NULL
5529         before calling a method on it.
5530         (Symbol_table::report_resolve_problem): Add defined parameter.
5531         Change all callers.
5532         (Symbol_table::should_override_with_special): Likewise.
5533         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5534         parameter.  Change all callers.
5535         (Symbol_table::do_define_in_output_data): Likewise.
5536         (Symbol_table::define_in_output_segment): Likewise.
5537         (Symbol_table::do_define_in_output_segment): Likewise.
5538         (Symbol_table::define_as_constant): Likewise.
5539         (Symbol_table::do_define_as_constant): Likewise.
5540         * script.h (class Symbol_assignment): Add is_defsym parameter to
5541         constructor; change all callers.
5542         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5543         parameter.  Change all callers.  Add is_defsym_ field.
5544         (class Parser_closure): Add parsing_defsym parameter to
5545         constructor; change all callers.  Add parsing_defsym accessor
5546         function.  Add parsing_defsym_ field.
5547
5548 2009-12-28  Ian Lance Taylor  <iant@google.com>
5549
5550         * gold.cc (queue_middle_tasks): Fix formatting.
5551         * object.cc (Relobj::is_section_name_included): Likewise.
5552
5553 2009-12-23  Ian Lance Taylor  <iant@google.com>
5554
5555         * i386.cc (Target_i386::do_calls_non_split): Recognize
5556         -fsplit-stack prologue for a function with a static chain.
5557         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5558         -fsplit-stack prologue when using %r11.
5559
5560 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5561
5562         * options.cc (General_options::parse_version): Make -v continue and do
5563         the link like GNU ld does.
5564
5565 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5566
5567         * Makefile.am (CCFILES): Add timer.cc.
5568         (HFILES): Add timer.h.
5569         * configure.ac: Check for sysconf and times.
5570         * main.cc: include timer.h.
5571         (main): Use Timer instead of get_run_time.
5572         * timer.cc: New.
5573         * timer.h: New.
5574         * workqueue.cc: include timer.h.
5575         (Workqueue::find_and_run_task):
5576         Report user, sys and wall time.
5577         * Makefile.in: Regenerate.
5578         * config.in: Regenerate.
5579         * configure: Regenerate.
5580
5581 2009-12-16  Doug Kwan  <dougkwan@google.com>
5582
5583         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5584         sections.
5585         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5586         relaxed input sections.
5587         * output.cc (Output_section::find_relaxed_input_section): Change
5588         return type to Output_relaxed_input_section pointer.  Adjust code
5589         for new type of relaxed_input_section_map_.
5590         * output.h (Output_section::find_relaxed_input_section): Change
5591         return type to Output_relaxed_input_section pointer.
5592         (Output_section::Output_relaxed_input_section_by_input_section_map):
5593         New type.
5594         (Output_section::relaxed_input_section_map_): Change type to
5595         Output_section::Output_relaxed_input_section_by_input_section_map.
5596         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5597         input section.
5598
5599 2009-12-15  Ian Lance Taylor  <iant@google.com>
5600
5601         * layout.cc (Layout::create_shstrtab): Only write out after input
5602         sections if we are compressing debug sections.
5603
5604 2009-12-15  Ian Lance Taylor  <iant@google.com>
5605
5606         * archive.cc (Archive::add_symbols): Only look up a symbol without
5607         a version if there is, in fact, a version.
5608
5609 2009-12-14  Ian Lance Taylor  <iant@google.com>
5610
5611         Revert -Wshadow changes, all changes from:
5612         2009-12-11  Doug Kwan  <dougkwan@google.com>
5613         2009-12-11  Nick Clifton  <nickc@redhat.com>
5614         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5615
5616 2009-12-11  Doug Kwan  <dougkwan@google.com>
5617
5618         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5619         due to -Wshadow.
5620         * attributes.cc (Object_attribute::size): Ditto.
5621         (Attributes_section_data::size): Ditto.
5622         (Attributes_section_data::Attributes_section_data): Ditto.
5623         (Output_attributes_section_data::do_write): Ditto.
5624         * attributes.h (Object_attribute::set_type): Ditto.
5625         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5626
5627 2009-12-11  Nick Clifton  <nickc@redhat.com>
5628
5629         * archive.cc: Fix shadowed variable warnings.
5630         * arm.cc: Likewise.
5631         * compressed_output.cc: Likewise.
5632         * compressed_output.h: Likewise.
5633         * configure: Likewise.
5634         * dwarf_reader.cc: Likewise.
5635         * dynobj.cc: Likewise.
5636         * dynobj.h: Likewise.
5637         * ehframe.cc: Likewise.
5638         * ehframe.h: Likewise.
5639         * errors.cc: Likewise.
5640         * expression.cc: Likewise.
5641         * fileread.cc: Likewise.
5642         * fileread.h: Likewise.
5643         * freebsd.h: Likewise.
5644         * i386.cc: Likewise.
5645         * icf.cc: Likewise.
5646         * incremental.h: Likewise.
5647         * layout.cc: Likewise.
5648         * layout.h: Likewise.
5649         * mapfile.cc: Likewise.
5650         * merge.cc: Likewise.
5651         * merge.h: Likewise.
5652         * object.cc: Likewise.
5653         * object.h: Likewise.
5654         * options.h: Likewise.
5655         * output.cc: Likewise.
5656         * output.h: Likewise.
5657         * parameters.cc: Likewise.
5658         * plugin.cc: Likewise.
5659         * powerpc.cc: Likewise.
5660         * reduced_debug_output.cc: Likewise.
5661         * reduced_debug_output.h: Likewise.
5662         * reloc.cc: Likewise.
5663         * reloc.h: Likewise.
5664         * resolve.cc: Likewise.
5665         * script-sections.cc: Likewise.
5666         * script.cc: Likewise.
5667         * script.h: Likewise.
5668         * sparc.cc: Likewise.
5669         * symtab.cc: Likewise.
5670         * symtab.h: Likewise.
5671         * target-select.cc: Likewise.
5672         * target-select.h: Likewise.
5673         * token.h: Likewise.
5674         * workqueue.cc: Likewise.
5675         * workqueue.h: Likewise.
5676         * x86_64.cc: Likewise.
5677
5678 2009-12-10  Doug Kwan  <dougkwan@google.com>
5679
5680         * arm.cc (attributes.h): New include.
5681         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5682         (Arm_relobj::~Arm_relobj): Delete object pointed by
5683         attributes_section_data_.
5684         (Arm_relobj::attributes_section_data): New method definition.
5685         (Arm_relobj::attributes_section_data_): New data member declaration.
5686         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5687         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5688         attributes_section_data_.
5689         (Arm_dynobj::attributes_section_data): New method definition.
5690         (Arm_dynobj::attributes_section_data_): New data member declaration.
5691         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5692         initialization value of may_use_blx_ to false.
5693         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5694         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5695         object attributes to compute results instead of hard-coding.
5696         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5697         Target_arm::get_secondary_compatible_arch,
5698         Target_arm::set_secondary_compatible_arch
5699         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5700         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5701         New method declarations.
5702         (Target_arm::get_aeabi_object_attribute): New method definition.
5703         (Target_arm::attributes_section_data_): New data member declaration.
5704         (read_arm_attributes_section): New template definition.
5705         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5706         (Arm_dynobj::do_read_symbols): Ditto.
5707         (Target_arm::do_finalize_sections): Merge attributes sections from
5708         input.  Check for BLX use after attributes section merging.
5709         Fix __exidx_start and __exidx_end visibility.  Create an
5710         .ARM.attributes section if necessary.
5711         (Target_arm::get_secondary_compatible_arch,
5712         Target_arm::set_secondary_compatible_arch,
5713         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5714         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5715         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5716         New method definitions.
5717
5718 2009-12-09  Ian Lance Taylor  <iant@google.com>
5719
5720         * plugin.cc (Plugin::load): Don't cast from void* to a function
5721         pointer.
5722
5723 2009-12-09  Ian Lance Taylor  <iant@google.com>
5724
5725         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5726         information fields.
5727
5728 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5729
5730         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5731         Replace two_file_shared_1.so with two_file_shared_2.so.
5732         * testsuite/Makefile.in: Regenerated.
5733
5734 2009-12-08  Doug Kwan  <dougkwan@google.com>
5735
5736         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5737         (HFILES): Add attributes.h and int_encoding.h.
5738         * Makefile.in: Regenerate.
5739         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5740         function definitions to int_encoding.cc
5741         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5742         prototypes to int_encoding.h
5743         * reduced_debug_output.cc (int_encoding.h): New include.
5744         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5745         function definitions to int_encoding.cc
5746         (insert_into_vector, read_from_pointer): Move template definitions to
5747         int_encoding.h
5748         * attributes.cc: New file.
5749         * attributes.h: New file.
5750         * int_encoding.cc: New file.
5751         * int_encoding.h: New file.
5752
5753 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5754
5755         PR gold/11055
5756         * incremental-dump.cc (dump_incremental_inputs): New.
5757         (main): Use dump_incremental_inputs.
5758
5759 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5760
5761         PR gold/10893
5762         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5763         checking elfcpp::STT_FUNC.
5764         (Target_i386::Relocate::relocate): Likewise.
5765         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5766
5767         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5768         symbols from shared libraries into normal FUNC symbols.
5769
5770         * symtab.h (Symbol): Add is_func and use it.
5771
5772 2009-12-05  Doug Kwan  <dougkwan@google.com>
5773
5774         * arm.cc (Target_arm::arm_info): Initialize new fields
5775         attributes_section and attributes_vendor.
5776         * i386.cc (Target_i386::i386_info): Same.
5777         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5778         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5779         fields attributes_section and attributes_vendor.
5780         * sparc.cc (Target_sparc::sparc_info): Same.
5781         * target.h (Target::attributes_section, Target::attributes_vendor,
5782         Target::is_attributes_section, Target::attribute_arg_type,
5783         Target::attributes_order): New method definitions.
5784         (Target::Target_info::attributes_section,
5785         Target::Target_info::attributes_vendor): New fields.
5786         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5787         virtual method definitions.
5788         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5789         attributes_section and attributes_vendor.
5790         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5791
5792 2009-12-05  Doug Kwan  <dougkwan@google.com>
5793
5794         * arm.cc: Update comments about interworking and stub generation.
5795         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5796         considered as non-PIC.
5797         (Arm_relocate_functions::base_abs): Fix formatting.
5798         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5799         of function to use GOT entry address instead of offset.
5800         (Target_arm::Scan::global): Issue an error if a symbol would need a
5801         PLT does not get one because it is untyped.  Remove code to create
5802         dynamic symbols for relative branches.
5803         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5804         takes unsigned integer instead of boolean.
5805
5806 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5807
5808         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5809         (two_file_test_LDADD): Likewise.
5810         (common_test_1_LDADD): Likewise.
5811         (exception_test_LDADD) Likewise.
5812         (weak_test_LDADD): Likewise.
5813         (many_sections_test_LDADD): Likewise.
5814         (initpri1_LDADD): Likewise.
5815         (script_test_1_LDADD): Likewise.
5816         (script_test_2_LDADD): Likewise.
5817         (justsyms_LDADD): Likewise.
5818         (binary_test_LDADD): Likewise.
5819         (large_LDADD): Likewise.
5820         * testsuite/Makefile.in: Regenerated.
5821
5822 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5823
5824         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5825         (Symbol_table::override_with_special): Likewise.
5826         (Symbol_table::add_from_object): Likewise.
5827
5828 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5829
5830         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5831         Don't set the data_offset twice.
5832
5833 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5834
5835         * testsuite/Makefile.in: Regenerate.
5836
5837 2009-12-03  Doug Kwan  <dougkwan@google.com>
5838
5839         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5840         (Target_arm::do_finalize_sections): Add parameter for symbol table
5841         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5842         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5843         parameter for symbol table pointer.
5844         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5845         an additional parameter for a pointer to symbol table.
5846         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5847         parameter for a symbol table pointer.
5848         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5849         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5850         Ditto.
5851         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5852         parameter for a symbol table pointer.
5853
5854 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5855
5856         * incremental.cc (Incremental_inputs_header)
5857         (Incremental_inputs_header_write, Incremental_inputs_entry)
5858         (Incremental_inputs_entry_write): Move ...
5859         * incremental.h (Incremental_inputs_header)
5860         (Incremental_inputs_header_write, Incremental_inputs_entry)
5861         (Incremental_inputs_entry_write): here.
5862
5863 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5864
5865         * incremental.cc (make_sized_incremental_binary): Set the target.
5866         Error if it is incompatible.
5867         * output.h (Output_file): Add filename method.
5868
5869 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5870
5871         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5872         from the get_* methods.
5873
5874 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5875
5876         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5877         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5878         Write 0 for the data_offset of scripts.
5879
5880 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5881
5882         * testsuite/Makefile.am: Add the incremental_test.sh test.
5883         * testsuite/incremental_test.sh: New.
5884         * testsuite/incremental_test_1.c: New.
5885         * testsuite/incremental_test_2.c: New.
5886
5887 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5888
5889        * incremental-dump.cc (main): Fix typos.
5890
5891 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5892
5893         PR gold/11025
5894         * incremental-dump.cc (main): Use llu to print 64 bit values.
5895
5896 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5897             H.J. Lu  <hongjiu.lu@intel.com>
5898
5899         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5900         $(LIBDL).
5901         (incremental_dump_LDADD): Likewise.
5902         * Makefile.in: Regenerated.
5903
5904 2009-11-25  Doug Kwan  <dougkwan@google.com>
5905
5906         Revert:
5907
5908         2009-11-25  Doug Kwan  <dougkwan@google.com>
5909
5910                 * arm.cc (Target_arm::Target_arm): Move method definition
5911                 outside of class definition.  Add code to handle
5912                 --target1-rel, --target1-abs and --target2= options.
5913                 (Target_arm::get_reloc_reloc_type): Change method to be
5914                 non-static and const.
5915                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5916                 New data member declaration.
5917                 (Target_arm::Scan::local, Target_arm::Scan::global,
5918                 Target_arm::Relocate::relocate,
5919                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5920                 Adjust call to Target_arm::get_real_reloc_type.
5921                 (Target_arm::get_real_reloc_type): Use command line options
5922                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5923                 * options.h (--target1-rel, --target1-abs, --target2): New
5924                 ARM-only options.
5925
5926 2009-11-25  Doug Kwan  <dougkwan@google.com>
5927
5928         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5929         class definition.  Add code to handle --target1-rel, --target1-abs
5930         and --target2= options.
5931         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5932         and const.
5933         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5934         member declaration.
5935         (Target_arm::Scan::local, Target_arm::Scan::global,
5936         Target_arm::Relocate::relocate,
5937         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5938         call to Target_arm::get_real_reloc_type.
5939         (Target_arm::get_real_reloc_type): Use command line options to
5940         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5941         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5942         options.
5943
5944 2009-11-25  Doug Kwan  <dougkwan@google.com>
5945
5946         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5947         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5948         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5949         formatting.
5950         (Arm_relocate_functions::thm_call): Replace body with a call to
5951         Arm_relocate_functions::thumb_branch_common.
5952         (Arm_relocate_functions::thm_jump24,
5953         Arm_relocate_functions::thm_xpc22): New method definitions.
5954         (Arm_relocate_functions::thumb_branch_common): New method definition.
5955         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5956         operator.
5957         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5958         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5959
5960 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5961
5962         * Makefile.am: Build incremental-dump
5963         * Makefile.in: Regenerate.
5964         * incremental-dump.cc: New.
5965         * incremental.cc (Incremental_inputs_header_data,
5966         Incremental_inputs_entry_data): Move to incremental.h
5967         * incremental.h: (Incremental_inputs_header_data,
5968         Incremental_inputs_entry_data): Move from incremental.cc
5969
5970 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5971
5972         * incremental.cc (Incremental_inputs_header,
5973         Incremental_inputs_header_write, Incremental_inputs_entry,
5974         Incremental_inputs_entry_write): Add a typedef with the data type.
5975
5976 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5977
5978         * incremental.cc (Incremental_inputs_header,
5979         Incremental_inputs_header_write, Incremental_inputs_entry,
5980         Incremental_inputs_entry_write): Update comment about which
5981         type has the filed descriptions.
5982
5983 2009-11-15  Doug Kwan  <dougkwan@google.com>
5984
5985         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5986         (Arm_relocate_functions::arm_branch_common): Change method defintion
5987         in class definition to a method declaration and update list of formal
5988         parameters.
5989         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5990         Arm_relocation_functions::jump24): Adjust call to
5991         Arm_relocate_functions::arm_branch_common.  Update list of formal
5992         parameters.
5993         (Arm_relocate_functions::xpc25): New method definition.
5994         (Arm_relocate_functions::arm_branch_common): Move method defintion
5995         out from class definition.  Use stubs for mode-switching and extending
5996         branch ranges.
5997         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5998         specially.  Change code to enable use of stubs in ARM branches.
5999
6000 2009-11-10  Doug Kwan  <dougkwan@google.com>
6001
6002         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6003         in method declaration.
6004         (Target_arm::relocate_stub): New method declaration.
6005         (Target_arm::default_target): Change to return a pointer instead of
6006         a const reference.
6007         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6008         Target_arm::default_target.
6009         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6010         method definition.
6011         (Target_arm::relocate_section): Adjust view.
6012         (Target_arm::relocate_stub): New method definition.
6013
6014 2009-11-10  Doug Kwan  <dougkwan@google.com>
6015
6016         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6017         a format warning.
6018         * incremental.cc (open_incremental_binary): Initialized local
6019         variables to avoid warnings.
6020         * object.cc (make_elf_object): Ditto.
6021         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6022         a format warning.
6023
6024 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6025
6026         PR gold/10930
6027         * testsuite/plugin_test.c: Include "config.h".
6028
6029 2009-11-09  Doug Kwan  <dougkwan@google.com>
6030
6031         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6032         (arm_symbol_value): Remove.
6033         (Arm_relocate_functions::arm_branch_common,
6034         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6035         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6036         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6037         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6038         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6039         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6040         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6041         Arm_relocate_functions::thm_mobw_abs_nc,
6042         Arm_relocate_functions::thm_mov_abs,
6043         Arm_relocate_functions::movw_prel_nc,
6044         Arm_relocate_functions::thm_movt_abs,
6045         Arm_relocate_functions::movt_prel,
6046         Arm_relocate_functions::thm_movw_prel_nc,
6047         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6048         (Target_arm::Relocate::relocate): Only decompose address into two
6049         parts if relocation type uses the thumb-bit and pass the actual
6050         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6051         calls to methods in Arm_relocate_functions for this change.
6052
6053 2009-11-08  Ian Lance Taylor  <iant@google.com>
6054
6055         PR 10925
6056         * reloc.cc: Instantiate
6057         Sized_relobj::initialize_input_to_output_maps and
6058         Sized_relobj:free_input_to_output_maps.
6059
6060 2009-11-06  Ian Lance Taylor  <iant@google.com>
6061
6062         PR 10876
6063         * defstd.cc (in_segment): Set only_if_ref true for "end".
6064
6065 2009-11-06  Doug Kwan  <dougkwan@google.com>
6066
6067         * arm.cc (class Reloc_stub): Correct a comment.
6068         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6069         (Target_arm::scan_section_for_stubs): New method declaration.
6070         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6071         Change methods from private to protected.
6072         (Target_arm::do_may_relax): New method definition.
6073         (Target_arm::do_relax, Target_arm::group_sections,
6074         Target_arm::scan_reloc_for_stub,
6075         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6076         (Target_arm::arm_input_section_map_): New data member declaration.
6077         (Target_arm::scan_reloc_for_stub,
6078         Target_arm::scan_reloc_section_for_stubs,
6079         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6080         Target_arm::do_relax): New method definitions.
6081
6082 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6083
6084         * configure.ac: Check for (struct stat)::st_mtim
6085         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6086         * config.in: Regenerate.
6087         * configure: Regenerate.
6088
6089 2009-11-05  Ian Lance Taylor  <iant@google.com>
6090
6091         PR 10910
6092         * output.cc (Output_segment::add_output_section): Add missing
6093         return statement.
6094
6095 2009-11-04  Ian Lance Taylor  <iant@google.com>
6096
6097         PR 10880
6098         * object.h (class Object): Add is_needed and set_is_needed
6099         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6100         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6101         defined in a dynamic object and referenced by a regular object,
6102         set is_needed for the dynamic object.
6103         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6104         if the file is marked with as_needed and it is not needed.
6105
6106 2009-11-04  Ian Lance Taylor  <iant@google.com>
6107
6108         PR 10887
6109         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6110         tags if data is discarded by linker script.
6111         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6112         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6113         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6114         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6115
6116 2009-11-04  Ian Lance Taylor  <iant@google.com>
6117
6118         * layout.cc (Layout::get_output_section): Add is_interp and
6119         is_dynamic_linker_section parameters.  Change all callers.
6120         (Layout::choose_output_section): Likewise.
6121         (Layout::make_output_section): Likewise.
6122         (Layout::add_output_section_data): Add is_dynamic_linker_section
6123         parameter.  Change all callers.
6124         * layout.h (class Layout): Update declarations.
6125         * output.h (class Output_section): Add is_interp, set_is_interp,
6126         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6127         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6128         generate_code_fills_at_write_ to a bitfield.
6129         * output.cc (Output_section::Output_sections): Initialize new
6130         fields.
6131         (Output_segment::add_output_section): Add do_sort parameter.
6132         Change all callers.
6133
6134 2009-11-03  Ian Lance Taylor  <iant@google.com>
6135
6136         PR 10860
6137         * options.h (class General_options): Add --warn-common.
6138         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6139         merging two common symbols.
6140         (Symbol_table::should_override): Handle --warn-common when merging
6141         a common symbol with a defined symbol.  Use report_resolve_problem
6142         for multiple definitions.
6143         (Symbol_table::report_resolve_problem): New function.
6144         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6145
6146 2009-11-03  Doug Kwan  <dougkwan@google.com>
6147
6148         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6149         stub_factory_.
6150         (Target_arm::stub_factory): New method definition.
6151         (Target_arm::new_arm_input_section,
6152         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6153         Target_arm::reloc_uses_thumb_bit): New method declarations.
6154         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6155         New type definitions.
6156         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6157         member declarations.
6158         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6159         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6160         New method definitions.
6161
6162 2009-11-03  Ian Lance Taylor  <iant@google.com>
6163
6164         * options.h (class General_options): Add --warn_constructors.
6165
6166 2009-11-03  Ian Lance Taylor  <iant@google.com>
6167
6168         PR 10893
6169         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6170         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6171
6172 2009-11-03  Ian Lance Taylor  <iant@google.com>
6173
6174         PR 10895
6175         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6176         --msgid-bugs-address.
6177         (install-pdf): New target.
6178         (install-data_yes): Look up one directory to find mkinstalldirs.
6179
6180 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6181
6182         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6183         tree.
6184
6185 2009-10-30  Doug Kwan  <dougkwan@google.com>
6186
6187         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6188
6189 2009-10-30  Doug Kwan  <dougkwan@google.com>
6190
6191         * arm.cc (Stub_addend_reader): New struct template definition
6192         and partial specializations.
6193         (Stub_addend_reader::operator()): New method definition for a
6194         partially specialized template.
6195
6196 2009-10-30  Doug Kwan  <dougkwan@google.com>
6197
6198         * arm.cc (Arm_relobj::processor_specific_flags): New method
6199         definition.
6200         (Arm_relobj::do_read_symbols): New method declaration.
6201         (Arm_relobj::processor_specific_flags_): New data member declaration.
6202         (Arm_dynobj): New class definition.
6203         (Target_arm::do_finalize_sections): Add input_objects parameter.
6204         (Target_arm::do_adjust_elf_header): New method declaration.
6205         (Target_arm::are_eabi_versions_compatible,
6206         (Target_arm::merge_processor_specific_flags): New method declaration.
6207         (Target_arm::do_make_elf_object): New overloaded method definitions
6208         and declaration.
6209         (Arm_relobj::do_read_symbols): New method definition.
6210         (Arm_dynobj::do_read_symbols): Ditto.
6211         (Target_arm::do_finalize_sections): Add input_objects parameters.
6212         Merge processor-specific flags from all input objects.
6213         (Target_arm::are_eabi_versions_compatible,
6214         Target_arm::merge_processor_specific_flags,
6215         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6216         New method definitions.
6217         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6218         Input_objects pointer type parameter.
6219         * layout.cc (Layout::finalize): Pass input objects to target's.
6220         finalize_sections function.
6221         * output.cc (Output_file_header::do_sized_write): Set ELF file
6222         header's processor-specific flags.
6223         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6224         Input_objects pointer type parameter.
6225         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6226         * target.h (Input_objects): New forward class declaration.
6227         (Target::processor_specific_flags,
6228         Target::are_processor_specific_flags_sect): New method definitions.
6229         (Target::finalize_sections): Add input_objects parameter.
6230         (Target::Target): Initialize processor_specific_flags_ and
6231         are_processor_specific_flags_set_.
6232         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6233         parameter.
6234         (Target::set_processor_specific_flags): New method definition.
6235         (Target::processor_specific_flags_,
6236         Target::are_processor_specific_flags_set_): New data member
6237         declarations.
6238         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6239         Input_objects pointer type parameter.
6240
6241 2009-10-30  Doug Kwan  <dougkwan@google.com>
6242
6243         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6244
6245 2009-10-28  Ian Lance Taylor  <iant@google.com>
6246
6247         * object.h (class Relobj): Drop options parameter from
6248         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6249         do_scan_relocs, do_relocate.  Change all callers.
6250         (class Sized_relobj): Drop options parameters from
6251         do_gc_process_relocs, do_scan_relocs, do_relocate,
6252         do_relocate_sections, relocate_sections, emit_relocs_scan,
6253         emit_relocs_scan_reltype.  Change all callers.
6254         (struct Relocate_info): Remove options field and all references to
6255         it.
6256         * reloc.h (class Read_relocs): Remove options constructor
6257         parameter and options_ field.  Change all callers.
6258         (class Gc_process_relocs, class Scan_relocs): Likewise.
6259         (class Relocate_task): Likewise.
6260         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6261         all callers.
6262         (scan_relocatable_relocs): Likewise.
6263         * target.h (class Sized_target): Remove options parameter from
6264         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6265         all callers.
6266         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6267         callers.
6268         * arm.cc: Update functions to remove options parameters.
6269         * i386.cc: Likewise.
6270         * powerpc.cc: Likewise.
6271         * sparc.cc: Likewise.
6272         * x86_64.cc: Likewise.
6273         * testsuite/testfile.cc: Likewise.
6274
6275 2009-10-28  Doug Kwan  <dougkwan@google.com>
6276
6277         * arm.cc (Arm_relobj): New class definition.
6278         (Arm_relobj::scan_sections_for_stubs,
6279         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6280         New method definitions.
6281
6282 2009-10-28  Cary Coutant  <ccoutant@google.com>
6283
6284         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6285         (Plugin::cleanup_done_): New member.
6286         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6287         (Plugin_manager::cleanup_done_): Remove.
6288         (Plugin_manager::add_input_file): Edit error message.
6289         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6290         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6291
6292 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6293
6294         * fileread.cc: (File_read::View::~View): Use the new
6295         data_ownership_ filed.
6296         (File_read::~File_read): Dispose the new whole_file_view_.
6297         (File_read::open): Mmap the whole file if needed.
6298         (File_read::open): Use whole_file_view_ instead of contents_.
6299         (File_read::find_view): Use whole_file_view_ if applicable.
6300         (File_read::do_read): Use whole_file_view_ instead of contents_.
6301         (File_read::make_view): Use whole_file_view_ instead of contents_,
6302         update File_read::View::View call.
6303         (File_read::find_or_make_view): Update File_read::View::View
6304         call.
6305         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6306         remove contents_
6307         (File_read::View::Data_ownership): New enum.
6308         (File_read::View::View): Replace bool mapped_ with Data_ownership
6309         argument.
6310         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6311         (File_read::View::data_ownership_): New field.
6312         (File_read::contents_): Remove (replaced by whole_file_view_).
6313         (File_read::whole_file_view_): New field.
6314         * options.h (class General_options): Add --keep-files-mapped.
6315
6316 2009-10-27  Cary Coutant  <ccoutant@google.com>
6317
6318         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6319         * testsuite/Makefile.am (plugin_test_5): New test case.
6320         * testsuite/Makefile.in: Regenerate.
6321
6322 2009-10-25  Doug Kwan  <dougkwan@google.com>
6323
6324         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6325         from private to protected to allow access by child class.
6326         (Sized_relobj::do_relocate_sections): New method declaration.
6327         (Sized_relobj::relocate_sections): Virtualize.
6328         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6329         Sized_relobj::relocate_sections.  Instantiate template explicitly
6330         for different target sizes and endianity.
6331
6332 2009-10-24  Doug Kwan  <dougkwan@google.com>
6333
6334         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6335         (Arm_input_section::as_arm_input_section): New method.
6336         (Arm_output_section): New class definition.
6337         (Arm_output_section::create_stub_group,
6338         Arm_output_section::group_sections): New method definitions.
6339
6340 2009-10-22  Doug Kwan  <dougkwan@google.com>
6341
6342         * arm.cc (Arm_input_section): New class definition.
6343         (Arm_input_section::init, Arm_input_section:do_write,
6344         Arm_input_section::set_final_data_size,
6345         Arm_input_section::do_reset_address_and_file_offset): New method
6346         definitions.
6347
6348 2009-10-21  Doug Kwan  <dougkwan@google.com>
6349
6350         * arm.cc (Stub_table, Arm_input_section): New forward class
6351         declarations.
6352         (Stub_table): New class defintion.
6353         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6354         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6355         New method definition.
6356
6357 2009-10-21  Doug Kwan  <dougkwan@google.com>
6358
6359         * arm.cc: Update copyright comments.
6360         (Target_arm): New forward class template declaration.
6361         (Arm_address): New type.
6362         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6363         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6364         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6365         constants.
6366         (Insn_template): Same.
6367         (DEF_STUBS): New macro.
6368         (Stub_type): New enum type.
6369         (Stub_template): New class definition.
6370         (Stub): Same.
6371         (Reloc_stub): Same.
6372         (Stub_factory): Same.
6373         (Target_arm::Target_arm): Initialize may_use_blx_ and
6374         should_force_pic_veneer_.
6375         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6376         Target_arm::should_force_pic_veneer,
6377         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6378         Target_arm::using_thumb_only, Target_arm:;default_target): New
6379         method defintions.
6380         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6381         New data member declarations.
6382         (Insn_template::size, Insn_template::alignment): New method defintions.
6383         (Stub_template::Stub_template): New method definition.
6384         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6385         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6386         (Stub_factory::Stub_factory): New method definition.
6387         * gold.h (string_hash): New template.
6388         * output.h (Input_section_specifier::hash_value): Use
6389         gold::string_hash.
6390         (Input_section_specifier::string_hash): Remove.
6391         * stringpool.cc (Stringpool_template::string_hash): Use
6392         gold::string_hash.
6393
6394 2009-10-20  Doug Kwan  <dougkwan@google.com>
6395
6396         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6397         symbols of relaxed input sections.
6398         * output.h (Output_section::find_relaxed_input_section): Make
6399         method public.
6400
6401 2009-10-16  Doug Kwan  <dougkwan@google.com>
6402
6403         * dynobj.cc (Versions::Versions): Initialize version_script_.
6404         Only insert base version symbol definition for a shared object
6405         if version script defines any version versions.
6406         (Versions::define_base_version): New method definition.
6407         (Versions::add_def): Check that base version is not needed.
6408         (Versions::add_need): Define base version lazily.
6409         * dynobj.h (Versions::define_base_version): New method declaration.
6410         (Versions::needs_base_version_): New data member declaration.
6411         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6412         (check_DATA): Add no_version_test.stdout.
6413         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6414         New make rules.
6415         * testsuite/Makefile.in: Regenerate.
6416         * testsuite/no_version_test.c: New file.
6417         * testsuite/no_version_test.sh: Ditto.
6418
6419 2009-10-16  Doug Kwan  <dougkwan@google.com>
6420
6421         * expression.cc (class Segment_start_expression): New class definition.
6422         (Segment_start_expression::value): New method definition.
6423         (script_exp_function_segment_start): Return a new
6424         Segment_start_expression.
6425         * gold/script-c.h (script_saw_segment_start_expression): New function
6426         prototype.
6427         * script-sections.cc (Script_sections::Script_sections): Initialize
6428         SAW_SEGMENT_START_EXPRESSION_ to false.
6429         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6430         and -Tbbs options to specify section addresses if given in
6431         command line and no SEGMENT_START expression is seen in a script.
6432         * script-sections.h (Script_sections::saw_segment_start_expression,
6433         Script_sections::set_saw_segment_start_expression): New method
6434         definition.
6435         (Script_sections::saw_segment_start_expression_): New data member
6436         declaration.
6437         * script.cc (script_saw_segment_start_expression): New function.
6438         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6439         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6440         script_test_7.sh and script_test_8.sh.
6441         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6442         script_test_8.stdout.
6443         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6444         (script_test_6, script_test_6.stdout, script_test_7,
6445         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6446         * Makefile.in: Regenerate.
6447         * testsuite/script_test_6.sh: New file.
6448         * testsuite/script_test_6.t: Same.
6449         * testsuite/script_test_7.sh: Same.
6450         * testsuite/script_test_7.t: Same.
6451         * testsuite/script_test_8.sh: Same.
6452
6453 2009-10-16  Doug Kwan  <dougkwan@google.com>
6454
6455         * output.cc (Output_segment::set_section_list_address): Cast
6456         expressions to unsigned long long type to avoid format warnings.
6457
6458 2009-10-15  Ian Lance Taylor  <iant@google.com>
6459
6460         * script.cc (Script_options::add_symbol_assignment): Always add a
6461         dot assignment to script_sections_.
6462         * script-sections.cc (Script_sections::add_dot_assignment):
6463         Initialize if necessary.
6464
6465         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6466         program headers with no load segment if there is a linker script.
6467
6468         * layout.cc (Layout::set_segment_offsets): Align the file offset
6469         to the segment aligment for -N or -n with no load segment.
6470         * output.cc (Output_segment::add_output_section): Don't crash if
6471         the first section is a TLS section.
6472         (Output_segment::set_section_list_addresses): Print an error
6473         message if the address moves backward in a linker script.
6474         * script-sections.cc
6475         (Output_section_element_input::set_section_addresses): Don't
6476         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6477         (Orphan_output_section::set_section_addresses): Likewise.
6478
6479 2009-10-15  Doug Kwan  <dougkwan@google.com>
6480
6481         * layout.cc (Layout::finish_dynamic_section): Generate tags
6482         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6483         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6484         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6485
6486 2009-10-14  Ian Lance Taylor  <iant@google.com>
6487
6488         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6489         fields.
6490         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6491         data_shdr fields of relinfo.
6492         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6493         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6494         R_386_TLS_LDO_32, adjust based on section flags.
6495         (Target_i386::Relocate::fix_up_ldo): Remove.
6496
6497 2009-10-13  Ian Lance Taylor  <iant@google.com>
6498
6499         Add support for -pie.
6500         * options.h (class General_options): Add -pie and
6501         --pic-executable.
6502         (General_options::output_is_position_independent): Test -pie.
6503         (General_options::output_is_executable): Return true if not shared
6504         and not relocatable.
6505         (General_options::output_is_pie): Remove.
6506         * options.cc (General_options::finalize): Reject incompatible uses
6507         of -pie.
6508         * gold.cc (queue_middle_tasks): A -pie link is not static.
6509         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6510         * symtab.cc (Symbol::final_value_is_known): Return false if
6511         output_is_position_independent.
6512         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6513         output_is_position_independent.
6514         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6515         output_is_position_independent.
6516         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6517         output_is_position_independent.
6518         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6519         two_file_pie_test.
6520         (basic_pie_test.o, basic_pie_test): New targets.
6521         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6522         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6523         (two_file_pie_test): New target.
6524         * testsuite/Makefile.in: Rebuild.
6525         * README: Remove note saying that -pie is not supported.
6526
6527 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6528
6529         * options.h (class General_options): Add -init and -fini.
6530         * layout.cc (Layout::finish_dynamic_section): Emit
6531         given init and fini functions.
6532
6533 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6534
6535         * gc.h (gc_process_relocs): Check if icf is enabled using new
6536         function.
6537         * gold.cc (queue_initial_tasks): Likewise.
6538         (queue_middle_tasks): Likewise.
6539         * object.cc (do_layout): Likewise.
6540         * symtab.cc (is_section_folded): Likewise.
6541         * main.cc (main): Likewise.
6542         * reloc.cc (Read_relocs::run): Likewise.
6543         (Sized_relobj::do_scan_relocs): Likewise.
6544         * icf.cc (is_function_ctor_or_dtor): New function.
6545         (Icf::find_identical_sections): Check if function is ctor or dtor when
6546         safe icf is chosen.
6547         * options.h (General_options::icf): Change option to be an enum.
6548         (Icf_status): New enum.
6549         (icf_enabled): New method.
6550         (icf_safe_folding): New method.
6551         (set_icf_status): New method.
6552         (icf_status_): New variable.
6553         * (options.cc) (General_options::finalize): Set icf_status_.
6554         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6555         icf_test and icf_keep_unique_test to use the --icf enum flag.
6556         * testsuite/icf_safe_test.sh: New file.
6557         * testsuite/icf_safe_test.cc: New file.
6558
6559 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6560
6561         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6562         includes to gc.h and icf.h.
6563         * arm.cc: Include gc.h.
6564         * gold.cc: Likewise.
6565         * i386.cc: Likewise.
6566         * powerpc.cc: Likewise.
6567         * sparc.cc: Likewise.
6568         * x86_64.cc: Likewise.
6569         * gc.h: Include icf.h.
6570
6571 2009-10-11  Ian Lance Taylor  <iant@google.com>
6572
6573         * plugin.cc: Include "gold.h" before other header files.
6574
6575 2009-10-10  Chris Demetriou  <cgd@google.com>
6576
6577         * options.h (Input_file_argument::Input_file_type): New enum.
6578         (Input_file_argument::is_lib_): Replace with...
6579         (Input_file_argument::type_): New member.
6580         (Input_file_argument::Input_file_argument): Take Input_file_type
6581         'type' rather than boolean 'is_lib' as second argument.
6582         (Input_file_argument::is_lib): Use type_.
6583         (Input_file_argument::is_searched_file): New function.
6584         (Input_file_argument::may_need_search): Handle is_searched_file.
6585         * options.cc (General_options::parse_library): Support -l:filename.
6586         (General_options::parse_just_symbols): Update for Input_file_argument
6587         changes.
6588         (Command_line::process): Likewise.
6589         * archive.cc (Archive::get_file_and_offset): Likewise.
6590         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6591         * script.cc (read_script_file, script_add_file): Likewise.
6592         * fileread.cc (Input_file::Input_file): Likewise.
6593         (Input_file::will_search_for): Handle is_searched_file.
6594         (Input_file::open): Likewise.
6595         * readsyms.cc (Read_symbols::get_name): Likewise.
6596         * testsuite/Makefile.am (searched_file_test): New test.
6597         * testsuite/Makefile.in: Regenerate.
6598         * testsuite/searched_file_test.cc: New file.
6599         * testsuite/searched_file_test_lib.cc: New file.
6600
6601 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6602             Ian Lance Taylor  <iant@google.com>
6603
6604         * descriptor.cc: Include <cstdio> and "binary-io.h".
6605         (Descriptors::open): Open the files in binary mode always.
6606         * script.cc (Lex::get_token): Treat \r as whitespace.
6607
6608 2009-10-09  Ian Lance Taylor  <iant@google.com>
6609
6610         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6611
6612 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6613             Ian Lance Taylor  <iant@google.com>
6614
6615         * configure.ac: Check for readv function also.
6616         * fileread.cc (readv): Define if not HAVE_READV.
6617         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6618         does not exist.
6619         * config.in: Regenerate.
6620         * configure: Regenerate.
6621
6622 2009-10-09  Doug Kwan  <dougkwan@google.com>
6623
6624         * layout.cc (Layout::make_output_section): Call target hook to make
6625         ordinary output section.
6626         (Layout::finalize): Adjust parameter list of call the
6627         Target::may_relax().
6628         * layout.h (class Layout::section_list): New method.
6629         * merge.h (Output_merge_base::entsize): Change visibility to public.
6630         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6631         New methods.
6632         (Output_merge_string::do_is_string): New method.
6633         * object.cc (Sized_relobj::do_setup): renamed from
6634         Sized_relobj::set_up.
6635         * object.h (Sized_relobj::adjust_shndx,
6636         Sized_relobj::initializ_input_to_output_maps,
6637         Sized_relobj::free_input_to_output_maps): Change visibilities to
6638         protected.
6639         (Sized_relobj::setup): Virtualize.
6640         (Sized_relobj::do_setup): New method declaration.
6641         (Sized_relobj::invalidate_section_offset,
6642         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6643         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6644         * options.cc (parse_int): New function.
6645         * options.h (parse_int): New declaration.
6646         (DEFINE_int): New macro.
6647         (stub_group_size): New option.
6648         * output.cc (Output_section::Output_section): Initialize memebers
6649         merge_section_map_, merge_section_by_properties_map_,
6650         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6651         (Output_section::add_input_section): Handled deferred code-fill
6652         generation and remove an old comment.
6653         (Output_section::add_relaxed_input_section): New method definition.
6654         (Output_section::add_merge_input_section): Use merge section by
6655         properties map to speed to search.  Update merge section maps
6656         as appropriate.
6657         (Output_section::build_relaxation_map): New method definition.
6658         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6659         Same.
6660         (Output_section::relax_input_section): Renamed to
6661         Output_section::convert_input_sections_to_relaxed_sections and change
6662         interface to take a vector of pointers to relaxed sections.
6663         (Output_section::find_merge_section,
6664         Output_section::find_relaxed_input_section): New method definitions.
6665         (Output_section::is_input_address_mapped,
6666         Output_section::output_offset, Output_section::output_address):
6667         Use output section data maps to speed up searching.
6668         (Output_section::find_starting_output_address): Add comments.
6669         (Output_section::do_write,
6670         Output_section::write_to_postprocessing_buffer): Do code-fill
6671         generation as appropriate.
6672         (Output_section::get_input_sections): Invalidate relaxed input section
6673         map.
6674         (Output_section::restore_states): Adjust type of checkpoint .
6675         Invalidate relaxed input section map.
6676         * output.h (Output_merge_base): New class declaration.
6677         (Input_section_specifier): New class defintion.
6678         (class Output_relaxed_input_section) Change base class to
6679         Output_section_data_build.
6680         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6681         base class initializer.
6682         (Output_section::add_relaxed_input_section): New method declaration.
6683         (Output_section::Input_section): Change visibility to protected.
6684         (Output_section::Input_section::relobj,
6685         Output_section::Input_section::shndx): Handle relaxed input sections.
6686         Output_section::input_sections) Change visibility to protected.  Also
6687         define overload to return a non-const pointer.
6688         (Output_section::Merge_section_properties): New class defintion.
6689         (Output_section::Merge_section_by_properties_map,
6690         Output_section::Output_section_data_by_input_section_map,
6691         Output_section::Relaxation_map): New types.
6692         (Output_section::relax_input_section): Rename method to
6693         Output_section::convert_input_sections_to_relaxed_sections and change
6694         interface to take a vector of relaxed section pointers.
6695         (Output_section::find_merge_section,
6696         Output_section::find_relaxed_input_section,
6697         Output_section::build_relaxation_map,
6698         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6699         New method declarations.
6700         (Output_section::merge_section_map_
6701         Output_section::merge_section_by_properties_map_,
6702         Output_section::relaxed_input_section_map_,
6703         Output_section::is_relaxed_input_section_map_valid_,
6704         Output_section::generate_code_fills_at_write_): New data members.
6705         * script-sections.cc
6706         (Output_section_element_input::set_section_addresses): Call
6707         current_data_size and addralign methods of relaxed input sections.
6708         (Orphan_output_section::set_section_addresses): Call current_data_size
6709         and addralign methods of relaxed input sections.
6710         * symtab.cc (Symbol_table::compute_final_value): Extract template
6711         from the body of Symbol_table::sized_finalize_symbol.
6712         (Symbol_table::sized_finalized_symbol): Call
6713         Symbol_table::compute_final_value.
6714         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6715         (Symbol_table::compute_final_value): New templated method declaration.
6716         * target.cc (Target::do_make_output_section): New method defintion.
6717         * target.h (Target::make_output_section): New method declaration.
6718         (Target::relax): Add more parameters for input objects, symbol table
6719         and layout.  Adjust call to do_relax.
6720         (Target::do_make_output_section): New method declaration.
6721         (Target::do_relax): Add parameters for input objects, symbol table
6722         and layout.
6723
6724 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6725
6726         * pread.c: Include stdio.h.
6727
6728 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6729
6730         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6731         defined.
6732
6733 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6734
6735         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6736         Change read_shndx type to unsigned int.
6737         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6738         int.
6739         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6740         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6741         Change read_shndx type to unsigned int.
6742         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6743         int.
6744         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6745         * layout.cc (Layout::create_symtab_sections): Cast the result of
6746         local_symcount * symsize to off_t in the gold_assert.
6747
6748 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6749
6750         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6751         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6752         R_ARM_BASE_ABS.
6753         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6754         (Arm_relocate_functions::thm_abs5): New function.
6755         (Arm_relocate_functions::abs12): New function.
6756         (Arm_relocate_functions::abs16): New function.
6757         (Arm_relocate_functions::base_abs): New function.
6758         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6759         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6760         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6761         R_ARM_BASE_ABS.
6762         (Scan::global): Likewise.
6763         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6764         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6765         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6766         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6767         R_ARM_BASE_ABS.
6768
6769 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6770
6771         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6772         (Arm_relocate_functions::movt_prel): New function.
6773         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6774         (Arm_relocate_functions::thm_movt_prel): New function.
6775         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6776         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6777         (Scan::global, Relocate::relocate): Likewise.
6778         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6779
6780 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6781
6782         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6783         Incremental_checker.
6784         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6785         unsigned int.
6786         (class Incremental_inputs_header): New class.
6787         (Incremental_inputs_header_writer): Edit comment.
6788         (Incremental_inputs_entry): New class.
6789         (Incremental_inputs_entry_writer): Edit comment.
6790         (Sized_incremental_binary::do_find_incremental_inputs_section):
6791         Add *strtab_shndx parameter, fill it.
6792         (Sized_incremental_binary::do_check_inputs): New method.
6793         (Incremental_checker::can_incrementally_link_output_file): Use
6794         Sized_incremental_binary::check_inputs.
6795         (Incremental_inputs::report_command_line): Save command line in
6796         command_line_.
6797         * incremental.h:
6798         (Incremental_binary::find_incremental_inputs_section): New
6799         method.
6800         (Incremental_binary::do_find_incremental_inputs_section): Add
6801         strtab_shndx parameter.
6802         (Incremental_binary::do_check_inputs): New pure virtual method.
6803         (Sized_incremental_binary::do_check_inputs): Declare.
6804         (Incremental_checker::Incremental_checker): Add incremental_inputs
6805         parameter, use it to initialize incremental_inputs_.
6806         (Incremental_checker::incremental_inputs_): New field.
6807         (Incremental_checker::command_line): New method.
6808         (Incremental_checker::inputs): New method.
6809         (Incremental_checker::command_line_): New field.
6810
6811 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6812
6813         * incremental.cc: Include <cstdarg> and "target-select.h".
6814         (vexplain_no_incremental): New function.
6815         (explain_no_incremental): New function.
6816         (Incremental_binary::error): New method.
6817         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6818         method.
6819         (make_sized_incremental_binary): New function.
6820         (open_incremental_binary): New function.
6821         (can_incrementally_link_file): Add checks if output is ELF and has
6822         inputs section.
6823         * incremental.h: Include "elfcpp_file.h" and "output.h".
6824         (Incremental_binary): New class.
6825         (Sized_incremental_binary): New class.
6826         (open_incremental_binary): Declare.
6827         * object.cc (is_elf_object): Use
6828         elfcpp::Elf_recognizer::is_elf_file.
6829         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6830         * output.h (Output_file::filesize): New method.
6831
6832 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6833
6834         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6835         New function.
6836         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6837         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6838         function.
6839         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6840         function.
6841         (Arm_relocate_functions::movw_abs_nc): New function.
6842         (Arm_relocate_functions::movt_abs): New function.
6843         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6844         (Arm_relocate_functions::thm_movt_abs): New function.
6845         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6846         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6847         (Scan::global): Likewise.
6848         (Relocate::relocate): Likewise.
6849         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6850
6851 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6852
6853         * arm.cc (Arm_relocate_functions::got_prel) New function.
6854         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6855         (Relocate::relocate): Likewise.
6856         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6857
6858 2009-10-06  Ian Lance Taylor  <iant@google.com>
6859
6860         * options.h (class General_options): Define
6861         split_stack_adjust_size parameter.
6862         * object.h (class Object): Add uses_split_stack_ and
6863         has_no_split_stack_ fields.  Add uses_split_stack and
6864         has_no_split_stack accessor functions.  Declare
6865         handle_split_stack_section.
6866         (class Reloc_symbol_changes): Define.
6867         (class Sized_relobj): Define Function_offsets.  Declare
6868         split_stack_adjust, split_stack_adjust_reltype, and
6869         find_functions.
6870         * object.cc (Object::handle_split_stack_section): New function.
6871         (Sized_relobj::do_layout): Call handle_split_stack_section.
6872         * dynobj.cc (Sized_dynobj::do_layout): Call
6873         handle_split_stack_section.
6874         * reloc.cc (Sized_relobj::relocate_sections): Call
6875         split_stack_adjust for executable sections in split_stack
6876         objects.  Pass reloc_map to relocate_section.
6877         (Sized_relobj::split_stack_adjust): New function.
6878         (Sized_relobj::split_stack_adjust_reltype): New function.
6879         (Sized_relobj::find_functions): New function.
6880         * target-reloc.h: Include "object.h".
6881         (relocate_section): Add reloc_symbol_changes parameter.  Change
6882         all callers.
6883         * target.h (class Target): Add calls_non_split method.  Declare
6884         do_calls_non_split virtual method.  Declare match_view and
6885         set_view_to_nop.
6886         * target.cc: Include "elfcpp.h".
6887         (Target::do_calls_non_split): New function.
6888         (Target::match_view): New function.
6889         (Target::set_view_to_nop): New function.
6890         * gold.cc (queue_middle_tasks): Give an error if mixing
6891         split-stack and non-split-stack objects with -r.
6892         * i386.cc (Target_i386::relocate_section): Add
6893         reloc_symbol_changes parameter.
6894         (Target_i386::do_calls_non_split): New function.
6895         * x86_64.cc (Target_x86_64::relocate_section): Add
6896         reloc_symbol_changes parameter.
6897         (Target_x86_64::do_calls_non_split): New function.
6898         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6899         parameter.
6900         * powerpc.cc (Target_powerpc::relocate_section): Add
6901         reloc_symbol_changes parameter.
6902         * sparc.cc (Target_sparc::relocate_section): Add
6903         reloc_symbol_changes parameter.
6904         * configure.ac: Call AM_CONDITIONAL for the default target.
6905         * configure: Rebuild.
6906         * testsuite/Makefile.am (TEST_AS): New variable.
6907         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6908         (check_DATA): Add split_i386 and split_x86_64 files.
6909         (SPLIT_DEFSYMS): Define.
6910         (split_i386_[1234n].o): New targets.
6911         (split_i386_[124]): New targets.
6912         (split_i386_[1234r].stdout): New targets.
6913         (split_x86_64_[1234n].o): New targets.
6914         (split_x86_64_[124]): New targets.
6915         (split_x86_64_[1234r].stdout): New targets.
6916         (MOSTLYCLEANFILES): Add new executables.
6917         * testsuite/split_i386.sh: New file.
6918         * testsuite/split_x86_64.sh: New file.
6919         * testsuite/split_i386_1.s: New file.
6920         * testsuite/split_i386_2.s: New file.
6921         * testsuite/split_i386_3.s: New file.
6922         * testsuite/split_i386_4.s: New file.
6923         * testsuite/split_i386_n.s: New file.
6924         * testsuite/split_x86_64_1.s: New file.
6925         * testsuite/split_x86_64_2.s: New file.
6926         * testsuite/split_x86_64_3.s: New file.
6927         * testsuite/split_x86_64_4.s: New file.
6928         * testsuite/split_x86_64_n.s: New file.
6929         * testsuite/testfile.cc (Target_test): Update relocation_section
6930         function.
6931         * testsuite/Makefile.in: Rebuild.
6932
6933 2009-10-06  Ian Lance Taylor  <iant@google.com>
6934
6935         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6936         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6937         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6938         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6939         the address on ldo_addrs_.
6940         (Target_i386::Relocate::fix_up_ldo): New function.
6941
6942 2009-10-06   Rafael Espindola  <espindola@google.com>
6943
6944         * plugin.cc (add_input_library): New.
6945         (Plugin::load): Add add_input_library to tv.
6946         (Plugin_manager::add_input_file): Add the is_lib argument.
6947         (add_input_file): Update call to Plugin_manager::add_input_file.
6948         (add_input_library): New.
6949         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6950
6951 2009-09-30  Doug Kwan  <dougkwan@google.com>
6952
6953         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6954         symbol and call Symbol::may_need_copy_reloc to determine if
6955         a copy reloc is needed.
6956         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6957         nocopyreloc is given in command line.
6958         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6959         given in command line.
6960         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6961         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6962         of the removed Target_i386::may_need_copy_reloc.
6963         * options.h (copyreloc): New option with default value false.
6964         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6965         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6966         instead of the removed Target_powerpc::may_need_copy_reloc.
6967         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6968         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6969         instead of the removed Target_sparc::may_need_copy_reloc.
6970         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6971         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6972         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6973         instead of the removed Target_x86_64::may_need_copy_reloc.
6974
6975 2009-09-30  Ian Lance Taylor  <iant@google.com>
6976
6977         * object.h (class Object): Remove target_ field, and target,
6978         sized_target, and set_target methods.
6979         (Object::sized_target): Remove.
6980         (class Sized_relobj): Update declarations.  Remove sized_target.
6981         * object.cc (Sized_relobj::setup): Remove target parameter.
6982         Change all callers.
6983         (Input_objects::add_object): Don't do anything with the target.
6984         (make_elf_sized_object): Add punconfigured parameter.  Change all
6985         callers.  Set or test parameter target.
6986         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6987         Change all callers.
6988         * parameters.cc (Parameters::set_target): Change parameter type to
6989         be non-const.
6990         (Parameters::default_target): Remove.
6991         (set_parameters_target): Change parameter type to be non-const.
6992         (parameters_force_valid_target): New function.
6993         (parameters_clear_target): New function.
6994         * parameters.h (class Parameters): Update declarations.  Remove
6995         default_target method.  Add sized_target and clear_target
6996         methods.  Change target_ to be non-const.
6997         (set_parameters_target): Update declaration.
6998         (parameters_force_valid_target): Declare.
6999         (parameters_clear_target): Declare.
7000         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7001         as NULL if we aren't searching.
7002         (Add_symbols::run): Don't check for compatible target.
7003         * fileread.cc (Input_file::open_binary): Call
7004         parameters_force_valid_target.
7005         * gold.cc (queue_middle_tasks): Likewise.
7006         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7007         set_target on object.
7008         * dynobj.h (class Sized_dynobj): Update declarations.
7009         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7010         make_elf_object returns NULL.
7011         (Archive::include_member): Don't check whether object target is
7012         compatible.
7013         * output.cc (Output_section::add_input_section): Get target from
7014         parameters.
7015         (Output_section::relax_input_section): Likewise.
7016         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7017         parameters.
7018         (Sized_relobj::do_scan_relocs): Likewise.
7019         (Sized_relobj::relocate_sections): Likewise.
7020         * resolve.cc (Symbol_table::resolve): Likewise.
7021         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7022         parameter.  Change all callers.
7023         (Symbol_table::add_from_object): Get target from parameters.
7024         (Symbol_table::add_from_relobj): Don't check object target.
7025         (Symbol_table::add_from_dynobj): Likewise.
7026         (Symbol_table::define_special_symbol): Get target from
7027         parameters.
7028         * symtab.h (class Symbol_table): Update declaration.
7029         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7030         parameter.  Change all callers.  Clear parameter target.
7031         (Binary_test): Test target here.
7032         * testsuite/object_unittest.cc (gold_testsuite): Remove
7033         target_test_pointer parameter.  Change all callers.
7034         (Object_test): Test target here.
7035
7036 2009-09-26  Ian Lance Taylor  <iant@google.com>
7037
7038         * testsuite/initpri1.c: Don't try to use constructor priorities if
7039         compiling with gcc before 4.3.
7040
7041 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7042
7043         * testsuite/retain_symbols_file_test.sh (check_present): Change
7044         output file name to retain_symbols_file_test.stdout.
7045         (check_absent): Likewise.
7046
7047 2009-09-18  Craig Silverstein  <csilvers@google.com>
7048
7049         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7050         * options.cc: Include <cerrno> and <fstream>.
7051         (General_options::finalize): Parse -retain-symbols-file tag.
7052         * options.h: New flag.
7053         (General_options): New method should_retain_symbol, new
7054         variable symbols_to_retain.
7055         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7056         should_retain_symbol map.
7057         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7058         * testsuite/Makefile.in: Regenerate.
7059         * testsuite/retain_symbols_file_test.sh: New file.
7060
7061 2009-09-18  Nick Clifton  <nickc@redhat.com>
7062
7063         * po/es.po: Updated Spanish translation.
7064
7065 2009-09-17  Doug Kwan  <dougkwan@google.com>
7066
7067         * debug.h (DEBUG_RELAXATION): New constant.
7068         (DEBUG_ALL): Add DEBUG_RELAXATION.
7069         (debug_string_to_enum): Add relaxation debug option.
7070         * layout.cc
7071         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7072         Layout::Relaxation_debug_check::read_sections,
7073         Layout::Relaxation_debug_check::read_sections): New method definitions.
7074         (Layout::Layout): Initialize data members
7075         record_output_section_data_from_scrips_,
7076         script_output_section_data_list_ and relaxation_debug_check_.
7077         (Layout::save_segments, Layout::restore_segments,
7078         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7079         Layout::relaxation_loop_body): New method definitions.
7080         (Layout::finalize): Support relaxation.  Move section layout code to
7081         Layout::relaxation_loop_body.
7082         (Layout::set_asection_address_from_script): Move code for orphan
7083         section placement out.
7084         (Layout::place_orphan_sections_in_script): New method definition.
7085         * layout.h (Output_segment_headers, Output_file_header):
7086         New forward class declarations.
7087         (Layout::~Layout): Define.
7088         (Layout::new_output_section_data_from_script): New method definition.
7089         (Layout::place_orphan_sections_in_script): New method declaration.
7090         (Layout::Segment_states): New type declaration.
7091         (Layout::save_segments, Layout::restore_segments,
7092         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7093         Layout::relaxation_loop_body): New method declarations.
7094         (Layout::Output_section_data_list): New type declaration.
7095         (Layout::Relaxation_debug_check): New class definition.
7096         (Layout::record_output_section_data_from_script_,
7097         Layout::script_output_section_data_list_, Layout::segment_states_,
7098         Layout::relaxation_debug_check_): New data members.
7099         * output.cc: (Output_section_headers::do_size): New method definition.
7100         (Output_section_headers::Output_section_headers): Move size
7101         computation to Output_section_headers::do_size.
7102         (Output_segment_headers::do_size): New method definition.
7103         (Output_file_header::Output_file_header): Move size computation to
7104         Output_file_header::do_size and call it.
7105         (Output_file_header::do_size): New method definition.
7106         (Output_data_group::Output_data_group): Adjust call to
7107         Output_section_data.
7108         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7109         (Output_symtab_xindex::do_write): Add array bound check.
7110         (Output_section::Input_section::print_to_mapfile): Handle
7111         RELAXED_INPUT_SECTION_CODE.
7112         (Output_section::Output_section): Initialize data member checkpoint_.
7113         (Output_section::~Output_section): Delete checkpoint object pointed
7114         by checkpoint_.
7115         (Output_section::add_input_section): Always add an Input_section if
7116         relaxing.
7117         (Output_section::add_merge_input_section): Add assert.
7118         (Output_section::relax_input_section): New method definition.
7119         (Output_section::set_final_data_size): Set load address to zero for
7120         an unallocated section.
7121         (Output_section::do_address_and_file_offset_have_reset_values):
7122         New method definition.
7123         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7124         Handle relaxed input section.
7125         (Output_section::sort_attached_input_sections): Checkpoint input
7126         section list lazily.
7127         (Output_section::get_input_sections): Change type of input_sections to
7128         list of Simple_input_section pointers.  Checkpoint input section list
7129         lazily.  Also handle relaxed input sections.
7130         (Output_section::add_input_section_for_script): Take a reference to
7131         a Simple_input_section object instead of Relobj pointer and section
7132         index as parameter.  Handle relaxed input sections.
7133         (Output_section::save_states, Output_section::restore_states): New
7134         method definitions.
7135         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7136         (Output_data::is_data_size_fixed): New method definition.
7137         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7138         if it is fixed.
7139         (Output_data::address_and_file_offset_have_reset_values): New method
7140         definition.
7141         (Output_data::do_address_and_file_offset_have_reset_values): New method
7142         definition.
7143         (Output_data::set_data_size): Check that data size is not fixed.
7144         (Output_data::fix_data_size): New method definition.
7145         (Output_data::is_data_size_fixed_): New data member.
7146         (Output_section_headers::set_final_data_size): New method definition.
7147         (Output_section_headers::do_size): New method declaration.
7148         (Output_segment_headers::set_final_data_size): New method definition.
7149         (Output_segment_headers::do_size): New method declaration.
7150         (Output_file_header::set_final_data_size)::New method definition.
7151         (Output_file_header::do_size)::New method declaration.
7152         (Output_section_data::Output_section_data): Add new parameter
7153         is_data_size_fixed and use it to fix data size.
7154         (Output_data_const::Output_data_const): Adjust call to base class
7155         constructor and fix data size.
7156         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7157         base class constructor and fix data size.
7158         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7159         base class constructor and fix data size.
7160         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7161         class constructor and fix data size.
7162         (Output_data_group::set_final_data_size): New method definition.
7163         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7164         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7165         class constructor and fix data size.
7166         (Output_relaxed_input_section): New class definition.
7167         (Output_section::Simple_input_section): New class definition.
7168         (Output_section::get_input_sections): Adjust parameter list.
7169         (Output_section::add_input_section_for_script): Same.
7170         (Output_section::save_states, Output_section::restore_states,
7171         Output_section::do_address_and_file_offset_have_reset_values,
7172         (Output_section::Input_section::Input_section): Handle
7173         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7174         Output_relaxed_input_section.
7175         (Output_section::Input_section::is_input_section,
7176         Output_section::Input_section::set_output_section): Handle relaxed
7177         input section.
7178         (Output_section::Input_section::is_relaxed_input_section,
7179         Output_section::Input_section::output_section_data,
7180         Output_section::Input_section::relaxed_input_section): New method
7181         definitions.
7182         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7183         value.
7184         (Output_section::Input_section::u1_): Update comments.
7185         (Output_section::Input_section::u2_): Add new union member poris.
7186         (Output_section::Checkpoint_output_section): New classs definition.
7187         (Output_section::relax_input_section): New method declaration.
7188         (Output_section::checkpoint_): New data member.
7189         (Output_segment): Update comments.
7190         (Output_segment::Output_segment): Un-privatize copy constructor.
7191         (Output_segment::operator=): Un-privatize.
7192         * script-sections.cc (Output_section_element::Input_section_list):
7193         Change element type to Output_section::Simple_input_section.
7194         (Output_section_element_dot_assignment::set_section_addresses):
7195         Register output section data for relaxation clean up.
7196         (Output_data_exression::Output_data_expression): Adjust call to base
7197         constructor to fix data size.
7198         (Output_section_element_data::set_section_addresses): Register
7199         Output_data_expression object for relaxation clean up.
7200         (struct Input_section_info): Replace Relobj pointer and section index
7201         pair with Output_section::Simple_input_section and Convert struct to a
7202         class.
7203         (Input_section_sorter::operator()): Adjust access to
7204         Input_section_info data member to use accessors.
7205         (Output_section_element_input::set_section_addresses): Use layout
7206         parameter.  Adjust code to use Output_section::Simple_input_section
7207         and Input_secction_info classes.  Register filler for relaxation
7208         clean up.
7209         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7210         and section index pair with Output_section::Simple_input_section
7211         class.  Adjust code accordingly.
7212         (Phdrs_element::release_segment): New method definition.
7213         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7214         segment list.
7215         (Script_sections::release_segments): New method definition.
7216         * gold/script-sections.h (Script_sections::release_segments): New
7217         method declaration.
7218         * gold/target.h (Target::may_relax, Target::relax,
7219         Target::do_may_relax, Target::do_relax): New method definitions.
7220
7221 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7222
7223         * arm.cc (has_signed_unsigned_overflow): New function.
7224         (Arm_relocate_functions::abs8): New function.
7225         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7226         (Target_arm::Scan::global): Likewise.
7227         (Target_arm::relocate::relocate): Likewise.
7228         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7229         Likewise.
7230
7231 2009-09-16  Cary Coutant  <ccoutant@google.com>
7232
7233         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7234         * testsuite/Makefile.in: Regenerate.
7235
7236 2009-09-11  Nick Clifton  <nickc@redhat.com>
7237
7238         * po/gold.pot: Updated by the Translation project.
7239
7240 2009-09-08  Cary Coutant  <ccoutant@google.com>
7241
7242         * output.cc (Output_file::open): Add execute permission to empty file.
7243         * testsuite/Makefile.am (permission_test): New test.
7244         * testsuite/Makefile.in: Regenerate.
7245
7246 2009-09-02  Ian Lance Taylor  <iant@google.com>
7247
7248         * output.cc (Output_file::resize): Call map_no_anonymous rather
7249         than map.
7250
7251 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7252
7253         * gold.cc: Include "incremental.h".
7254         (queue_initial_tasks): Call Incremental_checker methods.
7255         * incremental.cc: Include "output.h".
7256         (Incremental_checker::can_incrementally_link_output_file): New
7257         method.
7258         * incremental.h (Incremental_checker): New class.
7259
7260         * output.cc (Output_file::open_for_modification): New method.
7261         (Output_file::map_anonymous): Changed return type to bool.  Record
7262         map in base_ field.
7263         (Output_file::map_no_anonymous): New method, broken out of map.
7264         (Output_file::map): Use map_no_anonymous and map_anonymous.
7265         * output.h (class Output_file): Update declarations.
7266
7267 2009-08-24  Cary Coutant  <ccoutant@google.com>
7268
7269         * options.h (Command_line::Pre_options): New class.
7270         (Command_line::pre_options): New member.
7271         * options.cc (gold::options::ready_to_register): New variable.
7272         (One_option::register_option): Do nothing if not registering options.
7273         Assert if same short option registered twice.
7274         (General_options::General_options): Turn off option registration when
7275         done constructing.
7276         (Command_line::Pre_options::Pre_options): New constructor.
7277
7278 2009-08-24  Cary Coutant  <ccoutant@google.com>
7279
7280         * options.h (General_options::no_keep_memory): Remove incorrect
7281         short option.
7282
7283 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7284
7285         * Makefile.am (am__skiplex, am__skipyacc): New.
7286         * Makefile.in: Regenerate.
7287
7288 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7289
7290         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7291         (INCLUDES): ... this.
7292         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7293         (AM_CPPFLAGS): Renamed from ...
7294         (INCLUDE): ... this.
7295         * Makefile.in, testsuite/Makefile.in: Regenerate.
7296
7297         * Makefile.in: Regenerate.
7298         * aclocal.m4: Likewise.
7299         * config.in: Likewise.
7300         * configure: Likewise.
7301         * testsuite/Makefile.in: Likewise.
7302
7303         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7304         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7305         * Makefile.in: Regenerate.
7306         * testsuite/Makefile.in: Regenerate.
7307
7308 2009-08-19  Cary Coutant  <ccoutant@google.com>
7309
7310         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7311         symbols in shared libraries overridden by hidden or internal symbols
7312         in the main program.
7313
7314 2009-08-19  Chris Demetriou  <cgd@google.com>
7315
7316         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7317         checking source file names in error messages.
7318
7319 2009-08-18  Doug Kwan  <dougkwan@google.com>
7320
7321         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7322         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7323         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7324         an elfcpp::Ehdr as parameter.
7325         * object.cc (Object::set_target): Remove the version that looks up
7326         a target and sets it.
7327         (Sized_relobj::setup): Take a Target object instead of
7328         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7329         (make_elf_sized_object): Find target and ask target to
7330         make an ELF object.
7331         * object.h: (Object::set_target): Remove the version that looks up
7332         a target and sets it.
7333         (Sized_relobj::setup): Take a Target object instead of
7334         an elfcpp:Ehdr as parameter.
7335         * target.cc: Include dynobj.h.
7336         (Target::do_make_elf_object_implementation): New.
7337         (Target::do_make_elf_object): New.
7338         * target.h (Target::make_elf_object): New template declaration.
7339         (Target::do_make_elf_object): New method declarations.
7340         (Target::do_make_elf_object_implementation): New template declaration.
7341
7342 2009-08-14  Ian Lance Taylor  <iant@google.com>
7343
7344         * gold.h (FUNCTION_NAME): Define.
7345         (gold_unreachable): Use FUNCTION_NAME.
7346
7347 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7348
7349         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7350         symbol in the --keep-unique list is not found.
7351
7352 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7353
7354         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7355         been maked as --keep-unique.
7356         (Icf::unfold_section): New function.
7357         * icf.h (Icf::unfold_section): New function.
7358         * options.h (General_options::keep_unique): New option.
7359         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7360         * testsuite/Makefile.in: Regenerate.
7361         * testsuite/icf_keep_unique_test.sh: New file.
7362         * testsuite/icf_keep_unique_test.cc: New file.
7363
7364 2009-08-12  Cary Coutant  <ccoutant@google.com>
7365
7366         PR 10471
7367         * resolve.cc (Symbol_table::resolve): Check for references from
7368         dynamic objects to hidden and internal symbols.
7369         * testsuite/Makefile.am (hidden_test.sh): New test.
7370         * testsuite/Makefile.in: Regenerate.
7371         * testsuite/hidden_test.sh: New script.
7372         * testsuite/hidden_test_1.c: New test source.
7373         * testsuite/hidden_test_main.c: New test source.
7374
7375 2009-08-11  Doug Kwan  <dougkwan@google.com>
7376
7377         * arm.cc: Update comments.
7378         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7379         segment to locate the .ARM.exidx section if present.
7380
7381 2009-08-09  Doug Kwan  <dougkwan@google.com>
7382
7383         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7384         patch.
7385
7386 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7387         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7388         compiler warnings.
7389
7390 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7391
7392         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7393         valid tls_segment only for non-debug-section relocations.
7394         * testsuite/Makefile.am: Add gc_tls_test.
7395         * testsuite/Makefile.in: Regenerate.
7396         * testsuite/gc_tls_test.cc: New file.
7397         * testsuite/gc_tls_test.sh: New file.
7398
7399 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7400
7401         * icf.cc: New file.
7402         * icf.h: New file.
7403         * Makefile.am (CCFILES): Add icf.cc.
7404         (HFILES): Add icf.h
7405         * Makefile.in: Regenerate.
7406         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7407         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7408         section, symbol and addend information for the relocs.
7409         * gold.cc (queue_middle_tasks): Call identical code folding.
7410         * gold.h: Add defines for multimap.
7411         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7412         to the call of finalize_local_symbols.
7413         * main.cc (main): Create object of class Icf.
7414         * object.cc (Sized_relobj::do_layout): Allow this function to be
7415         called twice during icf.
7416         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7417         to sections marked as identical by icf.
7418         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7419         when available.
7420         (Sized_relobj::do_section_entsize): New function.
7421         * object.h (Object::section_entsize): New function.
7422         (Object::do_section_entsize): New pure virtual function.
7423         (Relobj::finalize_local_symbols): Add new parameter.
7424         (Relobj::do_section_entsize): New function.
7425         * options.h (General_options::icf): New option.
7426         (General_options::icf_iterations): New option.
7427         (General_options::print_icf_sections): New option.
7428         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7429         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7430         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7431         icf.
7432         * symtab.cc (Symbol_table::is_section_folded): New function.
7433         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7434         to sections marked as identical by icf.
7435         * symtab.h (Symbol_table::set_icf): New function.
7436         (Symbol_table::icf): New function.
7437         (Symbol_table::is_section_folded): New function.
7438         (Symbol_table::icf_): New data member.
7439         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7440         * testsuite/Makefile.am: Add commands to build icf_test.
7441         * testsuite/Makefile.in: Regenerate.
7442         * testsuite/icf_test.sh: New file.
7443         * testsuite/icf_test.cc: New file.
7444
7445 2009-07-24  Chris Demetriou  <cgd@google.com>
7446
7447         * layout.cc (is_compressible_debug_section): Fix incorrect
7448         comment about compressed section names.
7449
7450 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7451
7452         PR 10419
7453         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7454
7455 2009-07-16  Ian Lance Taylor  <iant@google.com>
7456
7457         PR 10400
7458         * layout.h: #include <map>.
7459         (class Kept_section): Change from struct to class.  Add accessors
7460         and setters.  Add section size to Comdat_group mapping.  Change
7461         Comdat_group to std::map.  Add is_comdat_ field.  Add
7462         linkonce_size field in union.
7463         (class Layout): Update declaration of find_or_add_kept_section.
7464         Don't declare find_kept_object.
7465         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7466         parameter.  Add object, shndx, is_comdat, and is_group_name
7467         parameters.  Change all callers.  Adjust for new Kept_section.
7468         (Layout::find_kept_object): Remove.
7469         * object.cc (Sized_relobj::include_section_group): Update use of
7470         Kept_section.  Rename secnum to shndx.  Only record
7471         Kept_comdat_section if sections are the same size.
7472         (Sized_relobj::include_linkonce_section): Update use of
7473         Kept_section.  Only record Kept_comdat_section if sections are the
7474         same size.  Set size of linkonce section.
7475         (Sized_relobj::map_to_kept_section): Update call to
7476         get_kept_comdat_section.
7477         * object.h (class Sized_relobj): Rename fields in
7478         Kept_comdat_section to drop trailing underscores; change object
7479         field to Relobj*.  Change Kept_comdat_section_table to store
7480         struct rather than pointer.
7481         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7482         Add kept_object and kept_shndx parameters.  Change all callers.
7483         (Sized_relobj::get_kept_comdat_section): Change return type to
7484         bool.  Add kept_object and kept_shndx parameters.  Change all
7485         callers.
7486         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7487         Layout::find_or_add_kept_section.
7488
7489 2009-07-09  Ian Lance Taylor  <iant@google.com>
7490
7491         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7492         Reserve space in the hash table.
7493
7494 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7495
7496         * fileread.cc (File_read::get_mtime): New method.
7497         * fileread.h (Timespec): New structure.
7498         (File_read::get_mtime): New method.
7499         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7500         Renamed from timestamp_nsec.
7501         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7502         Elf_Xword.
7503         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7504         timestamp_nsec.
7505         (Incremental_inputs::report_archive): Save mtime; style fix.
7506         (Incremental_inputs::report_obejct): Save mtime; style fix.
7507         (Incremental_inputs::report_script): Save mtime; style fix.
7508         (Incremental_inputs::finalize_inputs): Style fix.
7509         (Incremental_inputs::finalize): Style fix.
7510         (Incremental_inputs::create_input_section_data): Store inputs
7511         mtime.
7512         * incremental.h (Incremental_inputs::report_script): Add mtime
7513         argument.
7514         (Incremental_inputs::Input_info::Input_info): Intialize only one
7515         union member.
7516         (Incremental_inputs::Input_info::archive): Move to nameless
7517         union.
7518         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7519         (Incremental_inputs::Input_info::script): Move to nameless union.
7520         (Incremental_inputs::mtime): New field.
7521         * script.cc (read_input_script): Pass file mtime to
7522         Incremental_input.
7523         * script.h (Script_info::inputs): Style fix.
7524
7525 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7526
7527         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7528         instead of 32.
7529
7530 2009-06-24  Ian Lance Taylor  <iant@google.com>
7531
7532         PR 10156
7533         * layout.cc (Layout::choose_output_section): If we find an
7534         existing section, update the flags.
7535         (Layout::create_notes): New function, broken out of
7536         Layout::finalize.
7537         (Layout::finalize): Don't create note sections.
7538         (Layout::create_note): Don't crash if linker script discards
7539         section.
7540         (Layout::create_gold_note): Likewise.
7541         (Layout::create_build_id): Likewise.  Don't set
7542         after_input_sections on the section.
7543         (Layout::create_executable_stack_info): Remove target parameter.
7544         Change caller.
7545         * layout.h (class Layout): Declare create_notes.  Update
7546         declaration of create_executable_stack_info.
7547         * gold.cc (queue_middle_tasks): Call create_notes.
7548         * output.cc (Output_section::update_flags_for_input_section): Move
7549         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7550         invalid.
7551         * output.h (Output_data::mark_address_invalid): New function.
7552         (class Output_section): Only declare, not define,
7553         update_flags_for_input_section.  Remove set_flags.
7554
7555 2009-06-24  Ian Lance Taylor  <iant@google.com>
7556
7557         * script-sections.cc (Output_section_definition::
7558         set_section_addresses): Rename shadowing local load_address to
7559         laddr.
7560
7561 2009-06-24  Ian Lance Taylor  <iant@google.com>
7562
7563         PR 10244
7564         * reloc.cc (relocate_sections): Skip empty relocation sections.
7565
7566 2009-06-23  Ian Lance Taylor  <iant@google.com>
7567
7568         PR 10156
7569         * layout.cc (Layout::create_note): Use choose_output_section
7570         rather than make_output_section.
7571
7572 2009-06-23  Ian Lance Taylor  <iant@google.com>
7573
7574         PR 10237
7575         * options.cc (General_options::parse_V): Set printed_version_.
7576         (General_options::General_options): Initialize printed_version_.
7577         * options.h (class General_options): Add printed_version_ field.
7578         * gold.cc (queue_initial_tasks): If there are no input files,
7579         don't give a fatal error if we printed the version information.
7580         (queue_middle_tasks): If using -r with a shared object, give a
7581         fatal error rather than an ordinary error.
7582
7583 2009-06-23  Ian Lance Taylor  <iant@google.com>
7584
7585         PR 10219
7586         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7587         (Layout::make_output_section): Set have_stabstr_section_ if we see
7588         a .stab*str section.
7589         (Layout::finalize): Call link_stabs_sections.
7590         (Layout::link_stabs_sections): New file.
7591         * layout.h (class Layout): Add have_stabstr_section_ field.
7592         Declare link_stabs_sections.
7593
7594 2009-06-23  Doug Kwan  <dougkwan@google.com>
7595
7596         * Makefile.am (libgold_a_LIBADD): New.
7597         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7598         * Makefile.in: Regenerate.
7599         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7600         * configure: Regenerate.
7601         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7602         * fileread.cc: Include sys/state.h
7603         * gold.h: Declare memmem and strndup if found missing.
7604         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7605
7606 2009-06-23  Ian Lance Taylor  <iant@google.com>
7607
7608         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7609         * configure: Rebuild.
7610
7611 2009-06-23  Ian Lance Taylor  <iant@google.com>
7612
7613         PR 10147
7614         * object.cc (Object::section_contents): Don't try to get a view if
7615         the section has length zero.
7616         (Object::handle_gnu_warning_section): If the section is empty, use
7617         the name of the section as the warning.
7618
7619 2009-06-23  Ian Lance Taylor  <iant@google.com>
7620
7621         PR 10133
7622         * stringpool.h (class Stringpool_template): Add optimize_ field.
7623         (Stringpool_template::set_optimize): New function.
7624         * stringpool.cc (Stringpool_template::Stringpool_template):
7625         Initialize optimize_ field.
7626         (Stringpool_template::set_string_offsets): Test local optimize
7627         fild rather than parameter.
7628         * layout.cc (Layout::Layout): Call set_optimize on the section
7629         name stringpool.
7630
7631 2009-06-22  Ian Lance Taylor  <iant@google.com>
7632
7633         PR 10030
7634         * yyscript.y: Parse TARGET.
7635         * script.cc (script_set_target): New function.
7636         * script-c.h (script_set_target): Declare.
7637         * options.cc (General_options::string_to_object_format): Rename
7638         from string_to_object_format in anonymous namespace.  Change
7639         callers.
7640         * options.h (class General_options): Declare
7641         string_to_object_format.
7642
7643 2009-06-22  Ian Lance Taylor  <iant@google.com>
7644
7645         * script-sections.cc (Script_sections::create_segments): Don't put
7646         program headers in a PT_LOAD segment if -n or -N.
7647
7648 2009-06-22  Ian Lance Taylor  <iant@google.com>
7649
7650         PR 10141
7651         * options.h (class General_options): Add -z lazy and -z now.  Sort
7652         -z options into alphabetical order.
7653         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7654
7655 2009-06-21  Ian Lance Taylor  <iant@google.com>
7656
7657         * layout.cc (Layout::make_output_section): Call
7658         Target::new_output_section.
7659         (Layout::attach_allocated_section_to_segment): Put large section
7660         sections in a separate load segment with the large segment flag
7661         set.
7662         (Layout::segment_precedes): Sort large data segments after other
7663         load segments.
7664         (align_file_offset): New static function.
7665         (Layout::set_segment_offsets): Use align_file_offset.
7666         * output.h (class Output_section): Add is_small_section_ and
7667         is_large_section_ fields.
7668         (Output_section::is_small_section): New function.
7669         (Output_section::set_is_small_section):  New function.
7670         (Output_section::is_large_section): New function.
7671         (Output_section::set_is_large_section): New function.
7672         (Output_section::is_large_data_section): New function.
7673         (class Output_segment): Add is_large_data_segment_ field.
7674         (Output_segment::is_large_data_segment): New function.
7675         (Output_segment::set_is_large_data_segment): New function.
7676         * output.cc (Output_section::Output_section): Initialize new
7677         fields.
7678         (Output_segment::Output_segment): Likewise.
7679         (Output_segment::add_output_section): Add assertion that large
7680         data sections always go in large data segments.  Force small data
7681         sections to the end of the list of data sections.  Force small BSS
7682         sections to the start of the list of BSS sections.  For large BSS
7683         sections to the end of the list of BSS sections.
7684         * symtab.h (class Symbol): Declare is_common_shndx.
7685         (Symbol::is_defined): Check Symbol::is_common_shndx.
7686         (Symbol::is_common): Likewise.
7687         (class Symbol_table): Define enum Commons_section_type.  Update
7688         declarations.  Add small_commons_ and large_commons_ fields.
7689         * symtab.cc (Symbol::is_common_shndx): New function.
7690         (Symbol_table::Symbol_table): Initialize new fields.
7691         (Symbol_table::add_from_object): Put small and large common
7692         symbols in the right list.
7693         (Symbol_table::sized_finalized_symbol): Check
7694         Symbol::is_common_shndx.
7695         (Symbol_table::sized_write_globals): Likewise.
7696         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7697         common symbol lists.  Don't call do_allocate_commons_list if the
7698         list is empty.
7699         (Symbol_table::do_allocate_commons_list): Remove is_tls
7700         parameter.  Add comons_section_type parameter.  Change all
7701         callers.  Handle small and large common symbols.
7702         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7703         Symbol::is_common_shndx.
7704         * resolve.cc (symbol_to_bits): Likewise.
7705         * target.h (Target::small_common_shndx): New function.
7706         (Target::small_common_section_flags): New function.
7707         (Target::large_common_shndx): New function.
7708         (Target::large_common_section_flags): New function.
7709         (Target::new_output_section): New function.
7710         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7711         small_common_section_flags, and large_common_section_flags
7712         fields.
7713         (Target::do_new_output_section): New virtual function.
7714         * arm.cc (Target_arm::arm_info): Initialize new fields.
7715         * i386.cc (Target_i386::i386_info): Likewise.
7716         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7717         Likewise.
7718         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7719         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7720         (Target_x86_64::do_new_output_section): New function.
7721         * configure.ac: Define conditional MCMODEL_MEDIUM.
7722         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7723         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7724         (large_LDFLAGS): Define.
7725         * testsuite/large.c: New file.
7726         * testsuite/testfile.cc (Target_test::test_target_info):
7727         Initialize new fields.
7728         * configure, testsuite/Makefile.in: Rebuild.
7729
7730 2009-06-05  Doug Kwan  <dougkwan@google.com>
7731
7732         * Makefile.am (CCFILES): Add target.cc.
7733         * Makefile.in: Regenerate.
7734         * i386.cc (class Target_i386): Define new virtual method to
7735         override do_is_local_label_name in parent.
7736         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7737         local symbols if --discard-locals or -X is given.
7738         * options.h (class General_options): Declare new options
7739         '--discard-locals' and '-X' for discarding locals.
7740         * target.h (class Target): Define new methods is_local_label_name.
7741         Declare new virtual method do_is_local_label_name.
7742         * target.cc: New file.
7743         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7744         (check_SCRIPTS): Add discard_locals_test.sh.
7745         (check_DATA): Add discard_local_tests.syms.
7746         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7747         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7748         * testsuite/Makefile.in: Regenerate.
7749         * testsuite/discard_locals_test.c: New file.
7750         * testsuite/discard_locals_test.sh: Same.
7751
7752 2009-06-05  Doug Kwan  <dougkwan@google.com>
7753
7754         * object.cc (Sized_relobj::Sized_relobj): Initialize
7755         discarded_eh_frame_shndx_ to -1U.
7756         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7757         section.
7758         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7759         a discarded .eh_frame section.
7760         (Sized_relobj::do_finalize_local_symbols): Ditto.
7761         * object.h (class Sized_relobj): Declare new member
7762         discarded_eh_frame_shndx_.
7763         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7764         (local_labels_test.o, local_labels_test): New rules.
7765         * testsuite/Makefile.in: Regenerate.
7766
7767 2009-06-04  Doug Kwan  <dougkwan@google.com>
7768
7769         * layout.cc (Layout::section_name_mapping): Add mapping for
7770         special ARM sections.
7771
7772 2009-06-03  Doug Kwan  <dougkwan@google.com>
7773
7774         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7775         (utils::has_overflow): Same.
7776
7777 2009-06-03  Ian Lance Taylor  <iant@google.com>
7778
7779         * layout.cc (Layout::section_name_mapping): New array, replacing
7780         Layout::linkonce_mapping.
7781         (Layout::section_name_mapping_count): New variable, replacing
7782         Layout::linkonce_mapping_count.
7783         (Layout::linkonce_output_name): Remove.
7784         (Layout::output_section_name): Rewrite.
7785         * layout.h (class Layout): Rename Linkonce_mapping to
7786         Section_name_mapping, linkonce_mapping to section_name_mapping,
7787         linkonce_mapping_count to section_name_mapping_count.  Don't
7788         declare linkonce_output_name.
7789
7790 2009-06-03  Doug Kwan  <dougkwan@google.com>
7791
7792         * gold/arm.cc (namespace utils): New.
7793         (Target_arm::reloc_is_non_pic): Define new method.
7794         (class Arm_relocate_functions): New.
7795         (Target_arm::Relocate::relocate): Handle relocation types used by
7796         Android.
7797
7798 2009-06-03  Ian Lance Taylor  <iant@google.com>
7799
7800         * arm.cc (Target_arm::scan::global): Use || instead of |.
7801
7802 2009-06-02  Doug Kwan  <dougkwan@google.com>
7803
7804         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7805         issued_non_pic_error_.
7806         (class Target_arm::Scan): Declare new method check_non_pic.
7807         Define new method symbol_needs_plt_entry.
7808         Declare new data member issued_non_pic_error_.
7809         (class Target_arm::Relocate): Declare new method
7810         should_apply_static_reloc.
7811         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7812         (Target_arm::Scan::check_non_pic): Define new method.
7813         (Target_arm::Scan::local): Handle a small subset of reloc types used
7814         by Android.
7815         (Target_arm::Scan::local): Same.
7816         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7817
7818 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7819
7820         * incremental.cc (Incremental_inputs::report_command_line): Filter
7821         out --incremental-* options.
7822
7823 2009-05-29  Doug Kwan  <dougkwan@google.com>
7824
7825         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7826         template class.
7827         (class Target_arm): Update comment.
7828         (Target_arm::Target_arm): Initialize new data members GOT_,
7829         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7830         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7831         and Target_arm::rel_dyn_section.
7832         Declare new_enum Target_arm::Got_type.
7833         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7834         and DYNBSS_.
7835         Update commments for member do_dynsym_value.
7836         (Target_arm::got_size, Target_arm::plt_section,
7837         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7838         new methods inside class defintion.
7839         (Target_arm::got_section): Define new method.
7840         (Target_arm::rel_dyn_section): Same.
7841         (Output_data_plt_arm): New template class.
7842         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7843         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7844         (Output_data_plt_arm::add_entry): Same.
7845         (Output_data_plt_arm::first_plt_entry): Define new
7846         static data member for PLT instruction template.
7847         (Output_data_plt_arm::plt_entry): Same.
7848         (Output_data_plt_arm::do_write): Define new method.
7849         (Target_arm::make_plt_entry): Same.
7850         (Target_arm::do_finalize_sections): Same.
7851         (Target_arm::do_dynsym_value): Same.
7852
7853 2009-05-28  Doug Kwan  <dougkwan@google.com>
7854
7855         * Makefile.am (TARGETSOURCES): Add arm.cc.
7856         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7857         * Makefile.in: Regenerate.
7858         * arm.cc: New file.
7859         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7860
7861 2009-05-26  Doug Kwan  <dougkwan@google.com>
7862
7863         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7864         (General_options::check_excluded_libs): Strip off directories in
7865         archive name before matching like GNU ld does.
7866         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7867         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7868         (exclude_libs_test_LDFLAGS): Add linker option
7869         -Wl,--exclude-libs,libexclude_libs_test_3
7870         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7871         an explicit archive without using -l.
7872         (alt/libexclude_libs_test_3.a): New make rule.
7873         * testsuite/Makefile.in: Regenerate.
7874         * testsuite/exclude_libs_test.c : Declare lib3_default().
7875         (main): Call it.
7876         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7877         * exclude_libs_test_3.c: New file.
7878
7879 2009-05-26  Nick Clifton  <nickc@redhat.com>
7880
7881         * po/id.po: New Indonesian translation.
7882         * po/gold.pot: Updated template file.
7883
7884 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7885
7886         * testsuite/Makefile.am: Add -ffunction-sections to compile
7887         gc_comdat_test files.  Add -Wl,--gc-sections to build
7888         gc_comdat_test.
7889         * testsuite/Makefile.in: Regenerate.
7890         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7891
7892 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7893
7894         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7895         kept comdat section was garbage collected.
7896         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7897         * testsuite/Makefile.in: Regenerate.
7898         * testsuite/gc_comdat_test.sh: New file.
7899         * testsuite/gc_comdat_test_1.cc: New file.
7900         * testsuite/gc_comdat_test_2.cc: New file.
7901
7902 2009-05-19  Doug Kwan  <dougkwan@google.com>
7903
7904         * archive.cc (Archive::Archive): Move constructor from archive.h
7905         to here.  Initialize no_export_.
7906         (Archive::get_elf_object_for_member): Set no_export flag of object.
7907         * archive.h (Archive::Archive): Move constructor body to
7908         archive.cc.
7909         (Archive::no_export): New method.
7910         (Archive::no_export_): New field.
7911         * object.h (Object::Object): Initialize no_export_ to false.
7912         (Object::no_export, Object::set_no_export): New methods.
7913         (Object::no_export_): New field.
7914         * options.cc (General_options::parse_exclude_libs): New method.
7915         (General_options::check_excluded_libs) Same.
7916         * options.h (exclude_libs): New option.
7917         (General_options::check_excluded_libs): New method declaration.
7918         (General_options::excluded_libs_): New field.
7919         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7920         default or protected visibility if an object has no-export flag set.
7921         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7922         (check_SCRIPTS): Add exclude_libs_test.sh.
7923         (check_DATA): Add exclude_libs_test.syms.
7924         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7925         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7926         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7927         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7928         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7929         libexclude_libs_test_2.a): New rules.
7930         * testsuite/Makefile.in: Regenerate.
7931         * testsuite/exclude_libs_test.c: New file.
7932         * testsuite/exclude_libs_test.sh: Ditto.
7933         * testsuite/exclude_libs_test_1.c: Ditto.
7934         * testsuite/exclude_libs_test_2.c: Ditto.
7935
7936 2009-05-15  Ian Lance Taylor  <iant@google.com>
7937
7938         * configure.ac: Check for declarations for cases where libiberty.h
7939         checks HAVE_DECL_xxx.
7940         * configure, config.in: Rebuild.
7941
7942 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7943
7944         * gold.h (Incremental_argument_list): Remove (invalid) forward
7945         declaration.
7946         * incremental.cc (Incremental_inputs::report_achive): New method.
7947         (Incremental_inputs::report_object): New method.
7948         (Incremental_inputs::report_script): New method.
7949         (Incremental_inputs::finalize_inputs): New method.
7950         (Incremental_inputs::finalize): Call finalize_inputs().
7951         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7952         Create inputs entries.
7953         * incremental.h (Incremental_input_type): New enum.
7954         (Incremental_inputs::Incremental_input): Initialize new fields.
7955         (Incremental_inputs::report_inputs): New method.
7956         (Incremental_inputs::report_achive): New method.
7957         (Incremental_inputs::report_object): New method.
7958         (Incremental_inputs::report_script): New method.
7959         (Incremental_inputs::finalize_inputs): New method.
7960         (Incremental_inputs::Input_info): New struct.
7961         (Incremental_inputs::Input_info_map): New typedef.
7962         (Incremental_inputs::lock_): New field.
7963         (Incremental_inputs::Inputs_): New field.
7964         (Incremental_inputs::Inputs_map): New field.
7965         * main.cc (main): Call Incremental_input::report_inputs.
7966         * options.h (Input_argument_list): Typedef moved from
7967         Input_arguments.
7968         (Input_file_group::Files): Remove, use ::Input_argument_list.
7969         (Input_file_group::Input_argument_list): Remove, use
7970         ::Input_argument_list.
7971         * plugin.cc (Plugin_manager::add_input_file): Add error in
7972         incremental build.
7973         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7974         functions.
7975         * script.cc (read_input_script): Call
7976         Incremental_input::report_script.
7977         * script.h (Script_info): New class.
7978
7979 2009-04-27  Ian Lance Taylor  <iant@google.com>
7980
7981         * x86_64.cc (do_adjust_output_section): Set entsize to
7982         plt_entry_size.
7983
7984 2009-04-23  Elliott Hughes  <enh@google.com>
7985
7986         * output.cc (Output_file::close): After short writes, continue
7987         writing from the correct offset in the buffer being written.
7988
7989 2009-04-23  Chris Demetriou  <cgd@google.com>
7990
7991         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7992         * configure: Regenerate.
7993         * config.in: Regenerate.
7994         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7995         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7996
7997 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7998
7999         * incremental.cc (Incremental_inputs_header_data): Renamed from
8000         Incremental_input_header_data.
8001         (Incremental_inputs_header_data::data_size): New field.
8002         (Incremental_inputs_header_data::put_input_file_count): Renamed
8003         from input_file_count.
8004         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8005         from command_line_offset.
8006         (Incremental_inputs_header_data::put_reserved): Renamed from
8007         put_reserved.
8008         (Incremental_inputs_entry_data): Renamed from
8009         Incremental_input_entry_data.
8010         (Incremental_inputs_entry_data::data_size): New field.
8011         (Incremental_inputs::report_command_line): New method.
8012         (Incremental_inputs::finalize): New method.
8013         (Incremental_inputs::create_incremental_inputs_data): New method.
8014         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8015         * incremental.h: New file.
8016         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8017        (Layout::finalize): Create incremental inputs section in
8018         incremental builds.
8019        (Layout::create_incremental_info_sections): New method.
8020         * layout.h (Layout::incremental_inputs): New method.
8021        (Layout::create_incremental_info_sections): New method.
8022        (Layout::incremental_inputs_): New field.
8023         * main.cc (main): Notify Incremental_input of the command line.
8024
8025 2009-04-01  Ian Lance Taylor  <iant@google.com>
8026             Mikolaj Zalewski  <mikolajz@google.com>
8027
8028         * gold.h (reserve_unordered_map): Define, three versions, one for
8029         each version of Unordered_map.
8030         * layout.cc (Layout::Layout): Remove options parameter.  Add
8031         number_of_input_files parameter.  Don't initialize options_.
8032         Initialize number_of_input_files_ and resized_signatures_.  Move
8033         sections_are_attached_.
8034         (Layout::layout_group): Reserve space for group_signatures_.
8035         (Layout::find_or_add_kept_section): Change name parameter to be a
8036         reference.  Resize signatures_ map when it gets large enough.
8037         (Layout::layout_eh_frame): Use parameters->options() instead of
8038         this->options_.
8039         (Layout::make_output_section): Likewise.
8040         (Layout::attach_allocated_section_to_segment): Likewise.
8041         (Layout::finalize, Layout::create_executable_stack): Likewise.
8042         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8043         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8044         * layout.h (class Layout): Update declarations.  Remove options_
8045         field.  Add number_of_input_files_ and resized_signatures_
8046         fields.  Move sections_are_attached_ field.
8047         * main.cc (main): Pass number of input files to Layout
8048         constructor.  Don't pass options.
8049
8050 2009-03-30  Ian Lance Taylor  <iant@google.com>
8051
8052         * ffsll.c (ffsll): Correct implementation.
8053
8054 2009-03-27  Ian Lance Taylor  <iant@google.com>
8055
8056         * ffsll.c: New file.
8057         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8058         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8059         * ftruncate.c (ftruncate): Declare before definition.
8060         * mremap.c (mremap): Likewise.
8061         * pread.c (pread): Likewise.
8062         * configure, Makefile.in, config.in: Rebuild.
8063
8064         * mremap.c: New file.
8065         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8066         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8067         (mremap): Declare if HAVE_MREMAP is not defined.
8068         * configure, Makefile.in, config.in: Rebuild.
8069
8070 2009-03-27  Cary Coutant  <ccoutant@google.com>
8071
8072         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8073         position independent.
8074         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8075         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8076
8077 2009-03-24  Cary Coutant  <ccoutant@google.com>
8078
8079         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8080         an executable.
8081         (needs_dynamic_reloc): Likewise.
8082
8083 2009-03-24  Ian Lance Taylor  <iant@google.com>
8084
8085         * yyscript.y (file_cmd): Recognize EXTERN.
8086         (extern_name_list, extern_name_list_body): New nonterminals.
8087         * script.cc (script_add_extern): Define.
8088         * script-c.h (script_add_extern): Declare.
8089
8090 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8091
8092         * object.cc (is_elf_object): Define.
8093         * object.h (is_elf_object): Declare.
8094         * archive.cc (Archive::get_elf_object_for_member): Call
8095         is_elf_object.
8096         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8097
8098 2009-03-24  Elliott Hughes  <enh@google.com>
8099
8100         * output.cc (Output_file::map_anonymous): Define.
8101         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8102         try an anonymous one.  Report the size if the mmap fails.
8103         * output.h (class Output_file): Declare map_anonymous.
8104
8105 2009-03-24  Ian Lance Taylor  <iant@google.com>
8106
8107         * target-select.cc (instantiate_target): Don't acquire the lock if
8108         the instantiated_target_ field has already been set.
8109
8110 2009-03-23  Ian Lance Taylor  <iant@google.com>
8111
8112         * gold-threads.h (class Initialize_lock): Define.
8113         * gold-threads.cc (class Initialize_lock_once): Define.
8114         (initialize_lock_control): New static variable.
8115         (initialize_lock_pointer): New static variable.
8116         (initialize_lock_once): New static function.
8117         (Initialize_lock::Initialize_lock): Define.
8118         (Initialize_lock::initialize): Define.
8119         * target-select.h: Include "gold-threads.h".
8120         (class Target_selector): Add lock_ and initialize_lock_ fields.
8121         Don't define instantiate_target, just declare it.
8122         * target-select.cc (Target_selector::Target_selector): Initialize
8123         new fields.
8124         (Target_selector::instantiate_target): Define.
8125         * descriptors.h: Include "gold-threads.h".
8126         (class Descriptors): Add initialize_lock_ field.
8127         * descriptors.cc (Descriptors::Descriptors): Initialize new
8128         field.
8129         (Descriptors::open): Use initialize_lock_ field
8130         * errors.h (class Errors): Add initialize_lock_ field.
8131         * errors.cc (Errors::Errors): Initialize new field.
8132         (Errors::initialize_lock): Use initialize_lock_ field.
8133         * powerpc.cc (class Target_selector_powerpc): Remove
8134         instantiated_target_ field.  In do_recognize call
8135         instantiate_target rather than do_instantiate_target.  In
8136         do_instantiate_target just allocate a new target.
8137         * sparc.cc (class Target_selector_sparc): Likewise.
8138
8139         * freebsd.h: New file.
8140         * i386.cc: Include "freebsd.h".
8141         (Target_i386): Derive from Target_freebsd rather than
8142         Sized_target.
8143         (Target_selector_i386): Derive from Target_selector_freebsd rather
8144         than Target_selector.
8145         * x86_64.cc: Include "freebsd.h".
8146         (Target_x86_64): Derive from Target_freebsd rather than
8147         Sized_target.
8148         (Target_selector_x86_64): Derive from Target_selector_freebsd
8149         rather than Target_selector.
8150         * target.h (class Target): Add adjust_elf_header and
8151         do_adjust_elf_header.
8152         * output.cc (Output_file_header:: do_sized_write): Call target
8153         adjust_elf_header routine.
8154         * configure.tgt: Set targ_osabi.
8155         * configure.ac: Define GOLD_DEFAULT_OSABI.
8156         * parameters.cc (Parameters::default_target): Pass
8157         GOLD_DEFAULT_OSABI to select_target.
8158         * target-select.h (class Target_selector): Make instantiate_target
8159         protected rather than private.
8160         * Makefile.am (HFILES): Add freebsd.h.
8161         * configure, Makefile.in, config.in: Rebuild.
8162
8163         * merge.cc (do_add_input_section): Correct pend value.  Change
8164         message about last entry not being null terminated from error to
8165         warning.
8166
8167 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8168
8169         * incremental.cc: New file.
8170         * Makefile.am (CCFILES): Add incremental.cc.
8171         * Makefile.in: Rebuild.
8172
8173 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8174
8175         * layout.cc (Layout::output_section_name): Preserve names
8176         of '.note.' sections.
8177
8178 2009-03-19  Ian Lance Taylor  <iant@google.com>
8179
8180         * descriptors.cc (Descriptors::open): Check that the options are
8181         valid before using them.
8182
8183 2009-03-18  Ian Lance Taylor  <iant@google.com>
8184
8185         * script-sections.h: Include <list>.
8186         (class Script_sections): Change Sections_elements from std::vector
8187         to std::list.  Typedef public Elements_iterator.  Add
8188         orphan_section_placement_, data_segment_align_start_, and
8189         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8190         field.
8191         * script-sections.cc (class Orphan_section_placement): New class.
8192         (class Sections_element): Add virtual functions is_relro and
8193         orphan_section_init.  Remove virtual function place_orphan_here.
8194         (class Output_section_definition): Add is_relro and
8195         orphan_section_init.  Remove place_orphan_here.
8196         (class Orphan_output_section): Likewise.
8197         (Script_sections::Script_sections): Update for field changes.
8198         (Script_sections::data_segment_align): Set saw_data_segment_align_
8199         and data_segment_align_start_, not data_segment_align_index.
8200         (Script_sections::data_segment_relro_end): Check
8201         saw_data_segment_align_.  Use data_segment_align_start_ rather
8202         than data_segment_align_index_.
8203         (Script_sections::place_orphan): Rewrite to use
8204         Orphan_section_placement.
8205
8206 2009-03-17  Ian Lance Taylor  <iant@google.com>
8207
8208         * archive.cc (Archive::add_symbols): Check for a version attached
8209         to the symbol name in the archive map.
8210         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8211         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8212         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8213         (ver_test_11.a): New target.
8214         * testsuite/Makefile.in: Rebuild.
8215
8216         * configure.ac: Check for chsize and posix_fallocate.  Replace
8217         ftruncate.
8218         * ftruncate.c: New file, from gnulib.
8219         * output.cc (posix_fallocate): Define dummy version if not
8220         HAVE_POSIX_FALLOCATE.
8221         (Output_file::map): Call posix_fallocate rather than lseek and
8222         write.
8223         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8224         * configure, Makefile.in, config.in: Rebuild.
8225
8226 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8227
8228         * layout.h (Layout::create_note): Add section_name parameter.
8229         * layout.cc (Layout::create_note): Likewise.
8230         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8231
8232 2009-03-17  Ian Lance Taylor  <iant@google.com>
8233
8234         * descriptors.cc: Include "options.h".
8235         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8236         (Descriptors::open): Always use O_CLOEXEC when opening a new
8237         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8238         then set FD_CLOEXEC.
8239
8240         * sparc.cc (class Target_sparc): Add has_got_section.
8241         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8242         make sure we have a GOT section.
8243
8244         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8245         (Target_sparc::Scan::local): Likewise.
8246         (Target_sparc::Scan::global): Likewise.
8247         (Target_sparc::Relocate::relocate): Likewise.
8248         (Target_sparc::Relocate::relocate_tls): Likewise.
8249
8250         * symtab.cc (Symbol_table::define_default_version): New function,
8251         broken out of add_from_object.
8252         (Symbol_table::add_from_object): Call define_default_version.
8253         (Symbol_table::define_special_symbol): Add resolve_oldsym
8254         parameter.  Change all callers.  If the version for a symbol comes
8255         from a version script, resolve it with the symbol with the same
8256         name with no version.  Also add the symbol without a version if
8257         appropriate.
8258         (do_define_in_output_data): If resolving with oldsym, don't delete
8259         sym.
8260         (do_define_in_output_segment): Likewise.
8261         (do_define_as_constant): Likewise.
8262         * symtab.h (class Symbol_table): Update declarations.
8263
8264 2009-03-13  Ian Lance Taylor  <iant@google.com>
8265
8266         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8267         (Read_symbols::requeue): New function.
8268         (Read_symbols::do_read_symbols): If make_elf_object fails because
8269         the target type is not configured, and the file was searched for,
8270         issue a warning and retry with the next directory.
8271         (Add_symbols::run): If the file has an incompatible format, and
8272         it was searched for, requeue the Read_symbols task.  On error,
8273         release the object.
8274         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8275         dirindex parameter to constructor.  Change all callers.  Declare
8276         incompatible_warning and requeue.
8277         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8278         input_argument_ and input_group_ fields.  Add them to
8279         constructor.  Change all callers.
8280         (class Read_script): Add dirindex_ field.  Add it to constructor.
8281         Change all callers.
8282         * archive.cc (Archive::setup): Remove input_objects parameter.
8283         Change all callers.
8284         (Archive::get_file_and_offset): Likewise.
8285         (Archive::read_all_symbols): Likewise.
8286         (Archive::read_symbols): Likewise.
8287         (Archive::get_elf_object_for_member): Remove input_objects
8288         parameter.  Add punconfigured parameter.  Change all callers.
8289         (Archive::add_symbols): Change return type to bool.  Check return
8290         value of include_member.
8291         (Archive::include_all_members): Likewise.
8292         (Archive::include_member): Change return type to bool.  Return
8293         false if first included object has incompatible target.  Set
8294         included_member_ field.
8295         (Add_archive_symbols::run): If add_symbols returns false, requeue
8296         Read_symbols task.
8297         * archive.h (class Archive): Add included_member_ field.
8298         Initialize it in constructor.  Add input_file and searched_for
8299         methods.  Update declarations.
8300         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8301         input_argument_ fields.  Add them to constructor.  Change all
8302         callers.
8303         * script.cc: Include "target-select.h".
8304         (class Parser_closure): Add skip_on_incompatible_target_ and
8305         found_incompatible_target_ fields.  Add
8306         skip_on_incompatible_target parameter to constructor.  Change all
8307         callers.  Add methods skip_on_incompatible_target,
8308         clear_skip_on_incompatible_target, found_incompatible_target, and
8309         set_found_incompatible_target.
8310         (read_input_script): Add dirindex parameter.  Change all callers.
8311         If parser finds an incompatible target, requeue Read_symbols
8312         task.
8313         (script_set_symbol): Clear skip_on_incompatible_target in
8314         closure.
8315         (script_add_assertion, script_parse_option): Likewise.
8316         (script_start_sections, script_add_phdr): Likewise.
8317         (script_check_output_format): New function.
8318         * script.h (read_input_script): Update declaration.
8319         * script-c.h (script_check_output_format): Declare.
8320         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8321         (ignore_cmd): Remove OUTPUT_FORMAT.
8322         * fileread.cc (Input_file::Input_file): Add explicit this.
8323         (Input_file::will_search_for): New function.
8324         (Input_file::open): Add pindex parameter.  Change all callers.
8325         * fileread.h (class Input_file): Add input_file_argument method.
8326         Declare will_search_for.  Update declarations.
8327         * object.cc (make_elf_object): Add punconfigured parameter.
8328         Change all callers.
8329         * object.h (class Object): Make input_file public.  Add
8330         searched_for method.
8331         (make_elf_object): Update declaration.
8332         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8333         restart search.
8334         * dirsearch.h (class Dirsearch): Update declaration.
8335         * options.h (class General_options): Add --warn-search-mismatch.
8336         * parameters.cc (Parameters::is_compatible_target): New function.
8337         * parameters.h (class Parameters): Declare is_compatible_target.
8338         * workqueue.cc (Workqueue::add_blocker): New function.
8339         * workqueue.h (class Workqueue): Declare add_blocker.
8340
8341         * fileread.cc (Input_file::open): Remove options parameter.
8342         Change all callers.
8343         (Input_file::open_binary): Likewise.
8344         * script.cc (read_input_script): Likewise.
8345         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8346         options parameter from constructor.  Change all callers.
8347         (class Read_script): Likewise.
8348         * fileread.h (class Input_file): Update declarations.
8349         * script.h (read_input_script): Update declaration.
8350
8351 2009-03-10  Nick Clifton  <nickc@redhat.com>
8352
8353         * po/es.po: New Spanish translation.
8354
8355 2009-03-06  Cary Coutant  <ccoutant@google.com>
8356
8357         * options.cc (parse_short_option): Keep dash_z from registering itself.
8358
8359 2009-03-03  Ian Lance Taylor  <iant@google.com>
8360
8361         PR 9918
8362         * target-reloc.h (relocate_section): Pass output_section to
8363         relocate.
8364         * i386.cc (Target_i386::should_apply_static_reloc): Add
8365         output_section parameter.  Change all callers.
8366         (Target_i386::Relocate::relocate): Add output_section parameter.
8367         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8368         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8369         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8370         * testsuite/two_file_shared.sh: New script.
8371         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8372         (check_DATA): Add two_file_shared.dbg.
8373         (two_file_shared.dbg): New target.
8374         * testsuite/Makefile.in: Rebuild.
8375
8376 2009-03-01  Ian Lance Taylor  <iant@google.com>
8377
8378         * configure.ac: Check for byteswap.h.
8379         * configure: Rebuild.
8380         * config.in: Rebuild.
8381
8382 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8383
8384         * layout.cc (Layout::find_or_add_kept_section): New function.
8385         (Layout::add_comdat): Removed.
8386         * layout.h (struct Kept_section): Move out of class Layout.
8387         Remove trailing underscores from field names.  Add group_sections
8388         field.  Rename group_ field to is_group.  Change all uses.
8389         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8390         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8391         comdat_groups_ field.
8392         (Sized_relobj::include_section_group): Use
8393         find_or_add_kept_section and Kept_section::group_sections.
8394         (Sized_relobj::include_linkonce_section): Likewise.
8395         * object.cc (class Sized_relobj): Don't define Comdat_group or
8396         Comdat_group_table.  Remove find_comdat_group and
8397         add_comdat_group.  Remove comdat_groups_ field.
8398         * plugin.cc (include_comdat_group): Use
8399         Layout::find_or_add_kept_section.
8400
8401 2009-02-28  Ian Lance Taylor  <iant@google.com>
8402
8403         * README: --gc-sections and map files are now supported.  Document
8404         some build requirements.
8405
8406         PR 6992
8407         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8408         relocatable link set the value of the section symbol to zero.
8409         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8410         relocatable link don't include the section address in the local
8411         symbol value.
8412
8413 2009-02-27  Ian Lance Taylor  <iant@google.com>
8414
8415         PR 6811
8416         * options.h (class Search_directory): Add is_system_directory.
8417         (class General_options): Declare is_in_system_directory.
8418         * options.cc (get_relative_sysroot): Make static.
8419         (get_default_sysroot): Make static.
8420         (General_optoins::is_in_system_directory): New function.
8421         * fileread.cc (Input_file::is_in_system_directory): New function.
8422         * fileread.h (class Input_file): Declare is_in_system_directory.
8423         * object.h (class Object): Add is_in_system_directory.
8424         (class Input_objects): Remove system_library_directory_ field.
8425         * object.cc (Input_objects::add_object): Don't set
8426         system_library_directory_.
8427         (input_objects::found_in_system_library_directory): Remove.
8428         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8429         parameter.  Change all callers.
8430         (Symbol_table::sized_write_globals): Likewise.
8431         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8432         Call Object::is_in_system_directory.
8433         * symtab.h (class Symbol_table): Update declarations.
8434
8435         PR 5990
8436         * descriptors.h (Open_descriptor): Add is_on_stack field.
8437         * descriptors.cc (Descriptors::open): If the descriptor is on the
8438         top of the stack, remove it.  Initialize is_on_stack field.
8439         (Descriptors::release): Only add pod to stack if it is not on the
8440         stack already.
8441         (Descriptors::close_some_descriptor): Clear stack_next and
8442         is_on_stack fields.
8443
8444         PR 7091
8445         * output.cc (Output_section::find_starting_output_address): Rename
8446         from starting_output_address; add PADDR parameter; change return
8447         type.
8448         * output.h (class Output_section): Declare
8449         find_starting_output_address instead of starting_output_address.
8450         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8451         section symbol for which we can't find a merge section.
8452
8453         PR 9836
8454         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8455         hidden or internal, force the symbol to be local.
8456         * resolve.cc (Symbol::override_visibility): Define.
8457         (Symbol::override_base): Use override_visibility.
8458         (Symbol_table::resolve): Likewise.
8459         (Symbol::override_base_with_special): Likewise.
8460         (Symbol_table::override_with_special): If the visibility is hidden
8461         or internal, force the symbol to be local.
8462         * symtab.h (class Symbol): Add set_visibility and
8463         override_visibility.
8464         * testsuite/ver_test_1.sh: New file.
8465         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8466         (check_DATA): Add ver_test_1.syms.
8467         (ver_test_1.syms): New target.
8468         * testsuite/Makefile.in: Rebuild.
8469
8470 2009-02-25  Cary Coutant  <ccoutant@google.com>
8471
8472         * layout.cc (Layout::choose_output_section): Don't rename sections
8473         when using a linker script that has a SECTIONS clause.
8474         * Makefile.in: Regenerate.
8475
8476         * testsuite/Makefile.am (script_test_5.sh): New test case.
8477         * testsuite/Makefile.in: Regenerate.
8478         * testsuite/script_test_5.cc: New file.
8479         * testsuite/script_test_5.sh: New file.
8480         * testsuite/script_test_5.t: New file.
8481
8482 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8483
8484         * archive.cc (Archive::include_member): Update calls to add_symbols.
8485         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8486         the Layout argument.
8487         * dynobj.h (do_add_symbols): Add the Layout argument.
8488         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8489         Layout argument.
8490         * object.h (Object::add_symbols): Add the Layout argument.
8491         (Object::do_add_symbols): Add the Layout argument.
8492         (Sized_relobj::do_add_symbols): Add the Layout argument.
8493         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8494         Unify the two versions.
8495         (Add_plugin_symbols): Remove.
8496         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8497         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8498         (Add_plugin_symbols): Remove.
8499         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8500         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8501         (Add_symbols::run): Make it work with Pulginobj.
8502
8503 2009-02-06  Ian Lance Taylor  <iant@google.com>
8504
8505         * object.cc (Sized_relobj::do_layout): Make info message start
8506         with lower case letter.
8507
8508 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8509
8510         * binary.cc: Fix file comment.
8511
8512         * options.h (enum Incremental_disposition): Define.
8513         (class General_options): Add new options: --incremental,
8514         --incremental_changed, --incremental_unchanged,
8515         --incremental_unknown.  Add incremental_disposition_ and
8516         implicit_incremental_ fields.
8517         (General_options::incremental_disposition): New function.
8518         (class Position_dependent_options): Add incremental_disposition
8519         option.
8520         (Position_dependent_options::copy_from_options): Set incremental
8521         dispositions.
8522         * options.cc (General_options::parse_incremental_changed): New
8523         function.
8524         (General_options::parse_incremental_unchanged): New function.
8525         (General_options::parse_incremental_unknown): New function.
8526         (General_options::General_options): Initialize new fields
8527         incremental_disposition_ and implicit_incremental_.
8528         (General_options::finalize): Check for uasge of --incremental-*
8529         without --incremental.
8530
8531 2009-02-06  Chris Demetriou  <cgd@google.com>
8532
8533         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8534         pointer and to report location as the file name associated with
8535         the symbol.
8536         (gold_undefined_symbol_at_location): New function to replace the
8537         old gold_undefined_symbol functionality.
8538         * target-reloc.h (relocate_section): Update to use
8539         gold_undefined_symbol_at_location.
8540         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8541         Call gold_undefined_symbol function rather than gold_error.
8542         * errors.h (Errors::undefined_symbol): Take location as a
8543         string, rather than calculating it from a relocation.
8544         * errors.cc (Errors::fatal): Print "fatal error:" before the
8545         formatted message.
8546         (Errors::error, Errors::error_at_location): Print "error: "
8547         before the formatted message.
8548         (Errors::undefined_symbol): Take location as a string, rather
8549         than calculating it from a relocation.
8550         (gold_undefined_symbol_at_location): New function akin to
8551         old gold_undefined_symbol, calculates location from relocation.
8552         (gold_undefined_symbol): Change to take only a Symbol pointer
8553         and to report location as the file name associated with the symbol.
8554         * testsuite/debug_msg.sh: Update for changed error messages.
8555         * testsuite/undef_symbol.sh: Likewise.
8556
8557 2009-02-04  Duncan Sands  <baldrick@free.fr>
8558
8559         PR 9812
8560         * reduced_debug_output.h
8561         (Output_reduced_debug_abbrev_section::failed): Use format for
8562         gold_warning.
8563         (Output_reduced_debug_info_section::faild): Likewise.
8564
8565 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8566
8567         * script.cc (Lazy_demangler): New class.
8568         (Version_script_info::get_symbol_version_helper): Demangle a
8569         symbol only once.
8570
8571 2009-01-29  Cary Coutant  <ccoutant@google.com>
8572
8573         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8574         to __tls_get_addr.
8575         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8576
8577 2009-01-28  Ian Lance Taylor  <iant@google.com>
8578
8579         * version.cc (version_string): Bump to 1.9.
8580
8581         * gold.h: Include <cstring> and <stdint.h>.
8582         * version.cc: Include <cstdio>.
8583         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8584         warning.
8585         * reduced_debug_output.cc (insert_into_vector): Rename from
8586         Insert_into_vector; change all callers.  Use Swap_unaligned to
8587         avoid aliasing issue; remove union since it is unnecessary.
8588
8589 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8590
8591         * Makefile.am (CCFILES): Add gc.cc.
8592         (HFILES): Add gc.h.
8593         * Makefile.in: Regenerate.
8594         * gold.cc (Gc_runner): New class.
8595         (queue_initial_tasks): Call garbage collection related tasks
8596         when corresponding options are invoked.
8597         (queue_middle_gc_tasks): New function.
8598         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8599         processed early before laying out sections during garbage collection.
8600         * gold.h (queue_middle_gc_tasks): New function.
8601         (is_prefix_of): Move from "layout.cc".
8602         * i386.cc (Target_i386::gc_process_relocs): New function.
8603         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8604         * main.cc (main): Create object of class "Garbage_collection".
8605         * object.cc (Relobj::copy_symbols_data): New function.
8606         (Relobj::is_section_name_included): New function.
8607         (Sized_relobj::do_layout): Allow this function to be called twice
8608         during garbage collection and defer layout of section during the
8609         first call.
8610         * object.h (Relobj::get_symbols_data): New function.
8611         (Relobj::is_section_name_included): New function.
8612         (Relobj::copy_symbols_data): New function.
8613         (Relobj::set_symbols_data): New function.
8614         (Relobj::get_relocs_data): New function.
8615         (Relobj::set_relocs_data): New function.
8616         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8617         (Relobj::gc_process_relocs): New function.
8618         (Relobj::do_gc_process_relocs): New pure virtual function.
8619         (Relobj::sd_): New data member.
8620         (Sized_relobj::is_output_section_offset_invalid): New function.
8621         (Sized_relobj::do_gc_process_relocs): New function.
8622         * options.h (General_options::gc_sections): Modify to not be a no-op.
8623         (General_options::print_gc_sections): New option.
8624         * plugin.cc (Plugin_finish::run): Remove function call to
8625         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8626         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8627         * reloc.cc (Read_relocs::run): Add task to process relocs and
8628         determine unreferenced sections when doing garbage collection.
8629         (Gc_process_relocs): New class.
8630         (Sized_relobj::do_gc_process_relocs): New function.
8631         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8632         sections that are garbage collected.
8633         * reloc.h (Gc_process_relocs): New class.
8634         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8635         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8636         symbols whose corresponding sections are garbage collected.
8637         (Symbol_table::Symbol_table): Add new parameter for the garbage
8638         collection object.
8639         (Symbol_table::gc_mark_undef_symbols): New function.
8640         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8641         (Symbol_table::gc_mark_dyn_syms): New function.
8642         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8643         as garbage.
8644         (Symbol_table::add_from_object): Likewise.
8645         (Symbol_table::add_from_relobj): When building shared objects, do not
8646         treat externally visible symbols as garbage.
8647         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8648         table information for static and relocatable links.
8649         * symtab.h (Symbol_table::set_gc): New function.
8650         (Symbol_table::gc): New function.
8651         (Symbol_table::gc_mark_undef_symbols): New function.
8652         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8653         (Symbol_table::gc_mark_dyn_syms): New function.
8654         (Symbol_table::gc_): New data member.
8655         * target.h (Sized_target::gc_process_relocs): New pure virtual
8656         function.
8657         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8658         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8659
8660 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8661
8662         * options.h (General_options::gc_sections): Define as a no-op for now.
8663         (General_options::no_keep_memory): Ditto.
8664         (General_options::Bshareable): Define.
8665         * options.cc (General_options::finalize): Honor -Bshareable.
8666
8667 2009-01-20  Andreas Schwab  <schwab@suse.de>
8668
8669         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8670         read the value in the contents, since we don't use it.  Use the
8671         template endianness when writing.
8672         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8673
8674 2009-01-19  Andreas Schwab  <schwab@suse.de>
8675
8676         * configure.tgt (powerpc64-*): Fix targ_obj.
8677
8678 2009-01-15  Ian Lance Taylor  <iant@google.com>
8679
8680         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8681         local symbols when stripping all symbols.
8682
8683 2009-01-14  Cary Coutant  <ccoutant@google.com>
8684
8685         * output.cc (Output_reloc): Add explicit instantiations.
8686
8687 2009-01-14  Cary Coutant  <ccoutant@google.com>
8688
8689         * archive.cc (Archive::get_elf_object_for_member): Remove call
8690         to File_read::claim_for_plugin.
8691         * descriptors.cc (Descriptors::open): Remove reference to
8692         is_claimed.
8693         (Descriptors::claim_for_plugin): Remove.
8694         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8695         (Descriptors::is_claimed): Remove.
8696         (claim_descriptor_for_plugin): Remove.
8697         * fileread.cc (File_read::claim_for_plugin): Remove.
8698         * fileread.h (File_read::claim_for_plugin): Remove.
8699         (File_read::descriptor): Reopen descriptor if necessary.
8700         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8701         (Plugin_manager::all_symbols_read): Add task parameter. Change
8702         all callers.
8703         (Plugin_manager::get_input_file): New function.
8704         (Plugin_manager::release_input_file): New function.
8705         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8706         corresponding data member.
8707         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8708         and pass to base constructor. Change all callers.
8709         (get_input_file, release_input_file): New functions.
8710         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8711         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8712         (Plugin_manager::all_symbols_read): Add task parameter.
8713         (Plugin_manager::get_input_file): New function.
8714         (Plugin_manager::release_input_file): New function.
8715         (Plugin_manager::task_): New data member.
8716         (Pluginobj::Pluginobj): Add filesize parameter.
8717         (Pluginobj::filename): New function.
8718         (Pluginobj::descriptor): New function.
8719         (Pluginobj::filesize): New function.
8720         (Pluginobj::filesize_): New data member.
8721         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8722         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8723         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8724
8725         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8726         with archive libraries.
8727         * testsuite/Makefile.in: Regenerate.
8728         * testsuite/plugin_test.c (struct sym_info): New type.
8729         (get_input_file, release_input_file): New static variables.
8730         (onload): Capture new transfer vector entries.
8731         (claim_file_hook): Stop reading at end of file according to filesize.
8732         Factor out parsing of readelf output into separate function.
8733         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8734         APIs and get the source file name from the symbol table.  Convert
8735         source file name to corresponding object file name.  Print info
8736         message when adding new input files.
8737         (parse_readelf_line): New function.
8738         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8739         * testsuite/plugin_test_2.sh: Likewise.
8740         * testsuite/plugin_test_3.sh: Likewise.
8741         * testsuite/plugin_test_4.sh: New test case.
8742
8743 2009-01-07  Ian Lance Taylor  <iant@google.com>
8744
8745         * version.cc (version_string): Bump to 1.8.
8746
8747 2008-12-23  Cary Coutant  <ccoutant@google.com>
8748
8749         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8750         * plugin.cc (Plugin_manager::finish): Rename as
8751         layout_deferred_objects.  Move cleanup to separate function.
8752         (Plugin_manager::cleanup): New function.
8753         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8754         separately.
8755         * plugin.h (Plugin_manager::finish): Rename as
8756         layout_deferred_objects.
8757         (Plugin_manager::cleanup): New function.
8758         (Plugin_manager::cleanup_done): New field.
8759
8760 2008-12-23  Cary Coutant  <ccoutant@google.com>
8761
8762         * plugin.cc (is_visible_from_outside): New function.
8763         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8764         so we don't return "IR only" status for exported symbols or -r links.
8765
8766         * testsuite/Makefile.am (plugin_test_3): New test case.
8767         * testsuite/Makefile.in: Regenerate.
8768         * testsuite/plugin_test_3.sh: New file.
8769
8770 2008-12-22  Cary Coutant  <ccoutant@google.com>
8771
8772         * object.cc (Sized_relobj::layout_section): New function.
8773         (Sized_relobj::do_layout): Defer layout of input sections until after
8774         plugin has provided replacement files.
8775         (Sized_relobj::do_layout_deferred_sections): New function.
8776         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8777         (Relobj::layout_deferred_sections): New function.
8778         (Relobj::do_layout_deferred_sections): New function.
8779         (Sized_relobj::do_layout_deferred_sections): New function.
8780         (Sized_relobj::layout_section): New function.
8781         (Sized_relobj::Deferred_layout): New structure.
8782         (Sized_relobj::deferred_layout_): New field.
8783         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8784         Change all callers.  Layout deferred sections.
8785         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8786         references.
8787         (Plugin_hook::run): Move code from do_plugin_hook inline.
8788         (Plugin_hook::do_plugin_hook): Remove.
8789         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8790         (Plugin_manager::finish): Renamed, was cleanup.
8791         (Plugin_manager::should_defer_layout): New function.
8792         (Plugin_manager::add_deferred_layout_object): New function.
8793         (Plugin_manager::Deferred_layout_list): New type.
8794         (Plugin_manager::deferred_layout_objects_): New field.
8795         (Plugin_hook::do_plugin_hook): Remove.
8796
8797 2008-12-17  Ian Lance Taylor  <iant@google.com>
8798
8799         * options.h (class General_options): Add --no case for
8800         --export-dynamic.
8801
8802 2008-12-16  Cary Coutant  <ccoutant@google.com>
8803
8804         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8805         vector.
8806         (Plugin_manager::claim_file): Create plugin object even if
8807         plugin did not call the add_symbols callback.
8808         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8809         asking for more symbols than were added.
8810         * testsuite/Makefile.am (plugin_test_1): Add test case with
8811         no global symbols.
8812         (empty.syms): New target.
8813         * testsuite/Makefile.in: Regenerate.
8814         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8815         message. Don't call add_symbols if no globals.
8816         (all_symbols_read_hook): Don't provide replacement for empty
8817         claimed file.
8818
8819 2008-12-12  Ian Lance Taylor  <iant@google.com>
8820
8821         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8822         r_type == 0 for a local symbol with r_sym == 0.
8823         (scan_relocatable_relocs): Pass r_sym to
8824         local_non_section_strategy.
8825         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8826         r_sym parameter.
8827
8828         * configure.ac: Update test for TLS descriptors: they are
8829         supported as of glibc 2.9.
8830         * configure: Rebuild.
8831
8832 2008-12-11  Ian Lance Taylor  <iant@google.com>
8833
8834         PR 7091
8835         * target-reloc.h (Default_scan_relocatable_relocs): For each
8836         function, map r_type == 0 to RELOC_DISCARD.
8837
8838 2008-12-10  Cary Coutant  <ccoutant@google.com>
8839
8840         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8841         object to override a kept COMDAT group from a plugin object.
8842
8843 2008-12-09  Ian Lance Taylor  <iant@google.com>
8844
8845         PR 7088
8846         * yyscript.y (file_cmd): Handle INPUT.
8847
8848         * testsuite/initpri1.c: Change all declarations to be full
8849         prototypes by adding void, to avoid compiler warnings.
8850
8851 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8852
8853         * options.cc (General_options::parse_plugin_opt): New.
8854         (General_options::add_plugin): The argument now is just the filename.
8855         (General_options::add_plugin_option): New.
8856         * options.h (plugin_opt): New.
8857         (add_plugin): Change argument name.
8858         (add_plugin_option): New.
8859         * plugin.cc (Plugin::load): Don't parse the plugin option.
8860         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8861         (Plugin::add_option): New.
8862         (Plugin::args_): Change type.
8863         (Plugin::filename_): New.
8864         (Plugin_manager::add_plugin_option): New.
8865         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8866         * testsuite/Makefile.in: Regenerate.
8867
8868 2008-12-05  Cary Coutant  <ccoutant@google.com>
8869
8870         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8871         Handle --strip-lto-sections option.
8872         * options.h (strip_lto_sections): New option.
8873
8874 2008-12-01  Cary Coutant  <ccoutant@google.com>
8875
8876         * plugin.cc (ld_plugin_message): Change format parameter to const.
8877         Fix mismatch between new[] and delete.
8878
8879 2008-11-14  Cary Coutant  <ccoutant@google.com>
8880
8881         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8882         instead of -1U.
8883
8884 2008-11-05  Craig Silverstein  <csilvers@google.com>
8885
8886         * options.cc (General_options::parse_dynamic_list): New function.
8887         * options.h (General_options): New flags dynamic_list,
8888         dynamic_list_data, dynamic_list_cpp_new, and
8889         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8890         (General_options::in_dynamic_list): New function.
8891         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8892         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8893         (Lex::can_continue_name): Likewise.
8894         (yylex): Likewise.
8895         (read_script_file): New parameter script_options.
8896         (read_dynamic_list): New function.
8897         (Script_options::define_dynamic_list): New function.
8898         (dynamic_list_keyword_parsecodes): New variable.
8899         (dynamic_list_keywords): New variable.
8900         * script.h (Script_options::define_dynamic_list): New function
8901         prototype.
8902         (read_dynamic_list): New function prototype.
8903         * symtab.cc (strprefix): New macro.
8904         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8905         dynamic_list_data, dynamic_list_cpp_new, and
8906         dynamic_list_cpp_typeinfo.
8907         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8908         (dynamic_list_expr): New rule.
8909         (dynamic_list_nodes): Likewise.
8910         (dynamic_list_node): Likewise.
8911         * testsuite/Makefile.am (dynamic_list): New test.
8912         * testsuite/Makefile.in: Regenerated.
8913         * testsuite/dynamic_list.t: New file.
8914         * testsuite/dynamic_list.sh: New file.
8915
8916 2008-11-05  Craig Silverstein  <csilvers@google.com>
8917
8918         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8919         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8920         (t11_last): Likewise.
8921         * testsuite/ver_test_6.c (main): Likewise.
8922
8923 2008-10-07  Cary Coutant  <ccoutant@google.com>
8924
8925         * options.c (General_options::finalize): Add check for -static and
8926         -shared.
8927         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8928         is not empty.
8929
8930 2008-10-02  Cary Coutant  <ccoutant@google.com>
8931
8932         * plugin.cc (make_sized_plugin_object): Fix conditional
8933         compilation to work when not all targets are enabled.
8934
8935 2008-09-29  Cary Coutant  <ccoutant@google.com>
8936
8937         * archive.cc (Archive::get_file_and_offset): Use filename instead
8938         of name to get library path.
8939         (Archive::include_member): Unlock external member of a thin archive.
8940
8941         * testsuite/Makefile.am (TEST_AR): New variable.
8942         (thin_archive_test_1): New test.
8943         (thin_archive_test_2): New test.
8944         * testsuite/Makefile.in: Regenerate.
8945         * testsuite/thin_archive_main.cc: New file.
8946         * testsuite/thin_archive_test_1.cc: New file.
8947         * testsuite/thin_archive_test_2.cc: New file.
8948         * testsuite/thin_archive_test_3.cc: New file.
8949         * testsuite/thin_archive_test_4.cc: New file.
8950
8951 2008-09-29  Cary Coutant  <ccoutant@google.com>
8952
8953         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8954         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8955         instead of -1U.
8956         (Sized_relobj::do_finalize_local_symbols): Likewise.
8957         (Sized_relobj::map_to_kept_section): Likewise.
8958         * object.h (Sized_relobj::invalid_address): New constant.
8959         (Sized_relobj::do_output_section_offset): Check for invalid_address
8960         and return -1ULL.
8961         * output.cc (Output_reloc::local_section_offset): Use constant
8962         invalid_address instead of -1U.
8963         (Output_reloc::get_address): Likewise.
8964         (Output_section::output_address): Change -1U to -1ULL.
8965         * output.h (Output_reloc::invalid_address): New constant.
8966         * reloc.cc (Sized_relobj::write_sections): Use constant
8967         invalid_address instead of -1U.
8968         (Sized_relobj::relocate_sections): Likewise.
8969         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8970         values for merge sections.
8971         * target-reloc.h (relocate_for_relocatable): Use constant
8972         invalid_address instead of -1U.
8973
8974 2008-09-19  Cary Coutant  <ccoutant@google.com>
8975
8976         Add plugin functionality for link-time optimization (LTO).
8977         * configure.ac (plugins): Add --enable-plugins option.
8978         * configure: Regenerate.
8979         * config.in: Regenerate.
8980         * Makefile.am (LIBDL): New variable.
8981         (CCFILES): Add plugin.cc.
8982         (HFILES): Add plugin.h.
8983         (ldadd_var): Add LIBDL.
8984         * Makefile.in: Regenerate.
8985
8986         * archive.cc: Include "plugin.h".
8987         (Archive::setup): Don't preread archive symbols when using a plugin.
8988         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8989         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8990         files.
8991         (Archive::include_member): Add symbols from plugin objects.
8992         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8993         * descriptors.cc (Descriptors::open): Check for file descriptors
8994         abandoned by plugins.
8995         (Descriptors::claim_for_plugin): New function.
8996         * descriptors.h (Descriptors::claim_for_plugin): New function.
8997         (Open_descriptor::is_claimed): New field.
8998         (claim_descriptor_for_plugin): New function.
8999         * fileread.cc (File_read::claim_for_plugin): New function.
9000         * fileread.h (File_read::claim_for_plugin): New function.
9001         (File_read::descriptor): New function.
9002         * gold.cc: Include "plugin.h".
9003         (queue_initial_tasks): Add task to call plugin hooks for generating
9004         new object files.
9005         * main.cc: Include "plugin.h".
9006         (main): Load plugin libraries.
9007         * object.h (Pluginobj): Declare.
9008         (Object::pluginobj): New function.
9009         (Object::do_pluginobj): New function.
9010         (Object::set_target): New function.
9011         * options.cc: Include "plugin.h".
9012         (General_options::parse_plugin): New function.
9013         (General_options::General_options): Initialize plugins_ field.
9014         (General_options::add_plugin): New function.
9015         * options.h (Plugin_manager): Declare.
9016         (General_options): Add --plugin option.
9017         (General_options::has_plugins): New function.
9018         (General_options::plugins): New function.
9019         (General_options::add_plugin): New function.
9020         (General_options::plugins_): New field.
9021         * plugin.cc: New file.
9022         * plugin.h: New file.
9023         * readsyms.cc: Include "plugin.h".
9024         (Read_symbols::do_read_symbols): Check for archive before checking
9025         for ELF file.  Call plugin hooks to claim files.
9026         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9027         from a real object file; force override when processing replacement
9028         files.
9029         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9030         (Symbol::init_base_object): Likewise.
9031         (Symbol::init_base_output_data): Likewise.
9032         (Symbol::init_base_output_segment): Likewise.
9033         (Symbol::init_base_constant): Likewise.
9034         (Symbol::init_base_undefined): Likewise.
9035         (Symbol::output_section): Assert that object is not a plugin.
9036         (Symbol_table::add_from_pluginobj): New function.
9037         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9038         undefined.
9039         (Symbol_table::sized_write_globals): Likewise.
9040         (Symbol_table::add_from_pluginobj): Instantiate template.
9041         * symtab.h (Sized_pluginobj): Declare.
9042         (Symbol::in_real_elf): New function.
9043         (Symbol::set_in_real_elf): New function.
9044         (Symbol::in_real_elf_): New field.
9045         (Symbol_table::add_from_pluginobj): New function.
9046
9047         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9048         (LIBDL): New variable.
9049         (LDADD): Add LIBDL.
9050         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9051         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9052         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9053         (MOSTLYCLEANFILES): Likewise.
9054         * testsuite/Makefile.in: Regenerate.
9055         * testsuite/plugin_test.c: New file.
9056         * testsuite/plugin_test_1.sh: New file.
9057         * testsuite/plugin_test_2.sh: New file.
9058
9059 2008-09-16  Ian Lance Taylor  <iant@google.com>
9060
9061         * target-reloc.h (relocate_section): Check whether a symbol is
9062         defined by the ABI before reporting an undefined symbol error.
9063         * target.h (Target::is_defined_by_abi): Make parameter const.
9064         (Target::do_is_defined_by_abi): Likewise.
9065         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9066         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9067         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9068         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9069         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9070         * testsuite/Makefile.in: Rebuild.
9071
9072         * fileread.cc (make_view): Add casts to avoid warning.
9073
9074 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9075
9076         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9077         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9078
9079 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9080
9081         * options.h (General_options::output_is_executable): New.
9082         (General_options::output_is_pie): New.
9083         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9084         for shared libraries.
9085         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9086
9087 2008-09-11  Chris Demetriou  <cgd@google.com>
9088
9089         * options.h (origin): New -z option.
9090         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9091         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9092         in DT_FLAGS_1.
9093
9094 2008-09-05  Cary Coutant  <ccoutant@google.com>
9095
9096         * fileread.cc (File_read::make_view): Add check for attempt to map
9097         beyond end of file.
9098
9099 2008-09-05  Cary Coutant  <ccoutant@google.com>
9100
9101         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9102         explicit instantiations.
9103
9104 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9105
9106         PR gold/6858
9107         * options.cc (General_options::finalize): Allow undefined symbols
9108         in shlibs if linking -shared.
9109
9110         PR gold/6859
9111         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9112         symbols as not needing a dynsym entry.
9113
9114 2008-08-20  Craig Silverstein  <csilvers@google.com>
9115
9116         * fileread.cc (File_read::open): Do not lock the file unless it
9117         was successfully opened.
9118
9119 2008-08-14  Cary Coutant  <ccoutant@google.com>
9120
9121         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9122         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9123         * testsuite/tls_test.cc (struct int128): 128-bit struct
9124         for testing TLS relocs with non-zero addend.
9125         (v12): New TLS variable.
9126         (t12): New test.
9127         (t_last): Add check for v12.
9128         * testsuite/tls_test.h (t12): New function.
9129         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9130
9131 2008-08-13  Ian Lance Taylor  <iant@google.com>
9132
9133         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9134         set tls_segment_ or relro_segment_.
9135         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9136         when appropriate.
9137         * output.h (Output_section::clear_is_relro): New function.
9138         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9139         sections specially even when output_data_ is empty.
9140         (Output_segment::maximum_alignment): When first section is relro,
9141         only force alignment for PT_LOAD segments.
9142         * script.cc (script_data_segment_align): New function.
9143         (script_data_segment_relro_end): New function.
9144         * script-c.h (script_data_segment_align): Declare.
9145         (script_data_segment_relro_end): Declare.
9146         * script-sections.h (class Script_sections): Declare
9147         data_segment_align and data_segment_relro_end.  Add fields
9148         segment_align_index_ and saw_relro_end_.
9149         * script-sections.cc (class Sections_element): Add set_is_relro
9150         virtual function.  Add new bool* parameter to place_orphan_here.
9151         Add get_output_section virtual function.
9152         (class Output_section_definition): Add set_is_relro.  Add new
9153         bool* parameter to place_orphan_here.  Add get_output_section.
9154         Add is_relro_ field.
9155         (Output_section_definition::Output_section_definition): Initialize
9156         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9157         and is_relro_ fields.
9158         (Output_section_definition::place_orphan_here): Add is_relro
9159         parameter.
9160         (Output_section_definition::set_section_addresses): Set relro for
9161         output section.
9162         (Output_section_definition::alternate_constraint): Likewise.
9163         (class Orphan_output_section): Add new bool* parameter to
9164         place_orphan_here.  Add get_output_section.
9165         (Orphan_output_section::place_orphan_here): Add is_relro
9166         parameter.
9167         (Script_sections::Script_sections): Initialize
9168         data_segment_align_index_ and saw_relro_end_.
9169         (Script_sections::data_segment_align): New function.
9170         (Script_sections::data_segment_relro_end): New function.
9171         (Script_sections::place_orphan): Set or clear is_relro.
9172         (Script_sections::set_section_addresses): Force alignment of first
9173         TLS section.
9174         * yyscript.y (exp): Call script_data_segment_align and
9175         script_data_segment_relro_end.
9176         * testsuite/relro_script_test.t: New file.
9177         * testsuite/relro_test.cc (using_script): Declare.
9178         (t1, t2): Test using_script.
9179         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9180         (relro_script_test_SOURCES): Define.
9181         (relro_script_test_DEPENDENCIES): Define.
9182         (relro_script_test_LDFLAGS): Define.
9183         (relro_script_test_LDADD): Define.
9184         (relro_script_test.so): New target.
9185         * testsuite/Makefile.in: Rebuild.
9186
9187 2008-08-06  Cary Coutant <ccoutant@google.com>
9188
9189         * archive.cc (Archive::total_archives, Archive::total_members)
9190         (Archive::total_members_loaded): New variables.
9191         (Archive::setup): Add parameter.  Add option to preread
9192         archive symbols.
9193         (Archive::read_armap): Add counter.
9194         (Archive::get_file_and_offset): New function.
9195         (Archive::get_elf_object_for_member): New function.
9196         (Archive::read_all_symbols): New function.
9197         (Archive::read_symbols): New function.
9198         (Archive::add_symbols): Add counters.
9199         (Archive::include_all_members): Use armap to find members if it's
9200         already built.
9201         (Archive::include_member): Skip reading symbols if already read.
9202         Factored code into Archive::get_file_and_offset and
9203         Archive::get_elf_object_for_member.  Changed call to
9204         Mapfile::report_include_archive_member.
9205         (Archive::print_stats): New function.
9206         * archive.h: Declare Object and Read_symbols_data classes.
9207         (Archive::Archive): Add initializers for new members.
9208         (Archive::setup): Add parameter.
9209         (Archive::print_stats): New function.
9210         (Archive::total_archives, Archive::total_members)
9211         (Archive::total_members_loaded): New variables.
9212         (Archive::get_file_and_offset): New function.
9213         (Archive::get_elf_object_for_member): New function.
9214         (Archive::read_all_symbols): New function.
9215         (Archive::read_symbols): New function.
9216         (Archive::Archive_member): New class.
9217         (Archive::members_): New member.
9218         (Archive::num_members_): New member.
9219         * main.cc: Include archive.h.
9220         (main): Call Archive::print_stats.
9221         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9222         archive parameter; member_name is now the fully-decorated name.
9223         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9224         * options.h: (General_options): Add --preread-archive-symbols option.
9225         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9226         Archive::setup.
9227
9228 2008-08-04  Ian Lance Taylor  <iant@google.com>
9229
9230         * symtab.h (Symbol::use_plt_offset): New function.
9231         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9232         * powerpc.cc (Relocate::relocate): Likewise.
9233         * sparc.cc (Relocate::relocate): Likewise.
9234         * x86_64.cc (Relocate::relocate): Likewise.
9235         * testsuite/weak_plt.sh: New test.
9236         * testsuite/weak_plt_main.cc: New test.
9237         * testsuite/weak_plt_shared.cc: New test.
9238         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9239         (check_PROGRAMS): Add weak_plt.
9240         (check_DATA): Add weak_plt_shared.so.
9241         (weak_plt_main_pic.o, weak_plt): New targets.
9242         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9243         * testsuite/Makefile.in: Rebuild.
9244
9245         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9246         gcctestdir/ld.
9247         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9248         * testsuite/Makefile.in: Rebuild.
9249
9250 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9251
9252         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9253         * Makefile.in: Regenerate.
9254         * po/POTFILES.in: Regenerate.
9255
9256 2008-07-29  Ian Lance Taylor  <iant@google.com>
9257
9258         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9259         symbols before other symbols.
9260         * testsuite/script_test_2.cc (test_addr): Declare.
9261         (test_addr_alias): Declare.
9262         (main): Check that test_addr and test_addr_alias have the right
9263         values.
9264         * testsuite/script_test_2.t: Define test_addr_alias and
9265         test_addr.
9266
9267 2008-07-24  Ian Lance Taylor  <iant@google.com>
9268
9269         PR 5990
9270         * descriptors.cc: New file.
9271         * descriptors.h: New file.
9272         * gold-threads.h (class Hold_optional_lock): New class.
9273         * fileread.cc: Include "descriptors.h".
9274         (File_read::~File_read): Release descriptor rather than closing
9275         it.
9276         (File_read::open) [file]: Call open_descriptor rather than open.
9277         Set is_descriptor_opened_.
9278         (File_read::open) [memory]: Assert that descriptor is not open.
9279         (File_read::reopen_descriptor): New function.
9280         (File_read::release): Release descriptor.
9281         (File_read::do_read): Make non-const.  Reopen descriptor.
9282         (File_read::read): Make non-const.
9283         (File_read::make_view): Reopen descriptor.
9284         (File_read::do_readv): Likewise.
9285         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9286         Update declarations.
9287         * layout.cc: Include "descriptors.h".
9288         (Layout::create_build_id): Use open_descriptor rather than open.
9289         * output.cc: Include "descriptors.h".
9290         (Output_file::open): Use open_descriptor rather than open.
9291         * archive.cc (Archive::const_iterator): Change Archive to be
9292         non-const.
9293         (Archive::begin, Archive::end): Make non-const.
9294         (Archive::count_members): Likewise.
9295         * archive.h (class Archive): Update declarations.
9296         * object.h (Object::read): Make non-const.
9297         * Makefile.am (CCFILES): Add descriptors.cc.
9298         (HFILES): Add descriptors.h.
9299         * Makefile.in: Rebuild.
9300
9301         PR 6716
9302         * gold.h: Always include <clocale>.  Add Solaris workarounds
9303         following code in binutils/sysdep.h.
9304
9305         PR 6048
9306         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9307         this->eh_frame_hdr_ is NULL before using it.
9308
9309         * dynobj.cc (Versions::Versions): Update comment.
9310
9311         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9312         the base version name.
9313
9314         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9315         array size plus one.
9316         (Stringpool_template::set_string_offsets): Subtract one from key
9317         before using it as an array index.
9318         (Stringpool_template::get_offset_with_length): Likewise.
9319         (Stringpool_template::write_to_buffer): Likewise.
9320         * stringpool.h (Stringpool_template::get_offset_from_key):
9321         Likewise.
9322
9323 2008-07-23  Ian Lance Taylor  <iant@google.com>
9324
9325         PR 6658
9326         * object.h (Merged_symbol_value::value): Do our best to handle a
9327         negative addend.
9328
9329         PR 6647
9330         * script.cc (Version_script_info::get_versions): Don't add empty
9331         version tag to return value.
9332         (Version_script_info::get_symbol_version_helper): Change return
9333         type to bool.  Add pversion parameter.  Change all callers.
9334         (script_register_vers_node): Don't require a non-NULL tag.
9335         * script.h (class Version_script_info): Update declarations.
9336         (Version_script_info::get_symbol_version): Change return type to
9337         bool.  Add version parameter.  Change all callers.
9338         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9339         handling.  Handle an empty version from a version script.
9340         (Symbol_table::define_special_symbol): Likewise.
9341         * testsuite/ver_test_10.script: New file.
9342         * testsuite/ver_test_10.sh: New file.
9343         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9344         (check_DATA): Add ver_test_10.syms.
9345         (ver_test_10.syms, ver_test_10.so): New target.
9346         * testsuite/Makefile.in: Rebuild.
9347
9348 2008-07-23  Simon Baldwin  <simonb@google.com>
9349
9350         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9351         to zero for undefined symbols from dynamic libraries.
9352
9353 2008-07-23  Ian Lance Taylor  <iant@google.com>
9354
9355         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9356         Change all callers.
9357         * symtab.h (class Symbol_table): Update declaration.
9358         * testsuite/ver_test_9.cc: New file.
9359         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9360         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9361         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9362         (ver_test_9.so, ver_test_9.o): New targets.
9363         * testsuite/Makefile.in: Rebuild.
9364
9365 2008-07-22  Ian Lance Taylor  <iant@google.com>
9366
9367         * options.h (class General_options): Define --check-sections.
9368         * layout.cc (Layout::set_segment_offsets): Handle
9369         --check-sections.
9370
9371         * options.h (class General_options): Define -n/--nmagic and
9372         -N/--omagic.
9373         * options.cc (General_options::finalize): For -n/--nmagic or
9374         -N/--omagic, set -static.
9375         * layout.cc (Layout::attach_allocated_section_to_segment): If
9376         -N/--omagic, don't put read-only and read-write sections in
9377         different segments.
9378         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9379         finding a read-only segment.
9380         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9381         don't set the minimum segment alignment to the common page size,
9382         and don't set the file offset to the address modulo the page size.
9383         * script-sections.cc (Script_sections::create_segments): If
9384         -n/--omagic, don't put read-only and read-write sections in
9385         different segments.
9386
9387         * cref.cc: New file.
9388         * cref.h: New file.
9389         * options.h (class General_options): Add --print-symbol-counts.
9390         * main.cc (main): Issue defined symbol report if requested.
9391         * archive.cc (Archive::interpret_header): Make into a const member
9392         function.
9393         (Archive::add_symbols): Call Input_objects::archive_start and
9394         archive_stop.
9395         (Archive::const_iterator): Define new class.
9396         (Archive::begin, Archive::end): New functions.
9397         (Archive::include_all_members): Rewrite to use iterator.
9398         (Archive::count_members): New function.
9399         * archive.h (class Archive): Update declarations.
9400         (Archive::filename): New function.
9401         * object.cc: Include "cref.h".
9402         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9403         (Sized_relobj::do_get_global_symbol_counts): New function.
9404         (Input_objects::add_object): Add object to cross-referencer.
9405         (Input_objects::archive_start): New function.
9406         (Input_objects::archive_stop): New function.
9407         (Input_objects::print_symbol_counts): New function.
9408         * object.h: Declare Cref and Archive.
9409         (Object::get_global_symbol_counts): New function.
9410         (Object::do_get_global_symbol_counts): New pure virtual function.
9411         (class Sized_relobj): Add defined_count_ field.  Update
9412         declarations.
9413         (class Input_objects): Add cref_ field.  Update constructor.
9414         Update declarations.
9415         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9416         defined_count_.
9417         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9418         symbol counts.
9419         (Sized_dynobj::do_get_global_symbol_counts): New function.
9420         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9421         defined_count_.  Update declarations.  Define Symbols typedef.
9422         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9423         parameter.  Change all callers.
9424         (Symbol_table::add_from_dynobj): Add sympointers and defined
9425         parameters.  Change all callers.
9426         * symtab.h (class Symbol_table): Update declarations.
9427         * Makefile.am (CCFILES): Add cref.cc.
9428         (HFILES): Add cref.h.
9429         * Makefile.in: Rebuild.
9430
9431 2008-07-22  Simon Baldwin  <simonb@google.com>
9432
9433         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9434         to zero when writing undefined symbols.
9435
9436 2008-07-22  Ian Lance Taylor  <iant@google.com>
9437
9438         * output.cc (Output_section::add_input_section): Don't try to
9439         merge empty merge sections.
9440
9441 2008-07-21  Craig Silverstein  <csilvers@google.com>
9442
9443         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9444         Include symbol version in error message.
9445
9446 2008-07-20  Chris Demetriou  <cgd@google.com>
9447
9448         * configure.ac (gold_cv_c_random_seed): New configured variable.
9449         (RANDOM_SEED_CFLAGS): New substituted variable.
9450         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9451         * configure: Rebuild.
9452         * Makefile.in: Likewise.
9453         * testsuite/Makefile.in: Likewise.
9454
9455 2008-07-18  Ian Lance Taylor  <iant@google.com>
9456
9457         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9458         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9459         * testsuite/ver_test_main.cc (main): Call t4.
9460         (t4, t4_2a): Define.
9461         * testsuite/ver_test_2.cc (t4_2): Define.
9462         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9463         * testsuite/ver_test_4.cc (t4_2a): Define.
9464         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9465         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9466
9467 2008-07-17  Ian Lance Taylor  <iant@google.com>
9468
9469         * dynobj.cc (Versions::add_def): If we give an error about a
9470         missing version, go ahead and create the version anyhow.
9471
9472 2008-07-10  Ian Lance Taylor  <iant@google.com>
9473
9474         Handle output sections with more than 0x7fffffff bytes.
9475         * object.h (class Relobj): Change map_to_output_ to
9476         output_sections_, and just keep a section pointer.  Change all
9477         uses.  Move comdat group support to Sized_relobj.
9478         (Relobj::is_section_specially_mapped): Remove.
9479         (Relobj::output_section): Remove poff parameter.  Change all
9480         callers.
9481         (Relobj::output_section_offset): New function.
9482         (Relobj::set_section_offset): Rewrite.
9483         (Relobj::map_to_output): Remove.
9484         (Relobj::output_sections): New function.
9485         (Relobj::do_output_section_offset): New pure virtual function.
9486         (Relobj::do_set_section_offset): Likewise.
9487         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9488         group support from Relobj.  Update declarations.
9489         (Sized_relobj::get_output_section_offset): New function.
9490         (Sized_relobj::do_output_section_offset): New function.
9491         (Sized_relobj::do_set_section_offset): New function.
9492         * object.cc (Relobj::output_section_address): Remove.
9493         (Sized_relobj::Sized_relobj): Initialize new fields.
9494         (Sized_relobj::include_section_group): Cast find_kept_object to
9495         Sized_relobj.
9496         (Sized_relobj::include_linkonce_section): Likewise.
9497         (Sized_relobj::do_layout): Use separate arrays for output section
9498         and output offset.
9499         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9500         output_sections.
9501         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9502         output_sections and section_offsets.
9503         (Sized_relobj::write_local_symbols): Likewise.
9504         (map_to_kept_section): Compute output address directly.
9505         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9506         output_sections and section_offsets.
9507         (Sized_relobj::write_sections): Likewise.
9508         (Sized_relobj::relocate_sections): Likewise.
9509         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9510         * output.h (class Output_reloc): Update declarations.  Change
9511         u2_.relobj to Sized_relobj*.
9512         (class Output_data_reloc): Change add functions to use
9513         Sized_relobj*.
9514         * output.cc (Output_reloc::Output_reloc): Change relobj to
9515         Sized_relobj*.
9516         (Output_reloc::local_section_offset): Change return type to
9517         Elf_Addr.  Use get_output_section_offset.
9518         (Output_reloc::get_address): Likewise.
9519         (Output_section::is_input_address_mapped): Don't call
9520         is_section_specially_mapped.
9521         (Output_section::output_offset): Likewise.
9522         (Output_section::output_address): Likewise.
9523         (Output_section::starting_output_address): Likewise.
9524         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9525         parameter to Sized_relobj*.
9526         (Copy_relocs::need_copy_reloc): Likewise.
9527         (Copy_relocs::save): Likewise.
9528         * copy-relocs.h (class Copy_relocs): Update declarations.
9529         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9530         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9531         * target-reloc.h (relocate_for_relocatable): Change
9532         offset_in_output_section type to Elf_Addr.  Change code that uses
9533         it as well.
9534         * layout.cc (Layout::layout): Always set *off.
9535         * mapfile.cc (Mapfile::print_input_section): Use
9536         output_section_offset.
9537         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9538         Sized_relobj*.
9539         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9540         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9541         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9542
9543 2008-07-03  Ian Lance Taylor  <iant@google.com>
9544
9545         * layout.cc (Layout::include_section): Do not discard unrecognized
9546         SHT_STRTAB sections.
9547
9548 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9549
9550         * script.cc (Lex::can_continue_name): Make '?' allowable in
9551         version-script names.
9552         * testsuite/version_script.map: Change glob pattern to use '?'
9553
9554 2008-06-30  Manish Singh  <yosh@gimp.org>
9555
9556         PR 6585
9557         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9558         Correct typo.
9559
9560 2008-06-30  Ian Lance Taylor  <iant@google.com>
9561
9562         PR 6660
9563         PR 6682
9564         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9565         versions]: Don't try to read the value in the contents, since we
9566         don't use it.  Use the template endianness when writing.
9567
9568 2008-06-25  Cary Coutant  <ccoutant@google.com>
9569
9570         * fileread.cc (File_read::make_view): Assert on zero-length view.
9571         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9572         symbol table when there are no symbols to read.
9573
9574 2008-06-23  Craig Silverstein  <csilvers@google.com>
9575
9576         * version.cc (version_string): Bump to 1.7
9577
9578 2008-06-18  Craig Silverstein  <csilvers@google.com>
9579
9580         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9581         constant 0xFFFF to type Valtype.
9582         (Powerpc_relocate_functions::rel16_ha): Likewise.
9583
9584 2008-06-17  Ian Lance Taylor  <iant@google.com>
9585
9586         * output.h (Output_section::Input_section): Initialize p2align_ to
9587         zero for Output_section_data constructors.
9588         (Output_section::Input_section::addralign): If not an input
9589         section, return the alignment of the Output_section_data.
9590         * testsuite/copy_test.cc: New file.
9591         * testsuite/copy_test_1.cc: New file.
9592         * testsuite/copy_test_2.cc: New file.
9593         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9594         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9595         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9596         (copy_test_1_pic.o, copy_test_1.so): New targets.
9597         (copy_test_2_pic.o, copy_test_2.so): New targets.
9598         * testsuite/Makefile.in: Rebuild.
9599
9600         * script-sections.cc (Script_sections::place_orphan): Initialize
9601         local variable exact.
9602
9603 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9604
9605         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9606
9607 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9608             David S. Miller  <davem@davemloft.net>
9609
9610         * powerpc.cc: New file.
9611         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9612         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9613         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9614         * Makefile.in: Rebuild.
9615
9616 2008-06-09  Ian Lance Taylor  <iant@google.com>
9617
9618         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9619         <exception>.
9620         (throwing, orig_terminate): New static variables.
9621         (terminate_handler): New static function.
9622         (t2): Set terminate handler.
9623
9624 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9625
9626         PR 6584
9627         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9628         alignment.
9629
9630 2008-05-30  Cary Coutant  <ccoutant@google.com>
9631
9632         * archive.cc (Archive::include_all_members) Correct to step
9633         over symbol table and extended name table in thin archives.
9634
9635 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9636
9637         PR 6407
9638         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9639         calculation.
9640
9641 2008-05-28  Caleb Howe  <cshowe@google.com>
9642
9643         * reduced_debug_output.cc: New file.
9644         * reduced_debug_output.h: New file.
9645         * options.h (class General_options): Add --strip-debug-non-line.
9646         * options.cc (General_options::finalize): Add strip_debug_non_line
9647         to the strip heirarchy.
9648         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9649         fields.
9650         * layout.cc: Include "reduced_debug_output.h".
9651         (Layout::Layout): Initialize new fields.
9652         (line_only_debug_sections): New static array.
9653         (is_lines_only_debug_sections): New static inline function.
9654         (Layout::include_section): Handle --strip-debug-non-line.
9655         (Layout::make_output_section): If --strip-debug-non-line, build
9656         new output sections for .debug_abbrev and .debug_info.
9657         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9658         gold.  Warn about possible overflow.
9659         (read_signed_LEB_128): Likewise.
9660         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9661         (read_signed_LEB_128): Declare.
9662         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9663         (HFILES): Add reduced_debug_output.h.
9664         * Makefile.in: Rebuild.
9665
9666 2008-05-21  Ian Lance Taylor  <iant@google.com>
9667
9668         * mapfile.cc: New file.
9669         * mapfile.h: New file.
9670         * options.h (class General_options): Add -M/--print-map and -Map.
9671         * options.cc (General_options::finalize): Make -M equivalent to
9672         -Map -.
9673         * main.cc: Include <cstdio> and "mapfile.h".
9674         (main): Open mapfile if requested.
9675         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9676         constructor.  Change caller.
9677         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9678         (queue_middle_tasks): Likewise.
9679         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9680         declarations.
9681         * archive.cc: Include "mapfile.h".
9682         (Archive::add_symbols): Add mapfile parameter.  Change all
9683         callers.  Pass mapfile, symbol, and reason to include_member.
9684         (Archive::include_all_members): Add mapfile parameter.  Change all
9685         callers.
9686         (Archive::include_member): Add mapfile, sym, and why parameters.
9687         Change all callers.  Report inclusion to map file.
9688         * archive.h: Include "fileread.h".
9689         (class Archive): Update declarations.
9690         (Archive::file): New const method.
9691         (class Add_archive_symbols): Add mapfile_ field.  Update
9692         constructor.  Change all callers.
9693         * readsyms.h (class Read_symbols): Likewise.
9694         (class Finish_group): Likewise.
9695         (class Read_script): Likewise.
9696         * common.cc: Include "mapfile.h".
9697         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9698         all callers.
9699         (Symbol_table::do_allocate_commons): Likewise.
9700         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9701         symbol allocation to mapfile.
9702         * common.h (class Allocate_commons_task): Add mapfile_ field.
9703         Update constructor.  Change all callers.
9704         * symtab.h (class Symbol_table): Update declarations.
9705         * layout.cc: Include "mapfile.h".
9706         (Layout_task_runner::run): Print information to mapfile.
9707         (Layout::create_gold_note): Change Output_data_fixed_space to
9708         Output_data_zero_fill.
9709         (Layout::create_build_id): Likewise.
9710         (Layout::print_to_mapfile): New function.
9711         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9712         constructor.  Change caller.
9713         (class Layout): Declare print_to_mapfile.
9714         * output.cc (Output_section::Input_section::print_to_mapfile): New
9715         function.
9716         (Output_section::add_input_section): If producing a map, always
9717         add to input_sections_ list.
9718         (Output_section::do_print_to_mapfile): New function.
9719         (Output_segment::print_sections_to_mapfile): New function.
9720         (Output_segment::print_section_list_to_mapfile): New function.
9721         * output.h: Include "mapfile.h".
9722         (Output_data::print_to_mapfile): New function.
9723         (Output_data::do_print_to_mapfile): New virtual function.
9724         (Output_segment_headers::do_print_to_mapfile): New function.
9725         (Output_file_header::do_print_to_mapfile): New function.
9726         (Output_data_const::do_print_to_mapfile): New function.
9727         (class Output_data_const_buffer): Add map_name_ field.  Update
9728         constructor.  Change all callers.  Add do_print_to_mapfile
9729         function.
9730         (class Output_data_fixed_space): Likewise.
9731         (class Output_data_space): Likewise.
9732         (class Output_data_zero_fill): New class.
9733         (Output_data_strtab::do_print_to_mapfile): New function.
9734         (Output_data_reloc_base::do_print_to_mapfile): New function.
9735         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9736         (Output_data_group::do_print_to_mapfile): New function.
9737         (Output_data_got::do_print_to_mapfile): New function.
9738         (Output_data_dynamic::do_print_to_mapfile): New function.
9739         (Output_symtab_xindex::do_print_to_mapfile): New function.
9740         (class Output_section): Declare do_print_to_mapflie.  Declare
9741         print_to_mapfile in Input_section.
9742         (class Output_segment): Declare new functions.
9743         * object.h (Sized_relobj::symbol_count): New function.
9744         * script-sections.cc
9745         (Output_section_element_dot_assignment::set_section_addresses):
9746         Change Output_data_fixed_space to Output_data_zero_fill.
9747         (Output_data_expression::do_print_to_mapfile): New function.
9748         * script.cc (read_input_script): Add mapfile parameter.  Change
9749         all callers.
9750         * script.h (read_input_script): Update declaration.
9751         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9752         (Eh_frame::do_print_to_mapfile): New function.
9753         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9754         (Output_merge_string::do_print_to_mapfile): New function.
9755         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9756         function.
9757         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9758         function.
9759         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9760         function.
9761         * Makefile.am (CCFILES): Add mapfile.cc.
9762         (HFILES): Add mapfile.h.
9763         * Makefile.in: Rebuild.
9764
9765 2008-05-19  Ian Lance Taylor  <iant@google.com>
9766
9767         * options.h (class General_options): Add -z relro.
9768         * layout.cc (Layout::Layout): Initialize relro_segment_.
9769         (Layout::add_output_section_data): Return the output section.
9770         (Layout::make_output_section): Rcognize relro sections and mark
9771         them appropriately.
9772         (Layout::attach_allocated_section_to_segment): Put relro sections
9773         in a PT_GNU_RELRO segment.
9774         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9775         section as relro.
9776         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9777         PT_TLS segments.
9778         (Layout::linkonce_mapping): Map d.rel.ro.local to
9779         .data.rel.ro.local.
9780         (Layout::output_section_name): Us .data.rel.ro.local for any
9781         section which begins with that.
9782         * layout.h (class Layout): Update add_output_section_data
9783         declaration.  Add relro_segment_ field.
9784         * output.cc (Output_section::Output_section): Initialize is_relro_
9785         and is_relro_local_ fields.
9786         (Output_segment::add_output_section): Group relro sections.
9787         (Output_segment::is_first_section_relro): New function.
9788         (Output_segment::maximum_alignment): If there is a relro section,
9789         align the segment to the common page size.
9790         (Output_segment::set_section_addresses): Track whether we are
9791         looking at relro sections.  If the last section is a relro
9792         section, align to the common page size.
9793         (Output_segment::set_section_list_addresses): Add in_relro
9794         parameter.  Change all callers.  Align to the page size when
9795         moving from relro to non-relro section.
9796         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9797         segment.
9798         * output.h (class Output_section): Add is_relro_ and
9799         is_relro_local_ fields.
9800         (Output_section::is_relro): New function.
9801         (Output_section::set_is_relro): New function.
9802         (Output_section::is_relro_local): New function.
9803         (Output_section::set_is_relro_local): New function.
9804         (class Output_segment): Update declarations.
9805         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9806         * sparc.cc (Target_sparc::got_section): Likewise.
9807         * x86_64.cc (Target_x86_64::got_section): Likewise.
9808         * testsuite/relro_test_main.cc: New file.
9809         * testsuite/relro_test.cc: New file.
9810         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9811         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9812         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9813         (relro_test.so, relro_test_pic.o): New targets.
9814         * testsuite/Makefile.in: Rebuild.
9815
9816 2008-05-16  Ian Lance Taylor  <iant@google.com>
9817
9818         * output.cc (Output_segment::add_output_section): Remove front
9819         parameter.
9820         * output.h (class Output_segment): Remove
9821         add_initial_output_section and overloaded add_output_section.
9822         Update declaration of remaining add_output_section.
9823         * layout.cc (Layout::create_interp): Call add_output_section
9824         rather than add_initial_output_section.
9825         (Layout::finish_dynamic_section): Likewise.
9826
9827         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9828         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9829         know the dynamic type.
9830         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9831         field.  Initialize it in constructor.
9832         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9833         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9834         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9835         reloc.
9836
9837         * output.cc (Output_reloc::get_address): Change return type to
9838         Elf_Addr.
9839         * output.h (class Output_reloc): Update get_address declaration.
9840         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9841         for section addresses.
9842
9843 2008-05-09  Ian Lance Taylor  <iant@google.com>
9844
9845         PR 6493
9846         * gold.cc (gold_nomem): Use return value of write.
9847
9848 2008-05-08  Ian Lance Taylor  <iant@google.com>
9849
9850         * symtab.c (Symbol::init_base_output_data): Add version
9851         parameter.  Change all callers.
9852         (Symbol::init_base_output_segment): Likewise.
9853         (Symbol::init_base_constant): Likewise.
9854         (Symbol::init_base_undefined): Likewise.
9855         (Sized_symbol::init_output_data): Likewise.
9856         (Sized_symbol::init_output_segment): Likewise.
9857         (Sized_symbol::init_constant): Likewise.
9858         (Sized_symbol::init_undefined): Likewise.
9859         (Symbol_table::do_define_in_output_data): If the new symbol has a
9860         version, mark it as the default.
9861         (Symbol_table::do_define_in_output_segment): Likewise.
9862         (Symbol_table::do_define_as_constant): Likewise.
9863         * symtab.h (class Symbol): Update declarations.
9864         (class Sized_symbol): Likewise.
9865         * resolve.cc (Symbol::override_version): New function.
9866         (Symbol::override_base): Call override_version.
9867         (Symbol::override_base_with_special): Likewise.
9868         * testsuite/ver_script_8.script: New file.
9869         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9870         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9871         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9872         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9873
9874 2008-05-06  Ian Lance Taylor  <iant@google.com>
9875
9876         PR 6049
9877         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9878         functions.
9879         (class General_options): Remove existing --undefined, and add
9880         --no-undefined instead.  Add new --undefined as synonym for -u.
9881         * archive.cc (Archive::add_symbols): Check whether symbol was
9882         named with -u.
9883         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9884         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9885         all uses.  Add IS_UNDEFINED.  Update declarations to split
9886         different versions of init_base.  Declare init_base_undefined.
9887         (Symbol::is_defined): Handle IS_UNDEFINED.
9888         (Symbol::is_undefined): Likewise.
9889         (Symbol::is_weak_undefined): Call is_undefined.
9890         (Symbol::is_absolute): Handle IS_CONSTANT.
9891         (class Sized_symbol): Update declarations to split different
9892         versions of init.  Declare init_undefined.
9893         (class Symbol_table): Declare new functions.
9894         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9895         Change all callers.
9896         (Symbol::init_base_output_data): Likewise.
9897         (Symbol::init_base_output_segment): Likewise.
9898         (Symbol::init_base_constant): Likewise.
9899         (Symbol::init_base_undefined): New function.
9900         (Sized_symbol::init_object): Rename from init.  Change all
9901         callers.
9902         (Sized_symbol::init_output_data): Likewise.
9903         (Sized_symbol::init_output_segment): Likewise.
9904         (Sized_symbol::init_constant): Likewise.
9905         (Sized_symbol::init_undefined): New function.
9906         (Symbol_table::add_undefined_symbols_from_command_line): New
9907         function.
9908         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9909         function.
9910         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9911         (Symbol::output_section): Likewise.
9912         (Symbol::set_output_section): Likewise.
9913         (Symbol_table::sized_finalize_symbol): Likewise.
9914         (Symbol_table::sized_write_globals): Likewise.
9915         * resolve.cc (Symbol_table::should_override): Likewise.
9916         (Symbol::override_base_with_special): Likewise.
9917
9918         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9919         symbol, change it to have default visibility.
9920         * testsuite/protected_1.cc: New file.
9921         * testsuite/protected_2.cc: New file.
9922         * testsuite/protected_3.cc: New file.
9923         * testsuite/protected_main_1.cc: New file.
9924         * testsuite/protected_main_2.cc: New file.
9925         * testsuite/protected_main_3.cc: New file.
9926         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9927         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9928         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9929         (protected_1.so): New target.
9930         (protected_1_pic.o, protected_2_pic.o): New targets.
9931         (protected_3_pic.o): New target.
9932         (check_PROGRAMS): Add protected_2.
9933         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9934         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9935         * testsuite/Makefile.in: Rebuild.
9936
9937         * options.h (DEFINE_var): Add set_user_set_##varname__.
9938         (DEFINE_bool_alias): New macro.
9939         (class General_options): Define -Bstatic using DEFINE_bool_alias
9940         rather than DEFINE_special.  Add --undefined as an alias for -z
9941         defs.
9942         * options.cc (General_options::parse_Bstatic): Remove.
9943
9944         * options.h (class General_options): Add --fatal-warnings.
9945         * main.cc (main): Implement --fatal-warnings.
9946         * errors.h (Errors::warning_count): New function.
9947
9948         * options.h (class General_options): Add -Bsymbolic-functions.
9949         * symtab.h (Symbol::is_preemptible): Check for
9950         -Bsymbolic-functions.
9951
9952 2008-05-05  Ian Lance Taylor  <iant@google.com>
9953
9954         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9955         as noVARNAME rather than no-VARNAME.
9956         (class General_options): Add option -z combreloc.
9957         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9958         get_address.
9959         (Output_reloc::sort_before) [SHT_REL]: New function.
9960         (Output_reloc::sort_before) [SHT_RELA]: New function.
9961         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9962         Sort_relocs_comparison.
9963         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9964         parameter.  Change all callers.
9965         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9966         sort_relocs parameter.  Change all callers.
9967         * output.cc (Output_reloc::get_address): New function, broken out
9968         of write_rel.
9969         (Output_reloc::write_rel): Call it.
9970         (Output_reloc::compare): New function.
9971         (Output_data_reloc_base::do_write): Optionally sort relocs.
9972
9973         * configure.ac: If targ_extra_obj is set, link it in.
9974         * configure.tgt: Initialize all variables.
9975         (x86_64*): Set targ_extra_obj and targ_extra_size.
9976         * configure: Rebuild.
9977
9978         * object.cc (Sized_relobj::include_section_group): Adjust section
9979         indexes read from group data.  Build vector to pass to
9980         layout_group.
9981         * layout.cc (Layout::layout_group): Add flags and shndxes
9982         parameters.  Remove contents parameter.  Change caller.  Update
9983         explicit instantiations.
9984         * layout.h (class Layout): Update layout_group declaration.
9985         * output.cc (Output_data_group::Output_data_group): Add flags and
9986         input_shndxes parameters.  Remove contents parameter.  Change
9987         caller.
9988         (Output_data_group::do_write): Change input_sections_ to
9989         input_shndxes_.
9990         * output.h (class Output_data_group): Update constructor
9991         declaration.  Rename input_sections_ to input_shndxes_.
9992         * testsuite/many_sections_test.cc: Add template.
9993
9994 2008-04-30  Cary Coutant  <ccoutant@google.com>
9995
9996         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9997
9998         * layout.cc (Layout::include_section): Refactored check for debug
9999         info section.
10000         (Layout::add_comdat): Add new parameters.  Change type
10001         of signature parameter.  Add object and shndx to signatures table.
10002         (Layout::find_kept_object): New function.
10003         * layout.h: Include <cstring>.
10004         (Layout::is_debug_info_section): New function.
10005         (Layout::add_comdat): Add new parameters.
10006         (Layout::find_kept_object): New function.
10007         (Layout::Kept_section): New struct.
10008         (Layout::Signatures): Change type of map range.
10009         * object.cc (Relobj::output_section_address): New function.
10010         (Sized_relobj::include_section_group): Add new parameters.  Change
10011         calls to Layout::add_comdat.  Change to build table of kept comdat
10012         groups and table mapping discarded sections to kept sections.
10013         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10014         (Sized_relobj::do_layout): Change calls to include_section_group and
10015         include_linkonce_section.
10016         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10017         value to zero when section is discarded.
10018         (Sized_relobj::map_to_kept_section): New function.
10019         * object.h (Relobj::output_section_address): New function.
10020         (Relobj::Comdat_group): New type.
10021         (Relobj::find_comdat_group): New function.
10022         (Relobj::Comdat_group_table): New type.
10023         (Relobj::Kept_comdat_section): New type.
10024         (Relobj::Kept_comdat_section_table): New type.
10025         (Relobj::add_comdat_group): New function.
10026         (Relobj::set_kept_comdat_section): New function.
10027         (Relobj::get_kept_comdat_section): New function.
10028         (Relobj::comdat_groups_): New field.
10029         (Relobj::kept_comdat_sections_): New field.
10030         (Symbol_value::input_value): Update comment.
10031         (Sized_relobj::map_to_kept_section) New function.
10032         (Sized_relobj::include_linkonce_section): Add new parameter.
10033         * target-reloc.h (Comdat_behavior): New type.
10034         (get_comdat_behavior): New function.
10035         (relocate_section): Add code to map a discarded section to the
10036         corresponding kept section when applying a relocation.
10037
10038 2008-04-30  Craig Silverstein  <csilvers@google.com>
10039
10040         * dwarf_reader.cc (next_generation_count): New static var.
10041         (Addr2line_cache_entry): New struct.
10042         (addr2line_cache): New static var.
10043         (Dwarf_line_info::one_addr2line): Added caching.
10044         (Dwarf_line_info::clear_addr2line_cache): New function.
10045         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10046         cache-size parameter.
10047         (Dwarf_line_info::one_addr2line_cache): New function.
10048         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10049         new cache-size argument to one_addr2line(), and clear cache.
10050
10051 2008-04-28  Cary Coutant  <ccoutant@google.com>
10052
10053         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10054         R_386_PC8 relocations.
10055
10056 2008-04-23  Ian Lance Taylor  <iant@google.com>
10057
10058         * object.cc (Sized_relobj::include_section_group): Check for
10059         invalid section group.
10060
10061         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10062         header size.
10063
10064         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10065         than read for file header.
10066         * archive.cc (Archive::include_member): Likewise.
10067
10068 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10069
10070         * aclocal.m4: Regenerate.
10071         * configure: Regenerate.
10072
10073 2008-04-19  Ian Lance Taylor  <iant@google.com>
10074
10075         * version.cc (version_string): Bump to 1.6.
10076
10077         * testsuite/Makefile.am (many_sections_r_test): New target.
10078         (many_sections_r_test_SOURCES): Remove.
10079         (many_sections_r_test_DEPENDENCIES): Remove.
10080         (many_sections_r_test_LDFLAGS): Remove.
10081         (many_sections_r_test_LDADD): Remove.
10082
10083         * object.cc (Sized_relobj::do_add_symbols): Always pass
10084         local_symbol_count_ to add_from_relobj.
10085
10086         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10087         every thousand variables.
10088         * testsuite/Makefile.in: Rebuild.
10089
10090         * object.cc (Xindex::initialize_symtab_xindex): New function.
10091         (Xindex::read_symtab_xindex): New function.
10092         (Xindex::sym_xindex_to_shndx): New function.
10093         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10094         available.
10095         (Sized_relobj::do_initialize_xindex): New function.
10096         (Sized_relobj::do_read_symbols): Adjust section links.
10097         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10098         parameter.  Change all callers.
10099         (Sized_relobj::include_section_group): Adjust section links and
10100         symbol section indexes.
10101         (Sized_relobj::do_layout): Adjust section links.
10102         (Sized_relobj::do_count_local_symbols): Adjust section links and
10103         symbol section indexes.
10104         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10105         ordinary and special symbols.
10106         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10107         dynsym_xindex parameters.  Change all callers.  Adjust section
10108         links.  Use SHN_XINDEX when needed.
10109         (Sized_relobj::get_symbol_location_info): Adjust section links.
10110         Don't get fooled by special symbols.
10111         * object.h (class Xindex): Define.
10112         (class Object): Add xindex_ parameter.  Declare virtual functoin
10113         do_initialize_xindex.
10114         (Object::adjust_sym_shndx): New function.
10115         (Object::set_xindex): New protected function.
10116         (class Symbol_value): Add is_ordinary_shndx_ field.
10117         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10118         (Symbol_value::value): Assert ordinary section.
10119         (Symbol_value::initialize_input_to_output_map): Likewise.
10120         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10121         Change all callers.
10122         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10123         all callers.
10124         (class Sized_relobj): Update declarations.
10125         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10126         parameter.  Change all callers.
10127         (Sized_relobj::adjust_shndx): New function.
10128         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10129         field.
10130         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10131         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10132         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10133         (Sized_dynobj::read_dynsym_section): Adjust section links.
10134         (Sized_dynobj::read_dynamic): Likewise.
10135         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10136         section links.
10137         (Sized_dynobj::do_initialize_xindex): New function.
10138         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10139         do_initialize_xindex.
10140         (Sized_dynobj::adjust_shndx): New function.
10141         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10142         dynsym_xindex_ fields.
10143         (Layout::finalize): Add a call to set_section_indexes before
10144         creating the symtab sections.
10145         (Layout::set_section_indexes): Don't do anything if the section
10146         already has a section index.
10147         (Layout::create_symtab_sections): Add shnum parameter.  Change
10148         caller.  Create .symtab_shndx section if needed.
10149         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10150         caller.
10151         (Layout::allocated_output_section_count): New function.
10152         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10153         needed.
10154         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10155         fields.  Update declarations.
10156         (Layout::symtab_xindex): New function.
10157         (Layout::dynsym_xindex): New function.
10158         (class Write_symbols_task): Add layout_ field.
10159         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10160         Change caller.
10161         * output.cc (Output_section_headers::Output_section_headers): Add
10162         shstrtab_section parameter.  Change all callers.
10163         (Output_section_headers::do_sized_write): Store overflow values
10164         for section count and section string table section index in
10165         section header zero.
10166         (Output_file_header::do_sized_write): Check for overflow of
10167         section count and section string table section index.
10168         (Output_symtab_xindex::do_write): New function.
10169         (Output_symtab_xindex::endian_do_write): New function.
10170         * output.h (class Output_section_headers): Add shstrtab_section_.
10171         Update declarations.
10172         (class Output_symtab_xindex): Define.
10173         (Output_section::has_out_shndx): New function.
10174         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10175         field.
10176         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10177         Change all callers.
10178         (Sized_symbol::init): Likewise.
10179         (Symbol::output_section): Check for ordinary symbol.
10180         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10181         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10182         callers.
10183         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10184         Change all callers.  Simplify handling of symbols from sections
10185         not included in the link.
10186         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10187         distinction.
10188         (Weak_alias_sorter::operator()): Assert that symbols are
10189         ordinary.
10190         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10191         distinction.
10192         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10193         parameters.  Change all callers.
10194         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10195         symbol distinction.  Use SHN_XINDEX when needed.
10196         (Symbol_table::write_section_symbol): Add symtab_xindex
10197         parameter.  Change all callers.
10198         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10199         SHN_XINDEX when needed.
10200         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10201         declarations.
10202         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10203         (Symbol::is_defined): Check is_ordinary.
10204         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10205         (Symbol::is_absolute, Symbol::is_common): Likewise.
10206         (class Sized_symbol): Update declarations.
10207         (class Symbol_table): Update declarations.
10208         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10209         parameters.  Change all callers.
10210         (Sized_symbol::override): Likewise.
10211         (Symbol_table::override): Likewise.
10212         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10213         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10214         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10215         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10216         to be in an ordinary section.
10217         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10218         object and is_ordinary parameters.  Change all callers.
10219         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10220         Change all callers.  Don't add undefined or non-ordinary symbols
10221         to reloc_map_.
10222         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10223         Change all callers.
10224         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10225         declarations.
10226         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10227         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10228         (Sized_relobj::relocate_sections): Likewise.
10229         * target-reloc.h (scan_relocs): Adjust section symbol index.
10230         (scan_relocatable_relocs): Likewise.
10231         * i386.cc (Scan::local): Check for ordinary symbols.
10232         * sparc.cc (Scan::local): Likewise.
10233         * x86_64.cc (Scan::local): Likewise.
10234         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10235         to symbol_section_and_value.
10236         * testsuite/many_sections_test.cc: New file.
10237         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10238         (check_PROGRAMS): Add many_sections_test.
10239         (many_sections_test_SOURCES): Define.
10240         (many_sections_test_DEPENDENCIES): Define.
10241         (many_sections_test_LDFLAGS): Define.
10242         (BUILT_SOURCES): Add many_sections_define.h.
10243         (many_sections_define.h): New target.
10244         (BUILT_SOURCES): Add many_sections_check.h.
10245         (many_sections_check.h): New target.
10246         (check_PROGRAMS): Add many_sections_r_test.
10247         (many_sections_r_test_SOURCES): Define.
10248         (many_sections_r_test_DEPENDENCIES): Define.
10249         (many_sections_r_test_LDFLAGS): Define.
10250         (many_sections_r_test_LDADD): Define.
10251         (many_sections_r_test.o): New target.
10252         * testsuite/Makefile.in: Rebuild.
10253
10254 2008-04-17  Cary Coutant  <ccoutant@google.com>
10255
10256         * errors.cc (Errors::info): New function.
10257         (gold_info): New function.
10258         * errors.h (Errors::info): New function.
10259         * gold.h (gold_info): New function.
10260         * object.cc (Input_objects::add_object): Print trace output.
10261         * options.cc (options::parse_set): New function.
10262         (General_options::parse_wrap): Deleted.
10263         (General_options::General_options): Deleted initializer.
10264         * options.h (options::String_set): New typedef.
10265         (options::parse_set): New function.
10266         (DEFINE_set): New macro.
10267         (General_options::wrap): Changed to use DEFINE_set. Changed
10268         callers of any_wrap_symbols and is_wrap_symbol.
10269         (General_options::trace, General_options::trace_symbol):
10270         New options.
10271         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10272         (General_options::wrap_symbols_): Deleted.
10273         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10274
10275 2008-04-17  David S. Miller  <davem@davemloft.net>
10276
10277         * options.cc (General_options::parse_V): New function.
10278         * options.h: Add entries for -V and -Qy.
10279
10280 2008-04-17  Ian Lance Taylor  <iant@google.com>
10281
10282         * common.cc (Symbol_table::allocate_commons): Remove options
10283         parameter.  Change caller.
10284         (Symbol_table::do_allocate_commons): Remove options parameter.
10285         Change caller.  Just call do_allocate_commons_list twice.
10286         (Symbol_table::do_allocate_commons_list): New function, broken out
10287         of do_allocate_commons.
10288         * common.h (class Allocate_commons_task): Remove options_ field.
10289         Update constructor.
10290         * symtab.cc (Symbol_table::Symbol_table): Initialize
10291         tls_commons_.
10292         (Symbol_table::add_from_object): Put TLS common symbols on
10293         tls_commons_ list.
10294         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10295         which are IN_OUTPUT_DATA.
10296         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10297         allocate_commons and do_allocate_commons declarations.  Declare
10298         do_allocate_commons_list.
10299         * gold.cc (queue_middle_tasks): Update creation of
10300         Allocate_commons_task to not pass options.
10301         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10302         (TLS_TEST_C_FLAGS): New variable.
10303         (tls_test_c_pic.o): New target.
10304         (tls_test_shared.so): Link in tls_test_c_pic.o.
10305         (tls_test_c_pic_ie.o): New target.
10306         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10307         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10308         (tls_test_c.o): New target.
10309         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10310         (tls_pic_test_LDADD): Likewise.
10311         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10312         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10313         (tls_test_c_gnu2.o): New target.
10314         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10315         tls_test_c_gnu2.o.
10316         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10317         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10318         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10319         * testsuite/tls_test.cc: Include "config.h".
10320         (t_last): Call t11_last.
10321         * testsuite/tls_test.h (t11, t11_last): Declare.
10322         * testsuite/tls_test_c.c: New file.
10323         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10324         * configure.ac: Check for OpenMP support.
10325         * configure, config.in, Makefile.in: Rebuild.
10326         * testsuite/Makefile.in: Rebuild.
10327
10328 2008-04-16  Cary Coutant  <ccoutant@google.com>
10329
10330         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10331         (Target_i386::tls_base_symbol_defined_): New field.
10332         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10333         (Target_i386::Scan::global): Likewise.
10334         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10335         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10336         (Target_x86_64::tls_base_symbol_defined_): New field.
10337         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10338         (Target_x86_64::Scan::global): Likewise.
10339
10340 2008-04-16  Cary Coutant  <ccoutant@google.com>
10341
10342         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10343         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10344         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10345         building shared libraries.
10346         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10347         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10348         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10349         * testsuite/Makefile.in: Rebuild.
10350         * testsuite/weak_undef.h: New file.
10351         * testsuite/weak_undef_file1.cc: Add extra test cases.
10352         * testsuite/weak_undef_file2.cc: Likewise.
10353         * testsuite/weak_undef_test.cc: Likewise.
10354
10355 2008-04-16  David S. Miller  <davem@davemloft.net>
10356
10357         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10358         Add issued_non_pic_error_ field.  Declare check_non_pic.
10359         (Target_sparc::Scan::check_non_pic): New function.
10360         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10361         (Target_sparc::Scan::global): Likewise.
10362
10363         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10364         * configure: Rebuild.
10365
10366         * options.h (DEFINE_enable): New macro.
10367         (new_dtags): New enable option.
10368         (initfirst, interpose, loadfltr, nodefaultlib,
10369         nodelete, nodlopen, nodump): New -z options.
10370         * layout.cc (Layout:finish_dynamic_section): If new
10371         dtags enabled, emit DT_RUNPATH.  Also, emit a
10372         DT_FLAGS_1 containing any specified -z flags.
10373
10374 2008-04-16  Ian Lance Taylor  <iant@google.com>
10375
10376         * copy-relocs.cc: New file.
10377         * copy-relocs.h: New file.
10378         * reloc.cc: Remove Copy_relocs code.
10379         * reloc.h: Likewise.
10380         * reloc-types.h (struct Reloc_types) [both versions]: Add
10381         get_reloc_addend_noerror.
10382         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10383         variants of add_global which take an addend which must be zero.
10384         * i386.cc: Include "copy-relocs.h".
10385         (class Target_i386): Change type of copy_relocs_ to variable,
10386         update initializer.
10387         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10388         Change all callers.
10389         (Target_i386::do_finalize_sections): Change handling of
10390         copy_relocs_.
10391         * sparc.cc: Include "copy-relocs.h".
10392         (class Target_sparc): Change type of copy_relocs_ to variable,
10393         update initializer.
10394         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10395         Change all callers.
10396         (Target_sparc::do_finalize_sections): Change handling of
10397         copy_relocs_.
10398         * x86_64.cc: Include "copy-relocs.h".
10399         (class Target_x86_64): Change type of copy_relocs_ to variable,
10400         update initializer.
10401         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10402         class.  Change all callers.
10403         (Target_x86_64::do_finalize_sections): Change handling of
10404         copy_relocs_.
10405         * Makefile.am (CCFILES): Add copy-relocs.cc.
10406         (HFILES): Add copy-relocs.h.
10407
10408         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10409
10410         * testsuite/script_test_4.sh: Permit leading zeroes.
10411
10412 2008-04-15  Ian Lance Taylor  <iant@google.com>
10413
10414         * script-sections.cc (Script_sections::create_segments): Use
10415         header_size_adjustment even when there is enough room for the
10416         headers.
10417         * testsuite/script_test_4.sh: New file.
10418         * testsuite/script_test_4.t: New file.
10419         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10420         (check_DATA): Add script_test_4.stdout.
10421         (MOSTLYCLEANFILES): Likewise.
10422         (script_test_4): New target.
10423         (script_test_4.stdout): New target.
10424         * testsuite/Makefile.in: Rebuild.
10425
10426         * sparc.cc: Add definitions for Output_data_plt_sparc class
10427         constants.
10428
10429 2008-04-14  David S. Miller  <davem@davemloft.net>
10430
10431         * sparc.cc: New file.
10432         * Makefile.am (TARGETSOURCES): Add sparc.cc
10433         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10434         * configure.tgt: Document targ_extra_size and
10435         targ_extra_big_endian.  Add entries for sparc-* and
10436         sparc64-*.
10437         * configure.ac: Handle targ_extra_size and
10438         targ_extra_big_endian.
10439         * Makefile.in: Rebuild.
10440         * configure: Likewise.
10441         * po/POTFILES.in: Likewise.
10442         * po/gold.pot: Likewise.
10443
10444 2008-04-14  Ian Lance Taylor  <iant@google.com>
10445
10446         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10447         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10448         in the name/type/flags to section mapping.  Don't call
10449         allocate_output_section.
10450         (Layout::choose_output_section): Change parameter from adjust_name
10451         to is_input_section.  Don't permit input sections after sections
10452         are attached to segments.  Don't call allocate_output_section.
10453         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10454         not write_enable_output_section.
10455         (Layout::make_output_section): Don't push to
10456         unattached_section_list_ nor call attach_to_segment.  Call
10457         attach_section_to_segment if sections are attached.
10458         (Layout::attach_sections_to_segments): New function.
10459         (Layout::attach_section_to_segment): New function.
10460         (Layout::attach_allocated_section_to_segment): Rename from
10461         attach_to_segment.  Remove flags parameter.
10462         (Layout::allocate_output_section): Remove function.
10463         (Layout::write_enable_output_section): Remove function.
10464         * layout.h (class Layout): Update for above changes.  Add new
10465         field sections_are_attached_.
10466         * output.h (Output_section::update_flags_for_input_section): New
10467         function.
10468         * output.cc (Output_section::add_input_section): Call
10469         update_flags_for_input_section.
10470         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10471
10472 2008-04-11  Cary Coutant  <ccoutant@google.com>
10473
10474         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10475         thought unnecessary.
10476         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10477
10478 2008-04-11  Ian Lance Taylor  <iant@google.com>
10479
10480         * output.h (class Output_section_data): Remove inline definition
10481         of set_addralign.
10482         * output.cc (Output_section_data::set_addralign): New function.
10483
10484 2008-04-11  Cary Coutant  <ccoutant@google.com>
10485
10486         Add support for TLS descriptors for i386 and x86_64.
10487         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10488         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10489         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10490         GOT_TYPE_TLS_DESC.
10491         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10492         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10493         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10494         relocations.
10495         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10496         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10497         Fix problem with initial-exec relocations.
10498         (Target_i386::Relocate::relocate_tls): Likewise.
10499         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10500         relaxation.
10501         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10502         support for section-plus-offset dynamic table entries.
10503         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10504         (Output_data_dynamic::Dynamic_entry): Add support for
10505         section-plus-offset dynamic table entries.
10506         (Output_data_dynamic::Classification): Likewise.
10507         (Output_data_dynamic::classification_): Renamed offset_.
10508         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10509         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10510         (Target_x86_64::make_plt_section): New function.
10511         (Target_x86_64::reserve_tlsdesc_entries): New function.
10512         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10513         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10514         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10515         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10516         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10517         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10518         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10519         add extra PLT entry for TLS descriptors.
10520         (Output_data_plt_x86_64::got_): New field.
10521         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10522         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10523         fields.
10524         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10525         descriptors.
10526         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10527         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10528         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10529         R_386_TLS_DESC_CALL relocations.
10530         (Target_x86_64::Scan::global): Likewise.
10531         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10532         for TLS descriptors.
10533         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10534         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10535         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10536         GD-to-IE relaxation.
10537         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10538         and TLS_DESCRIPTORS.
10539         * Makefile.in: Rebuild.
10540         * configure: Rebuild.
10541         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10542         (tls_test_shared2.so): New target.
10543         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10544         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10545         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10546         (tls_shared_gd_to_ie_test_LDADD): New variable.
10547         (tls_shared_gnu2_gd_to_ie_test): New target.
10548         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10549         New targets.
10550         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10551         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10552         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10553         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10554         (tls_shared_gnu2_test): New target.
10555         (tls_test_gnu2_shared.so): New target.
10556         (tls_shared_gnu2_test_SOURCES): New variable.
10557         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10558         (tls_shared_gnu2_test_LDFLAGS): New variable.
10559         (tls_shared_gnu2_test_LDADD): New variable.
10560         * testsuite/Makefile.in: Rebuild.
10561         * testsuite/Makefile.
10562
10563 2008-04-11  Ian Lance Taylor  <iant@google.com>
10564
10565         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10566         justsyms.t.
10567         * testsuite/Makefile.in: Rebuild.
10568
10569         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10570         long.
10571         * testsuite/script_test_2.cc (main): Adjust test.
10572
10573 2008-04-11  David S. Miller  <davem@davemloft.net>
10574             Ian Lance Taylor  <iant@google.com>
10575
10576         * options.h (General_options): Add entries for '-Y' and
10577         '-relax'.
10578         * options.cc (General_options:finalize): If -Y was used, add those
10579         entries to the library path instead of the default "/lib" and
10580         "/usr/lib".
10581
10582 2008-04-11  David S. Miller  <davem@davemloft.net>
10583
10584         * testsuite/justsyms.t: Start at 0x100.
10585         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10586         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10587         long.
10588         * testsuite/script_test_2.cc: Adjust string and section length
10589         checks.
10590
10591 2008-04-09  Ian Lance Taylor  <iant@google.com>
10592
10593         PR gold/5996
10594         * script-sections.cc (Sections_element::allocate_to_segment): Add
10595         orphan parameter.
10596         (Output_section_definition::allocate_to_segment): Likewise.
10597         (Orphan_output_section::allocate_to_segment): Likewise.
10598         (Script_sections::attach_sections_using_phdrs_clause): Don't
10599         propagate non-PT_LOAD segments to orphan sections.
10600         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10601         readelf rather than objdump.
10602         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10603         .interp section and PT_INTERP segment are the same size.
10604         * testsuite/Makefile.in: Rebuild.
10605
10606         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10607         aliases for symbols defined in the same object.
10608         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10609         (weak_alias_test_SOURCES): New variable.
10610         (weak_alias_test_DEPENDENCIES): New variable.
10611         (weak_alias_test_LDFLAGS): New variable.
10612         (weak_alias_test_LDADD): New variable.
10613         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10614         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10615         (weak_alias_test_3.o): New target.
10616         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10617         * testsuite/weak_alias_test_main.cc: New file.
10618         * testsuite/weak_alias_test_1.cc: New file.
10619         * testsuite/weak_alias_test_2.cc: New file.
10620         * testsuite/weak_alias_test_3.cc: New file.
10621
10622 2008-04-08  Ian Lance Taylor  <iant@google.com>
10623
10624         * options.h (class General_options): Add --noinhibit-exec option.
10625         * main.cc (main): Check --noinhibit-exec.
10626
10627         * options.h (class General_options): Define --wrap as a special
10628         option.  Add wrap_symbols_ field.
10629         (General_options::any_wrap_symbols): New function.
10630         (General_options::is_wrap_symbol): New function.
10631         * options.cc (General_options::parse_wrap): New function.
10632         (General_options::General_options): Initialize wrap_symbols_.
10633         * symtab.cc (Symbol_table::wrap_symbol): New function.
10634         (Symbol_table::add_from_object): Handle --wrap.
10635         * symtab.h (class Symbol_table): Declare wrap_symbol.
10636         * target.h (Target::wrap_char): New function.
10637         (Target::Target_info): Add wrap_char field.
10638         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10639         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10640         * testsuite/testfile.cc (Target_test::test_target_info):
10641         Likewise.
10642
10643         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10644         there is one.
10645
10646         * layout.h (class Layout): Add added_eh_frame_data_ field.
10647         * layout.cc (Layout::Layout): Initialize new field.
10648         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10649         output section until we find a section we merged successfully.
10650         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10651         that the size be non-zero.
10652
10653         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10654         qualifier.
10655
10656 2008-04-08  Craig Silverstein  <csilvers@google.com>
10657
10658         * configure.ac: Export new conditional variable HAVE_ZLIB.
10659         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10660         on HAVE_ZLIB.
10661         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10662         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10663
10664 2008-04-07  Ian Lance Taylor  <iant@google.com>
10665
10666         * version.cc (version_string): Set to "1.5".
10667
10668         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10669         Add issued_non_pic_error_ field.  Declare check_non_pic.
10670         (Target_x86_64::Scan::check_non_pic): New function.
10671         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10672         (Target_x86_64::Scan::global): Likewise.
10673
10674         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10675         addend parameter.  Change caller.  Handle merge sections.
10676         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10677         Address to Addend.  Don't add in the result of
10678         local_section_offset, pass down the addend and use the returned
10679         value.
10680         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10681         Update declarations of local_section_offset and symbol_value.
10682         * testsuite/two_file_test_1.cc (t18): New function.
10683         * testsuite/two_file_test_2.cc (f18): New function.
10684         * testsuite/two_file_test_main.cc (main): Call t18.
10685         * testsuite/two_file_test.h (t18, f18): Declare.
10686
10687         * configure.ac: Don't test for objdump, c++filt, or readelf.
10688         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10689         conditionals.
10690         (TEST_READELF): New variable.
10691         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10692         (check_PROGRAMS): Add two_file_strip_test.
10693         (two_file_strip_test): New target.
10694         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10695         (two_file_same_shared_strip_test_SOURCES): New variable.
10696         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10697         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10698         (two_file_same_shared_strip_test_LDADD): New variable.
10699         (two_file_shared_strip.so): New target.
10700         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10701         (ver_test_5.syms, ver_test_7.syms): Likewise.
10702         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10703         (strip_test_3.stdout): Use TEST_OBJDUMP.
10704         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10705
10706 2008-04-04  Cary Coutant  <ccoutant@google.com>
10707
10708         * symtab.h (Symbol::is_weak_undefined): New function.
10709         (Symbol::is_strong_undefined): New function.
10710         (Symbol::is_absolute): New function.
10711         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10712         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10713         absolute symbols.
10714         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10715         (weak_undef_test): New target.
10716         * testsuite/Makefile.in: Rebuild.
10717         * testsuite/weak_undef_file1.cc: New file.
10718         * testsuite/weak_undef_file2.cc: New file.
10719         * testsuite/weak_undef_test.cc: New file.
10720
10721 2008-04-03  Craig Silverstein  <csilvers@google.com>
10722
10723         * compressed_output.h (class Output_compressed_section): Use
10724         unsigned buffer.
10725         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10726         add zlib header.
10727         (zlib_compressed_suffix): Removed.
10728         (Output_compressed_section::set_final_data_size): Use unsigned
10729         buffers.
10730         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10731         Fix linker invocation.
10732         (flagstest_o_specialfile_and_compress_debug_sections):
10733         Likewise.
10734         * testsuite/Makefile.in: Regenerated.
10735
10736 2008-04-02  David S. Miller  <davem@davemloft.net>
10737
10738         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10739         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10740
10741 2008-04-02  Craig Silverstein  <csilvers@google.com>
10742
10743         * TODO: New file.
10744
10745 2008-04-02  Ian Lance Taylor  <iant@google.com>
10746
10747         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10748         parameters.  Update for new key type to views_.  Change all
10749         callers.
10750         (File_read::read): Adjust for byteshift in returned view.
10751         (File_read::add_view): New function, broken out of
10752         find_and_make_view.
10753         (File_read::make_view): New function, broken out of
10754         find_and_make_view.
10755         (File_read::find_or_make_view): Add offset and aligned
10756         parameters.  Rewrite accordingly.  Change all callers.
10757         (File_read::get_view): Add offset and aligned parameters.  Adjust
10758         for byteshift in return value.
10759         (File_read::get_lasting_view): Likewise.
10760         * fileread.h (class File_read): Update declarations.
10761         (class File_read::View): Add byteshift_ field.  Add byteshift to
10762         constructor.  Add byteshift method.
10763         * archive.h (Archive::clear_uncached_views): New function.
10764         (Archive::get_view): Add aligned parameter.  Change all callers.
10765         * object.h (Object::get_view): Add aligned parameter.  Change all
10766         callers.
10767         (Object::get_lasting_view): Likewise.
10768
10769         * fileread.cc (File_read::release): Don't call clear_views if
10770         there are multiple objects.
10771         * fileread.h (File_read::clear_uncached_views): New function.
10772         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10773         on the archive.
10774
10775 2008-03-31  Cary Coutant  <ccoutant@google.com>
10776
10777         Add thin archive support.
10778         * archive.cc (Archive::armagt): New const.
10779         (Archive::setup): Remove task parameter and calls to unlock.
10780         (Archive::unlock_nested_archives): New function.
10781         (Archive::read_header): Add nested_off parameter. Change
10782         all callers.
10783         (Archive::interpret_header): Likewise.
10784         (Archive::include_all_members): Change to handle thin
10785         archives.
10786         (Archive::include_member): Likewise.
10787         * archive.h (Archive::Archive): Add new parameters and
10788         initializers.
10789         (Archive::armagt): New const.
10790         (Archive::setup): Remove task parameter.
10791         (Archive::unlock_nested_archives): New function.
10792         (Archive::read_header): Add nested_off parameter.
10793         (Archive::interpret_header): Likewise.
10794         (Archive::Nested_archive_table): New typedef.
10795         (Archive::is_thin_archive_): New field.
10796         (Archive::nested_archives_): New field.
10797         (Archive::options_): New field.
10798         (Archive::dirpath_): New field.
10799         (Archive::task_): New field.
10800         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10801         for thin archives.  Pass additional parameters to
10802         Archive::Archive.  Unlock the archive file after calling
10803         Archive::setup.
10804
10805 2008-03-29  Ian Lance Taylor  <iant@google.com>
10806
10807         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10808         version symbol to be local.
10809         * testsuite/ver_test_4.sh: New file.
10810         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10811         (check_DATA): Add ver_test_4.syms.
10812         (ver_test_4.syms): New target.
10813         * testsuite/Makefile.in: Rebuild.
10814
10815         * output.cc
10816         (Output_section::Input_section_sort_entry::has_priority): New
10817         function.
10818         (Output_section::Input_section_sort_entry::match_file_name): New
10819         function.
10820         (Output_section::Input_section_sort_entry::match_section_name):
10821         Remove.
10822         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10823         Remove.
10824         (Output_section::Input_section_sort_entry::match_section_file):
10825         Remove.
10826         (Output_section::Input_section_sort_compare::operator()): Rewrite
10827         using new Input_section_sort_entry functions.  Sort crtbegin and
10828         crtend first.  Sort sections with no priority before sections with
10829         a priority.
10830         * testsuite/initpri1.c (d3): Check j != 4.
10831         (cd5): New constructor/destructor function.
10832         (main): Check j != 2.
10833
10834         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10835         new symbol when resolving, don't call set_is_default.
10836         * testsuite/ver_test_7.cc: New file.
10837         * testsuite/ver_test_7.sh: New file.
10838         * testsuite/Makefile.am (ver_test_7.so): New target.
10839         (ver_test_7.o): New target.
10840         (check_SCRIPTS): Add ver_test_7.sh.
10841         (check_DATA): Add ver_test_7.syms.
10842         (ver_test_7.syms): New target.
10843
10844 2008-03-28  Ian Lance Taylor  <iant@google.com>
10845
10846         * layout.cc (Layout::layout): If we see an input section with a
10847         name that needs sorting, set the must_sort flag for the output
10848         section.
10849         (Layout::make_output_section): If the name of the output section
10850         indicates that it might require sorting, set the may_sort flag.
10851         * output.h (Output_section::may_sort_attached_input_sections): New
10852         function.
10853         (Output_section::set_may_sort_attached_input_sections): New
10854         function.
10855         (Output_section::must_sort_attached_input_sections): New
10856         function.
10857         (Output_section::set_must_sort_attached_input_sections): New
10858         function.
10859         (class Output_section): Declare Input_section_sort_entry.  Define
10860         Input_section_sort_compare.  Declare
10861         sort_attached_input_sections.  Add new fields:
10862         may_sort_attached_input_sections_,
10863         must_sort_attached_input_sections_,
10864         attached_input_sections_are_sorted_.
10865         * output.cc (Output_section::Output_section): Initialize new
10866         fields.
10867         (Output_section::add_input_section): Add an entry to
10868         input_sections_ if may_sort or must_sort are true.
10869         (Output_section::set_final_data_size): Call
10870         sort_attached_input_sections if necessary.
10871         (Output_section::Input_section_sort_entry): Define new class.
10872         (Output_section::Input_section_sort_compare::operator()): New
10873         function.
10874         (Output_section::sort_attached_input_sections): New function.
10875         * configure.ac: Check whether the compiler supports constructor
10876         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10877         * testsuite/initpri1.c: New file.
10878         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10879         CONSTRUCTOR_PRIORITY.
10880         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10881         (initpri1_LDFLAGS): New variable.
10882         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10883
10884 2008-03-27  Ian Lance Taylor  <iant@google.com>
10885
10886         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10887         * testsuite/common_test_1.c: New file.
10888         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10889         (common_test_1_SOURCES): New variable.
10890         (common_test_1_DEPENDENCIES): New variable.
10891         (common_test_1_LDFLAGS): New variable.
10892
10893         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10894         and commons_ correctly when NAME/VERSION does not override
10895         NAME/NULL.
10896         * testsuite/ver_test_6.c: New file.
10897         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10898         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10899         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10900
10901 2008-03-26  Ian Lance Taylor  <iant@google.com>
10902
10903         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10904         of an undefined symbol from a version script.
10905         * testsuite/Makefile.am (ver_test_5.so): New target.
10906         (ver_test_5.o): New target.
10907         (check_SCRIPTS): Add ver_test_5.sh.
10908         (check_DATA): Add ver_test_5.syms.
10909         (ver_test_5.syms): New target.
10910         * testsuite/ver_test_5.cc: New file.
10911         * testsuite/ver_test_5.script: New file.
10912         * testsuite/ver_test_5.sh: New file.
10913         * Makefile.in, testsuite/Makefile.in: Rebuild.
10914
10915         PR gold/5986
10916         Fix problems building gold with gcc 4.3.0.
10917         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10918         (gold_error_at_location, gold_warning_at_location): Use it.
10919         * configure.ac: Check whether we can compile and use a template
10920         function with a printf attribute.
10921         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10922         when jumping over bytes.
10923         * object.cc: Instantiate Object::read_section_data.
10924         * debug.h: Include <cstring>
10925         * dwarf_reader.cc: Include <algorithm>
10926         * main.cc: Include <cstring>.
10927         * options.cc: Include <cstring>.
10928         * output.cc: Include <cstring>.
10929         * script.cc: Include <cstring>.
10930         * script.h: Include <string>.
10931         * symtab.cc: Include <cstring> and <algorithm>.
10932         * target-select.cc: Include <cstring>.
10933         * version.cc: Include <string>.
10934         * testsuite/testmain.cc: Include <cstdlib>.
10935         * configure, config.in: Rebuild.
10936
10937 2008-03-25  Ian Lance Taylor  <iant@google.com>
10938
10939         * options.cc: Include "../bfd/bfdver.h".
10940         (options::help): Print bug reporting address.
10941
10942         * version.cc (print_version): Adjust output for current value of
10943         BFD_VERSION_STRING.
10944
10945         * NEWS: New file.
10946
10947         * options.cc (options::help): Print list of supported targets.
10948         * target-select.h: Include <vector>.
10949         (class Target_selector): Make machine_, size_, and is_big_endian_
10950         fields const.  Add bfd_name_ and instantiated_target_ fields.
10951         (Target_selector::Target_selector): Add bfd_name parameter.
10952         (Target_selector::recognize): Make non-virtual, call
10953         do_recognize.
10954         (Target_selector::recognize_by_name): Make non-virtual, call
10955         do_recognize_by_name.
10956         (Target_selector::supported_names): New function.
10957         (Target_selector::bfd_name): New function.
10958         (Target_selector::do_instantiate_target): New pure virtual
10959         function.
10960         (Target_selector::do_recognize): New virtual function.
10961         (Target_selector::do_recognize_by_name): New virtual function.
10962         (Target_selector::instantiate_target): New private function.
10963         (supported_target_names): Declare.
10964         * target-select.cc (Target_selector::Target_selector): Update for
10965         new parameter and fields.
10966         (select_target_by_name): Check that the name matches before
10967         calling recognize_by_name.
10968         (supported_target_names): New function.
10969         * i386.cc (class Target_selector_i386): Update Target_selector
10970         constructor call.  Remove recognize and recognize_by_name.  Add
10971         do_instantiate_target.
10972         * x86_64.cc (class Target_selector_x86_64): Likewise.
10973         * testsuite/testfile.cc (class Target_selector_test): Update for
10974         changes to Target_selector.
10975
10976         * README: Rewrite, with some notes on unsupported features.
10977
10978 2008-03-24  Cary Coutant  <ccoutant@google.com>
10979
10980         * i386.cc (Target_i386::Got_type): New enum declaration.
10981         (Target_i386::Scan::local): Updated callers of Output_data_got
10982         member functions.
10983         (Target_i386::Scan::global): Likewise.
10984         (Target_i386::Relocate::relocate): Likewise.
10985         (Target_i386::Relocate::relocate_tls): Likewise.
10986         * object.h (Got_offset_list): New class.
10987         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10988         (Sized_relobj::local_got_offset): Likewise.
10989         (Sized_relobj::set_local_got_offset): Likewise.
10990         (Sized_relobj::local_has_tls_got_offset): Removed.
10991         (Sized_relobj::local_tls_got_offset): Removed.
10992         (Sized_relobj::set_local_tls_got_offset): Removed.
10993         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10994         * output.cc (Output_data_got::add_global): Added got_type parameter.
10995         (Output_data_got::add_global_with_rel): Likewise.
10996         (Output_data_got::add_global_with_rela): Likewise.
10997         (Output_data_got::add_global_pair_with_rel): New function.
10998         (Output_data_got::add_global_pair_with_rela): New function.
10999         (Output_data_got::add_local): Added got_type parameter.
11000         (Output_data_got::add_local_with_rel): Likewise.
11001         (Output_data_got::add_local_with_rela): Likewise.
11002         (Output_data_got::add_local_pair_with_rel): New function.
11003         (Output_data_got::add_local_pair_with_rela): New function.
11004         (Output_data_got::add_global_tls): Removed.
11005         (Output_data_got::add_global_tls_with_rel): Removed.
11006         (Output_data_got::add_global_tls_with_rela): Removed.
11007         (Output_data_got::add_local_tls): Removed.
11008         (Output_data_got::add_local_tls_with_rel): Removed.
11009         (Output_data_got::add_local_tls_with_rela): Removed.
11010         * output.h (Output_data_got::add_global): Added got_type parameter.
11011         (Output_data_got::add_global_with_rel): Likewise.
11012         (Output_data_got::add_global_with_rela): Likewise.
11013         (Output_data_got::add_global_pair_with_rel): New function.
11014         (Output_data_got::add_global_pair_with_rela): New function.
11015         (Output_data_got::add_local): Added got_type parameter.
11016         (Output_data_got::add_local_with_rel): Likewise.
11017         (Output_data_got::add_local_with_rela): Likewise.
11018         (Output_data_got::add_local_pair_with_rel): New function.
11019         (Output_data_got::add_local_pair_with_rela): New function.
11020         (Output_data_got::add_global_tls): Removed.
11021         (Output_data_got::add_global_tls_with_rel): Removed.
11022         (Output_data_got::add_global_tls_with_rela): Removed.
11023         (Output_data_got::add_local_tls): Removed.
11024         (Output_data_got::add_local_tls_with_rel): Removed.
11025         (Output_data_got::add_local_tls_with_rela): Removed.
11026         * resolve.cc (Symbol::override_base_with_special): Removed
11027         reference to has_got_offset_ field.
11028         * symtab.cc (Symbol::init_fields): Replaced initialization
11029         of got_offset_ with got_offsets_.  Removed initialization
11030         of has_got_offset_
11031         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11032         (Symbol::got_offset): Likewise.
11033         (Symbol::set_got_offset): Likewise.
11034         (Symbol::has_tls_got_offset): Removed.
11035         (Symbol::tls_got_offset): Removed.
11036         (Symbol::set_tls_got_offset): Removed.
11037         (Symbol::got_offset_): Removed.
11038         (Symbol::tls_mod_got_offset_): Removed.
11039         (Symbol::tls_pair_got_offset_): Removed.
11040         (Symbol::got_offsets_): New field.
11041         (Symbol::has_got_offset): Removed.
11042         (Symbol::has_tls_mod_got_offset): Removed.
11043         (Symbol::has_tls_pair_got_offset): Removed.
11044         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11045         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11046         member functions.
11047         (Target_x86_64::Scan::global): Likewise.
11048         (Target_x86_64::Relocate::relocate): Likewise.
11049         (Target_x86_64::Relocate::relocate_tls): Likewise.
11050
11051 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11052
11053         * yyscript.y: Fix spelling error in comment.
11054
11055 2008-03-24  Ian Lance Taylor  <iant@google.com>
11056
11057         * options.h (class General_options): Define build_id option.
11058         * layout.h (class Layout): Declare write_build_id, create_note,
11059         create_build_id.  Add build_id_note_ member.
11060         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11061         "libiberty.h", "md5.h", "sha1.h".
11062         (Layout::Layout): Initialize eh_frame_data_,
11063         eh_frame_hdr_section_, and build_id_note_.
11064         (Layout::finalize): Call create_build_id.
11065         (Layout::create_note): New function, broken out of
11066         Layout::create_gold_note.
11067         (Layout::create_gold_note): Call create_note.
11068         (Layout::create_build_id): New function.
11069         (Layout::write_build_id): New function.
11070         (Close_task_runner::run): Call write_build_id.
11071
11072         * x86_64.cc: Correct license to GPLv3.
11073
11074 2008-03-23  Ian Lance Taylor  <iant@google.com>
11075
11076         * options.cc: Include "demangle.h".
11077         (parse_optional_string): New function.
11078         (parse_long_option): Handle takes_optional_argument.
11079         (parse_short_option): Update dash_z initializer.  Handle
11080         takes_optional_argument.
11081         (General_options::General_options): Initialize do_demangle_.
11082         (General_options::finalize): Set do_demangle_.  Handle demangling
11083         style.
11084         * options.h (parse_optional_string): Declare.
11085         (struct One_option): Add optional_arg field.  Update constructor.
11086         Update call constructor calls.  Add takes_optional_argument
11087         function.
11088         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11089         (DEFINE_optional_string): Define.
11090         (General_options::demangle): Change from DEFINE_bool to
11091         DEFINE_optional_string.
11092         (General_options::no_demangle): New function.
11093         (General_options::do_demangle): New function.
11094         (General_options::set_do_demangle): New function.
11095         (General_options::execstack_status_): Move definition to end of
11096         class definition.
11097         (General_options::static_): Likewise.
11098         (General_options::do_demangle_): New field.
11099         * object.cc (big_endian>::get_symbol_location_info): Call
11100         Options::do_demangle, not Options::demangle.
11101         * symtab.cc (demangle): Likewise.
11102
11103 2008-03-22  Ian Lance Taylor  <iant@google.com>
11104
11105         * gold.h: Include <cstddef> and <sys/types.h>
11106         * options.h: Include <cstring>.
11107
11108 2008-03-21  Ian Lance Taylor  <iant@google.com>
11109
11110         * Added source code to GNU binutils.