4a072a80396e7a0c8006608985a850b90a14caaa
[external/binutils.git] / gold / ChangeLog
1 2011-06-17  Ian Lance Taylor  <iant@google.com>
2
3         PR gold/12893
4         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5         symbol is redefined with the exact same object and value.
6
7 2011-06-17  Ian Lance Taylor  <iant@google.com>
8
9         PR gold/12880
10         * layout.h (class Layout): Add interp_segment_ field.
11         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
12         (Layout::attach_allocated_section_to_segment): If making shared
13         library, put .interp section in PT_INTERP segment.
14         (Layout::finalize): Also call create_interp if -dynamic-linker
15         option was used.
16         (Layout::create_interp): Assert that there is no PT_INTERP
17         segment.  If not using a SECTIONS clause, use make_output_section.
18         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
19         * script-sections.cc
20         (Script_sections::create_note_and_tls_segments): If making shared
21         library, put .interp section in PT_INTERP segment.
22
23 2011-06-17  Ian Lance Taylor  <iant@google.com>
24
25         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
26         when making a shared library.
27
28 2011-06-17  Ian Lance Taylor  <iant@google.com>
29
30         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
31         parameter.  Change all callers.  Don't issue warning about PC32
32         against locally defined symbol.
33
34 2011-06-16  Ian Lance Taylor  <iant@google.com>
35
36         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
37         occurs in same object.
38
39 2011-06-14  Alan Modra  <amodra@gmail.com>
40
41         * po/POTFILES.in: Regenerate.
42
43 2011-06-09  Ian Lance Taylor  <iant@google.com>
44
45         * script-sections.cc
46         (Orphan_output_section::set_section_addresses): For a relocatable
47         link set address to 0.
48
49 2011-06-09  Cary Coutant  <ccoutant@google.com>
50
51         PR gold/12804
52         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
53         used with --compress-debug-sections.
54         * gold/object.cc (Sized_relobj_file::do_layout): Report
55         uncompressed size of compressed input sections.
56
57 2011-06-08  Cary Coutant  <ccoutant@google.com>
58
59         PR gold/12804
60         * testsuite/two_file_test_2_v1.cc: Change initialization of
61         v2 to keep it in .data.
62
63 2011-06-07  Cary Coutant  <ccoutant@google.com>
64
65         * common.cc (Symbol_table::do_allocate_commons_list): Call
66         gold_fallback.
67         * errors.cc (Errors::fatal): Adjust call to gold_exit.
68         (Errors::fallback): New function.
69         (gold_fallback): New function.
70         * errors.h (Errors::fallback): New function.
71         * gold.cc (gold_exit): Change status parameter to enum; adjust
72         all callers.
73         (queue_initial_tasks): Call gold_fallback.
74         * gold.h: Include cstdlib.
75         (Exit_status): New enum type.
76         (gold_exit): Change status parameter to enum.
77         (gold_fallback): New function.
78         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
79         (Layout::create_symtab_sections): Likewise.
80         (Layout::create_shdrs): Likewise.
81         * main.cc (main): Adjust call to gold_exit.
82         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
83         (Output_data_got::add_got_entry_pair): Likewise.
84         (Output_section::add_input_section): Likewise.
85         (Output_section::add_output_section_data): Likewise.
86         (Output_segment::set_section_list_addresses): Likewise.
87         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
88
89 2011-06-07  Cary Coutant  <ccoutant@google.com>
90
91         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
92         for incremental links.
93         * output.cc (Output_segment::set_section_list_addresses): Remove
94         FIXME and test for TLS or BSS.
95
96 2011-06-07  Cary Coutant  <ccoutant@google.com>
97
98         * testsuite/Makefile.am: Add incremental_copy_test,
99         incremental_common_test_1.
100         * testsuite/Makefile.in: Regenerate.
101         * testsuite/common_test_1_v1.c: New source file.
102         * testsuite/common_test_1_v2.c: New source file.
103         * testsuite/copy_test_v1.cc: New source file.
104
105 2011-06-07  Cary Coutant  <ccoutant@google.com>
106
107         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
108         update, allocate common from bss section's free list.
109         * incremental-dump.cc (dump_incremental_inputs): Print flag for
110         linker-defined symbols.
111         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
112         Skip GOT and PLT entries that are no longer referenced.
113         (Output_section_incremental_inputs::write_info_blocks): Mark
114         linker-defined symbols.
115         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
116         * output.cc (Output_section::allocate): New function.
117         * output.h (Output_section::allocate): New function.
118         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
119         linker-defined symbols.
120         (Symbol::override_base_with_special): Copy is_predefined_ flag.
121         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
122         (Symbol::init_base_output_data): Likewise.
123         (Symbol::init_base_output_segment): Likewise.
124         (Symbol::init_base_constant): Likewise.
125         (Sized_symbol::init_output_data): Likewise.
126         (Sized_symbol::init_output_segment): Likewise.
127         (Sized_symbol::init_constant): Likewise.
128         (Symbol_table::do_define_in_output_data): Likewise.
129         (Symbol_table::do_define_in_output_segment): Likewise.
130         (Symbol_table::do_define_as_constant): Likewise.
131         * symtab.h (Symbol::is_predefined): New function.
132         (Symbol::init_base_output_data): Add is_predefined parameter.
133         (Symbol::init_base_output_segment): Likewise.
134         (Symbol::init_base_constant): Likewise.
135         (Symbol::is_predefined_): New data member.
136         (Sized_symbol::init_output_data): Add is_predefined parameter.
137         (Sized_symbol::init_output_segment): Likewise.
138         (Sized_symbol::init_constant): Likewise.
139         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
140
141 2011-06-07  Cary Coutant  <ccoutant@google.com>
142
143         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
144         instead of emit_copy_reloc.
145         (Copy_relocs::emit_copy_reloc): Refactor.
146         (Copy_relocs::make_copy_reloc): New function.
147         (Copy_relocs::add_copy_reloc): Remove.
148         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
149         section.
150         (Copy_relocs::make_copy_reloc): New function.
151         (Copy_relocs::add_copy_reloc): Remove.
152         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
153         unchanged input files.
154         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
155         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
156         Reserve BSS space for COPY relocations.
157         (Sized_incremental_binary::do_emit_copy_relocs): New function.
158         (Output_section_incremental_inputs::write_info_blocks): Record
159         whether a symbol is copied from a shared object.
160         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
161         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
162         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
163         (Incremental_input_entry_reader::get_output_symbol_index): Add
164         is_copy parameter.
165         (Incremental_binary::emit_copy_relocs): New function.
166         (Incremental_binary::do_emit_copy_relocs): New function.
167         (Sized_incremental_binary::Sized_incremental_binary): Initialize
168         new data member.
169         (Sized_incremental_binary::add_copy_reloc): New function.
170         (Sized_incremental_binary::do_emit_copy_relocs): New function.
171         (Sized_incremental_binary::Copy_reloc): New struct.
172         (Sized_incremental_binary::Copy_relocs): New typedef.
173         (Sized_incremental_binary::copy_relocs_): New data member.
174         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
175         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
176         * target.h (Sized_target::emit_copy_reloc): New function.
177         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
178
179 2011-06-02  Cary Coutant  <ccoutant@google.com>
180
181         PR gold/12163
182         * gold/archive.cc (Archive::Archive): Initialize new data member.
183         (Archive::include_all_members): Return if archive has already been
184         included.
185         * gold/archive.h (Archive::include_all_members_): New data member.
186
187 2011-06-02  Nick Clifton  <nickc@redhat.com>
188
189         * dynobj.h: Fix spelling mistake in comment.
190         * output.cc: Likewise.
191
192 2011-05-31  Doug Kwan  <dougkwan@google.com>
193             Asier Llano
194
195         PR gold/12826
196         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
197         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
198         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
199         redundant arm_exidx_test.so.
200         * testsuite/Makefile.in: Regenerate.
201         (check_SCRIPTS): Add pr12826.sh
202         (check_DATA): Add pr12826.stdout
203         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
204         * testsuite/pr12826.sh: New file.
205         * testsuite/pr12826_1.s: Ditto.
206         * testsuite/pr12826_1.s: Ditto.
207
208 2011-05-30  Ian Lance Taylor  <iant@google.com>
209
210         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
211         sections.
212
213 2011-05-29  Ian Lance Taylor  <iant@google.com>
214
215         PR gold/12804
216         * testsuite/Makefile.am: Use different file name for two_file_test
217         temporary file for each incremental test.
218         * testsuite/Makefile.in: Rebuild.
219
220 2011-05-29  Ian Lance Taylor  <iant@google.com>
221
222         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
223         binary input file is empty.
224
225 2011-05-27  Ian Lance Taylor  <iant@google.com>
226
227         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
228         (ver_test_9.so): Likewise.
229         * testsuite/Makefile.in: Rebuild.
230
231 2011-05-26 Cary Coutant  <ccoutant@google.com>
232
233         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
234         * incremental.cc (Incremental_inputs::report_input_section): Fix
235         comment, indentation.
236         (Incremental_inputs::report_comdat_group): New function.
237         (Output_section_incremental_inputs::set_final_data_size): Adjust size
238         of data for incremental input file entry.
239         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
240         group count, COMDAT group signatures.
241         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
242         an unchanged input file.
243         * incremental.h (Incremental_object_entry::Incremental_object_entry):
244         Initialize new data member.
245         (Incremental_object_entry::add_comdat_group): New function.
246         (Incremental_object_entry::get_comdat_group_count): New function.
247         (Incremental_object_entry::get_comdat_signature_key): New function.
248         (Incremental_object_entry::groups_): New data member.
249         (Incremental_inputs::report_comdat_group): New function.
250         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
251         data for incremental input file entry.
252         (Incremental_input_entry_reader::get_comdat_group_count): New function.
253         (Incremental_input_entry_reader::get_input_section): Adjust size of
254         data for incremental input file entry.
255         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
256         (Incremental_input_entry_reader::get_comdat_group_signature): New
257         function.
258         * object.cc (Sized_relobj::include_section_group): Report kept
259         COMDAT groups for incremental links.
260
261 2011-05-24  David Meyer  <pdox@google.com>
262
263         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
264         with name parameter.  Add found_name parameter.
265         * fileread.cc (Input_file::find_file): Adjust code accordingly.
266         * dirsearch.h (class Dirsearch): Update declaration.
267
268 2011-05-24  Ian Lance Taylor  <iant@google.com>
269
270         * archive.cc (Library_base::should_include_member): Pull in object
271         from archive if it defines the entry symbol.
272         * parameters.cc (Parameters::entry): New function.
273         * parameters.h (class Parameters): Declare entry.
274         * output.h (class Output_file_header): Remove entry_ field.
275         * output.cc (Output_file_header::Output_file_header): Remove entry
276         parameter.  Change all callers.
277         (Output_file_header::entry): Use parameters->entry.
278         * gold.cc (queue_middle_tasks): Likewise.
279         * plugin.cc (Plugin_hook::run): Likewise.
280
281 2011-05-24 Cary Coutant  <ccoutant@google.com>
282
283         * gold.cc (queue_initial_tasks): Pass incremental base filename
284         to Output_file::open_base_file; don't print error message.
285         * incremental-dump.cc (main): Adjust call to
286         Output_file::open_for_modification.
287         * incremental-dump.cc (main): Likewise.
288         * incremental.cc (Incremental_inputs::report_command_line):
289         Ignore --incremental-base option when comparing command lines.
290         Ignore parameter when given as separate argument.
291         * options.h (class General_options): Add --incremental-base.
292         * output.cc (Output_file::Output_file):
293         (Output_file::open_base_file): Add base_name and writable parameters;
294         read base file into new file; print error message here.
295         (Output_file::map_no_anonymous): Add writable parameter; adjust all
296         callers.
297         * output.h (Output_file::open_for_modification): Rename to...
298         (Output_file::open_base_file): ...this; add base_name and
299         writable parameters; adjust all callers.
300         (Output_file::map_no_anonymous): Add writable parameter; adjust all
301         callers.
302         * testsuite/Makefile.am (incremental_test_4): Test
303         --incremental-base.
304         * testsuite/Makefile.in: Regenerate.
305
306 2011-05-24 Cary Coutant  <ccoutant@google.com>
307
308         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
309         incremental_test_4.
310         * testsuite/Makefile.in: Regenerate.
311         * testsuite/two_file_test_1_v1.cc: New test source file.
312         * testsuite/two_file_test_1b_v1.cc: New test source file.
313         * testsuite/two_file_test_2_v1.cc: New test source file.
314
315 2011-05-24 Cary Coutant  <ccoutant@google.com>
316
317         * dynobj.h (Dynobj::do_dynobj): New function.
318         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
319         flag and soname for shared objects.
320         * incremental.cc (Incremental_inputs::report_object): Make
321         either Incremental_object_entry or Incremental_dynobj_entry; add
322         soname to string table.
323         (Incremental_inputs::report_input_section): Add assertion.
324         (Output_section_incremental_inputs::set_final_data_size): Adjust
325         type of input file entry for shared libraries; adjust size of
326         shared library info entry.
327         (Output_section_incremental_inputs::write_input_files): Write
328         as_needed flag for shared libraries.
329         (Output_section_incremental_inputs::write_info_blocks): Adjust type
330         of input file entry for shared libraries; write soname.
331         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
332         soname from incremental info.
333         * incremental.h (enum Incremental_input_flags): Add
334         INCREMENTAL_INPUT_AS_NEEDED.
335         (Incremental_input_entry::Incremental_input_entry): Initialize new
336         data member.
337         (Incremental_input_entry::set_as_needed): New function.
338         (Incremental_input_entry::as_needed): New function.
339         (Incremental_input_entry::do_dynobj_entry): New function.
340         (Incremental_input_entry::as_needed_): New data member.
341         (Incremental_object_entry::Incremental_object_entry): Don't check
342         for shared library.
343         (Incremental_object_entry::do_type): Likewise.
344         (class Incremental_dynobj_entry): New class.
345         (Incremental_input_entry_reader::as_needed): New function.
346         (Incremental_input_entry_reader::get_soname): New function.
347         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
348         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
349         size of shared library info entry.
350         * layout.cc (Layout::finish_dynamic_section): Don't test for 
351         incremental link when adding DT_NEEDED entries.
352         * object.h (Object::Object): Initialize new data member.
353         (Object::dynobj): New function.
354         (Object::set_as_needed): New function.
355         (Object::as_needed): New function.
356         (Object::do_dynobj): New function.
357         (Object::as_needed_): New data member.
358
359 2011-05-24 Cary Coutant  <ccoutant@google.com>
360
361         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
362         info; adjust display of GOT entries.
363         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
364         vector of input objects; remove file_status_.
365         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
366         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
367         got_plt reader; call target hooks to reserve GOT entries.
368         (Output_section_incremental_inputs::set_final_data_size): Adjust size
369         of input file info header and GOT info entry.
370         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
371         relocation info.
372         (Got_plt_view_info::got_descriptor): Remove.
373         (Got_plt_view_info::sym_index): New data member.
374         (Got_plt_view_info::input_index): New data member.
375         (Local_got_offset_visitor::visit): Write input file index.
376         (Global_got_offset_visitor::visit): Write 0 for input file index.
377         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
378         with sym_index and input_index.
379         (Output_section_incremental_inputs::write_got_plt): Adjust size of
380         incremental info GOT entry; replace got_descriptor with input_index.
381         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
382         map from input file index to object.
383         (Sized_relobj_incr::do_layout): Replace direct data member reference
384         with accessor function.
385         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
386         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
387         Adjust size of input file info header.
388         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
389         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
390         (Incremental_input_entry_reader::get_input_section): Adjust size of
391         input file info header.
392         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
393         of incremental info GOT entry.
394         (Incremental_got_plt_reader::get_got_desc): Remove.
395         (Incremental_got_plt_reader::get_got_symndx): New function.
396         (Incremental_got_plt_reader::get_got_input_index): New function.
397         (Sized_incremental_binary::Sized_incremental_binary): Remove
398         file_status_; add input_objects_.
399         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
400         (Sized_incremental_binary::set_file_is_unchanged): Remove.
401         (Sized_incremental_binary::file_is_unchanged): Remove.
402         (Sized_incremental_binary::set_input_object): New function.
403         (Sized_incremental_binary::input_object): New function.
404         (Sized_incremental_binary::file_status_): Remove.
405         (Sized_incremental_binary::input_objects_): New data member.
406         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
407         references.
408         (Sized_relobj_incr::invalid_address): Move to base class.
409         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
410         class.
411         (Sized_relobj_incr::do_output_section_offset): Likewise.
412         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
413         (Sized_relobj_incr::section_offsets_): Likewise.
414         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
415         function.
416         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
417         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
418         with accessor function.
419         (Sized_relobj_file::do_layout): Likewise.
420         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
421         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
422         (Sized_relobj_file::compute_final_local_value): Replace refs to
423         section_offsets_ with accessor function.
424         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
425         * object.h (Relobj::Relobj): Initialize new data members.
426         (Relobj::add_dyn_reloc): New function.
427         (Relobj::first_dyn_reloc): New function.
428         (Relobj::dyn_reloc_count): New function.
429         (Relobj::first_dyn_reloc_): New data member.
430         (Relobj::dyn_reloc_count_): New data member.
431         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
432         references.
433         (Sized_relobj::Address): New typedef.
434         (Sized_relobj::invalid_address): Move here from child class.
435         (Sized_relobj::Sized_relobj): Initialize new data members.
436         (Sized_relobj::sized_relobj): New function.
437         (Sized_relobj::is_output_section_offset_invalid): Move here from
438         child class.
439         (Sized_relobj::get_output_section_offset): Likewise.
440         (Sized_relobj::local_has_got_offset): Likewise.
441         (Sized_relobj::local_got_offset): Likewise.
442         (Sized_relobj::set_local_got_offset): Likewise.
443         (Sized_relobj::do_for_all_local_got_entries): Likewise.
444         (Sized_relobj::clear_got_offsets): New function.
445         (Sized_relobj::section_offsets): Move here from child class.
446         (Sized_relobj::do_output_section_offset): Likewise.
447         (Sized_relobj::do_set_section_offset): Likewise.
448         (Sized_relobj::Local_got_offsets): Likewise.
449         (Sized_relobj::local_got_offsets_): Likewise.
450         (Sized_relobj::section_offsets_): Likewise.
451         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
452         references.
453         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
454         class.
455         (Sized_relobj_file::sized_relobj): New function
456         (Sized_relobj_file::local_has_got_offset): Move to base class.
457         (Sized_relobj_file::local_got_offset): Likewise.
458         (Sized_relobj_file::set_local_got_offset): Likewise.
459         (Sized_relobj_file::get_output_section_offset): Likewise.
460         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
461         (Sized_relobj_file::do_output_section_offset): Likewise.
462         (Sized_relobj_file::do_set_section_offset): Likewise.
463         (Sized_relobj_file::Local_got_offsets): Likewise.
464         (Sized_relobj_file::local_got_offsets_): Likewise.
465         (Sized_relobj_file::section_offsets_): Likewise.
466         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
467         (all constructors).
468         (set_needs_dynsym_index): Convert relobj to derived class pointer.
469         (Output_reloc::get_symbol_index): Likewise.
470         (Output_reloc::local_section_offset): Likewise.
471         (Output_reloc::get_address): Likewise.
472         (Output_reloc::symbol_value): Likewise.
473         (Output_data_got::reserve_slot): Move to class definition.
474         (Output_data_got::reserve_local): New function.
475         (Output_data_got::reserve_slot_for_global): Remove.
476         (Output_data_got::reserve_global): New function.
477         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
478         (all constructors, two instantiations).
479         (Output_reloc::get_relobj): New function (two instantiations).
480         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
481         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
482         (Output_data_reloc::add_global): Adjust type of relobj.
483         (Output_data_reloc::add_global_relative): Likewise.
484         (Output_data_reloc::add_symbolless_global_addend): Likewise.
485         (Output_data_reloc::add_local): Likewise.
486         (Output_data_reloc::add_local_relative): Likewise.
487         (Output_data_reloc::add_symbolless_local_addend): Likewise.
488         (Output_data_reloc::add_local_section): Likewise.
489         (Output_data_reloc::add_output_section): Likewise.
490         (Output_data_reloc::add_absolute): Likewise.
491         (Output_data_reloc::add_target_specific): Likewise.
492         (Output_data_got::reserve_slot): Move definition here.
493         (Output_data_got::reserve_local): New function.
494         (Output_data_got::reserve_global): New function.
495         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
496         section_offsets_ with accessor function.
497         (Sized_relobj_file::write_sections): Likewise.
498         (Sized_relobj_file::do_relocate_sections): Likewise.
499         * target.h (Sized_target::reserve_local_got_entry): New function.
500         (Sized_target::reserve_global_got_entry): New function.
501         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
502         (Target_x86_64::reserve_global_got_entry): New function.
503         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
504
505 2011-05-23 Cary Coutant  <ccoutant@google.com>
506
507         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
508         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
509         bit when checking got_type.
510         * incremental.cc (Sized_incremental_binary::setup_readers):
511         Store symbol table and string table locations; initialize bit vector
512         of file status flags.
513         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
514         unchanged files.
515         (Sized_incremental_binary::do_process_got_plt): New function.
516         (Sized_incremental_binary::get_symtab_view): Use stored locations.
517         (Output_section_incremental_inputs::set_final_data_size): Record
518         file index for each input file.
519         (Output_section_incremental_inputs::write_got_plt): Store file index
520         instead of input entry offset for each GOT entry.
521         * incremental.h
522         (Incremental_input_entry::Incremental_input_entry): Initialize new
523         data member.
524         (Incremental_input_entry::set_offset): Store file index.
525         (Incremental_input_entry::get_file_index): New function.
526         (Incremental_input_entry::file_index_): New data member.
527         (Incremental_binary::process_got_plt): New function.
528         (Incremental_binary::do_process_got_plt): New function.
529         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
530         data members.
531         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
532         (Sized_incremental_binary::set_file_is_unchanged): New function.
533         (Sized_incremental_binary::file_is_unchanged): New function.
534         (Sized_incremental_binary::do_process_got_plt): New function.
535         (Sized_incremental_binary::file_status_): New data member.
536         (Sized_incremental_binary::main_symtab_loc_): New data member.
537         (Sized_incremental_binary::main_strtab_loc_): New data member.
538         * output.cc (Output_data_got::Got_entry::write): Add case
539         RESERVED_CODE.
540         (Output_data_got::add_global): Call add_got_entry.
541         (Output_data_got::add_global_plt): Likewise.
542         (Output_data_got::add_global_with_rel): Likewise.
543         (Output_data_got::add_global_with_rela): Likewise.
544         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
545         (Output_data_got::add_global_pair_with_rela): Likewise.
546         (Output_data_got::add_local): Call add_got_entry.
547         (Output_data_got::add_local_plt): Likewise.
548         (Output_data_got::add_local_with_rel): Likewise.
549         (Output_data_got::add_local_with_rela): Likewise.
550         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
551         (Output_data_got::add_local_pair_with_rela): Likewise.
552         (Output_data_got::reserve_slot): New function.
553         (Output_data_got::reserve_slot_for_global): New function.
554         (Output_data_got::add_got_entry): New function.
555         (Output_data_got::add_got_entry_pair): New function.
556         (Output_section::add_output_section_data): Edit FIXME.
557         * output.h
558         (Output_section_data_build::Output_section_data_build): New
559         constructor with size parameter.
560         (Output_data_space::Output_data_space): Likewise.
561         (Output_data_got::Output_data_got): Initialize new data member; new
562         constructor with size parameter.
563         (Output_data_got::add_constant): Call add_got_entry.
564         (Output_data_got::reserve_slot): New function.
565         (Output_data_got::reserve_slot_for_global): New function.
566         (class Output_data_got::Got_entry): Add RESERVED_CODE.
567         (Output_data_got::add_got_entry): New function.
568         (Output_data_got::add_got_entry_pair): New function.
569         (Output_data_got::free_list_): New data member.
570         * target.h (Sized_target::init_got_plt_for_update): New function.
571         (Sized_target::register_global_plt_entry): New function.
572         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
573         Initialize new data member; call init; add constructor with PLT count.
574         (Output_data_plt_x86_64::init): New function.
575         (Output_data_plt_x86_64::add_relocation): New function.
576         (Output_data_plt_x86_64::reserve_slot): New function.
577         (Output_data_plt_x86_64::free_list_): New data member.
578         (Target_x86_64::init_got_plt_for_update): New function.
579         (Target_x86_64::register_global_plt_entry): New function.
580         (Output_data_plt_x86_64::add_entry): Allocate from free list for
581         incremental updates.
582         (Output_data_plt_x86_64::add_relocation): New function.
583         * testsuite/object_unittest.cc (Object_test): Set default options.
584
585 2011-05-16  Ian Lance Taylor  <iant@google.com>
586
587         * options.h (class General_options): Make -i a synonym for -r.
588
589 2011-05-16  Ian Lance Taylor  <iant@google.com>
590
591         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
592
593 2011-05-10 Cary Coutant  <ccoutant@google.com>
594
595         * object.cc (Sized_relobj::do_count_local_symbols): Check for
596         strip_all (-s).
597
598 2011-05-06  Ian Lance Taylor  <iant@google.com>
599
600         * layout.cc (Layout::layout): If the output section flags change,
601         update the ordering.
602
603 2011-04-25 Cary Coutant  <ccoutant@google.com>
604
605         * incremental-dump.cc (dump_incremental_inputs): Print local
606         symbol info for each input file.
607         * incremental.cc
608         (Output_section_incremental_inputs::set_final_data_size): Add local
609         symbol info to input file entries in incremental info.
610         (Output_section_incremental_inputs::write_info_blocks): Likewise.
611         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
612         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
613         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
614         implementation.
615         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
616         (Sized_incr_relobj::do_relocate): Write the local symbols.
617         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
618         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
619         Adjust size of input file header.
620         (Incremental_inputs_reader::get_local_symbol_offset): New function.
621         (Incremental_inputs_reader::get_local_symbol_count): New function.
622         (Incremental_inputs_reader::get_input_section): Adjust size of input
623         file header.
624         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
625         (Sized_incr_relobj::This): New typedef.
626         (Sized_incr_relobj::sym_size): New const data member.
627         (Sized_incr_relobj::Local_symbol): New struct.
628         (Sized_incr_relobj::do_output_local_symbol_count): New function.
629         (Sized_incr_relobj::do_local_symbol_offset): New function.
630         (Sized_incr_relobj::local_symbol_count_): New data member.
631         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
632         (Sized_incr_relobj::local_symbol_index_): New data member.
633         (Sized_incr_relobj::local_symbol_offset_): New data member.
634         (Sized_incr_relobj::local_dynsym_offset_): New data member.
635         (Sized_incr_relobj::local_symbols_): New data member.
636         * object.h (Relobj::output_local_symbol_count): New function.
637         (Relobj::local_symbol_offset): New function.
638         (Relobj::do_output_local_symbol_count): New function.
639         (Relobj::do_local_symbol_offset): New function.
640         (Sized_relobj::do_output_local_symbol_count): New function.
641         (Sized_relobj::do_local_symbol_offset): New function.
642
643 2011-04-22  Vladimir Simonov  <sv@sw.ru>
644
645         * descriptors.cc (set_close_on_exec): New function.
646         (Descriptors::open): Use set_close_on_exec.
647         * output.cc (S_ISLNK): Define if not defined.
648
649 2011-04-22 Cary Coutant  <ccoutant@google.com>
650
651         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
652         global symbol map.
653         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
654         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
655         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
656         relocations.
657         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
658         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
659         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
660         * incremental.h
661         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
662         function.
663         (Incremental_binary::apply_incremental_relocs): New function.
664         (Incremental_binary::do_apply_incremental_relocs): New function.
665         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
666         data member.
667         (Sized_incremental_binary::add_global_symbol): New function.
668         (Sized_incremental_binary::global_symbol): New function.
669         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
670         (Sized_incremental_binary::symbol_map_): New data member.
671         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
672         * target.h (Sized_target::apply_relocation): New function.
673         * target-reloc.h (apply_relocation): New function.
674         * x86_64.cc (Target_x86_64::apply_relocation): New function.
675
676 2011-04-22  Doug Kwan  <dougkwan@google.com>
677
678         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
679         flag of a SHT_ARM_EXIDX section.
680         * testsuite/Makefile.am (arm_exidx_test): New test rules.
681         * testsuite/Makefile.in: Regenerate.
682         * testsuite/arm_exidx_test.s: New file.
683         * testsuite/arm_exidx_test.sh: Same.
684
685 2011-04-20 Cary Coutant  <ccoutant@google.com>
686
687         PR gold/12689
688         * archive.h (Incremental_archive_entry::Archive_member):
689         Initialize arg_serial_ (second constructor).
690
691 2011-04-17  Ian Lance Taylor  <iant@google.com>
692
693         * object.cc (Relocate_info::location): Simplify location string.
694         * errors.cc (Errors::error_at_location): Don't print program
695         name.
696         (Errors::warning_at_location): Likewise.
697         (Errors::undefined_symbol): Likewise.
698         * testsuite/debug_msg.sh: Update accordingly.
699
700 2011-04-14 Cary Coutant  <ccoutant@google.com>
701
702         * gold/layout.cc (Layout::symtab_section_offset): New function.
703         * gold/layout.h (Layout::symtab_section_offset): New function.
704         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
705
706 2011-04-12  Ian Lance Taylor  <iant@google.com>
707
708         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
709         with MREMAP_MAYMOVE.
710         * output.h (class Output_file): Add map_is_allocated_ field.
711         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
712         not available, provide stubs.  If mremap is not available, #define
713         it to gold_mremap.
714         (MREMAP_MAYMOVE): Define if not defined.
715         (Output_file::Output_file): Initialize map_is_allocated_.
716         (Output_file::resize): Check map_is_allocated_.
717         (Output_file::map_anonymous): If mmap fails, use malloc.
718         (Output_file::unmap): Don't do anything for an anonymous map.
719         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
720         is not available, provide stubs.
721         (File_read::View::~View): Use free rather than delete[].
722         (File_read::make_view): Use malloc rather than new[].  If mmap
723         fails, use malloc.
724         (File_read::find_or_make_view): Use malloc rather than new[].
725         * gold.h: Remove HAVE_REMAP code.
726         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
727         exists.  Rename mremap to gold_mremap.  If mmap is not available
728         don't do anything.
729         * configure, config.in: Rebuild.
730
731 2011-04-11  Ian Lance Taylor  <iant@google.com>
732
733         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
734         initialize local variable v.
735
736 2011-04-11  Cary Coutant  <ccoutant@google.com>
737
738         * archive.cc (Archive::include_member): Adjust call to
739         report_object.
740         (Add_archive_symbols::run): Track argument serial numbers.
741         (Lib_group::include_member): Likewise.
742         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
743         * archive.h (Incremental_archive_entry::Archive_member):
744         Initialize arg_serial_.
745         (Archive_member::arg_serial_): New data member.
746         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
747         (Sized_dynobj::do_add_symbols): Track symbols when doing an
748         incremental link.
749         (Sized_dynobj::do_for_all_local_got_entries): New function.
750         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
751         function.
752         * fileread.cc (get_mtime): New function.
753         * fileread.h (get_mtime): New function.
754         * gold.cc (queue_initial_tasks): Check for incremental update.
755         (process_incremental_input): New function.
756         (queue_middle_tasks): Don't force valid target for incremental
757         update.
758         * incremental-dump.cc (find_input_containing_global): Adjust
759         size of symbol info entry.
760         (dump_incremental_inputs): Dump argument serial number and
761         in_system_directory flag; bias shndx by 1; print symbol names
762         when dumping per-file symbol lists; use new symbol info readers.
763         * incremental.cc
764         (Output_section_incremental_inputs:update_data_size): New function.
765         (Sized_incremental_binary::setup_readers): Setup input readers
766         for each input file; build maps for files added from libraries
767         and scripts.
768         (Sized_incremental_binary::check_input_args): New function.
769         (Sized_incremental_binary::do_check_inputs): Build map of argument
770         serial numbers to input arguments.
771         (Sized_incremental_binary::do_file_has_changed): Rename
772         do_file_is_unchanged to this; compare file modification times.
773         (Sized_incremental_binary::do_init_layout): New function.
774         (Sized_incremental_binary::do_reserve_layout): New function.
775         (Sized_incremental_binary::do_get_input_reader): Remove.
776         (Sized_incremental_binary::get_symtab_view): New function.
777         (Incremental_checker::can_incrementally_link_output_file): Remove.
778         (Incremental_inputs::report_command_line): Exclude --debug options.
779         (Incremental_inputs::report_archive_begin): Add parameter; track
780         argument serial numbers; don't put input file entry for archive
781         before archive members.
782         (Incremental_inputs::report_archive_end): Put input file entry
783         for archive after archive members.
784         (Incremental_inputs::report_object): Add parameter; track argument
785         serial numbers and in_system_directory flag.
786         (Incremental_inputs::report_script): Add parameter; track argument
787         serial numbers.
788         (Output_section_incremental_inputs::set_final_data_size): Adjust
789         size of symbol info entry; check for forwarding symbols.
790         (Output_section_incremental_inputs::write_input_files): Write
791         in_system_directory flag and argument serial number.
792         (Output_section_incremental_inputs::write_info_blocks): Map section
793         indices between incremental info and original input file; store
794         input section index for each symbol.
795         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
796         change operator() to visit().
797         (class Global_got_offset_visitor): Likewise.
798         (class Global_symbol_visitor_got_plt):
799         (Output_section_incremental_inputs::write_got_plt): Use new visitor
800         classes.
801         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
802         (Sized_incr_relobj::do_read_symbols): New function.
803         (Sized_incr_relobj::do_layout): New function.
804         (Sized_incr_relobj::do_layout_deferred_sections): New function.
805         (Sized_incr_relobj::do_add_symbols): New function.
806         (Sized_incr_relobj::do_should_include_member): New function.
807         (Sized_incr_relobj::do_for_all_global_symbols): New function.
808         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
809         (Sized_incr_relobj::do_section_size): New function.
810         (Sized_incr_relobj::do_section_name): New function.
811         (Sized_incr_relobj::do_section_contents): New function.
812         (Sized_incr_relobj::do_section_flags): New function.
813         (Sized_incr_relobj::do_section_entsize): New function.
814         (Sized_incr_relobj::do_section_address): New function.
815         (Sized_incr_relobj::do_section_type): New function.
816         (Sized_incr_relobj::do_section_link): New function.
817         (Sized_incr_relobj::do_section_info): New function.
818         (Sized_incr_relobj::do_section_addralign): New function.
819         (Sized_incr_relobj::do_initialize_xindex): New function.
820         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
821         (Sized_incr_relobj::do_read_relocs): New function.
822         (Sized_incr_relobj::do_gc_process_relocs): New function.
823         (Sized_incr_relobj::do_scan_relocs): New function.
824         (Sized_incr_relobj::do_count_local_symbols): New function.
825         (Sized_incr_relobj::do_finalize_local_symbols): New function.
826         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
827         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
828         (Sized_incr_relobj::do_relocate): New function.
829         (Sized_incr_relobj::do_set_section_offset): New function.
830         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
831         (Sized_incr_dynobj::do_read_symbols): New function.
832         (Sized_incr_dynobj::do_layout): New function.
833         (Sized_incr_dynobj::do_add_symbols): New function.
834         (Sized_incr_dynobj::do_should_include_member): New function.
835         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
836         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
837         (Sized_incr_dynobj::do_section_size): New function.
838         (Sized_incr_dynobj::do_section_name): New function.
839         (Sized_incr_dynobj::do_section_contents): New function.
840         (Sized_incr_dynobj::do_section_flags): New function.
841         (Sized_incr_dynobj::do_section_entsize): New function.
842         (Sized_incr_dynobj::do_section_address): New function.
843         (Sized_incr_dynobj::do_section_type): New function.
844         (Sized_incr_dynobj::do_section_link): New function.
845         (Sized_incr_dynobj::do_section_info): New function.
846         (Sized_incr_dynobj::do_section_addralign): New function.
847         (Sized_incr_dynobj::do_initialize_xindex): New function.
848         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
849         (make_sized_incremental_object): New function.
850         (Incremental_library::copy_unused_symbols): New function.
851         (Incremental_library::do_for_all_unused_symbols): New function.
852         * incremental.h (enum Incremental_input_flags): New type.
853         (class Incremental_checker): Remove.
854         (Incremental_input_entry::Incremental_input_entry): Add argument
855         serial number.
856         (Incremental_input_entry::arg_serial): New function.
857         (Incremental_input_entry::set_is_in_system_directory): New function.
858         (Incremental_input_entry::is_in_system_directory): New function.
859         (Incremental_input_entry::arg_serial_): New data member.
860         (Incremental_input_entry::is_in_system_directory_): New data member.
861         (class Script_info): Move here from script.h.
862         (Script_info::Script_info): Add filename parameter.
863         (Script_info::filename): New function.
864         (Script_info::filename_): New data member.
865         (Incremental_script_entry::Incremental_script_entry): Add argument
866         serial number.
867         (Incremental_object_entry::Incremental_object_entry): Likewise.
868         (Incremental_object_entry::add_input_section): Build list of input
869         sections with map to original shndx.
870         (Incremental_object_entry::get_input_section_index): New function.
871         (Incremental_object_entry::shndx_): New data member.
872         (Incremental_object_entry::name_key_): Rename; adjust all refs.
873         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
874         (Incremental_archive_entry::Incremental_archive_entry): Add argument
875         serial number.
876         (Incremental_inputs::report_archive_begin): Likewise.
877         (Incremental_inputs::report_object): Likewise.
878         (Incremental_inputs::report_script): Likewise.
879         (class Incremental_global_symbol_reader): New class.
880         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
881         and store flags and input file type.
882         (Incremental_input_entry_reader::arg_serial): New function.
883         (Incremental_input_entry_reader::type): Extract type from flags.
884         (Incremental_input_entry_reader::is_in_system_directory): New function.
885         (Incremental_input_entry_reader::get_input_section_count): Call
886         accessor function for type.
887         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
888         function for type; adjust size of global symbol entry.
889         (Incremental_input_entry_reader::get_global_symbol_count): Call
890         accessor function for type.
891         (Incremental_input_entry_reader::get_object_count): Likewise.
892         (Incremental_input_entry_reader::get_object_offset): Likewise.
893         (Incremental_input_entry_reader::get_member_count): Likewise.
894         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
895         (Incremental_input_entry_reader::get_member_offset): Likewise.
896         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
897         (Incremental_input_entry_reader::Global_symbol_info): Remove.
898         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
899         (Incremental_input_entry_reader::get_global_symbol_reader): New
900         function.
901         (Incremental_input_entry_reader::get_output_symbol_index): New
902         function.
903         (Incremental_input_entry_reader::type_): Remove.
904         (Incremental_input_entry_reader::flags_): New data member.
905         (Incremental_inputs_reader::input_file_offset): New function.
906         (Incremental_inputs_reader::input_file_index): New function.
907         (Incremental_inputs_reader::input_file): Call input_file_offset.
908         (Incremental_inputs_reader::input_file_at_offset): New function.
909         (Incremental_relocs_reader::get_r_type): Reformat.
910         (Incremental_relocs_reader::get_r_shndx): Reformat.
911         (Incremental_relocs_reader::get_r_offset): Reformat.
912         (Incremental_relocs_reader::data): New function.
913         (Incremental_binary::Incremental_binary): Initialize new data members.
914         (Incremental_binary::check_inputs): Add cmdline parameter.
915         (Incremental_binary::file_is_unchanged): Remove.
916         (Input_reader::arg_serial): New function.
917         (Input_reader::get_unused_symbol_count): New function.
918         (Input_reader::get_unused_symbol): New function.
919         (Input_reader::do_arg_serial): New function.
920         (Input_reader::do_get_unused_symbol_count): New function.
921         (Input_reader::do_get_unused_symbol): New function.
922         (Incremental_binary::input_file_count): New function.
923         (Incremental_binary::get_input_reader): Change signature to use
924         index instead of filename.
925         (Incremental_binary::file_has_changed): New function.
926         (Incremental_binary::get_input_argument): New function.
927         (Incremental_binary::get_library): New function.
928         (Incremental_binary::get_script_info): New function.
929         (Incremental_binary::init_layout): New function.
930         (Incremental_binary::reserve_layout): New function.
931         (Incremental_binary::output_file): New function.
932         (Incremental_binary::do_check_inputs): New function.
933         (Incremental_binary::do_file_is_unchanged): Remove.
934         (Incremental_binary::do_file_has_changed): New function.
935         (Incremental_binary::do_init_layout): New function.
936         (Incremental_binary::do_reserve_layout): New function.
937         (Incremental_binary::do_input_file_count): New function.
938         (Incremental_binary::do_get_input_reader): Change signature.
939         (Incremental_binary::input_args_map_): New data member.
940         (Incremental_binary::library_map_): New data member.
941         (Incremental_binary::script_map_): New data member.
942         (Sized_incremental_binary::Sized_incremental_binary): Initialize
943         new data members.
944         (Sized_incremental_binary::output_section): New function.
945         (Sized_incremental_binary::inputs_reader): Add const.
946         (Sized_incremental_binary::symtab_reader): Add const.
947         (Sized_incremental_binary::relocs_reader): Add const.
948         (Sized_incremental_binary::got_plt_reader): Add const.
949         (Sized_incremental_binary::get_symtab_view): New function.
950         (Sized_incremental_binary::Inputs_reader): New typedef.
951         (Sized_incremental_binary::Input_entry_reader): New typedef.
952         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
953         (Sized_incremental_binary::do_file_is_unchanged): Remove.
954         (Sized_incremental_binary::do_file_has_changed): New function.
955         (Sized_incremental_binary::do_init_layout): New function.
956         (Sized_incremental_binary::do_reserve_layout): New function.
957         (Sized_input_reader::Inputs_reader): Remove.
958         (Sized_input_reader::Input_entry_reader): Remove.
959         (Sized_input_reader::do_arg_serial): New function.
960         (Sized_input_reader::do_get_unused_symbol_count): New function.
961         (Sized_input_reader::do_get_unused_symbol): New function.
962         (Sized_incremental_binary::do_input_file_count): New function.
963         (Sized_incremental_binary::do_get_input_reader): Change signature;
964         use index instead of filename.
965         (Sized_incremental_binary::section_map_): New data member.
966         (Sized_incremental_binary::input_entry_readers_): New data member.
967         (class Sized_incr_relobj): New class.
968         (class Sized_incr_dynobj): New class.
969         (make_sized_incremental_object): New function.
970         (class Incremental_library): New class.
971         * layout.cc (Free_list::num_lists): New static data member.
972         (Free_list::num_nodes): New static data member.
973         (Free_list::num_removes): New static data member.
974         (Free_list::num_remove_visits): New static data member.
975         (Free_list::num_allocates): New static data member.
976         (Free_list::num_allocate_visits): New static data member.
977         (Free_list::init): New function.
978         (Free_list::remove): New function.
979         (Free_list::allocate): New function.
980         (Free_list::dump): New function.
981         (Free_list::print_stats): New function.
982         (Layout_task_runner::run): Resize output file for incremental updates.
983         (Layout::Layout): Initialize new data members.
984         (Layout::set_incremental_base): New function.
985         (Layout::init_fixed_output_section): New function.
986         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
987         incremental updates.
988         (Layout::create_gold_note): Do not create gold note section for
989         incremental updates.
990         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
991         for incremental updates.
992         (Layout::set_section_offsets): For incremental updates, allocate space
993         from free list.
994         (Layout::create_symtab_sections): Layout with offsets relative to
995         start of section; for incremental updates, allocate space from free
996         list.
997         (Layout::create_shdrs): For incremental updates, allocate space from
998         free list.
999         (Layout::finish_dynamic_section): For incremental updates, do not
1000         check --as-needed (fixed in subsequent patch).
1001         * layout.h (class Free_list): New class.
1002         (Layout::set_incremental_base): New function.
1003         (Layout::incremental_base): New function.
1004         (Layout::init_fixed_output_section): New function.
1005         (Layout::allocate): New function.
1006         (Layout::incremental_base_): New data member.
1007         (Layout::free_list_): New data member.
1008         * main.cc (main): Print Free_list statistics.
1009         * object.cc (Relobj::finalize_incremental_relocs): Add
1010         clear_counts parameter; clear counts only when clear_counts is set.
1011         (Sized_relobj::Sized_relobj): Initialize new base class.
1012         (Sized_relobj::do_layout): Don't report special sections.
1013         (Sized_relobj::do_for_all_local_got_entries): New function.
1014         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1015         symtab_off to all symbol table offsets.
1016         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1017         * object.h (class Got_offset_list): Move to top of file.
1018         (Object::Object): Allow case where input_file == NULL.
1019         (Object::~Object): Likewise.
1020         (Object::input_file): Assert that input_file != NULL.
1021         (Object::lock): Allow case where input_file == NULL.
1022         (Object::unlock): Likewise.
1023         (Object::is_locked): Likewise.
1024         (Object::token): Likewise.
1025         (Object::release): Likewise.
1026         (Object::is_incremental): New function.
1027         (Object::get_mtime): New function.
1028         (Object::for_all_local_got_entries): New function.
1029         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1030         (Object::set_is_in_system_directory): New function.
1031         (Object::is_in_system_directory): New function.
1032         (Object::do_is_incremental): New function.
1033         (Object::do_get_mtime): New function.
1034         (Object::do_for_all_local_got_entries): New function.
1035         (Object::is_in_system_directory_): New data member.
1036         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1037         (class Sized_relobj_base): New class.
1038         (class Sized_relobj): Derive from Sized_relobj_base.
1039         (class Sized_relobj::Symbols): Redeclare from base class.
1040         (class Sized_relobj::local_got_offset_list): Remove.
1041         (class Sized_relobj::Output_sections): Redeclare from base class.
1042         (class Sized_relobj::do_for_all_local_got_entries): New function.
1043         (class Sized_relobj::write_local_symbols): Add offset parameter.
1044         (class Sized_relobj::local_symbol_offset_): Update comment.
1045         (class Sized_relobj::local_dynsym_offset_): Update comment.
1046         * options.cc (Input_arguments::add_file): Remove const.
1047         * options.h (Input_file_argument::Input_file_argument):
1048         Initialize arg_serial_ (all constructors).
1049         (Input_file_argument::set_arg_serial): New function.
1050         (Input_file_argument::arg_serial): New function.
1051         (Input_file_argument::arg_serial_): New data member.
1052         (Input_arguments::Input_arguments): Initialize file_count_.
1053         (Input_arguments::add_file): Remove const.
1054         (Input_arguments::number_of_input_files): New function.
1055         (Input_arguments::file_count_): New data member.
1056         (Command_line::number_of_input_files): Call
1057         Input_arguments::number_of_input_files.
1058         * output.cc (Output_segment_headers::Output_segment_headers):
1059         Set current size.
1060         (Output_section::Input_section::current_data_size): New function.
1061         (Output_section::Output_section): Initialize new data members.
1062         (Output_section::add_input_section): Don't do merge sections for
1063         an incremental link; allocate space from free list for an
1064         incremental update.
1065         (Output_section::add_output_section_data): Allocate space from
1066         free list for an incremental update.
1067         (Output_section::update_data_size): New function.
1068         (Output_section::set_fixed_layout): New function.
1069         (Output_section::reserve): New function.
1070         (Output_segment::set_section_addresses): Remove const.
1071         (Output_segment::set_section_list_addresses): Remove const; allocate
1072         space from free list for an incremental update.
1073         (Output_segment::set_offset): Adjust size of RELRO segment for an
1074         incremental update.
1075         * output.h (Output_data::current_data_size): Move here from
1076         child classes.
1077         (Output_data::pre_finalize_data_size): New function.
1078         (Output_data::update_data_size): New function.
1079         (Output_section_headers::update_data_size): new function.
1080         (Output_section_data_build::current_data_size): Move to Output_data.
1081         (Output_data_strtab::update_data_size): New function.
1082         (Output_section::current_data_size): Move to Output_data.
1083         (Output_section::set_fixed_layout): New function.
1084         (Output_section::has_fixed_layout): New function.
1085         (Output_section::reserve): New function.
1086         (Output_section::update_data_size): New function.
1087         (Output_section::has_fixed_layout_): New data member.
1088         (Output_section::free_list_): New data member.
1089         (Output_segment::set_section_addresses): Remove const.
1090         (Output_segment::set_section_list_addresses): Remove const.
1091         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1092         New function.
1093         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1094         New function.
1095         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1096         parameter when calling Add_symbols constructor; store argument
1097         serial number for members of a lib group.
1098         (Add_symbols::locks): Allow case where token == NULL.
1099         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1100         (Read_member::~Read_member): New function.
1101         (Read_member::is_runnable): New function.
1102         (Read_member::locks): New function.
1103         (Read_member::run): New function.
1104         (Check_script::~Check_script): New function.
1105         (Check_script::is_runnable): New function.
1106         (Check_script::locks): New function.
1107         (Check_script::run): New function.
1108         (Check_library::~Check_library): New function.
1109         (Check_library::is_runnable): New function.
1110         (Check_library::locks): New function.
1111         (Check_library::run): New function.
1112         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1113         (Add_symbols::library_): New data member.
1114         (class Read_member): New class.
1115         (class Check_script): New class.
1116         (class Check_library): New class.
1117         * reloc.cc (Read_relocs::is_runnable): Allow case where
1118         token == NULL.
1119         (Read_relocs::locks): Likewise.
1120         (Scan_relocs::locks): Likewise.
1121         (Relocate_task::locks): Likewise.
1122         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1123         to clear counters.
1124         (Sized_relobj::incremental_relocs_scan): Fix comment.
1125         (Sized_relobj::do_relocate): Pass output file offset to
1126         write_local_symbols.
1127         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1128         from class declaration.
1129         * script.cc (read_input_script): Allocate Script_info; pass
1130         argument serial number to report_script.
1131         * script.h (class Script_info): Move to incremental.h.
1132         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1133         * symtab.h (Symbol_table::add_from_incrobj): New function.
1134         (Symbol_table::set_file_offset): New function.
1135
1136 2011-04-05  Cary Coutant  <ccoutant@google.com>
1137
1138         * incremental-dump.cc (dump_incremental_inputs): Change signature
1139         to take a Sized_incremental_binary; change caller.  Use readers
1140         in Sized_incremental_binary.
1141         * incremental.cc
1142         (Sized_incremental_binary::find_incremental_inputs_sections):
1143         Rename do_find_incremental_inputs_sections to this.
1144         (Sized_incremental_binary::setup_readers): New function.
1145         (Sized_incremental_binary::do_check_inputs): Check
1146         has_incremental_info_ flag; move setup code to setup_readers;
1147         use input readers.
1148         (Sized_incremental_binary::do_file_is_unchanged): New function.
1149         (Sized_incremental_binary::do_get_input_reader): New function.
1150         * incremental.h (class Incremental_binary): Move to end of file.
1151         (Incremental_binary::file_is_unchanged): New function.
1152         (Incremental_binary::do_file_is_unchanged): New function.
1153         (Incremental_binary::Input_reader): New class.
1154         (Incremental_binary::get_input_reader): New function.
1155         (class Sized_incremental_binary): Move to end of file.
1156         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1157         input section reader classes.
1158         (Sized_incremental_binary::has_incremental_info): New function.
1159         (Sized_incremental_binary::inputs_reader): New function.
1160         (Sized_incremental_binary::symtab_reader): New function.
1161         (Sized_incremental_binary::relocs_reader): New function.
1162         (Sized_incremental_binary::got_plt_reader): New function.
1163         (Sized_incremental_binary::do_file_is_unchanged): New function.
1164         (Sized_incremental_binary::Sized_input_reader): New class.
1165         (Sized_incremental_binary::get_input_reader): New function.
1166         (Sized_incremental_binary::find_incremental_inputs_sections):
1167         Rename do_find_incremental_inputs_sections to this.
1168         (Sized_incremental_binary::setup_readers): New function.
1169         (Sized_incremental_binary::has_incremental_info_): New data member.
1170         (Sized_incremental_binary::inputs_reader_): New data member.
1171         (Sized_incremental_binary::symtab_reader_): New data member.
1172         (Sized_incremental_binary::relocs_reader_): New data member.
1173         (Sized_incremental_binary::got_plt_reader_): New data member.
1174         (Sized_incremental_binary::current_input_file_): New data member.
1175
1176 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1177
1178         PR gold/12640
1179         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1180         violation.
1181
1182 2011-03-30  Cary Coutant  <ccoutant@google.com>
1183
1184         * archive.cc (Archive::include_member): Adjust call to report_object.
1185         (Add_archive_symbols::run): Add script_info to call to
1186         report_archive_begin.
1187         (Lib_group::include_member): Adjust call to report_object.
1188         (Add_lib_group_symbols::run): Adjust call to report_object.
1189         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1190         blocks.  Add object count for script input files.
1191         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1192         script_info parameter; change all callers.
1193         (Incremental_inputs::report_object): Add script_info parameter;
1194         change all callers.
1195         (Incremental_inputs::report_script): Store backpointer to
1196         incremental info entry.
1197         (Output_section_incremental_inputs::set_final_data_size): Record
1198         additional information for scripts.
1199         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1200         * incremental.h (Incremental_script_entry::add_object): New function.
1201         (Incremental_script_entry::get_object_count): New function.
1202         (Incremental_script_entry::get_object): New function.
1203         (Incremental_script_entry::objects_): New data member; adjust
1204         constructor.
1205         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1206         (Incremental_inputs::report_object): Add script_info parameter.
1207         (Incremental_inputs_reader::get_object_count): New function.
1208         (Incremental_inputs_reader::get_object_offset): New function.
1209         * options.cc (Input_arguments::add_file): Return reference to
1210         new input argument.
1211         * options.h (Input_argument::set_script_info): New function.
1212         (Input_argument::script_info): New function.
1213         (Input_argument::script_info_): New data member; adjust all
1214         constructors.
1215         (Input_file_group::add_file): Return reference to new input argument.
1216         (Input_file_lib::add_file): Likewise.
1217         (Input_arguments::add_file): Likewise.
1218         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1219         * script.cc (Parser_closure::Parser_closure): Add script_info
1220         parameter; adjust all callers.
1221         (Parser_closure::script_info): New function.
1222         (Parser_closure::script_info_): New data member.
1223         (read_input_script): Report scripts earlier to incremental info.
1224         (script_add_file): Set script_info in Input_argument.
1225         (script_add_library): Likewise.
1226         * script.h (Script_options::Script_info): Rewrite class.
1227
1228 2011-03-29  Cary Coutant  <ccoutant@google.com>
1229
1230         * archive.cc (Library_base::should_include_member): Move
1231         method here from class Archive.
1232         (Archive::Archive): Initialize base class.
1233         (Archive::should_include_member): Move to base class.
1234         (Archive::do_for_all_unused_symbols): New function.
1235         (Add_archive_symbols::run): Remove redundant access to
1236         incremental_inputs.
1237         (Lib_group::Lib_group): Initialize base class.
1238         (Lib_group::do_filename): New function.
1239         (Lib_group::include_member): Pass pointer to Lib_group to
1240         report_object.
1241         (Lib_group::do_for_all_unused_symbols): New function.
1242         (Add_lib_group_symbols::run): Report archive information for
1243         incremental links.
1244         * archive.h (class Library_base): New base class.
1245         (class Archive): Derive from Library_base.
1246         (Archive::filename): Move to base class.
1247         (Archive::set_incremental_info): Likewise.
1248         (Archive::incremental_info): Likewise.
1249         (Archive::Should_include): Likewise.
1250         (Archive::should_include_member): Likewise.
1251         (Archive::Armap_entry): Remove.
1252         (Archive::Unused_symbol_iterator): Remove.
1253         (Archive::unused_symbols_begin): Remove.
1254         (Archive::unused_symbols_end): Remove.
1255         (Archive::do_filename): New function.
1256         (Archive::do_get_mtime): New function.
1257         (Archive::do_for_all_unused_symbols): New function.
1258         (Archive::task_): Move to base class.
1259         (Archive::incremental_info_): Likewise.
1260         (class Lib_group): Derive from Library_base.
1261         (Lib_group::do_filename): New function.
1262         (Lib_group::do_get_mtime): New function.
1263         (Lib_group::do_for_all_unused_symbols): New function.
1264         (Lib_group::task_): Move to base class.
1265         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1266         function.
1267         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1268         function.
1269         * incremental.cc (Incremental_inputs::report_archive_begin):
1270         Use Library_base; call library's get_mtime; add incremental inputs
1271         entry before members.
1272         (class Unused_symbol_visitor): New class.
1273         (Incremental_inputs::report_archive_end): Use Library_base; use
1274         visitor class to record unused symbols; don't add incremental inputs
1275         entry after members.
1276         (Incremental_inputs::report_object): Use Library_base.
1277         * incremental.h
1278         (Incremental_archive_entry::Incremental_archive_entry): Remove
1279         unused Archive parameter.
1280         (Incremental_inputs::report_archive_begin): Use Library_base.
1281         (Incremental_inputs::report_archive_end): Likewise.
1282         (Incremental_inputs::report_object): Likewise.
1283         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1284         function.
1285         * object.h (Object::for_all_global_symbols): New function.
1286         (Object::do_for_all_global_symbols): New function.
1287         (Sized_relobj::do_for_all_global_symbols): New function.
1288         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1289         function.
1290         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1291         function.
1292
1293 2011-03-27  Ian Lance Taylor  <iant@google.com>
1294
1295         * archive.cc (Archive::interpret_header): Return -1 if something
1296         goes wrong.  Change callers accordingly.
1297
1298 2011-03-25  Cary Coutant  <ccoutant@google.com>
1299
1300         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1301         * testsuite/Makefile.in: Regenerate.
1302
1303 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1304
1305         * plugin.cc (get_view): New.
1306         (Plugin::load): Pass get_view to the plugin.
1307         (Plugin_manager::get_view): New.
1308
1309 2011-03-21  Ian Lance Taylor  <iant@google.com>
1310
1311         * testsuite/final_layout.sh: Rewrite to not use dc.
1312         * testsuite/relro_test.sh: Fail if dc is not present.
1313
1314 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1315
1316         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1317         Change == to -eq.
1318         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1319         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1320         Change == to -eq.
1321         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1322         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1323
1324 2011-03-14  Ian Lance Taylor  <iant@google.com>
1325
1326         * script-sections.cc (Sort_output_sections::script_compare):
1327         Rename from is_before, change return type.
1328         (Sort_output_sections::operator()): Adjust accordingly.
1329
1330 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1331
1332         PR gold/12572
1333         * testsuite/odr_violation2.cc: Add comment to make all error line
1334         numbers double digits.
1335         * testsuite/debug_msg.sh: Adjust expected errors.
1336
1337 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1338
1339         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1340         but mark earlier ones as non-canonical
1341         (offset_to_iterator): Update search target and example
1342         (do_addr2line): Return extra lines in a vector*
1343         (format_file_lineno): Extract from do_addr2line
1344         (one_addr2line): Add vector* out-param
1345         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1346         when a lineno entry appeared last for its instruction
1347         (Dwarf_line_info): Add vector* out-param
1348         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1349         * symtab.cc (Odr_violation_compare): Include the lineno in the
1350         comparison again.
1351         (linenos_from_loc): New. Combine the canonical line for an
1352         address with its other lines.
1353         (True_if_intersect): New. Helper functor to make
1354         std::set_intersection a query.
1355         (detect_odr_violations): Compare sets of lines instead of just
1356         one line for each function. This became less deterministic, but
1357         has fewer false positives.
1358         * symtab.h: Declarations.
1359         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1360         mix an optimized and non-optimized object in the same binary
1361         (odr_violation2.so): Same.
1362         * testsuite/Makefile.in: Regenerate from Makefile.am.
1363         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1364         * testsuite/debug_msg.sh: Update line numbers and add
1365         assertions.
1366         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1367         non-optimized context.
1368         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1369         isn't inlined, and use OdrDerived in an optimized context.
1370         * testsuite/odr_header1.h: Defines OdrDerived, where
1371         optimization will change the
1372         first-instruction-in-the-destructor's file and line number.
1373         * testsuite/odr_header2.h: Defines OdrBase.
1374
1375 2011-03-09  Ian Lance Taylor  <iant@google.com>
1376
1377         * fileread.cc (File_read::clear_views): Don't delete the whole
1378         file view.
1379
1380 2011-03-08  Ian Lance Taylor  <iant@google.com>
1381
1382         PR gold/12525
1383         * fileread.cc: #include <climits>.
1384         (GOLD_IOV_MAX): Define.
1385         (File_read::read_multiple): Limit number of entries by iov_max.
1386         * fileread.h (class File_read): Always set max_readv_entries to
1387         128.
1388
1389 2011-03-07  Ian Lance Taylor  <iant@google.com>
1390
1391         PR gold/12525
1392         * options.h (class General_options): Add -dy and -dn.
1393
1394 2011-03-02  Cary Coutant  <ccoutant@google.com>
1395
1396         * testsuite/script_test_9.t: Add TLS segment.
1397
1398 2011-03-02  Simon Baldwin  <simonb@google.com>
1399
1400         * configure.ac: Add check for gnu_indirect_function support in
1401         the toolchain building binutils.
1402         * configure: Rebuild.
1403
1404 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1405
1406         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1407         plugin only symbols.
1408         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1409         in plugin files as not needed in the symbol table.
1410
1411 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1412
1413         * output.cc (Output_section::add_input_section): Delay fill
1414         generation for section ordering.
1415
1416 2011-02-09  Ian Lance Taylor  <iant@google.com>
1417
1418         PR gold/12316
1419         * object.h (class Sized_relobj): Remove clear_local_symbols.
1420         * reloc.cc (Sized_relobj::do_relocate): Don't call
1421         clear_local_symbols.
1422
1423 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1424
1425         * plugin.cc (is_visible_from_outside): Return true for symbols
1426         in the -u option.
1427
1428 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1429
1430         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1431         filename.
1432
1433 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1434
1435         * icf.h (is_section_foldable_candidate): Change type of parameter
1436         to std::string.
1437         * icf.cc (Icf::find_identical_sections): Change type of local variable
1438         section_name to be std::string.
1439         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1440
1441 2011-01-25  Ian Lance Taylor  <iant@google.com>
1442
1443         * script.cc (script_add_extern): Rewrite to use
1444         add_symbol_reference.
1445
1446 2011-01-25  Doug Kwan  <dougkwan@google.com>
1447
1448         * icf.cc (get_section_contents): Always lock section's object.
1449
1450 2011-01-24  Ian Lance Taylor  <iant@google.com>
1451
1452         * options.h (class General_options): Accept
1453         --no-detect-odr-violations.
1454
1455 2011-01-24  Ian Lance Taylor  <iant@google.com>
1456
1457         * version.cc (version_string): Bump to 1.11.
1458
1459 2011-01-24  Ian Lance Taylor  <iant@google.com>
1460
1461         * plugin.cc (class Plugin_rescan): Define new class.
1462         (Plugin_manager::claim_file): Set any_claimed_.
1463         (Plugin_manager::save_archive): New function.
1464         (Plugin_manager::save_input_group): New function.
1465         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1466         necessary.
1467         (Plugin_manager::new_undefined_symbol): New function.
1468         (Plugin_manager::rescan): New function.
1469         (Plugin_manager::rescannable_defines): New function.
1470         (Plugin_manager::add_input_file): Set any_added_.
1471         * plugin.h (class Plugin_manager): define new fields rescannable_,
1472         undefined_symbols_, any_claimed_, and any_added_.  Declare
1473         Plugin_rescan as friend.  Declare new functions.
1474         (Plugin_manager::Rescannable): Define type.
1475         (Plugin_manager::Rescannable_list): Define type.
1476         (Plugin_manager::Undefined_symbol_list): Define type.
1477         (Plugin_manager::Plugin_manager): Initialize new fields.
1478         * archive.cc (Archive::defines_symbol): New function.
1479         (Add_archive_symbols::run): Pass archive to plugins if any.
1480         * archive.h (class Archive): Declare defines_symbol.
1481         * readsyms.cc (Input_group::~Input_group): New function.
1482         (Finish_group::run): Pass input_group to plugins if any.
1483         * readsyms.h (class Input_group): Declare destructor.
1484         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1485         any.
1486
1487 2011-01-10  Ian Lance Taylor  <iant@google.com>
1488
1489         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1490         section as relro.
1491         (Layout::set_segment_offsets): Reset increase_relro before calling
1492         set_section_addresses a second time.
1493
1494 2011-01-04  Cary Coutant  <ccoutant@google.com>
1495
1496         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1497         sections before NOBITS sections.
1498
1499 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1500
1501         * version.cc (print_version): Update copyright to 2011.
1502
1503 2010-12-23  Cary Coutant  <ccoutant@google.com>
1504
1505         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1506         of OS to this->add.  Add OD parameter to second form of the function.
1507
1508 2010-12-20  Ian Lance Taylor  <iant@google.com>
1509
1510         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1511         second of two consecutive entries with same offset.
1512
1513 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1514
1515         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1516         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1517         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1518         to avoid unneeded links against $(LDADD).
1519         * testsuite/Makefile.in: Regenerate.
1520
1521 2010-12-15  Ian Lance Taylor  <iant@google.com>
1522
1523         PR gold/12324
1524         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1525         for R_X86_64_32 and R_X86_64_PC32.
1526         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1527         ver_matching_def_pic.o.
1528         (ver_matching_def_pic.o): New target.
1529
1530 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1531
1532         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1533         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1534         Move definition before File_read::View member definitions.
1535         (File_read::View::~View): Initialize and hold lock before
1536         updating current_mapped_bytes.
1537
1538 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1539
1540         * dwarf_reader.cc: Remove outdated comment.
1541         * gold-threads.cc: Fix typo in error message.
1542         * archive.cc: Fix typos in comments.
1543         * archive.h: Likewise.
1544         * arm-reloc-property.cc: Likewise.
1545         * arm-reloc-property.h: Likewise.
1546         * arm-reloc.def: Likewise.
1547         * arm.cc: Likewise.
1548         * attributes.h: Likewise.
1549         * cref.cc: Likewise.
1550         * ehframe.cc: Likewise.
1551         * fileread.h: Likewise.
1552         * gold.h: Likewise.
1553         * i386.cc: Likewise.
1554         * icf.cc: Likewise.
1555         * incremental.h: Likewise.
1556         * int_encoding.cc: Likewise.
1557         * layout.h: Likewise.
1558         * main.cc: Likewise.
1559         * merge.h: Likewise.
1560         * object.cc: Likewise.
1561         * object.h: Likewise.
1562         * options.cc: Likewise.
1563         * readsyms.cc: Likewise.
1564         * reduced_debug_output.cc: Likewise.
1565         * reloc.cc: Likewise.
1566         * script-sections.cc: Likewise.
1567         * sparc.cc: Likewise.
1568         * symtab.h: Likewise.
1569         * target-reloc.h: Likewise.
1570         * target.cc: Likewise.
1571         * target.h: Likewise.
1572         * timer.cc: Likewise.
1573         * timer.h: Likewise.
1574         * x86_64.cc: Likewise.
1575
1576 2010-12-09  Cary Coutant  <ccoutant@google.com>
1577
1578         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1579         stack.
1580         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1581         parameter; change all callers.
1582         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1583         * options.h (warn_execstack): New option.
1584
1585 2010-12-07  Doug Kwan  <dougkwan@google.com>
1586
1587         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1588         like function call relocations.
1589
1590 2010-12-07  Ian Lance Taylor  <iant@google.com>
1591
1592         * archive.cc (Archive::get_elf_object_for_member): Permit
1593         punconfigured to be NULL.
1594         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1595         (Archive::include_member): Pass NULL to get_elf_object_for_member
1596         if we searched for the archive and this is the first included
1597         object.
1598
1599 2010-12-01  Ian Lance Taylor  <iant@google.com>
1600
1601         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1602         track_relocs_type_ field.
1603         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1604         Set track_relocs_type_.
1605         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1606         contents when using RELA relocs.
1607         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1608         reloc_map_.
1609         * reloc.cc (Track_relocs::next_addend): New function.
1610         * reloc.h (class Track_relocs): Declare next_addend.
1611
1612 2010-12-01  Ian Lance Taylor  <iant@google.com>
1613
1614         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1615         virtual destructor.
1616
1617 2010-12-01  Ian Lance Taylor  <iant@google.com>
1618
1619         * README: Update compilers known to work and fail.
1620
1621 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1622
1623         * configure.in: For --enable-gold, handle value `default' instead of
1624         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1625         not the default.
1626         * configure: Regenerate.
1627
1628 2010-11-18  Doug Kwan  <dougkwan@google.com>
1629
1630         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1631         and right_alignment to be zero.  Store result alignment only if it is
1632         greater than existing alignment.
1633
1634 2010-11-16  Cary Coutant  <ccoutant@google.com>
1635
1636         PR gold/12220
1637         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1638         Check for ".zdebug_line".
1639
1640 2010-11-16  Doug Kwan  <dougkwan@google.com>
1641             Cary Coutant  <ccoutant@google.com>
1642
1643         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1644         by reference; adjust all callers.
1645         * output.cc (Output_segment::set_section_addresses): Adjust references
1646         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1647         list is empty.
1648         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1649         end at page boundary.
1650
1651 2010-11-16  Cary Coutant  <ccoutant@google.com>
1652
1653         PR gold/12220
1654         * layout.cc (Layout::choose_output_section): Transform names of
1655         compressed sections even when using a script with a SECTIONS clause.
1656         (Layout::output_section_name): Remove code to transform
1657         compressed debug section names.
1658         * output.cc (Output_section::add_input_section): Use uncompressed
1659         section size when tracking input sections.
1660
1661 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1662
1663         * symtab.h (Symbol::NON_PIC_REF): Remove.
1664         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1665         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1666         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1667         (Symbol::use_plt_offset): Take a flags argument and pass it
1668         directly to needs_dynamic_reloc.  Restrict check for undefined
1669         weak symbols to function calls.
1670         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1671         (Target_arm::Scan::global): Use it.
1672         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1673         (Target_arm::Relocate::relocate): Likewise.
1674         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1675         parameter with an r_type parameter.  Use get_reference_flags
1676         to get the flags.
1677         (Target_arm::Relocate::relocate): Update accordingly.
1678         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1679         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1680         (Target_i386::Scan::global): Likewise.
1681         (Target_i386::Relocate::relocate): Likewise.
1682         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1683         parameter with an r_type parameter.  Use get_reference_flags
1684         to get the flags.
1685         (Target_i386::Relocate::relocate): Update accordingly.
1686         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1687         (Target_powerpc::Scan::global): Use it.
1688         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1689         (Target_powerpc::Relocate::relocate): Likewise.
1690         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1691         (Target_sparc::Scan::global): Use it.
1692         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1693         (Target_sparc::Relocate::relocate): Likewise.
1694         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1695         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1696         (Target_x86_64::Scan::global): Likewise.
1697         (Target_x86_64::Relocate::relocate): Likewise.
1698
1699 2010-11-08  Doug Kwan  <dougkwan@google.com>
1700             Cary Coutant  <ccoutant@google.com>
1701
1702         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1703         (Arm_exidx_merge_section::section_contents_): New data member.
1704         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1705         (Arm_input_section::~Arm_input_section): De-allocate memory.
1706         (Arm_input_section::original_contents_): New data member.       
1707         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1708         in parameters instead of calling Object::section_contents without
1709         locking.
1710         (Arm_output_section::group_section): New parameter TASK.  Pass it
1711         to callees that need locking objects.
1712         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1713         to lock EXIDX input sections.  Fix a formatting issue.  Call
1714         Arm_exidx_merged_section::build_contents to create merged section
1715         contents.
1716         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1717         to lock object of stub table owner.
1718         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1719         TEXT_SIZE to initialize data member TEXT_SIZE_.
1720         (Arm_exidx_input_section::addralign): Fix typo in comment.
1721         (Arm_exidx_input_section::text_size): New method.
1722         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1723         that require locking objects.  Lock objects before scanning for stubs
1724         and updating local symbols.
1725         (Arm_input_section<big_endian>::init): Copy contents of original
1726         input section.
1727         (Arm_input_section<big_endian>::do_write): Use saved contents of
1728         original input section instead of calling Object::section_contents
1729         without locking.
1730         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1731         size without calling Object::section_size().
1732         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1733         for size.  Allocate a buffer for merged EXIDX entries.
1734         (Arm_exidx_merged_section::build_contents): New method.
1735         (Arm_exidx_merged_section::do_write): Move merge section contents
1736         building code to Arm_exidx_merged_section::build_contetns.  Write
1737         out contetns in buffer instead of building it on the fly.
1738         (Arm_relobj::make_exidx_input_section): Also pass text section size
1739         to Arm_exidx_input_section constructor.
1740         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1741         (Arm_dynobj::do_read_symbols): Fix memory leak.
1742         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1743         * target.h: (class Task): Add forward declaration.
1744         (Target::relax): Add new parameter TASK and pass it to
1745         Target::do_relax().
1746         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1747
1748 2010-11-05  Cary Coutant  <ccoutant@google.com>
1749
1750         PR gold/10708
1751         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1752         object when reading from the file.
1753         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1754         second layout pass.
1755         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1756         when reading section contents.
1757         (get_section_contents): Likewise.
1758         (icf::find_identical_sections): Likewise.
1759         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1760         object when reading from the file.
1761         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1762         the object when doing deferred section layout.
1763
1764 2010-11-03  Nick Clifton  <nickc@redhat.com>
1765
1766         PR gold/12001
1767         * script.h (class Symbol_assignment: name): New member.  Returns
1768         the name of the symbol.
1769         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1770         Returns true if the given symbol name is on the list of
1771         assignments wating to be processed.
1772         * archive.cc (should_incldue_member): If the symbol is undefined,
1773         check to see if it is on the list of symbols pending assignment.
1774
1775 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1776
1777         * script-sections.cc (Script_sections::find_memory_region): Check
1778         for a NULL output section pointer.
1779
1780 2010-10-29  Doug Kwan  <dougkwan@google.com>
1781
1782         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1783         Output_section::add_relaxed_input_section.
1784         * output.cc (Output_section::add_relaxed_input_section): Add new
1785         arguments LAYOUT and NAME.  Set section order index.
1786         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1787         Copy section order index.
1788         * output.h (Output_section::add_relaxed_input_section): Add new
1789         arguments LAYOUT and NAME.
1790
1791 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1792
1793         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1794         NATIVE_OR_CROSS_LINKER.
1795         * testsuite/Makefile.in: Regenerate.
1796
1797 2010-10-20  Doug Kwan  <dougkwan@google.com>
1798
1799         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1800         without SHF_LINK_ORDER flags.
1801         * layout.cc (Layout::choose_output_section): Do not filter
1802         SHF_LINK_ORDER flag in a relocatable link.
1803
1804 2010-10-17  Cary Coutant  <ccoutant@google.com>
1805
1806         * output.h (Output_segment::set_section_addresses): Change function
1807         signature.  Update all callers.
1808         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1809         sections.
1810         (Output_segment::set_section_addresses): Align after last TLS
1811         section.  Add padding before last relro section instead of after.
1812
1813 2010-10-17  Doug Kwan  <dougkwan@google.com>
1814
1815         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1816         GOT output section to be writable.
1817
1818 2010-10-14  Cary Coutant  <ccoutant@google.com>
1819
1820         * debug.h (DEBUG_INCREMENTAL): New flag.
1821         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1822         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1823         mode.
1824         * incremental.cc (report_command_line): Ignore all forms of
1825         --incremental.
1826         * layout.cc (Layout::Layout): Check parameters for incremental link
1827         mode.
1828         * options.cc (General_options::parse_incremental): New function.
1829         (General_options::parse_no_incremental): New function.
1830         (General_options::parse_incremental_full): New function.
1831         (General_options::parse_incremental_update): New function.
1832         (General_options::incremental_mode_): New data member.
1833         (General_options::finalize): Check incremental_mode_.
1834         * options.h (General_options): Update help text for --incremental.
1835         Add --no-incremental, --incremental-full, --incremental-update.
1836         (General_options::Incremental_mode): New enum type.
1837         (General_options::incremental_mode): New function.
1838         (General_options::incremental_mode_): New data member.
1839         * parameters.cc (Parameters::incremental_mode_): New data member.
1840         (Parameters::set_options): Set incremental_mode_.
1841         (Parameters::set_incremental_full): New function.
1842         (Parameters::incremental): New function.
1843         (Parameters::incremental_update): New function.
1844         (set_parameters_incremental_full): New function.
1845         * parameters.h (Parameters::set_incremental_full): New function.
1846         (Parameters::incremental): New function.
1847         (Parameters::incremental_update): New function.
1848         (Parameters::incremental_mode_): New data member.
1849         (set_parameters_incremental_full): New function.
1850         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1851         incremental link mode.
1852         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1853         (Sized_relobj::do_relocate_sections): Likewise.
1854         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1855         option.
1856         * testsuite/Makefile.in: Regenerate.
1857         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1858
1859 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1860
1861         * script-sections.h (class Script_sections): Make
1862         Sections_elements typedef public.
1863         * script-sections.cc (class Sort_output_sections): Add elements_
1864         field.  Add constructor which sets it; change all callers.
1865         (Sort_output_sections::is_before): New function.
1866         (Sort_output_sections::operator()): Call is_before.
1867         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1868         conditional.
1869         * testsuite/script_test_10.sh: New test. Test script section
1870         order.
1871         * testsuite/script_test_10.t: Likewise.
1872         * testsuite/script_test_10.s: Likewise.
1873         * testsuite/Makefile.am: Wrap the cross linker tests and the
1874         common tests into NATIVE_OR_CROSS_LINKER.
1875         (check_SCRIPTS): Add script_test_10.sh.
1876         (check_DATA): Add script_test_10.stdout.
1877         (script_test_10.o, script_test_10): New targets.
1878         (script_test_10.stdout): New target.
1879         * configure, testsuite/Makefile.in: Regenerate.
1880
1881 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1882
1883         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1884         error for the deprecated relocations.
1885         (Target_arm::Scan::global): Likewise.
1886         (Target_arm::Relocate::relocate): Likewise.
1887
1888 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1889
1890         * fileread.cc (Input_file::find_file): Initialize *found_name
1891         and *namep when using the fallback search for case 4.
1892
1893 2010-10-11  Cary Coutant  <ccoutant@google.com>
1894
1895         * options.h (class General_options): Redefine -z lazy as an alias for
1896         the negation of -z now.
1897
1898 2010-10-11  Ian Lance Taylor  <iant@google.com>
1899
1900         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1901         binding.
1902
1903 2010-10-06  Nick Clifton  <nickc@redhat.com>
1904
1905         * script-sections.cc(class Memory_region): Remove
1906         current_lma_offset_ field.  Rename current_vma_offset_ to
1907         current_offset_.  Add last_section_ field.
1908         (Memory_region::get_current_vma_address): Rename to
1909         get_current_address.
1910         (Memory_region::get_current_lma_address): Delete.
1911         (Memory_region::increment_vma_offset): Rename to
1912         increment_offset.
1913         (Memory_region::increment_lma_offset): Delete.
1914         (Memory_region::attributes_compatible): New method.  Returns
1915         true if the provided section is compatible with the region.
1916         (Memory_region::get_last_section): New method.  Returns the last
1917         section to use the region.
1918         (Memory_region::set_last_section): New method.  Stores the last
1919         section to use the region.
1920         (Script_sections::block_in_region): New method.  Returns true if
1921         a block of memory is contained within a region.
1922         (Script_sections::find_memory_region): New method.  Locates a
1923         memory region to be used to set a VMA or LMA address.
1924         (Output_section_definition::set_section_addresses): Add code to
1925         check for addresses set by memory regions.
1926         (Output_segment::set_section_addresses): Remove memory region
1927         walking code.
1928         (Script_sections::create_segment): Add a warning if a header
1929         segment is created outside of any region.
1930         * script-sections.h (class Script_sections): Add prototypes for
1931         find_memory_region and block_in_region methods.
1932         * testsuite/memory_test.s: Use .long instead of .word.
1933         * testsuite/memory_test.t: Add some more output sections.
1934         * testsuite/memory_test.sh: Update expected output.
1935
1936 2010-10-02  Doug Kwan  <dougkwan@google.com>
1937
1938         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1939         defintion to symtab.h
1940         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1941         declaration to defintion.
1942
1943 2010-10-01  Nick Clifton  <nickc@redhat.com>
1944
1945         * expression.cc (eval): Replace dummy argument with NULL.
1946         (eval_maybe_dot): Check for a NULL result section pointer.
1947         (Symbol_expression::value): Likewise.
1948         (Dot_expression::value): Likewise.
1949         (BINARY_EXPRESSION): Likewise.
1950         (Max_expression::value): Likewise.
1951         (Min_expression::value): Likewise.
1952         (Absolute_expression::value): Likewise.
1953         (Addr_expression::value_from_output_section): Likewise.
1954         (Loaddddr_expression::value_from_output_section): Likewise.
1955         (Segment_start_expression::value): Likewise.
1956         * script-sections.cc
1957         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1958         argument with NULL.
1959         (Sections_elememt_dot_assignment::set_section_addresses):
1960         Likewise.
1961         (Output_data_expression::do_write_to_buffer): Likewise.
1962         (Output_section_definition::finalize_symbols): Likewise.
1963         (Output_section_definition::set_section_addresses): Likewise.
1964
1965 2010-09-30  Doug Kwan  <dougkwan@google.com>
1966
1967         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1968
1969 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1970
1971         * target.h (Target::can_icf_inline_merge_sections): New virtual
1972         function.
1973         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1974         virtual function.
1975         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1976         virtual function.
1977         * icf.cc (get_section_contents): Inline merge sections only when
1978         target allows it.
1979
1980 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1981
1982         * configure: Regenerate.
1983
1984 2010-09-17  Ian Lance Taylor  <iant@google.com>
1985
1986         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1987         * testsuite/Makefile.am (memory_test.o): New target.
1988         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1989         memory_test.t.
1990         * testsuite/Makefile.in: Rebuild.
1991
1992 2010-09-17  Doug Kwan  <dougkwan@google.com>
1993
1994         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1995         defintion if relocation uses GOT entries of the symbol.
1996         * testsuite/icf_safe_test.sh: Fix test.
1997         * testsuite/icf_safe_so_test.sh: Fix test.
1998
1999 2010-09-16  Cary Coutant  <ccoutant@google.com>
2000
2001         * script_sections.cc (class Memory_region): Remove "NULL" from
2002         vector initializations.
2003
2004 2010-09-15  Cary Coutant  <ccoutant@google.com>
2005
2006         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2007         Resolve forwarding symbols.
2008
2009 2010-09-15  Doug Kwan  <dougkwan@google.com>
2010
2011         * gold/testsuite/script_test_3.t: Add ARM special sections.
2012         * gold/testsuite/script_test_4.t: Same.
2013         * gold/testsuite/script_test_5.t: Same.
2014         * gold/testsuite/script_test_6.t: Same.
2015         * gold/testsuite/script_test_7.t: Same.
2016         * gold/testsuite/script_test_7.t: Same.
2017         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2018
2019 2010-09-14  Cary Coutant  <ccoutant@google.com>
2020
2021         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2022         (Target_x86_64::Relocate::relocate_tls): Replace check for
2023         saw_tls_block_reloc_ with test for executable section.
2024
2025 2010-09-12  Cary Coutant  <ccoutant@google.com>
2026
2027         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2028         position-independent executables to shared libraries need dynamic
2029         relocations.
2030         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2031         position-independent executables.
2032         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2033         * testsuite/Makefile.in: Regenerate.
2034
2035 2010-09-10  Nick Clifton  <nickc@redhat.com>
2036
2037         PR gold/11997
2038         * testsuite/memory_test.t: Discard any sections that are not
2039         needed.
2040
2041 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2042
2043         PR gold/11996
2044         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2045         "This::" to work around a bug in gcc 4.2.
2046
2047         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2048
2049 2010-09-09  Rafael Espindola  <espindola@google.com>
2050
2051         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2052         sections with different PF_X flags in the same segment.
2053         (Layout::find_first_load_seg): Search all segments to find the first
2054         one.
2055         * options.h (rosegment): New.
2056
2057 2010-09-08  Rafael Espindola  <espindola@google.com>
2058
2059         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2060
2061 2010-09-08  Doug Kwan  <dougkwan@google.com>
2062
2063         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2064         (Arm_relobj::do_relocate_sections): Add new parameter for output
2065         file to match the parent.
2066         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2067         of local symbols instead of input values.  Update code to track
2068         changes in gold::relocate_section.
2069         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2070         (Sized_relobj::compute_final_local_value_internal): New methods.
2071         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2072         body into private version of Sized_relobj::compute_final_local_value.
2073         Call the inline method.
2074         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2075         merged symbol value if there is one.
2076         (Symbol_value::has_output_value): New method defintiion.
2077         (Sized_relobj::Compute_final_local_value_status): New enum type.
2078         (Sized_relobj::compute_final_local_value): New methods.
2079         (Sized_relobj::compute_final_local_value_internal): New methods.
2080         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2081         and arm_cortex_a8.sh.
2082         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2083         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2084         New tests.
2085         * Makefile.in: Regenerate.
2086         * testsuite/arm_bl_out_of_range.s: Update test.
2087         * testsuite/thumb_bl_out_of_range.s: Ditto.
2088         * testsuite/thumb_blx_out_of_range.s: Ditto.
2089         * testsuite/arm_branch_out_of_range.sh: New file.
2090         * testsuite/arm_cortex_a8.sh: Ditto.
2091         * testsuite/arm_cortex_a8_b.s: Ditto.
2092         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2093         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2094         * testsuite/arm_cortex_a8_bl.s: Ditto.
2095         * testsuite/arm_cortex_a8_blx.s: Ditto.
2096         * testsuite/arm_cortex_a8_local.s: Ditto.
2097         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2098         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2099
2100 2010-09-08  Rafael Espindola  <espindola@google.com>
2101
2102         * Makefile.am (memory_test.stdout): Run readelf with -W.
2103         * Makefile.in: Regenerate.
2104         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2105         64 bit output.
2106
2107 2010-09-08  Rafael Espindola  <espindola@google.com>
2108
2109         * script-sections.cc (Script_sections::add_memory_region): Convert
2110         field precision to int.
2111         * script.cc (script_set_section_region, script_set_section_region):
2112         Convert field precision to int.
2113
2114 2010-09-08  Rafael Espindola  <espindola@google.com>
2115
2116         * arm.cc (do_finalize_sections): Create the __exidx_start and
2117         __exdix_end symbols even when the section is missing.
2118
2119 2010-09-08  Nick Clifton  <nickc@redhat.com>
2120
2121         * README: Remove claim that MEMORY is not supported.
2122         * expression.cc (script_exp_function_origin)
2123         (script_exp_function_length): Move from here to ...
2124         * script.cc: ... here.
2125         (script_set_section_region, script_add_memory)
2126         (script_parse_memory_attr, script_include_directive): New
2127         functions.
2128         * script-sections.cc
2129         (class Memory_region): New class.
2130         (class Output_section_definition): Add set_memory_region,
2131         set_section_vma, set_section_lma and get_section_name methods.
2132         (class Script_Sections): Add add_memory_region,
2133         find_memory_region, find_memory_region_origin,
2134         find_memory_region_length and set_memory_region methods.
2135         Have set_section_addresses method walk the list of set memory
2136         regions.
2137         Extend the print methos to display memory regions.
2138         * script-sections.h: Add prototypes for new methods.
2139         Add enum for MEMORY region attributes.
2140         * yyscript.y: Add support for parsing MEMORY regions.
2141         * script-c.h: Add prototypes for new functions.
2142         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2143         * testsuite/Makefile.in: Regenerate.
2144         * testsuite/memory_test.sh: New script.
2145         * testsuite/memory_test.s: New assembler source file.
2146         * testsuite/memory_test.t: New linker script.
2147
2148 2010-08-27  Doug Kwan  <dougkwan@google.com>
2149
2150         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2151         reference override an existing dynamic weak reference.
2152         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2153         * testsuite/Makefile.in: Regenerate.
2154         * testsuite/dyn_weak_ref.sh: New file.
2155         * testsuite/dyn_weak_ref_1.c: Ditto.
2156         * testsuite/dyn_weak_ref_2.c: Ditto.
2157
2158 2010-08-27  Ian Lance Taylor  <iant@google.com>
2159
2160         * incremental.h (class Incremental_input_entry): Add virtual
2161         destructor.
2162
2163 2010-08-27  Ian Lance Taylor  <iant@google.com>
2164
2165         * testsuite/start_lib_test_3.c: Mark t3 as used.
2166
2167 2010-08-27  Nick Clifton  <nickc@redhat.com>
2168
2169         * options.cc (version_script): Fix small typo in previous
2170         whitespace tidyup.
2171
2172 2010-08-25  Nick Clifton  <nickc@redhat.com>
2173
2174         * archive.cc: Formatting fixes: Remove whitespace between
2175         typename and following asterisk.  Remove whitespace between
2176         function name and opening parenthesis.
2177         * archive.h: Likewise.
2178         * arm.cc: Likewise.
2179         * attributes.cc: Likewise.
2180         * attributes.h: Likewise.
2181         * common.cc: Likewise.
2182         * copy-relocs.cc: Likewise.
2183         * dirsearch.h: Likewise.
2184         * dynobj.cc: Likewise.
2185         * ehframe.cc: Likewise.
2186         * ehframe.h: Likewise.
2187         * expression.cc: Likewise.
2188         * fileread.cc: Likewise.
2189         * fileread.h: Likewise.
2190         * gc.h: Likewise.
2191         * gold-threads.cc: Likewise.
2192         * gold.cc: Likewise.
2193         * i386.cc: Likewise.
2194         * icf.h: Likewise.
2195         * incremental-dump.cc: Likewise.
2196         * incremental.cc: Likewise.
2197         * layout.cc: Likewise.
2198         * layout.h: Likewise.
2199         * main.cc: Likewise.
2200         * merge.cc: Likewise.
2201         * merge.h: Likewise.
2202         * object.cc: Likewise.
2203         * object.h: Likewise.
2204         * options.cc: Likewise.
2205         * options.h: Likewise.
2206         * output.cc: Likewise.
2207         * output.h: Likewise.
2208         * plugin.cc: Likewise.
2209         * plugin.h: Likewise.
2210         * powerpc.cc: Likewise.
2211         * reloc.cc: Likewise.
2212         * script-c.h: Likewise.
2213         * script-sections.cc: Likewise.
2214         * script.cc: Likewise.
2215         * stringpool.cc: Likewise.
2216         * symtab.cc: Likewise.
2217         * symtab.h: Likewise.
2218         * target.cc: Likewise.
2219         * timer.cc: Likewise.
2220         * timer.h: Likewise.
2221         * version.cc: Likewise.
2222         * x86_64.cc: Likewise.
2223
2224 2010-08-24  Nick Clifton  <nickc@redhat.com>
2225
2226         PR 11899
2227         * layout.cc (segment_precedes): Sort segments by their physical
2228         addresses, if they have been set.
2229
2230 2010-08-23  Cary Coutant  <ccoutant@google.com>
2231
2232         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2233         symbols data.
2234         (Lib_group::include_member): Unlock object after deleting its
2235         symbols data.
2236         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2237         the bug fixed here.
2238
2239 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2240             Cary Coutant  <ccoutant@google.com>
2241
2242         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2243         constructor, and set_blocker.
2244         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2245         readsyms_blocker_.
2246         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2247         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2248         * testsuite/Makefile.am (start_lib_test): New test case.
2249         * testsuite/Makefile.in: Regenerate.
2250         * testsuite/start_lib_test_main.c: New file.
2251         * testsuite/start_lib_test_1.c: New file.
2252         * testsuite/start_lib_test_2.c: New file.
2253         * testsuite/start_lib_test_3.c: New file.
2254
2255 2010-08-19  Ian Lance Taylor  <iant@google.com>
2256
2257         * Makefile.in: Rebuild with automake 1.11.1.
2258         * aclocal.m4: Likewise.
2259         * testsuite/Makefile.in: Likewise.
2260
2261 2010-08-19  Ian Lance Taylor  <iant@google.com>
2262
2263         PR 10893
2264         * i386.cc (class Output_data_plt_i386): Update declarations.
2265         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2266         local_ifuncs_ fields.
2267         (Target_i386::do_plt_section_for_global): New function.
2268         (Target_i386::do_plt_section_for_local): New function.
2269         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2270         parameter; change all callers.  Initialize global_ifuncs_ and
2271         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2272         __rel_iplt_end.
2273         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2274         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2275         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2276         symbols.
2277         (Target_i386::make_plt_section): New function, broken out of
2278         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2279         (Target_i386::make_plt_entry): Call make_plt_section.
2280         (Target_i386::make_local_ifunc_plt_entry): New function.
2281         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2282         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2283         R_386_IRELATIVE to switch.
2284         (Target_i386::Scan::global): Likewise.
2285         (Target_i386::Relocate::relocate): Likewise.
2286         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2287         switch.
2288         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2289         (Target_x86_64::do_plt_section_for_global): New function.
2290         (Target_x86_64::do_plt_section_for_local): New function.
2291         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2292         parameter; change all callers.  If doing a static link define
2293         __rela_iplt_start and __rela_iplt_end.
2294         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2295         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2296         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2297         to point to .plt.
2298         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2299         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2300         switch.
2301         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2302         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2303         R_X86_64_IRELATIVE to switch.
2304         (Target_x86_64::Scan::global): Likewise.
2305         (Target_x86_64::Relocate::relocate): Likewise.
2306         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2307         switch.
2308         * target.h (class Target): Add plt_section_for_global and
2309         plt_section_for_local functions.  Add do_plt_section_for_global
2310         and do_plt_section_for_local virtual functions.
2311         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2312         clarifying comments.
2313         (Symbol::use_plt_offset): Handle IFUNC symbol.
2314         * object.cc (Sized_relobj::Sized_relobj): Initialize
2315         local_plt_offsets_.
2316         (Sized_relobj::local_has_plt_offset): New function.
2317         (Sized_relobj::local_plt_offset): New function.
2318         (Sized_relobj::set_local_plt_offset): New function.
2319         (Sized_relobj::do_count): Handle IFUNC symbol.
2320         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2321         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2322         is_ifunc_symbol functions.
2323         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2324         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2325         local_plt_offsets_ field.
2326         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2327         * output.h (class Output_section_data): Add non-const
2328         output_section function.
2329         (class Output_data_got): Update declarations.
2330         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2331         Add use_plt_offset parameter to global and local constructors.
2332         Change all callers.  Change local_sym_index_ field to 31 bits.
2333         Change GSYM_CODE and CONSTANT_CODE accordingly.
2334         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2335         doing a static link don't set sh_link field.
2336         (Output_data_got::Got_entry::write): Use PLT offset if
2337         appropriate.
2338         (Output_data_got::add_global_plt): New function.
2339         (Output_data_got::add_local_plt): New function.
2340         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2341         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2342         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2343         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2344         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2345         IFUNC conditional.
2346         * testsuite/ifunc-sel.h: New file.
2347         * testsuite/ifuncmain1.c: New file.
2348         * testsuite/ifuncmain1vis.c: New file.
2349         * testsuite/ifuncmod1.c: New file.
2350         * testsuite/ifuncdep2.c: New file.
2351         * testsuite/ifuncmain2.c: New file.
2352         * testsuite/ifuncmain3.c: New file.
2353         * testsuite/ifuncmod3.c: New file.
2354         * testsuite/ifuncmain4.c: New file.
2355         * testsuite/ifuncmain5.c: New file.
2356         * testsuite/ifuncmod5.c: New file.
2357         * testsuite/ifuncmain6pie.c: New file.
2358         * testsuite/ifuncmod6.c: New file.
2359         * testsuite/ifuncmain7.c: New file.
2360         * configure, testsuite/Makefile.in: Rebuild.
2361
2362 2010-08-18  Ian Lance Taylor  <iant@google.com>
2363
2364         * incremental.cc
2365         (Output_section_incremental_inputs::write_input_files): Add cast
2366         to avoid signed/unsigned comparison warning.
2367         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2368
2369 2010-08-12  Cary Coutant  <ccoutant@google.com>
2370
2371         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2372
2373 2010-08-13  Ian Lance Taylor  <iant@google.com>
2374
2375         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2376
2377 2010-08-12  Cary Coutant  <ccoutant@google.com>
2378             Doug Kwan  <dougkwan@google.com>
2379
2380         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2381         defintion overrides non-weak undef, remember that the original undef
2382         is not weak.
2383         * symtab.cc (Symbol_table::sized_write_global): For undef without
2384         an original weak binding, set binding to global in output.
2385         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2386         * testsuite/Makefile.in: Regenerate.
2387         * testsuite/strong_ref_weak_def.sh: New file.
2388         * testsuite/strong_ref_weak_def_1.c: Ditto.
2389         * testsuite/strong_ref_weak_def_2.c: Ditto.
2390
2391 2010-08-12  Cary Coutant  <ccoutant@google.com>
2392
2393         * testsuite/incremental_test.sh: Rewrite.
2394         * testsuite/incremental_test_1.c: Rewrite.
2395         * testsuite/incremental_test_2.c: Rewrite.
2396
2397 2010-08-12  Cary Coutant  <ccoutant@google.com>
2398
2399         * arm.cc (Target_arm::got_size): Add const.
2400         (Target_arm::got_entry_count): New function.
2401         (Target_arm::plt_entry_count): New function.
2402         (Target_arm::first_plt_entry_offset): New function.
2403         (Target_arm::plt_entry_size): New function.
2404         (Output_data_plt_arm::entry_count): New function.
2405         (Output_data_plt_arm::first_plt_entry_offset): New function.
2406         (Output_data_plt_arm::get_plt_entry_size): New function.
2407         * i386.cc (Target_i386::got_size): Add const.
2408         (Target_i386::got_entry_count): New function.
2409         (Target_i386::plt_entry_count): New function.
2410         (Target_i386::first_plt_entry_offset): New function.
2411         (Target_i386::plt_entry_size): New function.
2412         (Output_data_plt_i386::entry_count): New function.
2413         (Output_data_plt_i386::first_plt_entry_offset): New function.
2414         (Output_data_plt_i386::get_plt_entry_size): New function.
2415         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2416         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2417         * incremental.cc: Include target.h.
2418         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2419         parameter.  Adjust all callers.  Find incremental_got_plt section.
2420         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2421         section.
2422         (Output_section_incremental_inputs::set_final_data_size): Calculate
2423         size of incremental_got_plt section.
2424         (Output_section_incremental_inputs::do_write): Write the
2425         incremental_got_plt section.
2426         (Got_plt_view_info): New struct.
2427         (Local_got_offset_visitor): New class.
2428         (Global_got_offset_visitor): New class.
2429         (Global_symbol_visitor_got_plt): New class.
2430         (Output_section_incremental_inputs::write_got_plt): New function.
2431         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2432         Add parameter.  Adjust all callers.
2433         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2434         (Incremental_inputs::got_plt_section): New function.
2435         (Incremental_inputs::got_plt_section_): New data member.
2436         (Incremental_got_plt_reader): New class.
2437         * layout.cc (Layout::create_incremental_info_sections): Add the
2438         incremental_got_plt section.
2439         * object.h (Got_offset_list::get_list): New function.
2440         (Got offset_list::for_all_got_offsets): New function.
2441         (Sized_relobj::local_got_offset_list): New function.
2442         * powerpc.cc (Target_powerpc::got_size): Add const.
2443         (Target_powerpc::got_entry_count): New function.
2444         (Target_powerpc::plt_entry_count): New function.
2445         (Target_powerpc::first_plt_entry_offset): New function.
2446         (Target_powerpc::plt_entry_size): New function.
2447         (Output_data_plt_powerpc::entry_count): New function.
2448         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2449         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2450         * sparc.cc (Target_sparc::got_size): Add const.
2451         (Target_sparc::got_entry_count): New function.
2452         (Target_sparc::plt_entry_count): New function.
2453         (Target_sparc::first_plt_entry_offset): New function.
2454         (Target_sparc::plt_entry_size): New function.
2455         (Output_data_plt_sparc::entry_count): New function.
2456         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2457         (Output_data_plt_sparc::get_plt_entry_size): New function.
2458         * symtab.h (Symbol::got_offset_list): New function.
2459         (Symbol_table::for_all_symbols): New function.
2460         * target.h (Sized_target::got_entry_count): New function.
2461         (Sized_target::plt_entry_count): New function.
2462         (Sized_target::plt_entry_size): New function.
2463         * x86_64.cc (Target_x86_64::got_size): Add const.
2464         (Target_x86_64::got_entry_count): New function.
2465         (Target_x86_64::plt_entry_count): New function.
2466         (Target_x86_64::first_plt_entry_offset): New function.
2467         (Target_x86_64::plt_entry_size): New function.
2468         (Output_data_plt_x86_64::entry_count): New function.
2469         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2470         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2471
2472 2010-08-12  Cary Coutant  <ccoutant@google.com>
2473
2474         * archive.cc: Include incremental.h.
2475         (Archive::Archive): Initialize incremental_info_.
2476         (Archive::include_member): Record archive members in incremental info.
2477         (Add_archive_symbols::run): Record begin and end of an archive in
2478         incremental info.
2479         (Lib_group::include_member): Record objects in incremental info.
2480         * archive.h (Incremental_archive_entry): Forward declaration.
2481         (Archive::set_incremental_info): New member function.
2482         (Archive::incremental_info): New member function.
2483         (Archive::Unused_symbol_iterator): New class.
2484         (Archive::unused_symbols_begin): New member function.
2485         (Archive::unused_symbols_end): New member function.
2486         (Archive::incremental_info_): New data member.
2487         * incremental-dump.cc (find_input_containing_global): New function.
2488         (dump_incremental_inputs): Dump new incremental info sections.
2489         * incremental.cc: Include symtab.h.
2490         (Output_section_incremental_inputs): New class.
2491         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2492         new incremental info sections.
2493         (Sized_incremental_binary::do_check_inputs): Likewise.
2494         (Incremental_inputs::report_archive): Remove.
2495         (Incremental_inputs::report_archive_begin): New function.
2496         (Incremental_inputs::report_archive_end): New function.
2497         (Incremental_inputs::report_object): New function.
2498         (Incremental_inputs::finalize_inputs): Remove.
2499         (Incremental_inputs::report_input_section): New function.
2500         (Incremental_inputs::report_script): Rewrite.
2501         (Incremental_inputs::finalize): Do nothing but finalize string table.
2502         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2503         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2504         (Incremental_inputs::create_data_sections): New function.
2505         (Incremental_inputs::relocs_entsize): New function.
2506         (Output_section_incremental_inputs::set_final_data_size): New function.
2507         (Output_section_incremental_inputs::do_write): New function.
2508         (Output_section_incremental_inputs::write_header): New function.
2509         (Output_section_incremental_inputs::write_input_files): New function.
2510         (Output_section_incremental_inputs::write_info_blocks): New function.
2511         (Output_section_incremental_inputs::write_symtab): New function.
2512         * incremental.h (Incremental_script_entry): Forward declaration.
2513         (Incremental_object_entry): Forward declaration.
2514         (Incremental_archive_entry): Forward declaration.
2515         (Incremental_inputs): Forward declaration.
2516         (Incremental_inputs_header_data): Remove.
2517         (Incremental_inputs_header): Remove.
2518         (Incremental_inputs_header_write): Remove.
2519         (Incremental_inputs_entry_data): Remove.
2520         (Incremental_inputs_entry): Remove.
2521         (Incremental_inputs_entry_write): Remove.
2522         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2523         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2524         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2525         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2526         Likewise.
2527         (Incremental_input_entry): New class.
2528         (Incremental_script_entry): New class.
2529         (Incremental_object_entry): New class.
2530         (Incremental_archive_entry): New class.
2531         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2532         (Incremental_inputs::report_inputs): Remove.
2533         (Incremental_inputs::report_archive): Remove.
2534         (Incremental_inputs::report_archive_begin): New function.
2535         (Incremental_inputs::report_archive_end): New function.
2536         (Incremental_inputs::report_object): Change prototype.
2537         (Incremental_inputs::report_input_section): New function.
2538         (Incremental_inputs::report_script): Change prototype.
2539         (Incremental_inputs::get_reloc_count): New function.
2540         (Incremental_inputs::set_reloc_count): New function.
2541         (Incremental_inputs::create_data_sections): New function.
2542         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2543         (Incremental_inputs::inputs_section): New function.
2544         (Incremental_inputs::symtab_section): New function.
2545         (Incremental_inputs::relocs_section): New function.
2546         (Incremental_inputs::get_stringpool): Add const.
2547         (Incremental_inputs::command_line): Add const.
2548         (Incremental_inputs::inputs): Remove.
2549         (Incremental_inputs::command_line_key): New function.
2550         (Incremental_inputs::input_file_count): New function.
2551         (Incremental_inputs::input_files): New function.
2552         (Incremental_inputs::relocs_entsize): New function.
2553         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2554         (Incremental_inputs::finalize_inputs): Remove.
2555         (Incremental_inputs::Input_info): Remove.
2556         (Incremental_inputs::lock_): Remove.
2557         (Incremental_inputs::inputs_): Change type.
2558         (Incremental_inputs::inputs_map_): Remove.
2559         (Incremental_inputs::current_object_entry_): New data member.
2560         (Incremental_inputs::inputs_section_): New data member.
2561         (Incremental_inputs::symtab_section_): New data member.
2562         (Incremental_inputs::relocs_section_): New data member.
2563         (Incremental_inputs::reloc_count_): New data member.
2564         (Incremental_inputs_reader): New class.
2565         (Incremental_symtab_reader): New class.
2566         (Incremental_relocs_reader): New class.
2567         * layout.cc (Layout::finalize): Move finalization of incremental info
2568         and creation of incremental info sections to follow finalization of
2569         symbol table.  Set offsets for postprocessing sections.
2570         (Layout::create_incremental_info_sections): Call
2571         Incremental_inputs::create_data_sections.  Add incremental symtab
2572         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2573         sections to layout after input sections.
2574         * layout.h (struct Timespec): Forward declaration.
2575         (Layout::incremental_inputs): Add const.
2576         (Layout::create_incremental_info_sections): Add parameter.
2577         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2578         * object.cc: Include incremental.h.
2579         (Relobj::finalize_incremental_relocs): New function.
2580         (Sized_relobj::do_layout): Record input sections in incremental info.
2581         * object.h (Object::output_section): New function.
2582         (Object::output_section_offset): Moved from Relobj.
2583         (Object::get_incremental_reloc_base): New function.
2584         (Object::get_incremental_reloc_count): New function.
2585         (Object::do_output_section): New function.
2586         (Object::do_output_section_offset): Moved from Relobj.
2587         (Object::do_get_incremental_reloc_base): New function.
2588         (Object::do_get_incremental_reloc_count): New function.
2589         (Object::Object): Initialize new data members.
2590         (Relobj::output_section): Renamed do_output_section and moved to
2591         protected.
2592         (Relobj::output_section_offset): Moved to Object.
2593         (Relobj::do_get_incremental_reloc_base): New function.
2594         (Relobj::do_get_incremental_reloc_count): New function.
2595         (Relobj::allocate_incremental_reloc_counts): New function.
2596         (Relobj::count_incremental_reloc): New function.
2597         (Relobj::finalize_incremental_relocs): New function.
2598         (Relobj::next_incremental_reloc_index): New function.
2599         (Relobj::reloc_counts_): New data member.
2600         (Relobj::reloc_bases_): New data member.
2601         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2602         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2603         (Sized_relobj::incremental_relocs_scan): New function.
2604         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2605         (Sized_relobj::incremental_relocs_write): New function.
2606         (Sized_relobj::incremental_relocs_write_reltype): New function.
2607         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2608         incremental link.
2609         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2610         archives and object files elsewhere.
2611         (Add_symbols::run): Report object files here.
2612         (Finish_group::run): Report end of archive at end of group.
2613         * reloc.cc: Include layout.h, incremental.h.
2614         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2615         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2616         (Sized_relobj::incremental_relocs_scan): New function.
2617         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2618         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2619         (Sized_relobj::incremental_relocs_write): New function.
2620         (Sized_relobj::incremental_relocs_write_reltype): New function.
2621         * script.cc (read_input_script): Rewrite test for incremental link.
2622         Change call to Incremental_inputs::report_script.
2623         * symtab.h (Symbol_table::first_global_index): New function.
2624         (Symbol_table::output_count): New function.
2625
2626 2010-08-12  Doug Kwan  <dougkwan@google.com>
2627
2628         * arm.cc (Target_arm::merge_object_attributes): Check command line
2629         options --no-wchar-size-warning and --no-enum-size-warning.
2630         * options.h (General_options): Add ld-compatible options
2631         --no-enum-size-warning and --no-wchar-size-warning.
2632
2633 2010-08-04  Ian Lance Taylor  <iant@google.com>
2634
2635         * x86_64.cc (Target_x86_64::Scan::local): Use
2636         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2637         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2638         (Target_x86_64::Scan::global): Likewise.
2639         (Target_x86_64::Relocate::relocate): Likewise.
2640         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2641         Likewise.
2642
2643 2010-08-03  Cary Coutant  <ccoutant@google.com>
2644
2645         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2646         to reserve space in merged_strings vector. Keep total input size
2647         for stats.
2648         (Output_merge_string::do_print_merge_stats): Print total input size.
2649         * merge.h (Output_merge_string): Add input_size_ field.
2650         * stringpool.cc (Stringpool_template::string_length): Move
2651         implementations out of Stringpool_template class and place in
2652         stringpool.h.
2653         * stringpool.h (string_length): Move out of Stringpool_template.
2654
2655 2010-08-03  Ian Lance Taylor  <iant@google.com>
2656
2657         PR 11712
2658         * layout.cc (relaxation_loop_body): If address of load segment is
2659         set, adjust address to include headers if possible.
2660
2661 2010-08-03  Ian Lance Taylor  <iant@google.com>
2662
2663         * version.cc (version_string): Bump to 1.10.
2664
2665 2010-08-03  Ian Lance Taylor  <iant@google.com>
2666
2667         PR 11805
2668         * layout.h (enum Output_section_order): Define.
2669         (class Layout): Update declarations.
2670         * layout.cc (Layout::get_output_section): Add order parameter.
2671         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2672         is_first_non_relro parameters.  Change all callers.
2673         (Layout::choose_output_section): Likewise.
2674         (Layout::add_output_section_data): Likewise.
2675         (Layout::make_output_section): Likewise.  Set order.
2676         (Layout::default_section_order): New function.
2677         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2678         * output.cc (Output_section::Output_section): Initialize order_.
2679         Don't initialize deleted fields.
2680         (Output_segment::Output_segment): Don't initialize deleted
2681         fields.
2682         (Output_segment::add_output_section_to_load): New function
2683         replacing add_output_section.  Change all callers to call this or
2684         add_output_section_to_nonload.
2685         (Output_segment::add_output_section_to_nonload): New function.
2686         (Output_segment::remove_output_section): Rewrite.
2687         (Output_segment::add_initial_output_data): Likewise.
2688         (Output_segment::has_any_data_sections): Likewise.
2689         (Output_segment::is_first_section_relro): Likewise.
2690         (Output_segment::maximum_alignment): Likewise.
2691         (Output_segment::has_dynamic_reloc): New function replacing
2692         dynamic_reloc_count.  Change all callers.
2693         (Output_segment::has_dynamic_reloc_list): New function replacing
2694         dynamic_reloc_count_list.  Change all callers.
2695         (Output_segment::set_section_addresses): Rewrite.
2696         (Output_segment::set_offset): Rewrite.
2697         (Output_segment::find_first_and_last_list): Remove.
2698         (Output_segment::set_tls_offsets): Rewrite.
2699         (Output_segment::first_section_load_address): Likewise.
2700         (Output_segment::output_section_count): Likewise.
2701         (Output_segment::section_with_lowest_load_address): Likewise.
2702         (Output_segment::write_section_headers): Likewise.
2703         (Output_segment::print_sections_to_map): Likewise.
2704         * output.h (class Output_data): Remove dynamic_reloc_count_
2705         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2706         (Output_data::add_dynamic_reloc): Rewrite.
2707         (Output_data::has_dynamic_reloc): New function.
2708         (Output_data::dynamic_reloc_count): Remove.
2709         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2710         is_last_relro_, is_first_non_relro_, is_interp_,
2711         is_dynamic_linker_section_ fields.  Add order and set_order
2712         functions.  Remove is_relro_local, set_is_relro_local,
2713         is_last_relro, set_is_last_relro, is_first_non_relro,
2714         set_is_first_non_relro functions, is_interp, set_is_interp,
2715         is_dynamic_linker_section, and set_is_dynamic_linker_section
2716         functions.
2717         (class Output_segment): Change Output_data_list from std::list to
2718         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2719         output_bss_ fields.  Update declarations.
2720
2721 2010-08-02  Ian Lance Taylor  <iant@google.com>
2722
2723         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2724         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2725         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2726
2727 2010-08-02  Ian Lance Taylor  <iant@google.com>
2728
2729         PR 11855
2730         * script.cc (Script_options::Script_options): Initialize
2731         symbol_definitions_ and symbol_references_.
2732         (Script_options::add_symbol_assignment): Update
2733         symbol_definitions_ and symbol_references_.
2734         (Script_options::add_symbol_reference): New function.
2735         (script_symbol): New function.
2736         * script.h (class Script_options): Add symbol_definitions_ and
2737         symbol_references_ fields.
2738         (Script_options::referenced_const_iterator): New type.
2739         (Script_options::referenced_begin): New function.
2740         (Script_options::referenced_end): New function.
2741         (Script_options::is_referenced): New function.
2742         (Script_options::any_unreferenced): New function.
2743         * script-c.h (script_symbol): Declare.
2744         * yyscript.y (exp): Call script_symbol.
2745         * symtab.cc: Include "script.h".
2746         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2747         Change all callers.  Check symbols referenced by scripts.
2748         (Symbol_table::add_undefined_symbols_from_command_line): Add
2749         layout parameter.  Change all callers.
2750         (Symbol_table::do_add_undefined_symbols_from_command_line):
2751         Likewise.  Break out loop body.  Check symbols referenced by
2752         scripts.
2753         (Symbol_table::add_undefined_symbol_from_command_line): New
2754         function broken out of
2755         do_add_undefined_symbols_from_command_line.
2756         * symtab.h (class Symbol_table): Update declarations.
2757         * archive.cc: Include "layout.h".
2758         (Archive::should_include_member): Add layout parameter.  Change
2759         all callers.  Check for symbol mentioned in expression.
2760         * archive.h (class Archive): Update declaration.
2761         * object.cc (Sized_relobj::do_should_include_member): Add layout
2762         parameter.
2763         * object.h (Object::should_include_member): Add layout parameter.
2764         Change all callers.
2765         (Object::do_should_include_member): Add layout parameter.
2766         (class Sized_relobj): Update declaration.
2767         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2768         parameter.
2769         * dynobj.h (class Sized_dynobj): Update declaration.
2770         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2771         layout parameter.
2772         * plugin.h (class Sized_pluginobj): Update declaration.
2773
2774 2010-08-02  Ian Lance Taylor  <iant@google.com>
2775
2776         PR 11866
2777         * output.cc (Output_segment::set_offset): Search for the first and
2778         last sections rather than assuming that the list is in order.
2779         (Output_segment::find_first_and_last_list): New function.
2780         * output.h (class Output_segment): Update declarations.
2781         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2782         (relro_strip_test_SOURCES): New variable.
2783         (relro_strip_test_DEPENDENCIES): New variable.
2784         (relro_strip_test_LDFLAGS): New variable.
2785         (relro_strip_test_LDADD): New variable.
2786         (relro_strip_test.so): New target.
2787
2788 2010-08-02  Ian Lance Taylor  <iant@google.com>
2789
2790         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2791         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2792         (Target_i386::got_tlsdesc_section): New function.
2793         (Target_i386::got_section): Create space for GOT entries for
2794         TLSDESC relocations.
2795         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2796         R_386_TLS_GOTDESC.
2797         (Target_i386::Scan::global): Likewise.
2798         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2799         using TLSDESC GOT.
2800         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2801         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2802         (Target_x86_64::got_tlsdesc_section): New function.
2803         (Target_x86_64::got_section): Create space for GOT entries for
2804         TLSDESC relocations.
2805         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2806         R_386_TLS_GOTDESC.
2807         (Target_x86_64::Scan::global): Likewise.
2808         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2809         using TLSDESC GOT.
2810
2811 2010-08-02  Ian Lance Taylor  <iant@google.com>
2812
2813         * testsuite/final_layout.sh: Use dc to convert from hex to
2814         decimal.
2815
2816 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2817
2818         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2819         paramter to the call to gold::gc_process_relocs.
2820         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2821         paramter to the call to gold::gc_process_relocs.
2822         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2823         parameter to the call to gold::gc_process_relocs.
2824         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2825         template parameter to the call to gold::gc_process_relocs.
2826         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2827         paramter to the call to gold::gc_process_relocs.
2828         * gc.h (get_embedded_addend_size): New function.
2829         (gc_process_relocs): Save the size of the reloc for use by ICF.
2830         * icf.cc (get_section_contents): Get the addend from the text section
2831         for SHT_REL relocation sections.
2832         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2833         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2834         * int_encoding.h (read_from_pointer): New overloaded function.
2835         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2836         * testsuite/icf_sht_rel_addend_test.sh: New file.
2837         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2838         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2839
2840 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2841
2842         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2843         * Makefile.in: Regenerate.
2844         * testsuite/Makefile.in: Regenerate.
2845
2846 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2847
2848         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2849         * gold/testsuite/debug_msg.cc: Likewise.
2850         * gold/testsuite/odr_violation1.cc
2851         * gold/testsuite/odr_violation2.cc
2852
2853 2010-07-21  Cary Coutant  <ccoutant@google.com>
2854
2855         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2856         string, and length fields.
2857         (Output_merge_string::Merged_strings_list): New type.
2858         (Output_merge_string::Merged_strings_lists): New typedef.
2859         (Output_merge_string): Replace merged_strings_ with
2860         merged_strings_lists_.
2861         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2862         Merged_strings_list per input object and section.  Don't store pointer
2863         to the string.  Don't store length with each merged string entry.
2864         (Output_merge_string::finalize_merged_data): Loop over list of merged
2865         strings lists.  Recompute length of each merged string.
2866
2867 2010-07-15  Cary Coutant  <ccoutant@google.com>
2868
2869         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2870         here.
2871
2872 2010-07-14  Ian Lance Taylor  <iant@google.com>
2873
2874         * descriptors.cc (Descriptors::open): Report correct name in error
2875         message.
2876
2877 2010-07-13  Doug Kwan  <dougkwan@google.com>
2878
2879         * arm.cc (Arm_input_section::Arm_input_section): For a
2880         SHT_ARM_EXIDX section, always keeps the input sections.
2881         (Arm_input_section::set_exidx_section_link): New method.
2882         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2883         has_errors_ to false.
2884         (Arm_exidx_input_section::has_errors,
2885         Arm_exidx_input_section::set_has_errors): New methods.
2886         (Arm_exidx_input_section::has_errors_): New data member.
2887         (Arm_relobj::get_exidx_shndx_list): New method.
2888         (Arm_output_section::append_text_sections_to_list): Do not skip
2889         section without SHF_EXECINSTR.
2890         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2891         errors.
2892         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2893         section header.  Make error messages more verbose.  Check for
2894         a non-executable section linked to an EXIDX section.
2895         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2896         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2897         check that there is no deferred EXIDX section if we exit early.
2898         Instead of not making an EXIDX section in case of an error, make one
2899         and set the has_errors flag of it.
2900         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2901         in a relocatable link.
2902         (Target_arm::do_relax): Look for the EXIDX output section instead of
2903         assuming that it is called .ARM.exidx.
2904         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2905         section list.  Do not check for SHF_EXECINSTR section flags but
2906         skip any input section with errors.
2907         * output.cc (Output_section::Output_section): Initialize
2908         always_keeps_input_sections_ to false.
2909         (Output_section::add_input_section): Check for
2910         always_keeps_input_sections_.
2911         *  output.h (Output_section::always_keeps_input_sections,
2912         Output_section::set_always_keeps_input_sections): New methods.
2913         (Output_section::always_keeps_input_sections): New data member.
2914
2915 2010-07-13  Rafael Espindola  <espindola@google.com>
2916
2917         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2918         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2919
2920 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2921             Ian Lance Taylor  <iant@google.com>
2922
2923         * output.h (Output_section_lookup_maps::add_merge_section):
2924         Correct check of whether value was inserted.
2925         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2926         (Output_section_lookup_maps::add_relaxed_input_section):
2927         Likewise.
2928         * arm.cc (Target_arm::got_section): Remove used local os.
2929         * i386.cc (Target_i386::got_section): Likewise.
2930         * x86_64.cc (Target_x86_64::got_section): Likewise.
2931         * sparc.cc (Target_sparc::got_section): Likewise.
2932         (Target_sparc::relocate): Remove unused local have_got_offset.
2933         * powerpc.cc (Target_powerpc::relocate): Likewise.
2934
2935 2010-07-13  Ian Lance Taylor  <iant@google.com>
2936
2937         * compressed_output.cc (zlib_decompress): Fix signature in
2938         !HAVE_ZLIB_H case.
2939
2940         * archive.cc (Archive::include_member): Unlock an external member
2941         of a thin archive.  Don't bother to delete an object we know is
2942         NULL.
2943
2944 2010-07-12  Cary Coutant  <ccoutant@google.com>
2945
2946         * compressed_output.cc (zlib_decompress): New function.
2947         (get_uncompressed_size): New function.
2948         (decompress_input_section): New function.
2949         * compressed_output.h (get_uncompressed_size): New function.
2950         (decompress_input_section): New function.
2951         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2952         Handle compressed debug sections.
2953         * layout.cc (is_compressed_debug_section): New function.
2954         (Layout::output_section_name): Map compressed section names to
2955         canonical names.
2956         * layout.h (is_compressed_debug_section): New function.
2957         (is_debug_info_section): Recognize compressed debug sections.
2958         * merge.cc: Include compressed_output.h.
2959         (Output_merge_data::do_add_input_section): Handle compressed
2960         debug sections.
2961         (Output_merge_string::do_add_input_section): Handle compressed
2962         debug sections.
2963         * object.cc: Include compressed_output.h.
2964         (Sized_relobj::Sized_relobj): Initialize new data members.
2965         (build_compressed_section_map): New function.
2966         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2967         * object.h (Object::section_is_compressed): New method.
2968         (Object::do_section_is_compressed): New method.
2969         (Sized_relobj::Compressed_section_map): New type.
2970         (Sized_relobj::do_section_is_compressed): New method.
2971         (Sized_relobj::compressed_sections_): New data member.
2972         * output.cc (Output_section::add_input_section): Handle compressed
2973         debug sections.
2974         * reloc.cc: Include compressed_output.h.
2975         (Sized_relobj::write_sections): Handle compressed debug sections.
2976
2977 2010-07-08  Cary Coutant  <ccoutant@google.com>
2978
2979         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2980         weak when resolving to a dynamic def.
2981         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2982         for weak undef/dynamic def cases. Adjust callers.
2983         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2984         undef_binding_weak_.
2985         (Symbol_table::sized_write_globals): Adjust symbol binding.
2986         (Symbol_table::sized_write_symbol): Add binding parameter.
2987         * symtab.h (Symbol::set_undef_binding): New method.
2988         (Symbol::is_undef_binding_weak): New method.
2989         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2990         (Symbol_table::should_override): Add new parameter.
2991         (Symbol_table::sized_write_symbol): Add new parameter.
2992
2993         * testsuite/weak_undef_file1.cc: Add new test case.
2994         * testsuite/weak_undef_file2.cc: Fix header comment.
2995         * testsuite/weak_undef_test.cc: Add new test case.
2996
2997 2010-06-29  Doug Kwan  <dougkwan@google.com>
2998
2999         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3000         Initialize USE_SYMBOL_.
3001         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3002         definition.
3003         (Arm_reloc_property::uses_symbol_): New data member declaration.
3004         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3005         uses symbol value and symbol is undefined but not weakly undefined.
3006
3007 2010-06-28  Rafael Espindola  <espindola@google.com>
3008
3009         * plugin.cc (Plugin::load): Use dlerror.
3010
3011 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3012
3013         * symtab.cc (detect_odr_violations): When reporting an ODR
3014         violation, report an object where the symbol is defined.
3015
3016 2010-06-25  Doug Kwan  <dougkwan@google.com>
3017
3018         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3019         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3020         definition.
3021         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3022         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3023         target hook to detect function points.
3024         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3025         * icf.h (Icf::check_section_for_function_pointers): Change type of
3026         parameter SECTION_NAME to const reference to std::string.  Use
3027         target hook to determine if section may have unsafe pointers.
3028         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3029         method definition.
3030
3031 2010-06-21  Rafael Espindola  <espindola@google.com>
3032
3033         * fileread.cc (Input_file::find_fie): New
3034         (Input_file::open): Use Input_file::find_fie.
3035         * fileread.h (Input_file::find_fie): New
3036         * plugin.cc (set_extra_library_path): New.
3037         (Plugin::load): Add set_extra_library_path to the transfer vector.
3038         (Plugin_manager::set_extra_library_path): New.
3039         (Plugin_manager::add_input_file): Use the extra search path if set.
3040         (set_extra_library_path(): New.
3041         * plugin.h (Plugin_manager): Add set_extra_library_path and
3042         extra_search_path_.
3043
3044 2010-06-19  Cary Coutant  <ccoutant@google.com>
3045
3046         * layout.cc (gdb_sections): Add .debug_types.
3047         (lines_only_debug_sections): Likewise.
3048
3049 2010-06-18  Rafael Espindola  <espindola@google.com>
3050
3051         * plugin.cc (add_input_file,add_input_library)
3052         (Plugin_manager::add_input_file): Make filename arguments const.
3053         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3054         const.
3055
3056 2010-06-16  Doug Kwan  <dougkwan@google.com>
3057
3058         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3059         .ARM.attributes section if we have not merged any input
3060         attributes sections.
3061
3062 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3063
3064         * arm.cc: Allow combining objects with no EABI version
3065         information.
3066
3067 2010-06-15  Rafael Espindola  <espindola@google.com>
3068
3069         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3070
3071 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3072
3073         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3074         (struct iovec): Correct !HAVE_READV definition.
3075
3076 2010-06-10  Cary Coutant  <ccoutant@google.com>
3077
3078         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3079         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3080         reloc sections.
3081         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3082
3083         PR 11683
3084         * symtab.h (Symbol::is_placeholder): New member function.
3085         * target-reloc.h (relocate_section): Check for placeholder symbols.
3086
3087         * testsuite/Makefile.am (plugin_test_8): New test.
3088         (plugin_test_9): New test.
3089         * testsuite/Makefile.in: Regenerate.
3090
3091 2010-06-09  Nick Clifton  <nickc@redhat.com>
3092
3093         * yyscript.y (input_list_element): Allow strings prefixed with
3094         the '-' character.  Treat these as libraries.
3095         * script.cc (script_add_library): New function.  Adds a library
3096         specified by "-l<name>" found in an input script.
3097         * script-c.h: Add prototype for script_add_library.
3098
3099 2010-06-07  Doug Kwan  <dougkwan@google.com>
3100
3101         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3102         Restrict stub-group size to be within long conditional branch
3103         range when working around cortex-A8 erratum.
3104
3105 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3106
3107         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3108         #ifdef typo.
3109
3110 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3111
3112         PR gold/11658
3113         * output.cc
3114         (Output_section::Input_section_sort_entry::compare_section_ordering):
3115         Change to return non-zero correctly.
3116         (Output_section::Input_section_sort_section_order_index_compare
3117         ::operator()): Change to fix ambiguity in comparisons.
3118
3119 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3120
3121         * gold.h (is_wildcard_string): New function.
3122         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3123         (Layout::layout_eh_frame): Ditto.
3124         (Layout::find_section_order_index): New method.
3125         (Layout::read_layout_from_file): New method.
3126         * layout.h (Layout::find_section_order_index): New method.
3127         (Layout::read_layout_from_file): New method.
3128         (Layout::input_section_position_): New private member.
3129         (Layout::input_section_glob_): New private member.
3130         * main.cc (main): Call read_layout_from_file here.
3131         * options.h (--section-ordering-file): New option.
3132         * output.cc (Output_section::input_section_order_specified_): New
3133         member.
3134         (Output_section::Output_section): Initialize new member.
3135         (Output_section::add_input_section): Add new parameter.
3136         Keep input sections when --section-ordering-file is used.
3137         (Output_section::set_final_data_size): Sort input sections when
3138         section ordering file is specified.
3139         (Output_section::Input_section_sort_entry): Add new parameter.
3140         Check sorting type.
3141         (Output_section::Input_section_sort_entry::compare_section_ordering):
3142         New method.
3143         (Output_section::Input_section_sort_compare::operator()): Change to
3144         consider section_order_index.
3145         (Output_section::Input_section_sort_init_fini_compare::operator()):
3146         Change to consider section_order_index.
3147         (Output_section::Input_section_sort_section_order_index_compare
3148         ::operator()): New method.
3149         (Output_section::sort_attached_input_sections): Change to sort
3150         according to section order when specified.
3151         (Output_section::add_input_section<32, true>): Add new parameter.
3152         (Output_section::add_input_section<64, true>): Add new parameter.
3153         (Output_section::add_input_section<32, false>): Add new parameter.
3154         (Output_section::add_input_section<64, false>): Add new parameter.
3155         * output.h (Output_section::add_input_section): Add new parameter.
3156         (Output_section::input_section_order_specified): New
3157         method.
3158         (Output_section::set_input_section_order_specified): New method.
3159         (Input_section::Input_section): Initialize section_order_index_.
3160         (Input_section::section_order_index): New method.
3161         (Input_section::set_section_order_index): New method.
3162         (Input_section::section_order_index_): New member.
3163         (Input_section::Input_section_sort_section_order_index_compare): New
3164         struct.
3165         (Output_section::input_section_order_specified_): New member.
3166         * script-sections.cc (is_wildcard_string): Delete and move modified
3167         method to gold.h.
3168         (Output_section_element_input::Output_section_element_input): Modify
3169         call to is_wildcard_string.
3170         (Output_section_element_input::Input_section_pattern
3171         ::Input_section_pattern): Ditto.
3172         (Output_section_element_input::Output_section_element_input): Ditto.
3173         * testsuite/Makefile.am (final_layout): New test case.
3174         * testsuite/Makefile.in: Regenerate.
3175         * testsuite/final_layout.cc: New file.
3176         * testsuite/final_layout.sh: New file.
3177
3178 2010-06-01  Rafael Espindola  <espindola@google.com>
3179
3180         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3181
3182 2010-06-01  Rafael Espindola  <espindola@google.com>
3183
3184         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3185         visibility of symbols.
3186
3187 2010-05-27  Doug Kwan  <dougkwan@google.com>
3188
3189         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3190         from start of output section instead of address for a local symbol
3191         in a merged or relaxed section when doing a relocatable link.
3192
3193 2010-05-26  Rafael Espindola  <espindola@google.com>
3194
3195        PR 11604
3196         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3197         adding sections the garbage collector removed.
3198         * gold/testsuite/Makefile.am: Add test.
3199         * gold/testsuite/Makefile.in: Regenerate.
3200         * gold/testsuite/plugin_test_7.sh: New.
3201         * gold/testsuite/plugin_test_7_1.c: New.
3202         * gold/testsuite/plugin_test_7_2.c: New.
3203
3204 2010-05-26  Rafael Espindola  <espindola@google.com>
3205
3206         * script-sections.cc (Output_section_definition::set_section_addresses):
3207         Check for --section-start.
3208
3209 2010-05-26  Doug Kwan  <dougkwan@google.com>
3210
3211         * arm.cc (Arm_scan_relocatable_relocs): New class.
3212         (Target_arm::relocate_special_relocatable): New method.
3213         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3214         (Arm_relocate_functions::thumb_branch_common): Same.
3215         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3216         instead of Default_scan_relocatable_relocs.
3217         * target-reloc.h (relocate_for_relocatable): Let target handle
3218         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3219         * target.h (Sized_target::relocate_special_relocatable): New method.
3220
3221 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3222
3223         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3224
3225 2010-05-23  Doug Kwan  <dougkwan@google.com>
3226
3227         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3228         instead of a cast.
3229         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3230         with a direct branch, not a conditional branch, to a stub.
3231         * merge.cc (Output_merge_base::record_input_section): New method
3232         defintion.
3233         (Output_merge_data::do_add_input_section): Record input section if
3234         keeps-input-sections flag is set.
3235         (Output_merge_string::do_add_input_section): Ditto.
3236         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3237         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3238         INPUT_SECTIONS_.
3239         (Output_merge_base::keeps_input_sections,
3240         Output_merge_base::set_keeps_input_sections,
3241         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3242         method definitions.
3243         (Output_merge_base::Input_sections): New type declaration.
3244         (Output_merge_base::input_sections_begin,
3245         Output_merge_base::input_sections_end,
3246         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3247         (Output_merge_base::bool keeps_input_sections_,
3248         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3249         Output_merge_base::input_sections_): New data members.
3250         (Output_merge_data::do_set_keeps_input_sections): New method
3251         defintion.
3252         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3253         * output.cc (Output_section::Input_section::relobj): Move method
3254         defintion from class declaration to here and handle merge sections.
3255         (Output_section::Input_section::shndx): Ditto.
3256         (Output_section::Output_section): Remove initializations of removed
3257         data members and initialize new data member LOOKUP_MAPS_.
3258         (Output_section::add_input_section): Set keeps-input-sections flag
3259         for a newly created merge output section as appropriate.  Adjust code
3260         to use Output_section_lookup_maps class.
3261         (Output_section::add_relaxed_input_section): Adjst code for lookup
3262         maps code refactoring.
3263         (Output_section::add_merge_input_section): Add a new parameter
3264         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3265         class.  If adding input section to a newly created merge output
3266         section fails, remove the new merge section.
3267         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3268         Adjust code for use of the Output_section_lookup_maps class.
3269         (Output_section::find_merge_section): Ditto.
3270         (Output_section::build_lookup_maps): New method defintion.
3271         (Output_section::find_relaxed_input_section): Adjust code to use
3272         Output_section_lookup_maps class.
3273         (Output_section::get_input_sections): Export merge sections.  Adjust
3274         code to use Output_section_lookup_maps class.
3275         (Output_section:::add_script_input_section): Adjust code to use
3276         Output_section_lookup_maps class.  Update lookup maps for merge
3277         sections also.
3278         (Output_section::discard_states): Use Output_section_lookup_maps.
3279         (Output_section::restore_states): Same.
3280         * output.h (Merge_section_properties): Move class defintion out of
3281         Output_section.
3282         (Output_section_lookup_maps): New class.
3283         (Output_section::Input_section::is_merge_section): New method
3284         defintion.
3285         (Output_section::Input_section::relobj): Move defintion out of class
3286         defintion.  Declare method only.
3287         (Output_section::Input_section::shndx): Ditto.
3288         (Output_section::Input_section::output_merge_base): New method defintion.
3289         (Output_section::Input_section::u2_.pomb): New union field.
3290         (Output_section::Merge_section_by_properties_map,
3291         Output_section::Output_section_data_by_input_section_map,
3292         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3293         Remove types.
3294         (Output_section::add_merge_input_section): Add new parameter
3295         KEEPS_INPUT_SECTIONS.
3296         (Output_section::build_lookup_maps): New method declaration.
3297         (Output_section::merge_section_map_,
3298         Output_section::merge_section_by_properties_map_,
3299         Output_section::relaxed_input_section_map_,
3300         Output_section::is_relaxed_input_section_map_valid_): Remove data
3301         members.
3302         (Output_section::lookup_maps_): New data member.
3303
3304 2010-05-21  Doug Kwan  <dougkwan@google.com>
3305
3306         PR gold/11619
3307         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3308         avoid a compilation error.
3309
3310 2010-05-19  Rafael Espindola  <espindola@google.com>
3311
3312         * script-sections.cc (Output_section_definition::allocate_to_segment):
3313         Update the phdrs_list even when the output section is NULL.
3314         * testsuite/Makefile.am: Add test.
3315         * testsuite/Makefile.in: Regenerate.
3316         * testsuite/script_test_9.cc: New.
3317         * testsuite/script_test_9.sh: New.
3318         * testsuite/script_test_9.t: New.
3319
3320 2010-05-19  Doug Kwan  <dougkwan@google.com>
3321
3322         * arm.cc (Arm_input_section::original_size): New method.
3323         (Arm_input_section::do_addralign): Add a cast.
3324         (Arm_input_section::do_output_offset): Remove static cast.
3325         (Arm_input_section::original_addralign,
3326          Arm_input_section::original_size_): Change type to uint32_t.
3327         (Arm_input_section::init): Add safe casts for section alignment
3328         and size.
3329         (Arm_input_section::set_final_data_size): Do not set address and
3330         offset of stub table.
3331         (Arm_output_section::fix_exidx_coverage): Change use of of
3332         Output_section::Simple_input_section to that of
3333         Output_section::Input_section.
3334         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3335         except for the first pass.
3336         * output.cc (Output_section::get_input_sections): Change type of
3337         input_sections to std::list<Input_section>.
3338         (Output_section::add_script_input_section): Rename from
3339         Output_section::add_simple_input_section.  Change type of SIS
3340         parameter from Simple_input_section to Input_section.
3341         * output.h (Output_section::Simple_input_section): Remove class.
3342         (Output_section::Input_section): Change class visibility to public.
3343         (Output_section::Input_section::addralign): Use stored alignments
3344         for special input sections if set.
3345         (Output_section::Input_section::set_addralign): New method.
3346         (Output_section::get_input_sections): Change parameter type from
3347         list of Simple_input_section to list of Input_section.
3348         (Output_section::add_script_input_section): Rename from
3349         Output_section::add_simple_input_section. Change first parameter's
3350         type from Simple_input_section to Input_section and remove the
3351         second and third parameters.
3352         * script-sections.cc (Input_section::Input_section_list): Change
3353         type to list of Output_section::Input_section/
3354         (Input_section_info::Input_section_info): Change parameter type of
3355         INPUT_SECTION to Output_section::Input_section.
3356         (Input_section_info::input_section): Change return type.
3357         (Input_section_info::input_section_): Change type to
3358         Output_section::Input_section.
3359         (Output_section_element_input::set_section_addresses): Adjust code
3360         to use Output_section::Input_section instead of
3361         Output_section::Simple_input_section.  Adjust code for renaming
3362         of Output_section::add_simple_input_section.
3363         (Orphan_output_section::set_section_addresses): Ditto.
3364
3365 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3366
3367         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3368         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3369
3370 2010-05-18  Rafael Espindola  <espindola@google.com>
3371
3372         * options.cc (General_options::finalize): Handle -nostdlib.
3373         * options.h (nostdlib): New option.
3374         * script.cc (script_add_search_dir): Handle -nostdlib.
3375
3376 2010-05-12  Doug Kwan  <dougkwan@google.com>
3377
3378         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3379         attributes section only if there no attributes section after merging.
3380         (Target_arm::merge_object_attributes): Move value of
3381         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3382         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3383         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3384         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3385         and arm_attr_merge_7.stdout.
3386         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3387         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3388         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3389         arm_attr_merge_7b.o): New rules.
3390         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3391         arm_attr_merge_7
3392         * testsuite/Makefile.in: Regenerate.
3393         * testsuite/arm_attr_merge.sh: New file.
3394         * testsuite/arm_attr_merge_[67][ab].s: Same.
3395
3396 2010-05-05  Nick Clifton  <nickc@redhat.com>
3397
3398         * po/es.po: Updated Spanish translation.
3399
3400 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3401
3402         * Makefile.am (install-exec-local): Properly install gold as
3403         default cross linker.
3404         * Makefile.in: Regenerated.
3405
3406 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3407             Nick Clifton  <nickc@redhat.com>
3408
3409         * configure.ac (install_as_default): Define and set to false
3410         unless --enable-gold or --enable-gold=both/gold has been
3411         specified.
3412         * configure: Regenerate.
3413
3414         * Makefile.am (install-exec-local): Install the executable as
3415         'ld.gold'.  If install_as_default is true then also install it as
3416         'ld'.
3417         * Makefile.in: Regenerated.
3418
3419 2010-04-24  Ian Lance Taylor  <iant@google.com>
3420
3421         * layout.cc (Layout::layout_reloc): In relocatable link don't
3422         combine reloc sections for grouped sections.
3423
3424 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3425
3426         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3427         sections that are not ordinary to icf.
3428         * icf.cc (get_section_contents): Handle relocation pointing to section
3429         with no object or shndx information.
3430         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3431         * testsuite/Makefile.in: Regenerate.
3432         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3433         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3434
3435 2010-04-22  Ian Lance Taylor  <iant@google.com>
3436
3437         * expression.cc (Expression::Expression_eval_info): Add
3438         result_alignment_pointer field.
3439         (Expression::eval_with_dot): Add result_alignment_pointer
3440         parameter.  Change all callers.
3441         (Expression::eval_maybe_dot): Likewise.
3442         (class Binary_expression): Add alignment_pointer parameter to
3443         left_value and right_value.  Change all callers.
3444         (BINARY_EXPRESSION): Set result alignment.
3445         (class Trinary_expression): Add alignment_pointer parameter to
3446         arg2_value and arg3_value.  Change all callers.
3447         (Trinary_cond::value): Set result alignment.
3448         (Max_expression::value, Min_expression::value): Likewise.
3449         (Align_expression::value): Likewise.
3450         * script-sections.cc (class Sections_element): Add dot_alignment
3451         parameter to set_section_addresses virtual function.  Update
3452         instantiations.
3453         (class Output_section_element): Likewise.
3454         (Script_sections::create_segments): Add dot_alignment parameter.
3455         Change all callers.
3456         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3457         (Script_sections::set_phdrs_clause_addresses): Likewise.
3458         * script-sections.h: Update declarations.
3459         * script.h: Update declarations.
3460         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3461         min_p_align.
3462         * testsuite/script_test_3.t: Set large alignment.
3463         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3464         segment has expected alignment.
3465
3466 2010-04-22  Nick Clifton  <nickc@redhat.com>
3467
3468         * po/gold.pot: Updated by the Translation project.
3469         * po/vi.po: Updated Vietnamese translation.
3470
3471 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3472
3473         * testsuite/Makefile.am (check_PROGRAMS): Add
3474         icf_virtual_function_folding_test.
3475         * testsuite/Makefile.in: Regenerated.
3476
3477 2010-04-15  Andrew Haley  <aph@redhat.com>
3478
3479         * options.h (merge_exidx_entries): New option.
3480         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3481         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3482         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3483         (Target_arm::merge_exidx_entries): New function.
3484         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3485         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3486         to Arm_exidx_fixup constructor.
3487         Add new arg, merge_exidx_entries.
3488         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3489         Arm_output_section::fix_exidx_coverage.
3490
3491 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3492
3493         * icf.cc (get_section_contents): Check for preemptible functions.
3494         Ignore addend when appropriate.
3495         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3496         section folded.
3497         (add_from_relobj): Check for section folded.
3498         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3499         * symtab.h (should_add_dynsym_entry): Add new parameter.
3500         * target-reloc.h (scan_relocs): Check for section folded.
3501         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3502         Check reloc types for function pointers in shared objects.
3503         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3504         case.
3505         (icf_preemptible_functions_test): New test case.
3506         (icf_string_merge_test): New test case.
3507         * testsuite.Makefile.in: Regenerate.
3508         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3509         bar_glob.  Refactor code.
3510         * testsuite/icf_preemptible_functions_test.cc: New file.
3511         * testsuite/icf_preemptible_functions_test.sh: New file.
3512         * testsuite/icf_string_merge_test.cc: New file.
3513         * testsuite/icf_string_merge_test.sh: New file.
3514         * testsuite/icf_virtual_function_folding_test.cc: New file.
3515         * testsuite/icf_virtual_function_folding_test.sh: New file.
3516
3517 2010-04-14  Doug Kwan  <dougkwan@google.com>
3518
3519         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3520         for local symbol recounting if we remove a section due to ICF.
3521         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3522         there are no regular objects in input.
3523
3524 2010-04-13  Doug Kwan  <dougkwan@google.com>
3525
3526         * arm.cc (Arm_input_section::set_final_data_size): Compute
3527         accurate final data size instead of using current data size.
3528
3529 2010-04-09  Doug Kwan  <dougkwan@google.com>
3530
3531         * layout.cc (Layout::choose_output_section): Handle script section
3532         types.
3533         (Layout::make_output_section_for_script): Add section type parameter.
3534         Handle script section types.
3535         * layout.h (Layout::make_output_section_for_script): Add section
3536         type parameter.
3537         * output.cc (Output_section::Output_section): Initialize data member
3538         is_noload_.
3539         (Output_section::do_reset_address_and_file_offset): Do not set address
3540         to 0 if section is a NOLOAD section.
3541         * output.h (Output_section::is_noload): New method.
3542         (Output_section::set_is_noload): Ditto.
3543         (Output_section::is_noload_): New data member.
3544         * script-c.h (Script_section_type): New enum type.
3545         (struct Parser_output_section_header): Add new file section_type.
3546         * script-sections.cc (Sections_element::output_section_name): Add
3547         parameter for returning script section type.
3548         (Output_section_definition::output_section_name): Ditto.
3549         (Output_section_definition::section_type)P; New method.
3550         (Output_section_definiton::script_section_type_name): Ditto.
3551         (Output_section_definition::script_section_type_): New data member.
3552         (Output_section_definition::Output_section_definition): Initialize
3553         data member Output_section_definition::script_section_type_.
3554         (Output_section_definition::create_sections): Pass script section type
3555         to Layout::make_output_section_for_script.
3556         (Output_section_definition::output_section_name): Return script
3557         section type to caller.
3558         (Output_section_definition::set_section_address): Do not advance
3559         dot value and load address if section type is NOLOAD.  Set address
3560         of NOLOAD sections regardless of section flags.
3561         (Output_section_definition::print): Print section type if it is
3562         not SCRIPT_SECTION_TYPE_NONE.
3563         (Output_section_definition::section_type): New method.
3564         (Output_section_definition::script_section_type_name): Ditto.
3565         (Script_sections::output_section_name): Add new parameter
3566         PSECTION_TYPE for returning script section type.  Pass it to
3567         section elements.  Handle discard sections.
3568         (Sort_output_sections::operator()): Handle NOLOAD sections.
3569         * script-sections.h (Script_sections::Section_type): New enum type.
3570         (Script_sections::output_section_name): Add a new parameter for
3571         returning script section type.
3572         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3573         INFO and NOLOAD.
3574         * yyscript.y (union): Add new field SECTION_TYPE.
3575         (COPY, DSECT, INFO, NOLOAD): New tokens.
3576         (opt_address_and_section_type): Change type to output_section_header.
3577         (section_type): New non-terminal
3578         (section_header): Handle section type.
3579         (opt_address_and_section_type): Return section type value.
3580
3581 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3582
3583         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3584         * testsuite/plugin_common_test_2.c (foo): Likewise.
3585
3586 2010-04-08  Doug Kwan  <dougkwan@google.com>
3587
3588         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3589         Output_merge_data.
3590         * output.cc (Output_section::add_merge_input_section): Simplify
3591         code and return status of Output_merge_base::add_input_section.
3592         Update merge section map only if Output_merge_base::add_input_section
3593         returns true.
3594
3595 2010-04-07  Doug Kwan  <dougkwan@google.com>
3596
3597         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3598         if section is marked as containing instructions but has no mapping
3599         symbols.
3600         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3601         correct section index.
3602         (Arm_relobj::find_linked_text_section): Ditto.
3603
3604 2010-04-07  Cary Coutant  <ccoutant@google.com>
3605
3606         * archive.cc (include_member): Destroy Read_symbols_data object before
3607         releasing file.
3608         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3609         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3610         (Read_symbols_data::~Read_symbols_data) New destructor.
3611         (Section_relocs::Section_relocs) New constructor.
3612         (Section_relocs::~Section_relocs) New destructor.
3613         (Read_relocs_data::Read_relocs_data) New constructor.
3614         (Read_relocs_data::~Read_relocs_data) New destructor.
3615         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3616         pointers to NULL after deleting.
3617
3618 2010-04-07  Doug Kwan  <dougkwan@google.com>
3619
3620         * arm.cc: Replace "endianity" with "endianness" in comments.
3621         (Arm_exidx_cantunwind): Ditto.
3622         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3623         (Arm_relobj::merge_flags_and_attributes): New method.
3624         (Arm_relobj::merge_flags_and_attributes_): New data member.
3625         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3626         (Arm_relobj::scan_sections_for_stubs): Ditto.
3627         (Arm_relobj::do_read_symbols): Check to see if we really want to
3628         merge processor-specific flags and attributes.  Exit early if
3629         an object is empty except for section names and the undefined symbol.
3630         (Target_arm::do_finalize_sections): Move check for ELF format to
3631         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3632         attributes from a regular object only when we have determined that
3633         it is aapropriate.  Do not create an .ARM.attributes section in
3634         output if there is no regular input object.
3635         (Target_arm::merge_processor_specific_flags): Check
3636         --warn-mismatch before printing any error.
3637         (Target_arm::merge_object_attributes): Ditto.
3638         * gold.cc (queue_middle_tasks): Handle the case in which there is
3639         no regular object in input.
3640         * options.cc (General_options::parse_EB): New method.
3641         (General_options::parse_EL): Same.
3642         (General_options::General_options): Initialize endianness_.
3643         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3644         New options.
3645         (General_options::Endianness): New enum.
3646         (General_options::endianness): New method.
3647         (General_options::endianness_): New data member.
3648         * parameters.cc (Parameters::set_options): Check target endianness.
3649         (Parameters::set_target_once): Ditto.
3650         (Parameters::check_target_endianness): New method.
3651         (parameters_force_valid_target): If either -EL or -EB is specified,
3652         use it to define endianness of default target.
3653         * parameters.h (Parameters::check_target_endianness): New method
3654         declaration.
3655         * target.h (class Target): Change "endianity" to "endianness"
3656         in comments.
3657
3658 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3659
3660         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3661         * configure: Regenerate.
3662         * Makefile.in: Regenerate.
3663         * testsuite/Makefile.in: Regenerate.
3664
3665 2010-04-06  Cary Coutant  <ccoutant@google.com>
3666
3667         gcc PR lto/42757
3668         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3669         prevailing definitions of common symbols.
3670         * testsuite/plugin_test_6.sh: New test case.
3671         * testsuite/plugin_common_test_1.c: New test case.
3672         * testsuite/plugin_common_test_2.c: New test case.
3673         * testsuite/Makefile.am (plugin_test_6): New test case.
3674         * testsuite/Makefile.in: Regenerate.
3675
3676 2010-04-06  Nick Clifton  <nickc@redhat.com>
3677
3678         * po/vi.po: New Vietnamese translation.
3679
3680 2010-03-30  Doug Kwan  <dougkwan@google.com>
3681
3682         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3683
3684 2010-03-25  Doug Kwan  <dougkwan@google.com>
3685
3686         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3687         to avoid a conversion warning on a 32-bit host.
3688
3689 2010-03-24  Ian Lance Taylor  <iant@google.com>
3690
3691         * testsuite/script_test_3.t: Add a TLS segment.
3692         * testsuite/Makefile.am (check_PROGRAMS): Add
3693         tls_phdrs_script_test.
3694         (tls_phdrs_script_test_SOURCES): Define.
3695         (tls_phdrs_script_test_DEPENDENCIES): Define.
3696         (tls_phdrs_script_test_LDFLAGS): Define.
3697         (tls_phdrs_script_test_LDADD): Define.
3698         * testsuite/Makefile.in: Rebuild.
3699
3700 2010-03-23  Cary Coutant  <ccoutant@google.com>
3701
3702         * fileread.cc (find_or_make_view): Fix comment.
3703
3704 2010-03-23  Ian Lance Taylor  <iant@google.com>
3705
3706         * script-sections.cc (class Orphan_section_placement): Define
3707         PLACE_TLS and PLACE_TLS_BSS.
3708         (Orphan_section_placement::Orphan_section_placement): Initialize
3709         new places.
3710         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3711         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3712         (tls_script_test_SOURCES): Define.
3713         (tls_script_test_DEPENDENCIES): Define.
3714         (tls_script_test_LDFLAGS): Define.
3715         (tls_script_test_LDADD): Define.
3716         * testsuite/Makefile.in: Rebuild.
3717
3718 2010-03-22  Doug Kwan  <dougkwan@google.com>
3719
3720         * arm.cc (Arm_relocate_functions::abs8,
3721         Arm_relocate_functions::abs16): Use correct check for overflow
3722         specified in the ARM ELF specs.
3723         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3724         target of a BLX instruction specially.
3725         (Reloc_stub::stub_type_for_reloc): Ditto.
3726         (Relocate::relocate): Use symbolic names instead of numeric relocation
3727         codes to report error.
3728         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3729         workaround.
3730         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3731         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3732         thumb2_blx_out_of_range.stdout
3733         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3734         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3735         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3736         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3737         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3738         thumb2_blx_in_range, thumb2_blx_in_range.o,
3739         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3740         thumb2_blx_out_of_range.o): New rules.
3741         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3742         thumb2_blx_in_range and thumb2_blx_out_of_range.
3743         * testsuite/Makefile.in: Regenerate.
3744         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3745         * testsuite/thumb_blx_in_range.s: New file.
3746         * testsuite/thumb_blx_out_of_range.s: New file.
3747
3748 2010-03-22  Rafael Espindola  <espindola@google.com>
3749
3750         * archive.cc (Should_include): Move to archive.h.
3751         (should_include_member): Make it a member of Archive.
3752         (Lib_group): New.
3753         (Add_lib_group_symbols): New.
3754         * archive.h: Include options.h.
3755         (Archive_member): Moved from Archive.
3756         (Should_include): Moved from archive.cc.
3757         (Lib_group): New.
3758         (Add_lib_group_symbols): New.
3759         * dynobj.cc (do_should_include_member): New.
3760         * dynobj.h (do_should_include_member): New.
3761         * gold.cc (queue_initial_tasks): Update call to queue.
3762         * main.cc (main): Print lib group stats.
3763         * object.cc (do_should_include_member): New.
3764         * object.h: Include archive.h.
3765         (Object::should_include_member): New.
3766         (Object::do_should_include_member): New.
3767         (Sized_relobj::do_should_include_member): New.
3768         * options.cc (General_options::parse_start_lib): New.
3769         (General_options::parse_end_lib): New.
3770         (Input_arguments::add_file): Handle lib groups.
3771         (Input_arguments::start_group): Check we are not in a lib.
3772         (Input_arguments::start_lib): New.
3773         (Input_arguments::end_lib): New.
3774         * options.h (General_options): Add start_lib and end_lib.
3775         (Input_argument::lib_): New.
3776         (Input_argument::lib): New.
3777         (Input_argument::is_lib): New.
3778         (Input_file_lib): New.
3779         (Input_arguments::in_lib_): New.
3780         (Input_arguments::in_lib): New.
3781         (Input_arguments::start_lib): New.
3782         (Input_arguments::end_lib_): New.
3783         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3784         in unused members as preempted.
3785         (Sized_pluginobj::do_should_include_member): New.
3786         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3787         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3788         return the blocker.
3789         (Read_symbols::do_whole_lib_group): New.
3790         (Read_symbols::do_lib_group): New.
3791         (Read_symbols::do_read_symbols): Handle lib groups.
3792         (Read_symbols::get_name): Handle lib groups.
3793         * readsyms.h (Read_symbols): Add an archive member pointer.
3794         (Read_symbols::do_whole_lib_group): New.
3795         (Read_symbols::do_lib_group): New.
3796         (Read_symbols::member_): New.
3797         * script.cc (read_input_script): Update call to queue_soon.
3798
3799 2010-03-19  Doug Kwan  <dougkwan@google.com>
3800
3801         * arm.cc (Stub_table::Stub_table): Initialize new data members
3802         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3803         (Stub_table::add_reloc_stub): Assign stub offset and update
3804         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3805         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3806         New data members.
3807         (Stub_table::update_data_size_and_addralign): Use
3808         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3809         instead of going over all reloc stubs.
3810         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3811         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3812         Stringpool_template::offset_ to size of Stringpool_char.
3813         (Stringpool_template::new_key_offset): Remove code to initialize
3814         Stringpool_template::offset_.
3815         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3816         Stringpool_template::offset_ to zero.
3817
3818 2010-03-15  Doug Kwan  <dougkwan@google.com>
3819
3820         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3821         offset_.
3822         (Stringpool_template::new_key_offset): New method.
3823         (Stringpool_template::add_string): Assign offsets when adding new
3824         strings.
3825         (Stringpool_template::set_string_offsets): Do not set string offsets
3826         when not optimizing.
3827         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3828         member size_.
3829         (Chunked_vector::clear): Clear size_.
3830         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3831         (Chunked_vector::size): Return size_.
3832         (Chunked_vector::push_back): Use size_ to find insert position.
3833         (Chunked_vector::size_): New data member.
3834         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3835         (Stringpool_template::new_key_offset): New method declaration.
3836         (Stringpool_template::offset_): New data member.
3837
3838 2010-03-15   Rafael Espindola  <espindola@google.com>
3839
3840         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3841         Add_symbols' constructor.
3842         * readsyms.h (Add_symbols): Remove the input_group member.
3843
3844 2010-03-10  Ian Lance Taylor  <iant@google.com>
3845
3846         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3847         target to ask whether a reference to a symbol requires a stack
3848         split.
3849         * target.h (Target::is_call_to_non_split): New function.
3850         (Target::do_is_call_to_non_split): Declare virtual function.
3851         * target.cc: Include "symtab.h".
3852         (Target::do_is_call_to_non_split): New function.
3853         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3854
3855 2010-03-10  Cary Coutant  <ccoutant@google.com>
3856
3857         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3858         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3859         (File_read::open[2]): Add whole_file_view_ to list of views.
3860         (File_read::make_view): Remove test of whole_file_view_.
3861         (File_read::find_or_make_view): Create whole_file_view_ if
3862         necessary.
3863         (File_read::clear_views): Replace bool parameter with enum;
3864         adjust all callers.  Don't delete views with permanent data;
3865         do delete cached views and views from archives if
3866         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3867         if clearing the corresponding view.
3868         * fileread.h (File_read::Clear_views_mode): New enum.
3869         (File_read::View::is_permanent_view): New method.
3870         (File_read::clear_views): Replace bool parameter
3871         with enum; adjust all callers.
3872         * options.h (General_options): Change keep_files_mapped option;
3873         add map_whole_files.
3874         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3875         releasing the file.
3876         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3877         the file.
3878
3879 2010-03-10  David S. Miller  <davem@davemloft.net>
3880
3881         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3882
3883 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3884
3885         * icf.cc (get_section_contents): Add '@' marker after processing the
3886         merge reloc.
3887
3888 2010-03-08  Doug Kwan  <dougkwan@google.com>
3889
3890         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3891         due to a conversion warning.
3892         (Arm_relobj::update_output_local_symbol_count): Check for local
3893         symbol with unset output index.
3894
3895 2010-03-05  Ian Lance Taylor  <iant@google.com>
3896
3897         * options.h (class General_options): Add --spare-dynamic-tags.
3898         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3899         --spare-dynamic-tags.
3900
3901 2010-03-05  Ian Lance Taylor  <iant@google.com>
3902
3903         * incremental.cc: Include "libiberty.h".
3904
3905 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3906
3907         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3908         function, is_info_ member.
3909         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3910         (Versions::Versions): Update caller.
3911         (Versions::define_base_version): Likewise.
3912         (Versions::add_def): Likewise.
3913
3914 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3915
3916         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3917         (Scan::possible_function_pointer_reloc): New function.
3918         (Scan::local_reloc_may_be_function_pointer): Change to call
3919         possible_function_pointer_reloc.
3920         (Scan::global_reloc_may_be_function_pointer): Ditto.
3921         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3922         relocations in ".data.rel.ro._ZTV" section.
3923         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3924         * testsuite/icf_safe_so_test.cc: Ditto.
3925         * testsuite/icf_safe_test.cc: Ditto.
3926         * testsuite/icf_safe_test.sh: Ditto.
3927
3928 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3929             Ian Lance Taylor  <iant@google.com>
3930
3931         * target-reloc.h (relocate_section): Check the symbol table index
3932         for -1U before setting the local symbol index.
3933         (scan_relocatable_relocs): If copying the relocation, record that
3934         the local symbol is required.
3935         * object.h (Symbol_value::is_output_symtab_index_set): New
3936         function.
3937         (Symbol_value::may_be_discarded_from_output_symtab): New
3938         function.
3939         (Symbol_value::has_output_symtab_entry): New function.
3940         (Symbol_value::needs_output_symtab_entry): Remove.
3941         (Symbol_value::output_symtab_index): Make sure the symbol index is
3942         set.
3943         (Symbol_value::set_output_symtab_index): Make sure the symbol
3944         index is not set.  Make sure the new index is valid.
3945         (Symbol_value::set_must_have_output_symtab_entry): New function.
3946         (Symbol_value::has_output_dynsym_entry): New function.
3947         (Symbol_value::set_output_dynsym_index): Make sure the new index
3948         is valid.
3949         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3950         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3951         local symbol if permitted.
3952         (Sized_relobj::do_finalize_local_symbols): Call
3953         is_output_symtab_index_set rather than needs_output_symtab_entry.
3954         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3955         rather than needs_output_symtab_entry.  Call
3956         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3957         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3958         is_output_symtab_index_set rather than needs_output_symtab_entry.
3959         * testsuite/discard_locals_relocatable_test.c: New file.
3960         * testsuite/discard_locals_test.sh: Test -r.
3961         * testsuite/Makefile.am (check_DATA): Add
3962         discard_locals_relocatable_test1.syms,
3963         discard_local_relocatable_test2.syms.
3964         (MOSTLYCLEANFILES): Likewise.  Also add
3965         discard_locals_relocatable_test1.lout and
3966         discard_locals_relocatable_test2.out.
3967         (discard_locals_relocatable_test1.syms): New target.
3968         (discard_locals_relocatable_test.o): New target.
3969         (discard_locals_relocatable_test1.out): New target.
3970         (discard_locals_relocatable_test2.syms): New target.
3971         (discard_locals_relocatable_test2.out): New target.
3972         (various): Add missing ../ld-new dependencies.
3973         * testsuite/Makefile.in: Rebuild.
3974
3975 2010-03-03  Nick Clifton  <nickc@redhat.com>
3976
3977         * po/fi.po: New Finnish translation.
3978
3979 2010-03-01  Doug Kwan  <dougkwan@google.com>
3980
3981         * layout.cc (Layout::Layout): Force section types of .init_array*,
3982         .preinit_array* and .fini_array* sections.
3983         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3984         Fix check of return value of std::string::find.().
3985         (Output_section::Input_section_sort_compare::operator()): Remove
3986         comment about .init_array.
3987         (Output_section::Input_section_sort_init_fini_compare::operator()):
3988         New method.
3989         (Output_section::sort_attached_input_sections): Handle .init_array
3990         and .fini_array specially.
3991         * output.h (Output_section::Inut_section_sort_compare): Update
3992         comment.
3993         (Output_section::Input_section_sort_init_fini_compare): New struct.
3994
3995 2010-02-26  Doug Kwan  <dougkwan@google.com>
3996
3997         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3998         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3999         * testsuite/debug_msg.sh: Avoid matching source line number for
4000         use of global variable undef_int.
4001
4002 2010-02-26  Doug Kwan  <dougkwan@google.com>
4003
4004         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4005         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4006         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4007         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4008         * options.cc (General_options::General_options): Initialize member
4009         fix_v4bx_.
4010         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4011         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4012         and rm_no_fix_v4bx.stdout
4013         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4014         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4015         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4016         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4017         and arm_no_fix_v4bx.
4018         * Makefile.in: Regenerate.
4019         * testsuite/arm_fix_v4bx.s: New file.
4020         * testsuite/arm_fix_v4bx.sh: Ditto.
4021
4022 2010-02-24  Doug Kwan  <dougkwan@google.com>
4023
4024         * arm.cc (Target_arm::got_section): Make the .got section the first
4025         non RELRO section in the data segment.
4026         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4027         suffixes of section names.
4028
4029 2010-02-24  Doug Kwan  <dougkwan@google.com>
4030
4031         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4032         flags and attributes merging if an input file is a binary file.
4033         * fileread.cc (Input_file::open): Record format of original file.
4034         * fileread.h (Input_file::Format): New enum type.
4035         (Input_file::Input_file): Initialize data member format_.
4036         (Input_file::format): New method definition.
4037         (Input_file::format_):: New data member.
4038
4039 2010-02-24  Doug Kwan  <dougkwan@google.com>
4040
4041         * arm.cc (Arm_output_data_got): New class.
4042         (ARM_TCB_SIZE): New constant
4043         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4044         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4045         If user uses a script with a SECTIONS clause, issue only a warning
4046         for a misplaced EXIDX input section.  Otherwise, issue an error.
4047         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4048         garbage collection.
4049         (Target_arm::got_mode_index_entry): Handle static linking.
4050         (Target_arm::Scan::local): Ditto.
4051         (Target_arm::Scan::global): Ditto.
4052         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4053         all incorrectly implemented relocations.
4054         (Target_arm::fix_exidx_coverage): Pass layout to
4055         Arm_output_section::fix_exidx_coverage.
4056         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4057         from ".ARM.exidx." and ".ARM.extab.".
4058
4059 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4060
4061         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4062         section if it does not already exist.
4063         * attributes.cc (Attributes_section_data::Attributes_section_data):
4064         Don't crash if size is zero.
4065
4066 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4067             Ian Lance Taylor  <iant@google.com>
4068
4069         * gold.cc (queue_middle_tasks): If no input files were opened,
4070         exit.
4071         * workqueue.h (Task_function::Task_function): Assert that there is
4072         a blocker.
4073
4074 2010-02-22  Doug Kwan  <dougkwan@google.com>
4075
4076         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4077         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4078         types to avoid warnings due to different uint64_t implementations
4079         on different hosts.
4080
4081 2010-02-21  Doug Kwan  <dougkwan@google.com>
4082
4083         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4084         handling of the maximum backward branch offset.
4085         (Arm_relocate_functions::thumb_branch_common): Ditto.
4086         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4087         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4088         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4089         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4090         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4091         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4092         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4093         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4094         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4095         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4096         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4097         thumb2_bl_out_of_range.o): New rules.
4098         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4099         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4100         thumb2_bl_out_of_range
4101         * testsuite/Makefile.in: Regenerate.
4102         * testsuite/arm_bl_in_range.s: New file.
4103         * testsuite/arm_bl_out_of_range.s: Ditto.
4104         * testsuite/arm_branch_in_range.sh: Ditto.
4105         * testsuite/arm_branch_range.t: Ditto.
4106         * testsuite/thumb2_branch_range.t: Ditto.
4107         * testsuite/thumb_bl_in_range.s: Ditto.
4108         * testsuite/thumb_bl_out_of_range.s: Ditto.
4109         * testsuite/thumb_branch_range.t: Ditto.
4110
4111 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4112
4113         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4114         Add reloc offset information.
4115         * icf.cc (get_section_contents): Change iterators to point to the new
4116         vectors. Add reloc offset information to the contents.
4117         * icf.h (Icf::Sections_reachable_info): New typedef.
4118         (Icf::Sections_reachable_list): New typedef.
4119         (Icf::Offset_info): New typedef.
4120         (Icf::Reloc_info): New struct typedef.
4121         (Icf::Reloc_info_list): New typedef.
4122         (Icf::symbol_reloc_list): Delete method.
4123         (Icf::addend_reloc_list): Delete method.
4124         (Icf::section_reloc_list): Delete method.
4125         (Icf::reloc_info_list): New method.
4126         (Icf::reloc_info_list_): New member.
4127
4128 2010-02-19  Doug Kwan  <dougkwan@google.com>
4129
4130         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4131         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4132         * arm.cc (Arm_relocation_functions): New forward declaration.
4133         (Target_arm::Target_arm): Initialize new data members
4134         got_mod_index_offset_ and tls_base_symbol_defined_.
4135         (Target_arm::Relocate::relocate_tls): New method.
4136         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4137          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4138         New methods.
4139         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4140         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4141         (Target_arm::got_mod_index_offset_,
4142         Target_arm::tls_base_symbol_defined_): New data members.
4143         (Target_arm::Scan::local, Target::Scan::global,
4144         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4145         relocations.
4146
4147 2010-02-18  Doug Kwan  <dougkwan@google.com>
4148
4149         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4150         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4151         text section as a parameter becuase some broken tools may not set
4152         the link in section header.
4153         (Target_arm::has_got_section): New method.
4154         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4155         without any mapping symbol as data only.  Remove warning.
4156         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4157         link in its section header, try to discover the link by inspecting the
4158         REL31 relocation at the beginning of the section.
4159         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4160         in error message.
4161         (Target_arm::Scan::global): Treat any reference to the symbol
4162         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4163
4164 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4165
4166         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4167         (Scan::global_reloc_may_be_function_pointer): New function.
4168         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4169         (Scan::global_reloc_may_be_function_pointer): New function.
4170         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4171         (Scan::global_reloc_may_be_function_pointer): New function.
4172         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4173         (Scan::global_reloc_may_be_function_pointer): New function.
4174         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4175         (Scan::global_reloc_may_be_function_pointer): New function.
4176         (Scan::possible_function_pointer_reloc): New function.
4177         (Target_x86_64::can_check_for_function_pointers): New function.
4178         * gc.h (gc_process_relocs): Scan relocation types to determine if
4179         function pointers were taken for targets that support it.
4180         * icf.cc (Icf::find_identical_sections): Include functions for
4181         folding in safe ICF whose pointer is not taken.
4182         * icf.h (Secn_fptr_taken_set): New typedef.
4183         (fptr_section_id_): New member.
4184         (section_has_function_pointers): New function.
4185         (set_section_has_function_pointers): New function.
4186         (check_section_for_function_pointers): New function.
4187         * options.h: Fix comment for safe ICF option.
4188         * target.h (can_check_for_function_pointers): New function.
4189         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4190         Modify icf_safe_test for X86-64.
4191         * testsuite/Makefile.in: Regenerate.
4192         * testsuite/icf_safe_so_test.cc: New file.
4193         * testsuite/icf_safe_so_test.sh: New file.
4194         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4195         (main): Change to take pointer to function kept_func_3.
4196         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4197         folding is done correctly for X86-64.
4198
4199 2010-02-12  David S. Miller  <davem@davemloft.net>
4200
4201         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4202         is_symbolless parameter.
4203         (Output_reloc<SHT_REL>::is_symbolless): New.
4204         (Output_reloc<SHT_REL>::is_symbolless_): New.
4205         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4206         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4207         (Output_reloc<SHT_RELA>::is_symbolless): New.
4208         (Output_data_reloc::add_global): Handle is_symbolless.
4209         (Output_data_reloc::add_global_relative): Likewise.
4210         (Output_data_reloc::add_local): Likewise.
4211         (Output_data_reloc::add_local_relative): Likewise.
4212         (Output_data_reloc::add_symbolless_global_addend): New.
4213         (Output_data_reloc::add_symbolless_local_addend): New.
4214         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4215         is_symbolless.
4216         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4217         instead of ->is_relative_
4218         (Output_reloc::write): Likewise.
4219         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4220         (Output_reloc::write_rel): Simplify.
4221
4222         * sparc.cc (Target_sparc::Scan::local): Use
4223         ->add_symbolless_local_addend as needed.
4224         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4225         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4226         based upon relocation offset.
4227
4228 2010-02-11  Doug Kwan  <dougkwan@google.com>
4229
4230         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4231         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4232         beginning of function.
4233         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4234         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4235         parameter is_32bit in calls to should_apply_static_reloc.
4236         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4237         (check_DATA): Add arm_abs_global.stdout.
4238         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4239         arm_abs_global.stdout): New rules.
4240         (MOSTLLYCLEANFILES): Add arm_abs_global
4241         * Makefile.in: Regenerate.
4242         * testsuite/arm_abs_global.s: New file.
4243         * testsuite/arm_abs_global.sh: Ditto.
4244         * testsuite/arm_abs_lib.s: Ditto.
4245
4246 2010-02-11  Ian Lance Taylor  <iant@google.com>
4247
4248         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4249         Read_relocs task.
4250         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4251         Allocate_commons_task first.
4252         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4253         task, rather than symtab_lock_.
4254         (Gc_process_relocs::~Gc_process_relocs): New function.
4255         (Gc_process_relocs::is_runnable): Check this_blocker_.
4256         (Gc_process_relocs::locks): Use next_blocker_ rather than
4257         blocker_.
4258         (Scan_relocs::~Scan_relocs): New function.
4259         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4260         symtab_lock_.
4261         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4262         next_blocker_.
4263         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4264         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4265         constructor accordingly.
4266         (class Gc_process_relocs): Likewise.
4267         (class Scan_relocs): Likewise.
4268         * common.h (class Allocate_commons_task): Remove symtab_lock_
4269         field, and corresponding constructor parameter.
4270         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4271         symtab_lock_.
4272         (Allocate_commons_task::locks): Likewise.
4273
4274 2010-02-11  Ian Lance Taylor  <iant@google.com>
4275
4276         * gold-threads.h (class Once): Define.
4277         (class Initialize_lock): Rewrite as child of Once.
4278         * gold-threads.cc (class Once_initialize): Define.
4279         (once_pointer_control): New static variable.
4280         (once_pointer, once_arg): New static variables.
4281         (c_run_once): New static function.
4282         (Once::Once, Once::run_once, Once::internal_run): New functions.
4283         (class Initialize_lock_once): Remove.
4284         (initialize_lock_control): Remove.
4285         (initialize_lock_pointer): Remove.
4286         (initialize_lock_once): Remove.
4287         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4288         (Initialize_lock::initialize): Rewrite.
4289         (Initialize_lock::do_run_once): New function.
4290         * archive.cc (Archive::interpret_header): Only clear name if it is
4291         not already empty.
4292         * fileread.cc: Include "gold-threads.h"
4293         (file_counts_lock): New static variable.
4294         (file_counts_initialize_lock): Likewise.
4295         (File_read::release): Only increment counts when using --stats.
4296         Use a lock around the increment.
4297         * parameters.cc (class Set_parameters_target_once): Define.
4298         (set_parameters_target_once): New static variable.
4299         (Parameters::Parameters): Move here from parameters.h.
4300         (Parameters::set_target): Rewrite.
4301         (Parameters::set_target_once): New function.
4302         (Parameters::clear_target): Move here and rewrite.
4303         * parameters.h (class Parameters): Update declarations.  Add
4304         set_parameters_target_once_ field.
4305         (Parameters::Parameters): Move to parameters.cc.
4306         (Parameters::clear_target): Likewise.
4307         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4308         task.
4309         (Start_group::~Start_group): New function.
4310         (Start_group::is_runnable): New function.
4311         (Start_group::locks, Start_group::run): New functions.
4312         (Finish_group::run): Change saw_undefined to size_t.
4313         * readsyms.h (class Start_group): Define.
4314         (class Finish_group): Change saw_undefined_ field to size_t.
4315         (Finish_group::Finish_group): Remove saw_undefined and
4316         this_blocker parameters.  Change all callers.
4317         (Finish_group::set_saw_undefined): New function.
4318         (Finish_group::set_blocker): New function.
4319         * symtab.h (class Symbol_table): Change saw_undefined to return
4320         size_t.  Change saw_undefined_ field to size_t.
4321         * target-select.cc (Set_target_once::do_run_once): New function.
4322         (Target_selector::Target_selector): Initialize set_target_once_
4323         field.  Don't initialize lock_ and initialize_lock_ fields.
4324         (Target_selector::instantiate_target): Rewrite.
4325         (Target_selector::set_target): New function.
4326         * target-select.h (class Set_target_once): Define.
4327         (class Target_selector): Update declarations.  Make
4328         Set_target_once a friend.  Remove lock_ and initialize_lock_
4329         fields.  Add set_target_once_ field.
4330
4331 2010-02-10  Ian Lance Taylor  <iant@google.com>
4332
4333         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4334         queueing any tasks.
4335         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4336         (queue_middle_tasks): Add all blockers before queueing any tasks.
4337         (queue_final_tasks): Likewise.
4338         * token.h (Task_token::add_blockers): New function.
4339         * object.h (Input_objects::number_of_relobjs): New function.
4340
4341 2010-02-10  Ian Lance Taylor  <iant@google.com>
4342
4343         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4344         shared, not if not position independent.
4345         * x86_64.cc (Relocate::relocate_tls): Likewise.
4346         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4347         (tls_pie_pic_test): New target.
4348         * testsuite/Makefile.in: Rebuild.
4349
4350         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4351         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4352         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4353         * testsuite/Makefile.in: Rebuild.
4354
4355 2010-02-09  David S. Miller  <davem@davemloft.net>
4356
4357         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4358         R_SPARC_RELATIVE using ->add_local_relative().
4359         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4360
4361         * output.h (Output_data_dynamic::add_section_size): New method
4362         that takes two Output_data objects.
4363         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4364         entry param.  Handle it in initializers.
4365         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4366         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4367         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4368         arg.
4369         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4370         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4371         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4372         for dynrel_includes_plt.
4373         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4374         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4375         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4376         before .rela.plt
4377         (Target_sparc::do_finalize_sections): Update to pass true for
4378         dynrel_includes_plt.
4379         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4380         output before .rela.plt
4381         (Target_powerpc::do_finalize_sections): Update to pass true for
4382         dynrel_includes_plt when 32-bit.
4383
4384 2010-02-08  Doug Kwan  <dougkwan@google.com>
4385
4386         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4387         method.
4388         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4389         Arm_relobj::scan_section_for_cortex_a8_stubs,
4390         Arm_relobj::do_relocation_section): Instead of calling
4391         Output_section::output_address, use faster
4392         Arm_relobj::simple_input_section_output_address.
4393
4394 2010-02-08  David S. Miller  <davem@davemloft.net>
4395
4396         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4397         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4398         relocation helper function.
4399
4400         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4401         just like R_SPARC_GOT{10,13,22}.
4402         (Target_sparc::Scan::local): Likewise.
4403         (Target_sparc::Relocate:relocate): Likewise.
4404
4405 2010-02-06  Ian Lance Taylor  <iant@google.com>
4406
4407         * configure.ac: Rewrite targetobjs duplicate removal code to use
4408         only shell constructs.
4409         * configure: Rebuild.
4410
4411 2010-02-05  Doug Kwan  <dougkwan@google.com>
4412
4413         PR 11247
4414         * arm.cc (Arm_relobj::section_is_scannable): New method.
4415         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4416         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4417
4418 2010-02-04  Doug Kwan  <dougkwan@google.com>
4419
4420         PR 11247
4421         * arm-reloc-property.cc (cstdio): Include.
4422         * configure.ac (targetobjs): Remove duplicates.
4423         * configure: Regenerate.
4424         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4425         big and little endian version for a given address size.
4426
4427 2010-02-03  Doug Kwan  <dougkwan@google.com>
4428
4429         * arm-reloc-property.cc
4430         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4431         definition.
4432         * arm-reloc-property.h
4433         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4434         New method definition.
4435         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4436         declaration.
4437         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4438         overflow to N.
4439         (GOT_PREL): Change implemented to Y.
4440         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4441         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4442         (Arm_relocate_functions::movw_abs_nc): Remove method.
4443         (Arm_relocate_functions::movt_abs): Ditto.
4444         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4445         (Arm_relocate_functions::thm_movt_abs): Ditto.
4446         (Arm_relocate_functions::movw_rel_nc): Ditto.
4447         (Arm_relocate_functions::movw_rel): Ditto.
4448         (Arm_relocate_functions::movt_rel): Ditto.
4449         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4450         (Arm_relocate_functions:thm_movw_rel): Ditto.
4451         (Arm_relocate_functions:thm_movt_rel): Ditto.
4452         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4453         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4454         New method definitions.
4455         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4456         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4457         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4458         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4459         (Target_arm::Relocate::relocate): Check for non-static or
4460         unimplemented relocation code and exit early.  Change calls to
4461         Target_arm::reloc_uses_thumb_bit and
4462         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4463         instead.  Refactor code to handle similar relocations to increase
4464         code sharing.  Remove check for unsupported relocation code in switch
4465         statement.
4466         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4467         relocation property table to find out size.  Change error message to
4468         print out the name of a relocation code instead of the numeric value.
4469         (Target_arm::scan_reloc_for_stub): Use relocation property table
4470         instead of calling Target_arm::reloc_uses_thumb_bit().
4471
4472 2010-02-02  Doug Kwan  <dougkwan@google.com>
4473
4474         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4475         types of relaxed input section.
4476
4477 2010-02-02  Doug Kwan  <dougkwan@google.com>
4478
4479         * Makefile.am (HFILES): Add arm-reloc-property.h.
4480         (DEFFILES): New.
4481         (TARGETSOURCES): Add arm-reloc-property.cc
4482         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4483         (libgold_a_SOURCES): $(DEFFILES)
4484         * Makefile.in: Regenerate.
4485         * arm-reloc-property.cc: New file.
4486         * arm-reloc-property.h: New file.
4487         * arm-reloc.def: New file.
4488         * arm.cc: Update comments.
4489         (arm-reloc-property.h): New included header.
4490         (arm_reloc_property_table): New global variable.
4491         (Target_arm::do_select_as_default_target): New method definition.
4492         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4493         arm-reloc-property to targ_extra_obj.
4494         * parameters.cc (set_parameters_target): Call
4495         Target::select_as_default_target().
4496         * target.h (Target::select_as_default_target): New method definition.
4497         (Target::do_select_as_default_target): Same.
4498
4499 2010-02-01  Doug Kwan  <dougkwan@google.com>
4500
4501         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4502         first_output_text_section_.
4503         (Arm_exidx_fixup::first_output_text_section): New method definition.
4504         (Arm_exidx_fixup::first_output_text_section_): New data member.
4505         (Arm_exidx_fixup::process_exidx_section): Record the first text
4506         output section seen.
4507         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4508         and entsize in output section header.
4509
4510 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4511
4512         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4513         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4514         (Arm_relocate_functions::thm_alu11): New Method.
4515         (Arm_relocate_functions::thm_pc8): New Method.
4516         (Arm_relocate_functions::thm_pc12): New Method.
4517         (Target_arm::Scan::local): Handle the relocations.
4518         (Target_arm::Scan::global): Likewise.
4519         (Target_arm::Relocate::relocate): Likewise.
4520         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4521
4522 2010-01-29  Doug Kwan  <dougkwan@google.com>
4523
4524         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4525         of relocation types as ld.
4526
4527 2010-01-29  Doug Kwan  <dougkwan@google.com>
4528
4529         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4530         to public.
4531         (Arm_relocate_functions::thumb_branch_common): Ditto.
4532         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4533         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4534         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4535         Arm_relocate_functions::jump24): Remove.
4536         (Target_arm::Relocate::relocate): Adjust code to call
4537         Arm_relocation_functions::arm_branch_common and
4538         Arm_relocation_functions::thumb_branch_common instead of their removed
4539         wrappers.  Merge switch-cases together to reduce source code size.
4540
4541 2010-01-29  Doug Kwan  <dougkwan@google.com>
4542
4543         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4544         output_local_symbol_count_needs_update_.
4545         (Arm_relobj::output_local_symbol_count_needs_update,
4546          Arm_relobj::set_output_local_symbol_count_needs_update,
4547          Arm_relobj::update_output_local_symbol_count): New methods.
4548         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4549         member.
4550         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4551         of pointed function as in a R_ARM_PREL31 relocation.
4552         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4553         for output local symbol count updating.
4554         (Target_arm::do_relax): Update output local symbol counts in objects
4555         if necessary.
4556         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4557
4558 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4559
4560         * arm.cc: Added support for the ARM relocations:
4561         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4562         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4563         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4564         movw_prel_nc).
4565         (Arm_relocate_functions::movw_rel): New method.
4566         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4567         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4568         thm_movw_prel_nc).
4569         (Arm_relocate_functions::thm_movw_rel): New method.
4570         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4571         thm_movt_prel).
4572         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4573         relocations.
4574         (Target_arm::Scan::global): Likewise.
4575         (Target_arm::Relocate::relocate): Likewise.
4576         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4577         Likewise.
4578
4579 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4580
4581         * arm.cc: Added support for ARM group relocations.
4582         (Target_arm::reloc_needs_sym_origin): New method.
4583         (Arm_relocate_functions::calc_grp_kn): New method.
4584         (Arm_relocate_functions::calc_grp_residual): New method.
4585         (Arm_relocate_functions::calc_grp_gn): New method.
4586         (Arm_relocate_functions::arm_grp_alu): New Method.
4587         (Arm_relocate_functions::arm_grp_ldr): New Method.
4588         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4589         (Arm_relocate_functions::arm_grp_ldc): New Method.
4590         (Target_arm::Scan::local): Handle the ARM group relocations.
4591         (Target_arm::Scan::global): Likewise.
4592         (Target_arm::Relocate::relocate): Likewise.
4593         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4594         Likewise.
4595
4596 2010-01-26  Doug Kwan  <dougkwan@google.com>
4597
4598         * arm.cc (set): Include.
4599         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4600         pointer type.
4601         (Arm_output_section::Text_section_list): New type.
4602         (Arm_output_section::append_text_sections_to_list): New method.
4603         (Arm_output_section::fix_exidx_coverage): Ditto.
4604         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4605         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4606         Relobj::set_section_offset() instead of
4607         Sized_relobj::invalidate_section_offset().
4608         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4609         parameter for section headers. Ignore relocation sections for
4610         unallocated sections and EXIDX sections.
4611         (Target_arm::fix_exidx_coverage): New method.
4612         (Target_arm::output_section_address_less_than): New type.
4613         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4614         linked text section instead of the EXIDX section.
4615         (Arm_output_section::create_stub_group): Add an assertion to check
4616         that this is not an EXIDX output section.
4617         (Arm_output_section::append_text_sections_to_list): New method.
4618         (Arm_output_section::fix_exidx_coverage): Ditto.
4619         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4620         Arm_relobj::section_needs_reloc_stub_scanning.
4621         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4622         first pass.
4623         (Target_arm::fix_exidx_coverage): New method.
4624         * object.h (Relobj::set_output_section): New method.
4625         (Sized_relobj::invalidate_section_offset): Remove method.
4626         (Sized_relobj::do_invalidate_section_offset): Remove method.
4627         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4628
4629 2010-01-25  Doug Kwan  <dougkwan@google.com>
4630
4631         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4632         Fix warning due to signed and unsigned comparison on a 32-bit host.
4633
4634 2010-01-22  Doug Kwan  <dougkwan@google.com>
4635
4636         * arm.cc (Target_arm::do_relax): Record an output section for section
4637         offset adjustment it contains any stub table that has changed.
4638         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4639         offsets in an output section if necessary.
4640         * output.cc (Output_section::Output_section): Initialize
4641         section_offsets_need_adjustments_.
4642         (Output_section::add_input_section_for_script): Renamed to
4643         Output_section::add_simple_input_section.
4644         (Output_section::save_states): Add a comment.
4645         (Output_section::discard_states): New method defintion.
4646         (Output_section::adjust_section_offsets): Same.
4647         * output.h (Output_section::add_input_section_for_script): Renamed to
4648         Output_section::add_simple_input_section.
4649         (Output_section::discard_states): New method declaration.
4650         (Output_section::adjust_section_offsets): Same.
4651         (Output_section::section_offsets_need_adjustment,
4652         Output_section::set_section_offsets_need_adjustment): New method
4653         definitions.
4654         (Output_section::section_offsets_need_adjustment_): New data member.
4655         * script-sections.cc
4656         (Output_section_element_input::set_section_address): Adjust code for
4657         renaming of Output_section::add_input_section_for_script.
4658         (Orphan_output_section::set_section_address): Same.
4659
4660 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4661
4662         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4663         Fix_v4bx enum values .
4664         * gold/options.h (General_options): New option definitions.
4665         (General_options::fix_v4bx): New method.
4666         (General_options::Fix_v4bx): New enum.
4667         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4668         (General_options::parse_fix_v4bx_interworking): New method.
4669
4670 2010-01-22  Doug Kwan  <dougkwan@google.com>
4671
4672         * arm.cc (Arm_exidx_fixup): New class.
4673
4674 2010-01-21  Doug Kwan  <dougkwan@google.com>
4675
4676         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4677         classes.
4678         (Arm_exidx_section_offset_map): New type.
4679
4680 2010-01-21  Doug Kwan  <dougkwan@google.com>
4681
4682         * arm.cc (Arm_exidx_input_section): New class.
4683         (Arm_relobj::exidx_input_section_by_link,
4684         Arm_relobj::exidx_input_section_by_shndx,
4685         Arm_relobj::make_exidx_input_section): New methods.
4686         (read_arm_attributes_section): Remove.
4687         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4688         information about them.
4689         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4690         to here.
4691
4692 2010-01-20  Doug Kwan  <dougkwan@google.com>
4693
4694         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4695         Input_section_specifier to Section_id.
4696         (Target_arm::new_arm_input_section: Adjust code for change of key
4697         type.
4698         (Target_arm::find_arm_input_section): Ditto.
4699         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4700         (Section_id): Remove.
4701         (Garbage_collection::Section_id_hash): Remove.
4702         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4703         (Section_id): Remove.
4704         (Icf::Section_id_hash): Remove.
4705         * object.h (Section_id, Const_section_id, Section_id_hash,
4706         Const_section_id_hash): New type definitions.
4707         * output.cc (Output_section::add_relaxed_input_section): Change to
4708         use Const_section_id instead of Input_section_specifier as key type.
4709         (Output_section::add_merge_input_section): Ditto.
4710         (Output_section::build_relaxation_map): Change to use Section_id
4711         instead of Input_section_specifier as key type.
4712         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4713         Ditto.
4714         (Output_section::convert_input_sections_to_relaxed_sections): Change
4715         to use Const_section_id instead of Input_section_specifier as key type.
4716         (Output_section::find_merge_section): Ditto.
4717         (Output_section::find_relaxed_input_section): Ditto.
4718         * output.h (Input_section_specifier): Remove class.
4719         (Output_section::Output_section_data_by_input_section_map): Change
4720         key type to Const_section_id.
4721         (Output_section::Output_relaxed_input_section_by_input_section_map):
4722         Ditto.
4723         (Output_section::Relaxation_map): Change key type to Section_id.
4724
4725 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4726
4727         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4728         (class Arm_v4bx_stub): New class.
4729         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4730         (Stub_factory::make_arm_v4bx_stub): New method.
4731         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4732         (Stub_table::empty): Handle v4bx stubs.
4733         (Stub_table::add_arm_v4bx_stub): New method.
4734         (Stub_table::find_arm_v4bx_stub): New method.
4735         (Arm_relocate_functions::v4bx): New method.
4736         (Target_arm::fix_v4bx): New method.
4737         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4738         (Stub_table::relocate_stubs): Likewise.
4739         (Stub_table::do_write): Likewise.
4740         (Stub_table::update_data_size_and_addralign): Likewise.
4741         (Stub_table::finalize_stubs):  Likewise.
4742         (Target_arm::Scan::local): Likewise.
4743         (Target_arm::Scan::global): Likewise.
4744         (Target_arm::do_finalize_sections): Likewise.
4745         (Target_arm::Relocate::relocate): Likewise.
4746         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4747         Likewise.
4748         (Target_arm::scan_reloc_for_stub): Likewise.
4749         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4750
4751 2010-01-19  Ian Lance Taylor  <iant@google.com>
4752
4753         * output.cc (Output_section_headers::do_sized_write): Write large
4754         segment count to sh_info field.
4755         (Output_file_header::do_sized_write): For large segment count,
4756         write PN_XNUM to e_phnum field.
4757
4758 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4759
4760         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4761         (Arm_relocate_functions::thm_jump8): New function.
4762         (Arm_relocate_functions::thm_jump11): New function.
4763         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4764         R_ARM_THM_JUMP11.
4765         (Target_arm::Scan::global): Likewise.
4766         (Target_arm::Relocate::relocate): Likewise.
4767         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4768         Likewise.
4769
4770 2010-01-14  Doug Kwan  <dougkwan@google.com>
4771
4772         * arm.cc (map, utility): Include headers.
4773         (Target_arm::apply_cortex_a8_workaround): New method.
4774         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4775         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4776         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4777         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4778         the --[no-]fix-cortex-a8 command line options.
4779         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4780         (Target_arm::relocate_stub): Use addend in instruction template.
4781         * options.h (DEFINE_bool): Set the user-set flag.
4782         (General_options): Add --[no-]-fix-cortex options.
4783         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4784         : Update fast look-up map after conversion.
4785
4786 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4787
4788         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4789         in the first pass of do_layout.
4790
4791 2010-01-13  Doug Kwan  <dougkwan@google.com>
4792
4793         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4794         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4795         apparent compiler problem of not folding static constant integral
4796         data members of elfcpp::Elf_sizes<32>.
4797
4798 2010-01-13  Doug Kwan  <dougkwan@google.com>
4799
4800         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4801         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4802         Arm_relobj::scan_section_for_cortex_a8_erratum,
4803         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4804         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4805         sections to scan for relocation stubs into a new method
4806         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4807         relocation and Cortex-A8 stub scanning.
4808         (Target_arm::do_relax): Force stubs to be after stubbed sections
4809         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4810         the beginning of a new relaxation pass.  Update a comment.
4811         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4812
4813 2010-01-12  Ian Lance Taylor  <iant@google.com>
4814
4815         * target-reloc.h (visibility_error): New inline function.
4816         (relocate_section): Call visibility_error.
4817         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4818         (MOSTLYCLEANFILES): Likewise.
4819         (protected_4_pic.o, protected_3.err): New targets.
4820         * testsuite/protected_4.cc: New file.
4821
4822 2010-01-12  Doug Kwan  <dougkwan@google.com>
4823
4824         * arm.cc (Cortex_a8_reloc): New class.
4825         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4826         and cortex_a8_relocs_info_.
4827         (Target_arm::fix_cortex_a8): New method definition.
4828         (Target_arm::Cortex_a8_relocs_info): New type.
4829         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4830         New data member declarations.
4831         (Target_arm::scan_reloc_for_stub): Record information about
4832         relocations for THUMB branches that might be exempted from the
4833         Cortex-A8 workaround.
4834         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4835         at the beginning of a relaxation pass.
4836
4837 2010-01-12  Doug Kwan  <dougkwan@google.com>
4838
4839         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4840         (Arm_relobj::Mapping_symbol_position,
4841          Arm_reloj::Mapping_symbol_position_less,
4842          Arm_relobj::Mapping_symbols_info): New types.
4843         (Target_arm::is_mapping_symbol_name): New method definition.
4844         (Arm_relobj::do_count_local_symbols): Save information about mapping
4845         symbols.
4846
4847 2010-01-11  Doug Kwan  <dougkwan@google.com>
4848
4849         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4850         Arm_relocate_functions::thumb32_branch_upper,
4851         Arm_relocate_functions::thumb32_branch_lower,
4852         Arm_relocate_functions::thumb32_cond_branch_offset,
4853         Arm_relocate_functions::thumb32_cond_branch_upper,
4854         Arm_relocate_functions::thumb32_cond_branch_lower,
4855         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4856         branch offset encoding.
4857         (Arm_relocate_functions::thumb_branch_common): Use new branch
4858         offset encoding methods to avoid code duplication.
4859         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4860         (Stub_addend_reader::operator()): Use new branch encoding method
4861         to avoid code duplication.
4862
4863 2010-01-11  Doug Kwan  <dougkwan@google.com>
4864
4865         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4866         (Target_arm::do_finalize_sections): Define special EXIDX section
4867         symbols only if referenced.
4868         * gc.h (Garbage_collection::add_reference): New method.
4869         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4870         code duplication.
4871
4872 2010-01-11  Ian Lance Taylor  <iant@google.com>
4873
4874         * script.cc (Version_script_info::build_expression_list_lookup):
4875         Change complaing about duplicate wildcard match from error to
4876         warning.
4877
4878         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4879         of 2009-12-30.
4880         (Version_script_info::Version_script_info): Initialize globs_,
4881         default_version_, default_is_global_, and exact_.  Don't
4882         initialize globals_ or locals_.
4883         (Version_script_info::build_lookup_tables): Build local symbols
4884         first.
4885         (Version_script_info::unquote): New function.
4886         (Version_script_info::add_exact_match): New function.
4887         (Version_script_info::build_expression_list_lookup): Remove lookup
4888         parameter.  Add is_global parameter.  Change all callers.  Handle
4889         wildcard pattern specially.  Unquote pattern.  Call
4890         add_exact_match.
4891         (Version_script_info::get_name_to_match): New function.
4892         (Version_script_info::get_symbol_version): New function.
4893         (Version_script_info::get_symbol_version_helper): Remove.
4894         (Version_script_info::check_unmatched_names): Call unquote.
4895         * script.h (class Version_script_info): Change get_symbol_version
4896         to be non-inline and add is_global parameter; change all callers.
4897         Rewrite symbol_is_local.  Update declarations.  Define struct
4898         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4899         Remove globals_ and locals_ members.  Add exact_, globs_,
4900         default_version_, is_global_.
4901         (Version_script_info::Glob): Remove pattern, add expression and
4902         is_global.  Update constructor.  Change all callers.
4903         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4904         default version.
4905         (Versions::symbol_section_contents): If a symbol is undefined, or
4906         defined in a dynamic object, set the version index to
4907         VER_NDX_LOCAL.
4908         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4909         symbol_is_local.
4910         (Symbol_table::add_from_pluginobj): Likewise.
4911         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4912
4913 2010-01-11  Doug Kwan  <dougkwan@google.com>
4914
4915         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4916         (incremental_dump_LDADD): Add linking option for libintl.
4917         * Makefile.in: Regenerate.
4918
4919 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4920
4921         PR gold/11144
4922         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4923         instead of -Ds.
4924         * testsuite/Makefile.in: Regenerated.
4925
4926 2010-01-10  Doug Kwan  <dougkwan@google.com>
4927
4928         * options.h (DEFINE_var): Use parentheses around argument varname__
4929         in macro body to avoid any unintended subsequent substitutions.
4930
4931 2010-01-10  Ian Lance Taylor  <iant@google.com>
4932
4933         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4934         candidates before doing symbol resolution.
4935
4936         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4937         ODR candidates if only one is weak.
4938
4939 2010-01-08  Ian Lance Taylor  <iant@google.com>
4940
4941         * script.cc (Version_script_info::build_expression_list_lookup):
4942         Don't warn about ambiguous version, just record the ambiguity.
4943         (Version_script_info::get_symbol_version_helper): Give error if
4944         version is ambiguous.
4945
4946 2010-01-08  Doug Kwan  <dougkwan@google.com>
4947
4948         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4949           prev_data_size_ and prev_addralign_.  Remove initializer for
4950           deleted data member has_been_changed_.
4951           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4952           to determine if the table is empty.
4953           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4954           Remove.
4955           (Stub_table::add_reloc_stub): Define method in class definition
4956           instead of just declaring it there.
4957           (Stub_table::add_cortex_a8_stub): New method definition.
4958           (Stub_table::update_data_size_and_addralign): Ditto.
4959           (Stub_table::finalize_stubs): Ditto.
4960           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4961           (Stub_table::do_addralign_): Return address alignment in the
4962           (Stub_table::do_reset_address_and_file_offset): Define method in
4963           class definition instead of declaring it there.  Set current data
4964           size to be the data size of the previous pass.
4965           (Stub_table::set_final_data_size): Use current data size as the
4966           final data size.
4967           (Stub_table::relocate_stub): Change parameter type of stub from
4968           Reloc_stub pointer to Stub pointer.
4969           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4970           (Stub_table::Cortex_a8_stub_list): New typedef.
4971           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4972            Stub_table::prev_addralign_): New data member.
4973           (Arm_relobj::Arm_relobj): Initialize data member
4974           section_has_cortex_a8_workaround_.
4975           (Arm_relobj::section_has_cortex_a8_workaround,
4976            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4977            definitions.
4978           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4979           declarations.
4980           (Target_arm::relocate_stub): Change parameter type of stub from
4981           Reloc_stub pointer to Stub pointer.
4982           (Insn_template::size, Insn_template::alignment): Handle
4983           THUMB16_SPECIAL_TYPE.
4984           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4985            Stub_table::update_data_size_and_addralign,
4986            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4987           definitions.
4988           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4989           (Stub_table::do_write): Ditto.
4990           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4991
4992 2010-01-08  Ian Lance Taylor  <iant@google.com>
4993
4994         PR 11108
4995         * symtab.h (class Symbol): Remove fields is_target_special_ and
4996         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4997         (Symbol::is_defined_in_discarded_section): New function.
4998         (Symbol::set_is_defined_in_discarded_section): New function.
4999         (Symbol::has_plt_offset): Rewrite.
5000         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5001         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5002         Don't initialize is_target_special_ or has_plt_offset_.
5003         Initialize is_defined_in_discarded_section_.
5004         (Symbol_table::add_from_relobj): If appropriate, set
5005         is_defined_in_discarded_section.
5006         * resolve.cc (Symbol::override_base_with_special): Don't test
5007         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5008         * target-reloc.h (relocate_section): Do special handling for
5009         symbols defined in discarded sections for global symbols as well
5010         as local symbols.
5011
5012 2010-01-08  Ian Lance Taylor  <iant@google.com>
5013
5014         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5015         the SHT_SYMTAB case.
5016
5017 2010-01-08  Ian Lance Taylor  <iant@google.com>
5018
5019         * object.cc (Sized_relobj::do_layout): Don't get confused if
5020         layout_eh_frame returns NULL.
5021
5022 2010-01-08  Ian Lance Taylor  <iant@google.com>
5023
5024         PR 11084
5025         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5026         dynamic symbol table, use the normal symbol table.
5027         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5028         symbol table.
5029
5030 2010-01-08  Ian Lance Taylor  <iant@google.com>
5031
5032         PR 11072
5033         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5034         sections.
5035
5036 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5037
5038         * version.cc (print_version): Change to "Copyright 2010".
5039
5040 2010-01-08  Ian Lance Taylor  <iant@google.com>
5041
5042         PR 10287
5043         PR 11063
5044         * i386.cc (class Target_i386): Change return type of plt_section
5045         to be non-const.
5046         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5047         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5048         tls_desc_rel_ field.
5049         (Output_data_plt_i386::rel_tls_desc): New function.
5050         (Target_i386::rel_tls_desc_section): New function.
5051         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5052         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5053         R_386_TLS_DESC reloc in rel_tls_desc_section.
5054         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5055         Define struct Tlsdesc_info.
5056         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5057         (Target_x86_64::do_reloc_symbol_index): New function.
5058         (Target_x86_64::add_tlsdesc_info): New function.
5059         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5060         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5061         tlsdesc_rel_ field.
5062         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5063         all callers.
5064         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5065         (Target_x86_64::rela_tlsdesc_section): New function.
5066         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5067         handling.
5068         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5069         (Target_x86_64::do_reloc_addend): New function.
5070         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5071         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5072         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5073         (Output_reloc::type): New function.
5074         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5075         (Output_reloc::is_target_specific): New function.
5076         (Output_reloc::target_arg): New function.
5077         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5078         absolute relocs and target specific relocs.
5079         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5080         add_target_specific.
5081         (class Output_data_reloc) [SHT_RELA]: Likewise.
5082         * output.cc (Output_reloc::Output_reloc): Add four new versions
5083         for absolute relocs and target specific relocs.
5084         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5085         (Output_reloc::get_symbol_index): Likewise.
5086         (Output_reloc::local_section_offset): Check that local_sym_index_
5087         is not TARGET_CODE or 0.
5088         (Output_reloc::symbol_value): Likewise.
5089         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5090         reloc.
5091         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5092         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5093         functions.
5094         * layout.cc (add_target_dynamic_tags): Use output section for
5095         DT_PLTRELSZ and DT_JMPREL.
5096
5097 2010-01-07  Ian Lance Taylor  <iant@google.com>
5098
5099         PR 11061
5100         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5101         function.
5102         (class Output_data_reloc_generic): Define.
5103         (class Output_data_reloc_base): Change base class to
5104         Output_data_reloc_generic.  Change add() method to call
5105         bump_relative_reloc_count for a relative reloc.  Remove
5106         sort_relocs_ field.
5107         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5108         to sort_relocs().
5109         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5110         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5111         appropriate.
5112         * layout.h (class Layout): Update declaration.
5113
5114 2010-01-07  Ian Lance Taylor  <iant@google.com>
5115
5116         * output.h (class Output_data): Add const version of
5117         output_section and do_output_section.
5118         (class Output_section_data): Add const version of
5119         do_output_section.
5120         (class Output_section): Likewise.
5121         * layout.cc (Layout::add_target_dynamic_tags): New function.
5122         * layout.h (class Layout): Update declarations.
5123         * arm.cc (Target_arm::do_finalize_sections): Use
5124         add_target_dynamic_tags.
5125         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5126         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5127         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5128         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5129
5130 2010-01-07  Ian Lance Taylor  <iant@google.com>
5131
5132         PR 11042
5133         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5134         object as needed.
5135
5136 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5137             Ian Lance Taylor  <iant@google.com>
5138
5139         PR 11019
5140         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5141         Xindex::read_symtab_xindex.
5142
5143 2010-01-07  Doug Kwan  <dougkwan@google.com>
5144
5145         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5146         (Insn_template::thumb16_bcond_insn): New method declaration.
5147         (Insn_template): Fix spelling.
5148         (Stub::thumb16_special): New method declaration.
5149         (Stub::do_write): Define virtual method which was previously pure
5150         virtual.
5151         (Stub::do_thumb16_special): New method declaration.
5152         (Stub::do_fixed_endian_write): New template member.
5153         (Reloc_stub::do_write): Remove.
5154         (Reloc_stub::do_fixed_endian_write): Remove.
5155         (Cortex_a8_stub): New class definition.
5156         (Stub_factory::make_cortex_a8_stub): New method definition.
5157         (Stub_factory::Stub_factory): Add missing static storage class
5158         qualifier for elf32_arm_stub_a8_veneer_blx.
5159
5160 2010-01-07  Ian Lance Taylor  <iant@google.com>
5161
5162         PR 10980
5163         * options.h (class General_options): Add --warn-unresolved-symbols
5164         and --error-unresolved-symbols.
5165         * errors.cc (Errors::undefined_symbol): Implement
5166         --warn-unresolved-symbols.
5167
5168         * options.h (class General_options): Add -z text and -z textoff.
5169         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5170
5171 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5172
5173         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5174         (Garbage_collection::cident_sections): New function.
5175         (Garbage_collection::add_cident_section): New function.
5176         (Garbage_collection::cident_sections_): New member.
5177         (gc_process_relocs): Add references to sections whose names are C
5178         identifiers.
5179         * gold.h (cident_section_start_prefix): New constant.
5180         (cident_section_stop_prefix): New constant.
5181         (is_cident): New function.
5182         * layout.cc (Layout::define_section_symbols): Replace string constants
5183         with the newly defined constants.
5184         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5185         C identifiers.
5186         * testsuite/Makefile.am: Add gc_orphan_section_test.
5187         * testsuite/Makefile.in: Regenerate.
5188         * testsuite/gc_orphan_section_test.cc: New file.
5189         * testsuite/gc_orphan_section_test.sh: New file.
5190
5191 2010-01-06  Ian Lance Taylor  <iant@google.com>
5192
5193         PR 10980
5194         * options.h (class General_options): Add --warn-shared-textrel.
5195         * layout.cc (Layout::finish_dynamic_section): Implement
5196         --warn-shared-textrel.
5197
5198         PR 10980
5199         * options.h (class General_options): Add --warn-multiple-gp.
5200
5201 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5202
5203         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5204         $(THREADSLIB) and $(LIBDL).
5205         * Makefile.in: Rebuild.
5206
5207 2010-01-06  Ian Lance Taylor  <iant@google.com>
5208
5209         PR 10980
5210         * options.cc (General_options::parse_section_start): New function.
5211         (General_options::section_start): New function.
5212         (General_options::General_options): Initialize all members.
5213         * options.h: Include <map>
5214         (class General_options): Add --section-start.  Add section_starts_
5215         member.
5216         * layout.cc (Layout::attach_allocated_section_to_segment): If
5217         --section-start was used, set the address of the segment.  Remove
5218         local sort_sections.
5219         (Layout::relaxation_loop_body): If the address of the load segment
5220         has been set by --section-start, don't use it.
5221         * output.h (Output_segment::update_flags_for_output_section): New
5222         function.
5223         * output.cc (Output_segment::add_output_section): Call
5224         update_flags_for_output_section.
5225
5226 2010-01-05  Ian Lance Taylor  <iant@google.com>
5227
5228         PR 10980
5229         * options.h (class General_options): Add --undefined-version.
5230         * script.cc (struct Version_expression): Add was_matched_by_symbol
5231         field.
5232         (Version_script_info::matched_symbol): New function.
5233         (Version_script_info::get_symbol_version_helper): Call
5234         matched_symbol.
5235         (Version_script_info::check_unmatched_names): New function.
5236         * script.h (class Version_script_info): Update declarations.
5237         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5238
5239         * options.h (class General_options): Use DEFINE_bool_alias for
5240         allow_multiple_definition.
5241         * resolve.cc (Symbol_table::should_override): Don't test
5242         allow_multiple_definition.
5243
5244         PR 10980
5245         * options.h (class General_options): Add --cref.
5246         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5247         until after printing cref table.
5248         * cref.cc: Include "symtab.h".
5249         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5250         (Cref_table_compare::operator()): New function.
5251         (Cref_inputs::gather_cref): New function.
5252         (filecol): New static const.
5253         (Cref_inputs::print_cref): New function.
5254         (Cref::print_cref): New function.
5255         * cref.h: Include <cstdio>.
5256         (class Cref): Update declarations.
5257         * mapfile.h (Mapfile::file): New function.
5258         * object.h (class Object): Define Symbols.  Declare virtual
5259         do_get_global_symbols.
5260         (Object::get_global_symbols): New function.
5261         * object.cc (Input_objects::add_object): Pass object to cref_ if
5262         --cref.
5263         (Input_objects::archive_start): Likewise.
5264         (Input_objects::archive_stop): Likewise.
5265         (Input_objects::print_cref): New function.
5266         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5267         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5268         --cref.
5269         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5270         function.
5271         * plugin.h (class Sized_pluginobj): Update declarations.
5272
5273 2010-01-05  Ian Lance Taylor  <iant@google.com>
5274
5275         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5276         to is_default_version.  Rename insdef to insdefault.
5277         (Symbol_table::add_from_relobj): Rename def to is_default_version
5278         and local to is_forced_local.
5279         (Symbol_table::add_from_pluginobj): Likewise.
5280         (Symbol_table::add_from_dynobj): Likewise.
5281         (Symbol_table::define_special_symbol): Rename insdef to
5282         insdefault.
5283
5284 2010-01-04  Ian Lance Taylor  <iant@google.com>
5285
5286         PR 10980
5287         * options.h (class General_options): Add
5288         --allow-multiple-definition and -z muldefs.
5289         * resolve.cc (Symbol_table::should_override): Don't warn about a
5290         multiple symbol definition if --allow-multiple-definition or -z
5291         muldefs.
5292
5293         PR 10980
5294         * options.h (class General_options): Add --add-needed and
5295         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5296         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5297         error if --copy-dt-needed-entries aka --add-needed is used and
5298         would cause a change in behaviour.
5299
5300         PR 10980
5301         * options.h (class General_options): Add -G as a short version of
5302         --shared.  Add no-op options -assert, -g, and -i.
5303
5304 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5305
5306         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5307         check for .text or .gnu.linkonce.t sections.
5308         * icf.cc (Icf::find_identical_sections): Ditto.
5309         Change the detection for mangled function name within the section
5310         name.
5311         * icf.h (is_section_foldable_candidate): New function.
5312
5313 2009-12-30  Ian Lance Taylor  <iant@google.com>
5314
5315         PR 10980
5316         * options.h (class General_options): Permit two dashes with
5317         --retain-symbols-file.
5318
5319 2009-12-30  Ian Lance Taylor  <iant@google.com>
5320
5321         PR 10979
5322         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5323         don't put the file header and segment headers in the text
5324         segment.
5325
5326         PR 10979
5327         * common.cc (Sort_commons::operator()): Stabilize sort when both
5328         entries are NULL.
5329         (Symbol_table::do_allocate_commons_list): When allocating common
5330         symbols, skip a symbol which is no longer common.
5331         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5332         an object before checking its type.
5333         * testsuite/common_test_2.c: New file.
5334         * testsuite/common_test_3.c: New file.
5335         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5336         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5337         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5338         (common_test_2_pic.o, common_test_2.so): New targets.
5339         (common_test_3_pic.o, common_test_3.so): New targets.
5340         * testsuite/Makefile.in: Rebuild.
5341
5342         PR 10979
5343         * script.cc (read_input_script): If we see a new SECTIONS clause,
5344         and we have added an input section, give an error.
5345         * layout.h (class Layout): Add have_added_input_section function.
5346         Add have_added_input_section_ field.
5347         * layout.cc (Layout::Layout): Initialize
5348         have_added_input_section_.
5349         (Layout::layout): Set have_added_input_section_.
5350         (Layout::layout_eh_frame): Likewise.
5351
5352 2009-12-30  Ian Lance Taylor  <iant@google.com>
5353
5354         PR 10931
5355         * options.h (class General_options): Add --sort-common option.
5356         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5357         * common.cc (Sort_common): Add sort_order parameter to
5358         constructor.  Add sort_order_ field.
5359         (Sort_commons::operator): Check sort_order_.
5360         (Symbol_table::allocate_commons): Determine the sort order.
5361         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5362         Change all callers.
5363         (Symbol_table::do_allocate_commons_list): Likewise.
5364
5365 2009-12-30  Ian Lance Taylor  <iant@google.com>
5366
5367         PR 10916
5368         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5369         symbols from this object, don't change the visibility of an
5370         undefined symbol.
5371         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5372
5373 2009-12-30  Ian Lance Taylor  <iant@google.com>
5374
5375         PR 10861
5376         * script.h (class Version_script_info): Define Language enum.
5377         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5378         new fields globals_, locals_, and is_finalized_.
5379         * script.cc: Various formatting fixes.
5380         (class Parser_closure): Change language_stack_ from a vector of
5381         std::string to one of Version_script_info::Language.  Adjust all
5382         uses accordingly.
5383         (class Lazy_demangler): Remove.
5384         (struct Version_expression): Change language from std::string to
5385         Version_script_info::Language.
5386         (Version_script_info::Version_script_info): New function.
5387         (Version_script_info::~Version_script_info): Don't call clear.
5388         (Version_script_info::finalize): New function.
5389         (Version_script_info::build_lookup_tables): New function.
5390         (Version_script_info::build_expression_list_lookup): New
5391         function.
5392         (Version_script_info::get_symbol_version_helper): Rewrite to use
5393         lookup tables.
5394         (Version_script_info::print_expression_list): Adjust to use
5395         Version_script_info::Language.
5396         (script_push_lex_into_version_mode): Check that the version script
5397         has not been finalized.
5398         (version_script_push_lang): Change language string to
5399         Version_script_info::Language.
5400         * options.cc (Command_line::version_script): New function.
5401         * options.h (class General_options): Add finalize_dynamic_list
5402         function.  Change version_script from declaration to definition.
5403         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5404         * testsuite/version_script.map: Remove duplicate def of foo.
5405         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5406         version_script.map.
5407         * testsuite/Makefile.in: Rebuild.
5408
5409 2009-12-30  Ian Lance Taylor  <iant@google.com>
5410
5411         PR 10843
5412         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5413         if the input symbol index is 0, make the output symbol index 0.
5414
5415 2009-12-30  Ian Lance Taylor  <iant@google.com>
5416
5417         PR 10670
5418         * options.h (class General_options): Add -x/--discard-all.
5419         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5420         --discard-all.  If the local symbol needs a dynamic entry, check
5421         that before handling --discard-locals.
5422
5423 2009-12-30  Ian Lance Taylor  <iant@google.com>
5424
5425         PR 10450
5426         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5427         flags to PF_R.
5428         (Output_segment::add_output_section): Don't change the flags if
5429         the type is PT_TLS.
5430
5431         PR 10450
5432         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5433         GNU hash table if they need a dynamic value.  Otherwise, don't add
5434         them if they are defined in a dynamic object or are forced local.
5435
5436 2009-12-29  Ian Lance Taylor  <iant@google.com>
5437
5438         PR 10450
5439         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5440         .gnu.hash table for a 32-bit target.
5441
5442         PR 10450
5443         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5444         regular and a dynamic object only needs a dynamic symbol table
5445         entry if it is externally visible.
5446
5447         PR 10450
5448         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5449         constructor.  Add global_offset_table_ field.
5450         (Target_i386::got_section): Set global_offset_table_.
5451         (Target_i386::do_finalize_sections): Set global_offset_table_
5452         size.
5453         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5454         in constructor.  Add global_offset_table_ field.
5455         (Target_x86_64::got_section): Set global_offset_table_.
5456         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5457         size.
5458
5459         * layout.cc (Layout::Layout): Initialize increase_relro_.
5460         (Layout::get_output_section): Add is_relro, is_last_relro, and
5461         is_first_non_relro parameters.  Change all callers.
5462         (Layout::choose_output_section): Likewise.
5463         (Layout::add_output_section_data): Likewise.
5464         (Layout::make_output_section): Likewise.
5465         (Layout::set_segment_offsets): Clear increase_relro when using a
5466         linker script.
5467         * layout.h (class Layout): Add increase_relro method.  Add
5468         increase_relro_ field.  Update declarations.
5469         * output.cc (Output_section::Output_section): Initialize
5470         is_last_relro_ and is_first_non_relro_.
5471         (Output_segment::add_output_section): Group relro sections is
5472         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5473         (Output_segment::maximum_alignment): Remove relro handling.
5474         (Output_segment::set_section_addresses): Add increase_relro
5475         parameter.  Change all callers.  Add initial alignment to align
5476         relro sections on separate page.  Remove old relro handling.
5477         (Output_segment::set_section_list_addresses): Remove in_relro
5478         parameter.  Change all callers.
5479         (Output_segment::set_offset): Add increase parameter.  Change all
5480         callers.  Remove old relro handling.
5481         * output.h (class Output_section): Add new methods: is_last_relro,
5482         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5483         Add is_last_relro_ and is_first_non_relro_ fields.
5484         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5485         Create separate .got.plt section.  Call increase_relro.
5486         * x86_64.cc (Target_x86_64::got_section): Likewise.
5487         * testsuite/relro_script_test.t: Add .got.plt.
5488
5489         PR 10450
5490         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5491         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5492         (Layout::finalize): Call set_dynamic_symbol_size.
5493         (Layout::set_dynamic_symbol_size): New function.
5494         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5495         set_dynamic_symbol_size.
5496
5497         PR 10450
5498         * output.h (class Output_section): Add is_entsize_zero_ field.
5499         * output.cc (Output_section::Output_section): Initialize
5500         is_entsize_zero_.
5501         (Output_section::set_entsize): If two different entsizes are
5502         requested, force it to zero.
5503         (Output_section::add_input_section): Set flags for .debug_str
5504         before updating section flags.  Set entsize.
5505         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5506         and SHF_STRING if all input sections have those flags.
5507
5508 2009-12-29   Rafael Espindola  <espindola@google.com>
5509
5510         * main.cc (main): Fix the sys time reporting.
5511         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5512         reporting.
5513
5514 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5515
5516         * options.cc (General_options::parse_version): Allow -v to exit
5517         without an error if there is nothing to link.
5518
5519 2009-12-29  Ian Lance Taylor  <iant@google.com>
5520
5521         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5522         using a version of gcc before 4.1.
5523         * configure: Rebuild.
5524
5525 2009-12-28  Chris Demetriou  <cgd@google.com>
5526
5527         * attributes.cc (Output_attributes_section_data::do_write): Use
5528         std::vector::front rather than std::vector::data.
5529
5530 2009-12-28  Ian Lance Taylor  <iant@google.com>
5531
5532         * symtab.h (class Symbol_table): Add enum Defined.
5533         * resolve.cc (Symbol_table::should_override): Add defined
5534         parameter.  Change all callers.  Test whether object is NULL
5535         before calling a method on it.
5536         (Symbol_table::report_resolve_problem): Add defined parameter.
5537         Change all callers.
5538         (Symbol_table::should_override_with_special): Likewise.
5539         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5540         parameter.  Change all callers.
5541         (Symbol_table::do_define_in_output_data): Likewise.
5542         (Symbol_table::define_in_output_segment): Likewise.
5543         (Symbol_table::do_define_in_output_segment): Likewise.
5544         (Symbol_table::define_as_constant): Likewise.
5545         (Symbol_table::do_define_as_constant): Likewise.
5546         * script.h (class Symbol_assignment): Add is_defsym parameter to
5547         constructor; change all callers.
5548         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5549         parameter.  Change all callers.  Add is_defsym_ field.
5550         (class Parser_closure): Add parsing_defsym parameter to
5551         constructor; change all callers.  Add parsing_defsym accessor
5552         function.  Add parsing_defsym_ field.
5553
5554 2009-12-28  Ian Lance Taylor  <iant@google.com>
5555
5556         * gold.cc (queue_middle_tasks): Fix formatting.
5557         * object.cc (Relobj::is_section_name_included): Likewise.
5558
5559 2009-12-23  Ian Lance Taylor  <iant@google.com>
5560
5561         * i386.cc (Target_i386::do_calls_non_split): Recognize
5562         -fsplit-stack prologue for a function with a static chain.
5563         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5564         -fsplit-stack prologue when using %r11.
5565
5566 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5567
5568         * options.cc (General_options::parse_version): Make -v continue and do
5569         the link like GNU ld does.
5570
5571 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5572
5573         * Makefile.am (CCFILES): Add timer.cc.
5574         (HFILES): Add timer.h.
5575         * configure.ac: Check for sysconf and times.
5576         * main.cc: include timer.h.
5577         (main): Use Timer instead of get_run_time.
5578         * timer.cc: New.
5579         * timer.h: New.
5580         * workqueue.cc: include timer.h.
5581         (Workqueue::find_and_run_task):
5582         Report user, sys and wall time.
5583         * Makefile.in: Regenerate.
5584         * config.in: Regenerate.
5585         * configure: Regenerate.
5586
5587 2009-12-16  Doug Kwan  <dougkwan@google.com>
5588
5589         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5590         sections.
5591         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5592         relaxed input sections.
5593         * output.cc (Output_section::find_relaxed_input_section): Change
5594         return type to Output_relaxed_input_section pointer.  Adjust code
5595         for new type of relaxed_input_section_map_.
5596         * output.h (Output_section::find_relaxed_input_section): Change
5597         return type to Output_relaxed_input_section pointer.
5598         (Output_section::Output_relaxed_input_section_by_input_section_map):
5599         New type.
5600         (Output_section::relaxed_input_section_map_): Change type to
5601         Output_section::Output_relaxed_input_section_by_input_section_map.
5602         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5603         input section.
5604
5605 2009-12-15  Ian Lance Taylor  <iant@google.com>
5606
5607         * layout.cc (Layout::create_shstrtab): Only write out after input
5608         sections if we are compressing debug sections.
5609
5610 2009-12-15  Ian Lance Taylor  <iant@google.com>
5611
5612         * archive.cc (Archive::add_symbols): Only look up a symbol without
5613         a version if there is, in fact, a version.
5614
5615 2009-12-14  Ian Lance Taylor  <iant@google.com>
5616
5617         Revert -Wshadow changes, all changes from:
5618         2009-12-11  Doug Kwan  <dougkwan@google.com>
5619         2009-12-11  Nick Clifton  <nickc@redhat.com>
5620         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5621
5622 2009-12-11  Doug Kwan  <dougkwan@google.com>
5623
5624         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5625         due to -Wshadow.
5626         * attributes.cc (Object_attribute::size): Ditto.
5627         (Attributes_section_data::size): Ditto.
5628         (Attributes_section_data::Attributes_section_data): Ditto.
5629         (Output_attributes_section_data::do_write): Ditto.
5630         * attributes.h (Object_attribute::set_type): Ditto.
5631         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5632
5633 2009-12-11  Nick Clifton  <nickc@redhat.com>
5634
5635         * archive.cc: Fix shadowed variable warnings.
5636         * arm.cc: Likewise.
5637         * compressed_output.cc: Likewise.
5638         * compressed_output.h: Likewise.
5639         * configure: Likewise.
5640         * dwarf_reader.cc: Likewise.
5641         * dynobj.cc: Likewise.
5642         * dynobj.h: Likewise.
5643         * ehframe.cc: Likewise.
5644         * ehframe.h: Likewise.
5645         * errors.cc: Likewise.
5646         * expression.cc: Likewise.
5647         * fileread.cc: Likewise.
5648         * fileread.h: Likewise.
5649         * freebsd.h: Likewise.
5650         * i386.cc: Likewise.
5651         * icf.cc: Likewise.
5652         * incremental.h: Likewise.
5653         * layout.cc: Likewise.
5654         * layout.h: Likewise.
5655         * mapfile.cc: Likewise.
5656         * merge.cc: Likewise.
5657         * merge.h: Likewise.
5658         * object.cc: Likewise.
5659         * object.h: Likewise.
5660         * options.h: Likewise.
5661         * output.cc: Likewise.
5662         * output.h: Likewise.
5663         * parameters.cc: Likewise.
5664         * plugin.cc: Likewise.
5665         * powerpc.cc: Likewise.
5666         * reduced_debug_output.cc: Likewise.
5667         * reduced_debug_output.h: Likewise.
5668         * reloc.cc: Likewise.
5669         * reloc.h: Likewise.
5670         * resolve.cc: Likewise.
5671         * script-sections.cc: Likewise.
5672         * script.cc: Likewise.
5673         * script.h: Likewise.
5674         * sparc.cc: Likewise.
5675         * symtab.cc: Likewise.
5676         * symtab.h: Likewise.
5677         * target-select.cc: Likewise.
5678         * target-select.h: Likewise.
5679         * token.h: Likewise.
5680         * workqueue.cc: Likewise.
5681         * workqueue.h: Likewise.
5682         * x86_64.cc: Likewise.
5683
5684 2009-12-10  Doug Kwan  <dougkwan@google.com>
5685
5686         * arm.cc (attributes.h): New include.
5687         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5688         (Arm_relobj::~Arm_relobj): Delete object pointed by
5689         attributes_section_data_.
5690         (Arm_relobj::attributes_section_data): New method definition.
5691         (Arm_relobj::attributes_section_data_): New data member declaration.
5692         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5693         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5694         attributes_section_data_.
5695         (Arm_dynobj::attributes_section_data): New method definition.
5696         (Arm_dynobj::attributes_section_data_): New data member declaration.
5697         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5698         initialization value of may_use_blx_ to false.
5699         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5700         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5701         object attributes to compute results instead of hard-coding.
5702         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5703         Target_arm::get_secondary_compatible_arch,
5704         Target_arm::set_secondary_compatible_arch
5705         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5706         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5707         New method declarations.
5708         (Target_arm::get_aeabi_object_attribute): New method definition.
5709         (Target_arm::attributes_section_data_): New data member declaration.
5710         (read_arm_attributes_section): New template definition.
5711         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5712         (Arm_dynobj::do_read_symbols): Ditto.
5713         (Target_arm::do_finalize_sections): Merge attributes sections from
5714         input.  Check for BLX use after attributes section merging.
5715         Fix __exidx_start and __exidx_end visibility.  Create an
5716         .ARM.attributes section if necessary.
5717         (Target_arm::get_secondary_compatible_arch,
5718         Target_arm::set_secondary_compatible_arch,
5719         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5720         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5721         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5722         New method definitions.
5723
5724 2009-12-09  Ian Lance Taylor  <iant@google.com>
5725
5726         * plugin.cc (Plugin::load): Don't cast from void* to a function
5727         pointer.
5728
5729 2009-12-09  Ian Lance Taylor  <iant@google.com>
5730
5731         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5732         information fields.
5733
5734 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5735
5736         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5737         Replace two_file_shared_1.so with two_file_shared_2.so.
5738         * testsuite/Makefile.in: Regenerated.
5739
5740 2009-12-08  Doug Kwan  <dougkwan@google.com>
5741
5742         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5743         (HFILES): Add attributes.h and int_encoding.h.
5744         * Makefile.in: Regenerate.
5745         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5746         function definitions to int_encoding.cc
5747         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5748         prototypes to int_encoding.h
5749         * reduced_debug_output.cc (int_encoding.h): New include.
5750         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5751         function definitions to int_encoding.cc
5752         (insert_into_vector, read_from_pointer): Move template definitions to
5753         int_encoding.h
5754         * attributes.cc: New file.
5755         * attributes.h: New file.
5756         * int_encoding.cc: New file.
5757         * int_encoding.h: New file.
5758
5759 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5760
5761         PR gold/11055
5762         * incremental-dump.cc (dump_incremental_inputs): New.
5763         (main): Use dump_incremental_inputs.
5764
5765 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5766
5767         PR gold/10893
5768         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5769         checking elfcpp::STT_FUNC.
5770         (Target_i386::Relocate::relocate): Likewise.
5771         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5772
5773         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5774         symbols from shared libraries into normal FUNC symbols.
5775
5776         * symtab.h (Symbol): Add is_func and use it.
5777
5778 2009-12-05  Doug Kwan  <dougkwan@google.com>
5779
5780         * arm.cc (Target_arm::arm_info): Initialize new fields
5781         attributes_section and attributes_vendor.
5782         * i386.cc (Target_i386::i386_info): Same.
5783         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5784         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5785         fields attributes_section and attributes_vendor.
5786         * sparc.cc (Target_sparc::sparc_info): Same.
5787         * target.h (Target::attributes_section, Target::attributes_vendor,
5788         Target::is_attributes_section, Target::attribute_arg_type,
5789         Target::attributes_order): New method definitions.
5790         (Target::Target_info::attributes_section,
5791         Target::Target_info::attributes_vendor): New fields.
5792         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5793         virtual method definitions.
5794         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5795         attributes_section and attributes_vendor.
5796         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5797
5798 2009-12-05  Doug Kwan  <dougkwan@google.com>
5799
5800         * arm.cc: Update comments about interworking and stub generation.
5801         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5802         considered as non-PIC.
5803         (Arm_relocate_functions::base_abs): Fix formatting.
5804         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5805         of function to use GOT entry address instead of offset.
5806         (Target_arm::Scan::global): Issue an error if a symbol would need a
5807         PLT does not get one because it is untyped.  Remove code to create
5808         dynamic symbols for relative branches.
5809         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5810         takes unsigned integer instead of boolean.
5811
5812 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5813
5814         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5815         (two_file_test_LDADD): Likewise.
5816         (common_test_1_LDADD): Likewise.
5817         (exception_test_LDADD) Likewise.
5818         (weak_test_LDADD): Likewise.
5819         (many_sections_test_LDADD): Likewise.
5820         (initpri1_LDADD): Likewise.
5821         (script_test_1_LDADD): Likewise.
5822         (script_test_2_LDADD): Likewise.
5823         (justsyms_LDADD): Likewise.
5824         (binary_test_LDADD): Likewise.
5825         (large_LDADD): Likewise.
5826         * testsuite/Makefile.in: Regenerated.
5827
5828 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5829
5830         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5831         (Symbol_table::override_with_special): Likewise.
5832         (Symbol_table::add_from_object): Likewise.
5833
5834 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5835
5836         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5837         Don't set the data_offset twice.
5838
5839 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5840
5841         * testsuite/Makefile.in: Regenerate.
5842
5843 2009-12-03  Doug Kwan  <dougkwan@google.com>
5844
5845         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5846         (Target_arm::do_finalize_sections): Add parameter for symbol table
5847         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5848         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5849         parameter for symbol table pointer.
5850         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5851         an additional parameter for a pointer to symbol table.
5852         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5853         parameter for a symbol table pointer.
5854         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5855         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5856         Ditto.
5857         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5858         parameter for a symbol table pointer.
5859
5860 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5861
5862         * incremental.cc (Incremental_inputs_header)
5863         (Incremental_inputs_header_write, Incremental_inputs_entry)
5864         (Incremental_inputs_entry_write): Move ...
5865         * incremental.h (Incremental_inputs_header)
5866         (Incremental_inputs_header_write, Incremental_inputs_entry)
5867         (Incremental_inputs_entry_write): here.
5868
5869 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5870
5871         * incremental.cc (make_sized_incremental_binary): Set the target.
5872         Error if it is incompatible.
5873         * output.h (Output_file): Add filename method.
5874
5875 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5876
5877         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5878         from the get_* methods.
5879
5880 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5881
5882         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5883         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5884         Write 0 for the data_offset of scripts.
5885
5886 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5887
5888         * testsuite/Makefile.am: Add the incremental_test.sh test.
5889         * testsuite/incremental_test.sh: New.
5890         * testsuite/incremental_test_1.c: New.
5891         * testsuite/incremental_test_2.c: New.
5892
5893 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5894
5895        * incremental-dump.cc (main): Fix typos.
5896
5897 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5898
5899         PR gold/11025
5900         * incremental-dump.cc (main): Use llu to print 64 bit values.
5901
5902 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5903             H.J. Lu  <hongjiu.lu@intel.com>
5904
5905         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5906         $(LIBDL).
5907         (incremental_dump_LDADD): Likewise.
5908         * Makefile.in: Regenerated.
5909
5910 2009-11-25  Doug Kwan  <dougkwan@google.com>
5911
5912         Revert:
5913
5914         2009-11-25  Doug Kwan  <dougkwan@google.com>
5915
5916                 * arm.cc (Target_arm::Target_arm): Move method definition
5917                 outside of class definition.  Add code to handle
5918                 --target1-rel, --target1-abs and --target2= options.
5919                 (Target_arm::get_reloc_reloc_type): Change method to be
5920                 non-static and const.
5921                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5922                 New data member declaration.
5923                 (Target_arm::Scan::local, Target_arm::Scan::global,
5924                 Target_arm::Relocate::relocate,
5925                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5926                 Adjust call to Target_arm::get_real_reloc_type.
5927                 (Target_arm::get_real_reloc_type): Use command line options
5928                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5929                 * options.h (--target1-rel, --target1-abs, --target2): New
5930                 ARM-only options.
5931
5932 2009-11-25  Doug Kwan  <dougkwan@google.com>
5933
5934         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5935         class definition.  Add code to handle --target1-rel, --target1-abs
5936         and --target2= options.
5937         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5938         and const.
5939         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5940         member declaration.
5941         (Target_arm::Scan::local, Target_arm::Scan::global,
5942         Target_arm::Relocate::relocate,
5943         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5944         call to Target_arm::get_real_reloc_type.
5945         (Target_arm::get_real_reloc_type): Use command line options to
5946         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5947         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5948         options.
5949
5950 2009-11-25  Doug Kwan  <dougkwan@google.com>
5951
5952         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5953         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5954         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5955         formatting.
5956         (Arm_relocate_functions::thm_call): Replace body with a call to
5957         Arm_relocate_functions::thumb_branch_common.
5958         (Arm_relocate_functions::thm_jump24,
5959         Arm_relocate_functions::thm_xpc22): New method definitions.
5960         (Arm_relocate_functions::thumb_branch_common): New method definition.
5961         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5962         operator.
5963         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5964         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5965
5966 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5967
5968         * Makefile.am: Build incremental-dump
5969         * Makefile.in: Regenerate.
5970         * incremental-dump.cc: New.
5971         * incremental.cc (Incremental_inputs_header_data,
5972         Incremental_inputs_entry_data): Move to incremental.h
5973         * incremental.h: (Incremental_inputs_header_data,
5974         Incremental_inputs_entry_data): Move from incremental.cc
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): Add a typedef with the data type.
5981
5982 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5983
5984         * incremental.cc (Incremental_inputs_header,
5985         Incremental_inputs_header_write, Incremental_inputs_entry,
5986         Incremental_inputs_entry_write): Update comment about which
5987         type has the filed descriptions.
5988
5989 2009-11-15  Doug Kwan  <dougkwan@google.com>
5990
5991         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5992         (Arm_relocate_functions::arm_branch_common): Change method defintion
5993         in class definition to a method declaration and update list of formal
5994         parameters.
5995         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5996         Arm_relocation_functions::jump24): Adjust call to
5997         Arm_relocate_functions::arm_branch_common.  Update list of formal
5998         parameters.
5999         (Arm_relocate_functions::xpc25): New method definition.
6000         (Arm_relocate_functions::arm_branch_common): Move method defintion
6001         out from class definition.  Use stubs for mode-switching and extending
6002         branch ranges.
6003         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6004         specially.  Change code to enable use of stubs in ARM branches.
6005
6006 2009-11-10  Doug Kwan  <dougkwan@google.com>
6007
6008         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6009         in method declaration.
6010         (Target_arm::relocate_stub): New method declaration.
6011         (Target_arm::default_target): Change to return a pointer instead of
6012         a const reference.
6013         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6014         Target_arm::default_target.
6015         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6016         method definition.
6017         (Target_arm::relocate_section): Adjust view.
6018         (Target_arm::relocate_stub): New method definition.
6019
6020 2009-11-10  Doug Kwan  <dougkwan@google.com>
6021
6022         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6023         a format warning.
6024         * incremental.cc (open_incremental_binary): Initialized local
6025         variables to avoid warnings.
6026         * object.cc (make_elf_object): Ditto.
6027         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6028         a format warning.
6029
6030 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6031
6032         PR gold/10930
6033         * testsuite/plugin_test.c: Include "config.h".
6034
6035 2009-11-09  Doug Kwan  <dougkwan@google.com>
6036
6037         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6038         (arm_symbol_value): Remove.
6039         (Arm_relocate_functions::arm_branch_common,
6040         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6041         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6042         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6043         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6044         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6045         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6046         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6047         Arm_relocate_functions::thm_mobw_abs_nc,
6048         Arm_relocate_functions::thm_mov_abs,
6049         Arm_relocate_functions::movw_prel_nc,
6050         Arm_relocate_functions::thm_movt_abs,
6051         Arm_relocate_functions::movt_prel,
6052         Arm_relocate_functions::thm_movw_prel_nc,
6053         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6054         (Target_arm::Relocate::relocate): Only decompose address into two
6055         parts if relocation type uses the thumb-bit and pass the actual
6056         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6057         calls to methods in Arm_relocate_functions for this change.
6058
6059 2009-11-08  Ian Lance Taylor  <iant@google.com>
6060
6061         PR 10925
6062         * reloc.cc: Instantiate
6063         Sized_relobj::initialize_input_to_output_maps and
6064         Sized_relobj:free_input_to_output_maps.
6065
6066 2009-11-06  Ian Lance Taylor  <iant@google.com>
6067
6068         PR 10876
6069         * defstd.cc (in_segment): Set only_if_ref true for "end".
6070
6071 2009-11-06  Doug Kwan  <dougkwan@google.com>
6072
6073         * arm.cc (class Reloc_stub): Correct a comment.
6074         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6075         (Target_arm::scan_section_for_stubs): New method declaration.
6076         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6077         Change methods from private to protected.
6078         (Target_arm::do_may_relax): New method definition.
6079         (Target_arm::do_relax, Target_arm::group_sections,
6080         Target_arm::scan_reloc_for_stub,
6081         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6082         (Target_arm::arm_input_section_map_): New data member declaration.
6083         (Target_arm::scan_reloc_for_stub,
6084         Target_arm::scan_reloc_section_for_stubs,
6085         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6086         Target_arm::do_relax): New method definitions.
6087
6088 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6089
6090         * configure.ac: Check for (struct stat)::st_mtim
6091         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6092         * config.in: Regenerate.
6093         * configure: Regenerate.
6094
6095 2009-11-05  Ian Lance Taylor  <iant@google.com>
6096
6097         PR 10910
6098         * output.cc (Output_segment::add_output_section): Add missing
6099         return statement.
6100
6101 2009-11-04  Ian Lance Taylor  <iant@google.com>
6102
6103         PR 10880
6104         * object.h (class Object): Add is_needed and set_is_needed
6105         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6106         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6107         defined in a dynamic object and referenced by a regular object,
6108         set is_needed for the dynamic object.
6109         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6110         if the file is marked with as_needed and it is not needed.
6111
6112 2009-11-04  Ian Lance Taylor  <iant@google.com>
6113
6114         PR 10887
6115         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6116         tags if data is discarded by linker script.
6117         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6118         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6119         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6120         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6121
6122 2009-11-04  Ian Lance Taylor  <iant@google.com>
6123
6124         * layout.cc (Layout::get_output_section): Add is_interp and
6125         is_dynamic_linker_section parameters.  Change all callers.
6126         (Layout::choose_output_section): Likewise.
6127         (Layout::make_output_section): Likewise.
6128         (Layout::add_output_section_data): Add is_dynamic_linker_section
6129         parameter.  Change all callers.
6130         * layout.h (class Layout): Update declarations.
6131         * output.h (class Output_section): Add is_interp, set_is_interp,
6132         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6133         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6134         generate_code_fills_at_write_ to a bitfield.
6135         * output.cc (Output_section::Output_sections): Initialize new
6136         fields.
6137         (Output_segment::add_output_section): Add do_sort parameter.
6138         Change all callers.
6139
6140 2009-11-03  Ian Lance Taylor  <iant@google.com>
6141
6142         PR 10860
6143         * options.h (class General_options): Add --warn-common.
6144         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6145         merging two common symbols.
6146         (Symbol_table::should_override): Handle --warn-common when merging
6147         a common symbol with a defined symbol.  Use report_resolve_problem
6148         for multiple definitions.
6149         (Symbol_table::report_resolve_problem): New function.
6150         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6151
6152 2009-11-03  Doug Kwan  <dougkwan@google.com>
6153
6154         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6155         stub_factory_.
6156         (Target_arm::stub_factory): New method definition.
6157         (Target_arm::new_arm_input_section,
6158         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6159         Target_arm::reloc_uses_thumb_bit): New method declarations.
6160         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6161         New type definitions.
6162         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6163         member declarations.
6164         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6165         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6166         New method definitions.
6167
6168 2009-11-03  Ian Lance Taylor  <iant@google.com>
6169
6170         * options.h (class General_options): Add --warn_constructors.
6171
6172 2009-11-03  Ian Lance Taylor  <iant@google.com>
6173
6174         PR 10893
6175         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6176         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6177
6178 2009-11-03  Ian Lance Taylor  <iant@google.com>
6179
6180         PR 10895
6181         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6182         --msgid-bugs-address.
6183         (install-pdf): New target.
6184         (install-data_yes): Look up one directory to find mkinstalldirs.
6185
6186 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6187
6188         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6189         tree.
6190
6191 2009-10-30  Doug Kwan  <dougkwan@google.com>
6192
6193         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6194
6195 2009-10-30  Doug Kwan  <dougkwan@google.com>
6196
6197         * arm.cc (Stub_addend_reader): New struct template definition
6198         and partial specializations.
6199         (Stub_addend_reader::operator()): New method definition for a
6200         partially specialized template.
6201
6202 2009-10-30  Doug Kwan  <dougkwan@google.com>
6203
6204         * arm.cc (Arm_relobj::processor_specific_flags): New method
6205         definition.
6206         (Arm_relobj::do_read_symbols): New method declaration.
6207         (Arm_relobj::processor_specific_flags_): New data member declaration.
6208         (Arm_dynobj): New class definition.
6209         (Target_arm::do_finalize_sections): Add input_objects parameter.
6210         (Target_arm::do_adjust_elf_header): New method declaration.
6211         (Target_arm::are_eabi_versions_compatible,
6212         (Target_arm::merge_processor_specific_flags): New method declaration.
6213         (Target_arm::do_make_elf_object): New overloaded method definitions
6214         and declaration.
6215         (Arm_relobj::do_read_symbols): New method definition.
6216         (Arm_dynobj::do_read_symbols): Ditto.
6217         (Target_arm::do_finalize_sections): Add input_objects parameters.
6218         Merge processor-specific flags from all input objects.
6219         (Target_arm::are_eabi_versions_compatible,
6220         Target_arm::merge_processor_specific_flags,
6221         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6222         New method definitions.
6223         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6224         Input_objects pointer type parameter.
6225         * layout.cc (Layout::finalize): Pass input objects to target's.
6226         finalize_sections function.
6227         * output.cc (Output_file_header::do_sized_write): Set ELF file
6228         header's processor-specific flags.
6229         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6230         Input_objects pointer type parameter.
6231         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6232         * target.h (Input_objects): New forward class declaration.
6233         (Target::processor_specific_flags,
6234         Target::are_processor_specific_flags_sect): New method definitions.
6235         (Target::finalize_sections): Add input_objects parameter.
6236         (Target::Target): Initialize processor_specific_flags_ and
6237         are_processor_specific_flags_set_.
6238         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6239         parameter.
6240         (Target::set_processor_specific_flags): New method definition.
6241         (Target::processor_specific_flags_,
6242         Target::are_processor_specific_flags_set_): New data member
6243         declarations.
6244         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6245         Input_objects pointer type parameter.
6246
6247 2009-10-30  Doug Kwan  <dougkwan@google.com>
6248
6249         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6250
6251 2009-10-28  Ian Lance Taylor  <iant@google.com>
6252
6253         * object.h (class Relobj): Drop options parameter from
6254         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6255         do_scan_relocs, do_relocate.  Change all callers.
6256         (class Sized_relobj): Drop options parameters from
6257         do_gc_process_relocs, do_scan_relocs, do_relocate,
6258         do_relocate_sections, relocate_sections, emit_relocs_scan,
6259         emit_relocs_scan_reltype.  Change all callers.
6260         (struct Relocate_info): Remove options field and all references to
6261         it.
6262         * reloc.h (class Read_relocs): Remove options constructor
6263         parameter and options_ field.  Change all callers.
6264         (class Gc_process_relocs, class Scan_relocs): Likewise.
6265         (class Relocate_task): Likewise.
6266         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6267         all callers.
6268         (scan_relocatable_relocs): Likewise.
6269         * target.h (class Sized_target): Remove options parameter from
6270         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6271         all callers.
6272         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6273         callers.
6274         * arm.cc: Update functions to remove options parameters.
6275         * i386.cc: Likewise.
6276         * powerpc.cc: Likewise.
6277         * sparc.cc: Likewise.
6278         * x86_64.cc: Likewise.
6279         * testsuite/testfile.cc: Likewise.
6280
6281 2009-10-28  Doug Kwan  <dougkwan@google.com>
6282
6283         * arm.cc (Arm_relobj): New class definition.
6284         (Arm_relobj::scan_sections_for_stubs,
6285         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6286         New method definitions.
6287
6288 2009-10-28  Cary Coutant  <ccoutant@google.com>
6289
6290         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6291         (Plugin::cleanup_done_): New member.
6292         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6293         (Plugin_manager::cleanup_done_): Remove.
6294         (Plugin_manager::add_input_file): Edit error message.
6295         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6296         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6297
6298 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6299
6300         * fileread.cc: (File_read::View::~View): Use the new
6301         data_ownership_ filed.
6302         (File_read::~File_read): Dispose the new whole_file_view_.
6303         (File_read::open): Mmap the whole file if needed.
6304         (File_read::open): Use whole_file_view_ instead of contents_.
6305         (File_read::find_view): Use whole_file_view_ if applicable.
6306         (File_read::do_read): Use whole_file_view_ instead of contents_.
6307         (File_read::make_view): Use whole_file_view_ instead of contents_,
6308         update File_read::View::View call.
6309         (File_read::find_or_make_view): Update File_read::View::View
6310         call.
6311         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6312         remove contents_
6313         (File_read::View::Data_ownership): New enum.
6314         (File_read::View::View): Replace bool mapped_ with Data_ownership
6315         argument.
6316         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6317         (File_read::View::data_ownership_): New field.
6318         (File_read::contents_): Remove (replaced by whole_file_view_).
6319         (File_read::whole_file_view_): New field.
6320         * options.h (class General_options): Add --keep-files-mapped.
6321
6322 2009-10-27  Cary Coutant  <ccoutant@google.com>
6323
6324         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6325         * testsuite/Makefile.am (plugin_test_5): New test case.
6326         * testsuite/Makefile.in: Regenerate.
6327
6328 2009-10-25  Doug Kwan  <dougkwan@google.com>
6329
6330         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6331         from private to protected to allow access by child class.
6332         (Sized_relobj::do_relocate_sections): New method declaration.
6333         (Sized_relobj::relocate_sections): Virtualize.
6334         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6335         Sized_relobj::relocate_sections.  Instantiate template explicitly
6336         for different target sizes and endianity.
6337
6338 2009-10-24  Doug Kwan  <dougkwan@google.com>
6339
6340         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6341         (Arm_input_section::as_arm_input_section): New method.
6342         (Arm_output_section): New class definition.
6343         (Arm_output_section::create_stub_group,
6344         Arm_output_section::group_sections): New method definitions.
6345
6346 2009-10-22  Doug Kwan  <dougkwan@google.com>
6347
6348         * arm.cc (Arm_input_section): New class definition.
6349         (Arm_input_section::init, Arm_input_section:do_write,
6350         Arm_input_section::set_final_data_size,
6351         Arm_input_section::do_reset_address_and_file_offset): New method
6352         definitions.
6353
6354 2009-10-21  Doug Kwan  <dougkwan@google.com>
6355
6356         * arm.cc (Stub_table, Arm_input_section): New forward class
6357         declarations.
6358         (Stub_table): New class defintion.
6359         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6360         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6361         New method definition.
6362
6363 2009-10-21  Doug Kwan  <dougkwan@google.com>
6364
6365         * arm.cc: Update copyright comments.
6366         (Target_arm): New forward class template declaration.
6367         (Arm_address): New type.
6368         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6369         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6370         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6371         constants.
6372         (Insn_template): Same.
6373         (DEF_STUBS): New macro.
6374         (Stub_type): New enum type.
6375         (Stub_template): New class definition.
6376         (Stub): Same.
6377         (Reloc_stub): Same.
6378         (Stub_factory): Same.
6379         (Target_arm::Target_arm): Initialize may_use_blx_ and
6380         should_force_pic_veneer_.
6381         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6382         Target_arm::should_force_pic_veneer,
6383         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6384         Target_arm::using_thumb_only, Target_arm:;default_target): New
6385         method defintions.
6386         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6387         New data member declarations.
6388         (Insn_template::size, Insn_template::alignment): New method defintions.
6389         (Stub_template::Stub_template): New method definition.
6390         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6391         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6392         (Stub_factory::Stub_factory): New method definition.
6393         * gold.h (string_hash): New template.
6394         * output.h (Input_section_specifier::hash_value): Use
6395         gold::string_hash.
6396         (Input_section_specifier::string_hash): Remove.
6397         * stringpool.cc (Stringpool_template::string_hash): Use
6398         gold::string_hash.
6399
6400 2009-10-20  Doug Kwan  <dougkwan@google.com>
6401
6402         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6403         symbols of relaxed input sections.
6404         * output.h (Output_section::find_relaxed_input_section): Make
6405         method public.
6406
6407 2009-10-16  Doug Kwan  <dougkwan@google.com>
6408
6409         * dynobj.cc (Versions::Versions): Initialize version_script_.
6410         Only insert base version symbol definition for a shared object
6411         if version script defines any version versions.
6412         (Versions::define_base_version): New method definition.
6413         (Versions::add_def): Check that base version is not needed.
6414         (Versions::add_need): Define base version lazily.
6415         * dynobj.h (Versions::define_base_version): New method declaration.
6416         (Versions::needs_base_version_): New data member declaration.
6417         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6418         (check_DATA): Add no_version_test.stdout.
6419         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6420         New make rules.
6421         * testsuite/Makefile.in: Regenerate.
6422         * testsuite/no_version_test.c: New file.
6423         * testsuite/no_version_test.sh: Ditto.
6424
6425 2009-10-16  Doug Kwan  <dougkwan@google.com>
6426
6427         * expression.cc (class Segment_start_expression): New class definition.
6428         (Segment_start_expression::value): New method definition.
6429         (script_exp_function_segment_start): Return a new
6430         Segment_start_expression.
6431         * gold/script-c.h (script_saw_segment_start_expression): New function
6432         prototype.
6433         * script-sections.cc (Script_sections::Script_sections): Initialize
6434         SAW_SEGMENT_START_EXPRESSION_ to false.
6435         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6436         and -Tbbs options to specify section addresses if given in
6437         command line and no SEGMENT_START expression is seen in a script.
6438         * script-sections.h (Script_sections::saw_segment_start_expression,
6439         Script_sections::set_saw_segment_start_expression): New method
6440         definition.
6441         (Script_sections::saw_segment_start_expression_): New data member
6442         declaration.
6443         * script.cc (script_saw_segment_start_expression): New function.
6444         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6445         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6446         script_test_7.sh and script_test_8.sh.
6447         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6448         script_test_8.stdout.
6449         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6450         (script_test_6, script_test_6.stdout, script_test_7,
6451         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6452         * Makefile.in: Regenerate.
6453         * testsuite/script_test_6.sh: New file.
6454         * testsuite/script_test_6.t: Same.
6455         * testsuite/script_test_7.sh: Same.
6456         * testsuite/script_test_7.t: Same.
6457         * testsuite/script_test_8.sh: Same.
6458
6459 2009-10-16  Doug Kwan  <dougkwan@google.com>
6460
6461         * output.cc (Output_segment::set_section_list_address): Cast
6462         expressions to unsigned long long type to avoid format warnings.
6463
6464 2009-10-15  Ian Lance Taylor  <iant@google.com>
6465
6466         * script.cc (Script_options::add_symbol_assignment): Always add a
6467         dot assignment to script_sections_.
6468         * script-sections.cc (Script_sections::add_dot_assignment):
6469         Initialize if necessary.
6470
6471         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6472         program headers with no load segment if there is a linker script.
6473
6474         * layout.cc (Layout::set_segment_offsets): Align the file offset
6475         to the segment aligment for -N or -n with no load segment.
6476         * output.cc (Output_segment::add_output_section): Don't crash if
6477         the first section is a TLS section.
6478         (Output_segment::set_section_list_addresses): Print an error
6479         message if the address moves backward in a linker script.
6480         * script-sections.cc
6481         (Output_section_element_input::set_section_addresses): Don't
6482         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6483         (Orphan_output_section::set_section_addresses): Likewise.
6484
6485 2009-10-15  Doug Kwan  <dougkwan@google.com>
6486
6487         * layout.cc (Layout::finish_dynamic_section): Generate tags
6488         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6489         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6490         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6491
6492 2009-10-14  Ian Lance Taylor  <iant@google.com>
6493
6494         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6495         fields.
6496         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6497         data_shdr fields of relinfo.
6498         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6499         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6500         R_386_TLS_LDO_32, adjust based on section flags.
6501         (Target_i386::Relocate::fix_up_ldo): Remove.
6502
6503 2009-10-13  Ian Lance Taylor  <iant@google.com>
6504
6505         Add support for -pie.
6506         * options.h (class General_options): Add -pie and
6507         --pic-executable.
6508         (General_options::output_is_position_independent): Test -pie.
6509         (General_options::output_is_executable): Return true if not shared
6510         and not relocatable.
6511         (General_options::output_is_pie): Remove.
6512         * options.cc (General_options::finalize): Reject incompatible uses
6513         of -pie.
6514         * gold.cc (queue_middle_tasks): A -pie link is not static.
6515         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6516         * symtab.cc (Symbol::final_value_is_known): Return false if
6517         output_is_position_independent.
6518         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6519         output_is_position_independent.
6520         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6521         output_is_position_independent.
6522         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6523         output_is_position_independent.
6524         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6525         two_file_pie_test.
6526         (basic_pie_test.o, basic_pie_test): New targets.
6527         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6528         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6529         (two_file_pie_test): New target.
6530         * testsuite/Makefile.in: Rebuild.
6531         * README: Remove note saying that -pie is not supported.
6532
6533 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6534
6535         * options.h (class General_options): Add -init and -fini.
6536         * layout.cc (Layout::finish_dynamic_section): Emit
6537         given init and fini functions.
6538
6539 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6540
6541         * gc.h (gc_process_relocs): Check if icf is enabled using new
6542         function.
6543         * gold.cc (queue_initial_tasks): Likewise.
6544         (queue_middle_tasks): Likewise.
6545         * object.cc (do_layout): Likewise.
6546         * symtab.cc (is_section_folded): Likewise.
6547         * main.cc (main): Likewise.
6548         * reloc.cc (Read_relocs::run): Likewise.
6549         (Sized_relobj::do_scan_relocs): Likewise.
6550         * icf.cc (is_function_ctor_or_dtor): New function.
6551         (Icf::find_identical_sections): Check if function is ctor or dtor when
6552         safe icf is chosen.
6553         * options.h (General_options::icf): Change option to be an enum.
6554         (Icf_status): New enum.
6555         (icf_enabled): New method.
6556         (icf_safe_folding): New method.
6557         (set_icf_status): New method.
6558         (icf_status_): New variable.
6559         * (options.cc) (General_options::finalize): Set icf_status_.
6560         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6561         icf_test and icf_keep_unique_test to use the --icf enum flag.
6562         * testsuite/icf_safe_test.sh: New file.
6563         * testsuite/icf_safe_test.cc: New file.
6564
6565 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6566
6567         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6568         includes to gc.h and icf.h.
6569         * arm.cc: Include gc.h.
6570         * gold.cc: Likewise.
6571         * i386.cc: Likewise.
6572         * powerpc.cc: Likewise.
6573         * sparc.cc: Likewise.
6574         * x86_64.cc: Likewise.
6575         * gc.h: Include icf.h.
6576
6577 2009-10-11  Ian Lance Taylor  <iant@google.com>
6578
6579         * plugin.cc: Include "gold.h" before other header files.
6580
6581 2009-10-10  Chris Demetriou  <cgd@google.com>
6582
6583         * options.h (Input_file_argument::Input_file_type): New enum.
6584         (Input_file_argument::is_lib_): Replace with...
6585         (Input_file_argument::type_): New member.
6586         (Input_file_argument::Input_file_argument): Take Input_file_type
6587         'type' rather than boolean 'is_lib' as second argument.
6588         (Input_file_argument::is_lib): Use type_.
6589         (Input_file_argument::is_searched_file): New function.
6590         (Input_file_argument::may_need_search): Handle is_searched_file.
6591         * options.cc (General_options::parse_library): Support -l:filename.
6592         (General_options::parse_just_symbols): Update for Input_file_argument
6593         changes.
6594         (Command_line::process): Likewise.
6595         * archive.cc (Archive::get_file_and_offset): Likewise.
6596         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6597         * script.cc (read_script_file, script_add_file): Likewise.
6598         * fileread.cc (Input_file::Input_file): Likewise.
6599         (Input_file::will_search_for): Handle is_searched_file.
6600         (Input_file::open): Likewise.
6601         * readsyms.cc (Read_symbols::get_name): Likewise.
6602         * testsuite/Makefile.am (searched_file_test): New test.
6603         * testsuite/Makefile.in: Regenerate.
6604         * testsuite/searched_file_test.cc: New file.
6605         * testsuite/searched_file_test_lib.cc: New file.
6606
6607 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6608             Ian Lance Taylor  <iant@google.com>
6609
6610         * descriptor.cc: Include <cstdio> and "binary-io.h".
6611         (Descriptors::open): Open the files in binary mode always.
6612         * script.cc (Lex::get_token): Treat \r as whitespace.
6613
6614 2009-10-09  Ian Lance Taylor  <iant@google.com>
6615
6616         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6617
6618 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6619             Ian Lance Taylor  <iant@google.com>
6620
6621         * configure.ac: Check for readv function also.
6622         * fileread.cc (readv): Define if not HAVE_READV.
6623         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6624         does not exist.
6625         * config.in: Regenerate.
6626         * configure: Regenerate.
6627
6628 2009-10-09  Doug Kwan  <dougkwan@google.com>
6629
6630         * layout.cc (Layout::make_output_section): Call target hook to make
6631         ordinary output section.
6632         (Layout::finalize): Adjust parameter list of call the
6633         Target::may_relax().
6634         * layout.h (class Layout::section_list): New method.
6635         * merge.h (Output_merge_base::entsize): Change visibility to public.
6636         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6637         New methods.
6638         (Output_merge_string::do_is_string): New method.
6639         * object.cc (Sized_relobj::do_setup): renamed from
6640         Sized_relobj::set_up.
6641         * object.h (Sized_relobj::adjust_shndx,
6642         Sized_relobj::initializ_input_to_output_maps,
6643         Sized_relobj::free_input_to_output_maps): Change visibilities to
6644         protected.
6645         (Sized_relobj::setup): Virtualize.
6646         (Sized_relobj::do_setup): New method declaration.
6647         (Sized_relobj::invalidate_section_offset,
6648         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6649         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6650         * options.cc (parse_int): New function.
6651         * options.h (parse_int): New declaration.
6652         (DEFINE_int): New macro.
6653         (stub_group_size): New option.
6654         * output.cc (Output_section::Output_section): Initialize memebers
6655         merge_section_map_, merge_section_by_properties_map_,
6656         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6657         (Output_section::add_input_section): Handled deferred code-fill
6658         generation and remove an old comment.
6659         (Output_section::add_relaxed_input_section): New method definition.
6660         (Output_section::add_merge_input_section): Use merge section by
6661         properties map to speed to search.  Update merge section maps
6662         as appropriate.
6663         (Output_section::build_relaxation_map): New method definition.
6664         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6665         Same.
6666         (Output_section::relax_input_section): Renamed to
6667         Output_section::convert_input_sections_to_relaxed_sections and change
6668         interface to take a vector of pointers to relaxed sections.
6669         (Output_section::find_merge_section,
6670         Output_section::find_relaxed_input_section): New method definitions.
6671         (Output_section::is_input_address_mapped,
6672         Output_section::output_offset, Output_section::output_address):
6673         Use output section data maps to speed up searching.
6674         (Output_section::find_starting_output_address): Add comments.
6675         (Output_section::do_write,
6676         Output_section::write_to_postprocessing_buffer): Do code-fill
6677         generation as appropriate.
6678         (Output_section::get_input_sections): Invalidate relaxed input section
6679         map.
6680         (Output_section::restore_states): Adjust type of checkpoint .
6681         Invalidate relaxed input section map.
6682         * output.h (Output_merge_base): New class declaration.
6683         (Input_section_specifier): New class defintion.
6684         (class Output_relaxed_input_section) Change base class to
6685         Output_section_data_build.
6686         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6687         base class initializer.
6688         (Output_section::add_relaxed_input_section): New method declaration.
6689         (Output_section::Input_section): Change visibility to protected.
6690         (Output_section::Input_section::relobj,
6691         Output_section::Input_section::shndx): Handle relaxed input sections.
6692         Output_section::input_sections) Change visibility to protected.  Also
6693         define overload to return a non-const pointer.
6694         (Output_section::Merge_section_properties): New class defintion.
6695         (Output_section::Merge_section_by_properties_map,
6696         Output_section::Output_section_data_by_input_section_map,
6697         Output_section::Relaxation_map): New types.
6698         (Output_section::relax_input_section): Rename method to
6699         Output_section::convert_input_sections_to_relaxed_sections and change
6700         interface to take a vector of relaxed section pointers.
6701         (Output_section::find_merge_section,
6702         Output_section::find_relaxed_input_section,
6703         Output_section::build_relaxation_map,
6704         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6705         New method declarations.
6706         (Output_section::merge_section_map_
6707         Output_section::merge_section_by_properties_map_,
6708         Output_section::relaxed_input_section_map_,
6709         Output_section::is_relaxed_input_section_map_valid_,
6710         Output_section::generate_code_fills_at_write_): New data members.
6711         * script-sections.cc
6712         (Output_section_element_input::set_section_addresses): Call
6713         current_data_size and addralign methods of relaxed input sections.
6714         (Orphan_output_section::set_section_addresses): Call current_data_size
6715         and addralign methods of relaxed input sections.
6716         * symtab.cc (Symbol_table::compute_final_value): Extract template
6717         from the body of Symbol_table::sized_finalize_symbol.
6718         (Symbol_table::sized_finalized_symbol): Call
6719         Symbol_table::compute_final_value.
6720         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6721         (Symbol_table::compute_final_value): New templated method declaration.
6722         * target.cc (Target::do_make_output_section): New method defintion.
6723         * target.h (Target::make_output_section): New method declaration.
6724         (Target::relax): Add more parameters for input objects, symbol table
6725         and layout.  Adjust call to do_relax.
6726         (Target::do_make_output_section): New method declaration.
6727         (Target::do_relax): Add parameters for input objects, symbol table
6728         and layout.
6729
6730 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6731
6732         * pread.c: Include stdio.h.
6733
6734 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6735
6736         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6737         defined.
6738
6739 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6740
6741         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6742         Change read_shndx type to unsigned int.
6743         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6744         int.
6745         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6746         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6747         Change read_shndx type to unsigned int.
6748         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6749         int.
6750         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6751         * layout.cc (Layout::create_symtab_sections): Cast the result of
6752         local_symcount * symsize to off_t in the gold_assert.
6753
6754 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6755
6756         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6757         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6758         R_ARM_BASE_ABS.
6759         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6760         (Arm_relocate_functions::thm_abs5): New function.
6761         (Arm_relocate_functions::abs12): New function.
6762         (Arm_relocate_functions::abs16): New function.
6763         (Arm_relocate_functions::base_abs): New function.
6764         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6765         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6766         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6767         R_ARM_BASE_ABS.
6768         (Scan::global): Likewise.
6769         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6770         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6771         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6772         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6773         R_ARM_BASE_ABS.
6774
6775 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6776
6777         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6778         (Arm_relocate_functions::movt_prel): New function.
6779         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6780         (Arm_relocate_functions::thm_movt_prel): New function.
6781         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6782         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6783         (Scan::global, Relocate::relocate): Likewise.
6784         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6785
6786 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6787
6788         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6789         Incremental_checker.
6790         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6791         unsigned int.
6792         (class Incremental_inputs_header): New class.
6793         (Incremental_inputs_header_writer): Edit comment.
6794         (Incremental_inputs_entry): New class.
6795         (Incremental_inputs_entry_writer): Edit comment.
6796         (Sized_incremental_binary::do_find_incremental_inputs_section):
6797         Add *strtab_shndx parameter, fill it.
6798         (Sized_incremental_binary::do_check_inputs): New method.
6799         (Incremental_checker::can_incrementally_link_output_file): Use
6800         Sized_incremental_binary::check_inputs.
6801         (Incremental_inputs::report_command_line): Save command line in
6802         command_line_.
6803         * incremental.h:
6804         (Incremental_binary::find_incremental_inputs_section): New
6805         method.
6806         (Incremental_binary::do_find_incremental_inputs_section): Add
6807         strtab_shndx parameter.
6808         (Incremental_binary::do_check_inputs): New pure virtual method.
6809         (Sized_incremental_binary::do_check_inputs): Declare.
6810         (Incremental_checker::Incremental_checker): Add incremental_inputs
6811         parameter, use it to initialize incremental_inputs_.
6812         (Incremental_checker::incremental_inputs_): New field.
6813         (Incremental_checker::command_line): New method.
6814         (Incremental_checker::inputs): New method.
6815         (Incremental_checker::command_line_): New field.
6816
6817 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6818
6819         * incremental.cc: Include <cstdarg> and "target-select.h".
6820         (vexplain_no_incremental): New function.
6821         (explain_no_incremental): New function.
6822         (Incremental_binary::error): New method.
6823         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6824         method.
6825         (make_sized_incremental_binary): New function.
6826         (open_incremental_binary): New function.
6827         (can_incrementally_link_file): Add checks if output is ELF and has
6828         inputs section.
6829         * incremental.h: Include "elfcpp_file.h" and "output.h".
6830         (Incremental_binary): New class.
6831         (Sized_incremental_binary): New class.
6832         (open_incremental_binary): Declare.
6833         * object.cc (is_elf_object): Use
6834         elfcpp::Elf_recognizer::is_elf_file.
6835         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6836         * output.h (Output_file::filesize): New method.
6837
6838 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6839
6840         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6841         New function.
6842         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6843         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6844         function.
6845         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6846         function.
6847         (Arm_relocate_functions::movw_abs_nc): New function.
6848         (Arm_relocate_functions::movt_abs): New function.
6849         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6850         (Arm_relocate_functions::thm_movt_abs): New function.
6851         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6852         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6853         (Scan::global): Likewise.
6854         (Relocate::relocate): Likewise.
6855         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6856
6857 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6858
6859         * arm.cc (Arm_relocate_functions::got_prel) New function.
6860         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6861         (Relocate::relocate): Likewise.
6862         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6863
6864 2009-10-06  Ian Lance Taylor  <iant@google.com>
6865
6866         * options.h (class General_options): Define
6867         split_stack_adjust_size parameter.
6868         * object.h (class Object): Add uses_split_stack_ and
6869         has_no_split_stack_ fields.  Add uses_split_stack and
6870         has_no_split_stack accessor functions.  Declare
6871         handle_split_stack_section.
6872         (class Reloc_symbol_changes): Define.
6873         (class Sized_relobj): Define Function_offsets.  Declare
6874         split_stack_adjust, split_stack_adjust_reltype, and
6875         find_functions.
6876         * object.cc (Object::handle_split_stack_section): New function.
6877         (Sized_relobj::do_layout): Call handle_split_stack_section.
6878         * dynobj.cc (Sized_dynobj::do_layout): Call
6879         handle_split_stack_section.
6880         * reloc.cc (Sized_relobj::relocate_sections): Call
6881         split_stack_adjust for executable sections in split_stack
6882         objects.  Pass reloc_map to relocate_section.
6883         (Sized_relobj::split_stack_adjust): New function.
6884         (Sized_relobj::split_stack_adjust_reltype): New function.
6885         (Sized_relobj::find_functions): New function.
6886         * target-reloc.h: Include "object.h".
6887         (relocate_section): Add reloc_symbol_changes parameter.  Change
6888         all callers.
6889         * target.h (class Target): Add calls_non_split method.  Declare
6890         do_calls_non_split virtual method.  Declare match_view and
6891         set_view_to_nop.
6892         * target.cc: Include "elfcpp.h".
6893         (Target::do_calls_non_split): New function.
6894         (Target::match_view): New function.
6895         (Target::set_view_to_nop): New function.
6896         * gold.cc (queue_middle_tasks): Give an error if mixing
6897         split-stack and non-split-stack objects with -r.
6898         * i386.cc (Target_i386::relocate_section): Add
6899         reloc_symbol_changes parameter.
6900         (Target_i386::do_calls_non_split): New function.
6901         * x86_64.cc (Target_x86_64::relocate_section): Add
6902         reloc_symbol_changes parameter.
6903         (Target_x86_64::do_calls_non_split): New function.
6904         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6905         parameter.
6906         * powerpc.cc (Target_powerpc::relocate_section): Add
6907         reloc_symbol_changes parameter.
6908         * sparc.cc (Target_sparc::relocate_section): Add
6909         reloc_symbol_changes parameter.
6910         * configure.ac: Call AM_CONDITIONAL for the default target.
6911         * configure: Rebuild.
6912         * testsuite/Makefile.am (TEST_AS): New variable.
6913         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6914         (check_DATA): Add split_i386 and split_x86_64 files.
6915         (SPLIT_DEFSYMS): Define.
6916         (split_i386_[1234n].o): New targets.
6917         (split_i386_[124]): New targets.
6918         (split_i386_[1234r].stdout): New targets.
6919         (split_x86_64_[1234n].o): New targets.
6920         (split_x86_64_[124]): New targets.
6921         (split_x86_64_[1234r].stdout): New targets.
6922         (MOSTLYCLEANFILES): Add new executables.
6923         * testsuite/split_i386.sh: New file.
6924         * testsuite/split_x86_64.sh: New file.
6925         * testsuite/split_i386_1.s: New file.
6926         * testsuite/split_i386_2.s: New file.
6927         * testsuite/split_i386_3.s: New file.
6928         * testsuite/split_i386_4.s: New file.
6929         * testsuite/split_i386_n.s: New file.
6930         * testsuite/split_x86_64_1.s: New file.
6931         * testsuite/split_x86_64_2.s: New file.
6932         * testsuite/split_x86_64_3.s: New file.
6933         * testsuite/split_x86_64_4.s: New file.
6934         * testsuite/split_x86_64_n.s: New file.
6935         * testsuite/testfile.cc (Target_test): Update relocation_section
6936         function.
6937         * testsuite/Makefile.in: Rebuild.
6938
6939 2009-10-06  Ian Lance Taylor  <iant@google.com>
6940
6941         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6942         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6943         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6944         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6945         the address on ldo_addrs_.
6946         (Target_i386::Relocate::fix_up_ldo): New function.
6947
6948 2009-10-06   Rafael Espindola  <espindola@google.com>
6949
6950         * plugin.cc (add_input_library): New.
6951         (Plugin::load): Add add_input_library to tv.
6952         (Plugin_manager::add_input_file): Add the is_lib argument.
6953         (add_input_file): Update call to Plugin_manager::add_input_file.
6954         (add_input_library): New.
6955         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6956
6957 2009-09-30  Doug Kwan  <dougkwan@google.com>
6958
6959         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6960         symbol and call Symbol::may_need_copy_reloc to determine if
6961         a copy reloc is needed.
6962         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6963         nocopyreloc is given in command line.
6964         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6965         given in command line.
6966         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6967         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6968         of the removed Target_i386::may_need_copy_reloc.
6969         * options.h (copyreloc): New option with default value false.
6970         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6971         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6972         instead of the removed Target_powerpc::may_need_copy_reloc.
6973         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6974         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6975         instead of the removed Target_sparc::may_need_copy_reloc.
6976         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6977         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6978         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6979         instead of the removed Target_x86_64::may_need_copy_reloc.
6980
6981 2009-09-30  Ian Lance Taylor  <iant@google.com>
6982
6983         * object.h (class Object): Remove target_ field, and target,
6984         sized_target, and set_target methods.
6985         (Object::sized_target): Remove.
6986         (class Sized_relobj): Update declarations.  Remove sized_target.
6987         * object.cc (Sized_relobj::setup): Remove target parameter.
6988         Change all callers.
6989         (Input_objects::add_object): Don't do anything with the target.
6990         (make_elf_sized_object): Add punconfigured parameter.  Change all
6991         callers.  Set or test parameter target.
6992         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6993         Change all callers.
6994         * parameters.cc (Parameters::set_target): Change parameter type to
6995         be non-const.
6996         (Parameters::default_target): Remove.
6997         (set_parameters_target): Change parameter type to be non-const.
6998         (parameters_force_valid_target): New function.
6999         (parameters_clear_target): New function.
7000         * parameters.h (class Parameters): Update declarations.  Remove
7001         default_target method.  Add sized_target and clear_target
7002         methods.  Change target_ to be non-const.
7003         (set_parameters_target): Update declaration.
7004         (parameters_force_valid_target): Declare.
7005         (parameters_clear_target): Declare.
7006         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7007         as NULL if we aren't searching.
7008         (Add_symbols::run): Don't check for compatible target.
7009         * fileread.cc (Input_file::open_binary): Call
7010         parameters_force_valid_target.
7011         * gold.cc (queue_middle_tasks): Likewise.
7012         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7013         set_target on object.
7014         * dynobj.h (class Sized_dynobj): Update declarations.
7015         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7016         make_elf_object returns NULL.
7017         (Archive::include_member): Don't check whether object target is
7018         compatible.
7019         * output.cc (Output_section::add_input_section): Get target from
7020         parameters.
7021         (Output_section::relax_input_section): Likewise.
7022         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7023         parameters.
7024         (Sized_relobj::do_scan_relocs): Likewise.
7025         (Sized_relobj::relocate_sections): Likewise.
7026         * resolve.cc (Symbol_table::resolve): Likewise.
7027         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7028         parameter.  Change all callers.
7029         (Symbol_table::add_from_object): Get target from parameters.
7030         (Symbol_table::add_from_relobj): Don't check object target.
7031         (Symbol_table::add_from_dynobj): Likewise.
7032         (Symbol_table::define_special_symbol): Get target from
7033         parameters.
7034         * symtab.h (class Symbol_table): Update declaration.
7035         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7036         parameter.  Change all callers.  Clear parameter target.
7037         (Binary_test): Test target here.
7038         * testsuite/object_unittest.cc (gold_testsuite): Remove
7039         target_test_pointer parameter.  Change all callers.
7040         (Object_test): Test target here.
7041
7042 2009-09-26  Ian Lance Taylor  <iant@google.com>
7043
7044         * testsuite/initpri1.c: Don't try to use constructor priorities if
7045         compiling with gcc before 4.3.
7046
7047 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7048
7049         * testsuite/retain_symbols_file_test.sh (check_present): Change
7050         output file name to retain_symbols_file_test.stdout.
7051         (check_absent): Likewise.
7052
7053 2009-09-18  Craig Silverstein  <csilvers@google.com>
7054
7055         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7056         * options.cc: Include <cerrno> and <fstream>.
7057         (General_options::finalize): Parse -retain-symbols-file tag.
7058         * options.h: New flag.
7059         (General_options): New method should_retain_symbol, new
7060         variable symbols_to_retain.
7061         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7062         should_retain_symbol map.
7063         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7064         * testsuite/Makefile.in: Regenerate.
7065         * testsuite/retain_symbols_file_test.sh: New file.
7066
7067 2009-09-18  Nick Clifton  <nickc@redhat.com>
7068
7069         * po/es.po: Updated Spanish translation.
7070
7071 2009-09-17  Doug Kwan  <dougkwan@google.com>
7072
7073         * debug.h (DEBUG_RELAXATION): New constant.
7074         (DEBUG_ALL): Add DEBUG_RELAXATION.
7075         (debug_string_to_enum): Add relaxation debug option.
7076         * layout.cc
7077         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7078         Layout::Relaxation_debug_check::read_sections,
7079         Layout::Relaxation_debug_check::read_sections): New method definitions.
7080         (Layout::Layout): Initialize data members
7081         record_output_section_data_from_scrips_,
7082         script_output_section_data_list_ and relaxation_debug_check_.
7083         (Layout::save_segments, Layout::restore_segments,
7084         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7085         Layout::relaxation_loop_body): New method definitions.
7086         (Layout::finalize): Support relaxation.  Move section layout code to
7087         Layout::relaxation_loop_body.
7088         (Layout::set_asection_address_from_script): Move code for orphan
7089         section placement out.
7090         (Layout::place_orphan_sections_in_script): New method definition.
7091         * layout.h (Output_segment_headers, Output_file_header):
7092         New forward class declarations.
7093         (Layout::~Layout): Define.
7094         (Layout::new_output_section_data_from_script): New method definition.
7095         (Layout::place_orphan_sections_in_script): New method declaration.
7096         (Layout::Segment_states): New type declaration.
7097         (Layout::save_segments, Layout::restore_segments,
7098         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7099         Layout::relaxation_loop_body): New method declarations.
7100         (Layout::Output_section_data_list): New type declaration.
7101         (Layout::Relaxation_debug_check): New class definition.
7102         (Layout::record_output_section_data_from_script_,
7103         Layout::script_output_section_data_list_, Layout::segment_states_,
7104         Layout::relaxation_debug_check_): New data members.
7105         * output.cc: (Output_section_headers::do_size): New method definition.
7106         (Output_section_headers::Output_section_headers): Move size
7107         computation to Output_section_headers::do_size.
7108         (Output_segment_headers::do_size): New method definition.
7109         (Output_file_header::Output_file_header): Move size computation to
7110         Output_file_header::do_size and call it.
7111         (Output_file_header::do_size): New method definition.
7112         (Output_data_group::Output_data_group): Adjust call to
7113         Output_section_data.
7114         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7115         (Output_symtab_xindex::do_write): Add array bound check.
7116         (Output_section::Input_section::print_to_mapfile): Handle
7117         RELAXED_INPUT_SECTION_CODE.
7118         (Output_section::Output_section): Initialize data member checkpoint_.
7119         (Output_section::~Output_section): Delete checkpoint object pointed
7120         by checkpoint_.
7121         (Output_section::add_input_section): Always add an Input_section if
7122         relaxing.
7123         (Output_section::add_merge_input_section): Add assert.
7124         (Output_section::relax_input_section): New method definition.
7125         (Output_section::set_final_data_size): Set load address to zero for
7126         an unallocated section.
7127         (Output_section::do_address_and_file_offset_have_reset_values):
7128         New method definition.
7129         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7130         Handle relaxed input section.
7131         (Output_section::sort_attached_input_sections): Checkpoint input
7132         section list lazily.
7133         (Output_section::get_input_sections): Change type of input_sections to
7134         list of Simple_input_section pointers.  Checkpoint input section list
7135         lazily.  Also handle relaxed input sections.
7136         (Output_section::add_input_section_for_script): Take a reference to
7137         a Simple_input_section object instead of Relobj pointer and section
7138         index as parameter.  Handle relaxed input sections.
7139         (Output_section::save_states, Output_section::restore_states): New
7140         method definitions.
7141         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7142         (Output_data::is_data_size_fixed): New method definition.
7143         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7144         if it is fixed.
7145         (Output_data::address_and_file_offset_have_reset_values): New method
7146         definition.
7147         (Output_data::do_address_and_file_offset_have_reset_values): New method
7148         definition.
7149         (Output_data::set_data_size): Check that data size is not fixed.
7150         (Output_data::fix_data_size): New method definition.
7151         (Output_data::is_data_size_fixed_): New data member.
7152         (Output_section_headers::set_final_data_size): New method definition.
7153         (Output_section_headers::do_size): New method declaration.
7154         (Output_segment_headers::set_final_data_size): New method definition.
7155         (Output_segment_headers::do_size): New method declaration.
7156         (Output_file_header::set_final_data_size)::New method definition.
7157         (Output_file_header::do_size)::New method declaration.
7158         (Output_section_data::Output_section_data): Add new parameter
7159         is_data_size_fixed and use it to fix data size.
7160         (Output_data_const::Output_data_const): Adjust call to base class
7161         constructor and fix data size.
7162         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7163         base class constructor and fix data size.
7164         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7165         base class constructor and fix data size.
7166         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7167         class constructor and fix data size.
7168         (Output_data_group::set_final_data_size): New method definition.
7169         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7170         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7171         class constructor and fix data size.
7172         (Output_relaxed_input_section): New class definition.
7173         (Output_section::Simple_input_section): New class definition.
7174         (Output_section::get_input_sections): Adjust parameter list.
7175         (Output_section::add_input_section_for_script): Same.
7176         (Output_section::save_states, Output_section::restore_states,
7177         Output_section::do_address_and_file_offset_have_reset_values,
7178         (Output_section::Input_section::Input_section): Handle
7179         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7180         Output_relaxed_input_section.
7181         (Output_section::Input_section::is_input_section,
7182         Output_section::Input_section::set_output_section): Handle relaxed
7183         input section.
7184         (Output_section::Input_section::is_relaxed_input_section,
7185         Output_section::Input_section::output_section_data,
7186         Output_section::Input_section::relaxed_input_section): New method
7187         definitions.
7188         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7189         value.
7190         (Output_section::Input_section::u1_): Update comments.
7191         (Output_section::Input_section::u2_): Add new union member poris.
7192         (Output_section::Checkpoint_output_section): New classs definition.
7193         (Output_section::relax_input_section): New method declaration.
7194         (Output_section::checkpoint_): New data member.
7195         (Output_segment): Update comments.
7196         (Output_segment::Output_segment): Un-privatize copy constructor.
7197         (Output_segment::operator=): Un-privatize.
7198         * script-sections.cc (Output_section_element::Input_section_list):
7199         Change element type to Output_section::Simple_input_section.
7200         (Output_section_element_dot_assignment::set_section_addresses):
7201         Register output section data for relaxation clean up.
7202         (Output_data_exression::Output_data_expression): Adjust call to base
7203         constructor to fix data size.
7204         (Output_section_element_data::set_section_addresses): Register
7205         Output_data_expression object for relaxation clean up.
7206         (struct Input_section_info): Replace Relobj pointer and section index
7207         pair with Output_section::Simple_input_section and Convert struct to a
7208         class.
7209         (Input_section_sorter::operator()): Adjust access to
7210         Input_section_info data member to use accessors.
7211         (Output_section_element_input::set_section_addresses): Use layout
7212         parameter.  Adjust code to use Output_section::Simple_input_section
7213         and Input_secction_info classes.  Register filler for relaxation
7214         clean up.
7215         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7216         and section index pair with Output_section::Simple_input_section
7217         class.  Adjust code accordingly.
7218         (Phdrs_element::release_segment): New method definition.
7219         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7220         segment list.
7221         (Script_sections::release_segments): New method definition.
7222         * gold/script-sections.h (Script_sections::release_segments): New
7223         method declaration.
7224         * gold/target.h (Target::may_relax, Target::relax,
7225         Target::do_may_relax, Target::do_relax): New method definitions.
7226
7227 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7228
7229         * arm.cc (has_signed_unsigned_overflow): New function.
7230         (Arm_relocate_functions::abs8): New function.
7231         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7232         (Target_arm::Scan::global): Likewise.
7233         (Target_arm::relocate::relocate): Likewise.
7234         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7235         Likewise.
7236
7237 2009-09-16  Cary Coutant  <ccoutant@google.com>
7238
7239         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7240         * testsuite/Makefile.in: Regenerate.
7241
7242 2009-09-11  Nick Clifton  <nickc@redhat.com>
7243
7244         * po/gold.pot: Updated by the Translation project.
7245
7246 2009-09-08  Cary Coutant  <ccoutant@google.com>
7247
7248         * output.cc (Output_file::open): Add execute permission to empty file.
7249         * testsuite/Makefile.am (permission_test): New test.
7250         * testsuite/Makefile.in: Regenerate.
7251
7252 2009-09-02  Ian Lance Taylor  <iant@google.com>
7253
7254         * output.cc (Output_file::resize): Call map_no_anonymous rather
7255         than map.
7256
7257 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7258
7259         * gold.cc: Include "incremental.h".
7260         (queue_initial_tasks): Call Incremental_checker methods.
7261         * incremental.cc: Include "output.h".
7262         (Incremental_checker::can_incrementally_link_output_file): New
7263         method.
7264         * incremental.h (Incremental_checker): New class.
7265
7266         * output.cc (Output_file::open_for_modification): New method.
7267         (Output_file::map_anonymous): Changed return type to bool.  Record
7268         map in base_ field.
7269         (Output_file::map_no_anonymous): New method, broken out of map.
7270         (Output_file::map): Use map_no_anonymous and map_anonymous.
7271         * output.h (class Output_file): Update declarations.
7272
7273 2009-08-24  Cary Coutant  <ccoutant@google.com>
7274
7275         * options.h (Command_line::Pre_options): New class.
7276         (Command_line::pre_options): New member.
7277         * options.cc (gold::options::ready_to_register): New variable.
7278         (One_option::register_option): Do nothing if not registering options.
7279         Assert if same short option registered twice.
7280         (General_options::General_options): Turn off option registration when
7281         done constructing.
7282         (Command_line::Pre_options::Pre_options): New constructor.
7283
7284 2009-08-24  Cary Coutant  <ccoutant@google.com>
7285
7286         * options.h (General_options::no_keep_memory): Remove incorrect
7287         short option.
7288
7289 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7290
7291         * Makefile.am (am__skiplex, am__skipyacc): New.
7292         * Makefile.in: Regenerate.
7293
7294 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7295
7296         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7297         (INCLUDES): ... this.
7298         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7299         (AM_CPPFLAGS): Renamed from ...
7300         (INCLUDE): ... this.
7301         * Makefile.in, testsuite/Makefile.in: Regenerate.
7302
7303         * Makefile.in: Regenerate.
7304         * aclocal.m4: Likewise.
7305         * config.in: Likewise.
7306         * configure: Likewise.
7307         * testsuite/Makefile.in: Likewise.
7308
7309         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7310         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7311         * Makefile.in: Regenerate.
7312         * testsuite/Makefile.in: Regenerate.
7313
7314 2009-08-19  Cary Coutant  <ccoutant@google.com>
7315
7316         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7317         symbols in shared libraries overridden by hidden or internal symbols
7318         in the main program.
7319
7320 2009-08-19  Chris Demetriou  <cgd@google.com>
7321
7322         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7323         checking source file names in error messages.
7324
7325 2009-08-18  Doug Kwan  <dougkwan@google.com>
7326
7327         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7328         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7329         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7330         an elfcpp::Ehdr as parameter.
7331         * object.cc (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.  Adjust call to set_target.
7335         (make_elf_sized_object): Find target and ask target to
7336         make an ELF object.
7337         * object.h: (Object::set_target): Remove the version that looks up
7338         a target and sets it.
7339         (Sized_relobj::setup): Take a Target object instead of
7340         an elfcpp:Ehdr as parameter.
7341         * target.cc: Include dynobj.h.
7342         (Target::do_make_elf_object_implementation): New.
7343         (Target::do_make_elf_object): New.
7344         * target.h (Target::make_elf_object): New template declaration.
7345         (Target::do_make_elf_object): New method declarations.
7346         (Target::do_make_elf_object_implementation): New template declaration.
7347
7348 2009-08-14  Ian Lance Taylor  <iant@google.com>
7349
7350         * gold.h (FUNCTION_NAME): Define.
7351         (gold_unreachable): Use FUNCTION_NAME.
7352
7353 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7354
7355         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7356         symbol in the --keep-unique list is not found.
7357
7358 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7359
7360         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7361         been maked as --keep-unique.
7362         (Icf::unfold_section): New function.
7363         * icf.h (Icf::unfold_section): New function.
7364         * options.h (General_options::keep_unique): New option.
7365         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7366         * testsuite/Makefile.in: Regenerate.
7367         * testsuite/icf_keep_unique_test.sh: New file.
7368         * testsuite/icf_keep_unique_test.cc: New file.
7369
7370 2009-08-12  Cary Coutant  <ccoutant@google.com>
7371
7372         PR 10471
7373         * resolve.cc (Symbol_table::resolve): Check for references from
7374         dynamic objects to hidden and internal symbols.
7375         * testsuite/Makefile.am (hidden_test.sh): New test.
7376         * testsuite/Makefile.in: Regenerate.
7377         * testsuite/hidden_test.sh: New script.
7378         * testsuite/hidden_test_1.c: New test source.
7379         * testsuite/hidden_test_main.c: New test source.
7380
7381 2009-08-11  Doug Kwan  <dougkwan@google.com>
7382
7383         * arm.cc: Update comments.
7384         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7385         segment to locate the .ARM.exidx section if present.
7386
7387 2009-08-09  Doug Kwan  <dougkwan@google.com>
7388
7389         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7390         patch.
7391
7392 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7393         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7394         compiler warnings.
7395
7396 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7397
7398         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7399         valid tls_segment only for non-debug-section relocations.
7400         * testsuite/Makefile.am: Add gc_tls_test.
7401         * testsuite/Makefile.in: Regenerate.
7402         * testsuite/gc_tls_test.cc: New file.
7403         * testsuite/gc_tls_test.sh: New file.
7404
7405 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7406
7407         * icf.cc: New file.
7408         * icf.h: New file.
7409         * Makefile.am (CCFILES): Add icf.cc.
7410         (HFILES): Add icf.h
7411         * Makefile.in: Regenerate.
7412         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7413         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7414         section, symbol and addend information for the relocs.
7415         * gold.cc (queue_middle_tasks): Call identical code folding.
7416         * gold.h: Add defines for multimap.
7417         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7418         to the call of finalize_local_symbols.
7419         * main.cc (main): Create object of class Icf.
7420         * object.cc (Sized_relobj::do_layout): Allow this function to be
7421         called twice during icf.
7422         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7423         to sections marked as identical by icf.
7424         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7425         when available.
7426         (Sized_relobj::do_section_entsize): New function.
7427         * object.h (Object::section_entsize): New function.
7428         (Object::do_section_entsize): New pure virtual function.
7429         (Relobj::finalize_local_symbols): Add new parameter.
7430         (Relobj::do_section_entsize): New function.
7431         * options.h (General_options::icf): New option.
7432         (General_options::icf_iterations): New option.
7433         (General_options::print_icf_sections): New option.
7434         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7435         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7436         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7437         icf.
7438         * symtab.cc (Symbol_table::is_section_folded): New function.
7439         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7440         to sections marked as identical by icf.
7441         * symtab.h (Symbol_table::set_icf): New function.
7442         (Symbol_table::icf): New function.
7443         (Symbol_table::is_section_folded): New function.
7444         (Symbol_table::icf_): New data member.
7445         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7446         * testsuite/Makefile.am: Add commands to build icf_test.
7447         * testsuite/Makefile.in: Regenerate.
7448         * testsuite/icf_test.sh: New file.
7449         * testsuite/icf_test.cc: New file.
7450
7451 2009-07-24  Chris Demetriou  <cgd@google.com>
7452
7453         * layout.cc (is_compressible_debug_section): Fix incorrect
7454         comment about compressed section names.
7455
7456 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7457
7458         PR 10419
7459         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7460
7461 2009-07-16  Ian Lance Taylor  <iant@google.com>
7462
7463         PR 10400
7464         * layout.h: #include <map>.
7465         (class Kept_section): Change from struct to class.  Add accessors
7466         and setters.  Add section size to Comdat_group mapping.  Change
7467         Comdat_group to std::map.  Add is_comdat_ field.  Add
7468         linkonce_size field in union.
7469         (class Layout): Update declaration of find_or_add_kept_section.
7470         Don't declare find_kept_object.
7471         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7472         parameter.  Add object, shndx, is_comdat, and is_group_name
7473         parameters.  Change all callers.  Adjust for new Kept_section.
7474         (Layout::find_kept_object): Remove.
7475         * object.cc (Sized_relobj::include_section_group): Update use of
7476         Kept_section.  Rename secnum to shndx.  Only record
7477         Kept_comdat_section if sections are the same size.
7478         (Sized_relobj::include_linkonce_section): Update use of
7479         Kept_section.  Only record Kept_comdat_section if sections are the
7480         same size.  Set size of linkonce section.
7481         (Sized_relobj::map_to_kept_section): Update call to
7482         get_kept_comdat_section.
7483         * object.h (class Sized_relobj): Rename fields in
7484         Kept_comdat_section to drop trailing underscores; change object
7485         field to Relobj*.  Change Kept_comdat_section_table to store
7486         struct rather than pointer.
7487         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7488         Add kept_object and kept_shndx parameters.  Change all callers.
7489         (Sized_relobj::get_kept_comdat_section): Change return type to
7490         bool.  Add kept_object and kept_shndx parameters.  Change all
7491         callers.
7492         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7493         Layout::find_or_add_kept_section.
7494
7495 2009-07-09  Ian Lance Taylor  <iant@google.com>
7496
7497         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7498         Reserve space in the hash table.
7499
7500 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7501
7502         * fileread.cc (File_read::get_mtime): New method.
7503         * fileread.h (Timespec): New structure.
7504         (File_read::get_mtime): New method.
7505         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7506         Renamed from timestamp_nsec.
7507         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7508         Elf_Xword.
7509         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7510         timestamp_nsec.
7511         (Incremental_inputs::report_archive): Save mtime; style fix.
7512         (Incremental_inputs::report_obejct): Save mtime; style fix.
7513         (Incremental_inputs::report_script): Save mtime; style fix.
7514         (Incremental_inputs::finalize_inputs): Style fix.
7515         (Incremental_inputs::finalize): Style fix.
7516         (Incremental_inputs::create_input_section_data): Store inputs
7517         mtime.
7518         * incremental.h (Incremental_inputs::report_script): Add mtime
7519         argument.
7520         (Incremental_inputs::Input_info::Input_info): Intialize only one
7521         union member.
7522         (Incremental_inputs::Input_info::archive): Move to nameless
7523         union.
7524         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7525         (Incremental_inputs::Input_info::script): Move to nameless union.
7526         (Incremental_inputs::mtime): New field.
7527         * script.cc (read_input_script): Pass file mtime to
7528         Incremental_input.
7529         * script.h (Script_info::inputs): Style fix.
7530
7531 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7532
7533         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7534         instead of 32.
7535
7536 2009-06-24  Ian Lance Taylor  <iant@google.com>
7537
7538         PR 10156
7539         * layout.cc (Layout::choose_output_section): If we find an
7540         existing section, update the flags.
7541         (Layout::create_notes): New function, broken out of
7542         Layout::finalize.
7543         (Layout::finalize): Don't create note sections.
7544         (Layout::create_note): Don't crash if linker script discards
7545         section.
7546         (Layout::create_gold_note): Likewise.
7547         (Layout::create_build_id): Likewise.  Don't set
7548         after_input_sections on the section.
7549         (Layout::create_executable_stack_info): Remove target parameter.
7550         Change caller.
7551         * layout.h (class Layout): Declare create_notes.  Update
7552         declaration of create_executable_stack_info.
7553         * gold.cc (queue_middle_tasks): Call create_notes.
7554         * output.cc (Output_section::update_flags_for_input_section): Move
7555         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7556         invalid.
7557         * output.h (Output_data::mark_address_invalid): New function.
7558         (class Output_section): Only declare, not define,
7559         update_flags_for_input_section.  Remove set_flags.
7560
7561 2009-06-24  Ian Lance Taylor  <iant@google.com>
7562
7563         * script-sections.cc (Output_section_definition::
7564         set_section_addresses): Rename shadowing local load_address to
7565         laddr.
7566
7567 2009-06-24  Ian Lance Taylor  <iant@google.com>
7568
7569         PR 10244
7570         * reloc.cc (relocate_sections): Skip empty relocation sections.
7571
7572 2009-06-23  Ian Lance Taylor  <iant@google.com>
7573
7574         PR 10156
7575         * layout.cc (Layout::create_note): Use choose_output_section
7576         rather than make_output_section.
7577
7578 2009-06-23  Ian Lance Taylor  <iant@google.com>
7579
7580         PR 10237
7581         * options.cc (General_options::parse_V): Set printed_version_.
7582         (General_options::General_options): Initialize printed_version_.
7583         * options.h (class General_options): Add printed_version_ field.
7584         * gold.cc (queue_initial_tasks): If there are no input files,
7585         don't give a fatal error if we printed the version information.
7586         (queue_middle_tasks): If using -r with a shared object, give a
7587         fatal error rather than an ordinary error.
7588
7589 2009-06-23  Ian Lance Taylor  <iant@google.com>
7590
7591         PR 10219
7592         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7593         (Layout::make_output_section): Set have_stabstr_section_ if we see
7594         a .stab*str section.
7595         (Layout::finalize): Call link_stabs_sections.
7596         (Layout::link_stabs_sections): New file.
7597         * layout.h (class Layout): Add have_stabstr_section_ field.
7598         Declare link_stabs_sections.
7599
7600 2009-06-23  Doug Kwan  <dougkwan@google.com>
7601
7602         * Makefile.am (libgold_a_LIBADD): New.
7603         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7604         * Makefile.in: Regenerate.
7605         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7606         * configure: Regenerate.
7607         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7608         * fileread.cc: Include sys/state.h
7609         * gold.h: Declare memmem and strndup if found missing.
7610         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7611
7612 2009-06-23  Ian Lance Taylor  <iant@google.com>
7613
7614         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7615         * configure: Rebuild.
7616
7617 2009-06-23  Ian Lance Taylor  <iant@google.com>
7618
7619         PR 10147
7620         * object.cc (Object::section_contents): Don't try to get a view if
7621         the section has length zero.
7622         (Object::handle_gnu_warning_section): If the section is empty, use
7623         the name of the section as the warning.
7624
7625 2009-06-23  Ian Lance Taylor  <iant@google.com>
7626
7627         PR 10133
7628         * stringpool.h (class Stringpool_template): Add optimize_ field.
7629         (Stringpool_template::set_optimize): New function.
7630         * stringpool.cc (Stringpool_template::Stringpool_template):
7631         Initialize optimize_ field.
7632         (Stringpool_template::set_string_offsets): Test local optimize
7633         fild rather than parameter.
7634         * layout.cc (Layout::Layout): Call set_optimize on the section
7635         name stringpool.
7636
7637 2009-06-22  Ian Lance Taylor  <iant@google.com>
7638
7639         PR 10030
7640         * yyscript.y: Parse TARGET.
7641         * script.cc (script_set_target): New function.
7642         * script-c.h (script_set_target): Declare.
7643         * options.cc (General_options::string_to_object_format): Rename
7644         from string_to_object_format in anonymous namespace.  Change
7645         callers.
7646         * options.h (class General_options): Declare
7647         string_to_object_format.
7648
7649 2009-06-22  Ian Lance Taylor  <iant@google.com>
7650
7651         * script-sections.cc (Script_sections::create_segments): Don't put
7652         program headers in a PT_LOAD segment if -n or -N.
7653
7654 2009-06-22  Ian Lance Taylor  <iant@google.com>
7655
7656         PR 10141
7657         * options.h (class General_options): Add -z lazy and -z now.  Sort
7658         -z options into alphabetical order.
7659         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7660
7661 2009-06-21  Ian Lance Taylor  <iant@google.com>
7662
7663         * layout.cc (Layout::make_output_section): Call
7664         Target::new_output_section.
7665         (Layout::attach_allocated_section_to_segment): Put large section
7666         sections in a separate load segment with the large segment flag
7667         set.
7668         (Layout::segment_precedes): Sort large data segments after other
7669         load segments.
7670         (align_file_offset): New static function.
7671         (Layout::set_segment_offsets): Use align_file_offset.
7672         * output.h (class Output_section): Add is_small_section_ and
7673         is_large_section_ fields.
7674         (Output_section::is_small_section): New function.
7675         (Output_section::set_is_small_section):  New function.
7676         (Output_section::is_large_section): New function.
7677         (Output_section::set_is_large_section): New function.
7678         (Output_section::is_large_data_section): New function.
7679         (class Output_segment): Add is_large_data_segment_ field.
7680         (Output_segment::is_large_data_segment): New function.
7681         (Output_segment::set_is_large_data_segment): New function.
7682         * output.cc (Output_section::Output_section): Initialize new
7683         fields.
7684         (Output_segment::Output_segment): Likewise.
7685         (Output_segment::add_output_section): Add assertion that large
7686         data sections always go in large data segments.  Force small data
7687         sections to the end of the list of data sections.  Force small BSS
7688         sections to the start of the list of BSS sections.  For large BSS
7689         sections to the end of the list of BSS sections.
7690         * symtab.h (class Symbol): Declare is_common_shndx.
7691         (Symbol::is_defined): Check Symbol::is_common_shndx.
7692         (Symbol::is_common): Likewise.
7693         (class Symbol_table): Define enum Commons_section_type.  Update
7694         declarations.  Add small_commons_ and large_commons_ fields.
7695         * symtab.cc (Symbol::is_common_shndx): New function.
7696         (Symbol_table::Symbol_table): Initialize new fields.
7697         (Symbol_table::add_from_object): Put small and large common
7698         symbols in the right list.
7699         (Symbol_table::sized_finalized_symbol): Check
7700         Symbol::is_common_shndx.
7701         (Symbol_table::sized_write_globals): Likewise.
7702         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7703         common symbol lists.  Don't call do_allocate_commons_list if the
7704         list is empty.
7705         (Symbol_table::do_allocate_commons_list): Remove is_tls
7706         parameter.  Add comons_section_type parameter.  Change all
7707         callers.  Handle small and large common symbols.
7708         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7709         Symbol::is_common_shndx.
7710         * resolve.cc (symbol_to_bits): Likewise.
7711         * target.h (Target::small_common_shndx): New function.
7712         (Target::small_common_section_flags): New function.
7713         (Target::large_common_shndx): New function.
7714         (Target::large_common_section_flags): New function.
7715         (Target::new_output_section): New function.
7716         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7717         small_common_section_flags, and large_common_section_flags
7718         fields.
7719         (Target::do_new_output_section): New virtual function.
7720         * arm.cc (Target_arm::arm_info): Initialize new fields.
7721         * i386.cc (Target_i386::i386_info): Likewise.
7722         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7723         Likewise.
7724         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7725         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7726         (Target_x86_64::do_new_output_section): New function.
7727         * configure.ac: Define conditional MCMODEL_MEDIUM.
7728         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7729         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7730         (large_LDFLAGS): Define.
7731         * testsuite/large.c: New file.
7732         * testsuite/testfile.cc (Target_test::test_target_info):
7733         Initialize new fields.
7734         * configure, testsuite/Makefile.in: Rebuild.
7735
7736 2009-06-05  Doug Kwan  <dougkwan@google.com>
7737
7738         * Makefile.am (CCFILES): Add target.cc.
7739         * Makefile.in: Regenerate.
7740         * i386.cc (class Target_i386): Define new virtual method to
7741         override do_is_local_label_name in parent.
7742         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7743         local symbols if --discard-locals or -X is given.
7744         * options.h (class General_options): Declare new options
7745         '--discard-locals' and '-X' for discarding locals.
7746         * target.h (class Target): Define new methods is_local_label_name.
7747         Declare new virtual method do_is_local_label_name.
7748         * target.cc: New file.
7749         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7750         (check_SCRIPTS): Add discard_locals_test.sh.
7751         (check_DATA): Add discard_local_tests.syms.
7752         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7753         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7754         * testsuite/Makefile.in: Regenerate.
7755         * testsuite/discard_locals_test.c: New file.
7756         * testsuite/discard_locals_test.sh: Same.
7757
7758 2009-06-05  Doug Kwan  <dougkwan@google.com>
7759
7760         * object.cc (Sized_relobj::Sized_relobj): Initialize
7761         discarded_eh_frame_shndx_ to -1U.
7762         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7763         section.
7764         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7765         a discarded .eh_frame section.
7766         (Sized_relobj::do_finalize_local_symbols): Ditto.
7767         * object.h (class Sized_relobj): Declare new member
7768         discarded_eh_frame_shndx_.
7769         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7770         (local_labels_test.o, local_labels_test): New rules.
7771         * testsuite/Makefile.in: Regenerate.
7772
7773 2009-06-04  Doug Kwan  <dougkwan@google.com>
7774
7775         * layout.cc (Layout::section_name_mapping): Add mapping for
7776         special ARM sections.
7777
7778 2009-06-03  Doug Kwan  <dougkwan@google.com>
7779
7780         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7781         (utils::has_overflow): Same.
7782
7783 2009-06-03  Ian Lance Taylor  <iant@google.com>
7784
7785         * layout.cc (Layout::section_name_mapping): New array, replacing
7786         Layout::linkonce_mapping.
7787         (Layout::section_name_mapping_count): New variable, replacing
7788         Layout::linkonce_mapping_count.
7789         (Layout::linkonce_output_name): Remove.
7790         (Layout::output_section_name): Rewrite.
7791         * layout.h (class Layout): Rename Linkonce_mapping to
7792         Section_name_mapping, linkonce_mapping to section_name_mapping,
7793         linkonce_mapping_count to section_name_mapping_count.  Don't
7794         declare linkonce_output_name.
7795
7796 2009-06-03  Doug Kwan  <dougkwan@google.com>
7797
7798         * gold/arm.cc (namespace utils): New.
7799         (Target_arm::reloc_is_non_pic): Define new method.
7800         (class Arm_relocate_functions): New.
7801         (Target_arm::Relocate::relocate): Handle relocation types used by
7802         Android.
7803
7804 2009-06-03  Ian Lance Taylor  <iant@google.com>
7805
7806         * arm.cc (Target_arm::scan::global): Use || instead of |.
7807
7808 2009-06-02  Doug Kwan  <dougkwan@google.com>
7809
7810         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7811         issued_non_pic_error_.
7812         (class Target_arm::Scan): Declare new method check_non_pic.
7813         Define new method symbol_needs_plt_entry.
7814         Declare new data member issued_non_pic_error_.
7815         (class Target_arm::Relocate): Declare new method
7816         should_apply_static_reloc.
7817         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7818         (Target_arm::Scan::check_non_pic): Define new method.
7819         (Target_arm::Scan::local): Handle a small subset of reloc types used
7820         by Android.
7821         (Target_arm::Scan::local): Same.
7822         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7823
7824 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7825
7826         * incremental.cc (Incremental_inputs::report_command_line): Filter
7827         out --incremental-* options.
7828
7829 2009-05-29  Doug Kwan  <dougkwan@google.com>
7830
7831         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7832         template class.
7833         (class Target_arm): Update comment.
7834         (Target_arm::Target_arm): Initialize new data members GOT_,
7835         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7836         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7837         and Target_arm::rel_dyn_section.
7838         Declare new_enum Target_arm::Got_type.
7839         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7840         and DYNBSS_.
7841         Update commments for member do_dynsym_value.
7842         (Target_arm::got_size, Target_arm::plt_section,
7843         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7844         new methods inside class defintion.
7845         (Target_arm::got_section): Define new method.
7846         (Target_arm::rel_dyn_section): Same.
7847         (Output_data_plt_arm): New template class.
7848         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7849         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7850         (Output_data_plt_arm::add_entry): Same.
7851         (Output_data_plt_arm::first_plt_entry): Define new
7852         static data member for PLT instruction template.
7853         (Output_data_plt_arm::plt_entry): Same.
7854         (Output_data_plt_arm::do_write): Define new method.
7855         (Target_arm::make_plt_entry): Same.
7856         (Target_arm::do_finalize_sections): Same.
7857         (Target_arm::do_dynsym_value): Same.
7858
7859 2009-05-28  Doug Kwan  <dougkwan@google.com>
7860
7861         * Makefile.am (TARGETSOURCES): Add arm.cc.
7862         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7863         * Makefile.in: Regenerate.
7864         * arm.cc: New file.
7865         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7866
7867 2009-05-26  Doug Kwan  <dougkwan@google.com>
7868
7869         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7870         (General_options::check_excluded_libs): Strip off directories in
7871         archive name before matching like GNU ld does.
7872         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7873         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7874         (exclude_libs_test_LDFLAGS): Add linker option
7875         -Wl,--exclude-libs,libexclude_libs_test_3
7876         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7877         an explicit archive without using -l.
7878         (alt/libexclude_libs_test_3.a): New make rule.
7879         * testsuite/Makefile.in: Regenerate.
7880         * testsuite/exclude_libs_test.c : Declare lib3_default().
7881         (main): Call it.
7882         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7883         * exclude_libs_test_3.c: New file.
7884
7885 2009-05-26  Nick Clifton  <nickc@redhat.com>
7886
7887         * po/id.po: New Indonesian translation.
7888         * po/gold.pot: Updated template file.
7889
7890 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7891
7892         * testsuite/Makefile.am: Add -ffunction-sections to compile
7893         gc_comdat_test files.  Add -Wl,--gc-sections to build
7894         gc_comdat_test.
7895         * testsuite/Makefile.in: Regenerate.
7896         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7897
7898 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7899
7900         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7901         kept comdat section was garbage collected.
7902         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7903         * testsuite/Makefile.in: Regenerate.
7904         * testsuite/gc_comdat_test.sh: New file.
7905         * testsuite/gc_comdat_test_1.cc: New file.
7906         * testsuite/gc_comdat_test_2.cc: New file.
7907
7908 2009-05-19  Doug Kwan  <dougkwan@google.com>
7909
7910         * archive.cc (Archive::Archive): Move constructor from archive.h
7911         to here.  Initialize no_export_.
7912         (Archive::get_elf_object_for_member): Set no_export flag of object.
7913         * archive.h (Archive::Archive): Move constructor body to
7914         archive.cc.
7915         (Archive::no_export): New method.
7916         (Archive::no_export_): New field.
7917         * object.h (Object::Object): Initialize no_export_ to false.
7918         (Object::no_export, Object::set_no_export): New methods.
7919         (Object::no_export_): New field.
7920         * options.cc (General_options::parse_exclude_libs): New method.
7921         (General_options::check_excluded_libs) Same.
7922         * options.h (exclude_libs): New option.
7923         (General_options::check_excluded_libs): New method declaration.
7924         (General_options::excluded_libs_): New field.
7925         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7926         default or protected visibility if an object has no-export flag set.
7927         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7928         (check_SCRIPTS): Add exclude_libs_test.sh.
7929         (check_DATA): Add exclude_libs_test.syms.
7930         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7931         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7932         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7933         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7934         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7935         libexclude_libs_test_2.a): New rules.
7936         * testsuite/Makefile.in: Regenerate.
7937         * testsuite/exclude_libs_test.c: New file.
7938         * testsuite/exclude_libs_test.sh: Ditto.
7939         * testsuite/exclude_libs_test_1.c: Ditto.
7940         * testsuite/exclude_libs_test_2.c: Ditto.
7941
7942 2009-05-15  Ian Lance Taylor  <iant@google.com>
7943
7944         * configure.ac: Check for declarations for cases where libiberty.h
7945         checks HAVE_DECL_xxx.
7946         * configure, config.in: Rebuild.
7947
7948 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7949
7950         * gold.h (Incremental_argument_list): Remove (invalid) forward
7951         declaration.
7952         * incremental.cc (Incremental_inputs::report_achive): New method.
7953         (Incremental_inputs::report_object): New method.
7954         (Incremental_inputs::report_script): New method.
7955         (Incremental_inputs::finalize_inputs): New method.
7956         (Incremental_inputs::finalize): Call finalize_inputs().
7957         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7958         Create inputs entries.
7959         * incremental.h (Incremental_input_type): New enum.
7960         (Incremental_inputs::Incremental_input): Initialize new fields.
7961         (Incremental_inputs::report_inputs): New method.
7962         (Incremental_inputs::report_achive): New method.
7963         (Incremental_inputs::report_object): New method.
7964         (Incremental_inputs::report_script): New method.
7965         (Incremental_inputs::finalize_inputs): New method.
7966         (Incremental_inputs::Input_info): New struct.
7967         (Incremental_inputs::Input_info_map): New typedef.
7968         (Incremental_inputs::lock_): New field.
7969         (Incremental_inputs::Inputs_): New field.
7970         (Incremental_inputs::Inputs_map): New field.
7971         * main.cc (main): Call Incremental_input::report_inputs.
7972         * options.h (Input_argument_list): Typedef moved from
7973         Input_arguments.
7974         (Input_file_group::Files): Remove, use ::Input_argument_list.
7975         (Input_file_group::Input_argument_list): Remove, use
7976         ::Input_argument_list.
7977         * plugin.cc (Plugin_manager::add_input_file): Add error in
7978         incremental build.
7979         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7980         functions.
7981         * script.cc (read_input_script): Call
7982         Incremental_input::report_script.
7983         * script.h (Script_info): New class.
7984
7985 2009-04-27  Ian Lance Taylor  <iant@google.com>
7986
7987         * x86_64.cc (do_adjust_output_section): Set entsize to
7988         plt_entry_size.
7989
7990 2009-04-23  Elliott Hughes  <enh@google.com>
7991
7992         * output.cc (Output_file::close): After short writes, continue
7993         writing from the correct offset in the buffer being written.
7994
7995 2009-04-23  Chris Demetriou  <cgd@google.com>
7996
7997         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7998         * configure: Regenerate.
7999         * config.in: Regenerate.
8000         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8001         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8002
8003 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8004
8005         * incremental.cc (Incremental_inputs_header_data): Renamed from
8006         Incremental_input_header_data.
8007         (Incremental_inputs_header_data::data_size): New field.
8008         (Incremental_inputs_header_data::put_input_file_count): Renamed
8009         from input_file_count.
8010         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8011         from command_line_offset.
8012         (Incremental_inputs_header_data::put_reserved): Renamed from
8013         put_reserved.
8014         (Incremental_inputs_entry_data): Renamed from
8015         Incremental_input_entry_data.
8016         (Incremental_inputs_entry_data::data_size): New field.
8017         (Incremental_inputs::report_command_line): New method.
8018         (Incremental_inputs::finalize): New method.
8019         (Incremental_inputs::create_incremental_inputs_data): New method.
8020         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8021         * incremental.h: New file.
8022         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8023        (Layout::finalize): Create incremental inputs section in
8024         incremental builds.
8025        (Layout::create_incremental_info_sections): New method.
8026         * layout.h (Layout::incremental_inputs): New method.
8027        (Layout::create_incremental_info_sections): New method.
8028        (Layout::incremental_inputs_): New field.
8029         * main.cc (main): Notify Incremental_input of the command line.
8030
8031 2009-04-01  Ian Lance Taylor  <iant@google.com>
8032             Mikolaj Zalewski  <mikolajz@google.com>
8033
8034         * gold.h (reserve_unordered_map): Define, three versions, one for
8035         each version of Unordered_map.
8036         * layout.cc (Layout::Layout): Remove options parameter.  Add
8037         number_of_input_files parameter.  Don't initialize options_.
8038         Initialize number_of_input_files_ and resized_signatures_.  Move
8039         sections_are_attached_.
8040         (Layout::layout_group): Reserve space for group_signatures_.
8041         (Layout::find_or_add_kept_section): Change name parameter to be a
8042         reference.  Resize signatures_ map when it gets large enough.
8043         (Layout::layout_eh_frame): Use parameters->options() instead of
8044         this->options_.
8045         (Layout::make_output_section): Likewise.
8046         (Layout::attach_allocated_section_to_segment): Likewise.
8047         (Layout::finalize, Layout::create_executable_stack): Likewise.
8048         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8049         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8050         * layout.h (class Layout): Update declarations.  Remove options_
8051         field.  Add number_of_input_files_ and resized_signatures_
8052         fields.  Move sections_are_attached_ field.
8053         * main.cc (main): Pass number of input files to Layout
8054         constructor.  Don't pass options.
8055
8056 2009-03-30  Ian Lance Taylor  <iant@google.com>
8057
8058         * ffsll.c (ffsll): Correct implementation.
8059
8060 2009-03-27  Ian Lance Taylor  <iant@google.com>
8061
8062         * ffsll.c: New file.
8063         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8064         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8065         * ftruncate.c (ftruncate): Declare before definition.
8066         * mremap.c (mremap): Likewise.
8067         * pread.c (pread): Likewise.
8068         * configure, Makefile.in, config.in: Rebuild.
8069
8070         * mremap.c: New file.
8071         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8072         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8073         (mremap): Declare if HAVE_MREMAP is not defined.
8074         * configure, Makefile.in, config.in: Rebuild.
8075
8076 2009-03-27  Cary Coutant  <ccoutant@google.com>
8077
8078         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8079         position independent.
8080         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8081         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8082
8083 2009-03-24  Cary Coutant  <ccoutant@google.com>
8084
8085         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8086         an executable.
8087         (needs_dynamic_reloc): Likewise.
8088
8089 2009-03-24  Ian Lance Taylor  <iant@google.com>
8090
8091         * yyscript.y (file_cmd): Recognize EXTERN.
8092         (extern_name_list, extern_name_list_body): New nonterminals.
8093         * script.cc (script_add_extern): Define.
8094         * script-c.h (script_add_extern): Declare.
8095
8096 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8097
8098         * object.cc (is_elf_object): Define.
8099         * object.h (is_elf_object): Declare.
8100         * archive.cc (Archive::get_elf_object_for_member): Call
8101         is_elf_object.
8102         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8103
8104 2009-03-24  Elliott Hughes  <enh@google.com>
8105
8106         * output.cc (Output_file::map_anonymous): Define.
8107         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8108         try an anonymous one.  Report the size if the mmap fails.
8109         * output.h (class Output_file): Declare map_anonymous.
8110
8111 2009-03-24  Ian Lance Taylor  <iant@google.com>
8112
8113         * target-select.cc (instantiate_target): Don't acquire the lock if
8114         the instantiated_target_ field has already been set.
8115
8116 2009-03-23  Ian Lance Taylor  <iant@google.com>
8117
8118         * gold-threads.h (class Initialize_lock): Define.
8119         * gold-threads.cc (class Initialize_lock_once): Define.
8120         (initialize_lock_control): New static variable.
8121         (initialize_lock_pointer): New static variable.
8122         (initialize_lock_once): New static function.
8123         (Initialize_lock::Initialize_lock): Define.
8124         (Initialize_lock::initialize): Define.
8125         * target-select.h: Include "gold-threads.h".
8126         (class Target_selector): Add lock_ and initialize_lock_ fields.
8127         Don't define instantiate_target, just declare it.
8128         * target-select.cc (Target_selector::Target_selector): Initialize
8129         new fields.
8130         (Target_selector::instantiate_target): Define.
8131         * descriptors.h: Include "gold-threads.h".
8132         (class Descriptors): Add initialize_lock_ field.
8133         * descriptors.cc (Descriptors::Descriptors): Initialize new
8134         field.
8135         (Descriptors::open): Use initialize_lock_ field
8136         * errors.h (class Errors): Add initialize_lock_ field.
8137         * errors.cc (Errors::Errors): Initialize new field.
8138         (Errors::initialize_lock): Use initialize_lock_ field.
8139         * powerpc.cc (class Target_selector_powerpc): Remove
8140         instantiated_target_ field.  In do_recognize call
8141         instantiate_target rather than do_instantiate_target.  In
8142         do_instantiate_target just allocate a new target.
8143         * sparc.cc (class Target_selector_sparc): Likewise.
8144
8145         * freebsd.h: New file.
8146         * i386.cc: Include "freebsd.h".
8147         (Target_i386): Derive from Target_freebsd rather than
8148         Sized_target.
8149         (Target_selector_i386): Derive from Target_selector_freebsd rather
8150         than Target_selector.
8151         * x86_64.cc: Include "freebsd.h".
8152         (Target_x86_64): Derive from Target_freebsd rather than
8153         Sized_target.
8154         (Target_selector_x86_64): Derive from Target_selector_freebsd
8155         rather than Target_selector.
8156         * target.h (class Target): Add adjust_elf_header and
8157         do_adjust_elf_header.
8158         * output.cc (Output_file_header:: do_sized_write): Call target
8159         adjust_elf_header routine.
8160         * configure.tgt: Set targ_osabi.
8161         * configure.ac: Define GOLD_DEFAULT_OSABI.
8162         * parameters.cc (Parameters::default_target): Pass
8163         GOLD_DEFAULT_OSABI to select_target.
8164         * target-select.h (class Target_selector): Make instantiate_target
8165         protected rather than private.
8166         * Makefile.am (HFILES): Add freebsd.h.
8167         * configure, Makefile.in, config.in: Rebuild.
8168
8169         * merge.cc (do_add_input_section): Correct pend value.  Change
8170         message about last entry not being null terminated from error to
8171         warning.
8172
8173 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8174
8175         * incremental.cc: New file.
8176         * Makefile.am (CCFILES): Add incremental.cc.
8177         * Makefile.in: Rebuild.
8178
8179 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8180
8181         * layout.cc (Layout::output_section_name): Preserve names
8182         of '.note.' sections.
8183
8184 2009-03-19  Ian Lance Taylor  <iant@google.com>
8185
8186         * descriptors.cc (Descriptors::open): Check that the options are
8187         valid before using them.
8188
8189 2009-03-18  Ian Lance Taylor  <iant@google.com>
8190
8191         * script-sections.h: Include <list>.
8192         (class Script_sections): Change Sections_elements from std::vector
8193         to std::list.  Typedef public Elements_iterator.  Add
8194         orphan_section_placement_, data_segment_align_start_, and
8195         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8196         field.
8197         * script-sections.cc (class Orphan_section_placement): New class.
8198         (class Sections_element): Add virtual functions is_relro and
8199         orphan_section_init.  Remove virtual function place_orphan_here.
8200         (class Output_section_definition): Add is_relro and
8201         orphan_section_init.  Remove place_orphan_here.
8202         (class Orphan_output_section): Likewise.
8203         (Script_sections::Script_sections): Update for field changes.
8204         (Script_sections::data_segment_align): Set saw_data_segment_align_
8205         and data_segment_align_start_, not data_segment_align_index.
8206         (Script_sections::data_segment_relro_end): Check
8207         saw_data_segment_align_.  Use data_segment_align_start_ rather
8208         than data_segment_align_index_.
8209         (Script_sections::place_orphan): Rewrite to use
8210         Orphan_section_placement.
8211
8212 2009-03-17  Ian Lance Taylor  <iant@google.com>
8213
8214         * archive.cc (Archive::add_symbols): Check for a version attached
8215         to the symbol name in the archive map.
8216         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8217         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8218         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8219         (ver_test_11.a): New target.
8220         * testsuite/Makefile.in: Rebuild.
8221
8222         * configure.ac: Check for chsize and posix_fallocate.  Replace
8223         ftruncate.
8224         * ftruncate.c: New file, from gnulib.
8225         * output.cc (posix_fallocate): Define dummy version if not
8226         HAVE_POSIX_FALLOCATE.
8227         (Output_file::map): Call posix_fallocate rather than lseek and
8228         write.
8229         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8230         * configure, Makefile.in, config.in: Rebuild.
8231
8232 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8233
8234         * layout.h (Layout::create_note): Add section_name parameter.
8235         * layout.cc (Layout::create_note): Likewise.
8236         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8237
8238 2009-03-17  Ian Lance Taylor  <iant@google.com>
8239
8240         * descriptors.cc: Include "options.h".
8241         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8242         (Descriptors::open): Always use O_CLOEXEC when opening a new
8243         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8244         then set FD_CLOEXEC.
8245
8246         * sparc.cc (class Target_sparc): Add has_got_section.
8247         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8248         make sure we have a GOT section.
8249
8250         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8251         (Target_sparc::Scan::local): Likewise.
8252         (Target_sparc::Scan::global): Likewise.
8253         (Target_sparc::Relocate::relocate): Likewise.
8254         (Target_sparc::Relocate::relocate_tls): Likewise.
8255
8256         * symtab.cc (Symbol_table::define_default_version): New function,
8257         broken out of add_from_object.
8258         (Symbol_table::add_from_object): Call define_default_version.
8259         (Symbol_table::define_special_symbol): Add resolve_oldsym
8260         parameter.  Change all callers.  If the version for a symbol comes
8261         from a version script, resolve it with the symbol with the same
8262         name with no version.  Also add the symbol without a version if
8263         appropriate.
8264         (do_define_in_output_data): If resolving with oldsym, don't delete
8265         sym.
8266         (do_define_in_output_segment): Likewise.
8267         (do_define_as_constant): Likewise.
8268         * symtab.h (class Symbol_table): Update declarations.
8269
8270 2009-03-13  Ian Lance Taylor  <iant@google.com>
8271
8272         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8273         (Read_symbols::requeue): New function.
8274         (Read_symbols::do_read_symbols): If make_elf_object fails because
8275         the target type is not configured, and the file was searched for,
8276         issue a warning and retry with the next directory.
8277         (Add_symbols::run): If the file has an incompatible format, and
8278         it was searched for, requeue the Read_symbols task.  On error,
8279         release the object.
8280         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8281         dirindex parameter to constructor.  Change all callers.  Declare
8282         incompatible_warning and requeue.
8283         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8284         input_argument_ and input_group_ fields.  Add them to
8285         constructor.  Change all callers.
8286         (class Read_script): Add dirindex_ field.  Add it to constructor.
8287         Change all callers.
8288         * archive.cc (Archive::setup): Remove input_objects parameter.
8289         Change all callers.
8290         (Archive::get_file_and_offset): Likewise.
8291         (Archive::read_all_symbols): Likewise.
8292         (Archive::read_symbols): Likewise.
8293         (Archive::get_elf_object_for_member): Remove input_objects
8294         parameter.  Add punconfigured parameter.  Change all callers.
8295         (Archive::add_symbols): Change return type to bool.  Check return
8296         value of include_member.
8297         (Archive::include_all_members): Likewise.
8298         (Archive::include_member): Change return type to bool.  Return
8299         false if first included object has incompatible target.  Set
8300         included_member_ field.
8301         (Add_archive_symbols::run): If add_symbols returns false, requeue
8302         Read_symbols task.
8303         * archive.h (class Archive): Add included_member_ field.
8304         Initialize it in constructor.  Add input_file and searched_for
8305         methods.  Update declarations.
8306         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8307         input_argument_ fields.  Add them to constructor.  Change all
8308         callers.
8309         * script.cc: Include "target-select.h".
8310         (class Parser_closure): Add skip_on_incompatible_target_ and
8311         found_incompatible_target_ fields.  Add
8312         skip_on_incompatible_target parameter to constructor.  Change all
8313         callers.  Add methods skip_on_incompatible_target,
8314         clear_skip_on_incompatible_target, found_incompatible_target, and
8315         set_found_incompatible_target.
8316         (read_input_script): Add dirindex parameter.  Change all callers.
8317         If parser finds an incompatible target, requeue Read_symbols
8318         task.
8319         (script_set_symbol): Clear skip_on_incompatible_target in
8320         closure.
8321         (script_add_assertion, script_parse_option): Likewise.
8322         (script_start_sections, script_add_phdr): Likewise.
8323         (script_check_output_format): New function.
8324         * script.h (read_input_script): Update declaration.
8325         * script-c.h (script_check_output_format): Declare.
8326         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8327         (ignore_cmd): Remove OUTPUT_FORMAT.
8328         * fileread.cc (Input_file::Input_file): Add explicit this.
8329         (Input_file::will_search_for): New function.
8330         (Input_file::open): Add pindex parameter.  Change all callers.
8331         * fileread.h (class Input_file): Add input_file_argument method.
8332         Declare will_search_for.  Update declarations.
8333         * object.cc (make_elf_object): Add punconfigured parameter.
8334         Change all callers.
8335         * object.h (class Object): Make input_file public.  Add
8336         searched_for method.
8337         (make_elf_object): Update declaration.
8338         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8339         restart search.
8340         * dirsearch.h (class Dirsearch): Update declaration.
8341         * options.h (class General_options): Add --warn-search-mismatch.
8342         * parameters.cc (Parameters::is_compatible_target): New function.
8343         * parameters.h (class Parameters): Declare is_compatible_target.
8344         * workqueue.cc (Workqueue::add_blocker): New function.
8345         * workqueue.h (class Workqueue): Declare add_blocker.
8346
8347         * fileread.cc (Input_file::open): Remove options parameter.
8348         Change all callers.
8349         (Input_file::open_binary): Likewise.
8350         * script.cc (read_input_script): Likewise.
8351         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8352         options parameter from constructor.  Change all callers.
8353         (class Read_script): Likewise.
8354         * fileread.h (class Input_file): Update declarations.
8355         * script.h (read_input_script): Update declaration.
8356
8357 2009-03-10  Nick Clifton  <nickc@redhat.com>
8358
8359         * po/es.po: New Spanish translation.
8360
8361 2009-03-06  Cary Coutant  <ccoutant@google.com>
8362
8363         * options.cc (parse_short_option): Keep dash_z from registering itself.
8364
8365 2009-03-03  Ian Lance Taylor  <iant@google.com>
8366
8367         PR 9918
8368         * target-reloc.h (relocate_section): Pass output_section to
8369         relocate.
8370         * i386.cc (Target_i386::should_apply_static_reloc): Add
8371         output_section parameter.  Change all callers.
8372         (Target_i386::Relocate::relocate): Add output_section parameter.
8373         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8374         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8375         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8376         * testsuite/two_file_shared.sh: New script.
8377         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8378         (check_DATA): Add two_file_shared.dbg.
8379         (two_file_shared.dbg): New target.
8380         * testsuite/Makefile.in: Rebuild.
8381
8382 2009-03-01  Ian Lance Taylor  <iant@google.com>
8383
8384         * configure.ac: Check for byteswap.h.
8385         * configure: Rebuild.
8386         * config.in: Rebuild.
8387
8388 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8389
8390         * layout.cc (Layout::find_or_add_kept_section): New function.
8391         (Layout::add_comdat): Removed.
8392         * layout.h (struct Kept_section): Move out of class Layout.
8393         Remove trailing underscores from field names.  Add group_sections
8394         field.  Rename group_ field to is_group.  Change all uses.
8395         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8396         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8397         comdat_groups_ field.
8398         (Sized_relobj::include_section_group): Use
8399         find_or_add_kept_section and Kept_section::group_sections.
8400         (Sized_relobj::include_linkonce_section): Likewise.
8401         * object.cc (class Sized_relobj): Don't define Comdat_group or
8402         Comdat_group_table.  Remove find_comdat_group and
8403         add_comdat_group.  Remove comdat_groups_ field.
8404         * plugin.cc (include_comdat_group): Use
8405         Layout::find_or_add_kept_section.
8406
8407 2009-02-28  Ian Lance Taylor  <iant@google.com>
8408
8409         * README: --gc-sections and map files are now supported.  Document
8410         some build requirements.
8411
8412         PR 6992
8413         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8414         relocatable link set the value of the section symbol to zero.
8415         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8416         relocatable link don't include the section address in the local
8417         symbol value.
8418
8419 2009-02-27  Ian Lance Taylor  <iant@google.com>
8420
8421         PR 6811
8422         * options.h (class Search_directory): Add is_system_directory.
8423         (class General_options): Declare is_in_system_directory.
8424         * options.cc (get_relative_sysroot): Make static.
8425         (get_default_sysroot): Make static.
8426         (General_optoins::is_in_system_directory): New function.
8427         * fileread.cc (Input_file::is_in_system_directory): New function.
8428         * fileread.h (class Input_file): Declare is_in_system_directory.
8429         * object.h (class Object): Add is_in_system_directory.
8430         (class Input_objects): Remove system_library_directory_ field.
8431         * object.cc (Input_objects::add_object): Don't set
8432         system_library_directory_.
8433         (input_objects::found_in_system_library_directory): Remove.
8434         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8435         parameter.  Change all callers.
8436         (Symbol_table::sized_write_globals): Likewise.
8437         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8438         Call Object::is_in_system_directory.
8439         * symtab.h (class Symbol_table): Update declarations.
8440
8441         PR 5990
8442         * descriptors.h (Open_descriptor): Add is_on_stack field.
8443         * descriptors.cc (Descriptors::open): If the descriptor is on the
8444         top of the stack, remove it.  Initialize is_on_stack field.
8445         (Descriptors::release): Only add pod to stack if it is not on the
8446         stack already.
8447         (Descriptors::close_some_descriptor): Clear stack_next and
8448         is_on_stack fields.
8449
8450         PR 7091
8451         * output.cc (Output_section::find_starting_output_address): Rename
8452         from starting_output_address; add PADDR parameter; change return
8453         type.
8454         * output.h (class Output_section): Declare
8455         find_starting_output_address instead of starting_output_address.
8456         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8457         section symbol for which we can't find a merge section.
8458
8459         PR 9836
8460         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8461         hidden or internal, force the symbol to be local.
8462         * resolve.cc (Symbol::override_visibility): Define.
8463         (Symbol::override_base): Use override_visibility.
8464         (Symbol_table::resolve): Likewise.
8465         (Symbol::override_base_with_special): Likewise.
8466         (Symbol_table::override_with_special): If the visibility is hidden
8467         or internal, force the symbol to be local.
8468         * symtab.h (class Symbol): Add set_visibility and
8469         override_visibility.
8470         * testsuite/ver_test_1.sh: New file.
8471         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8472         (check_DATA): Add ver_test_1.syms.
8473         (ver_test_1.syms): New target.
8474         * testsuite/Makefile.in: Rebuild.
8475
8476 2009-02-25  Cary Coutant  <ccoutant@google.com>
8477
8478         * layout.cc (Layout::choose_output_section): Don't rename sections
8479         when using a linker script that has a SECTIONS clause.
8480         * Makefile.in: Regenerate.
8481
8482         * testsuite/Makefile.am (script_test_5.sh): New test case.
8483         * testsuite/Makefile.in: Regenerate.
8484         * testsuite/script_test_5.cc: New file.
8485         * testsuite/script_test_5.sh: New file.
8486         * testsuite/script_test_5.t: New file.
8487
8488 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8489
8490         * archive.cc (Archive::include_member): Update calls to add_symbols.
8491         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8492         the Layout argument.
8493         * dynobj.h (do_add_symbols): Add the Layout argument.
8494         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8495         Layout argument.
8496         * object.h (Object::add_symbols): Add the Layout argument.
8497         (Object::do_add_symbols): Add the Layout argument.
8498         (Sized_relobj::do_add_symbols): Add the Layout argument.
8499         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8500         Unify the two versions.
8501         (Add_plugin_symbols): Remove.
8502         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8503         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8504         (Add_plugin_symbols): Remove.
8505         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8506         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8507         (Add_symbols::run): Make it work with Pulginobj.
8508
8509 2009-02-06  Ian Lance Taylor  <iant@google.com>
8510
8511         * object.cc (Sized_relobj::do_layout): Make info message start
8512         with lower case letter.
8513
8514 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8515
8516         * binary.cc: Fix file comment.
8517
8518         * options.h (enum Incremental_disposition): Define.
8519         (class General_options): Add new options: --incremental,
8520         --incremental_changed, --incremental_unchanged,
8521         --incremental_unknown.  Add incremental_disposition_ and
8522         implicit_incremental_ fields.
8523         (General_options::incremental_disposition): New function.
8524         (class Position_dependent_options): Add incremental_disposition
8525         option.
8526         (Position_dependent_options::copy_from_options): Set incremental
8527         dispositions.
8528         * options.cc (General_options::parse_incremental_changed): New
8529         function.
8530         (General_options::parse_incremental_unchanged): New function.
8531         (General_options::parse_incremental_unknown): New function.
8532         (General_options::General_options): Initialize new fields
8533         incremental_disposition_ and implicit_incremental_.
8534         (General_options::finalize): Check for uasge of --incremental-*
8535         without --incremental.
8536
8537 2009-02-06  Chris Demetriou  <cgd@google.com>
8538
8539         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8540         pointer and to report location as the file name associated with
8541         the symbol.
8542         (gold_undefined_symbol_at_location): New function to replace the
8543         old gold_undefined_symbol functionality.
8544         * target-reloc.h (relocate_section): Update to use
8545         gold_undefined_symbol_at_location.
8546         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8547         Call gold_undefined_symbol function rather than gold_error.
8548         * errors.h (Errors::undefined_symbol): Take location as a
8549         string, rather than calculating it from a relocation.
8550         * errors.cc (Errors::fatal): Print "fatal error:" before the
8551         formatted message.
8552         (Errors::error, Errors::error_at_location): Print "error: "
8553         before the formatted message.
8554         (Errors::undefined_symbol): Take location as a string, rather
8555         than calculating it from a relocation.
8556         (gold_undefined_symbol_at_location): New function akin to
8557         old gold_undefined_symbol, calculates location from relocation.
8558         (gold_undefined_symbol): Change to take only a Symbol pointer
8559         and to report location as the file name associated with the symbol.
8560         * testsuite/debug_msg.sh: Update for changed error messages.
8561         * testsuite/undef_symbol.sh: Likewise.
8562
8563 2009-02-04  Duncan Sands  <baldrick@free.fr>
8564
8565         PR 9812
8566         * reduced_debug_output.h
8567         (Output_reduced_debug_abbrev_section::failed): Use format for
8568         gold_warning.
8569         (Output_reduced_debug_info_section::faild): Likewise.
8570
8571 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8572
8573         * script.cc (Lazy_demangler): New class.
8574         (Version_script_info::get_symbol_version_helper): Demangle a
8575         symbol only once.
8576
8577 2009-01-29  Cary Coutant  <ccoutant@google.com>
8578
8579         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8580         to __tls_get_addr.
8581         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8582
8583 2009-01-28  Ian Lance Taylor  <iant@google.com>
8584
8585         * version.cc (version_string): Bump to 1.9.
8586
8587         * gold.h: Include <cstring> and <stdint.h>.
8588         * version.cc: Include <cstdio>.
8589         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8590         warning.
8591         * reduced_debug_output.cc (insert_into_vector): Rename from
8592         Insert_into_vector; change all callers.  Use Swap_unaligned to
8593         avoid aliasing issue; remove union since it is unnecessary.
8594
8595 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8596
8597         * Makefile.am (CCFILES): Add gc.cc.
8598         (HFILES): Add gc.h.
8599         * Makefile.in: Regenerate.
8600         * gold.cc (Gc_runner): New class.
8601         (queue_initial_tasks): Call garbage collection related tasks
8602         when corresponding options are invoked.
8603         (queue_middle_gc_tasks): New function.
8604         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8605         processed early before laying out sections during garbage collection.
8606         * gold.h (queue_middle_gc_tasks): New function.
8607         (is_prefix_of): Move from "layout.cc".
8608         * i386.cc (Target_i386::gc_process_relocs): New function.
8609         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8610         * main.cc (main): Create object of class "Garbage_collection".
8611         * object.cc (Relobj::copy_symbols_data): New function.
8612         (Relobj::is_section_name_included): New function.
8613         (Sized_relobj::do_layout): Allow this function to be called twice
8614         during garbage collection and defer layout of section during the
8615         first call.
8616         * object.h (Relobj::get_symbols_data): New function.
8617         (Relobj::is_section_name_included): New function.
8618         (Relobj::copy_symbols_data): New function.
8619         (Relobj::set_symbols_data): New function.
8620         (Relobj::get_relocs_data): New function.
8621         (Relobj::set_relocs_data): New function.
8622         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8623         (Relobj::gc_process_relocs): New function.
8624         (Relobj::do_gc_process_relocs): New pure virtual function.
8625         (Relobj::sd_): New data member.
8626         (Sized_relobj::is_output_section_offset_invalid): New function.
8627         (Sized_relobj::do_gc_process_relocs): New function.
8628         * options.h (General_options::gc_sections): Modify to not be a no-op.
8629         (General_options::print_gc_sections): New option.
8630         * plugin.cc (Plugin_finish::run): Remove function call to
8631         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8632         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8633         * reloc.cc (Read_relocs::run): Add task to process relocs and
8634         determine unreferenced sections when doing garbage collection.
8635         (Gc_process_relocs): New class.
8636         (Sized_relobj::do_gc_process_relocs): New function.
8637         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8638         sections that are garbage collected.
8639         * reloc.h (Gc_process_relocs): New class.
8640         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8641         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8642         symbols whose corresponding sections are garbage collected.
8643         (Symbol_table::Symbol_table): Add new parameter for the garbage
8644         collection object.
8645         (Symbol_table::gc_mark_undef_symbols): New function.
8646         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8647         (Symbol_table::gc_mark_dyn_syms): New function.
8648         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8649         as garbage.
8650         (Symbol_table::add_from_object): Likewise.
8651         (Symbol_table::add_from_relobj): When building shared objects, do not
8652         treat externally visible symbols as garbage.
8653         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8654         table information for static and relocatable links.
8655         * symtab.h (Symbol_table::set_gc): New function.
8656         (Symbol_table::gc): New function.
8657         (Symbol_table::gc_mark_undef_symbols): New function.
8658         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8659         (Symbol_table::gc_mark_dyn_syms): New function.
8660         (Symbol_table::gc_): New data member.
8661         * target.h (Sized_target::gc_process_relocs): New pure virtual
8662         function.
8663         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8664         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8665
8666 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8667
8668         * options.h (General_options::gc_sections): Define as a no-op for now.
8669         (General_options::no_keep_memory): Ditto.
8670         (General_options::Bshareable): Define.
8671         * options.cc (General_options::finalize): Honor -Bshareable.
8672
8673 2009-01-20  Andreas Schwab  <schwab@suse.de>
8674
8675         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8676         read the value in the contents, since we don't use it.  Use the
8677         template endianness when writing.
8678         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8679
8680 2009-01-19  Andreas Schwab  <schwab@suse.de>
8681
8682         * configure.tgt (powerpc64-*): Fix targ_obj.
8683
8684 2009-01-15  Ian Lance Taylor  <iant@google.com>
8685
8686         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8687         local symbols when stripping all symbols.
8688
8689 2009-01-14  Cary Coutant  <ccoutant@google.com>
8690
8691         * output.cc (Output_reloc): Add explicit instantiations.
8692
8693 2009-01-14  Cary Coutant  <ccoutant@google.com>
8694
8695         * archive.cc (Archive::get_elf_object_for_member): Remove call
8696         to File_read::claim_for_plugin.
8697         * descriptors.cc (Descriptors::open): Remove reference to
8698         is_claimed.
8699         (Descriptors::claim_for_plugin): Remove.
8700         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8701         (Descriptors::is_claimed): Remove.
8702         (claim_descriptor_for_plugin): Remove.
8703         * fileread.cc (File_read::claim_for_plugin): Remove.
8704         * fileread.h (File_read::claim_for_plugin): Remove.
8705         (File_read::descriptor): Reopen descriptor if necessary.
8706         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8707         (Plugin_manager::all_symbols_read): Add task parameter. Change
8708         all callers.
8709         (Plugin_manager::get_input_file): New function.
8710         (Plugin_manager::release_input_file): New function.
8711         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8712         corresponding data member.
8713         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8714         and pass to base constructor. Change all callers.
8715         (get_input_file, release_input_file): New functions.
8716         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8717         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8718         (Plugin_manager::all_symbols_read): Add task parameter.
8719         (Plugin_manager::get_input_file): New function.
8720         (Plugin_manager::release_input_file): New function.
8721         (Plugin_manager::task_): New data member.
8722         (Pluginobj::Pluginobj): Add filesize parameter.
8723         (Pluginobj::filename): New function.
8724         (Pluginobj::descriptor): New function.
8725         (Pluginobj::filesize): New function.
8726         (Pluginobj::filesize_): New data member.
8727         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8728         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8729         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8730
8731         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8732         with archive libraries.
8733         * testsuite/Makefile.in: Regenerate.
8734         * testsuite/plugin_test.c (struct sym_info): New type.
8735         (get_input_file, release_input_file): New static variables.
8736         (onload): Capture new transfer vector entries.
8737         (claim_file_hook): Stop reading at end of file according to filesize.
8738         Factor out parsing of readelf output into separate function.
8739         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8740         APIs and get the source file name from the symbol table.  Convert
8741         source file name to corresponding object file name.  Print info
8742         message when adding new input files.
8743         (parse_readelf_line): New function.
8744         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8745         * testsuite/plugin_test_2.sh: Likewise.
8746         * testsuite/plugin_test_3.sh: Likewise.
8747         * testsuite/plugin_test_4.sh: New test case.
8748
8749 2009-01-07  Ian Lance Taylor  <iant@google.com>
8750
8751         * version.cc (version_string): Bump to 1.8.
8752
8753 2008-12-23  Cary Coutant  <ccoutant@google.com>
8754
8755         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8756         * plugin.cc (Plugin_manager::finish): Rename as
8757         layout_deferred_objects.  Move cleanup to separate function.
8758         (Plugin_manager::cleanup): New function.
8759         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8760         separately.
8761         * plugin.h (Plugin_manager::finish): Rename as
8762         layout_deferred_objects.
8763         (Plugin_manager::cleanup): New function.
8764         (Plugin_manager::cleanup_done): New field.
8765
8766 2008-12-23  Cary Coutant  <ccoutant@google.com>
8767
8768         * plugin.cc (is_visible_from_outside): New function.
8769         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8770         so we don't return "IR only" status for exported symbols or -r links.
8771
8772         * testsuite/Makefile.am (plugin_test_3): New test case.
8773         * testsuite/Makefile.in: Regenerate.
8774         * testsuite/plugin_test_3.sh: New file.
8775
8776 2008-12-22  Cary Coutant  <ccoutant@google.com>
8777
8778         * object.cc (Sized_relobj::layout_section): New function.
8779         (Sized_relobj::do_layout): Defer layout of input sections until after
8780         plugin has provided replacement files.
8781         (Sized_relobj::do_layout_deferred_sections): New function.
8782         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8783         (Relobj::layout_deferred_sections): New function.
8784         (Relobj::do_layout_deferred_sections): New function.
8785         (Sized_relobj::do_layout_deferred_sections): New function.
8786         (Sized_relobj::layout_section): New function.
8787         (Sized_relobj::Deferred_layout): New structure.
8788         (Sized_relobj::deferred_layout_): New field.
8789         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8790         Change all callers.  Layout deferred sections.
8791         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8792         references.
8793         (Plugin_hook::run): Move code from do_plugin_hook inline.
8794         (Plugin_hook::do_plugin_hook): Remove.
8795         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8796         (Plugin_manager::finish): Renamed, was cleanup.
8797         (Plugin_manager::should_defer_layout): New function.
8798         (Plugin_manager::add_deferred_layout_object): New function.
8799         (Plugin_manager::Deferred_layout_list): New type.
8800         (Plugin_manager::deferred_layout_objects_): New field.
8801         (Plugin_hook::do_plugin_hook): Remove.
8802
8803 2008-12-17  Ian Lance Taylor  <iant@google.com>
8804
8805         * options.h (class General_options): Add --no case for
8806         --export-dynamic.
8807
8808 2008-12-16  Cary Coutant  <ccoutant@google.com>
8809
8810         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8811         vector.
8812         (Plugin_manager::claim_file): Create plugin object even if
8813         plugin did not call the add_symbols callback.
8814         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8815         asking for more symbols than were added.
8816         * testsuite/Makefile.am (plugin_test_1): Add test case with
8817         no global symbols.
8818         (empty.syms): New target.
8819         * testsuite/Makefile.in: Regenerate.
8820         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8821         message. Don't call add_symbols if no globals.
8822         (all_symbols_read_hook): Don't provide replacement for empty
8823         claimed file.
8824
8825 2008-12-12  Ian Lance Taylor  <iant@google.com>
8826
8827         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8828         r_type == 0 for a local symbol with r_sym == 0.
8829         (scan_relocatable_relocs): Pass r_sym to
8830         local_non_section_strategy.
8831         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8832         r_sym parameter.
8833
8834         * configure.ac: Update test for TLS descriptors: they are
8835         supported as of glibc 2.9.
8836         * configure: Rebuild.
8837
8838 2008-12-11  Ian Lance Taylor  <iant@google.com>
8839
8840         PR 7091
8841         * target-reloc.h (Default_scan_relocatable_relocs): For each
8842         function, map r_type == 0 to RELOC_DISCARD.
8843
8844 2008-12-10  Cary Coutant  <ccoutant@google.com>
8845
8846         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8847         object to override a kept COMDAT group from a plugin object.
8848
8849 2008-12-09  Ian Lance Taylor  <iant@google.com>
8850
8851         PR 7088
8852         * yyscript.y (file_cmd): Handle INPUT.
8853
8854         * testsuite/initpri1.c: Change all declarations to be full
8855         prototypes by adding void, to avoid compiler warnings.
8856
8857 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8858
8859         * options.cc (General_options::parse_plugin_opt): New.
8860         (General_options::add_plugin): The argument now is just the filename.
8861         (General_options::add_plugin_option): New.
8862         * options.h (plugin_opt): New.
8863         (add_plugin): Change argument name.
8864         (add_plugin_option): New.
8865         * plugin.cc (Plugin::load): Don't parse the plugin option.
8866         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8867         (Plugin::add_option): New.
8868         (Plugin::args_): Change type.
8869         (Plugin::filename_): New.
8870         (Plugin_manager::add_plugin_option): New.
8871         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8872         * testsuite/Makefile.in: Regenerate.
8873
8874 2008-12-05  Cary Coutant  <ccoutant@google.com>
8875
8876         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8877         Handle --strip-lto-sections option.
8878         * options.h (strip_lto_sections): New option.
8879
8880 2008-12-01  Cary Coutant  <ccoutant@google.com>
8881
8882         * plugin.cc (ld_plugin_message): Change format parameter to const.
8883         Fix mismatch between new[] and delete.
8884
8885 2008-11-14  Cary Coutant  <ccoutant@google.com>
8886
8887         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8888         instead of -1U.
8889
8890 2008-11-05  Craig Silverstein  <csilvers@google.com>
8891
8892         * options.cc (General_options::parse_dynamic_list): New function.
8893         * options.h (General_options): New flags dynamic_list,
8894         dynamic_list_data, dynamic_list_cpp_new, and
8895         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8896         (General_options::in_dynamic_list): New function.
8897         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8898         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8899         (Lex::can_continue_name): Likewise.
8900         (yylex): Likewise.
8901         (read_script_file): New parameter script_options.
8902         (read_dynamic_list): New function.
8903         (Script_options::define_dynamic_list): New function.
8904         (dynamic_list_keyword_parsecodes): New variable.
8905         (dynamic_list_keywords): New variable.
8906         * script.h (Script_options::define_dynamic_list): New function
8907         prototype.
8908         (read_dynamic_list): New function prototype.
8909         * symtab.cc (strprefix): New macro.
8910         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8911         dynamic_list_data, dynamic_list_cpp_new, and
8912         dynamic_list_cpp_typeinfo.
8913         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8914         (dynamic_list_expr): New rule.
8915         (dynamic_list_nodes): Likewise.
8916         (dynamic_list_node): Likewise.
8917         * testsuite/Makefile.am (dynamic_list): New test.
8918         * testsuite/Makefile.in: Regenerated.
8919         * testsuite/dynamic_list.t: New file.
8920         * testsuite/dynamic_list.sh: New file.
8921
8922 2008-11-05  Craig Silverstein  <csilvers@google.com>
8923
8924         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8925         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8926         (t11_last): Likewise.
8927         * testsuite/ver_test_6.c (main): Likewise.
8928
8929 2008-10-07  Cary Coutant  <ccoutant@google.com>
8930
8931         * options.c (General_options::finalize): Add check for -static and
8932         -shared.
8933         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8934         is not empty.
8935
8936 2008-10-02  Cary Coutant  <ccoutant@google.com>
8937
8938         * plugin.cc (make_sized_plugin_object): Fix conditional
8939         compilation to work when not all targets are enabled.
8940
8941 2008-09-29  Cary Coutant  <ccoutant@google.com>
8942
8943         * archive.cc (Archive::get_file_and_offset): Use filename instead
8944         of name to get library path.
8945         (Archive::include_member): Unlock external member of a thin archive.
8946
8947         * testsuite/Makefile.am (TEST_AR): New variable.
8948         (thin_archive_test_1): New test.
8949         (thin_archive_test_2): New test.
8950         * testsuite/Makefile.in: Regenerate.
8951         * testsuite/thin_archive_main.cc: New file.
8952         * testsuite/thin_archive_test_1.cc: New file.
8953         * testsuite/thin_archive_test_2.cc: New file.
8954         * testsuite/thin_archive_test_3.cc: New file.
8955         * testsuite/thin_archive_test_4.cc: New file.
8956
8957 2008-09-29  Cary Coutant  <ccoutant@google.com>
8958
8959         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8960         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8961         instead of -1U.
8962         (Sized_relobj::do_finalize_local_symbols): Likewise.
8963         (Sized_relobj::map_to_kept_section): Likewise.
8964         * object.h (Sized_relobj::invalid_address): New constant.
8965         (Sized_relobj::do_output_section_offset): Check for invalid_address
8966         and return -1ULL.
8967         * output.cc (Output_reloc::local_section_offset): Use constant
8968         invalid_address instead of -1U.
8969         (Output_reloc::get_address): Likewise.
8970         (Output_section::output_address): Change -1U to -1ULL.
8971         * output.h (Output_reloc::invalid_address): New constant.
8972         * reloc.cc (Sized_relobj::write_sections): Use constant
8973         invalid_address instead of -1U.
8974         (Sized_relobj::relocate_sections): Likewise.
8975         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8976         values for merge sections.
8977         * target-reloc.h (relocate_for_relocatable): Use constant
8978         invalid_address instead of -1U.
8979
8980 2008-09-19  Cary Coutant  <ccoutant@google.com>
8981
8982         Add plugin functionality for link-time optimization (LTO).
8983         * configure.ac (plugins): Add --enable-plugins option.
8984         * configure: Regenerate.
8985         * config.in: Regenerate.
8986         * Makefile.am (LIBDL): New variable.
8987         (CCFILES): Add plugin.cc.
8988         (HFILES): Add plugin.h.
8989         (ldadd_var): Add LIBDL.
8990         * Makefile.in: Regenerate.
8991
8992         * archive.cc: Include "plugin.h".
8993         (Archive::setup): Don't preread archive symbols when using a plugin.
8994         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8995         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8996         files.
8997         (Archive::include_member): Add symbols from plugin objects.
8998         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8999         * descriptors.cc (Descriptors::open): Check for file descriptors
9000         abandoned by plugins.
9001         (Descriptors::claim_for_plugin): New function.
9002         * descriptors.h (Descriptors::claim_for_plugin): New function.
9003         (Open_descriptor::is_claimed): New field.
9004         (claim_descriptor_for_plugin): New function.
9005         * fileread.cc (File_read::claim_for_plugin): New function.
9006         * fileread.h (File_read::claim_for_plugin): New function.
9007         (File_read::descriptor): New function.
9008         * gold.cc: Include "plugin.h".
9009         (queue_initial_tasks): Add task to call plugin hooks for generating
9010         new object files.
9011         * main.cc: Include "plugin.h".
9012         (main): Load plugin libraries.
9013         * object.h (Pluginobj): Declare.
9014         (Object::pluginobj): New function.
9015         (Object::do_pluginobj): New function.
9016         (Object::set_target): New function.
9017         * options.cc: Include "plugin.h".
9018         (General_options::parse_plugin): New function.
9019         (General_options::General_options): Initialize plugins_ field.
9020         (General_options::add_plugin): New function.
9021         * options.h (Plugin_manager): Declare.
9022         (General_options): Add --plugin option.
9023         (General_options::has_plugins): New function.
9024         (General_options::plugins): New function.
9025         (General_options::add_plugin): New function.
9026         (General_options::plugins_): New field.
9027         * plugin.cc: New file.
9028         * plugin.h: New file.
9029         * readsyms.cc: Include "plugin.h".
9030         (Read_symbols::do_read_symbols): Check for archive before checking
9031         for ELF file.  Call plugin hooks to claim files.
9032         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9033         from a real object file; force override when processing replacement
9034         files.
9035         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9036         (Symbol::init_base_object): Likewise.
9037         (Symbol::init_base_output_data): Likewise.
9038         (Symbol::init_base_output_segment): Likewise.
9039         (Symbol::init_base_constant): Likewise.
9040         (Symbol::init_base_undefined): Likewise.
9041         (Symbol::output_section): Assert that object is not a plugin.
9042         (Symbol_table::add_from_pluginobj): New function.
9043         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9044         undefined.
9045         (Symbol_table::sized_write_globals): Likewise.
9046         (Symbol_table::add_from_pluginobj): Instantiate template.
9047         * symtab.h (Sized_pluginobj): Declare.
9048         (Symbol::in_real_elf): New function.
9049         (Symbol::set_in_real_elf): New function.
9050         (Symbol::in_real_elf_): New field.
9051         (Symbol_table::add_from_pluginobj): New function.
9052
9053         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9054         (LIBDL): New variable.
9055         (LDADD): Add LIBDL.
9056         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9057         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9058         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9059         (MOSTLYCLEANFILES): Likewise.
9060         * testsuite/Makefile.in: Regenerate.
9061         * testsuite/plugin_test.c: New file.
9062         * testsuite/plugin_test_1.sh: New file.
9063         * testsuite/plugin_test_2.sh: New file.
9064
9065 2008-09-16  Ian Lance Taylor  <iant@google.com>
9066
9067         * target-reloc.h (relocate_section): Check whether a symbol is
9068         defined by the ABI before reporting an undefined symbol error.
9069         * target.h (Target::is_defined_by_abi): Make parameter const.
9070         (Target::do_is_defined_by_abi): Likewise.
9071         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9072         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9073         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9074         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9075         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9076         * testsuite/Makefile.in: Rebuild.
9077
9078         * fileread.cc (make_view): Add casts to avoid warning.
9079
9080 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9081
9082         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9083         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9084
9085 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9086
9087         * options.h (General_options::output_is_executable): New.
9088         (General_options::output_is_pie): New.
9089         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9090         for shared libraries.
9091         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9092
9093 2008-09-11  Chris Demetriou  <cgd@google.com>
9094
9095         * options.h (origin): New -z option.
9096         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9097         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9098         in DT_FLAGS_1.
9099
9100 2008-09-05  Cary Coutant  <ccoutant@google.com>
9101
9102         * fileread.cc (File_read::make_view): Add check for attempt to map
9103         beyond end of file.
9104
9105 2008-09-05  Cary Coutant  <ccoutant@google.com>
9106
9107         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9108         explicit instantiations.
9109
9110 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9111
9112         PR gold/6858
9113         * options.cc (General_options::finalize): Allow undefined symbols
9114         in shlibs if linking -shared.
9115
9116         PR gold/6859
9117         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9118         symbols as not needing a dynsym entry.
9119
9120 2008-08-20  Craig Silverstein  <csilvers@google.com>
9121
9122         * fileread.cc (File_read::open): Do not lock the file unless it
9123         was successfully opened.
9124
9125 2008-08-14  Cary Coutant  <ccoutant@google.com>
9126
9127         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9128         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9129         * testsuite/tls_test.cc (struct int128): 128-bit struct
9130         for testing TLS relocs with non-zero addend.
9131         (v12): New TLS variable.
9132         (t12): New test.
9133         (t_last): Add check for v12.
9134         * testsuite/tls_test.h (t12): New function.
9135         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9136
9137 2008-08-13  Ian Lance Taylor  <iant@google.com>
9138
9139         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9140         set tls_segment_ or relro_segment_.
9141         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9142         when appropriate.
9143         * output.h (Output_section::clear_is_relro): New function.
9144         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9145         sections specially even when output_data_ is empty.
9146         (Output_segment::maximum_alignment): When first section is relro,
9147         only force alignment for PT_LOAD segments.
9148         * script.cc (script_data_segment_align): New function.
9149         (script_data_segment_relro_end): New function.
9150         * script-c.h (script_data_segment_align): Declare.
9151         (script_data_segment_relro_end): Declare.
9152         * script-sections.h (class Script_sections): Declare
9153         data_segment_align and data_segment_relro_end.  Add fields
9154         segment_align_index_ and saw_relro_end_.
9155         * script-sections.cc (class Sections_element): Add set_is_relro
9156         virtual function.  Add new bool* parameter to place_orphan_here.
9157         Add get_output_section virtual function.
9158         (class Output_section_definition): Add set_is_relro.  Add new
9159         bool* parameter to place_orphan_here.  Add get_output_section.
9160         Add is_relro_ field.
9161         (Output_section_definition::Output_section_definition): Initialize
9162         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9163         and is_relro_ fields.
9164         (Output_section_definition::place_orphan_here): Add is_relro
9165         parameter.
9166         (Output_section_definition::set_section_addresses): Set relro for
9167         output section.
9168         (Output_section_definition::alternate_constraint): Likewise.
9169         (class Orphan_output_section): Add new bool* parameter to
9170         place_orphan_here.  Add get_output_section.
9171         (Orphan_output_section::place_orphan_here): Add is_relro
9172         parameter.
9173         (Script_sections::Script_sections): Initialize
9174         data_segment_align_index_ and saw_relro_end_.
9175         (Script_sections::data_segment_align): New function.
9176         (Script_sections::data_segment_relro_end): New function.
9177         (Script_sections::place_orphan): Set or clear is_relro.
9178         (Script_sections::set_section_addresses): Force alignment of first
9179         TLS section.
9180         * yyscript.y (exp): Call script_data_segment_align and
9181         script_data_segment_relro_end.
9182         * testsuite/relro_script_test.t: New file.
9183         * testsuite/relro_test.cc (using_script): Declare.
9184         (t1, t2): Test using_script.
9185         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9186         (relro_script_test_SOURCES): Define.
9187         (relro_script_test_DEPENDENCIES): Define.
9188         (relro_script_test_LDFLAGS): Define.
9189         (relro_script_test_LDADD): Define.
9190         (relro_script_test.so): New target.
9191         * testsuite/Makefile.in: Rebuild.
9192
9193 2008-08-06  Cary Coutant <ccoutant@google.com>
9194
9195         * archive.cc (Archive::total_archives, Archive::total_members)
9196         (Archive::total_members_loaded): New variables.
9197         (Archive::setup): Add parameter.  Add option to preread
9198         archive symbols.
9199         (Archive::read_armap): Add counter.
9200         (Archive::get_file_and_offset): New function.
9201         (Archive::get_elf_object_for_member): New function.
9202         (Archive::read_all_symbols): New function.
9203         (Archive::read_symbols): New function.
9204         (Archive::add_symbols): Add counters.
9205         (Archive::include_all_members): Use armap to find members if it's
9206         already built.
9207         (Archive::include_member): Skip reading symbols if already read.
9208         Factored code into Archive::get_file_and_offset and
9209         Archive::get_elf_object_for_member.  Changed call to
9210         Mapfile::report_include_archive_member.
9211         (Archive::print_stats): New function.
9212         * archive.h: Declare Object and Read_symbols_data classes.
9213         (Archive::Archive): Add initializers for new members.
9214         (Archive::setup): Add parameter.
9215         (Archive::print_stats): New function.
9216         (Archive::total_archives, Archive::total_members)
9217         (Archive::total_members_loaded): New variables.
9218         (Archive::get_file_and_offset): New function.
9219         (Archive::get_elf_object_for_member): New function.
9220         (Archive::read_all_symbols): New function.
9221         (Archive::read_symbols): New function.
9222         (Archive::Archive_member): New class.
9223         (Archive::members_): New member.
9224         (Archive::num_members_): New member.
9225         * main.cc: Include archive.h.
9226         (main): Call Archive::print_stats.
9227         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9228         archive parameter; member_name is now the fully-decorated name.
9229         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9230         * options.h: (General_options): Add --preread-archive-symbols option.
9231         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9232         Archive::setup.
9233
9234 2008-08-04  Ian Lance Taylor  <iant@google.com>
9235
9236         * symtab.h (Symbol::use_plt_offset): New function.
9237         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9238         * powerpc.cc (Relocate::relocate): Likewise.
9239         * sparc.cc (Relocate::relocate): Likewise.
9240         * x86_64.cc (Relocate::relocate): Likewise.
9241         * testsuite/weak_plt.sh: New test.
9242         * testsuite/weak_plt_main.cc: New test.
9243         * testsuite/weak_plt_shared.cc: New test.
9244         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9245         (check_PROGRAMS): Add weak_plt.
9246         (check_DATA): Add weak_plt_shared.so.
9247         (weak_plt_main_pic.o, weak_plt): New targets.
9248         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9249         * testsuite/Makefile.in: Rebuild.
9250
9251         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9252         gcctestdir/ld.
9253         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9254         * testsuite/Makefile.in: Rebuild.
9255
9256 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9257
9258         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9259         * Makefile.in: Regenerate.
9260         * po/POTFILES.in: Regenerate.
9261
9262 2008-07-29  Ian Lance Taylor  <iant@google.com>
9263
9264         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9265         symbols before other symbols.
9266         * testsuite/script_test_2.cc (test_addr): Declare.
9267         (test_addr_alias): Declare.
9268         (main): Check that test_addr and test_addr_alias have the right
9269         values.
9270         * testsuite/script_test_2.t: Define test_addr_alias and
9271         test_addr.
9272
9273 2008-07-24  Ian Lance Taylor  <iant@google.com>
9274
9275         PR 5990
9276         * descriptors.cc: New file.
9277         * descriptors.h: New file.
9278         * gold-threads.h (class Hold_optional_lock): New class.
9279         * fileread.cc: Include "descriptors.h".
9280         (File_read::~File_read): Release descriptor rather than closing
9281         it.
9282         (File_read::open) [file]: Call open_descriptor rather than open.
9283         Set is_descriptor_opened_.
9284         (File_read::open) [memory]: Assert that descriptor is not open.
9285         (File_read::reopen_descriptor): New function.
9286         (File_read::release): Release descriptor.
9287         (File_read::do_read): Make non-const.  Reopen descriptor.
9288         (File_read::read): Make non-const.
9289         (File_read::make_view): Reopen descriptor.
9290         (File_read::do_readv): Likewise.
9291         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9292         Update declarations.
9293         * layout.cc: Include "descriptors.h".
9294         (Layout::create_build_id): Use open_descriptor rather than open.
9295         * output.cc: Include "descriptors.h".
9296         (Output_file::open): Use open_descriptor rather than open.
9297         * archive.cc (Archive::const_iterator): Change Archive to be
9298         non-const.
9299         (Archive::begin, Archive::end): Make non-const.
9300         (Archive::count_members): Likewise.
9301         * archive.h (class Archive): Update declarations.
9302         * object.h (Object::read): Make non-const.
9303         * Makefile.am (CCFILES): Add descriptors.cc.
9304         (HFILES): Add descriptors.h.
9305         * Makefile.in: Rebuild.
9306
9307         PR 6716
9308         * gold.h: Always include <clocale>.  Add Solaris workarounds
9309         following code in binutils/sysdep.h.
9310
9311         PR 6048
9312         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9313         this->eh_frame_hdr_ is NULL before using it.
9314
9315         * dynobj.cc (Versions::Versions): Update comment.
9316
9317         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9318         the base version name.
9319
9320         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9321         array size plus one.
9322         (Stringpool_template::set_string_offsets): Subtract one from key
9323         before using it as an array index.
9324         (Stringpool_template::get_offset_with_length): Likewise.
9325         (Stringpool_template::write_to_buffer): Likewise.
9326         * stringpool.h (Stringpool_template::get_offset_from_key):
9327         Likewise.
9328
9329 2008-07-23  Ian Lance Taylor  <iant@google.com>
9330
9331         PR 6658
9332         * object.h (Merged_symbol_value::value): Do our best to handle a
9333         negative addend.
9334
9335         PR 6647
9336         * script.cc (Version_script_info::get_versions): Don't add empty
9337         version tag to return value.
9338         (Version_script_info::get_symbol_version_helper): Change return
9339         type to bool.  Add pversion parameter.  Change all callers.
9340         (script_register_vers_node): Don't require a non-NULL tag.
9341         * script.h (class Version_script_info): Update declarations.
9342         (Version_script_info::get_symbol_version): Change return type to
9343         bool.  Add version parameter.  Change all callers.
9344         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9345         handling.  Handle an empty version from a version script.
9346         (Symbol_table::define_special_symbol): Likewise.
9347         * testsuite/ver_test_10.script: New file.
9348         * testsuite/ver_test_10.sh: New file.
9349         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9350         (check_DATA): Add ver_test_10.syms.
9351         (ver_test_10.syms, ver_test_10.so): New target.
9352         * testsuite/Makefile.in: Rebuild.
9353
9354 2008-07-23  Simon Baldwin  <simonb@google.com>
9355
9356         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9357         to zero for undefined symbols from dynamic libraries.
9358
9359 2008-07-23  Ian Lance Taylor  <iant@google.com>
9360
9361         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9362         Change all callers.
9363         * symtab.h (class Symbol_table): Update declaration.
9364         * testsuite/ver_test_9.cc: New file.
9365         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9366         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9367         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9368         (ver_test_9.so, ver_test_9.o): New targets.
9369         * testsuite/Makefile.in: Rebuild.
9370
9371 2008-07-22  Ian Lance Taylor  <iant@google.com>
9372
9373         * options.h (class General_options): Define --check-sections.
9374         * layout.cc (Layout::set_segment_offsets): Handle
9375         --check-sections.
9376
9377         * options.h (class General_options): Define -n/--nmagic and
9378         -N/--omagic.
9379         * options.cc (General_options::finalize): For -n/--nmagic or
9380         -N/--omagic, set -static.
9381         * layout.cc (Layout::attach_allocated_section_to_segment): If
9382         -N/--omagic, don't put read-only and read-write sections in
9383         different segments.
9384         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9385         finding a read-only segment.
9386         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9387         don't set the minimum segment alignment to the common page size,
9388         and don't set the file offset to the address modulo the page size.
9389         * script-sections.cc (Script_sections::create_segments): If
9390         -n/--omagic, don't put read-only and read-write sections in
9391         different segments.
9392
9393         * cref.cc: New file.
9394         * cref.h: New file.
9395         * options.h (class General_options): Add --print-symbol-counts.
9396         * main.cc (main): Issue defined symbol report if requested.
9397         * archive.cc (Archive::interpret_header): Make into a const member
9398         function.
9399         (Archive::add_symbols): Call Input_objects::archive_start and
9400         archive_stop.
9401         (Archive::const_iterator): Define new class.
9402         (Archive::begin, Archive::end): New functions.
9403         (Archive::include_all_members): Rewrite to use iterator.
9404         (Archive::count_members): New function.
9405         * archive.h (class Archive): Update declarations.
9406         (Archive::filename): New function.
9407         * object.cc: Include "cref.h".
9408         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9409         (Sized_relobj::do_get_global_symbol_counts): New function.
9410         (Input_objects::add_object): Add object to cross-referencer.
9411         (Input_objects::archive_start): New function.
9412         (Input_objects::archive_stop): New function.
9413         (Input_objects::print_symbol_counts): New function.
9414         * object.h: Declare Cref and Archive.
9415         (Object::get_global_symbol_counts): New function.
9416         (Object::do_get_global_symbol_counts): New pure virtual function.
9417         (class Sized_relobj): Add defined_count_ field.  Update
9418         declarations.
9419         (class Input_objects): Add cref_ field.  Update constructor.
9420         Update declarations.
9421         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9422         defined_count_.
9423         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9424         symbol counts.
9425         (Sized_dynobj::do_get_global_symbol_counts): New function.
9426         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9427         defined_count_.  Update declarations.  Define Symbols typedef.
9428         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9429         parameter.  Change all callers.
9430         (Symbol_table::add_from_dynobj): Add sympointers and defined
9431         parameters.  Change all callers.
9432         * symtab.h (class Symbol_table): Update declarations.
9433         * Makefile.am (CCFILES): Add cref.cc.
9434         (HFILES): Add cref.h.
9435         * Makefile.in: Rebuild.
9436
9437 2008-07-22  Simon Baldwin  <simonb@google.com>
9438
9439         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9440         to zero when writing undefined symbols.
9441
9442 2008-07-22  Ian Lance Taylor  <iant@google.com>
9443
9444         * output.cc (Output_section::add_input_section): Don't try to
9445         merge empty merge sections.
9446
9447 2008-07-21  Craig Silverstein  <csilvers@google.com>
9448
9449         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9450         Include symbol version in error message.
9451
9452 2008-07-20  Chris Demetriou  <cgd@google.com>
9453
9454         * configure.ac (gold_cv_c_random_seed): New configured variable.
9455         (RANDOM_SEED_CFLAGS): New substituted variable.
9456         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9457         * configure: Rebuild.
9458         * Makefile.in: Likewise.
9459         * testsuite/Makefile.in: Likewise.
9460
9461 2008-07-18  Ian Lance Taylor  <iant@google.com>
9462
9463         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9464         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9465         * testsuite/ver_test_main.cc (main): Call t4.
9466         (t4, t4_2a): Define.
9467         * testsuite/ver_test_2.cc (t4_2): Define.
9468         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9469         * testsuite/ver_test_4.cc (t4_2a): Define.
9470         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9471         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9472
9473 2008-07-17  Ian Lance Taylor  <iant@google.com>
9474
9475         * dynobj.cc (Versions::add_def): If we give an error about a
9476         missing version, go ahead and create the version anyhow.
9477
9478 2008-07-10  Ian Lance Taylor  <iant@google.com>
9479
9480         Handle output sections with more than 0x7fffffff bytes.
9481         * object.h (class Relobj): Change map_to_output_ to
9482         output_sections_, and just keep a section pointer.  Change all
9483         uses.  Move comdat group support to Sized_relobj.
9484         (Relobj::is_section_specially_mapped): Remove.
9485         (Relobj::output_section): Remove poff parameter.  Change all
9486         callers.
9487         (Relobj::output_section_offset): New function.
9488         (Relobj::set_section_offset): Rewrite.
9489         (Relobj::map_to_output): Remove.
9490         (Relobj::output_sections): New function.
9491         (Relobj::do_output_section_offset): New pure virtual function.
9492         (Relobj::do_set_section_offset): Likewise.
9493         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9494         group support from Relobj.  Update declarations.
9495         (Sized_relobj::get_output_section_offset): New function.
9496         (Sized_relobj::do_output_section_offset): New function.
9497         (Sized_relobj::do_set_section_offset): New function.
9498         * object.cc (Relobj::output_section_address): Remove.
9499         (Sized_relobj::Sized_relobj): Initialize new fields.
9500         (Sized_relobj::include_section_group): Cast find_kept_object to
9501         Sized_relobj.
9502         (Sized_relobj::include_linkonce_section): Likewise.
9503         (Sized_relobj::do_layout): Use separate arrays for output section
9504         and output offset.
9505         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9506         output_sections.
9507         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9508         output_sections and section_offsets.
9509         (Sized_relobj::write_local_symbols): Likewise.
9510         (map_to_kept_section): Compute output address directly.
9511         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9512         output_sections and section_offsets.
9513         (Sized_relobj::write_sections): Likewise.
9514         (Sized_relobj::relocate_sections): Likewise.
9515         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9516         * output.h (class Output_reloc): Update declarations.  Change
9517         u2_.relobj to Sized_relobj*.
9518         (class Output_data_reloc): Change add functions to use
9519         Sized_relobj*.
9520         * output.cc (Output_reloc::Output_reloc): Change relobj to
9521         Sized_relobj*.
9522         (Output_reloc::local_section_offset): Change return type to
9523         Elf_Addr.  Use get_output_section_offset.
9524         (Output_reloc::get_address): Likewise.
9525         (Output_section::is_input_address_mapped): Don't call
9526         is_section_specially_mapped.
9527         (Output_section::output_offset): Likewise.
9528         (Output_section::output_address): Likewise.
9529         (Output_section::starting_output_address): Likewise.
9530         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9531         parameter to Sized_relobj*.
9532         (Copy_relocs::need_copy_reloc): Likewise.
9533         (Copy_relocs::save): Likewise.
9534         * copy-relocs.h (class Copy_relocs): Update declarations.
9535         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9536         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9537         * target-reloc.h (relocate_for_relocatable): Change
9538         offset_in_output_section type to Elf_Addr.  Change code that uses
9539         it as well.
9540         * layout.cc (Layout::layout): Always set *off.
9541         * mapfile.cc (Mapfile::print_input_section): Use
9542         output_section_offset.
9543         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9544         Sized_relobj*.
9545         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9546         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9547         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9548
9549 2008-07-03  Ian Lance Taylor  <iant@google.com>
9550
9551         * layout.cc (Layout::include_section): Do not discard unrecognized
9552         SHT_STRTAB sections.
9553
9554 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9555
9556         * script.cc (Lex::can_continue_name): Make '?' allowable in
9557         version-script names.
9558         * testsuite/version_script.map: Change glob pattern to use '?'
9559
9560 2008-06-30  Manish Singh  <yosh@gimp.org>
9561
9562         PR 6585
9563         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9564         Correct typo.
9565
9566 2008-06-30  Ian Lance Taylor  <iant@google.com>
9567
9568         PR 6660
9569         PR 6682
9570         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9571         versions]: Don't try to read the value in the contents, since we
9572         don't use it.  Use the template endianness when writing.
9573
9574 2008-06-25  Cary Coutant  <ccoutant@google.com>
9575
9576         * fileread.cc (File_read::make_view): Assert on zero-length view.
9577         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9578         symbol table when there are no symbols to read.
9579
9580 2008-06-23  Craig Silverstein  <csilvers@google.com>
9581
9582         * version.cc (version_string): Bump to 1.7
9583
9584 2008-06-18  Craig Silverstein  <csilvers@google.com>
9585
9586         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9587         constant 0xFFFF to type Valtype.
9588         (Powerpc_relocate_functions::rel16_ha): Likewise.
9589
9590 2008-06-17  Ian Lance Taylor  <iant@google.com>
9591
9592         * output.h (Output_section::Input_section): Initialize p2align_ to
9593         zero for Output_section_data constructors.
9594         (Output_section::Input_section::addralign): If not an input
9595         section, return the alignment of the Output_section_data.
9596         * testsuite/copy_test.cc: New file.
9597         * testsuite/copy_test_1.cc: New file.
9598         * testsuite/copy_test_2.cc: New file.
9599         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9600         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9601         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9602         (copy_test_1_pic.o, copy_test_1.so): New targets.
9603         (copy_test_2_pic.o, copy_test_2.so): New targets.
9604         * testsuite/Makefile.in: Rebuild.
9605
9606         * script-sections.cc (Script_sections::place_orphan): Initialize
9607         local variable exact.
9608
9609 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9610
9611         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9612
9613 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9614             David S. Miller  <davem@davemloft.net>
9615
9616         * powerpc.cc: New file.
9617         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9618         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9619         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9620         * Makefile.in: Rebuild.
9621
9622 2008-06-09  Ian Lance Taylor  <iant@google.com>
9623
9624         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9625         <exception>.
9626         (throwing, orig_terminate): New static variables.
9627         (terminate_handler): New static function.
9628         (t2): Set terminate handler.
9629
9630 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9631
9632         PR 6584
9633         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9634         alignment.
9635
9636 2008-05-30  Cary Coutant  <ccoutant@google.com>
9637
9638         * archive.cc (Archive::include_all_members) Correct to step
9639         over symbol table and extended name table in thin archives.
9640
9641 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9642
9643         PR 6407
9644         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9645         calculation.
9646
9647 2008-05-28  Caleb Howe  <cshowe@google.com>
9648
9649         * reduced_debug_output.cc: New file.
9650         * reduced_debug_output.h: New file.
9651         * options.h (class General_options): Add --strip-debug-non-line.
9652         * options.cc (General_options::finalize): Add strip_debug_non_line
9653         to the strip heirarchy.
9654         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9655         fields.
9656         * layout.cc: Include "reduced_debug_output.h".
9657         (Layout::Layout): Initialize new fields.
9658         (line_only_debug_sections): New static array.
9659         (is_lines_only_debug_sections): New static inline function.
9660         (Layout::include_section): Handle --strip-debug-non-line.
9661         (Layout::make_output_section): If --strip-debug-non-line, build
9662         new output sections for .debug_abbrev and .debug_info.
9663         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9664         gold.  Warn about possible overflow.
9665         (read_signed_LEB_128): Likewise.
9666         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9667         (read_signed_LEB_128): Declare.
9668         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9669         (HFILES): Add reduced_debug_output.h.
9670         * Makefile.in: Rebuild.
9671
9672 2008-05-21  Ian Lance Taylor  <iant@google.com>
9673
9674         * mapfile.cc: New file.
9675         * mapfile.h: New file.
9676         * options.h (class General_options): Add -M/--print-map and -Map.
9677         * options.cc (General_options::finalize): Make -M equivalent to
9678         -Map -.
9679         * main.cc: Include <cstdio> and "mapfile.h".
9680         (main): Open mapfile if requested.
9681         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9682         constructor.  Change caller.
9683         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9684         (queue_middle_tasks): Likewise.
9685         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9686         declarations.
9687         * archive.cc: Include "mapfile.h".
9688         (Archive::add_symbols): Add mapfile parameter.  Change all
9689         callers.  Pass mapfile, symbol, and reason to include_member.
9690         (Archive::include_all_members): Add mapfile parameter.  Change all
9691         callers.
9692         (Archive::include_member): Add mapfile, sym, and why parameters.
9693         Change all callers.  Report inclusion to map file.
9694         * archive.h: Include "fileread.h".
9695         (class Archive): Update declarations.
9696         (Archive::file): New const method.
9697         (class Add_archive_symbols): Add mapfile_ field.  Update
9698         constructor.  Change all callers.
9699         * readsyms.h (class Read_symbols): Likewise.
9700         (class Finish_group): Likewise.
9701         (class Read_script): Likewise.
9702         * common.cc: Include "mapfile.h".
9703         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9704         all callers.
9705         (Symbol_table::do_allocate_commons): Likewise.
9706         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9707         symbol allocation to mapfile.
9708         * common.h (class Allocate_commons_task): Add mapfile_ field.
9709         Update constructor.  Change all callers.
9710         * symtab.h (class Symbol_table): Update declarations.
9711         * layout.cc: Include "mapfile.h".
9712         (Layout_task_runner::run): Print information to mapfile.
9713         (Layout::create_gold_note): Change Output_data_fixed_space to
9714         Output_data_zero_fill.
9715         (Layout::create_build_id): Likewise.
9716         (Layout::print_to_mapfile): New function.
9717         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9718         constructor.  Change caller.
9719         (class Layout): Declare print_to_mapfile.
9720         * output.cc (Output_section::Input_section::print_to_mapfile): New
9721         function.
9722         (Output_section::add_input_section): If producing a map, always
9723         add to input_sections_ list.
9724         (Output_section::do_print_to_mapfile): New function.
9725         (Output_segment::print_sections_to_mapfile): New function.
9726         (Output_segment::print_section_list_to_mapfile): New function.
9727         * output.h: Include "mapfile.h".
9728         (Output_data::print_to_mapfile): New function.
9729         (Output_data::do_print_to_mapfile): New virtual function.
9730         (Output_segment_headers::do_print_to_mapfile): New function.
9731         (Output_file_header::do_print_to_mapfile): New function.
9732         (Output_data_const::do_print_to_mapfile): New function.
9733         (class Output_data_const_buffer): Add map_name_ field.  Update
9734         constructor.  Change all callers.  Add do_print_to_mapfile
9735         function.
9736         (class Output_data_fixed_space): Likewise.
9737         (class Output_data_space): Likewise.
9738         (class Output_data_zero_fill): New class.
9739         (Output_data_strtab::do_print_to_mapfile): New function.
9740         (Output_data_reloc_base::do_print_to_mapfile): New function.
9741         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9742         (Output_data_group::do_print_to_mapfile): New function.
9743         (Output_data_got::do_print_to_mapfile): New function.
9744         (Output_data_dynamic::do_print_to_mapfile): New function.
9745         (Output_symtab_xindex::do_print_to_mapfile): New function.
9746         (class Output_section): Declare do_print_to_mapflie.  Declare
9747         print_to_mapfile in Input_section.
9748         (class Output_segment): Declare new functions.
9749         * object.h (Sized_relobj::symbol_count): New function.
9750         * script-sections.cc
9751         (Output_section_element_dot_assignment::set_section_addresses):
9752         Change Output_data_fixed_space to Output_data_zero_fill.
9753         (Output_data_expression::do_print_to_mapfile): New function.
9754         * script.cc (read_input_script): Add mapfile parameter.  Change
9755         all callers.
9756         * script.h (read_input_script): Update declaration.
9757         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9758         (Eh_frame::do_print_to_mapfile): New function.
9759         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9760         (Output_merge_string::do_print_to_mapfile): New function.
9761         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9762         function.
9763         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9764         function.
9765         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9766         function.
9767         * Makefile.am (CCFILES): Add mapfile.cc.
9768         (HFILES): Add mapfile.h.
9769         * Makefile.in: Rebuild.
9770
9771 2008-05-19  Ian Lance Taylor  <iant@google.com>
9772
9773         * options.h (class General_options): Add -z relro.
9774         * layout.cc (Layout::Layout): Initialize relro_segment_.
9775         (Layout::add_output_section_data): Return the output section.
9776         (Layout::make_output_section): Rcognize relro sections and mark
9777         them appropriately.
9778         (Layout::attach_allocated_section_to_segment): Put relro sections
9779         in a PT_GNU_RELRO segment.
9780         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9781         section as relro.
9782         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9783         PT_TLS segments.
9784         (Layout::linkonce_mapping): Map d.rel.ro.local to
9785         .data.rel.ro.local.
9786         (Layout::output_section_name): Us .data.rel.ro.local for any
9787         section which begins with that.
9788         * layout.h (class Layout): Update add_output_section_data
9789         declaration.  Add relro_segment_ field.
9790         * output.cc (Output_section::Output_section): Initialize is_relro_
9791         and is_relro_local_ fields.
9792         (Output_segment::add_output_section): Group relro sections.
9793         (Output_segment::is_first_section_relro): New function.
9794         (Output_segment::maximum_alignment): If there is a relro section,
9795         align the segment to the common page size.
9796         (Output_segment::set_section_addresses): Track whether we are
9797         looking at relro sections.  If the last section is a relro
9798         section, align to the common page size.
9799         (Output_segment::set_section_list_addresses): Add in_relro
9800         parameter.  Change all callers.  Align to the page size when
9801         moving from relro to non-relro section.
9802         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9803         segment.
9804         * output.h (class Output_section): Add is_relro_ and
9805         is_relro_local_ fields.
9806         (Output_section::is_relro): New function.
9807         (Output_section::set_is_relro): New function.
9808         (Output_section::is_relro_local): New function.
9809         (Output_section::set_is_relro_local): New function.
9810         (class Output_segment): Update declarations.
9811         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9812         * sparc.cc (Target_sparc::got_section): Likewise.
9813         * x86_64.cc (Target_x86_64::got_section): Likewise.
9814         * testsuite/relro_test_main.cc: New file.
9815         * testsuite/relro_test.cc: New file.
9816         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9817         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9818         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9819         (relro_test.so, relro_test_pic.o): New targets.
9820         * testsuite/Makefile.in: Rebuild.
9821
9822 2008-05-16  Ian Lance Taylor  <iant@google.com>
9823
9824         * output.cc (Output_segment::add_output_section): Remove front
9825         parameter.
9826         * output.h (class Output_segment): Remove
9827         add_initial_output_section and overloaded add_output_section.
9828         Update declaration of remaining add_output_section.
9829         * layout.cc (Layout::create_interp): Call add_output_section
9830         rather than add_initial_output_section.
9831         (Layout::finish_dynamic_section): Likewise.
9832
9833         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9834         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9835         know the dynamic type.
9836         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9837         field.  Initialize it in constructor.
9838         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9839         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9840         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9841         reloc.
9842
9843         * output.cc (Output_reloc::get_address): Change return type to
9844         Elf_Addr.
9845         * output.h (class Output_reloc): Update get_address declaration.
9846         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9847         for section addresses.
9848
9849 2008-05-09  Ian Lance Taylor  <iant@google.com>
9850
9851         PR 6493
9852         * gold.cc (gold_nomem): Use return value of write.
9853
9854 2008-05-08  Ian Lance Taylor  <iant@google.com>
9855
9856         * symtab.c (Symbol::init_base_output_data): Add version
9857         parameter.  Change all callers.
9858         (Symbol::init_base_output_segment): Likewise.
9859         (Symbol::init_base_constant): Likewise.
9860         (Symbol::init_base_undefined): Likewise.
9861         (Sized_symbol::init_output_data): Likewise.
9862         (Sized_symbol::init_output_segment): Likewise.
9863         (Sized_symbol::init_constant): Likewise.
9864         (Sized_symbol::init_undefined): Likewise.
9865         (Symbol_table::do_define_in_output_data): If the new symbol has a
9866         version, mark it as the default.
9867         (Symbol_table::do_define_in_output_segment): Likewise.
9868         (Symbol_table::do_define_as_constant): Likewise.
9869         * symtab.h (class Symbol): Update declarations.
9870         (class Sized_symbol): Likewise.
9871         * resolve.cc (Symbol::override_version): New function.
9872         (Symbol::override_base): Call override_version.
9873         (Symbol::override_base_with_special): Likewise.
9874         * testsuite/ver_script_8.script: New file.
9875         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9876         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9877         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9878         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9879
9880 2008-05-06  Ian Lance Taylor  <iant@google.com>
9881
9882         PR 6049
9883         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9884         functions.
9885         (class General_options): Remove existing --undefined, and add
9886         --no-undefined instead.  Add new --undefined as synonym for -u.
9887         * archive.cc (Archive::add_symbols): Check whether symbol was
9888         named with -u.
9889         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9890         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9891         all uses.  Add IS_UNDEFINED.  Update declarations to split
9892         different versions of init_base.  Declare init_base_undefined.
9893         (Symbol::is_defined): Handle IS_UNDEFINED.
9894         (Symbol::is_undefined): Likewise.
9895         (Symbol::is_weak_undefined): Call is_undefined.
9896         (Symbol::is_absolute): Handle IS_CONSTANT.
9897         (class Sized_symbol): Update declarations to split different
9898         versions of init.  Declare init_undefined.
9899         (class Symbol_table): Declare new functions.
9900         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9901         Change all callers.
9902         (Symbol::init_base_output_data): Likewise.
9903         (Symbol::init_base_output_segment): Likewise.
9904         (Symbol::init_base_constant): Likewise.
9905         (Symbol::init_base_undefined): New function.
9906         (Sized_symbol::init_object): Rename from init.  Change all
9907         callers.
9908         (Sized_symbol::init_output_data): Likewise.
9909         (Sized_symbol::init_output_segment): Likewise.
9910         (Sized_symbol::init_constant): Likewise.
9911         (Sized_symbol::init_undefined): New function.
9912         (Symbol_table::add_undefined_symbols_from_command_line): New
9913         function.
9914         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9915         function.
9916         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9917         (Symbol::output_section): Likewise.
9918         (Symbol::set_output_section): Likewise.
9919         (Symbol_table::sized_finalize_symbol): Likewise.
9920         (Symbol_table::sized_write_globals): Likewise.
9921         * resolve.cc (Symbol_table::should_override): Likewise.
9922         (Symbol::override_base_with_special): Likewise.
9923
9924         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9925         symbol, change it to have default visibility.
9926         * testsuite/protected_1.cc: New file.
9927         * testsuite/protected_2.cc: New file.
9928         * testsuite/protected_3.cc: New file.
9929         * testsuite/protected_main_1.cc: New file.
9930         * testsuite/protected_main_2.cc: New file.
9931         * testsuite/protected_main_3.cc: New file.
9932         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9933         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9934         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9935         (protected_1.so): New target.
9936         (protected_1_pic.o, protected_2_pic.o): New targets.
9937         (protected_3_pic.o): New target.
9938         (check_PROGRAMS): Add protected_2.
9939         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9940         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9941         * testsuite/Makefile.in: Rebuild.
9942
9943         * options.h (DEFINE_var): Add set_user_set_##varname__.
9944         (DEFINE_bool_alias): New macro.
9945         (class General_options): Define -Bstatic using DEFINE_bool_alias
9946         rather than DEFINE_special.  Add --undefined as an alias for -z
9947         defs.
9948         * options.cc (General_options::parse_Bstatic): Remove.
9949
9950         * options.h (class General_options): Add --fatal-warnings.
9951         * main.cc (main): Implement --fatal-warnings.
9952         * errors.h (Errors::warning_count): New function.
9953
9954         * options.h (class General_options): Add -Bsymbolic-functions.
9955         * symtab.h (Symbol::is_preemptible): Check for
9956         -Bsymbolic-functions.
9957
9958 2008-05-05  Ian Lance Taylor  <iant@google.com>
9959
9960         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9961         as noVARNAME rather than no-VARNAME.
9962         (class General_options): Add option -z combreloc.
9963         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9964         get_address.
9965         (Output_reloc::sort_before) [SHT_REL]: New function.
9966         (Output_reloc::sort_before) [SHT_RELA]: New function.
9967         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9968         Sort_relocs_comparison.
9969         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9970         parameter.  Change all callers.
9971         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9972         sort_relocs parameter.  Change all callers.
9973         * output.cc (Output_reloc::get_address): New function, broken out
9974         of write_rel.
9975         (Output_reloc::write_rel): Call it.
9976         (Output_reloc::compare): New function.
9977         (Output_data_reloc_base::do_write): Optionally sort relocs.
9978
9979         * configure.ac: If targ_extra_obj is set, link it in.
9980         * configure.tgt: Initialize all variables.
9981         (x86_64*): Set targ_extra_obj and targ_extra_size.
9982         * configure: Rebuild.
9983
9984         * object.cc (Sized_relobj::include_section_group): Adjust section
9985         indexes read from group data.  Build vector to pass to
9986         layout_group.
9987         * layout.cc (Layout::layout_group): Add flags and shndxes
9988         parameters.  Remove contents parameter.  Change caller.  Update
9989         explicit instantiations.
9990         * layout.h (class Layout): Update layout_group declaration.
9991         * output.cc (Output_data_group::Output_data_group): Add flags and
9992         input_shndxes parameters.  Remove contents parameter.  Change
9993         caller.
9994         (Output_data_group::do_write): Change input_sections_ to
9995         input_shndxes_.
9996         * output.h (class Output_data_group): Update constructor
9997         declaration.  Rename input_sections_ to input_shndxes_.
9998         * testsuite/many_sections_test.cc: Add template.
9999
10000 2008-04-30  Cary Coutant  <ccoutant@google.com>
10001
10002         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10003
10004         * layout.cc (Layout::include_section): Refactored check for debug
10005         info section.
10006         (Layout::add_comdat): Add new parameters.  Change type
10007         of signature parameter.  Add object and shndx to signatures table.
10008         (Layout::find_kept_object): New function.
10009         * layout.h: Include <cstring>.
10010         (Layout::is_debug_info_section): New function.
10011         (Layout::add_comdat): Add new parameters.
10012         (Layout::find_kept_object): New function.
10013         (Layout::Kept_section): New struct.
10014         (Layout::Signatures): Change type of map range.
10015         * object.cc (Relobj::output_section_address): New function.
10016         (Sized_relobj::include_section_group): Add new parameters.  Change
10017         calls to Layout::add_comdat.  Change to build table of kept comdat
10018         groups and table mapping discarded sections to kept sections.
10019         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10020         (Sized_relobj::do_layout): Change calls to include_section_group and
10021         include_linkonce_section.
10022         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10023         value to zero when section is discarded.
10024         (Sized_relobj::map_to_kept_section): New function.
10025         * object.h (Relobj::output_section_address): New function.
10026         (Relobj::Comdat_group): New type.
10027         (Relobj::find_comdat_group): New function.
10028         (Relobj::Comdat_group_table): New type.
10029         (Relobj::Kept_comdat_section): New type.
10030         (Relobj::Kept_comdat_section_table): New type.
10031         (Relobj::add_comdat_group): New function.
10032         (Relobj::set_kept_comdat_section): New function.
10033         (Relobj::get_kept_comdat_section): New function.
10034         (Relobj::comdat_groups_): New field.
10035         (Relobj::kept_comdat_sections_): New field.
10036         (Symbol_value::input_value): Update comment.
10037         (Sized_relobj::map_to_kept_section) New function.
10038         (Sized_relobj::include_linkonce_section): Add new parameter.
10039         * target-reloc.h (Comdat_behavior): New type.
10040         (get_comdat_behavior): New function.
10041         (relocate_section): Add code to map a discarded section to the
10042         corresponding kept section when applying a relocation.
10043
10044 2008-04-30  Craig Silverstein  <csilvers@google.com>
10045
10046         * dwarf_reader.cc (next_generation_count): New static var.
10047         (Addr2line_cache_entry): New struct.
10048         (addr2line_cache): New static var.
10049         (Dwarf_line_info::one_addr2line): Added caching.
10050         (Dwarf_line_info::clear_addr2line_cache): New function.
10051         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10052         cache-size parameter.
10053         (Dwarf_line_info::one_addr2line_cache): New function.
10054         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10055         new cache-size argument to one_addr2line(), and clear cache.
10056
10057 2008-04-28  Cary Coutant  <ccoutant@google.com>
10058
10059         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10060         R_386_PC8 relocations.
10061
10062 2008-04-23  Ian Lance Taylor  <iant@google.com>
10063
10064         * object.cc (Sized_relobj::include_section_group): Check for
10065         invalid section group.
10066
10067         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10068         header size.
10069
10070         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10071         than read for file header.
10072         * archive.cc (Archive::include_member): Likewise.
10073
10074 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10075
10076         * aclocal.m4: Regenerate.
10077         * configure: Regenerate.
10078
10079 2008-04-19  Ian Lance Taylor  <iant@google.com>
10080
10081         * version.cc (version_string): Bump to 1.6.
10082
10083         * testsuite/Makefile.am (many_sections_r_test): New target.
10084         (many_sections_r_test_SOURCES): Remove.
10085         (many_sections_r_test_DEPENDENCIES): Remove.
10086         (many_sections_r_test_LDFLAGS): Remove.
10087         (many_sections_r_test_LDADD): Remove.
10088
10089         * object.cc (Sized_relobj::do_add_symbols): Always pass
10090         local_symbol_count_ to add_from_relobj.
10091
10092         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10093         every thousand variables.
10094         * testsuite/Makefile.in: Rebuild.
10095
10096         * object.cc (Xindex::initialize_symtab_xindex): New function.
10097         (Xindex::read_symtab_xindex): New function.
10098         (Xindex::sym_xindex_to_shndx): New function.
10099         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10100         available.
10101         (Sized_relobj::do_initialize_xindex): New function.
10102         (Sized_relobj::do_read_symbols): Adjust section links.
10103         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10104         parameter.  Change all callers.
10105         (Sized_relobj::include_section_group): Adjust section links and
10106         symbol section indexes.
10107         (Sized_relobj::do_layout): Adjust section links.
10108         (Sized_relobj::do_count_local_symbols): Adjust section links and
10109         symbol section indexes.
10110         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10111         ordinary and special symbols.
10112         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10113         dynsym_xindex parameters.  Change all callers.  Adjust section
10114         links.  Use SHN_XINDEX when needed.
10115         (Sized_relobj::get_symbol_location_info): Adjust section links.
10116         Don't get fooled by special symbols.
10117         * object.h (class Xindex): Define.
10118         (class Object): Add xindex_ parameter.  Declare virtual functoin
10119         do_initialize_xindex.
10120         (Object::adjust_sym_shndx): New function.
10121         (Object::set_xindex): New protected function.
10122         (class Symbol_value): Add is_ordinary_shndx_ field.
10123         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10124         (Symbol_value::value): Assert ordinary section.
10125         (Symbol_value::initialize_input_to_output_map): Likewise.
10126         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10127         Change all callers.
10128         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10129         all callers.
10130         (class Sized_relobj): Update declarations.
10131         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10132         parameter.  Change all callers.
10133         (Sized_relobj::adjust_shndx): New function.
10134         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10135         field.
10136         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10137         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10138         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10139         (Sized_dynobj::read_dynsym_section): Adjust section links.
10140         (Sized_dynobj::read_dynamic): Likewise.
10141         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10142         section links.
10143         (Sized_dynobj::do_initialize_xindex): New function.
10144         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10145         do_initialize_xindex.
10146         (Sized_dynobj::adjust_shndx): New function.
10147         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10148         dynsym_xindex_ fields.
10149         (Layout::finalize): Add a call to set_section_indexes before
10150         creating the symtab sections.
10151         (Layout::set_section_indexes): Don't do anything if the section
10152         already has a section index.
10153         (Layout::create_symtab_sections): Add shnum parameter.  Change
10154         caller.  Create .symtab_shndx section if needed.
10155         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10156         caller.
10157         (Layout::allocated_output_section_count): New function.
10158         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10159         needed.
10160         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10161         fields.  Update declarations.
10162         (Layout::symtab_xindex): New function.
10163         (Layout::dynsym_xindex): New function.
10164         (class Write_symbols_task): Add layout_ field.
10165         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10166         Change caller.
10167         * output.cc (Output_section_headers::Output_section_headers): Add
10168         shstrtab_section parameter.  Change all callers.
10169         (Output_section_headers::do_sized_write): Store overflow values
10170         for section count and section string table section index in
10171         section header zero.
10172         (Output_file_header::do_sized_write): Check for overflow of
10173         section count and section string table section index.
10174         (Output_symtab_xindex::do_write): New function.
10175         (Output_symtab_xindex::endian_do_write): New function.
10176         * output.h (class Output_section_headers): Add shstrtab_section_.
10177         Update declarations.
10178         (class Output_symtab_xindex): Define.
10179         (Output_section::has_out_shndx): New function.
10180         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10181         field.
10182         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10183         Change all callers.
10184         (Sized_symbol::init): Likewise.
10185         (Symbol::output_section): Check for ordinary symbol.
10186         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10187         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10188         callers.
10189         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10190         Change all callers.  Simplify handling of symbols from sections
10191         not included in the link.
10192         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10193         distinction.
10194         (Weak_alias_sorter::operator()): Assert that symbols are
10195         ordinary.
10196         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10197         distinction.
10198         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10199         parameters.  Change all callers.
10200         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10201         symbol distinction.  Use SHN_XINDEX when needed.
10202         (Symbol_table::write_section_symbol): Add symtab_xindex
10203         parameter.  Change all callers.
10204         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10205         SHN_XINDEX when needed.
10206         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10207         declarations.
10208         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10209         (Symbol::is_defined): Check is_ordinary.
10210         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10211         (Symbol::is_absolute, Symbol::is_common): Likewise.
10212         (class Sized_symbol): Update declarations.
10213         (class Symbol_table): Update declarations.
10214         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10215         parameters.  Change all callers.
10216         (Sized_symbol::override): Likewise.
10217         (Symbol_table::override): Likewise.
10218         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10219         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10220         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10221         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10222         to be in an ordinary section.
10223         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10224         object and is_ordinary parameters.  Change all callers.
10225         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10226         Change all callers.  Don't add undefined or non-ordinary symbols
10227         to reloc_map_.
10228         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10229         Change all callers.
10230         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10231         declarations.
10232         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10233         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10234         (Sized_relobj::relocate_sections): Likewise.
10235         * target-reloc.h (scan_relocs): Adjust section symbol index.
10236         (scan_relocatable_relocs): Likewise.
10237         * i386.cc (Scan::local): Check for ordinary symbols.
10238         * sparc.cc (Scan::local): Likewise.
10239         * x86_64.cc (Scan::local): Likewise.
10240         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10241         to symbol_section_and_value.
10242         * testsuite/many_sections_test.cc: New file.
10243         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10244         (check_PROGRAMS): Add many_sections_test.
10245         (many_sections_test_SOURCES): Define.
10246         (many_sections_test_DEPENDENCIES): Define.
10247         (many_sections_test_LDFLAGS): Define.
10248         (BUILT_SOURCES): Add many_sections_define.h.
10249         (many_sections_define.h): New target.
10250         (BUILT_SOURCES): Add many_sections_check.h.
10251         (many_sections_check.h): New target.
10252         (check_PROGRAMS): Add many_sections_r_test.
10253         (many_sections_r_test_SOURCES): Define.
10254         (many_sections_r_test_DEPENDENCIES): Define.
10255         (many_sections_r_test_LDFLAGS): Define.
10256         (many_sections_r_test_LDADD): Define.
10257         (many_sections_r_test.o): New target.
10258         * testsuite/Makefile.in: Rebuild.
10259
10260 2008-04-17  Cary Coutant  <ccoutant@google.com>
10261
10262         * errors.cc (Errors::info): New function.
10263         (gold_info): New function.
10264         * errors.h (Errors::info): New function.
10265         * gold.h (gold_info): New function.
10266         * object.cc (Input_objects::add_object): Print trace output.
10267         * options.cc (options::parse_set): New function.
10268         (General_options::parse_wrap): Deleted.
10269         (General_options::General_options): Deleted initializer.
10270         * options.h (options::String_set): New typedef.
10271         (options::parse_set): New function.
10272         (DEFINE_set): New macro.
10273         (General_options::wrap): Changed to use DEFINE_set. Changed
10274         callers of any_wrap_symbols and is_wrap_symbol.
10275         (General_options::trace, General_options::trace_symbol):
10276         New options.
10277         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10278         (General_options::wrap_symbols_): Deleted.
10279         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10280
10281 2008-04-17  David S. Miller  <davem@davemloft.net>
10282
10283         * options.cc (General_options::parse_V): New function.
10284         * options.h: Add entries for -V and -Qy.
10285
10286 2008-04-17  Ian Lance Taylor  <iant@google.com>
10287
10288         * common.cc (Symbol_table::allocate_commons): Remove options
10289         parameter.  Change caller.
10290         (Symbol_table::do_allocate_commons): Remove options parameter.
10291         Change caller.  Just call do_allocate_commons_list twice.
10292         (Symbol_table::do_allocate_commons_list): New function, broken out
10293         of do_allocate_commons.
10294         * common.h (class Allocate_commons_task): Remove options_ field.
10295         Update constructor.
10296         * symtab.cc (Symbol_table::Symbol_table): Initialize
10297         tls_commons_.
10298         (Symbol_table::add_from_object): Put TLS common symbols on
10299         tls_commons_ list.
10300         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10301         which are IN_OUTPUT_DATA.
10302         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10303         allocate_commons and do_allocate_commons declarations.  Declare
10304         do_allocate_commons_list.
10305         * gold.cc (queue_middle_tasks): Update creation of
10306         Allocate_commons_task to not pass options.
10307         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10308         (TLS_TEST_C_FLAGS): New variable.
10309         (tls_test_c_pic.o): New target.
10310         (tls_test_shared.so): Link in tls_test_c_pic.o.
10311         (tls_test_c_pic_ie.o): New target.
10312         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10313         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10314         (tls_test_c.o): New target.
10315         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10316         (tls_pic_test_LDADD): Likewise.
10317         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10318         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10319         (tls_test_c_gnu2.o): New target.
10320         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10321         tls_test_c_gnu2.o.
10322         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10323         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10324         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10325         * testsuite/tls_test.cc: Include "config.h".
10326         (t_last): Call t11_last.
10327         * testsuite/tls_test.h (t11, t11_last): Declare.
10328         * testsuite/tls_test_c.c: New file.
10329         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10330         * configure.ac: Check for OpenMP support.
10331         * configure, config.in, Makefile.in: Rebuild.
10332         * testsuite/Makefile.in: Rebuild.
10333
10334 2008-04-16  Cary Coutant  <ccoutant@google.com>
10335
10336         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10337         (Target_i386::tls_base_symbol_defined_): New field.
10338         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10339         (Target_i386::Scan::global): Likewise.
10340         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10341         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10342         (Target_x86_64::tls_base_symbol_defined_): New field.
10343         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10344         (Target_x86_64::Scan::global): Likewise.
10345
10346 2008-04-16  Cary Coutant  <ccoutant@google.com>
10347
10348         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10349         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10350         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10351         building shared libraries.
10352         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10353         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10354         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10355         * testsuite/Makefile.in: Rebuild.
10356         * testsuite/weak_undef.h: New file.
10357         * testsuite/weak_undef_file1.cc: Add extra test cases.
10358         * testsuite/weak_undef_file2.cc: Likewise.
10359         * testsuite/weak_undef_test.cc: Likewise.
10360
10361 2008-04-16  David S. Miller  <davem@davemloft.net>
10362
10363         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10364         Add issued_non_pic_error_ field.  Declare check_non_pic.
10365         (Target_sparc::Scan::check_non_pic): New function.
10366         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10367         (Target_sparc::Scan::global): Likewise.
10368
10369         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10370         * configure: Rebuild.
10371
10372         * options.h (DEFINE_enable): New macro.
10373         (new_dtags): New enable option.
10374         (initfirst, interpose, loadfltr, nodefaultlib,
10375         nodelete, nodlopen, nodump): New -z options.
10376         * layout.cc (Layout:finish_dynamic_section): If new
10377         dtags enabled, emit DT_RUNPATH.  Also, emit a
10378         DT_FLAGS_1 containing any specified -z flags.
10379
10380 2008-04-16  Ian Lance Taylor  <iant@google.com>
10381
10382         * copy-relocs.cc: New file.
10383         * copy-relocs.h: New file.
10384         * reloc.cc: Remove Copy_relocs code.
10385         * reloc.h: Likewise.
10386         * reloc-types.h (struct Reloc_types) [both versions]: Add
10387         get_reloc_addend_noerror.
10388         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10389         variants of add_global which take an addend which must be zero.
10390         * i386.cc: Include "copy-relocs.h".
10391         (class Target_i386): Change type of copy_relocs_ to variable,
10392         update initializer.
10393         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10394         Change all callers.
10395         (Target_i386::do_finalize_sections): Change handling of
10396         copy_relocs_.
10397         * sparc.cc: Include "copy-relocs.h".
10398         (class Target_sparc): Change type of copy_relocs_ to variable,
10399         update initializer.
10400         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10401         Change all callers.
10402         (Target_sparc::do_finalize_sections): Change handling of
10403         copy_relocs_.
10404         * x86_64.cc: Include "copy-relocs.h".
10405         (class Target_x86_64): Change type of copy_relocs_ to variable,
10406         update initializer.
10407         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10408         class.  Change all callers.
10409         (Target_x86_64::do_finalize_sections): Change handling of
10410         copy_relocs_.
10411         * Makefile.am (CCFILES): Add copy-relocs.cc.
10412         (HFILES): Add copy-relocs.h.
10413
10414         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10415
10416         * testsuite/script_test_4.sh: Permit leading zeroes.
10417
10418 2008-04-15  Ian Lance Taylor  <iant@google.com>
10419
10420         * script-sections.cc (Script_sections::create_segments): Use
10421         header_size_adjustment even when there is enough room for the
10422         headers.
10423         * testsuite/script_test_4.sh: New file.
10424         * testsuite/script_test_4.t: New file.
10425         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10426         (check_DATA): Add script_test_4.stdout.
10427         (MOSTLYCLEANFILES): Likewise.
10428         (script_test_4): New target.
10429         (script_test_4.stdout): New target.
10430         * testsuite/Makefile.in: Rebuild.
10431
10432         * sparc.cc: Add definitions for Output_data_plt_sparc class
10433         constants.
10434
10435 2008-04-14  David S. Miller  <davem@davemloft.net>
10436
10437         * sparc.cc: New file.
10438         * Makefile.am (TARGETSOURCES): Add sparc.cc
10439         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10440         * configure.tgt: Document targ_extra_size and
10441         targ_extra_big_endian.  Add entries for sparc-* and
10442         sparc64-*.
10443         * configure.ac: Handle targ_extra_size and
10444         targ_extra_big_endian.
10445         * Makefile.in: Rebuild.
10446         * configure: Likewise.
10447         * po/POTFILES.in: Likewise.
10448         * po/gold.pot: Likewise.
10449
10450 2008-04-14  Ian Lance Taylor  <iant@google.com>
10451
10452         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10453         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10454         in the name/type/flags to section mapping.  Don't call
10455         allocate_output_section.
10456         (Layout::choose_output_section): Change parameter from adjust_name
10457         to is_input_section.  Don't permit input sections after sections
10458         are attached to segments.  Don't call allocate_output_section.
10459         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10460         not write_enable_output_section.
10461         (Layout::make_output_section): Don't push to
10462         unattached_section_list_ nor call attach_to_segment.  Call
10463         attach_section_to_segment if sections are attached.
10464         (Layout::attach_sections_to_segments): New function.
10465         (Layout::attach_section_to_segment): New function.
10466         (Layout::attach_allocated_section_to_segment): Rename from
10467         attach_to_segment.  Remove flags parameter.
10468         (Layout::allocate_output_section): Remove function.
10469         (Layout::write_enable_output_section): Remove function.
10470         * layout.h (class Layout): Update for above changes.  Add new
10471         field sections_are_attached_.
10472         * output.h (Output_section::update_flags_for_input_section): New
10473         function.
10474         * output.cc (Output_section::add_input_section): Call
10475         update_flags_for_input_section.
10476         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10477
10478 2008-04-11  Cary Coutant  <ccoutant@google.com>
10479
10480         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10481         thought unnecessary.
10482         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10483
10484 2008-04-11  Ian Lance Taylor  <iant@google.com>
10485
10486         * output.h (class Output_section_data): Remove inline definition
10487         of set_addralign.
10488         * output.cc (Output_section_data::set_addralign): New function.
10489
10490 2008-04-11  Cary Coutant  <ccoutant@google.com>
10491
10492         Add support for TLS descriptors for i386 and x86_64.
10493         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10494         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10495         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10496         GOT_TYPE_TLS_DESC.
10497         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10498         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10499         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10500         relocations.
10501         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10502         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10503         Fix problem with initial-exec relocations.
10504         (Target_i386::Relocate::relocate_tls): Likewise.
10505         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10506         relaxation.
10507         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10508         support for section-plus-offset dynamic table entries.
10509         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10510         (Output_data_dynamic::Dynamic_entry): Add support for
10511         section-plus-offset dynamic table entries.
10512         (Output_data_dynamic::Classification): Likewise.
10513         (Output_data_dynamic::classification_): Renamed offset_.
10514         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10515         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10516         (Target_x86_64::make_plt_section): New function.
10517         (Target_x86_64::reserve_tlsdesc_entries): New function.
10518         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10519         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10520         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10521         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10522         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10523         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10524         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10525         add extra PLT entry for TLS descriptors.
10526         (Output_data_plt_x86_64::got_): New field.
10527         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10528         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10529         fields.
10530         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10531         descriptors.
10532         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10533         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10534         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10535         R_386_TLS_DESC_CALL relocations.
10536         (Target_x86_64::Scan::global): Likewise.
10537         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10538         for TLS descriptors.
10539         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10540         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10541         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10542         GD-to-IE relaxation.
10543         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10544         and TLS_DESCRIPTORS.
10545         * Makefile.in: Rebuild.
10546         * configure: Rebuild.
10547         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10548         (tls_test_shared2.so): New target.
10549         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10550         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10551         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10552         (tls_shared_gd_to_ie_test_LDADD): New variable.
10553         (tls_shared_gnu2_gd_to_ie_test): New target.
10554         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10555         New targets.
10556         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10557         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10558         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10559         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10560         (tls_shared_gnu2_test): New target.
10561         (tls_test_gnu2_shared.so): New target.
10562         (tls_shared_gnu2_test_SOURCES): New variable.
10563         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10564         (tls_shared_gnu2_test_LDFLAGS): New variable.
10565         (tls_shared_gnu2_test_LDADD): New variable.
10566         * testsuite/Makefile.in: Rebuild.
10567         * testsuite/Makefile.
10568
10569 2008-04-11  Ian Lance Taylor  <iant@google.com>
10570
10571         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10572         justsyms.t.
10573         * testsuite/Makefile.in: Rebuild.
10574
10575         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10576         long.
10577         * testsuite/script_test_2.cc (main): Adjust test.
10578
10579 2008-04-11  David S. Miller  <davem@davemloft.net>
10580             Ian Lance Taylor  <iant@google.com>
10581
10582         * options.h (General_options): Add entries for '-Y' and
10583         '-relax'.
10584         * options.cc (General_options:finalize): If -Y was used, add those
10585         entries to the library path instead of the default "/lib" and
10586         "/usr/lib".
10587
10588 2008-04-11  David S. Miller  <davem@davemloft.net>
10589
10590         * testsuite/justsyms.t: Start at 0x100.
10591         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10592         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10593         long.
10594         * testsuite/script_test_2.cc: Adjust string and section length
10595         checks.
10596
10597 2008-04-09  Ian Lance Taylor  <iant@google.com>
10598
10599         PR gold/5996
10600         * script-sections.cc (Sections_element::allocate_to_segment): Add
10601         orphan parameter.
10602         (Output_section_definition::allocate_to_segment): Likewise.
10603         (Orphan_output_section::allocate_to_segment): Likewise.
10604         (Script_sections::attach_sections_using_phdrs_clause): Don't
10605         propagate non-PT_LOAD segments to orphan sections.
10606         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10607         readelf rather than objdump.
10608         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10609         .interp section and PT_INTERP segment are the same size.
10610         * testsuite/Makefile.in: Rebuild.
10611
10612         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10613         aliases for symbols defined in the same object.
10614         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10615         (weak_alias_test_SOURCES): New variable.
10616         (weak_alias_test_DEPENDENCIES): New variable.
10617         (weak_alias_test_LDFLAGS): New variable.
10618         (weak_alias_test_LDADD): New variable.
10619         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10620         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10621         (weak_alias_test_3.o): New target.
10622         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10623         * testsuite/weak_alias_test_main.cc: New file.
10624         * testsuite/weak_alias_test_1.cc: New file.
10625         * testsuite/weak_alias_test_2.cc: New file.
10626         * testsuite/weak_alias_test_3.cc: New file.
10627
10628 2008-04-08  Ian Lance Taylor  <iant@google.com>
10629
10630         * options.h (class General_options): Add --noinhibit-exec option.
10631         * main.cc (main): Check --noinhibit-exec.
10632
10633         * options.h (class General_options): Define --wrap as a special
10634         option.  Add wrap_symbols_ field.
10635         (General_options::any_wrap_symbols): New function.
10636         (General_options::is_wrap_symbol): New function.
10637         * options.cc (General_options::parse_wrap): New function.
10638         (General_options::General_options): Initialize wrap_symbols_.
10639         * symtab.cc (Symbol_table::wrap_symbol): New function.
10640         (Symbol_table::add_from_object): Handle --wrap.
10641         * symtab.h (class Symbol_table): Declare wrap_symbol.
10642         * target.h (Target::wrap_char): New function.
10643         (Target::Target_info): Add wrap_char field.
10644         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10645         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10646         * testsuite/testfile.cc (Target_test::test_target_info):
10647         Likewise.
10648
10649         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10650         there is one.
10651
10652         * layout.h (class Layout): Add added_eh_frame_data_ field.
10653         * layout.cc (Layout::Layout): Initialize new field.
10654         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10655         output section until we find a section we merged successfully.
10656         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10657         that the size be non-zero.
10658
10659         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10660         qualifier.
10661
10662 2008-04-08  Craig Silverstein  <csilvers@google.com>
10663
10664         * configure.ac: Export new conditional variable HAVE_ZLIB.
10665         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10666         on HAVE_ZLIB.
10667         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10668         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10669
10670 2008-04-07  Ian Lance Taylor  <iant@google.com>
10671
10672         * version.cc (version_string): Set to "1.5".
10673
10674         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10675         Add issued_non_pic_error_ field.  Declare check_non_pic.
10676         (Target_x86_64::Scan::check_non_pic): New function.
10677         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10678         (Target_x86_64::Scan::global): Likewise.
10679
10680         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10681         addend parameter.  Change caller.  Handle merge sections.
10682         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10683         Address to Addend.  Don't add in the result of
10684         local_section_offset, pass down the addend and use the returned
10685         value.
10686         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10687         Update declarations of local_section_offset and symbol_value.
10688         * testsuite/two_file_test_1.cc (t18): New function.
10689         * testsuite/two_file_test_2.cc (f18): New function.
10690         * testsuite/two_file_test_main.cc (main): Call t18.
10691         * testsuite/two_file_test.h (t18, f18): Declare.
10692
10693         * configure.ac: Don't test for objdump, c++filt, or readelf.
10694         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10695         conditionals.
10696         (TEST_READELF): New variable.
10697         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10698         (check_PROGRAMS): Add two_file_strip_test.
10699         (two_file_strip_test): New target.
10700         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10701         (two_file_same_shared_strip_test_SOURCES): New variable.
10702         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10703         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10704         (two_file_same_shared_strip_test_LDADD): New variable.
10705         (two_file_shared_strip.so): New target.
10706         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10707         (ver_test_5.syms, ver_test_7.syms): Likewise.
10708         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10709         (strip_test_3.stdout): Use TEST_OBJDUMP.
10710         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10711
10712 2008-04-04  Cary Coutant  <ccoutant@google.com>
10713
10714         * symtab.h (Symbol::is_weak_undefined): New function.
10715         (Symbol::is_strong_undefined): New function.
10716         (Symbol::is_absolute): New function.
10717         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10718         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10719         absolute symbols.
10720         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10721         (weak_undef_test): New target.
10722         * testsuite/Makefile.in: Rebuild.
10723         * testsuite/weak_undef_file1.cc: New file.
10724         * testsuite/weak_undef_file2.cc: New file.
10725         * testsuite/weak_undef_test.cc: New file.
10726
10727 2008-04-03  Craig Silverstein  <csilvers@google.com>
10728
10729         * compressed_output.h (class Output_compressed_section): Use
10730         unsigned buffer.
10731         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10732         add zlib header.
10733         (zlib_compressed_suffix): Removed.
10734         (Output_compressed_section::set_final_data_size): Use unsigned
10735         buffers.
10736         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10737         Fix linker invocation.
10738         (flagstest_o_specialfile_and_compress_debug_sections):
10739         Likewise.
10740         * testsuite/Makefile.in: Regenerated.
10741
10742 2008-04-02  David S. Miller  <davem@davemloft.net>
10743
10744         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10745         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10746
10747 2008-04-02  Craig Silverstein  <csilvers@google.com>
10748
10749         * TODO: New file.
10750
10751 2008-04-02  Ian Lance Taylor  <iant@google.com>
10752
10753         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10754         parameters.  Update for new key type to views_.  Change all
10755         callers.
10756         (File_read::read): Adjust for byteshift in returned view.
10757         (File_read::add_view): New function, broken out of
10758         find_and_make_view.
10759         (File_read::make_view): New function, broken out of
10760         find_and_make_view.
10761         (File_read::find_or_make_view): Add offset and aligned
10762         parameters.  Rewrite accordingly.  Change all callers.
10763         (File_read::get_view): Add offset and aligned parameters.  Adjust
10764         for byteshift in return value.
10765         (File_read::get_lasting_view): Likewise.
10766         * fileread.h (class File_read): Update declarations.
10767         (class File_read::View): Add byteshift_ field.  Add byteshift to
10768         constructor.  Add byteshift method.
10769         * archive.h (Archive::clear_uncached_views): New function.
10770         (Archive::get_view): Add aligned parameter.  Change all callers.
10771         * object.h (Object::get_view): Add aligned parameter.  Change all
10772         callers.
10773         (Object::get_lasting_view): Likewise.
10774
10775         * fileread.cc (File_read::release): Don't call clear_views if
10776         there are multiple objects.
10777         * fileread.h (File_read::clear_uncached_views): New function.
10778         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10779         on the archive.
10780
10781 2008-03-31  Cary Coutant  <ccoutant@google.com>
10782
10783         Add thin archive support.
10784         * archive.cc (Archive::armagt): New const.
10785         (Archive::setup): Remove task parameter and calls to unlock.
10786         (Archive::unlock_nested_archives): New function.
10787         (Archive::read_header): Add nested_off parameter. Change
10788         all callers.
10789         (Archive::interpret_header): Likewise.
10790         (Archive::include_all_members): Change to handle thin
10791         archives.
10792         (Archive::include_member): Likewise.
10793         * archive.h (Archive::Archive): Add new parameters and
10794         initializers.
10795         (Archive::armagt): New const.
10796         (Archive::setup): Remove task parameter.
10797         (Archive::unlock_nested_archives): New function.
10798         (Archive::read_header): Add nested_off parameter.
10799         (Archive::interpret_header): Likewise.
10800         (Archive::Nested_archive_table): New typedef.
10801         (Archive::is_thin_archive_): New field.
10802         (Archive::nested_archives_): New field.
10803         (Archive::options_): New field.
10804         (Archive::dirpath_): New field.
10805         (Archive::task_): New field.
10806         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10807         for thin archives.  Pass additional parameters to
10808         Archive::Archive.  Unlock the archive file after calling
10809         Archive::setup.
10810
10811 2008-03-29  Ian Lance Taylor  <iant@google.com>
10812
10813         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10814         version symbol to be local.
10815         * testsuite/ver_test_4.sh: New file.
10816         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10817         (check_DATA): Add ver_test_4.syms.
10818         (ver_test_4.syms): New target.
10819         * testsuite/Makefile.in: Rebuild.
10820
10821         * output.cc
10822         (Output_section::Input_section_sort_entry::has_priority): New
10823         function.
10824         (Output_section::Input_section_sort_entry::match_file_name): New
10825         function.
10826         (Output_section::Input_section_sort_entry::match_section_name):
10827         Remove.
10828         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10829         Remove.
10830         (Output_section::Input_section_sort_entry::match_section_file):
10831         Remove.
10832         (Output_section::Input_section_sort_compare::operator()): Rewrite
10833         using new Input_section_sort_entry functions.  Sort crtbegin and
10834         crtend first.  Sort sections with no priority before sections with
10835         a priority.
10836         * testsuite/initpri1.c (d3): Check j != 4.
10837         (cd5): New constructor/destructor function.
10838         (main): Check j != 2.
10839
10840         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10841         new symbol when resolving, don't call set_is_default.
10842         * testsuite/ver_test_7.cc: New file.
10843         * testsuite/ver_test_7.sh: New file.
10844         * testsuite/Makefile.am (ver_test_7.so): New target.
10845         (ver_test_7.o): New target.
10846         (check_SCRIPTS): Add ver_test_7.sh.
10847         (check_DATA): Add ver_test_7.syms.
10848         (ver_test_7.syms): New target.
10849
10850 2008-03-28  Ian Lance Taylor  <iant@google.com>
10851
10852         * layout.cc (Layout::layout): If we see an input section with a
10853         name that needs sorting, set the must_sort flag for the output
10854         section.
10855         (Layout::make_output_section): If the name of the output section
10856         indicates that it might require sorting, set the may_sort flag.
10857         * output.h (Output_section::may_sort_attached_input_sections): New
10858         function.
10859         (Output_section::set_may_sort_attached_input_sections): New
10860         function.
10861         (Output_section::must_sort_attached_input_sections): New
10862         function.
10863         (Output_section::set_must_sort_attached_input_sections): New
10864         function.
10865         (class Output_section): Declare Input_section_sort_entry.  Define
10866         Input_section_sort_compare.  Declare
10867         sort_attached_input_sections.  Add new fields:
10868         may_sort_attached_input_sections_,
10869         must_sort_attached_input_sections_,
10870         attached_input_sections_are_sorted_.
10871         * output.cc (Output_section::Output_section): Initialize new
10872         fields.
10873         (Output_section::add_input_section): Add an entry to
10874         input_sections_ if may_sort or must_sort are true.
10875         (Output_section::set_final_data_size): Call
10876         sort_attached_input_sections if necessary.
10877         (Output_section::Input_section_sort_entry): Define new class.
10878         (Output_section::Input_section_sort_compare::operator()): New
10879         function.
10880         (Output_section::sort_attached_input_sections): New function.
10881         * configure.ac: Check whether the compiler supports constructor
10882         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10883         * testsuite/initpri1.c: New file.
10884         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10885         CONSTRUCTOR_PRIORITY.
10886         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10887         (initpri1_LDFLAGS): New variable.
10888         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10889
10890 2008-03-27  Ian Lance Taylor  <iant@google.com>
10891
10892         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10893         * testsuite/common_test_1.c: New file.
10894         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10895         (common_test_1_SOURCES): New variable.
10896         (common_test_1_DEPENDENCIES): New variable.
10897         (common_test_1_LDFLAGS): New variable.
10898
10899         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10900         and commons_ correctly when NAME/VERSION does not override
10901         NAME/NULL.
10902         * testsuite/ver_test_6.c: New file.
10903         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10904         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10905         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10906
10907 2008-03-26  Ian Lance Taylor  <iant@google.com>
10908
10909         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10910         of an undefined symbol from a version script.
10911         * testsuite/Makefile.am (ver_test_5.so): New target.
10912         (ver_test_5.o): New target.
10913         (check_SCRIPTS): Add ver_test_5.sh.
10914         (check_DATA): Add ver_test_5.syms.
10915         (ver_test_5.syms): New target.
10916         * testsuite/ver_test_5.cc: New file.
10917         * testsuite/ver_test_5.script: New file.
10918         * testsuite/ver_test_5.sh: New file.
10919         * Makefile.in, testsuite/Makefile.in: Rebuild.
10920
10921         PR gold/5986
10922         Fix problems building gold with gcc 4.3.0.
10923         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10924         (gold_error_at_location, gold_warning_at_location): Use it.
10925         * configure.ac: Check whether we can compile and use a template
10926         function with a printf attribute.
10927         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10928         when jumping over bytes.
10929         * object.cc: Instantiate Object::read_section_data.
10930         * debug.h: Include <cstring>
10931         * dwarf_reader.cc: Include <algorithm>
10932         * main.cc: Include <cstring>.
10933         * options.cc: Include <cstring>.
10934         * output.cc: Include <cstring>.
10935         * script.cc: Include <cstring>.
10936         * script.h: Include <string>.
10937         * symtab.cc: Include <cstring> and <algorithm>.
10938         * target-select.cc: Include <cstring>.
10939         * version.cc: Include <string>.
10940         * testsuite/testmain.cc: Include <cstdlib>.
10941         * configure, config.in: Rebuild.
10942
10943 2008-03-25  Ian Lance Taylor  <iant@google.com>
10944
10945         * options.cc: Include "../bfd/bfdver.h".
10946         (options::help): Print bug reporting address.
10947
10948         * version.cc (print_version): Adjust output for current value of
10949         BFD_VERSION_STRING.
10950
10951         * NEWS: New file.
10952
10953         * options.cc (options::help): Print list of supported targets.
10954         * target-select.h: Include <vector>.
10955         (class Target_selector): Make machine_, size_, and is_big_endian_
10956         fields const.  Add bfd_name_ and instantiated_target_ fields.
10957         (Target_selector::Target_selector): Add bfd_name parameter.
10958         (Target_selector::recognize): Make non-virtual, call
10959         do_recognize.
10960         (Target_selector::recognize_by_name): Make non-virtual, call
10961         do_recognize_by_name.
10962         (Target_selector::supported_names): New function.
10963         (Target_selector::bfd_name): New function.
10964         (Target_selector::do_instantiate_target): New pure virtual
10965         function.
10966         (Target_selector::do_recognize): New virtual function.
10967         (Target_selector::do_recognize_by_name): New virtual function.
10968         (Target_selector::instantiate_target): New private function.
10969         (supported_target_names): Declare.
10970         * target-select.cc (Target_selector::Target_selector): Update for
10971         new parameter and fields.
10972         (select_target_by_name): Check that the name matches before
10973         calling recognize_by_name.
10974         (supported_target_names): New function.
10975         * i386.cc (class Target_selector_i386): Update Target_selector
10976         constructor call.  Remove recognize and recognize_by_name.  Add
10977         do_instantiate_target.
10978         * x86_64.cc (class Target_selector_x86_64): Likewise.
10979         * testsuite/testfile.cc (class Target_selector_test): Update for
10980         changes to Target_selector.
10981
10982         * README: Rewrite, with some notes on unsupported features.
10983
10984 2008-03-24  Cary Coutant  <ccoutant@google.com>
10985
10986         * i386.cc (Target_i386::Got_type): New enum declaration.
10987         (Target_i386::Scan::local): Updated callers of Output_data_got
10988         member functions.
10989         (Target_i386::Scan::global): Likewise.
10990         (Target_i386::Relocate::relocate): Likewise.
10991         (Target_i386::Relocate::relocate_tls): Likewise.
10992         * object.h (Got_offset_list): New class.
10993         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10994         (Sized_relobj::local_got_offset): Likewise.
10995         (Sized_relobj::set_local_got_offset): Likewise.
10996         (Sized_relobj::local_has_tls_got_offset): Removed.
10997         (Sized_relobj::local_tls_got_offset): Removed.
10998         (Sized_relobj::set_local_tls_got_offset): Removed.
10999         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11000         * output.cc (Output_data_got::add_global): Added got_type parameter.
11001         (Output_data_got::add_global_with_rel): Likewise.
11002         (Output_data_got::add_global_with_rela): Likewise.
11003         (Output_data_got::add_global_pair_with_rel): New function.
11004         (Output_data_got::add_global_pair_with_rela): New function.
11005         (Output_data_got::add_local): Added got_type parameter.
11006         (Output_data_got::add_local_with_rel): Likewise.
11007         (Output_data_got::add_local_with_rela): Likewise.
11008         (Output_data_got::add_local_pair_with_rel): New function.
11009         (Output_data_got::add_local_pair_with_rela): New function.
11010         (Output_data_got::add_global_tls): Removed.
11011         (Output_data_got::add_global_tls_with_rel): Removed.
11012         (Output_data_got::add_global_tls_with_rela): Removed.
11013         (Output_data_got::add_local_tls): Removed.
11014         (Output_data_got::add_local_tls_with_rel): Removed.
11015         (Output_data_got::add_local_tls_with_rela): Removed.
11016         * output.h (Output_data_got::add_global): Added got_type parameter.
11017         (Output_data_got::add_global_with_rel): Likewise.
11018         (Output_data_got::add_global_with_rela): Likewise.
11019         (Output_data_got::add_global_pair_with_rel): New function.
11020         (Output_data_got::add_global_pair_with_rela): New function.
11021         (Output_data_got::add_local): Added got_type parameter.
11022         (Output_data_got::add_local_with_rel): Likewise.
11023         (Output_data_got::add_local_with_rela): Likewise.
11024         (Output_data_got::add_local_pair_with_rel): New function.
11025         (Output_data_got::add_local_pair_with_rela): New function.
11026         (Output_data_got::add_global_tls): Removed.
11027         (Output_data_got::add_global_tls_with_rel): Removed.
11028         (Output_data_got::add_global_tls_with_rela): Removed.
11029         (Output_data_got::add_local_tls): Removed.
11030         (Output_data_got::add_local_tls_with_rel): Removed.
11031         (Output_data_got::add_local_tls_with_rela): Removed.
11032         * resolve.cc (Symbol::override_base_with_special): Removed
11033         reference to has_got_offset_ field.
11034         * symtab.cc (Symbol::init_fields): Replaced initialization
11035         of got_offset_ with got_offsets_.  Removed initialization
11036         of has_got_offset_
11037         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11038         (Symbol::got_offset): Likewise.
11039         (Symbol::set_got_offset): Likewise.
11040         (Symbol::has_tls_got_offset): Removed.
11041         (Symbol::tls_got_offset): Removed.
11042         (Symbol::set_tls_got_offset): Removed.
11043         (Symbol::got_offset_): Removed.
11044         (Symbol::tls_mod_got_offset_): Removed.
11045         (Symbol::tls_pair_got_offset_): Removed.
11046         (Symbol::got_offsets_): New field.
11047         (Symbol::has_got_offset): Removed.
11048         (Symbol::has_tls_mod_got_offset): Removed.
11049         (Symbol::has_tls_pair_got_offset): Removed.
11050         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11051         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11052         member functions.
11053         (Target_x86_64::Scan::global): Likewise.
11054         (Target_x86_64::Relocate::relocate): Likewise.
11055         (Target_x86_64::Relocate::relocate_tls): Likewise.
11056
11057 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11058
11059         * yyscript.y: Fix spelling error in comment.
11060
11061 2008-03-24  Ian Lance Taylor  <iant@google.com>
11062
11063         * options.h (class General_options): Define build_id option.
11064         * layout.h (class Layout): Declare write_build_id, create_note,
11065         create_build_id.  Add build_id_note_ member.
11066         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11067         "libiberty.h", "md5.h", "sha1.h".
11068         (Layout::Layout): Initialize eh_frame_data_,
11069         eh_frame_hdr_section_, and build_id_note_.
11070         (Layout::finalize): Call create_build_id.
11071         (Layout::create_note): New function, broken out of
11072         Layout::create_gold_note.
11073         (Layout::create_gold_note): Call create_note.
11074         (Layout::create_build_id): New function.
11075         (Layout::write_build_id): New function.
11076         (Close_task_runner::run): Call write_build_id.
11077
11078         * x86_64.cc: Correct license to GPLv3.
11079
11080 2008-03-23  Ian Lance Taylor  <iant@google.com>
11081
11082         * options.cc: Include "demangle.h".
11083         (parse_optional_string): New function.
11084         (parse_long_option): Handle takes_optional_argument.
11085         (parse_short_option): Update dash_z initializer.  Handle
11086         takes_optional_argument.
11087         (General_options::General_options): Initialize do_demangle_.
11088         (General_options::finalize): Set do_demangle_.  Handle demangling
11089         style.
11090         * options.h (parse_optional_string): Declare.
11091         (struct One_option): Add optional_arg field.  Update constructor.
11092         Update call constructor calls.  Add takes_optional_argument
11093         function.
11094         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11095         (DEFINE_optional_string): Define.
11096         (General_options::demangle): Change from DEFINE_bool to
11097         DEFINE_optional_string.
11098         (General_options::no_demangle): New function.
11099         (General_options::do_demangle): New function.
11100         (General_options::set_do_demangle): New function.
11101         (General_options::execstack_status_): Move definition to end of
11102         class definition.
11103         (General_options::static_): Likewise.
11104         (General_options::do_demangle_): New field.
11105         * object.cc (big_endian>::get_symbol_location_info): Call
11106         Options::do_demangle, not Options::demangle.
11107         * symtab.cc (demangle): Likewise.
11108
11109 2008-03-22  Ian Lance Taylor  <iant@google.com>
11110
11111         * gold.h: Include <cstddef> and <sys/types.h>
11112         * options.h: Include <cstring>.
11113
11114 2008-03-21  Ian Lance Taylor  <iant@google.com>
11115
11116         * Added source code to GNU binutils.